diff --git a/library/plugin-store-carrier-wiki.html b/library/plugin-store-carrier-wiki.html index 6d28d219..460af952 100644 --- a/library/plugin-store-carrier-wiki.html +++ b/library/plugin-store-carrier-wiki.html @@ -309,7 +309,7 @@ {"title":"$:/plugins/xyvir/lithic-patch-markdown","author":"Xyvir","description":"Configuration patches and UI additions to optimize the native Markdown parsing and editing experience.","name":"Markdown_LithicPatch","plugin-type":"plugin","parent-plugin":"$:/plugins/tiddlywiki/markdown","version":"0.0.2","plugin-priority":"2","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/config/PageControlButtons/Visibility/$:/plugins/tiddlywiki/markdown/new-markdown-button\":{\"title\":\"$:/config/PageControlButtons/Visibility/$:/plugins/tiddlywiki/markdown/new-markdown-button\",\"text\":\"hide\"},\"$:/config/markdown/breaks\":{\"title\":\"$:/config/markdown/breaks\",\"tags\":\"\",\"text\":\"true\"},\"$:/config/markdown/linkify\":{\"title\":\"$:/config/markdown/linkify\",\"created\":\"20260529164350392\",\"modified\":\"20260529164350392\",\"text\":\"true\"},\"$:/plugins/tiddlywiki/markdown/new-markdown-button\":{\"title\":\"$:/plugins/tiddlywiki/markdown/new-markdown-button\",\"caption\":\"{{$:/plugins/tiddlywiki/markdown/images/new-markdown-button}} {{$:/language/Buttons/NewMarkdown/Caption}}\",\"description\":\"{{$:/language/Buttons/NewMarkdown/Hint}}\",\"tags\":\"$:/tags/PageControls\",\"text\":\"\\\\whitespace trim\\n\u003C$button tooltip={{$:/language/Buttons/NewMarkdown/Hint}} aria-label={{$:/language/Buttons/NewMarkdown/Caption}} class=\u003C\u003Ctv-config-toolbar-class>>>\\n\u003C$action-sendmessage $message=\\\"tm-new-tiddler\\\" type=\\\"text/markdown\\\"/>\\n\u003C%if [\u003Ctv-config-toolbar-icons>match[yes]] %>\\n{{$:/plugins/tiddlywiki/markdown/images/new-markdown-button}}\\n\u003C%endif%>\\n\u003C%if [\u003Ctv-config-toolbar-text>match[yes]] %>\\n\u003Cspan class=\\\"tc-btn-text\\\">\u003C$text text={{$:/language/Buttons/NewMarkdown/Caption}}/>\u003C/span>\\n\u003C%endif%>\\n\u003C/$button>\\n\"}}}"}, {"title":"$:/plugins/xyvir/lithic-patch-mermaid","description":"Lithic Mermaid engine: the \u003C$mermaid> widget, rendered by the vendored pele engine, its stylesheets, and the Pyramid sidebar view, which renders the active stream node as a mermaid tree. Everything here needs this plugin, so it belongs behind it rather than in lithic-core. A build without it loses the view instead of shipping a sidebar tab whose \u003C$mermaid> widget does not exist.","author":"Lithic","core-version":">=5.0.0","version":"0.1.0","plugin-type":"plugin","list":"readme","priority":"2","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/lithic/styles/pyramid.css\":{\"title\":\"$:/lithic/styles/pyramid.css\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/*\\nPyramid sidebar ($:/lithic/ui/SideBar/Pyramid): converts the active nodestream\\ninto a mermaid tree and marks the node mirroring the tiddler currently being\\nedited with the `activeStyle` class (see the macro's `:::activeStyle` hints).\\n\\npele keeps those class names on each node group (g.pele-node.activeStyle), so\\nthe active node is styled by class and inherits the palette theme for everything\\nelse. Only the active node needs special handling here.\\n\\nThis sheet is text/css: TW's wikitext stylesheet parser rewrites the\\n--lithic-c-* double hyphens into en-dashes inside text/vnd.tiddlywiki sheets.\\n*/\\n\\n/* Active node fill/border = accent pair (accent-fg is derived >= 4.5:1 on accent) */\\ndiv.mm-themed:not(.mm-user) .pele-node.activeStyle :is(rect, path, polygon, circle, ellipse) {\\n fill: var(--lithic-c-accent) !important;\\n stroke: var(--lithic-c-accent-fg) !important;\\n stroke-width: 2px !important;\\n}\\n\\n/* Active node label keeps the derived accent foreground */\\ndiv.mm-themed:not(.mm-user) .pele-node.activeStyle text,\\ndiv.mm-themed:not(.mm-user) .pele-node.activeStyle tspan {\\n fill: var(--lithic-c-accent-fg) !important;\\n font-weight: bold !important;\\n}\"},\"$:/lithic/ui/SideBar/Pyramid\":{\"title\":\"$:/lithic/ui/SideBar/Pyramid\",\"tags\":\"$:/tags/SideBar $:/tags/Macro\",\"caption\":\"Pyramid\",\"description\":\"Displays a hierarchical pyramid of the active stream node\",\"text\":\"\\\\define traverse(node, parentId, depth)\\n\\\\whitespace trim\\n\u003C$let dq='\\\"' quot=\\\"#quot;\\\" lcb=\\\"{\\\" rcb=\\\"}\\\" lp=\\\"(\\\" rp=\\\")\\\">\\n\u003C$list filter=\\\"[\u003C__depth__>compare:number:gt[0]]\\\" variable=\\\"ignore\\\">\\n \u003C$list filter=\\\"[\u003C__node__>get[stream-list]enlist-input[]]\\\" variable=\\\"childNode\\\" counter=\\\"nodeIndex\\\">\\n \u003C$set name=\\\"currentId\\\" value={{{ [\u003C__parentId__>addsuffix[_]addsuffix\u003CnodeIndex>] }}}>\\n \u003C$set name=\\\"nodeClass\\\" value={{{ [\u003CchildNode>match\u003CactiveNode>then[activeStyle]else[childStyle]] }}}>\\n \u003C$set name=\\\"safeText\\\" value={{{ [\u003CchildNode>get[text]else\u003CchildNode>splitregexp[\\\\r?\\\\n]first[]search-replace::regexp[^#{1,6} *],[]search-replace:g\u003Cdq>,\u003Cquot>search-replace:g\u003Clcb>,\u003Clp>search-replace:g\u003Crcb>,\u003Crp>] }}}>\\n\u003C$text text=\u003C\u003Cnl>>/>\u003C\u003C__parentId__>> \u003C$text text=\\\"---\\\" /> \u003C\u003CcurrentId>>[\\\"\u003C\u003CsafeText>>\\\"]:::\u003C\u003CnodeClass>>\\n \u003C$macrocall $name=\\\"traverse\\\" node=\u003C\u003CchildNode>> parentId=\u003C\u003CcurrentId>> depth={{{ [\u003C__depth__>subtract[1]] }}} />\\n \u003C/$set>\\n \u003C/$set>\\n \u003C/$set>\\n \u003C/$list>\\n\u003C/$list>\\n\u003C/$let>\\n\\\\end\\n\\n\\\\define build-pyramid-data(rootNode)\\n\\\\whitespace trim\\n\u003C$let nl={{{ [charcode[10]] }}} dq='\\\"' quot=\\\"#quot;\\\" lcb=\\\"{\\\" rcb=\\\"}\\\" lp=\\\"(\\\" rp=\\\")\\\">\\n\u003C$set name=\\\"parentClass\\\" value={{{ [\u003C__rootNode__>match\u003CactiveNode>then[activeStyle]else[parentStyle]] }}}>\\n\u003C$set name=\\\"safeParentText\\\" value={{{ [\u003C__rootNode__>get[text]else\u003C__rootNode__>splitregexp[\\\\r?\\\\n]first[]search-replace::regexp[^#{1,6} *],[]search-replace:g\u003Cdq>,\u003Cquot>search-replace:g\u003Clcb>,\u003Clp>search-replace:g\u003Crcb>,\u003Crp>] }}}>\\ngraph TD\\n\u003C$text text=\u003C\u003Cnl>>/>\u003C$text text=\u003C\u003Cnl>>/>Parent[\\\"\u003C\u003CsafeParentText>>\\\"]:::\u003C\u003CparentClass>>\\n\u003C$macrocall $name=\\\"traverse\\\" node=\u003C\u003C__rootNode__>> parentId=\\\"Parent\\\" depth=\\\"4\\\" />\\n\u003C/$set>\\n\u003C/$set>\\n\u003C/$let>\\n\\\\end\\n\\n\\\\define pyramid(tiddler)\\n\u003C$set name=\\\"targetNode\\\" value={{{ [\u003C__tiddler__>!is[blank]else\u003CcurrentTiddler>] }}}>\\n\u003C$set name=\\\"activeNode\\\" value={{{ [prefix[$:/state/sq/streams/current-edit-tiddler]get[text]first[]] }}}>\\n \u003C$list filter=\\\"[\u003CtargetNode>has[stream-list]]\\\" emptyMessage=\\\"*No child streams to display for this node.*\\\">\\n \u003C$wikify name=\\\"pyramidData\\\" text=\\\"\u003C$macrocall $name='build-pyramid-data' rootNode=\u003C\u003CtargetNode>> />\\\">\\n \u003C$let nl={{{ [charcode[10]] }}} fullChart={{{ [\u003CpyramidData>] }}}>\\n \u003C$mermaid text=\u003C\u003CfullChart>> fontFamily=\\\"Vollkorn\\\" />\\n \u003Cdiv style=\\\"display:flex; justify-content:flex-end; margin-top:4px;\\\">\\n \u003C$button message=\\\"tm-copy-to-clipboard\\\" param=\u003C\u003CpyramidData>> tooltip=\\\"Copy mermaid code\\\" class=\\\"tc-btn-invisible tc-btn-mini tc-tiddlylink\\\">\\n copy\\n \u003C/$button>\\n \u003C/div>\\n \u003C/$let>\\n \u003C/$wikify>\\n \u003C/$list>\\n\u003C/$set>\\n\u003C/$set>\\n\\\\end\\n\\n\u003C$tiddler tiddler={{{ [list[$:/StoryList]first[]] }}}>\\n \u003C$macrocall $name=\\\"pyramid\\\" tiddler=\u003C\u003CcurrentTiddler>> />\\n\u003C/$tiddler>\"},\"$:/plugins/orange/mermaid-tw5/config\":{\"title\":\"$:/plugins/orange/mermaid-tw5/config\",\"type\":\"application/json\",\"tags\":\"[[$:/tags/ControlPanel/Settings]]\",\"text\":\"{\\\"fontFamily\\\":\\\"Vollkorn\\\"}\"},\"$:/plugins/orange/mermaid-tw5/styles\":{\"title\":\"$:/plugins/orange/mermaid-tw5/styles\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Theming for Mermaid diagrams drawn by the pele engine.\\n\\n pele reads its colours from --pele-* custom properties on the diagram's\\n container. Those are mapped onto the palette's contrast roles here, so a\\n palette switch re-themes every diagram without re-rendering it. Diagrams that\\n declare their own styling (container class mm-user) keep their own colours on\\n the parts the author styled, and pele's theme still covers the rest.\\n\\n The variables are read from the --lithic-c-* palette published by\\n $:/plugins/xyvir/lithic-core/contrast-publisher.js. */\\n\\ndiv.mm-themed {\\n --pele-bg: var(--lithic-c-page);\\n --pele-fg: var(--lithic-c-node-fg);\\n --pele-muted: var(--lithic-c-foreground-muted);\\n --pele-line: var(--lithic-c-line);\\n --pele-surface: var(--lithic-c-node-bg);\\n --pele-surface-alt: var(--lithic-c-cluster-bg);\\n --pele-border: var(--lithic-c-node-border);\\n --pele-accent: var(--lithic-c-accent);\\n --pele-critical: var(--lithic-c-code-warn);\\n --pele-error: var(--lithic-c-code-warn);\\n --pele-radius: 4px;\\n}\\n\\n/* =========================================================\\n PRINT: greyscale for all mermaid diagrams\\n\\n Diagrams should never print palette colours. Redefining the\\n --pele-* variables to print greys re-themes the whole diagram\\n with no selector duplication, and the grayscale filter catches\\n anything an author styled with explicit colours.\\n ========================================================= */\\n@media print {\\n div.mm-themed {\\n --pele-bg: #ffffff;\\n --pele-fg: #000000;\\n --pele-muted: #444444;\\n --pele-line: #000000;\\n --pele-surface: #f2f2f2;\\n --pele-surface-alt: #ffffff;\\n --pele-border: #000000;\\n --pele-accent: #000000;\\n --pele-critical: #000000;\\n --pele-error: #000000;\\n background: #ffffff !important;\\n filter: grayscale(1) !important;\\n -webkit-print-color-adjust: exact !important;\\n print-color-adjust: exact !important;\\n }\\n}\"},\"$:/plugins/orange/mermaid-tw5/wrapper.js\":{\"title\":\"$:/plugins/orange/mermaid-tw5/wrapper.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\ntitle: $:/plugins/orange/mermaid-tw5/wrapper.js\\ntype: application/javascript\\nmodule-type: widget\\nauthor: Nathaniel Jones 2017-05-26\\nmodified: Lithic 2026-10-19 (engine swap: diagrams render through the vendored pele engine instead of mermaid.js; pele owns layout, zoom controls and font-aware sizing; the Mermaid-only rocklib, d3 and render queue are gone; source handling and the self-heal ladder are unchanged)\\n*/\\n(function() {\\n // jslint node: true, browser: true\\n // global $tw: false\\n 'use strict';\\n\\n // Soft dependency: if the pele engine or the wiki core is missing, bail at\\n // load time with a warning instead of aborting the whole TiddlyWiki boot.\\n var Widget, pele;\\n try {\\n Widget = require('$:/core/modules/widgets/widget.js').widget;\\n pele = require('$:/plugins/xyvir/lithic-patch-mermaid/pele.js').pele;\\n } catch (bootDepErr) {\\n console.warn('[lithic-patch-mermaid] pele engine not available; \u003C$mermaid> disabled.');\\n return;\\n }\\n\\n var CONFIG_TITLE = '$:/plugins/orange/mermaid-tw5/config',\\n DEFAULT_FONT = 'Vollkorn',\\n uniqueID = 1;\\n\\n function escapeHtml(text) {\\n if (text === null || text === undefined) {\\n return '';\\n }\\n return String(text)\\n .replace(/&/g, '&')\\n .replace(/\u003C/g, '<')\\n .replace(/>/g, '>')\\n .replace(/\\\"/g, '"');\\n }\\n\\n var NAMED_ENTITIES = { amp: '&', lt: '\u003C', gt: '>', quot: '\\\"', apos: \\\"'\\\", nbsp: '\\\\u00a0' };\\n\\n // doc is the widget's document: the browser's, or TiddlyWiki's fake DOM\\n // when the library build renders in Node, where there is no global document.\\n function decodeHtmlEntities(text, doc) {\\n if (!text) return text;\\n if (doc && doc.createElement) {\\n var el = doc.createElement('textarea');\\n el.innerHTML = text;\\n if (typeof el.value === 'string') return el.value;\\n }\\n return text.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/gi, function(match, body) {\\n if (body.charAt(0) === '#') {\\n var code = body.charAt(1) === 'x' || body.charAt(1) === 'X' ? parseInt(body.slice(2), 16) : parseInt(body.slice(1), 10);\\n return isNaN(code) ? match : String.fromCodePoint(code);\\n }\\n return NAMED_ENTITIES.hasOwnProperty(body.toLowerCase()) ? NAMED_ENTITIES[body.toLowerCase()] : match;\\n });\\n }\\n\\n // ---- ROBUST SOURCE EXTRACTION --------------------------------------\\n // Decodes every entity (the upstream tree-walk only knew five and passed the\\n // rest through as literal text, which then failed to parse) and keeps line\\n // structure.\\n function decodeEntity(entity) {\\n if (!entity) return '';\\n var named = {\\n '–': '--', // wikitext turns -- into en-dash; keep upstream heal\\n '—': '---', // same for ---\\n '>': '>', '<': '\u003C', '&': '&', '"': '\\\"',\\n ' ': ' ',\\n '‘': \\\"'\\\", '’': \\\"'\\\", '‚': \\\"'\\\",\\n '“': '\\\"', '”': '\\\"',\\n '…': '...', '•': '*', '·': '*',\\n '−': '-', '∗': '*', '±': '+/-'\\n };\\n if (named[entity] !== undefined) return named[entity];\\n var m = /^&#(\\\\d+);$/.exec(entity);\\n if (m) {\\n var code = parseInt(m[1], 10);\\n if (code > 0 && code \u003C= 0x10FFFF) {\\n try { return String.fromCodePoint(code); } catch (e) {}\\n }\\n }\\n m = /^&#x([0-9a-f]+);$/i.exec(entity);\\n if (m) {\\n var code2 = parseInt(m[1], 16);\\n if (code2 > 0 && code2 \u003C= 0x10FFFF) {\\n try { return String.fromCodePoint(code2); } catch (e) {}\\n }\\n }\\n // any other named entity: let the DOM decode it; unparseable stays literal\\n try {\\n var el = document.createElement('textarea');\\n el.innerHTML = entity;\\n if (el.value !== undefined && el.value !== '') return el.value;\\n } catch (e) {}\\n return entity;\\n }\\n\\n function extractDiagramSource(widget) {\\n var attr = widget.getAttribute('text', '');\\n if (attr) return String(attr);\\n var node = widget.parseTreeNode;\\n if (!node) return '';\\n if (typeof node.text === 'string') return node.text;\\n if (!node.children || !node.children.length) return '';\\n var out = '';\\n var walk = function(nodes) {\\n for (var i = 0; i \u003C nodes.length; i++) {\\n var n = nodes[i];\\n if (!n) continue;\\n if (n.type === 'text') { out += (n.text || ''); continue; }\\n if (n.type === 'entity') { out += decodeEntity(n.entity); continue; }\\n if (n.type === 'element') {\\n if (n.tag === 'br') { out += '\\\\n'; continue; }\\n if (n.children && n.children.length) {\\n walk(n.children);\\n if (n.tag === 'div' || n.tag === 'p') out += '\\\\n';\\n }\\n continue;\\n }\\n if (n.children && n.children.length) walk(n.children);\\n }\\n };\\n walk(node.children);\\n return out;\\n }\\n\\n // ---- POISON-CHARACTER SANITIZER -------------------------------------\\n // Diagram sources reach this widget via typing, paste, tiddler import and\\n // markdown transclusion; those paths can leave invisible or typographic\\n // characters the diagram grammar rejects. Each replacement maps such a\\n // character onto its plain-ASCII meaning.\\n function sanitizeDiagramSource(src) {\\n if (!src) return src;\\n var s = String(src);\\n // BOM + line/paragraph separators -> plain newlines; CRLF -> LF\\n s = s.replace(/^\\\\uFEFF/, '').replace(/\\\\u2028|\\\\u2029/g, '\\\\n').replace(/\\\\r\\\\n?/g, '\\\\n');\\n // zero-width characters and bidi controls (invisible paste artifacts)\\n s = s.replace(/[\\\\u200B-\\\\u200D\\\\u2060\\\\uFEFF\\\\u202A-\\\\u202E\\\\u2066-\\\\u2069]/g, '');\\n // every Unicode whitespace variant -> plain space\\n s = s.replace(/[\\\\u00A0\\\\u1680\\\\u2000-\\\\u200A\\\\u202F\\\\u205F\\\\u3000]/g, ' ');\\n // C0 controls (except tab/newline) and DEL -- pure poison, no meaning\\n s = s.replace(/[\\\\u0000-\\\\u0008\\\\u000B\\\\u000C\\\\u000E-\\\\u001F\\\\u007F]/g, '');\\n // typographic punctuation the grammar never accepts\\n s = s.replace(/\\\\u2212/g, '-')\\n .replace(/[\\\\u2010\\\\u2011]/g, '-')\\n .replace(/[\\\\u2018\\\\u2019\\\\u201B]/g, \\\"'\\\")\\n .replace(/[\\\\u201C\\\\u201D]/g, '\\\"')\\n .replace(/\\\\u2032/g, \\\"'\\\")\\n .replace(/\\\\u2033/g, '\\\"')\\n .replace(/\\\\u2026/g, '...');\\n return s;\\n }\\n\\n // ---- SELF-HEAL RENDER LADDER -----------------------------------------\\n // Attempt 1 is the sanitized source; attempt 2 (only if attempt 1 fails)\\n // drops every %%{...}%% directive, since a malformed directive is the most\\n // common hand-edit failure and default rendering beats an error box.\\n function buildRenderAttempts(source) {\\n var attempts = [{ label: 'sanitized', text: source }];\\n if (/%%\\\\{[\\\\s\\\\S]*?%%/.test(source)) {\\n attempts.push({\\n label: 'directives-stripped',\\n text: source.replace(/%%\\\\{[\\\\s\\\\S]*?}%%/g, '').trim()\\n });\\n }\\n return attempts;\\n }\\n\\n // Style gating: a diagram that declares its own styling keeps it. The\\n // container gets `mm-user`, which opts it out of the palette defaults in\\n // the stylesheet. Over-detection is safe: the diagram just keeps the\\n // engine's own colours.\\n function hasSelfStyling(source) {\\n if (!source) return false;\\n if (/%%\\\\s*\\\\{\\\\s*(init|config)\\\\s*:/i.test(source)) return true;\\n if (/^\\\\s*(style|classDef|linkStyle)\\\\s+\\\\S/m.test(source)) return true;\\n return false;\\n }\\n\\n // Site typeface: the Pyramid pins Vollkorn per widget; other diagrams read\\n // the config tiddler and fall back to Vollkorn. Only a plain family name is\\n // accepted, since it is handed to the measurer and to a CSS font list.\\n function siteFontFamily() {\\n var data = $tw.wiki.getTiddlerData(CONFIG_TITLE, {});\\n var family = data && typeof data.fontFamily === 'string' ? data.fontFamily : '';\\n return (/^[\\\\w\\\\s,'-]+$/.test(family) && family) || DEFAULT_FONT;\\n }\\n\\n function errorBox(source, ex) {\\n var name = (ex && ex.name) || 'Error';\\n var message = (ex && ex.message) || String(ex);\\n return '\u003Cdiv style=\\\"border-left:3px solid var(--lithic-c-code-warn);background:var(--lithic-c-note-bg);padding:8px 12px;\\\">' +\\n '\u003Cp>\u003Cstrong>Mermaid diagram could not be rendered.\u003C/strong> The diagram syntax may contain an error.\u003C/p>' +\\n '\u003Cpre style=\\\"margin:8px 0;padding:6px;background:var(--lithic-c-code-bg);border:1px solid var(--lithic-c-code-border);overflow:auto;\\\">' +\\n escapeHtml(source) +\\n '\u003C/pre>' +\\n '\u003Cdetails>' +\\n '\u003Csummary style=\\\"cursor:pointer;color:var(--lithic-c-foreground-muted);font-size:12px;\\\">Technical details\u003C/summary>' +\\n '\u003Cp style=\\\"margin:8px 0 0 0;font-size:12px;\\\">\u003Cstrong>' + escapeHtml(name) + ':\u003C/strong> ' +\\n escapeHtml(message) + '\u003C/p>' +\\n '\u003C/details>' +\\n '\u003C/div>';\\n }\\n\\n var MermaidWidget = function(parseTreeNode, options) {\\n this.initialise(parseTreeNode, options);\\n };\\n MermaidWidget.prototype = new Widget();\\n\\n MermaidWidget.prototype.render = function(parent, nextSibling) {\\n this.parentDomNode = parent;\\n this.computeAttributes();\\n this.execute();\\n\\n var rawBody = extractDiagramSource(this) || '';\\n var source = String(rawBody).trim();\\n // Entities first, then the dash repair TiddlyWiki's parser applies to\\n // widget attribute values, then the poison-character pass.\\n source = decodeHtmlEntities(source, this.document).trim();\\n source = source.replace(/\\\\u2013/g, '--').replace(/\\\\u2014/g, '---');\\n source = sanitizeDiagramSource(source).trim();\\n\\n var divNode = this.document.createElement('div');\\n divNode.id = 'mermaid_' + (uniqueID++) + '_' + Math.random().toString(36).slice(2, 7);\\n divNode.className = 'mm-themed' + (hasSelfStyling(source) ? ' mm-user' : '');\\n // Visible version stamp for debugging: which wrapper drew this diagram?\\n divNode.setAttribute('data-mmwrapver', '2026-10-19.pele');\\n parent.insertBefore(divNode, nextSibling);\\n this.domNodes.push(divNode);\\n\\n // Skip rendering during static HTML generation (Node.js build).\\n if (!$tw.browser) {\\n divNode.innerHTML = '\u003Cdiv style=\\\"border-left:3px solid var(--lithic-c-accent);background:var(--lithic-c-note-bg);padding:8px 12px;\\\">' +\\n '\u003Cstrong>Mermaid diagram\u003C/strong> (interactive rendering requires a browser)' +\\n '\u003C/div>';\\n return;\\n }\\n\\n var fontFamily = this.getAttribute('fontFamily', siteFontFamily());\\n if (!/^[\\\\w\\\\s,'-]+$/.test(fontFamily)) fontFamily = DEFAULT_FONT;\\n\\n // pele.render is synchronous and throws a PeleError on bad syntax, so\\n // the self-heal ladder can pick a source variant before anything is mounted.\\n var attempts = buildRenderAttempts(source),\\n chosen = null,\\n lastError = null;\\n for (var i = 0; i \u003C attempts.length; i++) {\\n try {\\n pele.render(attempts[i].text, { fontFamily: fontFamily });\\n chosen = attempts[i];\\n break;\\n } catch (renderErr) {\\n lastError = renderErr;\\n console.warn('[lithic-patch-mermaid] render failed (attempt: ' + attempts[i].label + ')');\\n }\\n }\\n if (!chosen) {\\n divNode.innerHTML = errorBox(source, lastError);\\n return;\\n }\\n\\n var self = this;\\n var mountNow = function() {\\n // Removed from the page before the fonts settled: nothing to draw into.\\n if (self.mounted || !divNode.isConnected) return;\\n try {\\n self.mounted = pele.mount(divNode, chosen.text, {\\n fontFamily: fontFamily,\\n // Diagrams are static: no pele zoom buttons, and no wheel, pinch or keyboard zoom.\\n zoom: false,\\n onError: function(err) {\\n divNode.innerHTML = errorBox(source, err);\\n }\\n });\\n } catch (mountErr) {\\n divNode.innerHTML = errorBox(source, mountErr);\\n }\\n };\\n\\n // Measure labels only once the webfont is loaded, so the measured box and\\n // the painted label use the same face. Bounded by a 3s fallback.\\n if (document.fonts && document.fonts.ready && typeof document.fonts.ready.then === 'function') {\\n var started = false;\\n var go = function() {\\n if (started) return;\\n started = true;\\n mountNow();\\n };\\n try {\\n if (document.fonts.load) {\\n document.fonts.load('16px ' + fontFamily, '0123456789');\\n document.fonts.load('16px ' + fontFamily, 'R(s)');\\n }\\n } catch (flErr) { /* font loading is best-effort */ }\\n document.fonts.ready.then(go, go);\\n setTimeout(go, 3000);\\n } else {\\n mountNow();\\n }\\n };\\n\\n // Tear the engine down before TiddlyWiki replaces this widget's DOM, so\\n // pele's resize observer does not outlive the diagram it watches.\\n MermaidWidget.prototype.removeChildDomNodes = function() {\\n if (this.mounted) {\\n try { this.mounted.destroy(); } catch (destroyErr) { /* already gone */ }\\n this.mounted = null;\\n }\\n Widget.prototype.removeChildDomNodes.call(this);\\n };\\n\\n MermaidWidget.prototype.execute = function() {\\n // Nothing to do\\n };\\n\\n exports.mermaid = MermaidWidget;\\n})();\"},\"$:/plugins/xyvir/lithic-patch-mermaid/pele.js\":{\"title\":\"$:/plugins/xyvir/lithic-patch-mermaid/pele.js\",\"type\":\"application/javascript\",\"module-type\":\"library\",\"text\":\"/*! Pele 1.13.0 | MIT License | https://github.com/obsidianmd/pele */\\r\\n\\\"use strict\\\";var pele=(()=>{var ja=Object.defineProperty;var J1=Object.getOwnPropertyDescriptor;var ew=Object.getOwnPropertyNames;var tw=Object.prototype.hasOwnProperty;var nw=(e,t,n)=>t in e?ja(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rw=(e,t)=>{for(var n in t)ja(e,n,{get:t[n],enumerable:!0})},sw=(e,t,n,r)=>{if(t&&typeof t==\\\"object\\\"||typeof t==\\\"function\\\")for(let i of ew(t))!tw.call(e,i)&&i!==n&&ja(e,i,{get:()=>t[i],enumerable:!(r=J1(t,i))||r.enumerable});return e};var iw=e=>sw(ja({},\\\"__esModule\\\",{value:!0}),e);var fe=(e,t,n)=>nw(e,typeof t!=\\\"symbol\\\"?t+\\\"\\\":t,n);var OL={};rw(OL,{PeleError:()=>Qe,detectType:()=>Um,enableZoom:()=>Dm,forgetTextWidths:()=>nc,mount:()=>O_,parse:()=>Gm,register:()=>wu,registered:()=>M_,render:()=>Ym,supports:()=>L_});var ow=[[\\\"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 nu(e){for(let[t,n,r]of ow)if(r.test(e))return{type:t,mermaidType:n};return null}var Qe=class extends Error{constructor(n,r=\\\"syntax\\\",i={}){super(n);fe(this,\\\"code\\\");fe(this,\\\"type\\\");fe(this,\\\"mermaidType\\\");fe(this,\\\"line\\\");fe(this,\\\"column\\\");fe(this,\\\"snippet\\\");this.name=\\\"PeleError\\\",this.code=r,this.type=i.type??null,this.mermaidType=i.mermaidType??null,this.line=i.line??0,this.column=i.column??0,this.snippet=i.snippet??\\\"\\\"}};function ds(e,t,n){return Array.from(e.matchAll(t),r=>[r.index,r.index+r[0].length,n])}function aw(e,t){let n=0;for(let[r,i,s]of e){let a=r-n;if(t\u003Ca)break;if(t\u003Ca+s)return r+Math.min(t-a,i-r-1);n+=i-r-s}return t+n}function zr(e,t){for(let n=e.length-1;n>=0;n--)t=aw(e[n],t);return t}var Ri;function em(e,t){let n=Ri;Ri=e;try{return t()}finally{Ri=n}}function ls(e,t){return Ri!==void 0&&e===Ri.parsed?Ri.find(t):[e,t]}function cr(e,t){let n=e.trimEnd().length;n>0&&t>=n?([e,t]=ls(e,n-1),t++):[e,t]=ls(e,t);let r=1,i=0;for(let c=e.indexOf(`\\r\\n`);c!==-1&&c\u003Ct;c=e.indexOf(`\\r\\n`,c+1))r++,i=c+1;let s=e.indexOf(`\\r\\n`,t);s===-1&&(s=e.length);let a=t-i+1,o=e.slice(i,s);return{line:r,column:a,snippet:o+`\\r\\n`+\\\"-\\\".repeat(a-1)+\\\"^\\\"}}function ft(e,t,n,r,i=!1){let s=cr(t,n),a=i?`Lexical error on line ${s.line}. Unrecognized text.`:`Parse error on line ${s.line}:`,o=i?`${a}\\r\\n${s.snippet}`:`${a}\\r\\n${s.snippet}\\r\\n${r}`;return new Qe(o,\\\"syntax\\\",{type:e,...s})}var cw=\\\"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\\\",Xa;function lw(e){if(!Xa){Xa=new Map;for(let t of cw.split(\\\",\\\")){let n=t.indexOf(\\\":\\\");Xa.set(t.slice(0,n),String.fromCodePoint(Number(t.slice(n+1))))}}return Xa.get(e)}function tm(e,t){return e>0&&e\u003C=1114111&&(e\u003C55296||e>57343)?String.fromCodePoint(e):t}var dw=/&(?:#(\\\\d+)|#[xX]([0-9a-fA-F]+)|(\\\\w+));/g,nm=\\\"fl°\\\",rm=\\\"¶ß\\\";function uw(e){let t=\\\"\\\",n=0,r=e.indexOf(nm);for(;r!==-1;){let i=e.indexOf(\\\"¶\\\",r+2);if(i===-1)break;if(e[i+1]===\\\"ß\\\"){let s=e[r+2]===\\\"°\\\";t+=e.slice(n,r)+(s?\\\"&#\\\":\\\"&\\\")+e.slice(r+(s?3:2),i)+\\\";\\\",n=i+2}r=e.indexOf(nm,i+1)}return n===0?e:t+e.slice(n)}var fw=/fl°°?(\\\\w+)¶ß/g;function xo(e){return e.includes(rm)?e.replace(fw,\\\"#$1;\\\"):e}function bt(e){return e.includes(rm)&&(e=uw(e)),e.includes(\\\"&\\\")&&(e=e.replace(dw,(t,n,r,i)=>n?tm(Number(n),t):r?tm(parseInt(r,16),t):lw(i)??t)),e}var Ao,So=new Map;function sm(e,t){let n=Ao,r=So;Ao=e,So=new Map;try{return t()}finally{Ao=n,So=r}}function Ti(e){if(Ao===void 0)return\\\"\\\";let t=So.get(e);return t===void 0&&(t=Ao(e)??\\\"\\\",So.set(e,t)),t}var wr,Mi=new Map;function om(e,t){let n=wr,r=Mi;wr=e,Mi=new Map;try{return t()}finally{wr=n,Mi=r}}function am(){return wr!==void 0}function im(e){return Number.isFinite(e)&&e>0}function cm(e,t){if(wr===void 0)return;let n=t+`\\r\\n`+e;if(Mi.has(n))return Mi.get(n);let r=wr(e,t)??void 0,i=r&&im(r.width)&&im(r.height)&&typeof(\\\"svg\\\"in r?r.svg:r.html)==\\\"string\\\"?r:void 0;return Mi.set(n,i),i}function lm(e){if(wr===void 0)return e();let t=wr;wr=void 0;try{return e()}finally{wr=t}}var us=class{constructor(t){fe(this,\\\"message\\\",t)}},fm=64;function qa(e,t,n){t===\\\"__proto__\\\"?Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0}):e[t]=n}var iu=class{constructor(t){fe(this,\\\"lines\\\");fe(this,\\\"i\\\",0);this.lines=(t.includes(\\\"\\\\r\\\")?t.replace(/\\\\r\\\\n?/g,`\\r\\n`):t).split(`\\r\\n`)}skipBlank(){for(;this.i\u003Cthis.lines.length;){let t=this.lines[this.i].trim();if(t!==\\\"\\\"&&t[0]!==\\\"#\\\"&&t!==\\\"---\\\")break;this.i++}}indent(){let t=this.lines[this.i],n=0;for(;n\u003Ct.length&&t[n]===\\\" \\\";)n++;if(t[n]===\\\"\\t\\\")throw new Error(\\\"YAML: tabs are not allowed for indentation\\\");return n}},hw=/^[-+]?(?:0|[1-9][0-9]*)$/,pw=/^[-+]?0x[0-9a-fA-F]+$/,mw=/^[-+]?0o[0-7]+$/,gw=/^[-+]?0b[01]+$/,bw=/^[-+]?(?:[0-9][0-9]*(?:\\\\.[0-9]*)?|\\\\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/,yw=/[\\\\s#:,[\\\\]{}&*!|>'\\\"%@`]/;function wo(e){return e===\\\" \\\"||e===\\\"\\t\\\"||e===`\\r\\n`||e===\\\"\\\\r\\\"}function ru(e){let t=e[0],n,r;if(t==='\\\"'||t===\\\"'\\\"){let s=1;for(;;){if(s>=e.length)return null;let a=e[s];if(t==='\\\"'&&a===\\\"\\\\\\\\\\\")s+=2;else if(a===t){if(t==='\\\"'||e[s+1]!==\\\"'\\\")break;s+=2}else s++}for(n=s+1,r=n;wo(e[r]);)r++;if(e[r]!==\\\":\\\")return null}else{if(t===void 0||yw.test(t)||t===\\\"-\\\"&&(e.length\u003C2||wo(e[1])||e[1]===\\\":\\\"||e[1]===\\\"#\\\"))return null;for(r=1;r\u003Ce.length&&e[r]!==\\\":\\\"&&e[r]!==\\\"#\\\";)r++;if(e[r]!==\\\":\\\")return null;for(n=r;wo(e[n-1]);)n--}let i=r+1;if(i\u003Ce.length&&!wo(e[i]))return null;for(;wo(e[i]);)i++;return{key:e.slice(0,n),length:i}}function ou(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\u003C\\\"0\\\"||n>\\\"9\\\"))return t;if(hw.test(t)||bw.test(t))return Number(t);if(pw.test(t)||mw.test(t)||gw.test(t)){let r=t[0]===\\\"-\\\",i=Number(r||t[0]===\\\"+\\\"?t.slice(1):t);return r?-i:i}return/^[-+]?\\\\.(?:inf|Inf|INF)$/.test(t)?t[0]===\\\"-\\\"?-1/0:1/0:/^\\\\.(?:nan|NaN|NAN)$/.test(t)?NaN:t}var dm={0:\\\"\\\\0\\\",a:\\\"\\\\x07\\\",b:\\\"\\\\b\\\",t:\\\"\\t\\\",n:`\\r\\n`,v:\\\"\\\\v\\\",f:\\\"\\\\f\\\",r:\\\"\\\\r\\\",e:\\\"\\\\x1B\\\",\\\" \\\":\\\" \\\",'\\\"':'\\\"',\\\"/\\\":\\\"/\\\",\\\"\\\\\\\\\\\":\\\"\\\\\\\\\\\",N:\\\"…\\\",_:\\\" \\\",L:\\\"\\\\u2028\\\",P:\\\"\\\\u2029\\\"};function _o(e){if(!e.includes(`\\r\\n`))return e;let t=e.split(`\\r\\n`),n=t.length-1;for(let r=0;r\u003C=n;r++){let i=t[r],s=0,a=i.length;if(r>0)for(;s\u003Ca&&(i.charCodeAt(s)===32||i.charCodeAt(s)===9);)s++;if(r\u003Cn)for(;a>s&&(i.charCodeAt(a-1)===32||i.charCodeAt(a-1)===9);)a--;t[r]=i.slice(s,a)}return t.join(`\\r\\n`).replace(/\\\\n+/g,r=>r.length===1?\\\" \\\":`\\r\\n`.repeat(r.length-1))}function Ew(e){if(!e.includes(\\\"\\\\\\\\\\\"))return _o(e);let t=\\\"\\\",n=_o(e.replace(/\\\\\\\\\\\\n[ \\\\t]*/g,\\\"\\\"));for(let r=0;r\u003Cn.length;r++){let i=n[r];if(i!==\\\"\\\\\\\\\\\"){t+=i;continue}let s=n[++r];if(s===\\\"x\\\"||s===\\\"u\\\"||s===\\\"U\\\"){let a=s===\\\"x\\\"?2:s===\\\"u\\\"?4:8;t+=String.fromCodePoint(parseInt(n.slice(r+1,r+1+a),16)),r+=a}else if(s in dm)t+=dm[s];else throw new Error(\\\"YAML: unknown escape sequence\\\")}return t}function Ws(e,t,n){for(;t\u003Ce.length;){let r=e[t];if(r===\\\" \\\"||r===`\\r\\n`||r===\\\"\\t\\\"||r===\\\"\\\\r\\\"||n&&r===\\\",\\\")t++;else if(r===\\\"#\\\"&&(t===0||/\\\\s/.test(e[t-1]))){let i=e.indexOf(`\\r\\n`,t);t=i===-1?e.length:i}else break}return t}function um(e,t){if(!t)throw new Error(\\\"YAML: missed comma between flow collection entries\\\");if(e===\\\",\\\")throw new Error(\\\"YAML: expected the node content, but found ','\\\")}function Ci(e,t,n,r=0){if(r>fm)throw new Error(\\\"YAML: nesting is too deep\\\");t=Ws(e,t,!1);let i=e[t];if(i===\\\"{\\\"){let a={};t++;let o=!0;for(;;){if(t=Ws(e,t,!1),t>=e.length)throw new us(\\\"YAML: unexpected end of the stream within a flow collection\\\");if(e[t]===\\\"}\\\")return[a,t+1];um(e[t],o);let c;[c,t]=Ci(e,t,\\\":,}\\\",r+1),t=Ws(e,t,!1);let l=null;e[t]===\\\":\\\"&&([l,t]=Ci(e,t+1,\\\",}\\\",r+1)),qa(a,String(c),l),t=Ws(e,t,!1),o=e[t]===\\\",\\\",o&&t++}}if(i===\\\"[\\\"){let a=[];t++;let o=!0;for(;;){if(t=Ws(e,t,!1),t>=e.length)throw new us(\\\"YAML: unexpected end of the stream within a flow collection\\\");if(e[t]===\\\"]\\\")return[a,t+1];um(e[t],o);let c;[c,t]=Ci(e,t,\\\",]\\\",r+1),a.push(c),t=Ws(e,t,!1),o=e[t]===\\\",\\\",o&&t++}}if(i==='\\\"'){let a=t+1;for(;a\u003Ce.length&&e[a]!=='\\\"';)a+=e[a]===\\\"\\\\\\\\\\\"?2:1;if(a>=e.length)throw new us(\\\"YAML: unexpected end of the stream within a double quoted scalar\\\");return[Ew(e.slice(t+1,a)),a+1]}if(i===\\\"'\\\"){let a=t+1;for(;a\u003Ce.length;){if(e[a]===\\\"'\\\"){if(e[a+1]!==\\\"'\\\")break;a++}a++}if(a>=e.length)throw new us(\\\"YAML: unexpected end of the stream within a single quoted scalar\\\");return[_o(e.slice(t+1,a)).replace(/''/g,\\\"'\\\"),a+1]}let s=t;for(;s\u003Ce.length;){let a=e[s];if(n.includes(a)&&(a!==\\\":\\\"||s+1>=e.length||/[\\\\s,[\\\\]{}]/.test(e[s+1])))break;if(a===\\\"#\\\"&&s>t&&/\\\\s/.test(e[s-1])){let o=e.indexOf(`\\r\\n`,s);return[ou(_o(e.slice(t,s).trim())),o===-1?e.length:o]}s++}return[ou(_o(e.slice(t,s).trim())),s]}function Ro(e){let t=\\\"\\\";for(let n=0;n\u003Ce.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]===\\\"\\t\\\"))return e.slice(0,n)}return e}function xw(e,t,n){let r=t[0]===\\\">\\\",i=t.includes(\\\"-\\\")?\\\"-\\\":t.includes(\\\"+\\\")?\\\"+\\\":\\\"\\\",s=/[1-9]/.exec(t),a=s?n+Number(s[0]):-1,o=[];for(;e.i\u003Ce.lines.length;){let u=e.lines[e.i];if(u.trim()===\\\"\\\"){o.push(\\\"\\\"),e.i++;continue}let h=u.length-u.trimStart().length;if(a===-1){if(h\u003C=n)break;a=h}if(h\u003Ca)break;o.push(u.slice(a)),e.i++}let c=0;for(;o.length>0&&o[o.length-1]===\\\"\\\";)o.pop(),c++;let l;if(r){l=\\\"\\\";for(let u=0;u\u003Co.length;u++){let h=o[u];if(u>0){let d=o[u-1];h===\\\"\\\"?l+=`\\r\\n`:d!==\\\"\\\"&&(l+=/^[ \\\\t]/.test(d)||/^[ \\\\t]/.test(h)?`\\r\\n`:\\\" \\\")}l+=h}}else l=o.join(`\\r\\n`);return o.length===0?i===\\\"+\\\"?`\\r\\n`.repeat(c):\\\"\\\":i===\\\"-\\\"?l:i===\\\"+\\\"?l+`\\r\\n`.repeat(c+1):l+`\\r\\n`}function su(e,t,n){let r=t[0];if((r===\\\"|\\\"||r===\\\">\\\")&&/^[|>][-+0-9]*\\\\s*(?:#.*)?$/.test(t))return xw(e,t,n);if(r===\\\"{\\\"||r===\\\"[\\\"||r==='\\\"'||r===\\\"'\\\"){let s=e.i,a=t,o=0,c=1;for(;;)try{let[l,u]=Ci(a,0,\\\"\\\"),h=0;for(let m=a.indexOf(`\\r\\n`);m!==-1&&m\u003Cu;m=a.indexOf(`\\r\\n`,m+1))h++;let d=a.indexOf(`\\r\\n`,u);if(Ro(a.slice(u,d===-1?a.length:d)).trim()!==\\\"\\\")throw new Error(\\\"YAML: unexpected content after a value\\\");return e.i=s+h,l}catch(l){if(!(l instanceof us))throw l;if(s+o>=e.lines.length)throw new Error(l.message);let u=e.lines.slice(s+o,s+o+c);a+=`\\r\\n`+u.join(`\\r\\n`),o+=u.length,c*=2}}let i=Ro(t).trim();for(;e.i\u003Ce.lines.length;){let s=e.lines[e.i];if(s.trim()===\\\"\\\"){let o=e.i;for(;o\u003Ce.lines.length&&e.lines[o].trim()===\\\"\\\";)o++;if(o>=e.lines.length||e.lines[o].length-e.lines[o].trimStart().length\u003C=n)break;i+=`\\r\\n`.repeat(o-e.i),e.i=o;continue}if(s.length-s.trimStart().length\u003C=n)break;let a=Ro(s).trim();i+=(i.endsWith(`\\r\\n`)?\\\"\\\":\\\" \\\")+a,e.i++}return ou(i)}function Qa(e,t,n=0){if(n>fm)throw new Error(\\\"YAML: nesting is too deep\\\");if(e.skipBlank(),e.i>=e.lines.length)return null;let r=e.indent();if(r\u003Ct)return null;let i=e.lines[e.i].slice(r);if(i===\\\"-\\\"||i.startsWith(\\\"- \\\")){let a=[];for(;e.i\u003Ce.lines.length&&(e.skipBlank(),!(e.i>=e.lines.length||e.indent()!==r));){let o=e.lines[e.i].slice(r);if(o!==\\\"-\\\"&&!o.startsWith(\\\"- \\\"))break;let c=o.slice(1),l=c.length-c.trimStart().length+1,u=Ro(c).trim();u===\\\"\\\"?(e.i++,a.push(Qa(e,r+1,n+1))):ru(u)!==null?(e.lines[e.i]=\\\" \\\".repeat(r+l)+c.trimStart(),a.push(Qa(e,r+l,n+1))):(e.i++,a.push(su(e,c.trim(),r)))}return a}if(ru(i)===null)return e.i++,su(e,i.trim(),r-1);let s={};for(;e.i\u003Ce.lines.length&&(e.skipBlank(),!(e.i>=e.lines.length));){let a=e.indent();if(a\u003Cr)break;if(a>r)throw new Error(\\\"YAML: bad indentation of a mapping entry\\\");let o=e.lines[e.i].slice(r),c=ru(o);if(!c)throw new Error(\\\"YAML: can not read a block mapping entry\\\");let l=String(Ci(c.key,0,\\\"\\\")[0]),u=o.slice(c.length);if(e.i++,Ro(u).trim()===\\\"\\\")if(e.skipBlank(),e.i\u003Ce.lines.length){let h=e.indent(),d=e.lines[e.i].slice(h),m=d===\\\"-\\\"||d.startsWith(\\\"- \\\");qa(s,l,h>r||m&&h===r?Qa(e,m?r:r+1,n+1):null)}else qa(s,l,null);else qa(s,l,su(e,u.trim(),r))}return s}function lr(e){let t=e.trim();if(t[0]===\\\"{\\\"||t[0]===\\\"[\\\")try{let[i,s]=Ci(t,0,\\\"\\\");if(Ws(t,s,!1)===t.length)return i}catch(i){throw i instanceof us?new Error(i.message):i}let n=new iu(e),r=Qa(n,0);if(n.skipBlank(),n.i\u003Cn.lines.length&&n.lines[n.i].trim()!==\\\"...\\\")throw new Error(\\\"YAML: end of the stream or a document separator is expected\\\");return r}function qe(e){return e\u003C128?e===32||e>=9&&e\u003C=13:e===160||e===5760||e>=8192&&e\u003C=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function Xn(e){return e===32||e===9}function Us(e){return e===10||e===13||e===8232||e===8233}function xt(e){return e>=48&&e\u003C=57}function Vr(e){return e>=65&&e\u003C=90||e>=97&&e\u003C=122}function Za(e){return e>=48&&e\u003C=57||e>=65&&e\u003C=70||e>=97&&e\u003C=102}function ot(e){return e>=48&&e\u003C=57||e>=65&&e\u003C=90||e>=97&&e\u003C=122||e===95}var Aw=/^\\\\s*%%(?!{)[^\\\\n]+\\\\n?/gm,Ni=/%{2}{\\\\s*(?:(\\\\w+)\\\\s*:|(\\\\w+))\\\\s*(?:(\\\\w+)|((?:(?!}%{2}).|\\\\r?\\\\n)*))?\\\\s*(?:}%{2})?/gi,Sw=/\u003C(\\\\w+)([^>]*)>/g,ww=/=\\\"([^\\\"]*)\\\"/g,_w=new Set([\\\"__proto__\\\",\\\"constructor\\\",\\\"prototype\\\"]);function pm(e,t,n){return n?.push(ds(e,t,0)),e.replace(t,\\\"\\\")}function lu(e,t){e.includes(\\\"%%\\\")&&(e=pm(e,Aw,t));let n=e.trimStart();return t?.push([[0,e.length-n.length,0]]),n}function du(e){return e.includes(\\\"\\\\r\\\")?e.replace(/\\\\r\\\\n?/g,`\\r\\n`):e}function Ja(e){return e===`\\r\\n`||e===\\\"\\\\r\\\"}function au(e){return e!==void 0&&/\\\\s/.test(e)}function Rw(e){let t=0;for(;t\u003Ce.length&&au(e[t])&&!Ja(e[t]);)t++;let n=e.slice(0,t);if(!e.startsWith(\\\"---\\\",t))return;let r=[];for(let h=t+3;h\u003Ce.length&&au(e[h]);h++)Ja(e[h])&&r.push(h);if(r.length===0)return;let i=n+\\\"---\\\",s=h=>{if(!Ja(e[h])||!e.startsWith(i,h+1))return-1;let d=-1;for(let m=h+1+i.length;m\u003Ce.length&&au(e[m]);m++)Ja(e[m])&&(d=m);return d},a=`\\r\\n`+i,o=-1;for(let h=e.lastIndexOf(a);h>r[0];h=e.lastIndexOf(a,h-1))if(s(h)!==-1){o=h;break}if(o===-1)return;let c=r[0];for(let h of r)h\u003Co&&(c=h);let l=c+1,u=l>0?l-1:0;for(let h=e.indexOf(a,u);h!==-1&&h\u003C=o;h=e.indexOf(a,h+1)){if(h\u003Cl)continue;let d=s(h);if(d!==-1)return{indent:n,body:e.slice(l,h),length:d+1}}}function jr(e){return typeof e==\\\"object\\\"&&e!==null&&!Array.isArray(e)}function ec(e,t){for(let n of Object.keys(t)){if(_w.has(n))continue;let r=t[n],i=e[n];jr(r)&&jr(i)?ec(i,r):jr(r)?e[n]=ec({},r):e[n]=r}return e}function Tw(e,t,n){if(!e.includes(\\\"%%{\\\"))return e;let r=e.trim().replace(/'/g,'\\\"');Ni.lastIndex=0;let i;for(;(i=Ni.exec(r))!==null;){i.index===Ni.lastIndex&&Ni.lastIndex++;let s=i[1]??i[2];if(s===\\\"wrap\\\")t.wrap=!0;else if((s===\\\"init\\\"||s===\\\"initialize\\\")&&i[4])try{let a=JSON.parse(i[4].trim());jr(a)&&ec(t,a)}catch{}}return Ni.lastIndex=0,pm(e,Ni,n)}function tc(e,t){let n=du(e),r=n.includes(\\\"\u003C\\\")?n.lastIndexOf(\\\">\\\"):-1;r>0&&(n=n.slice(0,r+1).replace(Sw,(c,l,u)=>\\\"\u003C\\\"+l+u.replace(ww,\\\"='$1'\\\")+\\\">\\\")+n.slice(r+1));let i={},s,a=0,o=n.includes(\\\"---\\\")?Rw(n):void 0;if(o){let c=o.indent?o.body.split(`\\r\\n`).map(u=>u.startsWith(o.indent)?u.slice(o.indent.length):u).join(`\\r\\n`):o.body,l;try{l=lr(c)}catch(u){throw new Qe(`Front matter is not valid YAML. ${u.message}`,\\\"syntax\\\")}if(jr(l)&&(l.title&&(s=String(l.title)),jr(l.config)&&ec(i,l.config),l.displayMode)){let u=jr(i.gantt)?i.gantt:i.gantt={};u.displayMode=String(l.displayMode)}for(let u=n.indexOf(`\\r\\n`);u!==-1&&u\u003Co.length;u=n.indexOf(`\\r\\n`,u+1))a++;n=n.slice(o.length),t?.push([[0,o.length,0]])}return n=Tw(n,i,t),{text:lu(n),title:s,config:i,withComments:n,lineOffset:a}}var Mw=/#\\\\w+;/g,Cw=/^\\\\+?\\\\d+$/,cu=new RegExp(\\\"[\\\\\\\\n\\\\\\\\r\\\\u2028\\\\u2029]\\\",\\\"g\\\");function mm(e){if(e===void 0)return;let t=[];return e.push(t),t}function hm(e,t,n){let r=mm(n),i=e.indexOf(t);if(i===-1)return e;let s=\\\"\\\",a=0;for(;i!==-1;){cu.lastIndex=i;let o=cu.test(e)?cu.lastIndex-1:e.length,c=!1,l=-1;for(let u=i+t.length;u\u003Co;u++){let h=e.charCodeAt(u);if(h===58)c=!0;else if(h===35){if(c){l=u;break}}else qe(h)&&(c=!1)}if(l!==-1){let u=e.lastIndexOf(\\\";\\\",o-1);u>l&&(r?.push([u,u+1,0]),s+=e.slice(a,u),a=u+1)}i=o>=e.length?-1:e.indexOf(t,o+1)}return a===0?e:s+e.slice(a)}function uu(e,t){if(!e.includes(\\\"#\\\"))return e;e=hm(hm(e,\\\"style\\\",t),\\\"classDef\\\",t);let n=mm(t);return e.replace(Mw,(r,i)=>{let s=r.substring(1,r.length-1),a=(Cw.test(s)?\\\"fl°°\\\":\\\"fl°\\\")+s+\\\"¶ß\\\";return n?.push([i,i+r.length,a.length]),a})}var gm=\\\"7q7q9vfgfgopij5b9999atg87q997q7qfgfgfgfgfgfgfgfgfgfg7q7qg8g8g8fgs7ijijk2k2ijgzlmk27qdwijfgn5k2lmijlmk2ijgzk2ijq8ijijgz7q7q7qd1fg99fgfgdwfgfg7qfgfg6666dw66n5fgfgfgfg99dw7qfgdwk2dwdwdw9a789ag8\\\",bm=\\\"7q99d6fgfgopk26m9999atg87q997q7qfgfgfgfgfgfgfgfgfgfg9999g8g8g8gzr3k2k2k2k2ijgzlmk27qfgk2gzn5k2lmijlmk2ijgzk2ijq8ijijgz997q99g8fg99fggzfggzfg99gzgz7q7qfg7qopgzgzgzgzatfg99gzfglmfgfgdwat7satg8\\\";var xm=1.2;function ym(e){let t=new Uint16Array(95);for(let n=0;n\u003C95;n++)t[n]=parseInt(e.substr(n*2,2),36);return t}var Nw,Iw;function kw(e){return e>=4352&&e\u003C=4447||e>=11904&&e\u003C=42191||e>=44032&&e\u003C=55203||e>=63744&&e\u003C=64255||e>=65072&&e\u003C=65103||e>=65280&&e\u003C=65376||e>=65504&&e\u003C=65510||e>=55296&&e\u003C=56319}function $w(e){return e===173||e>=768&&e\u003C=879||e>=8203&&e\u003C=8207||e>=56320&&e\u003C=57343||e>=65024&&e\u003C=65039||e===65279}var Lw={width(e,t,n){let r=(n&4)!==0,i=n&24?t/xm:t,s=n&1?Iw??=ym(bm):Nw??=ym(gm),a=0;for(let o=0;o\u003Ce.length;o++){let c=e.charCodeAt(o);if(!(c\u003C32))if(c\u003C127)a+=r?600:s[c-32];else{if($w(c))continue;kw(c)?a+=r?1200:1e3:a+=r?600:580}}return a*i/1e3}};function Ow(){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 Dw=2e4;function Em(){let e=globalThis;return e.document?.fonts??e.fonts}function vw(e,t,n){try{return e?.check(t,n)??!0}catch{return!0}}function Pw(e,t=\\\"monospace\\\"){let n=Ow();if(!n)return null;let r=new Map,i=\\\"\\\",s=Em()?.size;return{width(a,o,c){let l=Em();l?.size!==s&&(s=l?.size,r.clear());let u=c&24?o/xm:o,h=(c&2?\\\"italic \\\":\\\"\\\")+(c&1?\\\"bold \\\":\\\"\\\")+u+\\\"px \\\"+(c&4?t:e),d=r.get(h);d||r.set(h,d=new Map);let m=d.get(a);return m===void 0&&(h!==i&&(n.font=i=h),m=n.measureText(a).width,vw(l,h,a)&&(d.size>=Dw&&d.clear(),d.set(a,m))),m}}}var fu=new Map;function ct(e=\\\"sans-serif\\\",t=\\\"monospace\\\"){let n=e+`\\r\\n`+t,r=fu.get(n);return r||(r=Pw(e,t)??Lw,fu.set(n,r)),r}function nc(){fu.clear()}var Fw=/[&\u003C>\\\"\\\\x00-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x7f\\\\ud800-\\\\udfff\\\\ufffe\\\\uffff]/u,Bw=/[&\u003C>\\\"]|[\\\\x00-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x7f\\\\ud800-\\\\udfff\\\\ufffe\\\\uffff]+/gu,Ww={\\\"&\\\":\\\"&\\\",\\\"\u003C\\\":\\\"<\\\",\\\">\\\":\\\">\\\",'\\\"':\\\""\\\"},rc=/[\\\\x00-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x7f\\\\ud800-\\\\udfff\\\\ufffe\\\\uffff]/u;function rt(e){return Fw.test(e)?e.replace(Bw,t=>Ww[t]??\\\"\\\"):e}function Ue(e){return rt(bt(e))}var hu=[];for(let e=0;e\u003C100;e++)hu.push(e===0?\\\"\\\":e%10===0?\\\".\\\"+e/10:\\\".\\\"+(e\u003C10?\\\"0\\\"+e:e));function f(e){let t=Math.round(e*100);if(t===0)return\\\"0\\\";if(t>0){if(t\u003C1e11){let n=Math.floor(t/100);return n+hu[t-n*100]}}else if(t>-1e11){let n=-t,r=Math.floor(n/100);return\\\"-\\\"+r+hu[n-r*100]}return String(t/100)}function Ne(e,t,n,r,i){let s=e.lines;if(s.length===0)return\\\"\\\";let a=e.lineHeight,o=e.heights,c=e.size*.35,l=n-e.height/2,u=s.length===1&&s[0].length===1?s[0][0]:void 0;if(u&&u.icon===void 0&&u.math===void 0&&u.style===0)return`\u003Ctext${r} x=\\\"${f(t)}\\\" y=\\\"${f(l+a/2+c)}\\\" text-anchor=\\\"middle\\\">${rt(u.text)}\u003C/text>`;let h=Xr(e),d=r,m;r=qn(r,h);let p=\\\"\\\",y=\\\"\\\";for(let E=0;E\u003Cs.length;E++){let b=s[E],S=o?o[E]:a,x=l+S/2,I=x+c,L=!1;for(let O of b)(O.icon!==void 0||O.math)&&(L=!0);if(L){let O=t-e.widths[E]/2;for(let v of b){if(v.math){let G=`x=\\\"${f(O)}\\\" y=\\\"${f(x-v.math.height/2)}\\\" width=\\\"${f(v.math.width)}\\\" height=\\\"${f(v.math.height)}\\\"`;m??=zw(d),y+=m.halo===void 0?Vw(v.math,G,e.size,m.attrs):`\u003Crect ${G} rx=\\\"2\\\" fill=\\\"${m.halo}\\\"/>`}else if(v.icon!==void 0){let G=e.size*1.1,K=i?.(v.icon)??\\\"\\\";y+=`\u003Csvg class=\\\"pele-icon\\\" data-icon=\\\"${Ue(v.icon)}\\\" x=\\\"${f(O)}\\\" y=\\\"${f(x-G/2)}\\\" width=\\\"${f(G)}\\\" height=\\\"${f(G)}\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\">${K}\u003C/svg>`}else v.text!==\\\"\\\"&&(p+=`\u003Ctspan x=\\\"${f(O)}\\\" y=\\\"${f(I)}\\\" text-anchor=\\\"start\\\"${_r(v.style&~h)}>${rt(v.text)}\u003C/tspan>`);O+=v.width}}else{for(let O=0;O\u003Cb.length;O++){let v=b[O],G=O===0?` x=\\\"${f(t)}\\\" y=\\\"${f(I)}\\\"`:\\\"\\\";p+=`\u003Ctspan${G}${_r(v.style&~h)}>${rt(v.text)}\u003C/tspan>`}b.length===0&&(p+=`\u003Ctspan x=\\\"${f(t)}\\\" y=\\\"${f(I)}\\\"> \u003C/tspan>`)}l+=S}return`\u003Ctext${r} text-anchor=\\\"middle\\\" xml:space=\\\"preserve\\\">${p}\u003C/text>${y}`}var Uw=/ fill=\\\"([^\\\"]*)\\\"/,Gw=/ stroke=\\\"([^\\\"]*)\\\"/,Yw=/ style=\\\"([^\\\"]*)\\\"/,Hw=/(?:^|;)\\\\s*fill:([^;]*)/,Kw=/(?:^|;)\\\\s*opacity:([^;]*)/;function zw(e){let t=Yw.exec(e)?.[1]??\\\"\\\",n=(Hw.exec(t)?.[1]??Uw.exec(e)?.[1]??\\\"\\\").trim();if(n===\\\"none\\\")return{attrs:\\\"\\\",halo:Gw.exec(e)?.[1]??\\\"none\\\"};let r=Kw.exec(t)?.[1].trim();return{attrs:(n===\\\"\\\"?\\\"\\\":` color=\\\"${n}\\\"`)+(r?` opacity=\\\"${r}\\\"`:\\\"\\\")}}function Vw(e,t,n,r){return\\\"svg\\\"in e?`\u003Csvg class=\\\"pele-math\\\" ${t} overflow=\\\"visible\\\"${r}>${e.svg}\u003C/svg>`:`\u003CforeignObject class=\\\"pele-math\\\" ${t} overflow=\\\"visible\\\"${r}>\u003Cdiv xmlns=\\\"http://www.w3.org/1999/xhtml\\\" style=\\\"display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:${f(n)}px;line-height:normal;white-space:nowrap\\\">${e.html}\u003C/div>\u003C/foreignObject>`}var Am=' font-weight=\\\"var(--_w)\\\"',Sm=' font-style=\\\"italic\\\"',jw=' text-decoration=\\\"underline\\\"',wm=' font-family=\\\"var(--_fm)\\\"',Xw=' baseline-shift=\\\"sub\\\" font-size=\\\"smaller\\\"',qw=' baseline-shift=\\\"super\\\" font-size=\\\"smaller\\\"';function _r(e){return(e&1?Am:\\\"\\\")+(e&2?Sm:\\\"\\\")+(e&4?wm:\\\"\\\")+(e&32?jw:\\\"\\\")+(e&8?Xw:e&16?qw:\\\"\\\")}function Xr(e){let t=7,n=!1;for(let r of e.lines)for(let i of r)i.icon!==void 0||i.text===\\\"\\\"||(t&=i.style,n=!0);return n?t:0}function qn(e,t){return e+(t&1&&!e.includes(' font-weight=\\\"')?Am:\\\"\\\")+(t&2&&!e.includes(' font-style=\\\"')?Sm:\\\"\\\")+(t&4&&!e.includes(' font-family=\\\"')?wm:\\\"\\\")}var _m=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(\\\" \\\")),Rm=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(\\\" \\\")),sc=\\\"var(--pele-fg-on-light,#1f1f1f)\\\",ic=\\\"var(--pele-fg-on-dark,#fff)\\\",mu=/[\\\";]fill:([^;\\\"]*)/,Qw=/[\\\";](?:fill-)?opacity:([^;\\\"]*)/g,Tm=/^#(?:[\\\\da-f]{3,4}|[\\\\da-f]{6}|[\\\\da-f]{8})$/i,Zw=/^(rgba?|hsla?)\\\\(([^()]*)\\\\)$/i,Mm=/^[+-]?(?:\\\\d+(?:\\\\.\\\\d+)?|\\\\.\\\\d+)(?:e[+-]?\\\\d+)?(%|deg|grad|rad|turn)?$/i,pu=e=>e\u003C=.04045?e/12.92:((e+.055)/1.055)**2.4,gu=(e,t,n)=>.2126*pu(e)+.7152*pu(t)+.0722*pu(n),Jw=e=>Math.min(Math.max(e,0),1),e_=Math.sqrt(1.05*(gu(31/255,31/255,31/255)+.05))-.05;function Mo(e,t){let n=Mm.exec(e);return!n||n[1]&&n[1]!==\\\"%\\\"?NaN:Jw(parseFloat(e)/(n[1]?100:t))}function t_(e){let t=Mm.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 n_(e,t){let n=e.includes(\\\",\\\"),[r,i,s]=n?[e]:e.split(\\\"/\\\");if(s!==void 0)return;let a=r.trim().split(n?/\\\\s*,\\\\s*/:/\\\\s+/);if(n?a.length\u003C3||a.length>4:a.length!==3)return;if(i!==void 0&&a.push(i.trim()),!n)return a.map(c=>c===\\\"none\\\"?\\\"0\\\":c);let o=a.slice(t?1:0,3).filter(c=>c.endsWith(\\\"%\\\")).length;return o===(t?2:3)||!t&&o===0?a:void 0}function Cm(e){let t=e.trim().toLowerCase(),n=t.replace(\\\"grey\\\",\\\"gray\\\");return Tm.test(t)||_m.has(n)||Rm.has(n)||t===\\\"transparent\\\"||t===\\\"currentcolor\\\"}function Nm(e){let t=e.trim().toLowerCase(),n=t.replace(\\\"grey\\\",\\\"gray\\\");if(_m.has(n))return[0,1];if(Rm.has(n))return[1,1];if(Tm.test(t)){let l=t.length\u003C6?t.slice(1).replace(/./g,\\\"$&$&\\\"):t.slice(1),u=h=>parseInt(l.slice(2*h,2*h+2),16)/255;return[gu(u(0),u(1),u(2)),l.length===8?u(3):1]}let r=Zw.exec(t),i=r?.[1].startsWith(\\\"hsl\\\")??!1,s=r&&n_(r[2],i);if(!s)return;let a=s.length===4?Mo(s[3],1):1,o;if(!i)o=s.slice(0,3).map(l=>Mo(l,255));else{let l=(t_(s[0])%360+360)%360/30,u=Mo(s[1],100),h=Mo(s[2],100),d=u*Math.min(h,1-h);o=[0,8,4].map(m=>{let p=(m+l)%12;return h-d*Math.max(-1,Math.min(p-3,9-p,1))})}let c=gu(o[0],o[1],o[2]);return Number.isNaN(c+a)?void 0:[c,a]}function Im(e){let t=1;for(let[,n]of e.matchAll(Qw))t*=Mo(n.trim(),1);return t}var To=new Map;function dr(e,t=\\\"\\\"){let n=`${e}\\\\0${t}`;if(To.has(n))return To.get(n);To.size>1e3&&To.clear();let r=r_(e,t);return To.set(n,r),r}function r_(e,t){let n=mu.exec(e),r=n&&!mu.test(t)?Nm(n[1]):void 0;if(r&&r[1]*Im(e)>=.5)return r[0]>e_?sc:ic}function Mn(e){let t=mu.exec(e)?.[1].trim().toLowerCase();if(!t||t===\\\"none\\\"||t===\\\"transparent\\\")return!1;let n=Im(e);return(Nm(t)?.[1]??1)*(Number.isNaN(n)?1:n)>0}function vt(e,t){let n=dr(e.shape,e.text)??t;return n?` fill=\\\"${n}\\\"`:\\\"\\\"}var s_={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}},Co=8,i_=/^[\\\\w\\\\s#%.,+\\\\-/()]{1,200}$/,o_=/([\\\\w-]*)\\\\s*\\\\(/g,a_=/var\\\\(\\\\s*([\\\\w-]*)/gi,c_=new Set([\\\"rgb\\\",\\\"rgba\\\",\\\"hsl\\\",\\\"hsla\\\",\\\"hwb\\\",\\\"lab\\\",\\\"lch\\\",\\\"oklab\\\",\\\"oklch\\\",\\\"color\\\",\\\"color-mix\\\",\\\"light-dark\\\",\\\"var\\\"]),km=e=>jr(e)?e:{};function l_(e){if(typeof e!=\\\"string\\\")return;let t=e.trim();if(!i_.test(t))return;if(!t.includes(\\\"(\\\"))return Cm(t)?t:void 0;let n=0;for(let r of t)if(r===\\\"(\\\")n++;else if(r===\\\")\\\"&&--n\u003C0)return;if(n===0){for(let[,r]of t.matchAll(o_))if(!c_.has(r.toLowerCase()))return;for(let[,r]of t.matchAll(a_))if(!r.startsWith(\\\"--pele-\\\"))return;return t}}function d_(e){let t=[],n=0,r=0;for(let i=0;i\u003Ce.length;i++){let s=e[i];s===\\\"(\\\"?n++:s===\\\")\\\"?n--:s===\\\",\\\"&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.map(i=>i.trim())}function u_(e,t){if(e===\\\"xychart\\\"){let i=km(t.xyChart).plotColorPalette;return typeof i==\\\"string\\\"?{list:d_(i),repeat:!0}:void 0}let n=s_[e];if(n===void 0)return;let r=[];for(let i=0;i\u003CCo;i++)r.push(t[n.prefix+(n.first+i)]);return n.repeat&&(r=r.filter(i=>i!=null&&i!==\\\"\\\")),{list:r,repeat:n.repeat===!0}}var bu={style:\\\"\\\",inks:[]};function $m(e,t){let n=u_(e,km(t.themeVariables));if(n===void 0||n.list.length===0)return bu;let{list:r,repeat:i}=n,s=\\\"\\\",a=[];for(let o=0;o\u003CCo&&!(!i&&o>=r.length);o++){let c=l_(r[o%r.length]);c!==void 0&&(s+=`;--pele-series-${o+1}:${c}`,a[o]=dr(`;fill:${c}`))}return s===\\\"\\\"?bu:{style:rt(s),inks:a}}var No=bu;function Lm(e,t){let n=No;No=e;try{return t()}finally{No=n}}var Om=()=>No.style;function fs(e){let t=No.inks[(e%Co+Co)%Co];return t?` fill=\\\"${t}\\\"`:\\\"\\\"}function Gs(e){return e.ownerDocument?.defaultView??globalThis}function yu(e,t){let n=e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0);return n>0?n:0}function f_(e,t,n,r,i){let s=t.width/n,a=t.height/n,o=(c,l,u)=>l>=u?Math.min(Math.max(c,u-l),0):Math.min(Math.max(c,0),u-l);return{x:o(r,s,e.width),y:o(i,a,e.height),width:s,height:a}}var Ii=1.25,oc=48,h_=4,p_=\\\"--_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\\\",m_=\\\"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)\\\",g_={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\\\"},b_={zoomIn:\\\"Zoom in\\\",zoomOut:\\\"Zoom out\\\",reset:\\\"Reset zoom\\\"};function Dm(e,t={}){return Eu(e,t,!0)}function Eu(e,t,n){let r=null,i={width:0,height:0},s={width:0,height:0},a={width:0,height:0},o=!1,c=\\\"\\\",l={width:\\\"\\\",height:\\\"\\\",maxWidth:\\\"\\\",margin:\\\"\\\",display:\\\"\\\"},u=null,h=0,d=0,m=0,p=0,y=()=>Gs(e),E=()=>i.width>0&&s.width>0?s.width/i.width:1,b=()=>Math.max(E(),t.maxScale??3),S=()=>r!==null&&i.width>0&&(t.always===!0||E()\u003C.999),x=()=>{if(!r||h!==0)return;let ce=r.getBoundingClientRect();s={width:ce.width,height:ce.height},a={width:Math.max(s.width,e.clientWidth),height:Math.max(s.height,e.clientHeight)},o=a.width>s.width+1||a.height>s.height+1,o||(a=s);let pe=y().getComputedStyle(e);c=[\\\"Top\\\",\\\"Right\\\",\\\"Bottom\\\",\\\"Left\\\"].map(V=>`${-(parseFloat(pe.getPropertyValue(`padding-${V.toLowerCase()}`))||0)}px`).join(\\\" \\\")},I,L={},O=!1,v=()=>{if(t.controls===!1)return;let ce=S();if(!I){if(!ce)return;let V=e.ownerDocument;I=V.createElement(\\\"div\\\"),I.className=\\\"pele pele-zoom\\\",I.setAttribute(\\\"style\\\",p_);let X={zoomIn:()=>H((h||E())*Ii*Ii),zoomOut:()=>H((h||E())/(Ii*Ii)),reset:()=>C()};for(let le of[\\\"zoomIn\\\",\\\"zoomOut\\\",\\\"reset\\\"]){let de=V.createElement(\\\"button\\\"),Se=t.labels?.[le]??b_[le];de.type=\\\"button\\\",de.className=`pele-zoom-${le===\\\"zoomIn\\\"?\\\"in\\\":le===\\\"zoomOut\\\"?\\\"out\\\":\\\"reset\\\"}`,de.setAttribute(\\\"style\\\",m_),de.setAttribute(\\\"aria-label\\\",Se),de.title=Se,de.innerHTML=`\u003Csvg 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\\\">\u003Cpath d=\\\"${g_[le]}\\\"/>\u003C/svg>`,de.addEventListener(\\\"click\\\",X[le]),L[le]=de,I.append(de)}}ce&&!O&&y().getComputedStyle(e).position===\\\"static\\\"&&(e.style.position=\\\"relative\\\",O=!0),ce&&I.parentNode!==e&&e.append(I),I.hidden=!ce,I.style.display=ce?\\\"flex\\\":\\\"none\\\";let pe=(V,X)=>{V&&(V.disabled=X,V.style.opacity=X?\\\"0.35\\\":\\\"\\\",V.style.cursor=X?\\\"default\\\":\\\"var(--pele-zoom-cursor,pointer)\\\")};pe(L.zoomIn,(h||E())>=b()*.999),pe(L.zoomOut,h===0),L.reset&&(L.reset.style.display=h===0?\\\"none\\\":\\\"grid\\\")},G=ce=>I!==void 0&&ce.target instanceof y().Node&&I.contains(ce.target),K=()=>{r&&(oe(),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)},C=()=>{r&&(K(),h=0,r.setAttribute(\\\"viewBox\\\",`0 0 ${i.width} ${i.height}`),r.style.cursor=\\\"\\\",r.style.userSelect=\\\"\\\",x(),r.style.touchAction=S()?\\\"pan-y\\\":\\\"\\\",S()?r.setAttribute(\\\"tabindex\\\",\\\"0\\\"):r.removeAttribute(\\\"tabindex\\\"),ue(S()),v(),Z())},Z=()=>{if(!r||!I||I.hidden)return;let ce=I.getBoundingClientRect(),pe=[...r.querySelectorAll(\\\"text\\\")].some(Me=>{let Ce=Me.getBoundingClientRect();return Ce.right>ce.left&&Ce.left\u003Cce.right&&Ce.bottom>ce.top&&Ce.top\u003Cce.bottom}),V=r.getBoundingClientRect(),X=ce.left-h_;if(!pe||V.right-X>=V.width/2)return;let le=e.getBoundingClientRect(),de=e.offsetWidth>0?le.width/e.offsetWidth:1,Se=parseFloat(y().getComputedStyle(e).paddingRight)||0,_e=le.left+(e.clientLeft+e.clientWidth-Se)*de,xe=[r.style.maxWidth,r.style.marginRight];r.style.maxWidth=`${(X-V.left)/de}px`,r.style.marginRight=`${Math.max(_e-X,0)/de}px`,u={before:xe,after:[r.style.maxWidth,r.style.marginRight]},r.getBoundingClientRect().right>X+1&&oe(),x()},oe=()=>{!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)},H=(ce,pe,V)=>{if(!r||(h===0&&x(),!S()))return;let X=h||E(),le=Math.min(Math.max(ce,E()),b());if(le\u003C=E()*1.001){C();return}let de=r.getBoundingClientRect(),Se=pe??de.left+de.width/2,_e=V??de.top+de.height/2,xe=(h?d:0)+(Se-de.left)/X,Me=(h?m:0)+(_e-de.top)/X;h=le;let Ce=de;o&&(r.style.maxWidth=\\\"none\\\",r.style.margin=c,r.style.display=\\\"block\\\",r.style.width=`${a.width}px`,r.style.height=`${a.height}px`,Ce=r.getBoundingClientRect()),z(xe-(Se-Ce.left)/h,Me-(_e-Ce.top)/h),r.style.cursor=\\\"grab\\\",r.style.userSelect=\\\"none\\\",r.style.touchAction=\\\"none\\\",v()},z=(ce,pe)=>{if(!r)return;let V=f_(i,a,h,ce,pe);d=V.x,m=V.y,r.setAttribute(\\\"viewBox\\\",`${d} ${m} ${V.width} ${V.height}`)},M=(ce,pe)=>{h!==0&&z(d-ce/h,m-pe/h)},T=()=>{$();let ce=e.clientWidth+e.clientHeight;ce!==p&&(p=ce,C())},R,_,$=()=>{if(!n)return;let ce=y();ce!==_&&(R?.disconnect(),_=ce,R=ce.ResizeObserver?new ce.ResizeObserver(T):void 0,R?.observe(e))},g=()=>{$(),h!==0?K():oe();let ce=e.firstElementChild;if(r=ce&&ce.localName===\\\"svg\\\"?ce:null,h=0,!r){I?.remove(),ue(!1);return}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},C()},N=new Map,w=!1,A=0,D=0,U=()=>{let[ce,pe]=[...N.values()];return{distance:Math.hypot(ce.x-pe.x,ce.y-pe.y),x:(ce.x+pe.x)/2,y:(ce.y+pe.y)/2}},B=()=>{w=!1},F=ce=>{!S()||G(ce)||ce.pointerType===\\\"mouse\\\"&&ce.button!==0||(N.set(ce.pointerId,{x:ce.clientX,y:ce.clientY}),A=0,N.size===2&&(D=U().distance),(N.size===2||h!==0)&&(e.setPointerCapture?.(ce.pointerId),r&&(r.style.cursor=\\\"grabbing\\\")))},W=ce=>{let pe=N.get(ce.pointerId);if(pe){if(N.size===2){let V=U();N.set(ce.pointerId,{x:ce.clientX,y:ce.clientY});let X=U();D>0&&X.distance>0&&H((h||E())*(X.distance/V.distance),X.x,X.y),M(X.x-V.x,X.y-V.y),w=!0;return}N.set(ce.pointerId,{x:ce.clientX,y:ce.clientY}),h!==0&&(A+=Math.abs(ce.clientX-pe.x)+Math.abs(ce.clientY-pe.y),A>4&&(w=!0),M(ce.clientX-pe.x,ce.clientY-pe.y))}},j=ce=>{N.delete(ce.pointerId)&&(D=0,N.size===0&&r&&h!==0&&(r.style.cursor=\\\"grab\\\"))},Q=ce=>{!w||ce.detail===0||(w=!1,ce.preventDefault(),ce.stopPropagation())},Y=ce=>{if(!(ce.ctrlKey||ce.metaKey)||!S())return;ce.preventDefault(),h===0&&x();let pe=Math.min(Math.max(-ce.deltaY,-24),24);H((h||E())*2**(pe*.02),ce.clientX,ce.clientY)},ne=ce=>{!S()||G(ce)||(ce.preventDefault(),h!==0?C():H(Math.max(1,E()*2),ce.clientX,ce.clientY))},q=ce=>{if(!S()||G(ce)||ce.ctrlKey||ce.metaKey||ce.altKey)return;let pe=ce.key;if(pe===\\\"+\\\"||pe===\\\"=\\\")H((h||E())*Ii);else if(pe===\\\"-\\\")H((h||E())/Ii);else{if(h===0)return;if(pe===\\\"0\\\"||pe===\\\"Escape\\\")C();else if(pe===\\\"ArrowLeft\\\")M(oc,0);else if(pe===\\\"ArrowRight\\\")M(-oc,0);else if(pe===\\\"ArrowUp\\\")M(0,oc);else if(pe===\\\"ArrowDown\\\")M(0,-oc);else return}ce.preventDefault()},k=ce=>{if(!r||ce.target!==r)return;let pe=!0;try{pe=r.matches(\\\":focus-visible\\\")}catch{}r.style.outline=pe?\\\"\\\":\\\"none\\\"},J=0,te=ce=>{S()&&(ce.preventDefault(),h===0&&x(),J=h||E())},se=ce=>{if(J===0)return;ce.preventDefault();let{scale:pe,clientX:V,clientY:X}=ce;H(J*pe,V,X)},re=()=>{J=0},P=[[\\\"pointerdown\\\",B,{capture:!0}],[\\\"pointerdown\\\",F],[\\\"pointermove\\\",W],[\\\"pointerup\\\",j],[\\\"pointercancel\\\",j],[\\\"click\\\",Q,{capture:!0}],[\\\"dblclick\\\",ne],[\\\"keydown\\\",q],[\\\"focusin\\\",k]];for(let[ce,pe,V]of P)e.addEventListener(ce,pe,V);let ee=[[\\\"wheel\\\",Y,{passive:!1}],[\\\"gesturestart\\\",te,{passive:!1}],[\\\"gesturechange\\\",se,{passive:!1}],[\\\"gestureend\\\",re,{passive:!1}]],ae=!1;function ue(ce){if(ce!==ae){ae=ce;for(let[pe,V,X]of ee)ce?e.addEventListener(pe,V,X):e.removeEventListener(pe,V,X);ce||(J=0)}}return p=e.clientWidth+e.clientHeight,g(),{get scale(){return h||E()},get fit(){return E()},zoomBy(ce){H((h||E())*ce)},zoomTo(ce){H(ce)},reset:C,refresh:g,resized:T,destroy(){C(),oe(),r&&(r.style.touchAction=\\\"\\\",r.removeAttribute(\\\"tabindex\\\")),I?.remove(),O&&(e.style.position=\\\"\\\"),R?.disconnect(),ue(!1);for(let[ce,pe,V]of P)e.removeEventListener(ce,pe,V)}}}function xu(e,t){let n=t?Gs(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 y_(e){return[...new Set([e.ownerDocument?.fonts,globalThis.document?.fonts])].filter(n=>n!==void 0)}var Au=new WeakMap;function E_(e){let t=Au.get(e);return t||(t=e.ready.then(()=>{Au.delete(e),nc()}),Au.set(e,t)),t}var Su=new WeakMap;function x_(e,t){Promise.all(e.map(E_)).then(()=>{let n=t.deref();n&&Su.get(n)?.()})}var ac=new WeakMap,A_=0,S_=Math.random().toString(36).slice(2,7),w_=\\\"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;\\\",__=\\\"margin:0;font-size:0.8em;font-family:var(--pele-font-mono,monospace);color:var(--pele-error,#e45756);white-space:pre-wrap;\\\";function R_(e){return e instanceof Error?e.message:String(e)}function T_(e){let t=e.split(`\\r\\n`).filter(n=>n.trim()!==\\\"\\\");return t.length>1?`${t[0]} ${t[t.length-1]}`:t[0]??\\\"\\\"}function vm(e,t,n,r={}){ac.get(t)?.destroy();let i=n,s=r,a,o,c=!1,l,u,h,d=`pele-${S_}-${++A_}`,m={},p,y=-1,E=!1,b=!1,S=!1,x=(A,D)=>{let{onRender:U,onError:B,sanitize:F,...W}=s,j={...W,idPrefix:W.idPrefix??d,fontFamily:W.fontFamily??m.family,fontFamilyMono:W.fontFamilyMono??m.mono,maxWidth:void 0};D&&(u=e.render(a,j),p=void 0);let Q=s.maxWidth??yu(t,A);return y=Q,Q>0&&Q\u003Cu.width&&(p??=e.render(a,{...j,maxWidth:1}).svg!==u.svg,p)?e.render(a,{...j,maxWidth:Q}):u},I=A=>{s.sanitize?t.replaceChildren(s.sanitize(A)):t.innerHTML=A},L,O=()=>{let A=h?t.firstElementChild:null;if(A?.style&&(A.style.opacity=l===void 0?\\\"\\\":\\\"0.4\\\"),l===void 0){L?.remove(),L=void 0;return}let D=t.ownerDocument;if(!D)return;L??=D.createElement(\\\"div\\\"),L.className=\\\"pele pele-error\\\";let U=R_(l);A?(L.textContent=T_(U),L.title=U,L.setAttribute(\\\"style\\\",w_),L.parentNode!==t&&t.append(L)):(L.textContent=U,L.removeAttribute(\\\"title\\\"),L.setAttribute(\\\"style\\\",__),t.replaceChildren(L))},v=A=>{l=A,O(),s.onError?.(A)},G=()=>{if(b||S)return;let A=y_(t).filter(D=>D.status===\\\"loading\\\");A.length!==0&&(b=!0,x_(A,new WeakRef(w)))},K=()=>{b=!1,E=!0,T()},C=(A,D=!A)=>{let U=Gs(t).getComputedStyle(t),B=t.firstElementChild??null,F={fonts:m,natural:u,adapts:p,drawnFor:y,stale:E},W;try{if(A&&(m=xu(U,B),E=t.isConnected===!1),W=x(U,A),D&&W.svg===h?.svg){A&&(o=a),c&&l!==void 0&&(l=void 0,O());return}I(W.svg)}catch(j){throw{fonts:m,natural:u,adapts:p,drawnFor:y,stale:E}=F,j}if(A&&(o=a),A&&!B&&t.firstElementChild){let j=xu(U,t.firstElementChild);if(j.family!==m.family||j.mono!==m.mono){let Q={fonts:m,natural:u,adapts:p,drawnFor:y};m=j;try{let Y=x(U,!0);I(Y.svg),W=Y}catch{({fonts:m,natural:u,adapts:p,drawnFor:y}=Q)}}}h=W,c&&(l=void 0),O(),Z?.refresh(),G(),s.onRender?.(W)},Z,oe=!1,H=()=>{let A=s.zoom??\\\"auto\\\";A!==oe&&(Z?.destroy(),oe=A,Z=A===!1?void 0:Eu(t,typeof A==\\\"object\\\"?A:{always:A===!0},!1))},z=()=>t.isConnected===!1||!(t.clientWidth>0),M=()=>t.isConnected!==!1&&!(t.clientWidth>0),T=()=>{if(S||(N(),!a||z()))return;let A=Gs(t).getComputedStyle(t),D=xu(A,t.firstElementChild??null);try{if(E||D.family!==m.family||D.mono!==m.mono)C(!0,!0);else if(p!==!1&&s.maxWidth===void 0){let U=yu(t,A);U!==y&&U!==h?.width&&C(!1)}}catch(U){E=!1,c&&(l=U),a!==o&&(a=o,c=!1),O(),s.onError?.(U)}Z?.resized(),G()},R,_,$,g=()=>{$!==void 0&&R?.cancelAnimationFrame($),$=void 0},N=()=>{let A=Gs(t);A!==R&&(_?.disconnect(),g(),R=A,_=A.ResizeObserver?new A.ResizeObserver(()=>{if($===void 0){if(!A.requestAnimationFrame)return T();$=A.requestAnimationFrame(()=>{$=void 0,T()})}}):void 0,_?.observe(t))},w={get result(){return h},get source(){return i},get error(){return l},get zoom(){return Z},update(A,D=s){let U=!c||A!==i||D.limit!==s.limit||D.maxEdges!==s.maxEdges||D.config!==s.config;i=A,s=D;let B=a;if(U)try{B=e.parse(A,D)}catch(W){c=!1,v(W),H();return}let F=h;if(a=B,c=!0,M()){E=!0,H();return}try{C(!0)}catch(W){if(h!==F)throw H(),W;a=o,c=!1,v(W)}H()},refresh:T,destroy(){S=!0,_?.disconnect(),_=void 0,g(),R=void 0,Z?.destroy(),Su.delete(w),ac.get(t)===w&&ac.delete(t)}};Su.set(w,K);try{a=e.parse(n,r),c=!0,C(!0)}catch(A){if(h)throw A;a=o,c=!1,v(A)}return H(),N(),ac.set(t,w),w}var cc=new Map;function wu(...e){for(let t of e)cc.set(t.type,t)}function M_(e){return cc.has(e)}var C_=5e4,N_=4e6,I_=5e3;function Pm(e){try{return e()}catch(t){throw t instanceof RangeError?new Qe(\\\"Diagram is nested too deeply.\\\",\\\"limit\\\"):t}}function Fm(e,t){try{return t()}catch(n){if(n instanceof RangeError)throw new Qe(\\\"Diagram is nested too deeply.\\\",\\\"limit\\\",e);if(n instanceof Qe){n.type??=e.type,n.mermaidType??=e.mermaidType;let r=xo(n.message);r!==n.message&&(n.stack=n.stack?.replace(n.message,()=>r),n.message=r),n.snippet=xo(n.snippet)}throw n}}var Bm=new WeakMap;function Wm(e,t=C_,n=I_,r){if(e.length>t)throw new Qe(`Diagram source is longer than the limit of ${t} characters.`,\\\"limit\\\");let i=tc(e),s=nu(i.text);if(s===null)throw new Qe(\\\"No diagram type detected for the given text.\\\",\\\"unsupported-diagram\\\");let a=cc.get(s.type);if(a===void 0)throw new Qe(`Diagram type \\\"${s.type}\\\" is not supported yet.`,\\\"unsupported-diagram\\\",s);let o=r?{...r,...i.config}:i.config,c=a.keepComments===!0,l=uu(c?i.withComments:i.text)+`\\r\\n`,u=Fm(s,()=>em({parsed:l,find:k_(e,c)},()=>a.parse(l,o,i.title,i.lineOffset,{maxEdges:n})));return{...s,diagram:a,model:u,config:o}}function k_(e,t){let n,r=\\\"\\\";return i=>{if(n===void 0){n=[];let s=tc(e,n);uu(t?s.withComments:lu(s.withComments,n),n),r=du(e)+`\\r\\n`}return[r,zr(n,i)]}}function $_(e,t){if(typeof e==\\\"string\\\")return Wm(e,t.limit,t.maxEdges,t.config);let n=Bm.get(e);if(n===void 0)throw new TypeError(\\\"render() takes diagram text or a model that parse() returned.\\\");return n}function Um(e){return nu(tc(e).text)?.type??null}function L_(e){try{let t=Um(e);return t!==null&&cc.has(t)}catch{return!1}}function Gm(e,t={}){return Pm(()=>{let n=Wm(e,t.limit,t.maxEdges,t.config),r=n.model;return Object.defineProperty(r,\\\"mermaidType\\\",{value:n.mermaidType,enumerable:!0}),Bm.set(r,n),r})}function Ym(e,t={}){return Pm(()=>{let{type:n,mermaidType:r,diagram:i,model:s,config:a}=$_(e,t),o=a[i.section??n],c=typeof o==\\\"object\\\"&&o!==null&&!Array.isArray(o)&&o.useMaxWidth===!1,l=t.responsive??!c,u=t.icons,h=u&&(p=>u(bt(p))),d=Fm({type:n,mermaidType:r},()=>Lm($m(n,a),()=>om(i.math?t.math:void 0,()=>sm(h,()=>i.render(s,a,{...t,responsive:l,icons:h}))))),m=t.outputLimit??N_;if(d.svg.length>m)throw new Qe(`Diagram output is longer than the limit of ${m} characters.`,\\\"limit\\\",{type:n,mermaidType:r});for(let p of d.links)p.id=bt(p.id);return{type:n,mermaidType:r,...d}})}function O_(e,t,n={}){return vm({parse:Gm,render:Ym},e,t,n)}var Io=\\\"about:blank\\\",D_=/^([^\\\\w]*)(javascript|data|vbscript)/im,Hm=/&#(\\\\w+)(^\\\\w|;)?/g,Km=/&(newline|tab);/gi,_u=/[\\\\u0000-\\\\u001F\\\\u007F-\\\\u009F -‍\\\\uD800-\\\\uDFFF\\\\uFFFE\\\\uFFFF]/gimu,v_=/^.+(:|:)/gim,zm=/(\\\\\\\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;function Vm(e){try{return decodeURIComponent(e)}catch{return e}}function Ru(e,t){let n=t?Vm(e.trim()):e.trim(),r,i=0;do{if(++i>32)return;n=n.replace(_u,\\\"\\\").replace(Hm,(s,a)=>String.fromCharCode(a)).replace(Km,\\\"\\\").replace(_u,\\\"\\\").replace(zm,\\\"\\\").trim(),t&&(n=Vm(n)),r=n.match(_u)||n.match(Hm)||n.match(Km)||n.match(zm)}while(r&&r.length>0);return n}function ki(e){if(!e)return Io;let t=Ru(e,!0),n=Ru(e,!1);if(!t||!n)return Io;if(t[0]===\\\".\\\"||t[0]===\\\"/\\\")return n;let r=t.trimStart().match(v_);if(!r)return n;let i=r[0].toLowerCase().trim();if(D_.test(i))return Io;let s=n.trimStart().replace(/\\\\\\\\/g,\\\"/\\\");if(i===\\\"mailto:\\\"||i.includes(\\\"://\\\"))return s;if(i===\\\"http:\\\"||i===\\\"https:\\\"){let a;try{a=new URL(s)}catch{return Io}return a.protocol=a.protocol.toLowerCase(),a.hostname=a.hostname.toLowerCase(),a.toString()}return s}function Qn(e){return ki(bt(e))}var P_=[\\\"http\\\",\\\"https\\\",\\\"mailto\\\",\\\"tel\\\"],F_=[\\\"http\\\",\\\"https\\\"],B_=/^([a-z][a-z0-9+.-]*):/i,W_=/^[\\\\\\\\/]{2}/;function jm(e,t){if(W_.test(e))return!1;let n=B_.exec(e);return!n||t.includes(n[1].toLowerCase())}function Xm(e,t){let n=Ru(e,!0);return n!==void 0&&jm(e,t)&&jm(n,t)?e:void 0}function ko(e,t){return t.links===!1?void 0:Xm(e,t.linkSchemes??P_)}function qm(e,t){return t.images===!1?void 0:Xm(e,t.imageSchemes??F_)}var U_=new RegExp(rc.source,\\\"gu\\\");function $i(e,t){let n=ki(e);if(n===Io||ko(n,t)===void 0)return!1;let r=e.replace(U_,\\\"\\\").replace(/[\\\\t\\\\n\\\\r]/g,\\\"\\\").replace(/^[\\\\x00-\\\\x20]+/,\\\"\\\");return ko(r,t)!==void 0}function Zn(e,t,n,r,i,s=\\\"\\\"){let a=ko(t,i);return a===void 0?e:(r.push({id:n,href:a,internal:!1}),`\u003Ca href=\\\"${rt(a)}\\\"${s}${qr(i)}>${e}\u003C/a>`)}function qr(e){let t=e.linkRel??\\\"noopener\\\";return t?` rel=\\\"${rt(t)}\\\"`:\\\"\\\"}var G_=[[\\\"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\\\"]],Y_=[\\\"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\\\"],H_=new Map([[\\\"square\\\",\\\"rect\\\"],[\\\"round\\\",\\\"rounded\\\"],[\\\"ellipse\\\",\\\"ellipse\\\"],[\\\"hexagon\\\",\\\"hex\\\"],[\\\"diamond\\\",\\\"diam\\\"]]),lc=new Map;for(let e of G_)for(let t of e)lc.set(t,e[0]);for(let e of Y_)lc.set(e,e);function dc(e){return lc.has(e)}function uc(e){return e===void 0?\\\"rect\\\":H_.get(e)??lc.get(e)??\\\"rect\\\"}var K_=new Map([[\\\"task\\\",\\\"roundedRect\\\"],[\\\"tool\\\",\\\"subroutine\\\"],[\\\"input\\\",\\\"lean-right\\\"],[\\\"decision\\\",\\\"diamond\\\"],[\\\"refdoc\\\",\\\"lin-doc\\\"],[\\\"action\\\",\\\"hexagon\\\"],[\\\"round\\\",\\\"rect\\\"]]),z_=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\\\"]),V_=new Set([\\\"roundedRect\\\",\\\"subroutine\\\",\\\"subprocess\\\",\\\"subproc\\\",\\\"framed-rectangle\\\",\\\"lean-right\\\",\\\"diamond\\\",\\\"lin-doc\\\",\\\"lined-document\\\",\\\"hexagon\\\",\\\"hex\\\",\\\"connector\\\",\\\"collapsedGroup\\\"]),$o=\\\"roundedRect\\\";function Li(e){return e&&(K_.get(e)??e)}function Qm(e){return dc(e)||e===\\\"constructor\\\"}function Zm(e,t){for(let n of e)n.isGroup||((!n.shape||n.shape===\\\"squareRect\\\"||n.shape===\\\"rect\\\")&&(n.shape=$o),z_.has(n.shape)?(t.emitError(\\\"SHAPE_REMOVED\\\",`shape \\\"${n.shape}\\\" was removed in v0.8.1, using \\\"${$o}\\\"`,{nodeId:n.id}),n.shape=$o):V_.has(n.shape)||(t.emitWarning(\\\"SHAPE_UNSUPPORTED\\\",`shape \\\"${n.shape}\\\" is not supported, using \\\"${$o}\\\"`,{nodeId:n.id}),n.shape=$o))}var j_=new Set([\\\"shape\\\",\\\"view\\\",\\\"icon\\\",\\\"img\\\",\\\"form\\\",\\\"pos\\\",\\\"w\\\",\\\"h\\\",\\\"class\\\",\\\"style\\\",\\\"labelType\\\"]),X_=new Set([\\\"subroutine\\\",\\\"subprocess\\\",\\\"subproc\\\",\\\"framed-rectangle\\\",\\\"tool\\\"]);function q_(e){return X_.has(e.type)}function Tu(e){return e===\\\"markdown\\\"||e===\\\"string\\\"||e===\\\"text\\\"?e:\\\"markdown\\\"}function Jm(e){return e.startsWith('\\\"')&&e.endsWith('\\\"')?e.substring(1,e.length-1):e}function Mu(e){return typeof e==\\\"object\\\"&&e!==null&&!Array.isArray(e)}function Q_(e){let t=i=>Array.isArray(i)?[]:Mu(i)?{}:i,n=t(e),r=[[e,n]];for(;r.length>0;){let[i,s]=r.pop();if(Array.isArray(i))for(let a of i){let o=t(a);s.push(o),typeof a==\\\"object\\\"&&a!==null&&r.push([a,o])}else if(Mu(i))for(let a of Object.keys(i)){if(a===\\\"__proto__\\\"||a===\\\"constructor\\\"||a===\\\"prototype\\\")continue;let o=i[a],c=t(o);s[a]=c,typeof o==\\\"object\\\"&&o!==null&&r.push([o,c])}}return n}function fc(e,t){return Object.assign(e??{},t)}var Z_=/:\\\\s*[>|][\\\\d+-]*\\\\s*$/,J_=/,([\\\\t ]*)$/;function eR(e){let t=!1,n=!1,r=0,i,s=[];for(let a of e.split(`\\r\\n`)){if(i!==void 0){let u=a.length-a.trimStart().length;if(a.trim()===\\\"\\\"||u>i){s.push(a);continue}i=void 0}let o=-1;for(let u=0;u\u003Ca.length;u++){let h=a[u];if(n)h===\\\"\\\\\\\\\\\"?u++:h==='\\\"'&&(n=!1);else if(t)h===\\\"'\\\"&&(t=!1);else if(h==='\\\"')n=!0;else if(h===\\\"'\\\")t=!0;else if(h===\\\"#\\\"&&(u===0||a[u-1]===\\\" \\\"||a[u-1]===\\\"\\t\\\")){o=u;break}else h===\\\"[\\\"||h===\\\"{\\\"?r++:(h===\\\"]\\\"||h===\\\"}\\\")&&(r=Math.max(0,r-1))}if(t||n||r>0){s.push(a);continue}let c=o>=0?a.slice(0,o):a,l=o>=0?a.slice(o):\\\"\\\";if(Z_.test(c)){i=a.length-a.trimStart().length,s.push(a);continue}s.push(c.replace(J_,\\\"$1\\\")+l)}return s.join(`\\r\\n`)}function tR(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 nR(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;break}let i=\\\"normal\\\",s=n.length-1,a=0;for(let o=0;o\u003Cn.length;o++)n[o]===\\\".\\\"&&a++;return a>0&&(i=\\\"dotted\\\",s=a),{type:r,stroke:i,length:s}}function eg(e){if(!e)return;let t={},n=!1;for(let r of Object.keys(e))j_.has(r)||(t[r]=e[r],n=!0);return n?t:void 0}var hc=class{constructor(t={}){fe(this,\\\"type\\\",\\\"agentflow\\\");fe(this,\\\"direction\\\");fe(this,\\\"nodes\\\",new Map);fe(this,\\\"edges\\\",[]);fe(this,\\\"subgraphs\\\",[]);fe(this,\\\"connectors\\\",new Map);fe(this,\\\"classes\\\",new Map);fe(this,\\\"tooltips\\\",new Map);fe(this,\\\"defaultEdgeStyle\\\");fe(this,\\\"defaultInterpolate\\\");fe(this,\\\"mappings\\\",[]);fe(this,\\\"diagnostics\\\",[]);fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"lineOffset\\\");fe(this,\\\"subgraphLookup\\\",new Map);fe(this,\\\"globalNodes\\\",new Set);fe(this,\\\"members\\\",new Set);fe(this,\\\"edgeById\\\",new Map);fe(this,\\\"pairCount\\\",new Map);fe(this,\\\"subCount\\\",0);fe(this,\\\"bareMappings\\\",new Set);fe(this,\\\"firstMapping\\\",new Map);fe(this,\\\"reported\\\",new Map);fe(this,\\\"options\\\");this.options=t,this.lineOffset=t.lineOffset??0}metadata(t,n,r){let i=n.includes(`\\r\\n`),s;try{s=lr(i?n+`\\r\\n`:`{\\r\\n`+n+`\\r\\n}`)}catch(a){let o=i?eR(n):n,c;if(o!==n)try{c=lr(o+`\\r\\n`)}catch{c=void 0}if(c===void 0){let{line:l,column:u}=this.errorAt(r),h=r?` (${l}:${u})`:\\\"\\\";throw new Qe(`Metadata of \\\"${t}\\\" is not valid YAML. ${a.message}${h}`,\\\"syntax\\\",{type:\\\"agentflow\\\",line:l,column:u})}s=c}return Q_(s??{})}errorAt(t){if(t===void 0)return{line:0,column:0};let n=this.options.source;if(n===void 0)return{line:t.first_line+this.lineOffset,column:t.first_column+1};let r=0;for(let a=1;a\u003Ct.first_line;a++)r=n.indexOf(`\\r\\n`,r)+1;let{line:i,column:s}=cr(n,r+t.first_column);return{line:i,column:s}}shapeError(t,n){return new Qe(t,\\\"semantic\\\",{type:\\\"agentflow\\\",...this.errorAt(n)})}addVertex(t,n,r,i,s,a,o={},c,l){if(!t||t.trim().length===0)return;let u,h,d;c!==void 0&&(u=this.metadata(t,c,l),Mu(u)&&(h=u,typeof u.shape==\\\"string\\\"&&(d=u.shape,u.shape=Li(u.shape))));let m=this.subgraphLookup.get(t);if(m&&u){m.metadata=fc(m.metadata,u);return}let p=this.connectors.get(t);if(p&&u){p.metadata=fc(p.metadata,u);return}if(t===\\\"connectors\\\")return;let y=this.edgeById.get(t);if(y){h?.animate!==void 0&&(y.animate=h.animate),h?.animation!==void 0&&(y.animation=h.animation),h?.curve!==void 0&&(y.interpolate=h.curve),u&&(y.metadata=fc(y.metadata,u));return}let E=this.nodes.get(t);if(E===void 0&&(E={id:t,labelType:\\\"text\\\",styles:[],classes:[]},this.nodes.set(t,E)),n!==void 0?(E.labelType=n.type,E.text=Jm(n.text.trim())):E.text===void 0&&(E.text=t),r!==void 0&&(E.type=r),i!=null)for(let b of i)E.styles.push(b);if(s!=null)for(let b of s)E.classes.push(b);if(a!==void 0&&(E.dir=a),E.props===void 0?E.props=o:o!==void 0&&Object.assign(E.props,o),!!u&&(E.metadata=fc(E.metadata,u),h!==void 0)){if(h.shape){let b=d??h.shape;if(typeof b!=\\\"string\\\")throw this.shapeError(`No such shape: ${JSON.stringify(b)}.`,l);if(b!==b.toLowerCase()||b.includes(\\\"_\\\"))throw this.shapeError(`No such shape: ${b}. Shape names should be lowercase.`,l);let S=h.shape;if(!Qm(S))throw this.shapeError(`No such shape: ${S}.`,l);E.type=S}h.label&&(E.text=String(h.label),E.labelType=Tu(h.labelType))}}addSingleLink(t,n,r,i){let s={start:t,end:n,type:void 0,text:\\\"\\\",labelType:\\\"text\\\",classes:[],isUserDefinedId:!1,interpolate:this.defaultInterpolate},a=r?.text;a!==void 0&&(s.text=Jm(a.text.trim()),s.labelType=Tu(a.type)),r!==void 0&&(s.type=r.type,s.stroke=r.stroke,s.length=r.length>10?10:r.length,r.edgeSemantic&&(s.edgeSemantic=r.edgeSemantic));let o=t+\\\"\\\\0\\\"+n,c=this.pairCount.get(o)??0;i&&!this.edgeById.has(i)?(s.id=i,s.isUserDefinedId=!0):s.id=`L_${t}_${n}_${c===0?0:c+1}`;let l=this.options.maxEdges;if(l!==void 0&&this.edges.length>=l)throw new Qe(`Edge limit exceeded. The limit is ${l}.`,\\\"limit\\\",{type:\\\"agentflow\\\"});this.edges.push(s),this.pairCount.set(o,c+1),this.edgeById.has(s.id)||this.edgeById.set(s.id,s)}addLink(t,n,r){let i=typeof r?.id==\\\"string\\\"?r.id.replace(\\\"@\\\",\\\"\\\"):void 0,s=t[t.length-1],a=n[0];for(let o of t)for(let c of n)this.addSingleLink(o,c,r,o===s&&c===a?i:void 0)}updateLinkInterpolate(t,n){for(let r of t)r===\\\"default\\\"?this.defaultInterpolate=n:this.edgeAt(r).interpolate=n}updateLink(t,n){for(let r of t){if(r===\\\"default\\\"){this.defaultEdgeStyle=n;continue}let i=this.edgeAt(r);i.style=n,n.length>0&&!n.some(s=>s?.startsWith(\\\"fill\\\"))&&n.push(\\\"fill:none\\\")}}edgeAt(t){let n=this.edges[Number(t)];if(n===void 0)throw new Qe(`The index ${t} 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 n}addClass(t,n){let r=n.join().replace(/\\\\\\\\,/g,\\\"§§§\\\").replace(/,/g,\\\";\\\").replace(/§§§/g,\\\",\\\").split(\\\";\\\");for(let i of t.split(\\\",\\\")){let s=this.classes.get(i);s===void 0&&(s={id:i,styles:[],textStyles:[]},this.classes.set(i,s));for(let a of r)a.includes(\\\"color\\\")&&s.textStyles.push(a.replace(\\\"fill\\\",\\\"bgFill\\\")),s.styles.push(a)}}setDirection(t){let n=t.trim();n.includes(\\\"\u003C\\\")&&(n=\\\"RL\\\"),n.includes(\\\"^\\\")&&(n=\\\"BT\\\"),n.includes(\\\">\\\")&&(n=\\\"LR\\\"),n.includes(\\\"v\\\")&&(n=\\\"TB\\\"),n===\\\"TD\\\"&&(n=\\\"TB\\\"),this.direction=n}setClass(t,n){for(let r of t.split(\\\",\\\"))this.nodes.get(r)?.classes.push(n),this.edgeById.get(r)?.classes.push(n),this.subgraphLookup.get(r)?.classes.push(n)}setTooltip(t,n){if(n!==void 0)for(let r of t.split(\\\",\\\"))this.tooltips.set(r,n)}setLink(t,n,r){let i=n.trim();for(let s of t.split(\\\",\\\")){let a=this.nodes.get(s);a!==void 0&&(a.link=i?Qn(i):void 0,a.linkTarget=r)}this.setClass(t,\\\"clickable\\\")}setClickEvent(t,n,r){this.setClass(t,\\\"clickable\\\")}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}addSubGraph(t,n,r,i){let s=t?.text?.trim(),a=r?.text||\\\"\\\";t!==void 0&&t===r&&/\\\\s/.test(a)&&(s=void 0);let o=new Set,c=[],l;for(let p of n)if(typeof p==\\\"string\\\")p.trim()!==\\\"\\\"&&!o.has(p)&&(o.add(p),c.push(p));else if(Array.isArray(p))for(let y of p)y.trim()!==\\\"\\\"&&!o.has(y)&&(o.add(y),c.push(y));else l=p.value;l??=this.options.inheritDir?this.direction??this.options.direction:void 0,s??=\\\"subGraph\\\"+this.subCount,this.subCount++;let u=this.members,h=c.filter(p=>p!==s&&!this.globalNodes.has(p)&&!u.has(p));for(let p of h)u.add(p);let d=this.subgraphLookup.get(s);if(d){for(let p of h)d.nodes.push(p);return a.trim()&&(d.title=a.trim()),l&&(d.dir=l),s}let m={id:s,nodes:h,title:a.trim(),classes:[],dir:l,labelType:Tu(r?.type),type:\\\"flow\\\"};return this.subgraphs.push(m),this.subgraphLookup.set(s,m),s}addGlobal(t){let n=!1,r=i=>{let s=i.trim();s!==\\\"\\\"&&(this.globalNodes.add(s),this.members.delete(s)&&(n=!0))};for(let i of t)if(typeof i==\\\"string\\\")r(i);else if(Array.isArray(i))for(let s of i)r(s);if(n)for(let i of this.subgraphs)i.nodes=i.nodes.filter(s=>!this.globalNodes.has(s))}addConnector(t,n){let r=t?.text?.trim();if(!r)return\\\"\\\";let i=n?.text?.trim()??\\\"\\\",s=this.connectors.get(r);if(s)i.length>0&&(s.text=i);else{let a={id:r,labelType:\\\"text\\\",styles:[],classes:[],isConnector:!0,text:i.length>0?i:r};this.connectors.set(r,a),this.nodes.set(r,a)}return r}destructLink(t,n){let r=nR(t);return n&&(n.includes(\\\".\\\")?\\\"dotted\\\":\\\"normal\\\")!==r.stroke?{type:\\\"INVALID\\\",stroke:\\\"INVALID\\\"}:{...r,edgeSemantic:tR(r.type,r.stroke)}}subgraph(t){return this.subgraphLookup.get(t)}vertexKind(t){if(q_(t))return\\\"tool\\\";let n=Li(t.type);return n===\\\"hexagon\\\"||n===\\\"hex\\\"?\\\"action\\\":n===\\\"lean-right\\\"||n===\\\"lean_right\\\"?\\\"input\\\":n===\\\"lin-doc\\\"||n===\\\"lined-document\\\"?\\\"refdoc\\\":n===\\\"diamond\\\"?\\\"decision\\\":\\\"task\\\"}semanticModel(){let t=[],n=[];for(let[a,o]of this.nodes){if(this.subgraphLookup.has(a))continue;let c=eg(o.metadata);if(o.isConnector){let h={id:a};o.text!==void 0&&o.text!==a&&(h.title=o.text),c&&(h.metadata=c),n.push(h);continue}let l={id:a};o.text!==void 0&&(l.label=o.text);let u=Li(o.type);u!==void 0&&(l.shape=u),l.vertexKind=this.vertexKind(o),c&&(l.metadata=c),t.push(l)}let r=this.edges.map(a=>{let o={start:a.start,end:a.end};return a.id!==void 0&&(o.id=a.id),a.text.length>0&&(o.label=a.text),a.type!==void 0&&(o.type=a.type),a.stroke!==void 0&&(o.stroke=a.stroke),a.edgeSemantic!==void 0&&(o.edgeSemantic=a.edgeSemantic),a.length!==void 0&&(o.length=a.length),a.metadata&&Object.keys(a.metadata).length>0&&(o.metadata={...a.metadata}),o}),i=this.subgraphs.map(a=>{let o={id:a.id,nodes:[...a.nodes],type:a.type,title:a.title};a.dir!==void 0&&(o.direction=a.dir);let c=eg(a.metadata);return c&&(o.metadata=c),o}),s={vertices:t,edges:r,subGraphs:i,connectors:n,diagnostics:this.diagnostics};return this.direction!==void 0&&(s.direction=this.direction),s}position(t){let n=t?.first_line??0,r=t?.first_column??0;return{startLine:n+this.lineOffset,startColumn:r,endLine:(t?.last_line??n)+this.lineOffset,endColumn:t?.last_column??r,startIndex:0,endIndex:0}}pushMapping(t,n,r){let i={id:t,type:n,position:r};return this.mappings.push(i),this.firstMapping.has(t)||this.firstMapping.set(t,i),i}addVertexMapping(t,n,r,i){if(!t)return;let s=this.pushMapping(t,\\\"vertex\\\",this.position(i));r==null&&this.bareMappings.add(s)}extendVertexMapping(t,n){if(!t||!n)return;let r=this.position(n);for(let i=this.mappings.length-1;i>=0;i--){let s=this.mappings[i];if(s.type!==\\\"vertex\\\"||s.id!==t)continue;this.bareMappings.delete(s)&&(s.type=\\\"attachment\\\");let a=s.position;(r.endLine>a.endLine||r.endLine===a.endLine&&r.endColumn>a.endColumn)&&(a.endLine=r.endLine,a.endColumn=r.endColumn);return}this.pushMapping(t,\\\"attachment\\\",r)}addEdgeMapping(t,n,r,i){let s=Array.isArray(n)?n.filter(a=>typeof a==\\\"string\\\"&&a!==\\\"\\\"):[];this.pushMapping(s.length>0?s.join(\\\">\\\"):\\\"edge\\\",\\\"edge\\\",this.position(i))}blockMapping(t,n,r,i){if(!t)return;let s=this.position(r),a=i?this.position(i):s;this.pushMapping(t,n,{startLine:s.startLine,startColumn:s.startColumn,endLine:a.endLine,endColumn:a.endColumn,startIndex:0,endIndex:0})}addSubgraphMapping(t,n,r,i){let s=typeof t==\\\"string\\\"?t:t?.text;this.blockMapping(s??\\\"\\\",\\\"subgraph\\\",r,i)}addConnectorMapping(t,n,r,i){this.blockMapping(t?.text?.trim()??\\\"\\\",\\\"connector\\\",r,i)}emit(t,n,r,i){let s=i?.nodeId??i?.edgeId,a={id:t,severity:n,message:r};i?.nodeId?a.nodeId=i.nodeId:i?.edgeId&&(a.edgeId=i.edgeId);let o=s?this.firstMapping.get(s):void 0;o&&(a.position=o.position);let c=s??\\\"\\\",l=this.reported.get(c);if(l===void 0)this.reported.set(c,[a]);else{for(let u of l)if(u.id===t&&u.severity===n&&u.message===r&&u.nodeId===a.nodeId&&u.edgeId===a.edgeId)return;l.push(a)}this.diagnostics.push(a),this.options.log?.(n,`agentflow[${t}]: ${r}`)}emitWarning(t,n,r){this.emit(t,\\\"warning\\\",n,r)}emitError(t,n,r){this.emit(t,\\\"error\\\",n,r)}};var rR=\\\"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\\\",sR;function iR(){let e=rR.split(\\\" \\\"),t=new Uint16Array(e.length),n=0;for(let r=0;r\u003Ce.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 Oi(e){if(e\u003C170||e>65500)return!1;let t=sR??=iR(),n=0,r=(t.length>>1)-1;for(;n\u003C=r;){let i=n+r>>1;if(e\u003Ct[i*2])r=i-1;else if(e>t[i*2+1])n=i+1;else return!0}return!1}var Cu=[\\\"$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\\\"];var tg=new Uint8Array(128);for(let e of\\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\\\\\\\"#$%&'*+.`?\\\\\\\\_/\\\")tg[e.charCodeAt(0)]=1;var oR=/accTitle\\\\s*:\\\\s*/y,aR=/accDescr\\\\s*:\\\\s*/y,cR=/accDescr\\\\s*\\\\{\\\\s*/y,lR=/call\\\\s+/y,dR=/click\\\\s+/y,uR=/(?:\\\\r?\\\\n)*\\\\s*\\\\n/y,fR=/\\\\s*(?:LR|RL|TB|BT|TD|BR)\\\\b/y,hR=/\\\\s*[\u003C>^]/y,pR=/\\\\s*v\\\\b/y,mR=[/.*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],Nu=/[\\\\n\\\\r\\\\u2028\\\\u2029]/g,gR=/\\\\(\\\\s*\\\\)/y,bR=/\\\\n\\\\s*/g;function ng(e){let t=e.length,n=[],r=[],i=[],s=[],a=[],o=0,c=0,l=1,u=0,h=!0,d=e.indexOf(\\\"direction\\\"),m=e.indexOf(\\\"@\\\"),p=-1,y=0,E=0,b=-1,S=-1,x=-1,I=-1,L=-1,O=-1,v=-1,G=F=>{let W=-1;for(let j=c;j\u003CF;j++){let Q=e.charCodeAt(j);Q===10?(l++,W=j):Q===13&&(j+1\u003CF&&e.charCodeAt(j+1)===10&&j++,l++,W=j)}if(W\u003C0)u+=F-c;else{let j=W+1;for(;j\u003CF;){let Q=e.charCodeAt(j);if(Q===8232||Q===8233)break;j++}u=j-W-1}c=F},K=(F,W)=>{n.push(F),r.push(e.slice(c,W)),i.push(c),s.push(l,u),G(W),s.push(l,u)},C=(F,W)=>{n.push(F),r.push(e.slice(c,W)),i.push(c),s.push(l,u),u+=W-c,c=W,s.push(l,u)},Z=(F,W)=>{n.push(F),r.push(e.slice(c,W)),i.push(c),s.push(l,u);for(let j=c;j\u003CW;j++){let Q=e.charCodeAt(j);Q===10||Q===13?(l++,u=0):u++}c=W,s.push(l,u)},oe=(F,W,j)=>{n.push(F),r.push(W),i.push(c),s.push(l,u),G(j),s.push(l,u)},H=F=>{a.push(o),o=F},z=()=>{a.length>0&&(o=a.pop())},M=(F,W)=>(F.lastIndex=W,F.test(e)?F.lastIndex:-1),T=F=>e.startsWith(F,c)&&!ot(e.charCodeAt(c+F.length)),R=F=>{if(F>=S&&F\u003C=x)return x;let W=F;for(;W\u003Ct&&qe(e.charCodeAt(W));)W++;return S=F,x=W,W},_=F=>{if(F>=I&&F\u003C=L)return L;let W=F;for(;W\u003Ct;){let j=e.charCodeAt(W);if(j!==32&&j!==9)break;W++}return I=F,L=W,W},$=F=>{let W=R(F);if(W===v||e.charCodeAt(W)!==45||e.charCodeAt(W+1)!==45)return-1;let j=W+2;for(;e.charCodeAt(j)===45;)j++;let Q=e.charCodeAt(j);return Q===120||Q===62?R(j+1):(v=W,-1)},g=()=>{let F=R(c);if(F===O||e.charCodeAt(F)!==45)return!1;let W=e.charCodeAt(F+1),j=F+2;if(W===45){for(;e.charCodeAt(j)===45;)j++;let Q=e.charCodeAt(j);return Q===120||Q===62?K(42,R(j+1)):(H(10),K(43,R(F+2))),!0}if(W===46){for(;e.charCodeAt(j)===46;)j++;if(e.charCodeAt(j)===45)return K(42,R(j+1)),!0}return O=F,!1},N=F=>{if(e.charCodeAt(F)!==37||e.charCodeAt(F+1)!==37||e.charCodeAt(F+2)===123)return-1;let W=e.indexOf(`\\r\\n`,F+2);return W===-1?t:W},w=()=>{e.charCodeAt(c+1)===96?(H(2),G(c+2)):(H(1),G(c+1))},A=F=>{let W=e.charCodeAt(c+1);return F===40?(W===45?(H(8),C(47,c+2)):W===91?(H(7),C(49,c+2)):W===40&&e.charCodeAt(c+2)===40?(H(7),C(57,c+3)):(H(7),C(72,c+1)),!0):F===91?(W===91?(H(7),C(51,c+2)):W===40?(H(7),C(55,c+2)):W===47?(H(9),C(60,c+2)):W===92?(H(9),C(61,c+2)):(H(7),C(74,c+1)),!0):F===124?(H(7),C(70,c+1),!0):F===123?(H(7),C(76,c+1),!0):!1},D=()=>{let F=c;for(;F\u003Ct;){let W=e.charCodeAt(F);if(W\u003C128&&tg[W]===1)F++;else if(W===45&&F+1\u003Ct){let j=e.charCodeAt(F+1);if(j===62||j===45||j===46)break;F++}else break}return F===c?!1:(C(67,F),!0)},U=F=>{let W=F;for(;W\u003Ct;){let j=e.charCodeAt(W);if(j!==32&&j!==9)break;W++}return W},B=F=>{let W;switch(F){case 97:if(e.startsWith(\\\"acc\\\",c)){if((W=M(oR,c))>=0)return H(3),K(2,W),!0;if((W=M(aR,c))>=0)return H(4),K(4,W),!0;if((W=M(cR,c))>=0)return H(5),G(W),!0}if(T(\\\"agentflow-beta\\\"))return h&&(h=!1,H(6)),C(20,c+14),!0;break;case 64:if(e.charCodeAt(c+1)===123)return H(14),oe(7,\\\"\\\",c+2),!0;break;case 99:if((W=M(lR,c))>=0)return H(12),G(W),!0;if(T(\\\"classDef\\\"))return C(16,c+8),!0;if(T(\\\"class\\\"))return C(17,c+5),!0;if((W=M(dR,c))>=0)return H(11),G(W),!0;if(T(\\\"connector\\\"))return C(22,c+9),!0;break;case 34:return w(),!0;case 115:if(T(\\\"style\\\"))return C(12,c+5),!0;break;case 100:if(T(\\\"default\\\"))return C(13,c+7),!0;break;case 108:if(T(\\\"linkStyle\\\"))return C(14,c+9),!0;break;case 105:if(T(\\\"interpolate\\\"))return C(15,c+11),!0;break;case 104:if(e.startsWith(\\\"href\\\",c)&&qe(e.charCodeAt(c+4)))return K(18,c+5),!0;break;case 102:if(T(\\\"flow\\\"))return C(21,c+4),!0;break;case 103:if(T(\\\"global\\\"))return C(23,U(c+6)),!0;break;case 101:if(T(\\\"end\\\"))return C(24,U(c+3)),!0;break;case 95:if(T(\\\"_self\\\"))return C(25,c+5),!0;if(T(\\\"_blank\\\"))return C(25,c+6),!0;if(T(\\\"_parent\\\"))return C(25,c+7),!0;if(T(\\\"_top\\\"))return C(25,c+4),!0;break}if(d!==-1&&c>=y&&(d\u003Cc&&(d=e.indexOf(\\\"direction\\\",c)),d!==-1&&(p\u003Cc&&(Nu.lastIndex=c,p=Nu.test(e)?Nu.lastIndex-1:t),d\u003Cp))){for(let j=0;j\u003C5;j++)if((W=M(mR[j],c))>=0)return K(28+j,W),!0;y=p}if(m!==-1&&F!==34&&!qe(F)){if(c>=E){m\u003Cc&&(m=e.indexOf(\\\"@\\\",c));let j=c;for(;j\u003Ct;){let Q=e.charCodeAt(j);if(Q===34||qe(Q))break;j++}if(E=j,b=-1,m!==-1&&m\u003Cj)for(let Q=Math.min(j,t-1)-1;Q>=m;Q--){if(e.charCodeAt(Q)!==64)continue;let Y=e.charCodeAt(Q+1);if(Y!==123&&Y!==34){b=Q;break}}}if(b>c)return C(33,b+1),!0}if(F>=48&&F\u003C=57){let j=c+1;for(;j\u003Ct;){let Q=e.charCodeAt(j);if(Q\u003C48||Q>57)break;j++}return C(34,j),!0}switch(F){case 35:return C(35,c+1),!0;case 58:return e.charCodeAt(c+1)===58&&e.charCodeAt(c+2)===58?C(36,c+3):C(37,c+1),!0;case 38:return C(38,c+1),!0;case 59:return C(39,c+1),!0;case 44:return C(40,c+1),!0;case 42:return C(41,c+1),!0;case 60:return C(62,c+1),!0;case 45:return g()||D()||C(68,c+1),!0;case 40:return A(F);case 91:return e.charCodeAt(c+1)===124?(C(52,c+2),!0):A(F);case 124:case 123:return A(F);case 62:return H(7),C(53,c+1),!0;case 94:return C(63,c+1),!0;case 92:return e.charCodeAt(c+1)===124?(C(64,c+2),!0):D();case 118:return ot(e.charCodeAt(c+1))?D():(C(65,c+1),!0);case 37:return(W=N(c))>=0?(K(66,W),!0):D()}if(qe(F)){if(g())return!0;if((F===32||F===9)&&(W=N(_(c)))>=0)return K(66,W),!0;for(W=c;;){let j=e.charCodeAt(W);if(j===10)W++;else if(j===13&&e.charCodeAt(W+1)===10)W+=2;else break}return W>c?K(77,W):K(78,c+1),!0}return F\u003C128?D():Oi(F)?(C(69,c+1),!0):!1};e:for(;;){if(c>=t){let j=-1;switch(o){case 0:j=79;break;case 3:j=3;break;case 4:j=5;break;case 5:j=6;break;case 11:j=19;break;case 12:j=8;break;case 13:j=9;break}j!==-1&&C(j,t);break}let F=e.charCodeAt(c),W=!0;switch(o){case 0:W=B(F);break;case 1:if(F===34)e.charCodeAt(c+1)===96?(H(2),G(c+2)):(z(),G(c+1));else{let j=e.indexOf('\\\"',c);K(11,j===-1?t:j)}break;case 2:if(F===96)e.charCodeAt(c+1)===34?(z(),G(c+2)):W=!1;else if(F===34)w();else{let j=c+1;for(;j\u003Ct;){let Q=e.charCodeAt(j);if(Q===96||Q===34)break;j++}K(10,j)}break;case 3:case 4:{let j=e.indexOf(`\\r\\n`,c);j===-1&&(j=t);let Q=o===3?3:5;z(),K(Q,j);break}case 5:if(F===125)z(),G(c+1);else{let j=e.indexOf(\\\"}\\\",c);j===-1&&(j=t),K(6,j)}break;case 6:{let j;F===34?w():(j=M(uR,c))>=0?(z(),K(26,j)):(j=M(fR,c))>=0||(j=M(hR,c))>=0||(j=M(pR,c))>=0?(z(),K(27,j)):W=A(F);break}case 7:{let j=e.charCodeAt(c+1);switch(F){case 34:w();break;case 40:case 91:case 123:A(F);break;case 93:z(),j===41?C(48,c+2):j===93?C(50,c+2):C(73,c+1);break;case 41:z(),j===93?C(54,c+2):j===41&&e.charCodeAt(c+2)===41?C(56,c+3):C(71,c+1);break;case 124:z(),C(70,c+1);break;case 125:z(),C(75,c+1);break;case 37:{let Q=N(c);Q>=0?G(Q):W=!1;break}default:{let Q=c+1;for(;Q\u003Ct;){let Y=e.charCodeAt(Q);if(Y===91||Y===93||Y===40||Y===41||Y===123||Y===125||Y===124||Y===34||Y===37)break;Q++}K(46,Q)}}break}case 8:{let j=e.charCodeAt(c+1),Q;if(F===34)w();else if(F===37&&(Q=N(c))>=0)G(Q);else if((F===45||F===47||F===41)&&j===41)z(),C(45,c+2);else if(F===40||F===91||F===123)A(F);else if(F===41||F===93||F===125)W=!1;else{let Y=c+1;for(;Y\u003Ct;){let ne=e.charCodeAt(Y);if(ne===34||ne===40||ne===41||ne===91||ne===93||ne===123||ne===125||(ne===45||ne===47)&&e.charCodeAt(Y+1)===41||ne===37&&e.charCodeAt(Y+1)===37&&e.charCodeAt(Y+2)!==123)break;Y++}Z(46,Y)}break}case 9:{let j=e.charCodeAt(c+1);if(F===34){w();break}switch(F){case 40:j===45||j===91||j===40&&e.charCodeAt(c+2)===40?A(F):j===93?(z(),C(58,c+2)):A(F);break;case 91:case 123:A(F);break;case 92:j===93?(z(),C(58,c+2)):C(46,c+1);break;case 47:j===93?(z(),C(59,c+2)):C(46,c+1);break;case 93:case 41:j===93?(z(),C(58,c+2)):W=!1;break;case 125:W=!1;break;case 37:{let Q=N(c);Q>=0?G(Q):W=!1;break}default:{if((F===63||F===61)&&j===93){z(),C(58,c+2);break}let Q=c+1;for(;Q\u003Ct;){let Y=e.charCodeAt(Q);if(Y===92||Y===91||Y===93||Y===40||Y===41||Y===123||Y===125||Y===47||Y===37)break;Q++}K(46,Q)}}break}case 10:{if(F===34){w();break}let j=$(c);if(j>=0){z(),K(42,j);break}if(F===45&&e.charCodeAt(c+1)===45){W=!1;break}let Q=c+1;for(;Q\u003Ct;){let Y=e.charCodeAt(Q);if(Y===34)break;if(Y===45){if(e.charCodeAt(Q+1)===45)break}else if(qe(Y)&&$(Q)>=0)break;Q++}Z(44,Q);break}case 11:if(F===34)w();else if(qe(F))z(),G(c+1);else{let j=c+1;for(;j\u003Ct&&!qe(e.charCodeAt(j));)j++;C(19,j)}break;case 12:if(F===40){let j=M(gR,c);z(),j>=0?G(j):(H(13),G(c+1))}else{let j=e.indexOf(\\\"(\\\",c);j===-1&&(j=t),K(8,j)}break;case 13:if(F===41)z(),G(c+1);else{let j=e.indexOf(\\\")\\\",c);j===-1&&(j=t),K(9,j)}break;case 14:if(F===34)H(15),C(7,c+1);else if(F===125)z(),G(c+1);else if(F===94)W=!1;else{let j=c+1;for(;j\u003Ct;){let Q=e.charCodeAt(j);if(Q===125||Q===94||Q===34)break;j++}K(7,j)}break;case 15:if(F===34)z(),C(7,c+1);else{let j=e.indexOf('\\\"',c);j===-1&&(j=t),oe(7,e.slice(c,j).replace(bR,\\\"\u003Cbr/>\\\"),j)}break}if(!W)return n.push(1),r.push(\\\"\\\"),i.push(c),s.push(l,u,l,u),{types:n,texts:r,starts:i,locs:s};continue e}return n.push(0),r.push(\\\"\\\"),i.push(t),s.push(l,u,l,u),{types:n,texts:r,starts:i,locs:s}}var pc=new Uint8Array(80);for(let e of[34,67,65,68,13,40,37,38,35,41,69])pc[e]=1;var ku=new Uint8Array(80);for(let e of[34,69,67,27,65,68,40,37,38,35,41])ku[e]=1;var $u=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])$u[e]=1;var Lu=new Uint8Array(80);for(let e of[34,67,37,78,35,12])Lu[e]=1;var mc=new Uint8Array(80);for(let e of[77,39,79,66])mc[e]=1;var rg=\\\"'UNICODE_TEXT', 'TEXT', 'TAGSTART'\\\",Iu=\\\"'COMMENT', 'SEMI', 'NEWLINE', 'EOF'\\\",og=new Uint8Array(80);for(let e of[66,77,78,79])og[e]=1;var Lo=[],sg=/}[^\\\\S\\\\n]*\\\\n/g;function ag(e,t,n=!1){let r=!n&&e.includes(\\\"}\\\")?e.replace(sg,`}\\r\\n`):e,{types:i,texts:s,starts:a,locs:o}=ng(r),c=0,l,u=0,h=0,d=w=>{let A=i[c],D=a[c];if(A===79||A===0){let B=c;for(;B>0&&og[i[B-1]];)B--;D=r.slice(0,a[B]).trimEnd().length}let U=r===e?D:zr([ds(e,sg,2)],D);throw A===1?ft(\\\"agentflow\\\",e,U,\\\"\\\",!0):ft(\\\"agentflow\\\",e,U,`Expecting ${w}, got '${Cu[A]}'`)},m=(w,A)=>({first_line:o[4*w],first_column:o[4*w+1],last_line:o[4*A+2],last_column:o[4*A+3]}),p=(w,A=\\\"\\\")=>(i[c]!==w&&d(`'${Cu[w]}'${A?\\\", \\\"+A:\\\"\\\"}`),s[c++]),y=()=>{mc[i[c]]===0&&d(Iu),c++},E=()=>{pc[i[c]]===0&&d(\\\"'NODE_STRING'\\\");let w=s[c++];for(;pc[i[c]]===1;)w+=s[c++];return w},b=()=>{ku[i[c]]===0&&d(\\\"'NODE_STRING'\\\");let w=s[c++];for(;ku[i[c]]===1;)w+=s[c++];return w},S=()=>{let w=i[c],A;if(w===11)A=\\\"string\\\";else if(w===10)A=\\\"markdown\\\";else if(w===46||w===62||w===53||w===69)A=\\\"text\\\";else return d(`${rg}, 'TAGEND', 'STR', 'MD_STR'`);let D=s[c++];for(;;){let U=i[c];if(U!==46&&U!==62&&U!==53&&U!==69)break;D+=s[c++]}return{text:D,type:A}},x=w=>{p(w,rg)},I=()=>{let w=i[c],A;if(w===11)A=\\\"string\\\";else if(w===10)A=\\\"markdown\\\";else if(w===44||w===69)A=\\\"text\\\";else return d(\\\"'EDGE_TEXT', 'STR', 'MD_STR'\\\");let D=s[c++];for(;i[c]===44||i[c]===69;)D+=s[c++];return{text:D,type:A}},L=()=>{let w=i[c],A;if(w===11)A=\\\"text\\\";else if(w===10)A=\\\"markdown\\\";else if($u[w]===1)A=\\\"text\\\";else return d(\\\"'NODE_STRING', 'STR', 'MD_STR'\\\");let D=s[c++];for(;$u[i[c]]===1;)D+=s[c++];return{text:D,type:A}},O=()=>{u=c;let w=s[c++];for(;i[c]===7;)w+=s[c++];return h=c-1,w},v=(w,A,D,U)=>{let B=m(D,U);t.addVertex(w,void 0,void 0,void 0,void 0,void 0,void 0,A,B),t.extendVertexMapping(w,B)},G=(w,A)=>{A.data!==void 0&&t.addVertex(w,void 0,void 0,void 0,void 0,void 0,void 0,A.data,m(A.dataFrom,A.dataTo))},K=()=>{let w=c,A=E(),D,U,B;switch(i[c]){case 74:c++,D=S(),x(73),U=\\\"square\\\";break;case 57:c++,D=S(),x(56),U=\\\"doublecircle\\\";break;case 72:c++,i[c]===72?(c++,D=S(),x(71),p(71),U=\\\"circle\\\"):(D=S(),x(71),U=\\\"round\\\");break;case 47:c++,D=S(),x(45),U=\\\"ellipse\\\";break;case 49:c++,D=S(),x(48),U=\\\"stadium\\\";break;case 51:c++,D=S(),x(50),U=\\\"subroutine\\\";break;case 52:{c++;let F=p(67);p(37);let W=p(67);p(70),D=S(),x(73),U=\\\"rect\\\",B={[F]:W};break}case 55:c++,D=S(),x(54),U=\\\"cylinder\\\";break;case 76:c++,i[c]===76?(c++,D=S(),x(75),p(75),U=\\\"hexagon\\\"):(D=S(),x(75),U=\\\"diamond\\\");break;case 53:c++,D=S(),x(73),U=\\\"odd\\\";break;case 60:c++,D=S(),i[c]===59?(c++,U=\\\"lean_right\\\"):(x(58),U=\\\"trapezoid\\\");break;case 61:c++,D=S(),i[c]===58?(c++,U=\\\"lean_left\\\"):(x(59),U=\\\"inv_trapezoid\\\");break}return B!==void 0?t.addVertex(A,D,U,void 0,void 0,void 0,B):U!==void 0?t.addVertex(A,D,U):t.addVertex(A),t.addVertexMapping(A,D,U,m(w,c-1)),A},C=()=>{let w=K();return i[c]===36&&(c++,t.setClass(w,E())),w},Z=()=>{let w=[C()];for(l=void 0;;){let D=i[c]===7?O():void 0,U=u,B=h;if(i[c]!==78)return l=D,w;do c++;while(i[c]===78);if(i[c]!==38)return D!==void 0&&d(\\\"'AMP'\\\"),w;c++,i[c]!==78&&d(\\\"'SPACE'\\\");do c++;while(i[c]===78);let F=C();D!==void 0&&v(w[w.length-1],D,U,B),w.push(F)}},oe=()=>{let w;if(i[c]===33&&(w=s[c++]),i[c]===42){let A=t.destructLink(s[c++]);return w!==void 0&&(A.id=w),i[c]===70&&(c++,A.text=S(),x(70),i[c]===78&&c++),A}if(i[c]===43){let A=s[c++],D=I(),U=p(42,\\\"'EDGE_TEXT'\\\"),B=t.destructLink(U,A);return B.text=D,w!==void 0&&(B.id=w),B}return d(\\\"'LINK', 'START_LINK'\\\")},H=()=>{let w=c,A=Z();l!==void 0&&v(A[A.length-1],l,u,h);let D=A;for(;;){let U=i[c];if(U!==42&&U!==43&&U!==33)return D;let B=oe(),F=Z();l!==void 0&&v(F[F.length-1],l,u,h),t.addLink(A,F,B),t.addEdgeMapping(A,F,B,m(w,c-1)),D=F.concat(D),A=F}},z=()=>{Lu[i[c]]===0&&d(\\\"'NODE_STRING', 'NUM', 'COLON', 'BRKT'\\\");let w=s[c++];for(;Lu[i[c]]===1;)w+=s[c++];return w},M=()=>{let w=[z()];for(;i[c]===40;)c++,w.push(z());return w},T=()=>{c++,p(78);let w;if(i[c]===13)w=[s[c++]];else for(w=[p(34,\\\"'DEFAULT'\\\")];i[c]===40;)c++,w.push(p(34));if(p(78),i[c]!==15){t.updateLink(w,M());return}c++,p(78);let A=b();if(i[c]===78){c++;let D=M();t.updateLinkInterpolate(w,A),t.updateLink(w,D)}else t.updateLinkInterpolate(w,A)},R=(w,A)=>{if(i[c]!==78){t.setLink(w,A);return}if(c++,i[c]===25){t.setLink(w,A,s[c++]);return}let D=p(11,\\\"'LINK_TARGET'\\\");i[c]===78?(c++,t.setLink(w,A,p(25))):t.setLink(w,A),t.setTooltip(w,D)},_=()=>{let w=s[c++];switch(i[c]){case 8:{let A=s[c++],D=i[c]===9,U=D?s[c++]:void 0,B;i[c]===78&&(c++,B=p(11)),D?t.setClickEvent(w,A,U):t.setClickEvent(w,A),B!==void 0&&t.setTooltip(w,B);return}case 18:c++,R(w,p(11));return;case 11:R(w,s[c++]);return;default:{let A=b();if(i[c]===78){c++;let D=p(11);t.setClickEvent(w,A),t.setTooltip(w,D)}else t.setClickEvent(w,A)}}},$=w=>{p(78,Iu);let A=L(),D={text:\\\"\\\",type:\\\"text\\\"};i[c]===74&&(c++,D=S(),x(73));let U=i[c]===7?O():void 0;return mc[i[c]]===0&&d(`${Iu}, 'SHAPE_DATA'`),{global:!1,at:w,id:A,title:D,data:U,dataFrom:u,dataTo:h,list:[],collect:!1}},g=()=>{let w=i[c];switch(w){case 12:{c++,p(78);let A=E();return p(78),t.addVertex(A,void 0,void 0,M()),y(),Lo}case 14:return T(),y(),Lo;case 16:{c++,p(78);let A=E();return p(78),t.addClass(A,M()),y(),Lo}case 17:{c++,p(78);let A=E();return p(78),t.setClass(A,E()),y(),Lo}case 19:return _(),y(),Lo;case 22:{let A=$(c++),D=c++,U=t.addConnector(A.id,A.title);return G(U,A),t.addConnectorMapping(A.id,A.title,m(A.at,A.at),m(D,D)),U}case 28:case 29:case 30:case 31:case 32:return c++,{stmt:\\\"dir\\\",value:yR[w-28]};case 2:{c++;let A=p(3).trim();return t.setAccTitle(A),A}case 4:{c++;let A=p(5).trim();return t.setAccDescription(A),A}case 6:{let A=s[c++].trim();return t.setAccDescription(A),A}default:{pc[w]===0&&d(ig);let A=H();return y(),A}}},N=()=>{let w=[],A=[],D=!1;for(;;){let U=i[c];if(U===0)break;if(U===24){let B=w.pop();if(B===void 0)break;let F=c++;if(B.global){t.addGlobal(A),A=B.list,D=B.collect;continue}let W=t.addSubGraph(B.id,A,B.title,\\\"flow\\\");G(W,B),t.addSubgraphMapping(B.id,B.title,m(B.at,B.at),m(F,F)),A=B.list,D=B.collect,D&&A.push(W)}else if(U===39||U===77||U===78||U===79)D&&A.push(s[c]),c++;else if(U===66)c++;else if(U===21||U===23){let B=c++,F;U===23||mc[i[c]]===1?(F={global:U===23,at:B,id:void 0,title:void 0,data:void 0,dataFrom:0,dataTo:0,list:A,collect:D},y()):(F=$(B),F.list=A,F.collect=D,c++),w.push(F),A=[],D=!0}else{let B=g();D&&(!Array.isArray(B)||B.length>0)&&A.push(B)}}w.length>0&&d(\\\"'end'\\\")};for(;i[c]===78||i[c]===77||i[c]===66;)c++;if(p(20,\\\"'SPACE', 'NEWLINE', 'COMMENT'\\\"),i[c]===26)c++,t.setDirection(\\\"TB\\\");else{let w=p(27,\\\"'NODIR'\\\"),A=i[c];if(A===78){do c++;while(i[c]===78);A=i[c],A!==77&&d(\\\"'NEWLINE', 'SPACE'\\\")}else A!==39&&A!==77&&A!==66&&d(\\\"'COMMENT', 'SEMI', 'NEWLINE', 'SPACE'\\\");c++,t.setDirection(w)}N(),i[c]!==0&&d(ig)}var yR=[\\\"TB\\\",\\\"BT\\\",\\\"RL\\\",\\\"LR\\\",\\\"TD\\\"],ig=\\\"'COMMENT', 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'flow', 'global', 'connector', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'\\\";function Ys(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 Hs(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 ER=24,cg=2e4,vu=16,lg=8,xR=.125,dg=3,AR=18,SR=10,wR=14,_R=2,RR=28,ug=12,TR=12,MR=8,CR=4,fg=.5,Rr=.5,Pu=1,NR=12,hg=24,IR=40,pg=400,Di=16,Ou=new Float64Array(2*Di+2),Du=new Float64Array(2*Di+2);function vi(e){return e===1||e===2}function mg(e,t,n,r){for(let i=t+1;i\u003Cn;i++){let s=e[i],a=r[s],o=i-1;for(;o>=t&&(r[e[o]]>a||r[e[o]]===a&&e[o]>s);)e[o+1]=e[o],o--;e[o+1]=s}}function kR(e,t,n,r,i,s){let a=(u,h)=>n[u]\u003Cn[h]||n[u]===n[h]&&(i?r[u]>r[h]:r[u]\u003Cr[h]);for(let u=0;u\u003Ct;u+=8)for(let h=u+1,d=Math.min(t,u+8);h\u003Cd;h++){let m=e[h],p=h-1;for(;p>=u&&a(m,e[p]);)e[p+1]=e[p],p--;e[p+1]=m}let c=e,l=s;for(let u=8;u\u003Ct;u*=2){for(let d=0;d\u003Ct;d+=2*u){let m=Math.min(t,d+u),p=Math.min(t,d+2*u),y=d,E=m,b=d;for(;y\u003Cm&&E\u003Cp;)l[b++]=a(c[E],c[y])?c[E++]:c[y++];for(;y\u003Cm;)l[b++]=c[y++];for(;E\u003Cp;)l[b++]=c[E++]}let h=c;c=l,l=h}if(c!==e)for(let u=0;u\u003Ct;u++)e[u]=c[u]}function gc(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 ie=e[0];return ie.rank=0,ie.x=ie.w/2,ie.y=ie.h/2,{width:ie.w,height:ie.h}}let s=1;if(i>0){let ie=new Set;for(let me of t){let Te=Math.min(me.tail,me.head),ye=Math.max(me.tail,me.head),we=Te*r+ye;if(me.labelW>0||ie.has(we)){s=2;break}ie.add(we)}}Do(e,t),vo(e,t,s);let a=new Int32Array(i),o=0;for(let ie=0;ie\u003Ci;ie++){let me=t[ie];a[ie]=Math.abs(e[me.head].rank-e[me.tail].rank),a[ie]>1&&(o+=a[ie]-1)}let c=new Uint8Array(i);if(o>cg){let ie=[];for(let me=0;me\u003Ci;me++)a[me]>1&&ie.push(me);ie.sort((me,Te)=>a[Te]-a[me]||me-Te);for(let me of ie){if(o\u003C=cg)break;c[me]=1,o-=a[me]-1}}let l=r+o,u=new Float64Array(l),h=new Float64Array(l),d=new Uint8Array(l),m=new Int32Array(l),p=0;for(let ie=0;ie\u003Cr;ie++){let me=e[ie];u[ie]=me.w,h[ie]=me.h,d[ie]=me.kind,m[ie]=me.rank,me.rank>p&&(p=me.rank)}let y=0;for(let ie=0;ie\u003Ci;ie++)c[ie]||(y+=a[ie]);let E=new Int32Array(y),b=new Int32Array(y),S=new Float64Array(y),x=new Float64Array(y),I=new Int32Array(i).fill(-1),L=new Uint8Array(p+1),O=new Int32Array(i).fill(-1),v=!1;for(let ie=0;ie\u003Cr;ie++)e[ie].span>0&&e[ie].kind===0&&(v=!0);let G=v?new Uint8Array(y):void 0,K=v?new Uint8Array(y):void 0,C=new Int32Array(i).fill(-1),Z=new Int32Array(i).fill(-1),oe=new Float64Array(l).fill(NaN);for(let ie=0;ie\u003Cr;ie++)oe[ie]=e[ie].key;let H=!1;{let ie=r,me=0;for(let Te=0;Te\u003Ci;Te++){if(c[Te])continue;let ye=t[Te],we=ye.reversed?ye.head:ye.tail,Ie=ye.reversed?ye.tail:ye.head,ve=ye.reversed?ye.headDx:ye.tailDx,Pe=ye.reversed?ye.tailDx:ye.headDx;(ve!==0||Pe!==0)&&(H=!0);let he=m[we],Re=m[Ie],Be=-1;ye.labelW>0&&(Be=he+(Re-he>>1),s===2&&Re-he>=4?(Be&1)===1&&(Be+=ye.reversed?1:-1):s===2&&(Be&1)===0&&(Be+=ye.reversed?1:-1));let ge=we;Re-he>1&&(I[Te]=ie),C[Te]=me,G&&!(ye.reversed?ye.headFixed:ye.tailFixed)&&(G[me]=ye.reversed?2:1);for(let Le=he+1;Le\u003CRe;Le++){let Fe=ie++;m[Fe]=Le,oe[Fe]=oe[we]+(oe[Ie]-oe[we])*(Le-he)/(Re-he),Le===Be?(u[Fe]=ye.labelW,h[Fe]=ye.labelH,d[Fe]=2,O[Te]=Fe,L[Le]|=ye.reversed?2:1):d[Fe]=1,E[me]=ge,b[me]=Fe,S[me]=ge===we?ve:0,me++,ge=Fe}E[me]=ge,b[me]=Ie,S[me]=ge===we?ve:0,x[me]=Pe,K&&!(ye.reversed?ye.tailFixed:ye.headFixed)&&(K[me]=ye.reversed?1:2),Z[Te]=me,me++}}let z;if(n.groups){let{of:ie,parent:me}=n.groups;z=new Int32Array(l);for(let we=0;we\u003Cr;we++)z[we]=ie[we];let Te=we=>{let Ie=0;for(;we>=0;we=me[we])Ie++;return Ie},ye=(we,Ie)=>{let ve=Te(we),Pe=Te(Ie);for(;ve>Pe;ve--)we=me[we];for(;Pe>ve;Pe--)Ie=me[Ie];for(;we!==Ie;)we=me[we],Ie=me[Ie];return we};for(let we=0;we\u003Ci;we++){if(I[we]\u003C0)continue;let Ie=t[we],ve=ye(ie[Ie.tail],ie[Ie.head]);for(let Pe=I[we],he=Pe+a[we]-1;Pe\u003Che;Pe++)z[Pe]=ve}}let M=new Int32Array(l+1),T=new Int32Array(l+1);for(let ie=0;ie\u003Cy;ie++)M[E[ie]+1]++,T[b[ie]+1]++;for(let ie=0;ie\u003Cl;ie++)M[ie+1]+=M[ie],T[ie+1]+=T[ie];let R=new Int32Array(y),_=new Int32Array(y);{let ie=M.slice(0,l),me=T.slice(0,l);for(let Te=0;Te\u003Cy;Te++)R[ie[E[Te]]++]=Te,_[me[b[Te]]++]=Te}let $=new Int32Array(p+2);for(let ie=0;ie\u003Cl;ie++)$[m[ie]+1]++;for(let ie=0;ie\u003C=p;ie++)$[ie+1]+=$[ie];let g=new Int32Array(l),N=new Int32Array(l);{let ie=new Int32Array(l),me=$.slice(0,p+1);for(let we=0;we\u003Cl;we++)ie[me[m[we]]++]=we;for(let we=0;we\u003C=p;we++)me[we]=$[we];let Te=new Uint8Array(l),ye=[];for(let we=0;we\u003Cl;we++)if(!Te[ie[we]])for(ye.push(ie[we]);ye.length>0;){let Ie=ye.pop();if(!Te[Ie]){Te[Ie]=1,g[me[m[Ie]]++]=Ie;for(let ve=M[Ie+1]-1;ve>=M[Ie];ve--){let Pe=b[R[ve]];Te[Pe]||ye.push(Pe)}}}}let w=(ie,me)=>{let Te=$[ie],ye=$[ie+1];if(ye-Te\u003C2)return!1;for(let ve=Te;ve\u003Cye;ve++)if(Number.isNaN(me(g[ve])))return!1;let we=Array.from(g.subarray(Te,ye)),Ie=new Map;return we.forEach((ve,Pe)=>Ie.set(ve,Pe)),we.sort((ve,Pe)=>me(ve)-me(Pe)||Ie.get(ve)-Ie.get(Pe)),g.set(we,Te),!0};for(let ie=0;ie\u003C=p;ie++)w(ie,me=>oe[me]);let A=!1;for(let ie=0;ie\u003Cr;ie++)e[ie].pin!==0&&(A=!0);if(A)for(let ie=0;ie\u003C=p;ie++){let me=Array.from(g.subarray($[ie],$[ie+1])),Te=new Map;me.forEach((we,Ie)=>Te.set(we,Ie));let ye=we=>we\u003Cr?e[we].pin:0;me.sort((we,Ie)=>ye(we)-ye(Ie)||Te.get(we)-Te.get(Ie)),g.set(me,$[ie])}let D=new Uint8Array(p+1),U=ie=>ie\u003Cr&&(e[ie].kind===3||e[ie].kind===4)?e[ie].hint:NaN;for(let ie of[0,p])w(ie,U)&&(D[ie]=1);let B=()=>{for(let ie=0;ie\u003C=p;ie++){let me=$[ie];for(let Te=me,ye=$[ie+1];Te\u003Cye;Te++)N[g[Te]]=Te-me}};B();let F={n:l,real:r,maxRank:p,W:u,KIND:d,RANK:m,EF:E,ET:b,EFD:S,ETD:x,succStart:M,succE:R,predStart:T,predE:_,layerStart:$,order:g,pos:N,offsets:H,fixed:D,GRP:z,groupParent:n.groups?.parent},W=0,j=0;if(y>0&&p>0&&([W,j]=GR(F,e),B()),n.orderOnly){let ie=gg(F,n);for(let me=0;me\u003Cr;me++)e[me].x=ie[me];for(let me=0;me\u003Ci;me++){let Te=t[me],ye=Te.reversed?Te.head:Te.tail,we=Te.reversed?Te.tail:Te.head,Ie=[m[ye],ie[ye]];if(!c[me]&&I[me]>=0)for(let ve=I[me],Pe=ve+a[me]-1;ve\u003CPe;ve++)Ie.push(m[ve],ie[ve]);Ie.push(m[we],ie[we]),Te.points=Ie}return{width:0,height:0,crossings:W,declared:j}}G&&K&&$R(F,e,G,K);let Q=gg(F,n),Y=FR(F);if(G&&K){let ie=OR(F,G,K);DR(F,e,Q,ie,n,Y),vR(F,e,Q,G,K,ie,Y),PR(F,Q,Y,n);for(let me=0;me\u003Ci;me++){if(c[me])continue;let Te=t[me],ye=S[C[me]],we=x[Z[me]];Te.tailDx=Te.reversed?we:ye,Te.headDx=Te.reversed?ye:we}}LR(F,Q,Y);let ne=new Uint8Array(l);Y&&!n.tracks&&WR(F,Q,Y,I,a,n.apart?0:n.edgeSep,ne),n.tracks||UR(F,Q,I,a,n.edgeSep,ne);let q=new Int32Array(i+1),k=n.tracks||G&&!n.straight?{from:[],to:[],rank:[],lower:[],track:[],levels:[],wide:[]}:void 0,J=new Int32Array(p+1);if(k){for(let ie=0;ie\u003Ci;ie++){if(q[ie]=k.from.length,c[ie])continue;let me=I[ie],Te=!1;for(let Ie=me,ve=me\u003C0?me:me+a[ie]-1;Ie\u003Cve;Ie++){let Pe=Y!==void 0&&Y[m[Ie]]===1;!n.tracks&&Pe!==(ne[Ie]===1)&&(Te=!0)}if(Te)continue;let ye=Q[E[C[ie]]]+S[C[ie]],we=m[E[C[ie]]];for(let Ie=me,ve=me\u003C0?me:me+a[ie]-1;Ie\u003Cve;Ie++)Y&&Y[m[Ie]]||(k.from.push(ye),k.to.push(Q[Ie]),k.rank.push(we),k.lower.push(Ie),ye=Q[Ie],we=m[Ie]);k.from.push(ye),k.to.push(Q[b[Z[ie]]]+x[Z[ie]]),k.rank.push(we),k.lower.push(-1)}q[i]=k.from.length}let te=(ie,me)=>{let Te=!1;for(let ye=$[ie];ye\u003C$[ie+1];ye++){let we=d[g[ye]];if(we===me)Te=!0;else if(we!==1)return!1}return Te},se=te(0,3)?s:0,re=te(p,4)?s:0,P=new Float64Array(p+1);for(let ie=0;ie\u003Cy;ie++){let me=Math.abs(Q[E[ie]]+S[ie]-Q[b[ie]]-x[ie]);me>P[m[E[ie]]]&&(P[m[E[ie]]]=me)}let ee=new Float64Array(p+1),ae=new Float64Array(p+1),ue=ie=>(ie\u003Cse||ie>=p-re?n.portSep:n.rankSep)/s,ce=new Float64Array(p+1);for(let ie=0;ie\u003Cp;ie++)ce[ie]=k?ue(ie):Math.max(ue(ie),Math.min(dg*n.rankSep/s,P[ie]*xR));let pe=new Uint8Array(p+1).fill(1);for(let ie=0;ie\u003Cr;ie++)pe[m[ie]]=0;for(let ie=1;ie\u003Cp;ie++){if(n.tracks||!pe[ie]||L[ie]!==1&&L[ie]!==2)continue;let me=Math.min((n.headRoom??0)/2,ce[L[ie]===1?ie-1:ie]/2);ce[ie-1]+=L[ie]===1?-me:me,ce[ie]+=L[ie]===1?me:-me}let V=ie=>d[ie]===1&&pe[m[ie]]&&!n.tracks?(ae[m[ie]]-ee[m[ie]])/4:0,X=n.tracks?AR:RR,le=n.tracks?SR:ug,de=n.tracks?wR:ug,Se=new Int32Array(p+1);if(k){let ie=new Float64Array(p+1);for(let Te=0;Te\u003Cp;Te++){if(Y&&Y[Te])continue;let ye=Te+1;for(ie[Te]=ce[Te];ye\u003Cp&&Y&&Y[ye];)ie[Te]+=ce[ye++];Se[Te]=ye}for(let Te=0;Te\u003Ck.from.length;Te++)k.wide.push(Math.abs(k.from[Te]-k.to[Te])>_R*ie[k.rank[Te]]?1:0);let me=new Float64Array(p+1);BR(k,J,!n.tracks,ie,me);for(let Te=0;Te\u003Cp;Te++)J[Te]>0?ce[Te]+=Math.max(0,2*X+(J[Te]-1)*le-ie[Te]):me[Te]>0&&(ce[Te]+=Math.max(0,Math.min(dg*n.rankSep,me[Te])-ie[Te]))}let _e=0;for(let ie=0;ie\u003C=p;ie++){let me=0;for(let Te=$[ie];Te\u003C$[ie+1];Te++)h[g[Te]]>me&&(me=h[g[Te]]);ee[ie]=_e,ae[ie]=_e+me,_e+=me+ce[ie]}let xe=_e,Me=(ie,me=k.track[ie])=>{let Te=k.rank[ie],ye=ae[Te],we=ee[Se[Te]],Ie=n.tracks?J[Te]:k.levels[ie],ve=Ie>1?Math.min(de,(we-ye-2*X)/(Ie-1)):0;return(ye+we)/2+(me-(Ie-1)/2)*ve},Ce=1/0,ke=-1/0;for(let ie=0;ie\u003Cl;ie++){let me=u[ie]/2;Q[ie]-me\u003CCe&&(Ce=Q[ie]-me),Q[ie]+me>ke&&(ke=Q[ie]+me)}let be=new Uint8Array(p+1),Ae=new Uint8Array(p+1);for(let ie=0;ie\u003Cr;ie++)d[ie]!==0||!G||(T[ie+1]>T[ie]&&(be[m[ie]]=1),M[ie+1]>M[ie]&&(Ae[m[ie]]=1));for(let ie=0;ie\u003Cr;ie++){let me=e[ie],Te=me.rank;me.x=Q[ie]-Ce,d[ie]===0&&Ae[Te]&&!be[Te]?me.y=ae[Te]-me.h/2:d[ie]===0&&be[Te]&&!Ae[Te]?me.y=ee[Te]+me.h/2:me.y=(ee[Te]+ae[Te])/2}for(let ie=0;ie\u003Ci;ie++){let me=t[ie],Te=e[me.reversed?me.head:me.tail],ye=e[me.reversed?me.tail:me.head],we=[Te.x+(me.reversed?me.headDx:me.tailDx),Te.y+Te.h/2],Ie=I[ie];if(k&&q[ie+1]>q[ie])for(let Pe=q[ie];Pe\u003Cq[ie+1];Pe++){if(k.track[Pe]>=0&&(n.tracks||k.wide[Pe]===1)){let Re=Me(Pe);we.push(k.from[Pe]-Ce,Re,k.to[Pe]-Ce,Re)}else k.track[Pe]>0&&we.push(k.from[Pe]-Ce,Me(Pe,k.track[Pe]-1));let he=k.lower[Pe];he\u003C0||(we.push(Q[he]-Ce,ee[m[he]]+V(he)),ae[m[he]]>ee[m[he]]&&we.push(Q[he]-Ce,ae[m[he]]-V(he)))}else if(Ie>=0)for(let Pe=Ie,he=Ie+a[ie]-1;Pe\u003Che;Pe++){if(ne[Pe])continue;let Re=Q[Pe]-Ce,Be=ee[m[Pe]],ge=ae[m[Pe]];we.push(Re,Be+V(Pe)),ge>Be&&we.push(Re,ge-V(Pe))}if(we.push(ye.x+(me.reversed?me.tailDx:me.headDx),ye.y-ye.h/2),me.reversed)for(let Pe=0,he=we.length-2;Pe\u003Che;Pe+=2,he-=2){let Re=we[Pe],Be=we[Pe+1];we[Pe]=we[he],we[Pe+1]=we[he+1],we[he]=Re,we[he+1]=Be}me.points=we;let ve=O[ie];ve>=0?(me.labelX=Q[ve]-Ce,me.labelY=(ee[m[ve]]+ae[m[ve]])/2):me.labelW>0&&(me.labelX=(we[0]+we[we.length-2])/2,me.labelY=(we[1]+we[we.length-1])/2)}return{width:ke-Ce,height:xe}}function Do(e,t){let n=e.length,r=t.length,i=new Int32Array(n+1);for(let l=0;l\u003Cr;l++){let u=t[l];u.reversed=e[u.head].kind===3||e[u.tail].kind===4,u.reversed||i[u.tail+1]++}for(let l=0;l\u003Cn;l++)i[l+1]+=i[l];let s=new Int32Array(i[n]);{let l=i.slice(0,n);for(let u=0;u\u003Cr;u++)t[u].reversed||(s[l[t[u].tail]++]=u)}let a=new Uint8Array(n),o=i.slice(0,n),c=[];for(let l=0;l\u003Cn;l++)if(a[l]===0)for(c.push(l),a[l]=1;c.length>0;){let u=c[c.length-1];if(o[u]\u003Ci[u+1]){let h=t[s[o[u]++]],d=h.head;a[d]===1?h.reversed=!0:a[d]===0&&(a[d]=1,c.push(d))}else a[u]=2,c.pop()}}function vo(e,t,n){let r=e.length,i=t.length,s=new Int32Array(i),a=new Int32Array(i),o=new Int32Array(i),c=new Int32Array(r+1),l=new Int32Array(r+1);for(let x=0;x\u003Ci;x++){let I=t[x],L=I.reversed?I.head:I.tail,O=I.reversed?I.tail:I.head;s[x]=L,a[x]=O,o[x]=Math.max(1,I.minlen)*n,c[L+1]++,l[O+1]++}for(let x=0;x\u003Cr;x++)c[x+1]+=c[x],l[x+1]+=l[x];let u=new Int32Array(i),h=new Int32Array(i);{let x=c.slice(0,r),I=l.slice(0,r);for(let L=0;L\u003Ci;L++)u[x[s[L]]++]=L,h[I[a[L]]++]=L}let d=new Int32Array(r);for(let x=0;x\u003Cr;x++)e[x].kind===3&&(d[x]=-n);let m=new Int32Array(r);for(let x=0;x\u003Cr;x++)m[x]=l[x+1]-l[x];let p=new Int32Array(r),y=0;for(let x=0;x\u003Cr;x++)m[x]===0&&(p[y++]=x);for(let x=0;x\u003Cy;x++){let I=p[x];for(let L=c[I];L\u003Cc[I+1];L++){let O=u[L],v=a[O];d[I]+o[O]>d[v]&&(d[v]=d[I]+o[O]),--m[v]===0&&(p[y++]=v)}}for(let x=0;x\u003C8;x++){let I=!1;for(let L=y-1;L>=0;L--){let O=p[L],v=l[O+1]-l[O],G=c[O+1]-c[O];if(v===0&&G===0)continue;let K=-1/0,C=1/0;for(let oe=l[O];oe\u003Cl[O+1];oe++){let H=h[oe];K=Math.max(K,d[s[H]]+o[H])}for(let oe=c[O];oe\u003Cc[O+1];oe++){let H=u[oe];C=Math.min(C,d[a[H]]-o[H])}let Z=d[O];G>v&&C!==1/0?Z=C:v>G&&K!==-1/0&&(Z=K),Z!==d[O]&&(d[O]=Z,I=!0)}if(!I)break}let E=1/0,b=-1/0,S=!1;for(let x=0;x\u003Cr;x++){let I=e[x].kind;I===3&&(S=!0),!(I===3||I===4)&&(d[x]\u003CE&&(E=d[x]),d[x]>b&&(b=d[x]))}E===1/0&&(E=0,b=0);for(let x=0;x\u003Cr;x++)e[x].kind===3?d[x]=E-n:e[x].kind===4&&(d[x]=b+n);S&&(E-=n);for(let x=0;x\u003Cr;x++)e[x].rank=d[x]-E}function bg(e,t,n,r,i,s,a){let o=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 p=o[t];p\u003Co[t+1];p++)i[c[p]]!==0&&s.push(c[p]);if(s.length\u003C2)return 0;s.sort((p,y)=>u[l[p]]-u[l[y]]||p-y);let h=p=>{let y=0;a[0]=0;for(let E=1;E\u003Cs.length;E++){let b=i[s[E]]===i[s[E-1]];a[E]=p(b&&i[s[E]]===1,b),y+=a[E]}return y},d=h(()=>1);if(r/d\u003Clg&&(d=h(p=>p?.5:1)),r/d\u003Clg&&(d=h((p,y)=>y?0:1)),d===0)return 0;let m=Math.min(vu,r/d);for(let p=1;p\u003Cs.length;p++)a[p]*=m;return d*m}function $R(e,t,n,r){let{real:i,W:s,EFD:a,ETD:o}=e;for(let c=0;c\u003Ci;c++){let l=Math.min(t[c].span,s[c]);if(!(l\u003C=0||t[c].kind!==0))for(let u=0;u\u003C2;u++){let h=[],d=[],m=bg(e,c,u,l,u===0?r:n,h,d);if(m===0)continue;let p=u===0?o:a,y=-m/2;for(let E=0;E\u003Ch.length;E++)y+=d[E],p[h[E]]=y}}}function Oo(e,t,n,r){if(!t)return n;let{KIND:i,RANK:s,EF:a,ET:o,succStart:c,succE:l,predStart:u,predE:h}=e;for(let d=0;d\u003C1e5;d++){let m=r===0?a[n]:o[n];if(i[m]!==1||!t[s[m]])break;n=r===0?h[u[m]]:l[c[m]]}return n}function LR(e,t,n){let{maxRank:r,KIND:i,EF:s,ET:a,EFD:o,ETD:c,succStart:l,succE:u,predStart:h,predE:d,layerStart:m,order:p}=e;for(let[y,E]of[[0,3],[r,4]]){let b=m[y],S=m[y+1],x=[];for(let I=b;I\u003CS;I++){let L=p[I],O=E===3;if(i[L]!==E||(O?l[L+1]-l[L]:h[L+1]-h[L])!==1)break;let v=Oo(e,n,O?u[l[L]]:d[h[L]],O?1:0),G=O?t[a[v]]+c[v]:t[s[v]]+o[v];if(x.length>0&&G\u003Cx[x.length-1]+Pu)break;x.push(G)}if(!(x.length===0||x.length!==S-b))for(let I=b;I\u003CS;I++)t[p[I]]=x[I-b]}}function OR(e,t,n){let r=[new Int32Array(e.n),new Int32Array(e.n)];for(let i=0;i\u003Ce.EF.length;i++)n[i]!==0&&r[0][e.ET[i]]++,t[i]!==0&&r[1][e.EF[i]]++;return r}function Pi(e,t){return Math.max(.25,Math.min(.5,4*Math.abs(t)/(Math.abs(e)||1)))}function DR(e,t,n,r,i,s){let a=i.edgeSep,{n:o,real:c,maxRank:l,KIND:u,RANK:h,W:d,EF:m,ET:p,EFD:y,ETD:E,succStart:b,succE:S,predStart:x,predE:I,layerStart:L,order:O,pos:v}=e,G=z=>u[z]===2||u[z]===1&&!(s!==void 0&&s[h[z]]===1),K=(z,M)=>{let T=M===0?m[z]:p[z];return[M===0?n[T]+y[z]:n[T]+E[z],T\u003Cc&&t[T].kind===0?r[1-M][T]:0]},C=z=>{let M=L[h[z]],T=M+v[z],R=_=>d[_]/2+d[z]/2+(u[_]===0?i.nodeSep/2+a/2:u[_]===u[z]?a:a/2);return[T>M?n[O[T-1]]+R(O[T-1]):-1/0,T+1\u003CL[h[z]+1]?n[O[T+1]]-R(O[T+1]):1/0]},Z=(z,M,T,R,_)=>{let g=(M[1]!==T[1]?M[1]\u003CT[1]:Math.abs(M[0]-z)\u003C=Math.abs(T[0]-z))?[M[0],T[0]]:[T[0],M[0]];return g.find(N=>N>=R&&N\u003C=_)??Math.max(R,Math.min(_,g[0]))},oe=new Uint8Array(o),H=[];for(let z=1;z\u003Cl;z++)for(let M=L[z];M\u003CL[z+1];M++){if(!G(O[M])||oe[O[M]])continue;let T=O[M];for(;vi(u[m[I[x[T]]]]);)T=m[I[x[T]]];let R=T,_=-1/0,$=1/0;H.length=0;for(let g=T;vi(u[g]);g=p[S[b[g]]]){if(R=g,!G(g))continue;oe[g]=1,H.push(g);let[N,w]=C(g);N>_&&(_=N),w\u003C$&&($=w)}if(_\u003C=$){let g=Z(n[H[0]],K(I[x[T]],0),K(S[b[R]],1),_,$);for(let N of H)n[N]=g;continue}for(let g of H){let[N,w]=C(g);N>w||(n[g]=Z(n[g],K(Oo(e,s,I[x[g]],0),0),K(Oo(e,s,S[b[g]],1),1),N,w))}}}function vR(e,t,n,r,i,s,a){let{real:o,W:c,EF:l,ET:u,EFD:h,ETD:d,succStart:m,succE:p,predStart:y,predE:E,pos:b}=e,S=(I,L,O,v,G)=>{if(s[L][O]\u003C2)return 0;I=Oo(e,a,I,L);let K=L===0?l[I]:u[I],C=L===0?n[K]+h[I]:n[K]+d[I];if(G&&Math.abs(C-n[O])\u003C=v/2+Rr)return Math.max(-v/2,Math.min(v/2,C-n[O]));let Z=C,oe=0;K\u003Co&&t[K].kind===0&&(L===0?r:i)[I]!==0&&s[1-L][K]>=2&&(oe=Math.max(0,Math.min(t[K].span,c[K])),oe>0&&(Z=n[K]));let H=Math.max(n[O]-v/2,Z-oe/2),z=Math.min(n[O]+v/2,Z+oe/2);if(H>z+Rr){let T=Math.max(0,v/2-IR);return Math.max(-T,Math.min(T,C-n[O]))}let M=(n[O]*oe+Z*v)/(oe+v);return Math.max(H,Math.min(z,M))-n[O]},x=[];for(let I=0;I\u003Co;I++){let L=Math.min(t[I].span,c[I]);if(!(L\u003C=0||t[I].kind!==0))for(let O=0;O\u003C2;O++){let v=O===0?l:u,G=O===0?y:m,K=O===0?E:p,C=[],Z=[];if(bg(e,I,O,L,O===0?i:r,C,Z),C.length===0)continue;C.length===1&&(Z[0]=0);let oe=[];for(let H=G[I];H\u003CG[I+1];H++)oe.push(K[H]);oe.sort((H,z)=>b[v[H]]-b[v[z]]||H-z),x.push({v:I,side:O,span:L,ids:C,room:Z,all:oe})}}for(let I=0,L=!0;L&&I\u003C6;I++){L=!1;for(let{v:O,side:v,span:G,ids:K,room:C,all:Z}of x){let oe=v===0?i:r,H=v===0?d:h,z=0,M=-G/2;for(let T=0;T\u003C=Z.length;T++){let R=T\u003CZ.length&&oe[Z[T]]===0;if(T\u003CZ.length&&!R)continue;let _=0;for(let g=T-1;g>=0&&oe[Z[g]]!==0;g--)_++;let $=R?H[Z[T]]-vu:G/2;if(_>0){let g=[],N=[],w=0;for(let U=0;U\u003C_;U++){U>0&&(w+=C[z+U]),g.push(S(K[z+U],v,O,G,I>0)-w),N.push(1);let B=U>0&&C[z+U]===0;for(;g.length>1&&(B||g[g.length-2]/N[N.length-2]>g[g.length-1]/N[N.length-1]);){B=!1;let F=g.pop(),W=N.pop();g[g.length-1]+=F,N[N.length-1]+=W}}let A=w,D=0;w=0;for(let U=0;U\u003Cg.length;U++){let B=$-A\u003CM?(M+$-A)/2:Math.max(M,Math.min($-A,g[U]/N[U]));for(let F=0;F\u003CN[U];F++,D++)D>0&&(w+=C[z+D]),Math.abs(H[K[z+D]]-B-w)>.01&&(L=!0),H[K[z+D]]=B+w}z+=_}R&&(M=H[Z[T]]+vu)}}}}function PR(e,t,n,r){let{n:i,KIND:s,RANK:a,EF:o,ET:c,EFD:l,ETD:u,layerStart:h,order:d,pos:m}=e,p=C=>n!==void 0&&s[C]===1&&n[a[C]]===1,y=[],E=[],b=[],S=[];for(let C=0;C\u003Co.length;C++){if(p(o[C]))continue;let Z=Oo(e,n,C,1);y.push(o[C]),E.push(c[Z]),b.push(l[C]),S.push(u[Z])}let x=C=>t[E[C]]+S[C]-t[y[C]]-b[C],I=new Int32Array(i),L=[];for(let C=0;C\u003Ci;C++)I[C]=C,L.push([C]);let O=(C,Z)=>{let oe=I[C],H=I[Z];if(oe!==H){L[oe].length\u003CL[H].length&&([oe,H]=[H,oe]);for(let z of L[H])I[z]=oe,L[oe].push(z);L[H]=[]}},v=[];for(let C=0;C\u003Cy.length;C++){let Z=Math.abs(x(C));Z\u003C.01?O(y[C],E[C]):Z\u003C=hg&&v.push(C)}if(v.length===0)return;v.sort((C,Z)=>Math.abs(x(C))-Math.abs(x(Z))||C-Z);let G=C=>yg(e,r,C),K=(C,Z)=>{for(let oe of L[C]){let H=h[a[oe]],z=h[a[oe]+1],M=H+m[oe];if(M>H&&I[d[M-1]]!==C&&t[oe]+Z-t[d[M-1]]\u003CG(oe)+G(d[M-1])-.01||M+1\u003Cz&&I[d[M+1]]!==C&&t[d[M+1]]-t[oe]-Z\u003CG(oe)+G(d[M+1])-.01)return!1}return!0};for(let C of v){let Z=x(C);if(Math.abs(Z)\u003C.01){O(y[C],E[C]);continue}if(Math.abs(Z)>hg||I[y[C]]===I[E[C]])continue;let oe=I[y[C]],H=I[E[C]],z=L[oe].length\u003C=L[H].length?oe:H;for(let M of[z,z===oe?H:oe]){let T=M===oe?Z:-Z;if(!(Math.abs(Z)>NR&&!L[M].every(R=>s[R]===1))&&K(M,T)){for(let R of L[M])t[R]+=T;O(y[C],E[C]);break}}}}function FR(e){let{maxRank:t,KIND:n,layerStart:r,order:i}=e,s=new Uint8Array(t+1),a=!1;for(let o=1;o\u003Ct;o++){let c=r[o+1]>r[o];for(let l=r[o];c&&l\u003Cr[o+1];l++)n[i[l]]!==1&&(c=!1);c&&(s[o]=1,a=!0)}return a?s:void 0}function BR(e,t,n,r,i){let{from:s,to:a,rank:o,track:c,levels:l,wide:u}=e,h=s.length,d=new Map;for(let C=0;C\u003Ch;C++){if(c.push(-1),l.push(0),Math.abs(s[C]-a[C])\u003CRr)continue;let Z=d.get(o[C]);Z?Z.push(C):d.set(o[C],[C])}if(d.size===0)return;let m=new Float64Array(h),p=new Float64Array(h);for(let C=0;C\u003Ch;C++)m[C]=Math.min(s[C],a[C]),p[C]=Math.max(s[C],a[C]);let y=(C,Z)=>C>=m[Z]-Rr&&C\u003C=p[Z]+Rr?1:0,E=(C,Z)=>Math.abs(s[C]-s[Z])\u003CRr||Math.abs(a[C]-a[Z])\u003CRr,b=(C,Z)=>m[C]\u003Cp[Z]-Rr&&m[Z]\u003Cp[C]-Rr,S=(C,Z)=>b(C,Z)&&!E(C,Z),x=(C,Z)=>b(C,Z)||y(a[C],Z)+y(s[Z],C)+y(a[Z],C)+y(s[C],Z)>0,I=(C,Z)=>y(a[C],Z)+y(s[Z],C),L=C=>{let Z=C.map((H,z)=>z).sort((H,z)=>m[C[H]]-m[C[z]]),oe=[];for(let H=0;H\u003CZ.length;H++){let z=Z[H],M=p[C[z]]+4*Rr;for(let T=H+1;T\u003CZ.length&&m[C[Z[T]]]\u003C=M;T++){let R=Z[T];oe.push(Math.min(z,R),Math.max(z,R))}}return oe},O=C=>{C.sort((D,U)=>p[U]-m[U]-(p[D]-m[D])||m[D]-m[U]||D-U);let Z=C.length,oe=[],H=C.map((D,U)=>U),z=D=>{for(;H[D]!==D;)D=H[D]=H[H[D]];return D},M=Z\u003C=pg,T=M?L(C):[],R=M?C.map(()=>[]):[];for(let D=0;D\u003CT.length;D+=2){let U=T[D],B=T[D+1];S(C[U],C[B])&&(R[U].push(B),R[B].push(U))}let _=C.map((D,U)=>U);if(M){let D=new Int32Array(Z),U=[];for(let F=0;F\u003CZ;F++)oe.push([]),U.push([]);for(let F=0;F\u003CT.length;F+=2){let W=T[F],j=T[F+1],Q=C[W],Y=C[j];if(!x(Q,Y))continue;H[z(W)]=z(j);let ne=I(Q,Y),q=I(Y,Q);if(ne===q)continue;let k=ne\u003Cq?W:j,J=ne\u003Cq?j:W;oe[J].push(k),U[k].push(J),D[J]++}let B=new Uint8Array(Z);_=[];for(let F=0;F\u003CZ;F++){let W=-1;for(let j=0;j\u003CZ&&!(!B[j]&&((W\u003C0||D[j]\u003CD[W])&&(W=j),D[j]===0));j++);B[W]=1,_.push(W);for(let j of U[W])D[j]--}}let $=new Set,g=[],N=0;for(let D of _){let U=C[D],B=0;for(let F of oe[D]??[])c[C[F]]>=B&&(B=c[C[F]]+1);if(M){$.clear();for(let F of R[D])$.add(c[C[F]]);for(;$.has(B);)B++}else{for(;g[B]?.some(F=>S(U,F));)B++;(g[B]??=[]).push(U)}c[U]=B,B>=N&&(N=B+1)}let w=new Int32Array(Z).fill(N),A=new Int32Array(Z).fill(-1);for(let D=0;D\u003CZ;D++){let U=z(D);w[U]=Math.min(w[U],c[C[D]]),A[U]=Math.max(A[U],c[C[D]])}for(let D=0;D\u003CZ;D++){let U=z(D);l[C[D]]=A[U]-w[U]+1,n&&(c[C[D]]-=w[U])}return N},v=(C,Z,oe)=>{let H=Pi(a[C]-s[C],Z);for(let z=0;z\u003C=Di;z++){let M=z/Di,T=1-M;oe[2*z]=s[C]+(a[C]-s[C])*M*M*(3-2*M),oe[2*z+1]=Z*(3*H*M*T*T+3*(1-H)*M*M*T+M*M*M)}},G=(C,Z,oe)=>{let H=oe*oe*1.000000001;for(let z=0;z\u003C=Di;z++){let M=C[2*z],T=C[2*z+1];for(let R=0;R\u003CDi;R++){let _=Z[2*R+2]-Z[2*R],$=Z[2*R+3]-Z[2*R+1],g=Math.max(0,Math.min(1,((M-Z[2*R])*_+(T-Z[2*R+1])*$)/(_*_+$*$||1))),N=M-Z[2*R]-g*_,w=T-Z[2*R+1]-g*$;if(N*N+w*w\u003CH&&Math.hypot(N,w)\u003Coe)return!0}}return!1},K=(C,Z,oe,H)=>{let z=Math.max(oe/2,oe-2*TR);return v(C,z,Ou),v(Z,z,Du),G(Ou,Du,H)||G(Du,Ou,H)};for(let[C,Z]of d){if(!n){t[C]=O(Z);continue}if(Z.length>pg)continue;let oe=Z.filter(g=>u[g]===1);O(oe);let H=new Set(oe.filter(g=>l[g]>1)),z=L(Z);for(let g=0;g\u003Cz.length;g+=2){let N=Z[z[g]],w=Z[z[g+1]];H.has(N)&&H.has(w)||!S(N,w)||s[N]\u003Ca[N]!=s[w]\u003Ca[w]||K(N,w,r[C],u[N]===1||u[w]===1?MR:CR)&&H.add(N).add(w)}for(let g of oe)c[g]=-1,l[g]=0;if(H.size===0)continue;let M=0,T=0,R=new Set;for(let g=0;g\u003Cz.length;g+=2){let N=Z[z[g]],w=Z[z[g+1]];if(H.has(N)&&H.has(w)){if(!b(N,w))continue;s[N]\u003Ca[N]!=s[w]\u003Ca[w]?M++:E(N,w)||T++}else(H.has(N)||H.has(w))&&x(N,w)&&R.add(N).add(w)}if(M>T){for(let g of Z)(p[g]-m[g])*fg>i[C]&&(i[C]=(p[g]-m[g])*fg);continue}let _=Z.filter(g=>H.has(g)||u[g]!==1&&R.has(g));O(_);let $=0;for(let g of _)l[g]>$&&($=l[g]);t[C]=$}}function WR(e,t,n,r,i,s,a){let{maxRank:o,EF:c,ET:l,EFD:u,ETD:h,succStart:d,succE:m,predStart:p,predE:y,layerStart:E,order:b}=e,S=new Float64Array(t.length),x=new Float64Array(t.length),I=new Float64Array(t.length);for(let O=0;O\u003Cr.length;O++){let v=r[O];if(v\u003C0)continue;let G=v+i[O]-1,K=e.RANK[v];for(let C=v;C\u003CG;C++){if(!n[K+C-v])continue;let Z=C;for(;Z+1\u003CG&&n[K+Z+1-v];)Z++;let oe=y[p[C]],H=m[d[Z]],z=t[c[oe]]+u[oe],M=t[l[H]]+h[H],T=Z-C+2;for(let R=C;R\u003C=Z;R++)S[R]=z+(M-z)*(R-C+1)/T,x[R]=z,I[R]=M;C=Z}}let L=[];for(let O=1;O\u003Co;O++){if(!n[O])continue;let v=E[O],G=E[O+1],K=Array.from(b.subarray(v,G)).sort((C,Z)=>x[C]-x[Z]||I[C]-I[Z]||C-Z);for(let C=0;C\u003CK.length;){L.length=0;let Z=C;for(;Z\u003CK.length&&Math.abs(x[K[Z]]-x[K[C]])\u003CPu&&Math.abs(I[K[Z]]-I[K[C]])\u003CPu;Z++)L.push(K[Z]);L.sort((oe,H)=>e.pos[oe]-e.pos[H]);for(let oe=0;oe\u003CL.length;oe++){let H=L[oe];t[H]=S[H]+(oe-(L.length-1)/2)*s,(L.length===1||s===0)&&(a[H]=1)}C=Z}}}function UR(e,t,n,r,i,s){let{maxRank:a,W:o,KIND:c,RANK:l,EF:u,ET:h,EFD:d,ETD:m,succStart:p,succE:y,predStart:E,predE:b,layerStart:S,order:x}=e,I=new Uint8Array(a+1),L=!1;for(let O=1;O\u003Ca;O++){let v=!1,G=!1;for(let K=S[O];K\u003CS[O+1];K++){let C=c[x[K]];C===2?v=!0:C!==1&&(G=!0)}v&&!G&&(I[O]=1,L=!0)}if(L)for(let O=0;O\u003Cn.length;O++){let v=n[O];if(!(v\u003C0))for(let G=v,K=v+r[O]-1;G\u003CK;G++){if(c[G]!==1||!I[l[G]])continue;let C=G,Z=G;for(;C>v&&s[C-1];)C--;for(;Z+1\u003CK&&s[Z+1];)Z++;let oe=b[E[C]],H=y[p[Z]],z=t[u[oe]]+d[oe],M=t[h[H]]+m[H],T=Math.min(z,M)-i,R=Math.max(z,M)+i,_=!0,$=l[G];for(let N=S[$];_&&N\u003CS[$+1];N++){let w=x[N];c[w]===2&&t[w]+o[w]/2>T&&t[w]-o[w]/2\u003CR&&(_=!1)}if(!_)continue;s[G]=1;let g=Z-C+2;for(let N=C;N\u003C=Z;N++)t[N]=z+(M-z)*(N-C+1)/g}}}function GR(e,t){let{n,real:r,maxRank:i,W:s,EF:a,ET:o,EFD:c,ETD:l,succStart:u,succE:h,predStart:d,predE:m,layerStart:p,order:y,pos:E,offsets:b,fixed:S,GRP:x,groupParent:I}=e,L=0;for(let P=0;P\u003C=i;P++)L=Math.max(L,p[P+1]-p[P]);if(L\u003C2)return[0,0];let O=b?new Int32Array(a.length):void 0,v=new Int32Array(O?a.length:0),G=new Int32Array(O?n:0),K=O?h.slice():h,C=new Uint8Array(O?n:0);if(O){let P=m.slice(),ee=(ae,ue,ce,pe)=>{for(let V=ue+1;V\u003Cce;V++)if(pe[ae[V]]!==pe[ae[ue]])return ae.subarray(ue,ce).sort((X,le)=>pe[X]-pe[le]),!0;return!1};for(let ae=0;ae\u003Cn;ae++){if(G[ae]=1,ee(P,d[ae],d[ae+1],l))for(let ue=d[ae]+1;ue\u003Cd[ae+1];ue++)l[P[ue]]!==l[P[ue-1]]&&G[ae]++,v[P[ue]]=G[ae]-1;ee(K,u[ae],u[ae+1],c)&&(C[ae]=1)}}let Z=1;for(;Z\u003C(O?L+a.length:L);)Z\u003C\u003C=1;let oe=new Int32Array(2*Z),H=new Int32Array(a.length),z=()=>{let P=0;for(let ee=0;ee\u003Ci;ee++){let ae=p[ee+2]-p[ee+1];if(O){let pe=0;for(let V=p[ee+1];V\u003Cp[ee+2];V++){let X=y[V];for(let le=d[X];le\u003Cd[X+1];le++)O[m[le]]=pe+v[m[le]];pe+=G[X]}ae=pe}if(ae\u003C2)continue;let ue=0;for(let pe=p[ee];pe\u003Cp[ee+1];pe++){let V=y[pe],X=u[V],le=u[V+1],de=ue;for(let _e=X;_e\u003Cle;_e++)H[ue++]=O?O[K[_e]]:E[o[h[_e]]];let Se=ue-de;if(!(Se\u003C2))if(O&&C[V])for(let _e=de+1;_e\u003Cue;_e++){let xe=H[_e],Me=c[K[X+_e-de]],Ce=_e-1;for(;Ce>=de&&c[K[X+Ce-de]]===Me&&H[Ce]>xe;)H[Ce+1]=H[Ce],Ce--;H[Ce+1]=xe}else if(Se\u003C=12)for(let _e=de+1;_e\u003Cue;_e++){let xe=H[_e],Me=_e-1;for(;Me>=de&&H[Me]>xe;)H[Me+1]=H[Me],Me--;H[Me+1]=xe}else H.subarray(de,ue).sort()}if(ue\u003C2)continue;let ce=1;for(;ce\u003Cae;)ce\u003C\u003C=1;oe.fill(0,0,2*ce);for(let pe=0;pe\u003Cue;pe++){let V=H[pe]+ce;for(oe[V]++;V>1;)(V&1)===0&&(P+=oe[V+1]),V>>=1,oe[V]++}}return P},M=z(),T=new Float64Array(n),R=new Int32Array(L),_=new Int32Array(L),$=I?I.length:0,g=new Int32Array($);for(let P=0;P\u003C$;P++)for(let ee=P;ee>=0;ee=I[ee])g[P]++;let N=new Float64Array($),w=new Int32Array($),A=new Int32Array($),D=(P,ee)=>{let ae=p[P],ue=p[P+1];for(let le=ae;le\u003Cue;le++)for(let de=x[y[le]];de>=0;de=I[de])N[de]=0,w[de]=0;for(let le=ae;le\u003Cue;le++){let de=y[le];for(let Se=x[de];Se>=0;Se=I[Se])w[Se]===0&&(A[Se]=le),N[Se]+=ee[de],w[Se]++}let ce=le=>le>=n?N[le-n]/w[le-n]:ee[le],pe=le=>le>=n?A[le-n]:ae+E[le],V=(le,de)=>{let Se=le,_e=de,xe=x[le],Me=x[de],Ce=xe\u003C0?0:g[xe],ke=Me\u003C0?0:g[Me];for(;Ce>ke;Ce--)Se=n+xe,xe=I[xe];for(;ke>Ce;ke--)_e=n+Me,Me=I[Me];for(;xe!==Me;)Se=n+xe,xe=I[xe],_e=n+Me,Me=I[Me];return ce(Se)-ce(_e)||pe(Se)-pe(_e)},X=Array.from(y.subarray(ae,ue)).sort(V);y.set(X,ae);for(let le=ae;le\u003Cue;le++)E[y[le]]=le-ae};if(x){let P=new Float64Array(n);for(let ee=0;ee\u003C=i;ee++){for(let ae=p[ee];ae\u003Cp[ee+1];ae++)P[y[ae]]=ae-p[ee];D(ee,P)}}let U=x?z():M;if(U===0)return[0,M];let B=y.slice(),F=Math.min(U,M),W=(P,ee)=>{let ae=P?d:u,ue=P?m:h,ce=P?a:o,pe=P?c:l;for(let V=1;V\u003C=i;V++){let X=P?V:i-V;if(S[X])continue;let le=p[X],de=p[X+1],Se=0;for(let xe=le;xe\u003Cde;xe++){let Me=y[xe],Ce=Me\u003Cr?t[Me].pin:0;if(Ce!==0){T[Me]=Ce*1e9,R[Se++]=Me;continue}let ke=ae[Me],be=ae[Me+1];if(ke===be){if(x){let ie=P?p[X]-p[X-1]:p[X+2]-p[X+1];T[Me]=(xe-le)*ie/(de-le);continue}T[Me]=-1;continue}let Ae=0;for(let ie=ke;ie\u003Cbe;ie++){let me=ce[ue[ie]];Ae+=E[me],b&&s[me]>0&&(Ae+=pe[ue[ie]]/s[me])}T[Me]=Ae/(be-ke),R[Se++]=Me}if(x){D(X,T);continue}if(Se\u003C2)continue;kR(R,Se,T,E,ee,_);let _e=0;for(let xe=le;xe\u003Cde;xe++)T[y[xe]]!==-1&&(y[xe]=R[_e++]);for(let xe=le;xe\u003Cde;xe++)E[y[xe]]=xe-le}},j=()=>{let P=0;for(let ee=0;ee\u003C=i;ee++)for(let ae=p[ee];ae\u003Cp[ee+1];ae++)if(!(y[ae]>=r))for(let ue=ae+1;ue\u003Cp[ee+1];ue++)y[ue]\u003Cy[ae]&&P++;return P},Q=()=>{for(let P=0;P\u003C=i;P++)for(let ee=p[P];ee\u003Cp[P+1];ee++)E[y[ee]]=ee-p[P]},Y=P=>P\u003Cr?t[P].pin:0,ne=(P,ee)=>{let ae=ee?a[P]:o[P];return b&&s[ae]>0?E[ae]+(ee?c[P]:l[P])/s[ae]:E[ae]},q=(P,ee)=>{let ae=0;for(let ue=d[P];ue\u003Cd[P+1];ue++){let ce=ne(m[ue],!0);for(let pe=d[ee];pe\u003Cd[ee+1];pe++)ce>ne(m[pe],!0)&&ae++}for(let ue=u[P];ue\u003Cu[P+1];ue++){let ce=ne(h[ue],!1);for(let pe=u[ee];pe\u003Cu[ee+1];pe++)ce>ne(h[pe],!1)&&ae++}return ae},k=()=>{for(let P=0;P\u003C8;P++){let ee=!1;for(let ae=0;ae\u003C=i;ae++){if(S[ae])continue;let ue=p[ae];for(let ce=ue;ce+1\u003Cp[ae+1];ce++){let pe=y[ce],V=y[ce+1];Y(pe)!==Y(V)||x&&x[pe]!==x[V]||q(V,pe)>=q(pe,V)||(y[ce]=V,y[ce+1]=pe,E[V]=ce-ue,E[pe]=ce+1-ue,ee=!0)}}if(!ee)break}},J=y.slice(),te=n\u003C=600,se=B,re=1/0;for(let P=0;P\u003C(te?2:1);P++){P>0&&(y.set(J),Q());let ee=F,ae=J.slice();for(let ce=0,pe=0;pe\u003C4&&ce\u003CER;ce++,pe++){W((ce+P)%2===0,ce%4>=2);let V=z();if(V\u003Cee&&(ee=V,ae.set(y),pe=0,V===0))break}if(y.set(ae),te&&ee>0){Q(),k();let ce=z();ce\u003Cee&&(ee=ce,ae.set(y))}let ue=te?j():0;(P===0||ee\u003CU||ee===U&&ue\u003Cre)&&(U=ee,se=ae,re=ue)}if(y.set(se),Q(),B.set(se),x&&(U=z()),!te)return[U,M];for(let P=0;P\u003Cr;P++)if(t[P].pin!==0)return[U,M];if(re===0||S[0]||S[i])return[U,M];for(let P=0;P\u003C=i;P++)y.subarray(p[P],p[P+1]).reverse();return Q(),(z()>U||j()>=re)&&y.set(B),[U,M]}function yg(e,t,n){return e.W[n]/2+(e.KIND[n]===0?t.nodeSep:t.edgeSep)/2}function gg(e,t){let{n,maxRank:r,W:i,KIND:s,EF:a,ET:o,EFD:c,ETD:l,succStart:u,succE:h,predStart:d,predE:m,layerStart:p,order:y,pos:E}=e,b=a.length,S=new Float64Array(n);for(let A=0;A\u003Cn;A++)S[A]=yg(e,t,A);let x=new Int32Array(b);for(let A=0;A\u003Cb;A++)x[A]=E[o[A]];for(let A=0;A\u003Cn;A++)u[A+1]-u[A]>1&&mg(h,u[A],u[A+1],x);for(let A=0;A\u003Cb;A++)x[A]=E[a[A]];for(let A=0;A\u003Cn;A++)d[A+1]-d[A]>1&&mg(m,d[A],d[A+1],x);let I=new Uint8Array(b);for(let A=1;A\u003C=r;A++){let D=p[A]-p[A-1],U=p[A],B=p[A+1],F=0,W=U;for(let j=U;j\u003CB;j++){let Q=y[j],Y=-1;if(vi(s[Q])){let q=a[m[d[Q]]];vi(s[q])&&(Y=q)}let ne=Y>=0?E[Y]:D;if(Y>=0||j===B-1){for(let q=W;q\u003C=j;q++){let k=y[q],J=vi(s[k]);for(let te=d[k];te\u003Cd[k+1];te++){let se=m[te],re=E[a[se]];(re\u003CF||ne\u003Cre)&&!(J&&vi(s[a[se]]))&&(I[se]=1)}}W=j+1,F=ne}}}let L=[],O=new Int32Array(n),v=new Int32Array(n),G=new Float64Array(n),K=new Int32Array(n),C=new Int32Array(n),Z=new Float64Array(n),oe=new Int32Array(n),H=new Int32Array(n+1),z=new Int32Array(n),M=new Int32Array(n),T=new Int32Array(n),R=new Float64Array(n);for(let A=0;A\u003C4;A++){let D=A\u003C2,U=(A&1)===1,B=D?d:u,F=D?m:h,W=D?a:o,j=D?l:c,Q=D?c:l;for(let k=0;k\u003Cn;k++)O[k]=k,v[k]=k,G[k]=0,oe[k]=0,H[k+1]=0,R[k]=0;for(let k=0;k\u003C=r;k++){let J=D?k:r-k,te=p[J],se=p[J+1],re=D?J-1:J+1,P=re>=0&&re\u003C=r?p[re+1]-p[re]-1:0,ee=-1;for(let ae=U?se-1:te;U?ae>=te:ae\u003Cse;U?ae--:ae++){let ue=y[ae],ce=B[ue],pe=B[ue+1]-ce;if(pe===0)continue;let V=ce+(pe-1>>1),X=ce+(pe>>1);for(let le=0;le\u003C2&&!(le===1&&V===X);le++){let de=F[le===0!==U?V:X],Se=W[de],_e=U?P-E[Se]:E[Se];v[ue]===ue&&ee\u003C_e&&I[de]===0&&(v[Se]=ue,v[ue]=O[ue]=O[Se],G[ue]=G[Se]+Q[de]-j[de],ee=_e)}}}let Y=0;for(let k=0;k\u003C=r;k++){let J=p[k],te=p[k+1];for(let se=J+1;se\u003Cte;se++){let re=U?y[se]:y[se-1],P=U?y[se-1]:y[se],ee=S[re]+S[P];K[Y]=O[re],C[Y]=O[P],Z[Y]=U?ee-G[re]+G[P]:ee+G[re]-G[P],oe[O[P]]++,H[O[re]+1]++,Y++}}for(let k=0;k\u003Cn;k++)H[k+1]+=H[k];for(let k=0;k\u003Cn;k++)M[k]=H[k];for(let k=0;k\u003CY;k++)z[M[K[k]]++]=k;let ne=0;for(let k=0;k\u003Cn;k++)O[k]===k&&oe[k]===0&&(T[ne++]=k);for(let k=0;k\u003Cne;k++){let J=T[k];for(let te=H[J];te\u003CH[J+1];te++){let se=z[te],re=C[se];R[J]+Z[se]>R[re]&&(R[re]=R[J]+Z[se]),--oe[re]===0&&(T[ne++]=re)}}for(let k=ne-1;k>=0;k--){let J=T[k],te=1/0;for(let se=H[J];se\u003CH[J+1];se++){let re=z[se],P=R[C[re]]-Z[re];P\u003Cte&&(te=P)}te!==1/0&&te>R[J]&&(R[J]=te)}let q=new Float64Array(n);for(let k=0;k\u003Cn;k++)q[k]=(U?-R[O[k]]:R[O[k]])+G[k];L.push(q)}let _=0,$=1/0,g=[],N=[];for(let A=0;A\u003C4;A++){let D=1/0,U=-1/0,B=L[A];for(let F=0;F\u003Cn;F++){let W=i[F]/2;B[F]-W\u003CD&&(D=B[F]-W),B[F]+W>U&&(U=B[F]+W)}g.push(D),N.push(U),U-D\u003C$&&($=U-D,_=A)}for(let A=0;A\u003C4;A++){let D=(A&1)===0?g[_]-g[A]:N[_]-N[A];if(D!==0){let U=L[A];for(let B=0;B\u003Cn;B++)U[B]+=D}}let w=new Float64Array(n);for(let A=0;A\u003Cn;A++){let D=L[0][A],U=L[1][A],B=L[2][A],F=L[3][A],W;D>U&&(W=D,D=U,U=W),B>F&&(W=B,B=F,F=W),D>B&&(W=D,D=B,B=W),U>F&&(W=U,U=F,F=W),U>B&&(W=U,U=B,B=W),w[A]=(U+B)/2}return w}function ln(e){return e===\\\"BT\\\"||e===\\\"LR\\\"||e===\\\"RL\\\"?e:\\\"TB\\\"}var YR=4e4,HR=400,KR=500,zR=1.5,VR=4;function Eg(e,t,n,r){let i=[];for(let o of e)i.push(o.x,o.y,o.w,o.h);let s=[];for(let o of t)s.push(o.labelX,o.labelY);let a=[];for(let o of n){a.push(o.x,o.y);for(let c of o.ports)a.push(c.px,c.py)}return{nodes:i,routes:t.map(o=>o.route),labels:s,levels:a,total:r}}function xg(e,t,n,r){t.forEach((s,a)=>{s.x=e.nodes[4*a],s.y=e.nodes[4*a+1],s.w=e.nodes[4*a+2],s.h=e.nodes[4*a+3]}),n.forEach((s,a)=>{s.route=e.routes[a],s.labelX=e.labels[2*a],s.labelY=e.labels[2*a+1]});let i=0;for(let s of r){s.x=e.levels[i++],s.y=e.levels[i++];for(let a of s.ports)a.px=e.levels[i++],a.py=e.levels[i++]}return e.total}var Ag=24,Fi=.5,Fu=3,Bu=2,jR=Math.max(3,Fu,Bu+1),bc=.62,XR=128;function qR(e){return e.tracks?1:e.straight?2:0}function yc(e,t,n=0){let r=0;for(let M of t)M.src!==M.dst&&M.route.length>3&&(r+=(M.route.length/3-1)*jR);let i=new Float64Array(r),s=new Float64Array(r),a=new Float64Array(r),o=new Float64Array(r),c=new Float64Array(r),l=new Float64Array(r),u=new Int32Array(r),h=new Uint8Array(r),d=0,m=1/0,p=-1/0,y=NaN,E=NaN,b=NaN,S=NaN,x=(M,T,R,_,$,g)=>{let N=d-1;R===b&&_===S&&(g===_&&E===_||$===R&&y===R)&&u[N]===M&&h[N]===T&&(R-y)*($-R)+(_-E)*(g-_)>0&&(d--,R=y,_=E),y=R,E=_,b=$,S=g,h[d]=T,i[d]=Math.min(R,$),a[d]=Math.max(R,$),s[d]=R\u003C=$?_:g,o[d]=R\u003C=$?g:_,c[d]=Math.min(_,g),l[d]=Math.max(_,g),c[d]\u003Cm&&(m=c[d]),l[d]>p&&(p=l[d]),u[d++]=M};for(let M=0;M\u003Ct.length;M++){let T=t[M];if(T.src===T.dst)continue;let R=T.route,_=A=>Math.abs(R[A]-R[A-3])\u003C.01||Math.abs(R[A+1]-R[A-2])\u003C.01,$=A=>Math.abs(R[A]-R[A-3])+Math.abs(R[A+1]-R[A-2]),g=A=>n===0&&A>0&&A\u003CR.length-3&&_(A)&&_(A+3)&&$(A)>=.01&&$(A+3)>=.01&&Math.abs(R[A]-R[A-3])\u003C.01!=Math.abs(R[A+3]-R[A])\u003C.01,N=R[0],w=R[1];for(let A=3;A\u003CR.length;A+=3){let D=(A===3?1:0)|(A===R.length-3?2:0),U=N,B=w,F=R[A],W=R[A+1];if(N=F,w=W,_(A)||n===2){if(!g(A)){x(M,D,U,B,F,W);continue}let q=g(A-3)?$(A)/2:$(A),k=g(A+3)?$(A+3)/2:$(A+3),J=(F-R[A-3])/$(A),te=(W-R[A-2])/$(A),se=(R[A+3]-F)/$(A+3),re=(R[A+4]-W)/$(A+3),P=F-J*q,ee=W-te*q;x(M,D,U,B,P,ee);let ae=F-J*q*(1-bc),ue=W-te*q*(1-bc),ce=F+se*k*(1-bc),pe=W+re*k*(1-bc);N=F+se*k,w=W+re*k;let V=D|(A+3===R.length-3?2:0),X=P,le=ee;for(let de=1;de\u003C=Bu;de++){let Se=de/Bu,_e=1-Se,xe=_e*_e*_e*P+3*_e*_e*Se*ae+3*_e*Se*Se*ce+Se*Se*Se*N,Me=_e*_e*_e*ee+3*_e*_e*Se*ue+3*_e*Se*Se*pe+Se*Se*Se*w;x(M,V,X,le,xe,Me),X=xe,le=Me}continue}if(n===1){let q=R[A+2]===0,k=q?U:(U+F)/2,J=q?(B+W)/2:B;x(M,D,U,B,k,J),x(M,D,k,J,q?F:k,q?J:W),x(M,D,q?F:k,q?J:W,F,W);continue}let j=R[A+2]===0,Q=j?Pi(F-U,W-B):Pi(W-B,F-U),Y=U,ne=B;for(let q=1;q\u003C=Fu;q++){let k=q/Fu,J=1-k,te=k*k*(3-2*k),se=3*Q*k*J*J+3*(1-Q)*k*k*J+k*k*k,re=U+(F-U)*(j?te:se),P=B+(W-B)*(j?se:te);x(M,D,Y,ne,re,P),Y=re,ne=P}}}let I=p>m?Math.round(Math.sqrt(d)):1,L=p>m?I/(p-m):0,O=M=>Math.min(I-1,Math.floor((M-m)*L)),v=new Int32Array(d),G=new Int32Array(I+1);for(let M=0;M\u003Cd;M++){v[M]=O(c[M]);for(let T=v[M],R=O(l[M]);T\u003C=R;T++)G[T+1]++}for(let M=0;M\u003CI;M++)G[M+1]+=G[M];let K=G.slice(0,I),C=new Int32Array(G[I]);for(let M=0;M\u003Cd;M++)for(let T=v[M],R=O(l[M]);T\u003C=R;T++)C[K[T]++]=M;let Z=new Float64Array(t.length*8),oe=(M,T,R,_)=>Math.abs(M[T]-M[R])\u003CFi&&Math.abs(M[T]-M[_])\u003CFi||Math.abs(M[T+1]-M[R+1])\u003CFi&&Math.abs(M[T+1]-M[_+1])\u003CFi;for(let M=0;M\u003Ct.length;M++){let T=t[M].route;if(T.length\u003C6)continue;let R=3;for(;R+3\u003CT.length&&oe(T,0,R,R+3);)R+=3;let _=T.length-3,$=_-3;for(;$>=3&&oe(T,_,$,$-3);)$-=3;Z.set([T[0],T[1],T[R],T[R+1],T[$],T[$+1],T[_],T[_+1]],M*8)}let H=(M,T,R,_)=>{let $=M*8+(T===1?0:4),g=Z[$],N=Z[$+1],w=Z[$+2]-g,A=Z[$+3]-N,D=w*w+A*A,U=D>0?Math.max(0,Math.min(1,((R-g)*w+(_-N)*A)/D)):0;return Math.hypot(R-g-U*w,_-N-U*A)\u003CFi},z=0;for(let M=0;M\u003CI;M++){let T=G[M+1];if(T-G[M]>XR)C.subarray(G[M],T).sort((R,_)=>i[R]-i[_]||R-_);else for(let R=G[M]+1;R\u003CT;R++){let _=C[R],$=R;for(;$>G[M]&&i[C[$-1]]>i[_];$--)C[$]=C[$-1];C[$]=_}for(let R=G[M];R\u003CT;R++){let _=C[R],$=a[_]-i[_],g=o[_]-s[_],N=v[_]===M;for(let w=R+1;w\u003CT;w++){let A=C[w];if(i[A]>a[_])break;if(l[A]\u003Cc[_]||c[A]>l[_]||u[_]===u[A]||!N&&v[A]!==M)continue;let D=$*(s[A]-s[_])-g*(i[A]-i[_]),U=$*(o[A]-s[_])-g*(a[A]-i[_]);if(D>0==U>0)continue;let B=a[A]-i[A],F=o[A]-s[A],W=B*(s[_]-s[A])-F*(i[_]-i[A]),j=B*(o[_]-s[A])-F*(a[_]-i[A]);if(W>0==j>0)continue;let Q=t[u[_]],Y=t[u[A]],ne=W/(W-j),q=i[_]+ne*$,k=s[_]+ne*g,J=(te,se,re)=>(h[_]&se)!==0&&(h[A]&re)!==0||Math.abs(q-e[te].x)\u003Ce[te].w/2+Ag&&Math.abs(k-e[te].y)\u003Ce[te].h/2+Ag||H(u[_],se,q,k)&&H(u[A],re,q,k);Q.src===Y.src&&J(Q.src,1,1)||Q.src===Y.dst&&J(Q.src,1,2)||Q.dst===Y.src&&J(Q.dst,2,1)||Q.dst===Y.dst&&J(Q.dst,2,2)||z++}}}return z}function xc(e,t){let n=r=>{let i=new Set;for(let s=e[r].parent;s>=0&&!i.has(s);s=e[s].parent)i.add(s);return i};for(let[r,i]of t){if(r\u003C0||i\u003C0||r===i)continue;let s=n(r),a=n(i);for(let o of s)a.has(o)||(e[o].dir=void 0);for(let o of a)s.has(o)||(e[o].dir=void 0)}}function Tr(e,t,n,r){for(let i of e)i.x+=n,i.y+=r;for(let i of t){for(let s=0;s\u003Ci.route.length;s+=3)i.route[s]+=n,i.route[s+1]+=r;i.labelX+=n,i.labelY+=r}}function Bt(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 Ec(e){return e===\\\"TB\\\"?0:e===\\\"BT\\\"?2:e===\\\"LR\\\"?3:1}function Po(e){return e+2&3}function On(e,t,n,r){let i=e.length,s=new Map,a=[],o=(T,R)=>{let _={id:T,dir:R,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return s.set(T,_),_},c=o(-1,n),l=[];for(let T=0;T\u003Ci;T++)l.push([]);let u=[];for(let T=0;T\u003Ci;T++){let R=e[T].parent;R>=0&&R\u003Ci&&R!==T&&e[R].isGroup?l[R].push(T):(e[T].parent=-1,u.push(T))}c.items=u,a.push(c);let h=new Int32Array(i),d=new Uint8Array(i),m=T=>{for(let R=T;R\u003Ca.length;R++){let _=a[R];for(let $ of _.items)if(d[$]=1,h[$]=_.id\u003C0?0:h[_.id]+1,e[$].isGroup){let g=o($,e[$].dir??_.dir);g.items=l[$],a.push(g)}}};m(0);for(let T=0;T\u003Ci;T++){if(d[T])continue;let R=e[T].parent;if(l[R]=l[R].filter(_=>_!==T),e[T].parent=-1,c.items.push(T),d[T]=1,h[T]=0,e[T].isGroup){let _=a.length,$=o(T,e[T].dir??n);$.items=l[T],a.push($),m(_)}}for(let T=a.length-1;T>0;T--){let R=a[T],_=1/0;for(let $ of R.items)e[$].seq\u003C_&&(_=e[$].seq);_!==1/0&&(e[R.id].seq=_)}for(let T of a)T.items.sort((R,_)=>e[R].seq-e[_].seq||R-_);let p=0;for(let T of t){let R=T.src,_=T.dst,$=0;for(;h[R]>h[_];$++)R=e[R].parent;for(;h[_]>h[R];$++)_=e[_].parent;for(;R!==_&&e[R].parent!==e[_].parent;$+=2)R=e[R].parent,_=e[_].parent;R!==_&&(p+$>YR?(T.src=R,T.dst=_):p+=$)}let y=[],E=[];for(let T=0;T\u003Ct.length;T++){let R=t[T];if(R.route=[],R.src===R.dst){y.push(T);continue}let _=R.src,$=R.dst,g=[],N=[];for(;h[_]>h[$];)g.push(_),_=e[_].parent;for(;h[$]>h[_];)N.push($),$=e[$].parent;if(_===$){E.push(T);continue}for(;e[_].parent!==e[$].parent;)g.push(_),N.push($),_=e[_].parent,$=e[$].parent;s.get(e[_].parent).edges.push({e:T,a:_,b:$});for(let[w,A]of[[g,!0],[N,!1]])for(let D of w){let U=s.get(e[D].parent),B={e:T,inner:D,out:A,side:0,hint:NaN,px:0,py:0,route:[]};U.ports.push(B),U.portOf.set(T*2+(A?0:1),B)}}let b=new Int32Array(i),S=(T,R,_)=>(_?R.src:R.dst)!==T,x=(T,R)=>{let _=T.dir===\\\"TB\\\"||T.dir===\\\"BT\\\",$=Ec(T.dir),g=[],N=[];T.items.forEach((U,B)=>{b[U]=B;let F=e[U],W=R?Ys(_?F.w:F.h,_?F.h:F.w):Ys(0,0);W.span=F.isGroup?Math.min(F.span,W.w-2*F.padX):F.span,W.key=O?L[U]:NaN,g.push(W)});let w=(U,B,F)=>e[U].isGroup&&S(U,t[B],F),A=(U,B,F)=>{if(!R||!e[U].isGroup||!S(U,t[B],F))return 0;let W=s.get(U).portOf.get(B*2+(F?0:1));return _?W.px-e[U].w/2:W.py-e[U].h/2};for(let U of T.edges){let B=t[U.e],F=Hs(b[U.a],b[U.b],B.minlen);R&&(F.labelW=_?B.labelW:B.labelH,F.labelH=_?B.labelH:B.labelW,F.tailDx=A(U.a,U.e,!0),F.headDx=A(U.b,U.e,!1),F.tailFixed=w(U.a,U.e,!0),F.headFixed=w(U.b,U.e,!1)),N.push(F)}let D=new Int32Array(T.ports.length).fill(-1);return T.ports.forEach((U,B)=>{if(U.side===$||U.side===Po($)){let F=g.length,W=Ys(0,0,U.side===$?3:4);W.key=O?L[U.out?t[U.e].dst:t[U.e].src]:NaN,W.hint=Number.isNaN(U.hint)&&O&&G?G(T,U):U.hint,g.push(W),D[B]=F;let j=U.out?Hs(b[U.inner],F):Hs(F,b[U.inner]);U.out?(j.tailDx=A(U.inner,U.e,!0),j.tailFixed=w(U.inner,U.e,!0)):(j.headDx=A(U.inner,U.e,!1),j.headFixed=w(U.inner,U.e,!1)),N.push(j)}else g[b[U.inner]].pin=U.side===0||U.side===3?-1:1}),{lnodes:g,ledges:N,dummies:D}},I=p>1&&p\u003C=HR&&t.length\u003C=KR,L=new Float64Array(i).fill(NaN),O=!1,v=0,G,K=a.length>1&&I;for(let T of a)T.dir!==n&&(K=!1);if(K){let T=n===\\\"TB\\\"||n===\\\"BT\\\",R=new Int32Array(i).fill(-1),_=new Int32Array(i).fill(-1),$=[],g=[],N=[];for(let W=0;W\u003Ci;W++)e[W].isGroup&&(_[W]=N.length,N.push(-1));for(let W=0;W\u003Ci;W++){let j=e[W].parent;e[W].isGroup?N[_[W]]=j>=0?_[j]:-1:(R[W]=$.length,$.push(Ys(T?e[W].w:e[W].h,T?e[W].h:e[W].w)),g.push(j>=0?_[j]:-1))}let w=[],A=new Int32Array(t.length).fill(-1);t.forEach((W,j)=>{W.src===W.dst||R[W.src]\u003C0||R[W.dst]\u003C0||(A[j]=w.length,w.push(Hs(R[W.src],R[W.dst],W.minlen,T?W.labelW:W.labelH,T?W.labelH:W.labelW)))});let D=gc($,w,{...r,groups:{of:Int32Array.from(g),parent:Int32Array.from(N)},orderOnly:!0});v=Math.min(D.crossings??0,D.declared??0);let U=new Float64Array(i),B=new Int32Array(i),F=new Int32Array(i).fill(-1);for(let W=0;W\u003Ci;W++)if(!(R[W]\u003C0)){L[W]=$[R[W]].x;for(let j=e[W].parent;j>=0;j=e[j].parent)U[j]+=L[W],B[j]++,F[j]=Math.max(F[j],$[R[W]].rank)}for(let W=0;W\u003Ci;W++)B[W]>0&&(L[W]=U[W]/B[W]);G=(W,j)=>{let Q=A[j.e];if(Q\u003C0||W.id\u003C0||!j.out||j.side!==Po(Ec(W.dir)))return NaN;let Y=w[Q].points,ne=L[t[j.e].src],q=0;for(let k=0;k\u003CY.length;k+=2)Y[k]===F[W.id]&&(ne=Y[k+1]),Y[k]===F[W.id]+1&&(q=Y[k+1]);return ne+q*1e-6}}let C=new Map,Z=(T,R,_)=>{if(!I)return{lnodes:R,ledges:_,size:gc(R,_,r)};let $=[];for(let w of R)$.push(w.w,w.h,w.kind,w.pin,w.hint,w.key,w.span);for(let w of _)$.push(w.tail,w.head,w.minlen,w.labelW,w.labelH,w.tailDx,w.headDx,+w.tailFixed,+w.headFixed);let g=C.get(T.id);g||C.set(T.id,g=[]);for(let w of g){let A=w.given.length===$.length;for(let D=0;A&&D\u003C$.length;D++)A=Object.is(w.given[D],$[D]);if(A)return w}let N={given:$,lnodes:R,ledges:_,size:gc(R,_,r)};return g.push(N),N},oe={width:0,height:0},H=()=>{for(let R of a){for(let w of R.ports)e[w.inner].isGroup&&S(w.inner,t[w.e],w.out)&&(s.get(w.inner).portOf.get(w.e*2+(w.out?0:1)).side=w.side);if(R.edges.length===0)continue;let _=!1;for(let w of R.edges){let A=t[w.e];(e[w.a].isGroup&&A.src!==w.a||e[w.b].isGroup&&A.dst!==w.b)&&(_=!0)}if(!_)continue;let{lnodes:$,ledges:g}=x(R,!1);Do($,g),vo($,g,1);let N=Ec(R.dir);R.edges.forEach((w,A)=>{let D=t[w.e],U=!g[A].reversed;e[w.a].isGroup&&D.src!==w.a&&(s.get(w.a).portOf.get(w.e*2).side=U?Po(N):N),e[w.b].isGroup&&D.dst!==w.b&&(s.get(w.b).portOf.get(w.e*2+1).side=U?N:Po(N))})}for(let R=a.length-1;R>=0;R--){let _=a[R],$=_.id>=0?e[_.id]:void 0,g=_.dir===\\\"TB\\\"||_.dir===\\\"BT\\\",N=_.dir===\\\"BT\\\"||_.dir===\\\"RL\\\",w=x(_,!0),{lnodes:A,ledges:D,size:U}=Z(_,w.lnodes,w.ledges),B=w.dummies,F=g?U.width:U.height,W=g?U.height:U.width,j=$?$.padX:0,Q=$?$.padTop:0,Y=Math.max(F+2*j,$?$.minW:0),ne=W+Q+($?$.padBottom:0),q=(Y-F)/2,k=Q,J=(ee,ae)=>q+(g?ee:N?U.height-ae:ae),te=(ee,ae)=>k+(g?N?U.height-ae:ae:ee),se=g?0:1,re=ee=>{let ae=[];for(let ue=0;ue\u003Cee.length;ue+=2)ae.push(J(ee[ue],ee[ue+1]),te(ee[ue],ee[ue+1]),se);return ae};_.items.forEach((ee,ae)=>{e[ee].x=J(A[ae].x,A[ae].y),e[ee].y=te(A[ae].x,A[ae].y)}),_.edges.forEach((ee,ae)=>{let ue=D[ae];_.routes.set(ee.e,re(ue.points));let ce=t[ee.e];ce.labelW>0&&(ce.labelX=J(ue.labelX,ue.labelY),ce.labelY=te(ue.labelX,ue.labelY))});let P=_.edges.length;_.ports.forEach((ee,ae)=>{let ue=e[ee.inner];if(B[ae]>=0){let de=re(D[P++].points),Se=ee.out?de.length-3:0,_e=de[Se],xe=de[Se+1];ee.side===0?xe=0:ee.side===2?xe=ne:ee.side===3?_e=0:_e=Y,ee.out?de.push(_e,xe,se):de.unshift(_e,xe,se),ee.px=_e,ee.py=xe,ee.route=de;return}let ce=ue.x,pe=ue.y;if(ue.isGroup&&S(ee.inner,t[ee.e],ee.out)){let de=s.get(ee.inner).portOf.get(ee.e*2+(ee.out?0:1));ce+=de.px-ue.w/2,pe+=de.py-ue.h/2}else ee.side===0?pe-=ue.h/2:ee.side===2?pe+=ue.h/2:ee.side===3?ce-=ue.w/2:ce+=ue.w/2;let V=ce,X=pe;ee.side===0?X=0:ee.side===2?X=ne:ee.side===3?V=0:V=Y;let le=ee.side===0||ee.side===2?0:1;ee.px=V,ee.py=X,ee.route=ee.out?[ce,pe,le,V,X,le]:[V,X,le,ce,pe,le]}),$?($.w=Y,$.h=ne):oe={width:Y,height:ne}}for(let R of a){let _=R.x,$=R.y;for(let g of R.items){let N=e[g];if(N.x+=_,N.y+=$,N.isGroup){let w=s.get(g);w.x=N.x-N.w/2,w.y=N.y-N.h/2}}}let T=(R,_,$,g)=>{for(let N=0;N\u003C_.length;N+=3){let w=_[N]+$,A=_[N+1]+g,D=R.length;D>=3&&Math.abs(R[D-3]-w)\u003C.01&&Math.abs(R[D-2]-A)\u003C.01||R.push(w,A,_[N+2])}};for(let R of a)for(let _ of R.edges){let $=t[_.e],g=[],N=[];for(let A=$.src;e[A].parent!==R.id;A=e[A].parent)N.push(s.get(e[A].parent));for(let A of N)T(g,A.portOf.get(_.e*2).route,A.x,A.y);T(g,R.routes.get(_.e),R.x,R.y);let w=[];for(let A=$.dst;e[A].parent!==R.id;A=e[A].parent)w.push(s.get(e[A].parent));for(let A=w.length-1;A>=0;A--)T(g,w[A].portOf.get(_.e*2+1).route,w[A].x,w[A].y);$.route=g,$.labelW>0&&($.labelX+=R.x,$.labelY+=R.y)}},z=qR(r);O=K,H();let M=-1;if(K&&(M=yc(e,t,z),M>v*zR+VR)){let T=Eg(e,t,a,oe);O=!1,H();let R=yc(e,t,z);R>=M?(O=!0,oe=xg(T,e,t,a)):M=R}if(O===K&&I){let T=!1;for(let R of a){if(R.id\u003C0)continue;let _=e[R.id],$=R.dir===\\\"TB\\\"||R.dir===\\\"BT\\\",g=Po(Ec(R.dir)),N=[];for(let w of R.ports){if(w.side!==g)continue;let A=t[w.e].route,D=R.x+w.px,U=R.y+w.py,B=-1;for(let j=0;j\u003CA.length&&(B\u003C0||w.out);j+=3)Math.abs(A[j]-D)\u003C.01&&Math.abs(A[j+1]-U)\u003C.01&&(B=j);if(B\u003C0)continue;let F=$?0:1,W=w.out?B+3:B-3;for(;W>=0&&W\u003CA.length&&Math.abs(A[W+F]-A[B+F])\u003CFi;)W+=w.out?3:-3;W\u003C0||W>=A.length||(w.hint=A[W+F]-($?_.x-_.w/2:_.y-_.h/2),N.push([$?w.px:w.py,w.hint]))}N.sort((w,A)=>w[0]-A[0]);for(let w=1;w\u003CN.length;w++)N[w-1][1]>N[w][1]&&(T=!0)}if(T){let R=M>=0?M:yc(e,t,z),_=R>0?Eg(e,t,a,oe):void 0;_&&(H(),yc(e,t,z)>=R&&(oe=xg(_,e,t,a)))}}for(let T of E){let R=t[T],_=e[R.src],$=e[R.dst];R.route=[_.x,_.y,0,$.x,$.y,0],R.labelX=(_.x+$.x)/2,R.labelY=(_.y+$.y)/2}for(let T of y){let R=t[T],_=e[R.src];R.labelX=_.x+_.w/2+28+R.labelW/2,R.labelY=_.y}return oe}function ur(e,t){for(let n=0;n\u003Ct.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 hs(e,t,n,r){if(t===0)return e.x;let i=e.y-e.h/2,s=e.x-e.w/2,a=t/2,o=[s+r-6+a,e.x,s+e.w-r+6-a],c=n.get(Math.round(i));if(c===void 0)return o[0];let l=o[0],u=-1;for(let h of o){let d=1/0;for(let m of c)m>s&&m\u003Cs+e.w&&(d=Math.min(d,Math.abs(m-h)-a));if(d>=6)return h;d>u+.5&&(u=d,l=h)}return l}function Ac(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 s=e.x-e.w/2;for(let a of i)if(a>s&&a\u003Cs+e.w&&Math.abs(a-n)\u003Ct/2+4)return!0;return!1}function Sc(e,t,n,r,i,s,a,o){let c=1;for(let u=s[a].parent;u>=0&&c\u003C8;u=s[u].parent)c++;let l=`color-mix(in srgb,var(--_a) ${f(100*(1-.5**c))}%,var(--_bg))`;return`\u003Cg class=\\\"pele-cluster-title\\\" data-id=\\\"${i}\\\">`+Ne(e,t,n,` fill=\\\"none\\\" stroke=\\\"${l}\\\" stroke-width=\\\"5\\\" stroke-linejoin=\\\"round\\\"`,o)+Ne(e,t,n,r,o)+\\\"\u003C/g>\\\"}var Lt=8,QR=12,wc=.62,Fo=6;function _c(){let e=new Map;return{add(t,n,r){let i=Rt(r);n>=0&&i>0&&i+Fo>(e.get(t*4+n)??0)&&e.set(t*4+n,i+Fo)},of:(t,n)=>n>=0?e.get(t*4+n)??0:0}}function Cn(e,t,n,r,i=n>0?n+Fo:0,s=r>0?r+Fo:0){let a=t===\\\"linear\\\",o=t===\\\"step\\\"||t===\\\"stepBefore\\\"||t===\\\"stepAfter\\\",c=[],l=[],u=[],h=(g,N,w,A)=>Math.abs(g-w)\u003C.01&&Math.abs(N-A)\u003C.01;for(let g=0;g\u003Ce.length;g+=3){let N=e[g],w=e[g+1],A=e[g+2],D=c.length-1;if(o&&D>=0&&Math.abs(N-c[D])>=.01&&Math.abs(w-l[D])>=.01){let U=c[D],B=l[D],F=t===\\\"stepBefore\\\"?B:t===\\\"stepAfter\\\"?w:(B+w)/2,W=t===\\\"stepBefore\\\"?U:t===\\\"stepAfter\\\"?N:(U+N)/2,j=A===0?[U,F,N,F]:[W,B,W,w];for(let Q=0;Q\u003C4;Q+=2)h(j[Q],j[Q+1],U,B)||h(j[Q],j[Q+1],N,w)||(c.push(j[Q]),l.push(j[Q+1]),u.push(A))}c.push(N),l.push(w),u.push(A)}let d=c.length-1,m=g=>Math.abs(c[g]-c[g-1])\u003C.01||Math.abs(l[g]-l[g-1])\u003C.01,p=g=>a||m(g),y=(g,N,w)=>{if(!p(Math.max(g,N)))return w===0?[0,Math.sign(l[N]-l[g])||1]:[Math.sign(c[N]-c[g])||1,0];let A=c[N]-c[g],D=l[N]-l[g],U=Math.hypot(A,D)||1;return[A/U,D/U]},[E,b]=y(0,1,u[1]),[S,x]=y(d-1,d,u[d]),I=c[0],L=l[0],O=c[d],v=l[d];c[0]+=E*n,l[0]+=b*n,c[d]-=S*r,l[d]-=x*r;let G=g=>Math.abs(c[g]-c[g-1])+Math.abs(l[g]-l[g-1]),K=g=>!a&&g>0&&g\u003Cd&&m(g)&&m(g+1)&&G(g)>=.01&&G(g+1)>=.01&&Math.abs(c[g]-c[g-1])\u003C.01!=Math.abs(c[g+1]-c[g])\u003C.01,C=(g,N,w)=>Math.abs(c[g]-c[g-1])*Math.abs(N)+Math.abs(l[g]-l[g-1])*Math.abs(w),Z=(g,N,w)=>{let A=Math.min(Math.max(0,g-Fo-N),w/4);return A+Math.min(g-N-A,(w-A)/4)},oe=s>r&&(!p(d)||K(d-1))?Z(s,r,C(d,S,x)):0,H=i>n&&(!p(1)||K(1))?Z(i,n,C(1,E,b)):0;oe>=1&&(c.splice(d,0,c[d]-S*oe),l.splice(d,0,l[d]-x*oe),u.splice(d,0,u[d]),d++),H>=1&&(c.splice(1,0,c[0]+E*H),l.splice(1,0,l[0]+b*H),u.splice(1,0,u[1]),d++);let z=[],M=g=>(z.push(tT(g)),f(g));z.push(77,2);let T=`M${M(c[0])},${M(l[0])}`,R=c[0],_=l[0],$=(g,N)=>{h(g,N,R,_)||(z.push(76,2),T+=`L${M(g)},${M(N)}`,R=g,_=N)};for(let g=1;g\u003C=d;g++){let N=c[g],w=l[g];if(!p(g)){let j=u[g]===0,Q=j?w-_:N-R,Y=Math.abs(Q)*Pi(j?N-R:w-_,Q),ne=j?0:Math.sign(Q)*Y,q=j?Math.sign(Q)*Y:0;z.push(67,6),T+=`C${M(R+ne)},${M(_+q)} ${M(N-ne)},${M(w-q)} ${M(N)},${M(w)}`,R=N,_=w;continue}if(!K(g)){if(g\u003Cd&&m(g)&&m(g+1)&&(N-c[g-1])*(c[g+1]-N)+(w-l[g-1])*(l[g+1]-w)>0)continue;$(N,w);continue}let A=K(g-1)?G(g)/2:G(g),D=K(g+1)?G(g+1)/2:G(g+1);o&&(A=D=Math.min(QR,A,D));let[U,B]=y(g-1,g,u[g]),[F,W]=y(g,g+1,u[g+1]);$(N-U*A,w-B*A),R=N+F*D,_=w+W*D,o?(z.push(81,4),T+=`Q${M(N)},${M(w)} ${M(R)},${M(_)}`):(z.push(67,6),T+=`C${M(N-U*A*(1-wc))},${M(w-B*A*(1-wc))} ${M(N+F*D*(1-wc))},${M(w+W*D*(1-wc))} ${M(R)},${M(_)}`)}return{d:T,tokens:z,sx:I,sy:L,sdx:-E,sdy:-b,ex:O,ey:v,edx:S,edy:x}}function Rt(e){return e===\\\"arrow_point\\\"?Lt-1:e===\\\"arrow_circle\\\"?Lt:e===\\\"arrow_cross\\\"?4:0}function _t(e,t,n,r,i,s,a=\\\"none\\\"){let o=-i,c=r;if(e===\\\"arrow_point\\\"){let l=t-r*Lt,u=n-i*Lt,h=Lt*.42;return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(t)},${f(n)}L${f(l+o*h)},${f(u+c*h)}L${f(l-o*h)},${f(u-c*h)}Z\\\" fill=\\\"${s}\\\" stroke=\\\"${a}\\\"/>`}if(e===\\\"arrow_circle\\\")return`\u003Ccircle class=\\\"pele-marker\\\" cx=\\\"${f(t-r*4)}\\\" cy=\\\"${f(n-i*4)}\\\" r=\\\"3.5\\\" fill=\\\"${s}\\\" stroke=\\\"${a}\\\"/>`;if(e===\\\"arrow_cross\\\"){let l=t-r*4,u=n-i*4,h=3.5,d=(r+o)*h,m=(i+c)*h,p=(r-o)*h,y=(i-c)*h;return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(l-d)},${f(u-m)}L${f(l+d)},${f(u+m)}M${f(l-p)},${f(u-y)}L${f(l+p)},${f(u+y)}\\\"/>`}return\\\"\\\"}var ZR=Array.from({length:23},(e,t)=>+`1e${t}`);function JR(e){return Sg(eT(e))}function eT(e){let t=[],n=-1;for(let r=0;r\u003Ce.length;){let i=e.charCodeAt(r);if(i>=65&&i\u003C=90&&i!==69)n=t.length+1,t.push(i,0),r++;else if(i===45||i===46||i>=48&&i\u003C=57){let s=i===45?r+1:r,a=0,o=-1;for(let l=e.charCodeAt(s);l>=48&&l\u003C=57||l===46&&o\u003C0;l=e.charCodeAt(++s))l===46?o=0:(a=a*10+l-48,o>=0&&o++);let c;if((e.charCodeAt(s)|32)===101||a>Number.MAX_SAFE_INTEGER||o>22){for(let l=e.charCodeAt(s);l===46||l===101||l===69||l>=48&&l\u003C=57||(l===45||l===43)&&(e.charCodeAt(s-1)|32)===101;l=e.charCodeAt(++s));c=Number(e.slice(r,s))}else c=o>0?a/ZR[o]:a,i===45&&(c=-c);n>=0&&(t.push(c),t[n]++),r=s}else r++}return t}function tT(e){let t=Math.round(e*100);return t===0?0:t/100}function Sg(e){let t=[],n=0,r=0;for(let i=0;i\u003Ce.length;){let s=e[i],a=e[i+1],o=i+2,c=o+a;if(i=c,s===72||s===86)for(let l=o;l\u003Cc;l++)s===72?n=e[l]:r=e[l],t.push(n,r);else if(s===67||s===81){let l=s===67,u=l?6:4;for(let h=o;h+u\u003C=c;h+=u){let d=e[h],m=e[h+1],p=e[h+2],y=e[h+3],E=l?e[h+4]:p,b=l?e[h+5]:y;for(let S=.125;S\u003C=1;S+=.125){let x=n+(d-n)*S,I=r+(m-r)*S,L=d+(p-d)*S,O=m+(y-m)*S;if(l){let v=p+(E-p)*S,G=y+(b-y)*S;x+=(L-x)*S,I+=(O-I)*S,L+=(v-L)*S,O+=(G-O)*S}t.push(x+(L-x)*S,I+(O-I)*S)}n=E,r=b}}else if(s===65)for(let l=o;l+7\u003C=c;l+=7)nT(t,n,r,e[l],e[l+1],e[l+3],e[l+4],e[l+5],e[l+6]),n=e[l+5],r=e[l+6];else for(let l=o;l+2\u003C=c;l+=2)s===77&&l===o&&t.length>0&&t.push(NaN,NaN),n=e[l],r=e[l+1],t.push(n,r)}return t}function nT(e,t,n,r,i,s,a,o,c){let l=(t-o)/2,u=(n-c)/2;if(r===0||i===0||l===0&&u===0){e.push(o,c);return}let h=Math.max(1,Math.sqrt(l*l/(r*r)+u*u/(i*i)));r*=h,i*=h;let d=(s===a?-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))),m=d*r*u/i+(t+o)/2,p=-d*i*l/r+(n+c)/2,y=Math.atan2((n-p)/i,(t-m)/r),E=Math.atan2((c-p)/i,(o-m)/r)-y;a&&E\u003C0?E+=2*Math.PI:!a&&E>0&&(E-=2*Math.PI);for(let b=1;b\u003C=8;b++)e.push(m+r*Math.cos(y+E*b/8),p+i*Math.sin(y+E*b/8))}function rT(e,t,n,r,i,s,a,o){let c=0,l=1;for(let u=0;u\u003C4;u++){let h=u===0?-n:u===1?n:u===2?-r:r,d=u===0?e-i:u===1?a-e:u===2?t-s:o-t;h===0?d\u003C0&&(l=-1):h\u003C0?c=Math.max(c,d/h):l=Math.min(l,d/h)}return c\u003Cl}function sT(e,t,n,r,i){for(let s=0;s+2\u003Ce.length;s+=2){let a=e[s],o=e[s+1],c=e[s+2],l=e[s+3];if(!(a\u003Ct&&c\u003Ct||a>r&&c>r||o\u003Cn&&l\u003Cn||o>i&&l>i)&&rT(a,o,c-a,l-o,t,n,r,i))return!0}return!1}function Bo(e,t,n,r){if(n.length===0)return;let i=r?Sg(r):JR(e),s=1/0,a=1/0,o=-1/0,c=-1/0;for(let h=0;h\u003Ci.length+t.length;h+=2){let d=h\u003Ci.length?i[h]:t[h-i.length],m=h\u003Ci.length?i[h+1]:t[h+1-i.length];d\u003Cs&&(s=d),d>o&&(o=d),m\u003Ca&&(a=m),m>c&&(c=m)}let l,u=1/0;for(let h of n){let[d,m,p,y]=h.box;if(o\u003Cd+.5||s>p-.5||c\u003Cm+.5||a>y-.5)continue;let E=sT(i,d+.5,m+.5,p-.5,y-.5);for(let S=0;S\u003Ct.length&&!E;S+=2)E=t[S]>d+.5&&t[S]\u003Cp-.5&&t[S+1]>m+.5&&t[S+1]\u003Cy-.5;if(!E)continue;if(s\u003Cd||o>p||a\u003Cm||c>y)return\\\"\\\";let b=(p-d)*(y-m);b\u003Cu&&(u=b,l=h)}return l}function Wo(e,t=\\\"\\\"){return(/[\\\";]stroke:/.test(t)?void 0:dr(e.shape))??\\\"\\\"}function Uo(e,t){let n=/[\\\";]fill:([^;\\\"]*)/.exec(t.shape)?.[1].trim();return n?e.replace(/ fill=\\\"var\\\\(--_bg\\\\)\\\"/g,` fill=\\\"${n}\\\"`):e}function Mr(e,t,n,r=\\\"\\\",i){let s=Bo(e,t,n,i);return s&&Wo(s,r)}var Wu=4;function Go(e,t,n=\\\"\\\",r=!1){let i=u=>n.includes(u)?new RegExp(`[\\\";]${u}:([^;\\\"]+);`).exec(n)?.[1].trim():void 0,s=i(\\\"stroke\\\");if(s===\\\"none\\\"||s===\\\"transparent\\\")return\\\"\\\";let a=r?\\\"2.5\\\":i(\\\"stroke-width\\\"),o=\\\"\\\",c=\\\"\\\";a!==void 0&&/^[\\\\d.]+(?:px)?$/.test(a)?parseFloat(a)!==1&&(o=` stroke-width=\\\"${f(parseFloat(a)+Wu)}\\\"`):a!==void 0&&(c+=`stroke-width:calc(${a} + ${Wu}px);`);for(let u of[\\\"opacity\\\",\\\"stroke-opacity\\\"]){let h=i(u);h!==void 0&&(c+=`${u}:${h};`)}let l=`\u003Cpath d=\\\"${e}\\\"/>`+t.replace(/ class=\\\"pele-marker\\\"/g,\\\"\\\");return o||c?`\u003Cg${o}${c?` style=\\\"${c}\\\"`:\\\"\\\"}>${l}\u003C/g>`:l}function Cr(e,t,n,r=\\\"\\\",i=!1){return Go(e.d,_t(t,e.sx,e.sy,e.sdx,e.sdy,\\\"var(--_bg)\\\",\\\"var(--_bg)\\\")+_t(n,e.ex,e.ey,e.edx,e.edy,\\\"var(--_bg)\\\",\\\"var(--_bg)\\\"),r,i)}function Dn(e){return e?`\u003Cg class=\\\"pele-casings\\\" fill=\\\"none\\\" stroke=\\\"var(--_bg)\\\" stroke-width=\\\"${1+Wu}\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" pointer-events=\\\"none\\\">${e}\u003C/g>`:\\\"\\\"}function dn(e,t,n,r,i,s){let a=t.width+8,o=t.height;return`\u003Cg class=\\\"pele-edge-label\\\" data-id=\\\"${Ue(e)}\\\">\u003Crect x=\\\"${f(n-a/2)}\\\" y=\\\"${f(r-o/2)}\\\" width=\\\"${f(a)}\\\" height=\\\"${f(o)}\\\" rx=\\\"3\\\" fill=\\\"var(--_bg)\\\"/>`+Ne(t,n,r,i,s)+\\\"\u003C/g>\\\"}function Rc(e,t,n,r,i,s,a,o){let c=(i?t:n)/2,l=Math.min(c-4,8+r*6),u=s+r*8,h=Math.hypot(u,l)||1,d=(y,E)=>i?`${f(e.x+E)},${f(e.y+n/2+y)}`:`${f(e.x+t/2+y)},${f(e.y+E)}`,m=u/h*a,p=l/h*a;return i?(o.labelX=e.x,o.labelY=e.y+n/2+u+4+o.labelH/2):(o.labelX=e.x+t/2+u+4+o.labelW/2,o.labelY=e.y),{d:`M${d(0,-l)}C${d(u,-l*2)} ${d(u,l*2)} ${d(m,l+p)}`,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/h:-u/h,edy:i?-u/h:-l/h}}var Tg=\\\"--_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)\\\",fr=\\\"var(--_fm)\\\",Mg=\\\"var(--pele-radius,4px)\\\",ht=' style=\\\"rx:var(--_r)\\\"',iT=/[\\\";]fill:/,vn=e=>iT.test(e);function At(e){let t=e.indexOf(' style=\\\"');return t\u003C0?e+ht:`${e.slice(0,t+8)}rx:var(--_r);${e.slice(t+8)}`}var Yo=\\\"var(--pele-critical,#e45756)\\\",wg=String.raw`(?:\\\"[^\\\"'\\\\\\\\\\\\n\u003C>{}();:@]*\\\"|'[^\\\"'\\\\\\\\\\\\n\u003C>{}();:@]*'|[\\\\p{L}\\\\p{N}_-][\\\\p{L}\\\\p{N}_ .-]*)`,oT=new RegExp(String.raw`^\\\\s*${wg}(?:\\\\s*,\\\\s*${wg})*\\\\s*$`,\\\"u\\\");function _g(e,t){return e&&oT.test(e)?e:t}function Cg(e,t,n){return`;--_fm:var(--pele-font-mono,${_g(n,\\\"monospace\\\")});font:${e}px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,${_g(t,\\\"sans-serif\\\")})`}var aT=new Set([\\\"fill\\\",\\\"fill-opacity\\\",\\\"stroke\\\",\\\"stroke-width\\\",\\\"stroke-dasharray\\\",\\\"stroke-dashoffset\\\",\\\"stroke-linecap\\\",\\\"stroke-linejoin\\\",\\\"stroke-opacity\\\",\\\"opacity\\\",\\\"rx\\\",\\\"ry\\\"]),cT=new Set([\\\"color\\\",\\\"font-size\\\",\\\"font-family\\\",\\\"font-weight\\\",\\\"font-style\\\",\\\"text-decoration\\\",\\\"letter-spacing\\\",\\\"word-spacing\\\",\\\"opacity\\\"]),lT=/url\\\\s*\\\\(|expression\\\\s*\\\\(|javascript:|[\u003C>{};\\\\\\\\]|@import|image-set|\\\\/\\\\*/i,Rg={shape:\\\"\\\",line:\\\"\\\",text:\\\"\\\",stroke:void 0,bold:!1,italic:!1,fontSize:void 0};function Ct(e){if(e.length===0)return Rg;let t=new Map,n=new Map;for(let l of e){let u=l.indexOf(\\\":\\\");if(u\u003C=0)continue;let h=l.slice(0,u).trim().toLowerCase(),d=l.slice(u+1).replace(/!important/gi,\\\"\\\").trim();d===\\\"\\\"||lT.test(d)||rc.test(d)||(aT.has(h)&&t.set(h,d),cT.has(h)&&n.set(h===\\\"color\\\"?\\\"fill\\\":h,d))}if(t.size===0&&n.size===0)return Rg;let r=\\\"\\\",i=\\\"\\\";for(let[l,u]of t)r+=`${l}:${u};`,l!==\\\"fill\\\"&&l!==\\\"fill-opacity\\\"&&(i+=`${l}:${u};`);let s=\\\"\\\";for(let[l,u]of n)s+=`${l}:${u};`;let a=n.get(\\\"font-weight\\\"),o=n.get(\\\"font-size\\\"),c=o&&/^[\\\\d.]+(px)?$/.test(o)?parseFloat(o):void 0;return{shape:r?` style=\\\"${rt(r)}\\\"`:\\\"\\\",line:i?` style=\\\"${rt(i)}\\\"`:\\\"\\\",text:s?` style=\\\"${rt(s)}\\\"`:\\\"\\\",stroke:t.get(\\\"stroke\\\"),bold:a===\\\"bold\\\"||a===\\\"bolder\\\"||Number(a)>=600,italic:n.get(\\\"font-style\\\")===\\\"italic\\\",fontSize:c!==void 0&&c>0&&c\u003C=200?c:void 0}}var dT=/[^\\\\w-]+/g;function It(e){let t=e.replace(dT,\\\" \\\").trim();return t===\\\"\\\"?\\\"\\\":\\\" \\\"+t}var uT=[\\\"#4c78a8\\\",\\\"#f58518\\\",\\\"#54a24b\\\",\\\"#e45756\\\",\\\"#72b7b2\\\",\\\"#eeca3b\\\",\\\"#b279a2\\\",\\\"#9d755d\\\"];function Et(e){let t=(e%8+8)%8;return`var(--pele-series-${t+1},${uT[t]})`}var fT=[[\\\"tw\\\",\\\"title\\\"],[\\\"hw\\\",\\\"heading\\\"],[\\\"w\\\",\\\"bold\\\"]],hT=/var\\\\(--_(r|tw|hw|w)\\\\)/g;function at(e,t,n,r,i,s,a){let o=rt(i.idPrefix??\\\"pele\\\"),c=\\\"\\\",l=\\\"\\\";s.accTitle&&(c+=`\u003Ctitle id=\\\"${o}-title\\\">${Ue(s.accTitle)}\u003C/title>`,l+=` aria-labelledby=\\\"${o}-title\\\"`),s.accDescr&&(c+=`\u003Cdesc id=\\\"${o}-desc\\\">${Ue(s.accDescr)}\u003C/desc>`,l+=` aria-describedby=\\\"${o}-desc\\\"`);let u=i.responsive===!1?\\\"\\\":\\\"max-width:100%;height:auto;\\\",h=new Set;for(let[,m]of a.matchAll(hT))if(h.add(m),h.size===4)break;let d=h.has(\\\"r\\\")?`;--_r:${Mg}`:\\\"\\\";for(let[m,p]of fT)h.has(m)&&(d+=`;--_${m}:var(--pele-${p}-weight,bold)`);return`\u003Csvg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"pele pele-${e}\\\" viewBox=\\\"0 0 ${t} ${n}\\\" width=\\\"${t}\\\" height=\\\"${n}\\\" style=\\\"${u}${Tg}${d}${rt(Cg(r,i.fontFamily,i.fontFamilyMono))}${Om()}\\\" fill=\\\"var(--_fg)\\\" role=\\\"graphics-document document\\\" aria-roledescription=\\\"${e}\\\"${l}>`+c+a+\\\"\u003C/svg>\\\"}var Tt=18,Mt=12,Wi=12,Gn=(e,t,n)=>(n?t:e)-2*Wi,Ho=e=>(t,n,r)=>r?0:t-2*e(n)-2*Wi;function Nc(e,t,n){let r=Math.min(1,Math.abs(e)/t);return n*(1-Math.sqrt(1-r*r))}var Ks=(e,t,n,r)=>n&1?Nc(r,t/2,e/2):Nc(r,e/2,t/2),zs=(e,t,n)=>(n?t:e)*.6,Ng=(e,t,n,r)=>n&1?0:Nc(r,e/2,Math.min(12,Math.max(6,e/14))),Vs=(e,t)=>()=>({w:e,h:t,dy:0});function Ig(e,t,n){let r=Math.max(1.6*e+40,80),i=(t+10)/(1-(e+8)/r),s=i/2-10-t/2;return{w:r,h:i,dy:n?-s:s}}function Bi(e,t){return`\u003Cpath d=\\\"${e}\\\"${t}/>`}var Tc=(e,t,n)=>n&1?t/8:0,Ko=(e,t)=>({w:Math.max(e+2*Tt,2*Tt+12),h:t+2*Mt,dy:0});function Nn(e,t){let n=\\\"\\\";for(let r=0;r\u003Ce.length;r+=2)n+=(r?\\\" \\\":\\\"\\\")+f(e[r])+\\\",\\\"+f(e[r+1]);return`\u003Cpolygon points=\\\"${n}\\\"${t}/>`}function xn(e,t,n,r=\\\"\\\"){return`\u003Crect x=\\\"${f(-e/2)}\\\" y=\\\"${f(-t/2)}\\\" width=\\\"${f(e)}\\\" height=\\\"${f(t)}\\\"${r}${n}/>`}var kg={rect:{size:Ko,span:Gn,draw:(e,t,n)=>xn(e,t,At(n))},rounded:{size:Ko,span:Gn,draw:(e,t,n)=>xn(e,t,n,` rx=\\\"${f(Math.min(12,t/2))}\\\"`)},stadium:{inset:(e,t,n,r)=>n&1?Nc(r,t/2,t/2):0,span:(e,t,n)=>n?t*.6:e-t,size:(e,t)=>{let n=t+2*Mt;return{w:e+n*.5+2*Tt-8,h:n,dy:0}},draw:(e,t,n)=>xn(e,t,n,` rx=\\\"${f(t/2)}\\\"`)},\\\"fr-rect\\\":{span:Gn,size:(e,t)=>({w:e+2*Tt+16,h:t+2*Mt,dy:0}),draw:(e,t,n,r)=>{let i=e/2-8;return xn(e,t,At(n))+`\u003Cpath d=\\\"M${f(-i)},${f(-t/2)}V${f(t/2)}M${f(i)},${f(-t/2)}V${f(t/2)}\\\" fill=\\\"none\\\"${r}/>`}},cyl:{inset:Ng,span:(e,t,n)=>n?t-2*Wi-12:e*.6,size:(e,t)=>{let n=Math.max(e+2*Tt,56),r=Math.min(12,Math.max(6,n/14));return{w:n,h:t+2*Mt+2*r,dy:r/2}},draw:(e,t,n,r)=>{let i=e/2,s=Math.min(12,Math.max(6,e/14)),a=-t/2+s,o=t/2-s;return`\u003Cpath d=\\\"M${f(-i)},${f(a)}A${f(i)},${f(s)} 0 0 1 ${f(i)},${f(a)}V${f(o)}A${f(i)},${f(s)} 0 0 1 ${f(-i)},${f(o)}Z\\\"${n}/>\u003Cpath d=\\\"M${f(-i)},${f(a)}A${f(i)},${f(s)} 0 0 0 ${f(i)},${f(a)}\\\" fill=\\\"none\\\"${r}/>`}},circle:{inset:Ks,span:zs,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)=>`\u003Ccircle r=\\\"${f(e/2)}\\\"${n}/>`},\\\"dbl-circ\\\":{inset:Ks,span:zs,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)=>`\u003Ccircle r=\\\"${f(e/2)}\\\"${n}/>\u003Ccircle r=\\\"${f(e/2-5)}\\\" fill=\\\"none\\\"${r}/>`},ellipse:{inset:Ks,span:zs,size:(e,t)=>({w:e*1.3+2*Tt,h:t*1.2+2*Mt,dy:0}),draw:(e,t,n)=>`\u003Cellipse rx=\\\"${f(e/2)}\\\" ry=\\\"${f(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)=>Nn([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-Wi,size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return Nn([-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:Ho(()=>0),size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+n/4,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return Nn([-e/2,-t/2,e/2,-t/2,e/2,t/2,-e/2,t/2,-e/2+r,0],n)}},\\\"lean-r\\\":{inset:Tc,span:Ho(e=>e/4),size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return Nn([-e/2+r,-t/2,e/2,-t/2,e/2-r,t/2,-e/2,t/2],n)}},\\\"lean-l\\\":{inset:Tc,span:Ho(e=>e/4),size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return Nn([-e/2,-t/2,e/2-r,-t/2,e/2,t/2,-e/2+r,t/2],n)}},\\\"trap-b\\\":{inset:Tc,span:Ho(e=>e/4),size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return Nn([-e/2+r,-t/2,e/2-r,-t/2,e/2,t/2,-e/2,t/2],n)}},\\\"trap-t\\\":{inset:Tc,span:Ho(e=>e/4),size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return Nn([-e/2,-t/2,e/2,-t/2,e/2-r,t/2,-e/2+r,t/2],n)}},text:{bare:!0,span:Gn,size:(e,t)=>({w:e+8,h:t+8,dy:0}),draw:(e,t)=>xn(e,t,' fill=\\\"none\\\" stroke=\\\"none\\\"')},\\\"sm-circ\\\":{noLabel:!0,inset:Ks,span:zs,size:Vs(14,14),draw:(e,t,n)=>`\u003Ccircle r=\\\"${f(e/2)}\\\"${n}/>`},\\\"f-circ\\\":{noLabel:!0,inset:Ks,span:zs,size:Vs(14,14),draw:(e,t,n,r)=>`\u003Ccircle r=\\\"${f(e/2)}\\\" fill=\\\"var(--_l)\\\"${r}/>`},\\\"fr-circ\\\":{noLabel:!0,inset:Ks,span:zs,size:Vs(18,18),draw:(e,t,n,r)=>`\u003Ccircle r=\\\"${f(e/2)}\\\"${n}/>\u003Ccircle r=\\\"${f(e/2-4)}\\\" fill=\\\"var(--_l)\\\"${r}/>`},fork:{noLabel:!0,span:(e,t,n)=>(n?t:e)-8,size:Vs(72,8),draw:(e,t,n,r)=>xn(e,t,` fill=\\\"var(--_l)\\\"${r}`,' rx=\\\"2\\\"')},\\\"notch-rect\\\":{size:Ko,span:Gn,draw:(e,t,n)=>Nn([-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:Gn,size:(e,t)=>({w:e+2*Tt+8,h:t+2*Mt,dy:0}),draw:(e,t,n,r)=>xn(e,t,At(n))+`\u003Cpath d=\\\"M${f(-e/2+8)},${f(-t/2)}V${f(t/2)}\\\" fill=\\\"none\\\"${r}/>`},\\\"div-rect\\\":{span:Gn,size:(e,t)=>({w:e+2*Tt,h:t+2*Mt+8,dy:4}),draw:(e,t,n,r)=>xn(e,t,At(n))+`\u003Cpath d=\\\"M${f(-e/2)},${f(-t/2+8)}H${f(e/2)}\\\" fill=\\\"none\\\"${r}/>`},\\\"win-pane\\\":{span:Gn,size:(e,t)=>({w:e+2*Tt+8,h:t+2*Mt+8,dy:4}),draw:(e,t,n,r)=>xn(e,t,At(n))+`\u003Cpath d=\\\"M${f(-e/2+8)},${f(-t/2)}V${f(t/2)}M${f(-e/2)},${f(-t/2+8)}H${f(e/2)}\\\" fill=\\\"none\\\"${r}/>`},tri:{inset:(e,t,n)=>n&1?e/4:0,size:(e,t)=>Ig(e,t,!1),draw:(e,t,n)=>Nn([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)=>Ig(e,t,!0),draw:(e,t,n)=>Nn([-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*Tt,h:t+2*Mt+10,dy:5}),draw:(e,t,n)=>Nn([-e/2,-t/2+10,e/2,-t/2,e/2,t/2,-e/2,t/2],n)},\\\"notch-pent\\\":{span:Gn,size:(e,t)=>({w:e+2*Tt,h:t+2*Mt,dy:0}),draw:(e,t,n)=>Nn([-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:Vs(32,40),draw:(e,t,n)=>Nn([-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*Mt;return{w:e+2*Tt+n/4,h:n,dy:0}},draw:(e,t,n)=>{let r=t/2;return`\u003Cpath d=\\\"M${f(-e/2)},${f(-r)}H${f(e/2-r)}A${f(r)},${f(r)} 0 0 1 ${f(e/2-r)},${f(r)}H${f(-e/2)}Z\\\"${n}/>`}},\\\"h-cyl\\\":{size:(e,t)=>{let n=t+2*Mt,r=Math.min(12,n/4);return{w:e+2*Tt+2*r,h:n,dy:0}},draw:(e,t,n,r)=>{let i=t/2,s=Math.min(12,t/4),a=-e/2+s,o=e/2-s;return`\u003Cpath d=\\\"M${f(a)},${f(-i)}H${f(o)}A${f(s)},${f(i)} 0 0 1 ${f(o)},${f(i)}H${f(a)}A${f(s)},${f(i)} 0 0 1 ${f(a)},${f(-i)}Z\\\"${n}/>\u003Cpath d=\\\"M${f(o)},${f(-i)}A${f(s)},${f(i)} 0 0 0 ${f(o)},${f(i)}\\\" fill=\\\"none\\\"${r}/>`}},\\\"cross-circ\\\":{noLabel:!0,inset:Ks,span:zs,size:Vs(44,44),draw:(e,t,n,r)=>{let i=e/2,s=i*Math.SQRT1_2;return`\u003Ccircle r=\\\"${f(i)}\\\"${n}/>\u003Cpath d=\\\"M${f(-s)},${f(-s)}L${f(s)},${f(s)}M${f(s)},${f(-s)}L${f(-s)},${f(s)}\\\" fill=\\\"none\\\"${r}/>`}},\\\"st-rect\\\":{span:(e,t,n)=>(n?t:e)-2*Wi-8,size:(e,t)=>({w:e+2*Tt+8,h:t+2*Mt+8,dy:4}),draw:(e,t,n)=>{let r=e-8,i=t-8,s=\\\"\\\";for(let a=0;a\u003C3;a++){let o=-e/2+(2-a)*4,c=-t/2+a*4;s+=`\u003Crect x=\\\"${f(o)}\\\" y=\\\"${f(c)}\\\" width=\\\"${f(r)}\\\" height=\\\"${f(i)}\\\"${At(n)}/>`}return s}},doc:{inset:(e,t,n)=>n===2?10:0,size:(e,t)=>({w:e+2*Tt,h:t+2*Mt+10,dy:-5}),draw:(e,t,n)=>Cc(e,t,n)},flag:{inset:(e,t,n)=>n&1?0:8,size:(e,t)=>({w:e+2*Tt,h:t+2*Mt+16,dy:0}),draw:(e,t,n)=>{let r=e/2,i=t/2-8,s=e/4;return`\u003Cpath d=\\\"M${f(-r)},${f(-i)}q${f(s)},-10 ${f(2*s)},0t${f(2*s)},0V${f(i)}q${f(-s)},10 ${f(-2*s)},0t${f(-2*s)},0Z\\\"${n}/>`}},datastore:{size:Ko,span:Gn,draw:(e,t,n,r)=>xn(e,t,n.replace('stroke=\\\"var(--_b)\\\"','stroke=\\\"none\\\"'))+`\u003Cpath d=\\\"M${f(-e/2)},${f(-t/2)}H${f(e/2)}M${f(-e/2)},${f(t/2)}H${f(e/2)}\\\" fill=\\\"none\\\"${r}/>`},folder:{size:(e,t)=>({w:Math.max(e+2*Tt,64),h:t+2*Mt+8,dy:4}),draw:(e,t,n)=>{let r=e/2,i=t/2,s=Math.min(e*.4,48);return Bi(`M${f(-r)},${f(-i)}H${f(-r+s)}L${f(-r+s+8)},${f(-i+8)}H${f(r)}V${f(i)}H${f(-r)}Z`,n)}},bucket:{size:(e,t)=>({w:e+2*Tt+20,h:t+2*Mt+10,dy:3}),inset:(e,t,n)=>n&1?t/12:0,draw:(e,t,n,r)=>{let i=e/2,s=t/2,a=5,o=t/6;return Bi(`M${f(-i)},${f(-s+a)}A${f(i)},${f(a)} 0 0 1 ${f(i)},${f(-s+a)}L${f(i-o)},${f(s-a)}A${f(i-o)},${f(a)} 0 0 1 ${f(-i+o)},${f(s-a)}Z`,n)+`\u003Cpath d=\\\"M${f(-i)},${f(-s+a)}A${f(i)},${f(a)} 0 0 0 ${f(i)},${f(-s+a)}\\\" fill=\\\"none\\\"${r}/>`}},console:{span:Gn,size:(e,t)=>({w:Math.max(e+2*Tt,72),h:t+2*Mt+12,dy:6}),draw:(e,t,n,r)=>xn(e,t,At(n))+`\u003Cpath d=\\\"M${f(-e/2)},${f(-t/2+12)}H${f(e/2)}M${f(-e/2+7)},${f(-t/2+4)}l3,2.5l-3,2.5M${f(-e/2+13)},${f(-t/2+9)}h4\\\" fill=\\\"none\\\"${r}/>`},browser:{span:Gn,size:(e,t)=>({w:Math.max(e+2*Tt,72),h:t+2*Mt+12,dy:6}),draw:(e,t,n,r)=>{let i=\\\"\\\";for(let s=0;s\u003C3;s++)i+=`\u003Ccircle cx=\\\"${f(-e/2+8+s*7)}\\\" cy=\\\"${f(-t/2+6)}\\\" r=\\\"1.5\\\" fill=\\\"none\\\"${r}/>`;return xn(e,t,At(n))+`\u003Cpath d=\\\"M${f(-e/2)},${f(-t/2+12)}H${f(e/2)}\\\" fill=\\\"none\\\"${r}/>`+i}},person:{size:(e,t)=>({w:Math.max(e+2*Tt,56),h:t+2*Mt+26,dy:13}),draw:(e,t,n)=>{let r=-t/2;return`\u003Crect x=\\\"${f(-e/2)}\\\" y=\\\"${f(r+26)}\\\" width=\\\"${f(e)}\\\" height=\\\"${f(t-26)}\\\" rx=\\\"12\\\"${n}/>\u003Ccircle cy=\\\"${f(r+14)}\\\" r=\\\"13\\\"${n}/>`}},bang:{size:(e,t)=>({w:e+2*Tt+28,h:t+2*Mt+24,dy:0}),inset:()=>3,draw:(e,t,n)=>{let i=[];for(let s=0;s\u003C28;s++){let a=Math.PI*s/14-Math.PI/2,o=s%2===0?1:.82;i.push(Math.cos(a)*(e/2)*o,Math.sin(a)*(t/2)*o)}return Nn(i,n)}},cloud:{size:(e,t)=>({w:e+2*Tt+32,h:t+2*Mt+24,dy:0}),inset:(e,t,n)=>n&1?2:1,draw:(e,t,n)=>{let r=e/2,i=t/2,s=i*.55;return Bi(`M${f(-r+s)},${f(i)}A${f(s)},${f(s)} 0 0 1 ${f(-r+s*.6)},${f(-i*.1)}A${f(r*.42)},${f(i*.7)} 0 0 1 ${f(-r*.1)},${f(-i*.72)}A${f(r*.4)},${f(i*.62)} 0 0 1 ${f(r*.62)},${f(-i*.42)}A${f(s*1.05)},${f(s*1.05)} 0 0 1 ${f(r-s)},${f(i)}Z`,n)}},brace:{bare:!0,size:(e,t)=>({w:e+2*Tt+12,h:t+2*Mt,dy:0}),draw:(e,t,n,r)=>xn(e,t,' fill=\\\"none\\\" stroke=\\\"none\\\"')+Mc(-e/2+12,t,-1,r)},\\\"brace-r\\\":{bare:!0,size:(e,t)=>({w:e+2*Tt+12,h:t+2*Mt,dy:0}),draw:(e,t,n,r)=>xn(e,t,' fill=\\\"none\\\" stroke=\\\"none\\\"')+Mc(e/2-12,t,1,r)},braces:{bare:!0,size:(e,t)=>({w:e+2*Tt+24,h:t+2*Mt,dy:0}),draw:(e,t,n,r)=>xn(e,t,' fill=\\\"none\\\" stroke=\\\"none\\\"')+Mc(-e/2+12,t,-1,r)+Mc(e/2-12,t,1,r)},bolt:{noLabel:!0,size:Vs(36,56),inset:(e,t,n)=>n&1?e/4:0,draw:(e,t,n)=>Nn([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:Ng,span:(e,t,n)=>n?t-2*Wi-20:e*.6,size:(e,t)=>{let n=Math.max(e+2*Tt,56),r=Math.min(12,Math.max(6,n/14));return{w:n,h:t+2*Mt+2*r+8,dy:r/2+4}},draw:(e,t,n,r)=>{let i=e/2,s=Math.min(12,Math.max(6,e/14)),a=-t/2+s,o=t/2-s,c=l=>`M${f(-i)},${f(l)}A${f(i)},${f(s)} 0 0 0 ${f(i)},${f(l)}`;return Bi(`M${f(-i)},${f(a)}A${f(i)},${f(s)} 0 0 1 ${f(i)},${f(a)}V${f(o)}A${f(i)},${f(s)} 0 0 1 ${f(-i)},${f(o)}Z`,n)+`\u003Cpath d=\\\"${c(a)}${c(a+8)}\\\" fill=\\\"none\\\"${r}/>`}},\\\"curv-trap\\\":{size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+n*.6,h:n,dy:0}},draw:(e,t,n)=>{let r=e/2,i=t/2,s=t*.3;return Bi(`M${f(-r+s)},${f(-i)}H${f(r-s)}A${f(s)},${f(i)} 0 0 1 ${f(r-s)},${f(i)}H${f(-r+s)}L${f(-r)},0Z`,n)}},docs:{size:(e,t)=>({w:e+2*Tt+8,h:t+2*Mt+18,dy:-1}),inset:(e,t,n)=>n===2?10:0,draw:(e,t,n)=>{let r=\\\"\\\";for(let i=0;i\u003C3;i++)r+=`\u003Cg transform=\\\"translate(${(1-i)*4},${(i-1)*4})\\\">${Cc(e-8,t-8,n)}\u003C/g>`;return r}},\\\"bow-rect\\\":{size:(e,t)=>{let n=t+2*Mt;return{w:e+2*Tt+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,s=t*.2;return Bi(`M${f(-r+s)},${f(-i)}H${f(r)}A${f(s)},${f(i)} 0 0 0 ${f(r)},${f(i)}H${f(-r+s)}A${f(s)},${f(i)} 0 0 1 ${f(-r+s)},${f(-i)}Z`,n)}},\\\"tag-rect\\\":{size:Ko,span:Gn,draw:(e,t,n,r)=>xn(e,t,At(n))+`\u003Cpath d=\\\"M${f(e/2-12)},${f(t/2)}L${f(e/2)},${f(t/2-12)}\\\" fill=\\\"none\\\"${r}/>`},\\\"tag-doc\\\":{size:(e,t)=>({w:e+2*Tt,h:t+2*Mt+10,dy:-5}),inset:(e,t,n)=>n===2?10:0,draw:(e,t,n,r)=>Cc(e,t,n)+`\u003Cpath d=\\\"M${f(e/2-12)},${f(t/2-14)}L${f(e/2)},${f(t/2-26)}\\\" fill=\\\"none\\\"${r}/>`},\\\"lin-doc\\\":{size:(e,t)=>({w:e+2*Tt+8,h:t+2*Mt+10,dy:-5}),inset:(e,t,n)=>n===2?10:0,draw:(e,t,n,r)=>Cc(e,t,n)+`\u003Cpath d=\\\"M${f(-e/2+8)},${f(-t/2)}V${f(t/2-6)}\\\" fill=\\\"none\\\"${r}/>`},collapsedGroup:{size:(e,t)=>({w:e+2*Tt+8,h:t+2*Mt+8,dy:-2}),draw:(e,t,n)=>`\u003Crect x=\\\"${f(-e/2+6)}\\\" y=\\\"${f(-t/2+8)}\\\" width=\\\"${f(e-12)}\\\" height=\\\"${f(t-8)}\\\"${At(n)}/>\u003Crect x=\\\"${f(-e/2)}\\\" y=\\\"${f(-t/2)}\\\" width=\\\"${f(e)}\\\" height=\\\"${f(t-4)}\\\"${At(n)}/>`}};function Mc(e,t,n,r){let i=t/2,s=6*n;return`\u003Cpath d=\\\"M${f(e)},${f(-i)}q${f(s)},0 ${f(s)},6V-6q0,6 ${f(s)},6q${f(-s)},0 ${f(-s)},6V${f(i-6)}q0,6 ${f(-s)},6\\\" fill=\\\"none\\\"${r}/>`}function Cc(e,t,n){let r=e/2,i=-t/2,s=t/2-10,a=e/4;return`\u003Cpath d=\\\"M${f(-r)},${f(i)}H${f(r)}V${f(s)}q${f(-a)},-12 ${f(-2*a)},0t${f(-2*a)},0Z\\\"${n}/>`}var Uu=kg.rect,Ui=new Map(Object.entries(kg));function ps(e,t,n){return(Ui.get(e)??Uu).size(t,n)}function hr(e,t,n,r,i){return(Ui.get(e)??Uu).draw(t,n,r,i)}function Qr(e,t,n,r,i=0){return Ui.get(e)?.inset?.(t,n,r,i)??0}function $g(e,t,n,r){return Math.max(0,Ui.get(e)?.span?.(t,n,r)??0)}function Lg(e){return Ui.get(e)?.noLabel!==!0}function Gi(e){return(Ui.get(e)??Uu).bare!==!0}function Jn(e,t,n){let r=e[t]-n.x,i=e[t+1]-n.y;return Math.abs(Math.abs(i)-n.h/2)\u003C.5?i\u003C0?0:2:Math.abs(Math.abs(r)-n.w/2)\u003C.5?r\u003C0?3:1:-1}function js(e,t,n,r){if(r.isGroup)return;let i=Jn(e,t,r);if(i===0||i===2){let s=Qr(n.shape,n.w,n.h,i,e[t]-r.x)+(r.h-n.h)/2;e[t+1]+=i===0?s:-s}else if(i>=0){let s=Qr(n.shape,n.w,n.h,i,e[t+1]-r.y)+(r.w-n.w)/2;e[t]+=i===3?s:-s}}var pT=1.5,Fg=1.3,mT=/\u003Cbr\\\\s*\\\\/?>|\\\\\\\\n|\\\\n/gi,Og=/\u003C\\\\/?([a-zA-Z][\\\\w-]*)(?:\\\\s[^\u003C>]*)?\\\\/?>/y,Dg=/(fa[bklrs]?):fa-([\\\\w-]+)/g,gT=/[\u003C\\\\\\\\\\\\n*_]|fa[bklrs]?:fa-/,bT=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]]),yT=24,ET=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(\\\" \\\")),Hu=\\\"\\\\\\\\u2e80-\\\\\\\\u9fff\\\\\\\\uf900-\\\\\\\\ufaff\\\\\\\\uff00-\\\\\\\\uff60\\\",vg=\\\"、。,.:;!?)]}」』】〕〉》〙〗ー…‥・ゝゞぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮ,.:;!?)\\\\\\\\]}\\\",xT=\\\"([{「『【〔〈《〘〖([{\\\",AT=new RegExp(`[${Hu}]`),Ic=\\\"\\\\\\\\u200b\\\\\\\\u00ad\\\",ST=new RegExp(`[${Ic}]`),wT=new RegExp(`\\\\\\\\s*(?:[${xT}]*[${Hu}][${vg}]*|[^\\\\\\\\s${Hu}${Ic}]+[${Ic}]*[${vg}]*|[${Ic}]+)\\\\\\\\s*|\\\\\\\\s+`,\\\"g\\\"),Bg=57344,_T=6400,RT=/\\\\$\\\\$(.+?)\\\\$\\\\$/g,Wg=/[\\\\ue000-\\\\uf8ff]/,TT=/([\\\\ue000-\\\\uf8ff])/,zo,MT={lines:[],widths:[],width:0,height:0,size:0,lineHeight:0};function CT(e){let t=e.split(`\\r\\n`),n=1/0;for(let r of t){if(r.trim()===\\\"\\\")continue;let i=r.length-r.trimStart().length;i\u003Cn&&(n=i)}return n===1/0||n===0?e:t.map(r=>r.slice(Math.min(n,r.length-r.trimStart().length))).join(`\\r\\n`)}function kc(e){return e!==void 0&&e.icon===void 0&&e.math===void 0}function Gu(e,t,n){if(t!==\\\"\\\"){if(zo!==void 0&&Wg.test(t)){let r=zo,i=t.split(TT);for(let s=0;s\u003Ci.length;s++){if(s%2===0){i[s]!==\\\"\\\"&&Yu(e,i[s],n);continue}let a=i[s].charCodeAt(0)-Bg,o=r.math[a];o?e.push({text:\\\"\\\",style:n,math:o,width:o.width}):Yu(e,`$$${r.tex[a]}$$`,n)}return}Yu(e,t,n)}}function Yu(e,t,n){let r=bt(t),i=e[e.length-1];kc(i)&&i.style===n?i.text+=r:e.push({text:r,style:n,width:0})}function NT(e,t,n){if(!t.includes(\\\":fa-\\\")){Gu(e,t,n);return}let r=0;Dg.lastIndex=0;let i;for(;(i=Dg.exec(t))!==null;){let s=`${i[1]}:fa-${i[2]}`;if(Gu(e,t.slice(r,i.index),n),r=i.index+i[0].length,Ti(s)!==\\\"\\\")e.push({text:\\\"\\\",style:n,icon:s,width:0});else if(t[r]===\\\" \\\")r++;else if(r===t.length){let a=e[e.length-1];kc(a)&&(a.text=a.text.trimEnd())}}Gu(e,t.slice(r),n)}function IT(e,t,n,r,i){let s=i.style,a=0,o=\\\"\\\",c=0,l=t.length,u=()=>{NT(e,o,s|(i.shifts[i.shifts.length-1]??0)),o=\\\"\\\"};for(;c\u003Cl;){let h=t[c];if(h===\\\"\u003C\\\"){Og.lastIndex=c;let d=Og.exec(t);if(d&&d.index===c){let m=d[1].toLowerCase(),p=t[c+1]===\\\"/\\\",y=bT.get(m)??0;if(y&yT){u();let E=i.shifts.lastIndexOf(y);p?E!==-1&&i.shifts.splice(E,1):i.shifts.push(y)}else y&&(u(),i.style=p?i.style&~y|r&y:i.style|y,s=p?s&~y|r&y:s|y);if(y||ET.has(m)){c+=d[0].length;continue}}}else if(n&&(h===\\\"*\\\"||h===\\\"_\\\")){let d=t[c+1]===h,m=d?1:2,p=d?2:1,y=(a&m)===0,E=c>0?t[c-1]:\\\" \\\",b=c+p\u003Cl?t[c+p]:\\\" \\\",S=y&&b.trim()!==\\\"\\\"&&t.indexOf(d?h+h:h,c+p)!==-1,x=!y&&E.trim()!==\\\"\\\",I=h===\\\"_\\\"&&/\\\\w/.test(E)&&/\\\\w/.test(b);if((S||x)&&!I){u(),a=S?a|m:a&~m,s=S?s|m:s&~m|r&m,c+=p;continue}}o+=h,c++}u()}function kT(e,t,n){let r=0;for(let i of e)i.width=i.icon!==void 0?n*1.25:i.math?i.math.width:t.width(i.text,n,i.style),r+=i.width;return r}function Ug(e,t,n,r,i,s){let a=[],o=0,c=(l=!1)=>{let u=a[a.length-1];if(kc(u)){let h=u.text.trimEnd();if(l&&u.text.endsWith(\\\"­\\\")&&(h=h.slice(0,-1)+\\\"-\\\"),h!==u.text){u.text=h;let d=t.width(h,n,u.style);o+=d-u.width,u.width=d}}i.push(a),s.push(o),a=[],o=0};for(let l of e){if(l.icon!==void 0||l.math){let y=l.math?l.math.width:n*1.25;o>0&&o+y>r&&c(),a.push({...l,width:y}),o+=y;continue}let u=l.text.match(wT)??[],h=l.text.includes(\\\"­\\\"),d=h?u.length:0,m=new Float64Array(d),p=new Float64Array(d+1);for(let y=d-1;y>=0;y--){let E=u[y].endsWith(\\\"­\\\"),b=u[y].trimEnd();m[y]=t.width(E?b.slice(0,-1):b,n,l.style),p[y]=E?y===d-1?l===e[e.length-1]?m[y]:1/0:m[y]+p[y+1]:m[y]}for(let y=0;y\u003Cu.length;y++){let E=u[y],b=h?m[y]:t.width(E.trimEnd(),n,l.style),S=!h||!E.endsWith(\\\"­\\\")?o+b\u003C=r:o+t.width(E.slice(0,-1)+\\\"-\\\",n,l.style)\u003C=r||o+p[y]\u003C=r;o>0&&!S&&(c(E.trimStart()===E),E=E.trimStart());let x=a[a.length-1];if(kc(x)&&x.style===l.style){if(x.text+=E,b>0||E.trimEnd()!==E){let I=x.width;x.width=t.width(x.text,n,x.style),o+=x.width-I}}else{let I=t.width(E,n,l.style);a.push({text:E,style:l.style,width:I}),o+=I}}}(a.length>0||i.length===0)&&c()}function Ge(e,t,n,r,i,s=0){if(e===void 0||e===\\\"\\\")return MT;let a=Math.round(r*pT);if(am()&&e.includes(\\\"$$\\\")&&!Wg.test(e)){let o={tex:[],math:[]},c=e.replace(RT,(l,u)=>o.tex.length===_T?l:(o.tex.push(u),String.fromCharCode(Bg+o.tex.length-1)));if(o.tex.length>0){for(let l of o.tex)o.math.push(cm(bt(l),r));return Pg(c,t,n,r,i,s,a,o)}}if(!gT.test(e)&&!e.includes(\\\"&\\\")&&!e.includes(\\\"fl\\\")){let o=e.trim(),c=n.width(o,r,s);if(c\u003C=i||!(o.includes(\\\" \\\")||AT.test(o)||ST.test(o)))return{lines:[[{text:o,style:s,width:c}]],widths:[c],width:c,height:a,size:r,lineHeight:a};let l=[],u=[];Ug([{text:o,style:s,width:c}],n,r,i,l,u);let h=0;for(let m of u)m>h&&(h=m);let d=l.length>1?Math.round(r*Fg):a;return{lines:l,widths:u,width:h,height:l.length*d,size:r,lineHeight:d}}return Pg(e,t,n,r,i,s,a)}function Pg(e,t,n,r,i,s,a,o){let c=zo;zo=o;try{let l=$T(e,t,n,r,i,s,a);return o?Vo(l):l}finally{zo=c}}function $T(e,t,n,r,i,s,a){let o=t?CT(e.replace(/\\\\r\\\\n?/g,`\\r\\n`)).trim():e.trim(),c=[],l=[],u=0,h={style:s,shifts:[]};for(let m of o.split(mT)){let p=[];IT(p,m.trim(),t,s,h);let y=kT(p,n,r);y>i?Ug(p,n,r,i,c,l):(c.push(p),l.push(y))}for(let m of l)m>u&&(u=m);let d=c.length>1?Math.round(r*Fg):a;return{lines:c,widths:l,width:u,height:c.length*d,size:r,lineHeight:d}}function Vo(e){let t;for(let r=0;r\u003Ce.lines.length;r++){let i=e.lineHeight;for(let s of e.lines[r])s.math&&(i=Math.max(i,Math.ceil(s.math.height+e.size/4)));i!==e.lineHeight&&t===void 0&&(t=e.lines.map(()=>e.lineHeight)),t&&(t[r]=i)}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 r of t)n+=r;return{...e,heights:t,height:n}}function Yi(e){for(let t of e)if(t.math)return!0;return!1}function Nr(e,t){let n=e.heights;if(!n)return(t+.5)*e.lineHeight;let r=0;for(let i=0;i\u003Ct;i++)r+=n[i];return r+n[t]/2}function Ir(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 ms(e,t,n,r){let i=r(t,!1),s=e.maxWidth;if(s===void 0||!(s>0)||i.width\u003C=s)return i;let a=Math.min(n,t),o=t;i=r(o,!0);for(let c=0;c\u003C3&&i.width>s&&o>a;c++)o=Math.max(a,o-(i.width-s)),i=r(o,!0);return i}function kt(e){let t=e.maxWidth;return t!==void 0&&t>0?Math.max(80,t-2*(e.padding??8)):4e3}function gs(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 LT=640;function Pt(e,t){let n=t(!1),r=e.maxWidth;if(e.autoDirection===!1||r===void 0||!(r>0)||n.width\u003C=r)return n;let i=e.directionBreakpoint;if(r>=(i!==void 0&&i>0?i:LT))return n;let s=t(!0);return s.width\u003Cn.width?s:n}function Pn(e){return e===\\\"LR\\\"||e===\\\"RL\\\"}function An(e,t){let n=t(!1),r=e.maxWidth;if(r===void 0||!(r>0)||n.width\u003C=r)return n;let i=t(!0);return i.width\u003Cn.width?i:n}var Xs=new Map([[\\\"tool\\\",0],[\\\"task\\\",1],[\\\"decision\\\",2],[\\\"input\\\",3],[\\\"refdoc\\\",4],[\\\"connector\\\",5],[\\\"action\\\",6]]),Gg=Xs.size,OT=e=>Math.max(1,e-Gg),DT=(e,t)=>{let n=Gg+e%OT(t);return t>0?n%t:n};function Yg(e,t,n,r){let i=n.size;for(let s of e){if(s.isGroup||s.shape===\\\"collapsedGroup\\\"){s.colorIndex=DT(n.get(s.id)??i++,r);continue}let a=t(s.id);a&&Xs.has(a)&&(s.kind=a)}}function Hg(e,t,n){let r=[],i=[],s=e.subgraphs,a=b=>{let S=[];for(let x of b){let I=e.classes.get(x);I?.styles&&(S=[...S,...I.styles].map(L=>L.trim())),I?.textStyles&&(S=[...S,...I.textStyles].map(L=>L.trim()))}return S},o=new Set,c=new Map,l=new Set;for(let b of s){if(b.metadata?.view!==\\\"collapsed\\\"||o.has(b.id))continue;let S=[b.id];for(;S.length>0;){let x=e.subgraph(S.pop())?.nodes;if(x!==void 0)for(let I of x)I===b.id||o.has(I)||(o.add(I),c.set(I,b.id),l.has(I)||S.push(I))}l.add(b.id)}let u=new Map;for(let b of o){let S=[b],x=c.get(b);for(;;){let I=u.get(x),L=I??c.get(x);if(L===void 0||(I===void 0&&S.push(x),x=L,I!==void 0))break}for(let I of S)u.set(I,x)}let h=new Map;s.forEach((b,S)=>h.set(b.id,S));let d=new Map,m=(b,S,x)=>{let I=h.get(b);if(I===void 0||I\u003Cx)return!1;let L=S;for(let O=0;L!==void 0&&O\u003C=s.length;O++){if(L===b)return!0;L=d.get(L)}return!1};for(let b=s.length-1;b>=0;b--){let S=s[b];if(!o.has(S.id))for(let x of S.nodes){if(m(x,S.id,b)){e.emitWarning(\\\"CONTAINMENT_VIOLATION\\\",`Container \\\"${S.id}\\\" cannot contain \\\"${x}\\\" because \\\"${x}\\\" already contains it. The nesting that would close the loop is dropped.`,{nodeId:x});continue}d.set(x,S.id)}}let p=new Map;for(let b=s.length-1;b>=0;b--){let S=s[b];if(o.has(S.id))continue;let x=S.metadata?.view===\\\"collapsed\\\",I={id:S.id,label:S.title,labelType:S.labelType,parentId:d.get(S.id),cssStyles:[],cssCompiledStyles:a(S.classes),cssClasses:S.classes.join(\\\" \\\"),shape:x?\\\"collapsedGroup\\\":\\\"flowGroup\\\",dir:S.dir,isGroup:!x,metadata:x?{...S.metadata,containerType:S.type}:S.metadata};r.push(I),p.set(S.id,I)}for(let b of e.nodes.values()){if(o.has(b.id))continue;let S=p.get(b.id);if(S){S.cssStyles=b.styles,S.cssCompiledStyles=a(b.classes),S.cssClasses=b.classes.join(\\\" \\\");continue}let x=Li(b.type),I={id:b.id,label:b.text,labelType:b.labelType,parentId:d.get(b.id),cssStyles:b.styles,cssCompiledStyles:a([\\\"default\\\",\\\"node\\\",...b.classes]),cssClasses:\\\"default \\\"+b.classes.join(\\\" \\\"),dir:b.dir,link:b.link,linkTarget:b.linkTarget,tooltip:e.tooltips.get(b.id),metadata:b.metadata,isGroup:!1,shape:x===\\\"square\\\"||x===void 0?\\\"squareRect\\\":x};r.push(I),p.set(b.id,I)}e.edges.forEach((b,S)=>{let x=u.get(b.start)??b.start,I=u.get(b.end)??b.end;if(x===I&&b.start!==b.end)return;let L=[...e.defaultEdgeStyle??[]];b.style&&L.push(...b.style);let O=b.type===\\\"arrow_open\\\"?\\\"none\\\":b.type===\\\"arrow_cross\\\"||b.type===\\\"arrow_point\\\"?b.type:\\\"arrow_point\\\";i.push({id:b.id||`L_${x}_${I}_${S}`,isUserDefinedId:b.isUserDefinedId,start:x,end:I,type:b.type??\\\"normal\\\",label:b.text,labelType:b.labelType,thickness:b.stroke,pattern:b.stroke,minlen:b.length,classes:\\\"edge-thickness-normal edge-pattern-solid flowchart-link\\\",arrowTypeStart:\\\"none\\\",arrowTypeEnd:O,cssCompiledStyles:a(b.classes),style:L,animate:b.animate,animation:b.animation,curve:b.interpolate||e.defaultInterpolate||n,metadata:b.metadata})}),Zm(r,e);let y=new Map;for(let b of s){let S=d.get(b.id);if(S===void 0)continue;let x=y.get(S);x?x.push(b.id):y.set(S,[b.id])}let E=new Map;for(let b of s){if(d.get(b.id)!==void 0)continue;let S=[b.id];for(;S.length>0;){let x=S.pop();if(E.has(x))continue;E.set(x,E.size);let I=y.get(x);if(I)for(let L=I.length-1;L>=0;L--)S.push(I[L])}}return Yg(r,b=>{if(e.connectors.has(b))return\\\"connector\\\";let S=e.nodes.get(b);return S?e.vertexKind(S):void 0},E,t),{nodes:r,edges:i}}var vT=8,PT=40,FT=16,BT=48,jo=20,Ku=26,$c=14,zu=\\\"collapsed\\\",WT={TB:2,RL:3,BT:0,LR:1},Kg=new WeakMap;function Xu(e,t){let n=Kg.get(e);if(n===void 0){let r=t.flowchart?.curve;n=Hg(e,vT,typeof r==\\\"string\\\"?r:void 0),Kg.set(e,n)}return n}function Lc(e,t,n){let r=e.agentflow?.[t];return typeof r==\\\"number\\\"&&r>0?Math.min(r,2e3):n}function Vu(e,t,n){let r=Et(e);return` fill=\\\"${r}\\\"${vn(n.shape)?\\\"\\\":` fill-opacity=\\\"${t}\\\"`} stroke=\\\"${r}\\\"`}function Vg(e,t,n){return Pn(e.direction)?Pt(n,r=>zg(e,t,n,r)):zg(e,t,n,!1)}function zg(e,t,n,r){let i=Xu(e,t),s=n.fontSize??16,a=Math.round(s*.875),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=Lc(t,\\\"wrappingWidth\\\",120),l=Lc(t,\\\"minNodeWidth\\\",120),u=n.padding??8,h=n.icons,d=new Map,m=[],p=[];i.nodes.forEach((ne,q)=>d.set(ne.id,q));for(let ne of i.nodes){let q=ne.cssStyles.length>0?ne.cssCompiledStyles.concat(ne.cssStyles):ne.cssCompiledStyles,k=Ct(q),J=(k.bold?1:0)|(k.italic?2:0),te=ne.labelType===\\\"markdown\\\",se=k.fontSize??s,re,P;if(ne.isGroup){let ee=Ge(ne.label,te,o,se,4e3,J);re={node:ne,style:k,label:ee,shape:\\\"group\\\",w:0,h:0,dy:0,loops:0},P=Bt(0,0),P.isGroup=!0,P.dir=ne.dir?ln(ne.dir):void 0,P.padX=jo,P.padTop=ee.height>0?ee.height+16:jo,P.padBottom=jo,P.minW=ee.width+2*jo-12}else if(ne.shape===\\\"collapsedGroup\\\"){let ee=Ge(ne.label,te,o,se,c,J),ae=Math.max(ee.width,l)+2*Tt,ue=ee.height+2*Mt+$c;re={node:ne,style:k,label:ee,shape:zu,w:ae,h:ue,dy:-$c/2,loops:0},P=Bt(ae,ue)}else{let ee=uc(ne.shape),ae=Ge(ne.label,te,o,se,c,J),ue=ps(ee,ee===\\\"diam\\\"?ae.width:Math.max(ae.width,l),ae.height);re={node:ne,style:k,label:ae,shape:ee,w:ue.w,h:ue.h,dy:ue.dy,loops:0},P=Bt(ue.w,ue.h)}P.seq=m.length,m.push(re),p.push(P)}i.nodes.forEach((ne,q)=>{p[q].parent=ne.parentId!==void 0?d.get(ne.parentId)??-1:-1}),xc(p,i.edges.map(ne=>[d.get(ne.start)??-1,d.get(ne.end)??-1]));let y=r?\\\"TB\\\":ln(e.direction),E=ne=>{let q;for(let k=p[ne].parent,J=0;k>=0&&q===void 0&&J\u003C1e4;k=p[k].parent,J++)q=p[k].dir;return q??y},b=ne=>{let q=E(ne);return q===\\\"LR\\\"||q===\\\"RL\\\"},S=new Int32Array(p.length).fill(-1);for(let ne=0;ne\u003Cp.length;ne++){let q=[],k=ne;for(;k>=0&&S[k]\u003C0&&q.length\u003C=p.length;)q.push(k),k=p[k].parent;let J=k>=0?S[k]+1:0;for(let te=q.length-1;te>=0;te--)S[q[te]]=J++}let x=(ne,q)=>{let k=q;for(let J=S[q];J>S[ne];J--)k=p[k].parent;return k===ne&&q!==ne},I=[],L=[],O=[],v=[];for(let ne of i.edges){let q=d.get(ne.start),k=d.get(ne.end);if(q===void 0||k===void 0)continue;let J=Ge(ne.label,ne.labelType===\\\"markdown\\\",o,a,c);if(x(q,k)||x(k,q)){v.push({edge:ne,label:J,src:q,dst:k});continue}q===k&&(m[q].loops++,b(q)?p[q].h+=2*(Ku+(J.height>0?J.height+8:0)):p[q].w+=2*(Ku+(J.width>0?J.width+12:0))),O.push(ne),L.push(J),I.push({src:q,dst:k,minlen:ne.minlen??1,labelW:J.width>0?J.width+12:0,labelH:J.height>0?J.height+4:0,route:[],labelX:0,labelY:0})}let G=On(p,I,y,{nodeSep:Lc(t,\\\"nodeSpacing\\\",PT),edgeSep:FT,rankSep:Lc(t,\\\"rankSpacing\\\",BT),portSep:20}),K=Ge(e.title,!1,o,s,4e3,1),C=K.height>0?K.height+12:0,Z=Math.max(G.width,K.width),oe=u+(Z-G.width)/2,H=u+C;Tr(p,I,oe,H);let z=Math.ceil(Z+2*u),M=Math.ceil(G.height+C+2*u),T=[],R=[],_=[],$=[],g=v.length*p.length\u003C2e6;for(let{edge:ne,src:q,dst:k}of v){let J=x(k,q),te=J?k:q,se=J?q:k,re=p[te],P=p[se],ee=WT[re.dir??E(te)],ae=J?ee:ee+2&3,ue=X=>{let le=(X&1)===0,de=X===0||X===3?-1:1,Se=le?P.x:P.x+de*P.w/2,_e=le?P.y+de*P.h/2:P.y,xe=le?P.x:re.x+de*re.w/2,Me=le?re.y+de*re.h/2:P.y,Ce=le?0:1;return J?[Se,_e,Ce,xe,Me,Ce]:[xe,Me,Ce,Se,_e,Ce]},ce=X=>{for(let le=0;le\u003Cp.length;le++){let de=p[le];if(le!==se&&!de.isGroup&&de.x+de.w/2>Math.min(X[0],X[3])-1&&de.x-de.w/2\u003CMath.max(X[0],X[3])+1&&de.y+de.h/2>Math.min(X[1],X[4])-1&&de.y-de.h/2\u003CMath.max(X[1],X[4])+1)return!0}return!1},pe=ue(ae);if(g&&ce(pe))for(let X of[ae+1&3,ae+3&3,ae+2&3]){let le=ue(X);if(!ce(le)){pe=le;break}}$.push(pe),_.push((pe[0]+pe[3])/2,(pe[1]+pe[4])/2);let V=pe.slice();js(V,J?0:3,m[se],P),R.push(Cn(V,\\\"linear\\\",0,Rt(ne.arrowTypeEnd)))}let N=new Map,w=!1;for(let ne of p)ne.isGroup&&(w=!0);if(w){for(let ne of I)ur(N,ne.route);for(let ne of $)ur(N,ne)}let A=\\\"\\\",D=\\\"\\\",U=[];for(let ne=0;ne\u003Cm.length;ne++){let q=m[ne],k=p[ne],J=q.node,te=k.x,se=k.y,re=It(J.cssClasses.replace(/^default\\\\s?/,\\\"\\\")),P=Ue(J.id);if(k.isGroup){Mn(q.style.shape)&&U.push({box:[te-k.w/2,se-k.h/2,te+k.w/2,se+k.h/2],shape:q.style.shape});let de=hs(k,q.label.width,N,jo);A+=`\u003Cg class=\\\"pele-cluster pele-flow${re}\\\" data-id=\\\"${P}\\\">\u003Crect x=\\\"${f(te-k.w/2)}\\\" y=\\\"${f(se-k.h/2)}\\\" width=\\\"${f(k.w)}\\\" height=\\\"${f(k.h)}\\\"${At(Vu(J.colorIndex??Xs.size,\\\"0.06\\\",q.style)+q.style.shape)}/>`+Ne(q.label,de,se-k.h/2+8+q.label.height/2,` class=\\\"pele-cluster-label\\\"${vt(q.style,\\\"var(--_m)\\\")}${q.style.text}`,h)+\\\"\u003C/g>\\\";continue}let ee=q.w,ae=q.h,ue=\\\"\\\",ce;if(q.shape===zu){let de=Et(J.colorIndex??Xs.size),Se=ae/2-$c-2,_e=Se+($c+2)/2;ce=`\u003Crect x=\\\"${f(-ee/2)}\\\" y=\\\"${f(-ae/2)}\\\" width=\\\"${f(ee)}\\\" height=\\\"${f(ae)}\\\"${At(Vu(J.colorIndex??Xs.size,\\\"0.06\\\",q.style)+q.style.shape)}/>\u003Cpath d=\\\"M${f(-ee/2+10)},${f(Se)}H${f(ee/2-10)}\\\" fill=\\\"none\\\" stroke=\\\"${de}\\\" stroke-dasharray=\\\"3 3\\\"${q.style.line}/>\u003Cpath class=\\\"pele-collapsed-mark\\\" d=\\\"${ju(-9,_e)}${ju(0,_e)}${ju(9,_e)}\\\" fill=\\\"${de}\\\" stroke=\\\"none\\\"/>`}else{let de=Xs.get(J.kind??\\\"task\\\")??1;ue=` pele-kind-${J.kind??\\\"task\\\"}`,ce=hr(q.shape,ee,ae,Vu(de,\\\"0.14\\\",q.style)+q.style.shape,` stroke=\\\"${Et(de)}\\\"`+q.style.line)}let pe=q.shape===zu||Gi(q.shape)?vt(q.style):\\\"\\\",V=Ne(q.label,0,q.dy,` class=\\\"pele-label\\\"${pe}${q.style.text}`,h);if(/ internal-link(?: |$)/.test(re+\\\" \\\")&&J.label&&n.links!==!1){let de=bt(J.label),Se=$i(de,n),_e=rt(de);V=`\u003Ca class=\\\"internal-link\\\"${Se?` href=\\\"${_e}\\\"${qr(n)}`:\\\"\\\"} data-href=\\\"${_e}\\\">${V}\u003C/a>`,T.push({id:J.id,href:de,internal:!0})}let le=ce+V;J.tooltip&&(le=`\u003Ctitle>${Ue(J.tooltip)}\u003C/title>`+le),J.link&&(le=Zn(le,J.link,J.id,T,n,J.linkTarget?` target=\\\"${rt(J.linkTarget)}\\\"`:\\\"\\\")),D+=`\u003Cg class=\\\"pele-node pele-shape-${q.shape}${ue}${re}\\\" data-id=\\\"${P}\\\" transform=\\\"translate(${f(te)},${f(se)})\\\">${le}\u003C/g>`}let B=\\\"\\\",F=\\\"\\\",W=\\\"\\\",j=(ne,q,k,J,te)=>{let se=ne.style.length>0||ne.cssCompiledStyles.length>0?Ct(ne.cssCompiledStyles.concat(ne.style)):void 0,re=ne.arrowTypeEnd,P=Mr(k.d,[k.ex,k.ey],U,se?.line,k.tokens),ee=P||(se?.stroke?rt(se.stroke):\\\"var(--_l)\\\"),ae=ne.thickness===\\\"dotted\\\"?\\\"reference\\\":re===\\\"arrow_cross\\\"?\\\"failure\\\":\\\"sequence\\\",ue=It(ne.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,\\\"\\\"));P===\\\"\\\"&&(B+=Cr(k,\\\"none\\\",re,se?.line)),F+=`\u003Cg class=\\\"pele-edge pele-edge-${ae}${ue}\\\" data-id=\\\"${Ue(ne.id)}\\\"${P?` stroke=\\\"${P}\\\"`:\\\"\\\"}${se?.line??\\\"\\\"}>\u003Cpath d=\\\"${k.d}\\\"${ne.thickness===\\\"dotted\\\"?' stroke-dasharray=\\\"3 4\\\"':\\\"\\\"}/>`+_t(re,k.ex,k.ey,k.edx,k.edy,ee)+\\\"\u003C/g>\\\",q.width>0&&(W+=dn(ne.id,q,J,te,se?.text??\\\"\\\",h))},Q=new Map;for(let ne=0;ne\u003CI.length;ne++){let q=I[ne],k=O[ne],J=L[ne],te=k.arrowTypeEnd,se;if(q.src===q.dst){let re=m[q.src],P=Q.get(q.src)??0;Q.set(q.src,P+1),se=Rc(p[q.src],re.w,re.h,P,b(q.src),Ku,Rt(te),q)}else{let re=q.route.slice();js(re,0,m[q.src],p[q.src]),js(re,re.length-3,m[q.dst],p[q.dst]),se=Cn(re,k.curve,0,Rt(te))}j(k,J,se,q.labelX,q.labelY)}return v.forEach((ne,q)=>j(ne.edge,ne.label,R[q],_[2*q],_[2*q+1])),{svg:at(\\\"agentflow\\\",z,M,s,n,e,Ne(K,z/2,u+K.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(A?`\u003Cg class=\\\"pele-clusters\\\">${A}\u003C/g>`:\\\"\\\")+Dn(B)+(F?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${F}\u003C/g>`:\\\"\\\")+(W?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${a}\\\">${W}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${D}\u003C/g>`),width:z,height:M,links:T}}function ju(e,t){return`M${f(e-1.75)},${f(t)}a1.75,1.75 0 1 0 3.5,0a1.75,1.75 0 1 0 -3.5,0Z`}var jg={type:\\\"agentflow\\\",keepComments:!0,parse(e,t,n,r,i){let s=t.flowchart??{},a=new hc({inheritDir:s.inheritDir===!0,direction:typeof t.direction==\\\"string\\\"?t.direction:void 0,lineOffset:r,source:e,maxEdges:i.maxEdges});return n&&(a.title=n),ag(e,a),Xu(a,t),a},render:Vg};function kr(e){throw new Qe(e,\\\"semantic\\\",{type:\\\"architecture\\\"})}var Oc=class{constructor(){fe(this,\\\"type\\\",\\\"architecture\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"nodes\\\",new Map);fe(this,\\\"groups\\\",new Map);fe(this,\\\"edges\\\",[]);fe(this,\\\"layoutHints\\\",[]);fe(this,\\\"registered\\\",new Map)}register(t,n,r){this.registered.has(n)&&kr(`The ${t} id [${n}] is already in use by another ${this.registered.get(n)}`),r!==void 0&&(n===r&&kr(`The ${t} [${n}] cannot be placed within itself`),this.registered.has(r)||kr(`The ${t} [${n}]'s parent does not exist. Please make sure the parent is created before this ${t}`),this.registered.get(r)===\\\"node\\\"&&kr(`The ${t} [${n}]'s parent is not a group`)),this.registered.set(n,t===\\\"group\\\"?\\\"group\\\":\\\"node\\\")}addService({id:t,icon:n,iconText:r,title:i,in:s}){this.register(\\\"service\\\",t,s),this.nodes.set(t,{id:t,type:\\\"service\\\",icon:n,iconText:r,title:i,in:s})}addJunction({id:t,in:n}){this.register(\\\"junction\\\",t,n),this.nodes.set(t,{id:t,type:\\\"junction\\\",in:n})}addGroup({id:t,icon:n,title:r,in:i}){this.register(\\\"group\\\",t,i),this.groups.set(t,{id:t,icon:n,title:r,in:i})}addEdge({lhsId:t,rhsId:n,lhsDir:r,rhsDir:i,lhsInto:s,rhsInto:a,lhsGroup:o,rhsGroup:c,title:l}){let u=[[\\\"left\\\",t,o],[\\\"right\\\",n,c]];for(let[d,m]of u)this.registered.has(m)||kr(`The ${d}-hand id [${m}] does not yet exist. Please create the service/group before declaring an edge to it.`);for(let[d,m]of u)this.nodes.has(m)||kr(`The ${d}-hand id [${m}] is a group. Add {group} to a service inside it instead.`);let h=this.nodes.get(t).in;if(h!==void 0&&h===this.nodes.get(n).in)for(let[d,m,p]of u)p&&kr(`The ${d}-hand id [${m}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);this.edges.push({lhsId:t,lhsDir:r,lhsInto:s,lhsGroup:o,rhsId:n,rhsDir:i,rhsInto:a,rhsGroup:c,title:l})}addLayoutHint(t){t.members.length\u003C2&&kr(`An align directive requires at least two members; got ${t.members.length}`);let n=new Set;for(let r of t.members)this.registered.get(r)!==\\\"node\\\"&&kr(`align ${t.direction} references [${r}], which is not a service or junction`),n.has(r)&&kr(`align ${t.direction} lists [${r}] more than once`),n.add(r);this.layoutHints.push(t)}};function Xg(e,t){e.accDescr&&(t.accDescr=e.accDescr.replace(/\\\\n\\\\s+/g,`\\r\\n`)),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 qg=new WeakMap;function UT(e){let t=e.map((i,s)=>s),n=[];for(let i=0;i\u003C128;i++){let s=String.fromCharCode(i);n.push(t.filter(a=>{let{pattern:o,first:c}=e[a];return typeof o==\\\"string\\\"?o[0]===s:c===void 0||c.includes(s)}))}let r={starting:n,every:t,longer:e.map(i=>i.longer?.map(s=>e.indexOf(s)))};return qg.set(e,r),r}function Yt(e,t,n){let r=[],i=[],s=[],a=new Uint8Array(t.length),{starting:o,every:c,longer:l}=qg.get(t)??UT(t),u=[],h=e.length,d=(p,y)=>{if(a[p])return-1;let E=t[p];if(E.match!==void 0)return E.match(e,y,r[r.length-1]??-1);if(E.scanner!==void 0)return(u[p]??=E.scanner())(e,y,r[r.length-1]??-1);let b=E.pattern;return typeof b==\\\"string\\\"?e.startsWith(b,y)?y+b.length:-1:(b.lastIndex=y,b.test(e)?b.lastIndex:(E.opener!==void 0&&(E.opener.lastIndex=y,E.opener.test(e)&&(a[p]=1)),-1))},m=0;e:for(;m\u003Ch;){let p=e.charCodeAt(m);for(let y of p\u003C128?o[p]:c){let E=d(y,m);if(E\u003C=m)continue;let b=y,S=l[y];if(S!==void 0)for(let x of S){let I=d(x,m);if(I>E){b=x,E=I;break}}t[b].hidden||(r.push(b),i.push(m),s.push(E)),m=E;continue e}throw ft(n,e,m,\\\"\\\",!0)}return r.push(-1),i.push(h),s.push(h),{kinds:r,starts:i,ends:s,src:e}}var sn={name:\\\"ACC_DESCR\\\",pattern:/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/y,first:\\\"\\t a\\\"},Xt={name:\\\"ACC_TITLE\\\",pattern:/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/y,first:\\\"\\t a\\\"},pr={name:\\\"TITLE\\\",pattern:/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/y,first:\\\"\\t t\\\"};function er(e){return{...pr,pattern:new RegExp(String.raw`[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|(?!${e}))`,\\\"y\\\")}}var Fn={name:\\\"STRING\\\",pattern:/\\\"([^\\\"\\\\\\\\]|\\\\\\\\.)*\\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/y,first:`\\\"'`},Sn={name:\\\"NEWLINE\\\",pattern:/\\\\r?\\\\n/y,first:`\\\\r\\r\\n`},wn={name:\\\"WHITESPACE\\\",pattern:/[\\\\t ]+/y,hidden:!0,first:\\\"\\t \\\"},Ht={name:\\\"YAML\\\",pattern:/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/y,hidden:!0,opener:/---[\\\\t ]*\\\\r?\\\\n/y,first:\\\"-\\\"},Qt={name:\\\"DIRECTIVE\\\",pattern:/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/y,hidden:!0,opener:/[\\\\t ]*%%{/y,first:\\\"\\t %\\\"},Zt={name:\\\"SINGLE_LINE_COMMENT\\\",pattern:/[\\\\t ]*%%[^\\\\n\\\\r]*/y,first:\\\"\\t %\\\",hidden:!0};function Jt(e){return{name:e,pattern:new RegExp(e.replace(/[.*+?^${}()|[\\\\]\\\\\\\\]/g,\\\"\\\\\\\\$&\\\")+\\\"(?:(?=%%)|(?!\\\\\\\\S))\\\",\\\"y\\\"),first:e[0]}}var GT=/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/,YT=/accTitle[\\\\t ]*:([^\\\\n\\\\r]*)/,HT=/title([\\\\t ][^\\\\n\\\\r]*|)/;function qu(e){return e.trim().replace(/[\\\\t ]{2,}/gm,\\\" \\\")}function Kt(e){return qu(HT.exec(e)[1])}function zt(e){return qu(YT.exec(e)[1])}function Vt(e){let t=GT.exec(e);return t[1]!==void 0?qu(t[1]):t[2].replace(/^\\\\s*/gm,\\\"\\\").replace(/\\\\s+$/gm,\\\"\\\").replace(/[\\\\t ]{2,}/gm,\\\" \\\").replace(/[\\\\n\\\\r]{2,}/gm,`\\r\\n`)}var KT=new Map([[\\\"b\\\",\\\"\\\\b\\\"],[\\\"f\\\",\\\"\\\\f\\\"],[\\\"n\\\",`\\r\\n`],[\\\"r\\\",\\\"\\\\r\\\"],[\\\"t\\\",\\\"\\t\\\"],[\\\"v\\\",\\\"\\\\v\\\"],[\\\"0\\\",\\\"\\\\0\\\"]]);function un(e){if(!e.includes(\\\"\\\\\\\\\\\"))return e.slice(1,-1);let t=\\\"\\\";for(let n=1;n\u003Ce.length-1;n++){let r=e[n];if(r===\\\"\\\\\\\\\\\"){let i=e[++n];t+=KT.get(i)??i}else t+=r}return t}var Ut=class{constructor(t,n,r){fe(this,\\\"tokens\\\",t);fe(this,\\\"types\\\",n);fe(this,\\\"diagram\\\",r);fe(this,\\\"i\\\",0);fe(this,\\\"kinds\\\");this.kinds=t.kinds}get kind(){return this.kinds[this.i]}text(t=this.i){return this.tokens.src.slice(this.tokens.starts[t],this.tokens.ends[t])}take(){return this.text(this.i++)}accept(t){return this.kinds[this.i]!==t?!1:(this.i++,!0)}expect(t){return this.kinds[this.i]!==t&&this.fail(`token of type '${this.types[t].name}'`),this.take()}fail(t){let n=this.kind===-1?\\\"end of input\\\":`\\\\`${this.text()}\\\\``,{src:r,starts:i,ends:s}=this.tokens,a=i[this.i];if(this.kind===-1){let o=this.i;for(;o>0&&r.slice(i[o-1],s[o-1]).trim()===\\\"\\\";)o--;o>0&&(a=s[o-1])}throw ft(this.diagram,r,a,`Expecting ${t} but found ${n}.`)}};var Zg={name:\\\"ID\\\",pattern:/[\\\\w]([-\\\\w]*\\\\w)?/y};function bs(e){return{name:e,pattern:e,longer:[Zg]}}var Qg=[bs(\\\"architecture-beta\\\"),bs(\\\"junction\\\"),bs(\\\"service\\\"),bs(\\\"column\\\"),bs(\\\"group\\\"),bs(\\\"align\\\"),bs(\\\"row\\\"),{name:\\\"--\\\",pattern:\\\"--\\\",longer:[Ht]},bs(\\\"in\\\"),{name:\\\":\\\",pattern:\\\":\\\"},{name:\\\"-\\\",pattern:\\\"-\\\",longer:[Ht]},{name:\\\"ARROW_DIRECTION\\\",pattern:/L|R|T|B/y},{name:\\\"ARROW_GROUP\\\",pattern:/\\\\{group\\\\}/y},{name:\\\"ARROW_INTO\\\",pattern:/\u003C|>/y},sn,Xt,er(String.raw`[-\\\\w]*\\\\w`),Fn,Zg,Sn,wn,Ht,Qt,Zt,{name:\\\"ARCH_ICON\\\",pattern:/\\\\([\\\\w-:]+\\\\)/y},{name:\\\"ARCH_TITLE\\\",pattern:/\\\\[(?:\\\"([^\\\"\\\\\\\\]|\\\\\\\\.)*\\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'|[^\\\\[\\\\]\\\\r\\\\n]+)\\\\]/y}];function Qu(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 Jg(e){let t=new Ut(Yt(e,Qg,\\\"architecture\\\"),Qg,\\\"architecture\\\"),n={$type:\\\"Architecture\\\",groups:[],services:[],junctions:[],edges:[],alignments:[]},r=s=>t.kinds[t.i]===s,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=Vt(t.take());break;case 15:n.accTitle=zt(t.take());break;case 16:n.title=Kt(t.take());break;case 4:{t.i++;let s={$type:\\\"Group\\\",id:t.expect(18)};r(24)&&(s.icon=t.take().slice(1,-1)),r(25)&&(s.title=Qu(t.take())),t.accept(8)&&(s.in=t.expect(18)),n.groups.push(s);break}case 2:{t.i++;let s={$type:\\\"Service\\\",id:t.expect(18)};r(17)?s.iconText=un(t.take()):r(24)&&(s.icon=t.take().slice(1,-1)),r(25)&&(s.title=Qu(t.take())),t.accept(8)&&(s.in=t.expect(18)),n.services.push(s);break}case 1:{t.i++;let s={$type:\\\"Junction\\\",id:t.expect(18)};t.accept(8)&&(s.in=t.expect(18)),n.junctions.push(s);break}case 18:{let s=t.take(),a=t.accept(12);t.expect(9);let o=t.expect(11),c=t.accept(13),l;t.accept(7)||(r(10)||t.fail(\\\"'--' or '-'\\\"),t.i++,l=Qu(t.expect(25)),t.expect(10));let u=t.accept(13),h=t.expect(11);t.expect(9);let d=t.expect(18),m=t.accept(12);n.edges.push({$type:\\\"Edge\\\",lhsId:s,lhsGroup:a,lhsDir:o,lhsInto:c,title:l,rhsInto:u,rhsDir:h,rhsId:d,rhsGroup:m});break}case 5:{t.i++,!r(6)&&!r(3)&&t.fail(\\\"'row' or 'column'\\\");let s=t.take(),a=[t.expect(18),t.expect(18)];for(;r(18);)a.push(t.take());n.alignments.push({$type:\\\"Alignment\\\",direction:s,members:a});break}default:t.fail(\\\"a group, a service, a junction, an edge, an alignment, a title, or a line break\\\")}i()}return n}var zT=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 eb(e){let t=zT.get(e);return t===void 0?\\\"\\\":`\u003Cpath d=\\\"${t}\\\" stroke=\\\"var(--_fg)\\\" stroke-width=\\\"1.5\\\"/>`}var Xo=[-1,1,0,0],Dc=[0,0,-1,1];function qo(e){return e===\\\"L\\\"?0:e===\\\"R\\\"?1:e===\\\"T\\\"?2:3}var tb=64,vc=2**25,nb=2**26;function rb(e,t,n,r){let i=e.length,s=t.length,a=s,o=new Map,c=new Map,l=new Int32Array(i+s).fill(a),u=new Int32Array(s+1),h=[];for(let Y=0;Y\u003C=s;Y++)h.push([]);t.forEach((Y,ne)=>{c.set(Y.id,ne);let q=Y.in===void 0?void 0:c.get(Y.in);q!==void 0&&q!==ne?(l[i+ne]=q,u[ne]=u[q]+1):u[ne]=1}),e.forEach((Y,ne)=>{o.set(Y.id,ne);let q=Y.in===void 0?void 0:c.get(Y.in);q!==void 0&&(l[ne]=q),h[l[ne]].push(ne)});for(let Y=0;Y\u003Cs;Y++)h[l[i+Y]].push(i+Y);let d=[],m=[],p=[],y=[],E=[],b=[],S=new Array(i+s),x=new Array(i+s),I=(Y,ne,q,k,J)=>{if(Y===ne)return;let te=Y,se=ne,re=l[Y],P=l[ne];for(;re!==P;)u[re]>=u[P]?(te=i+re,re=l[te]):(se=i+P,P=l[se]);let ee=d.length;d.push(Y),m.push(ne),p.push(q),y.push(k),E.push(te),b.push(se),(J[te]??=[]).push(ee),(J[se]??=[]).push(ee)};for(let Y of r){let ne=Y.direction===\\\"row\\\";for(let q=1;q\u003CY.members.length;q++){let k=o.get(Y.members[q-1]),J=o.get(Y.members[q]);k!==void 0&&J!==void 0&&I(k,J,ne?1:3,ne?0:2,S)}}for(let Y of[!1,!0])for(let ne of n){if(ne.lhsDir===ne.rhsDir!==Y)continue;let q=o.get(ne.lhsId),k=o.get(ne.rhsId);q!==void 0&&k!==void 0&&I(q,k,qo(ne.lhsDir),qo(ne.rhsDir),x)}let L=new Int32Array(i+s),O=new Int32Array(i+s),v=new Int32Array(i+s).fill(1),G=new Int32Array(i+s).fill(1),K=new Uint8Array(i+s),C=[],Z=new Map,oe=[],H=new Map,z=0,M=0,T=0,R=(Y,ne)=>{M=0,T=0;for(let q=Y;q!==ne;q=i+l[q])M+=L[q],T+=O[q]},_=(Y,ne,q)=>{if(L[Y]=ne,O[Y]=q,K[Y]=1,C.push(Y),v[Y]*G[Y]>tb){oe.push(Y);return}for(let k=q;k\u003Cq+G[Y];k++)for(let J=ne;J\u003Cne+v[Y];J++)Z.set((J+vc)*nb+k+vc,Y)},$=(Y,ne,q,k,J)=>L[Y]\u003Cne+k&&ne\u003CL[Y]+v[Y]&&O[Y]\u003Cq+J&&q\u003CO[Y]+G[Y],g=(Y,ne,q,k)=>{if(q*k>tb){for(let J=z;J\u003CC.length;J++)if($(C[J],Y,ne,q,k))return C[J];return-1}for(let J=ne;J\u003Cne+k;J++)for(let te=Y;te\u003CY+q;te++){let se=Z.get((te+vc)*nb+J+vc);if(se!==void 0)return se}for(let J of oe)if($(J,Y,ne,q,k))return J;return-1},N=(Y,ne,q,k,J,te)=>{let se=`${Y},${ne},${q},${k},${J},${te}`,re=H.get(se)??0;for(;;){let P=g(Y+re*J,ne+re*te,q,k);if(P\u003C0)break;re=J>0?L[P]+v[P]-Y:J\u003C0?Y+q-L[P]:te>0?O[P]+G[P]-ne:ne+k-O[P]}return H.set(se,re),re},w=(Y,ne)=>{let q=E[ne]===Y,k=q?b[ne]:E[ne];if(K[k])return;let J=q?p[ne]:y[ne],te=q?y[ne]:p[ne];R(q?d[ne]:m[ne],Y);let se=M,re=T;R(q?m[ne]:d[ne],k);let P=Xo[J],ee=Dc[J],ae=0,ue=0,ce=Xo[J]+Xo[te]===0&&Dc[J]+Dc[te]===0;J===te?(P=Xo[J]===0?1:0,ee=1-P):ce||(ae=-Xo[te],ue=-Dc[te]);let pe,V;if(P!==0?(pe=P>0?L[Y]+v[Y]:L[Y]-v[k],V=O[Y]+re+ue-T):(V=ee>0?O[Y]+G[Y]:O[Y]-G[k],pe=L[Y]+se+ae-M),ce){let X=x[k];if(X!==void 0&&X.length>1){let Me=[];for(let Ce of X){let ke=b[Ce]===k,be=ke?E[Ce]:b[Ce];if(!K[be]||(ke?p[Ce]:y[Ce])!==J||(ke?y[Ce]:p[Ce])!==te)continue;R(ke?d[Ce]:m[Ce],be);let Ae=P!==0?O[be]+T:L[be]+M;R(ke?m[Ce]:d[Ce],k),Me.push(Ae-(P!==0?T:M))}Me.length>1&&(Me.sort((Ce,ke)=>Ce-ke),P!==0?V=Me[Me.length-1>>1]:pe=Me[Me.length-1>>1])}let le=P===0?1:0,de=1-le,Se=N(pe,V,v[k],G[k],le,de),_e=Se===0?0:N(pe,V,v[k],G[k],-le,-de),xe=Se\u003C=_e?Se:-_e;pe+=le*xe,V+=de*xe}else{let X=N(pe,V,v[k],G[k],P,ee);pe+=P*X,V+=ee*X}_(k,pe,V)},A=Y=>{let ne=h[Y];if(ne.length===0)return;C.length=0;let q=[];for(let X of ne){if(K[X])continue;z=C.length,q.push(z),Z.clear(),oe.length=0,H.clear(),_(X,0,0);let le=z,de=z,Se=0;for(;;){if(le\u003CC.length){let xe=C[le++],Me=S[xe];if(Me!==void 0)for(let Ce of Me)w(xe,Ce);continue}if(de>=C.length)break;let _e=x[C[de]];if(_e===void 0||Se>=_e.length){de++,Se=0;continue}w(C[de],_e[Se++])}}q.push(C.length);let k=q.length-1,J=new Array(k),te=new Array(k),se=new Array(k),re=new Array(k),P=0,ee=0;for(let X=0;X\u003Ck;X++){let le=1/0,de=1/0,Se=-1/0,_e=-1/0;for(let xe=q[X];xe\u003Cq[X+1];xe++){let Me=C[xe];le=Math.min(le,L[Me]),de=Math.min(de,O[Me]),Se=Math.max(Se,L[Me]+v[Me]),_e=Math.max(_e,O[Me]+G[Me])}J[X]=le,te[X]=de,se[X]=Se-le,re[X]=_e-de,P+=se[X]*re[X],ee=Math.max(ee,se[X])}let ae=Math.max(ee,Math.ceil(Math.sqrt(P*2))),ue=0,ce=0,pe=0,V=0;for(let X=0;X\u003Ck;X++){ue>0&&ue+se[X]>ae&&(ce+=pe,ue=0,pe=0);for(let le=q[X];le\u003Cq[X+1];le++)L[C[le]]+=ue-J[X],O[C[le]]+=ce-te[X];ue+=se[X],pe=Math.max(pe,re[X]),V=Math.max(V,ue)}Y\u003Cs&&(v[i+Y]=V,G[i+Y]=ce+pe)};for(let Y=s-1;Y>=0;Y--)A(Y);A(a);let D=new Int32Array(s),U=new Int32Array(s),B=new Int32Array(s),F=new Uint8Array(s);for(let Y=0;Y\u003Cs;Y++){let ne=l[i+Y];B[Y]=ne===a?-1:ne,D[Y]=L[i+Y]+(ne===a?0:D[ne]),U[Y]=O[i+Y]+(ne===a?0:U[ne]),h[Y].length===0&&(F[Y]=1)}let W=new Int32Array(i),j=new Int32Array(i),Q=new Int32Array(i);for(let Y=0;Y\u003Ci;Y++){let ne=l[Y];Q[Y]=ne===a?-1:ne,W[Y]=L[Y]+(ne===a?0:D[ne]),j[Y]=O[Y]+(ne===a?0:U[ne])}return{col:W,row:j,groupCol:D,groupRow:U,groupCols:v.slice(i),groupRows:G.slice(i),groupParent:B,groupEmpty:F,nodeParent:Q}}var In=12,VT=6,sb=4,ib=3,jT=[-1,1,0,0],XT=[0,0,-1,1];function Zu(e,t,n,r,i){let s=e.architecture,a=s!==null&&typeof s==\\\"object\\\"&&!Array.isArray(s)?s[t]:void 0;return typeof a==\\\"number\\\"&&Number.isFinite(a)?Math.min(i,Math.max(r,a)):n}function ob(e){let t=new Map;for(let n of e.sort((r,i)=>r-i))t.has(n)||t.set(n,t.size);return t}function ab(e,t,n,r,i){return`\u003Csvg class=\\\"pele-icon\\\" data-icon=\\\"${Ue(e)}\\\" x=\\\"${f(t)}\\\" y=\\\"${f(n)}\\\" width=\\\"${f(r)}\\\" height=\\\"${f(r)}\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\">${i?.(e)??eb(e)}\u003C/svg>`}function qT(e,t,n,r){let i=e.lines.length>n;if(!i&&e.width\u003C=t)return e;let s=r.width(\\\"…\\\",e.size,0),a=[],o=[],c=0;for(let l=0;l\u003CMath.min(n,e.lines.length);l++){let u=e.lines[l].map(d=>({...d})),h=e.widths[l];if(h>t||i&&l===n-1)for(;;){let d=u[u.length-1];if(d===void 0){u.push({text:\\\"…\\\",style:0,width:s}),h=s;break}let m=h-d.width;if(d.icon===void 0&&m+s\u003Ct){let p=0,y=d.text.length;for(;p\u003Cy;){let b=p+y+1>>1;m+r.width(d.text.slice(0,b),e.size,d.style)+s\u003C=t?p=b:y=b-1}let E=p>0?d.text.charCodeAt(p-1):0;E>=55296&&E\u003C=56319&&p--,d.text=d.text.slice(0,p).trimEnd()+\\\"…\\\",d.width=r.width(d.text,e.size,d.style),h=m+d.width;break}u.pop(),h=m}a.push(u),o.push(h),c=Math.max(c,h)}return{...e,lines:a,widths:o,width:c,height:a.length*e.lineHeight}}function QT(e,t){let{x:n,y:r,dx:i,dy:s}=e,{x:a,y:o,dx:c,dy:l}=t,u=n+i*In,h=r+s*In,d=a+c*In,m=o+l*In;if(i*c+s*l===0){let b=i!==0?a:n,S=i!==0?r:o;return(b-n)*i+(S-r)*s>0&&(b-a)*c+(S-o)*l>0?[n,r,b,S,a,o]:i!==0?[n,r,u,h,u,m,d,m,a,o]:[n,r,u,h,d,h,d,m,a,o]}let p=i!==0,y=p?o-r:a-n;if(i===-c&&s===-l){if((a-n)*i+(o-r)*s>0){if(Math.abs(y)\u003C.5)return[n,r,a,o];if(p){let L=i>0?e.x1:t.x1,O=i>0?t.x0:e.x0,v=L\u003CO?(L+O)/2:(n+a)/2;return[n,r,v,r,v,o,a,o]}let S=s>0?e.y1:t.y1,x=s>0?t.y0:e.y0,I=S\u003Cx?(S+x)/2:(r+o)/2;return[n,r,n,I,a,I,a,o]}}else if(Math.abs(y)>=1){if(p){let S=i>0?Math.max(n,a)+In:Math.min(n,a)-In;return[n,r,S,r,S,o,a,o]}let b=s>0?Math.max(r,o)+In:Math.min(r,o)-In;return[n,r,n,b,a,b,a,o]}if(p){let b=e.y1+In\u003C=t.y0?(e.y1+t.y0)/2:t.y1+In\u003C=e.y0?(t.y1+e.y0)/2:Math.max(e.y1,t.y1)+In;return[n,r,u,r,u,b,d,b,d,o,a,o]}let E=e.x1+In\u003C=t.x0?(e.x1+t.x0)/2:t.x1+In\u003C=e.x0?(t.x1+e.x0)/2:Math.max(e.x1,t.x1)+In;return[n,r,n,h,E,h,E,m,a,m,a,o]}function ZT(e){let t=[e[0],e[1]];for(let n=2;n\u003Ce.length;n+=2){let r=e[n],i=e[n+1],s=t.length,a=Math.abs(r-t[s-2])\u003C.01,o=Math.abs(i-t[s-1])\u003C.01;a&&o||(s>=4&&(a&&Math.abs(t[s-4]-t[s-2])\u003C.01||o&&Math.abs(t[s-3]-t[s-1])\u003C.01)?(t[s-2]=r,t[s-1]=i):t.push(r,i))}return t}function JT(e,t,n){let r=e.length/2,i=new Array(r),s=new Array(r);for(let c=0;c\u003Cr;c++)i[c]=e[c*2],s[c]=e[c*2+1];let a=(c,l,u)=>{let h=Math.hypot(i[l]-i[c],s[l]-s[c]),d=Math.min(u,Math.max(0,h-1));h>0&&d>0&&(i[c]+=(i[l]-i[c])/h*d,s[c]+=(s[l]-s[c])/h*d)};a(0,1,t),a(r-1,r-2,n);let o=`M${f(i[0])},${f(s[0])}`;for(let c=1;c\u003Cr-1;c++){let l=Math.hypot(i[c]-i[c-1],s[c]-s[c-1]),u=Math.hypot(i[c+1]-i[c],s[c+1]-s[c]),h=Math.min(VT,l/2,u/2);if(h\u003C.5){o+=`L${f(i[c])},${f(s[c])}`;continue}let d=i[c]-(i[c]-i[c-1])/l*h,m=s[c]-(s[c]-s[c-1])/l*h,p=i[c]+(i[c+1]-i[c])/u*h,y=s[c]+(s[c+1]-s[c])/u*h;o+=`L${f(d)},${f(m)}Q${f(i[c])},${f(s[c])} ${f(p)},${f(y)}`}return o+`L${f(i[r-1])},${f(s[r-1])}`}function cb(e,t,n){return An(n,r=>e2(e,t,n,r))}function e2(e,t,n,r){let i=Zu(t,\\\"iconSize\\\",48,8,512),s=Zu(t,\\\"fontSize\\\",n.fontSize??16,4,128),a=Math.min(Zu(t,\\\"padding\\\",20,0,256),r?12:1/0),o=Math.round(s*.875),c=n.measurer??ct(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=n.icons,h=i/2,d=[...e.nodes.values()],m=[...e.groups.values()],p=d.length,y=m.length,E=rb(d,m,e.edges,e.layoutHints),b=new Map;d.forEach((ge,Le)=>b.set(ge.id,Le));let S=new Array(p),x=new Float64Array(p),I=new Float64Array(p),L=r?Math.max(i,64):Math.max(i*2.25,96);for(let ge=0;ge\u003Cp;ge++){let Le=d[ge],Fe=Ge(Le.type===\\\"service\\\"?Le.title:void 0,!0,c,s,L);S[ge]=Fe,x[ge]=Math.max(i,2*Math.ceil(Fe.width/2)),I[ge]=i+(Fe.height>0?sb+Fe.height:0)}let O=[],v=[];for(let ge=0;ge\u003Cp;ge++)O.push(E.col[ge]),v.push(E.row[ge]);for(let ge=0;ge\u003Cy;ge++)E.groupEmpty[ge]&&(O.push(E.groupCol[ge]),v.push(E.groupRow[ge]));let G=ob(O),K=ob(v),C=G.size,Z=K.size,oe=new Float64Array(C),H=new Float64Array(Z),z=r?Math.max(24,2*In):Math.max(40,Math.round(i*.75)),M=new Float64Array(C).fill(z),T=new Float64Array(Z).fill(z),R=new Int32Array(p),_=new Int32Array(p);for(let ge=0;ge\u003Cp;ge++){let Le=R[ge]=G.get(E.col[ge]),Fe=_[ge]=K.get(E.row[ge]);oe[Le]=Math.max(oe[Le],x[ge]),H[Fe]=Math.max(H[Fe],I[ge])}for(let ge=0;ge\u003Cy;ge++){if(!E.groupEmpty[ge])continue;let Le=G.get(E.groupCol[ge]),Fe=K.get(E.groupRow[ge]);oe[Le]=Math.max(oe[Le],i),H[Fe]=Math.max(H[Fe],h)}let $=e.edges.length,g=new Array($),N=new Int32Array($*2);for(let ge=0;ge\u003C$;ge++){let Le=e.edges[ge],Fe=N[ge*2]=b.get(Le.lhsId)??-1,Ve=N[ge*2+1]=b.get(Le.rhsId)??-1,Oe=Ge(Le.title,!0,c,o,160);if(g[ge]=Oe,!(Oe.width===0||Fe\u003C0||Ve\u003C0)){if(R[Fe]!==R[Ve]){let je=Math.min(R[Fe],R[Ve]);M[je]=Math.max(M[je],Math.ceil(Oe.width)+28)}else if(oe[R[Fe]]=Math.max(oe[R[Fe]],2*Math.ceil(Oe.width/2)+8),_[Fe]!==_[Ve]){let je=Math.min(_[Fe],_[Ve]);T[je]=Math.max(T[je],Math.ceil(Oe.height)+24)}}}let w=new Array(y),A=new Int32Array(y),D=new Int32Array(y),U=new Int32Array(y),B=new Int32Array(y),F=new Float64Array(y),W=new Float64Array(y),j=new Float64Array(y),Q=new Float64Array(y),Y=new Float64Array(y),ne=new Float64Array(y),q=new Float64Array(C),k=new Float64Array(C),J=new Float64Array(Z),te=new Float64Array(Z),se=Math.round(s*1.25);for(let ge=0;ge\u003Cy;ge++){A[ge]=G.get(E.groupCol[ge]),D[ge]=G.get(E.groupCol[ge]+E.groupCols[ge]-1),U[ge]=K.get(E.groupRow[ge]),B[ge]=K.get(E.groupRow[ge]+E.groupRows[ge]-1);let Le=Ge(m[ge].title,!0,c,s,r?Math.max(80,kt(n)/2):320);w[ge]=Le;let Fe=m[ge].icon?se:0;Y[ge]=Le.width+Fe+(Le.width>0&&Fe>0?6:0),ne[ge]=Math.max(Le.height,Fe)}for(let ge=y-1;ge>=0;ge--){let Le=a+F[ge],Fe=a+W[ge],Ve=(ne[ge]>0?Math.max(a,ne[ge]+12):a)+j[ge],Oe=a+Q[ge];if(Y[ge]>0){let Je=Le+Fe;for(let $e=A[ge];$e\u003C=D[ge];$e++)Je+=oe[$e]+($e\u003CD[ge]?k[$e]+M[$e]+q[$e+1]:0);Y[ge]+20>Je&&(Fe+=Math.ceil(Y[ge]+20-Je))}F[ge]=Le,W[ge]=Fe,j[ge]=Ve,Q[ge]=Oe,q[A[ge]]=Math.max(q[A[ge]],Le),k[D[ge]]=Math.max(k[D[ge]],Fe),J[U[ge]]=Math.max(J[U[ge]],Ve),te[B[ge]]=Math.max(te[B[ge]],Oe);let je=E.groupParent[ge];je\u003C0||(A[je]===A[ge]&&(F[je]=Math.max(F[je],Le)),D[je]===D[ge]&&(W[je]=Math.max(W[je],Fe)),U[je]===U[ge]&&(j[je]=Math.max(j[je],Ve)),B[je]===B[ge]&&(Q[je]=Math.max(Q[je],Oe)))}let re=new Float64Array(C),P=new Float64Array(Z),ee=0;for(let ge=0;ge\u003CC;ge++)re[ge]=ee+q[ge],ee=re[ge]+oe[ge]+k[ge]+(ge\u003CC-1?M[ge]:0);let ae=0;for(let ge=0;ge\u003CZ;ge++)P[ge]=ae+J[ge],ae=P[ge]+H[ge]+te[ge]+(ge\u003CZ-1?T[ge]:0);let ue=0,ce=0,pe=ee,V=ae,X=ge=>re[A[ge]]-F[ge],le=ge=>re[D[ge]]+oe[D[ge]]+W[ge],de=ge=>P[U[ge]]-j[ge],Se=ge=>P[B[ge]]+H[B[ge]]+Q[ge],_e=ge=>re[R[ge]]+oe[R[ge]]/2,xe=(ge,Le,Fe)=>{let Ve=jT[Le],Oe=XT[Le],je=_e(ge),Je=P[_[ge]],$e={x:je,y:Je+h,dx:Ve,dy:Oe,x0:je-x[ge]/2,y0:Je,x1:je+x[ge]/2,y1:Je+I[ge],gap:0,wire:!1};d[ge].type===\\\"junction\\\"?($e.x0=$e.x1=je,$e.y0=$e.y1=$e.y,$e.gap=ib):Ve!==0?$e.x=je+Ve*h:$e.y=Oe\u003C0?Je:Je+I[ge]+(S[ge].height>0?2:0);let Ze=Fe?E.nodeParent[ge]:-1;return Ze>=0&&($e.x0=X(Ze),$e.x1=le(Ze),$e.y0=de(Ze),$e.y1=Se(Ze),$e.gap=0,$e.wire=d[ge].type===\\\"junction\\\",Ve!==0?$e.x=Ve\u003C0?$e.x0:$e.x1:$e.y=Oe\u003C0?$e.y0:$e.y1),$e},Me=\\\"\\\",Ce=\\\"\\\",ke=[],be=Rt(\\\"arrow_point\\\");for(let ge=0;ge\u003C$;ge++){let Le=e.edges[ge],Fe=N[ge*2],Ve=N[ge*2+1];if(Fe\u003C0||Ve\u003C0)continue;let Oe=xe(Fe,qo(Le.lhsDir),Le.lhsGroup),je=xe(Ve,qo(Le.rhsDir),Le.rhsGroup);Oe.x===je.x&&Oe.y===je.y&&Oe.dx===je.dx&&(Oe.x-=8*Math.abs(Oe.dy),Oe.y-=8*Math.abs(Oe.dx),je.x+=8*Math.abs(Oe.dy),je.y+=8*Math.abs(Oe.dx));let Je=QT(Oe,je);Oe.wire&&Je.unshift(_e(Fe),P[_[Fe]]+h),je.wire&&Je.push(_e(Ve),P[_[Ve]]+h);let $e=ZT(Je);if($e.length\u003C4)continue;let Ze=Ue(`${Le.lhsId}-${Le.rhsId}`);Me+=`\u003Cg class=\\\"pele-edge\\\" data-id=\\\"${Ze}\\\">\u003Cpath d=\\\"${JT($e,Le.lhsInto&&!Oe.wire?be+Oe.gap:0,Le.rhsInto&&!je.wire?be+je.gap:0)}\\\"/>`+(Le.lhsInto?_t(\\\"arrow_point\\\",Oe.x+Oe.dx*Oe.gap,Oe.y+Oe.dy*Oe.gap,-Oe.dx,-Oe.dy,\\\"var(--_l)\\\"):\\\"\\\")+(Le.rhsInto?_t(\\\"arrow_point\\\",je.x+je.dx*je.gap,je.y+je.dy*je.gap,-je.dx,-je.dy,\\\"var(--_l)\\\"):\\\"\\\")+\\\"\u003C/g>\\\";let tt=-1,mt=-1,dt=-1,Ee=-1,We=g[ge];for(let De=0;De\u003C$e.length;De+=2)ue=Math.min(ue,$e[De]-4),pe=Math.max(pe,$e[De]+4),ce=Math.min(ce,$e[De+1]-4),V=Math.max(V,$e[De+1]+4);for(let De=0;De+3\u003C$e.length;De+=2){let Xe=Math.abs($e[De+1]-$e[De+3])\u003C.01,ze=Math.abs($e[De]-$e[De+2])+Math.abs($e[De+1]-$e[De+3]);Xe||ke.push($e[De],Math.min($e[De+1],$e[De+3]),Math.max($e[De+1],$e[De+3])),ze>mt&&(tt=De,mt=ze),Xe&&ze>Ee&&(dt=De,Ee=ze)}if(We.width>0){let De=Ee>=We.width+8?dt:tt,Xe=($e[De]+$e[De+2])/2,ze=($e[De+1]+$e[De+3])/2,et=We.width+8,Ye=Math.abs($e[De]-$e[De+2])\u003C.01;for(let He of[Oe,je])Xe+et/2\u003C=He.x0||Xe-et/2>=He.x1||ze+We.height/2\u003C=He.y0||ze-We.height/2>=He.y1||(Ye?Xe=Xe>=(He.x0+He.x1)/2?He.x1+et/2+4:He.x0-et/2-4:ze=ze>=(He.y0+He.y1)/2?He.y1+We.height/2+4:He.y0-We.height/2-4);ue=Math.min(ue,Xe-et/2),pe=Math.max(pe,Xe+et/2),ce=Math.min(ce,ze-We.height/2),V=Math.max(V,ze+We.height/2),Ce+=dn(`${Le.lhsId}-${Le.rhsId}`,We,Xe,ze,\\\"\\\",u)}}let Ae=\\\"\\\";for(let ge=0;ge\u003Cy;ge++){let Le=m[ge],Fe=X(ge),Ve=de(ge),Oe=le(ge)-Fe,je=w[ge],Je=\\\"\\\";if(Y[ge]>0){let $e=Ve+ne[ge]+12,Ze=[];for(let Ee=0;Ee\u003Cke.length;Ee+=3)ke[Ee+1]\u003C$e&&ke[Ee+2]>Ve&&ke[Ee]>Fe&&ke[Ee]\u003CFe+Oe&&Ze.push(ke[Ee]);Ze.sort((Ee,We)=>Ee-We),Ze.push(Fe+Oe-4);let tt=Fe+10;for(let Ee of Ze){if(Ee-6-tt>=Y[ge])break;tt=Math.max(tt,Ee+6)}tt+Y[ge]>Fe+Oe-4&&(tt=Fe+10);let mt=Ve+6+ne[ge]/2,dt=tt;Le.icon&&(Je+=ab(Le.icon,tt,mt-se/2,se,u),dt+=se+6),Je+=Ne(je,dt+je.width/2,mt,' class=\\\"pele-cluster-label\\\" fill=\\\"var(--_m)\\\"',u)}Ae+=`\u003Cg class=\\\"pele-cluster\\\" data-id=\\\"${Ue(Le.id)}\\\">\u003Crect x=\\\"${f(Fe)}\\\" y=\\\"${f(Ve)}\\\" width=\\\"${f(Oe)}\\\" height=\\\"${f(Se(ge)-Ve)}\\\" fill=\\\"var(--_a)\\\" fill-opacity=\\\"0.5\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+Je+\\\"\u003C/g>\\\"}let ie=\\\"\\\",me=i*.5,Te=Math.max(6,Math.round(s*.75));for(let ge=0;ge\u003Cp;ge++){let Le=d[ge],Fe=`data-id=\\\"${Ue(Le.id)}\\\" transform=\\\"translate(${f(_e(ge))},${f(P[_[ge]])})\\\"`;if(Le.type===\\\"junction\\\"){ie+=`\u003Cg class=\\\"pele-node pele-junction\\\" ${Fe}>\u003Ccircle cy=\\\"${f(h)}\\\" r=\\\"${ib}\\\" fill=\\\"var(--_l)\\\"/>\u003C/g>`;continue}let Ve=\\\"\\\";if(Le.icon)Ve=ab(Le.icon,-me/2,(i-me)/2,me,u);else if(Le.iconText){let Oe=Ge(Le.iconText,!1,c,Te,i-8),je=Math.max(1,Math.floor((i-4)/(Oe.lineHeight||1)));Ve=Ne(qT(Oe,i-8,je,c),0,h,` class=\\\"pele-icon-text\\\" font-size=\\\"${Te}\\\"`,u)}ie+=`\u003Cg class=\\\"pele-node pele-service\\\" ${Fe}>\u003Crect x=\\\"${f(-h)}\\\" width=\\\"${f(i)}\\\" height=\\\"${f(i)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+Ve+Ne(S[ge],0,i+sb+S[ge].height/2,' class=\\\"pele-label\\\"',u)+\\\"\u003C/g>\\\"}let ye=Ge(e.title,!1,c,s,r?kt(n):4e3,1),we=ye.height>0?ye.height+12:0,Ie=Math.ceil(Math.max(pe-ue,ye.width)+2*l),ve=Math.ceil(V-ce+we+2*l),Pe=Math.round((Ie-(pe-ue))/2-ue),he=Math.round(l+we-ce),Re=(Ae?`\u003Cg class=\\\"pele-clusters\\\">${Ae}\u003C/g>`:\\\"\\\")+(Me?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\">${Me}\u003C/g>`:\\\"\\\")+(Ce?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${o}\\\">${Ce}\u003C/g>`:\\\"\\\")+(ie?`\u003Cg class=\\\"pele-nodes\\\">${ie}\u003C/g>`:\\\"\\\");return{svg:at(\\\"architecture\\\",Ie,ve,s,n,e,Ne(ye,Ie/2,l+ye.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(Re?`\u003Cg transform=\\\"translate(${Pe},${he})\\\">${Re}\u003C/g>`:\\\"\\\")),width:Ie,height:ve,links:[]}}var lb={type:\\\"architecture\\\",parse(e,t,n){let r=new Oc;return n&&(r.title=n),Xg(Jg(e),r),r},render:cb};var db=1e5;function t2(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\\\"\u003C[]>\\\":return\\\"block_arrow\\\";default:return\\\"na\\\"}}function n2(e){switch(e.trim().slice(-1)){case\\\"x\\\":return\\\"arrow_cross\\\";case\\\"o\\\":return\\\"arrow_circle\\\";case\\\">\\\":return\\\"arrow_point\\\";default:return\\\"\\\"}}function r2(e){switch(e.trim().charAt(0)){case\\\"x\\\":return\\\"arrow_cross\\\";case\\\"o\\\":return\\\"arrow_circle\\\";case\\\"\u003C\\\":return\\\"arrow_point\\\";default:return\\\"arrow_open\\\"}}function s2(e){return e.includes(\\\"==\\\")?\\\"thick\\\":\\\"normal\\\"}function i2(e){return e.includes(\\\".-\\\")?\\\"dotted\\\":\\\"solid\\\"}function ub(e,t){let n=e.flat(),r=-1;for(let i of n)if(i.type===\\\"column-setting\\\"){r=i.columns??-1;break}return{list:n,at:0,parent:t,children:[],columns:r}}var Pc=class{constructor(t={}){fe(this,\\\"type\\\",\\\"block\\\");fe(this,\\\"title\\\");fe(this,\\\"root\\\",{id:\\\"root\\\",type:\\\"composite\\\",children:[],columns:-1});fe(this,\\\"blocks\\\",[]);fe(this,\\\"edges\\\",[]);fe(this,\\\"classes\\\",new Map);fe(this,\\\"byId\\\",new Map);fe(this,\\\"typeStr2Type\\\",t2);fe(this,\\\"edgeStrToEdgeData\\\",n2);fe(this,\\\"edgeStrToEdgeStartData\\\",r2);fe(this,\\\"edgeStrToThickness\\\",s2);fe(this,\\\"edgeStrToPattern\\\",i2);fe(this,\\\"warn\\\");fe(this,\\\"pending\\\",new Set);fe(this,\\\"edgeCount\\\",new Map);fe(this,\\\"ids\\\",0);fe(this,\\\"colors\\\",0);fe(this,\\\"spaces\\\",0);this.warn=t.warn}generateId(){return\\\"id-\\\"+ ++this.ids}addStyleClass(t,n=\\\"\\\"){let r=this.classes.get(t);r||(r={id:t,styles:[],textStyles:[]},this.classes.set(t,r));for(let i of n.split(\\\",\\\")){let s=i.indexOf(\\\";\\\"),a=(s===-1?i:i.slice(0,s)+i.slice(s+1)).trim();i.includes(\\\"color\\\")&&r.textStyles.push(a.replace(\\\"fill\\\",\\\"bgFill\\\").replace(\\\"color\\\",\\\"fill\\\")),r.styles.push(a)}}addStyle2Node(t,n=\\\"\\\"){this.named(t).styles=n.split(\\\",\\\")}setCssClass(t,n){for(let r of t.split(\\\",\\\"))(this.named(r.trim()).classes??=[]).push(n)}named(t){let n=this.byId.get(t);return n===void 0&&(n={id:t,type:\\\"na\\\",children:[]},this.byId.set(t,n),this.pending.add(t)),n}setHierarchy(t){let n=[ub(t,this.root)];for(;n.length>0;){let r=n[n.length-1];if(r.at===r.list.length){r.parent.children=r.children,n.pop();continue}let i=r.list[r.at++];switch(r.columns>0&&i.type!==\\\"column-setting\\\"&&typeof i.widthInColumns==\\\"number\\\"&&i.widthInColumns>r.columns&&this.warn?.(`Block ${i.id} width ${i.widthInColumns} exceeds configured column width ${r.columns}`),i.type){case\\\"classDef\\\":this.addStyleClass(i.id,i.css);continue;case\\\"applyClass\\\":this.setCssClass(i.id,i.styleClass??\\\"\\\");continue;case\\\"applyStyles\\\":i.stylesStr&&this.addStyle2Node(i.id,i.stylesStr);continue;case\\\"column-setting\\\":r.parent.columns=i.columns??-1;continue;case\\\"edge\\\":{let c=(this.edgeCount.get(i.id)??0)+1;this.edgeCount.set(i.id,c),i.id=c+\\\"-\\\"+i.id,this.edges.push(i);continue}}i.id??=this.generateId(),i.label||(i.label=i.type===\\\"composite\\\"?\\\"\\\":i.id);let s=this.byId.get(i.id),a=s===void 0||this.pending.delete(i.id);a?(s&&(i.classes=s.classes,i.styles=s.styles),i.type===\\\"composite\\\"&&(i.colorIndex=this.colors++),this.byId.set(i.id,i)):(i.type!==\\\"na\\\"&&(s.type=i.type),i.label!==i.id&&(s.label=i.label));let o=i.children;if(i.children=[],i.type===\\\"space\\\"){let c=i.width??1;if(!(c\u003C=db-this.spaces))throw new Qe(`A block diagram can hold at most ${db} space blocks.`,\\\"limit\\\",{type:\\\"block\\\"});this.spaces+=Math.max(c,0);for(let l=0;l\u003Cc;l++){let u={...i,id:i.id+\\\"-\\\"+l,children:[]};this.byId.set(u.id,u),r.children.push(u)}}else a&&r.children.push(i);o&&o.length>0&&n.push(ub(o,i))}this.blocks=this.root.children??[]}};var Ju=[\\\"$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\\\"];var o2=[\\\"right\\\",\\\"left\\\",\\\"x\\\",\\\"y\\\",\\\"up\\\",\\\"down\\\"],fb=new Uint8Array(128);for(let e of[9,10,11,12,13,32,40,41,45,58,60,61,62,91,123,125])fb[e]=1;function hb(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=(K,C,Z)=>(n.push(K),r.push(C),i.push(o),o=Z,!0),l=(K,C)=>c(K,e.slice(o,C),C),u=K=>{s.push(a),a=K},h=()=>{s.length>0&&(a=s.pop())},d=K=>{for(;K\u003Ct&&qe(e.charCodeAt(K));)K++;return K},m=K=>{for(;K\u003Ct;){let C=e.charCodeAt(K);if(C\u003C48||C>57)break;K++}return K},p=K=>{for(;K\u003Ct&&ot(e.charCodeAt(K));)K++;return K},y=K=>e.startsWith(K,o)&&!ot(e.charCodeAt(o+K.length)),E=()=>(e.charCodeAt(o+1)===96?(u(2),o+=2):(u(1),o++),!0),b=K=>{if(e.charCodeAt(K)!==46)return-1;do K++;while(e.charCodeAt(K)===46);if(e.charCodeAt(K)!==45)return-1;let C=e.charCodeAt(K+1);return C===120||C===111||C===62?K+2:K+1},S=K=>{let C=e.charCodeAt(K);(C===120||C===111||C===60)&&K++;let Z=e.charCodeAt(K);if(Z===46)return b(K);if(Z!==45&&Z!==61)return-1;let oe=K+1;for(;e.charCodeAt(oe)===Z;)oe++;if(oe-K===1)return Z===45?b(oe):-1;let H=e.charCodeAt(oe);return H===120||H===111||H===62?oe+1:oe-K>=3?oe:-1},x=()=>{let K=S(o);if(K>=0)return l(33,d(K));let C=e.charCodeAt(o)===60?o+1:o,Z=e.charCodeAt(C),oe=e.charCodeAt(C+1);return Z===45&&(oe===45||oe===46)||Z===61&&oe===61?(u(6),l(34,d(C+2))):!1},I=K=>{let C=e.indexOf(`\\r\\n`,o);return C===-1&&(C=t),h(),l(K,C)},L=(K,C)=>{let Z=p(o);if(Z===o)return!1;for(;e.charCodeAt(Z)===44;){let oe=d(Z+1),H=p(oe);if(H===oe)break;Z=H}return a=C,l(K,Z)},O=K=>{if(qe(K))return o=d(o+1),!0;let C;switch(K){case 98:if(e.startsWith(\\\"block\\\",o)){if(y(\\\"block-beta\\\"))return l(2,o+10);if(e.charCodeAt(o+5)===58)return l(3,o+6);if(!ot(e.charCodeAt(o+5)))return l(2,o+5)}break;case 99:if(e.startsWith(\\\"columns\\\",o)){if(C=d(o+7),C>o+7){if(e.startsWith(\\\"auto\\\",C)&&!ot(e.charCodeAt(C+4)))return c(4,\\\"-1\\\",C+4);let Z=m(C);if(Z>C)return c(4,e.slice(C,Z),Z)}}else if(e.startsWith(\\\"class\\\",o)){let Z=e.startsWith(\\\"Def\\\",o+5),oe=Z?o+8:o+5;if(C=d(oe),C>oe)return u(Z?7:9),l(Z?11:15,C)}break;case 34:return E();case 115:if(e.startsWith(\\\"space\\\",o)){if(e.charCodeAt(o+5)===58){let Z=m(o+6);if(Z>o+6)return c(7,e.slice(o+6,Z),Z)}if(!ot(e.charCodeAt(o+5)))return c(7,\\\"1\\\",o+5)}else if(e.startsWith(\\\"style\\\",o)&&(C=d(o+5),C>o+5))return u(11),l(18,C);break;case 100:if(y(\\\"default\\\"))return l(8,o+7);break;case 108:if(y(\\\"linkStyle\\\"))return l(9,o+9);break;case 105:if(y(\\\"interpolate\\\"))return l(10,o+11);break;case 97:if(e.startsWith(\\\"accTitle\\\",o)){if(C=d(o+8),e.charCodeAt(C)===58)return u(13),l(21,d(C+1))}else if(e.startsWith(\\\"accDescr\\\",o)){C=d(o+8);let Z=e.charCodeAt(C);if(Z===58)return u(14),l(23,d(C+1));if(Z===123)return u(15),o=d(C+1),!0}break;case 101:if(y(\\\"end\\\"))return l(26,d(o+3));break;case 45:return e.charCodeAt(o+1)===41?(u(3),l(27,o+2)):x();case 61:return x();case 60:return e.charCodeAt(o+1)===91?(u(4),l(29,o+2)):x();case 40:{let Z=e.charCodeAt(o+1),oe=Z===45||Z===91?2:Z===40?e.charCodeAt(o+2)===40?3:2:1;return u(3),l(27,o+oe)}case 41:case 123:return u(3),l(27,e.charCodeAt(o+1)===K?o+2:o+1);case 62:return u(3),l(27,o+1);case 91:{let Z=e.charCodeAt(o+1);return u(3),l(27,Z===91||Z===124||Z===40||Z===92||Z===47?o+2:o+1)}case 58:{let Z=m(o+1);return Z>o+1?c(36,e.slice(o+1,Z),Z):!1}}for(C=o;C\u003Ct;){let Z=e.charCodeAt(C);if(Z\u003C128?fb[Z]===1:qe(Z))break;C++}return C>o&&l(32,C)},v=K=>{let C=e.charCodeAt(o+1),Z=0;switch(K){case 34:return E();case 40:Z=C===45?2:C===40?e.charCodeAt(o+2)===40?3:2:1;break;case 41:Z=C===41?e.charCodeAt(o+2)===41?3:2:C===93?2:1;break;case 125:Z=C===125?2:1;break;case 45:Z=C===41?2:0;break;case 93:Z=C===93||C===41||C===62?2:1;break;case 92:case 47:Z=C===93?2:0;break}return Z===0?!1:(h(),l(28,o+Z))},G=K=>{if(K===41)return h(),h(),c(30,\\\"]>\\\",d(o+1));let C=d(K===44?o+1:o);for(let Z of o2)if(e.startsWith(Z,C)){let oe=d(C+Z.length);return c(31,e.slice(K===44?C:o,oe),oe)}return!1};for(;;){if(o>=t){let Z=-1;switch(a){case 0:Z=37;break;case 1:Z=6;break;case 8:Z=14;break;case 10:Z=17;break;case 12:Z=20;break;case 13:Z=22;break;case 14:Z=24;break;case 15:Z=25;break}o=t,Z!==-1&&c(Z,\\\"\\\",t);break}let K=e.charCodeAt(o),C=!0;switch(a){case 0:C=O(K);break;case 1:if(K===34)h(),o++;else{let Z=e.indexOf('\\\"',o);l(6,Z===-1?t:Z)}break;case 2:if(K===96)C=e.charCodeAt(o+1)===34,C&&(h(),o+=2);else if(K===34)C=!1;else{let Z=o+1;for(;Z\u003Ct;){let oe=e.charCodeAt(Z);if(oe===96||oe===34)break;Z++}l(5,Z)}break;case 3:C=v(K);break;case 4:if(K===34)E();else if(K===93&&e.charCodeAt(o+1)===62){let Z=d(o+2);C=e.charCodeAt(Z)===40,C&&(u(5),o=Z+1)}else C=!1;break;case 5:C=G(K);break;case 6:if(K===34)e.charCodeAt(o+1)===96?E():(l(35,o+1),u(1));else{let Z=S(d(o));C=Z>=0,C&&(h(),l(33,d(Z)))}break;case 7:{let Z=12,oe=e.startsWith(\\\"DEFAULT\\\",o)?o+7:o,H=d(oe);(oe===o||H===oe)&&(Z=13,oe=p(o),H=d(oe)),C=oe>o&&H>oe,C&&(a=8,l(Z,H));break}case 8:I(14);break;case 9:C=L(16,10);break;case 10:I(17);break;case 11:C=L(19,12);break;case 12:I(20);break;case 13:I(22);break;case 14:I(24);break;case 15:if(K===125)h(),o++;else{let Z=e.indexOf(\\\"}\\\",o);l(25,Z===-1?t:Z)}break}if(!C)return n.push(1),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i}}return n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i}}var Qo=\\\"'NODE_ID', 'COLUMNS', 'SPACE_BLOCK', 'BLOCK_DIAGRAM_KEY', 'id-block', 'classDef', 'class', 'style'\\\";function pb(e){let t=e[e.length-1];return Array.isArray(t)?(e.pop(),e.concat(t)):e}function mb(e,t){let{types:n,texts:r,starts:i}=hb(e),s=0,a=d=>{let m=n[s];throw m===1?ft(\\\"block\\\",e,i[s],\\\"\\\",!0):ft(\\\"block\\\",e,i[s],`Expecting ${d}, got '${Ju[m]}'`)},o=d=>(n[s]!==d&&a(`'${Ju[d]}'`),r[s++]),c=()=>{let d=o(32);if(n[s]===27){let m=r[s++],p=o(6);return{id:d,label:p,typeStr:m+o(28)}}if(n[s]===29){let m=r[s++],p=o(6),y=[o(31)];for(;n[s]===31;)y.push(r[s++]);return{id:d,label:p,typeStr:m+o(30),directions:y}}return{id:d}},l=()=>{let d=c(),m=n[s]===36?parseInt(r[s++],10):1,p={id:d.id,label:d.label,type:t.typeStr2Type(d.typeStr),directions:d.directions,widthInColumns:m},y;for(;n[s]===33||n[s]===34;){let E=\\\"\\\";n[s++]===34&&(o(35),E=o(6),o(33));let b=r[s-1],S=c(),x=t.edgeStrToEdgeData(b),I=t.edgeStrToEdgeStartData(b),L=t.edgeStrToThickness(b),O=t.edgeStrToPattern(b);y??=[{id:p.id,label:p.label,type:p.type,directions:p.directions}],p={id:S.id,label:S.label,type:t.typeStr2Type(S.typeStr),directions:S.directions},y.push({id:y[y.length-1].id+\\\"-\\\"+S.id,start:y[y.length-1].id,end:S.id,label:E,type:\\\"edge\\\",thickness:L,pattern:O,directions:S.directions,arrowTypeEnd:x,arrowTypeStart:I},p)}return y??p};o(2);let u=[],h=[];for(;;)switch(n[s]){case 32:h.push(l());break;case 4:h.push({type:\\\"column-setting\\\",columns:parseInt(r[s++],10)});break;case 7:{let d=parseInt(r[s++],10);h.push({id:t.generateId(),type:\\\"space\\\",label:\\\"\\\",width:d,children:[]});break}case 2:s++,u.push({list:h,header:void 0}),h=[];break;case 3:s++,n[s]!==32&&a(\\\"'NODE_ID'\\\"),u.push({list:h,header:l()}),h=[];break;case 26:{let d=u.pop();if(d===void 0||h.length===0)return a(Qo);s++;let m=t.generateId(),p=pb(h);h=d.list,h.push(d.header===void 0?{id:m,type:\\\"composite\\\",label:\\\"\\\",children:p}:{...d.header,type:\\\"composite\\\",children:p});break}case 11:{s++;let d=o(13).trim();h.push({type:\\\"classDef\\\",id:d,css:o(14).trim()});break}case 15:{s++;let d=o(16).trim();h.push({type:\\\"applyClass\\\",id:d,styleClass:o(17).trim()});break}case 18:{s++;let d=o(19).trim();h.push({type:\\\"applyStyles\\\",id:d,stylesStr:o(20).trim()});break}case 37:u.length>0&&a(Qo+\\\", 'end'\\\"),h.length===0&&a(Qo),t.setHierarchy(pb(h));return;default:a(h.length===0?Qo:Qo+(u.length>0?\\\", 'end'\\\":\\\", 'EOF'\\\"))}}function yn(e,t,n,r){return lm(()=>Ge(e,!1,t,n,r,1))}function Fc(e,t,n,r,i,s,a){let o=yn(e,t,n,4e3);if(o.height===0)return{width:i,height:s,content:a};let c=o.height+12,l=Math.max(i,Math.ceil(o.width+2*r));return{width:l,height:Math.ceil(s+c),content:Ne(o,l/2,r+o.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg transform=\\\"translate(${f((l-i)/2)},${f(c)})\\\">${a}\u003C/g>`}}var $r=1,Lr=2,Or=4,Dr=8,qs=7,Bc=20,Es=12;function gb(e){let t=0;if(e)for(let n of e)switch(n.trim()){case\\\"right\\\":t|=$r;break;case\\\"left\\\":t|=Lr;break;case\\\"up\\\":t|=Or;break;case\\\"down\\\":t|=Dr;break;case\\\"x\\\":t|=$r|Lr;break;case\\\"y\\\":t|=Or|Dr;break}return t}var ys=(e,t)=>e&t?1:0;function Zo(e){return e!==0&&(e&(Or|Dr))===0?\\\"x\\\":e!==0&&(e&($r|Lr))===0?\\\"y\\\":\\\"\\\"}function ef(e,t,n){let r=Zo(e),i=ys(e,Lr)-ys(e,$r),s=ys(e,Or)-ys(e,Dr);if(r===\\\"x\\\"){let a=Math.max(n+8,14)+2*qs,o=Math.min(a/2,Bc);return{w:Math.max(t+12,16)+o*(e===($r|Lr)?2:1),h:a,dx:i*o/2,dy:0}}if(r===\\\"y\\\"){let a=Math.max(t+16,14)+2*qs,o=Math.min(a/2,Bc);return{w:a,h:Math.max(n+8,16)+o*(e===(Or|Dr)?2:1),dx:0,dy:s*o/2}}return{w:Math.max(t+16,24)+Es*(ys(e,Lr)+ys(e,$r)),h:Math.max(n+8,24)+Es*(ys(e,Or)+ys(e,Dr)),dx:i*Es/2,dy:s*Es/2}}function bb(e,t,n,r){let i=Zo(e),s=t/2,a=n/2,o;if(i===\\\"x\\\"){let l=Math.min(a,Bc),u=a-qs,h=e&Lr?-s+l:-s,d=e&$r?s-l:s;o=[h,-u,d,-u],e&$r&&o.push(d,-a,s,0,d,a),o.push(d,u,h,u),e&Lr&&o.push(h,a,-s,0,h,-a)}else if(i===\\\"y\\\"){let l=Math.min(s,Bc),u=s-qs,h=e&Or?-a+l:-a,d=e&Dr?a-l:a;o=[u,h,u,d],e&Dr&&o.push(s,d,0,a,-s,d),o.push(-u,d,-u,h),e&Or&&o.push(-s,h,0,-a,s,h)}else{let l=e&Lr?-s+Es:-s,u=e&$r?s-Es:s,h=e&Or?-a+Es:-a,d=e&Dr?a-Es:a,m=(l+u)/2,p=(h+d)/2,y=Math.min(10,(u-l)/2),E=Math.min(10,(d-h)/2);o=[l,h],e&Or&&o.push(m-y,h,m,-a,m+y,h),o.push(u,h),e&$r&&o.push(u,p-E,s,p,u,p+E),o.push(u,d),e&Dr&&o.push(m+y,d,m,a,m-y,d),o.push(l,d),e&Lr&&o.push(l,p+E,-s,p,l,p-E)}let c=\\\"\\\";for(let l=0;l\u003Co.length;l+=2)c+=(l?\\\" \\\":\\\"\\\")+f(o[l])+\\\",\\\"+f(o[l+1]);return`\u003Cpolygon points=\\\"${c}\\\" stroke-linejoin=\\\"round\\\"${r}/>`}var a2=1e3;function c2(e,t){if(e===0||!Number.isInteger(e))throw new Qe(\\\"Columns must be an integer !== 0.\\\",\\\"semantic\\\",{type:\\\"block\\\"});if(t\u003C0||!Number.isInteger(t))throw new Qe(\\\"Position must be a non-negative integer.\\\"+t,\\\"semantic\\\",{type:\\\"block\\\"});return e\u003C0?{px:t,py:0}:{px:t%e,py:Math.floor(t/e)}}function l2(e,t,n){let r=e.columns,i=[],s=0,a=0,o=0,c=0;for(let u of e.children){let{px:h,py:d}=c2(r,s),m=u.span>=1?Math.min(u.span,a2):1;if(r>0&&m>r-h&&(m=r-h),u.span=m,u.col=h,u.row=d,s+=m,h+m>a&&(a=h+m),d===i.length&&i.push(0),u.children.length===0?i[d]=-1:i[d]>=0&&u.nh>i[d]&&(i[d]=u.nh),u.space)continue;let p=(u.nw-t*(m-1))/m;p>o&&(o=p),u.nh>c&&(c=u.nh)}let l=(i.length-1)*t+Wc(e.rowGaps);for(let u=0;u\u003Ci.length;u++)i[u]\u003C0&&(i[u]=c),l+=i[u];e.cols=a,e.heights=i,e.nw=Math.max(e.nw,a*o+(a-1)*t+Wc(e.colGaps)+2*n),e.nh=l+2*n+e.head}function d2(e,t,n){let{cols:r,heights:i,rowGaps:s,colGaps:a}=e,o=i.length,c=(e.w-2*n-(r-1)*t-Wc(a))/r,l=e.h-2*n-e.head-(o-1)*t-Wc(s),u=[];if(a.length>0){let b=0;for(let S=0;S\u003Cr;S++)u.push(b),b+=a[S]??0}let h=0;for(let b of i)h+=b;let d=h>0?l/h:0,m=h>0?0:l/o,p=e.x-e.w/2+n,y=e.y-e.h/2+n+e.head,E=0;for(let b of e.children){for(;E\u003Cb.row;E++)y+=i[E]*d+m+t+(s[E]??0);let S=u[b.col]??0;b.w=c*b.span+t*(b.span-1)+(u[b.col+b.span-1]??0)-S,b.h=i[E]*d+m,b.x=p+b.col*(c+t)+S+b.w/2,b.y=y+b.h/2}}function Wc(e){let t=0;for(let n of e)t+=n??0;return t}function yb(e,t){let n=[e];for(let r=0;r\u003Cn.length;r++)for(let i of n[r].children)n.push(i);for(let r=n.length-1;r>=0;r--){let i=n[r];i.children.length>0&&l2(i,t,r===0?0:t)}e.w=e.nw,e.h=e.nh,e.x=e.w/2,e.y=e.h/2;for(let r=0;r\u003Cn.length;r++){let i=n[r];i.children.length>0&&d2(i,t,r===0?0:t)}return{width:e.w,height:e.h}}var u2=12,Eb=200,f2=8,xb=' fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"',h2=' stroke=\\\"var(--_b)\\\"',Ab=[],p2=[],m2=[],zi=[],g2=[\\\"default\\\"],Sb=2e6,tf=4,b2=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\\\"]]),wb=new Set([\\\"circle\\\",\\\"dbl-circ\\\",\\\"diam\\\"]),y2=new Set([\\\"stadium\\\",\\\"hex\\\",\\\"odd\\\",\\\"lean-r\\\",\\\"lean-l\\\",\\\"trap-b\\\",\\\"trap-t\\\"]);function Uc(e){return e.kind===0&&(e.shape===\\\"circle\\\"||e.shape===\\\"dbl-circ\\\")}function Hi(e,t,n){let r=e.bw/2,i=e.bh/2,s=Math.abs(t-e.x),a=i;return Uc(e)?a=Math.sqrt(Math.max(r*r-s*s,0)):e.kind===0&&e.shape===\\\"diam\\\"?a=i*Math.max(1-s/r,0):e.kind===0?a=i-Qr(e.shape,e.bw,e.bh,n>0?2:0):e.kind===1&&Zo(e.mask)===\\\"x\\\"&&(a=i-qs),e.y+n*a}function Ki(e,t,n){let r=e.bw/2,i=e.bh/2,s=Math.abs(t-e.y),a=r;return Uc(e)?a=Math.sqrt(Math.max(i*i-s*s,0)):e.kind===0&&e.shape===\\\"diam\\\"?a=r*Math.max(1-s/i,0):e.kind===0?a=r-Qr(e.shape,e.bw,e.bh,n>0?1:3):e.kind===1&&Zo(e.mask)===\\\"y\\\"&&(a=r-qs),e.x+n*a}function _b(e,t,n,r){let i=t-e.x,s=n-e.y,a=e.bw/2,o=e.bh/2,c;Uc(e)?c=a/(Math.hypot(i,s)||1):e.kind===0&&e.shape===\\\"diam\\\"?c=1/(Math.abs(i)/a+Math.abs(s)/o||1):c=Math.min(i===0?1/0:a/Math.abs(i),s===0?1/0:o/Math.abs(s)),c===1/0&&(c=0),r.push(e.x+i*c,e.y+s*c)}function E2(e,t,n,r,i){let s=i.x-i.bw/2+1,a=i.x+i.bw/2-1,o=i.y-i.bh/2+1,c=i.y+i.bh/2-1;if(e\u003Cs&&n\u003Cs||e>a&&n>a||t\u003Co&&r\u003Co||t>c&&r>c)return!1;if(e===n||t===r)return!0;let l=n-e,u=r-t,h=(m,p)=>Math.sign(l*(p-t)-u*(m-e)),d=h(s,o);return d===0||h(a,o)!==d||h(a,c)!==d||h(s,c)!==d}function nf(e,t,n,r){let i=0;for(let s of r)if(!(s===t||s===n)){for(let a=0;a+3\u003Ce.length;a+=2)if(E2(e[a],e[a+1],e[a+2],e[a+3],s)){i++;break}}return i}function x2(e,t,n,r){let i=e.x-e.bw/2,s=e.x+e.bw/2,a=e.y-e.bh/2,o=e.y+e.bh/2,c=t.x-t.bw/2,l=t.x+t.bw/2,u=t.y-t.bh/2,h=t.y+t.bh/2,d=Math.max(i,c),m=Math.min(s,l),p=Math.max(a,u),y=Math.min(o,h),E=m-d>6,b=y-p>6;if(E&&b){let oe=e.bw*e.bh\u003C=t.bw*t.bh?e:t,H=oe===e?t:e,z=oe.y-oe.bh/2-(H.y-H.bh/2),M=H.y+H.bh/2-(oe.y+oe.bh/2),T=oe.x-oe.bw/2-(H.x-H.bw/2),R=H.x+H.bw/2-(oe.x+oe.bw/2),_=Math.min(z,M,T,R),$;return _===M?$=[oe.x,Hi(oe,oe.x,1),oe.x,H.y+H.bh/2]:_===z?$=[oe.x,Hi(oe,oe.x,-1),oe.x,H.y-H.bh/2]:_===R?$=[Ki(oe,oe.y,1),oe.y,H.x+H.bw/2,oe.y]:$=[Ki(oe,oe.y,-1),oe.y,H.x-H.bw/2,oe.y],oe===e?$:[$[2],$[3],$[0],$[1]]}if(E){let oe=Math.min(6,(m-d)/2),H=Math.min(Math.max((d+m)/2+n,d+oe),m-oe),z=t.y>e.y?1:-1;return[H,Hi(e,H,z),H,Hi(t,H,-z)]}if(b){let oe=Math.min(6,(y-p)/2),H=Math.min(Math.max((p+y)/2+n,p+oe),y-oe),z=t.x>e.x?1:-1;return[Ki(e,H,z),H,Ki(t,H,-z),H]}let S=t.x>e.x?1:-1,x=t.y>e.y?1:-1,I=[Ki(e,e.y,S),e.y,t.x,e.y,t.x,Hi(t,t.x,-x)],L=[e.x,Hi(e,e.x,x),e.x,t.y,Ki(t,t.y,-S),t.y],O=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y),v=O?I:L;if(r===void 0)return v;let G=nf(v,e,t,r);if(G===0)return v;let K=O?L:I,C=nf(K,e,t,r);if(C\u003CG&&(v=K,G=C),G===0)return v;let Z=[];return _b(e,t.x,t.y,Z),_b(t,e.x,e.y,Z),nf(Z,e,t,r)\u003CG?Z:v}function A2(e,t,n){let r=e.length,i=e[0],s=e[1],a=e[r-2],o=e[r-1],c=e[2]-i,l=e[3]-s,u=Math.hypot(c,l);c/=u||1,l/=u||1;let h=a-e[r-4],d=o-e[r-3],m=Math.hypot(h,d);if(h/=m||1,d/=m||1,r===4&&t+n>u){let y=u/(t+n);t*=y,n*=y}t=Math.min(t,u),n=Math.min(n,m);let p=`M${f(i+c*t)},${f(s+l*t)}`;if(r===6){let y=Math.max(0,Math.min(f2,u-t,m-n));p+=`L${f(e[2]-c*y)},${f(e[3]-l*y)}Q${f(e[2])},${f(e[3])} ${f(e[2]+h*y)},${f(e[3]+d*y)}`}return p+=`L${f(a-h*n)},${f(o-d*n)}`,{d:p,sx:i,sy:s,sdx:-c,sdy:-l,ex:a,ey:o,edx:h,edy:d}}function rf(e,t){let n=e.bw/2,r=e.bh/2,i=Math.max(1,Math.min(10+5*(t-1),n,r));if(Uc(e)){let s=e.x+n*Math.SQRT1_2,a=e.y-n*Math.SQRT1_2,o=2*Math.asin(Math.min(1,i/(2*n))),c=l=>Math.atan2(e.y-n*Math.sin(l)-a,e.x+n*Math.cos(l)-s);return[s,a,i,c(Math.PI/4+o),c(Math.PI/4-o)]}if(e.kind===0&&e.shape===\\\"diam\\\"){let s=Math.atan2(r,n);return[e.x+n/2,e.y-r/2,i,s+Math.PI,s]}return[e.x+n,e.y-r,i,Math.PI,Math.PI/2]}function S2(e,t,n,r){let[i,s,a,o,c]=rf(e,t),l=o+n/a,u=c-r/a,h=(u-l)%(2*Math.PI);h\u003C=0&&(h+=2*Math.PI);let d=i+a*Math.cos(l),m=s+a*Math.sin(l),p=i+a*Math.cos(u),y=s+a*Math.sin(u),E=i+a*Math.cos(o),b=s+a*Math.sin(o),S=i+a*Math.cos(c),x=s+a*Math.sin(c),I=Math.hypot(E-d,b-m),L=Math.hypot(S-p,x-y);return{d:`M${f(d)},${f(m)}A${f(a)},${f(a)} 0 ${h>Math.PI?1:0} 1 ${f(p)},${f(y)}`,sx:E,sy:b,sdx:I>0?(E-d)/I:Math.sin(o),sdy:I>0?(b-m)/I:-Math.cos(o),ex:S,ey:x,edx:L>0?(S-p)/L:-Math.sin(c),edy:L>0?(x-y)/L:Math.cos(c)}}var w2=[.5,.3,.7,.15,.85];function Rb(e,t,n,r,i,s,a){if(a===void 0)return!1;for(let o of a)if(o!==i&&o!==s&&Math.abs(e-o.x)\u003C(n+o.bw)/2&&Math.abs(t-o.y)\u003C(r+o.bh)/2)return!0;return!1}function _2(e,t,n,r,i,s,a){if(a===void 0)return .5;for(let o of w2){let c=e[t]+(e[t+2]-e[t])*o,l=e[t+1]+(e[t+3]-e[t+1])*o;if(!Rb(c,l,n,r,i,s,a))return o}return .5}function R2(e,t,n,r,i,s){let a=n[e[0]][0]===n[e[0]][2],o=-1/0,c=1/0,l=-tf,u=!1;for(let m=0;m\u003Ce.length;m++){let p=n[e[m]];if(a?p[0]!==p[2]:p[1]!==p[3])return 0;o=Math.max(o,a?Math.min(p[1],p[3]):Math.min(p[0],p[2])),c=Math.min(c,a?Math.max(p[1],p[3]):Math.max(p[0],p[2]));let y=t[e[m]];l+=(a?y.label.height:y.label.width+8)+tf;for(let E=0;E\u003Cm;E++){let b=t[e[E]];Math.abs(y.lx-b.lx)\u003C(y.label.width+b.label.width)/2+8&&Math.abs(y.ly-b.ly)\u003C(y.label.height+b.label.height)/2&&(u=!0)}}if(!u)return 0;if(l>c-o-2*Lt)return l-(c-o-2*Lt);let h=[],d=(o+c-l)/2;for(let m of e){let{label:p,lx:y,ly:E}=t[m],b=a?p.height:p.width+8,S=d+b/2;if(Rb(a?y:S,a?S:E,p.width+8,p.height,r,i,s))return 0;h.push(S),d+=b+tf}return e.forEach((m,p)=>{a?t[m].ly=h[p]:t[m].lx=h[p]}),0}function T2(e,t,n,r,i,s){let a=new Set;for(let d=t;d!==void 0;d=e[d.index])a.add(d);let o,c=n;for(;c!==void 0&&!a.has(c);)o=c,c=e[c.index];if(c===void 0||o===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===o.row)return!1;u=Math.max(l.row,o.row)-1,c.rowGaps===zi&&(c.rowGaps=[])}else{let[d,m]=l.col\u003Co.col?[l,o]:[o,l];if(m.col\u003Cd.col+d.span)return!1;u=m.col-1,c.colGaps===zi&&(c.colGaps=[])}let h=r?c.rowGaps:c.colGaps;return s.has(h)||s.set(h,h.slice()),h[u]=Math.max(h[u]??0,(s.get(h)[u]??0)+i),!0}function Tb(e,t,n){return An(n,r=>M2(e,t,n,r))}function M2(e,t,n,r){let i=n.fontSize??16,s=Math.round(i*.875),a=n.measurer??ct(n.fontFamily,n.fontFamilyMono),o=n.padding??8,c=n.icons,l=t.block?.padding,u=Math.min(typeof l==\\\"number\\\"&&l>=0?Math.min(l,200):u2,r?6:1/0),h=r?80:Eb,d=re=>{let P=[],ee=ae=>{for(let ue of ae)for(let ce of ue.split(\\\";\\\"))P.push(ce)};for(let ae of re.classes&&re.classes.length>0?re.classes:g2){let ue=e.classes.get(ae);ue&&ee(ue.styles)}return re.styles&&ee(re.styles),Ct(P)},m=(re,P)=>{let ee=re.type,ae=ee===\\\"space\\\"?Ct(Ab):d(re),ue=(ae.bold?1:0)|(ae.italic?2:0),ce=ae.fontSize??i,pe=0,V=\\\"\\\",X,le=0,de=0,Se=0,_e=0,xe=0,Me=0;if(ee===\\\"space\\\")pe=3,X=Ge(void 0,!1,a,ce,h);else if(ee===\\\"composite\\\")pe=2,X=Ge(re.label,!1,a,ce,r?kt(n):4e3,ue),Se=X.height>0?X.height+4:0,le=X.width+2*u,de=Se+2*u;else if(ee===\\\"block_arrow\\\"){pe=1,X=Ge(re.label,!1,a,ce,h,ue);let Ce=!0;for(let be of X.lines)for(let Ae of be)(Ae.icon!==void 0||Ae.text.trim()!==\\\"\\\")&&(Ce=!1);_e=gb(re.directions);let ke=Ce?ef(_e,0,0):ef(_e,X.width,X.height);le=ke.w,de=ke.h,xe=ke.dx,Me=ke.dy}else{V=b2.get(ee??\\\"\\\")??\\\"rect\\\",X=Ge(re.label,!1,a,ce,h,ue);let Ce=ps(V,X.width,X.height);le=Ce.w,de=V===\\\"cyl\\\"?Math.max(Ce.h,X.height+40):Ce.h,Me=Ce.dy}return{children:[],columns:pe===2?re.columns??-1:-1,span:pe===3?1:re.widthInColumns??1,space:pe===3,head:Se,nw:le,nh:de,col:0,row:0,cols:0,heights:m2,rowGaps:zi,colGaps:zi,x:0,y:0,w:0,h:0,block:re,kind:pe,index:P,shape:V,label:X,style:ae,mask:_e,dx:xe,dy:Me,bw:0,bh:0}},p=m(e.root,0);p.nw=0,p.nh=0;let y=[p],E=[],b=new Map;for(let re=0;re\u003Cy.length;re++){let P=y[re];if(P.kind===2)for(let ee of P.block.children??p2){let ae=m(ee,y.length);P.children.push(ae),E[ae.index]=P,y.push(ae),ae.kind!==3&&b.set(ee.id,ae)}}let S=[],x=[],I=y.map(re=>re.nw),L=()=>{for(let P of y)P.nw=I[P.index];let re=yb(p,u);S.length=0,x.length=0;for(let P of y)P.kind===0&&wb.has(P.shape)?(P.bw=P.nw,P.bh=P.nh):P.kind===1?(P.bw=P.span>1?P.w:P.nw,P.bh=P.nh):(P.bw=P.w,P.bh=P.kind===0&&y2.has(P.shape)?P.nh:P.h),P.kind===0&&P.shape===\\\"cyl\\\"&&(P.dy=Math.min(12,Math.max(6,P.bw/14))/2),P.kind===0||P.kind===1?S.push(P):P.head>0&&x.push({x:P.x,y:P.y-P.h/2+(P.head+u)/2+2,bw:P.label.width,bh:P.label.height});return re},O=L(),v=new Map,G=new Set,K=[],C=[];for(let re of e.edges){let P=b.get(re.start??\\\"\\\"),ee=b.get(re.end??\\\"\\\");if(P===void 0||ee===void 0)continue;let ae=Math.min(P.index,ee.index)*y.length+Math.max(P.index,ee.index);v.set(ae,(v.get(ae)??0)+1),re.label&&G.add(ae),K.push([P,ee]),C.push(re)}let Z=C.length*S.length\u003C=Sb?S:void 0,oe=[],H=new Map,z=[],M=()=>{let re=new Map;oe.length=0,H.clear();for(let P=0;P\u003CC.length;P++){let[ee,ae]=K[P],ue=Math.min(ee.index,ae.index)*y.length+Math.max(ee.index,ae.index),ce=v.get(ue)??1,pe=re.get(ue)??0;re.set(ue,pe+1);let V=Ge(C[P].label,!1,a,s,Eb),X,le,de;if(ee===ae){let[Se,_e,xe]=rf(ee,pe+1);X=[],le=Se+xe+6+V.width/2,de=_e-xe/2}else{let Se=G.has(ue)?Math.round(s*1.5)+2:14;X=x2(ee,ae,(pe-(ce-1)/2)*Se,Z);let _e=X.length,xe=Math.abs(X[2]-X[0])+Math.abs(X[3]-X[1]),Me=Math.abs(X[_e-2]-X[_e-4])+Math.abs(X[_e-1]-X[_e-3]),Ce=_e===6&&Me>xe?2:0,ke=V.width>0?_2(X,Ce,V.width+8,V.height,ee,ae,Z):.5;if(le=X[Ce]+(X[Ce+2]-X[Ce])*ke,de=X[Ce+1]+(X[Ce+3]-X[Ce+1])*ke,V.width>0&&ce>1){z[P]=X.slice(Ce,Ce+4);let be=H.get(ue);be?be.push(P):H.set(ue,[P])}}oe.push({edge:C[P],points:X,loop:ee===ae?pe+1:0,label:V,lx:le,ly:de})}},T=re=>{M();let P=Z&&[...Z,...x],ee=new Map,ae=!1;for(let ue of H.values()){if(ue.length\u003C2)continue;let[ce,pe]=K[ue[0]],V=R2(ue,oe,z,ce,pe,P),X=z[ue[0]][0]===z[ue[0]][2];re&&V>0&&(X||!r)&&T2(E,ce,pe,X,Math.ceil(V),ee)&&(ae=!0)}return ae},R=()=>{let re=0;for(let P=0;P\u003Coe.length;P++){let ee=oe[P];for(let ae=P+1;ae\u003Coe.length;ae++){let ue=oe[ae],ce=(ee.label.width+8)/2,pe=(ue.label.width+8)/2,V=Math.min(ee.lx+ce,ue.lx+pe)-Math.max(ee.lx-ce,ue.lx-pe),X=Math.min(ee.ly+ee.label.height/2,ue.ly+ue.label.height/2)-Math.max(ee.ly-ee.label.height/2,ue.ly-ue.label.height/2);ee.label.width>0&&ue.label.width>0&&V>0&&X>0&&(re+=V*X)}}return re},_=0,$=0,g=0,N=0,w=(re,P,ee,ae)=>{re-ee/2\u003C_&&(_=re-ee/2),re+ee/2>g&&(g=re+ee/2),P-ae/2\u003C$&&($=P-ae/2),P+ae/2>N&&(N=P+ae/2)},A=()=>{_=0,$=0,g=O.width,N=O.height;for(let re=0;re\u003Coe.length;re++){let P=oe[re];if(P.loop>0){let[ee,ae,ue]=rf(K[re][0],P.loop);w(ee,ae,2*ue+2,2*ue+2)}P.label.width>0&&w(P.lx,P.ly,P.label.width+8,P.label.height)}return g-_};if(T(C.length*C.length\u003C=Sb)){let re=R(),P=A(),ee=!0;for(let ce=0;ce\u003C3&ⅇce++)O=L(),ee=T(ce\u003C2);let ae=A(),ue=n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth:1/0;if(R()>re-1||ae>P&&Math.ceil(ae+2*o)>ue){for(let ce of y)ce.rowGaps=zi,ce.colGaps=zi;O=L(),T(!1)}}A();let D=yn(e.title,a,i,r?kt(n):4e3),U=D.height>0?D.height+12:0,B=Math.max(g-_,D.width),F=o-_+(B-(g-_))/2,W=o+U-$;for(let re of y)re.x+=F,re.y+=W;let j=Math.ceil(B+2*o),Q=Math.ceil(N-$+U+2*o),Y=\\\"\\\",ne=\\\"\\\",q=[];for(let re=1;re\u003Cy.length;re++){let P=y[re];if(P.kind===3)continue;let ee=It((P.block.classes??Ab).join(\\\" \\\")),ae=Ue(P.block.id);if(P.kind===2){let pe=P.y-P.h/2;Mn(P.style.shape)&&q.push({box:[P.x-P.w/2,pe,P.x+P.w/2,pe+P.h],shape:P.style.shape}),Y+=`\u003Cg class=\\\"pele-cluster${ee}\\\" data-id=\\\"${ae}\\\">\u003Crect x=\\\"${f(P.x-P.w/2)}\\\" y=\\\"${f(pe)}\\\" width=\\\"${f(P.w)}\\\" height=\\\"${f(P.h)}\\\" fill=\\\"var(--_a)\\\"${vn(P.style.shape)?\\\"\\\":' fill-opacity=\\\"0.5\\\"'} stroke=\\\"var(--_b)\\\"${At(P.style.shape)}/>`+Ne(P.label,P.x,pe+(P.head+u)/2+2,` class=\\\"pele-cluster-label\\\"${vt(P.style,\\\"var(--_m)\\\")}${P.style.text}`,c)+\\\"\u003C/g>\\\";continue}let ue=P.kind===1,ce=P.label;if(P.span>1&&P.label.width>0&&P.label.lines.length>1&&P.bw>P.nw&&(ue||!wb.has(P.shape))){let pe=(P.style.bold?1:0)|(P.style.italic?2:0),V=P.label.width+(P.bw-P.nw);ce=Ge(P.block.label,!1,a,P.label.size,V,pe)}ne+=`\u003Cg class=\\\"pele-node pele-shape-${ue?\\\"block-arrow\\\":P.shape}${ee}\\\" data-id=\\\"${ae}\\\" transform=\\\"translate(${f(P.x)},${f(P.y)})\\\">`+(ue?bb(P.mask,P.bw,P.bh,xb+P.style.shape):hr(P.shape,P.bw,P.bh,xb+P.style.shape,h2+P.style.line))+Ne(ce,P.dx,P.dy,` class=\\\"pele-label\\\"${ue||Gi(P.shape)?vt(P.style):\\\"\\\"}${P.style.text}`,c)+\\\"\u003C/g>\\\"}let k=\\\"\\\",J=\\\"\\\",te=\\\"\\\";for(let re=0;re\u003Coe.length;re++){let{edge:P,points:ee,loop:ae,label:ue}=oe[re],ce=P.arrowTypeStart??\\\"\\\",pe=P.arrowTypeEnd??\\\"\\\",V;if(ae>0)V=S2(K[re][0],ae,Rt(ce),Rt(pe));else{for(let de=0;de\u003Cee.length;de+=2)ee[de]+=F,ee[de+1]+=W;V=A2(ee,Rt(ce),Rt(pe))}let X=Mr(V.d,[V.sx,V.sy,V.ex,V.ey],q);X===\\\"\\\"&&(k+=Cr(V,ce,pe,\\\"\\\",P.thickness===\\\"thick\\\"));let le=Ue(P.id);if(J+=`\u003Cg class=\\\"pele-edge\\\" data-id=\\\"${le}\\\"${X?` stroke=\\\"${X}\\\"`:\\\"\\\"}>\u003Cpath d=\\\"${V.d}\\\"${P.thickness===\\\"thick\\\"?' stroke-width=\\\"2.5\\\"':\\\"\\\"}${P.pattern===\\\"dotted\\\"?' stroke-dasharray=\\\"3 4\\\"':\\\"\\\"}/>`+_t(ce,V.sx,V.sy,V.sdx,V.sdy,X||\\\"var(--_l)\\\")+_t(pe,V.ex,V.ey,V.edx,V.edy,X||\\\"var(--_l)\\\")+\\\"\u003C/g>\\\",ue.width>0){let de=oe[re].lx+F,Se=oe[re].ly+W;te+=dn(P.id,ue,de,Se,\\\"\\\",c)}}return{svg:at(\\\"block\\\",j,Q,i,n,e,Ne(D,j/2,o+D.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(Y?`\u003Cg class=\\\"pele-clusters\\\">${Y}\u003C/g>`:\\\"\\\")+Dn(k)+(J?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${J}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${ne}\u003C/g>`+(te?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${s}\\\">${te}\u003C/g>`:\\\"\\\")),width:j,height:Q,links:[]}}var Mb={type:\\\"block\\\",math:!0,parse(e,t,n){let r=new Pc;return r.title=n,mb(e,r),r},render:Tb};var C2=new Set([\\\"label\\\",\\\"type\\\",\\\"descr\\\",\\\"techn\\\",\\\"sprite\\\",\\\"tags\\\",\\\"link\\\",\\\"bgColor\\\",\\\"fontColor\\\",\\\"borderColor\\\",\\\"shadowing\\\",\\\"shape\\\",\\\"legendText\\\",\\\"legendSprite\\\"]),N2=new Set([\\\"label\\\",\\\"descr\\\",\\\"techn\\\",\\\"sprite\\\",\\\"tags\\\",\\\"link\\\",\\\"textColor\\\",\\\"lineColor\\\"]);function Jo(e,t){let{key:n,value:r}=t;\\\"from\\\"in e&&(n===\\\"offsetX\\\"||n===\\\"offsetY\\\")?e[n]=parseInt(r):(\\\"from\\\"in e?N2:C2).has(n)?e[n]=r:(e.extra??=new Map).set(n,r)}function jt(e,t,n){n!==void 0&&(typeof n==\\\"string\\\"?e[t]=n:Jo(e,n))}function Vi(e,t,n){n===void 0?e[t]??=\\\"\\\":jt(e,t,n)}function Cb(e,t){e.labelAttr=void 0,typeof t==\\\"object\\\"?(e.label=\\\"\\\",e.labelAttr=t,Jo(e,t)):e.label=t??\\\"\\\"}var Gc=class{constructor(){fe(this,\\\"type\\\",\\\"c4\\\");fe(this,\\\"c4Type\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"shapes\\\",[]);fe(this,\\\"boundaries\\\",[{alias:\\\"global\\\",label:\\\"global\\\",type:\\\"global\\\",parent:void 0}]);fe(this,\\\"rels\\\",[]);fe(this,\\\"shapeInRow\\\",4);fe(this,\\\"boundaryInRow\\\",2);fe(this,\\\"shapeIndex\\\",new Map);fe(this,\\\"boundaryIndex\\\",new Map);fe(this,\\\"relIndex\\\",new Map);fe(this,\\\"current\\\",this.boundaries[0]);fe(this,\\\"stack\\\",[])}setC4Type(t){this.c4Type=t}setTitle(t){this.title=t}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}element(t,n,r,i){let s=typeof r==\\\"string\\\"?n.get(r):void 0;return s===void 0&&(s={alias:\\\"\\\",label:\\\"\\\",parent:void 0},t.push(s),typeof r==\\\"string\\\"?(s.alias=r,n.set(r,s)):(s.aliasAttr=r,Jo(s,r))),Cb(s,i),s}addPersonOrSystem(t,n){let r=this.element(this.shapes,this.shapeIndex,n[0],n[1]);Vi(r,\\\"descr\\\",n[2]),this.finishShape(r,t,n,3)}addContainer(t,n){let r=this.element(this.shapes,this.shapeIndex,n[0],n[1]);Vi(r,\\\"techn\\\",n[2]),Vi(r,\\\"descr\\\",n[3]),this.finishShape(r,t,n,4)}addComponent(t,n){this.addContainer(t,n)}finishShape(t,n,r,i){jt(t,\\\"sprite\\\",r[i]),jt(t,\\\"tags\\\",r[i+1]),jt(t,\\\"link\\\",r[i+2]),t.kind=n,t.parent=this.current}boundary(t,n){let r=this.element(this.boundaries,this.boundaryIndex,t[0],t[1]);return t[2]===void 0?r.type=n:jt(r,\\\"type\\\",t[2]),r}open(t){t.parent=this.current,this.stack.push(this.current),this.current=t}addPersonOrSystemBoundary(t,n=\\\"system\\\"){let r=this.boundary(t,n);jt(r,\\\"tags\\\",t[3]),jt(r,\\\"link\\\",t[4]),this.open(r)}addContainerBoundary(t){this.addPersonOrSystemBoundary(t,\\\"container\\\")}addDeploymentNode(t,n){let r=this.boundary(n,\\\"node\\\");Vi(r,\\\"descr\\\",n[3]),jt(r,\\\"sprite\\\",n[4]),jt(r,\\\"tags\\\",n[5]),jt(r,\\\"link\\\",n[6]),r.nodeType=t,this.open(r)}popBoundaryParseStack(){this.current=this.stack.pop()??this.boundaries[0]}addRel(t,n){let r=n[0],i=n[1];if(r===void 0||i===void 0||n[2]===void 0)return;let s=typeof r==\\\"string\\\"&&typeof i==\\\"string\\\",a=s?this.relIndex.get(r)?.get(i):void 0;if(a===void 0){if(a={type:t,from:\\\"\\\",to:\\\"\\\",label:\\\"\\\"},this.rels.push(a),s){let o=this.relIndex.get(r);o===void 0&&this.relIndex.set(r,o=new Map),o.set(i,a)}typeof r==\\\"string\\\"?a.from=r:a.fromAttr=r,typeof i==\\\"string\\\"?a.to=i:a.toAttr=i}a.type=t,Cb(a,n[2]),Vi(a,\\\"techn\\\",n[3]),Vi(a,\\\"descr\\\",n[4]),jt(a,\\\"sprite\\\",n[5]),jt(a,\\\"tags\\\",n[6]),jt(a,\\\"link\\\",n[7])}getC4Shape(t){return this.shapeIndex.get(t)??this.boundaryIndex.get(t)}updateElStyle(t,n){let r=typeof n[0]==\\\"string\\\"?this.getC4Shape(n[0]):void 0;r!==void 0&&(jt(r,\\\"bgColor\\\",n[1]),jt(r,\\\"fontColor\\\",n[2]),jt(r,\\\"borderColor\\\",n[3]),jt(r,\\\"shadowing\\\",n[4]),jt(r,\\\"shape\\\",n[5]),jt(r,\\\"sprite\\\",n[6]),jt(r,\\\"techn\\\",n[7]),jt(r,\\\"legendText\\\",n[8]),jt(r,\\\"legendSprite\\\",n[9]))}updateRelStyle(t,n){let r=n[0],i=n[1],s=typeof r==\\\"string\\\"&&typeof i==\\\"string\\\"?this.relIndex.get(r)?.get(i):void 0;if(s===void 0)return;jt(s,\\\"textColor\\\",n[2]),jt(s,\\\"lineColor\\\",n[3]);let a=n[4],o=n[5];typeof a==\\\"string\\\"?s.offsetX=parseInt(a):a!==void 0&&Jo(s,a),typeof o==\\\"string\\\"?s.offsetY=parseInt(o):o!==void 0&&Jo(s,o)}updateLayoutConfig(t,n){let r=a=>a===void 0?NaN:parseInt(typeof a==\\\"string\\\"?a:a.value),i=r(n[0]),s=r(n[1]);i>=1&&(this.shapeInRow=i),s>=1&&(this.boundaryInRow=s)}};var sf=[\\\"$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\\\"];var I2=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]]),of=[/.*direction\\\\s+TB[^\\\\n]*/y,/.*direction\\\\s+BT[^\\\\n]*/y,/.*direction\\\\s+RL[^\\\\n]*/y,/.*direction\\\\s+LR[^\\\\n]*/y],af=/[\\\\n\\\\r\\\\u2028\\\\u2029]/g,cf=/title[^\\\\S\\\\r\\\\n]*(?=[\\\\r\\\\n]|$)\\\\s*/y;function Nb(e){let t=e.length,n=[],r=[],i=[],s=0,a=9,o=0,c=!1,l=-2,u=-1,h=0,d=(E,b,S)=>{n.push(E),r.push(b),i.push(S),o=S},m=E=>{for(;E\u003Ct&&qe(e.charCodeAt(E));)E++;return E},p=(E,b)=>{let S=e.indexOf(E,b);return S===-1?t:S},y=(E,b)=>{let S=o+E.length;if(!e.startsWith(E,o)||!qe(e.charCodeAt(S)))return!1;let x=++S;for(;S\u003Ct;){let I=e.charCodeAt(S);if(I===35||I===10||I===59)break;S++}return S===x?!1:(d(b,o,S),!0)};for(;;){if(c){d(0,t,t);break}o>=t&&(c=!0);let E=e.charCodeAt(o);if(s===0){if(o>=t){d(64,t,t);continue}if(l!==-1&&o>=h&&(l\u003Co&&(l=e.indexOf(\\\"direction\\\",o)),l!==-1&&(u\u003Co&&(af.lastIndex=o,u=af.test(e)?af.lastIndex-1:t),l\u003Cu))){let b=!1;for(let S=0;S\u003C4&&!b;S++)of[S].lastIndex=o,of[S].test(e)&&(d(2+S,o,of[S].lastIndex),b=!0);if(b)continue;h=u}if(E===116){if(cf.lastIndex=o,cf.test(e)){o=cf.lastIndex;continue}if(y(\\\"title\\\",6))continue}if(E===97){if(y(\\\"accDescription\\\",7))continue;let b=e.startsWith(\\\"accTitle\\\",o);if(b||e.startsWith(\\\"accDescr\\\",o)){let S=m(o+8),x=e.charCodeAt(S);if(x===58){d(b?8:10,o,m(S+1)),a=b?9:11,s=7;continue}if(x===123&&!b){o=m(S+1),s=8;continue}}}if(E===37&&e.charCodeAt(o+1)===37){let b=p(`\\r\\n`,o+2);for(;b\u003Ct&&(e.charCodeAt(b)===10||e.charCodeAt(b)===13);)b++;o=b;continue}if(qe(E)){let b=o,S=-1;for(;b\u003Ct;){let x=e.charCodeAt(b);if(!qe(x))break;x===10&&(S=b),b++}S!==-1?d(13,o,S+1):o=b;continue}if(E===123){d(62,o,o+1);continue}if(E===125){d(63,o,o+1);continue}if(ot(E)){let b=o+1;for(;b\u003Ct&&ot(e.charCodeAt(b));)b++;let S=b-o\u003C=19?I2.get(e.slice(o,b)):void 0;if(S!==void 0){S>18&&(s=1),d(S,o,b);continue}}d(1,o,o);break}if(s===1){if(o>=t)d(57,t,t);else if(E===40){let b=o+1;for(;e.charCodeAt(b)===32;)b++;e.charCodeAt(b)===44?d(58,o,b+1):o++,s=2}else if(E===41)o++,s=0;else{d(1,o,o);break}continue}if(s===2){if(o>=t)continue;if(E===41)o++,s=0;else if(E===44)e.charCodeAt(o+1)===44?d(58,o,o+2):o++;else{let b=o;for(;e.charCodeAt(b)===32;)b++;let S=e.charCodeAt(b);S===34?e.charCodeAt(b+1)===34?d(58,o,b+2):(o=b+1,s=3):S===36?(o=b+1,s=4):d(59,o,p(\\\",\\\",o))}continue}if(s===3){E===34?(o++,s=2):d(59,o,p('\\\"',o));continue}if(s===4){d(60,o,p(\\\"=\\\",o)),s=5;continue}if(s===5){if(o>=t)continue;let b=o+1;if(E===61)for(;e.charCodeAt(b)===32;)b++;if(E!==61||e.charCodeAt(b)!==34){d(1,o,o);break}o=b+1,s=6;continue}if(s===6){if(o>=t)continue;E===34?(o++,s=2):d(61,o,p('\\\"',o));continue}if(s===7){d(a,o,p(`\\r\\n`,o)),s=0;continue}E===125?(o++,s=0):d(12,o,p(\\\"}\\\",o))}return{types:n,starts:r,ends:i}}var lf=[\\\"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\\\"],k2=[\\\"rel\\\",\\\"birel\\\",\\\"rel_u\\\",\\\"rel_d\\\",\\\"rel_l\\\",\\\"rel_r\\\",\\\"rel_b\\\",\\\"rel\\\"],$2=[\\\"node\\\",\\\"nodeL\\\",\\\"nodeR\\\"],L2=\\\"'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'C4_CONTEXT', 'C4_CONTAINER', 'C4_COMPONENT', 'C4_DYNAMIC', 'C4_DEPLOYMENT'\\\",O2=\\\"'STR', 'STR_KEY', 'ATTRIBUTE', 'ATTRIBUTE_EMPTY'\\\";function D2(e){return e===6||e===7||e===8||e===10||e===12}function Ib(e){return e>=19&&e\u003C=56}function kb(e,t){let{types:n,starts:r,ends:i}=Nb(e),s=0,a=y=>e.slice(r[y],i[y]),o=y=>{let E=n[s];throw E===1?ft(\\\"c4\\\",e,r[s],\\\"\\\",!0):ft(\\\"c4\\\",e,r[s],`Expecting ${y}, got '${sf[E]}'`)},c=y=>{n[s]!==y&&o(`'${sf[y]}'`),s++},l=()=>{let y=[];for(;;){let E=n[s];if(E===59)y.push(a(s++).trim());else if(E===58)y.push(\\\"\\\"),s++;else if(E===60)s++,n[s]!==61&&o(\\\"'STR_VALUE'\\\"),y.push({key:a(s-1).trim(),value:a(s).trim()}),s++;else break}return y.length===0&&o(O2),y},u=y=>{y===6?t.setTitle(a(s++).substring(6)):y===7?t.setAccDescription(a(s++).substring(15)):y===12?t.setAccDescription(a(s++).trim()):(s++,y===8?(n[s]!==9&&o(\\\"'acc_title_value'\\\"),t.setTitle(a(s++).trim())):(n[s]!==11&&o(\\\"'acc_descr_value'\\\"),t.setAccDescription(a(s++).trim())))},h=y=>{s++;let E=l();if(y\u003C=26)t.addPersonOrSystem(lf[y-19],E);else if(y\u003C=32)t.addContainer(lf[y-19],E);else if(y\u003C=38)t.addComponent(lf[y-19],E);else{if(y\u003C=45)return y===39?E.splice(2,0,\\\"ENTERPRISE\\\"):y===40?E.splice(2,0,\\\"SYSTEM\\\"):y===42&&E.splice(2,0,\\\"CONTAINER\\\"),y>=43?t.addDeploymentNode($2[y-43],E):y===42?t.addContainerBoundary(E):t.addPersonOrSystemBoundary(E),n[s]===62?(s++,c(13)):n[s]===13?(s++,c(62),n[s]===13&&s++):o(\\\"'NEWLINE', 'LBRACE'\\\"),!0;y\u003C=53?(y===53&&E.splice(0,1),t.addRel(k2[y-46],E)):y===54?t.updateElStyle(\\\"update_el_style\\\",E):y===55?t.updateRelStyle(\\\"update_rel_style\\\",E):t.updateLayoutConfig(\\\"update_layout_config\\\",E)}return!1},d=n[s];(d\u003C14||d>18)&&o(L2),s++,c(13);let m=0,p=0;for(;;){let y=n[s];if(p===3||p===4){if(y===13){s++,p=2;continue}if(p===3&&Ib(y)){p=1;continue}}else if(Ib(y)){h(y)?(m++,p=1):p=4;continue}else if(D2(y)&&p!==1){u(y),p=3;continue}else p!==2&&o(\\\"'title', 'accDescription', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'PERSON', 'REL'\\\");if(m>0)y!==63&&o(\\\"'NEWLINE', 'RBRACE'\\\"),s++,t.popBoundaryParseStack(),m--,p=4;else{y!==64&&o(\\\"'NEWLINE', 'EOF'\\\"),s++,c(0),t.setC4Type(a(0));return}}}var df=/\\\\s/;function Qs(e,t,n,r,i=0){let s=[];for(let l of e.split(`\\r\\n`)){let u=Array.from(l);u.length===0&&s.push(\\\"\\\");let h=0;for(;h\u003Cu.length;){let d=S=>t.width(u.slice(h,h+S).join(\\\"\\\"),n,i)\u003C=r,m=1;for(;m\u003Cu.length-h&&d(m);)m=Math.min(u.length-h,m*2);let p=1;for(;p\u003Cm;){let S=Math.ceil((p+m)/2);d(S)?p=S:m=S-1}let y=p,E=h+y\u003Cu.length;if(E&&!df.test(u[h+y])){for(let S=y-1;S>0;S--)if(df.test(u[h+S])){y=S+1;break}}let b=u.slice(h,h+y).join(\\\"\\\");for(s.push(E&&b.trimEnd()||b),h+=y;E&&h\u003Cu.length&&df.test(u[h]);)h++}}e===\\\"\\\"&&(s.length=0);let a=s.map(l=>t.width(l,n,i)),o=0;for(let l of a)o=Math.max(o,l);let c=Math.round(n*1.5);return{lines:s.map((l,u)=>[{text:l,style:i,width:a[u]}]),widths:a,width:o,height:s.length*c,size:n,lineHeight:c}}function Zs(e,t,n){if(e.width\u003C=n)return e;let r=[],i=[];for(let o=0;o\u003Ce.lines.length;o++){if(e.widths[o]\u003C=n){r.push(e.lines[o]),i.push(e.widths[o]);continue}let c=[],l=0,u=()=>{r.push(c),i.push(l),c=[],l=0};for(let h of e.lines[o]){if(h.icon!==void 0||h.math){c.length&&l+h.width>n&&u(),c.push(h),l+=h.width;continue}for(let d of Array.from(h.text)){let m=c[c.length-1],p=m&&m.icon===void 0&&m.math===void 0&&m.style===h.style,E=t.width(p?m.text+d:d,e.size,h.style)-(p?m.width:0);c.length&&l+E>n&&(u(),m=void 0,E=t.width(d,e.size,h.style)),m&&m.icon===void 0&&m.math===void 0&&m.style===h.style?(m.text+=d,m.width+=E):c.push({text:d,style:h.style,width:E}),l+=E}}(c.length||!e.lines[o].length)&&u()}let s=0;for(let o of i)s=Math.max(s,o);let a={...e,lines:r,widths:i,width:s,height:r.length*e.lineHeight};return e.heights?Vo(a):a}function Zr(e,t,n,r){let i=Xr(e),s=\\\"\u003Ctext\\\"+qn(r,i),a=\\\"\\\";for(let o=0;o\u003Ce.lines.length;o++){let c=e.lines[o],l=n+(o+.5)*e.lineHeight;if(c.some(h=>h.icon!==void 0)){let h=e.widths[o];a+=Ne({...e,lines:[c],widths:[h],width:h,height:e.lineHeight},t+h/2,l,r);continue}let u=\\\"\\\";for(let h of c){let d=_r(h.style&~i);u+=d?`\u003Ctspan${d}>${rt(h.text)}\u003C/tspan>`:rt(h.text)}u!==\\\"\\\"&&(a+=`${s} x=\\\"${f(t)}\\\" y=\\\"${f(l+e.size*.35)}\\\" text-anchor=\\\"start\\\" xml:space=\\\"preserve\\\">${u}\u003C/text>`)}return a}var ji=28,ei=20,Ob=7,v2=8,P2=30,ta=88,Yc=160,zc=8,na=26,ff=e=>Math.min(12,Math.max(6,e/14)),hf=e=>Math.min(12,e/4);function Js(e,t,n,r,i,s,a,o){let c=0,l=1;if(a===0){if(i\u003Ce||i>n)return 1/0}else{let u=(e-i)/a,h=(n-i)/a;c=Math.max(c,Math.min(u,h)),l=Math.min(l,Math.max(u,h))}if(o===0){if(s\u003Ct||s>r)return 1/0}else{let u=(t-s)/o,h=(r-s)/o;c=Math.max(c,Math.min(u,h)),l=Math.min(l,Math.max(u,h))}return c\u003C=l?c:1/0}function ea(e,t,n,r,i,s,a,o){let c=a/n,l=o/r,u=(i-e)/n,h=(s-t)/r,d=c*c+l*l,m=2*(c*u+l*h),p=u*u+h*h-1,y=m*m-4*d*p;if(d===0||y\u003C0)return 1/0;let E=(-m-Math.sqrt(y))/(2*d);return E>=0&&E\u003C=1?E:p\u003C=0?0:1/0}function Yn(e,t,n,r,i){let{x:s,y:a,w:o,h:c}=e,l=r-t,u=i-n;if(e.form===\\\"person\\\")return Math.min(Js(s,a+na,s+o,a+c,t,n,l,u),ea(s+o/2,a+14,13,13,t,n,l,u));if(e.form===\\\"cyl\\\"){let h=ff(o);return Math.min(Js(s,a+h,s+o,a+c-h,t,n,l,u),ea(s+o/2,a+h,o/2,h,t,n,l,u),ea(s+o/2,a+c-h,o/2,h,t,n,l,u))}if(e.form===\\\"h-cyl\\\"){let h=hf(c);return Math.min(Js(s+h,a,s+o-h,a+c,t,n,l,u),ea(s+h,a+c/2,h,c/2,t,n,l,u),ea(s+o-h,a+c/2,h,c/2,t,n,l,u))}return Js(s,a,s+o,a+c,t,n,l,u)}function pf(e,t,n,r,i){for(let s=2;s\u003Ce.length;s+=2){let a=e[s-2],o=e[s-1];if(Js(t,n,r,i,a,o,e[s]-a,e[s+1]-o)\u003C=1)return!0}return!1}function Hc(e,t){return e.x\u003C=t.x&&e.y\u003C=t.y&&e.x+e.w>=t.x+t.w&&e.y+e.h>=t.y+t.h}function F2(e,t,n){let r=e.x+e.w/2,i=e.y+e.h/2,s=t.x+t.w/2,a=t.y+t.h/2,o=Hc(e,t);if(o||Hc(t,e)){let L=o?e:t,O=o?t:e,v=O.x+O.w/2,G=O.y+O.h/2,K=O.x-L.x,C=L.x+L.w-O.x-O.w,Z=O.y-L.y,oe=L.y+L.h-O.y-O.h,H=Math.min(K,C,Z,oe),z=H===K?L.x:H===C?L.x+L.w:v,M=H===K||H===C?G:H===oe?L.y+L.h:L.y,T=Math.min(Yn(O,z,M,v,G),1),R=z+(v-z)*T,_=M+(G-M)*T;return o?[z,M,R,_]:[R,_,z,M]}let c=r,l=i,u=s,h=a,d=Math.max(e.x,t.x),m=Math.min(e.x+e.w,t.x+t.w),p=Math.max(e.y,t.y),y=Math.min(e.y+e.h,t.y+t.h);d\u003Cm?c=u=(d+m)/2:p\u003Cy&&(l=h=(p+y)/2);let E=Math.hypot(u-c,h-l)||1,b=-(h-l)/E*n,S=(u-c)/E*n,x=Yn(e,u+b,h+S,c+b,l+S),I=Yn(t,c+b,l+S,u+b,h+S);return x\u003C=1&&I\u003C=1?(c+=b,l+=S,u+=b,h+=S):(c=r,l=i,u=s,h=a,x=Math.min(Yn(e,u,h,c,l),1),I=Math.min(Yn(t,c,l,u,h),1)),[u+(c-u)*x,h+(l-h)*x,c+(u-c)*I,l+(h-l)*I]}var uf=6,B2=3,$b=12,Kc=class{constructor(){fe(this,\\\"upright\\\",[]);fe(this,\\\"level\\\",[]);fe(this,\\\"frames\\\",[[],[]]);fe(this,\\\"taken\\\",new Map);fe(this,\\\"squeezed\\\",0)}free(t,n,r,i){let s=Math.min(r,i),a=Math.max(r,i),o=(c,l)=>{for(let u=0;u\u003Cc.length;u+=3)if(Math.abs(c[u]-n)\u003Cl&&c[u+1]\u003Ca&&c[u+2]>s)return!0;return!1};return!o(t?this.upright:this.level,uf)&&!o(this.frames[t?0:1],B2)}crossings(t){let n=0;for(let r=2;r\u003Ct.length;r+=2){let i=t[r]===t[r-2],s=i?t[r]:t[r+1],a=Math.min(i?t[r-1]:t[r-2],i?t[r+1]:t[r]),o=Math.max(i?t[r-1]:t[r-2],i?t[r+1]:t[r]),c=i?this.level:this.upright;for(let l=0;l\u003Cc.length;l+=3)c[l]>a&&c[l]\u003Co&&c[l+1]\u003Cs&&c[l+2]>s&&n++}return n}frame(t){this.frames[0].push(t.x,t.y,t.y+t.h,t.x+t.w,t.y,t.y+t.h),this.frames[1].push(t.y,t.x,t.x+t.w,t.y+t.h,t.x,t.x+t.w)}take(t){for(let n=2;n\u003Ct.length;n+=2)t[n]===t[n-2]?this.upright.push(t[n],Math.min(t[n-1],t[n+1]),Math.max(t[n-1],t[n+1])):t[n+1]===t[n-1]&&this.level.push(t[n+1],Math.min(t[n-2],t[n]),Math.max(t[n-2],t[n]))}ports(t,n,r,i,s){let a=this.taken.get(t)??[],o=[];for(let c=0;c\u003C9&&o.length\u003C4;c++){let l=r+(c&1?1:-1)*Math.ceil(c/2)*$b;if(l\u003Ci||l>s)continue;let u=!0;for(let h=0;h\u003Ca.length;h+=2)a[h]===n&&Math.abs(a[h+1]-l)\u003C$b&&(u=!1);u&&o.push(l)}return o.length?o:[r]}claim(t,n,r){let i=this.taken.get(t);i?i.push(n,r):this.taken.set(t,[n,r])}};function W2(e,t,n){let r=e.length,i=Math.sign(e[2]-e[0]),s=Math.sign(e[3]-e[1]),a=`M${f(e[0]+i*t)},${f(e[1]+s*t)}`;for(let l=2;l\u003Cr-2;l+=2){let u=e[l],h=e[l+1],d=Math.sign(u-e[l-2]),m=Math.sign(h-e[l-1]),p=Math.sign(e[l+2]-u),y=Math.sign(e[l+3]-h),E=Math.min(v2,Math.abs(u-e[l-2]+h-e[l-1])/2,Math.abs(e[l+2]-u+e[l+3]-h)/2);a+=`${d?\\\"H\\\"+f(u-d*E):\\\"V\\\"+f(h-m*E)}Q${f(u)},${f(h)} ${f(u+p*E)},${f(h+y*E)}`}let o=Math.sign(e[r-2]-e[r-4]),c=Math.sign(e[r-1]-e[r-3]);return a+(o?\\\"H\\\"+f(e[r-2]-o*n):\\\"V\\\"+f(e[r-1]-c*n))}function Db(e,t,n,r){for(let i of t)if(i!==n&&i!==r&&pf(e,i.x,i.y,i.x+i.w,i.y+i.h))return!1;return!0}function vb(e,t,n,r,i){let s=e.length;return{d:W2(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[s-2],ey:e[s-1],edx:Math.sign(e[s-2]-e[s-4]),edy:Math.sign(e[s-1]-e[s-3]),x0:e[t],y0:e[t+1],x1:e[t+2],y1:e[t+3],nx:0,ny:0,lean:0,room:Yc,...i,points:e}}function Lb(e,t){let n=[],r=(e+t)/2,i=Math.max(Ob,(t-e)/4);for(let s=0;s\u003C9;s++){let a=r+(s&1?1:-1)*Math.ceil(s/2)*i;a>=e+uf&&a\u003C=t-uf&&n.push(a)}return n}function U2(e,t,n,r,i,s){let a=e.x+e.w/2,o=e.y+e.h/2,c=t.x+t.w/2,l=t.y+t.h/2,u,h=(y,E,b)=>{if(!Db(y,n,e,t))return;for(let x=2;x\u003Cy.length;x+=2){let I=y[x]===y[x-2];if(!r.free(I,I?y[x]:y[x+1],I?y[x-1]:y[x-2],I?y[x+1]:y[x]))return}let S=r.crossings(y)*1e6;for(let x=2;x\u003Cy.length;x+=2)S+=Math.abs(y[x]-y[x-2])+Math.abs(y[x+1]-y[x-1]);(!u||S\u003Cu.cost)&&(u={points:y,cost:S,upright:E,sides:b})};if(e.x+e.w\u003C=t.x||t.x+t.w\u003C=e.x){let y=c>a,E=Math.sign(l-o),b=y?[1,0]:[0,1],S=Lb(y?e.x+e.w:t.x+t.w,y?t.x:e.x);e:for(let x of r.ports(e,b[0],o+E*e.h/4,e.y+8,e.y+e.h-8))for(let I of r.ports(t,b[1],l-E*t.h/4,t.y+8,t.y+t.h-8))for(let L of S){let O=L+(a-L)*Math.min(Yn(e,L,x,a,x),1),v=L+(c-L)*Math.min(Yn(t,L,I,c,I),1),G=u;if(h([O,x,L,x,L,I,v,I],!0,b),u!==G)break e}}if(e.y+e.h\u003C=t.y||t.y+t.h\u003C=e.y){let y=l>o,E=Math.sign(c-a),b=y?[3,2]:[2,3],S=Lb(y?e.y+e.h:t.y+t.h,y?t.y:e.y);e:for(let x of r.ports(e,b[0],a+E*e.w/4,e.x+8,e.x+e.w-8))for(let I of r.ports(t,b[1],c-E*t.w/4,t.x+8,t.x+t.w-8))for(let L of S){let O=L+(o-L)*Math.min(Yn(e,x,L,x,o),1),v=L+(l-L)*Math.min(Yn(t,I,L,I,l),1),G=u;if(h([x,O,x,L,I,L,I,v],!1,b),u!==G)break e}}if(!u)return;let{points:d,upright:m,sides:p}=u;return r.take(d),r.claim(e,p[0],m?d[1]:d[0]),r.claim(t,p[1],m?d[7]:d[6]),vb(d,2,i,s,{room:m?ta:Yc})}function Pb(e,t,n,r,i,s,a){if(e===t){let E=Math.min(e.h/2-4,10),b=Math.hypot(ji,E),S=e.x+e.w,x=e.y+e.h/2,I=ji/b,L=E/b;return{d:`M${f(S+I*s)},${f(x-E-L*s)}C${f(S+ji)},${f(x-E*2)} ${f(S+ji)},${f(x+E*2)} ${f(S+I*a)},${f(x+E+L*a)}`,sx:S,sy:x-E,sdx:-I,sdy:L,ex:S,ey:x+E,edx:-I,edy:-L,x0:S+ji+4,y0:x,x1:S+ji+4,y1:x,nx:1,ny:0,lean:0,room:64,points:[]}}let[o,c,l,u]=F2(e,t,n),h=o===l,d=!1;if(r&&!Hc(e,t)&&!Hc(t,e))for(let E of r)E!==e&&E!==t&&Js(E.x,E.y,E.x+E.w,E.y+E.h,o,c,l-o,u-c)\u003C=1&&(d=!0);if(r&&d&&!h&&c!==u){let E=U2(e,t,r,i,s,a);if(E)return E;i.squeezed++}if(r&&d&&(h||c===u)){let E=A=>{let D=A?-1/0:1/0,U=B=>{let F=h?B.x:B.y;D=A?Math.max(D,F+(h?B.w:B.h)):Math.min(D,F)};U(e),U(t);for(let B of r)B!==e&&B!==t&&Js(B.x,B.y,B.x+B.w,B.y+B.h,o,c,l-o,u-c)\u003C=1&&U(B);return D},b=h?Math.min(e.y,t.y):Math.min(e.x,t.x),S=h?Math.max(e.y+e.h,t.y+t.h):Math.max(e.x+e.w,t.x+t.w),x=(A,D)=>{for(let U of r){if(U===e||U===t)continue;let B=h?U.y\u003CS&&U.y+U.h>b:U.x\u003CS&&U.x+U.w>b,F=h?U.x:U.y,W=F+(h?U.w:U.h);if(B&&(A?W>D:F\u003CD))return!1}return!0},I=e.x+e.w/2,L=e.y+e.h/2,O=t.x+t.w/2,v=t.y+t.h/2,G=Math.sign(h?v-L:O-I),K=A=>{let D=E(A),U=A?1:-1,B=h?A?1:0:A?3:2,F=h?i.ports(e,B,L+G*e.h/4,e.y+8,e.y+e.h-8)[0]:i.ports(e,B,I+G*e.w/4,e.x+8,e.x+e.w-8)[0],W=h?i.ports(t,B,v-G*t.h/4,t.y+8,t.y+t.h-8)[0]:i.ports(t,B,O-G*t.w/4,t.x+8,t.x+t.w-8)[0],j=Y=>{if(h){let k=Y+(I-Y)*Math.min(Yn(e,Y,F,I,F),1),J=Y+(O-Y)*Math.min(Yn(t,Y,W,O,W),1);return[k,F,Y,F,Y,W,J,W]}let ne=Y+(L-Y)*Math.min(Yn(e,F,Y,F,L),1),q=Y+(v-Y)*Math.min(Yn(t,W,Y,W,v),1);return[F,ne,F,Y,W,Y,W,q]},Q=j(D+U*ei);for(let Y=0;Y\u003C=4;Y++){let ne=D+U*(ei+Y*Ob),q=j(ne);if(Db(q,r,e,t)&&(Q=q,i.free(h,ne,F,W)))return{points:Q,side:B,p0:F,p1:W,step:Y}}return{points:Q,side:B,p0:F,p1:W,step:5}},C=h?u>c:l\u003Co,Z=x(C,E(C)),oe=x(!C,E(!C)),H=K(C),z=Z===oe?K(!C):void 0,M=A=>i.crossings(A.points)*8+A.step,T=oe&&!Z||z&&M(z)\u003CM(H)?!C:C,{points:R,side:_,p0:$,p1:g,step:N}=T===C?H:z??K(!C),w=T?1:-1;return N>4&&i.squeezed++,i.take(R),i.claim(e,_,$),i.claim(t,_,g),vb(R,2,s,a,h?{nx:w,lean:P2,room:ta}:{room:Yc})}let m=Math.hypot(l-o,u-c)||1,p=(l-o)/m,y=(u-c)/m;return(h||c===u)&&i.take([o,c,l,u]),{d:`M${f(o+p*s)},${f(c+y*s)}L${f(l-p*a)},${f(u-y*a)}`,sx:o,sy:c,sdx:-p,sdy:-y,ex:l,ey:u,edx:p,edy:y,x0:o,y0:c,x1:l,y1:u,nx:n?-y:0,ny:n?p:0,lean:0,room:Math.abs(p)>Math.abs(y)?ta:Yc,points:[o,c,l,u]}}var gf=216,G2=64,Fb=14,Y2=12,H2=ta+zc+3*Lt,K2=88,Bb=ei+8,Vc=48,Xi=16,jc=10,mf=new Map([[\\\"person\\\",\\\"person\\\"],[\\\"box\\\",\\\"rect\\\"],[\\\"rounded\\\",\\\"rect\\\"],[\\\"component\\\",\\\"rect\\\"],[\\\"cylinder\\\",\\\"cyl\\\"],[\\\"database\\\",\\\"cyl\\\"],[\\\"db\\\",\\\"cyl\\\"],[\\\"queue\\\",\\\"h-cyl\\\"],[\\\"pipe\\\",\\\"h-cyl\\\"]]);function z2(e){let t=mf.get((e.shape??\\\"\\\").toLowerCase())??mf.get((e.sprite??\\\"\\\").toLowerCase());if(t)return t;if(e.tags)for(let r of e.tags.split(\\\",\\\")){let i=mf.get(r.trim().toLowerCase());if(i)return i}let n=e.kind;return n.endsWith(\\\"person\\\")?\\\"person\\\":n.endsWith(\\\"_db\\\")?\\\"cyl\\\":n.endsWith(\\\"_queue\\\")?\\\"h-cyl\\\":\\\"rect\\\"}function V2(e,t,n,r,i=gf){let s=z2(e),a=s===\\\"h-cyl\\\"?36:0,o=s===\\\"person\\\"?na:s===\\\"cyl\\\"?24:0,c=i-2*Fb-a,l=[Ge(\\\"«\\\"+e.kind.replace(/_/g,\\\" \\\")+\\\"»\\\",!1,t,r-1,c),Ge(e.label,!1,t,n,c,1),Ge(e.techn?`[${e.techn}]`:void 0,!1,t,r,c),Ge(e.descr,!1,t,r,c)],u=0,h=l[3].height>0?4:0;for(let d of l)u=Math.max(u,d.width),h+=d.height;return{shape:e,form:s,labels:l,textH:h,x:0,y:0,w:Math.max(i,u+2*Fb+a),h:Math.max(G2,h+2*Y2+o)}}function Wb(e,t,n,r,i){let s=0,a=0;for(let o=0;o\u003Ce.length;o+=t){let c=Math.min(e.length,o+t),l=0,u=0;for(let h=o;h\u003Cc;h++)u=Math.max(u,e[h].h);for(let h=o;h\u003Cc;h++){let d=e[h];d.x=l,d.y=a,i&&(d.h=u),l+=d.w+n}s=Math.max(s,l-n),a+=u+r}return[s,e.length>0?a-r:0]}function Ub(e,t,n,r,i,s){let a=i===void 0?Bb:12,o=new Map;for(let y of e.boundaries){let E=i===void 0?4e3:Math.max(80,i-2*Xi-2*Bb*2),b=y.parent?[Ge(y.label,!1,t,n,E,1),Ge(y.type?`[${y.type}]`:void 0,!1,t,r,E),Ge(y.descr,!1,t,r,E)]:[],S=0,x=0;for(let I of b)S+=I.height,x=Math.max(x,I.width);o.set(y,{boundary:y,kids:[],nodes:[],labels:b,head:S>0?S+jc+6+ei:a,headW:x,headX:Xi,x:0,y:0,w:0,h:0,form:\\\"rect\\\"})}let c=o.get(e.boundaries[0]);for(let y of o.values()){let E=y.boundary.parent;E&&o.get(E)?.kids.push(y)}let l=[c],u=new Map([[c.boundary,0]]);for(let y=0;y\u003Cl.length;y++)for(let E of l[y].kids)u.set(E.boundary,u.get(l[y].boundary)+1),l.push(E);for(let y of e.shapes)if(y.parent){let E=u.get(y.parent)??0,b=i===void 0?gf:Math.max(100,Math.min(gf,i-2*E*a-32));o.get(y.parent)?.nodes.push(V2(y,t,n,r,b))}let h=Math.max(1,e.shapeInRow),d=Math.max(1,e.boundaryInRow),m=new Map;for(let y=l.length-1;y>=0;y--){let E=l[y],b=i===void 0?H2:s,S=(K,C,Z)=>{if(i===void 0)return C;let oe=1;for(let H of K)oe=Math.max(oe,H.w);return Math.max(1,Math.min(C,Math.floor((i+Z-2*a)/(oe+Z))))},[x,I]=Wb(E.nodes,S(E.nodes,h,b),b,K2,!0),[L,O]=Wb(E.kids,S(E.kids,d,Vc),Vc,Vc,!1),v=I>0&&O>0?Vc:0,G=E===c?0:a;m.set(E,I+v),E.w=Math.max(x,L,E.headW+2*Xi-2*G)+2*G,E.h=(G&&E.head)+I+v+O+G}let p=new Map;for(let y of l){let E=y.x+(y===c?0:a),b=y.y+(y===c?0:y.head);for(let S of y.nodes)S.x+=E,S.y+=b,p.set(S.shape,S);for(let S of y.kids)S.x+=E,S.y+=b+m.get(y);y!==c&&p.set(y.boundary,y)}return{order:l,boxes:p}}var j2=7,qc=36,bf=24,Gb=2e3,Xc=8,X2=[.5,.4,.6,.3,.7,.2,.8],q2=2e6;function ra(e,t,n){let r=[];return e&&r.push(\\\"fill:\\\"+e),t&&r.push(\\\"stroke:\\\"+t),n&&r.push(\\\"color:\\\"+n),Ct(r)}function yf(e,t,n,r,i){return t?Zn(e,ki(t.includes(\\\"¶ß\\\")?t.replace(/\\\\ufb02\\\\u00b0\\\\u00b0?/g,\\\"#\\\").replace(/\\\\u00b6\\\\u00df/g,\\\";\\\"):t),n,r,i):e}function Yb(e,t,n){return An(n,r=>{if(!r)return Ef(e,t,n,!1)[0];let[i,s]=Ef(e,t,n,!0,qc);for(let a=qc+bf;s>0&&a\u003C=qc+3*bf;a+=bf){let[o,c]=Ef(e,t,n,!0,a);c\u003Cs&&([i,s]=[o,c])}return i})}function Ef(e,t,n,r,i=qc){let s=n.fontSize??16,a=Math.round(s*.8125),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=[],{order:u,boxes:h}=Ub(e,o,s,a,r?Math.max(80,(n.maxWidth??320)-2*c):void 0,i),d=u[0],m=0,p=0,y=d.w,E=d.h,b=(B,F,W,j)=>{m=Math.min(m,B),p=Math.min(p,F),y=Math.max(y,W),E=Math.max(E,j)},S=[],x=new Map;for(let B of e.rels){let F=B.fromAttr?void 0:e.getC4Shape(B.from),W=B.toAttr?void 0:e.getC4Shape(B.to),j=F&&h.get(F),Q=W&&h.get(W);if(!j||!Q)throw new Qe(`C4 rel \\\"${B.from}\\\" -> \\\"${B.to}\\\" references an unknown shape or boundary`,\\\"semantic\\\",{type:\\\"c4\\\"});S.push(j,Q);let Y=x.get(j);Y||x.set(j,Y=new Set),Y.add(Q)}let I=[],L=[];for(let B of u)for(let F of B.nodes)I.push(F),L.push(F.x+Xc,F.y+Xc,F.x+F.w-Xc,F.y+F.h-Xc);let O=e.rels.length*(I.length+u.length+3*e.rels.length)\u003C=q2,v=(B,F,W,j)=>{let Q=0;for(let Y=0;Y\u003CL.length;Y+=4){let ne=Math.min(W,L[Y+2])-Math.max(B,L[Y]);if(ne\u003C=0)continue;let q=Math.min(j,L[Y+3])-Math.max(F,L[Y+1]);q>0&&(Q+=ne*q)}return Q},G=B=>B?Math.max(-Gb,Math.min(Gb,B)):0,K=\\\"\\\",C=\\\"\\\",Z=Rt(\\\"arrow_point\\\"),oe=[];for(let B of u){if(B===d)continue;let F=ra(B.boundary.bgColor,void 0,void 0).shape;Mn(F)&&oe.push({box:[B.x,B.y,B.x+B.w,B.y+B.h],shape:F})}let H=new Kc;for(let B of u)B!==d&&H.frame(B);let z=e.rels.map((B,F)=>{let W=S[F*2],j=S[F*2+1],Q=ra(void 0,B.lineColor,void 0),Y=B.type===\\\"birel\\\"||B.type===\\\"rel_b\\\",ne=B.type!==\\\"rel_b\\\",q=W!==j&&x.get(j)?.has(W)===!0,k=Pb(W,j,q?j2:0,O?I:void 0,H,Y?Z:0,ne?Z:0);b(Math.min(k.x0,k.x1),Math.min(k.y0,k.y1),Math.max(k.x0,k.x1),Math.max(k.y0,k.y1)),Y&&O&&L.push(k.sx-Lt,k.sy-Lt,k.sx+Lt,k.sy+Lt),ne&&O&&L.push(k.ex-Lt,k.ey-Lt,k.ex+Lt,k.ey+Lt);let J=Mr(k.d,[k.sx,k.sy,k.ex,k.ey],oe,Q.line),te=J||(Q.stroke?rt(Q.stroke):\\\"var(--_l)\\\");return J===\\\"\\\"&&(K+=Cr(k,Y?\\\"arrow_point\\\":\\\"none\\\",ne?\\\"arrow_point\\\":\\\"none\\\",Q.line)),C+=`\u003Cg class=\\\"pele-edge\\\" data-id=\\\"${Ue(B.from+\\\"-\\\"+B.to)}\\\"${J?` stroke=\\\"${J}\\\"`:\\\"\\\"}${Q.line}>\u003Cpath d=\\\"${k.d}\\\"/>`+(Y?_t(\\\"arrow_point\\\",k.sx,k.sy,k.sdx,k.sdy,te):\\\"\\\")+(ne?_t(\\\"arrow_point\\\",k.ex,k.ey,k.edx,k.edy,te):\\\"\\\")+\\\"\u003C/g>\\\",k});for(let B of u){if(!O||B.headW===0)continue;let F=B.y+jc,W=B.y+B.head-ei,j=1/0;for(let Q of[Xi,(B.w-B.headW)/2,B.w-Xi-B.headW]){let Y=0;for(let ne of z)pf(ne.points,B.x+Q-4,F,B.x+Q+B.headW+4,W)&&Y++;if(Y\u003Cj&&(j=Y,B.headX=Q),Y===0)break}L.push(B.x+B.headX-4,F,B.x+B.headX+B.headW+4,W)}let M=\\\"\\\";e.rels.forEach((B,F)=>{let W=z[F],j=B.from+\\\"-\\\"+B.to,Q=ra(void 0,void 0,B.textColor),Y=(e.c4Type===\\\"C4Dynamic\\\"?F+1+\\\": \\\":\\\"\\\")+B.label,ne=Ge(Y,!1,o,a,W.room),q=Ge(B.techn?`[${B.techn}]`:void 0,!1,o,a,W.room,2),k=Math.max(ne.width,q.width)+zc,J=ne.height+q.height;if(J===0)return;let te=Math.abs(W.nx)*(k/2)+Math.abs(W.ny)*(J/2)+2,se=W.lean?Math.max(0,Math.min(W.lean,te-14)):te,re=W.nx*se+(r?0:G(B.offsetX)),P=W.ny*se+(r?0:G(B.offsetY)),ee=.5;if(O){let ce=1/0,pe=re!==W.nx*se||P!==W.ny*se;for(let V=0;V\u003C(pe?2:1)&&ce>0;V++){let X=V?W.nx*se:re,le=V?W.ny*se:P;for(let de of X2){let Se=W.x0+(W.x1-W.x0)*de+X,_e=W.y0+(W.y1-W.y0)*de+le,xe=v(Se-k/2,_e-J/2,Se+k/2,_e+J/2);if(xe\u003Cce&&(ce=xe,ee=de,re=X,P=le),xe===0)break}}}let ae=W.x0+(W.x1-W.x0)*ee+re,ue=W.y0+(W.y1-W.y0)*ee+P-J/2;O&&L.push(ae-k/2,ue,ae+k/2,ue+J),b(ae-k/2,ue,ae+k/2,ue+J),M+=`\u003Cg class=\\\"pele-edge-label\\\" data-id=\\\"${Ue(j)}\\\">`+(B.descr?`\u003Ctitle>${Ue(B.descr)}\u003C/title>`:\\\"\\\")+`\u003Crect x=\\\"${f(ae-k/2)}\\\" y=\\\"${f(ue)}\\\" width=\\\"${f(k)}\\\" height=\\\"${f(J)}\\\" rx=\\\"3\\\" fill=\\\"var(--_bg)\\\"/>`+yf(Ne(ne,ae,ue+ne.height/2,Q.text)+Ne(q,ae,ue+ne.height+q.height/2,` class=\\\"pele-c4-techn\\\" fill=\\\"var(--_m)\\\"${Q.text}`),B.link,j,l,n)+\\\"\u003C/g>\\\"});let T=\\\"\\\",R=\\\"\\\";for(let B of u){if(B!==d){let F=B.boundary,W=ra(F.bgColor,F.borderColor,F.fontColor),j=B.x+B.headX,Q=B.y+jc,Y=vt(W)+W.text,ne=vt(W,\\\"var(--_m)\\\")+W.text,q=Zr(B.labels[0],j,Q,` class=\\\"pele-cluster-label\\\" font-weight=\\\"var(--_hw)\\\"${Y}`);Q+=B.labels[0].height,q+=Zr(B.labels[1],j,Q,` class=\\\"pele-c4-type\\\" font-size=\\\"${a}\\\"${ne}`),Q+=B.labels[1].height,q+=Zr(B.labels[2],j,Q,` class=\\\"pele-c4-descr\\\" font-size=\\\"${a}\\\"${ne}`),T+=`\u003Cg class=\\\"pele-cluster pele-c4-${F.nodeType?\\\"node\\\":\\\"boundary\\\"}\\\" data-id=\\\"${Ue(F.alias)}\\\">\u003Crect x=\\\"${f(B.x)}\\\" y=\\\"${f(B.y)}\\\" width=\\\"${f(B.w)}\\\" height=\\\"${f(B.h)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"${F.nodeType?\\\"\\\":' stroke-dasharray=\\\"6 4\\\"'}${At(W.shape)}/>`+yf(q,F.link,F.alias,l,n)+\\\"\u003C/g>\\\"}for(let F of B.nodes){let W=F.shape,j=W.kind.startsWith(\\\"external\\\"),Q=ra(W.bgColor,W.borderColor,W.fontColor),Y=' stroke=\\\"var(--_b)\\\"'+(j?' stroke-dasharray=\\\"4 3\\\"':\\\"\\\"),{w:ne,h:q,form:k,labels:J}=F,te=k===\\\"h-cyl\\\"?-hf(q)/2:0,se=k===\\\"person\\\"?na/2:k===\\\"cyl\\\"?ff(ne)/2:0,re=vt(Q)+Q.text,P=vt(Q,\\\"var(--_m)\\\")+Q.text,ee=se-F.textH/2,ae=Ne(J[0],te,ee+J[0].height/2,` class=\\\"pele-c4-type\\\" font-size=\\\"${a-1}\\\"${P}`);ee+=J[0].height,ae+=Ne(J[1],te,ee+J[1].height/2,` class=\\\"pele-label\\\" font-weight=\\\"var(--_hw)\\\"${re}`),ee+=J[1].height,ae+=Ne(J[2],te,ee+J[2].height/2,` class=\\\"pele-c4-techn\\\" font-size=\\\"${a}\\\"${P}`),ee+=J[2].height+4,ae+=Ne(J[3],te,ee+J[3].height/2,` class=\\\"pele-c4-descr\\\" font-size=\\\"${a}\\\"${re}`),R+=`\u003Cg class=\\\"pele-node pele-shape-${k} pele-c4-${W.kind}${j?\\\" pele-c4-external\\\":\\\"\\\"}\\\" data-id=\\\"${Ue(W.alias)}\\\" transform=\\\"translate(${f(F.x+ne/2)},${f(F.y+q/2)})\\\">`+yf(hr(k,ne,q,` fill=\\\"var(${j?\\\"--_bg\\\":\\\"--_s\\\"})\\\"${Y}${Q.shape}`,Y+Q.line)+ae,W.link,W.alias,l,n)+\\\"\u003C/g>\\\"}}let _=Ge(e.title,!1,o,s,r?kt(n):4e3,1),$=_.height>0?_.height+12:0,g=Math.max(y-m,_.width),N=Math.ceil(g+2*c),w=Math.ceil(E-p+$+2*c),A=c-m+(g-(y-m))/2,D=c+$-p;return[{svg:at(\\\"c4\\\",N,w,s,n,e,Ne(_,N/2,c+_.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg transform=\\\"translate(${f(A)},${f(D)})\\\">`+(T?`\u003Cg class=\\\"pele-clusters\\\">${T}\u003C/g>`:\\\"\\\")+Dn(K)+(C?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${C}\u003C/g>`:\\\"\\\")+(R?`\u003Cg class=\\\"pele-nodes\\\">${R}\u003C/g>`:\\\"\\\")+(M?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${a}\\\">${M}\u003C/g>`:\\\"\\\")+\\\"\u003C/g>\\\"),width:N,height:w,links:l},H.squeezed]}var Hb={type:\\\"c4\\\",parse(e,t,n){let r=new Gc;return n&&(r.title=n),kb(e,r),r},render:Yb};function xf(e){let t=0;for(let n=e.indexOf(\\\"~\\\");n!==-1;n=e.indexOf(\\\"~\\\",n+1))t++;return t}function Q2(e){let t=xf(e);if(t\u003C=1)return e;let n=t%2!==0&&e.startsWith(\\\"~\\\"),r=e.split(\\\"\\\"),i=[];for(let s=n?1:0;s\u003Cr.length;s++)r[s]===\\\"~\\\"&&i.push(s);for(let s=0,a=i.length-1;s\u003Ca;s++,a--)r[i[s]]=\\\"\u003C\\\",r[i[a]]=\\\">\\\";return r.join(\\\"\\\")}function xs(e){if(!e.includes(\\\"~\\\"))return e;let t=e.split(/(,)/),n=[];for(let r=0;r\u003Ct.length;r++){let i=t[r];i===\\\",\\\"&&r>0&&r+1\u003Ct.length&&xf(t[r-1])===1&&xf(t[r+1])===1&&(i=t[r-1]+\\\",\\\"+t[r+1],r++,n.pop()),n.push(Q2(i))}return n.join(\\\"\\\")}function Kb(e){return e===\\\"#\\\"||e===\\\"+\\\"||e===\\\"~\\\"||e===\\\"-\\\"}var sa=class{constructor(t,n){fe(this,\\\"id\\\",\\\"\\\");fe(this,\\\"memberType\\\");fe(this,\\\"visibility\\\",\\\"\\\");fe(this,\\\"classifier\\\",\\\"\\\");fe(this,\\\"parameters\\\",\\\"\\\");fe(this,\\\"returnType\\\",\\\"\\\");this.memberType=n,(n!==\\\"method\\\"||!this.parseMethod(t))&&this.parseAttribute(t),this.id=this.id.startsWith(\\\" \\\")?\\\" \\\"+this.id.trim():this.id.trim()}parseMethod(t){let n=t.length;for(let r=0;r\u003Cn;){let i=r;for(;i\u003Cn&&!Us(t.charCodeAt(i));)i++;let s=i-1;for(;s>r&&t.charCodeAt(s)!==41;)s--;let a=s-1;for(;a>r&&t.charCodeAt(a)!==40;)a--;if(a>r){let o=t[r],c=Kb(o)&&a>r+1;c&&(this.visibility=o),this.id=t.slice(c?r+1:r,a),this.parameters=t.slice(a+1,s).trim();let l=s+1,u=\\\"\\\";if(l\u003Cn){let d=t[l];(d===\\\"$\\\"||d===\\\"*\\\"||d.trim()===\\\"\\\")&&(u=d.trim(),l++)}let h=l;for(;h\u003Cn&&!Us(t.charCodeAt(h));)h++;if(this.returnType=t.slice(l,h).trim(),u===\\\"\\\"){let d=this.returnType.slice(-1);(d===\\\"$\\\"||d===\\\"*\\\")&&(u=d,this.returnType=this.returnType.slice(0,-1))}return this.classifier=u,!0}r=i+1}return this.memberType=\\\"attribute\\\",!1}parseAttribute(t){let n=t.slice(0,1),r=t.slice(-1);Kb(n)&&(this.visibility=n),(r===\\\"$\\\"||r===\\\"*\\\")&&(this.classifier=r),this.id=t.substring(this.visibility===\\\"\\\"?0:1,this.classifier===\\\"\\\"?t.length:t.length-1)}getDisplayDetails(){let t=this.visibility+xs(this.id);return this.memberType===\\\"method\\\"&&(t+=`(${xs(this.parameters.trim())})`,this.returnType&&(t+=\\\" : \\\"+xs(this.returnType))),{displayText:t.trim(),cssStyle:this.parseClassifier()}}parseClassifier(){return this.classifier===\\\"*\\\"?\\\"font-style:italic;\\\":this.classifier===\\\"$\\\"?\\\"text-decoration:underline;\\\":\\\"\\\"}};var Z2={LINE:0,DOTTED_LINE:1},qi={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},J2=\\\"classId-\\\";function As(e){let t=e.indexOf(\\\"~\\\");if(t\u003C=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 zb(e){let t=e.charCodeAt(0);return As(t>=48&&t\u003C=57?J2+e:e).className}var Qc=class{constructor(){fe(this,\\\"type\\\",\\\"class\\\");fe(this,\\\"lineType\\\",Z2);fe(this,\\\"relationType\\\",qi);fe(this,\\\"direction\\\",\\\"TB\\\");fe(this,\\\"classes\\\",new Map);fe(this,\\\"relations\\\",[]);fe(this,\\\"notes\\\",new Map);fe(this,\\\"namespaces\\\",new Map);fe(this,\\\"interfaces\\\",[]);fe(this,\\\"styleClasses\\\",new Map);fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"namespaceStack\\\",[]);fe(this,\\\"withCssClass\\\",new Map)}addClass(t){let{className:n,type:r}=As(t);if(this.classes.has(n))return;let i={id:n,type:r,label:n,cssClasses:\\\"default\\\",methods:[],members:[],annotations:[],styles:[]};this.classes.set(n,i),this.tag(i,\\\"default\\\")}tag(t,n){let r=this.withCssClass.get(n);r?r.add(t):this.withCssClass.set(n,new Set([t]))}ensure(t){return this.addClass(t),this.classes.get(As(t).className)}setClassLabel(t,n){this.ensure(t).label=n}addRelation(t){let{type1:n,type2:r}=t.relation;n===qi.LOLLIPOP&&r===\\\"none\\\"?(this.addClass(t.id2),t.id1=this.addInterface(t.id1,t.id2)):r===qi.LOLLIPOP&&n===\\\"none\\\"?(this.addClass(t.id1),t.id2=this.addInterface(t.id2,t.id1)):(this.addClass(t.id1),this.addClass(t.id2)),t.id1=As(t.id1).className,t.id2=As(t.id2).className,t.relationTitle1=t.relationTitle1.trim(),t.relationTitle2=t.relationTitle2.trim(),this.relations.push(t)}addInterface(t,n){let r=`interface${this.interfaces.length}`;return this.interfaces.push({id:r,label:t,classId:n}),r}addAnnotation(t,n){this.ensure(t).annotations.push(n)}addMember(t,n){let r=this.ensure(t);if(typeof n!=\\\"string\\\")return;let i=n.trim();if(i.startsWith(\\\"\u003C\u003C\\\")&&i.endsWith(\\\">>\\\"))r.annotations.push(i.substring(2,i.length-2));else if(i.indexOf(\\\")\\\")>0){let s=new sa(i,\\\"method\\\");(s.memberType===\\\"method\\\"?r.methods:r.members).push(s)}else i&&r.members.push(new sa(i,\\\"attribute\\\"))}addMembers(t,n){if(Array.isArray(n)){n.reverse();for(let r of n)this.addMember(t,r)}}addNote(t,n){let r=this.notes.size,i=`note${r}`;return this.notes.set(i,{id:i,class:n,text:t,index:r}),i}cleanupLabel(t){return(t.startsWith(\\\":\\\")?t.substring(1):t).trim()}setCssClass(t,n){for(let r of t.split(\\\",\\\")){let i=this.classes.get(zb(r));if(i!==void 0){i.cssClasses+=\\\" \\\"+n;for(let s of n.split(\\\" \\\"))this.tag(i,s)}}}defineClass(t,n){for(let r of t){let i=this.styleClasses.get(r);if(i===void 0&&(i={id:r,styles:[],textStyles:[]},this.styleClasses.set(r,i)),!n)continue;for(let o of n)o.includes(\\\"color\\\")&&i.textStyles.push(o.replace(\\\"fill\\\",\\\"bgFill\\\")),i.styles.push(o);let s=this.withCssClass.get(r);if(s===void 0)continue;let a=n.flatMap(o=>o.split(\\\",\\\"));for(let o of s)for(let c of a)o.styles.push(c)}}setTooltip(t,n){if(n!==void 0)for(let r of t.split(\\\",\\\")){let i=this.classes.get(As(r).className);i&&(i.tooltip=n)}}setLink(t,n,r){let i=bt(n).trim();for(let s of t.split(\\\",\\\")){let a=this.classes.get(zb(s));a&&(a.link=i?ki(i):void 0,a.linkTarget=typeof r==\\\"string\\\"?r:\\\"_blank\\\")}this.setCssClass(t,\\\"clickable\\\")}setClickEvent(t,n,r){for(let i of t.split(\\\",\\\")){let s=this.classes.get(As(i).className);s&&(s.haveCallback=!0)}this.setCssClass(t,\\\"clickable\\\")}setDirection(t){this.direction=t}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}addNamespace(t,n){let r=this.namespaceStack[this.namespaceStack.length-1],i=r?`${r}.${t}`:t;this.namespaceStack.push(i);let s=this.namespaces.get(i);if(s)return s.explicit=!0,n&&(s.label=n),i;let a=r||void 0,o=r?r.length+1:0;for(;;){let c=i.indexOf(\\\".\\\",o),l=c===-1,u=l?i:i.slice(0,c),h=this.namespaces.get(u);if(h===void 0){let m=i.slice(o,l?i.length:c);h={id:u,label:l&&n?n:m,classes:new Map,notes:new Map,children:new Map,parent:a,explicit:l},this.namespaces.set(u,h)}else l&&(h.explicit=!0);let d=a?this.namespaces.get(a):void 0;if(d&&(d.children.has(u)||d.children.set(u,h),h.parent??=a),l)return i;a=u,o=c+1}}popNamespace(){this.namespaceStack.pop()}addClassesToNamespace(t,n,r){let i=this.namespaces.get(t);if(i!==void 0){for(let s of n){let{className:a}=As(s),o=this.classes.get(a);o!==void 0&&(o.parent=t,i.classes.set(a,o))}for(let s of r){let a=this.notes.get(s);a!==void 0&&(a.parent=t,i.notes.set(s,a))}}}setCssStyle(t,n){let r=this.classes.get(t);if(!(!n||!r))for(let i of n)for(let s of i.split(\\\",\\\"))r.styles.push(s)}};var Af=[\\\"$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\\\"];var eM=[4,6,4,9,44,45,12,14,15,4,56,4,56],tM=[/.*direction\\\\s+TB[^\\\\n]*/y,/.*direction\\\\s+BT[^\\\\n]*/y,/.*direction\\\\s+RL[^\\\\n]*/y,/.*direction\\\\s+LR[^\\\\n]*/y],Sf=/[\\\\n\\\\r\\\\u2028\\\\u2029]/g;function Vb(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=e.indexOf(\\\"direction\\\"),l=-1,u=0,h=(O,v,G)=>(n.push(O),r.push(e.slice(v,G)),i.push(v),o=G,!0),d=O=>{s.push(a),a=O},m=()=>{s.length>0&&(a=s.pop())},p=O=>e.startsWith(O,o)&&!ot(e.charCodeAt(o+O.length)),y=O=>{for(;O\u003Ct&&qe(e.charCodeAt(O));)O++;return O},E=O=>{let v=e.indexOf(O,o);return v===-1?t:v},b=O=>{let v=o,G=-1;for(let K=e.charCodeAt(v);v\u003Ct&&qe(K);K=e.charCodeAt(++v))K===10&&(G=v);if(G\u003C0){o=v;return}O&&m(),h(3,o,G+1)},S=O=>{switch(O){case 99:if(p(\\\"cssClass\\\"))return h(48,o,o+8);if(p(\\\"callback\\\"))return h(40,o,o+8);if(p(\\\"click\\\"))return h(43,o,o+5);break;case 108:if(p(\\\"link\\\"))return h(41,o,o+4);break;case 110:if(p(\\\"note for\\\"))return h(24,o,o+8);if(p(\\\"note\\\"))return h(25,o,o+4);break;case 60:if(e.charCodeAt(o+1)===60)return h(20,o,o+2);break;case 62:if(e.charCodeAt(o+1)===62)return h(21,o,o+2);break;case 104:if(p(\\\"href\\\"))return h(46,o,o+4);break}return!1},x=O=>{if(S(O))return!0;let v=e.charCodeAt(o+1);switch(O){case 34:return d(1),o++,!0;case 126:return d(3),o++,!0;case 96:return d(2),o++,!0;case 95:if(p(\\\"_self\\\"))return h(42,o,o+5);if(p(\\\"_blank\\\"))return h(42,o,o+6);if(p(\\\"_parent\\\"))return h(42,o,o+7);if(p(\\\"_top\\\"))return h(42,o,o+4);break;case 60:return v===124?h(34,o,o+2):h(36,o,o+1);case 124:return v===62&&h(34,o,o+2);case 62:return h(36,o,o+1);case 42:return h(35,o,o+1);case 111:if(!ot(v))return h(33,o,o+1);break;case 40:return v===41&&h(37,o,o+2);case 45:return v===45?h(38,o,o+2):h(52,o,o+1);case 46:return v===46?h(39,o,o+2):h(8,o,o+1);case 58:{let G=o+1;for(;G\u003Ct;){let K=e.charCodeAt(G);if(K===58||K===10||K===59)break;G++}return G>o+1?h(10,o,G):v===58&&e.charCodeAt(o+2)===58&&h(19,o,o+3)}case 43:return h(58,o,o+1);case 37:return h(51,o,o+1);case 61:return h(59,o,o+1);case 91:return h(5,o,o+1);case 93:return h(7,o,o+1);case 33:case 35:case 36:case 38:case 39:case 44:case 63:case 92:case 47:return h(60,o,o+1)}if(ot(O)){let G=o+1;for(;ot(e.charCodeAt(G));)G++;return h(27,o,G)}return Oi(O)&&h(53,o,o+1)},I=()=>{if(c===-1||o\u003Cu||(c\u003Co&&(c=e.indexOf(\\\"direction\\\",o)),c===-1)||(l\u003Co&&(Sf.lastIndex=o,l=Sf.test(e)?Sf.lastIndex-1:t),c>=l))return!1;for(let O=0;O\u003C4;O++){let v=tM[O];if(v.lastIndex=o,v.test(e))return h(29+O,o,v.lastIndex)}return u=l,!1},L=O=>{if(I())return!0;if(qe(O))return b(!1),!0;switch(O){case 37:if(e.charCodeAt(o+1)===37){let v=E(`\\r\\n`);for(;v\u003Ct&&(e.charCodeAt(v)===10||e.charCodeAt(v)===13);)v++;return o=v,!0}break;case 97:{let v=e.startsWith(\\\"accTitle\\\",o);if(!v&&!e.startsWith(\\\"accDescr\\\",o))break;let G=y(o+8),K=e.charCodeAt(G);if(K===58)return h(v?11:13,o,y(G+1)),d(v?6:7),!0;if(K===123&&!v)return o=y(G+1),d(8),!0;break}case 99:if(p(\\\"classDiagram-v2\\\"))return h(2,o,o+15);if(p(\\\"classDiagram\\\"))return h(2,o,o+12);if(e.startsWith(\\\"call\\\",o)&&qe(e.charCodeAt(o+4)))return o=y(o+4),d(4),!0;if(p(\\\"classDef\\\"))return h(26,o,o+8);if(p(\\\"class\\\"))return d(9),h(22,o,o+5);break;case 91:if(e.startsWith(\\\"*]\\\",o+1))return h(55,o,o+3);break;case 115:if(p(\\\"style\\\"))return h(47,o,o+5);break;case 110:if(p(\\\"namespace\\\"))return d(11),h(18,o,o+9);break;case 44:return h(28,o,o+1);case 35:return h(50,o,o+1)}return x(O)||O===58&&h(49,o,o+1)};for(;;){if(o>=t){n.push(eM[a]),r.push(\\\"\\\"),i.push(t);break}let O=e.charCodeAt(o),v=!0;switch(a){case 0:v=L(O);break;case 9:qe(O)?b(!0):O===125?(m(),m(),h(17,o,o+1)):O===123?(d(10),h(16,o,o+1)):v=x(O);break;case 10:if(O===34)d(1),o++;else if(O===125)m(),h(17,o,o+1);else if(O===91&&e.startsWith(\\\"*]\\\",o+1))h(55,o,o+3);else if(O===123)h(57,o,o+1);else if(O===10)o++;else{let G=o+1;for(;G\u003Ct;){let K=e.charCodeAt(G);if(K===123||K===125||K===10)break;G++}h(23,o,G)}break;case 11:qe(O)?b(!0):O===123?(d(12),h(16,o,o+1)):O===125?m():O===110&&p(\\\"namespace\\\")?(d(11),h(18,o,o+9)):v=x(O);break;case 12:qe(O)?b(!1):O===125?(m(),h(17,o,o+1)):O===110&&p(\\\"namespace\\\")?(d(11),h(18,o,o+9)):O===91&&e.startsWith(\\\"*]\\\",o+1)?h(55,o,o+3):O===99&&p(\\\"class\\\")?(d(9),h(22,o,o+5)):v=x(O);break;case 1:O===34?(m(),o++):h(6,o,E('\\\"'));break;case 3:if(O===34)d(1),o++;else{if(S(O))break;O===126?(m(),o++):h(9,o,E(\\\"~\\\"))}break;case 2:if(O===34)d(1),o++;else{if(S(O))break;O===126?(d(3),o++):O===96?(m(),o++):h(54,o,E(\\\"`\\\"))}break;case 4:if(O===40){let G=y(o+1);m(),e.charCodeAt(G)===41?o=G+1:(d(5),o++)}else h(44,o,E(\\\"(\\\"));break;case 5:O===41?(m(),o++):h(45,o,E(\\\")\\\"));break;case 6:case 7:h(a===6?12:14,o,E(`\\r\\n`)),m();break;case 8:O===125?(m(),o++):h(15,o,E(\\\"}\\\"));break}if(!v)return n.push(1),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i}}return n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i}}var _f=61,Zc=new Uint8Array(_f);for(let e of[53,27,52])Zc[e]=1;var wf=new Uint8Array(_f);for(let e of[27,49,50,47,51,10])wf[e]=1;var ti=new Uint8Array(_f);ti[33]=1;ti[34]=2;ti[35]=3;ti[36]=4;ti[37]=5;var nM=\\\"'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS', 'BQUOTE_STR'\\\";function jb(e,t){let{types:n,texts:r,starts:i}=Vb(e),s=0,a=O=>{let v=n[s];throw v===1?ft(\\\"class\\\",e,i[s],\\\"\\\",!0):ft(\\\"class\\\",e,i[s],`Expecting ${O}, got '${Af[v]}'`)},o=O=>(n[s]!==O&&a(`'${Af[O]}'`),r[s++]),c=()=>(Zc[n[s]]===0&&a(\\\"'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS'\\\"),r[s++]),l=O=>{let v=\\\"\\\";for(;;){if(n[s]===54){v+=r[s++];break}Zc[n[s]]===0&&a(nM),v+=r[s++];let G=n[s];if(G===8)v+=\\\".\\\",s++;else if(Zc[G]===0&&G!==54)break}return O&&n[s]===9&&(v+=\\\"~\\\"+r[s++]+\\\"~\\\"),v},u=()=>{s++;let O=o(6);return o(7),O},h=()=>{n[s]!==23&&a(\\\"'STRUCT_STOP', 'MEMBER'\\\");let O=[];for(;n[s]===23;)O.push(r[s++]);return o(17),O.reverse()},d=()=>{s++;let O=l(!0);switch(t.addClass(O),n[s]===5&&t.setClassLabel(O,u()),n[s]){case 19:{s++;let v=c();t.setCssClass(O,v),n[s]===16&&(s++,t.addMembers(O,h()));break}case 16:s++,n[s]===17?s++:t.addMembers(O,h());break;case 20:{s++;let v=c();o(21),t.addAnnotation(O,v),n[s]===16&&(s++,n[s]===17?s++:t.addMembers(O,h()));break}}return O},m=()=>{if(n[s++]===25)return t.addNote(o(6));let O=l(!0);return t.addNote(o(6),O)},p=()=>{let O=[];for(;;){s++;let v=l(!1),G=n[s]===5?t.addNamespace(v,u()):t.addNamespace(v);o(16),n[s]===3&&s++,O.push({id:G,classes:[],notes:[]});let K=!0;for(;K;){let C=O[O.length-1],Z=n[s];if(Z===18)break;for(Z===22?C.classes.push(d()):Z===25||Z===24?C.notes.push(m()):a(\\\"'NAMESPACE', 'CLASS', 'NOTE_FOR', 'NOTE'\\\");;){if(n[s]===3){let H=n[s+1];if(H===18||H===22||H===25||H===24){s++;break}s++}o(17);let oe=O.pop();if(t.addClassesToNamespace(oe.id,oe.classes,oe.notes),t.popNamespace(),O.length===0){K=!1;break}}}if(O.length===0)return}},y=()=>{let O=ti[n[s]];return O===0?\\\"none\\\":(s++,O-1)},E=()=>{let O=l(!0),v=n[s];if(v===10){t.addMember(O,t.cleanupLabel(r[s++]));return}let G=\\\"none\\\";if(v===6)G=r[s++],v=n[s];else if(ti[v]===0&&v!==38&&v!==39)return;let K=y();v=n[s],v!==38&&v!==39&&a(\\\"'AGGREGATION', 'EXTENSION', 'COMPOSITION', 'DEPENDENCY', 'LOLLIPOP', 'LINE', 'DOTTED_LINE'\\\"),s++;let C=y(),Z=n[s]===6?r[s++]:\\\"none\\\",oe=l(!0),H={id1:O,id2:oe,relation:{type1:K,type2:C,lineType:v===38?0:1},relationTitle1:G,relationTitle2:Z};n[s]===10&&(H.title=t.cleanupLabel(r[s++])),t.addRelation(H)},b=()=>{let O=[];for(;;){wf[n[s]]===0&&a(\\\"'ALPHA', 'NUM', 'COLON', 'UNIT', 'SPACE', 'BRKT', 'STYLE', 'PCT', 'LABEL'\\\");let v=r[s++];for(;wf[n[s]]===1;)v+=r[s++];if(O.push(v),n[s]!==28)return O;s++}},S=O=>{n[s]===6&&t.setTooltip(O,r[s++])},x=O=>{let v=o(6),G=n[s]===6?r[s++]:void 0;n[s]===42?t.setLink(O,v,r[s++]):t.setLink(O,v),G!==void 0&&t.setTooltip(O,G)},I=()=>{let O=n[s];switch(O){case 53:case 27:case 52:case 54:E();return;case 18:p();return;case 22:d();return;case 23:s++;return;case 20:{s++;let v=c();o(21),t.addAnnotation(l(!0),v);return}case 40:{s++;let v=l(!0);t.setClickEvent(v,o(6)),S(v);return}case 41:s++,x(l(!0));return;case 43:{s++;let v=l(!0);if(n[s]===46){s++,x(v);return}let G=o(44);n[s]===45?t.setClickEvent(v,G,r[s++]):t.setClickEvent(v,G),S(v);return}case 47:{s++;let v=o(27);t.setCssStyle(v,b());return}case 48:{s++;let v=o(6);t.setCssClass(v,o(27));return}case 25:case 24:m();return;case 26:{s++;let v=[o(27)];for(;n[s]===28;)s++,v.push(o(27));t.defineClass(v,b());return}case 29:case 30:case 31:case 32:s++,t.setDirection(O===29?\\\"TB\\\":O===30?\\\"BT\\\":O===31?\\\"RL\\\":\\\"LR\\\");return;case 11:s++,t.setAccTitle(o(12).trim());return;case 13:s++,t.setAccDescription(o(14).trim());return;case 15:t.setAccDescription(r[s++].trim());return}a(\\\"'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'\\\")},L=n[s]===2;for(L&&(s++,o(3));I(),!(n[s]!==3||(s++,n[s]===4||n[s]===0)););L&&o(4),o(0)}function Xb(e,t,n,r){let i=Int32Array.from(e,(b,S)=>S),s=b=>{for(;i[b]!==b;)i[b]=i[i[b]],b=i[b];return b},a=(b,S)=>{i[s(b)]=s(S)};for(let b=0;b\u003Ce.length;b++)e[b].parent>=0&&a(b,e[b].parent);for(let b of t)a(b.src,b.dst);let o=new Map,c=(b,S,x,I=0,L=0)=>{b.left=Math.min(b.left,S-I/2),b.top=Math.min(b.top,x-L/2),b.right=Math.max(b.right,S+I/2),b.bottom=Math.max(b.bottom,x+L/2)};for(let b=0;b\u003Ce.length;b++){let S=s(b),x=o.get(S);x||(x={nodes:[],edges:[],left:1/0,top:1/0,right:-1/0,bottom:-1/0},o.set(S,x));let I=e[b];x.nodes.push(I),c(x,I.x,I.y,I.w,I.h)}if(o.size\u003C2)return;for(let b of t){let S=o.get(s(b.src));S.edges.push(b);for(let x=0;x\u003Cb.route.length;x+=3)c(S,b.route[x],b.route[x+1]);b.labelW>0&&c(S,b.labelX,b.labelY,b.labelW,b.labelH)}let l=0,u=0,h=0,d=0,m=1/0,p=-1/0,y=[];for(let b of o.values()){let S=b.right-b.left,x=b.bottom-b.top;l>0&&l+S>n&&(u+=h+r,l=0,h=0),y.push(l-b.left,u-b.top),m=Math.min(m,b.left),p=Math.max(p,b.right),d=Math.max(d,l+S),h=Math.max(h,x),l+=S+r}if(d>=p-m)return;let E=0;for(let b of o.values())Tr(b.nodes,b.edges,y[E++],y[E++]);return{width:d,height:u+h}}var rM=[\\\"aggregation\\\",\\\"extension\\\",\\\"composition\\\",\\\"dependency\\\",\\\"lollipop\\\"];function qb(e){return typeof e==\\\"number\\\"&&rM[e]||\\\"none\\\"}function Qb(e,t=!0){let n=[],r=[],i=new Map,s=new Map,a=new Map,o=new Map,c=d=>{if(t||d===void 0)return d;let m=[],p=d,y;for(;p;){if(o.has(p)){y=o.get(p);break}let E=e.namespaces.get(p);if(E===void 0)break;if(E.explicit){y=p;break}m.push(p),p=E.parent}for(let E of m)o.set(E,y);return y},l=d=>d===void 0?-1:i.get(d)??-1;for(let d of e.namespaces.values())!t&&!d.explicit||(i.set(d.id,n.length),n.push({id:d.id,label:t?d.label:d.id,isGroup:!0,shape:\\\"rect\\\",parentId:t?d.parent:void 0,parent:-1}));for(let d of n)d.parent=l(d.parentId);let u=0;for(let d of e.classes.values()){let m=c(d.parent);s.set(d.id,n.length),n.push({id:d.id,label:d.label,isGroup:!1,shape:\\\"classBox\\\",parentId:m,parent:l(m),classNode:d,colorIndex:u++})}for(let d of e.notes.values()){let m=c(d.parent),p=d.class===void 0?void 0:s.get(d.class);p!==void 0&&r.push({id:`edgeNote${d.index}`,start:d.id,end:n[p].id,source:n.length,target:p,label:void 0,arrowTypeStart:\\\"none\\\",arrowTypeEnd:\\\"none\\\",startLabelRight:\\\"\\\",endLabelLeft:\\\"\\\",pattern:\\\"dotted\\\",classes:\\\"relation\\\"}),n.push({id:d.id,label:d.text,isGroup:!1,shape:\\\"note\\\",parentId:m,parent:l(m)})}for(let d of e.interfaces){let m=s.get(d.classId);a.set(d.id,n.length),n.push({id:d.id,label:d.label,isGroup:!1,shape:\\\"interface\\\",parentId:void 0,parent:m===void 0?-1:n[m].parent})}let h=0;for(let d of e.relations){h++;let{type1:m,type2:p}=d.relation,y=m===qi.LOLLIPOP&&p===\\\"none\\\"?a:s,E=y===s&&p===qi.LOLLIPOP&&m===\\\"none\\\"?a:s;r.push({id:`id_${d.id1}_${d.id2}_${h}`,start:d.id1,end:d.id2,source:y.get(d.id1)??-1,target:E.get(d.id2)??-1,label:d.title,arrowTypeStart:qb(m),arrowTypeEnd:qb(p),startLabelRight:d.relationTitle1===\\\"none\\\"?\\\"\\\":d.relationTitle1,endLabelLeft:d.relationTitle2===\\\"none\\\"?\\\"\\\":d.relationTitle2,pattern:d.relation.lineType===1?\\\"dashed\\\":\\\"solid\\\",classes:\\\"relation\\\"})}return{nodes:n,edges:r}}var Rf=12,oa=16,ia=6,Jc=5;function Tf(e){switch(e){case\\\"extension\\\":return Rf;case\\\"composition\\\":case\\\"aggregation\\\":return oa;case\\\"lollipop\\\":return 2*Jc;case\\\"dependency\\\":return Rt(\\\"arrow_point\\\")}return 0}function Mf(e,t,n,r,i,s){let a=-i,o=r;switch(e){case\\\"extension\\\":{let c=t-r*Rf,l=n-i*Rf;return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(t)},${f(n)}L${f(c+a*ia)},${f(l+o*ia)}L${f(c-a*ia)},${f(l-o*ia)}Z\\\" stroke-linejoin=\\\"round\\\"/>`}case\\\"composition\\\":case\\\"aggregation\\\":{let c=t-r*oa/2,l=n-i*oa/2,u=ia-1;return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(t)},${f(n)}L${f(c+a*u)},${f(l+o*u)}L${f(t-r*oa)},${f(n-i*oa)}L${f(c-a*u)},${f(l-o*u)}Z\\\" stroke-linejoin=\\\"round\\\"${e===\\\"composition\\\"?` fill=\\\"${s}\\\"`:\\\"\\\"}/>`}case\\\"lollipop\\\":return`\u003Ccircle class=\\\"pele-marker\\\" cx=\\\"${f(t-r*Jc)}\\\" cy=\\\"${f(n-i*Jc)}\\\" r=\\\"${Jc}\\\"/>`;case\\\"dependency\\\":return _t(\\\"arrow_point\\\",t,n,r,i,s)}return\\\"\\\"}var Zb=40,sM=16,Jb=56,ni=20,Cf=26,Nf=12,el=8,ey=6,iM=10,oM=64,tl=8,If=\\\"var(--_l)\\\",aM=new Set([\\\"_self\\\",\\\"_blank\\\",\\\"_parent\\\",\\\"_top\\\"]);function kf(e,t,n){let r=e[t];return typeof r==\\\"number\\\"&&r>0?Math.min(r,2e3):n}var nl=[],rl=[];function ty(e,t,n,r){let i=bt(e.getDisplayDetails().displayText).trim(),s=(e.classifier===\\\"*\\\"?2:0)|(r?4:0);return{text:i,width:t.width(i,n,s),classifier:e.classifier}}function ny(e,t,n){let r=i=>An(n,s=>cM(e,t,n,i,s));return Pn(e.direction)?Pt(n,r):r(!1)}function cM(e,t,n,r,i){let s=t.class??{},a=Qb(e,s.hierarchicalNamespaces!==!1),o=s.hideEmptyMembersBox===!0,c=Array.isArray(n.monospace)&&n.monospace.includes(\\\"members\\\"),l=be=>c&&!/[\\\";]font-family:/.test(be.text),u=n.fontSize??16,h=Math.round(u*.875),d=Math.round(u*.8),m=Math.round(d*1.4),p=n.measurer??ct(n.fontFamily,n.fontFamilyMono),y=n.padding??8,E=(be,Ae)=>{if(!be.includes(\\\"$$\\\"))return;let ie=Ge(be,!1,p,Ae,4e3);return ie.lines.some(Yi)?ie:void 0},b=be=>be?E(be,d)?.width??p.width(bt(be),d,0):0,S=r?\\\"TB\\\":ln(e.direction),x=new Map,I=new Map,L=new Map,O=be=>{let Ae=x.get(be);if(Ae===void 0){let ie=Ct([be]);Ae=ie.shape===\\\"\\\"&&ie.text===\\\"\\\"?\\\"\\\":be.slice(0,be.indexOf(\\\":\\\")).trim().toLowerCase(),x.set(be,Ae)}Ae!==\\\"\\\"&&L.set(Ae,be)},v=be=>{L.clear();let Ae=I.get(be.cssClasses);if(Ae===void 0){for(let ie of be.cssClasses.split(\\\" \\\")){let me=e.styleClasses.get(ie);if(me)for(let Te of me.styles)for(let ye of Te.split(\\\",\\\"))O(ye)}Ae=[...L],I.set(be.cssClasses,Ae)}else for(let[ie,me]of Ae)L.set(ie,me);for(let ie of be.styles)O(ie);return Ct(L.size===0?rl:[...L.values()])},G=new Int32Array(a.nodes.length);for(let be of a.nodes)be.parent>=0&&G[be.parent]++;let K=new Uint8Array(a.nodes.length);for(let be of a.edges){if(be.source\u003C0||be.target\u003C0)continue;let Ae=a.nodes[be.source].parent,ie=a.nodes[be.target].parent;if(Ae!==ie){for(let me=Ae;me>=0&&K[me]===0;me=a.nodes[me].parent)K[me]=1;for(let me=ie;me>=0&&K[me]===0;me=a.nodes[me].parent)K[me]=1}}let C=[],Z=[];a.nodes.forEach((be,Ae)=>{let ie,me;if(be.isGroup){let Te=Ge(be.label,!1,p,u,4e3);ie=oe(be,Te,0,0,u),G[Ae]>0?(me=Bt(0,0),me.isGroup=!0,me.padX=ni,me.padTop=Te.height>0?Te.height+16:ni,me.padBottom=ni,me.minW=Te.width+2*ni-12+(K[Ae]===1&&!i?Math.min(Te.width+24,240):0)):(ie.w=Math.max(Te.width+2*ni,80),ie.h=Te.height+2*ni,me=Bt(ie.w,ie.h))}else if(be.classNode)ie=H(be,be.classNode),me=Bt(ie.w,ie.h);else if(be.shape===\\\"note\\\"){let Te=Ge(be.label,!0,p,h,260);ie=oe(be,Te,Math.max(Te.width+2*Nf,40),Te.height+2*el,h),me=Bt(ie.w,ie.h)}else{let Te=Ge(be.label,!1,p,h,200);ie=oe(be,Te,Math.max(Te.width,12)+4,Math.max(Te.height,12),h),me=Bt(ie.w,ie.h)}me.parent=be.parent,me.seq=Ae,C.push(ie),Z.push(me)});function oe(be,Ae,ie,me,Te){return{node:be,style:Ct(rl),label:Ae,w:ie,h:me,loops:0,annotations:rl,attributes:nl,methods:nl,titleH:0,attributesH:0,fontSize:Te}}function H(be,Ae){let ie=v(Ae),me=ie.fontSize??u,Te=Math.round(me*.875),ye=Math.round(Te*1.5),we=Ae.type?\\\"<\\\"+xs(Ae.type).replace(/\u003C/g,\\\"<\\\").replace(/>/g,\\\">\\\")+\\\">\\\":\\\"\\\",Ie=Ge(Ae.label+we,!1,p,me,4e3,1|(ie.italic?2:0)),ve=Ae.annotations.length>0?Ae.annotations.map(Oe=>E(`«${Oe.trim()}»`,d)??`«${bt(Oe).trim()}»`):rl,Pe=Ae.members.length>0?Ae.members.map(Oe=>ty(Oe,p,Te,l(ie))):nl,he=Ae.methods.length>0?Ae.methods.map(Oe=>ty(Oe,p,Te,l(ie))):nl,Re=Ie.width,Be=0;for(let Oe of ve)Re=Math.max(Re,typeof Oe==\\\"string\\\"?p.width(Oe,d,0):Oe.width),Be+=typeof Oe==\\\"string\\\"?m:Math.max(m,Oe.height);for(let Oe of Pe)Re=Math.max(Re,Oe.width);for(let Oe of he)Re=Math.max(Re,Oe.width);let ge=!(o&&Pe.length===0&&he.length===0),Le=Oe=>ge?Oe>0?2*ey+Oe*ye:iM:0,Fe=2*el+Be+Math.max(Ie.height,Math.round(me*1.5)),Ve=Le(Pe.length);return{node:be,style:ie,label:Ie,w:Math.max(Re+2*Nf,oM),h:Fe+Ve+Le(he.length),loops:0,annotations:ve,attributes:Pe,methods:he,titleH:Fe,attributesH:Ve,fontSize:me}}let z=[],M=[],T=[],R=[],_=[],$=new Float64Array(C.length*4),g=(be,Ae,ie)=>{$[be*4+Ae]++,ie>$[be*4+Ae+1]&&($[be*4+Ae+1]=ie)};for(let be of a.edges){if(be.source\u003C0||be.target\u003C0)continue;let Ae=Ge(be.label,!0,p,h,200),ie=b(be.startLabelRight),me=b(be.endLabelLeft);be.source===be.target?(C[be.source].loops++,Z[be.source].w+=2*(Cf+(Ae.width>0?Ae.width+12:0))):(g(be.source,0,ie),g(be.target,2,me)),R.push(ie),_.push(me),M.push(be),T.push(Ae),z.push({src:be.source,dst:be.target,minlen:1,labelW:Ae.width>0?Ae.width+12:0,labelH:Ae.height>0?Ae.height+4:0,route:[],labelX:0,labelY:0})}if(S===\\\"TB\\\"||S===\\\"BT\\\")for(let be=0;be\u003CC.length;be++){if(!C[be].node.classNode)continue;let Ae=0;for(let ie=0;ie\u003C4;ie+=2){let me=$[be*4+ie],Te=$[be*4+ie+1];me>1&&(Ae=Math.max(Ae,(me-1)*(Te>0?Te+24:14)+24))}Ae=Math.min(Ae,480),Ae>C[be].w&&(Z[be].w+=Ae-C[be].w,C[be].w=Ae)}let N=!1;for(let be=0;be\u003CM.length&&!N;be++)N=R[be]>0||_[be]>0;let w=0;if(S===\\\"TB\\\"||S===\\\"BT\\\"){let be=Ae=>Ae?Math.max(m,E(Ae,d)?.height??0):0;for(let Ae of M)w=Math.max(w,be(Ae.startLabelRight)+be(Ae.endLabelLeft)-2*m)}let A=On(Z,z,S,{nodeSep:kf(s,\\\"nodeSpacing\\\",Zb),edgeSep:sM,rankSep:kf(s,\\\"rankSpacing\\\",N?Jb+16:Jb)+w,portSep:20,apart:!0}),D=new Map,U=[],B=(be,Ae,ie,me,Te)=>{let ye=be.route,we=Z[ie],Ie=Jn(ye,Ae,we);if(Ie\u003C0)return;let ve=(we.w-C[ie].w)/2;Ie===1?ye[Ae]-=ve:Ie===3&&(ye[Ae]+=ve);let Pe=Ie&1,he=ye[(Ae===0?3:Ae-3)+Pe],Re=he-ye[Ae+Pe],Be={route:ye,at:Ae,toward:he,order:Te,room:me,side:Ie,after:Pe?Re>0:Re>=0},ge=ie*4+Ie,Le=D.get(ge);return Le?Le.push(Be):D.set(ge,[Be]),Be},F=[],W=[];for(let be=0;be\u003Cz.length;be++){let Ae=z[be],ie=Ae.src!==Ae.dst&&Ae.route.length>=6;F.push(ie?B(Ae,0,Ae.src,R[be],be):void 0),W.push(ie?B(Ae,Ae.route.length-3,Ae.dst,_[be],be):void 0)}let j=(be,Ae,ie)=>{for(let me=Z[be].parent,Te=0;me>=0&&Te\u003C1e4;me=Z[me].parent,Te++){let ye=Z[me],we=Math.abs(Ae-ye.x),Ie=Math.abs(ie-ye.y);if(Math.abs(Ie-ye.h/2)\u003C.5&&we\u003C=ye.w/2+.5||Math.abs(we-ye.w/2)\u003C.5&&Ie\u003C=ye.h/2+.5)return!0}return!1},Q=[];for(let[be,Ae]of D){if(Ae.length\u003C2)continue;let ie=be>>2,me=be&1,Te=me?C[ie].h:C[ie].w;Ae.sort((ve,Pe)=>ve.toward-Pe.toward||ve.order-Pe.order);let ye=0;for(let ve=0;ve+1\u003CAe.length;ve++){let Pe=Ae[ve],he=Ae[ve+1],Re=me?20:24;Pe.room>0&&Pe.after&&(Re+=me?m+6:Pe.room),he.room>0&&!he.after&&(Re+=me?m+6:he.room),Q[ve]=Re,ye+=Re}let we=Math.min(1,(Te-24)/ye);if(we\u003C=0)continue;let Ie=(me?Z[ie].y:Z[ie].x)-ye*we/2;for(let ve=0;ve\u003CAe.length;ve++){let{route:Pe,at:he}=Ae[ve],Re=he===0?3:-3,Be=he+Re,ge=-1;for(let Le=Be;Le>=0&&Le\u003CPe.length&&Math.abs(Pe[Le+me]-Pe[Be+me])\u003C.5;Le+=Re)if(j(ie,Pe[Le],Pe[Le+1])){ge=Le;break}if(ge>=0&&Math.abs(Pe[Be+me]-Ie)\u003C=24)for(let Le=Be;Le!==ge+Re;Le+=Re)Pe[Le+me]=Ie;Pe[he+me]=Ie,Ie+=Q[ve]*we}}let Y=(be,Ae,ie,me)=>{if(Ae===void 0||ie\u003C=0)return;let Te=Ae.side&1,ye=me?0:be.length-3,we=ye+1-Te,Ie=Math.abs(be[(me?3:ye-3)+1-Te]-be[we]),ve=Math.min(Te?ie+10:m+6,Ie*.35);if(ve\u003C4)return;let Pe=[be[ye],be[ye+1],be[ye+2]];Pe[1-Te]+=(Ae.side===0||Ae.side===3?-1:1)*ve,be.splice(me?3:ye,0,Pe[0],Pe[1],Pe[2])};for(let be=0;be\u003Cz.length;be++)Y(z[be].route,F[be],R[be],!0),Y(z[be].route,W[be],_[be],!1);let ne=0,q=0,k=A.width,J=A.height,te=(be,Ae,ie,me,Te,ye,we)=>{if(!Ae)return;let Ie=E(Ae,d),ve=Ie?Math.max(m,Ie.height):m,Pe=me,he=Te;ye&1?(Pe+=(ye===3?-1:1)*(5+ie/2),he+=(we?1:-1)*(7+ve/2)):(Pe+=(we?1:-1)*(9+ie/2),he+=(ye===0?-1:1)*(3+ve/2)),U.push({text:bt(Ae),math:Ie,x:Pe,y:he,w:ie,h:ve,parent:be}),ne=Math.min(ne,Pe-ie/2),k=Math.max(k,Pe+ie/2),q=Math.min(q,he-ve/2),J=Math.max(J,he+ve/2)},se=new Map,re=new Int32Array(z.length);for(let be=0;be\u003Cz.length;be++){let Ae=z[be],ie=M[be],me=Ae.route;if(Ae.src===Ae.dst){let Te=se.get(Ae.src)??0;se.set(Ae.src,Te+1),re[be]=Te;let ye=Z[Ae.src],we=C[Ae.src],Ie=ye.x+we.w/2,ve=Math.min(we.h/2-4,8+Te*6);te(Ae.src,ie.startLabelRight,R[be],Ie,ye.y-ve,1,!1),te(Ae.dst,ie.endLabelLeft,_[be],Ie,ye.y+ve,1,!0),Ae.labelX=ye.x+we.w/2+Cf+Te*8+4+Ae.labelW/2,Ae.labelY=ye.y}else if(me.length>=6){let Te=me.length-3,ye=F[be],we=W[be];te(Ae.src,ie.startLabelRight,R[be],me[0],me[1],ye?ye.side:2,ye?ye.after:!0),te(Ae.dst,ie.endLabelLeft,_[be],me[Te],me[Te+1],we?we.side:0,we?we.after:!0)}}let P=n.maxWidth;if(P!==void 0&&P>0&&k-ne+2*y>P){let be=U.map(ie=>({...Bt(ie.w,ie.h,ie.parent),x:ie.x,y:ie.y})),Ae=Xb(Z.concat(be),z,Math.max(1,P-2*y),kf(s,\\\"nodeSpacing\\\",Zb));Ae&&(U.forEach((ie,me)=>{ie.x=be[me].x,ie.y=be[me].y}),ne=q=0,k=Ae.width,J=Ae.height)}let ee=y-ne,ae=y-q,ue=Math.ceil(k-ne+2*y),ce=Math.ceil(J-q+2*y),pe=[],V=new Map;if(a.nodes.length>0&&a.nodes[0].isGroup)for(let be of z)ur(V,be.route);let X=\\\"\\\",le=\\\"\\\",de=\\\"\\\";for(let be=0;be\u003CC.length;be++){let Ae=C[be],ie=Z[be],me=Ae.node,Te=ie.x+ee,ye=ie.y+ae,we=Ue(me.id),Ie=ie.isGroup?ie.w:Ae.w,ve=ie.isGroup?ie.h:Ae.h;if(me.isGroup){let he=ie.isGroup?hs(ie,Ae.label.width,V,ni):ie.x,Re=ye-ve/2+8+Ae.label.height/2,Be=' class=\\\"pele-cluster-label\\\" fill=\\\"var(--_m)\\\"',ge=ie.isGroup&&Ac(ie,Ae.label.width,he,V);ge&&(le+=Sc(Ae.label,he+ee,Re,Be,we,a.nodes,be)),X+=`\u003Cg class=\\\"pele-cluster pele-namespace\\\" data-id=\\\"${we}\\\">\u003Crect x=\\\"${f(Te-Ie/2)}\\\" y=\\\"${f(ye-ve/2)}\\\" width=\\\"${f(Ie)}\\\" height=\\\"${f(ve)}\\\" fill=\\\"var(--_a)\\\" fill-opacity=\\\"0.5\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+(ge?\\\"\\\":Ne(Ae.label,he+ee,Re,Be))+\\\"\u003C/g>\\\";continue}let Pe=` transform=\\\"translate(${f(Te)},${f(ye)})\\\"`;if(me.classNode)de+=Se(Ae,me.classNode,we,Pe);else if(me.shape===\\\"note\\\"){let he=Ie/2,Re=-ve/2;de+=`\u003Cg class=\\\"pele-node pele-note\\\" data-id=\\\"${we}\\\"${Pe}>\u003Cpath d=\\\"M${f(-he)},${f(Re)}H${f(he-tl)}L${f(he)},${f(Re+tl)}V${f(-Re)}H${f(-he)}Z\\\" fill=\\\"var(--_a)\\\" stroke=\\\"var(--_b)\\\" stroke-linejoin=\\\"round\\\"/>\u003Cpath d=\\\"M${f(he-tl)},${f(Re)}V${f(Re+tl)}H${f(he)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\" stroke-linejoin=\\\"round\\\"/>`+Ne(Ae.label,0,0,` class=\\\"pele-label\\\" font-size=\\\"${h}\\\"`,n.icons)+\\\"\u003C/g>\\\"}else de+=`\u003Cg class=\\\"pele-node pele-interface\\\" data-id=\\\"${we}\\\"${Pe}>`+Ne(Ae.label,0,0,` class=\\\"pele-label\\\" font-size=\\\"${h}\\\"`,n.icons)+\\\"\u003C/g>\\\"}function Se(be,Ae,ie,me){let{w:Te,h:ye,style:we}=be,Ie=-Te/2,ve=-ye/2,Pe=Math.round(be.fontSize*.875),he=Math.round(Pe*1.5),Re=`\u003Crect x=\\\"${f(Ie)}\\\" y=\\\"${f(ve)}\\\" width=\\\"${f(Te)}\\\" height=\\\"${f(ye)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${At(we.shape)}/>`,Be=vt(we),ge=ve+be.titleH,Le=ge+be.attributesH;if(ye>be.titleH){let je=we.stroke?` style=\\\"stroke:${rt(we.stroke)}\\\"`:\\\"\\\";Re+=`\u003Cpath class=\\\"pele-divider\\\" d=\\\"M${f(Ie)},${f(ge)}H${f(-Ie)}M${f(Ie)},${f(Le)}H${f(-Ie)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"${je}/>`}let Fe=ve+el;for(let je of be.annotations)if(typeof je==\\\"string\\\")Re+=`\u003Ctext class=\\\"pele-annotation\\\" x=\\\"0\\\" y=\\\"${f(Fe+m/2+d*.35)}\\\" text-anchor=\\\"middle\\\" font-size=\\\"${d}\\\"${Be||' fill=\\\"var(--_m)\\\"'}>${rt(je)}\u003C/text>`,Fe+=m;else{let Je=Math.max(m,je.height);Re+=Ne(je,0,Fe+Je/2,` class=\\\"pele-annotation\\\" font-size=\\\"${d}\\\"${Be||' fill=\\\"var(--_m)\\\"'}`,n.icons),Fe+=Je}let Ve=be.fontSize===u?\\\"\\\":` font-size=\\\"${f(be.fontSize)}\\\"`;Re+=Ne(be.label,0,(Fe+ge-el)/2,` class=\\\"pele-label\\\"${Ve} font-weight=\\\"var(--_hw)\\\"${Be}${we.text}`,n.icons);let Oe=(je,Je,$e)=>{let Ze=\\\"\\\",tt=$e+ey+he/2+Pe*.35;for(let mt of je){let dt=mt.classifier===\\\"$\\\"?` pele-static\\\"${we.text?we.text.slice(0,-1)+'text-decoration:underline\\\"':' style=\\\"text-decoration:underline\\\"'}`:mt.classifier===\\\"*\\\"?` pele-abstract\\\" font-style=\\\"italic\\\"${we.text}`:`\\\"${we.text}`;Ze+=`\u003Ctext class=\\\"pele-member pele-${Je}${dt} x=\\\"${f(Ie+Nf)}\\\" y=\\\"${f(tt)}\\\">${rt(mt.text)}\u003C/text>`,tt+=he}return Ze};return(be.attributes.length>0||be.methods.length>0)&&(Re+=`\u003Cg class=\\\"pele-members\\\" font-size=\\\"${Pe}\\\"${Be}${l(we)?` font-family=\\\"${fr}\\\"`:\\\"\\\"}>${Oe(be.attributes,\\\"attribute\\\",ge)}${Oe(be.methods,\\\"method\\\",Le)}\u003C/g>`),Ae.tooltip&&(Re=`\u003Ctitle>${Ue(Ae.tooltip)}\u003C/title>`+Re),Ae.link&&(Re=Zn(Re,Ae.link,Ae.id,pe,n,Ae.linkTarget&&aM.has(Ae.linkTarget)?` target=\\\"${Ae.linkTarget}\\\"`:\\\"\\\")),`\u003Cg class=\\\"pele-node pele-class${It(Ae.cssClasses.replace(/^default\\\\s?/,\\\"\\\"))}\\\" data-id=\\\"${ie}\\\"${me}>${Re}\u003C/g>`}let _e=\\\"\\\",xe=\\\"\\\";for(let be=0;be\u003Cz.length;be++){let Ae=z[be],ie=M[be],me=T[be],Te=ie.arrowTypeStart,ye=ie.arrowTypeEnd,we=Tf(Te),Ie=Tf(ye),ve;if(Ae.src===Ae.dst){let he=Z[Ae.src],Re=C[Ae.src],Be=re[be],ge=he.x+ee+Re.w/2,Le=he.y+ae,Fe=Math.min(Re.h/2-4,8+Be*6),Ve=Cf+Be*8;ve={d:`M${f(ge+we)},${f(Le-Fe)}C${f(ge+Ve+we)},${f(Le-Fe)} ${f(ge+Ve+Ie)},${f(Le+Fe)} ${f(ge+Ie)},${f(Le+Fe)}`,sx:ge,sy:Le-Fe,sdx:-1,sdy:0,ex:ge,ey:Le+Fe,edx:-1,edy:0}}else{let he=Ae.route;for(let Re=0;Re\u003Che.length;Re+=3)he[Re]+=ee,he[Re+1]+=ae;ve=Cn(he,void 0,we,Ie)}let Pe=ie.pattern===\\\"dashed\\\"?' stroke-dasharray=\\\"6 4\\\"':ie.pattern===\\\"dotted\\\"?' stroke-dasharray=\\\"2 4\\\"':\\\"\\\";if(_e+=`\u003Cg class=\\\"pele-edge${ie.pattern===\\\"dotted\\\"?\\\" pele-note-edge\\\":\\\" pele-relation\\\"}\\\" data-id=\\\"${Ue(ie.id)}\\\">\u003Cpath d=\\\"${ve.d}\\\"${Pe}/>`+Mf(Te,ve.sx,ve.sy,ve.sdx,ve.sdy,If)+Mf(ye,ve.ex,ve.ey,ve.edx,ve.edy,If)+\\\"\u003C/g>\\\",me.width>0){let he=Ae.labelX+ee,Re=Ae.labelY+ae;xe+=dn(ie.id,me,he,Re,\\\"\\\",n.icons)}}let Me=\\\"\\\";for(let be of U)Me+=be.math?Ne(be.math,be.x+ee,be.y+ae,' class=\\\"pele-cardinality\\\"',n.icons):`\u003Ctext class=\\\"pele-cardinality\\\" x=\\\"${f(be.x+ee)}\\\" y=\\\"${f(be.y+ae+d*.35)}\\\" text-anchor=\\\"middle\\\">${rt(be.text)}\u003C/text>`;let Ce=Fc(e.title,p,u,y,ue,ce,(X?`\u003Cg class=\\\"pele-clusters\\\">${X}\u003C/g>`:\\\"\\\")+(_e?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"${If}\\\" stroke-linecap=\\\"round\\\">${_e}\u003C/g>`:\\\"\\\")+(le?`\u003Cg class=\\\"pele-cluster-titles\\\">${le}\u003C/g>`:\\\"\\\")+(xe?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${h}\\\">${xe}\u003C/g>`:\\\"\\\")+(Me?`\u003Cg class=\\\"pele-cardinalities\\\" font-size=\\\"${d}\\\" fill=\\\"var(--_m)\\\">${Me}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${de}\u003C/g>`);return{svg:at(\\\"class\\\",Ce.width,Ce.height,u,n,e,Ce.content),width:Ce.width,height:Ce.height,links:pe}}var ry={type:\\\"class\\\",math:!0,parse(e,t,n){let r=new Qc;return n&&(r.title=n),jb(e,r),r},render:ny};var $f=class{constructor(){fe(this,\\\"domains\\\",new Map);fe(this,\\\"transitions\\\",[])}setDomains(t){if(t)for(let n of t){let r=n.domain;this.domains.set(r,{name:r,items:(n.items??[]).map(i=>({label:i.label}))})}}setTransitions(t){t&&(this.transitions=t.filter(n=>n.from!==n.to).map(n=>({from:n.from,to:n.to,label:n.label||void 0})))}};function sy(e,t){let n=new $f;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,`\\r\\n`):void 0,domains:n.domains,transitions:n.transitions}}var iy=[{name:\\\"cynefin-beta:\\\",pattern:\\\"cynefin-beta:\\\"},Jt(\\\"cynefin-beta\\\"),{name:\\\"-->\\\",pattern:\\\"-->\\\"},{name:\\\":\\\",pattern:\\\":\\\"},{name:\\\"DOMAIN_NAME\\\",pattern:/complex|complicated|clear|chaotic|confusion/y},sn,Xt,pr,Fn,Sn,wn,Ht,Qt,Zt];function oy(e){let t=new Ut(Yt(e,iy,\\\"cynefin\\\"),iy,\\\"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=Vt(t.take()),i();break;case 6:n.accTitle=zt(t.take()),i();break;case 7:n.title=Kt(t.take()),i();break;case 4:{let s=t.take();if(t.accept(2)){let o={$type:\\\"Transition\\\",from:s,to:t.expect(4)};t.accept(3)&&(o.label=un(t.expect(8))),i(),n.transitions.push(o);break}let a={$type:\\\"DomainBlock\\\",domain:s,items:[]};for(r();t.kinds[t.i]===8;)a.items.push({$type:\\\"DomainItem\\\",label:un(t.take())}),r();n.domains.push(a);break}default:t.fail(\\\"a domain, a transition, a title, or a line break\\\")}return n}function ay(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 lM(e){let t=0;for(let n=0;n\u003Ce.length;n++)t=(t\u003C\u003C5)-t+e.charCodeAt(n),t|=0;return t}function cy(e,t){return typeof e==\\\"number\\\"&&Number.isFinite(e)&&e!==0?e:lM(t)}var ly={segments:7,vertical:!0,pointStep:17,controlStep:31,controlShift:7},Lf={segments:7,vertical:!1,pointStep:23,controlStep:37,controlShift:11};function sl(e,t,n,r,i,s){let a=(t-e)/s.segments,o=[],c=[];for(let u=0;u\u003C=s.segments;u++){let h=u===0&&s.pinStart||u===s.segments&&s.pinEnd;o.push(e+u*a),c.push(h?n:n+ay(r+u*s.pointStep)*i*2-i)}let l=s.vertical?[c[0],o[0]]:[o[0],c[0]];for(let u=0;u\u003Cs.segments;u++){let h=(o[u]+o[u+1])/2,d=i*1.5*(u%2===0?1:-1)*ay(r+u*s.controlStep+s.controlShift);s.vertical?l.push(c[u]+d,h,c[u+1]-d,h,c[u+1],o[u+1]):l.push(h,c[u]+d,h,c[u+1]-d,o[u+1],c[u+1])}return l}function dy(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 Qi(e){let t=\\\"\\\";for(let n=2;n\u003Ce.length;n+=6)t+=`C${f(e[n])},${f(e[n+1])} ${f(e[n+2])},${f(e[n+3])} ${f(e[n+4])},${f(e[n+5])}`;return t}function aa(e){let t=\\\"\\\";for(let n=e.length-6;n>=2;n-=6)t+=`C${f(e[n+2])},${f(e[n+3])} ${f(e[n])},${f(e[n+1])} ${f(e[n-2])},${f(e[n-1])}`;return t}function ca(e){return`M${f(e[0])},${f(e[1])}${Qi(e)}`}function uy(e,t,n,r){let i=`${f(n)},${f(r)}`;return`M${f(e-n)},${f(t)}A${i} 0 1,1 ${f(e+n)},${f(t)}A${i} 0 1,1 ${f(e-n)},${f(t)}Z`}var Of=[[\\\"complex\\\",0,0,0],[\\\"complicated\\\",1,0,1],[\\\"chaotic\\\",0,1,3],[\\\"clear\\\",1,1,2]],dM=4,uM=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\\\"]]]),fy=3,hy=200,fM=10,hM=4,il=6,py=10,my=20,ol=10;function al(e,t,n,r,i){let s=e.cynefin?.[t];return typeof s==\\\"number\\\"&&s>=r&&s\u003C=i?s:n}function gy(e,t,n){let r=n.fontSize??16,i=Math.round(r*.8125),s=Math.round(r*.875),a=n.measurer??ct(n.fontFamily,n.fontFamilyMono),o=n.padding??8,c=n.icons,l=t.cynefin?.showDomainDescriptions!==!1,u=al(t,\\\"boundaryAmplitude\\\",8,0,50),h=cy(al(t,\\\"seed\\\",0,-1e15,1e15),n.idPrefix??\\\"pele\\\"),d=Math.round(s*1.5),m=(k,J)=>{let te=Ge(k,!1,a,s,hy);return{text:k,label:te,w:te.width+2*fM,h:Math.max(te.height,d)+2*hM,overflow:J}},p=k=>{let J=uM.get(k),te=Ge(J[0],!1,a,r,4e3,1),se=[];if(l)for(let ce of[J[1],J[2]])ce&&se.push(Ge(ce,!1,a,i,4e3,2));let re=e.domains.get(k)?.items??[],P=k===\\\"confusion\\\"&&re.length>fy?fy:re.length,ee=[];for(let ce=0;ce\u003CP;ce++)ee.push(m(re[ce].label,!1));P\u003Cre.length&&ee.push(m(`+${re.length-P} more`,!0));let ae=te.width,ue=te.height;for(let ce of se)ae=Math.max(ae,ce.width),ue+=ce.height;ee.length>0&&(ue+=py-il);for(let ce of ee)ae=Math.max(ae,ce.w),ue+=il+ce.h;return{name:k,title:te,subtitles:se,badges:ee,w:ae,h:ue,cx:0,cy:0}},y=Of.map(([k])=>p(k)),E=p(\\\"confusion\\\"),b=Math.max(88,E.w*.71+8),S=Math.max(64,E.h*.71+6),x=al(t,\\\"width\\\",640,100,1e4)/2,I=al(t,\\\"height\\\",440,100,1e4)/2;for(let k of y)x=Math.max(x,k.w+2*my),I=Math.max(I,k.h+2*my);for(let k of y){let J=(x-k.w)/2,te=(I-k.h)/2;if((J/(b+ol))**2+(te/(S+ol))**2>=1)continue;let se=k.w+2*(b+ol),re=k.h+2*(S+ol);se*I\u003C=x*re?x=Math.max(x,se):I=Math.max(I,re)}let L=Ge(e.title,!1,a,r,4e3,1),O=L.height>0?L.height+12:0,v=2*x,G=2*I,K=o,C=o+O,Z=K+x,oe=C+I,H=K+v,z=C+G,M=sl(C,oe,Z,h,u,{...ly,segments:4,pinEnd:!0}),T=sl(K,Z,oe,h+100,u,{...Lf,segments:4,pinEnd:!0}),R=sl(Z,H,oe,h+200,u,{...Lf,segments:4,pinStart:!0}),_=dy(Z,oe,z,v*.03),$=(k,J)=>J?`${f(k[k.length-2])},${f(k[k.length-1])}`:`${f(k[0])},${f(k[1])}`,g=new Map([[\\\"complex\\\",`M${f(K)},${f(C)}L${$(M,!1)}${Qi(M)}${aa(T)}Z`],[\\\"complicated\\\",`M${$(M,!1)}L${f(H)},${f(C)}L${$(R,!0)}${aa(R)}${aa(M)}Z`],[\\\"chaotic\\\",`M${$(T,!1)}${Qi(T)}${Qi(_)}L${f(K)},${f(z)}Z`],[\\\"clear\\\",`M${$(R,!1)}${Qi(R)}L${f(H)},${f(z)}L${$(_,!0)}${aa(_)}Z`]]),N=\\\"\\\";for(let[k,,,J]of Of)N+=`\u003Cpath class=\\\"pele-cynefin-region\\\" data-id=\\\"${k}\\\" d=\\\"${g.get(k)}\\\" fill=\\\"${Et(J)}\\\" fill-opacity=\\\"0.14\\\"/>`;let w=`\u003Cg class=\\\"pele-cynefin-boundaries\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\" stroke-dasharray=\\\"6 3\\\">\u003Cpath d=\\\"${ca(M)}\\\"/>\u003Cpath d=\\\"${ca(T)}\\\"/>\u003Cpath d=\\\"${ca(R)}\\\"/>\u003Cpath class=\\\"pele-cynefin-cliff\\\" d=\\\"${ca(_)}\\\" stroke=\\\"var(--_l)\\\" stroke-width=\\\"2\\\" stroke-dasharray=\\\"none\\\" stroke-linecap=\\\"round\\\"/>\u003C/g>`,A=uy(Z,oe,b,S),D=`\u003Cpath d=\\\"${A}\\\" fill=\\\"var(--_bg)\\\"/>\u003Cpath class=\\\"pele-cynefin-region\\\" data-id=\\\"confusion\\\" d=\\\"${A}\\\" fill=\\\"${Et(dM)}\\\" fill-opacity=\\\"0.18\\\" stroke=\\\"var(--_b)\\\" stroke-dasharray=\\\"4 2\\\"/>`,U=k=>{let J=k.cy-k.h/2,te=Ne(k.title,k.cx,J+k.title.height/2,' class=\\\"pele-label\\\" font-weight=\\\"var(--_hw)\\\"');J+=k.title.height;for(let se of k.subtitles)te+=Ne(se,k.cx,J+se.height/2,` class=\\\"pele-cynefin-subtitle\\\" font-size=\\\"${i}\\\" font-style=\\\"italic\\\" fill=\\\"var(--_m)\\\"`),J+=se.height;J+=py-il;for(let se of k.badges)J+=il,te+=`\u003Cg class=\\\"pele-node${se.overflow?\\\" pele-cynefin-overflow\\\":\\\"\\\"}\\\"${se.overflow?\\\"\\\":` data-id=\\\"${Ue(se.text)}\\\"`}>\u003Crect x=\\\"${f(k.cx-se.w/2)}\\\" y=\\\"${f(J)}\\\" width=\\\"${f(se.w)}\\\" height=\\\"${f(se.h)}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${se.overflow?' stroke-dasharray=\\\"3 2\\\"':\\\"\\\"}${ht}/>`+Ne(se.label,k.cx,J+se.h/2,` class=\\\"pele-label\\\" font-size=\\\"${s}\\\"${se.overflow?' fill=\\\"var(--_m)\\\"':\\\"\\\"}`,c)+\\\"\u003C/g>\\\",J+=se.h;return`\u003Cg class=\\\"pele-cynefin-domain\\\" data-id=\\\"${k.name}\\\">${te}\u003C/g>`},B=new Map,F=\\\"\\\";Of.forEach(([k,J,te],se)=>{let re=y[se];re.cx=K+x*(J+.5),re.cy=C+I*(te+.5),B.set(k,re),F+=U(re)}),E.cx=Z,E.cy=oe,B.set(\\\"confusion\\\",E),F+=U(E);let W=(k,J,te)=>k===E?((J-Z)/(b+4))**2+((te-oe)/(S+4))**2\u003C=1:Math.abs(J-k.cx)\u003C=k.w/2+8&&Math.abs(te-k.cy)\u003C=k.h/2+8,j=\\\"\\\",Q=new Map;for(let k of e.transitions){let J=B.get(k.from),te=B.get(k.to);if(!J||!te||J===te)continue;let se=k.from\u003Ck.to?`${k.from} ${k.to}`:`${k.to} ${k.from}`,re=Q.get(se)??0;Q.set(se,re+1);let P=te.cx-J.cx,ee=te.cy-J.cy,ae=Math.hypot(P,ee)||1,ue=(J.cx+te.cx)/2,ce=(J.cy+te.cy)/2,pe=-ee*(ue-Z)+P*(ce-oe)>=0?1:-1,V=-ee/ae*pe,X=P/ae*pe,de=(J!==E&&te!==E&&Math.abs(P)>1&&Math.abs(ee)>1?2*(Math.hypot(b*V,S*X)+16):ae*.15)+re*56,Se=ue+V*de,_e=ce+X*de,xe=Le=>{let Fe=1-Le;return[Fe*Fe*J.cx+2*Fe*Le*Se+Le*Le*te.cx,Fe*Fe*J.cy+2*Fe*Le*_e+Le*Le*te.cy]},Me=(Le,Fe,Ve,Oe)=>{for(let je=0;je\u003C16;je++){let Je=(Fe+Ve)/2;W(Le,...xe(Je))===Oe?Fe=Je:Ve=Je}return(Fe+Ve)/2},Ce=48,ke=1;for(;ke\u003C=Ce&&W(J,...xe(ke/Ce));)ke++;if(ke>Ce)continue;let be=Me(J,(ke-1)/Ce,ke/Ce,!0);for(;ke\u003C=Ce&&!W(te,...xe(ke/Ce));)ke++;let Ae=ke>Ce?1:Me(te,(ke-1)/Ce,ke/Ce,!1),[ie,me]=xe(be),[Te,ye]=xe(Ae),we=(Le,Fe,Ve)=>(1-be)*(1-Ae)*Le+((1-be)*Ae+be*(1-Ae))*Fe+be*Ae*Ve,Ie=we(J.cx,Se,te.cx),ve=we(J.cy,_e,te.cy),Pe=Math.hypot(Te-Ie,ye-ve)||1,he=(Te-Ie)/Pe,Re=(ye-ve)/Pe,Be=_t(\\\"arrow_point\\\",Te,ye,he,Re,\\\"var(--_l)\\\");Te-=he*Rt(\\\"arrow_point\\\"),ye-=Re*Rt(\\\"arrow_point\\\");let ge=\\\"\\\";if(k.label){let Le=Ge(k.label,!1,a,i,hy),[Fe,Ve]=xe((be+Ae)/2),Oe=Math.abs(V)*Le.width/2+Math.abs(X)*Le.height/2+6,je=Le.width/2+4,Je=Math.min(Math.max(Fe+V*Oe,K+je),Math.max(H-je,K+je));ge=Ne(Le,Je,Ve+X*Oe,` class=\\\"pele-edge-label\\\" font-size=\\\"${i}\\\"`,c)}j+=`\u003Cg class=\\\"pele-edge\\\" data-id=\\\"${k.from}-${k.to}\\\">\u003Cpath d=\\\"M${f(ie)},${f(me)}Q${f(Ie)},${f(ve)} ${f(Te)},${f(ye)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>`+Be+ge+\\\"\u003C/g>\\\"}let Y=Math.ceil(Math.max(v,L.width)+2*o),ne=Math.ceil(G+O+2*o),q=Ne(L,K+v/2,o+L.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg class=\\\"pele-cynefin-regions\\\">${N}\u003C/g>`+w+D+F+(j?`\u003Cg class=\\\"pele-edges\\\">${j}\u003C/g>`:\\\"\\\");return{svg:at(\\\"cynefin\\\",Y,ne,r,n,e,q),width:Y,height:ne,links:[]}}var by={type:\\\"cynefin\\\",parse:(e,t,n)=>sy(oy(e),n),render:gy};function pM(e){return e===\\\"markdown\\\"||e===\\\"string\\\"||e===\\\"text\\\"?e:\\\"markdown\\\"}var cl=class{constructor(){fe(this,\\\"type\\\",\\\"er\\\");fe(this,\\\"direction\\\",\\\"TB\\\");fe(this,\\\"entities\\\",new Map);fe(this,\\\"relationships\\\",[]);fe(this,\\\"classes\\\",new Map);fe(this,\\\"subgraphs\\\",[]);fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"subgraphLookup\\\",new Map);fe(this,\\\"claimed\\\",new Set)}addEntity(t,n=\\\"\\\"){let r=this.entities.get(t);return r===void 0?(r={id:`entity-${t}-${this.entities.size}`,label:t,alias:n,attributes:[],cssClasses:\\\"default\\\",cssStyles:[]},this.entities.set(t,r)):!r.alias&&n&&(r.alias=n),r}addAttributes(t,n){let r=this.addEntity(t);for(let i=n.length-1;i>=0;i--){let s=n[i];s.keys??=[],s.comment??=\\\"\\\",r.attributes.push(s)}}addRelationship(t,n,r,i){let s=this.subgraphLookup.has(t)?t:this.addEntity(t).id,a=this.subgraphLookup.has(r)?r:this.addEntity(r).id;this.relationships.push({entityA:s,roleA:n,entityB:a,relSpec:i})}setDirection(t){this.direction=t}addCssStyles(t,n){if(n)for(let r of t){let i=this.entities.get(r);if(i)for(let a of n)i.cssStyles.push(a);let s=this.subgraphLookup.get(r);if(s)for(let a of n)s.cssStyles.push(a)}}addClass(t,n){for(let r of t){let i=this.classes.get(r);if(i===void 0&&(i={id:r,styles:[],textStyles:[]},this.classes.set(r,i)),!!n)for(let s of n)s.includes(\\\"color\\\")&&i.textStyles.push(s.replace(\\\"fill\\\",\\\"bgFill\\\")),i.styles.push(s)}}setClass(t,n){for(let r of t){let i=this.entities.get(r);if(i)for(let a of n)i.cssClasses+=\\\" \\\"+a;let s=this.subgraphLookup.get(r);if(s)for(let a of n)s.classes.push(a)}}addSubGraph(t,n,r){let i=t.text.trim(),s=new Set,a=[],o;for(let l of n.flat()){if(typeof l!=\\\"string\\\"){l?.stmt===\\\"dir\\\"&&(o=l.value);continue}let u=l.trim();u===\\\"\\\"||s.has(u)||(s.add(u),this.claimed.has(l)||a.push(l))}for(let l of a)this.claimed.add(l);let c={id:i,nodes:a,title:(r.text||\\\"\\\").trim(),classes:[],cssStyles:[],dir:o,labelType:pM(r.type)};return this.subgraphs.push(c),this.subgraphLookup.set(i,c),i}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}};var Df=[\\\"$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\\\"];var la=1,ll=2,Ff=4,da=8,mr=new Uint8Array(128);for(let e=0;e\u003C128;e++){let t=e>=48&&e\u003C=57||e>=65&&e\u003C=90||e>=97&&e\u003C=122||e===95,n=t&&(e\u003C48||e>57);t&&(mr[e]|=la|ll|da),n&&(mr[e]|=Ff)}for(let e of\\\"-*\\\")mr[e.charCodeAt(0)]|=la|ll|da;mr[46]|=la|da;mr[42]|=Ff;for(let e of\\\"[](),\\\")mr[e.charCodeAt(0)]|=da;var mM=/accTitle\\\\s*:\\\\s*/iy,gM=/accDescr\\\\s*:\\\\s*/iy,bM=/accDescr\\\\s*\\\\{\\\\s*/iy,yM=[/.*direction\\\\s+TB[^\\\\n]*/iy,/.*direction\\\\s+BT[^\\\\n]*/iy,/.*direction\\\\s+RL[^\\\\n]*/iy,/.*direction\\\\s+LR[^\\\\n]*/iy],vf=/direction/gi,Pf=/[\\\\n\\\\r\\\\u2028\\\\u2029]/g;function yy(e,t){return e\u003C128?(mr[e]&t)!==0:e>=192||e===181}function Ey(e){let t=e.length,n=[],r=[],i=[],s=0,a=0,o=-2,c=0,l=-1,u=-2,h=-1,d=-1,m=-1,p=(H,z,M)=>{n.push(H),r.push(e.slice(z,M)),i.push(z),a=M},y=(H,z)=>(H.lastIndex=z,H.test(e)?H.lastIndex:-1),E=H=>{for(let z=0;z\u003CH.length;z++){let M=H.charCodeAt(z),T=e.charCodeAt(a+z);if(T!==M&&(M\u003C97||M>122||(T|32)!==M))return!1}return!0},b=H=>E(H)&&!ot(e.charCodeAt(a+H.length)),S=H=>{let z=e.charCodeAt(H);return z>=65&&z\u003C=90?z+32:z},x=H=>(Pf.lastIndex=H,Pf.test(e)?Pf.lastIndex-1:t),I=H=>{for(;xt(e.charCodeAt(H));)H++;return H},L=()=>{if(o===-1||o\u003Ca&&(vf.lastIndex=a,o=vf.test(e)?vf.lastIndex-9:-1,o===-1)||a\u003Cc||(l\u003Ca&&(l=x(a)),o>=l))return!1;for(let H=0;H\u003C4;H++){let z=y(yM[H],a);if(z>=0)return p(18+H,a,z),!0}return c=l,!1},O=()=>{let H=e.indexOf('\\\"',a+1);if(H===-1){p(45,a,a+1);return}let z=H>a+1;for(let M=a+1;z&&M\u003CH;M++){let T=e.charCodeAt(M);(T===37||T===92||T===13||T===10||T===11||T===8)&&(z=!1)}p(z?31:44,a,H+1)},v=H=>{let z=e.charCodeAt(a+1);if(z===43&&(H===49||H===48)){p(H===49?39:38,a,a+2);return}let M=I(a+1);if(e.charCodeAt(M)===46&&xt(e.charCodeAt(M+1))){p(32,a,I(M+2));return}if(H===49){if(qe(z)){let T=a+2;for(;qe(e.charCodeAt(T));)T++;let R=e.charCodeAt(T);if(ot(R)||R===34||R===39){p(40,a,a+1);return}}else if(z===45||z===46){let T=e.charCodeAt(a+2);if(T===45||T===46){p(40,a,a+1);return}}if(!ot(z)){p(33,a,a+1);return}}p(29,a,M)},G=H=>{let z=e.charCodeAt(a+1);switch(H){case 101:if(b(\\\"erdiagram\\\"))p(2,a,a+9);else if(b(\\\"end\\\")){let M=a+3;for(;qe(e.charCodeAt(M));)M++;p(16,a,M)}else return!1;return!0;case 115:if(b(\\\"style\\\"))s=6,p(27,a,a+5);else if(b(\\\"subgraph\\\"))p(17,a,a+8);else return!1;return!0;case 99:if(b(\\\"classdef\\\"))s=6,p(22,a,a+8);else if(b(\\\"class\\\"))p(26,a,a+5);else return!1;return!0;case 111:if(b(\\\"one or zero\\\"))p(37,a,a+11);else if(b(\\\"one or more\\\")||b(\\\"one or many\\\"))p(39,a,a+11);else if(b(\\\"one\\\"))p(40,a,a+3);else if(b(\\\"only one\\\"))p(40,a,a+8);else if(z===124)p(37,a,a+2);else if(z===123)p(38,a,a+2);else if(b(\\\"optionally to\\\"))p(42,a,a+13);else return!1;return!0;case 122:if(b(\\\"zero or one\\\"))p(37,a,a+11);else if(b(\\\"zero or more\\\")||b(\\\"zero or many\\\"))p(38,a,a+12);else return!1;return!0;case 109:if(E(\\\"many(0)\\\"))p(38,a,a+7);else if(E(\\\"many(1)\\\"))p(39,a,a+7);else if(b(\\\"many\\\"))p(38,a,a+4);else return!1;return!0;case 116:return b(\\\"to\\\")?(p(43,a,a+2),!0):!1;case 117:return z!==46&&z!==45&&z!==124?!1:(p(41,a,a+1),!0);case 124:if(S(a+1)===111&&!ot(e.charCodeAt(a+2)))p(37,a,a+2);else if(z===124)p(40,a,a+2);else if(z===123)p(39,a,a+2);else return!1;return!0;case 125:if(S(a+1)===111&&!ot(e.charCodeAt(a+2)))p(38,a,a+2);else if(z===124)p(39,a,a+2);else return!1;return!0;case 46:return z!==46&&z!==45?!1:(p(42,a,a+2),!0);case 45:if(z===45)p(43,a,a+2);else if(z===46)p(42,a,a+2);else return!1;return!0}return!1},K=H=>{let z;if((H===97||H===65)&&E(\\\"acc\\\")){if((z=y(mM,a))>=0){s=3,p(11,a,z);return}if((z=y(gM,a))>=0){s=4,p(13,a,z);return}if((z=y(bM,a))>=0){s=5,a=z;return}}if(!L()){switch(H){case 32:case 9:case 13:z=a+1;for(let M=e.charCodeAt(z);M===32||M===9||M===13;M=e.charCodeAt(z))z++;a=z;return;case 10:for(z=a+1;e.charCodeAt(z)===10;)z++;p(4,a,z);return;case 34:O();return;case 123:s=1,p(7,a,a+1);return;case 35:p(30,a,a+1);return;case 44:p(25,a,a+1);return;case 58:e.charCodeAt(a+1)===58&&e.charCodeAt(a+2)===58?p(6,a,a+3):p(5,a,a+1);return;case 91:p(9,a,a+1);return;case 93:p(10,a,a+1);return}if(xt(H)){v(H);return}if(!G(H>=65&&H\u003C=90?H+32:H)){if(H>=128||(mr[H]&la)!==0){z=a+1;for(let M=e.charCodeAt(z);M>=128||(mr[M]&la)!==0;M=e.charCodeAt(z))z++;p(23,a,z);return}p(45,a,a+1)}}},C=()=>{if(u===-1||u\u003Ca&&(u=e.indexOf(\\\"~\\\",a),u===-1))return!1;if(m\u003Ca){let z=a;for(;z\u003Ct&&!qe(e.charCodeAt(z));)z++;m=z}if(u>=m||(h\u003Ca&&(h=x(a),d=e.lastIndexOf(\\\"~\\\",h-1)),d\u003C=u))return!1;let H=d+1;for(;H\u003Ct&&!qe(e.charCodeAt(H));)H++;return p(34,a,H),!0},Z=H=>{if(qe(H)){for(a++;qe(e.charCodeAt(a));)a++;return}let z=H|32;if((z===112||z===102||z===117)&&(e.charCodeAt(a+1)|32)===107&&!ot(e.charCodeAt(a+2))){p(35,a,a+2);return}if(!C()){if(yy(H,Ff)){let M=a+1;for(;M\u003Ct&&yy(e.charCodeAt(M),da);)M++;p(34,a,M);return}if(H===96){s=2,a++;return}if(H===34){let M=e.indexOf('\\\"',a+1);if(M!==-1){p(36,a,M+1);return}}else if(H===125){s=0,p(8,a,a+1);return}p(45,a,a+1)}};for(;a\u003Ct;){let H=e.charCodeAt(a),z;switch(s){case 0:K(H);break;case 1:Z(H);break;case 2:H===96?(s=1,a++):(z=e.indexOf(\\\"`\\\",a),p(34,a,z===-1?t:z));break;case 3:case 4:z=e.indexOf(`\\r\\n`,a),p(s===3?12:14,a,z===-1?t:z),s=0;break;case 5:H===125?(s=0,a++):(z=e.indexOf(\\\"}\\\",a),p(15,a,z===-1?t:z));break;case 6:if(H===10){for(z=a+1;e.charCodeAt(z)===10;)z++;s=0,p(4,a,z)}else if(qe(H))for(a++;qe(e.charCodeAt(a));)a++;else if(H===58)p(5,a,a+1);else if(H===44)p(25,a,a+1);else if(H===35)p(30,a,a+1);else if(H===59)p(28,a,a+1);else if(H>=128||(mr[H]&ll)!==0){z=a+1;for(let M=e.charCodeAt(z);M>=128||(mr[M]&ll)!==0;M=e.charCodeAt(z))z++;p(24,a,z)}else return n.push(1),r.push(\\\"\\\"),i.push(a),{types:n,texts:r,starts:i};break}}let oe=s===0?3:s===3?12:s===4?14:s===5?15:-1;return oe!==-1&&(n.push(oe),r.push(\\\"\\\"),i.push(t)),n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i}}var Bf=new Map([[37,\\\"ZERO_OR_ONE\\\"],[38,\\\"ZERO_OR_MORE\\\"],[39,\\\"ONE_OR_MORE\\\"],[40,\\\"ONLY_ONE\\\"],[41,\\\"MD_PARENT\\\"]]),EM=[\\\"TB\\\",\\\"BT\\\",\\\"RL\\\",\\\"LR\\\"],xy=\\\"'UNICODE_TEXT', 'NUM', 'ENTITY_NAME', 'DECIMAL_NUM', 'ENTITY_ONE'\\\",xM=\\\"'ZERO_OR_ONE', 'ZERO_OR_MORE', 'ONE_OR_MORE', 'ONLY_ONE', 'MD_PARENT'\\\",dl=\\\"'EOF', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'SUBGRAPH', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'CLASSDEF', 'CLASS', 'STYLE', \\\"+xy;function Ay(e,t){let{types:n,texts:r,starts:i}=Ey(e),s=0,a=v=>{let G=n[s];throw G===1?ft(\\\"er\\\",e,i[s],\\\"\\\",!0):ft(\\\"er\\\",e,i[s],`Expecting ${v}, got '${G===45?r[s]:Df[G]}'`)},o=v=>(n[s]!==v&&a(`'${Df[v]}'`),r[s++]),c=()=>{let v=n[s];v!==4&&v!==28&&v!==3&&a(\\\"'EOF', 'NEWLINE', 'SEMI'\\\"),s++},l=v=>v===23||v===31||v===29||v===32||v===33,u=()=>{let v=n[s];l(v)||a(xy);let G=r[s++];return v===31?G.slice(1,-1):G},h=()=>{let v=[];for(;;){let G=n[s];if(G!==23&&G!==24&&a(\\\"'UNICODE_TEXT', 'STYLE_TEXT'\\\"),v.push(r[s++]),n[s]!==25)return v;s++}},d=v=>v===24||v===29||v===5||v===30,m=()=>{let v=[];for(;;){d(n[s])||a(\\\"'STYLE_TEXT', 'COLON', 'NUM', 'BRKT'\\\");let G=r[s++];for(;d(n[s]);)G+=r[s++];if(v.push(G),n[s]!==25)return v;s++}},p=()=>{let v=Bf.get(n[s++]),G=n[s];G!==43&&G!==42&&a(\\\"'NON_IDENTIFYING', 'IDENTIFYING'\\\");let K=G===43?\\\"IDENTIFYING\\\":\\\"NON_IDENTIFYING\\\";s++;let C=Bf.get(n[s]);return C===void 0?a(xM):(s++,{cardA:C,relType:K,cardB:v})},y=()=>{let v=n[s];v!==44&&v!==31&&v!==23&&a(\\\"'UNICODE_TEXT', 'ENTITY_NAME', 'WORD'\\\");let G=r[s++];return v===23?G:G.slice(1,-1)},E=v=>n[s]===45&&r[s]===v,b=()=>{let v=[];do{let G=o(34);E(\\\"?\\\")&&(G+=r[s++]),n[s]!==34&&a(G.endsWith(\\\"?\\\")?\\\"'ATTRIBUTE_WORD'\\\":\\\"'ATTRIBUTE_WORD', '?'\\\");let K={type:G,name:r[s++]};if(n[s]===35){let C=[r[s++]];for(;E(\\\",\\\");)s++,C.push(o(35));K.keys=C}n[s]===36&&(K.comment=r[s++].slice(1,-1)),v.push(K)}while(n[s]!==8);return v.reverse()},S=()=>{if(n[s]!==7)return;if(s++,n[s]===8){s++;return}let v=b();return s++,v},x=()=>{let v=u(),G=n[s];if(G===9){s++;let Z=u();o(10);let oe;n[s]===6&&(s++,oe=h());let H=S();return t.addEntity(v,Z),H&&t.addAttributes(v,H),oe&&t.setClass([v],oe),[v]}let K;if(G===6&&(s++,K=h(),G=n[s]),Bf.has(G)){let Z=p(),oe=u(),H;n[s]===6&&(s++,H=h()),o(5);let z=y();return t.addEntity(v),t.addEntity(oe),t.addRelationship(v,z,oe,Z),K&&t.setClass([v],K),H&&t.setClass([oe],H),[v,oe]}let C=S();return t.addEntity(v),C&&t.addAttributes(v,C),K&&t.setClass([v],K),[v]};o(2);let I=[{id:\\\"\\\",title:\\\"\\\",list:[]}],L=I[0],O=!1;for(;;){let v=n[s];switch(v){case 4:s++;break;case 3:s++,O&&a(`'END', ${dl}`);return;case 16:{O||a(dl),s++;let G=t.addSubGraph({text:L.id},L.list,{text:L.title});I.pop(),L=I[I.length-1],O=I.length>1,O&&L.list.push(G);break}case 17:{s++;let G=u(),K=G;if(n[s]===9){for(s++,K=u();l(n[s]);)K+=\\\" \\\"+u();o(10)}c(),L={id:G,title:K,list:[]},I.push(L),O=!0;break}case 11:{s++;let G=o(12).trim();t.setAccTitle(G),O&&L.list.push(G);break}case 13:{s++;let G=o(14).trim();t.setAccDescription(G),O&&L.list.push(G);break}case 15:{let G=r[s++].trim();t.setAccDescription(G),O&&L.list.push(G);break}case 18:case 19:case 20:case 21:{s++;let G=EM[v-18];O?L.list.push({stmt:\\\"dir\\\",value:G}):t.setDirection(G);break}case 22:{let G=r[s++],K=h(),C=m();c(),t.addClass(K,C),O&&L.list.push(G);break}case 26:{let G=r[s++],K=h();t.setClass(K,h()),O&&L.list.push(G);break}case 27:{let G=r[s++],K=h(),C=m();c(),t.addCssStyles(K,C),O&&L.list.push(G);break}default:{l(v)||a(O?`'END', ${dl}`:dl);let G=x();if(O)for(let K of G)L.list.push(K)}}}}var AM=[];function Sy(e){let t=[],n=[],r=e.subgraphs,i=c=>{let l=[];for(let u of c){let h=e.classes.get(u);if(h!==void 0){for(let d of h.styles)l.push(d.trim());for(let d of h.textStyles)l.push(d.trim())}}return l},s=new Map,a=new Set;for(let c=r.length-1;c>=0;c--){let l=r[c];a.add(l.id);for(let u of l.nodes)s.set(u,l.id)}for(let c=r.length-1;c>=0;c--){let l=r[c];t.push({id:l.id,label:l.title,alias:\\\"\\\",attributes:AM,isGroup:!0,parentId:s.get(l.id),cssStyles:l.cssStyles,cssCompiledStyles:i(l.classes),cssClasses:l.classes.join(\\\" \\\"),dir:l.dir,labelType:l.labelType})}let o=new Map;for(let[c,l]of e.entities){if(a.has(c)){o.set(l.id,c);continue}t.push({id:l.id,label:l.label,alias:l.alias,attributes:l.attributes,isGroup:!1,parentId:s.get(c),cssStyles:l.cssStyles,cssCompiledStyles:i(l.cssClasses.split(\\\" \\\")),cssClasses:l.cssClasses,dir:void 0,labelType:\\\"markdown\\\"})}return e.relationships.forEach((c,l)=>{n.push({id:`id_${c.entityA}_${c.entityB}_${l}`,start:o.get(c.entityA)??c.entityA,end:o.get(c.entityB)??c.entityB,label:c.roleA,arrowTypeStart:c.relSpec.cardB.toLowerCase(),arrowTypeEnd:c.relSpec.cardA.toLowerCase(),pattern:c.relSpec.relType===\\\"IDENTIFYING\\\"?\\\"solid\\\":\\\"dashed\\\"})}),{nodes:t,edges:n}}var vr=18,wy=5,_y=6,Wf=10,Ry=3.5;function ri(e,t,n,r,i){let s=(u,h)=>f(t-r*u-i*h)+\\\",\\\"+f(n-i*u+r*h),a=u=>`M${s(u,-wy)}L${s(u,wy)}`,o=`M${s(0,-_y)}L${s(Wf,0)}L${s(0,_y)}`,c=u=>`\u003Ccircle class=\\\"pele-marker\\\" cx=\\\"${f(t-r*u)}\\\" cy=\\\"${f(n-i*u)}\\\" r=\\\"${Ry}\\\" fill=\\\"var(--_bg)\\\"/>`,l=u=>`\u003Cpath class=\\\"pele-marker\\\" d=\\\"${u}\\\"/>`;switch(e){case\\\"only_one\\\":return l(a(6)+a(10));case\\\"zero_or_one\\\":return l(a(6))+c(13.5);case\\\"one_or_more\\\":return l(o+a(Wf+3.5));case\\\"zero_or_more\\\":return l(o)+c(Wf+Ry+.5);case\\\"md_parent\\\":return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${s(0,0)}L${s(6,4)}L${s(12,0)}L${s(6,-4)}Z\\\" fill=\\\"var(--_bg)\\\"/>`}return\\\"\\\"}var SM=48,wM=20,_M=64,ua=20,fa=28,RM=38,Ty=96,My=18,TM=12,MM=9,Uf=12,Cy=16,Gf=9,CM=260,Yf=1e6,NM=[],IM=18,kM=14,Ny=' fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"';function Iy(e,t,n){let r=e.er?.[t];return typeof r==\\\"number\\\"&&r>0?Math.min(r,2e3):n}function ul(e,t,n,r,i,s=0){let a=e.lines;if(a.length===0)return\\\"\\\";let o=a.length===1&&a[0].length===1?a[0][0]:void 0;if(o&&o.icon===void 0&&o.math===void 0&&o.style===s&&!(s&&o.text.includes(\\\" \\\")))return`\u003Ctext${qn(r,s)} x=\\\"${f(t)}\\\" y=\\\"${f(n)}\\\">${rt(o.text)}\u003C/text>`;let c=Xr(e),l=e.size*.35,u=n-l-e.lineHeight/2,h=\\\"\\\",d=\\\"\\\";for(let m=0;m\u003Ca.length;m++){let p=a[m],y=u+Nr(e,m);if(Yi(p)){d+=Ne(Ir(e,m),t+e.widths[m]/2,y,r,i);continue}n=y+l;let E=!1;for(let x of p)x.icon!==void 0&&(E=!0);let b=t,S=!1;for(let x of p){if(x.icon!==void 0){let I=e.size*1.1;d+=`\u003Csvg class=\\\"pele-icon\\\" data-icon=\\\"${Ue(x.icon)}\\\" x=\\\"${f(b)}\\\" y=\\\"${f(n-e.size*.35-I/2)}\\\" width=\\\"${f(I)}\\\" height=\\\"${f(I)}\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\">${i?.(x.icon)??\\\"\\\"}\u003C/svg>`}else if(x.text!==\\\"\\\"){let I=E||!S?` x=\\\"${f(b)}\\\" y=\\\"${f(n)}\\\"`:\\\"\\\";h+=`\u003Ctspan${I}${_r(x.style&~c)}>${rt(x.text)}\u003C/tspan>`,S=!0}b+=x.width}}return`\u003Ctext${qn(r,c)} xml:space=\\\"preserve\\\">${h}\u003C/text>${d}`}function Hf(e){let t=xs(e);return t===e?e:t.replace(/\u003C/g,\\\"<\\\").replace(/>/g,\\\">\\\")}function Ly(e,t,n){return Pn(e.direction)?Pt(n,r=>ky(e,t,n,r)):ky(e,t,n,!1)}function ky(e,t,n,r){let i=Sy(e),s=Array.isArray(n.monospace)&&n.monospace.includes(\\\"attributes\\\"),a=n.fontSize??16,o=Math.round(a*.875),c=n.measurer??ct(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=n.icons,h=new Map,d=[],m=[];i.nodes.forEach((A,D)=>h.set(A.id,D));let p=[],y=[],E=[],b=new Map,S=[];for(let A of i.edges){let D=h.get(A.start),U=h.get(A.end);if(D===void 0||U===void 0)continue;let B=Ge(A.label,!0,c,o,200),F;if(D===U){F={label:B,band:0,at:0};let W=b.get(D);W?W.push(F):b.set(D,[F])}S.push(F),E.push(A),y.push(B),p.push({src:D,dst:U,minlen:1,labelW:B.width>0?B.width+12:0,labelH:B.height>0?B.height+4:0,route:[],labelX:0,labelY:0})}let x=A=>{let D=A;for(let U=0;U\u003Ci.nodes.length;U++){let B=i.nodes[D].parentId,F=B===void 0?void 0:h.get(B);if(F===void 0)break;let W=i.nodes[F].dir;if(W)return W===\\\"LR\\\"||W===\\\"RL\\\";D=F}return e.direction===\\\"LR\\\"||e.direction===\\\"RL\\\"};for(let A=0;A\u003Ci.nodes.length;A++){let D=i.nodes[A],U=Ct(D.cssStyles.length>0?D.cssCompiledStyles.concat(D.cssStyles):D.cssCompiledStyles),B=(U.bold?1:0)|(U.italic?2:0),F=s&&!/[\\\";]font-family:/.test(U.text)?4:0,W=U.fontSize??a,j=U.fontSize??o,Q=U.fontSize??Math.round(a*.75),Y=D.isGroup?Ge(D.label,!0,c,W,4e3,B):Ge(D.alias||D.label,!0,c,W,240,B),ne=b.get(A)??NM,q=ne.length>0&&!D.isGroup&&x(A),k={node:D,style:U,label:Y,w:0,h:0,headH:0,rows:[],cols:[],rowSize:j,keySize:Q,mono:F,below:q},J=0,te=0;for(let P of ne)P.band=Math.max(RM,q?P.label.width+12:P.label.height+6),te+=P.band,J=Math.max(J,q?P.label.height:P.label.width);let se=Math.max(Ty,q?te+8:0),re;if(D.isGroup)re=Bt(0,0),re.isGroup=!0,re.dir=D.dir?ln(D.dir):void 0,re.padX=ua,re.padTop=k.label.height>0?k.label.height+16:ua,re.padBottom=ua,re.minW=Math.max(k.label.width+2*ua-12,Ty);else{let P=Math.max(Y.height,Math.round(W*1.5));if(D.attributes.length===0)k.w=Math.max(Y.width+2*My,se),k.h=Math.max(P+2*TM,q?0:te+8);else{let ae=Math.round(j*1.5),ue=[0,0,0,0];for(let le of D.attributes){let de=[Ge(Hf(le.type),!0,c,j,Yf,B|F),Ge(Hf(le.name),!0,c,j,Yf,B|F),Ge(le.keys.join(\\\", \\\"),!1,c,Q,Yf,B|F),Ge(Hf(le.comment),!0,c,j,CM,B)],Se=ae;for(let _e=0;_e\u003C4;_e++)de[_e].width>ue[_e]&&(ue[_e]=de[_e].width),de[_e].height>Se&&(Se=de[_e].height);k.rows.push({cells:de,h:Se+Gf}),k.h+=Se+Gf}let ce=0,pe=0;for(let le of ue)le!==0&&(pe+=le+(ce>0?Cy:0),ce++);k.w=Math.max(pe+2*Uf,Y.width+2*My,se);let V=ce>0?(k.w-pe-2*Uf)/ce:0,X=Uf;for(let le of ue)k.cols.push(X),le>0&&(X+=le+V+Cy);k.headH=P+2*MM,k.h+=k.headH}let ee=ne.length>0?2*(vr+fa*.75+10+J):0;re=q?Bt(k.w,k.h+ee):Bt(k.w+ee,k.h)}re.seq=d.length,d.push(k),m.push(re)}i.nodes.forEach((A,D)=>{m[D].parent=A.parentId!==void 0?h.get(A.parentId)??-1:-1});let I=On(m,p,r?\\\"TB\\\":ln(e.direction),{nodeSep:Iy(t,\\\"nodeSpacing\\\",SM),edgeSep:wM,rankSep:Iy(t,\\\"rankSpacing\\\",_M),portSep:24});LM(p,m,d);let L=I.width;for(let[A,D]of b){let U=m[A];if(!U.isGroup)continue;let B=0;for(let F of D)B=Math.max(B,F.label.width);L=Math.max(L,U.x+U.w/2+vr+fa*.75+10+B)}let O=yn(e.title,c,a,4e3),v=O.height>0?O.height+12:0,G=Math.max(L,O.width),K=l+(G-L)/2,C=l+v;Tr(m,p,K,C);let Z=Math.ceil(G+2*l),oe=Math.ceil(I.height+v+2*l),H=[],z=new Map,M=!1;for(let A of m)A.isGroup&&(M=!0);if(M)for(let A of p)ur(z,A.route);let T=\\\"\\\",R=[],_=\\\"\\\";for(let A=0;A\u003Cd.length;A++){let D=d[A],U=m[A],B=D.node,F=It(B.cssClasses.replace(/^default\\\\s?/,\\\"\\\"));if(U.isGroup){D.w=U.w,D.h=U.h;let P=U.x-U.w/2,ee=U.y-U.h/2,ae=hs(U,D.label.width,z,ua);Mn(D.style.shape)&&R.push({box:[P,ee,P+U.w,ee+U.h],shape:D.style.shape}),T+=`\u003Cg class=\\\"pele-cluster${F}\\\" data-id=\\\"${Ue(B.id)}\\\">\u003Crect x=\\\"${f(P)}\\\" y=\\\"${f(ee)}\\\" width=\\\"${f(U.w)}\\\" height=\\\"${f(U.h)}\\\" fill=\\\"var(--_a)\\\"${vn(D.style.shape)?\\\"\\\":' fill-opacity=\\\"0.5\\\"'} stroke=\\\"var(--_b)\\\"${At(D.style.shape)}/>`+Ne(D.label,ae,ee+8+D.label.height/2,` class=\\\"pele-cluster-label\\\"${vt(D.style,\\\"var(--_m)\\\")}${D.style.text}`,u)+\\\"\u003C/g>\\\";continue}let W=D.w,j=D.h,Q=-W/2,Y=-j/2,ne=D.style.text,q=vt(D.style),k=q||' fill=\\\"var(--_m)\\\"',J=`x=\\\"${f(Q)}\\\" y=\\\"${f(Y)}\\\" width=\\\"${f(W)}\\\" height=\\\"${f(j)}\\\"`,te=Ne(D.label,0,D.rows.length>0?Y+D.headH/2:0,` class=\\\"pele-label\\\"${q}${ne}`,u),se=bt(B.alias||B.label);if(/ internal-link(?: |$)/.test(F+\\\" \\\")&&te!==\\\"\\\"&&n.links!==!1){let P=$i(se,n),ee=rt(se);te=`\u003Ca class=\\\"internal-link\\\"${P?` href=\\\"${ee}\\\"${qr(n)}`:\\\"\\\"} data-href=\\\"${ee}\\\">${te}\u003C/a>`,H.push({id:B.label,href:se,internal:!0})}let re;if(D.rows.length===0)re=`\u003Crect ${J}${At(Ny+D.style.shape)}/>`+te;else{let P=Math.round(D.rowSize*1.5),ee=D.style.stroke?rt(D.style.stroke):\\\"var(--_b)\\\",ae=\\\"\\\",ue=\\\"\\\",ce=Y+D.headH;for(let le=0;le\u003CD.rows.length;le++){let de=D.rows[le];if(le%2===0){let ke=`x=\\\"${f(Q)}\\\" width=\\\"${f(W)}\\\"`;le===D.rows.length-1?ae+=`\u003Crect ${ke} y=\\\"${f(ce)}\\\" height=\\\"${f(de.h)}\\\"${ht}/>\u003Crect ${ke} y=\\\"${f(ce)}\\\" height=\\\"${f(de.h/2)}\\\"/>`:ae+=`\u003Crect ${ke} y=\\\"${f(ce)}\\\" height=\\\"${f(de.h)}\\\"/>`}let Se=ce+Gf/2+P/2+D.rowSize*.35,[_e,xe,Me,Ce]=de.cells;ue+=ul(_e,Q+D.cols[0],Se,` class=\\\"pele-er-type\\\"${k}${ne}`,u,D.mono)+ul(xe,Q+D.cols[1],Se,` class=\\\"pele-er-name\\\"${q}${ne}`,u,D.mono)+ul(Me,Q+D.cols[2],Se,` class=\\\"pele-er-keys\\\" font-size=\\\"${D.keySize}\\\"${k}${ne}`,u,D.mono)+ul(Ce,Q+D.cols[3],Se,` class=\\\"pele-er-comment\\\"${k}${ne}`,u),ce+=de.h}let pe=f(Y+D.headH),V=dr(D.style.shape),X=V===sc?ic:V===ic?sc:\\\"var(--_bg)\\\";re=`\u003Crect ${J}${At(Ny+D.style.shape)}/>\u003Cg class=\\\"pele-er-stripes\\\" fill=\\\"${X}\\\"${D.style.shape.includes(\\\"fill:\\\")?' opacity=\\\"0.6\\\"':\\\"\\\"}>${ae}\u003C/g>\u003Cpath class=\\\"pele-er-divider\\\" d=\\\"M${f(Q)},${pe}H${f(Q+W)}\\\" stroke=\\\"${ee}\\\"/>\u003Crect ${J} fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"${At(D.style.line)}/>`+te+`\u003Cg class=\\\"pele-er-attributes\\\" font-size=\\\"${D.rowSize}\\\">${ue}\u003C/g>`}_+=`\u003Cg class=\\\"pele-node pele-entity${F}\\\" data-id=\\\"${Ue(B.label)}\\\" transform=\\\"translate(${f(U.x)},${f(U.y)})\\\">${re}\u003C/g>`}for(let[A,D]of b){let U=d[A],B=0;for(let j of D)B+=j.band;let F=Math.min(1,Math.max((U.below?U.w:U.h)-8,0)/B),W=-B*F/2;for(let j of D)j.band*=F,j.at=W+j.band/2,W+=j.band}let $=\\\"\\\",g=\\\"\\\",N=\\\"\\\";for(let A=0;A\u003Cp.length;A++){let D=p[A],U=E[A],B=y[A],F,W,j,Q=S[A];if(Q){let k=m[D.src],J=d[D.src],te=Math.max(Math.min(Q.band/2-6,13),1),se=vr+fa*.75+6;if(J.below){let re=k.x+Q.at,P=k.y+J.h/2,ee=f(P+vr),ae=f(P+vr+fa);F=`M${f(re-te)},${f(P)}V${ee}C${f(re-te)},${ae} ${f(re+te)},${ae} ${f(re+te)},${ee}V${f(P)}`,W=ri(U.arrowTypeStart,re-te,P,0,-1),j=ri(U.arrowTypeEnd,re+te,P,0,-1),D.labelX=re,D.labelY=P+se+B.height/2}else{let re=k.x+J.w/2,P=k.y+Q.at,ee=f(re+vr),ae=f(re+vr+fa);F=`M${f(re)},${f(P-te)}H${ee}C${ae},${f(P-te)} ${ae},${f(P+te)} ${ee},${f(P+te)}H${f(re)}`,W=ri(U.arrowTypeStart,re,P-te,-1,0),j=ri(U.arrowTypeEnd,re,P+te,-1,0),D.labelX=re+se+B.width/2,D.labelY=P}}else{let k=$M(D.route);if(k.length\u003C6)continue;$y(k,0,d[D.src],m[D.src]),$y(k,k.length-3,d[D.dst],m[D.dst]);let J=Math.abs(k[k.length-3]-k[0]),te=Math.abs(k[k.length-2]-k[1]),re=k.length===6&&(J\u003C.01||te\u003C.01||Math.hypot(J,te)\u003C=3*vr)?0:vr,P=Cn(k,void 0,re,re);F=re>0?`M${f(P.sx)},${f(P.sy)}L${P.d.slice(1)}L${f(P.ex)},${f(P.ey)}`:P.d,W=ri(U.arrowTypeStart,P.sx,P.sy,P.sdx,P.sdy),j=ri(U.arrowTypeEnd,P.ex,P.ey,P.edx,P.edy)}let Y=Bo(F,[],R),ne=Y&&Wo(Y);ne===\\\"\\\"&&(g+=Go(F,W+j)),Y&&ne&&(W=Uo(W,Y),j=Uo(j,Y));let q=U.pattern===\\\"dashed\\\";if($+=`\u003Cg class=\\\"pele-edge pele-er-${q?\\\"non-identifying\\\":\\\"identifying\\\"}\\\" data-id=\\\"${Ue(U.id)}\\\"${ne?` stroke=\\\"${ne}\\\"`:\\\"\\\"}>\u003Cpath d=\\\"${F}\\\"${q?' stroke-dasharray=\\\"4 3\\\"':\\\"\\\"}/>`+W+j+\\\"\u003C/g>\\\",B.width>0){let k=D.labelX,J=D.labelY;N+=dn(U.id,B,k,J,\\\"\\\",u)}}return{svg:at(\\\"er\\\",Z,oe,a,n,e,Ne(O,Z/2,l+O.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(T?`\u003Cg class=\\\"pele-clusters\\\">${T}\u003C/g>`:\\\"\\\")+Dn(g)+($?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${$}\u003C/g>`:\\\"\\\")+(N?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${o}\\\">${N}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${_}\u003C/g>`),width:Z,height:oe,links:H}}function $M(e){let t=e.slice(0,3);for(let n=3;n\u003Ce.length;n+=3){let r=t.length-3,i=s=>Math.abs(t[r+s]-e[n+s])\u003C.01&&Math.abs(e[n+s]-e[n+3+s])\u003C.01;n+3\u003Ce.length&&(i(0)||i(1))||t.push(e[n],e[n+1],e[n+2])}return t}function LM(e,t,n){let r=new Map,i=(s,a,o,c)=>{let l=t[s],u=a[o]-l.x,h=a[o+1]-l.y,d;if(Math.abs(Math.abs(h)-l.h/2)\u003C.5)d=h\u003C0?0:2;else if(Math.abs(Math.abs(u)-l.w/2)\u003C.5)d=u\u003C0?3:1;else return;let m=s*4+d,p={route:a,at:o,toward:a[c+(d&1?1:0)]},y=r.get(m);y?y.push(p):r.set(m,[p])};for(let s of e){let a=s.route.length-3;s.src===s.dst||a\u003C3||(i(s.src,s.route,0,3),i(s.dst,s.route,a,a-3))}for(let[s,a]of r){if(a.length\u003C2)continue;let o=s>>2,c=(s&1)===1,l=t[o].isGroup?t[o]:n[o],u=c?l.h:l.w,h=Math.max(Math.min(IM,(u-2*kM)/(a.length-1)),0),d=c?t[o].y:t[o].x;a.sort((m,p)=>m.toward-p.toward);for(let m=0;m\u003Ca.length;m++)a[m].route[a[m].at+(c?1:0)]=d+(m-(a.length-1)/2)*h}}function $y(e,t,n,r){if(r.isGroup)return;let i=e[t]-r.x,s=e[t+1]-r.y;r.w!==n.w&&Math.abs(Math.abs(i)-r.w/2)\u003C.5&&(e[t]-=Math.sign(i)*(r.w-n.w)/2),r.h!==n.h&&Math.abs(Math.abs(s)-r.h/2)\u003C.5&&(e[t+1]-=Math.sign(s)*(r.h-n.h)/2)}var Oy={type:\\\"er\\\",math:!0,parse(e,t,n){let r=new cl;return n&&(r.title=n),Ay(e,r),r},render:Ly};var OM=new Map([[\\\"ui\\\",\\\"ui\\\"],[\\\"pcr\\\",\\\"processor\\\"],[\\\"processor\\\",\\\"processor\\\"],[\\\"rmo\\\",\\\"readmodel\\\"],[\\\"readmodel\\\",\\\"readmodel\\\"],[\\\"cmd\\\",\\\"command\\\"],[\\\"command\\\",\\\"command\\\"],[\\\"evt\\\",\\\"event\\\"],[\\\"event\\\",\\\"event\\\"]]),DM=new Map([[\\\"trigger\\\",[0,\\\"UI/Automation\\\",\\\"UI/A: \\\"]],[\\\"state\\\",[100,\\\"Command/Read Model\\\",\\\"C/RM: \\\"]],[\\\"stream\\\",[200,\\\"Events\\\",\\\"Stream: \\\"]]]);function vM(e){return e===\\\"ui\\\"||e===\\\"processor\\\"?\\\"trigger\\\":e===\\\"event\\\"?\\\"stream\\\":\\\"state\\\"}function Kf(e){let t=e.indexOf(\\\"{\\\"),n=e.lastIndexOf(\\\"}\\\"),i=(t!==-1&&n>t?e.slice(t+1,n):t===-1&&e.length>=2?e.slice(1,-1):\\\"\\\").replace(/\\\\r/g,\\\"\\\").split(`\\r\\n`);for(;i.length>0&&i[0].trim()===\\\"\\\";)i.shift();for(;i.length>0&&i[i.length-1].trim()===\\\"\\\";)i.pop();let s=1/0;for(let a of i)a.trim()!==\\\"\\\"&&(s=Math.min(s,a.length-a.trimStart().length));return i.map(a=>a.slice(Math.min(s,a.length)).trimEnd()).join(`\\r\\n`)}function Dy(e,t){let n=new Set;for(let h of e.frames){if(n.has(h.name)){let d=cr(e.$source,h.$offset).line;throw new Qe(`Duplicate event modeling frame ID \\\"${h.name}\\\" on line ${d}`,\\\"semantic\\\",{type:\\\"eventmodeling\\\",line:d})}n.add(h.name)}let r=new Map;for(let h of e.dataEntities)r.has(h.name)||r.set(h.name,h.dataBlockValue);let i=new Map,s=new Map,a=(h,d)=>{let m=vM(h),p=d===void 0?m:`${m} ${d}`,y=i.get(p);if(!y){let[E,b,S]=DM.get(m),x=E;d!==void 0&&(x=s.get(m)??E+1,s.set(m,x+1)),y={index:x,label:d===void 0?b:S+d,group:m,namespace:d},i.set(p,y)}return y},o=[],c=new Map,l=[];e.frames.forEach((h,d)=>{let m=h.entityIdentifier.split(\\\".\\\"),p=m.length===2?m[0]:void 0,y=OM.get(h.modelEntityType)??\\\"event\\\",E=h.dataInlineValue===void 0?void 0:Kf(h.dataInlineValue);if(h.dataReference){let S=r.get(h.dataReference.$refText);S!==void 0&&(E=Kf(S))}let b={id:h.name,kind:y,entity:h.entityIdentifier,name:m.length===2?m[1]:h.entityIdentifier,namespace:p,reset:h.$type===\\\"EmResetFrame\\\",lane:a(y,p),data:E,dataType:h.dataType};if(o.push(b),c.set(b.id,b),h.sourceFrames.length>0){let S=new Set(h.sourceFrames.map(x=>x.$refText));for(let x of o)S.has(x.id)&&l.push({source:x,target:b})}else if(d>0&&!b.reset){for(let S=d-1;S>=0;S--)if(o[S].lane!==b.lane){l.push({source:o[S],target:b});break}}});let u=h=>h.map(d=>d.entityIdentifier.$refText);return{type:\\\"eventmodeling\\\",title:e.title&&Kt(e.title)||t,accTitle:e.accTitle?zt(e.accTitle).replace(/^\\\\s+/g,\\\"\\\"):void 0,accDescr:e.accDescr?Vt(e.accDescr).replace(/\\\\n\\\\s+/g,`\\r\\n`):void 0,boxes:o,lanes:[...i.values()].sort((h,d)=>h.index-d.index),relations:l,notes:e.noteEntities.map(h=>({frame:h.sourceFrame.$refText,text:Kf(h.dataBlockValue),dataType:h.dataType})),specifications:e.gwtEntities.map(h=>({frame:h.sourceFrame.$refText,given:u(h.givenStatements),when:u(h.whenStatements),then:u(h.thenStatements)})),entities:e.modelEntities.map(h=>h.name)}}var zf=/[\\\\t ]*accDescr(?:[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*({))/y;function PM(){let e=!1;return(t,n)=>{zf.lastIndex=n;let r=zf.exec(t);if(r===null)return-1;let i=zf.lastIndex;if(r[1]===void 0)return i;if(e)return-1;let s=t.indexOf(\\\"}\\\",i);return e=s===-1,s+1||-1}}function Zi(e=\\\"ACC_DESCR\\\"){return{...sn,name:e,scanner:PM}}var jf={name:\\\"EM_ID\\\",pattern:/[_a-zA-Z][\\\\w_]*/y},Ji=e=>({name:e,pattern:e,longer:[jf]}),ha=e=>({name:e,pattern:e}),FM=[\\\"resetframe\\\",\\\"readmodel\\\",\\\"processor\\\",\\\"timeframe\\\",\\\"command\\\",\\\"entity\\\",\\\"event\\\",\\\"jsobj\\\",\\\"figma\\\",\\\"given\\\",\\\"json\\\",\\\"salt\\\",\\\"html\\\",\\\"text\\\",\\\"data\\\",\\\"note\\\",\\\"when\\\",\\\"then\\\",\\\"rmo\\\",\\\"cmd\\\",\\\"evt\\\",\\\"pcr\\\",\\\"uri\\\"],Xf=[{...Jt(\\\"eventmodeling\\\"),longer:[jf]},...FM.map(Ji),ha(\\\"->>\\\"),Ji(\\\"gwt\\\"),Ji(\\\"ui\\\"),Ji(\\\"md\\\"),Ji(\\\"tf\\\"),ha(\\\"[[\\\"),ha(\\\"]]\\\"),Ji(\\\"rf\\\"),ha(\\\"`\\\"),ha(\\\".\\\"),jf,{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},Zi(\\\"EM_ACC_DESCR\\\"),{...Xt,name:\\\"EM_ACC_TITLE\\\"},{...er(String.raw`\\\\w`),name:\\\"EM_TITLE\\\"},{name:\\\"EM_WS\\\",pattern:/\\\\s+/y,hidden:!0},{...Ht,name:\\\"EM_YAML\\\"},{...Qt,name:\\\"EM_DIRECTIVE\\\"},{...Zt,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}],en=e=>Xf.findIndex(t=>t.name===e),fl=e=>new Set(e.map(en)),Ot={keyword:0,arrow:en(\\\"->>\\\"),open:en(\\\"[[\\\"),close:en(\\\"]]\\\"),tick:en(\\\"`\\\"),dot:en(\\\".\\\"),id:en(\\\"EM_ID\\\"),frameId:en(\\\"EM_FID\\\"),inline:en(\\\"EM_DATA_INLINE\\\"),block:en(\\\"EM_DATA_BLOCK\\\"),accDescr:en(\\\"EM_ACC_DESCR\\\"),accTitle:en(\\\"EM_ACC_TITLE\\\"),title:en(\\\"EM_TITLE\\\"),entity:en(\\\"entity\\\"),data:en(\\\"data\\\"),note:en(\\\"note\\\"),gwt:en(\\\"gwt\\\"),given:en(\\\"given\\\"),when:en(\\\"when\\\"),then:en(\\\"then\\\")},vy=fl([\\\"tf\\\",\\\"timeframe\\\"]),BM=fl([\\\"rf\\\",\\\"resetframe\\\"]),Vf=fl([\\\"rmo\\\",\\\"readmodel\\\",\\\"ui\\\",\\\"cmd\\\",\\\"command\\\",\\\"evt\\\",\\\"event\\\",\\\"pcr\\\",\\\"processor\\\"]),WM=fl([\\\"json\\\",\\\"jsobj\\\",\\\"figma\\\",\\\"salt\\\",\\\"uri\\\",\\\"md\\\",\\\"html\\\",\\\"text\\\"]);function Py(e){let t=new Ut(Yt(e,Xf,\\\"eventmodeling\\\"),Xf,\\\"eventmodeling\\\"),n={$type:\\\"EventModel\\\",modelEntities:[],frames:[],dataEntities:[],noteEntities:[],gwtEntities:[],$source:e},r=c=>t.kinds[t.i]===c,i=(c,l)=>c.has(t.kinds[t.i])?t.take():t.fail(l),s=()=>{let c=t.expect(Ot.id);for(;t.accept(Ot.dot);)c+=\\\".\\\"+t.expect(Ot.id);return c},a=()=>{if(!t.accept(Ot.tick))return;let c=i(WM,\\\"a data type\\\");return t.expect(Ot.tick),c},o=()=>{let c=[];do i(Vf,\\\"an entity type\\\"),c.push({$type:\\\"EmGwtStatement\\\",entityIdentifier:{$refText:t.expect(Ot.id)}});while(Vf.has(t.kinds[t.i]));return c};for(t.expect(Ot.keyword);!r(-1);){let c=t.kinds[t.i];if(c===Ot.accDescr)n.accDescr=t.take();else if(c===Ot.accTitle)n.accTitle=t.take();else if(c===Ot.title)n.title=t.take();else if(c===Ot.entity)t.i++,n.modelEntities.push({$type:\\\"EmModelEntity\\\",name:s()});else if(vy.has(c)||BM.has(c)){let l={$type:vy.has(c)?\\\"EmTimeFrame\\\":\\\"EmResetFrame\\\",name:\\\"\\\",modelEntityType:\\\"\\\",entityIdentifier:\\\"\\\",sourceFrames:[],$offset:t.tokens.starts[t.i]};for(t.i++,l.name=t.expect(Ot.frameId),l.modelEntityType=i(Vf,\\\"an entity type\\\"),l.entityIdentifier=s();t.accept(Ot.arrow);)l.sourceFrames.push({$refText:t.expect(Ot.frameId)});if(t.accept(Ot.open)&&(l.dataReference={$refText:t.expect(Ot.id)},t.expect(Ot.close)),r(Ot.tick)||r(Ot.inline)){let u=a();u!==void 0&&(l.dataType=u),l.dataInlineValue=t.expect(Ot.inline)}n.frames.push(l)}else if(c===Ot.data){t.i++;let l={$type:\\\"EmDataEntity\\\",name:t.expect(Ot.id),dataBlockValue:\\\"\\\"},u=a();u!==void 0&&(l.dataType=u),l.dataBlockValue=t.expect(Ot.block),n.dataEntities.push(l)}else if(c===Ot.note){t.i++;let l={$type:\\\"EmNoteEntity\\\",sourceFrame:{$refText:t.expect(Ot.frameId)},dataBlockValue:\\\"\\\"},u=a();u!==void 0&&(l.dataType=u),l.dataBlockValue=t.expect(Ot.block),n.noteEntities.push(l)}else if(c===Ot.gwt){t.i++;let l={$type:\\\"EmGwt\\\",sourceFrame:{$refText:t.expect(Ot.frameId)},givenStatements:[],whenStatements:[],thenStatements:[]};t.expect(Ot.given),l.givenStatements=o(),t.accept(Ot.when)&&(l.whenStatements=o()),t.expect(Ot.then),l.thenStatements=o(),n.gwtEntities.push(l)}else t.fail(\\\"a frame, an entity, a data block, a note, or a specification\\\")}return n}var Gy=new Map([[\\\"command\\\",0],[\\\"event\\\",1],[\\\"readmodel\\\",2],[\\\"processor\\\",6]]),fn=12,Hn=10,UM=96,Fy=16,GM=80,hl=12,By=8,YM=48,Wy=80,Yy=8;function qf(e,t){let n=[];for(let r of bt(e).split(`\\r\\n`)){let i=r.length\u003C=t?void 0:Array.from(r);if(i===void 0||i.length\u003C=t){n.push(r);continue}for(let s=0;s\u003Ci.length;s+=t)n.push(i.slice(s,s+t).join(\\\"\\\"))}return n}function pl(e,t,n,r,i){let s=\\\"\\\";for(let a=0;a\u003Ce.length;a++)e[a]!==\\\"\\\"&&(s+=`\u003Ctspan x=\\\"${f(t)}\\\" y=\\\"${f(n+a*r)}\\\">${rt(e[a])}\u003C/tspan>`);return s===\\\"\\\"?\\\"\\\":`\u003Ctext${i} xml:space=\\\"preserve\\\">${s}\u003C/text>`}function Hy(e,t,n){return Pt(n,r=>HM(e,t,n,r))}function HM(e,t,n,r){if(r)return VM(e,n);let i=n.fontSize??16,s=Math.round(i*.875),a=Math.round(i*.8125),o=Math.round(i*.75),c=Math.round(o*1.4),l=Math.round(a*1.5),u=n.measurer??ct(n.fontFamily,n.fontFamilyMono),h=n.padding??8,d=(w,A,D)=>{let U=0;for(let B of w)U=Math.max(U,u.width(B,A,D));return U},m=new Map,p=0;for(let w of e.lanes){let A=Ge(w.label,!1,u,a,4e3,1);p=Math.max(p,A.width),m.set(w,{lane:w,label:A,right:-1/0,y:0,h:0})}p+=2*hl;let y=[],E=new Map,b;for(let w of e.boxes){let A=m.get(w.lane),D=Ge(w.name,!1,u,s,4e3,1),U=w.data?qf(w.data,YM):[],B=Math.max(UM,Math.max(D.width,d(U,o,4))+2*fn),F=2*Hn+D.height+(U.length>0?6+U.length*c:0),W=0;if(b){let Q=b.x+Math.max(b.w/2,b.w-GM);W=b.box.lane===w.lane?A.right+Fy:Math.max(Q,A.right+Fy)}let j={box:w,name:D,data:U,x:W,y:0,w:B,h:F};A.right=W+B,A.h=Math.max(A.h,F),y.push(j),E.set(w,j),b=j}let S=0;for(let w of y)S=Math.max(S,w.x+w.w);let x=p+S+hl,I=Ge(e.title,!1,u,i,4e3,1),L=I.height>0?I.height+12:0,O=h,v=h+L,G=v,K=\\\"\\\";for(let w of m.values())w.y=G,w.h+=2*hl,K+=`\u003Cg class=\\\"pele-cluster pele-em-lane\\\" data-id=\\\"${Ue(w.lane.label)}\\\">\u003Crect x=\\\"${f(O)}\\\" y=\\\"${f(G)}\\\" width=\\\"${f(x)}\\\" height=\\\"${f(w.h)}\\\" fill=\\\"var(--_s)\\\"${ht}/>`+Ne(w.label,O+hl+w.label.width/2,G+w.h/2,` class=\\\"pele-cluster-label\\\" font-size=\\\"${a}\\\" font-weight=\\\"var(--_hw)\\\" fill=\\\"var(--_m)\\\"`)+\\\"\u003C/g>\\\",G+=w.h+By;let C=m.size>0?G-By:v,Z=\\\"\\\";for(let w of y){let A=m.get(w.box.lane);w.x+=O+p,w.y=A.y+(A.h-w.h)/2;let D=Gy.get(w.box.kind),U=`x=\\\"${f(w.x)}\\\" y=\\\"${f(w.y)}\\\" width=\\\"${f(w.w)}\\\" height=\\\"${f(w.h)}\\\"`,B=D===void 0?`\u003Crect ${U} fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`:`\u003Crect ${U} fill=\\\"var(--_bg)\\\"${ht}/>\u003Crect ${U} fill=\\\"${Et(D)}\\\" fill-opacity=\\\"0.22\\\" stroke=\\\"${Et(D)}\\\"${ht}/>`,F=w.y+Hn+w.name.height/2,W=Ne(w.name,w.x+w.w/2,F,` class=\\\"pele-label\\\" font-size=\\\"${s}\\\" font-weight=\\\"var(--_hw)\\\"`)+pl(w.data,w.x+fn,w.y+Hn+w.name.height+6+c/2+o*.35,c,` class=\\\"pele-em-data\\\" font-family=\\\"${fr}\\\" font-size=\\\"${o}\\\"`);Z+=`\u003Cg class=\\\"pele-node pele-em-${w.box.kind}${w.box.reset?\\\" pele-em-reset\\\":\\\"\\\"}\\\" data-id=\\\"${Ue(w.box.id)}\\\">${B}${W}\u003C/g>`}let oe=\\\"\\\",H=Rt(\\\"arrow_point\\\");for(let w of e.relations){let A=E.get(w.source),D=E.get(w.target);if(!A||!D||A===D)continue;let U,B;if(A.box.lane===D.box.lane){let F=D.x>=A.x,W=F?A.x+A.w:A.x,j=F?D.x:D.x+D.w,Q=A.y+A.h/2,Y=D.y+D.h/2,ne=j>=W?1:-1;U=`M${f(W)},${f(Q)}L${f(j-ne*H)},${f(Y)}`,B=_t(\\\"arrow_point\\\",j,Y,ne,0,\\\"var(--_l)\\\")}else{let F=D.y>A.y,W=Math.max(A.x,D.x),j=Math.min(A.x+A.w,D.x+D.w),Q=re=>Math.min(24,re/4),Y=j-W>=16?(W+j)/2:D.x>A.x?A.x+A.w-Q(A.w):A.x+Q(A.w),ne=j-W>=16?Y:D.x>A.x?D.x+Q(D.w):D.x+D.w-Q(D.w),q=F?A.y+A.h:A.y,k=F?D.y:D.y+D.h,J=F?1:-1,te=k-J*H,se=(q+te)/2;U=Y===ne?`M${f(Y)},${f(q)}V${f(te)}`:`M${f(Y)},${f(q)}C${f(Y)},${f(se)} ${f(ne)},${f(se)} ${f(ne)},${f(te)}`,B=_t(\\\"arrow_point\\\",ne,k,0,J,\\\"var(--_l)\\\")}oe+=`\u003Cg class=\\\"pele-edge\\\" data-id=\\\"${Ue(w.source.id)}-${Ue(w.target.id)}\\\">\u003Cpath d=\\\"${U}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>${B}\u003C/g>`}let z=new Map;for(let w of e.boxes)z.set(w.id,w.name);let M=\\\"\\\",T=0,R=(w,A,D,U)=>{let B=Ge(`${A} · ${D}${z.has(D)?\\\" \\\"+z.get(D):\\\"\\\"}`,!1,u,a,4e3,1),F=Math.max(B.width,d(U,a,0))+2*fn,W=2*Hn+B.height+U.length*l,j=C+(M===\\\"\\\"&&m.size===0?0:Yy);M+=`\u003Cg class=\\\"pele-em-${w}\\\" data-id=\\\"${Ue(D)}\\\">\u003Crect x=\\\"${f(O)}\\\" y=\\\"${f(j)}\\\" width=\\\"${f(F)}\\\" height=\\\"${f(W)}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+Ne(B,O+fn+B.width/2,j+Hn+B.height/2,` font-size=\\\"${a}\\\" font-weight=\\\"var(--_hw)\\\"`)+pl(U,O+fn,j+Hn+B.height+l/2+a*.35,l,` font-size=\\\"${a}\\\"`)+\\\"\u003C/g>\\\",C=j+W,T=Math.max(T,F)};for(let w of e.notes)R(\\\"note\\\",\\\"Note\\\",w.frame,qf(w.text,Wy));for(let w of e.specifications){let A=[`Given ${w.given.join(\\\", \\\")}`];w.when.length>0&&A.push(`When ${w.when.join(\\\", \\\")}`),A.push(`Then ${w.then.join(\\\", \\\")}`),R(\\\"specification\\\",\\\"Given / When / Then\\\",w.frame,A.flatMap(D=>qf(D,Wy)))}let _=Math.max(m.size>0?x:0,T,I.width),$=Math.ceil(_+2*h),g=Math.ceil(C+h),N=Ne(I,$/2,h+I.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+K+oe+Z+M;return{svg:at(\\\"eventmodeling\\\",$,g,i,n,e,N),width:$,height:g,links:[]}}var Uy=8,KM=120,zM=20;function VM(e,t){let n=t.fontSize??16,r=Math.round(n*.875),i=Math.round(n*.75),s=t.padding??8,a=t.measurer??ct(t.fontFamily,t.fontFamilyMono),o=Math.max(160,(t.maxWidth??320)-2*s),c=new Map(e.boxes.map((z,M)=>[z,M])),l=new Map,u=new Set;for(let z of e.relations){let M=c.get(z.source),T=c.get(z.target);if(M===void 0||T===void 0||M===T)continue;if(Math.abs(M-T)\u003C2){u.add(e.boxes[Math.max(M,T)]);continue}let R=l.get(z.target);R?(R[0]=Math.min(R[0],M),R[1]=Math.max(R[1],M)):l.set(z.target,[Math.min(M,T),Math.max(M,T)])}let h=new Map,d=[];for(let[z,[M,T]]of[...l].sort((R,_)=>R[1][0]-_[1][0])){let R=d.findIndex(_=>_\u003CM);R\u003C0&&(R=d.length),d[R]=T,h.set(z,R)}let m=24+Uy*Math.max(0,d.length-1),p=Math.max(KM,o-m),y=p-2*fn,E=Ge(e.title,!1,a,n,o,1),b=s+(E.height?E.height+12:0),S=s+E.height,x=Math.max(E.width,p+m),I=\\\"\\\",L=\\\"\\\",O=\\\"\\\",v=new Map,G=(z,M,T=0)=>Qs(bt(z),a,M,y,T);e.boxes.forEach((z,M)=>{let T=u.has(z)?y-zM:y,R=Zs(Ge(z.lane.label,!1,a,r,T,1),a,T),_=Ge(z.name,!1,a,r,y-36,1),$=z.data?G(z.data,i,4):void 0,g=Math.max(p,R.width+2*fn,_.width+2*fn+36,($?.width??0)+2*fn),N=R.height+12,w=2*Hn+_.height+($?$.height+6:0),A=Gy.get(z.kind),D=b+N,U=`x=\\\"${f(s)}\\\" y=\\\"${f(D)}\\\" width=\\\"${f(g)}\\\" height=\\\"${f(w)}\\\"`;I+=`\u003Cg class=\\\"pele-cluster pele-em-lane\\\" data-id=\\\"${Ue(z.lane.label)}\\\">`+Zr(R,s+fn,b,` class=\\\"pele-cluster-label\\\" font-size=\\\"${r}\\\" font-weight=\\\"var(--_hw)\\\" fill=\\\"var(--_m)\\\"`)+`\u003Cg class=\\\"pele-node pele-em-${z.kind}${z.reset?\\\" pele-em-reset\\\":\\\"\\\"}\\\" data-id=\\\"${Ue(z.id)}\\\">\u003Crect ${U} fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+(A===void 0?\\\"\\\":`\u003Crect ${U} fill=\\\"${Et(A)}\\\" fill-opacity=\\\"0.22\\\" stroke=\\\"${Et(A)}\\\"${ht}/>`)+Ne(_,s+fn+_.width/2,D+Hn+_.height/2,` class=\\\"pele-label\\\" font-size=\\\"${r}\\\" font-weight=\\\"var(--_hw)\\\"`)+`\u003Ctext class=\\\"pele-em-frame\\\" x=\\\"${f(s+g-fn)}\\\" y=\\\"${f(D+Hn+r)}\\\" text-anchor=\\\"end\\\" font-size=\\\"${i}\\\" fill=\\\"var(--_m)\\\">${rt(z.id)}\u003C/text>`+($?pl($.lines.map(B=>B.map(F=>F.text).join(\\\"\\\")),s+fn,D+Hn+_.height+6+$.lineHeight/2+i*.35,$.lineHeight,` class=\\\"pele-em-data\\\" font-family=\\\"${fr}\\\" font-size=\\\"${i}\\\"`):\\\"\\\")+\\\"\u003C/g>\u003C/g>\\\",v.set(z,{y:D,h:w,w:g,index:M,lane:R.width}),x=Math.max(x,g+m),S=D+w,b=S+28});for(let z of e.relations){let M=v.get(z.source),T=v.get(z.target);if(!M||!T||M===T)continue;let R=T.y>M.y,_=R?1:-1,$=R?M.y+M.h:M.y,g=R?T.y:T.y+T.h,N,w;if(Math.abs(M.index-T.index)===1){let A=s+Math.max(Math.min(M.w,T.w)/2,fn+(R?T:M).lane+16);N=`M${f(A)},${f($)}V${f(g-_*Rt(\\\"arrow_point\\\"))}`,w=_t(\\\"arrow_point\\\",A,g,0,_,\\\"var(--_l)\\\")}else{let A=s+x-m+12+Uy*(h.get(z.target)??0),D=M.y+M.h/2-5,U=T.y+T.h/2+5;N=`M${f(s+M.w)},${f(D)}H${f(A)}V${f(U)}H${f(s+T.w+Rt(\\\"arrow_point\\\"))}`,w=_t(\\\"arrow_point\\\",s+T.w,U,-1,0,\\\"var(--_l)\\\")}L+=`\u003Cg class=\\\"pele-edge\\\" data-id=\\\"${Ue(z.source.id)}-${Ue(z.target.id)}\\\">\u003Cpath d=\\\"${N}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>${w}\u003C/g>`}let K=new Map(e.boxes.map(z=>[z.id,z.name])),C=(z,M,T,R)=>{let _=Ge(`${M} · ${T}${K.has(T)?\\\" \\\"+K.get(T):\\\"\\\"}`,!1,a,r,y,1),$=G(R,r),g=Math.max(p,_.width+2*fn,$.width+2*fn),N=2*Hn+_.height+$.height;O+=`\u003Cg class=\\\"pele-em-${z}\\\" data-id=\\\"${Ue(T)}\\\">\u003Crect x=\\\"${f(s)}\\\" y=\\\"${f(b)}\\\" width=\\\"${f(g)}\\\" height=\\\"${f(N)}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+Ne(_,s+fn+_.width/2,b+Hn+_.height/2,` font-size=\\\"${r}\\\" font-weight=\\\"var(--_hw)\\\"`)+pl($.lines.map(w=>w.map(A=>A.text).join(\\\"\\\")),s+fn,b+Hn+_.height+$.lineHeight/2+r*.35,$.lineHeight,` font-size=\\\"${r}\\\"`)+\\\"\u003C/g>\\\",S=b+N,b=S+Yy,x=Math.max(x,g)};for(let z of e.notes)C(\\\"note\\\",\\\"Note\\\",z.frame,z.text);for(let z of e.specifications){let M=[`Given ${z.given.join(\\\", \\\")}`];z.when.length&&M.push(`When ${z.when.join(\\\", \\\")}`),M.push(`Then ${z.then.join(\\\", \\\")}`),C(\\\"specification\\\",\\\"Given / When / Then\\\",z.frame,M.join(`\\r\\n`))}let Z=Math.ceil(x+2*s),oe=Math.ceil(S+s),H=Ne(E,Z/2,s+E.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+L+I+O;return{svg:at(\\\"eventmodeling\\\",Z,oe,n,t,e,H),width:Z,height:oe,links:[]}}var Ky={type:\\\"eventmodeling\\\",keepComments:!0,parse:(e,t,n)=>Dy(Py(e),n),render:Hy};function Qf(e){return e===\\\"markdown\\\"||e===\\\"string\\\"||e===\\\"text\\\"?e:\\\"markdown\\\"}function zy(e){return e.startsWith('\\\"')&&e.endsWith('\\\"')?e.substring(1,e.length-1):e}function jM(e,t){let n=0;for(let r=0;r\u003Ct.length;r++)t[r]===e&&n++;return n}function XM(e){let t=e.trim(),n=\\\"arrow_open\\\";switch(t[0]){case\\\"\u003C\\\":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);break}let r=\\\"normal\\\";return t.includes(\\\"=\\\")&&(r=\\\"thick\\\"),t.includes(\\\".\\\")&&(r=\\\"dotted\\\"),{type:n,stroke:r}}function qM(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(\\\"\u003C\\\")&&(r=\\\"double_\\\"+r,n=n.slice(1));break;case\\\"o\\\":r=\\\"arrow_circle\\\",t.startsWith(\\\"o\\\")&&(r=\\\"double_\\\"+r,n=n.slice(1));break}let i=\\\"normal\\\",s=n.length-1;n.startsWith(\\\"=\\\")&&(i=\\\"thick\\\"),n.startsWith(\\\"~\\\")&&(i=\\\"invisible\\\");let a=jM(\\\".\\\",n);return a&&(i=\\\"dotted\\\",s=a),{type:r,stroke:i,length:s}}var ml=class{constructor(t={}){fe(this,\\\"type\\\",\\\"flowchart\\\");fe(this,\\\"direction\\\");fe(this,\\\"nodes\\\",new Map);fe(this,\\\"edges\\\",[]);fe(this,\\\"subgraphs\\\",[]);fe(this,\\\"classes\\\",new Map);fe(this,\\\"tooltips\\\",new Map);fe(this,\\\"defaultEdgeStyle\\\");fe(this,\\\"defaultInterpolate\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"subgraphLookup\\\",new Map);fe(this,\\\"members\\\",new Set);fe(this,\\\"edgeById\\\",new Map);fe(this,\\\"pairCount\\\",new Map);fe(this,\\\"subCount\\\",0);fe(this,\\\"options\\\");this.options=t}addVertex(t,n,r,i,s,a,o,c){if(!t||t.trim().length===0)return;let l;if(c!==void 0){let p=c.includes(`\\r\\n`)?c+`\\r\\n`:`{\\r\\n`+c+`\\r\\n}`,y;try{y=lr(p)}catch(E){throw new Qe(`Metadata of \\\"${t}\\\" is not valid YAML. ${E.message}`,\\\"syntax\\\",{type:\\\"flowchart\\\"})}l=y!==null&&typeof y==\\\"object\\\"&&!Array.isArray(y)?y:void 0}let u=this.subgraphLookup.get(t);if(u&&l){u.metadata={...u.metadata,...l};return}let h=this.edgeById.get(t);if(h){l?.animate!==void 0&&(h.animate=l.animate),l?.animation!==void 0&&(h.animation=l.animation),l?.curve!==void 0&&(h.interpolate=l.curve);return}let d=this.nodes.get(t);if(d===void 0&&(n===void 0&&r===void 0&&i!==void 0&&i!==null&&this.options.warn?.(`Style applied to unknown node \\\"${t}\\\". This may indicate a typo. The node will be created automatically.`),d={id:t,labelType:\\\"text\\\",styles:[],classes:[]},this.nodes.set(t,d)),n!==void 0?(d.labelType=n.type,d.text=zy(n.text.trim())):d.text===void 0&&(d.text=t),r!==void 0&&(d.type=r),i!=null)for(let p of i)d.styles.push(p);if(s!=null)for(let p of s)d.classes.push(p);if(a!==void 0&&(d.dir=a),d.props===void 0?d.props=o??{}:o!==void 0&&Object.assign(d.props,o),l===void 0)return;if(l.shape){let p=String(l.shape);if(p!==p.toLowerCase()||p.includes(\\\"_\\\"))throw new Qe(`No such shape: ${p}. Shape names should be lowercase.`,\\\"semantic\\\",{type:\\\"flowchart\\\"});if(!dc(p))throw new Qe(`No such shape: ${p}.`,\\\"semantic\\\",{type:\\\"flowchart\\\"});d.type=p}let m=typeof l.label==\\\"string\\\"?l.label:void 0;l.label&&(d.text=String(l.label),d.labelType=Qf(l.labelType)),l.icon&&(d.icon=String(l.icon),!m?.trim()&&d.text===t&&(d.text=\\\"\\\")),l.form&&(d.form=String(l.form)),l.pos&&(d.pos=String(l.pos)),l.img&&(d.img=String(l.img),!m?.trim()&&d.text===t&&(d.text=\\\"\\\")),l.constraint&&(d.constraint=String(l.constraint)),l.w&&(d.assetWidth=Number(l.w)),l.h&&(d.assetHeight=Number(l.h))}addSingleLink(t,n,r,i){let s={start:t,end:n,type:void 0,text:\\\"\\\",labelType:\\\"text\\\",classes:[],isUserDefinedId:!1,interpolate:this.defaultInterpolate},a=r?.text;a!==void 0&&(s.text=zy(a.text.trim()),s.labelType=Qf(a.type)),r!==void 0&&(s.type=r.type,s.stroke=r.stroke,s.length=r.length>10?10:r.length);let o=t+\\\"\\\\0\\\"+n,c=this.pairCount.get(o)??0;i&&!this.edgeById.has(i)?(s.id=i,s.isUserDefinedId=!0):s.id=`L_${t}_${n}_${c===0?0:c+1}`;let l=this.options.maxEdges;if(l!==void 0&&this.edges.length>=l)throw new Qe(`Edge limit exceeded. The limit is ${l}.`,\\\"limit\\\",{type:\\\"flowchart\\\"});this.edges.push(s),this.pairCount.set(o,c+1),this.edgeById.has(s.id)||this.edgeById.set(s.id,s)}addLink(t,n,r){let i=typeof r?.id==\\\"string\\\"?r.id.replace(\\\"@\\\",\\\"\\\"):void 0,s=t[t.length-1],a=n[0];for(let o of t)for(let c of n)this.addSingleLink(o,c,r,o===s&&c===a?i:void 0)}updateLinkInterpolate(t,n){for(let r of t)r===\\\"default\\\"?this.defaultInterpolate=n:this.edgeAt(r).interpolate=n}updateLink(t,n){for(let r of t){if(r===\\\"default\\\"){this.defaultEdgeStyle=n;continue}let i=this.edgeAt(r);i.style=n,n.length>0&&!n.some(s=>s?.startsWith(\\\"fill\\\"))&&n.push(\\\"fill:none\\\")}}edgeAt(t){let n=this.edges[Number(t)];if(n===void 0)throw new Qe(`The index ${t} 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 n}addClass(t,n){let r=n.join().replace(/\\\\\\\\,/g,\\\"§§§\\\").replace(/,/g,\\\";\\\").replace(/§§§/g,\\\",\\\").split(\\\";\\\");for(let i of t.split(\\\",\\\")){let s=this.classes.get(i);s===void 0&&(s={id:i,styles:[],textStyles:[]},this.classes.set(i,s));for(let a of r)a.includes(\\\"color\\\")&&s.textStyles.push(a.replace(\\\"fill\\\",\\\"bgFill\\\")),s.styles.push(a)}}setDirection(t){let n=t.trim();n.includes(\\\"\u003C\\\")&&(n=\\\"RL\\\"),n.includes(\\\"^\\\")&&(n=\\\"BT\\\"),n.includes(\\\">\\\")&&(n=\\\"LR\\\"),n.includes(\\\"v\\\")&&(n=\\\"TB\\\"),n===\\\"TD\\\"&&(n=\\\"TB\\\"),this.direction=n}setClass(t,n){for(let r of t.split(\\\",\\\"))this.nodes.get(r)?.classes.push(n),this.edgeById.get(r)?.classes.push(n),this.subgraphLookup.get(r)?.classes.push(n)}setTooltip(t,n){if(n!==void 0)for(let r of t.split(\\\",\\\"))this.tooltips.set(r,n)}setLink(t,n,r){let i=n.trim();for(let s of t.split(\\\",\\\")){let a=this.nodes.get(s);a!==void 0&&(a.link=i?Qn(i):void 0,a.linkTarget=r)}this.setClass(t,\\\"clickable\\\")}setClickEvent(t,n,r){this.setClass(t,\\\"clickable\\\")}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}addSubGraph(t,n,r){let i=t?.text.trim(),s=r?.text??\\\"\\\";t!==void 0&&t===r&&/\\\\s/.test(s)&&(i=void 0);let a=new Set,o=[],c;for(let d of n)if(typeof d==\\\"string\\\")d.trim()!==\\\"\\\"&&!a.has(d)&&(a.add(d),o.push(d));else if(Array.isArray(d))for(let m of d)m.trim()!==\\\"\\\"&&!a.has(m)&&(a.add(m),o.push(m));else c=d.value;c??=this.options.inheritDir?this.direction??this.options.direction:void 0,i??=\\\"subGraph\\\"+this.subCount,s=s||\\\"\\\",this.subCount++;let l={id:i,nodes:o,title:s.trim(),classes:[],dir:c,labelType:Qf(r?.type)},u=this.members;l.nodes=o.filter(d=>!u.has(d)&&d!==i);for(let d of l.nodes)u.add(d);let h=this.subgraphLookup.get(i);if(h)for(let d of l.nodes)h.nodes.push(d);else this.subgraphs.push(l);return this.subgraphLookup.set(i,h??l),i}exists(t,n){for(let r of t)if(r.nodes.includes(n))return!0;return!1}makeUniq(t,n){let r=new Set;for(let i of n)for(let s of i.nodes)r.add(s);return{nodes:t.nodes.filter(i=>!r.has(i))}}destructLink(t,n){let r=qM(t);if(!n)return r;let i=XM(n);if(i.stroke!==r.stroke)return{type:\\\"INVALID\\\",stroke:\\\"INVALID\\\"};if(i.type===\\\"arrow_open\\\")i.type=r.type;else{if(i.type!==r.type)return{type:\\\"INVALID\\\",stroke:\\\"INVALID\\\"};i.type=\\\"double_\\\"+i.type}return i.type===\\\"double_arrow\\\"&&(i.type=\\\"double_arrow_point\\\"),i.length=r.length,i}subgraph(t){return this.subgraphLookup.get(t)}};var Zf=[\\\"$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\\\"];var qy=new Uint8Array(128);for(let e of\\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\\\\\\\"#$%&'*+.`?\\\\\\\\_/\\\")qy[e.charCodeAt(0)]=1;var QM=/accTitle\\\\s*:\\\\s*/y,ZM=/accDescr\\\\s*:\\\\s*/y,JM=/accDescr\\\\s*\\\\{\\\\s*/y,eC=/call\\\\s+/y,tC=/click\\\\s+/y,nC=/(?:\\\\r?\\\\n)*\\\\s*\\\\n/y,rC=/\\\\s*(?:LR|RL|TB|BT|TD|BR)\\\\b/y,sC=/\\\\s*[\u003C>^]/y,iC=/\\\\s*v\\\\b/y,oC=[/.*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],Jf=/[\\\\n\\\\r\\\\u2028\\\\u2029]/g,Vy=/\\\\s*[xo\u003C]?--+[-xo>]\\\\s*/y,aC=/\\\\s*[xo\u003C]?--\\\\s*/y,jy=/\\\\s*[xo\u003C]?==+[=xo>]\\\\s*/y,cC=/\\\\s*[xo\u003C]?==\\\\s*/y,eh=/\\\\s*[xo\u003C]?-?\\\\.+-[xo>]?\\\\s*/y,lC=/\\\\s*[xo\u003C]?-\\\\.\\\\s*/y,Xy=/\\\\s*~~~+\\\\s*/y,dC=/(?:\\\\r?\\\\n)+/y,uC=/[^\\\\S\\\\n\\\\r]+/y,fC=/\\\\(\\\\s*\\\\)/y,hC=/\\\\n\\\\s*/g;function Qy(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=!0,l=e.indexOf(\\\"direction\\\"),u=e.indexOf(\\\"@\\\"),h=-1,d=0,m=0,p=-1,y=-1,E=-1,b=(T,R,_)=>{n.push(T),r.push(e.slice(R,_)),i.push(R),o=_},S=T=>{s.push(a),a=T},x=()=>{s.length>0&&(a=s.pop())},I=(T,R)=>(T.lastIndex=R,T.test(e)?T.lastIndex:-1),L=T=>e.startsWith(T,o)&&!ot(e.charCodeAt(o+T.length)),O=T=>{let R=T;if(T>=y&&T\u003C=E)R=E;else if(qe(e.charCodeAt(T))){for(;R\u003Ct&&qe(e.charCodeAt(R));)R++;y=T,E=R}let _=e.charCodeAt(R);return _===120||_===111||_===60?e.charCodeAt(R+1):_},v=T=>{let R=T;if(T>=y&&T\u003C=E)R=E;else if(qe(e.charCodeAt(T))){for(;R\u003Ct&&qe(e.charCodeAt(R));)R++;y=T,E=R}return e.charCodeAt(R)===126},G=()=>{e.charCodeAt(o+1)===96?(S(2),o+=2):(S(1),o++)},K=()=>{if(!v(o))return!1;let T=I(Xy,o);return T\u003C0?!1:(b(40,o,T),!0)},C=T=>{let R=e.charCodeAt(o+1);return T===40?(R===45?(S(8),b(45,o,o+2)):R===91?(S(7),b(47,o,o+2)):R===40&&e.charCodeAt(o+2)===40?(S(7),b(55,o,o+3)):(S(7),b(69,o,o+1)),!0):T===91?(R===91?(S(7),b(49,o,o+2)):R===40?(S(7),b(53,o,o+2)):R===47?(S(9),b(58,o,o+2)):R===92?(S(9),b(59,o,o+2)):(S(7),b(71,o,o+1)),!0):T===124?(S(7),b(67,o,o+1),!0):T===123?(S(7),b(73,o,o+1),!0):!1},Z=T=>{c&&(c=!1,S(6)),b(20,o,o+T)},oe=()=>{let T=o;for(;T\u003Ct;){let R=e.charCodeAt(T);if(R\u003C128&&qy[R]===1)T++;else if(R===45&&T+1\u003Ct){let _=e.charCodeAt(T+1);if(_===62||_===45||_===46)break;T++}else break}return T===o?!1:(b(64,o,T),!0)},H=T=>{let R=O(o),_;if(R===45){if((_=I(Vy,o))>=0)return b(40,o,_),!0;if((_=I(aC,o))>=0)return S(10),b(41,o,_),!0;if((_=I(eh,o))>=0)return b(40,o,_),!0;if((_=I(lC,o))>=0)return S(12),b(41,o,_),!0}else if(R===61){if((_=I(jy,o))>=0)return b(40,o,_),!0;if((_=I(cC,o))>=0)return S(11),b(41,o,_),!0}else if(R===46&&(_=I(eh,o))>=0)return b(40,o,_),!0;return T!==45&&T!==61&&T!==46&&K()},z=T=>{let R;switch(T){case 97:if(e.startsWith(\\\"acc\\\",o)){if((R=I(QM,o))>=0)return S(3),b(2,o,R),!0;if((R=I(ZM,o))>=0)return S(4),b(4,o,R),!0;if((R=I(JM,o))>=0)return S(5),o=R,!0}break;case 64:if(e.charCodeAt(o+1)===123)return S(16),n.push(7),r.push(\\\"\\\"),i.push(o),o+=2,!0;break;case 99:if((R=I(eC,o))>=0)return S(14),o=R,!0;if(L(\\\"classDef\\\"))return b(16,o,o+8),!0;if(L(\\\"class\\\"))return b(17,o,o+5),!0;if((R=I(tC,o))>=0)return S(13),o=R,!0;break;case 34:return G(),!0;case 115:if(L(\\\"style\\\"))return b(12,o,o+5),!0;if(L(\\\"swimlane-beta\\\"))return Z(13),!0;if(L(\\\"subgraph\\\"))return b(21,o,o+8),!0;break;case 100:if(L(\\\"default\\\"))return b(13,o,o+7),!0;break;case 108:if(L(\\\"linkStyle\\\"))return b(14,o,o+9),!0;break;case 105:if(L(\\\"interpolate\\\"))return b(15,o,o+11),!0;break;case 104:if(e.startsWith(\\\"href\\\",o)&&qe(e.charCodeAt(o+4)))return b(18,o,o+5),!0;break;case 102:if(L(\\\"flowchart-elk\\\"))return Z(13),!0;if(L(\\\"flowchart\\\"))return Z(9),!0;break;case 103:if(L(\\\"graph\\\"))return Z(5),!0;break;case 101:if(L(\\\"end\\\")){for(R=o+3;R\u003Ct&&qe(e.charCodeAt(R));)R++;return b(22,o,R),!0}break;case 95:if(L(\\\"_self\\\"))return b(23,o,o+5),!0;if(L(\\\"_blank\\\"))return b(23,o,o+6),!0;if(L(\\\"_parent\\\"))return b(23,o,o+7),!0;if(L(\\\"_top\\\"))return b(23,o,o+4),!0;break}if(l!==-1&&o>=d&&(l\u003Co&&(l=e.indexOf(\\\"direction\\\",o)),l!==-1&&(h\u003Co&&(Jf.lastIndex=o,h=Jf.test(e)?Jf.lastIndex-1:t),l\u003Ch))){for(let _=0;_\u003C5;_++)if((R=I(oC[_],o))>=0)return b(26+_,o,R),!0;d=h}if(u!==-1&&T!==34&&!qe(T)){if(o>=m){u\u003Co&&(u=e.indexOf(\\\"@\\\",o));let _=o;for(;_\u003Ct;){let $=e.charCodeAt(_);if($===34||qe($))break;_++}if(m=_,p=-1,u!==-1&&u\u003C_)for(let $=Math.min(_,t-1)-1;$>=u;$--){if(e.charCodeAt($)!==64)continue;let g=e.charCodeAt($+1);if(g!==123&&g!==34){p=$;break}}}if(p>o)return b(31,o,p+1),!0}if(T>=48&&T\u003C=57){let _=o+1;for(;_\u003Ct;){let $=e.charCodeAt(_);if($\u003C48||$>57)break;_++}return b(32,o,_),!0}switch(T){case 35:return b(33,o,o+1),!0;case 58:return e.charCodeAt(o+1)===58&&e.charCodeAt(o+2)===58?b(34,o,o+3):b(35,o,o+1),!0;case 38:return b(36,o,o+1),!0;case 59:return b(37,o,o+1),!0;case 44:return b(38,o,o+1),!0;case 42:return b(39,o,o+1),!0;case 120:case 111:return H(T)||oe();case 60:return H(T)||b(60,o,o+1),!0;case 45:return H(T)||oe()||b(65,o,o+1),!0;case 61:return H(T);case 46:return H(T)||oe();case 126:return K();case 40:return C(T);case 91:return e.charCodeAt(o+1)===124?(b(50,o,o+2),!0):C(T);case 124:case 123:return C(T);case 62:return S(7),b(51,o,o+1),!0;case 94:return b(61,o,o+1),!0;case 92:return e.charCodeAt(o+1)===124?(b(62,o,o+2),!0):oe();case 118:return ot(e.charCodeAt(o+1))?oe():(b(63,o,o+1),!0)}return qe(T)?H(T)?!0:(R=I(dC,o))>=0?(b(74,o,R),!0):(R=I(uC,o))>=0?(b(75,o,R),!0):!1:T\u003C128?oe():Oi(T)?(b(66,o,o+1),!0):!1},M=(T,R,_,$)=>{if(T===34)return G(),!0;let g=O(o);if(g===_||g===$){let w=I(R,o);if(w>=0)return x(),b(40,o,w),!0}if(T===_&&(_!==45||e.charCodeAt(o+1)===45))return!1;let N=o+1;for(;N\u003Ct;){let w=e.charCodeAt(N);if(w===34)break;if(w===_){if(_!==45||e.charCodeAt(N+1)===45)break}else if(w===120||w===111||w===60||w===$||qe(w)){let A=O(N);if((A===_||A===$)&&I(R,N)>=0)break}N++}return b(42,o,N),!0};e:for(;;){if(o>=t){let _=-1;switch(a){case 0:_=76;break;case 3:_=3;break;case 4:_=5;break;case 5:_=6;break;case 13:_=19;break;case 14:_=8;break;case 15:_=9;break}_!==-1&&b(_,t,t);break}let T=e.charCodeAt(o),R=!0;switch(a){case 0:R=z(T);break;case 1:if(T===34)e.charCodeAt(o+1)===96?(S(2),o+=2):(x(),o++);else{let _=e.indexOf('\\\"',o);b(11,o,_===-1?t:_)}break;case 2:if(T===96)e.charCodeAt(o+1)===34?(x(),o+=2):R=!1;else if(T===34)G();else{let _=o+1;for(;_\u003Ct;){let $=e.charCodeAt(_);if($===96||$===34)break;_++}b(10,o,_)}break;case 3:case 4:{let _=e.indexOf(`\\r\\n`,o);_===-1&&(_=t);let $=a===3?3:5;x(),b($,o,_);break}case 5:if(T===125)x(),o++;else{let _=e.indexOf(\\\"}\\\",o);_===-1&&(_=t),b(6,o,_)}break;case 6:{let _;T===34?G():(_=I(nC,o))>=0?(x(),b(24,o,_)):(_=I(rC,o))>=0||(_=I(sC,o))>=0||(_=I(iC,o))>=0?(x(),b(25,o,_)):R=K()||C(T);break}case 7:{let _=e.charCodeAt(o+1);switch(T){case 34:G();break;case 40:case 91:case 123:C(T);break;case 93:x(),_===41?b(46,o,o+2):_===93?b(48,o,o+2):b(70,o,o+1);break;case 41:x(),_===93?b(52,o,o+2):_===41&&e.charCodeAt(o+2)===41?b(54,o,o+3):b(68,o,o+1);break;case 124:x(),b(67,o,o+1);break;case 125:x(),b(72,o,o+1);break;default:{if((T===126||qe(T))&&K())break;let $=o+1;for(;$\u003Ct;){let g=e.charCodeAt($);if(g===91||g===93||g===40||g===41||g===123||g===125||g===124||g===34)break;$++}b(44,o,$)}}break}case 8:{let _=e.charCodeAt(o+1);if(T===34)G();else{if((T===126||qe(T))&&K())break;if((T===45||T===47||T===41)&&_===41)x(),b(43,o,o+2);else if(T===40||T===91||T===123)C(T);else if(T===41||T===93||T===125)R=!1;else{let $=o+1;for(;$\u003Ct;){let g=e.charCodeAt($);if(g===34||g===40||g===41||g===91||g===93||g===123||g===125||(g===45||g===47)&&e.charCodeAt($+1)===41||(g===126||qe(g))&&v($)&&I(Xy,$)>=0)break;$++}b(44,o,$)}}break}case 9:{let _=e.charCodeAt(o+1);if(T===34){G();break}if((T===126||qe(T))&&K())break;switch(T){case 40:_===45||_===91||_===40&&e.charCodeAt(o+2)===40?C(T):_===93?(x(),b(56,o,o+2)):C(T);break;case 91:case 123:C(T);break;case 92:_===93?(x(),b(56,o,o+2)):b(44,o,o+1);break;case 47:_===93?(x(),b(57,o,o+2)):b(44,o,o+1);break;case 93:case 41:_===93?(x(),b(56,o,o+2)):R=!1;break;case 125:R=!1;break;default:{if((T===63||T===61)&&_===93){x(),b(56,o,o+2);break}let $=o+1;for(;$\u003Ct;){let g=e.charCodeAt($);if(g===92||g===91||g===93||g===40||g===41||g===123||g===125||g===47)break;$++}b(44,o,$)}}break}case 10:R=M(T,Vy,45,-1);break;case 11:R=M(T,jy,61,-1);break;case 12:R=M(T,eh,46,45);break;case 13:if(T===34)G();else if(qe(T))x(),o++;else{let _=o+1;for(;_\u003Ct&&!qe(e.charCodeAt(_));)_++;b(19,o,_)}break;case 14:if(T===40){let _=I(fC,o);x(),_>=0?o=_:(S(15),o++)}else{let _=e.indexOf(\\\"(\\\",o);_===-1&&(_=t),b(8,o,_)}break;case 15:if(T===41)x(),o++;else{let _=e.indexOf(\\\")\\\",o);_===-1&&(_=t),b(9,o,_)}break;case 16:if(T===34)S(17),b(7,o,o+1);else if(T===125)x(),o++;else if(T===94)R=!1;else{let _=o+1;for(;_\u003Ct;){let $=e.charCodeAt(_);if($===125||$===94||$===34)break;_++}b(7,o,_)}break;case 17:if(T===34)x(),b(7,o,o+1);else{let _=e.indexOf('\\\"',o);_===-1&&(_=t),n.push(7),r.push(e.slice(o,_).replace(hC,\\\"\u003Cbr/>\\\")),i.push(o),o=_}break}if(!R)return n.push(1),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i};continue e}return n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i}}var gl=new Uint8Array(77);for(let e of[32,64,63,65,13,38,35,36,33,39,66])gl[e]=1;var th=new Uint8Array(77);for(let e of[32,66,64,25,63,65,38,35,36,33,39])th[e]=1;var nh=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])nh[e]=1;var rh=new Uint8Array(77);for(let e of[32,64,35,75,33,12])rh[e]=1;var Zy=\\\"'UNICODE_TEXT', 'TEXT', 'TAGSTART'\\\",pa=[],Jy=/}\\\\s*\\\\n/g;function tE(e,t){let n=e.includes(\\\"}\\\")?e.replace(Jy,`}\\r\\n`):e,{types:r,texts:i,starts:s}=Qy(n),a=0,o,c=M=>{let T=r[a],R=n===e?s[a]:zr([ds(e,Jy,2)],s[a]);throw T===1?ft(\\\"flowchart\\\",e,R,\\\"\\\",!0):ft(\\\"flowchart\\\",e,R,`Expecting ${M}, got '${Zf[T]}'`)},l=(M,T=\\\"\\\")=>(r[a]!==M&&c(`'${Zf[M]}'${T?\\\", \\\"+T:\\\"\\\"}`),i[a++]),u=()=>{let M=r[a];M!==74&&M!==37&&M!==76&&c(\\\"'SEMI', 'NEWLINE', 'EOF'\\\"),a++},h=()=>{gl[r[a]]===0&&c(\\\"'NODE_STRING'\\\");let M=i[a++];for(;gl[r[a]]===1;)M+=i[a++];return M},d=()=>{th[r[a]]===0&&c(\\\"'NODE_STRING'\\\");let M=i[a++];for(;th[r[a]]===1;)M+=i[a++];return M},m=()=>{let M=r[a],T;if(M===11)T=\\\"string\\\";else if(M===10)T=\\\"markdown\\\";else if(M===44||M===60||M===51||M===66)T=\\\"text\\\";else return c(`${Zy}, 'TAGEND', 'STR', 'MD_STR'`);let R=i[a++];for(;;){let _=r[a];if(_!==44&&_!==60&&_!==51&&_!==66)break;R+=i[a++]}return{text:R,type:T}},p=M=>{l(M,Zy)},y=()=>{let M=r[a],T;if(M===11)T=\\\"string\\\";else if(M===10)T=\\\"markdown\\\";else if(M===42||M===66)T=\\\"text\\\";else return c(\\\"'EDGE_TEXT', 'STR', 'MD_STR'\\\");let R=i[a++];for(;r[a]===42||r[a]===66;)R+=i[a++];return{text:R,type:T}},E=()=>{let M=r[a],T;if(M===11)T=\\\"text\\\";else if(M===10)T=\\\"markdown\\\";else if(nh[M]===1)T=\\\"text\\\";else return c(\\\"'NODE_STRING', 'STR', 'MD_STR'\\\");let R=i[a++];for(;nh[r[a]]===1;)R+=i[a++];return{text:R,type:T}},b=()=>{let M=i[a++];for(;r[a]===7;)M+=i[a++];return M},S=()=>{let M=h(),T;switch(r[a]){case 71:a++,T=m(),p(70),t.addVertex(M,T,\\\"square\\\");break;case 55:a++,T=m(),p(54),t.addVertex(M,T,\\\"doublecircle\\\");break;case 69:a++,r[a]===69?(a++,T=m(),p(68),l(68),t.addVertex(M,T,\\\"circle\\\")):(T=m(),p(68),t.addVertex(M,T,\\\"round\\\"));break;case 45:a++,T=m(),p(43),t.addVertex(M,T,\\\"ellipse\\\");break;case 47:a++,T=m(),p(46),t.addVertex(M,T,\\\"stadium\\\");break;case 49:a++,T=m(),p(48),t.addVertex(M,T,\\\"subroutine\\\");break;case 50:{a++;let R=l(64);l(35);let _=l(64);l(67),T=m(),p(70),t.addVertex(M,T,\\\"rect\\\",void 0,void 0,void 0,{[R]:_});break}case 53:a++,T=m(),p(52),t.addVertex(M,T,\\\"cylinder\\\");break;case 73:a++,r[a]===73?(a++,T=m(),p(72),l(72),t.addVertex(M,T,\\\"hexagon\\\")):(T=m(),p(72),t.addVertex(M,T,\\\"diamond\\\"));break;case 51:a++,T=m(),p(70),t.addVertex(M,T,\\\"odd\\\");break;case 58:a++,T=m(),r[a]===57?(a++,t.addVertex(M,T,\\\"lean_right\\\")):(p(56),t.addVertex(M,T,\\\"trapezoid\\\"));break;case 59:a++,T=m(),r[a]===56?(a++,t.addVertex(M,T,\\\"lean_left\\\")):(p(57),t.addVertex(M,T,\\\"inv_trapezoid\\\"));break;default:t.addVertex(M)}return M},x=()=>{let M=S();return r[a]===34&&(a++,t.setClass(M,h())),M},I=()=>{let M=[x()];for(o=void 0;;){let T=r[a]===7?b():void 0;if(r[a]!==75)return o=T,M;do a++;while(r[a]===75);if(r[a]!==36)return T!==void 0&&c(\\\"'AMP'\\\"),M;a++,r[a]!==75&&c(\\\"'SPACE'\\\");do a++;while(r[a]===75);let R=x();T!==void 0&&t.addVertex(M[M.length-1],void 0,void 0,void 0,void 0,void 0,void 0,T),M.push(R)}},L=()=>{let M;if(r[a]===31&&(M=i[a++]),r[a]===40){let T=t.destructLink(i[a++]);return M!==void 0&&(T.id=M),r[a]===67&&(a++,T.text=m(),p(67),r[a]===75&&a++),T}if(r[a]===41){let T=i[a++],R=y(),_=l(40,\\\"'EDGE_TEXT'\\\"),$=t.destructLink(_,T);return $.text=R,M!==void 0&&($.id=M),$}return c(\\\"'LINK', 'START_LINK'\\\")},O=M=>{let T=I();o!==void 0&&t.addVertex(T[T.length-1],void 0,void 0,void 0,void 0,void 0,void 0,o);let R=T;for(;;){let _=r[a];if(_!==40&&_!==41&&_!==31)return R;let $=L(),g=I();o!==void 0&&t.addVertex(g[g.length-1],void 0,void 0,void 0,void 0,void 0,void 0,o),t.addLink(T,g,$),M&&(R=g.concat(R)),T=g}},v=()=>{rh[r[a]]===0&&c(\\\"'NODE_STRING', 'NUM', 'COLON', 'BRKT'\\\");let M=i[a++];for(;rh[r[a]]===1;)M+=i[a++];return M},G=()=>{let M=[v()];for(;r[a]===38;)a++,M.push(v());return M},K=()=>{a++,l(75);let M;if(r[a]===13)M=[i[a++]];else for(M=[l(32,\\\"'DEFAULT'\\\")];r[a]===38;)a++,M.push(l(32));if(l(75),r[a]!==15){t.updateLink(M,G());return}a++,l(75);let T=d();if(r[a]===75){a++;let R=G();t.updateLinkInterpolate(M,T),t.updateLink(M,R)}else t.updateLinkInterpolate(M,T)},C=(M,T)=>{if(r[a]!==75){t.setLink(M,T);return}if(a++,r[a]===23){t.setLink(M,T,i[a++]);return}let R=l(11,\\\"'LINK_TARGET'\\\");r[a]===75?(a++,t.setLink(M,T,l(23))):t.setLink(M,T),t.setTooltip(M,R)},Z=()=>{let M=i[a++];switch(r[a]){case 8:{let T=i[a++],R=r[a]===9,_=R?i[a++]:void 0,$;r[a]===75&&(a++,$=l(11)),R?t.setClickEvent(M,T,_):t.setClickEvent(M,T),$!==void 0&&t.setTooltip(M,$);return}case 18:a++,C(M,l(11));return;case 11:C(M,i[a++]);return;default:{let T=d();if(r[a]===75){a++;let R=l(11);t.setClickEvent(M,T),t.setTooltip(M,R)}else t.setClickEvent(M,T)}}},oe=()=>{a++;let M=r[a];if(M===74||M===37||M===76)return a++,{id:void 0,title:void 0,list:[],collect:!1};l(75,\\\"'SEMI', 'NEWLINE', 'EOF'\\\");let T=E(),R=T;return r[a]===71&&(a++,R=m(),p(70)),M=r[a],M!==74&&M!==37&&M!==76&&c(\\\"'SEMI', 'NEWLINE', 'EOF', 'SQS'\\\"),a++,{id:T,title:R,list:[],collect:!1}},H=M=>{let T=r[a];switch(T){case 12:{a++,l(75);let R=h();return l(75),t.addVertex(R,void 0,void 0,G()),u(),pa}case 14:return K(),u(),pa;case 16:{a++,l(75);let R=h();return l(75),t.addClass(R,G()),u(),pa}case 17:{a++,l(75);let R=h();return l(75),t.setClass(R,h()),u(),pa}case 19:return Z(),u(),pa;case 26:case 27:case 28:case 29:case 30:return a++,{stmt:\\\"dir\\\",value:pC[T-26]};case 2:{a++;let R=l(3).trim();return t.setAccTitle(R),R}case 4:{a++;let R=l(5).trim();return t.setAccDescription(R),R}case 6:{let R=i[a++].trim();return t.setAccDescription(R),R}default:{gl[T]===0&&c(eE);let R=O(M);return u(),R}}},z=()=>{let M=[],T=[],R=!1;for(;;){let _=r[a];if(_===0)break;if(_===22){let $=M.pop();if($===void 0)break;a++;let g=t.addSubGraph($.id,T,$.title);T=$.list,R=$.collect,R&&T.push(g)}else if(_===37||_===74||_===75||_===76)R&&T.push(i[a]),a++;else if(_===21){let $=oe();$.list=T,$.collect=R,M.push($),T=[],R=!0}else{let $=H(R);R&&(!Array.isArray($)||$.length>0)&&T.push($)}}M.length>0&&c(\\\"'end'\\\")};for(;r[a]===75||r[a]===74;)a++;if(l(20,\\\"'SPACE', 'NEWLINE'\\\"),r[a]===24)a++,t.setDirection(\\\"TB\\\");else{let M=l(25,\\\"'NODIR'\\\"),T=r[a];if(T===75){do a++;while(r[a]===75);T=r[a],T!==74&&c(\\\"'NEWLINE', 'SPACE'\\\")}else T!==37&&T!==74&&c(\\\"'SEMI', 'NEWLINE', 'SPACE'\\\");a++,t.setDirection(M)}z(),r[a]!==0&&c(eE)}var pC=[\\\"TB\\\",\\\"BT\\\",\\\"RL\\\",\\\"LR\\\",\\\"TD\\\"],eE=\\\"'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'subgraph', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'\\\";function mC(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 gC(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 nE(e,t){let n=[],r=[],i=e.subgraphs,s=x=>{let I=[];for(let L of x){let O=e.classes.get(L);if(O!==void 0){for(let v of O.styles)I.push(v.trim());for(let v of O.textStyles)I.push(v.trim())}}return I},a=new Map;for(let x of i)for(let I of x.nodes)e.subgraph(I)&&a.set(I,x.id);let o=new Map,c=new Map;for(let x of i){let I=a.get(x.id);if(I===void 0)continue;let L=c.get(I);L?L.push(x.id):c.set(I,[x.id])}let l=0;for(let x of i){if(a.has(x.id))continue;let I=[x.id];for(;I.length>0;){let L=I.pop();if(o.has(L))continue;o.set(L,l++);let O=c.get(L);if(O)for(let v=O.length-1;v>=0;v--)I.push(O[v])}}let u=x=>e.subgraph(x)?.metadata?.view===\\\"collapsed\\\",h=!1;for(let x of i)x.metadata?.view===\\\"collapsed\\\"&&(h=!0);let d=new Map,m=x=>{let I=[],L=new Set,O=x;for(;O!==void 0&&!d.has(O)&&!L.has(O);)L.add(O),I.push(O),O=a.get(O);let v=O!==void 0?d.get(O):void 0;for(let G=I.length-1;G>=0;G--)v===void 0&&u(I[G])&&(v=I[G]),d.set(I[G],v);return v},p=new Set,y=new Map;for(let x of h?i:[]){let I=m(x.id);if(I!==void 0){x.id!==I&&(p.add(x.id),y.set(x.id,I));for(let L of x.nodes)L!==I&&(p.add(L),y.set(L,I))}}let E=new Map,b=new Set;for(let x=i.length-1;x>=0;x--){let I=i[x];if(!p.has(I.id)){I.nodes.length>0&&b.add(I.id);for(let L of I.nodes)E.set(L,I.id)}}let S=new Map;for(let x=i.length-1;x>=0;x--){let I=i[x];if(p.has(I.id))continue;let L=I.metadata?.view===\\\"collapsed\\\",O={id:I.id,label:I.title,labelType:I.labelType,parentId:E.get(I.id),cssStyles:[],cssCompiledStyles:s(I.classes),cssClasses:I.classes.join(\\\" \\\"),shape:L?\\\"collapsedGroup\\\":\\\"rect\\\",dir:I.dir,isGroup:!L,colorIndex:o.get(I.id)};L||(O.metadata=I.metadata),n.push(O),S.set(I.id,O)}for(let x of e.nodes.values()){if(p.has(x.id))continue;let I=S.get(x.id);if(I){I.cssStyles=x.styles,I.cssCompiledStyles=s(x.classes),I.cssClasses=x.classes.join(\\\" \\\");continue}let L=b.has(x.id),O={id:x.id,label:x.text,labelType:x.labelType,parentId:E.get(x.id),cssStyles:x.styles,cssCompiledStyles:s([\\\"default\\\",\\\"node\\\",...x.classes]),cssClasses:\\\"default \\\"+x.classes.join(\\\" \\\"),dir:x.dir,link:x.link,linkTarget:x.linkTarget,tooltip:e.tooltips.get(x.id),icon:x.icon,pos:x.pos,img:x.img,assetWidth:x.assetWidth,assetHeight:x.assetHeight,constraint:x.constraint,isGroup:L,shape:L?\\\"rect\\\":mC(x)};n.push(O)}return e.edges.forEach((x,I)=>{let L=y.get(x.start)??x.start,O=y.get(x.end)??x.end;if(L===O&&(y.has(x.start)||y.has(x.end)))return;let[v,G]=gC(x.type),K=[...e.defaultEdgeStyle??[]];x.style&&K.push(...x.style);let C=x.stroke===\\\"invisible\\\"||x.type===\\\"arrow_open\\\";r.push({id:x.id||`L_${L}_${O}_${I}`,isUserDefinedId:x.isUserDefinedId,start:L,end:O,type:x.type??\\\"normal\\\",label:x.text,labelType:x.labelType,thickness:x.stroke,pattern:x.stroke,minlen:x.length,classes:x.stroke===\\\"invisible\\\"?\\\"\\\":\\\"edge-thickness-normal edge-pattern-solid flowchart-link\\\",arrowTypeStart:C?\\\"none\\\":v,arrowTypeEnd:C?\\\"none\\\":G,cssCompiledStyles:s(x.classes),style:K,animate:x.animate,animation:x.animation,curve:x.interpolate||e.defaultInterpolate||t})}),{nodes:n,edges:r}}var bC=40,yC=16,EC=48,rE=20,sh=26,ih=' fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"',xC=' stroke=\\\"var(--_b)\\\"';function oh(e,t,n){let r=e[t];return typeof r==\\\"number\\\"&&r>0?Math.min(r,2e3):n}function ma(e,t){return e!==void 0&&e>0&&e\u003C=4e3?e:t}function bl(e,t,n,r){let i=s=>An(n,a=>AC(e,t,n,r,s,a));return Pn(e.direction)?Pt(n,i):i(!1)}function AC(e,t,n,r,i,s){let a=s?12:rE,o=r?t[r.type]:void 0,c=typeof o==\\\"object\\\"&&o!==null&&!Array.isArray(o)?o:t.flowchart??{},l=nE(e,typeof c.curve==\\\"string\\\"?c.curve:void 0);r?.prepare(l);let u=n.fontSize??16,h=Math.round(u*.875),d=n.measurer??ct(n.fontFamily,n.fontFamilyMono),m=Math.min(oh(c,\\\"wrappingWidth\\\",200),r&&s?100:1/0),p=n.padding??8,y=n.icons,E=new Map,b=[],S=[];l.nodes.forEach((Q,Y)=>E.set(Q.id,Y));for(let Q of l.nodes){let Y=Ct(Q.cssStyles.length>0?Q.cssCompiledStyles.concat(Q.cssStyles):Q.cssCompiledStyles),ne=(Y.bold?1:0)|(Y.italic?2:0),q=Q.labelType===\\\"markdown\\\",k=Y.fontSize??u,J,te;if(Q.isGroup){let se=Ge(Q.label,q,d,k,r&&s?Math.max(80,kt(n)/2):4e3,ne);J={node:Q,style:Y,label:se,shape:\\\"group\\\",w:0,h:0,dy:0,loops:0},te=Bt(0,0),te.isGroup=!0,te.dir=Q.dir?ln(Q.dir):void 0,te.padX=a,te.padTop=se.height>0?se.height+16:rE,te.padBottom=a,te.minW=se.width+2*a-12}else{let se=uc(Q.shape),re=Q.img||Q.icon||Lg(se)?Q.label:void 0,P=Ge(re,q,d,k,m,ne),ee,ae,ue=0;if(Q.img||Q.icon){let ce=Q.img?80:48,pe=ma(Q.assetWidth,ce),V=ma(Q.assetHeight,ce);ee=Math.max(pe,P.width+8),ae=V+(P.height>0?P.height+6:0),ue=Q.pos===\\\"t\\\"?-V/2:V/2,P.height===0&&(ue=0)}else{let ce=ps(se,P.width,P.height);ee=ce.w,ae=ce.h,ue=ce.dy}J={node:Q,style:Y,label:P,shape:se,w:ee,h:ae,dy:ue,loops:0},te=Bt(ee,ae)}te.seq=b.length,b.push(J),S.push(te)}l.nodes.forEach((Q,Y)=>{S[Y].parent=Q.parentId!==void 0?E.get(Q.parentId)??-1:-1}),xc(S,l.edges.map(Q=>[E.get(Q.start)??-1,E.get(Q.end)??-1]));let x=i?\\\"TB\\\":ln(e.direction),I=Q=>{let Y;for(let ne=S[Q].parent,q=0;ne>=0&&Y===void 0&&q\u003C1e4;ne=S[ne].parent,q++)Y=S[ne].dir;return Y??=x,Y===\\\"LR\\\"||Y===\\\"RL\\\"};b.forEach((Q,Y)=>{Q.node.isGroup?S[Y].span=1/0:!Q.node.img&&!Q.node.icon&&(S[Y].span=$g(Q.shape,Q.w,Q.h,I(Y)))});let L=[],O=[],v=[];for(let Q of l.edges){let Y=E.get(Q.start),ne=E.get(Q.end);if(Y===void 0||ne===void 0)continue;let q=Ge(Q.label,Q.labelType===\\\"markdown\\\",d,h,m);Y===ne&&(b[Y].loops++,I(Y)?S[Y].h+=2*(sh+(q.height>0?q.height+8:0)):S[Y].w+=2*(sh+(q.width>0?q.width+12:0))),v.push(Q),O.push(q),L.push({src:Y,dst:ne,minlen:Q.minlen??1,labelW:q.width>0?q.width+12:0,labelH:q.height>0?q.height+4:0,route:[],labelX:0,labelY:0})}let G={nodeSep:oh(c,\\\"nodeSpacing\\\",bC)*(s?.5:1),edgeSep:yC,rankSep:oh(c,\\\"rankSpacing\\\",EC)*(s?.75:1),portSep:20,tracks:typeof c.curve==\\\"string\\\"&&/^step/.test(c.curve),straight:c.curve===\\\"linear\\\",headRoom:Rt(\\\"arrow_point\\\")},K=r?r.layout(S,L,x,G,s):On(S,L,x,G),C=yn(e.title,d,u,s?kt(n):4e3),Z=C.height>0?C.height+12:0,oe=Math.max(K.width,C.width),H=p+(oe-K.width)/2,z=p+Z;Tr(S,L,H,z);let M=Math.ceil(oe+2*p),T=Math.ceil(K.height+Z+2*p),R=[],_=new Map,$=!1;for(let Q of S)Q.isGroup&&($=!0);if($)for(let Q of L)ur(_,Q.route);let g=\\\"\\\",N=\\\"\\\",w=\\\"\\\",A=[];for(let Q=0;Q\u003Cb.length;Q++){let Y=b[Q],ne=S[Q],q=Y.node,k=ne.x,J=ne.y,te=It(q.cssClasses.replace(/^default\\\\s?/,\\\"\\\")),se=Ue(q.id);if(ne.isGroup&&r?.drawGroup&&ne.parent\u003C0){Mn(Y.style.shape)&&r.filledBox&&A.push({box:r.filledBox(ne,x),shape:Y.style.shape}),g+=r.drawGroup(ne,Y.label,Y.style,te,se,x,y);continue}if(ne.isGroup){Mn(Y.style.shape)&&A.push({box:[k-ne.w/2,J-ne.h/2,k+ne.w/2,J+ne.h/2],shape:Y.style.shape});let V=hs(ne,Y.label.width,_,a),X=J-ne.h/2+8+Y.label.height/2,le=Ac(ne,Y.label.width,V,_),de=` class=\\\"pele-cluster-label\\\"${le?' fill=\\\"var(--_m)\\\"':vt(Y.style,\\\"var(--_m)\\\")}${Y.style.text}`;le&&(N+=Sc(Y.label,V,X,de,se,S,Q,y)),g+=`\u003Cg class=\\\"pele-cluster${te}\\\" data-id=\\\"${se}\\\">\u003Crect x=\\\"${f(k-ne.w/2)}\\\" y=\\\"${f(J-ne.h/2)}\\\" width=\\\"${f(ne.w)}\\\" height=\\\"${f(ne.h)}\\\" fill=\\\"var(--_a)\\\"${vn(Y.style.shape)?\\\"\\\":' fill-opacity=\\\"0.5\\\"'} stroke=\\\"var(--_b)\\\"${At(Y.style.shape)}/>`+(le?\\\"\\\":Ne(Y.label,V,X,de,y))+\\\"\u003C/g>\\\";continue}let re=Y.w,P=Y.h,ee,ae=\\\"\\\";if(q.img){let V=ma(q.assetWidth,80),X=ma(q.assetHeight,80),le=Y.label.height>0?q.pos===\\\"t\\\"?P/2-X:-P/2:-X/2,de=qm(Qn(q.img),n);ee=de===void 0?\\\"\\\":`\u003Cimage href=\\\"${rt(de)}\\\" x=\\\"${f(-V/2)}\\\" y=\\\"${f(le)}\\\" width=\\\"${f(V)}\\\" height=\\\"${f(X)}\\\" preserveAspectRatio=\\\"${q.constraint===\\\"on\\\"?\\\"xMidYMid meet\\\":\\\"none\\\"}\\\"/>`}else if(q.icon){let V=ma(q.assetHeight,48),X=Y.label.height>0?q.pos===\\\"t\\\"?P/2-V:-P/2:-V/2,le=q.shape===\\\"icon\\\"?\\\"\\\":q.shape===\\\"iconCircle\\\"?`\u003Ccircle cy=\\\"${f(X+V/2)}\\\" r=\\\"${f(V/2)}\\\"${ih}${Y.style.shape}/>`:`\u003Crect x=\\\"${f(-V/2)}\\\" y=\\\"${f(X)}\\\" width=\\\"${f(V)}\\\" height=\\\"${f(V)}\\\" rx=\\\"${q.shape===\\\"iconRounded\\\"?8:0}\\\"${ih}${Y.style.shape}/>`,de=V*.6;ee=le+`\u003Csvg class=\\\"pele-icon\\\" data-icon=\\\"${Ue(q.icon)}\\\" x=\\\"${f(-de/2)}\\\" y=\\\"${f(X+(V-de)/2)}\\\" width=\\\"${f(de)}\\\" height=\\\"${f(de)}\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\">${y?.(q.icon)??\\\"\\\"}\u003C/svg>`}else ee=hr(Y.shape,re,P,ih+Y.style.shape,xC+Y.style.line),Gi(Y.shape)&&(ae=vt(Y.style));let ue=Ne(Y.label,0,Y.dy,` class=\\\"pele-label\\\"${ae}${Y.style.text}`,y);if(/ internal-link(?: |$)/.test(te+\\\" \\\")&&q.label&&n.links!==!1){let V=bt(q.label),X=$i(V,n),le=rt(V);ue=`\u003Ca class=\\\"internal-link\\\"${X?` href=\\\"${le}\\\"${qr(n)}`:\\\"\\\"} data-href=\\\"${le}\\\">${ue}\u003C/a>`,R.push({id:q.id,href:V,internal:!0})}let pe=ee+ue;q.tooltip&&(pe=`\u003Ctitle>${Ue(q.tooltip)}\u003C/title>`+pe),q.link&&(pe=Zn(pe,q.link,q.id,R,n,q.linkTarget?` target=\\\"${rt(q.linkTarget)}\\\"`:\\\"\\\")),w+=`\u003Cg class=\\\"pele-node pele-shape-${Y.shape}${te}\\\" data-id=\\\"${se}\\\" transform=\\\"translate(${f(k)},${f(J)})\\\">${pe}\u003C/g>`}let D=_c();for(let Q=0;Q\u003CL.length;Q++){let Y=L[Q];Y.src===Y.dst||v[Q].thickness===\\\"invisible\\\"||Y.route.length\u003C6||(D.add(Y.src,Jn(Y.route,0,S[Y.src]),v[Q].arrowTypeStart),D.add(Y.dst,Jn(Y.route,Y.route.length-3,S[Y.dst]),v[Q].arrowTypeEnd))}let U=\\\"\\\",B=\\\"\\\",F=\\\"\\\",W=new Map;for(let Q=0;Q\u003CL.length;Q++){let Y=L[Q],ne=v[Q],q=O[Q],k=ne.style.length>0||ne.cssCompiledStyles.length>0?Ct(ne.cssCompiledStyles.concat(ne.style)):void 0;if(ne.thickness!==\\\"invisible\\\"){let J=ne.arrowTypeStart,te=ne.arrowTypeEnd,se;if(Y.src===Y.dst){let ue=b[Y.src],ce=W.get(Y.src)??0;W.set(Y.src,ce+1),se=Rc(S[Y.src],ue.w,ue.h,ce,I(Y.src),sh,Rt(te),Y)}else{let ue=Y.route.slice(),ce=D.of(Y.src,Jn(ue,0,S[Y.src])),pe=D.of(Y.dst,Jn(ue,ue.length-3,S[Y.dst]));js(ue,0,b[Y.src],S[Y.src]),js(ue,ue.length-3,b[Y.dst],S[Y.dst]),se=Cn(ue,ne.curve,Rt(J),Rt(te),ce,pe)}let re=Mr(se.d,[se.sx,se.sy,se.ex,se.ey],A,k?.line,se.tokens),P=re||(k?.stroke&&ne.thickness!==\\\"invisible\\\"?rt(k.stroke):\\\"var(--_l)\\\"),ee=\\\"\\\";ne.thickness===\\\"thick\\\"?ee+=' stroke-width=\\\"2.5\\\"':ne.thickness===\\\"dotted\\\"&&(ee+=' stroke-dasharray=\\\"3 4\\\"');let ae=It(ne.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,\\\"\\\"));re===\\\"\\\"&&(U+=Cr(se,J,te,k?.line,ne.thickness===\\\"thick\\\")),B+=`\u003Cg class=\\\"pele-edge${ae}\\\" data-id=\\\"${Ue(ne.id)}\\\"${re?` stroke=\\\"${re}\\\"`:\\\"\\\"}${k?.line??\\\"\\\"}>\u003Cpath d=\\\"${se.d}\\\"${ee}/>`+_t(J,se.sx,se.sy,se.sdx,se.sdy,P)+_t(te,se.ex,se.ey,se.edx,se.edy,P)+\\\"\u003C/g>\\\"}if(q.width>0){let J=Y.labelX,te=Y.labelY;F+=dn(ne.id,q,J,te,k?.text??\\\"\\\",y)}}return{svg:at(r?.type??\\\"flowchart\\\",M,T,u,n,e,Ne(C,M/2,p+C.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(g?`\u003Cg class=\\\"pele-clusters\\\">${g}\u003C/g>`:\\\"\\\")+Dn(U)+(B?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${B}\u003C/g>`:\\\"\\\")+(N?`\u003Cg class=\\\"pele-cluster-titles\\\">${N}\u003C/g>`:\\\"\\\")+(F?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${h}\\\">${F}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${w}\u003C/g>`),width:M,height:T,links:R}}var yl={type:\\\"flowchart\\\",math:!0,parse(e,t,n,r,i){let s=t.flowchart??{},a=new ml({inheritDir:s.inheritDir===!0,maxEdges:i.maxEdges});return n&&(a.title=n),tE(e,a),a},render:bl};var si=[\\\"January\\\",\\\"February\\\",\\\"March\\\",\\\"April\\\",\\\"May\\\",\\\"June\\\",\\\"July\\\",\\\"August\\\",\\\"September\\\",\\\"October\\\",\\\"November\\\",\\\"December\\\"],Jr=[\\\"Sunday\\\",\\\"Monday\\\",\\\"Tuesday\\\",\\\"Wednesday\\\",\\\"Thursday\\\",\\\"Friday\\\",\\\"Saturday\\\"];function eo(e){return!Number.isNaN(e.getTime())}function Kn(e,t){let n=String(e);return n.length>=t?n:\\\"0\\\".repeat(t-n.length)+n}function fE(e){let t=[\\\"th\\\",\\\"st\\\",\\\"nd\\\",\\\"rd\\\"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function ah(e){let t=-Math.round(e.getTimezoneOffset()/15)*15;return t===0?0:t}function sE(e){let t=ah(e),n=Math.abs(t);return(t>=0?\\\"+\\\":\\\"-\\\")+Kn(Math.floor(n/60),2)+\\\":\\\"+Kn(n%60,2)}function hE(e){return e.getDay()||7}function Pr(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function SC(e){let t=new Date(e.getFullYear(),e.getMonth()+1,0);return t.setHours(23,59,59,999),t.getDate()}function iE(e,t){let n=new Date(e);return n.setDate(1),t(n),n.setDate(Math.min(e.getDate(),SC(n))),n}function xl(e,t,n){switch(n){case\\\"M\\\":return iE(e,r=>r.setMonth(e.getMonth()+t));case\\\"y\\\":return iE(e,r=>r.setFullYear(e.getFullYear()+t));case\\\"d\\\":return Pr(e,Math.round(t));case\\\"w\\\":return Pr(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 pE(e){return Pr(e,4-hE(e))}function oE(e){let t=pE(e),n=new Date(t.getFullYear(),0,1),r=hE(n),i=Pr(n,4-r+(r>4?7:0)),s=(ah(i)-ah(t))*6e4,a=(t.getTime()-i.getTime()-s)/6048e5;return(a\u003C0?Math.ceil(a)||0:Math.floor(a))+1}var wC=/\\\\[([^\\\\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,_C=/\\\\[([^\\\\]]+)]|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,RC=\\\"YYYY-MM-DDTHH:mm:ssZ\\\";function ch(e,t){if(!eo(e))return\\\"Invalid Date\\\";let n=t||RC;if(n===\\\"YYYY-MM-DD\\\")return lh(e);let r=!1,i=n.replace(wC,a=>{switch(a){case\\\"Q\\\":return String(Math.ceil((e.getMonth()+1)/3));case\\\"Do\\\":return\\\"[\\\"+fE(e.getDate())+\\\"]\\\";case\\\"GGGG\\\":return String(pE(e).getFullYear());case\\\"W\\\":return String(oE(e));case\\\"WW\\\":return Kn(oE(e),2);case\\\"k\\\":return String(e.getHours()||24);case\\\"kk\\\":return Kn(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,a;default:return a}});if(r)return;let s=e.getHours();return i.replace(_C,(a,o)=>{if(o)return o;switch(a){case\\\"YY\\\":return String(e.getFullYear()).slice(-2);case\\\"YYYY\\\":return Kn(e.getFullYear(),4);case\\\"M\\\":return String(e.getMonth()+1);case\\\"MM\\\":return Kn(e.getMonth()+1,2);case\\\"MMM\\\":return si[e.getMonth()].slice(0,3);case\\\"MMMM\\\":return si[e.getMonth()];case\\\"D\\\":return String(e.getDate());case\\\"DD\\\":return Kn(e.getDate(),2);case\\\"d\\\":return String(e.getDay());case\\\"dd\\\":return Jr[e.getDay()].slice(0,2);case\\\"ddd\\\":return Jr[e.getDay()].slice(0,3);case\\\"dddd\\\":return Jr[e.getDay()];case\\\"H\\\":return String(s);case\\\"HH\\\":return Kn(s,2);case\\\"h\\\":return String(s%12||12);case\\\"hh\\\":return Kn(s%12||12,2);case\\\"a\\\":return s\u003C12?\\\"am\\\":\\\"pm\\\";case\\\"A\\\":return s\u003C12?\\\"AM\\\":\\\"PM\\\";case\\\"m\\\":return String(e.getMinutes());case\\\"mm\\\":return Kn(e.getMinutes(),2);case\\\"s\\\":return String(e.getSeconds());case\\\"ss\\\":return Kn(e.getSeconds(),2);case\\\"SSS\\\":return Kn(e.getMilliseconds(),3);case\\\"Z\\\":return sE(e);default:return sE(e).replace(\\\":\\\",\\\"\\\")}})}function lh(e){let t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();return(t>=1e3&&t\u003C=9999?t:Kn(t,4))+(n\u003C10?\\\"-0\\\":\\\"-\\\")+n+(r\u003C10?\\\"-0\\\":\\\"-\\\")+r}var TC=/(\\\\[[^[]*\\\\])|([-_:/.,()\\\\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,MC=/\\\\[[^\\\\]]+]/g,aE=/\\\\d/,ga=/\\\\d\\\\d/,CC=/\\\\d{3}/,NC=/\\\\d{4}/,gr=/\\\\d\\\\d?/,IC=/[+-]?\\\\d+/,cE=/[+-]\\\\d\\\\d:?(\\\\d\\\\d)?|Z/,ba=/\\\\d*[^-_:/,()\\\\s\\\\d]+/;function _n(e){return(t,n)=>(t[e]=+n,!0)}var lE=(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 dE(e){return(t,n)=>{let r=e.indexOf(n)+1;return r\u003C1?!1:(t.month=r%12||r,!0)}}var kC=new Map([[\\\"A\\\",{re:ba,read:(e,t)=>(e.afternoon=t===\\\"PM\\\",!0)}],[\\\"a\\\",{re:ba,read:(e,t)=>(e.afternoon=t===\\\"pm\\\",!0)}],[\\\"Q\\\",{re:aE,read:(e,t)=>(e.month=(+t-1)*3+1,!0)}],[\\\"S\\\",{re:aE,read:(e,t)=>(e.milliseconds=+t*100,!0)}],[\\\"SS\\\",{re:ga,read:(e,t)=>(e.milliseconds=+t*10,!0)}],[\\\"SSS\\\",{re:CC,read:(e,t)=>(e.milliseconds=+t,!0)}],[\\\"s\\\",{re:gr,read:_n(\\\"seconds\\\")}],[\\\"ss\\\",{re:gr,read:_n(\\\"seconds\\\")}],[\\\"m\\\",{re:gr,read:_n(\\\"minutes\\\")}],[\\\"mm\\\",{re:gr,read:_n(\\\"minutes\\\")}],[\\\"H\\\",{re:gr,read:_n(\\\"hours\\\")}],[\\\"h\\\",{re:gr,read:_n(\\\"hours\\\")}],[\\\"HH\\\",{re:gr,read:_n(\\\"hours\\\")}],[\\\"hh\\\",{re:gr,read:_n(\\\"hours\\\")}],[\\\"D\\\",{re:gr,read:_n(\\\"day\\\")}],[\\\"DD\\\",{re:ga,read:_n(\\\"day\\\")}],[\\\"Do\\\",{re:ba,read:(e,t)=>{let n=t.match(/\\\\d+/);if(!n)return!1;e.day=+n[0],e.dayGiven=!0;for(let r=1;r\u003C=31;r++)fE(r)===t&&(e.day=r);return!0}}],[\\\"w\\\",{re:gr,read:_n(\\\"week\\\")}],[\\\"ww\\\",{re:ga,read:_n(\\\"week\\\")}],[\\\"M\\\",{re:gr,read:_n(\\\"month\\\")}],[\\\"MM\\\",{re:ga,read:_n(\\\"month\\\")}],[\\\"MMM\\\",{re:ba,read:dE(si.map(e=>e.slice(0,3)))}],[\\\"MMMM\\\",{re:ba,read:dE(si)}],[\\\"Y\\\",{re:IC,read:_n(\\\"year\\\")}],[\\\"YY\\\",{re:ga,read:(e,t)=>(e.year=+t+(+t>68?1900:2e3),!0)}],[\\\"YYYY\\\",{re:NC,read:_n(\\\"year\\\")}],[\\\"Z\\\",{re:cE,read:lE}],[\\\"ZZ\\\",{re:cE,read:lE}]]),uE,El=null;function $C(e){if(e===uE)return El;if(uE=e,El=null,/[Ll]/.test(e.replace(MC,\\\"\\\")))return null;let t=e.match(TC);return t?(El=t.map(n=>kC.get(n)??n.replace(/^\\\\[|\\\\]$/g,\\\"\\\")),El):null}function LC(e,t,n){if(t===\\\"x\\\"||t===\\\"X\\\")return new Date((t===\\\"X\\\"?1e3:1)*Number(e));let r=$C(t);if(!r)return;let i={},s=e,a=0;for(let p of r){if(typeof p==\\\"string\\\"){a+=p.length;continue}let y=p.re.exec(s.slice(a));if(!y||!p.read(i,y[0]))return;s=s.replace(y[0],\\\"\\\")}i.afternoon!==void 0&&i.hours!==void 0&&(i.afternoon?i.hours\u003C12&&(i.hours+=12):i.hours===12&&(i.hours=0));let o=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,h=i.minutes||0,d=i.seconds||0,m=i.milliseconds||0;if(i.offset!==void 0)return new Date(Date.UTC(c,l,o,u,h,d,m+i.offset*6e4));if(!i.week)return new Date(c,l,o,u,h,d,m)}function mE(e,t,n){let r=LC(e,t,n);return r&&eo(r)&&ch(r,t)===e?r:void 0}var OC=/^[YMDHhmsSZXx\\\\-/.:, T]*$/,DC=/^\\\\s*(active|done|crit|milestone|vert)\\\\s*$/,vC=/^after\\\\s+([\\\\d\\\\w- ]+)/,PC=/^until\\\\s+([\\\\d\\\\w- ]+)/,FC=/^(\\\\d+(?:\\\\.\\\\d+)?)([Mdhmswy]|ms)$/,BC=/[\\\\s,]+/,WC=/^\\\\d+$/,UC=new Set(Jr.map(e=>e.toLowerCase())),GC=4e8,YC=400,HC=200,KC=400;function dh(e){let t=e===void 0?NaN:+e;return Number.isFinite(t)?t:Date.now()}function zC(e){let t=FC.exec(e.trim());return t?[Number.parseFloat(t[1]),t[2]]:[NaN,\\\"ms\\\"]}function gE(e,t){let n=new Set(e);for(let r of t.toLowerCase().split(BC))r!==\\\"\\\"&&n.add(r);return[...n]}var Al=class{constructor(t={}){fe(this,\\\"type\\\",\\\"gantt\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"dateFormat\\\",\\\"\\\");fe(this,\\\"axisFormat\\\",\\\"\\\");fe(this,\\\"tickInterval\\\");fe(this,\\\"todayMarker\\\",\\\"\\\");fe(this,\\\"includes\\\",[]);fe(this,\\\"excludes\\\",[]);fe(this,\\\"inclusiveEndDates\\\",!1);fe(this,\\\"topAxis\\\",!1);fe(this,\\\"displayMode\\\",\\\"\\\");fe(this,\\\"weekday\\\");fe(this,\\\"weekend\\\",\\\"saturday\\\");fe(this,\\\"sections\\\",[]);fe(this,\\\"links\\\",new Map);fe(this,\\\"tasks\\\",[]);fe(this,\\\"byId\\\",new Map);fe(this,\\\"currentSection\\\",\\\"\\\");fe(this,\\\"taskCount\\\",0);fe(this,\\\"lastOrder\\\",0);fe(this,\\\"lastTaskId\\\");fe(this,\\\"options\\\");fe(this,\\\"now\\\",0);fe(this,\\\"work\\\",0);fe(this,\\\"includeSet\\\",new Set);fe(this,\\\"excludeSet\\\",new Set);fe(this,\\\"excludedDays\\\",[]);fe(this,\\\"datedTokens\\\",!1);this.options=t}setDateFormat(t){this.dateFormat=t}enableInclusiveEndDates(){this.inclusiveEndDates=!0}TopAxis(){this.topAxis=!0}setAxisFormat(t){this.axisFormat=t}setTickInterval(t){this.tickInterval=t}setTodayMarker(t){this.todayMarker=t}setIncludes(t){this.includes=gE(this.includes,t)}setExcludes(t){this.excludes=gE(this.excludes,t)}setWeekday(t){this.weekday=t}setWeekend(t){this.weekend=t}setDiagramTitle(t){this.title=t}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}addSection(t){this.currentSection=t,this.sections.push(t)}addTask(t,n){let r=(n.startsWith(\\\":\\\")?n.slice(1):n).split(\\\",\\\"),i={id:\\\"\\\",task:t,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:n,start:void 0,end:\\\"\\\"}},s;for(;r.length>0&&(s=DC.exec(r[0]))!==null;)i[s[1]]=!0,r.shift();if(r.length===0)throw new Qe(`Task \\\"${t.trim()}\\\" needs a duration or an end date.`,\\\"semantic\\\",{type:\\\"gantt\\\"});if(r.length>3)throw new Qe(`Task \\\"${t.trim()}\\\" has too many fields. A task takes an id, a start, and an end or duration.`,\\\"semantic\\\",{type:\\\"gantt\\\"});for(let a=0;a\u003Cr.length;a++)r[a]=r[a].trim();r.length===3?i.id=r[0]:(this.taskCount++,i.id=\\\"task\\\"+this.taskCount),r.length>1&&(i.raw.start=r[r.length-2]),i.raw.end=r[r.length-1],i.vert||(i.order=this.lastOrder++),this.tasks.push(i),this.lastTaskId=i.id,this.byId.set(i.id,i)}setLink(t,n){let r=Qn(n);for(let i of t.split(\\\",\\\"))this.byId.has(i)&&this.links.set(i,r);this.setClass(t,\\\"clickable\\\")}setClickEvent(t,n,r){this.setClass(t,\\\"clickable\\\")}setClass(t,n){for(let r of t.split(\\\",\\\"))this.byId.get(r)?.classes.push(n)}getTasks(t){this.now=dh(t),this.work=0,this.includeSet=new Set(this.includes),this.excludeSet=new Set(this.excludes);let n=this.weekend===\\\"friday\\\"?5:this.weekend===\\\"saturday\\\"?6:NaN,r=this.excludeSet.has(\\\"weekends\\\");this.excludedDays=Jr.map((s,a)=>{let o=a||7;return r&&(o===n||o===n+1)||this.excludeSet.has(s.toLowerCase())}),this.datedTokens=this.includes.length>0||!OC.test(this.dateFormat.trim());for(let s of this.excludes)s!==\\\"weekends\\\"&&!UC.has(s)&&(this.datedTokens=!0);for(let s of this.tasks)s.startTime=s.endTime=void 0,s.renderEndTime=null,s.processed=s.manualEndTime=!1;let i=this.compileTasks();for(let s=0;!i&&s\u003C10;s++)i=this.compileTasks();return this.tasks}isInvalidDate(t){let n=this.excludedDays[t.getDay()];if(!this.datedTokens)return n;let r=this.dateFormat.trim(),i=lh(t),s=i;this.spend(HC),r!==\\\"YYYY-MM-DD\\\"&&(this.spend(KC+r.length*8),s=ch(t,r));let a=o=>o.has(i)||s!==void 0&&o.has(s);return a(this.includeSet)?!1:n||a(this.excludeSet)}spend(t){if(this.work+=t,this.work>GC)throw new Qe(\\\"The gantt chart takes too much work to schedule.\\\",\\\"limit\\\",{type:\\\"gantt\\\"})}parse(t,n){return this.spend((n.length+1)*(t.length+1)),mE(t,n,new Date(this.now))}today(){let t=new Date(this.now);return t.setHours(0,0,0,0),t}warn(t){this.options.warn&&this.options.warn(t())}compileTasks(){let t=!0;for(let n of this.tasks)this.compileTask(n),t=t&&n.processed;return t}compileTask(t){let n=t.raw.start;if(n===void 0){let r=t.prevTaskId===void 0?void 0:this.byId.get(t.prevTaskId);t.startTime=r?r.endTime:this.today()}else{let r=this.getStartDate(n);r&&(t.startTime=r)}t.startTime&&(t.endTime=this.getEndDate(t.startTime,t.raw.end),t.endTime&&(t.processed=!0,t.manualEndTime=this.parse(t.raw.end,\\\"YYYY-MM-DD\\\")!==void 0,this.checkTaskDates(t)))}references(t,n){let r=[],i;for(let s of n.split(\\\" \\\")){if(s===\\\"\\\")continue;let a=this.byId.get(s);a?r.push(a):(i??=[]).push(s)}if(i){let s=i;this.warn(()=>`Gantt: \\\"${t}\\\" refers to task ids that do not exist: ${s.join(\\\", \\\")}.`)}return r}getStartDate(t){let n=t.trim(),r=this.dateFormat.trim();if((r===\\\"x\\\"||r===\\\"X\\\")&&WC.test(n))return this.checked(new Date(Number(n)),n);let i=vC.exec(n);if(i!==null){let o=this.references(\\\"after\\\",i[1]),c;for(let l of o)(!c||l.endTime>c.endTime)&&(c=l);return c?c.endTime:this.today()}let s=this.parse(n,r);if(s)return s;let a=new Date(n);if(!eo(a)||a.getFullYear()\u003C-1e4||a.getFullYear()>1e4)throw new Qe(\\\"Invalid date:\\\"+n,\\\"semantic\\\",{type:\\\"gantt\\\"});return a}checked(t,n){if(!eo(t))throw new Qe(\\\"Invalid date:\\\"+n,\\\"semantic\\\",{type:\\\"gantt\\\"});return t}getEndDate(t,n){let r=n.trim(),i=PC.exec(r);if(i!==null){let u=this.references(\\\"until\\\",i[1]),h;for(let d of u)(!h||d.startTime\u003Ch.startTime)&&(h=d);return h?h.startTime:this.today()}let s=this.dateFormat.trim(),a=this.parse(r,s);if(a)return this.inclusiveEndDates?Pr(a,1):a;let[o,c]=zC(r);if(Number.isNaN(o))return this.warn(()=>`Gantt: \\\"${r}\\\" is neither a date in the \\\"${s}\\\" format nor a duration such as \\\"3d\\\", so the task gets no duration.`),new Date(t);let l=xl(t,o,c);return eo(l)?l:new Date(t)}checkTaskDates(t){if(this.excludes.length===0||t.manualEndTime)return;let n=Pr(t.startTime,1),r=new Date(t.endTime),i=+Pr(r,1e4),s=!1,a=null;for(;+n\u003C=+r;){if(this.spend(YC),s||(a=+r),s=this.isInvalidDate(n),s&&(r.setDate(r.getDate()+1),+r>i))throw new Qe(\\\"Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.\\\",\\\"semantic\\\",{type:\\\"gantt\\\"});n.setDate(n.getDate()+1)}t.endTime=r,t.renderEndTime=a===null?null:new Date(a)}};var bE=[\\\"$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\\\"];var VC=/accTitle\\\\s*:\\\\s*/iy,jC=/accDescr\\\\s*:\\\\s*/iy,XC=/accDescr\\\\s*\\\\{\\\\s*/iy,qC=/href\\\\s+\\\"/iy,QC=/call\\\\s+/iy,ZC=/click\\\\s+/iy,JC=/\\\\(\\\\s*\\\\)/y,uh=/weekday\\\\s+(monday|tuesday|wednesday|thursday|friday|saturday|sunday)\\\\b/iy,eN=[\\\"monday\\\",\\\"tuesday\\\",\\\"wednesday\\\",\\\"thursday\\\",\\\"friday\\\",\\\"saturday\\\",\\\"sunday\\\"],fh=/weekend\\\\s+(?:(friday)|saturday)\\\\b/iy,tN=/\\\\d\\\\d\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d\\\\b/y,nN=/title[^\\\\S\\\\r\\\\n]*(?=[\\\\r\\\\n]|$)/iy,rN=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 yE(e){let t=e.length,n=[],r=[],i=[],s=0,a=0,o=(h,d,m)=>{n.push(h),r.push(e.slice(d,m)),i.push(d),a=m},c=h=>(h.lastIndex=a,h.test(e)?h.lastIndex:-1),l=(h,d)=>{let m=e.indexOf(h,d);return m===-1?t:m},u=h=>{let d;switch(h|32){case 97:if((d=c(VC))>=0)return s=1,o(3,a,d),!0;if((d=c(jC))>=0)return s=2,o(5,a,d),!0;if((d=c(XC))>=0)return s=3,a=d,!0;break;case 104:if((d=c(qC))>=0)return s=4,a=d,!0;break;case 99:if((d=c(QC))>=0)return s=5,a=d,!0;if((d=c(ZC))>=0)return s=7,a=d,!0;break;case 116:if((d=c(nN))>=0)return a=d,!0;break;case 119:{uh.lastIndex=a;let p=uh.exec(e);if(p)return o(22+eN.indexOf(p[1].toLowerCase()),a,uh.lastIndex),!0;if(fh.lastIndex=a,p=fh.exec(e),p)return o(p[1]!==void 0?29:30,a,fh.lastIndex),!0;break}}let m=rN.get(h|32);if(m){for(let[p,y]of m)if((d=c(p))>=0)return o(y,a,d),!0}return!1};for(;;){if(a>=t){let d=38;switch(s){case 1:d=4;break;case 2:d=6;break;case 3:d=7;break;case 4:d=9;break;case 5:d=10;break;case 6:d=11;break;case 7:d=12;break}o(d,t,t);break}let h=e.charCodeAt(a);switch(s){case 0:{let d=e.charCodeAt(a+1);if(h===37)if(d!==37){let m=l(`\\r\\n`,a+1);for(;e.charCodeAt(m)===10;)m++;a=m}else{if(e.charCodeAt(a+2)===123)return o(2,a,a+3),o(1,a,a),{types:n,texts:r,starts:i};a=l(`\\r\\n`,a+2)}else if(h===10){let m=a+1;for(;e.charCodeAt(m)===10;)m++;o(8,a,m)}else if(qe(h))for(a++;a\u003Ct&&qe(e.charCodeAt(a));)a++;else{if(u(h))break;if(h>=48&&h\u003C=57&&c(tN)>=0)o(31,a,a+10);else if(h!==58){let m=a+1;for(;m\u003Ct;){let p=e.charCodeAt(m);if(p===58||p===10)break;m++}o(35,a,m)}else{let m=a+1;for(;m\u003Ct;){let p=e.charCodeAt(m);if(p===35||p===10||p===59)break;m++}o(m>a+1?36:37,a,m)}}break}case 1:case 2:{let d=s===1?4:6;s=0,o(d,a,l(`\\r\\n`,a));break}case 3:h===125?(s=0,a++):o(7,a,l(\\\"}\\\",a));break;case 4:h===34?(s=0,a++):o(9,a,l('\\\"',a));break;case 5:if(h===40){let d=c(JC);d>=0?(s=0,a=d):(s=6,a++)}else o(10,a,l(\\\"(\\\",a));break;case 6:h===41?(s=0,a++):o(11,a,l(\\\")\\\",a));break;case 7:if(qe(h))s=0,a++;else{let d=a+1;for(;d\u003Ct&&!qe(e.charCodeAt(d));)d++;o(12,a,d)}break}}return n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i}}var sN=[\\\"monday\\\",\\\"tuesday\\\",\\\"wednesday\\\",\\\"thursday\\\",\\\"friday\\\",\\\"saturday\\\",\\\"sunday\\\"],EE=\\\"'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'\\\",Sl=new Uint8Array(39);for(let e=22;e\u003C=30;e++)Sl[e]=1;for(let e of[38,8,14,15,16,17,18,20,19,21,32,3,5,7,34,35,12])Sl[e]=1;function xE(e,t){let{types:n,texts:r,starts:i}=yE(e),s=0,a=c=>{let l=n[s];throw ft(\\\"gantt\\\",e,i[s],`Expecting ${c}, got '${l===0?\\\"1\\\":bE[l]}'`)},o=(c=\\\"\\\")=>{Sl[n[s]]!==1&&a(EE+c)};for(n[s]!==13&&a(\\\"'gantt'\\\"),s++;;){let c=n[s],l=r[s];switch(Sl[c]!==1&&a(EE),s++,c){case 38:if(n[s]===0)return;o();break;case 8:break;case 14:o(),t.setDateFormat(l.slice(11));break;case 15:o(),t.enableInclusiveEndDates();break;case 16:o(),t.TopAxis();break;case 17:o(),t.setAxisFormat(l.slice(11));break;case 18:o(),t.setTickInterval(l.slice(13));break;case 20:o(),t.setExcludes(l.slice(9));break;case 19:o(),t.setIncludes(l.slice(9));break;case 21:o(),t.setTodayMarker(l.slice(12));break;case 29:o(),t.setWeekend(\\\"friday\\\");break;case 30:o(),t.setWeekend(\\\"saturday\\\");break;case 32:o(),t.setDiagramTitle(l.slice(6));break;case 3:{n[s]!==4&&a(\\\"'acc_title_value'\\\");let u=r[s++];o(),t.setAccTitle(u.trim());break}case 5:{n[s]!==6&&a(\\\"'acc_descr_value'\\\");let u=r[s++];o(),t.setAccDescription(u.trim());break}case 7:o(),t.setAccDescription(l.trim());break;case 34:o(),t.addSection(l.slice(8));break;case 35:{n[s]!==36&&a(\\\"'taskData'\\\");let u=r[s++];o(),t.addTask(l,u);break}case 12:{let u,h=null,d;n[s]===10?(u=r[s++],n[s]===11&&(h=r[s++]),n[s]===9?(d=r[s++],o()):o(h===null?\\\", 'callbackargs', 'href'\\\":\\\", 'href'\\\")):n[s]===9?(d=r[s++],n[s]===10?(u=r[s++],n[s]===11?(h=r[s++],o()):o(\\\", 'callbackargs'\\\")):o(\\\", 'callbackname'\\\")):a(\\\"'callbackname', 'href'\\\"),u!==void 0&&t.setClickEvent(l,u,h),d!==void 0&&t.setLink(l,d);break}default:o(),t.setWeekday(sN[c-22])}}}var es=1e3,ts=60*es,ii=60*ts,oi=24*ii,xa=7*oi,ph=30*oi,Rl=365*oi;function wl(e){e.setHours(0,0,0,0)}function Ml(e){return{floor(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),wl(t)},offset:(t,n)=>t.setDate(t.getDate()+n*7),cycle:1/0,ms:xa}}var ya={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*es),field:e=>e.getUTCSeconds(),cycle:60,ms:es},minute:{floor:e=>e.setTime(+e-e.getMilliseconds()-e.getSeconds()*es),offset:(e,t)=>e.setTime(+e+t*ts),field:e=>e.getMinutes(),cycle:60,ms:ts},hour:{floor:e=>e.setTime(+e-e.getMilliseconds()-e.getSeconds()*es-e.getMinutes()*ts),offset:(e,t)=>e.setTime(+e+t*ii),field:e=>e.getHours(),cycle:24,ms:ii},day:{floor:wl,offset:(e,t)=>e.setDate(e.getDate()+t),field:e=>e.getDate()-1,cycle:31,ms:oi},month:{floor(e){e.setDate(1),wl(e)},offset:(e,t)=>e.setMonth(e.getMonth()+t),field:e=>e.getMonth(),cycle:12,ms:ph},year:{floor(e){e.setMonth(0,1),wl(e)},offset:(e,t)=>e.setFullYear(e.getFullYear()+t),cycle:1/0,ms:Rl}};function Tl(e,t,n){return Math.floor((+t-+e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ts)/n)}function iN(e,t){return(e%t+t)%t}function _l(e,t,n){let r=e===\\\"week\\\"?Ml(n):ya[e];if(t\u003C=1)return r;if(e===\\\"millisecond\\\")return{...r,floor:a=>a.setTime(Math.floor(+a/t)*t),offset:(a,o)=>a.setTime(+a+o*t)};if(e===\\\"year\\\")return{...r,floor(a){a.setFullYear(Math.floor(a.getFullYear()/t)*t),r.floor(a)},offset:(a,o)=>a.setFullYear(a.getFullYear()+o*t)};if(e===\\\"week\\\"){let a=new Date(0);return r.floor(a),{...r,floor(o){r.floor(o),r.offset(o,-iN(Tl(a,o,xa),t))},offset:(o,c)=>r.offset(o,c*t)}}let i=r.field,s=a=>i(a)%t===0;return{...r,floor(a){for(r.floor(a);Number.isFinite(+a)&&!s(a);r.floor(a))a.setTime(+a-1)},offset(a,o){for(let c=0;c\u003Co&&Number.isFinite(+a);c++)do r.offset(a,1);while(Number.isFinite(+a)&&!s(a))}}}function wE(e,t,n,r){let i=new Date(t-1);e.floor(i),e.offset(i,1),e.floor(i);let s=[],a=-1/0;for(;+i\u003C=n&&+i>a;){if(s.length>=r)return;a=+i,s.push(a),e.offset(i,1),e.floor(i)}return s}function AE(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),a=s>=Math.sqrt(50)?10:s>=Math.sqrt(10)?5:s>=Math.SQRT2?2:1;return Math.pow(10,i)*a}var to=[[\\\"second\\\",1,es],[\\\"second\\\",5,5*es],[\\\"second\\\",15,15*es],[\\\"second\\\",30,30*es],[\\\"minute\\\",1,ts],[\\\"minute\\\",5,5*ts],[\\\"minute\\\",15,15*ts],[\\\"minute\\\",30,30*ts],[\\\"hour\\\",1,ii],[\\\"hour\\\",3,3*ii],[\\\"hour\\\",6,6*ii],[\\\"hour\\\",12,12*ii],[\\\"day\\\",1,oi],[\\\"day\\\",2,2*oi],[\\\"week\\\",1,xa],[\\\"month\\\",1,ph],[\\\"month\\\",3,3*ph],[\\\"year\\\",1,Rl]];function _E(e,t,n){let r=(t-e)/n,i=0;for(;i\u003Cto.length&&to[i][2]\u003C=r;)i++;let s;if(i===to.length)s=_l(\\\"year\\\",Math.max(1,AE(e/Rl,t/Rl,n)),0);else if(i===0)s=_l(\\\"millisecond\\\",Math.max(AE(e,t,n),1),0);else{let[a,o]=to[r/to[i-1][2]\u003Cto[i][2]/r?i-1:i];s=_l(a,o,0)}return wE(s,e,t,4*n+8)??[]}var oN=/^([1-9]\\\\d*)(millisecond|second|minute|hour|day|week|month)$/,aN=[\\\"sunday\\\",\\\"monday\\\",\\\"tuesday\\\",\\\"wednesday\\\",\\\"thursday\\\",\\\"friday\\\",\\\"saturday\\\"];function RE(e,t,n,r,i){let s=oN.exec(e);if(!s)return;let a=parseInt(s[1],10),o=s[2],c=_l(o,a,Math.max(0,aN.indexOf(t)));if(!((r-n)/(Math.min(a,c.cycle)*c.ms)>i))return wE(c,n,r,i)}function hn(e,t,n){let r=e\u003C0?\\\"-\\\":\\\"\\\",i=String(r?-e:e);return r+(i.length\u003Cn?t.repeat(n-i.length)+i:i)}function Ss(e,t){let n=new Date(+e);return t.floor(n),n}function SE(e,t){let n=Ml(t),r=Ss(e,ya.year);return Tl(Ss(new Date(+r-1),n),Ss(e,n),xa)}function hh(e){let t=Ml(4),n=e.getDay(),r=Ss(n>=4||n===0?e:new Date(+e-1),t);return n>=4||n===0||(t.offset(r,1),t.floor(r)),r}var cN=new Map([[\\\"-\\\",\\\"\\\"],[\\\"_\\\",\\\" \\\"],[\\\"0\\\",\\\"0\\\"]]);function Ea(e,t){let n=\\\"\\\",r=0,i=e.length;for(let s=0;s\u003Ci;s++){if(e.charCodeAt(s)!==37)continue;n+=e.slice(r,s);let a=e.charAt(++s),o=cN.get(a);o!==void 0?a=e.charAt(++s):o=a===\\\"e\\\"?\\\" \\\":\\\"0\\\",n+=lN(a,t,o),r=s+1}return n+e.slice(r)}function lN(e,t,n){switch(e){case\\\"a\\\":return Jr[t.getDay()].slice(0,3);case\\\"A\\\":return Jr[t.getDay()];case\\\"b\\\":return si[t.getMonth()].slice(0,3);case\\\"B\\\":return si[t.getMonth()];case\\\"c\\\":return Ea(\\\"%x, %X\\\",t);case\\\"d\\\":case\\\"e\\\":return hn(t.getDate(),n,2);case\\\"f\\\":return hn(t.getMilliseconds(),n,3)+\\\"000\\\";case\\\"g\\\":return hn(hh(t).getFullYear()%100,n,2);case\\\"G\\\":return hn(hh(t).getFullYear()%1e4,n,4);case\\\"H\\\":return hn(t.getHours(),n,2);case\\\"I\\\":return hn(t.getHours()%12||12,n,2);case\\\"j\\\":return hn(1+Tl(Ss(t,ya.year),Ss(t,ya.day),oi),n,3);case\\\"L\\\":return hn(t.getMilliseconds(),n,3);case\\\"m\\\":return hn(t.getMonth()+1,n,2);case\\\"M\\\":return hn(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 hn(t.getSeconds(),n,2);case\\\"u\\\":return String(t.getDay()||7);case\\\"U\\\":return hn(SE(t,0),n,2);case\\\"V\\\":{let r=hh(t),i=Ss(r,ya.year),s=Ss(i,Ml(4));return hn(Tl(s,r,xa)+(i.getDay()===4?1:0),n,2)}case\\\"w\\\":return String(t.getDay());case\\\"W\\\":return hn(SE(t,1),n,2);case\\\"x\\\":return Ea(\\\"%-m/%-d/%Y\\\",t);case\\\"X\\\":return Ea(\\\"%-I:%M:%S %p\\\",t);case\\\"y\\\":return hn(t.getFullYear()%100,n,2);case\\\"Y\\\":return hn(t.getFullYear()%1e4,n,4);case\\\"Z\\\":{let r=t.getTimezoneOffset(),i=Math.abs(r);return(r>0?\\\"-\\\":\\\"+\\\")+hn(Math.floor(i/60),\\\"0\\\",2)+hn(i%60,\\\"0\\\",2)}case\\\"%\\\":return\\\"%\\\";default:return e}}var dN=800,uN=240,no=8,fN=/\u003Cbr\\\\s*\\\\/?>/gi;function Fr(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 mh(e,t){let n=e.gantt?.[t];return typeof n==\\\"string\\\"?n:void 0}function hN(e,t){return e.gantt?.[t]===!0}function TE(e,t,n){let r=Ge(e.replace(fN,\\\" \\\"),!1,t,n,4e3);return r.lines.length\u003C=1?r:{...r,lines:[r.lines[0]],widths:[r.widths[0]],width:r.widths[0],height:r.lineHeight}}function Cl(e){return Number.isFinite(+e.startTime)&&Number.isFinite(+e.endTime)}function pN(e,t,n){let r=e.filter(Cl).sort((a,o)=>+a.startTime-+o.startTime||a.order-o.order),i=[];for(let a of r){let o=+a.startTime,c=0;for(;c\u003Ci.length&&o\u003Ci[c];)c++;i[c]=+a.endTime,n.set(a,t+c)}let s=i.length;for(let a of e)n.has(a)||n.set(a,t+s++);return Math.max(s,1)}function ME(e,t,n){let r=n.fontSize??16,i=n.measurer??ct(n.fontFamily,n.fontFamilyMono),s=n.padding??8,a=dh(n.now),o=Fr(t,\\\"fontSize\\\",4,72)??Math.round(r*.8125),c=Fr(t,\\\"sectionFontSize\\\",4,72)??o,l=Math.round(r*.75),u=Fr(t,\\\"barHeight\\\",4,400)??Math.round(o*1.85),h=Fr(t,\\\"barGap\\\",0,400)??Math.round(u/4),d=u+h,m=Math.round(Fr(t,\\\"numberSectionStyles\\\",1,1e3)??4),p=e.displayMode===\\\"compact\\\",y=e.topAxis||hN(t,\\\"topAxis\\\"),E=e.getTasks(a),b=E.filter(ye=>!ye.vert),S=E.filter(ye=>ye.vert&&Cl(ye)),x=new Map;for(let ye of b)x.has(ye.section)||x.set(ye.section,x.size);let I=new Map,L=[];if(p){let ye=new Map;for(let we of b){let Ie=ye.get(we.section);Ie?Ie.push(we):ye.set(we.section,[we])}for(let[we,Ie]of ye){let ve=pN(Ie,L.length,I);for(let Pe=0;Pe\u003Cve;Pe++)L.push(we)}}else for(let ye of b)I.set(ye,L.length),L.push(ye.section);let O=L.length,v=1/0,G=-1/0;for(let ye of E)Cl(ye)&&(v=Math.min(v,+ye.startTime),G=Math.max(G,+ye.endTime));let K=v\u003C=G,C=Ge(e.title,!1,i,r,4e3,1),Z=C.height>0?C.height+16:0;if(!K){let ye=Math.ceil(Math.max(C.width,1)+2*s),we=Math.ceil(Math.max(C.height,1)+2*s),Ie=Ne(C,ye/2,s+C.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"');return{svg:at(\\\"gantt\\\",ye,we,r,n,e,Ie),width:ye,height:we,links:[]}}let oe=new Map,H=0;for(let ye of x.keys()){let we=Ge(ye,!1,i,c,180);oe.set(ye,we),H=Math.max(H,we.width)}let z=e.axisFormat||(e.dateFormat===\\\"D\\\"?\\\"%d\\\":mh(t,\\\"axisFormat\\\")??\\\"%Y-%m-%d\\\"),M=ye=>Ea(z,new Date(ye)),T=Math.max(i.width(M(v),l,0),i.width(M(G),l,0)),R=s+(Fr(t,\\\"leftPadding\\\",0,2e3)??Math.max(H>0?H+24:0,T/2)),_=Fr(t,\\\"rightPadding\\\",0,2e3)??Math.max(16,T/2),$=gs(n,Fr(t,\\\"useWidth\\\",100,2e4)??dN,280),g=Math.max(uN,$-R-_-s),N=R+g,w=G>v?g/(G-v):0,A=ye=>w===0?R+g/2:R+(ye-v)*w,D=Math.round(l*1.75),U=Fr(t,\\\"topPadding\\\",0,2e3),B=Fr(t,\\\"gridLineStartPadding\\\",0,2e3),F=s+Z+(y?D:0),W=Math.max(F,U??0),j=U!==void 0&&B!==void 0?Math.max(0,Math.min(U-B,W-F)):0,Q=Math.max(O,1)*d,Y=W+Q,ne=[],q=N+_;for(let ye of b){let we=TE(ye.task,i,o),Ie=I.get(ye);if(!Cl(ye)){let Be=R+no+we.width/2;q=Math.max(q,Be+we.width/2),ne.push({task:ye,label:we,row:Ie,x0:NaN,x1:NaN,labelX:Be,inside:!1});continue}let ve=A(+ye.startTime),Pe=Math.max(A(+(ye.renderEndTime??ye.endTime)),ve+(ye.milestone?0:2));if(ye.milestone){let Be=ve+(A(+ye.endTime)-ve)/2;ve=Be-u/2,Pe=Be+u/2}let he=!ye.milestone&&we.width+2*no\u003C=Pe-ve,Re=(ve+Pe)/2;if(!he){let Be=Pe+no+we.width\u003C=N+_,ge=ve-no-we.width>=R;Re=Be||!ge?Pe+no+we.width/2:ve-no-we.width/2,q=Math.max(q,Re+we.width/2)}ne.push({task:ye,label:we,row:Ie,x0:ve,x1:Pe,labelX:Re,inside:he})}let k=e.tickInterval||mh(t,\\\"tickInterval\\\")||\\\"\\\",J=e.weekday??mh(t,\\\"weekday\\\")??\\\"sunday\\\",te=Math.max(2,Math.min(10,Math.floor(g/(T+24)))),se=RE(k,J,v,G,Math.ceil(g/3))??_E(v,G,te),re=\\\"\\\",P=\\\"\\\",ee=\\\"\\\",ae=-1/0,ue=\\\"\\\",ce=Y+D/2+2,pe=W-j-D/2-2;for(let ye of se){let we=A(ye);re+=`M${f(we)},${f(W-j)}V${f(Y)}`;let Ie=M(ye),ve=i.width(Ie,l,0);if(we-ve/2\u003Cae+8||Ie===ue)continue;ae=we+ve/2,ue=Ie,q=Math.max(q,ae);let Pe=`text-anchor=\\\"middle\\\">${rt(Ie)}\u003C/text>`;P+=`\u003Ctext x=\\\"${f(we)}\\\" y=\\\"${f(ce+l*.35)}\\\" ${Pe}`,y&&(ee+=`\u003Ctext x=\\\"${f(we)}\\\" y=\\\"${f(pe+l*.35)}\\\" ${Pe}`)}let V=\\\"\\\",X=\\\"\\\",le=[],de=Y+D+4,Se=Math.round(o*1.5);for(let ye of[...S].sort((we,Ie)=>+we.startTime-+Ie.startTime)){let we=A(+ye.startTime),Ie=TE(ye.task,i,o),ve=Math.max(s+Ie.width/2,we),Pe=0;for(;Pe\u003Cle.length&&ve-Ie.width/2\u003Cle[Pe]+8;)Pe++;le[Pe]=ve+Ie.width/2,q=Math.max(q,le[Pe]),V+=`\u003Cpath class=\\\"pele-vert\\\" data-id=\\\"${Ue(ye.id)}\\\" d=\\\"M${f(we)},${f(W-j)}V${f(Y)}\\\"/>`,X+=Ne(Ie,ve,de+Pe*Se+Se/2,` class=\\\"pele-vert-label\\\" data-id=\\\"${Ue(ye.id)}\\\"`)}let _e=Math.ceil(Math.max(q,s+C.width)+s),xe=Math.ceil(Y+D+(le.length>0?4+le.length*Se:0)+s),Me=\\\"\\\",Ce=\\\"\\\";for(let ye=0;ye\u003CO;){let we=L[ye],Ie=ye+1;for(;Ie\u003CO&&L[Ie]===we;)Ie++;let ve=x.get(we)%m,Pe=W+ye*d,he=(Ie-ye)*d;(x.size>1||we!==\\\"\\\")&&(Me+=`\u003Crect class=\\\"pele-section pele-section-${ve}\\\" x=\\\"0\\\" y=\\\"${f(Pe)}\\\" width=\\\"${_e}\\\" height=\\\"${f(he)}\\\" fill=\\\"${ve%2===0?\\\"var(--_s)\\\":\\\"none\\\"}\\\"/>`);let Re=oe.get(we);Ce+=Ne(Re,s+8+Re.width/2,Pe+he/2,` class=\\\"pele-section-label\\\" data-id=\\\"${Ue(we)}\\\"`,n.icons),ye=Ie}let ke=\\\"\\\";if((e.excludes.length>0||e.includes.length>0)&&+xl(new Date(v),6,\\\"y\\\")>G){let ye,we,Ie=()=>{if(!ye||!we)return;let ve=new Date(ye);ve.setHours(0,0,0,0);let Pe=new Date(we);Pe.setHours(23,59,59,999);let he=Math.max(R,A(+ve)),Re=Math.min(N,A(+Pe));Re>he&&(ke+=`\u003Crect x=\\\"${f(he)}\\\" y=\\\"${f(W)}\\\" width=\\\"${f(Re-he)}\\\" height=\\\"${f(Q)}\\\"/>`),ye=we=void 0};for(let ve=new Date(v);+ve\u003C=G;ve=Pr(ve,1))e.isInvalidDate(ve)?(ye??=ve,we=ve):Ie();Ie()}let be=[],Ae=\\\"\\\";for(let ye of ne){let we=ye.task,Ie=W+ye.row*d+d/2,ve=we.active?\\\"active\\\":we.done?\\\"done\\\":\\\"\\\",Pe=\\\"pele-task\\\";ve&&(Pe+=\\\" pele-\\\"+ve),we.crit&&(Pe+=\\\" pele-crit\\\"),we.milestone&&(Pe+=\\\" pele-milestone\\\"),we.classes.includes(\\\"clickable\\\")&&(Pe+=\\\" pele-clickable\\\");let he=\\\"\\\",Re=\\\"\\\";if(Number.isNaN(ye.x0))Pe+=\\\" pele-unscheduled\\\",Re=' fill=\\\"var(--_m)\\\"';else{let Le=we.crit?Yo:\\\"var(--_c)\\\",Fe=ve===\\\"done\\\"?'fill=\\\"var(--_a)\\\"':ve===\\\"active\\\"?`fill=\\\"${Le}\\\" fill-opacity=\\\"0.25\\\"`:`fill=\\\"${Le}\\\"`,Ve=`stroke=\\\"${ve===\\\"done\\\"&&!we.crit?\\\"var(--_b)\\\":Le}\\\"`;if(we.milestone){let Oe=(ye.x0+ye.x1)/2,je=u/2;he=`\u003Cpath d=\\\"M${f(Oe)},${f(Ie-je)}L${f(Oe+je)},${f(Ie)}L${f(Oe)},${f(Ie+je)}L${f(Oe-je)},${f(Ie)}Z\\\" ${Fe} ${Ve} stroke-linejoin=\\\"round\\\"/>`}else he=`\u003Crect x=\\\"${f(ye.x0)}\\\" y=\\\"${f(Ie-u/2)}\\\" width=\\\"${f(ye.x1-ye.x0)}\\\" height=\\\"${f(u)}\\\" ${Fe} ${Ve}${ht}/>`;ye.inside?Re=ve===\\\"\\\"?' fill=\\\"var(--_bg)\\\"':\\\"\\\":ve===\\\"done\\\"&&(Re=' fill=\\\"var(--_m)\\\"')}let Be=he+Ne(ye.label,ye.labelX,Ie,` class=\\\"pele-label\\\"${Re}`),ge=e.links.get(we.id);ge!==void 0&&(Be=Zn(Be,ge,we.id,be,n)),Ae+=`\u003Cg class=\\\"${Pe}\\\" data-id=\\\"${Ue(we.id)}\\\">${Be}\u003C/g>`}let ie=\\\"\\\";if(e.todayMarker!==\\\"off\\\"&&a>=v&&a\u003C=G&&G>v){let ye=A(a),we=W-j,Ie=e.todayMarker?Ct(e.todayMarker.split(\\\",\\\")).line:\\\"\\\";ie=`\u003Cg class=\\\"pele-today\\\">\u003Cpath d=\\\"M${f(ye)},${f(we)}V${f(Y)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_c)\\\" stroke-width=\\\"2\\\"${Ie}/>`+(Ie?\\\"\\\":`\u003Cpath d=\\\"M${f(ye-4)},${f(we-5)}H${f(ye+4)}L${f(ye)},${f(we+1)}Z\\\" fill=\\\"var(--_c)\\\"/>`)+\\\"\u003C/g>\\\"}let me=`M${f(R)},${f(Y)}H${f(N)}`+(y?`M${f(R)},${f(W-j)}H${f(N)}`:\\\"\\\"),Te=Ne(C,_e/2,s+C.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(Me?`\u003Cg class=\\\"pele-sections\\\">${Me}\u003C/g>`:\\\"\\\")+(ke?`\u003Cg class=\\\"pele-excluded\\\" fill=\\\"var(--_a)\\\">${ke}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-grid\\\" fill=\\\"none\\\">\u003Cpath d=\\\"${re}\\\" stroke=\\\"var(--_b)\\\" stroke-dasharray=\\\"1 3\\\"/>\u003Cpath d=\\\"${me}\\\" stroke=\\\"var(--_b)\\\"/>\u003C/g>`+(V?`\u003Cg class=\\\"pele-verts\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-width=\\\"1.5\\\" stroke-dasharray=\\\"4 3\\\">${V}\u003C/g>`:\\\"\\\")+ie+`\u003Cg class=\\\"pele-tasks\\\" font-size=\\\"${f(o)}\\\">${Ae}\u003C/g>\u003Cg class=\\\"pele-section-labels\\\" font-size=\\\"${f(c)}\\\">${Ce}\u003C/g>\u003Cg class=\\\"pele-axis\\\" font-size=\\\"${l}\\\" fill=\\\"var(--_m)\\\">${P}${ee}\u003C/g>`+(X?`\u003Cg class=\\\"pele-vert-labels\\\" font-size=\\\"${f(o)}\\\">${X}\u003C/g>`:\\\"\\\");return{svg:at(\\\"gantt\\\",_e,xe,r,n,e,Te),width:_e,height:xe,links:be}}var CE={type:\\\"gantt\\\",parse(e,t,n){let r=new Al;n&&(r.title=n);let i=t.gantt?.displayMode;return typeof i==\\\"string\\\"&&(r.displayMode=i),xE(e,r),r},render:ME};var tn={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4};function Bn(e){throw new Qe(e,\\\"semantic\\\",{type:\\\"gitGraph\\\"})}function NE(e){return e===\\\"REVERSE\\\"?tn.REVERSE:e===\\\"HIGHLIGHT\\\"?tn.HIGHLIGHT:tn.NORMAL}function mN(e,t){e.dir&&t.setDirection(e.dir);for(let n of e.statements)gN(n,t)}function gN(e,t){switch(e.$type){case\\\"Commit\\\":t.commit({id:e.id,msg:e.message??\\\"\\\",type:e.type!==void 0?NE(e.type):tn.NORMAL,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?NE(e.type):void 0,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});break}}function IE(e,t,n){let r=t.gitGraph,i=typeof r?.mainBranchName==\\\"string\\\"?r.mainBranchName:\\\"main\\\",s=typeof r?.mainBranchOrder==\\\"number\\\"?r.mainBranchOrder:0,a=new Map,o=new Map([[i,null]]),c=new Map([[i,s]]),l=[],u=null,h=i,d=\\\"LR\\\",m=0,p=()=>{for(let S=m+1;;S+=2654435761){let x=`${m}-${(Math.imul(S,2654435761)>>>0).toString(16).padStart(8,\\\"0\\\").slice(0,7)}`;if(!a.has(x))return x}},y=S=>{u=S,a.set(S.id,S),o.set(h,S.id)},E=S=>{o.has(S)||Bn(`Trying to checkout branch which is not yet created. (Help try using \\\"branch ${S}\\\")`),h=S;let x=o.get(S);u=x?a.get(x)??null:null};mN(e,{setDirection(S){d=S},commit({msg:S,id:x,type:I,tags:L}){let O={id:x||p(),message:S,seq:m++,type:I??tn.NORMAL,tags:L?[...L]:[],parents:u===null?[]:[u.id],branch:h};a.has(O.id)&&l.push(`Commit ID ${O.id} already exists`),y(O)},branch({name:S,order:x}){o.has(S)&&Bn(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using \\\"checkout ${S}\\\")`),o.set(S,u!==null?u.id:null),c.set(S,x),E(S)},merge({branch:S,id:x,type:I,tags:L}){let O=o.get(h),v=o.get(S),G=O?a.get(O):void 0,K=v?a.get(v):void 0;G&&K&&G.branch===S&&Bn(`Cannot merge branch '${S}' into itself.`),h===S&&Bn('Incorrect usage of \\\"merge\\\". Cannot merge a branch to itself'),G===void 0&&Bn(`Incorrect usage of \\\"merge\\\". Current branch (${h})has no commits`),o.has(S)||Bn(`Incorrect usage of \\\"merge\\\". Branch to be merged (${S}) does not exist`),K===void 0&&Bn(`Incorrect usage of \\\"merge\\\". Branch to be merged (${S}) has no commits`),G===K&&Bn('Incorrect usage of \\\"merge\\\". Both branches have same head'),x&&a.has(x)&&Bn(`Incorrect usage of \\\"merge\\\". Commit with id:${x} already exists, use different custom id`),y({id:x||p(),message:`merged branch ${S} into ${h}`,seq:m++,parents:u===null?[]:[u.id,v||\\\"\\\"],branch:h,type:tn.MERGE,customType:I,customId:!!x,tags:L?[...L]:[]})},cherryPick({id:S,targetId:x,tags:I,parent:L}){let O=S?a.get(S):void 0;if(O===void 0&&Bn('Incorrect usage of \\\"cherryPick\\\". Source commit id should exist and provided'),L&&!O.parents.includes(L)&&Bn(\\\"Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.\\\"),O.type===tn.MERGE&&!L&&Bn(\\\"Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.\\\"),x&&a.has(x))return;O.branch===h&&Bn('Incorrect usage of \\\"cherryPick\\\". Source commit is already on current branch');let v=o.get(h);(!v||!a.has(v))&&Bn(`Incorrect usage of \\\"cherry-pick\\\". Current branch (${h})has no commits`),y({id:p(),message:`cherry-picked ${O.message} into ${h}`,seq:m++,parents:u===null?[]:[u.id,O.id],branch:h,type:tn.CHERRY_PICK,tags:I?I.filter(Boolean):[`cherry-pick:${O.id}${O.type===tn.MERGE?`|parent:${L}`:\\\"\\\"}`]})},checkout:E});let b=[...c].map(([S,x],I)=>({name:S,order:x??parseFloat(`0.${I}`)})).sort((S,x)=>S.order-x.order).map(S=>S.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,`\\r\\n`):void 0,direction:d,commits:a,branches:o,lanes:b,currentBranch:h,head:u,warnings:l}}var $E={name:\\\"REFERENCE\\\",pattern:/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/y},LE=[$E];function tr(e){return{name:e,pattern:e,longer:LE}}var kE=[tr(\\\"cherry-pick\\\"),{name:\\\"gitGraph:\\\",pattern:\\\"gitGraph:\\\"},tr(\\\"HIGHLIGHT\\\"),{...Jt(\\\"gitGraph\\\"),longer:LE},tr(\\\"checkout\\\"),tr(\\\"REVERSE\\\"),{name:\\\"parent:\\\",pattern:\\\"parent:\\\"},tr(\\\"commit\\\"),tr(\\\"NORMAL\\\"),tr(\\\"branch\\\"),{name:\\\"order:\\\",pattern:\\\"order:\\\"},tr(\\\"switch\\\"),{name:\\\"type:\\\",pattern:\\\"type:\\\"},tr(\\\"merge\\\"),{name:\\\"msg:\\\",pattern:\\\"msg:\\\"},{name:\\\"tag:\\\",pattern:\\\"tag:\\\"},{name:\\\"id:\\\",pattern:\\\"id:\\\"},tr(\\\"LR\\\"),tr(\\\"TB\\\"),tr(\\\"BT\\\"),{name:\\\":\\\",pattern:\\\":\\\"},{...sn,opener:/[\\\\t ]*accDescr\\\\s*{/y},Xt,er(String.raw`[-./\\\\w]*[-\\\\w]`),{name:\\\"INT\\\",pattern:/0|[1-9][0-9]*(?!\\\\.)/y},Fn,Sn,wn,Ht,Qt,Zt,$E];function OE(e){let t=new Ut(Yt(e,kE,\\\"gitGraph\\\"),kE,\\\"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?un(t.take()):t.fail(\\\"a branch name\\\"),s=()=>un(t.expect(25)),a=()=>(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 o=t.kinds[t.i+1];(t.kind===17||t.kind===18||t.kind===19)&&o===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=Vt(t.take()),r();break;case 22:n.accTitle=zt(t.take()),r();break;case 23:n.title=Kt(t.take()),r();break;case 7:{t.i++;let o={$type:\\\"Commit\\\",tags:[]};for(;;)if(t.accept(16))o.id=s();else if(t.accept(15))o.tags.push(s());else if(t.accept(12))o.type=a();else if(t.accept(14)||t.kinds[t.i]===25)o.message=s();else break;r(),n.statements.push(o);break}case 9:{t.i++;let o={$type:\\\"Branch\\\",name:i()};t.accept(10)&&(o.order=parseInt(t.expect(24))),r(),n.statements.push(o);break}case 13:{t.i++;let o={$type:\\\"Merge\\\",branch:i(),tags:[]};for(;;)if(t.accept(16))o.id=s();else if(t.accept(15))o.tags.push(s());else if(t.accept(12))o.type=a();else break;r(),n.statements.push(o);break}case 4:case 11:{t.i++;let o={$type:\\\"Checkout\\\",branch:i()};r(),n.statements.push(o);break}case 0:{t.i++;let o={$type:\\\"CherryPicking\\\",tags:[]};for(;;)if(t.accept(16))o.id=s();else if(t.accept(15))o.tags.push(s());else if(t.accept(6))o.parent=s();else break;r(),n.statements.push(o);break}default:t.fail(\\\"a statement, a title, or a line break\\\")}return n}var bN=/\u003C(?!br\\\\s*\\\\/?>)/gi,yN=/:fa-/g,EN=/\u003Cbr\\\\s*\\\\/?>|fl°°?\\\\w+¶ß|&#?\\\\w+;|[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]|[\\\\s\\\\S]/gi;function br(e,t,n,r,i=0){let s=e;return s!==void 0&&(s.includes(\\\"\u003C\\\")&&(s=s.replace(bN,\\\"<\\\")),s.includes(\\\":fa-\\\")&&(s=s.replace(yN,\\\":fa-\\\"))),Ge(s,!1,t,n,r,i)}function Wn(e,t,n,r,i=0){let s=br(e,t,n,r,i);if(e===void 0||s.width\u003C=r)return s;let a=\\\"\\\",o=0;for(let c of e.match(EN)??[]){if(c.trim()===\\\"\\\"||c.length>2&&c[0]===\\\"\u003C\\\")o=0;else{let l=t.width(c.length>2?\\\"x\\\":c,n,i);o>0&&o+l>r&&(a+=`\\r\\n`,o=0),o+=l}a+=c}return br(a,t,n,r,i)}var nn=7,xN=44,AN=44,Nl=36,Il=8,ai=20,Aa=20,Sa=7,DE=6,gh=Math.SQRT1_2,vE=[\\\"normal\\\",\\\"reverse\\\",\\\"highlight\\\",\\\"merge\\\",\\\"cherry-pick\\\"];function kl(e,t,n){let r=e.gitGraph?.[t];return typeof r==\\\"boolean\\\"?r:n}function PE(e){return Sa+4+e.width+6}function SN(e,t,n,r){let i=`cx=\\\"${f(t)}\\\" cy=\\\"${f(n)}\\\"`;if(e===tn.HIGHLIGHT)return`\u003Crect x=\\\"${f(t-nn-1)}\\\" y=\\\"${f(n-nn-1)}\\\" width=\\\"${2*nn+2}\\\" height=\\\"${2*nn+2}\\\" rx=\\\"2\\\" fill=\\\"${r}\\\"/>`;if(e===tn.MERGE)return`\u003Ccircle ${i} r=\\\"${nn-1}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"${r}\\\" stroke-width=\\\"2\\\"/>\u003Ccircle ${i} r=\\\"2.5\\\" fill=\\\"${r}\\\"/>`;let s=`\u003Ccircle ${i} r=\\\"${nn}\\\" fill=\\\"${r}\\\"/>`;return e===tn.REVERSE?s+`\u003Cpath d=\\\"M${f(t-3)},${f(n-3)}l6,6M${f(t-3)},${f(n+3)}l6,-6\\\" fill=\\\"none\\\" stroke=\\\"var(--_bg)\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\"/>`:e===tn.CHERRY_PICK?s+`\u003Cpath d=\\\"M${f(t-2.6)},${f(n+1)}L${f(t+.8)},${f(n-4.2)}L${f(t+2.6)},${f(n+1)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_bg)\\\" stroke-linejoin=\\\"round\\\"/>\u003Ccircle cx=\\\"${f(t-2.6)}\\\" cy=\\\"${f(n+2.2)}\\\" r=\\\"1.8\\\" fill=\\\"var(--_bg)\\\"/>\u003Ccircle cx=\\\"${f(t+2.6)}\\\" cy=\\\"${f(n+2.2)}\\\" r=\\\"1.8\\\" fill=\\\"var(--_bg)\\\"/>`:s}function BE(e,t,n){return e.direction!==\\\"LR\\\"?FE(e,t,n,e.direction):Pt(n,r=>FE(e,t,n,r?\\\"TB\\\":\\\"LR\\\"))}function FE(e,t,n,r){let i=n.fontSize??16,s=Math.round(i*.75),a=n.measurer??ct(n.fontFamily,n.fontFamilyMono),o=n.padding??8,c=kl(t,\\\"showBranches\\\",!0),l=kl(t,\\\"showCommitLabel\\\",!0),u=kl(t,\\\"rotateCommitLabel\\\",!0),h=kl(t,\\\"parallelCommits\\\",!1),d=r!==\\\"LR\\\",m=r===\\\"BT\\\",p=new Map;e.lanes.forEach((k,J)=>p.set(k,J));let y=e.lanes.length,E=Math.round(i*.875),b=e.lanes.map(k=>br(c?k:\\\"\\\",a,E,4e3)),S=[],x=new Map;for(let k of[...e.commits.values()].sort((J,te)=>J.seq-te.seq)){let J=l&&k.type!==tn.CHERRY_PICK&&(k.type!==tn.MERGE||k.customId===!0),te=[];for(let re of k.tags){let P=br(re,a,s,4e3);P.lines.length>0&&te.push(P)}let se={commit:k,index:S.length,lane:p.get(k.branch)??0,m:0,label:J?br(k.id,a,s,4e3):void 0,tags:te};S.push(se),x.set(k.id,se)}let I=new Float64Array(S.length),L=new Float64Array(S.length),O=new Float64Array(y).fill(nn),v=new Float64Array(y).fill(nn);S.forEach((k,J)=>{let{label:te,tags:se}=k,re=0,P=0;for(let V of se){let X=PE(V);d?(re=Math.max(re,V.height),P+=X+4):(re=Math.max(re,X),P+=V.height+3)}let ee=0,ae=0;te!==void 0&&te.lines.length>0&&(u?ae=3+gh*(te.width+te.height):(ee=d?te.height:te.width,ae=6+(d?te.width:te.height))),I[J]=Math.max(nn,re/2,ee/2),L[J]=re/2;let ue=nn+(se.length>0?DE+P:0),ce=nn+ae,pe=k.lane;O[pe]=Math.max(O[pe],d?ce:ue),v[pe]=Math.max(v[pe],d?ue:ce)});let G=new Float64Array(S.length);d||S.forEach((k,J)=>{if(L[J]!==0)for(let te of k.commit.parents){let se=x.get(te);se!==void 0&&se.lane\u003Ck.lane&&(G[J]=L[J]+4)}});let K=(k,J)=>Math.max(xN,I[k]+I[J]+Il,G[J]>0?I[k]+Nl+G[J]:0);S.forEach((k,J)=>{if(!h){k.m=J===0?0:S[J-1].m+K(J-1,J);return}let te=0;for(let se of k.commit.parents){let re=x.get(se);re===void 0||re.index>=J||(te=Math.max(te,re.m+K(re.index,J)))}k.m=te});let C=0;for(let k of S)C=Math.max(C,k.m);let Z=new Float64Array(y);for(let k=0;k\u003Cy;k++){let J=b[k],te=J.lines.length===0?0:d?J.width/2+8:J.height/2+2;O[k]=Math.max(O[k],te),v[k]=Math.max(v[k],te),k>0&&(Z[k]=Z[k-1]+Math.max(AN,v[k-1]+O[k]+Il))}let oe=(k,J)=>d?J:k,H=(k,J)=>d?m?-k:k:J,z=(k,J)=>`${f(oe(k,J))},${f(H(k,J))}`,M=1/0,T=1/0,R=-1/0,_=-1/0,$=(k,J,te,se)=>{k\u003CM&&(M=k),J\u003CT&&(T=J),te>R&&(R=te),se>_&&(_=se)},g=\\\"\\\";if(c)for(let k=0;k\u003Cy;k++){let J=b[k],te=Et(k),se=Z[k],re=J.width+16,P=J.height+4,ee=J.lines.length===0?-ai:-ai-(d?P:re),ae=oe(ee+(d?P:re)/2,se),ue=H(ee+(d?P:re)/2,se);$(oe(-ai,se),H(-ai,se),oe(-ai,se),H(-ai,se)),$(oe(C+Aa,se),H(C+Aa,se),oe(C+Aa,se),H(C+Aa,se)),g+=`\u003Cg class=\\\"pele-branch\\\" data-id=\\\"${Ue(e.lanes[k])}\\\">\u003Cpath class=\\\"pele-lane\\\" d=\\\"M${z(-ai,se)}L${z(C+Aa,se)}\\\" stroke=\\\"${te}\\\" stroke-dasharray=\\\"2 4\\\"/>`,J.lines.length>0&&($(ae-re/2,ue-P/2,ae+re/2,ue+P/2),g+=`\u003Crect x=\\\"${f(ae-re/2)}\\\" y=\\\"${f(ue-P/2)}\\\" width=\\\"${f(re)}\\\" height=\\\"${f(P)}\\\" fill=\\\"${te}\\\"${ht}/>`+Ne(J,ae,ue,' class=\\\"pele-label\\\"'+(fs(k)||' fill=\\\"var(--_bg)\\\"'))),g+=\\\"\u003C/g>\\\"}let N=Array.from({length:y},()=>[]);for(let k of S)N[k.lane].push(k.m);if(h)for(let k of N)k.sort((J,te)=>J-te);let w=(k,J,te)=>{let se=N[k],re=0,P=se.length;for(;re\u003CP;){let ee=re+P>>1;se[ee]\u003C=J?re=ee+1:P=ee}return re\u003Cse.length&&se[re]\u003Cte},A=\\\"\\\",D=\\\"\\\";for(let k of S){let{commit:J}=k,te=Z[k.lane],se=k.m;for(let re=0;re\u003CJ.parents.length;re++){let P=x.get(J.parents[re]);if(P===void 0||P===k)continue;let ee=Z[P.lane],ae=P.m;if(P.lane===k.lane){D+=`\u003Cpath class=\\\"pele-edge\\\" d=\\\"M${z(ae,ee)}L${z(se,te)}\\\" stroke=\\\"${Et(k.lane)}\\\"/>`;continue}let ue=re>0&&J.type===tn.MERGE,ce=re>0&&!ue,pe=`M${z(ae,ee)}`;if(se\u003C=ae){let V=(ae+se)/2;pe+=`C${z(V,ee)} ${z(V,te)} ${z(se,te)}`}else if(!ue&&!w(k.lane,ae,se)){let V=Math.min(Nl,se-ae);pe+=`C${z(ae+V/2,ee)} ${z(ae+V/2,te)} ${z(ae+V,te)}L${z(se,te)}`}else{let V=P.lane\u003Ck.lane&&se-G[k.index]>ae?se-G[k.index]:se,X=Math.min(Nl,V-ae),le=ee;(!ue||w(P.lane,ae,se))&&(le=ee>te?te+v[k.lane]+Il/2:te-O[k.lane]-Il/2,X=Math.min(Nl,(V-ae)/2),pe+=`C${z(ae+X/2,ee)} ${z(ae+X/2,le)} ${z(ae+X,le)}`),pe+=`L${z(V-X,le)}C${z(V-X/2,le)} ${z(V-X/2,te)} ${z(V,te)}`,V\u003Cse&&(pe+=`L${z(se,te)}`)}A+=`\u003Cpath class=\\\"pele-edge${ue?\\\" pele-edge-merge\\\":ce?\\\" pele-edge-cherry-pick\\\":\\\"\\\"}\\\" d=\\\"${pe}\\\" stroke=\\\"${Et(ue?P.lane:k.lane)}\\\"${ce?' stroke-dasharray=\\\"4 3\\\"':\\\"\\\"}/>`}}let U=\\\"\\\";for(let k of S){let{commit:J,label:te,tags:se}=k,re=oe(k.m,Z[k.lane]),P=H(k.m,Z[k.lane]),ee=J.customType??J.type;$(re-nn-1,P-nn-1,re+nn+1,P+nn+1);let ue=J.type\u003Ctn.MERGE&&J.message!==\\\"\\\"?`\u003Ctitle>${Ue(J.message)}\u003C/title>`:\\\"\\\";if(ue+=SN(ee,re,P,Et(k.lane)),te!==void 0&&te.lines.length>0){let V=te.width,X=te.height,le=(de,Se)=>`\u003Crect x=\\\"${f(de-V/2-2)}\\\" y=\\\"${f(Se-X/2+2)}\\\" width=\\\"${f(V+4)}\\\" height=\\\"${f(X-4)}\\\" rx=\\\"3\\\" fill=\\\"var(--_bg)\\\"/>`;if(u){let de=gh*X/2,Se=d?re-nn-3-de:re+3,_e=d?P:P+nn+3+de,xe=gh*V+de;$(Se-xe,m?_e-xe:_e-de,Se+de,m?_e+de:_e+xe),ue+=`\u003Cg class=\\\"pele-commit-label\\\" transform=\\\"rotate(${m?45:-45} ${f(Se)} ${f(_e)})\\\">`+le(Se-V/2,_e)+Ne(te,Se-V/2,_e,\\\"\\\")+\\\"\u003C/g>\\\"}else{let de=d?re-nn-6-V/2:re,Se=d?P:P+nn+6+X/2;$(de-V/2,Se-X/2,de+V/2,Se+X/2),ue+=`\u003Cg class=\\\"pele-commit-label\\\">${le(de,Se)}${Ne(te,de,Se,\\\"\\\")}\u003C/g>`}}let ce=nn+DE;for(let V=d?0:se.length-1;V>=0&&V\u003Cse.length;V+=d?1:-1){let X=se[V],le=PE(X),de=X.height,Se=d?re+ce:re-le/2,_e=d?P:P-ce-de/2;ce+=d?le+4:de+3,$(Se,_e-de/2,Se+le,_e+de/2),ue+=`\u003Cg class=\\\"pele-tag\\\">\u003Cpath d=\\\"M${f(Se)},${f(_e)}L${f(Se+Sa)},${f(_e-de/2)}H${f(Se+le)}V${f(_e+de/2)}H${f(Se+Sa)}Z\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\" stroke-linejoin=\\\"round\\\"/>\u003Ccircle cx=\\\"${f(Se+Sa)}\\\" cy=\\\"${f(_e)}\\\" r=\\\"1.5\\\" fill=\\\"var(--_b)\\\"/>`+Ne(X,Se+Sa+4+X.width/2,_e,' fill=\\\"var(--_fg)\\\"')+\\\"\u003C/g>\\\"}let pe=J.type===tn.MERGE&&ee!==tn.MERGE?\\\" pele-commit-merge\\\":\\\"\\\";U+=`\u003Cg class=\\\"pele-commit pele-commit-${vE[ee]??vE[0]}${pe}\\\" data-id=\\\"${Ue(J.id)}\\\">${ue}\u003C/g>`}M>R&&$(0,0,0,0);let B=Ge(e.title,!1,a,i,4e3,1),F=B.height>0?B.height+16:0,W=Math.max(R-M,B.width),j=Math.ceil(W+2*o),Q=Math.ceil(_-T+F+2*o),Y=o-M+(W-(R-M))/2,ne=o+F-T,q=Ne(B,j/2,o+B.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg transform=\\\"translate(${f(Y)},${f(ne)})\\\">`+(g?`\u003Cg class=\\\"pele-branches\\\" fill=\\\"none\\\" font-size=\\\"${E}\\\">${g}\u003C/g>`:\\\"\\\")+(A||D?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\">${A}${D}\u003C/g>`:\\\"\\\")+(U?`\u003Cg class=\\\"pele-commits\\\" font-size=\\\"${s}\\\" fill=\\\"var(--_m)\\\">${U}\u003C/g>`:\\\"\\\")+\\\"\u003C/g>\\\";return{svg:at(\\\"gitGraph\\\",j,Q,i,n,e,q),width:j,height:Q,links:[]}}var WE={type:\\\"gitGraph\\\",parse:(e,t,n)=>IE(OE(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,`\\r\\n`):void 0}}var GE=[Jt(\\\"showInfo\\\"),Jt(\\\"info\\\"),sn,Xt,pr,Sn,wn,Ht,Qt,Zt];function YE(e){let t=new Ut(Yt(e,GE,\\\"info\\\"),GE,\\\"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 r=t.kind;if(r===2?n.accDescr=Vt(t.take()):r===3?n.accTitle=zt(t.take()):r===4?n.title=Kt(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 HE=\\\"1.13.0\\\";function KE(e,t,n){let r=n.fontSize??16,i=n.measurer??ct(n.fontFamily,n.fontFamilyMono),s=n.padding??8,a=Ge(e.title,!1,i,r,4e3,1),o=a.height>0?a.height+8:0,c=Ge(`Pele v${HE}`,!1,i,r,4e3),l=Math.ceil(Math.max(a.width,c.width)+2*s),u=Math.ceil(o+c.height+2*s),h=Ne(a,l/2,s+a.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+Ne(c,l/2,s+o+c.height/2,' class=\\\"pele-version\\\" fill=\\\"var(--_m)\\\"');return{svg:at(\\\"info\\\",l,u,r,n,e,h),width:l,height:u,links:[]}}var zE={type:\\\"info\\\",parse:(e,t,n)=>UE(YE(e),n),render:KE};var $l=class{constructor(){fe(this,\\\"type\\\",\\\"ishikawa\\\");fe(this,\\\"title\\\");fe(this,\\\"root\\\");fe(this,\\\"stack\\\",[]);fe(this,\\\"baseLevel\\\")}addNode(t,n){let r={text:n,children:[]};if(!this.root){this.root=r,this.stack=[{level:0,node:r}];return}this.baseLevel??=t;let i=Math.max(t-this.baseLevel+1,1),s=this.stack;for(;s.length>1&&s[s.length-1].level>=i;)s.pop();s[s.length-1].node.children.push(r),s.push({level:i,node:r})}};var VE=[\\\"$end\\\",\\\"EOF\\\",\\\"SPACELINE\\\",\\\"NL\\\",\\\"ISHIKAWA\\\",\\\"SPACELIST\\\",\\\"TEXT\\\"];function _N(e,t){let n=\\\"ishikawa-beta\\\",r=0;for(;r\u003C13;){let i=e.charCodeAt(t+r),s=n.charCodeAt(r);if(i!==s&&(i+32!==s||i\u003C65||i>90))break;r++}return r===13&&!ot(e.charCodeAt(t+13))?13:r>=8&&!ot(e.charCodeAt(t+8))?8:0}function jE(e){let t=[],n=[],r=[],i=e.length,s=0;for(;s\u003Ci;){let a=s,o=-1;for(;a\u003Ci&&qe(e.charCodeAt(a));)e.charCodeAt(a)===10&&(o=a),a++;let c,l;if(e.charCodeAt(a)===37&&e.charCodeAt(a+1)===37)for(c=2,l=a+2;l\u003Ci;){let u=e.charCodeAt(l);if(u===10||u===13||u===8232||u===8233)break;l++}else if(a===s){let u=_N(e,s);u>0?(c=4,l=s+u):(c=6,l=e.indexOf(`\\r\\n`,s),l===-1&&(l=i))}else o>s?(c=2,l=o+1):o===s?(c=3,l=s+1):(c=5,l=a);t.push(c),n.push(s),r.push(l),s=l}return t.push(1,0),n.push(i,i),r.push(i,i),{types:t,starts:n,ends:r}}var bh=\\\"'SPACELINE', 'NL', 'EOF'\\\";function XE(e,t){let{types:n,starts:r,ends:i}=jE(e),s=0,a=o=>{throw ft(\\\"ishikawa\\\",e,r[s],`Expecting ${o}, got '${VE[n[s]]}'`)};if(n[s]===2){for(s++;n[s]===2||n[s]===3;)s++;n[s]!==4&&a(\\\"'SPACELINE', 'NL', 'ISHIKAWA'\\\")}else n[s]!==4&&a(\\\"'SPACELINE', 'ISHIKAWA'\\\");for(s++,n[s]===3&&s++;;){let o=n[s];if(o===6||o===5&&n[s+1]===6){let c=o===6?s:s+1;s=c+1,n[s]!==2&&n[s]!==3&&n[s]!==1&&a(bh),t.addNode(o===6?0:i[c-1]-r[c-1],e.slice(r[c],i[c]).trim())}else o===2||o===5?(s++,n[s]!==2&&n[s]!==3&&n[s]!==1&&a(o===5?`${bh}, 'TEXT'`:bh)):a(\\\"'SPACELINE', 'SPACELIST', 'TEXT'\\\");for(s++;n[s]===3||n[s]===1;)s++;if(n[s]===0)return}}var Ol=.5,Ll=Math.hypot(Ol,1),RN=14,TN=6,MN=8,qE=22,CN=18,yh=5,NN=26,QE=34,IN=28,kN=10,$N=5;function LN(e,t,n,r,i){let s=Ge(e.text,!1,n,r,180),a=Math.round(i*1.5),o=[],c=[],l=[],u=(p,y,E)=>{let b=p.length;for(let S=b-1;S>=0;S--)l.push({node:p[t?b-1-S:S],depth:y,parent:E,slot:S,bone:-1})};for(u(e.children,2,-1);l.length>0;){let p=l.pop();if(p.bone!==-1){c.push(p.bone);continue}let y=o.length;o.push({label:Ge(p.node.text,!1,n,i,200),depth:p.depth,parent:p.parent,slot:p.slot,kids:p.node.children.length,rise:0,at:0,textEnd:0}),p.depth%2===0?c.push(y):(p.bone=y,l.push(p)),u(p.node.children,p.depth+1,y)}let h=RN;for(let p of c){let y=Math.max(o[p].label.height,a)+TN;o[p].rise=h+y/2,h+=y}let d=s.width+2*kN,m=d/2;for(let p of o){let y=p.parent===-1?void 0:o[p.parent];p.depth%2===0?(p.at=y?y.at:0,p.textEnd=p.at-(p.kids>0?(p.kids+1)*qE:CN)-yh):(p.at=y.at-(y.kids-p.slot)*qE,p.textEnd=p.at-yh),m=Math.max(m,p.label.width-p.textEnd)}return{node:e,label:s,boxW:d,boxH:s.height+2*$N,bones:o,rise:h+MN,reach:m}}function ZE(e,t,n){return Pt(n,r=>ON(e,t,n,r))}function ON(e,t,n,r){let i=n.fontSize??16,s=Math.round(i*.875),a=n.measurer??ct(n.fontFamily,n.fontFamilyMono),o=n.padding??8;if(r)return DN(e,n);let c=e.root,l=Ge(e.title,!1,a,i,4e3,1),u=l.height>0?l.height+12:0,h=\\\"\\\",d=0,m=0,p=0,y=0;if(c){let O=Ge(c.text,!1,a,i,200,1),v=Math.max(O.height+24,48),G=O.width+24+v/2,K=c.children.map((M,T)=>LN(M,T%2===0,a,i,s));for(let M of K)M.rise=Math.max(M.rise,v/2+14);let C=[],Z=-QE;for(let M=0;M\u003CK.length;M+=2){if(M>0){let T=0;for(let R=0;R\u003C2;R++){let _=K[M-2+R],$=K[M+R];_&&(T=Math.max(T,_.reach+($?$.boxW/2:0)))}Z-=T+NN}C.push(Z,Z)}let oe=K.length>0?Z-IN:-QE;m=G,d=oe,p=-v/2,y=v/2;let H=\\\"\\\";K.forEach((M,T)=>{let R=T%2===0?-1:1,_=C[T],$=(B,F)=>_+B-F*Ol,g=$(0,M.rise),N=R*M.rise,w=Lt-1,A=`M${f(_-Ol/Ll*w)},${f(R*w/Ll)}L${f(g)},${f(N)}`,D=\\\"\\\";for(let B of M.bones){let F=R*B.rise;if(B.depth%2===0)A+=`M${f($(B.at,B.rise))},${f(F)}H${f($(B.textEnd+yh,B.rise))}`;else{let j=M.bones[B.parent].rise;A+=`M${f($(B.at,j))},${f(R*j)}L${f($(B.at,B.rise))},${f(F)}`}let W=$(B.textEnd,B.rise);D+=Ne(B.label,W-B.label.width/2,F,B.depth>2?' fill=\\\"var(--_m)\\\"':\\\"\\\"),d=Math.min(d,W-B.label.width)}let U=N+R*(M.boxH/2);d=Math.min(d,g-M.boxW/2),m=Math.max(m,g+M.boxW/2),p=Math.min(p,U-M.boxH/2),y=Math.max(y,U+M.boxH/2),H+=`\u003Cg class=\\\"pele-ishikawa-category\\\" data-id=\\\"${Ue(M.node.text)}\\\">\u003Cpath class=\\\"pele-ishikawa-bones\\\" d=\\\"${A}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>`+_t(\\\"arrow_point\\\",_,0,Ol/Ll,-R/Ll,\\\"var(--_l)\\\")+`\u003Crect x=\\\"${f(g-M.boxW/2)}\\\" y=\\\"${f(U-M.boxH/2)}\\\" width=\\\"${f(M.boxW)}\\\" height=\\\"${f(M.boxH)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+Ne(M.label,g,U,' class=\\\"pele-label\\\"')+(D?`\u003Cg class=\\\"pele-ishikawa-causes\\\" font-size=\\\"${s}\\\">${D}\u003C/g>`:\\\"\\\")+\\\"\u003C/g>\\\"});let z=v/2;h=`\u003Cpath class=\\\"pele-ishikawa-spine\\\" d=\\\"M${f(oe)},0H${f(-(Lt-1))}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>`+_t(\\\"arrow_point\\\",0,0,1,0,\\\"var(--_l)\\\")+H+`\u003Cg class=\\\"pele-ishikawa-head\\\" data-id=\\\"${Ue(c.text)}\\\">\u003Cpath d=\\\"M0,${f(-z)}H${f(G-z)}A${f(z)},${f(z)} 0 0 1 ${f(G-z)},${f(z)}H0Z\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\" stroke-linejoin=\\\"round\\\"/>`+Ne(O,12+O.width/2,0,' class=\\\"pele-label\\\" font-weight=\\\"var(--_hw)\\\"')+\\\"\u003C/g>\\\"}let E=Math.max(m-d,l.width),b=Math.ceil(E+2*o),S=Math.ceil(y-p+u+2*o),x=o+(E-(m-d))/2-d,I=o+u-p;return{svg:at(\\\"ishikawa\\\",b,S,i,n,{},Ne(l,b/2,o+l.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(h?`\u003Cg transform=\\\"translate(${f(x)},${f(I)})\\\">${h}\u003C/g>`:\\\"\\\")),width:b,height:S,links:[]}}function DN(e,t){let n=t.fontSize??16,r=Math.round(n*.875),i=t.measurer??ct(t.fontFamily,t.fontFamilyMono),s=t.padding??8,a=Math.max(140,(t.maxWidth??320)-2*s),o=Ge(e.title,!1,i,n,kt(t),1),c=[],l=e.root?[{node:e.root,depth:0,parent:-1}]:[],u=0;for(;l.length;){let x=l.pop(),I=c.length;c.push({...x,x:0,y:0,w:0,h:0}),u=Math.max(u,x.depth);for(let L=x.node.children.length-1;L>=0;L--)l.push({node:x.node.children[L],depth:x.depth+1,parent:I})}let h=Math.min(20,Math.max(2,(a-120)/Math.max(1,u))),d=s+(o.height?o.height+12:0),m=o.width,p=\\\"\\\",y=\\\"\\\";for(let x of c){x.x=s+x.depth*h;let I=Math.max(60,a-x.depth*h-20);x.label=Zs(Ge(x.node.text,!1,i,x.depth\u003C2?n:r,I,x.depth\u003C2?1:0),i,I),x.w=x.label.width+20,x.h=x.label.height+12,x.y=d,d+=x.h+12,m=Math.max(m,x.x-s+x.w);let L=x.depth\u003C2;if(p+=`\u003Cg class=\\\"pele-node ${x.depth===0?\\\"pele-ishikawa-head\\\":x.depth===1?\\\"pele-ishikawa-category\\\":\\\"pele-ishikawa-cause\\\"}\\\" data-id=\\\"${Ue(x.node.text)}\\\">`+(L?`\u003Crect x=\\\"${f(x.x)}\\\" y=\\\"${f(x.y)}\\\" width=\\\"${f(x.w)}\\\" height=\\\"${f(x.h)}\\\" rx=\\\"${x.depth===0?12:4}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"/>`:\\\"\\\")+Ne(x.label,x.x+x.w/2,x.y+x.h/2,` class=\\\"pele-label\\\"${x.depth\u003C2?' font-weight=\\\"var(--_hw)\\\"':\\\"\\\"}${x.depth>1?` font-size=\\\"${r}\\\"`:\\\"\\\"}`)+\\\"\u003C/g>\\\",x.parent>=0){let O=c[x.parent],v=O.x+h/2;y+=`\u003Cpath class=\\\"pele-edge\\\" d=\\\"M${f(v)},${f(O.y+O.h)}V${f(x.y+x.h/2)}H${f(x.x)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"/>`}}let E=Math.ceil(m+2*s),b=Math.ceil(Math.max(s+o.height,d-12)+s),S=Ne(o,E/2,s+o.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+y+p;return{svg:at(\\\"ishikawa\\\",E,b,n,t,{},S),width:E,height:b,links:[]}}var JE={type:\\\"ishikawa\\\",parse(e,t,n){let r=new $l;return r.title=n,XE(e,r),r},render:ZE};function vl(e){let t=new Set;for(let n of e)for(let r of n.people)t.add(r);return[...t].sort()}var Dl=class{constructor(){fe(this,\\\"type\\\",\\\"journey\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"sections\\\",[]);fe(this,\\\"tasks\\\",[]);fe(this,\\\"currentSection\\\",\\\"\\\")}setDiagramTitle(t){this.title=t}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}addSection(t){this.currentSection=t,this.sections.push(t)}addTask(t,n){let r=n.substring(1).split(\\\":\\\"),i=r.length===1?[]:r[1].split(\\\",\\\").map(s=>s.trim());this.tasks.push({task:t,score:Number(r[0]),people:i,section:this.currentSection})}getActors(){return vl(this.tasks)}};function wa(e,t){let n=e.indexOf(`\\r\\n`,t);return n===-1?e.length:n}function nr(e,t,n){for(let r=0;r\u003Cn.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function Pl(e,t){let n=e.length,r=t;for(;r\u003Cn;){let i=e.charCodeAt(r);if(i===37&&e.charCodeAt(r+1)!==123)r=wa(e,r);else{if(i===10)return r;if(qe(i))do r++;while(r\u003Cn&&qe(e.charCodeAt(r)));else if(i===35)r=wa(e,r);else return r}}return r}function Eh(e,t){let n=t;for(;qe(e.charCodeAt(n));)n++;return n}function Fl(e,t,n,r){let i=nr(e,t,\\\"accdescr\\\");if(!i&&!nr(e,t,\\\"acctitle\\\"))return t;let s=e.length,a=Eh(e,t+8),o=e.charCodeAt(a),c=(l,u,h)=>{n.types.push(l),n.texts.push(e.slice(u,h)),n.starts.push(u)};if(o===58){a=Eh(e,a+1);let l=wa(e,a);return c(i?r+2:r,t,a),c(i?r+3:r+1,a,l),l}if(!i||o!==123)return t;for(a=Eh(e,a+1);e.charCodeAt(a)!==125;){let l=e.indexOf(\\\"}\\\",a);if(l===-1&&(l=s),c(r+4,a,l),a===s)return s;a=l}return a+1}var e0=[\\\"$end\\\",\\\"EOF\\\",\\\"INVALID\\\",\\\"NEWLINE\\\",\\\"journey\\\",\\\"title\\\",\\\"acc_title\\\",\\\"acc_title_value\\\",\\\"acc_descr\\\",\\\"acc_descr_value\\\",\\\"acc_descr_multiline_value\\\",\\\"section\\\",\\\"taskName\\\",\\\"taskData\\\",\\\":\\\"];function Bl(e,t,n){let r=e.length,i=t;for(;i\u003Cr;i++){let s=e.charCodeAt(i);if(s===35||s===10||s===59||n&&s===58)break}return i}function t0(e){let t=e.length,n=[],r=[],i=[],s={types:n,texts:r,starts:i},a=0,o=(c,l)=>{n.push(c),r.push(e.slice(a,l)),i.push(a),a=l};for(;a=Pl(e,a),!(a>=t);){let c=e.charCodeAt(a),l=a+1;if(c===10){for(;e.charCodeAt(l)===10;)l++;o(3,l);continue}if(nr(e,a,\\\"journey\\\")&&!ot(e.charCodeAt(a+7))){o(4,a+7);continue}if(nr(e,a,\\\"title\\\")){for(l=a+5;e.charCodeAt(l)!==10&&qe(e.charCodeAt(l));)l++;if(l===t||e.charCodeAt(l)===10){a=l;continue}let u=e.charCodeAt(a+5);if(u!==13&&qe(u)&&(l=Bl(e,a+6,!1),l>a+6)){o(5,l);continue}}if(l=Fl(e,a,s,6),l!==a){a=l;continue}if(nr(e,a,\\\"section\\\")&&qe(e.charCodeAt(a+7))&&(l=Bl(e,a+8,!0),l>a+8)){o(11,l);continue}c===58?(l=Bl(e,a+1,!1),o(l>a+1?13:14,l>a+1?l:a+1)):c===59?o(2,a+1):o(12,Bl(e,a+1,!0))}return(i.length===0||i[i.length-1]\u003Ct)&&o(1,t),o(0,t),s}var vN=\\\"'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'taskName'\\\";function n0(e,t){let{types:n,texts:r,starts:i}=t0(e),s=(a,o)=>{let c=n[a]===0?\\\"1\\\":e0[n[a]];throw ft(\\\"journey\\\",e,i[a],`Expecting ${o}, got '${c}'`)};n[0]!==4&&s(0,\\\"'journey'\\\");for(let a=1;;a++){let o=r[a];switch(n[a]){case 3:break;case 5:t.setDiagramTitle(o.substring(6));break;case 6:t.setAccTitle(r[++a].trim());break;case 8:t.setAccDescription(r[++a].trim());break;case 10:t.setAccDescription(o.trim());break;case 11:t.addSection(o.substring(8));break;case 12:n[++a]!==13&&s(a,\\\"'taskData'\\\"),t.addTask(o,r[a]);break;case 1:return;default:s(a,vN)}}}var Ul=10,ws=8,PN=124,FN=200,Wl=12,r0=6,xh=24,Ah=26,ro=11,Br=5,BN=13,WN=20,UN='\u003Ccircle cx=\\\"-3.6\\\" cy=\\\"-2.8\\\" r=\\\"1.3\\\"/>\u003Ccircle cx=\\\"3.6\\\" cy=\\\"-2.8\\\" r=\\\"1.3\\\"/>',GN={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 s0(e,t,n){return`\u003Cg class=\\\"pele-face pele-face-${n}\\\" transform=\\\"translate(${f(e)},${f(t)})\\\">\u003Ccircle r=\\\"${ro}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_l)\\\"/>\u003Cg fill=\\\"var(--_l)\\\">${UN}\u003C/g>\u003Cpath d=\\\"${GN[n]}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\"/>\u003C/g>`}function i0(e,t,n){return Pt(n,r=>YN(e,t,n,r))}function YN(e,t,n,r){let i=n.fontSize??16,s=Math.round(i*.875),a=Math.round(i*.75),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=n.padding??8;if(r)return HN(e,n);let l=e.tasks,u=l.length,h=vl(l).filter(j=>j!==\\\"\\\"),d=new Map;h.forEach((j,Q)=>d.set(j,Q));let m=PN,p=l.map(j=>br(j.task,o,s,m)),y=0;for(let j of p)y=Math.max(y,j.width);y>m&&(m=Math.min(Math.ceil(y),FN),p=l.map(j=>Wn(j.task,o,s,m)));let E=m+2*Ul,b=E+Wl,S=u>0?u*b-Wl:0,x=Math.round(s*1.5),I=Math.max(S,240),L=[],O=0,v=0,G=0;for(let j of h){let Q=Wn(j,o,s,I-2*Br-6),Y=2*Br+6+Q.width;G>0&&G+Y>I&&(G=0,v+=4);let ne=G>0?L[L.length-1].y:v,q=Math.max(Q.height,x);L.push({name:j,label:Q,x:G,y:ne,h:q}),G+=Y,O=Math.max(O,G),v=Math.max(v,ne+q),G+=WN}let K=u>0?xh+S:0,C=Wn(e.title,o,i,Math.max(K,320),1),Z=C.height>0?C.height+16:0,oe=Math.max(K,C.width,u>0?xh+O:0),H=c+(oe-K)/2+xh,z=c+Z,M=[],T=0;for(let j=0;j\u003Cu;){let Q=j+1;for(;Q\u003Cu&&l[Q].section===l[j].section;)Q++;let Y;l[j].section!==\\\"\\\"&&(Y=Wn(l[j].section,o,s,(Q-j)*b-Wl-2*Ul,1),T=Math.max(T,Math.max(Y.height,x)+2*r0)),M.push({start:j,count:Q-j,label:Y}),j=Q}let R=x;for(let j of p)R=Math.max(R,j.height);let _=h.length>0?2*Br+6:0,$=R+_+2*ws,g=z+(T>0?T+r0:0),N=g+$+ro+16,w=N+4*Ah,A=H+S,D=\\\"\\\",U=z;if(u>0){let j=\\\"\\\",Q=\\\"\\\";for(let J=5;J>=1;J--){let te=N+(5-J)*Ah;j+=`M${f(H-6)},${f(te)}H${f(A)}`,Q+=`\u003Ctext x=\\\"${f(H-12)}\\\" y=\\\"${f(te+a*.35)}\\\">${J}\u003C/text>`}D+=`\u003Cpath class=\\\"pele-grid\\\" d=\\\"${j}\\\" fill=\\\"none\\\" stroke=\\\"var(--_a)\\\"/>\u003Cg class=\\\"pele-scale\\\" font-size=\\\"${a}\\\" text-anchor=\\\"end\\\" fill=\\\"var(--_m)\\\">${Q}\u003C/g>`;let Y=\\\"\\\",ne=\\\"\\\",q=\\\"\\\",k=[];l.forEach((J,te)=>{let se=H+te*b,re=se+E/2,P=J.score,ee=Number.isNaN(P)?3:Math.min(5,Math.max(1,P)),ae=N+(5-ee)*Ah;Y+=`${te===0?\\\"M\\\":\\\"L\\\"}${f(re)},${f(ae)}`,ne+=`M${f(re)},${f(g+$)}V${f(ae-ro)}`,q+=s0(re,ae,P>3?\\\"happy\\\":P\u003C3?\\\"sad\\\":\\\"neutral\\\");let ue=\\\"\\\",ce=J.people.filter(V=>V!==\\\"\\\"),pe=Math.min(BN,(E-2*Ul-2*Br)/Math.max(ce.length-1,1));ce.forEach((V,X)=>{ue+=`\u003Ccircle class=\\\"pele-actor\\\" cx=\\\"${f(re+(X-(ce.length-1)/2)*pe)}\\\" cy=\\\"${f(g+$-ws-Br)}\\\" r=\\\"${Br}\\\" fill=\\\"${Et(d.get(V)??0)}\\\" stroke=\\\"var(--_s)\\\">\u003Ctitle>${Ue(V)}\u003C/title>\u003C/circle>`}),k.push(`\u003Cg class=\\\"pele-node pele-task\\\" data-id=\\\"${Ue(J.task.trim())}\\\">\u003Crect x=\\\"${f(se)}\\\" y=\\\"${f(g)}\\\" width=\\\"${f(E)}\\\" height=\\\"${f($)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+Ne(p[te],re,g+ws+R/2,` font-size=\\\"${s}\\\"`)+ue+\\\"\u003C/g>\\\")}),D+=`\u003Cpath class=\\\"pele-stems\\\" d=\\\"${ne}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\" stroke-dasharray=\\\"2 3\\\"/>`+(u>1?`\u003Cpath class=\\\"pele-edge\\\" d=\\\"${Y}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linejoin=\\\"round\\\"/>`:\\\"\\\")+q;for(let J of M){let te=k.slice(J.start,J.start+J.count).join(\\\"\\\");if(!J.label){D+=te;continue}let se=H+J.start*b,re=J.count*b-Wl;D+=`\u003Cg class=\\\"pele-cluster pele-section\\\" data-id=\\\"${Ue(l[J.start].section.trim())}\\\">\u003Crect x=\\\"${f(se)}\\\" y=\\\"${f(z)}\\\" width=\\\"${f(re)}\\\" height=\\\"${f(T)}\\\" fill=\\\"var(--_a)\\\"${ht}/>`+Ne(J.label,se+re/2,z+T/2,` font-size=\\\"${s}\\\" font-weight=\\\"var(--_hw)\\\"`)+te+\\\"\u003C/g>\\\"}if(U=w+ro,L.length>0){let J=H+(S-O)/2,te=U+16,se=\\\"\\\";for(let re of L){let P=te+re.y+re.h/2;se+=`\u003Cg class=\\\"pele-legend-item\\\" data-id=\\\"${Ue(re.name)}\\\">\u003Ccircle cx=\\\"${f(J+re.x+Br)}\\\" cy=\\\"${f(P)}\\\" r=\\\"${Br}\\\" fill=\\\"${Et(d.get(re.name)??0)}\\\"/>`+Ne(re.label,J+re.x+2*Br+6+re.label.width/2,P,\\\"\\\")+\\\"\u003C/g>\\\"}D+=`\u003Cg class=\\\"pele-legend\\\" font-size=\\\"${s}\\\">${se}\u003C/g>`,U=te+v}}let B=Math.ceil(oe+2*c),F=Math.ceil(Math.max(U,c)+c),W=Ne(C,c+oe/2,c+C.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+D;return{svg:at(\\\"journey\\\",B,F,i,n,e,W),width:B,height:F,links:[]}}function HN(e,t){let n=t.fontSize??16,r=Math.round(n*.875),i=t.measurer??ct(t.fontFamily,t.fontFamilyMono),s=t.padding??8,a=Math.max(140,(t.maxWidth??320)-2*s),o=Wn(e.title,i,n,a,1),c=vl(e.tasks).filter(b=>b!==\\\"\\\"),l=new Map(c.map((b,S)=>[b,S])),u=s+(o.height?o.height+16:0),h,d=\\\"\\\",m=o.width;e.tasks.forEach((b,S)=>{if(b.section!==h){h=b.section;let C=Wn(h,i,n,a-16,1);C.height&&(d+=Ne(C,s+8+C.width/2,u+C.height/2,' class=\\\"pele-cluster-label\\\" font-weight=\\\"var(--_hw)\\\"'),m=Math.max(m,C.width+16),u+=C.height+8)}let x=Wn(b.task,i,r,a-72),I=b.people.filter(C=>C!==\\\"\\\").map(C=>({name:C,label:Wn(C,i,r,a-44)})),L=Math.max(x.height,42),O=2*ws+L;for(let C of I)O+=Math.max(16,C.label.height)+4;let v=Math.max(a,x.width+72);d+=`\u003Cg class=\\\"pele-node pele-journey-step\\\" data-id=\\\"${S}\\\">\u003Crect x=\\\"${f(s)}\\\" y=\\\"${f(u)}\\\" width=\\\"${f(v)}\\\" height=\\\"${f(O)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`,d+=Ne(x,s+Ul+x.width/2,u+ws+x.height/2,' class=\\\"pele-label\\\"');let G=s+v-28;d+=s0(G,u+ws+ro,b.score>3?\\\"happy\\\":b.score\u003C3?\\\"sad\\\":\\\"neutral\\\"),Number.isNaN(b.score)||(d+=`\u003Ctext class=\\\"pele-journey-score\\\" x=\\\"${f(G)}\\\" y=\\\"${f(u+ws+2*ro+r)}\\\" font-size=\\\"${r}\\\" text-anchor=\\\"middle\\\">${f(Math.min(5,Math.max(1,b.score)))}\u003C/text>`);let K=u+ws+L+4;for(let C of I){let Z=Math.max(16,C.label.height);d+=`\u003Ccircle class=\\\"pele-actor\\\" cx=\\\"${f(s+16)}\\\" cy=\\\"${f(K+Z/2)}\\\" r=\\\"${Br}\\\" fill=\\\"${Et(l.get(C.name))}\\\"/>`+Ne(C.label,s+28+C.label.width/2,K+Z/2,` class=\\\"pele-journey-actor\\\" font-size=\\\"${r}\\\"`),K+=Z+4}d+=\\\"\u003C/g>\\\",u+=O,S+1\u003Ce.tasks.length&&(d+=`\u003Cpath class=\\\"pele-edge\\\" d=\\\"M${f(s+v/2)},${f(u)}v16\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>`),u+=16,m=Math.max(m,v)});let p=Math.ceil(m+2*s),y=Math.ceil(Math.max(s+o.height,u-(e.tasks.length?16:0))+s),E=Ne(o,p/2,s+o.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+d;return{svg:at(\\\"journey\\\",p,y,n,t,e,E),width:p,height:y,links:[]}}var o0={type:\\\"journey\\\",parse(e,t,n){let r=new Dl;return r.title=n,n0(e,r),r},render:i0};var KN=[\\\"1\\\",\\\"INVALID\\\",\\\"SPACELINE\\\",\\\"NL\\\",\\\"EOF\\\",\\\"\\\",\\\"SPACELIST\\\",\\\"ICON\\\",\\\"CLASS\\\",\\\"NODE_DSTART\\\",\\\"NODE_ID\\\",\\\"NODE_DESCR\\\",\\\"NODE_DEND\\\",\\\"SHAPE_DATA\\\"];function a0(e,t){return e===5?t?\\\"KANBAN\\\":\\\"MINDMAP\\\":KN[e]}var _s={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6};function Gl(e,t){switch(e){case\\\"[\\\":return _s.RECT;case\\\"(\\\":return t===\\\")\\\"?_s.ROUNDED_RECT:_s.CLOUD;case\\\"((\\\":return _s.CIRCLE;case\\\")\\\":return _s.CLOUD;case\\\"))\\\":return _s.BANG;case\\\"{{\\\":return _s.HEXAGON;default:return _s.DEFAULT}}var zN=/\\\\s+/y,Sh=/.+/y,VN=/[^([\\\\n){}]+/y,jN=/[^([\\\\n){}@]+/y,XN=/[^)\\\\](}]+/y,qN=/[^`\\\"]+/y,QN=/[^}^\\\"]+/y,ZN=/\\\\n\\\\s*/g;function c0(e,t,n){for(let r=0;r\u003Cn.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function wh(e,t){let n=e.length,r=[],i=[],s=[],a=t?\\\"kanban\\\":\\\"mindmap\\\",o=t?jN:VN,c=0,l=0,u=-1,h=(y,E,b)=>{r.push(y),i.push(E),s.push(l),l=b},d=(y,E,b)=>{h(y,e.slice(l,E),E),c=b},m=(y,E)=>(y.lastIndex=E,y.test(e)?y.lastIndex:-1),p=y=>{let E=e.indexOf(y,l);return E===-1?n:E};for(;l\u003Cn;){let y=e.charCodeAt(l),E=e.charCodeAt(l+1),b;if(c===0){let S=y\u003C=32||y>=160?Math.max(m(zN,l),l):l;if(t&&y===64&&E===123)h(13,\\\"\\\",l+2),c=6;else if(e.charCodeAt(S)===37&&e.charCodeAt(S+1)===37)d(2,m(Sh,S),0);else if(S>l)u\u003Cl&&(u=p(`\\r\\n`)),u>=S?d(6,S,0):(b=e.lastIndexOf(`\\r\\n`,S-1))>l?d(2,b+1,0):d(3,l+1,0);else if(c0(e,l,a)&&!ot(e.charCodeAt(l+a.length)))d(5,l+a.length,0);else if(y===58&&E===58&&e.charCodeAt(l+2)===58)l+=3,c=1;else if(y===58&&E===58&&c0(e,l+2,\\\"icon\\\")&&e.charCodeAt(l+6)===40)l+=7,c=2;else if(y===45&&E===41||y===40&&(E===45||E===40)||(y===41||y===123)&&E===y)d(9,l+2,3);else if(y===41||y===40||y===91)d(9,l+1,3);else if((b=m(o,l))!==-1)d(10,b,0);else break}else if(c===3)y===34?(c=E===96?5:4,l+=E===96?2:1):y===41||y===40?d(12,E===y||y===40&&E===45?l+2:l+1,0):y===93?d(12,l+1,0):y===125&&E===125||y===45&&E===41?d(12,l+2,0):d(11,m(y===125?Sh:XN,l),3);else if(c===4)y===34?(l++,c=3):d(11,p('\\\"'),4);else if(c===5)if(y===96&&E===34)l+=2,c=3;else if((b=m(qN,l))!==-1)d(11,b,5);else break;else if(c===1)if((b=m(Sh,l))!==-1)d(8,b,0);else if(y===10)l++,c=0;else break;else if(c===2)y===41?(l++,c=0):d(7,p(\\\")\\\"),2);else if(c===6)if(y===34)d(13,l+1,7);else if(y===125)l++,c=0;else if((b=m(QN,l))!==-1)d(13,b,6);else break;else y===34?d(13,l+1,6):(b=p('\\\"'),h(13,e.slice(l,b).replace(ZN,\\\"\u003Cbr/>\\\"),b))}return l\u003Cn?h(1,\\\"\\\",l):(c===0&&h(4,\\\"\\\",n),h(0,\\\"\\\",n)),{types:r,texts:i,starts:s}}var ci=\\\"'SPACELINE', 'NL', 'EOF'\\\",l0=new Uint8Array(14);for(let e of[2,6,7,8,9,10])l0[e]=1;function so(e){return e===2||e===3||e===4}function Yl(e,t,n){let r=n?\\\"kanban\\\":\\\"mindmap\\\",{types:i,texts:s,starts:a}=wh(e,n),o=n?\\\", 'SHAPE_DATA'\\\":\\\"\\\",c=0,l=d=>{let m=i[c];throw m===1?ft(r,e,a[c],\\\"\\\",!0):ft(r,e,a[c],`Expecting ${d}, got '${a0(m,n)}'`)},u=`'${a0(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 h=\\\"'SPACELINE', 'NL', 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'\\\";for(i[c]===3&&(c++,h=\\\"'SPACELINE', 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'\\\");;){let d=i[c],m=0,p=d===6;if(p&&(m=s[c++].length,d=i[c]),d===10||d===9){let y,E,b=0;if(d===10&&(y=s[c++]),i[c]===9){let S=s[c++];i[c]!==11&&l(\\\"'NODE_DESCR'\\\"),E=s[c++],i[c]!==12&&l(\\\"'NODE_DEND'\\\");let x=s[c++];!so(i[c])&&i[c]!==13&&l(ci+o),b=t.getType(S,x)}else!so(i[c])&&i[c]!==13&&l(ci+\\\", 'NODE_DSTART'\\\"+o),E=y;if(i[c]===13){let S=s[c++];for(;i[c]===13;)S+=s[c++];so(i[c])||l(ci+o),t.addNode(m,y??E,E,b,S)}else t.addNode(m,y??E,E,b)}else if(d===7||d===8){let y=s[c++];so(i[c])||l(ci),t.decorateNode(d===7?{icon:y}:{class:y})}else p?so(d)||l(ci+\\\", 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'\\\"):d===2?so(i[++c])||l(ci):l(h);for(c++;i[c]===3||i[c]===4;)c++;if(i[c]===0)return;l0[i[c]]===0&&l(ci+\\\", 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'\\\")}}var Hl=class{constructor(){fe(this,\\\"type\\\",\\\"kanban\\\");fe(this,\\\"title\\\");fe(this,\\\"sections\\\",[]);fe(this,\\\"getType\\\",Gl);fe(this,\\\"last\\\");fe(this,\\\"sectionLevel\\\",0);fe(this,\\\"misplaced\\\")}addNode(t,n,r,i,s){let a={id:n,level:t,label:r};if(s!==void 0){let c=s.includes(`\\r\\n`)?s+`\\r\\n`:`{\\r\\n`+s+`\\r\\n}`,l;try{l=lr(c)}catch(u){throw new Qe(`Metadata of \\\"${a.id}\\\" is not valid YAML. ${u.message}`,\\\"syntax\\\",{type:\\\"kanban\\\"})}if(l!==null&&typeof l==\\\"object\\\"&&!Array.isArray(l)){let u=l.shape?String(l.shape):\\\"\\\";if(u!==u.toLowerCase()||u.includes(\\\"_\\\"))throw new Qe(`No such shape: ${u}. Shape names should be lowercase.`,\\\"semantic\\\",{type:\\\"kanban\\\"});l.label&&(a.label=String(l.label)),l.icon&&(a.icon=String(l.icon)),l.assigned&&(a.assigned=String(l.assigned)),l.ticket&&(a.ticket=String(l.ticket)),l.priority&&(a.priority=String(l.priority))}}if(this.misplaced)throw new Qe(`Items without section detected, found section (\\\"${this.misplaced.label}\\\")`,\\\"semantic\\\",{type:\\\"kanban\\\"});let o=this.sections;if(o.length===0&&(this.sectionLevel=t),this.last=a,t===this.sectionLevel){let c=a;c.items=[],o.push(c)}else o[o.length-1].items.push(a),t\u003Cthis.sectionLevel&&(this.misplaced=a)}decorateNode(t){let n=this.last;!t||!n||(t.icon&&(n.icon=t.icon),t.class&&(n.cssClasses=t.class))}};function d0(e,t){Yl(e,t,!0)}function _a(e,t,n,r,i){return`\u003Csvg class=\\\"pele-icon\\\" data-icon=\\\"${Ue(e)}\\\" x=\\\"${f(t)}\\\" y=\\\"${f(n)}\\\" width=\\\"${f(r)}\\\" height=\\\"${f(r)}\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\">${i?.(e)??\\\"\\\"}\u003C/svg>`}var Wr=12,Ur=8,yr=10,_h=8,JN=4,Ra=6,eI=new Map([[\\\"very high\\\",`stroke=\\\"${Yo}\\\"`],[\\\"high\\\",`stroke=\\\"${Yo}\\\" opacity=\\\"0.5\\\"`],[\\\"low\\\",'stroke=\\\"var(--_m)\\\" opacity=\\\"0.5\\\"'],[\\\"very low\\\",'stroke=\\\"var(--_m)\\\"']]);function Kl(e,t,n,r,i,s=0){let a=Ge(e,t,n,r,i,s);if(a.width\u003C=i)return a;let o=[],c=[],l=0,u=[],h=0,d=()=>{o.push(u),c.push(h),l=Math.max(l,h),u=[],h=0};for(let p=0;p\u003Ca.lines.length;p++){if(a.widths[p]\u003C=i){u=a.lines[p],h=a.widths[p],d();continue}for(let y of a.lines[p]){if(y.icon!==void 0||y.math){h>0&&h+y.width>i&&d(),u.push(y),h+=y.width;continue}let E=\\\"\\\",b=h;for(let S of y.text){let x=n.width(S,r,y.style);h>0&&h+x>i&&(E&&u.push({text:E,style:y.style,width:h-b}),d(),E=\\\"\\\",b=0),E+=S,h+=x}E&&u.push({text:E,style:y.style,width:h-b})}d()}let m={...a,lines:o,widths:c,width:l,height:o.length*a.lineHeight};return a.heights?Vo(m):m}function Ta(e,t,n,r,i,s=!1){let a=\\\"\\\";for(let o=0;o\u003Ce.lines.length;o++){let c=e.lines[o],l=n+Nr(e,o);if(c.length===1&&c[0].icon===void 0&&c[0].math===void 0&&(c[0].style&56)===0)a+=`\u003Ctext${qn(r,c[0].style)} x=\\\"${f(t)}\\\" y=\\\"${f(l+e.size*.35)}\\\"${s?' text-anchor=\\\"end\\\"':\\\"\\\"}>${rt(c[0].text)}\u003C/text>`;else{let u=e.widths[o];a+=Ne(Ir(e,o),t+(s?-u:u)/2,l,r,i)}}return a}var io=e=>!!e&&Ti(e)!==\\\"\\\";function u0(e,t,n){let r=n.fontSize??16,i=Math.round(r*.875),s=Math.round(r*1.5),a=Math.round(i*1.5),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=n.icons,u=t.kanban??{},h=u.sectionWidth,d=i*1.25,m=0,p=(W,j,Q)=>{if(!(!W||!W.includes(\\\"$$\\\")))for(let Y of Ge(W,!0,o,j,1/0).lines)for(let ne of Y)ne.math&&(m=Math.max(m,ne.math.width+Q))};for(let W of e.sections){let j=o.width(String(W.items.length),i,0);p(W.label,r,2*Ur+8+j+12+(io(W.icon)?d+Ra:0));for(let Q of W.items){let Y=2*(Ur+yr);p(Q.label,i,Y+(io(Q.icon)?d+Ra:0)),p(Q.ticket,i,Y),p(Q.assigned,i,Y)}}let y=Math.max(typeof h==\\\"number\\\"&&h>0?Math.min(Math.max(h,80),2e3):200,Math.ceil(m)),E=n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth-2*c:1/0,b=e.sections.length,S=b*(y+Wr)-Wr\u003C=E,x=S?Math.max(b,1):Math.max(1,Math.floor((E+Wr)/(y+Wr))),I=S?y:Math.max(Math.min(y,E),Math.min(Math.floor((E+Wr)/x)-Wr,y*2),Math.ceil(m)),L=typeof u.ticketBaseUrl==\\\"string\\\"?u.ticketBaseUrl:\\\"\\\",O=I-2*Ur,v=O-2*yr,G=[],K=e.sections,C=[],Z=[],oe=[],H=s,z=[];for(let W of K){let j=o.width(String(W.items.length),i,0),Q=j+12+(io(W.icon)?d+Ra:0),Y=Kl(W.label,!0,o,r,O-8-Q,1);H=Math.max(H,Y.height),Z.push(j),C.push(Y);let ne=[],q=0;for(let k of W.items){let J=Kl(k.label,!0,o,i,v-(io(k.icon)?d+Ra:0)),te=Kl(k.ticket,!1,o,i,v),se=Kl(k.assigned,!1,o,i,v),re=te.width+se.width+8>v?te.height+se.height:Math.max(te.height,se.height),P=2*yr+Math.max(J.height,a)+(re?JN+re:0);ne.push({item:k,label:J,ticket:te,assigned:se,meta:re,height:P}),q+=P+_h}oe.push(ne),z.push(q)}H+=2*Ur;let M=[],T=[];for(let W=0,j=0;W\u003CK.length;W+=x){let Q=_h;for(let Y=W;Y\u003CMath.min(W+x,K.length);Y++)Q=Math.max(Q,z[Y]);T.push(j),M.push(H+Q),j+=H+Q+Wr}let R=M.length>0?T[T.length-1]+M[M.length-1]:0,_=yn(e.title,o,r,kt(n)),$=_.height>0?_.height+16:0,g=Math.max(Math.min(K.length,x)*(I+Wr)-Wr,0),N=Math.max(g,_.width),w=c+(N-g)/2,A=I-Ur-4,D=\\\"\\\";for(let W=0;W\u003CK.length;W++){let j=K[W],Q=Math.floor(W/x),Y=`\u003Crect width=\\\"${I}\\\" height=\\\"${f(M[Q])}\\\" fill=\\\"var(--_s)\\\"${ht}/>`+Ta(C[W],Ur+4,Ur,' class=\\\"pele-cluster-label\\\" font-weight=\\\"var(--_hw)\\\"',l)+`\u003Ctext class=\\\"pele-count\\\" x=\\\"${A}\\\" y=\\\"${f(Ur+s/2+i*.35)}\\\" text-anchor=\\\"end\\\" font-size=\\\"${i}\\\" fill=\\\"var(--_m)\\\">${j.items.length}\u003C/text>`;io(j.icon)&&(Y+=_a(j.icon,A-Z[W]-Ra-d,Ur+(s-d)/2,d,l));let ne=H;for(let q of oe[W]){let k=q.item,J=(k.priority??\\\"\\\").trim().toLowerCase(),te=eI.get(J),se=`\u003Crect width=\\\"${O}\\\" height=\\\"${f(q.height)}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`;te!==void 0&&(se+=`\u003Cpath class=\\\"pele-priority\\\" d=\\\"M2.5,5V${f(q.height-5)}\\\" fill=\\\"none\\\" ${te} stroke-width=\\\"3\\\" stroke-linecap=\\\"round\\\"/>`),se+=Ta(q.label,yr,yr,' class=\\\"pele-label\\\"',l),io(k.icon)&&(se+=_a(k.icon,O-yr-d,yr+(a-d)/2,d,l));let re=q.height-yr;if(k.ticket){let P=re-q.meta,ee=L?ko(Qn(L.replace(\\\"#TICKET#\\\",()=>k.ticket)),n):void 0;ee===void 0?se+=Ta(q.ticket,yr,P,' class=\\\"pele-ticket\\\" fill=\\\"var(--_m)\\\"',l):(se+=`\u003Ca href=\\\"${rt(ee)}\\\" target=\\\"_blank\\\"${qr(n)}>`+Ta(q.ticket,yr,P,' class=\\\"pele-ticket\\\" fill=\\\"var(--_c)\\\"',l)+\\\"\u003C/a>\\\",G.push({id:k.id,href:ee,internal:!1}))}k.assigned&&(se+=Ta(q.assigned,O-yr,re-q.assigned.height,' class=\\\"pele-assigned\\\" fill=\\\"var(--_m)\\\"',l,!0)),Y+=`\u003Cg class=\\\"pele-node pele-card${te===void 0?\\\"\\\":\\\" pele-priority-\\\"+J.replace(\\\" \\\",\\\"-\\\")}${It(k.cssClasses??\\\"\\\")}\\\" data-id=\\\"${Ue(k.id)}\\\" transform=\\\"translate(${Ur},${f(ne)})\\\" font-size=\\\"${i}\\\">${se}\u003C/g>`,ne+=q.height+_h}D+=`\u003Cg class=\\\"pele-cluster pele-column${It(j.cssClasses??\\\"\\\")}\\\" data-id=\\\"${Ue(j.id)}\\\" transform=\\\"translate(${f(w+W%x*(I+Wr))},${f(c+$+T[Q])})\\\">${Y}\u003C/g>`}let U=Math.ceil(N+2*c),B=Math.ceil(R+$+2*c),F=Ne(_,U/2,c+_.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+D;return{svg:at(\\\"kanban\\\",U,B,r,n,{},F),width:U,height:B,links:G}}var f0={type:\\\"kanban\\\",math:!0,parse(e,t,n){let r=new Hl;return r.title=n,d0(e,r),r},render:u0};var tI=11,zl=class{constructor(){fe(this,\\\"type\\\",\\\"mindmap\\\");fe(this,\\\"title\\\");fe(this,\\\"nodes\\\",[]);fe(this,\\\"getType\\\",Gl);fe(this,\\\"baseLevel\\\",0);fe(this,\\\"open\\\",[])}addNode(t,n,r,i){let s=this.nodes.length===0;s&&(this.baseLevel=t),t-=this.baseLevel;let a=this.open,o=a.length;for(;o>0&&a[o-1].level>=t;)o--;let c=a[o-1];if(!c&&!s)throw new Qe(`There can be only one root. No parent could be found for (\\\"${r}\\\")`,\\\"semantic\\\",{type:\\\"mindmap\\\"});let l={id:this.nodes.length,nodeId:n,level:t,descr:r,type:i,children:[],isRoot:s};c&&(l.section=c.isRoot?c.children.length%tI:c.section,c.children.push(l)),a.length=o,a.push(l),this.nodes.push(l)}decorateNode(t){let n=this.nodes[this.nodes.length-1];!t||!n||(t.icon&&(n.icon=t.icon),t.class&&(n.class=t.class))}};function h0(e,t){Yl(e,t,!1)}var nI=[\\\"\\\",\\\"rounded\\\",\\\"rect\\\",\\\"circle\\\",\\\"cloud\\\",\\\"bang\\\",\\\"hex\\\"],p0=\\\"stadium\\\",rI=36,sI=8,iI=18,oI=52,m0=28,g0=6,aI=12,cI=.22,Rh=6,Th=28,b0=12,y0=8,E0=10;function lI(e,t,n,r){if(e.lines.length\u003C2)return Ne(e,t+e.width/2,n,' class=\\\"pele-label\\\"',r);let i=\\\"\\\",s=n-e.height/2;for(let a=0;a\u003Ce.lines.length;a++)i+=Ne(Ir(e,a),t+e.widths[a]/2,s+Nr(e,a),' class=\\\"pele-label\\\"',r);return i}function x0(e,t,n){return Pt(n,r=>dI(e,t,n,r))}function dI(e,t,n,r){let i=n.fontSize??16,s=n.measurer??ct(n.fontFamily,n.fontFamilyMono),a=n.padding??8,o=n.icons,c=t.mindmap?.maxNodeWidth,l=typeof c==\\\"number\\\"&&c>0?Math.min(c,2e3):200,u=i*1.25,h=e.nodes,d=h.length,m=new Int32Array(d),p=new Int32Array(d);for(let q=0;q\u003Cd;q++)for(let k of h[q].children)m[k.id]=q,p[k.id]=p[q]+1;let y=r&&n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth-2*a:1/0,E=new Array(d),b=new Array(d),S=new Float64Array(d),x=new Float64Array(d),I=new Float64Array(d),L=new Float64Array(d),O=new Uint8Array(d);for(let q=0;q\u003Cd;q++){let k=h[q];O[q]=k.icon!==void 0&&Ti(k.icon)!==\\\"\\\"?1:0;let J=Math.min(l,Math.max(72,y-p[q]*Th-2*g0-(O[q]?u+Rh:0))),te=E[q]=Ge(k.descr,!0,s,i,J),se=te.width+(O[q]?u+(te.width>0?Rh:0):0),re=Math.max(te.height,Math.round(i*1.5)),P=nI[k.type]||(q===0?p0:\\\"\\\");if(r&&q===0&&P!==\\\"rect\\\"&&P!==\\\"rounded\\\"&&(P=p0),b[q]=P,P===\\\"\\\"){let ee=k.children.length>0;S[q]=se+2*(ee?aI:g0),x[q]=re+(ee?6:0),L[q]=x[q]/2}else{let ee=ps(P,se,re);S[q]=ee.w,x[q]=ee.h,I[q]=ee.dy,L[q]=ee.h/2}}let v=new Float64Array(d),G=new Float64Array(d),K=new Float64Array(d),C=new Float64Array(d),Z=0,oe=(q,k,J,te)=>{let se=0,re=0;for(let ae=k;ae\u003CJ;ae++){let ue=q[ae].id;G[ue]=se,re=q[ae].children.length>0||ae+1\u003CJ&&q[ae+1].children.length>0?Math.max(te,iI):te,se+=v[ue]+re}Z=se-re;let P=q[k].id,ee=q[J-1].id;return(G[P]+K[P]+L[P]+G[ee]+K[ee]+L[ee])/2};for(let q=d-1;q>0;q--){let k=h[q].children;if(k.length===0){v[q]=x[q];continue}let J=oe(k,0,k.length,sI)-L[q],te=Math.min(0,J);v[q]=Math.max(Z,J+x[q])-te,K[q]=J-te,C[q]=-te}let H=new Float64Array(d),z=new Float64Array(d),M=new Float64Array(d),T=new Int8Array(d),R=new Float64Array(d);if(r){let q=0;for(let k=0;k\u003Cd;k++)k>0&&m[k]===0&&(q+=E0),H[k]=p[k]*Th+S[k]/2,z[k]=q,q+=x[k]+E0}else if(d>0){let q=h[0].children,k=q.length,J=0;for(let P of q)J+=v[P.id];let te=k,se=1/0,re=0;for(let P=1;P\u003Ck;P++){re+=v[q[P-1].id];let ee=Math.abs(2*re-J+(2*P-k)*m0);ee\u003Cse&&(se=ee,te=P)}for(let P=0,ee=te,ae=1;P\u003Ck;P=ee,ee=k,ae=-1){let ue=oe(q,P,ee,m0);for(let ce=P;ce\u003Cee;ce++){let pe=q[ce].id;M[pe]=G[pe]-ue,T[pe]=ae}}z[0]=-x[0]/2;for(let P=0;P\u003Cd;P++){P>0&&(z[P]=M[P]+K[P]);for(let ee of h[P].children){let ae=ee.id;P>0&&(T[ae]=T[P],M[ae]=M[P]+C[P]+G[ae]),H[ae]=H[P]+T[ae]*(S[P]/2+(P>0?rI:oI)+S[ae]/2)}}}let _=0,$=0,g=0,N=0,w=\\\"\\\",A=\\\"\\\",D=\\\"\\\",U=\\\"\\\",B=q=>{D!==\\\"\\\"&&(w+=`\u003Cg class=\\\"pele-branch pele-section-${q??0}\\\">\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"${U}\\\" stroke-width=\\\"1.5\\\">${A}\u003C/g>${D}\u003C/g>`,A=D=\\\"\\\")};for(let q=1;q\u003C=d;q++){let k=q%d,J=h[k],te=b[k],se=E[k],re=H[k],P=z[k];if(_=Math.min(_,re-S[k]/2),$=Math.max($,re+S[k]/2),g=Math.min(g,P),N=Math.max(N,P+x[k]),(k===0||m[k]===0)&&B(h[q-1].section),k>0&&r){m[k]===0&&(U=Et(J.section??0));let V=m[k],X=V===0?Math.min(Math.max(b0,x[0]/2),Th-y0):b0,le=H[V]-S[V]/2+Math.min(X,S[V]/2),de=R[V]||z[V]+x[V],_e=re-S[k]/2+(te?Qr(te,S[k],x[k],3):0),xe=P+L[k],Me=Math.max(0,Math.min(y0,_e-le,xe-de));R[V]=xe-Me,A+=`\u003Cpath class=\\\"pele-edge\\\" d=\\\"M${f(le)},${f(de)}V${f(xe-Me)}Q${f(le)},${f(xe)} ${f(le+Me)},${f(xe)}H${f(_e)}\\\"/>`}else if(k>0){m[k]===0&&(U=Et(J.section??0));let V=m[k],X=T[k],le=X>0?1:3,de=H[V]+X*(S[V]/2-(b[V]?Qr(b[V],S[V],x[V],le):0)),Se=z[V]+L[V],xe=re-X*S[k]/2+(te?X*Qr(te,S[k],x[k],4-le):0),Me=P+L[k],Ce=f((de+xe)/2);A+=`\u003Cpath class=\\\"pele-edge\\\" d=\\\"M${f(de)},${f(Se)}C${Ce},${f(Se)} ${Ce},${f(Me)} ${f(xe)},${f(Me)}\\\"/>`}let ee=!te&&J.children.length>0,ae=` fill=\\\"${U}\\\" fill-opacity=\\\"${cI}\\\" stroke=\\\"${U}\\\"`,ue=\\\"\\\";te?ue=k>0?hr(te,S[k],x[k],ae,` stroke=\\\"${U}\\\"`):hr(te,S[k],x[k],' fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"',' stroke=\\\"var(--_b)\\\"'):ee&&(ue=`\u003Crect x=\\\"${f(-S[k]/2)}\\\" y=\\\"${f(-x[k]/2)}\\\" width=\\\"${f(S[k])}\\\" height=\\\"${f(x[k])}\\\" rx=\\\"${f(x[k]/2)}\\\"${ae}/>`);let ce=0;J.icon&&O[k]&&(ce=(u+(se.width>0?Rh:0))/2,ue+=_a(J.icon,-ce-se.width/2,I[k]-u/2,u,o));let pe=`\u003Cg class=\\\"pele-node pele-shape-${te||(ee?\\\"branch\\\":\\\"text\\\")}${k>0?\\\"\\\":\\\" pele-root\\\"}${It(J.class??\\\"\\\")}\\\" data-id=\\\"${Ue(J.nodeId)}\\\" transform=\\\"translate(${f(re)},${f(P+x[k]/2)})\\\">`+ue+(r&&!te?lI(se,ce-se.width/2,I[k],o):Ne(se,ce,I[k],' class=\\\"pele-label\\\"',o))+\\\"\u003C/g>\\\";k>0?D+=pe:w+=pe}let F=yn(e.title,s,i,kt(n)),W=F.height>0?F.height+16:0,j=Math.max($-_,F.width),Q=Math.ceil(j+2*a),Y=Math.ceil(N-g+W+2*a),ne=Ne(F,Q/2,a+F.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg transform=\\\"translate(${f(a-_+(j-$+_)/2)},${f(a+W-g)})\\\">${w}\u003C/g>`;return{svg:at(\\\"mindmap\\\",Q,Y,i,n,{},ne),width:Q,height:Y,links:[]}}var A0={type:\\\"mindmap\\\",math:!0,parse(e,t,n){let r=new zl;return r.title=n,h0(e,r),r},render:x0};var uI=1e4;function oo(e,t,n,r,i){let s=e.packet?.[t];return typeof s==\\\"number\\\"&&s>=r?Math.min(s,i):n}function Mh(e){return new Qe(e,\\\"semantic\\\",{type:\\\"packet\\\"})}function S0(e,t,n){let r=Math.floor(oo(t,\\\"bitsPerRow\\\",32,1,4096)),i=[],s=-1,a=[],o=1;for(let c of e.blocks){let{start:l,end:u,bits:h}=c;if(l!==void 0&&u!==void 0&&u\u003Cl)throw Mh(`Packet block ${l} - ${u} is invalid. End must be greater than start.`);if(l??=s+1,l!==s+1)throw Mh(`Packet block ${l} - ${u??l} is not contiguous. It should start from ${s+1}.`);if(h===0)throw Mh(`Packet block ${l} is invalid. Cannot have a zero bit field.`);for(u??=l+(h??1)-1,h??=u-l+1,s=u;a.length\u003C=r+1&&i.length\u003CuI;){let d=o*r-1;if(u\u003C=d){a.push({start:l,end:u,bits:h,label:c.label}),u===d&&(i.push(a),a=[],o++);break}a.push({start:l,end:d,bits:d-l,label:c.label}),i.push(a),a=[],o++,l=d+1,h=u-l}}return a.length>0&&i.push(a),{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,`\\r\\n`):void 0,bitsPerRow:r,rows:i}}var w0=[{name:\\\"packet-beta\\\",pattern:\\\"packet-beta\\\"},Jt(\\\"packet\\\"),{name:\\\"-\\\",pattern:\\\"-\\\",longer:[Ht]},{name:\\\"+\\\",pattern:\\\"+\\\"},{name:\\\":\\\",pattern:\\\":\\\"},sn,Xt,pr,{name:\\\"INT\\\",pattern:/0|[1-9][0-9]*(?!\\\\.)/y},Fn,Sn,wn,Ht,Qt,Zt];function _0(e){let t=new Ut(Yt(e,w0,\\\"packet\\\"),w0,\\\"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=Vt(t.take()),r();break;case 6:n.accTitle=zt(t.take()),r();break;case 7:n.title=Kt(t.take()),r();break;case 8:case 3:{let i={$type:\\\"PacketBlock\\\",label:\\\"\\\"};t.accept(3)?i.bits=Number(t.expect(8)):(i.start=Number(t.take()),t.accept(2)&&(i.end=Number(t.expect(8)))),t.expect(4),i.label=un(t.expect(9)),n.blocks.push(i),r();break}default:t.fail(\\\"a field, a title, or a line break\\\")}return n}function Ma(e,t,n,r,i,s=0){if(e===\\\"\\\"||t\u003C=0)return;let a=i.width(e,n,s);if(a\u003C=t)return{text:e,size:n,width:a};let o=Math.max(r,Math.floor(n*t/a));for(;o>=r;){if(a=i.width(e,o,s),a\u003C=t)return{text:e,size:o,width:a};o--}let c=Array.from(e),l=0,u=c.length-1;for(;l\u003Cu;){let d=l+u+1>>1;i.width(c.slice(0,d).join(\\\"\\\").trimEnd()+\\\"…\\\",r,s)\u003C=t?l=d:u=d-1}if(l===0)return;let h=c.slice(0,l).join(\\\"\\\").trimEnd()+\\\"…\\\";return a=i.width(h,r,s),a\u003C=t?{text:h,size:r,width:a}:void 0}function R0(e,t,n){return Pt(n,r=>fI(e,t,n,r))}function fI(e,t,n,r){let i=n.fontSize??16,s=Math.round(i*.875),a=Math.round(i*.625),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=t.packet??{},u=oo(t,\\\"rowHeight\\\",32,1,400),h=oo(t,\\\"bitWidth\\\",32,1,400),d=oo(t,\\\"paddingX\\\",5,0,400),m=oo(t,\\\"paddingY\\\",5,0,400),p=l.showBits!==!1,y=l.bitOrder===\\\"descending\\\",E=e.bitsPerRow,b=e.rows;if(r){let $=Math.max(1,Math.floor(((n.maxWidth??320)-2*c)/Math.min(h,18)));E=Math.min(E,Math.max(8,2**Math.floor(Math.log2($))));let g=e.rows[e.rows.length-1],N=g?.[g.length-1]?.end??0;Math.ceil((N+1)/E)>1e4&&(E=e.bitsPerRow),h=Math.min(h,Math.max(18,((n.maxWidth??320)-2*c)/E));let w=D=>D.bits===D.end-D.start,A=[];for(let D of e.rows)for(let U of D){let B=A[A.length-1];B&&w(B)&&w(U)&&B.label===U.label&&U.start===B.end+1&&U.start%e.bitsPerRow===0?(B.end=U.end,B.bits=B.end-B.start):A.push({...U})}b=[];for(let D of A)for(let U=D.start;U\u003C=D.end;){let B=Math.min(D.end,(Math.floor(U/E)+1)*E-1),F=Math.floor(U/E);(b[F]??(b[F]=[])).push({...D,start:U,end:B}),U=B+1}}let S=new Map;if(r)for(let $ of b)for(let g of $){let N=Math.max(1,(g.end-g.start+1)*h-Math.min(d,h-1)-6),w=Qs(bt(g.label).trim(),o,s,N);S.set(g,w)}let x=p?a+4:0,I=b.map($=>{let g=u;if(r)for(let N of $)g=Math.max(g,S.get(N).height+10);return g}),L=[],O=0;for(let $ of I)L.push(O),O+=x+$+m;b.length&&(O-=m);let v=Math.min(d,h-1),G=b.length>0?E*h-v:0,K=Ge(e.title,!1,o,i,r?kt(n):4e3,1),C=K.height>0?K.height+(O>0?12:0):0,Z=new Map,oe=($,g)=>{let N=Z.get($);return N||Z.set($,N=new Map),N.has(g)||N.set(g,Ma(bt($).trim(),g,s,Math.round(i*.5),o)),N.get(g)},H=c+Math.max(0,(K.width-G)/2),z=\\\"\\\",M=\\\"\\\";b.forEach(($,g)=>{let N=c+L[g]+x,w=I[g];for(let A of $){let D=A.end-A.start+1,U=A.start%E,B=H+(y?E-U-D:U)*h,F=D*h-v,W=r?void 0:oe(A.label,F-6);if(z+=`\u003Cg class=\\\"pele-node\\\" data-id=\\\"${A.start}-${A.end}\\\">\u003Crect x=\\\"${f(B)}\\\" y=\\\"${f(N)}\\\" width=\\\"${f(F)}\\\" height=\\\"${f(w)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+(r?Ne(S.get(A),B+F/2,N+w/2,\\\"\\\"):W&&W.size\u003C=w?`\u003Ctext x=\\\"${f(B+F/2)}\\\" y=\\\"${f(N+w/2+W.size*.35)}\\\"${W.size===s?\\\"\\\":` font-size=\\\"${f(W.size)}\\\"`}>${rt(W.text)}\u003C/text>`:\\\"\\\")+\\\"\u003C/g>\\\",!p)continue;let j=y?A.end:A.start,Q=y?A.start:A.end;D===1?M+=`\u003Ctext x=\\\"${f(B+F/2)}\\\" y=\\\"${f(N-4)}\\\" text-anchor=\\\"middle\\\">${j}\u003C/text>`:M+=`\u003Ctext x=\\\"${f(B)}\\\" y=\\\"${f(N-4)}\\\">${j}\u003C/text>\u003Ctext x=\\\"${f(B+F)}\\\" y=\\\"${f(N-4)}\\\" text-anchor=\\\"end\\\">${Q}\u003C/text>`}});let T=Math.ceil(Math.max(G,K.width)+2*c),R=Math.ceil(O+C+2*c),_=(z?`\u003Cg class=\\\"pele-packet-fields\\\" font-size=\\\"${s}\\\" text-anchor=\\\"middle\\\">${z}\u003C/g>`:\\\"\\\")+(M?`\u003Cg class=\\\"pele-packet-bits\\\" font-size=\\\"${a}\\\" fill=\\\"var(--_m)\\\">${M}\u003C/g>`:\\\"\\\")+Ne(K,T/2,R-c-K.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"');return{svg:at(\\\"packet\\\",T,R,i,n,e,_),width:T,height:R,links:[]}}var T0={type:\\\"packet\\\",parse:(e,t,n)=>S0(_0(e),t,n),render:R0};function M0(e,t){let n=new Map;for(let{label:r,value:i}of e.sections){if(i\u003C0)throw new Qe(`\\\"${r}\\\" has invalid value: ${i}. Negative values are not allowed in pie charts. All slice values must be >= 0.`,\\\"semantic\\\",{type:\\\"pie\\\"});n.has(r)||n.set(r,i)}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,`\\r\\n`):void 0,showData:e.showData,sections:n}}function C0(e,t){let n=t;for(let r=e.charCodeAt(n);r>=48&&r\u003C=57;r=e.charCodeAt(n))n++;return n}function hI(){let e=0,t=0,n=-1;return(r,i)=>{let s=r.charCodeAt(i)===45?i+1:i;if((s\u003Ce||s>=t)&&(e=s,t=C0(r,s),n=-1,t>s&&r.charCodeAt(t)===46)){let a=C0(r,t+1),o=a-t-1;o>0&&r.charCodeAt(a)!==46?n=a:o>1&&(n=a-1)}return t===s?-1:n>=0?n:r.charCodeAt(s)===48?r.charCodeAt(s+1)===46?-1:s+1:r.charCodeAt(t)!==46?t:t-1>s?t-1:-1}}var N0=[Jt(\\\"showData\\\"),Jt(\\\"pie\\\"),{name:\\\":\\\",pattern:\\\":\\\"},{name:\\\"NUMBER_PIE\\\",pattern:/(?:-?[0-9]+\\\\.[0-9]+(?!\\\\.))|(?:-?(0|[1-9][0-9]*)(?!\\\\.))/y,scanner:hI,first:\\\"-0123456789\\\"},sn,Xt,pr,Fn,Sn,wn,Ht,Qt,Zt];function I0(e){let t=new Ut(Yt(e,N0,\\\"pie\\\"),N0,\\\"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=Vt(t.take()),r();break;case 5:n.accTitle=zt(t.take()),r();break;case 6:n.title=Kt(t.take()),r();break;case 7:{let i=un(t.take());t.expect(2);let s=Number(t.expect(3));n.sections.push({$type:\\\"PieSection\\\",label:i,value:s}),r();break}default:t.fail(\\\"a section, a title, or a line break\\\")}return n}var pI=120,Ca=12,Ch=26,Nh=32,k0=28;function Ih(e,t){return e.pie?.[t]}function ao(e,t){return`${f(Math.sin(e)*t)},${f(-Math.cos(e)*t)}`}function mI(e,t,n,r){if(t-e>=Math.PI*2-1e-9){let s=(a,o)=>`M0,${f(-a)}A${f(a)},${f(a)} 0 1 ${o} 0,${f(a)}A${f(a)},${f(a)} 0 1 ${o} 0,${f(-a)}Z`;return s(n,1)+(r>0?s(r,0):\\\"\\\")}let i=t-e>Math.PI?1:0;return r\u003C=0?`M0,0L${ao(e,n)}A${f(n)},${f(n)} 0 ${i} 1 ${ao(t,n)}Z`:`M${ao(e,n)}A${f(n)},${f(n)} 0 ${i} 1 ${ao(t,n)}L${ao(t,r)}A${f(r)},${f(r)} 0 ${i} 0 ${ao(e,r)}Z`}function $0(e,t,n){return ms(n,pI*2,140,(r,i)=>gI(e,t,n,r/2,i))}function gI(e,t,n,r,i){let s=n.fontSize??16,a=Math.round(s*.875),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=Ih(t,\\\"textPosition\\\"),u=typeof l==\\\"number\\\"&&l>=0&&l\u003C=1?l:.75,h=Ih(t,\\\"donutHole\\\"),d=typeof h==\\\"number\\\"&&h>0&&h\u003C=.9?h*r:0,m=String(Ih(t,\\\"legendPosition\\\")??\\\"right\\\"),p=i&&(m===\\\"left\\\"||m===\\\"right\\\")?\\\"bottom\\\":m,y=[...e.sections],E=0;for(let[,Q]of y)E+=Q;let b=y.map(([Q,Y])=>Ge(e.showData?`${Q} [${Y}]`:Q,!1,o,a,4e3)),S=0;for(let Q of b)S=Math.max(S,Q.width);S+=b.length>0?Ca+8:0;let x=b.length*Ch,I=Ge(e.title,!1,o,s,kt(n),1),L=I.height>0?I.height+16:0,O=y.map(([,Q])=>{let Y=E>0?Q/E:0;return Y*100>=1&&(Y*100).toFixed(0)!==\\\"0\\\"?Y:0}),v=O.map(Q=>Q===0||Q>=.5?!1:2*r*u*Math.sin(Q*Math.PI)\u003Co.width((Q*100).toFixed(0)+\\\"%\\\",a,0)+6),G=v.includes(!0)?k0:0,K=p===\\\"left\\\"||p===\\\"right\\\"||p===\\\"center\\\"?p:\\\"\\\",C=p===\\\"top\\\"||p===\\\"bottom\\\",Z=(r+G)*2,oe=Z,H=Z;K===\\\"left\\\"||K===\\\"right\\\"?(oe+=S>0?Nh+S:0,H=Math.max(H,x)):C&&(oe=Math.max(oe,S),H+=x>0?20+x:0),oe=Math.max(oe,I.width);let z=c+(K===\\\"left\\\"?S+Nh+Z/2:K===\\\"right\\\"?Z/2:oe/2),M=c+L,T=M+(p===\\\"top\\\"?x+20+Z/2:C?Z/2:H/2),R=\\\"\\\",_=\\\"\\\",$=\\\"\\\",g=0,N=r+k0/2,w=[],A=(Q,Y,ne)=>w.every(q=>Math.abs(Q-q.x)>=(ne+q.width)/2+2||Math.abs(Y-q.y)>=a+2);y.forEach(([Q],Y)=>{let ne=O[Y];if(ne===0)return;let q=g+ne*Math.PI*2;R+=`\u003Cpath class=\\\"pele-slice\\\" data-id=\\\"${Ue(Q)}\\\" d=\\\"${mI(g,q,r,d)}\\\" fill=\\\"${Et(Y)}\\\"/>`;let k=(g+q)/2,J=(ne*100).toFixed(0)+\\\"%\\\";if(v[Y]){let te=o.width(J,a,0),se=k;for(let ee=0;ee\u003C360&&!A(Math.sin(se)*N,-Math.cos(se)*N,te);ee++)se+=2/N;let re=Math.sin(se)*N,P=-Math.cos(se)*N;w.push({x:re,y:P,width:te}),$+=`\u003Ctext x=\\\"${f(re)}\\\" y=\\\"${f(P+a*.35)}\\\">${J}\u003C/text>`}else{let te=r*u;_+=`\u003Ctext x=\\\"${f(Math.sin(k)*te)}\\\" y=\\\"${f(-Math.cos(k)*te+a*.35)}\\\"${fs(Y)}>${J}\u003C/text>`}g=q}),R===\\\"\\\"&&(R=`\u003Ccircle class=\\\"pele-slice\\\" r=\\\"${r}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"/>`);let D=\\\"\\\",U,B;K===\\\"right\\\"?(U=z+Z/2+Nh,B=M+(H-x)/2):K===\\\"left\\\"?(U=c,B=M+(H-x)/2):K===\\\"center\\\"?(U=z-S/2,B=T-x/2):(U=c+(oe-S)/2,B=p===\\\"top\\\"?M:M+Z+20),b.forEach((Q,Y)=>{let ne=B+Y*Ch+Ch/2;D+=`\u003Cg class=\\\"pele-legend-item\\\" data-id=\\\"${Ue(y[Y][0])}\\\">\u003Crect x=\\\"${f(U)}\\\" y=\\\"${f(ne-Ca/2)}\\\" width=\\\"${Ca}\\\" height=\\\"${Ca}\\\" rx=\\\"2\\\" fill=\\\"${Et(Y)}\\\"/>`+Ne(Q,U+Ca+8+Q.width/2,ne,\\\"\\\")+\\\"\u003C/g>\\\"});let F=Math.ceil(oe+2*c),W=Math.ceil(H+L+2*c),j=Ne(I,F/2,c+I.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg class=\\\"pele-slices\\\" transform=\\\"translate(${f(z)},${f(T)})\\\" stroke=\\\"var(--_bg)\\\" stroke-width=\\\"1\\\" stroke-linejoin=\\\"round\\\">${R}\u003C/g>`+(_?`\u003Cg class=\\\"pele-slice-labels\\\" transform=\\\"translate(${f(z)},${f(T)})\\\" font-size=\\\"${a}\\\" text-anchor=\\\"middle\\\" fill=\\\"var(--_bg)\\\">${_}\u003C/g>`:\\\"\\\")+($?`\u003Cg class=\\\"pele-slice-labels\\\" transform=\\\"translate(${f(z)},${f(T)})\\\" font-size=\\\"${a}\\\" text-anchor=\\\"middle\\\">${$}\u003C/g>`:\\\"\\\")+(D?`\u003Cg class=\\\"pele-legend\\\" font-size=\\\"${a}\\\">${D}\u003C/g>`:\\\"\\\");return{svg:at(\\\"pie\\\",F,W,s,n,e,j),width:F,height:W,links:[]}}var L0={type:\\\"pie\\\",parse:(e,t,n)=>M0(I0(e),n),render:$0};var bI=/^\\\\d+$/,O0=/^#?([\\\\dA-Fa-f]{6}|[\\\\dA-Fa-f]{3})$/,yI=/^\\\\d+px$/;function Vl(e,t,n){return new Qe(`value for ${e} ${t} is invalid, please use a valid ${n}`,\\\"semantic\\\",{type:\\\"quadrantChart\\\"})}function EI(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 D0(e){let t={};for(let n of e){let[r,i]=EI(n);if(r===\\\"radius\\\"){if(!bI.test(i))throw Vl(r,i,\\\"number\\\");t.radius=parseInt(i)}else if(r===\\\"color\\\"){if(!O0.test(i))throw Vl(r,i,\\\"hex code\\\");t.color=i}else if(r===\\\"stroke-color\\\"){if(!O0.test(i))throw Vl(r,i,\\\"hex code\\\");t.strokeColor=i}else if(r===\\\"stroke-width\\\"){if(!yI.test(i))throw Vl(r,i,\\\"number of pixels (eg. 10px)\\\");t.strokeWidth=i}else throw new Qe(`style named ${r} is not supported.`,\\\"semantic\\\",{type:\\\"quadrantChart\\\"})}return t}function ns(e){return{text:e.text.trim(),type:e.type}}var jl=class{constructor(){fe(this,\\\"type\\\",\\\"quadrantChart\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"quadrants\\\",[void 0,void 0,void 0,void 0]);fe(this,\\\"xAxisLeft\\\");fe(this,\\\"xAxisRight\\\");fe(this,\\\"yAxisBottom\\\");fe(this,\\\"yAxisTop\\\");fe(this,\\\"points\\\",[]);fe(this,\\\"classes\\\",new Map)}setQuadrant1Text(t){this.quadrants[0]=ns(t)}setQuadrant2Text(t){this.quadrants[1]=ns(t)}setQuadrant3Text(t){this.quadrants[2]=ns(t)}setQuadrant4Text(t){this.quadrants[3]=ns(t)}setXAxisLeftText(t){this.xAxisLeft=ns(t)}setXAxisRightText(t){this.xAxisRight=ns(t)}setYAxisBottomText(t){this.yAxisBottom=ns(t)}setYAxisTopText(t){this.yAxisTop=ns(t)}addPoint(t,n,r,i,s){this.points.push({x:Number(r),y:Number(i),text:ns(t),className:n,...D0(s)})}addClass(t,n){this.classes.set(t,D0(n))}setDiagramTitle(t){this.title=t}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}};function pn(e,t,n){for(let r=0;r\u003Cn.length;r++){let i=e.charCodeAt(t+r),s=n.charCodeAt(r);if(i!==s&&!(s>=97&&s\u003C=122&&i===s-32))return!1}return!0}var kh=[\\\"$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\\\"];var $h=[41,4,6,8,9,19],Lh=new Uint8Array(128);for(let[e,t]of[[\\\":\\\",27],[\\\"+\\\",28],[\\\",\\\",29],[\\\"=\\\",30],[\\\"*\\\",31],[\\\"#\\\",32],[\\\"_\\\",33],[\\\".\\\",34],[\\\"&\\\",35],[\\\"-\\\",36],[\\\" \\t\\\\v\\\\f\\\",38],[\\\";\\\",39],[\\\"!$%'`?\\\\\\\\/\\\",40]])for(let n=0;n\u003Ce.length;n++)Lh[e.charCodeAt(n)]=t;function v0(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=0,l=0,u=0,h=0,d=0,m=0,p=0,y=0,E=(v,G,K)=>{n.push(v),r.push(e.slice(G,K)),i.push(G),o=K},b=v=>{s.push(a),a=v},S=()=>{s.length>0&&(a=s.pop())},x=v=>{let G=e.indexOf(`\\r\\n`,v);return G===-1?t:G},I=v=>{for(;e.charCodeAt(v)===32;)v++;return v},L=v=>{for(;v\u003Ct&&qe(e.charCodeAt(v));)v++;return v},O=v=>{let G=e.charCodeAt(v);if(G===49)return v+1;if(G!==48)return-1;let K=v+1;if(K\u003Ct&&!Us(e.charCodeAt(K))&&xt(e.charCodeAt(K+1)))for(K+=2;xt(e.charCodeAt(K));)K++;return K};e:for(;o\u003Ct;){let v=e.charCodeAt(o),G=e.charCodeAt(o+1);switch(a){case 0:break;case 1:case 2:case 3:E($h[a],o,x(o)),S();continue;case 4:if(v===125)o++,S();else{let M=e.indexOf(\\\"}\\\",o);E(9,o,M===-1?t:M)}continue;case 5:if(v===34)o++,S();else{let M=e.indexOf('\\\"',o);E(19,o,M===-1?t:M)}continue;case 6:if(v===96&&G===34){o+=2,S();continue}if(v!==96&&v!==34){let M=o+1;for(let T=e.charCodeAt(M);M\u003Ct&&T!==96&&T!==34;T=e.charCodeAt(++M));E(18,o,M);continue}break e;case 7:if(ot(v)){let M=o+1;for(;ot(e.charCodeAt(M));)M++;E(20,o,M),S();continue}break e;case 8:{let M=O(o);if(M!==-1){E(22,o,M),b(9);continue}let T=L(o);if(e.charCodeAt(T)===93){o=I(T+1),S();continue}break e}case 9:{let M=L(o);if(e.charCodeAt(M)===44){o=L(M+1),a=10;continue}break e}case 10:{let M=O(o);if(M!==-1){E(23,o,M),S();continue}break e}}if(v===37&&G===37){o=x(o+2);continue}if(v===10||v===13){let M=o+1;for(let T=e.charCodeAt(M);T===10||T===13;T=e.charCodeAt(++M));E(2,o,M);continue}let K=v|32;if(K===116&&pn(e,o,\\\"title\\\")&&!ot(e.charCodeAt(o+5))){E(3,o,o+5),b(1);continue}if(K===97&&pn(e,o,\\\"acc\\\")){let M=pn(e,o+3,\\\"descr\\\");if(M||pn(e,o+3,\\\"title\\\")){let T=L(o+8),R=e.charCodeAt(T);if(R===58){E(M?7:5,o,L(T+1)),b(M?3:2);continue}if(R===123&&M){o=L(T+1),b(4);continue}}}let C=o;v===32&&((o\u003Cc||o>=l)&&(c=o,l=I(o)),C=l);let Z=e.charCodeAt(C),oe=Z|32,H=0,z=0;if(oe===120&&pn(e,C,\\\"x-axis\\\"))H=10,z=C+6;else if(oe===121&&pn(e,C,\\\"y-axis\\\"))H=11,z=C+6;else if(Z===45){if(C\u003Cu||C>=h)for(u=C,h=C;e.charCodeAt(h)===45;)h++;h-C>=2&&e.charCodeAt(h)===62&&(H=12,z=h+1)}else if(oe===113&&pn(e,C,\\\"quadrant\\\")){let M=e.charCodeAt(C+9);e.charCodeAt(C+8)===45&&M>=49&&M\u003C=52?(H=13+M-49,z=C+10):pn(e,C+8,\\\"chart\\\")&&(H=24,z=C+13)}if(H!==0){E(H,o,I(z));continue}if(K===99&&pn(e,o,\\\"classdef\\\")&&!ot(e.charCodeAt(o+8))){E(17,o,o+8);continue}if(v===34){G===96?(o+=2,b(6)):(o++,b(5));continue}if(v===58&&G===58&&e.charCodeAt(o+2)===58){o+=3,b(7);continue}if(v===58||qe(v)){let M=o;if(v!==58&&((o\u003Cd||o>=m)&&(d=o,m=L(o)),M=m),e.charCodeAt(M)===58&&((M+1\u003Cp||M+1>=y)&&(p=M+1,y=L(M+1)),e.charCodeAt(y)===91)){E(21,o,L(y+1)),b(8);continue}}if(Vr(v)){let M=o+1;for(;Vr(e.charCodeAt(M));)M++;E(25,o,M);continue}if(v>=128){let M=o+1;for(;e.charCodeAt(M)>=128;)M++;E(26,o,M);continue}if(xt(v)){let M=o+1;for(;xt(e.charCodeAt(M));)M++;E(37,o,M);continue}if(Lh[v]!==0){E(Lh[v],o,o+1);continue}break}return o\u003Ct?(n.push(1),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i}):(a\u003C$h.length&&(n.push($h[a]),r.push(\\\"\\\"),i.push(t)),n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i})}function Xl(...e){let t=new Uint8Array(42);for(let n of e)t[n]=1;return t}var P0=Xl(40,35,37,25,29,28,30,31,34,32,33,26),F0=Xl(25,37,36,29,27,35,32,31,26),Oh=Xl(25,37,27,38,32,36),B0=Xl(2,39,41),xI=[\\\"setQuadrant1Text\\\",\\\"setQuadrant2Text\\\",\\\"setQuadrant3Text\\\",\\\"setQuadrant4Text\\\"],AI=\\\"'STR', 'MD_STR', 'ALPHA', 'NUM', 'UNICODE_TEXT', 'PUNCTUATION'\\\";function W0(e,t){let{types:n,texts:r,starts:i}=v0(e),s=0,a=h=>{let d=n[s];throw d===1?ft(\\\"quadrantChart\\\",e,i[s],\\\"\\\",!0):ft(\\\"quadrantChart\\\",e,i[s],`Expecting ${h}, got '${kh[d]}'`)},o=h=>(n[s]!==h&&a(`'${kh[h]}'`),r[s++]),c=h=>h===19||h===18||P0[h]===1,l=()=>{let h=n[s];c(h)||a(AI);let d=r[s++];for(;P0[n[s]]===1||n[s]===38||n[s]===36;)d+=r[s++];return{text:d,type:h===18?\\\"markdown\\\":\\\"text\\\"}},u=()=>{let h=[];for(;;){Oh[n[s]]===0&&a(\\\"'ALPHA', 'NUM', 'COLON', 'SPACE', 'BRKT', 'MINUS'\\\");let d=r[s++];for(;Oh[n[s]]===1;)d+=r[s++];if(h.push(d.trim()),n[s]!==29)return h;s++}};for(;B0[n[s]]===1||n[s]===38;)s++;for(o(24);n[s]!==0;){for(;n[s]===38;)s++;let h=n[s];switch(h){case 17:{s++,o(38),F0[n[s]]===0&&a(\\\"'ALPHA', 'NUM', 'UNICODE_TEXT'\\\");let d=r[s++];for(;F0[n[s]]===1;)d+=r[s++];o(38),t.addClass(d,u());break}case 10:case 11:{s++;let d=l(),m;n[s]===12&&(s++,c(n[s])?m=l():d.text+=\\\" ⟶ \\\"),h===10?(t.setXAxisLeftText(d),m&&t.setXAxisRightText(m)):(t.setYAxisBottomText(d),m&&t.setYAxisTopText(m));break}case 13:case 14:case 15:case 16:s++,t[xI[h-13]](l());break;case 3:s++,t.setDiagramTitle(o(4).trim());break;case 5:s++,t.setAccTitle(o(6).trim());break;case 7:s++,t.setAccDescription(o(8).trim());break;case 9:t.setAccDescription(r[s++].trim());break;default:if(c(h)){let d=l(),m=n[s]===20?r[s++]:\\\"\\\";o(21);let p=o(22),y=o(23);t.addPoint(d,m,p,y,Oh[n[s]]===1?u():[])}}B0[n[s]]===0&&a(\\\"'NEWLINE', 'SEMI', 'EOF'\\\"),s++}}var U0=4,SI=300;function ql(e,t){return e.quadrantChart?.[t]}function rs(e,t,n,r){let i=ql(e,t);return typeof i==\\\"number\\\"&&i>=0?Math.min(i,r):n}function Na(e,t,n){let r=ql(e,t);return typeof r==\\\"number\\\"&&Number.isFinite(r)?Math.min(72,Math.max(4,r)):n}function G0(e){return e.startsWith(\\\"#\\\")?e:\\\"#\\\"+e}function Y0(e,t,n){let r=n.fontSize??16,i=Na(t,\\\"titleFontSize\\\",r),s=Na(t,\\\"quadrantLabelFontSize\\\",r),a=Na(t,\\\"xAxisLabelFontSize\\\",Math.round(r*.875)),o=Na(t,\\\"yAxisLabelFontSize\\\",Math.round(r*.875)),c=Na(t,\\\"pointLabelFontSize\\\",Math.round(r*.75)),l=(P,ee)=>P===ee?\\\"\\\":` font-size=\\\"${P}\\\"`,u=n.measurer??ct(n.fontFamily,n.fontFamilyMono),h=Math.round(Math.max(100,rs(t,\\\"chartWidth\\\",500,4e3))),d=Math.round(gs(n,h,280)),m=Math.round(Math.max(100,rs(t,\\\"chartHeight\\\",500,4e3))*d/h),p=rs(t,\\\"quadrantPadding\\\",n.padding??8,200),y=rs(t,\\\"xAxisLabelPadding\\\",5,200),E=rs(t,\\\"yAxisLabelPadding\\\",5,200),b=e.points.length>0,S=(P,ee,ae)=>Ge(P?.text,P?.type===\\\"markdown\\\",u,ee,Math.max(ae,40)),x=Ge(e.title,!1,u,i,Math.max(d-2*p,40),1),I=rs(t,\\\"titlePadding\\\",10,200),L=x.height>0?x.height+I:0,O=!!(e.xAxisLeft?.text||e.xAxisRight?.text),v=!!(e.yAxisBottom?.text||e.yAxisTop?.text),G=b||ql(t,\\\"xAxisPosition\\\")===\\\"bottom\\\",K=ql(t,\\\"yAxisPosition\\\")===\\\"right\\\",C=d-2*p,Z=S(e.xAxisLeft,a,e.xAxisRight?C/2-16:C),oe=S(e.xAxisRight,a,C/2-16),H=Math.max(Z.height,oe.height),z=O?H+y:0,M=m-2*p-L-z,T=S(e.yAxisBottom,o,e.yAxisTop?M/2-16:M),R=S(e.yAxisTop,o,M/2-16),_=Math.max(T.height,R.height),$=v?_+E:0,g=p+(K?0:$),N=p+L+(G?0:z),w=Math.max(0,C-$),A=Math.max(0,M),D=Math.max(0,(w-U0)/2),U=Math.max(0,(A-U0)/2),B=[g+D,N,g+w-D,N+A,g,N+U,g+w,N+A-U],F=(P,ee,ae,ue,ce)=>{for(let pe=P;pe\u003CB.length;pe+=4)if(!(B[pe]>=B[pe+2]||B[pe+1]>=B[pe+3])&&ee\u003CB[pe+2]&&ue>B[pe]&&ae\u003CB[pe+3]&&ce>B[pe+1])return!1;return!0},W=rs(t,\\\"quadrantTextTopPadding\\\",5,200),j=\\\"\\\";for(let P=0;P\u003C4;P++){let ee=P===0||P===3?g+w-D:g,ae=P\u003C2?N:N+A-U,ue=S(e.quadrants[P],s,D-16),ce=ee+D/2,pe=b?ae+W+ue.height/2:ae+U/2;B.push(ce-ue.width/2,pe-ue.height/2,ce+ue.width/2,pe+ue.height/2),j+=`\u003Cg class=\\\"pele-quadrant\\\" data-id=\\\"${P+1}\\\">\u003Crect x=\\\"${f(ee)}\\\" y=\\\"${f(ae)}\\\" width=\\\"${f(D)}\\\" height=\\\"${f(U)}\\\"${ht}/>`+Ne(ue,ce,pe,` class=\\\"pele-label\\\"${l(s,r)} fill=\\\"var(--_fg)\\\" stroke=\\\"none\\\"`)+\\\"\u003C/g>\\\"}let Q=\\\"\\\";if(O){let P=G?N+A+y+H/2:N-y-H/2;Q+=Ne(Z,oe.height>0?g+w/4:g+Z.width/2,P,\\\"\\\")+Ne(oe,g+w*3/4,P,\\\"\\\")}if(v){let P=K?g+w+E+_/2:g-E-_/2,ee=(ae,ue)=>ae.height>0?`\u003Cg transform=\\\"translate(${f(P)},${f(ue)}) rotate(-90)\\\"${l(o,a)}>${Ne(ae,0,0,\\\"\\\")}\u003C/g>`:\\\"\\\";Q+=ee(T,R.height>0?N+A*3/4:N+A-T.width/2)+ee(R,N+A/4)}let Y=rs(t,\\\"pointRadius\\\",5,200),ne=rs(t,\\\"pointTextPadding\\\",5,200),q=Et(0),k=[],J=[];for(let P of e.points){if(!(P.x>=0&&P.x\u003C=1&&P.y>=0&&P.y\u003C=1))continue;let ee=e.classes.get(P.className),ae=Math.min(P.radius??ee?.radius??Y,2e3),ue=P.color??ee?.color,ce=P.strokeColor??ee?.strokeColor,pe=P.strokeWidth??ee?.strokeWidth,V=[];ue&&V.push(\\\"fill:\\\"+G0(ue)),pe&&(ce&&V.push(\\\"stroke:\\\"+G0(ce)),V.push(\\\"stroke-width:\\\"+pe));let X=g+P.x*w,le=N+(1-P.y)*A;k.push({cx:X,cy:le,reach:ae+(pe?Math.min(parseInt(pe),400)/2:0),text:S(P.text,c,w)}),J.push(`\u003Ccircle class=\\\"pele-point${It(P.className)}\\\" data-id=\\\"${Ue(P.text.text)}\\\" cx=\\\"${f(X)}\\\" cy=\\\"${f(le)}\\\" r=\\\"${f(ae)}\\\"${pe&&!ce?` stroke=\\\"${q}\\\"`:\\\"\\\"}${Ct(V).shape}/>`)}let te=k.length\u003C=SI;if(te)for(let{cx:P,cy:ee,reach:ae}of k)B.push(P-ae,ee-ae,P+ae,ee+ae);let se=\\\"\\\";for(let{cx:P,cy:ee,reach:ae,text:ue}of k){let ce=ue.width/2,pe=ue.size*.6+(ue.height-ue.lineHeight)/2,V=ae+ne,X=Math.min(V,Math.max(0,(D-ue.width)/2)),le=8+4*(P\u003Cg+w/2?ee\u003CN+A/2?1:2:ee\u003CN+A/2?0:3),de=Math.max(ee+V,B[le+3]+ne)+pe,Se=[P,ee+V+pe,P,ee-V-pe,P+V+ce,ee,P-V-ce,ee,P,de],_e=P,xe=Se[1],Me=!1;for(let Ce=0;Ce\u003C20;Ce+=2){let ke=Ce%10,be=ke===8?X:0,Ae=(ke\u003C4||ke===8)&&ue.width\u003Cw?Math.min(Math.max(Se[ke],g+ce+be),g+w-ce-be):Se[ke],ie=Se[ke+1];if(Ae-ce\u003Cg||Ae+ce>g+w||ie-pe\u003CN||ie+pe>N+A)continue;let me=!te||F(Ce\u003C10?0:8,Ae-ce,ie-pe,Ae+ce,ie+pe);if((!Me||me)&&(_e=Ae,xe=ie,Me=!0),me)break}te&&B.push(_e-ce,xe-pe,_e+ce,xe+pe),se+=Ne(ue,_e,xe,' class=\\\"pele-label\\\"')}let re=Ne(x,d/2,I/2+x.height/2,` class=\\\"pele-title\\\"${l(i,r)} font-weight=\\\"var(--_tw)\\\"`)+`\u003Cg class=\\\"pele-quadrants\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\">${j}\u003C/g>`+(Q?`\u003Cg class=\\\"pele-axis-labels\\\" font-size=\\\"${a}\\\" fill=\\\"var(--_m)\\\">${Q}\u003C/g>`:\\\"\\\")+(k.length>0?`\u003Cg class=\\\"pele-points\\\" fill=\\\"${q}\\\">${J.reverse().join(\\\"\\\")}\u003C/g>\u003Cg class=\\\"pele-point-labels\\\" font-size=\\\"${c}\\\">${se}\u003C/g>`:\\\"\\\");return{svg:at(\\\"quadrantChart\\\",d,m,r,n,e,re),width:d,height:m,links:[]}}var H0={type:\\\"quadrantChart\\\",parse(e,t,n){let r=new jl;return r.title=n,W0(e,r),r},render:Y0};var K0=32;function z0(e){return new Qe(e,\\\"semantic\\\",{type:\\\"radar\\\"})}function V0(e,t){let n=e.axes.map(s=>({name:s.name,label:s.label??s.name})),r=e.curves.map(s=>{let a;if(s.entries[0].axis===void 0)a=s.entries.map(o=>o.value);else{if(n.length===0)throw z0(\\\"Axes must be populated before curves for reference entries\\\");let o=new Map;for(let c of s.entries)c.axis!==void 0&&!o.has(c.axis.$refText)&&o.set(c.axis.$refText,c.value);a=n.map(c=>{let l=o.get(c.name);if(l===void 0)throw z0(\\\"Missing entry for axis \\\"+c.label);return l})}return{name:s.name,label:s.label??s.name,entries:a}}),i={showLegend:!0,ticks:5,max:null,min:0,graticule:\\\"circle\\\"};for(let s of e.options)s.name===\\\"showLegend\\\"?i.showLegend=s.value:s.name===\\\"graticule\\\"?i.graticule=s.value:i[s.name]=s.value;return i.ticks>K0&&(i.ticks=K0),{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,`\\r\\n`):void 0,axes:n,curves:r,options:i}}var Ph=0,Ql=0;function j0(e,t){let n=t;for(let r=e.charCodeAt(n);r>=48&&r\u003C=57;r=e.charCodeAt(n))n++;return n}function wI(e,t){(t\u003CPh||t>=Ql)&&(Ph=t,Ql=j0(e,t));let n=Ql;if(n===t)return-1;let r=e.charCodeAt(n)===46;if(r){let i=j0(e,n+1),s=i-n-1;if(s>0&&e.charCodeAt(i)!==46)return i;if(s>1)return i-1}return e.charCodeAt(t)===48?t+1:r?n-1>t?n-1:-1:n}var Dh=sn.pattern,vh=/[\\\\t ]*accDescr\\\\s*{/y,Zl=-2;function _I(e,t){return vh.lastIndex=t,vh.test(e)&&(Zl===-2&&(Zl=e.lastIndexOf(\\\"}\\\")),vh.lastIndex>Zl)?-1:(Dh.lastIndex=t,Dh.test(e)?Dh.lastIndex:-1)}var Fh={name:\\\"ID\\\",pattern:/[\\\\w]([-\\\\w]*\\\\w)?/y},X0=/[-\\\\w]*\\\\w/y;function q0(e,t){return(n,r,i)=>{if(e.lastIndex=r,!e.test(n))return-1;let s=e.lastIndex;return i===t?s:(X0.lastIndex=s,X0.test(n)?-1:s)}}var li=e=>({name:e,pattern:e,longer:[Fh]}),di=e=>({name:e,pattern:e}),Q0=[di(\\\"radar-beta:\\\"),{...Jt(\\\"radar-beta\\\"),longer:[Fh]},li(\\\"showLegend\\\"),li(\\\"graticule\\\"),li(\\\"curve\\\"),li(\\\"ticks\\\"),li(\\\"axis\\\"),li(\\\"max\\\"),li(\\\"min\\\"),di(\\\":\\\"),di(\\\",\\\"),di(\\\"[\\\"),di(\\\"]\\\"),di(\\\"{\\\"),di(\\\"}\\\"),{name:\\\"GRATICULE\\\",pattern:/circle|polygon/y,match:q0(/circle|polygon/y,3)},{name:\\\"BOOLEAN\\\",pattern:/true|false/y,match:q0(/true|false/y,2)},{...sn,match:_I},Xt,er(String.raw`[-\\\\w]*\\\\w`),{name:\\\"NUMBER\\\",pattern:/(?:[0-9]+\\\\.[0-9]+(?!\\\\.))|(?:0|[1-9][0-9]*(?!\\\\.))/y,match:wI},Fn,Fh,Sn,wn,Ht,Qt,Zt];function RI(e){return Ph=Ql=0,Zl=-2,Yt(e,Q0,\\\"radar\\\")}function Z0(e){let t=new Ut(RI(e),Q0,\\\"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())},s=()=>{if(!t.accept(11))return;let h=un(t.expect(21));return t.expect(12),h},a=h=>{if(!h)return{$type:\\\"Entry\\\",value:Number(t.expect(20))};let d={$refText:t.expect(22)};return t.accept(9),{$type:\\\"Entry\\\",axis:d,value:Number(t.expect(20))}},o=()=>{let h=t.expect(22),d=s(),m={$type:\\\"Curve\\\",name:h,entries:[]};d!==void 0&&(m.label=d),t.expect(13),r(),t.kind!==20&&t.kind!==22&&t.fail(\\\"a number or an axis name\\\");let p=t.kind===22;for(m.entries.push(a(p));t.accept(10);)r(),m.entries.push(a(p));return r(),t.expect(14),m},c=()=>{let h={$type:\\\"Axis\\\",name:t.expect(22)},d=s();return d!==void 0&&(h.label=d),h},l=()=>{let h=t.kind,d=t.take(),m;return h===2?m=t.expect(16)===\\\"true\\\":h===3?m=t.expect(15):m=Number(t.expect(20)),{$type:\\\"Option\\\",name:d,value:m}},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=Vt(t.take()),i();break;case 18:n.accTitle=zt(t.take()),i();break;case 19:n.title=Kt(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(o());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 co=12,Bh=26,J0=24;function ss(e,t,n,r,i){let s=e.radar?.[t];return typeof s==\\\"number\\\"&&s>=r?Math.min(s,i):n}function TI(e,t,n,r){let i=Math.min(Math.max(e,t),n),s=r*(i-t);return Number.isFinite(s)?s/(n-t):r*((i-t)/(n-t))}function MI(e,t){let n=e.length,r=`M${f(e[0].x)},${f(e[0].y)}`;for(let i=0;i\u003Cn;i++){let s=e[(i-1+n)%n],a=e[i],o=e[(i+1)%n],c=e[(i+2)%n];r+=` C${f(a.x+(o.x-s.x)*t)},${f(a.y+(o.y-s.y)*t)} ${f(o.x-(c.x-a.x)*t)},${f(o.y-(c.y-a.y)*t)} ${f(o.x)},${f(o.y)}`}return r+\\\" Z\\\"}function ex(e){let t=\\\"\\\";for(let n of e)t+=(t?\\\" \\\":\\\"\\\")+f(n.x)+\\\",\\\"+f(n.y);return t}function tx(e,t,n){let r=ss(t,\\\"width\\\",320,1,4e3);return ms(n,r,160,(i,s)=>CI(e,t,n,i,ss(t,\\\"height\\\",320,1,4e3)*i/r,s))}function CI(e,t,n,r,i,s){let a=n.fontSize??16,o=Math.round(a*.875),c=n.measurer??ct(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=ss(t,\\\"axisScaleFactor\\\",1,0,10),h=ss(t,\\\"axisLabelFactor\\\",1.05,0,10),d=ss(t,\\\"curveTension\\\",.17,0,1),m=Math.min(r,i)/2,{axes:p,curves:y}=e,{ticks:E,graticule:b,min:S}=e.options,x=p.length,I=p.map((F,W)=>{let j=2*Math.PI*W/x-Math.PI/2;return{x:Math.cos(j),y:Math.sin(j)}}),L=e.options.max;if(L===null){L=-1/0;for(let F of y)for(let W of F.entries)W>L&&(L=W)}let O=-r/2-ss(t,\\\"marginLeft\\\",16,0,2e3),v=r/2+ss(t,\\\"marginRight\\\",16,0,2e3),G=-i/2-ss(t,\\\"marginTop\\\",16,0,2e3),K=i/2+ss(t,\\\"marginBottom\\\",16,0,2e3),C=\\\"\\\";for(let F=0;F\u003CE;F++){let W=Math.min(m,m*(F+1)/E);b===\\\"circle\\\"?C+=`\u003Ccircle r=\\\"${f(W)}\\\"/>`:C+=`\u003Cpolygon points=\\\"${ex(I.map(j=>({x:j.x*W,y:j.y*W})))}\\\"/>`}let Z=\\\"\\\",oe=\\\"\\\";I.forEach((F,W)=>{let j=m*u;Z+=`M0,0L${f(F.x*j)},${f(F.y*j)}`;let Q=Ge(p[W].label,!1,c,o,4e3),Y=m*h+6,ne=F.x*Y+(F.x>.01?Q.width/2:F.x\u003C-.01?-Q.width/2:0),q=F.y*Y+(F.y>.01?Q.height/2:F.y\u003C-.01?-Q.height/2:0);oe+=`\u003Cg class=\\\"pele-axis-label\\\" data-id=\\\"${Ue(p[W].name)}\\\">${Ne(Q,ne,q,\\\"\\\")}\u003C/g>`,O=Math.min(O,ne-Q.width/2),v=Math.max(v,ne+Q.width/2),G=Math.min(G,q-Q.height/2),K=Math.max(K,q+Q.height/2)});let H=\\\"\\\";y.forEach((F,W)=>{if(F.entries.length!==x)return;let j=F.entries.map((ne,q)=>{let k=TI(ne,S,L,m),J=Number.isFinite(k)?k:0;return{x:I[q].x*J,y:I[q].y*J}}),Q=Et(W),Y=` class=\\\"pele-curve\\\" data-id=\\\"${Ue(F.name)}\\\" fill=\\\"${Q}\\\" stroke=\\\"${Q}\\\"`;H+=b===\\\"circle\\\"?`\u003Cpath${Y} d=\\\"${MI(j,d)}\\\"/>`:`\u003Cpolygon${Y} points=\\\"${ex(j)}\\\"/>`});let z=e.options.showLegend?y.map(F=>Ge(F.label,!1,c,o,4e3)):[],M=0;for(let F of z)M=Math.max(M,F.width);let T=z.length*Bh,R=s?-(co+8+M)/2:v+J0,_=s?K+J0/2:-T/2;z.length>0&&s?(O=Math.min(O,R),v=Math.max(v,-R),K=_+T):z.length>0&&(v=R+co+8+M,G=Math.min(G,-T/2),K=Math.max(K,T/2));let $=\\\"\\\";z.forEach((F,W)=>{let j=_+W*Bh+Bh/2,Q=Et(W);$+=`\u003Cg class=\\\"pele-legend-item\\\" data-id=\\\"${Ue(y[W].name)}\\\">\u003Crect x=\\\"${f(R)}\\\" y=\\\"${f(j-co/2)}\\\" width=\\\"${co}\\\" height=\\\"${co}\\\" rx=\\\"2\\\" fill=\\\"${Q}\\\" fill-opacity=\\\"0.4\\\" stroke=\\\"${Q}\\\"/>`+Ne(F,R+co+8+F.width/2,j,\\\"\\\")+\\\"\u003C/g>\\\"});let g=Ge(e.title,!1,c,a,kt(n),1),N=g.height>0?g.height+8:0,w=Math.max(v-O,g.width),A=Math.ceil(w+2*l),D=Math.ceil(K-G+N+2*l),U=`translate(${f(l+(w-(v-O))/2-O)},${f(l+N-G)})`,B=Ne(g,A/2,l+g.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg transform=\\\"${U}\\\">`+(C?`\u003Cg class=\\\"pele-graticule\\\" fill=\\\"none\\\" stroke=\\\"var(--_a)\\\">${C}\u003C/g>`:\\\"\\\")+(Z?`\u003Cpath class=\\\"pele-axes\\\" d=\\\"${Z}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"/>`:\\\"\\\")+(H?`\u003Cg class=\\\"pele-curves\\\" fill-opacity=\\\"0.2\\\" stroke-width=\\\"1.5\\\" stroke-linejoin=\\\"round\\\">${H}\u003C/g>`:\\\"\\\")+(oe?`\u003Cg class=\\\"pele-axis-labels\\\" font-size=\\\"${o}\\\">${oe}\u003C/g>`:\\\"\\\")+($?`\u003Cg class=\\\"pele-legend\\\" font-size=\\\"${o}\\\">${$}\u003C/g>`:\\\"\\\")+\\\"\u003C/g>\\\";return{svg:at(\\\"radar\\\",A,D,a,n,e,B),width:A,height:D,links:[]}}var nx={type:\\\"radar\\\",parse:(e,t,n)=>V0(Z0(e),n),render:tx};function Wh(e){return e===32||e>=9&&e\u003C=13||e>127&&/\\\\s/.test(String.fromCharCode(e))}function NI(){let e=1/0;return(t,n)=>{if(!t.startsWith(\\\"accDescr\\\",n))return-1;let r=t.length,i=n+8;for(;i\u003Cr&&(t.charCodeAt(i)===32||t.charCodeAt(i)===9);)i++;if(t.charCodeAt(i)===58){for(i++;i\u003Cr;i++){let a=t.charCodeAt(i);if(a===10||a===13||a===37&&t.charCodeAt(i+1)===37)break}return i}for(;i\u003Cr&&Wh(t.charCodeAt(i));)i++;if(t.charCodeAt(i)!==123||i>=e)return-1;let s=t.indexOf(\\\"}\\\",i+1);return s===-1&&(e=i),s+1||-1}}var Uh=\\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\\\";function Rs(e){return{name:\\\"TITLE\\\",pattern:new RegExp(String.raw`title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|(?!${e}))`,\\\"y\\\"),first:\\\"t\\\"}}var Ts={name:\\\"ACC_TITLE\\\",pattern:/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/y,first:\\\"a\\\"},Ms={name:\\\"ACC_DESCR\\\",pattern:/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/y,first:\\\"a\\\",scanner:NI};function St(e,t){return{name:e,pattern:e,longer:t}}function Cs(e,t){return{...Jt(e),longer:[t]}}function lo(e){return{name:e,pattern:/[A-Z_a-z][\\\\w-]*/y,first:Uh+\\\"_\\\"}}function uo(e){return{name:e,pattern:/\\\"([^\\\"\\\\\\\\]|\\\\\\\\.)*\\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/y,first:`\\\"'`}}function Ns(e){return[{name:e+\\\"_WHITESPACE\\\",pattern:/[\\\\t \\\\r\\\\n]+/y,hidden:!0,first:`\\t \\\\r\\r\\n`},{...Ht,name:e+\\\"_YAML\\\",first:\\\"-\\\"},{...Qt,name:e+\\\"_DIRECTIVE\\\",first:\\\"\\t %\\\"},{...Zt,name:e+\\\"_SINGLE_LINE_COMMENT\\\",first:\\\"\\t %\\\"}]}function is(e){if(!e.includes(\\\"\\\\\\\\\\\"))return e.slice(1,-1);let t=e.length-1,n=\\\"\\\";for(let r=1;r\u003Ct;r++){let i=e[r];i===\\\"\\\\\\\\\\\"&&r+1\u003Ct?(i=e[++r],n+=i===\\\"n\\\"?`\\r\\n`:i===\\\"r\\\"?\\\"\\\\r\\\":i===\\\"t\\\"?\\\"\\t\\\":i):n+=i}return n}function Is(e,t,n,r,i,s){let a=new Ut(Yt(e,t,\\\"railroad\\\"),t,\\\"railroad\\\"),o={$type:n,rules:[]};for(a.expect(0);;){let c=a.kind;if(c===r){let l=Kt(a.take()),u=l[0];o.title=(u==='\\\"'||u===\\\"'\\\")&&l.endsWith(u)?i(l):l}else if(c===r+1)o.accTitle=zt(a.take());else if(c===r+2)o.accDescr=Vt(a.take());else break}for(;a.kind!==-1;)o.rules.push(s(a));return o}var Gh=[];function Jl(e){let t=e,n=t.element??t.primary??t.suffix,r=t.alternatives??t.elements??(n?[n]:Gh);if(t.base){r=[t.base];for(let i of t.postfixes)i.except&&r.push(i.except)}return r}var os=e=>({type:\\\"terminal\\\",value:e}),ks=e=>({type:\\\"nonterminal\\\",name:e}),ui=e=>({type:\\\"special\\\",text:e}),Gr=e=>({type:\\\"optional\\\",element:e}),as=(e,t,n=1/0)=>({type:\\\"repetition\\\",element:e,min:t,max:n});function $s(e){return e.length===1?e[0]:{type:\\\"sequence\\\",elements:e}}function Ls(e){return e.length===1?e[0]:{type:\\\"choice\\\",alternatives:e}}function Os(e,t){return e.rules.map(n=>({name:n.name,definition:Yh(n.definition,Jl,t)}))}function Yh(e,t,n){let r=[e],i=[t(e)],s=[[]];for(;;){let a=r.length-1,o=s[a];if(o.length\u003Ci[a].length){let c=i[a][o.length];r.push(c),i.push(t(c)),s.push([])}else{let c=n(r[a],o);if(a===0)return c;r.pop(),i.pop(),s.pop(),s[a-1].push(c)}}}var rx=\\\"0123456789\\\",sx={name:\\\"ABNF_RULENAME\\\",pattern:/[A-Za-z][A-Za-z0-9-]*/y,first:Uh},ix={name:\\\"ABNF_COMMENT\\\",pattern:/;[^\\\\n\\\\r]*/y,hidden:!0,first:\\\";\\\"},ax=[Cs(\\\"railroad-abnf-beta\\\",sx),St(\\\"=\\\"),St(\\\";\\\",[ix]),St(\\\"/\\\"),St(\\\"(\\\"),St(\\\")\\\"),St(\\\"[\\\"),St(\\\"]\\\"),Rs(String.raw`[A-Za-z0-9-]`),Ts,Ms,sx,{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:rx+\\\"*\\\"},{name:\\\"ABNF_EXACT_REPEAT\\\",pattern:/[0-9]+/y,first:rx},...Ns(\\\"ABNF\\\"),ix];function ox(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 II(e){let t=[],n=ox(void 0,{$type:\\\"AbnfAlternation\\\",alternatives:[]},-2,void 0);for(;;){let r=e.kind===14||e.kind===15?e.take():void 0,i,s=e.kind;switch(s){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 a={$type:\\\"AbnfAlternation\\\",alternatives:[]};t.push(n),n=ox({$type:s===4?\\\"AbnfGroup\\\":\\\"AbnfOptionalGroup\\\",element:a},a,s+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();continue}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 '${ax[n.close].name}'`)}break}}}function cx(e){return Is(e,ax,\\\"RailroadAbnf\\\",8,t=>t.slice(1,-1),t=>{let n=t.expect(11);t.expect(1);let r=II(t);return t.expect(2),{$type:\\\"AbnfRule\\\",name:n,definition:r}})}function kI(e,t){switch(e.$type){case\\\"AbnfAlternation\\\":return Ls(t);case\\\"AbnfConcatenation\\\":return $s(t);case\\\"AbnfElement\\\":{let n=e.repeat;if(!n)return t[0];let r=n.indexOf(\\\"*\\\"),i=r===-1,s=r>0||i?parseInt(n,10):0,a=i?s:r\u003Cn.length-1?parseInt(n.slice(r+1),10):1/0;return s===0&&a===1?Gr(t[0]):as(t[0],s,a)}case\\\"AbnfStringLiteral\\\":case\\\"AbnfNumVal\\\":return os(e.value);case\\\"AbnfRuleName\\\":return ks(e.name);case\\\"AbnfGroup\\\":return t[0];case\\\"AbnfOptionalGroup\\\":return Gr(t[0])}}var lx=e=>Os(e,kI);function $I(e,t){if(e.charCodeAt(t)!==63)return-1;let n=!1;for(let r=t+1;r\u003Ce.length;r++){let i=e.charCodeAt(r);if(i===63)return n?r+1:-1;if(i===59)return-1;n||=!Wh(i)}return-1}var dx=lo(\\\"EBNF_ID\\\"),ux={name:\\\"EBNF_SPECIAL_SEQUENCE\\\",pattern:/\\\\?(?=[^?;]*[^?\\\\s;][^?;]*\\\\?)[^?;]*\\\\?/y,first:\\\"?\\\",scanner:()=>$I},fx=Ns(\\\"EBNF\\\"),hx={name:\\\"EBNF_ISO_COMMENT\\\",pattern:/\\\\(\\\\*[\\\\s\\\\S]*?\\\\*\\\\)/y,hidden:!0,first:\\\"(\\\",opener:/\\\\(\\\\*/y},mx=[Cs(\\\"railroad-ebnf-beta\\\",dx),St(\\\"::=\\\"),St(\\\"=\\\"),St(\\\";\\\"),St(\\\"|\\\"),St(\\\",\\\"),St(\\\"(\\\",[hx]),St(\\\")\\\"),St(\\\"[\\\"),St(\\\"]\\\"),St(\\\"{\\\"),St(\\\"}\\\"),St(\\\"?\\\",[ux]),St(\\\"*\\\"),St(\\\"+\\\"),St(\\\"-\\\",[fx[1]]),Rs(String.raw`[\\\\w-]`),Ts,Ms,dx,uo(\\\"EBNF_STRING\\\"),ux,...fx,{name:\\\"EBNF_BLOCK_COMMENT\\\",pattern:/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//y,hidden:!0,first:\\\"/\\\",opener:/\\\\/\\\\*/y},hx];function px(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 LI=[\\\"EbnfGroup\\\",\\\"EbnfOptional\\\",\\\"EbnfRepetition\\\"];function OI(e){let t=[],n=px(void 0,{$type:\\\"EbnfChoice\\\",alternatives:[]},-2,!1),r=!1;for(;;){let i,s=e.kind;switch(s){case 20:i={$type:\\\"EbnfTerminal\\\",value:is(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 a={$type:\\\"EbnfChoice\\\",alternatives:[]};t.push(n),n=px({$type:LI[s-6>>1],element:a},a,s+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 c=e.kind;if(c===12)a.push({$type:\\\"EbnfOptionalPostfix\\\",operator:e.take()});else if(c===13)a.push({$type:\\\"EbnfZeroOrMorePostfix\\\",operator:e.take()});else if(c===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();continue}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 '${mx[n.close].name}'`)}break}}}function gx(e){return Is(e,mx,\\\"RailroadEbnf\\\",16,is,t=>{let n=t.expect(19);t.accept(2)||t.expect(1);let r={$type:\\\"EbnfRule\\\",name:n,definition:OI(t)};return t.expect(3),r})}function DI(e,t){switch(e.$type){case\\\"EbnfChoice\\\":return Ls(t);case\\\"EbnfSequence\\\":return $s(t);case\\\"EbnfTerm\\\":{let n=t[0],r=1;for(let i of e.postfixes)i.$type===\\\"EbnfOptionalPostfix\\\"?n=Gr(n):i.$type===\\\"EbnfExceptionPostfix\\\"?n={type:\\\"sequence\\\",elements:[n,os(\\\"-\\\"),t[r++]]}:n=as(n,i.$type===\\\"EbnfOneOrMorePostfix\\\"?1:0);return n}case\\\"EbnfTerminal\\\":return os(e.value);case\\\"EbnfNonTerminal\\\":return ks(e.name);case\\\"EbnfSpecial\\\":return ui(e.text);case\\\"EbnfGroup\\\":return t[0];case\\\"EbnfOptional\\\":return Gr(t[0]);case\\\"EbnfRepetition\\\":return as(t[0],0)}}var bx=e=>Os(e,DI);var zh=lo(\\\"RR_ID\\\"),Ds=e=>St(e,[zh]),vI=[Cs(\\\"railroad-beta\\\",zh),Ds(\\\"nonterminal\\\"),Ds(\\\"zeroOrMore\\\"),Ds(\\\"oneOrMore\\\"),Ds(\\\"sequence\\\"),Ds(\\\"optional\\\"),Ds(\\\"terminal\\\"),Ds(\\\"special\\\"),Ds(\\\"choice\\\"),St(\\\"=\\\"),St(\\\";\\\"),St(\\\"(\\\"),St(\\\",\\\"),St(\\\")\\\"),Rs(String.raw`[\\\\w-]`),Ts,Ms,zh,uo(\\\"RR_STRING\\\"),...Ns(\\\"RR\\\"),{name:\\\"RR_BLOCK_COMMENT\\\",pattern:/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//y,hidden:!0,first:\\\"/\\\",opener:/\\\\/\\\\*/y}];function Hh(e){e.i++,e.expect(11);let t=is(e.expect(18));return e.expect(13),t}function Kh(e){return{$type:e,element:void 0}}function PI(e){let t=[];for(;;){let n;switch(e.kind){case 6:n={$type:\\\"RailroadTerminalExpr\\\",value:Hh(e)};break;case 1:n={$type:\\\"RailroadNonTerminalExpr\\\",name:Hh(e)};break;case 7:n={$type:\\\"RailroadSpecialExpr\\\",text:Hh(e)};break;case 4:n={$type:\\\"RailroadSequenceExpr\\\",elements:[]};break;case 8:n={$type:\\\"RailroadChoiceExpr\\\",alternatives:[]};break;case 5:n=Kh(\\\"RailroadOptionalExpr\\\");break;case 3:n=Kh(\\\"RailroadOneOrMoreExpr\\\");break;case 2:n=Kh(\\\"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);continue}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 yx(e){return Is(e,vI,\\\"Railroad\\\",14,is,t=>{let n=t.expect(17);t.expect(9);let r=PI(t);return t.expect(10),{$type:\\\"RailroadRule\\\",name:n,definition:r}})}function FI(e,t){switch(e.$type){case\\\"RailroadTerminalExpr\\\":return os(e.value);case\\\"RailroadNonTerminalExpr\\\":return ks(e.name);case\\\"RailroadSpecialExpr\\\":return ui(e.text);case\\\"RailroadSequenceExpr\\\":return $s(t);case\\\"RailroadChoiceExpr\\\":return Ls(t);case\\\"RailroadOptionalExpr\\\":return Gr(t[0]);default:return as(t[0],e.$type===\\\"RailroadOneOrMoreExpr\\\"?1:0)}}var Ex=e=>Os(e,FI);var xx=lo(\\\"PEG_ID\\\"),BI=[Cs(\\\"railroad-peg-beta\\\",xx),St(\\\"\u003C-\\\"),St(\\\";\\\"),St(\\\"/\\\"),St(\\\"&\\\"),St(\\\"!\\\"),St(\\\"?\\\"),St(\\\"*\\\"),St(\\\"+\\\"),St(\\\"(\\\"),St(\\\")\\\"),St(\\\".\\\"),Rs(String.raw`[\\\\w-]`),Ts,Ms,xx,uo(\\\"PEG_STRING\\\"),...Ns(\\\"PEG\\\"),{name:\\\"PEG_LINE_COMMENT\\\",pattern:/#[^\\\\n\\\\r]*/y,hidden:!0,first:\\\"#\\\"}];function Ax(e,t,n){let r={$type:\\\"PegSequence\\\",elements:[]};return t.alternatives.push(r),{choice:t,sequence:r,node:e,operator:n}}function WI(e){let t=[],n=Ax(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:is(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 a={$type:\\\"PegOrderedChoice\\\",alternatives:[]};t.push(n),n=Ax({$type:\\\"PegGroup\\\",element:a},a,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();continue}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 Sx(e){return Is(e,BI,\\\"RailroadPeg\\\",12,is,t=>{let n=t.expect(15);t.expect(1);let r={$type:\\\"PegRule\\\",name:n,definition:WI(t)};return t.expect(2),r})}function UI(e){switch(e.type){case\\\"terminal\\\":return`\\\"${e.value}\\\"`;case\\\"nonterminal\\\":return e.name;case\\\"special\\\":return e.text;default:return\\\"(...)\\\"}}function GI(e,t){let n=t[0];switch(e.$type){case\\\"PegOrderedChoice\\\":return Ls(t);case\\\"PegSequence\\\":return $s(t);case\\\"PegPrefix\\\":return e.operator?ui(e.operator+UI(n)):n;case\\\"PegSuffix\\\":return e.operator?e.operator===\\\"?\\\"?Gr(n):as(n,e.operator===\\\"+\\\"?1:0):n;case\\\"PegLiteral\\\":return os(e.value);case\\\"PegIdentifier\\\":return ks(e.name);case\\\"PegAny\\\":return ui(e.dot);case\\\"PegGroup\\\":return n}}var wx=e=>Os(e,GI);var Vh=class{constructor(){fe(this,\\\"type\\\",\\\"railroad\\\");fe(this,\\\"notation\\\",\\\"railroad\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"rules\\\",[]);fe(this,\\\"byName\\\",new Map)}setTitle(t){this.title=t}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}addRule(t){this.rules.push(t),this.byName.set(t.name,t)}getRule(t){return this.byName.get(t)}},YI=/^\\\\s*railroad-(ebnf-|abnf-|peg-)?beta/i;function HI(e){let t=YI.exec(e);if(t===null)return;let n=t[1]?.toLowerCase();return n===\\\"ebnf-\\\"?\\\"ebnf\\\":n===\\\"abnf-\\\"?\\\"abnf\\\":n===\\\"peg-\\\"?\\\"peg\\\":\\\"railroad\\\"}function KI(e,t){switch(t){case\\\"ebnf\\\":{let n=gx(e);return[n,bx(n)]}case\\\"abnf\\\":{let n=cx(e);return[n,lx(n)]}case\\\"peg\\\":{let n=Sx(e);return[n,wx(n)]}default:{let n=yx(e);return[n,Ex(n)]}}}function zI(e,t,n){let[r,i]=KI(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 s of i)e.addRule(s)}function _x(e,t){let n=HI(e);if(n===void 0)throw new Qe(\\\"No railroad diagram keyword found.\\\",\\\"syntax\\\",{type:\\\"railroad\\\"});let r=new Vh;return t&&(r.title=t),zI(r,e,n),r}var jh=12,VI=6,jI=18,nd=12,Er=7;function fi(e,t,n,r){let i=e.railroad?.[t];return typeof i==\\\"number\\\"&&i>=0?Math.min(i,r):n}var XI=/[\\\\n\\\\r\\\\t]/g;function td(e){return(e.includes(\\\"¶ß\\\")?bt(e.replace(/&/g,\\\"&\\\")):e).replace(XI,n=>n===`\\r\\n`?\\\"\\\\\\\\n\\\":n===\\\"\\\\r\\\"?\\\"\\\\\\\\r\\\":\\\"\\\\\\\\t\\\")}function ed(e,t){for(let n=t,r=e.length-1;n\u003Cr;n++,r--){let i=e[n];e[n]=e[r],e[r]=i}}function qh(e){return Math.ceil(e/2)*2}function Xh(e,t,n,r,i){let s=i.height/2,a=Math.max(qh(i.measurer.width(t,i.size,r)+2*i.padding),i.height);return{kind:e,width:a,up:s,down:s,kids:Gh,text:t,id:n,reach:0}}function qI(e,t){if(t===1/0&&e\u003C=1)return\\\"\\\";let n=r=>Number.isFinite(r)?String(r):\\\"∞\\\";return e===t?n(e)+\\\"×\\\":t===1/0?\\\"≥\\\"+n(e)+\\\"×\\\":e===0?\\\"≤\\\"+n(t)+\\\"×\\\":n(e)+\\\"–\\\"+n(t)+\\\"×\\\"}function Tx(e,t,n,r){return Math.max(e+t.down+r.sep+n.up,2*r.arc)}function Rx(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 QI(e,t,n=1/0){let r=new Map,i=[[e,n]];for(let s=0;n!==1/0&&s\u003Ci.length;s++){let[a,o]=i[s];r.set(a,o);let c=a.type===\\\"choice\\\"||a.type===\\\"optional\\\"?4*t.arc:a.type===\\\"repetition\\\"?(a.min===0?6:2)*t.arc:a.type===\\\"sequence\\\"?6*t.arc:0;for(let l of Jl(a))i.push([l,Math.max(40,o-c)])}return Yh(e,Jl,(s,a)=>{let o=r.get(s)??1/0;switch(s.type){case\\\"terminal\\\":{let c=td(s.value);return Xh(0,/^ +$/.test(c)?\\\"␣\\\".repeat(c.length):c,\\\"\\\",4,t)}case\\\"nonterminal\\\":return Xh(1,td(s.name),s.name,0,t);case\\\"special\\\":return Xh(2,\\\"? \\\"+td(s.text)+\\\" ?\\\",\\\"\\\",2,t);case\\\"sequence\\\":{let c=Math.max(0,a.length-1)*t.gap,l=0,u=0;for(let S of a)c+=S.width,l=Math.max(l,S.up),u=Math.max(u,S.down);let h={kind:3,width:c,up:l,down:u,kids:a,text:\\\"\\\",id:\\\"\\\",reach:0};if(c\u003C=o||a.length\u003C2)return h;let d=[],m=[],p=0,y=()=>{let S=0,x=0;for(let I of m)S=Math.max(S,I.up),x=Math.max(x,I.down);d.push({kind:3,width:p,up:S,down:x,kids:m,text:\\\"\\\",id:\\\"\\\",reach:0}),m=[],p=0};for(let S of a)m.length&&p+t.gap+S.width>Math.max(40,o-6*t.arc)&&y(),p+=(m.length?t.gap:0)+S.width,m.push(S);if(y(),d.length\u003C2)return h;let E=0,b=0;for(let S=0;S\u003Cd.length;S++)E=Math.max(E,d[S].width),S&&(b+=d[S-1].down+Math.max(t.sep,2*t.arc)+d[S].up);return{kind:7,width:E+6*t.arc,up:d[0].up,down:b+d[d.length-1].down,kids:d,text:\\\"\\\",id:\\\"\\\",reach:0}}case\\\"choice\\\":{let c=0,l=0;for(let h=0;h\u003Ca.length;h++)c=Math.max(c,a[h].width),h>0&&(l=Tx(l,a[h-1],a[h],t));let u=a[a.length-1];return{kind:4,width:c+4*t.arc,up:a.length>0?a[0].up:0,down:u?l+u.down:0,kids:a,text:\\\"\\\",id:\\\"\\\",reach:0}}case\\\"optional\\\":return Rx(a[0],t);case\\\"repetition\\\":{let{min:c,max:l}=s,u=a[0];if(c===1&&l===1)return u;let h=qI(c,l),d=Math.max(u.down+t.sep,2*t.arc),m=h===\\\"\\\"?0:qh(t.measurer.width(h,nd,0)),p={kind:6,width:Math.max(u.width,m)+2*t.arc,up:u.up,down:d+(h===\\\"\\\"?Er/2+1:nd+6),kids:[u],text:h,id:\\\"\\\",reach:d};return c===0?Rx(p,t):p}}})}function Mx(e,t,n){return An(n,r=>ZI(e,t,n,r))}function ZI(e,t,n,r){let i=n.fontSize??16,s=fi(t,\\\"fontSize\\\",0,200),a=s||Math.round(i*.875),o=s||i,c=fi(t,\\\"padding\\\",-1,200),l=Math.round(a*1.5),u={measurer:n.measurer??ct(n.fontFamily,n.fontFamilyMono),size:a,padding:c\u003C0?12:c,height:qh(l+(c\u003C0?9:2*c)),gap:Math.min(fi(t,\\\"horizontalSeparation\\\",16,500),r?12:1/0),sep:fi(t,\\\"verticalSeparation\\\",10,500),arc:Math.min(fi(t,\\\"arcRadius\\\",10,200),r?6:1/0)},h=t.railroad?.showMarkers===!1?0:fi(t,\\\"markerRadius\\\",4,50),d=fi(t,\\\"strokeWidth\\\",0,20),m=d>0?` stroke-width=\\\"${f(d)}\\\"`:\\\"\\\",p=n.padding??8,{arc:y}=u,E=f(y),b=(U,B,F)=>`a${E},${E} 0 0 ${U} ${B}${E},${F}${E}`,S=b(1,\\\"\\\",\\\"\\\"),x=b(0,\\\"\\\",\\\"\\\"),I=b(0,\\\"\\\",\\\"-\\\"),L=b(1,\\\"\\\",\\\"-\\\"),O=b(0,\\\"-\\\",\\\"\\\"),v=b(0,\\\"-\\\",\\\"-\\\"),G=Ge(e.title,!1,u.measurer,i,r?kt(n):4e3,1),K=G.height>0?G.height+16:0,C=Math.round(o*1.5),Z=a*.35,oe=u.height/2,H=\\\"\\\",z=\\\"\\\",M=\\\"\\\",T=(U,B,F)=>{F>U&&(H+=`M${f(U)},${f(B)}H${f(F)}`)},R=(U,B,F)=>{let W=[U],j=[B,F];for(;W.length>0;){let Q=W.pop(),Y=j.pop(),ne=j.pop(),q=Q.kids,k=ne+Q.width;switch(Q.kind){case 3:{let J=k;for(let te=q.length-1;te>=0;te--)J-=q[te].width,W.push(q[te]),j.push(J,Y),te>0&&T(J-u.gap,Y,J),J-=u.gap;break}case 7:{let J=ne+2*y,te=W.length,se=0;T(ne,Y,J);for(let re=0;re\u003Cq.length;re++){let P=q[re],ee=Y+se;if(W.push(P),j.push(ee,J),re+1\u003Cq.length){let ae=q[re+1],ue=se+P.down+Math.max(u.sep,2*y)+ae.up,ce=Y+se+P.down+Math.max(u.sep,2*y)/2;H+=`M${f(J+P.width)},${f(ee)}H${f(k-2*y)}V${f(ce)}H${f(ne+y)}V${f(Y+ue)}H${f(J)}`,z+=`M${f(J-Er)},${f(Y+ue-Er/2)}l${Er},${Er/2}l${-Er},${Er/2}z`,se=ue}else H+=`M${f(J+P.width)},${f(ee)}H${f(k-y)}V${f(Y)}H${f(k)}`}ed(W,te),ed(j,2*te);break}case 4:{let J=Q.width-4*y,te=ne+y,se=k-y,re=W.length,P=0;for(let ee=0;ee\u003Cq.length;ee++){let ae=q[ee];ee>0&&(P=Tx(P,q[ee-1],ae,u));let ue=Y+P,ce=ne+2*y+(J-ae.width)/2,pe=ee===q.length-1;ee===0?(T(ne,Y,ce),T(ce+ae.width,Y,k)):H+=(pe?`M${f(ne)},${f(Y)}${S}V${f(ue-y)}`:`M${f(te)},${f(ue-y)}`)+x+(ce>te+y?`H${f(ce)}`:\\\"\\\")+`M${f(ce+ae.width)},${f(ue)}`+(ce>te+y?`H${f(se-y)}`:\\\"\\\")+I+(pe?`V${f(Y+y)}${L}`:\\\"\\\"),W.push(ae),j.push(ue,ce)}ed(W,re),ed(j,2*re);break}case 5:{let J=q[0],te=ne+2*y;T(ne,Y,te),T(te+J.width,Y,k),H+=`M${f(ne)},${f(Y)}${I}V${f(Y-Q.reach+y)}${L}H${f(k-2*y)}${S}V${f(Y-y)}${x}`,W.push(J),j.push(te,Y);break}case 6:{let J=q[0],te=ne+(Q.width-J.width)/2,se=Y+Q.reach,re=ne+Q.width/2;T(ne,Y,te),T(te+J.width,Y,k),H+=`M${f(ne+y)},${f(Y)}${O}V${f(se-y)}${x}H${f(k-y)}${I}V${f(Y+y)}${v}`,z+=`M${f(re-Er/2)},${f(se)}l${Er},${-Er/2}v${Er}z`,Q.text!==\\\"\\\"&&(M+=`\u003Ctext class=\\\"pele-edge-label pele-count\\\" x=\\\"${f(re)}\\\" y=\\\"${f(se+nd+3)}\\\" font-size=\\\"${nd}\\\" fill=\\\"var(--_m)\\\">${rt(Q.text)}\u003C/text>`),W.push(J),j.push(te,Y);break}default:{let J=Q.text,te=J.startsWith(\\\" \\\")||J.endsWith(\\\" \\\")||J.includes(\\\" \\\")?' xml:space=\\\"preserve\\\"':\\\"\\\",se=`\u003Crect x=\\\"${f(ne)}\\\" y=\\\"${f(Y-oe)}\\\" width=\\\"${f(Q.width)}\\\" height=\\\"${f(u.height)}\\\"`,re=`\u003Ctext x=\\\"${f(ne+Q.width/2)}\\\" y=\\\"${f(Y+Z)}\\\"${te}`;Q.kind===0?M+=`\u003Cg class=\\\"pele-node pele-terminal\\\">${se} rx=\\\"${f(oe)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${m}/>${re} font-family=\\\"${fr}\\\">${rt(J)}\u003C/text>\u003C/g>`:Q.kind===1?M+=`\u003Cg class=\\\"pele-node pele-nonterminal\\\" data-id=\\\"${Ue(Q.id)}\\\">${se} fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${m}${ht}/>${re}>${rt(J)}\u003C/text>\u003C/g>`:M+=`\u003Cg class=\\\"pele-node pele-special\\\">${se} fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\" stroke-dasharray=\\\"4 3\\\"${m}${ht}/>${re} font-style=\\\"italic\\\">\u003Ctspan fill=\\\"var(--_m)\\\">? \u003C/tspan>${rt(J.slice(2,-2))}\u003Ctspan fill=\\\"var(--_m)\\\"> ?\u003C/tspan>\u003C/text>\u003C/g>`}}}},_=\\\"\\\",$=G.width,g=p+K,N=p+G.height;for(let U of e.rules){let B=QI(U.definition,u,r?Math.max(80,(n.maxWidth??320)-2*p-4*h-2*jh-1):1/0),F=td(U.name),W=g+C+VI+B.up,j=p+2*h,Q=j+jh,Y=Q+B.width+jh;H=\\\"\\\",z=\\\"\\\",M=\\\"\\\",T(j,W,Q),T(Q+B.width,W,Y),R(B,Q,W);let ne=h>0?`\u003Ccircle class=\\\"pele-marker pele-start\\\" cx=\\\"${f(p+h)}\\\" cy=\\\"${f(W)}\\\" r=\\\"${f(h)}\\\" fill=\\\"var(--_l)\\\"/>\u003Ccircle class=\\\"pele-marker pele-end\\\" cx=\\\"${f(Y+h)}\\\" cy=\\\"${f(W)}\\\" r=\\\"${f(h)}\\\" fill=\\\"var(--_l)\\\"/>`:\\\"\\\";_+=`\u003Cg class=\\\"pele-rule\\\" data-id=\\\"${Ue(U.name)}\\\">\u003Ctext class=\\\"pele-rule-name\\\" x=\\\"${f(p)}\\\" y=\\\"${f(g+C/2+o*.35)}\\\" font-size=\\\"${f(o)}\\\" font-weight=\\\"var(--_hw)\\\" text-anchor=\\\"start\\\">${rt(F)}\u003C/text>\u003Cpath class=\\\"pele-edge pele-track\\\" d=\\\"${H}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"${m}/>`+(z?`\u003Cpath class=\\\"pele-marker\\\" d=\\\"${z}\\\" fill=\\\"var(--_l)\\\"/>`:\\\"\\\")+ne+M+\\\"\u003C/g>\\\",$=Math.max($,Y+2*h-p,u.measurer.width(F,o,1)),N=W+B.down,g=N+u.sep+jI}let w=Math.ceil($+2*p),A=Math.ceil(N+p),D=Ne(G,w/2,p+G.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(_?`\u003Cg class=\\\"pele-rules\\\" transform=\\\"translate(0.5,0.5)\\\" font-size=\\\"${f(a)}\\\" text-anchor=\\\"middle\\\">${_}\u003C/g>`:\\\"\\\");return{svg:at(\\\"railroad\\\",w,A,i,n,e,D),width:w,height:A,links:[]}}var Cx={type:\\\"railroad\\\",parse:(e,t,n)=>_x(e,n),render:Mx};var hi={REQUIREMENT:\\\"Requirement\\\",FUNCTIONAL_REQUIREMENT:\\\"Functional Requirement\\\",INTERFACE_REQUIREMENT:\\\"Interface Requirement\\\",PERFORMANCE_REQUIREMENT:\\\"Performance Requirement\\\",PHYSICAL_REQUIREMENT:\\\"Physical Requirement\\\",DESIGN_CONSTRAINT:\\\"Design Constraint\\\"},sd={LOW_RISK:\\\"Low\\\",MED_RISK:\\\"Medium\\\",HIGH_RISK:\\\"High\\\"},Ia={VERIFY_ANALYSIS:\\\"Analysis\\\",VERIFY_DEMONSTRATION:\\\"Demonstration\\\",VERIFY_INSPECTION:\\\"Inspection\\\",VERIFY_TEST:\\\"Test\\\"},Yr={CONTAINS:\\\"contains\\\",COPIES:\\\"copies\\\",DERIVES:\\\"derives\\\",SATISFIES:\\\"satisfies\\\",VERIFIES:\\\"verifies\\\",REFINES:\\\"refines\\\",TRACES:\\\"traces\\\"},JI=1e6,rd=class{constructor(){fe(this,\\\"type\\\",\\\"requirement\\\");fe(this,\\\"direction\\\",\\\"TB\\\");fe(this,\\\"requirements\\\",new Map);fe(this,\\\"elements\\\",new Map);fe(this,\\\"relations\\\",[]);fe(this,\\\"classes\\\",new Map);fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"newId\\\",\\\"\\\");fe(this,\\\"newText\\\",\\\"\\\");fe(this,\\\"newRisk\\\",\\\"\\\");fe(this,\\\"newVerifyMethod\\\",\\\"\\\");fe(this,\\\"newElementType\\\",\\\"\\\");fe(this,\\\"newDocRef\\\",\\\"\\\");fe(this,\\\"styleCopies\\\",0)}copy(t,n){if(this.styleCopies+=n.length,this.styleCopies>JI)throw new Qe(\\\"Requirement diagram applies too many style declarations.\\\",\\\"limit\\\",{type:\\\"requirement\\\"});for(let r of n)t.push(r)}setDirection(t){this.direction=t}addRequirement(t,n){let r=this.requirements.get(t);return r===void 0&&(r={name:t,type:n,requirementId:this.newId,text:this.newText,risk:this.newRisk,verifyMethod:this.newVerifyMethod,cssStyles:[],classes:[\\\"default\\\"]},this.requirements.set(t,r)),this.newId=this.newText=this.newRisk=this.newVerifyMethod=\\\"\\\",r}setNewReqId(t){this.newId=t}setNewReqText(t){this.newText=t}setNewReqRisk(t){this.newRisk=t}setNewReqVerifyMethod(t){this.newVerifyMethod=t}addElement(t){let n=this.elements.get(t);return n===void 0&&(n={name:t,type:this.newElementType,docRef:this.newDocRef,cssStyles:[],classes:[\\\"default\\\"]},this.elements.set(t,n)),this.newElementType=this.newDocRef=\\\"\\\",n}setNewElementType(t){this.newElementType=t}setNewElementDocRef(t){this.newDocRef=t}addRelationship(t,n,r){this.relations.push({type:t,src:n,dst:r})}node(t){return this.requirements.get(t)??this.elements.get(t)}setCssStyle(t,n){for(let r of t){let i=this.node(r);if(!n||!i)return;for(let s of n)this.copy(i.cssStyles,s.includes(\\\",\\\")?s.split(\\\",\\\"):[s])}}setClass(t,n){for(let r of t){let i=this.node(r);if(i)for(let s of n){i.classes.push(s);let a=this.classes.get(s)?.styles;a&&this.copy(i.cssStyles,a)}}}defineClass(t,n){for(let r of t){let i=this.classes.get(r);i===void 0&&(i={id:r,styles:[],textStyles:[]},this.classes.set(r,i));for(let a of n)a.includes(\\\"color\\\")&&i.textStyles.push(a.replace(\\\"fill\\\",\\\"bgFill\\\")),i.styles.push(a);let s=n.flatMap(a=>a.split(\\\",\\\"));for(let a of this.requirements.values())a.classes.includes(r)&&this.copy(a.cssStyles,s);for(let a of this.elements.values())a.classes.includes(r)&&this.copy(a.cssStyles,s)}}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}};var Qh=[\\\"$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\\\"],Nx=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]]);var tk=/accTitle\\\\s*:\\\\s*/iy,nk=/accDescr\\\\s*:\\\\s*/iy,rk=/accDescr\\\\s*\\\\{\\\\s*/iy,id=/direction\\\\s+(?:(TB)|(BT)|(RL)|LR)/gi,Zh=/[\\\\n\\\\r\\\\u2028\\\\u2029]/g,sk=22,Ix=new Uint8Array(128);for(let e of`:,\\\\r\\r\\n{\u003C>-=`)Ix[e.charCodeAt(0)]=1;function kx(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=[[],[],[],[]],l=[[],[],[],[]],u=[0,0,0,0],h=!1,d=-1;id.lastIndex=0;for(let O=id.exec(e);O!==null;O=id.exec(e)){let v=O[1]!==void 0?0:O[2]!==void 0?1:O[3]!==void 0?2:3;c[v].push(O.index),l[v].push(id.lastIndex),h=!0}let m=(O,v,G)=>{n.push(O),r.push(e.slice(v,G)),i.push(v),o=G},p=O=>{s.push(a),a=O},y=()=>{s.length>0&&(a=s.pop())},E=(O,v)=>(O.lastIndex=v,O.test(e)?O.lastIndex:-1),b=O=>{let v=e.indexOf(`\\r\\n`,O);return v===-1?t:v},S=()=>{if(d\u003Co){Zh.lastIndex=o,d=Zh.test(e)?Zh.lastIndex-1:t;for(let O=0;O\u003C4;O++){let v=c[O],G=u[O];for(;G\u003Cv.length&&v[G]\u003C=d;)G++;u[O]=G}}for(let O=0;O\u003C4;O++){let v=u[O]-1;if(v>=0&&c[O][v]>=o)return m(8+O,o,b(l[O][v])),!0}return!1},x=O=>{let v=O|32;if(v===116&&e.slice(o+1,o+5).toLowerCase()===\\\"itle\\\"&&qe(e.charCodeAt(o+5))){let G=o+6;for(;G\u003Ct;){let K=e.charCodeAt(G);if(K===35||K===10||K===59)break;G++}if(G>o+6)return m(2,o,G),!0}if(v===97&&(e.charCodeAt(o+1)|32)===99&&(e.charCodeAt(o+2)|32)===99){let G;if((G=E(tk,o))>=0)return p(3),m(3,o,G),!0;if((G=E(nk,o))>=0)return p(4),m(5,o,G),!0;if((G=E(rk,o))>=0)return p(5),o=G,!0}if(h&&!Us(O)&&S())return!0;if(O===10||O===13&&e.charCodeAt(o+1)===10){let G=o;for(;G\u003Ct;){let K=e.charCodeAt(G);if(K===10)G++;else if(K===13&&e.charCodeAt(G+1)===10)G+=2;else break}return m(12,o,G),!0}if(qe(O)){for(o++;o\u003Ct&&qe(e.charCodeAt(o));)o++;return!0}if(O===35||O===37)return o=b(o),!0;if(ot(O)){let G=o+1;for(;G\u003Ct&&ot(e.charCodeAt(G));)G++;if(G-o\u003C=sk){let K=Nx.get(e.slice(o,G).toLowerCase());if(K!==void 0)return(K===46||K===47||K===48)&&p(2),m(K,o,G),!0}for(;G\u003Ct;){let K=e.charCodeAt(G);if(K\u003C128&&Ix[K]===1)break;G++}return n.push(59),r.push(e.slice(o,G).trim()),i.push(o),o=G,!0}switch(O){case 123:return m(15,o,o+1),!0;case 125:return m(16,o,o+1),!0;case 58:return e.charCodeAt(o+1)===58&&e.charCodeAt(o+2)===58?m(17,o,o+3):m(18,o,o+1),!0;case 60:return e.charCodeAt(o+1)!==45?!1:(m(55,o,o+2),!0);case 45:return e.charCodeAt(o+1)===62?m(56,o,o+2):m(57,o,o+1),!0;case 34:return p(1),o++,!0;case 44:return m(60,o,o+1),!0}return!1},I=O=>{if(ot(O)){let v=o+1;for(;v\u003Ct&&ot(e.charCodeAt(v));)v++;return m(49,o,v),!0}switch(O){case 58:return m(50,o,o+1),!0;case 59:return m(51,o,o+1),!0;case 37:return m(52,o,o+1),!0;case 45:return m(53,o,o+1),!0;case 35:return m(54,o,o+1),!0;case 32:return o++,!0;case 34:return p(1),o++,!0;case 10:return y(),o++,!0;case 44:return m(60,o,o+1),!0}return!1};for(;o\u003Ct;){let O=e.charCodeAt(o),v=!0;switch(a){case 0:v=x(O);break;case 2:v=I(O);break;case 1:if(O===34)y(),o++;else{let G=e.indexOf('\\\"',o);m(58,o,G===-1?t:G)}break;case 3:y(),m(4,o,b(o));break;case 4:y(),m(6,o,b(o));break;case 5:if(O===125)y(),o++;else{let G=e.indexOf(\\\"}\\\",o);m(7,o,G===-1?t:G)}break}if(!v)return n.push(1),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i}}let L=a===0?13:a===1?58:a===3?4:a===4?6:a===5?7:-1;return L!==-1&&m(L,t,t),m(0,t,t),{types:n,texts:r,starts:i}}var ik=[hi.REQUIREMENT,hi.FUNCTIONAL_REQUIREMENT,hi.INTERFACE_REQUIREMENT,hi.PERFORMANCE_REQUIREMENT,hi.PHYSICAL_REQUIREMENT,hi.DESIGN_CONSTRAINT,sd.LOW_RISK,sd.MED_RISK,sd.HIGH_RISK,Ia.VERIFY_ANALYSIS,Ia.VERIFY_DEMONSTRATION,Ia.VERIFY_INSPECTION,Ia.VERIFY_TEST,\\\"\\\",Yr.CONTAINS,Yr.COPIES,Yr.DERIVES,Yr.SATISFIES,Yr.VERIFIES,Yr.REFINES,Yr.TRACES];function $x(e){return e===49||e===50||e===54||e===53||e===51}function Lx(e,t){let{types:n,texts:r,starts:i}=kx(e),s=0,a=[],o=[],c=(b,S=b,...x)=>{let I=n[s];if(I===1)throw ft(\\\"requirement\\\",e,i[s],\\\"\\\",!0);for(let O=S;O>=b;O--)x.unshift(O);let L=x.map(O=>`'${Qh[O]}'`).join(\\\", \\\");throw ft(\\\"requirement\\\",e,i[s],`Expecting ${L}, got '${Qh[I]}'`)},l=b=>(n[s]!==b&&c(b),r[s++]),u=(b,S)=>{let x=n[s];return(x\u003Cb||x>S)&&c(b,S),s++,ik[x-23]},h=()=>{let b=n[s];return b!==59&&b!==58&&c(58,59),r[s++]},d=()=>{let b=n[s];if(b===3)s++,t.setAccTitle(l(4).trim());else if(b===5)s++,t.setAccDescription(l(6).trim());else if(b===7)t.setAccDescription(r[s++].trim());else return!1;return!0},m=()=>{let b=[];for(;;){let S=n[s];if(S!==49&&S!==59&&S!==58&&c(58,59,49),b.push(r[s++]),n[s]!==60)return b;s++}},p=()=>{let b=[];for(;;){$x(n[s])||c(49,51,53,54);let S=r[s++];for(;$x(n[s]);)S+=r[s++];if(b.push(S),n[s]!==60)return b;s++}},y=()=>{let b;return n[s]===17?(s++,b=m(),l(15)):n[s]===15?s++:c(15,15,17),l(12),b},E=b=>{for(a.length=0,o.length=0;;){let S=n[s];if(S===16){s++;break}if(S===12){s++;continue}(b?S\u003C19||S>22:S!==44&&S!==45)&&(b&&c(19,22,12,16),c(44,45,12,16)),s++,l(18),o.push(S===21?u(29,31):S===22?u(32,35):h()),a.push(S),l(12)}for(let S=a.length-1;S>=0;S--){let x=o[S];switch(a[S]){case 19:t.setNewReqId(x);break;case 20:t.setNewReqText(x);break;case 21:t.setNewReqRisk(x);break;case 22:t.setNewReqVerifyMethod(x);break;case 44:t.setNewElementType(x);break;default:t.setNewElementDocRef(x)}}};for(;d();)n[s]===12&&s++;for(n[s]!==14&&c(14,14,3,5,7),s++,l(12);;){let b=n[s];if(b===13)return;if(b===12)s++;else{if(d())continue;if(b>=8&&b\u003C=11)s++,t.setDirection(b===8?\\\"TB\\\":b===9?\\\"BT\\\":b===10?\\\"RL\\\":\\\"LR\\\");else if(b>=23&&b\u003C=28){let S=u(23,28),x=h(),I=y();E(!0),t.addRequirement(x,S),I&&t.setClass([x],I)}else if(b===36){s++;let S=h(),x=y();E(!1),t.addElement(S),x&&t.setClass([S],x)}else if(b===46){s++;let S=m();t.setCssStyle(S,p())}else if(b===47){s++;let S=m();t.defineClass(S,p())}else if(b===48){s++;let S=m();t.setClass(S,m())}else if(b===59||b===58){let S=r[s++],x=n[s];if(x===17)s++,t.setClass([S],m());else if(x===55||x===57){s++;let I=u(37,43);l(x===57?56:57);let L=h();x===57?t.addRelationship(I,S,L):t.addRelationship(I,L,S)}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 Ox(e){let t=[];for(let i of e.requirements.values())t.push({id:i.name,requirement:i,element:void 0,cssStyles:i.cssStyles,cssClasses:i.classes.join(\\\" \\\")});for(let i of e.elements.values())t.push({id:i.name,requirement:void 0,element:i,cssStyles:i.cssStyles,cssClasses:i.classes.join(\\\" \\\")});let n=i=>e.requirements.has(i)||e.elements.has(i)?i:void 0,r=e.relations.map((i,s)=>({id:`${i.src}-${i.dst}-${s}`,start:n(i.src),end:n(i.dst),type:i.type,contains:i.type===Yr.CONTAINS}));return{nodes:t,edges:r,direction:e.direction}}var ok=40,ak=16,ck=56,od=14,ka=10,Jh=2,Dx=12,lk=120,dk=280,uk=240,ep=26,Bx=6,vx=9,ad=4.5,fk=28,hk=14;function cd(e,t,n){if(t===0||e.lines.length===0)return e;let r=0,i=[],s=e.lines.map(a=>{let o=0,c=a.map(l=>{let u=l.style|t,h=l.icon!==void 0||l.math?l.width:n.width(l.text,e.size,u);return o+=h,{...l,style:u,width:h}});return i.push(o),o>r&&(r=o),c});return{...e,lines:s,widths:i,width:r}}function Px(e,t,n,r){let i=Xr(e),s=\\\"\\\",a=\\\"\\\";for(let o=0;o\u003Ce.lines.length;o++){let c=e.lines[o],l=n+Nr(e,o);if(Yi(c)){a+=Ne(Ir(e,o),t+e.widths[o]/2,l,r);continue}let u=l+e.size*.35,h=!0;for(let d of c)d.icon!==void 0||d.text===\\\"\\\"||(s+=`\u003Ctspan${h?` x=\\\"${f(t)}\\\" y=\\\"${f(u)}\\\"`:\\\"\\\"}${_r(d.style&~i)}>${rt(d.text)}\u003C/tspan>`,h=!1)}return(s===\\\"\\\"?\\\"\\\":`\u003Ctext${qn(r,i)} text-anchor=\\\"start\\\" xml:space=\\\"preserve\\\">${s}\u003C/text>`)+a}function pk(e,t,n,r){let i=Bx,s=e-n*i,a=t-r*i;return`\u003Ccircle class=\\\"pele-marker\\\" cx=\\\"${f(s)}\\\" cy=\\\"${f(a)}\\\" r=\\\"${i}\\\"/>\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(s-n*i)},${f(a-r*i)}L${f(s+n*i)},${f(a+r*i)}M${f(s+r*i)},${f(a-n*i)}L${f(s-r*i)},${f(a+n*i)}\\\"/>`}function mk(e,t,n,r){let i=e-n*vx,s=t-r*vx;return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(i-r*ad)},${f(s+n*ad)}L${f(e)},${f(t)}L${f(i+r*ad)},${f(s-n*ad)}\\\" stroke-linejoin=\\\"round\\\"/>`}function gk(e,t,n){let r=new Map;for(let i of t){let s=i.route;if(!(i.src===i.dst||s.length\u003C6))for(let a of[0,s.length-3]){let o=a===0?i.src:i.dst,c=e[o],l=s[a]-c.x,u=s[a+1]-c.y,h=a===0?3:a-3,d;if(Math.abs(Math.abs(u)-c.h/2)\u003C.5)d=u\u003C0?0:2;else if(Math.abs(Math.abs(l)-c.w/2)\u003C.5)d=l\u003C0?3:1;else continue;let m=o*4+d,p={route:s,at:a,toward:s[d%2===0?h:h+1]},y=r.get(m);y?y.push(p):r.set(m,[p])}}for(let[i,s]of r){if(s.length\u003C2)continue;let a=i>>2,o=i%2===1,c=(o?n[a].h:n[a].w)-2*hk,l=Math.max(0,Math.min(fk,c/(s.length-1)));s.sort((u,h)=>u.toward-h.toward);for(let u=0;u\u003Cs.length;u++){let h=(u-(s.length-1)/2)*l;o?s[u].route[s[u].at+1]=e[a].y+h:s[u].route[s[u].at]=e[a].x+h}}}function Wx(e,t,n){return Pn(e.direction)?Pt(n,r=>Fx(e,t,n,r)):Fx(e,t,n,!1)}function Fx(e,t,n,r){let i=Ox(e),s=n.fontSize??16,a=Math.round(s*.875),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=new Map,u=[],h=[];for(let z of i.nodes){let M=Ct(z.cssStyles),T=(M.bold?1:0)|(M.italic?2:0),R=M.fontSize??s,_=M.fontSize??a,$=z.requirement,g=z.element,N=cd(Ge(`«${$?$.type:\\\"Element\\\"}»`,!1,o,_,4e3),T,o),w=cd(Ge(z.id,!0,o,R,dk),T|1,o),A=$?[[\\\"ID\\\",$.requirementId],[\\\"Text\\\",$.text],[\\\"Risk\\\",$.risk],[\\\"Verification\\\",$.verifyMethod]]:[[\\\"Type\\\",g.type],[\\\"Doc Ref\\\",g.docRef]],D=[],U=0,B=0,F=0;for(let[Y,ne]of A){if(!ne)continue;let q=cd(Ge(Y,!1,o,_,4e3),T,o),k=cd(Ge(ne,!0,o,_,uk),T,o),J=Math.max(q.height,k.height);D.push({key:q,value:k,height:J}),U=Math.max(U,q.width),B=Math.max(B,k.width),F+=J+Jh}D.length>0&&(F+=2*ka-Jh);let W=2*ka+N.height+w.height,j=Math.max(lk,Math.max(N.width,w.width)+2*od,D.length>0?U+Dx+B+2*od:0);l.has(z.id)||l.set(z.id,u.length);let Q=Bt(j,W+F);Q.seq=u.length,u.push({node:z,style:M,kind:N,name:w,rows:D,keyWidth:U,headHeight:W,w:j,h:W+F}),h.push(Q)}let d=r?\\\"TB\\\":ln(i.direction),m=d===\\\"LR\\\"||d===\\\"RL\\\",p=[],y=[],E=[];for(let z of i.edges){let M=z.start===void 0?void 0:l.get(z.start),T=z.end===void 0?void 0:l.get(z.end);if(M===void 0||T===void 0)continue;let R=Ge(`«${z.type}»`,!1,o,a,4e3);M===T&&(m?h[M].h+=2*(ep+R.height+8):h[M].w+=2*(ep+R.width+12)),E.push(z),y.push(R),p.push({src:M,dst:T,minlen:1,labelW:R.width+12,labelH:R.height+4,route:[],labelX:0,labelY:0})}let b=On(h,p,d,{nodeSep:ok,edgeSep:ak,rankSep:ck,portSep:20});gk(h,p,u);let S=yn(e.title,o,s,4e3),x=S.height>0?S.height+12:0,I=Math.max(b.width,S.width),L=c+(I-b.width)/2,O=c+x,v=Math.ceil(I+2*c),G=Math.ceil(b.height+x+2*c),K=\\\"\\\";for(let z=0;z\u003Cu.length;z++){let M=u[z],{w:T,h:R,style:_}=M,$=vt(_),g=$||' fill=\\\"var(--_m)\\\"',N=-T/2,w=-R/2,A=`\u003Crect x=\\\"${f(N)}\\\" y=\\\"${f(w)}\\\" width=\\\"${f(T)}\\\" height=\\\"${f(R)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${At(_.shape)}/>`+Ne(M.kind,0,w+ka+M.kind.height/2,` class=\\\"pele-stereotype\\\" font-size=\\\"${M.kind.size}\\\"${g}${_.text}`)+Ne(M.name,0,w+ka+M.kind.height+M.name.height/2,` class=\\\"pele-label\\\" font-size=\\\"${M.name.size}\\\" font-weight=\\\"var(--_hw)\\\"${$}${_.text}`);if(M.rows.length>0){let D=w+M.headHeight;A+=`\u003Cpath class=\\\"pele-divider\\\" d=\\\"M${f(N)},${f(D)}H${f(-N)}\\\" stroke=\\\"var(--_b)\\\"${_.line}/>`;let U=D+ka,B=\\\"\\\";for(let F of M.rows)B+=Px(F.key,N+od,U,` class=\\\"pele-field\\\"${g}${_.text}`)+Px(F.value,N+od+M.keyWidth+Dx,U,` class=\\\"pele-value\\\"${$}${_.text}`),U+=F.height+Jh;A+=`\u003Cg class=\\\"pele-fields\\\" font-size=\\\"${M.rows[0].key.size}\\\">${B}\u003C/g>`}K+=`\u003Cg class=\\\"pele-node ${M.node.requirement?\\\"pele-requirement\\\":\\\"pele-element\\\"}${It(M.node.cssClasses.replace(/^default\\\\s?/,\\\"\\\"))}\\\" data-id=\\\"${Ue(M.node.id)}\\\" transform=\\\"translate(${f(h[z].x+L)},${f(h[z].y+O)})\\\">${A}\u003C/g>`}let C=\\\"\\\",Z=\\\"\\\",oe=new Map;for(let z=0;z\u003Cp.length;z++){let M=p[z],T=E[z],R=y[z],_=T.contains?2*Bx:0,$,g=M.labelX+L,N=M.labelY+O;if(M.src===M.dst){let w=u[M.src],A=h[M.src].x+L,D=h[M.src].y+O,U=oe.get(M.src)??0;oe.set(M.src,U+1);let B=(m?w.w:w.h)/2,F=Math.min(B-4,12+U*6),W=ep+U*8,j=(Y,ne)=>m?`${f(A+ne)},${f(D+w.h/2+Y)}`:`${f(A+w.w/2+Y)},${f(D+ne)}`,Q=W/.75;$={d:`M${j(_,-F)}C${j(Q,-F)} ${j(Q,F)} ${j(0,F)}`,sx:m?A-F:A+w.w/2,sy:m?D+w.h/2:D-F,sdx:m?0:-1,sdy:m?-1:0,ex:m?A+F:A+w.w/2,ey:m?D+w.h/2:D+F,edx:m?0:-1,edy:m?-1:0},m?(g=A,N=D+w.h/2+W+4+M.labelH/2):(g=A+w.w/2+W+4+M.labelW/2,N=D)}else{let w=M.route.slice();for(let A=0;A\u003Cw.length;A+=3)w[A]+=L,w[A+1]+=O;$=Cn(w,void 0,_,0)}C+=`\u003Cg class=\\\"pele-edge pele-relationship-${T.contains?\\\"contains\\\":\\\"arrow\\\"}\\\" data-id=\\\"${Ue(T.id)}\\\">\u003Cpath d=\\\"${$.d}\\\"${T.contains?\\\"\\\":' stroke-dasharray=\\\"5 4\\\"'}/>`+(T.contains?pk($.sx,$.sy,$.sdx,$.sdy):mk($.ex,$.ey,$.edx,$.edy))+\\\"\u003C/g>\\\",Z+=dn(T.id,R,g,N,\\\"\\\")}return{svg:at(\\\"requirement\\\",v,G,s,n,e,Ne(S,v/2,c+S.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(C?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${C}\u003C/g>`:\\\"\\\")+(Z?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${a}\\\" fill=\\\"var(--_m)\\\">${Z}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${K}\u003C/g>`),width:v,height:G,links:[]}}var Ux={type:\\\"requirement\\\",math:!0,parse(e,t,n){let r=new rd;return n&&(r.title=n),Lx(e,r),r},render:Wx};var ld=class{constructor(){fe(this,\\\"type\\\",\\\"sankey\\\");fe(this,\\\"nodes\\\",[]);fe(this,\\\"links\\\",[]);fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"lookup\\\",new Map)}findOrCreateNode(t){let n=this.lookup.get(t);return n===void 0&&(n={id:t,index:this.nodes.length},this.lookup.set(t,n),this.nodes.push(n)),n}addLink(t,n,r){this.links.push({source:t,target:n,value:r})}};var dd=[\\\"$end\\\",\\\"STUCK\\\",\\\"SANKEY\\\",\\\"NEWLINE\\\",\\\"COMMA\\\",\\\"DQUOTE\\\",\\\"NON_ESCAPED_TEXT\\\",\\\"ESCAPED_TEXT\\\",\\\"EOF\\\"];function Gx(e){return e>=32&&e\u003C=126&&e!==34&&e!==44||e>=160&&e\u003C=55295||e>=57344&&e\u003C=65533||e>=65536&&e\u003C=1114111}function Yx(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=(u,h,d)=>{n.push(u),r.push(e.slice(h,d)),i.push(h),o=d},l=u=>e.slice(o,o+u.length).toLowerCase()===u&&!ot(e.charCodeAt(o+u.length));for(;o\u003Ct;){let u=e.charCodeAt(o),h=o,d=o;if(a===2){if(u===34&&e.charCodeAt(o+1)!==34){s.length>0&&(a=s.pop()),c(5,o,o+1);continue}for(;d\u003Ct;){let m=e.codePointAt(d);if(Gx(m)||m===44||m===13||m===10)d+=m>65535?2:1;else if(m===34&&e.charCodeAt(d+1)===34)d+=2;else break}c(7,o,d)}else{if(a===0&&(u|32)===115){let m=l(\\\"sankey-beta\\\")?11:l(\\\"sankey\\\")?6:0;if(m>0){s.push(a),a=1,c(2,o,o+m);continue}}if(u===10||u===13&&e.charCodeAt(o+1)===10){c(3,o,u===10?o+1:o+2);continue}if(u===44){c(4,o,o+1);continue}if(u===34){s.push(a),a=2,c(5,o,o+1);continue}for(;d\u003Ct;){let m=e.codePointAt(d);if(!Gx(m))break;d+=m>65535?2:1}c(6,o,d)}if(d===h)return c(1,o,o),{types:n,texts:r,starts:i}}return c(a===2?7:8,t,t),c(0,t,t),{types:n,texts:r,starts:i}}var Hx=/[\\\\n\\\\r]+/g,bk=/[\\\\x00-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\ud800-\\\\udfff\\\\ufffe\\\\uffff]/u;function tp(e){return e===10||e===13?!1:e\u003C128?e===32||e===9||e===11||e===12:e===160||e===5760||e>=8192&&e\u003C=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function yk(e,t){let n=e.length;for(;n>0&&tp(e.charCodeAt(n-1));)n--;let r=\\\"\\\",i=0,s=!1;for(let a=0;a\u003Cn;){let o=e.charCodeAt(a);if(s)o===34&&(e.charCodeAt(a+1)===34?a++:s=!1),a++;else if(o===34)s=!0,a++;else if(tp(o)){let c=a+1;for(;tp(e.charCodeAt(c));)c++;let l=e.charCodeAt(a-1),u=e.charCodeAt(c);(a===0||u===10||u===13||(l===10||l===13)&&u!==44)&&(r+=e.slice(i,a),t.push([a,c,0]),i=c),a=c}else a++}return n\u003Ce.length&&t.push([n,e.length,0]),r+e.slice(i,n)}function np(e,t){let n=[],r=yk(e,n),i=r.replace(Hx,`\\r\\n`),s=i.trim();if(t!==void 0){let a=i.length-i.trimStart().length;t.push(n,ds(r,Hx,1),[[0,a,0],[a+s.length,i.length,0]])}return s}function Kx(e,t,n=e){let{types:r,texts:i,starts:s}=Yx(e),a=0,o=(d,m)=>{let p=[];n!==e&&np(n,p);let y=d>0&&d>=e.length?zr(p,e.length-1)+1:zr(p,d);return ft(\\\"sankey\\\",n,y,m)},c=d=>{let m=r[a],p=m===1?dd[r[a-1]]:dd[m];throw o(s[a],`Expecting ${d}, got '${p}'`)},l=(d,m=\\\"\\\")=>{r[a]!==d&&c(`'${dd[d]}'${m}`),a++},u=()=>{if(r[a]===6)return i[a++];r[a]!==5&&c(\\\"'DQUOTE', 'NON_ESCAPED_TEXT'\\\"),a++,r[a]!==7&&c(\\\"'ESCAPED_TEXT'\\\");let d=i[a++];return l(5),d},h=()=>{let d=s[a],m=u().trim().replaceAll('\\\"\\\"','\\\"');if(bk.test(bt(m)))throw o(d,\\\"Invalid XML character in node name\\\");return m};for(l(2),l(3);;){let d=h();l(4,\\\", 'NEWLINE', 'EOF'\\\");let m=h();l(4,\\\", 'NEWLINE', 'EOF'\\\");let p=s[a],y=parseFloat(u());if(!Number.isFinite(y))throw o(p,\\\"Expecting a number\\\");let E=t.findOrCreateNode(d),b=t.findOrCreateNode(m);if(t.addLink(E,b,y),r[a]!==3)break;a++}r[a]===8&&a++,r[a]!==0&&c(\\\"'NEWLINE', 'EOF'\\\")}var Ek=6;function rp(e,t){if(e.length>8){e.sort(t);return}for(let n=1;n\u003Ce.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 zx(e,t){let n=e.nodes.length,r=e.links.map(R=>({source:R.source.index,target:R.target.index,value:Number.isFinite(R.value)&&R.value>0?R.value:0,thickness:0,sourceY:0,targetY:0})),i=[],s=[];for(let R=0;R\u003Cn;R++)i.push([]),s.push([]);r.forEach((R,_)=>{i[R.source].push(_),s[R.target].push(_)});let a=new Int32Array(n),o=new Int32Array(n),c=[];for(let R=0;R\u003Cn;R++)o[R]=s[R].length,o[R]===0&&c.push(R);for(let R=0;R\u003Cc.length;R++){let _=c[R];for(let $ of i[_]){let g=r[$].target;a[g]\u003Ca[_]+1&&(a[g]=a[_]+1),--o[g]===0&&c.push(g)}}if(c.length\u003Cn){let R=0;for(;o[R]===0;)R++;let _=new Uint8Array(n);for(;_[R]===0;){_[R]=1;for(let $ of s[R])if(o[r[$].source]>0){R=r[$].source;break}}throw new Qe(`Sankey diagrams cannot have circular links, and \\\"${e.nodes[R].id}\\\" is part of one.`,\\\"semantic\\\",{type:\\\"sankey\\\"})}let l=1;for(let R=0;R\u003Cn;R++)a[R]+1>l&&(l=a[R]+1);let u=new Int32Array(n);for(let R=n-1;R>=0;R--){let _=c[R];for(let $ of i[_])u[_]\u003Cu[r[$].target]+1&&(u[_]=u[r[$].target]+1)}let h=0;for(let R of r)R.value>h&&(h=R.value);let d=h>0?1/h:0,m=[],p=new Float64Array(n),y=[];for(let R=0;R\u003Cl;R++)y.push([]);let E=l>1?(t.width-t.nodeWidth)/(l-1):0;for(let R=0;R\u003Cn;R++){let _;if(t.alignment===\\\"left\\\")_=a[R];else if(t.alignment===\\\"right\\\")_=l-1-u[R];else if(t.alignment===\\\"center\\\"){if(_=a[R],s[R].length===0&&i[R].length>0){_=l;for(let A of i[R])a[r[A].target]-1\u003C_&&(_=a[r[A].target]-1)}}else _=i[R].length>0?a[R]:l-1;let $=0,g=0,N=0,w=0;for(let A of s[R])$+=r[A].value*d,N+=r[A].value;for(let A of i[R])g+=r[A].value*d,w+=r[A].value;p[R]=Math.max($,g),m.push({layer:_,value:Math.max(N,w),x:_*E,y:0,height:0}),y[_].push(R)}let b=1;for(let R of y)R.length>b&&(b=R.length);let S=b>1?Math.min(t.nodePadding,t.height/(b-1)):t.nodePadding,x=1/0;for(let R of y){let _=0;for(let $ of R)_+=p[$];_>0&&(x=Math.min(x,(t.height-(R.length-1)*S)/_))}(!Number.isFinite(x)||x\u003C0)&&(x=0);let I=Math.max(0,t.labelHeight-S),L=R=>{for(let _ of y){let $=(_.length-1)*S;for(let g of _)$+=Math.max(p[g]*R,I);if($>t.height+1e-6)return!1}return!0};if(I>0&&!L(x))if(L(0)){let R=0;for(let _=0;_\u003C40;_++){let $=(R+x)/2;L($)?R=$:x=$}x=R}else I=0;let O=new Float64Array(n);for(let R of r)R.thickness=R.value*d*x;for(let R of y){let _=0;for(let g of R)m[g].height=p[g]*x,O[g]=Math.max(0,I-m[g].height)/2,m[g].y=_+O[g],_+=m[g].height+2*O[g]+S;let $=(t.height-_+S)/(R.length+1);R.forEach((g,N)=>m[g].y+=$*(N+1))}let v=R=>m[R].y+m[R].height/2,G=new Float64Array(r.length),K=new Float64Array(r.length),C=(R,_)=>v(r[R].target)-v(r[_].target)||R-_,Z=(R,_)=>v(r[R].source)-v(r[_].source)||R-_,oe=(R,_)=>v(R)-v(_)||R-_,H=R=>{let _=0;rp(i[R],C);for(let $ of i[R])G[$]=_+r[$].thickness/2,_+=r[$].thickness},z=R=>{let _=0;rp(s[R],Z);for(let $ of s[R])K[$]=_+r[$].thickness/2,_+=r[$].thickness},M=()=>{for(let R=0;R\u003Cn;R++)H(R),z(R)},T=(R,_,$)=>{for(let N of R){let w=$?s[N]:i[N];if(w.length===0)continue;$?z(N):H(N);let A=0,D=0,U=0;for(let F of w){let W=$?m[r[F].source].y+G[F]-K[F]:m[r[F].target].y+K[F]-G[F];A+=W*r[F].thickness,D+=r[F].thickness,U+=v($?r[F].source:r[F].target)-m[N].height/2}let B=D>0?A/D:U/w.length;m[N].y+=(B-m[N].y)*_}rp(R,oe);let g=0;for(let N of R)m[N].y-O[N]\u003Cg&&(m[N].y=g+O[N]),g=m[N].y+m[N].height+O[N]+S;g=t.height;for(let N=R.length-1;N>=0;N--){let w=R[N];m[w].y+m[w].height+O[w]>g&&(m[w].y=g-m[w].height-O[w]),g=m[w].y-O[w]-S}};M();for(let R=0;R\u003CEk;R++){let _=Math.pow(.99,R);for(let $=l-2;$>=0;$--)T(y[$],_,!1);M();for(let $=1;$\u003Cl;$++)T(y[$],_,!0);M()}for(let R=0;R\u003Cr.length;R++)r[R].sourceY=m[r[R].source].y+G[R],r[R].targetY=m[r[R].target].y+K[R];return{nodes:m,links:r}}var Hr=6,xk=15,Ak=1.8,Vx=300;function Sk(e){let t=2166136261,n=5381;for(let r=0;r\u003Ce.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 Qx(e){return typeof e==\\\"object\\\"&&e!==null&&!Array.isArray(e)}function ud(e,t,n,r,i){let s=e[t];return typeof s==\\\"number\\\"&&s>=r?Math.min(s,i):n}function jx(e,t){let n=e[t];return typeof n==\\\"string\\\"||typeof n==\\\"number\\\"&&Number.isFinite(n)?String(n):\\\"\\\"}function Xx(e){return Math.abs(e)\u003C1e15?Math.round(e*100)/100:e}function qx(e){return typeof e==\\\"string\\\"?Ct([`fill:${e}`]).shape:\\\"\\\"}function Zx(e,t,n){let r=Qx(t.sankey)?t.sankey:{},i=ud(r,\\\"width\\\",600,1,1e4);return ms(n,i,160,s=>wk(e,r,n,s,i))}function wk(e,t,n,r,i){let s=n.fontSize??16,a=Math.round(s*.625),o=Math.max(a,Math.round(s*.875*Math.min(1,r/i))),c=n.measurer??ct(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=ud(t,\\\"height\\\",400,1,1e4),h=Math.min(ud(t,\\\"nodeWidth\\\",10,1,200),r),d=t.showValues!==!1,m=bt(jx(t,\\\"prefix\\\")),p=bt(jx(t,\\\"suffix\\\")),y=t.labelStyle===\\\"outlined\\\",E=t.nodeAlignment===\\\"left\\\"||t.nodeAlignment===\\\"right\\\"||t.nodeAlignment===\\\"center\\\"?t.nodeAlignment:\\\"justify\\\",b=typeof t.linkColor==\\\"string\\\"?t.linkColor:\\\"gradient\\\",S=te=>zx(e,{width:r,height:u,nodeWidth:h,nodePadding:ud(t,\\\"nodePadding\\\",12,0,200)+(d?xk:0),labelHeight:te*1.15,alignment:E}),x=S(o),I=new Map,L=1;for(let te of x.nodes){let se=(I.get(te.layer)??0)+1;I.set(te.layer,se),se>L&&(L=se)}let O=Math.max(a,Math.round(u/L/Ak));O\u003Co&&(o=O,x=S(o));let{nodes:v,links:G}=x,K=o*1.5,C=new Map;if(Qx(t.nodeColors))for(let[te,se]of Object.entries(t.nodeColors)){let re=qx(se);re&&C.set(te,re)}let Z=te=>C.get(e.nodes[te].id)??\\\"\\\",oe=te=>/^ style=\\\"fill:(.*);\\\"$/.exec(Z(te))?.[1]??Et(te),H=0,z=0;v.forEach(te=>{te.value>z&&(z=te.value,H=te.layer)});let M=0,T=r,R=0,_=u,$=v.map((te,se)=>{let re=bt(e.nodes[se].id),P=d?`${m}${Xx(te.value)}${p}`:\\\"\\\",ee=c.width(P?`${re} ${P}`:re,o,0),ae=y?te.layer>=H:te.x\u003Cr/2,ue=ae?te.x+h+Hr:te.x-Hr,ce=te.y+te.height/2;return M=Math.min(M,ae?ue:ue-ee),T=Math.max(T,ae?ue+ee:ue),R=Math.min(R,ce-o*.75),_=Math.max(_,ce+o*.75),{value:P,width:ee,after:ae,left:ae?ue:ue-ee,y:ce}}),g=new Map;if(v.length\u003C=Vx)for(let te of $){let se=Math.floor(te.y/K);for(let re of[se-2,se-1,se,se+1,se+2]){let P=g.get(re);P?P.push(te):g.set(re,[te])}}let N=\\\"\\\",w=\\\"\\\";v.forEach((te,se)=>{let re=e.nodes[se].id,P=bt(re),ee=Math.max(te.height,1);w+=`\u003Crect class=\\\"pele-sankey-node\\\" data-id=\\\"${Ue(re)}\\\" x=\\\"${f(te.x)}\\\" y=\\\"${f(te.y)}\\\" width=\\\"${f(h)}\\\" height=\\\"${f(ee)}\\\" rx=\\\"${f(Math.min(2,ee/2))}\\\" fill=\\\"${Et(se)}\\\"${Z(se)}/>`;let ae=$[se],ue=(Se,_e)=>(g.get(Math.floor(_e/K))??[]).some(xe=>xe!==ae&&Math.abs(xe.y-_e)\u003CK&&Se\u003Cxe.left+xe.width+Hr&&Se+ae.width>xe.left-Hr);if(v.length\u003C=Vx&&ue(ae.left,ae.y))e:for(let Se of[0,-K,K])for(let _e of[ae.after,!ae.after]){let xe=_e?te.x+h+Hr:te.x-Hr-ae.width,Me=ae.y+Se;if(ue(xe,Me)||xe\u003CM||xe+ae.width>T||Me-o*.75\u003CR||Me+o*.75>_||v.some((ke,be)=>be!==se&&xe\u003Cke.x+h+Hr&&xe+ae.width>ke.x-Hr&&Me-o*.75\u003Cke.y+ke.height&&Me+o*.75>ke.y))continue;let Ce=Math.max(0,te.y-Me,Me-te.y-te.height);if(!v.some((ke,be)=>be!==se&&ke.x===te.x&&Math.max(0,ke.y-Me,Me-ke.y-ke.height)\u003C=Ce)){ae.left=xe,ae.y=Me,ae.after=_e;break e}}let{value:ce,after:pe,y:V}=ae,X=pe?te.x+h+Hr:te.x-Hr,le=` x=\\\"${f(X)}\\\" y=\\\"${f(V+o*.35)}\\\" text-anchor=\\\"${pe?\\\"start\\\":\\\"end\\\"}\\\"`,de=rt(P)+(ce?` \u003Ctspan class=\\\"pele-sankey-value\\\" fill=\\\"var(--_m)\\\">${rt(ce)}\u003C/tspan>`:\\\"\\\");N+=`\u003Cg class=\\\"pele-label\\\" data-id=\\\"${Ue(re)}\\\">`+(y?`\u003Ctext${le} fill=\\\"none\\\" stroke=\\\"var(--_bg)\\\" stroke-width=\\\"3\\\" stroke-linejoin=\\\"round\\\">${rt(P)}${ce?\\\" \\\"+rt(ce):\\\"\\\"}\u003C/text>`:\\\"\\\")+`\u003Ctext${le}>${de}\u003C/text>\u003C/g>`});let A=b===\\\"gradient\\\"||b===\\\"source\\\"||b===\\\"target\\\"?\\\"\\\":qx(b),D=n.idPrefix??\\\"\\\",U=b===\\\"gradient\\\"&&/^[\\\\w-]+$/.test(D),B=new Map,F=\\\"\\\";for(let te of G){let se=b===\\\"target\\\"?te.target:te.source,re=Math.max(te.thickness,1)/2,P=v[te.source].x+h,ee=v[te.target].x,ae=`fill=\\\"${Et(se)}\\\"${A||Z(se)}`;if(U){let V=`x1=\\\"${f(P)}\\\" x2=\\\"${f(ee)}\\\">\u003Cstop offset=\\\"0\\\" stop-color=\\\"${oe(te.source)}\\\"/>\u003Cstop offset=\\\"1\\\" stop-color=\\\"${oe(te.target)}\\\"/>`,X=`${D}-sankey-${Sk(V)}`;B.set(X,`\u003ClinearGradient id=\\\"${X}\\\" gradientUnits=\\\"userSpaceOnUse\\\" ${V}\u003C/linearGradient>`),ae=`fill=\\\"url(#${X}) ${oe(te.source)}\\\"`}let ue=f((P+ee)/2),ce=Ue(e.nodes[te.source].id),pe=Ue(e.nodes[te.target].id);F+=`\u003Cpath class=\\\"pele-sankey-link\\\" data-id=\\\"${ce}->${pe}\\\" d=\\\"M${f(P)},${f(te.sourceY-re)}C${ue},${f(te.sourceY-re)} ${ue},${f(te.targetY-re)} ${f(ee)},${f(te.targetY-re)}L${f(ee)},${f(te.targetY+re)}C${ue},${f(te.targetY+re)} ${ue},${f(te.sourceY+re)} ${f(P)},${f(te.sourceY+re)}Z\\\" ${ae}>\u003Ctitle>${ce} → ${pe}: ${rt(m)}${Xx(te.value)}${rt(p)}\u003C/title>\u003C/path>`}let W=Ge(e.title,!1,c,s,kt(n),1),j=W.height>0?W.height+12:0,Q=Math.max(T-M,W.width),Y=l-M+(Q-(T-M))/2,ne=l+j-R,q=Math.ceil(Q+2*l),k=Math.ceil(_-R+j+2*l);return{svg:at(\\\"sankey\\\",q,k,s,n,e,Ne(W,q/2,l+W.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg transform=\\\"translate(${f(Y)},${f(ne)})\\\">`+(B.size>0?`\u003Cdefs>${[...B.values()].join(\\\"\\\")}\u003C/defs>`:\\\"\\\")+`\u003Cg class=\\\"pele-sankey-links\\\" fill-opacity=\\\"0.4\\\">${F}\u003C/g>\u003Cg class=\\\"pele-sankey-nodes\\\">${w}\u003C/g>\u003Cg class=\\\"pele-labels\\\" font-size=\\\"${o}\\\">${N}\u003C/g>\u003C/g>`),width:q,height:k,links:[]}}var Jx={type:\\\"sankey\\\",parse(e,t,n){let r=new ld;return n&&(r.title=n),Kx(np(e),r,e),r},render:Zx};var _k=\\\"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\\\",eA,Rk=/^[+-]?(?:\\\\d+(?:\\\\.\\\\d+)?|\\\\.\\\\d+)(?:e[+-]?\\\\d+)?(%|deg|grad|rad|turn)?$/i;function tA(e){if(e.toLowerCase()===\\\"none\\\")return 4;let t=Rk.exec(e);return t?t[1]===void 0?1:t[1]===\\\"%\\\"?2:3:0}function Tk(e,t){let n=tA(e);return n===1||n===2||t&&n===4}function Mk(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(),s,a,o=i.includes(\\\",\\\");if(o)s=i.split(\\\",\\\").map(l=>l.trim()),s.length===4&&(a=s.pop());else{let l=i.split(\\\"/\\\");if(l.length>2)return!1;s=l[0].trim().split(/\\\\s+/),l.length===2&&(a=l[1].trim())}if(s.length!==3||a!==void 0&&!Tk(a,!o))return!1;let c=s.map(tA);if(o)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 l=0;l\u003C3;l++){let u=c[l];if(!(u===1||u===4||(t&&l===0?u===3:u===2)))return!1}return!0}function nA(e){return e.includes(\\\"(\\\")?Mk(e):(eA??=new Set(_k.split(\\\" \\\")),eA.has(e.toLowerCase()))}var Ck=/^:?wrap:/,Nk=/^:?nowrap:/,Ik=/^:?(?:no)?wrap:/,kk=/^(?:rgba?|hsla?)\\\\s*\\\\(/,rA=/[\\\\r\\\\u2028\\\\u2029]/,$k=/^\\\\w*/;function $a(e){throw new Qe(e,\\\"semantic\\\",{type:\\\"sequence\\\"})}function sA(e){let t=e.trim(),n=Ck.test(t)?!0:Nk.test(t)?!1:void 0;return{text:(n===void 0?t:t.replace(Ik,\\\"\\\")).trim(),wrap:n}}function Lk(e){let t=kk.exec(e);if(t){let r=e.lastIndexOf(\\\")\\\");if(r>=t[0].length)return rA.test(e.slice(t[0].length))?void 0:[e.slice(0,r+1),e.slice(r+1)]}if(rA.test(e))return;let n=$k.exec(e)[0];return[n,e.slice(n.length)]}function iA(e){return typeof e==\\\"string\\\"?[...e].map((t,n)=>[String(n),t]):e!==null&&typeof e==\\\"object\\\"?Object.entries(e):[]}var fd=class{constructor(t={}){fe(this,\\\"type\\\",\\\"sequence\\\");fe(this,\\\"actors\\\",new Map);fe(this,\\\"createdActors\\\",new Map);fe(this,\\\"destroyedActors\\\",new Map);fe(this,\\\"boxes\\\",[]);fe(this,\\\"messages\\\",[]);fe(this,\\\"notes\\\",[]);fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"prevActor\\\");fe(this,\\\"currentBox\\\");fe(this,\\\"lastCreated\\\");fe(this,\\\"lastDestroyed\\\");fe(this,\\\"wrapEnabled\\\");fe(this,\\\"sequenceWrap\\\");fe(this,\\\"active\\\",new Map);this.wrapEnabled=t.wrap,this.sequenceWrap=t.sequenceWrap??!1}autoWrap(){return this.wrapEnabled??this.sequenceWrap}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}setDiagramTitle(t){this.title=t}parseMessage(t){return sA(t)}parseBoxData(t){let n=Lk(t),r=n?.[0]?n[0].trim():\\\"transparent\\\",i=n?.[1]?n[1].trim():void 0;if(nA(r)||(r=\\\"transparent\\\",i=t.trim()),i===void 0)return{text:void 0,color:r,wrap:void 0};let{text:s,wrap:a}=sA(i);return{text:s||void 0,color:r,wrap:a}}addBox(t){this.currentBox={name:t.text,wrap:t.wrap??this.autoWrap(),fill:t.color,actorKeys:[]},this.boxes.push(this.currentBox)}addActor(t,n,r,i,s){let a=this.currentBox,o;if(s!==void 0){let h;try{h=lr(s.includes(`\\r\\n`)?s+`\\r\\n`:`{\\r\\n`+s+`\\r\\n}`)}catch(d){throw new Qe(`Config of participant \\\"${t}\\\" is not valid YAML. ${d.message}`,\\\"syntax\\\",{type:\\\"sequence\\\"})}h!==null&&typeof h==\\\"object\\\"&&!Array.isArray(h)&&(o=h)}let c=o&&Object.prototype.hasOwnProperty.call(o,\\\"type\\\")?o.type:void 0,l=o&&Object.prototype.hasOwnProperty.call(o,\\\"alias\\\")?o.alias:void 0;c!=null&&(i=String(c)),l&&(!r||r.text===n)&&(r={text:String(l),wrap:r?.wrap,type:i});let u=this.actors.get(t);if(!(u&&(this.currentBox&&u.box&&this.currentBox!==u.box&&$a(`A same participant should only be defined in one Box: ${u.name} can't be in '${u.box.name}' and in '${this.currentBox.name}' at the same time.`),a=u.box?u.box:this.currentBox,u.box=a,n===u.name&&r==null))){if((r?.text==null||i==null)&&(r={text:n,type:i}),this.actors.set(t,{box:a,name:n,description:r.text,wrap:r.wrap??this.autoWrap(),prevActor:this.prevActor,links:new Map,properties:new Map,type:i??\\\"participant\\\"}),this.prevActor){let h=this.actors.get(this.prevActor);h&&(h.nextActor=t)}this.currentBox&&this.currentBox.actorKeys.push(t),this.prevActor=t}}addMessage(t,n,r,i){this.messages.push({id:String(this.messages.length),from:t,to:n,message:r.text,wrap:r.wrap??this.autoWrap(),answer:i})}addSignal(t,n,r,i,s=!1,a){if(i===18){let o=t?this.active.get(t)??0:0;o\u003C1&&$a(`Trying to inactivate an inactive participant (${t})`),this.active.set(t,o-1)}else i===17&&t&&this.active.set(t,(this.active.get(t)??0)+1);return this.messages.push({id:String(this.messages.length),from:t,to:n,message:r?.text??\\\"\\\",wrap:r?.wrap??this.autoWrap(),type:i,activate:s,centralConnection:a??0}),!0}addNote(t,n,r){let i=r.wrap??this.autoWrap(),s={actor:t,placement:n,message:r.text,wrap:i},a=typeof t==\\\"string\\\"?[t,t]:t;this.notes.push(s),this.messages.push({id:String(this.messages.length),from:a[0],to:a[1],message:r.text,wrap:i,type:2,placement:n})}addLinks(t,n){let r=this.actors.get(t);if(r)try{let i=JSON.parse(n.text);for(let[s,a]of iA(i))r.links.set(s,a)}catch{return}}addALink(t,n){let r=this.actors.get(t);if(!r)return;let i=n.text.indexOf(\\\"@\\\");r.links.set(n.text.slice(0,i-1).trim(),n.text.slice(i+1).trim())}addProperties(t,n){let r=this.actors.get(t);if(r)try{let i=JSON.parse(n.text);for(let[s,a]of iA(i))r.properties.set(s,a)}catch{return}}addDetails(t,n){let r=this.actors.get(t);r&&(r.details=n.text)}apply(t){let n=[],r=[],i=t;for(;;){i!==void 0&&(Array.isArray(i)?(n.push(i),r.push(0)):typeof i!=\\\"string\\\"&&this.applyOne(i));let s=n.length-1;if(s\u003C0)return;let a=n[s];r[s]\u003Ca.length?i=a[r[s]++]:(n.pop(),r.pop(),i=void 0)}}applyOne(t){let n=t.actor;switch(t.type){case\\\"sequenceIndex\\\":this.messages.push({id:String(this.messages.length),from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible===!0},wrap:!1,type:t.signalType});break;case\\\"addParticipant\\\":this.addActor(n,n,t.description,t.draw,t.config);break;case\\\"createParticipant\\\":this.actors.has(n)&&$a(\\\"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=n,this.addActor(n,n,t.description,t.draw,t.config),this.createdActors.set(n,this.messages.length);break;case\\\"destroyParticipant\\\":this.lastDestroyed=n,this.destroyedActors.set(n,this.messages.length);break;case\\\"activeStart\\\":case\\\"activeEnd\\\":case\\\"centralConnection\\\":case\\\"centralConnectionReverse\\\":this.addSignal(n,void 0,void 0,t.signalType);break;case\\\"addNote\\\":this.addNote(t.actor,t.placement,t.text);break;case\\\"addLinks\\\":this.addLinks(n,t.text);break;case\\\"addALink\\\":this.addALink(n,t.text);break;case\\\"addProperties\\\":this.addProperties(n,t.text);break;case\\\"addDetails\\\":this.addDetails(n,t.text);break;case\\\"addMessage\\\":this.lastCreated?(t.to!==this.lastCreated&&$a(`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&&(t.to!==this.lastDestroyed&&t.from!==this.lastDestroyed&&$a(`The destroyed participant ${this.lastDestroyed} does not have an associated destroying message after its declaration. Please check the sequence diagram.`),this.lastDestroyed=void 0),this.addSignal(t.from,t.to,t.msg,t.signalType,t.activate,t.centralConnection);break;case\\\"boxStart\\\":this.addBox(t.boxData);break;case\\\"boxEnd\\\":this.currentBox=void 0;break;case\\\"loopStart\\\":this.addSignal(void 0,void 0,t.loopText,t.signalType);break;case\\\"rectStart\\\":this.addSignal(void 0,void 0,t.color,t.signalType);break;case\\\"optStart\\\":this.addSignal(void 0,void 0,t.optText,t.signalType);break;case\\\"altStart\\\":case\\\"else\\\":this.addSignal(void 0,void 0,t.altText,t.signalType);break;case\\\"parStart\\\":case\\\"and\\\":this.addSignal(void 0,void 0,t.parText,t.signalType);break;case\\\"criticalStart\\\":this.addSignal(void 0,void 0,t.criticalText,t.signalType);break;case\\\"option\\\":this.addSignal(void 0,void 0,t.optionText,t.signalType);break;case\\\"breakStart\\\":this.addSignal(void 0,void 0,t.breakText,t.signalType);break;case\\\"loopEnd\\\":case\\\"rectEnd\\\":case\\\"optEnd\\\":case\\\"altEnd\\\":case\\\"parEnd\\\":case\\\"criticalEnd\\\":case\\\"breakEnd\\\":this.addSignal(void 0,void 0,void 0,t.signalType);break}}};var sp=[\\\"$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\\\"];var oA=new Uint8Array(128);for(let e=0;e\u003C128;e++){let t=String.fromCharCode(e),n=e===32||e>=9&&e\u003C=13,r=0;`/\\\\\\\\+()\u003C->:\\r\\n,;`.includes(t)||(r|=1),`+\u003C->:\\r\\n,;`.includes(t)||(r|=2),`\u003C>:\\r\\n,;@`.includes(t)||(r|=8|(n?0:4)),`#\\r\\n;`.includes(t)||(r|=16),!`/\\\\\\\\+()\u003C>:\\r\\n,;-`.includes(t)&&!n&&(r|=32),oA[e]=r}function aA(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=-1,l=(_,$,g)=>{n.push(_),r.push(e.slice($,g)),i.push($),o=g},u=(_,$,g,N)=>{n.push(_),r.push(N),i.push($),o=g},h=_=>{s.push(a),a=_},d=()=>{s.length>0&&(a=s.pop())},m=_=>(c\u003C_&&(c=e.indexOf(`\\r\\n`,_),c===-1&&(c=t)),c),p=(_,$)=>{let g=e.charCodeAt(_);return g\u003C128?(oA[g]&$)!==0:$===4||$===32?!qe(g):!0},y=(_,$)=>{for(let g=0;g\u003C$.length;g++){let N=$.charCodeAt(g),w=e.charCodeAt(_+g);if(N>=97&&N\u003C=122?(w|32)!==N:w!==N)return!1}return!0},E=_=>y(o,_)&&!ot(e.charCodeAt(o+_.length)),b=_=>{for(;_\u003Ct&&qe(e.charCodeAt(_));)_++;return _},S=()=>{let _=o;for(;_\u003Ct;){let $=e.charCodeAt(_);if($===10||!qe($))break;_++}return _===o?!1:(o=_,!0)},x=_=>{for(;_\u003Ct&&p(_,16);)_++;return _},I=(_,$,g)=>{l(_,o,o+$),h(g)},L=(_,$,g=-1)=>E(_)?(l($,o,o+_.length),g>=0&&h(g),!0):!1,O=(_,$)=>{if(!y(o,_))return!1;let g=o+_.length,N=e.charCodeAt(g);if(N!==32&&N!==9)return!1;for(;N===32||N===9;)N=e.charCodeAt(++g);return g>=t||!p(g,32)?!1:(l($,o,o+_.length),!0)},v=_=>{let $=e.charCodeAt(_),g=e.charCodeAt(_+1);if($===45){if(g===120||g===88||g===41||g===92||g===47||g===45)return!0;let N=e.charCodeAt(_+2);return g===124&&(N===92||N===47)}return $===47||$===92?(g===124||g===$)&&e.charCodeAt(_+2)===45:$===40&&g===41},G=()=>{let _=o+1;for(;_\u003Ct&&p(_,1);)_++;for(;_\u003Ct&&!v(_);){let $=_;for(;e.charCodeAt($)===45;)$++;if($>=t||!p($,2))break;for($++;$\u003Ct&&p($,2);)$++;_=$}u(48,o,_,e.slice(o,_).trim())},K=()=>{let _=o;for(;xt(e.charCodeAt(_));)_++;let $=_>o;if(e.charCodeAt(_)===46&&xt(e.charCodeAt(_+1))){let N=xt(e.charCodeAt(_+2))?_+3:_+2,w=e.charCodeAt(N);if(w===32||w===10)return l(10,o,N),!0}let g=e.charCodeAt(_);return $&&(g===32||g===10)?(l(10,o,_),!0):!1},C=()=>{let _=e.charCodeAt(o+1),$=e.charCodeAt(o+2);if(_===62)l($===62?55:53,o,o+($===62?3:2));else if(_===120||_===88)l(59,o,o+2);else if(_===41)l(61,o,o+2);else if(_===124&&$===92)l(63,o,o+3);else if(_===124&&$===47)l(64,o,o+3);else if(_===92&&$===92)l(65,o,o+3);else if(_===47&&$===47)l(66,o,o+3);else if(_===45){let g=e.charCodeAt(o+3);$===62?l(g===62?57:54,o,o+(g===62?4:3)):$===120||$===88?l(60,o,o+3):$===41?l(62,o,o+3):$===124&&g===92?l(67,o,o+4):$===124&&g===47?l(68,o,o+4):$===92&&g===92?l(69,o,o+4):$===47&&g===47?l(70,o,o+4):l(46,o,o+1)}else l(46,o,o+1)},Z=_=>{let $=e.charCodeAt(o+1);if($!==124&&$!==_||e.charCodeAt(o+2)!==45)return!1;let g=e.charCodeAt(o+3)===45,N=_===47,w;return $===124?g?w=N?75:76:w=N?71:72:g?w=N?77:78:w=N?73:74,l(w,o,o+(g?4:3)),!0},oe=()=>{if(!y(o,\\\"title\\\"))return!1;let _=o+5,$=e.charCodeAt(_)===58;$&&_++;let g=_;for(;g\u003Ct&&e.charCodeAt(g)!==10&&qe(e.charCodeAt(g));)g++;if(g===t||e.charCodeAt(g)===10)return o=g,!0;let N=e.charCodeAt(_);return!qe(N)||N===13||!p(_+1,16)?!1:(l($?15:14,o,x(_+1)),!0)},H=()=>{let _=y(o,\\\"accdescr\\\");if(!_&&!y(o,\\\"acctitle\\\"))return!1;let $=b(o+8),g=e.charCodeAt($);return g===58?(l(_?18:16,o,b($+1)),h(_?6:5),!0):_&&g===123?(o=b($+1),h(7),!0):!1},z=_=>{switch(_|32){case 97:return L(\\\"actor\\\",34,1)||L(\\\"alt\\\",24,3)||L(\\\"and\\\",30,3)||L(\\\"activate\\\",12,1)||H()||L(\\\"autonumber\\\",9);case 98:return L(\\\"box\\\",6,3)||L(\\\"break\\\",28,3);case 99:return L(\\\"create\\\",5)||L(\\\"critical\\\",27,3);case 100:return L(\\\"destroy\\\",35,1)||O(\\\"details\\\",41)||L(\\\"deactivate\\\",13,1);case 101:return L(\\\"else\\\",31,3)||L(\\\"end\\\",8);case 108:return L(\\\"loop\\\",21,3)||L(\\\"left of\\\",43)||O(\\\"links\\\",38)||O(\\\"link\\\",39);case 110:return L(\\\"note\\\",36);case 111:return L(\\\"opt\\\",23,3)||L(\\\"option\\\",29,3)||L(\\\"over\\\",37)||L(\\\"off\\\",11);case 112:return L(\\\"participant\\\",32,1)||L(\\\"par\\\",25,3)||L(\\\"par_over\\\",26,3)||O(\\\"properties\\\",40);case 114:return L(\\\"rect\\\",22,3)||L(\\\"right of\\\",44);case 115:return L(\\\"sequencediagram\\\",4);case 116:return oe();default:return!1}},M=()=>{let _=e.charCodeAt(o);if(_===10){let $=o+1;for(;e.charCodeAt($)===10;)$++;l(3,o,$);return}if(qe(_)){o=b(o+1);return}if(_===35||_===37&&e.charCodeAt(o+1)!==123){o=m(o);return}if(!((xt(_)||_===46)&&K())&&!(_\u003C128&&(_|32)>=97&&(_|32)\u003C=122&&z(_)))if(_===44)l(42,o,o+1);else if(_===59)l(3,o,o+1);else if(p(o,1))G();else if(_===45)C();else if(_===60&&e.startsWith(\\\"\u003C\u003C->>\\\",o))l(56,o,o+5);else if(_===60&&e.startsWith(\\\"\u003C\u003C-->>\\\",o))l(58,o,o+6);else{if((_===47||_===92)&&Z(_))return;_===58?l(52,o,x(o+1)):_===43?l(45,o,o+1):_===40&&e.charCodeAt(o+1)===41?l(47,o,o+2):l(2,o,o+1)}},T=()=>{if(S())return!0;let _=e.charCodeAt(o);if(_===35)return o=m(o),!0;if(_===64&&e.charCodeAt(o+1)===123)return I(49,2,4),!0;let $=o;for(;$\u003Ct&&p($,4);)$++;if($>o){let N=b($);if(e.charCodeAt(N)===64&&e.charCodeAt(N+1)===123)return l(48,o,$),!0;if(N>$&&y(N,\\\"as\\\")&&qe(e.charCodeAt(N+2)))return l(48,o,$),h(2),!0}let g=$;for(;g\u003Ct&&p(g,8);)g++;if(g>o){let N=e.charCodeAt(g),w=g;if(g\u003Ct&&N!==10&&N!==59)for(w--;w>o&&e.charCodeAt(w)!==35;)w--;if(w>o)return u(48,o,w,e.slice(o,w).trim()),d(),!0}if(e.charCodeAt(g)===60)return l(2,o,m(o)),d(),!0;if(_!==10){let N=m(o);return u(2,o,N,e.slice(o,N).trim()),d(),!0}return!1},R=()=>{switch(a){case 0:return M(),!0;case 1:return T();case 2:return S()?!0:e.charCodeAt(o)===35?(o=m(o),!0):(d(),d(),E(\\\"as\\\")?I(33,2,3):l(3,o,o),!0);case 3:return S()?!0:e.charCodeAt(o)===35?(o=m(o),!0):(l(7,o,x(o)),d(),!0);case 4:if(e.charCodeAt(o)!==125){let _=e.indexOf(\\\"}\\\",o);return _===-1&&(_=t),l(50,o,_),!0}else{let _=b(o+1),$=_>o+1&&y(_,\\\"as\\\")&&qe(e.charCodeAt(_+2));return l(51,o,o+1),d(),$?h(2):d(),!0}case 5:case 6:return l(a===5?17:19,o,m(o)),d(),!0;default:if(e.charCodeAt(o)===125)o++,d();else{let _=e.indexOf(\\\"}\\\",o);_===-1&&(_=t),l(20,o,_)}return!0}};for(;o\u003Ct;)if(!R())return n.push(1),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i};return a===0||a===2?l(3,t,t):a===3?l(7,t,t):a===5?l(17,t,t):a===6?l(19,t,t):a===7&&l(20,t,t),n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i}}var Wt=new Int8Array(79).fill(-1);Wt[53]=5;Wt[54]=6;Wt[55]=0;Wt[57]=1;Wt[56]=33;Wt[58]=34;Wt[59]=3;Wt[60]=4;Wt[61]=24;Wt[62]=25;Wt[63]=41;Wt[64]=42;Wt[65]=43;Wt[66]=44;Wt[67]=51;Wt[68]=52;Wt[69]=53;Wt[70]=54;Wt[71]=45;Wt[72]=46;Wt[73]=47;Wt[74]=48;Wt[75]=55;Wt[76]=56;Wt[77]=57;Wt[78]=58;var Kr=new Int8Array(79).fill(-1);Kr[21]=2;Kr[22]=3;Kr[23]=4;Kr[28]=5;Kr[24]=6;Kr[25]=7;Kr[26]=7;Kr[27]=8;Kr[6]=1;var Ok=\\\"'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT'\\\";function cA(e,t){let{types:n,texts:r,starts:i}=aA(e),s=0,a=x=>{let I=n[s];throw I===1?ft(\\\"sequence\\\",e,i[s],\\\"\\\",!0):ft(\\\"sequence\\\",e,i[s],`Expecting ${x}, got '${sp[I]}'`)},o=x=>(n[s]!==x&&a(`'${sp[x]}'`),r[s++]),c=()=>{let x=n[s];return x!==48&&x!==39&&a(\\\"'ACTOR'\\\"),{type:\\\"addParticipant\\\",actor:r[s++]}},l=()=>t.parseMessage(o(52).trim().substring(1)),u=()=>{let x=n[s++];if(x===35){let L=c();return o(3),L.type=\\\"destroyParticipant\\\",L}let I=c();if(n[s]===49&&n[s-1]===48){s++;let L=o(50);o(51),I.config=L.trim()}if(I.draw=x===32?\\\"participant\\\":\\\"actor\\\",n[s]===33){s++;let L=o(7);o(3),I.description=t.parseMessage(L)}else n[s]===3?s++:a(\\\"'AS', 'NEWLINE'\\\");return I},h=x=>{let I=!1;n[s]===47&&(I=!0,s++);let L=Wt[n[s]];L\u003C0&&a(Ok),s++;let O=n[s];(O===47||!I&&(O===45||O===46))&&s++;let v=c(),G=l(),K={type:\\\"addMessage\\\",from:x.actor,to:v.actor,signalType:L,msg:G},C=[x,v,K];if(I){let Z=O===47;K.activate=Z,K.centralConnection=Z?61:60,Z&&C.push({type:\\\"centralConnection\\\",signalType:59,actor:v.actor}),C.push({type:\\\"centralConnectionReverse\\\",signalType:60,actor:x.actor})}else O===45?(K.activate=!0,C.push({type:\\\"activeStart\\\",signalType:17,actor:v.actor})):O===46?C.push({type:\\\"activeEnd\\\",signalType:18,actor:x.actor}):O===47&&(K.activate=!0,K.centralConnection=59,C.push({type:\\\"centralConnection\\\",signalType:59,actor:v.actor}));return C},d=x=>{s++;let I=c();return[I,{type:x,actor:I.actor,text:l()}]},m=()=>{s++;let x=n[s];if(x===37){s++;let O=c(),v=O,G=[O.actor,O.actor];if(n[s]===42){s++;let K=c();v=[O,K],G=[O.actor,K.actor]}return[v,{type:\\\"addNote\\\",placement:2,actor:G,text:l()}]}x!==43&&x!==44&&a(\\\"'over', 'left_of', 'right_of'\\\"),s++;let I=c(),L=x===43?0:1;return[I,{type:\\\"addNote\\\",placement:L,actor:I.actor,text:l()}]},p=()=>{s++;let x={type:\\\"sequenceIndex\\\",sequenceVisible:!0,signalType:26};return n[s]===10?(x.sequenceIndex=Number(r[s++]),x.sequenceIndexStep=n[s]===10?Number(r[s++]):1):n[s]===11&&(s++,x.sequenceVisible=!1),n[s]!==3&&a(\\\"'NEWLINE', 'NUM', 'off'\\\"),s++,x},y=(x,I,L,O)=>{let v=x.list,G=x.sections;if(G)for(let K=G.length-2;K>=0;K-=2){let C={type:I,signalType:O};C[L]=t.parseMessage(G[K+1]),v=G[K].concat([C,v])}return v},E=x=>{let I=x.text,L=x.list;switch(x.kind){case 1:L[0]={type:\\\"boxStart\\\",boxData:t.parseBoxData(I)},L.push({type:\\\"boxEnd\\\",boxText:I});break;case 2:L[0]={type:\\\"loopStart\\\",loopText:t.parseMessage(I),signalType:10},L.push({type:\\\"loopEnd\\\",loopText:I,signalType:11});break;case 3:L[0]={type:\\\"rectStart\\\",color:t.parseMessage(I),signalType:22},L.push({type:\\\"rectEnd\\\",color:t.parseMessage(I),signalType:23});break;case 4:L[0]={type:\\\"optStart\\\",optText:t.parseMessage(I),signalType:15},L.push({type:\\\"optEnd\\\",optText:t.parseMessage(I),signalType:16});break;case 5:L[0]={type:\\\"breakStart\\\",breakText:t.parseMessage(I),signalType:30},L.push({type:\\\"breakEnd\\\",optText:t.parseMessage(I),signalType:31});break;case 6:L=y(x,\\\"else\\\",\\\"altText\\\",13),L[0]={type:\\\"altStart\\\",altText:t.parseMessage(I),signalType:12},L.push({type:\\\"altEnd\\\",signalType:14});break;case 7:L=y(x,\\\"and\\\",\\\"parText\\\",20),L[0]={type:\\\"parStart\\\",parText:t.parseMessage(I),signalType:x.startType},L.push({type:\\\"parEnd\\\",signalType:21});break;default:L=y(x,\\\"option\\\",\\\"optionText\\\",28),L[0]={type:\\\"criticalStart\\\",criticalText:t.parseMessage(I),signalType:27},L.push({type:\\\"criticalEnd\\\",signalType:29})}return L};for(;n[s]===3;)s++;o(4);let b=[],S={kind:0,text:\\\"\\\",startType:0,list:[],sections:void 0};for(;;){let x=n[s],I=S.list;if(S.kind===1){if(x===32||x===34||x===35)I.push(u());else if(x===3)I.push([]),s++;else if(x===8){s++;let L=E(S);S=b.pop(),S.list.push(L)}else a(\\\"'end', 'NEWLINE', 'participant', 'participant_actor', 'destroy'\\\");continue}switch(x){case 3:case 2:I.push([]),s++;break;case 32:case 34:case 35:I.push(u());break;case 5:{s++;let L=n[s];L!==32&&L!==34&&L!==35&&a(\\\"'participant', 'participant_actor', 'destroy'\\\");let O=u();O.type=\\\"createParticipant\\\",I.push(O);break}case 48:I.push(h(c())),o(3);break;case 39:{let L=n[s+1];I.push(L===48||L===39?d(\\\"addALink\\\"):h(c())),o(3);break}case 38:I.push(d(\\\"addLinks\\\")),o(3);break;case 40:I.push(d(\\\"addProperties\\\")),o(3);break;case 41:I.push(d(\\\"addDetails\\\")),o(3);break;case 36:I.push(m()),o(3);break;case 9:I.push(p());break;case 12:case 13:{s++;let L=c();o(3),I.push(x===12?{type:\\\"activeStart\\\",signalType:17,actor:L.actor}:{type:\\\"activeEnd\\\",signalType:18,actor:L.actor});break}case 14:case 15:{let L=r[s++].substring(x===14?6:7);t.setDiagramTitle(L),I.push(L);break}case 16:{s++;let L=o(17).trim();t.setAccTitle(L),I.push(L);break}case 18:{s++;let L=o(19).trim();t.setAccDescription(L),I.push(L);break}case 20:{let L=r[s++].trim();t.setAccDescription(L),I.push(L);break}case 21:case 22:case 23:case 28:case 24:case 25:case 26:case 27:case 6:{s++;let L=o(7);b.push(S),S={kind:Kr[x],text:L,startType:x===26?32:19,list:[[]],sections:void 0};break}case 31:case 30:case 29:{S.kind!==(x===31?6:x===30?7:8)&&a(\\\"'end'\\\"),s++;let O=o(7);(S.sections??=[]).push(I,O),S.list=[];break}case 8:{S.kind===0&&a(\\\"'NEWLINE', 'EOF'\\\"),s++;let L=E(S);S=b.pop(),S.list.push(L);break}case 0:S.kind!==0&&a(\\\"'end'\\\"),t.apply(I);return;default:a(\\\"'NEWLINE', 'ACTOR', 'participant', 'note', 'end'\\\")}}}var Dk=16,vk=10,lA=34,dA=4,mi=5,pi=6,cs=' fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"',fo=' fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"',Pk=new Set([\\\"participant\\\",\\\"actor\\\",\\\"boundary\\\",\\\"control\\\",\\\"entity\\\",\\\"database\\\",\\\"collections\\\",\\\"queue\\\"]),Fk=new Set([\\\"actor\\\",\\\"boundary\\\",\\\"control\\\",\\\"entity\\\",\\\"database\\\"]);function uA(e){return Pk.has(e)?e:\\\"participant\\\"}function La(e){return Fk.has(e)}function fA(e,t,n,r,i=Dk){if(La(e))return{w:Math.max(40,t.width+8),h:lA+(t.height>0?dA+t.height:0)};let s=e===\\\"collections\\\"?mi:e===\\\"queue\\\"?2*pi:0;return{w:Math.max(n,t.width+2*i)+s,h:Math.max(r,t.height+2*vk)+(e===\\\"collections\\\"?mi:0)}}function Bk(e,t,n){let r=f(t),i=s=>f(n+s);switch(e){case\\\"actor\\\":return`\u003Ccircle cx=\\\"${r}\\\" cy=\\\"${i(7)}\\\" r=\\\"6\\\"${cs}/>\u003Cpath d=\\\"M${r},${i(13)}V${i(24)}M${f(t-10)},${i(17)}H${f(t+10)}M${f(t-8)},${i(34)}L${r},${i(24)}L${f(t+8)},${i(34)}\\\"${fo}/>`;case\\\"boundary\\\":return`\u003Cpath d=\\\"M${f(t-19)},${i(6)}V${i(28)}M${f(t-19)},${i(17)}H${f(t-8)}\\\"${fo}/>\u003Ccircle cx=\\\"${f(t+3)}\\\" cy=\\\"${i(17)}\\\" r=\\\"11\\\"${cs}/>`;case\\\"control\\\":return`\u003Ccircle cx=\\\"${r}\\\" cy=\\\"${i(21)}\\\" r=\\\"11\\\"${cs}/>\u003Cpath d=\\\"M${f(t+5)},${i(5)}L${f(t-1)},${i(10)}L${f(t+5)},${i(15)}\\\"${fo}/>`;case\\\"entity\\\":return`\u003Ccircle cx=\\\"${r}\\\" cy=\\\"${i(15)}\\\" r=\\\"11\\\"${cs}/>\u003Cpath d=\\\"M${f(t-11)},${i(30)}H${f(t+11)}\\\"${fo}/>`;default:{let s=f(t-14),a=f(t+14);return`\u003Cpath d=\\\"M${s},${i(7)}V${i(27)}A14,5 0 0 0 ${a},${i(27)}V${i(7)}A14,5 0 0 0 ${s},${i(7)}Z\\\"${cs}/>\u003Cpath d=\\\"M${s},${i(7)}A14,5 0 0 0 ${a},${i(7)}\\\"${fo}/>`}}}function hA(e,t,n,r,i,s,a=\\\"\\\"){let{w:o,h:c}=r,l=' class=\\\"pele-label\\\"';if(La(e))return Bk(e,t,n)+Ne(i,t,n+lA+dA+i.height/2,l+a,s);let u=t-o/2;if(e===\\\"collections\\\"){let h=o-mi,d=c-mi,m=`\u003Crect x=\\\"${f(u+mi)}\\\" y=\\\"${f(n)}\\\" width=\\\"${f(h)}\\\" height=\\\"${f(d)}\\\"${cs}${ht}/>`,p=`\u003Crect x=\\\"${f(u)}\\\" y=\\\"${f(n+mi)}\\\" width=\\\"${f(h)}\\\" height=\\\"${f(d)}\\\"${cs}${ht}/>`;return m+p+Ne(i,u+h/2,n+mi+d/2,l,s)}if(e===\\\"queue\\\"){let h=f(u+pi),d=f(u+o-pi),m=f(n+c),p=f(c/2);return`\u003Cpath d=\\\"M${h},${f(n)}H${d}A${pi},${p} 0 0 1 ${d},${m}H${h}A${pi},${p} 0 0 1 ${h},${f(n)}Z\\\"${cs}/>\u003Cpath d=\\\"M${d},${f(n)}A${pi},${p} 0 0 0 ${d},${m}\\\"${fo}/>`+Ne(i,t-pi/2,n+c/2,l,s)}return`\u003Crect x=\\\"${f(u)}\\\" y=\\\"${f(n)}\\\" width=\\\"${f(o)}\\\" height=\\\"${f(c)}\\\"${cs}${ht}/>`+Ne(i,t,n+c/2,l,s)}var ap=[];function mn(e,t,n,r=1,i=!1){ap[e]={dotted:t,head:n,atStart:r!==1,atEnd:r!==0,bottom:i}}mn(0,!1,1);mn(1,!0,1);mn(3,!1,2);mn(4,!0,2);mn(5,!1,0);mn(6,!0,0);mn(24,!1,3);mn(25,!0,3);mn(33,!1,1,2);mn(34,!0,1,2);for(let e of[!1,!0]){let t=e?10:0;mn(41+t,e,4),mn(42+t,e,4,1,!0),mn(43+t,e,5),mn(44+t,e,5,1,!0),mn(45+t,e,4,0),mn(46+t,e,4,0,!0),mn(47+t,e,5,0),mn(48+t,e,5,0,!0)}var Wk=new Map([[10,\\\"loop\\\"],[12,\\\"alt\\\"],[15,\\\"opt\\\"],[19,\\\"par\\\"],[32,\\\"par\\\"],[27,\\\"critical\\\"],[30,\\\"break\\\"],[22,\\\"rect\\\"]]),Uk=12,ip=28,pA=22,rr=10,mA=4,Gk=14,ho=10,Yk=16,Hk=20,Kk=10,hd=20,gA=240,pd=16,po=4,bA=' stroke-dasharray=\\\"4 4\\\"';function op(e){return e!==void 0&&ap[e]!==void 0}function zk(e,t){let n=new Array(e.length),r=new Array(e.length),i=1,s=1,a=!1;for(let o=0;o\u003Ce.length;o++){let c=e[o];if(n[o]=NaN,r[o]=!1,c.type===26){let l=c.message;i=l.start||i,s=l.step||s,a=l.visible}else op(c.type)&&(n[o]=i,r[o]=a||t,i=Math.round((i+s)*100)/100)}return{index:n,shown:r,visible:a}}var yA={lines:[],widths:[],width:0,height:0,size:0,lineHeight:0};function gi(e,t,n){let r=e[t];return typeof r==\\\"number\\\"&&r>=0&&r\u003C=2e3?r:n}function EA(e,t,n,r,i,s){let a=f(e-n*Lt);return i?`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(e)},${f(t)}L${a},${f(t+r*5)}\\\"/>`:`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(e)},${f(t)}L${a},${f(t+r*4.5)}V${f(t)}Z\\\" fill=\\\"${s}\\\" stroke=\\\"none\\\"/>`}function md(e,t,n,r,i,s){switch(e){case 1:return _t(\\\"arrow_point\\\",t,n,r,0,s);case 2:return _t(\\\"arrow_cross\\\",t,n,r,0,s);case 3:return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(t-r*Lt)},${f(n-4.5)}L${f(t)},${f(n)}L${f(t-r*Lt)},${f(n+4.5)}\\\" stroke-linejoin=\\\"round\\\"/>`;case 4:return EA(t,n,r,i,!1,s);case 5:return EA(t,n,r,i,!0,s);default:return\\\"\\\"}}function Vk(e){return e===1?Lt-1:e===2?4:0}function xA(e,t,n){return An(n,r=>AA(e,t,n,r))}function AA(e,t,n,r,i=0,s=!0){let a=t.sequence??{},o=n.fontSize??16,c=Math.round(o*.875),l=Math.round(o*.75),u=n.measurer??ct(n.fontFamily,n.fontFamilyMono),h=Array.isArray(n.monospace)&&n.monospace.includes(\\\"messages\\\"),d=h?{width:(Ee,We,De)=>u.width(Ee,We,De|4)}:u,m=n.icons,p=n.padding??8,y=a.mirrorActors!==!1,E=a.rightAngles===!0,b=Math.min(gi(a,\\\"actorMargin\\\",40),r?8:1/0),S=Math.min(gi(a,\\\"width\\\",64),r?48:1/0),x=gi(a,\\\"height\\\",Math.round(o*1.5)+20),I=Math.min(gi(a,\\\"width\\\",160),r?Math.max(32,((n.maxWidth??320)-2*p)/Math.max(1,e.actors.size)-b-24):1/0),L=Math.max(4,14+gi(a,\\\"messageMargin\\\",35)-35),O=Math.min(gi(a,\\\"noteMargin\\\",10),r?6:1/0),v=Math.min(gi(a,\\\"boxMargin\\\",10),r?6:1/0),G=a.messageAlign===\\\"left\\\"?-1:a.messageAlign===\\\"right\\\"?1:0,K=r?6:Uk,C=r?8:Yk,Z=r?12:Hk,oe=r?6:Kk,H=e.messages,z=H.length,M=zk(H,a.showSequenceNumbers===!0),T=(Ee,We,De,Xe=I,ze=u)=>{let et=Ge(Ee,!1,ze,We,r||De?Xe:1/0);return r?Zs(et,ze,Math.max(120,Xe)):et},R=(Ee,We,De=I)=>T(Ee,c,We,De,d),_;if(a.hideUnusedParticipants===!0){_=new Set;for(let Ee of H)_.add(Ee.from).add(Ee.to)}let $=new Int32Array(z+1);$[z]=-1;for(let Ee=z-1;Ee>=0;Ee--)$[Ee]=op(H[Ee].type)?Ee:$[Ee+1];let g=[],N=new Map;for(let[Ee,We]of e.actors){if(_&&!_.has(Ee))continue;let De=uA(We.type),Xe=T(We.description,o,We.wrap),ze=e.createdActors.get(Ee),et=e.destroyedActors.get(Ee),Ye=ze===void 0?-1:$[Math.min(ze,z)];Ye>=0&&H[Ye].to!==Ee&&(Ye=-1);let He=et===void 0?-1:$[Math.min(et,z)];He>=0&&H[He].to!==Ee&&H[He].from!==Ee&&(He=-1),N.set(Ee,g.length),g.push({id:Ee,actor:We,kind:De,label:Xe,size:fA(De,Xe,S,x,r?8:void 0),x:0,createAt:Ye,destroyAt:He,top:0,lifeStart:0,lifeEnd:-1,activations:[]})}let w=g.length-1,A=new Map,D=(Ee,We,De)=>{if(Ee\u003C0||We>w)return;let Xe=Ee*g.length+We;(A.get(Xe)??0)\u003CDe&&A.set(Xe,De)},U=Ee=>M.shown[Ee]?Math.max(pd,u.width(String(M.index[Ee]),l,0)+8):0,B=new Array(z),F=new Array(z),W=(Ee,We)=>{let De=F[Ee];if(!De){if(We===I)return B[Ee].label;F[Ee]=De=new Map([[I,B[Ee].label]])}let Xe=De.get(We);return Xe||De.set(We,Xe=R(H[Ee].message,!0,We)),Xe};for(let Ee=0;Ee\u003Cz;Ee++){let We=H[Ee],De=We.from===void 0?void 0:N.get(We.from),Xe=We.to===void 0?void 0:N.get(We.to);if(!(De===void 0||Xe===void 0||typeof We.message!=\\\"string\\\")){if(We.type===2){let ze=T(We.message,c,We.wrap),et=ze.width+2*O;We.placement===0?D(De-1,De,et+2*ho+rr):We.placement===1?D(De,De+1,et+2*ho+rr):De===Xe?(D(De-1,De,et/2+ho),D(De,De+1,et/2+ho)):D(Math.min(De,Xe),Math.max(De,Xe),et-2*C),B[Ee]={kind:2,a:De,b:Xe,label:ze,x:0,w:et}}else if(op(We.type)){let ze=R(We.message,We.wrap),et=U(Ee);if(De===Xe)D(De,De+1,ip+8+ze.width+16+rr+et),B[Ee]={kind:1,a:De,b:Xe,label:ze,x:0,w:0};else{let Ye=g[Xe].createAt===Ee?g[Xe].size.w/2:0,He=We.centralConnection?4*po:0;D(Math.min(De,Xe),Math.max(De,Xe),(r?Math.min(ze.width,Math.max(16,I-16)):ze.width)+2*K+rr+et+Ye+He),B[Ee]={kind:0,a:De,b:Xe,label:ze,x:0,w:0}}}}}let j=[];for(let Ee=0;Ee\u003C=w;Ee++){let We=g[Ee].actor.box,De=j[j.length-1];We&&De&&De.box===We&&De.last===Ee-1?De.last=Ee:We&&j.push({box:We,first:Ee,last:Ee,title:T(We.name,c,We.wrap),grow:0})}let Q=new Array(Math.max(w,0));for(let Ee=0;Ee\u003Cw;Ee++){let We=g[Ee],De=g[Ee+1],Xe=We.actor.box!==De.actor.box?(We.actor.box?v:0)+(De.actor.box?v:0):0;Q[Ee]=Math.max(We.size.w/2+De.size.w/2+b+Xe,A.get(Ee*g.length+Ee+1)??0)}let Y=[];for(let[Ee,We]of A){let De=Math.floor(Ee/g.length),Xe=Ee%g.length;Xe-De>1&&Y.push([De,Xe,We])}Y.sort((Ee,We)=>Ee[1]-Ee[0]-(We[1]-We[0])||Ee[0]-We[0]);for(let[Ee,We,De]of Y){let Xe=0;for(let et=Ee;et\u003CWe;et++)Xe+=Q[et];if(Xe>=De)continue;let ze=(De-Xe)/(We-Ee);for(let et=Ee;et\u003CWe;et++)Q[et]+=ze}let ne=()=>{for(let Ee=1;Ee\u003C=w;Ee++)g[Ee].x=g[Ee-1].x+Q[Ee-1]};ne();for(let Ee of j){let We=g[Ee.last].x+g[Ee.last].size.w/2-(g[Ee.first].x-g[Ee.first].size.w/2);Ee.grow=Math.max(0,(Ee.title.width-We)/2),Ee.grow!==0&&(Ee.first>0&&(Q[Ee.first-1]+=Ee.grow),Ee.last\u003Cw&&(Q[Ee.last]+=Ee.grow))}let q=1/0,k=-1/0,J=(Ee,We)=>{Ee\u003Cq&&(q=Ee),We>k&&(k=We)},te=Ee=>[g[Ee.first].x-g[Ee.first].size.w/2-v-Ee.grow,g[Ee.last].x+g[Ee.last].size.w/2+v+Ee.grow],se=new Array(z),re=()=>{ne(),q=1/0,k=-1/0;for(let De of g)J(De.x-De.size.w/2,De.x+De.size.w/2);for(let De of j)J(...te(De));let Ee=[],We=()=>w\u003C0?[0,120]:[g[0].x-Z,g[w].x+Z];for(let De=0;De\u003Cz;De++){let Xe=H[De],ze=Xe.type,et=ze===void 0?void 0:Wk.get(ze),Ye=B[De];if(et!==void 0){let He={kind:et,x0:1/0,x1:-1/0,top:0,title:yA,tabW:0,fill:et===\\\"rect\\\"&&typeof Xe.message==\\\"string\\\"?Xe.message:\\\"\\\",dividers:[De],dividerY:[],dividerLabels:[]};se[De]=He,Ee.push(He)}else if(ze===13||ze===20||ze===28)Ee[Ee.length-1]?.dividers.push(De);else if(ze===11||ze===14||ze===16||ze===21||ze===29||ze===31||ze===23){let He=Ee.pop();if(!He)continue;if(se[De]=He,He.x0>He.x1&&([He.x0,He.x1]=We()),He.kind!==\\\"rect\\\"){He.tabW=u.width(He.kind,l,1)+14;for(let it=0;it\u003CHe.dividers.length;it++){let wt=H[He.dividers[it]].message,ut=it===0?He.tabW+8:0,st=He.x1-He.x0-16-ut,pt=wt?T(`[${wt}]`,c,!0,Math.max(st,r?Math.min(gA,I):gA)):yA;pt.width>st&&(He.x1+=pt.width-st),it===0?He.title=pt:He.dividerLabels.push(pt)}}J(He.x0,He.x1);let nt=Ee[Ee.length-1];nt&&(nt.x0=Math.min(nt.x0,He.x0-oe),nt.x1=Math.max(nt.x1,He.x1+oe))}else if(Ye){let He=g[Ye.a],nt=g[Ye.b],it,wt;if(Ye.kind===2){if(Xe.placement===0)Ye.x=He.x-ho-Ye.w;else if(Xe.placement===1)Ye.x=He.x+ho;else if(Ye.a===Ye.b)Ye.x=He.x-Ye.w/2;else{let st=Math.min(He.x,nt.x)-C,pt=Math.max(He.x,nt.x)+C;(r||Xe.wrap)&&(Ye.label=T(Xe.message,c,!0,Math.max(I,pt-st-2*O))),Ye.w=Math.max(pt-st,Ye.label.width+2*O),Ye.x=(st+pt-Ye.w)/2}it=Ye.x,wt=Ye.x+Ye.w}else Ye.kind===1?(it=He.x,wt=He.x+rr+ip+8+Ye.label.width+U(De)):(it=Math.min(He.x,nt.x),wt=Math.max(He.x,nt.x),(r||Xe.wrap)&&(Ye.label=W(De,Math.max(I,wt-it-2*K-rr))),nt.createAt===De&&(nt.x>He.x?wt+=nt.size.w/2:it-=nt.size.w/2));J(it,wt);let ut=Ee[Ee.length-1];ut&&(ut.x0=Math.min(ut.x0,it-Z),ut.x1=Math.max(ut.x1,wt+Z))}}};re();let P=!1,ee=!1;if(r&&n.maxWidth!==void 0){let Ee=Math.floor(n.maxWidth)-Math.ceil(k-q+2*p)-i,We=new Int32Array(g.length),De=new Array(Q.length).fill(0),Xe=[],ze=0;for(let He=0;Ee>0&&He\u003CB.length;He++){let nt=B[He];if(nt?.kind!==0)continue;let it=R(H[He].message,!1,1/0);if(nt.label.lines.length\u003C=it.lines.length)continue;Xe.push(He),ze+=nt.label.lines.length;let wt=Math.min(nt.a,nt.b),ut=Math.max(nt.a,nt.b);We[wt]++,We[ut]--;let st=(it.width-(g[ut].x-g[wt].x-2*K-rr))/(ut-wt);for(let pt=wt;pt\u003Cut;pt++)De[pt]=Math.max(De[pt],st)}let et=0,Ye=0;for(let He=0;He\u003CQ.length;He++)et+=We[He],We[He]=et>0?1:0,Ye+=We[He];if(Ye>0){let He=Q.slice(),nt=gt=>{for(let yt=0;yt\u003CQ.length;yt++)Q[yt]=He[yt]+gt(yt);return re(),Xe.map(yt=>B[yt].label.lines.length)},it=gt=>gt.reduce((yt,Nt)=>yt+Nt,0),wt=gt=>We[gt]*Ee/Ye,ut=nt(wt),st=it(De),pt=gt=>De[gt]*(Ee-.01)/st;if(s&&Ye>1&&st>0&&Q.some((gt,yt)=>pt(yt)>wt(yt))){let gt=ut;ut=nt(pt),ee=it(ut)\u003Cit(gt)&&ut.every((yt,Nt)=>yt\u003C=gt[Nt]),ee||(ut=nt(wt))}P=it(ut)\u003Cze,P||(Q.splice(0,Q.length,...He),re())}}let ae=0;for(let Ee of j)ae=Math.max(ae,Ee.title.height);let ue=j.length>0?v+(ae>0?ae+4:0):0,ce=0;for(let Ee of g)Ee.createAt\u003C0&&(ce=Math.max(ce,Ee.size.h));let pe=ue+ce;for(let Ee of g)Ee.top=pe-Ee.size.h,Ee.lifeStart=pe;let V=g.map(Ee=>Ee.x),X=(Ee,We)=>{let De=0,Xe=V.length;for(;De\u003CXe;){let ze=De+Xe>>1;V[ze]\u003C=Ee?De=ze+1:Xe=ze}return De\u003CV.length&&V[De]\u003CWe},le=[],de=new Map,Se=Ee=>{if(Ee)return de.has(Ee)||de.set(Ee,dr(Ct([`fill:${Ee}`]).shape)),de.get(Ee)},_e=Ee=>{let We=Se(Ee);return We?` fill=\\\"${We}\\\"`:\\\"\\\"},xe=(Ee,We)=>{for(let De=le.length-1;De>=0;De--)if(le[De].kind===\\\"rect\\\")return le[De].fill;for(let De of j){let[Xe,ze]=te(De);if(Ee>=Xe&&We\u003C=ze)return De.box.fill}},Me=(Ee,We)=>_e(xe(Ee,We)),Ce=(Ee,We,De,Xe=!1)=>{if(Ee.width===0)return\\\"\\\";let ze=We-Ee.width/2,et=X(ze,ze+Ee.width),Ye=et?`\u003Crect x=\\\"${f(ze-3)}\\\" y=\\\"${f(De-Ee.height/2+2)}\\\" width=\\\"${f(Ee.width+6)}\\\" height=\\\"${f(Ee.height-4)}\\\" rx=\\\"3\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"none\\\"/>`:\\\"\\\",He=et?\\\"\\\":Me(ze,ze+Ee.width);return Ye+Ne(Ee,We,De,Xe?` class=\\\"pele-frame-label\\\"${He||' fill=\\\"var(--_m)\\\"'} stroke=\\\"none\\\"`:He,m)},ke=(Ee,We=0)=>Ee.activations.length+We>0?Ee.x-rr/2:Ee.x,be=(Ee,We=0)=>{let De=Ee.activations.length+We;return De>0?Ee.x+rr/2+(De-1)*mA:Ee.x},Ae=[],ie=[],me=\\\"\\\",Te=\\\"\\\",ye=\\\"\\\",we=\\\"\\\",Ie=\\\"\\\",ve=\\\"\\\",Pe=(Ee,We)=>{let De=Ee.activations.pop(),Xe=Math.max(We,De+Gk),ze=Ee.x-rr/2+Ee.activations.length*mA;return J(ze,ze+rr),ie.push(`\u003Crect class=\\\"pele-activation\\\" data-id=\\\"${Ue(Ee.id)}\\\" x=\\\"${f(ze)}\\\" y=\\\"${f(De)}\\\" width=\\\"${rr}\\\" height=\\\"${f(Xe-De)}\\\" rx=\\\"2\\\"/>`),Xe},he=(Ee,We)=>{let De=Ee.x,Xe=We+16;return Ee.lifeEnd=Xe,ve+=`\u003Cpath class=\\\"pele-destroy\\\" data-id=\\\"${Ue(Ee.id)}\\\" d=\\\"M${f(De-6)},${f(Xe-6)}L${f(De+6)},${f(Xe+6)}M${f(De+6)},${f(Xe-6)}L${f(De-6)},${f(Xe+6)}\\\"/>`,Xe+6},Re=(Ee,We,De)=>{let Xe=Ee.actor.properties.get(\\\"class\\\");return`\u003Cg class=\\\"pele-node pele-actor pele-actor-${Ee.kind}${De?\\\" pele-actor-footer\\\":\\\"\\\"}${typeof Xe==\\\"string\\\"?It(Xe):\\\"\\\"}\\\" data-id=\\\"${Ue(Ee.id)}\\\">`+hA(Ee.kind,Ee.x,We,Ee.size,Ee.label,m,La(Ee.kind)?_e(Ee.actor.box?.fill):\\\"\\\")+\\\"\u003C/g>\\\"},Be=(Ee,We,De,Xe)=>`\u003Cg class=\\\"pele-sequence-number\\\">\u003Crect x=\\\"${f(We-Xe/2)}\\\" y=\\\"${f(De-pd/2)}\\\" width=\\\"${f(Xe)}\\\" height=\\\"${pd}\\\" rx=\\\"${pd/2}\\\" fill=\\\"var(--_l)\\\" stroke=\\\"none\\\"/>\u003Ctext x=\\\"${f(We)}\\\" y=\\\"${f(De+l*.35)}\\\" text-anchor=\\\"middle\\\" font-size=\\\"${l}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"none\\\">${rt(String(M.index[Ee]))}\u003C/text>\u003C/g>`,ge=pe+6;for(let Ee=0;Ee\u003Cz;Ee++){let We=H[Ee],De=We.type,Xe=B[Ee],ze=se[Ee];if(De===17){let et=We.from===void 0?void 0:N.get(We.from);et!==void 0&&g[et].activations.push(ge)}else if(De===18){let et=We.from===void 0?void 0:N.get(We.from);et!==void 0&&g[et].activations.length>0&&(ge=Math.max(ge,Pe(g[et],ge)))}else if(ze&&ze.dividers[0]===Ee)le.push(ze),ze.kind===\\\"rect\\\"?(ze.top=ge+8,ge=ze.top):(ze.top=ge+12,ge=ze.top+Math.max(hd,ze.title.height+2));else if(ze){le.pop();let et=ge+12,Ye=f(ze.x0),He=f(ze.x1-ze.x0);if(ze.kind===\\\"rect\\\"){let nt=ze.fill?Ct([`fill:${ze.fill}`]).shape:\\\"\\\";Ae.push(`\u003Crect class=\\\"pele-rect\\\" x=\\\"${Ye}\\\" y=\\\"${f(ze.top)}\\\" width=\\\"${He}\\\" height=\\\"${f(et-ze.top)}\\\"${At((nt?\\\"\\\":' fill-opacity=\\\"0.5\\\"')+nt)}/>`)}else{let nt=`\u003Crect x=\\\"${Ye}\\\" y=\\\"${f(ze.top)}\\\" width=\\\"${He}\\\" height=\\\"${f(et-ze.top)}\\\" fill=\\\"none\\\"${ht}/>`;for(let it=0;it\u003Cze.dividerY.length;it++){let wt=ze.dividerY[it],ut=ze.dividerLabels[it];nt+=`\u003Cpath d=\\\"M${Ye},${f(wt)}H${f(ze.x1)}\\\"${bA}/>`+Ce(ut,ze.x0+8+ut.width/2,wt+2+ut.height/2,!0)}nt+=`\u003Crect x=\\\"${Ye}\\\" y=\\\"${f(ze.top)}\\\" width=\\\"${f(ze.tabW)}\\\" height=\\\"${hd}\\\" fill=\\\"var(--_s)\\\"${ht}/>\u003Ctext class=\\\"pele-frame-kind\\\" x=\\\"${f(ze.x0+ze.tabW/2)}\\\" y=\\\"${f(ze.top+hd/2+l*.35)}\\\" text-anchor=\\\"middle\\\" font-size=\\\"${l}\\\" font-weight=\\\"var(--_hw)\\\" fill=\\\"var(--_m)\\\" stroke=\\\"none\\\">${ze.kind}\u003C/text>`+Ce(ze.title,ze.x0+ze.tabW+8+ze.title.width/2,ze.top+Math.max(hd,ze.title.height)/2,!0),me+=`\u003Cg class=\\\"pele-frame pele-frame-${ze.kind}\\\">${nt}\u003C/g>`}ge=et}else if(De===13||De===20||De===28){let et=le[le.length-1];if(et){let Ye=et.dividerLabels[et.dividerY.length];et.dividerY.push(ge+12),ge+=12+(Ye.height>0?Ye.height:0)}}else if(Xe&&Xe.kind===2){let et=g[Xe.a],Ye=Xe.label.height+2*Math.max(4,O-4),He=ge+10,nt=Xe.x;We.placement===1?nt+=be(et)-et.x:We.placement===0&&(nt+=ke(et)-et.x),J(nt,nt+Xe.w),we+=`\u003Cg class=\\\"pele-note\\\" data-id=\\\"i${Ue(We.id)}\\\">\u003Crect x=\\\"${f(nt)}\\\" y=\\\"${f(He)}\\\" width=\\\"${f(Xe.w)}\\\" height=\\\"${f(Ye)}\\\"${ht}/>`+Ne(Xe.label,nt+Xe.w/2,He+Ye/2,' class=\\\"pele-label\\\" stroke=\\\"none\\\" fill=\\\"var(--_fg)\\\"',m)+\\\"\u003C/g>\\\",ge=He+Ye}else if(Xe){let et=ap[De],Ye=g[Xe.a],He=g[Xe.b],nt=Xe.label,it=U(Ee),wt=0;for(let $t=Ee+1;$t\u003Cz;$t++){let qt=H[$t].type;if(qt===17)H[$t].from===We.to&&wt++;else if(qt!==18&&qt!==59&&qt!==60)break}let ut=et.bottom?1:-1,st=et.dotted?bA:\\\"\\\",pt=We.centralConnection,gt=pt===59||pt===61,yt=pt===60||pt===61,Nt,Ft=\\\"var(--_l)\\\",jn=($t,qt)=>`\u003Ccircle class=\\\"pele-central\\\" cx=\\\"${f($t)}\\\" cy=\\\"${f(qt)}\\\" r=\\\"${po}\\\" fill=\\\"${Ft}\\\" stroke=\\\"none\\\"/>`,En=et.atStart&&!et.atEnd,Sr=Vk(et.head),an=\\\"\\\",cn;if(Xe.kind===1){let $t=ge+L+Math.max(0,(nt.height-pA)/2),qt=$t+pA,Ln=yt?Ye.x+po:be(Ye),Tn=gt?Ye.x+po:be(Ye,wt),or=Math.max(Ln,Tn)+ip+it/2;Nt=Se(xe(Ye.x,or)),Ft=Nt??Ft,yt&&(an+=jn(Ye.x,$t)),gt&&(an+=jn(Ye.x,qt)),it>0&&(an+=Be(Ee,En?Tn:Ln,En?qt:$t,it),En?Tn+=it/2:Ln+=it/2);let Jd=(et.atStart?md(et.head,Ln,$t,-1,ut,Ft):\\\"\\\")+(et.atEnd?md(et.head,Tn,qt,-1,-ut,Ft):\\\"\\\"),Va=f(Ln+(et.atStart?Sr:0)),ar=f(Tn+(et.atEnd?Sr:0));an=`\u003Cpath d=\\\"${E?`M${Va},${f($t)}H${f(or)}V${f(qt)}H${ar}`:`M${Va},${f($t)}H${f(or-6)}A6,6 0 0 1 ${f(or)},${f($t+6)}V${f(qt-6)}A6,6 0 0 1 ${f(or-6)},${f(qt)}H${ar}`}\\\"${st}/>`+Jd+an,J(Ye.x,or+8+nt.width),nt.width>0&&(ye+=`\u003Cg class=\\\"pele-edge-label\\\" data-id=\\\"i${Ue(We.id)}\\\">${Ne(nt,or+8+nt.width/2,($t+qt)/2,Me(or+8,or+8+nt.width),m)}\u003C/g>`),cn=Math.max(qt,($t+qt)/2+nt.height/2)}else{let $t=He.x>Ye.x?1:-1,qt=He.createAt===Ee;Nt=Se(xe(Math.min(Ye.x,He.x),Math.max(Ye.x,He.x))),Ft=Nt??Ft,cn=ge+L+Math.max(nt.height>0?nt.height+2:6,qt?He.size.h/2-L+6:0);let Ln=$t>0?be(Ye):ke(Ye),Tn=$t>0?ke(He,wt):be(He,wt);if(qt&&(He.top=cn-He.size.h/2,He.lifeStart=He.top+He.size.h,Tn=He.x-$t*(La(He.kind)?18:He.size.w/2+1)),yt&&(an+=jn(Ye.x,cn),Ln=Ye.x+$t*po),gt&&(an+=jn(He.x,cn),Tn=He.x-$t*po),it>0)if(En){let ar=gt?Tn-$t*(it/2+2):Tn;an+=Be(Ee,ar,cn,it),Tn=ar-$t*it/2}else{let ar=yt?Ln+$t*(it/2+2):Ln;an+=Be(Ee,ar,cn,it),Ln=ar+$t*it/2}let or=(et.atStart?md(et.head,Ln,cn,-$t,ut*$t,Ft):\\\"\\\")+(et.atEnd?md(et.head,Tn,cn,$t,ut*$t,Ft):\\\"\\\"),Jd=Ln+(et.atStart?$t*Sr:0),Va=Tn-(et.atEnd?$t*Sr:0);if(an=`\u003Cpath d=\\\"M${f(Jd)},${f(cn)}H${f(Va)}\\\"${st}/>`+or+an,nt.width>0){let ar=Math.min(Ln,Tn),eu=Math.max(Ln,Tn),tu=G\u003C0?ar+K+nt.width/2:G>0?eu-K-nt.width/2:(ar+eu)/2;J(tu-nt.width/2,tu+nt.width/2),ye+=`\u003Cg class=\\\"pele-edge-label\\\" data-id=\\\"i${Ue(We.id)}\\\">${Ce(nt,tu,cn-4-nt.height/2)}\u003C/g>`}qt&&(ge=cn+He.size.h/2-6)}Te+=`\u003Cg class=\\\"pele-edge pele-message\\\" data-id=\\\"i${Ue(We.id)}\\\"${Nt?` stroke=\\\"${Nt}\\\"`:\\\"\\\"}>${an}\u003C/g>`,ge=Math.max(ge,cn),Ye.destroyAt===Ee&&(ge=Math.max(ge,he(Ye,cn))),He.destroyAt===Ee&&He!==Ye&&(ge=Math.max(ge,he(He,cn)))}}ge+=20;for(let Ee of g)for(;Ee.activations.length>0;)Pe(Ee,ge);let Le=ge;if(y){let Ee=0;for(let We of g)We.lifeEnd>=0||(Ee=Math.max(Ee,We.size.h),Ie+=Re(We,ge,!0));Le=ge+Ee}let Fe=\\\"\\\";for(let Ee of g){Ie+=Re(Ee,Ee.top,!1);let We=Ee.lifeEnd>=0?Ee.lifeEnd:ge;We>Ee.lifeStart&&(Fe+=`\u003Cpath class=\\\"pele-lifeline\\\" data-id=\\\"${Ue(Ee.id)}\\\" d=\\\"M${f(Ee.x)},${f(Ee.lifeStart)}V${f(We)}\\\"/>`)}let Ve=\\\"\\\";for(let Ee of j){let[We,De]=te(Ee),Xe=Ee.box.fill===\\\"transparent\\\"?\\\"\\\":Ct([`fill:${Ee.box.fill}`]).shape;Ve+=`\u003Cg class=\\\"pele-cluster pele-box\\\"${Ee.box.name?` data-id=\\\"${Ue(Ee.box.name)}\\\"`:\\\"\\\"}>\u003Crect x=\\\"${f(We)}\\\" y=\\\"0\\\" width=\\\"${f(De-We)}\\\" height=\\\"${f(Le+v)}\\\" fill=\\\"var(--_a)\\\" stroke=\\\"var(--_b)\\\"${At((Xe?\\\"\\\":' fill-opacity=\\\"0.5\\\"')+Xe)}/>`+Ne(Ee.title,(We+De)/2,v/2+2+Ee.title.height/2,` class=\\\"pele-cluster-label\\\"${_e(Ee.box.fill)||' fill=\\\"var(--_m)\\\"'}`,m)+\\\"\u003C/g>\\\"}j.length>0&&(Le+=v);let Oe=0,je=\\\"\\\",Je=kt(n),$e=yn(e.title,u,o,r?Je:1/0),Ze=r?Zs($e,u,Math.max(120,Je)):$e;if(q>k&&J(0,Math.max(Ze.width,40)),Ze.width>0){let Ee=(q+k)/2;J(Ee-Ze.width/2,Ee+Ze.width/2),Oe=-Ze.height-12,je=Ne(Ze,Ee,Oe+Ze.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"',m)}let tt=Math.ceil(k-q+2*p);if(P&&tt>n.maxWidth)return AA(e,t,n,r,ee?i:i>0?1/0:tt-Math.floor(n.maxWidth),!1);let mt=Math.ceil(Le-Oe+2*p);return{svg:at(\\\"sequence\\\",tt,mt,o,n,e,`\u003Cg transform=\\\"translate(${f(p-q)},${f(p-Oe)})\\\">`+je+(Ve?`\u003Cg class=\\\"pele-boxes\\\" font-size=\\\"${c}\\\">${Ve}\u003C/g>`:\\\"\\\")+(Ae.length>0?`\u003Cg class=\\\"pele-rects\\\" fill=\\\"var(--_a)\\\">${Ae.reverse().join(\\\"\\\")}\u003C/g>`:\\\"\\\")+(Fe?`\u003Cg class=\\\"pele-lifelines\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\">${Fe}\u003C/g>`:\\\"\\\")+(ie.length>0?`\u003Cg class=\\\"pele-activations\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\">${ie.reverse().join(\\\"\\\")}\u003C/g>`:\\\"\\\")+(me?`\u003Cg class=\\\"pele-frames\\\" font-size=\\\"${c}\\\" stroke=\\\"var(--_b)\\\">${me}\u003C/g>`:\\\"\\\")+(Te?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${Te}\u003C/g>`:\\\"\\\")+(ve?`\u003Cg class=\\\"pele-destroys\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\">${ve}\u003C/g>`:\\\"\\\")+(ye?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${c}\\\"${h?` font-family=\\\"${fr}\\\"`:\\\"\\\"}>${ye}\u003C/g>`:\\\"\\\")+(we?`\u003Cg class=\\\"pele-notes\\\" font-size=\\\"${c}\\\" fill=\\\"var(--_a)\\\" stroke=\\\"var(--_b)\\\">${we}\u003C/g>`:\\\"\\\")+(Ie?`\u003Cg class=\\\"pele-nodes\\\">${Ie}\u003C/g>`:\\\"\\\")+\\\"\u003C/g>\\\"),width:tt,height:mt,links:[]}}var SA={type:\\\"sequence\\\",math:!0,parse(e,t,n){let r=t.sequence??{},i=new fd({wrap:typeof t.wrap==\\\"boolean\\\"?t.wrap:void 0,sequenceWrap:r.wrap===!0});return n&&i.setDiagramTitle(n),cA(e,i),i},render:xA};function jk(e){let t=\\\"TB\\\";for(let n of e)typeof n!=\\\"string\\\"&&n.stmt===\\\"dir\\\"&&(t=n.value);return t}function wA(e,t,n){let r=[],i=[],s=new Map,a=new Map,o=new Map,c=0,l=0,u=m=>{if(!m.id||m.id===\\\"\u003C/join>\u003C/fork>\\\"||m.id===\\\"\u003C/choice>\\\")return;if(m.cssClasses){let y;for(let E of m.cssClasses.split(\\\" \\\")){let b=n.get(E);if(b){y??=m.cssCompiledStyles.slice();for(let S of b.styles)y.push(S)}}y&&(m.cssCompiledStyles=y)}let p=s.get(m.id);if(p){let y=m.parentId??p.parentId;Object.assign(p,m),y!==void 0&&(p.parentId=y)}else s.set(m.id,m),r.push(m)},h=(m,p,y)=>{let E=p.id;if(E===\\\"root\\\")return;let b=t.get(E),S=b?.classes?.join(\\\" \\\")??\\\"\\\",x=b?.styles??[],I=a.get(E);if(!I){let H=\\\"rect\\\";p.start===!0?H=\\\"stateStart\\\":p.start===!1&&(H=\\\"stateEnd\\\"),p.type!==\\\"default\\\"&&(H=p.type),I={shape:H,description:E,cssClasses:`${S} statediagram-state`,cssStyles:x,type:void 0,dir:void 0,colorIndex:void 0},a.set(E,I)}if(p.description&&(Array.isArray(I.description)?(I.shape=\\\"rectWithTitle\\\",I.description=I.description.concat(p.description)):I.description.length>0?(I.shape=\\\"rectWithTitle\\\",I.description=I.description===E?[p.description].flat():[I.description,p.description].flat()):(I.shape=\\\"rect\\\",I.description=Array.isArray(p.description)?p.description.slice():p.description)),I.description.length===1&&I.shape===\\\"rectWithTitle\\\"&&(I.shape=I.type===\\\"group\\\"?\\\"roundedWithTitle\\\":\\\"rect\\\"),!I.type&&p.doc){if(I.type=\\\"group\\\",I.dir=jk(p.doc),I.shape=p.type===\\\"divider\\\"?\\\"divider\\\":\\\"roundedWithTitle\\\",I.shape===\\\"divider\\\"&&m?.id!==void 0&&o.has(m.id))I.colorIndex=o.get(m.id);else{let H=l++;I.colorIndex=S.trim()!==\\\"\\\"||x.length>0?void 0:H}o.set(E,I.colorIndex),I.cssClasses=`${I.cssClasses} statediagram-cluster ${y?\\\"statediagram-cluster-alt\\\":\\\"\\\"}`}let L=I.description,O={id:E,shape:I.shape,label:Array.isArray(L)?L[0]:L,description:Array.isArray(L)?L.slice(1):[],cssClasses:I.cssClasses,cssCompiledStyles:[],cssStyles:I.cssStyles,type:I.type,isGroup:I.type===\\\"group\\\",dir:I.dir,colorIndex:I.colorIndex};O.shape===\\\"divider\\\"&&(O.label=\\\"\\\"),m&&m.id!==\\\"root\\\"&&(O.parentId=m.id);let v=p.note;if(!v){u(O);return}let G=(H,z,M,T)=>({id:H,shape:z,label:v.text,description:[],cssClasses:M,cssCompiledStyles:[],cssStyles:[],type:T?\\\"group\\\":\\\"node\\\",isGroup:T,dir:void 0,position:v.position}),K=G(`${E}----note-${c++}`,\\\"note\\\",\\\"statediagram-note\\\",!1);K.parentId=`${E}----parent`,K.noteFor=E,u(G(K.parentId,\\\"noteGroup\\\",I.cssClasses,!0)),u(K),u(O);let C=v.position===\\\"left of\\\",Z=C?K.id:E,oe=C?E:K.id;i.push({id:`${Z}-${oe}`,start:Z,end:oe,label:\\\"\\\",classes:\\\"transition note-edge\\\",pattern:\\\"dashed\\\"})},d=[{item:void 0,doc:e,at:0,alt:!0}];for(;d.length>0;){let m=d[d.length-1];if(m.at>=m.doc.length){d.pop();continue}let p=m.doc[m.at++];typeof p!=\\\"string\\\"&&(p.stmt===\\\"state\\\"?(h(m.item,p,m.alt),p.doc&&d.push({item:p,doc:p.doc,at:0,alt:!m.alt})):p.stmt===\\\"relation\\\"&&(h(m.item,p.state1,m.alt),h(m.item,p.state2,m.alt),i.push({id:`edge${c++}`,start:p.state1.id,end:p.state2.id,label:p.description??\\\"\\\",classes:\\\"transition\\\"})))}for(let m of r)if(m.isGroup&&m.description.length>0)throw new Qe(`Group nodes can only have label. Remove the additional description for node [${m.id}]`,\\\"semantic\\\",{type:\\\"state\\\"});return{nodes:r,edges:i}}var gd=class{constructor(){fe(this,\\\"type\\\",\\\"state\\\");fe(this,\\\"rootDoc\\\",[]);fe(this,\\\"states\\\",new Map);fe(this,\\\"relations\\\",[]);fe(this,\\\"classes\\\",new Map);fe(this,\\\"links\\\",new Map);fe(this,\\\"graph\\\",{nodes:[],edges:[]});fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"dividerCount\\\",0)}get direction(){let t=\\\"TB\\\";for(let n of this.rootDoc)typeof n!=\\\"string\\\"&&n.stmt===\\\"dir\\\"&&(t=n.value);return t}setRootDoc(t){this.rootDoc=t,this.translate(),this.extract(t)}extract(t){this.states=new Map,this.relations=[],this.classes=new Map;let n=Array.isArray(t)?t:t.doc;for(let r of n)if(typeof r!=\\\"string\\\")switch(r.stmt){case\\\"state\\\":this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case\\\"relation\\\":this.addRelation(r.state1,r.state2,r.description);break;case\\\"classDef\\\":this.addStyleClass(r.id.trim(),r.classes);break;case\\\"style\\\":{let i=r.styleClass.split(\\\",\\\").map(s=>s.replace(/;/g,\\\"\\\").trim());for(let s of this.named(r.id.trim()))s.styles=i.slice();break}case\\\"applyClass\\\":this.setCssClass(r.id.trim(),r.styleClass);break;case\\\"click\\\":this.addLink(typeof r.id==\\\"string\\\"?r.id:r.id.id,r.url,r.tooltip);break}this.graph=wA(n,this.states,this.classes)}translate(){let t=[[\\\"root\\\",{stmt:\\\"root\\\",id:\\\"root\\\",doc:this.rootDoc},!0]];for(;t.length>0;){let[n,r,i]=t.pop();if(typeof r==\\\"string\\\")continue;if(r.stmt===\\\"relation\\\"){t.push([n,r.state2,!1],[n,r.state1,!0]);continue}if(r.stmt===\\\"state\\\")r.id===\\\"[*]\\\"?(r.id=n+(i?\\\"_start\\\":\\\"_end\\\"),r.start=i):r.id=r.id.trim();else if(r.stmt!==\\\"root\\\")continue;if(!r.doc)continue;let s=[],a=[];for(let o of r.doc)typeof o!=\\\"string\\\"&&o.stmt===\\\"state\\\"&&o.type===\\\"divider\\\"&&!o.doc?(s.push({...o,doc:a}),a=[]):a.push(o);s.length>0&&(a.length>0&&s.push({stmt:\\\"state\\\",id:this.getDividerId(),type:\\\"divider\\\",doc:a}),r.doc=s);for(let o=r.doc.length-1;o>=0;o--)t.push([r.id,r.doc[o],!0])}}addState(t,n=\\\"default\\\",r,i,s,a){let o=t.trim(),c=this.states.get(o);if(c?(c.doc||(c.doc=r),c.type||(c.type=n)):(c={stmt:\\\"state\\\",id:o,descriptions:[],type:n,doc:r,note:s,classes:[],styles:[],textStyles:[]},this.states.set(o,c)),i)for(let l of Array.isArray(i)?i:[i])this.addDescription(o,l.trim());if(s&&(c.note=s),a)for(let l of a)this.setCssClass(o,l.trim())}getState(t){return this.states.get(t)}addLink(t,n,r){this.links.set(t,{url:n,tooltip:r})}addRelation(t,n,r=\\\"\\\"){for(let i of[t,n])this.addState(i.id,i.type,i.doc,i.description,i.note,i.classes);this.relations.push({id1:t.id.trim(),id2:n.id.trim(),relationTitle:r})}addDescription(t,n){this.states.get(t)?.descriptions?.push(n.startsWith(\\\":\\\")?n.replace(\\\":\\\",\\\"\\\").trim():n)}getDividerId(){return`divider-id-${++this.dividerCount}`}addStyleClass(t,n=\\\"\\\"){let r=this.classes.get(t);if(r||(r={id:t,styles:[],textStyles:[]},this.classes.set(t,r)),!!n)for(let i of n.split(\\\",\\\")){let s=i.replace(\\\";\\\",\\\"\\\").trim();i.includes(\\\"color\\\")&&r.textStyles.push(s.replace(\\\"fill\\\",\\\"bgFill\\\").replace(\\\"color\\\",\\\"fill\\\")),r.styles.push(s)}}setCssClass(t,n){for(let r of this.named(t))r.classes?.push(n)}getDirection(){for(let t of this.rootDoc)if(typeof t!=\\\"string\\\"&&t.stmt===\\\"dir\\\")return t.value;return\\\"TB\\\"}setDirection(t){for(let n of this.rootDoc)if(typeof n!=\\\"string\\\"&&n.stmt===\\\"dir\\\"){n.value=t;return}this.rootDoc.unshift({stmt:\\\"dir\\\",value:t})}trimColon(t){return t.startsWith(\\\":\\\")?t.slice(1).trim():t.trim()}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}named(t){let n=[];for(let r of t.split(\\\",\\\")){let i=this.states.get(r);i||(this.addState(r),i=this.states.get(r.trim())),i&&n.push(i)}return n}};var cp=[\\\"$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\\\"];var Xk=/direction/gi,qk=/\u003C\u003C(?:fork|join|choice)>>|\\\\[\\\\[(?:fork|join|choice)\\\\]\\\\]/gi,Qk=/[\\\\n\\\\r\\\\u2028\\\\u2029]/g,Zk=/%%/g,Jk=/\\\\{/g;function Oa(e,t){let n=0,r=-2;return i=>{if(r===-2||i\u003Cn||r!==-1&&i>r){e.lastIndex=i;let s=e.exec(t);r=s?s.index:-1,n=i}return r}}function _A(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c,l=Oa(Xk,e),u=Oa(qk,e),h=Oa(Qk,e),d=Oa(Zk,e),m=Oa(Jk,e),p=-1,y=-1,E=[-1,-1,-1,-1],b=[0,0,0,0],S=-1,x=-1,I=[-1,-1,-1,-1,-1,-1],L=(_,$,g)=>{n.push(_),r.push(e.slice($,g)),i.push($),o=g},O=(_,$,g,N)=>{n.push(_),r.push($),i.push(g),o=N},v=_=>{s.push(a),a=_},G=()=>{s.length>0&&(a=s.pop())},K=(_,$)=>{for(let g=0;g\u003C_.length;g++){let N=_.charCodeAt(g),w=e.charCodeAt($+g);if(w!==N&&!(N>=97&&N\u003C=122&&w===N-32))return!1}return!0},C=_=>{let $=_;for(;$\u003Ct&&qe(e.charCodeAt($));)$++;return $},Z=_=>{let $=_;for(;$\u003Ct&&ot(e.charCodeAt($));)$++;return $},oe=_=>{let $=e.indexOf(`\\r\\n`,_);return $===-1?t:$},H=_=>{let $=h(_);return $===-1?t:$},z=_=>{if(_\u003Cp||_>y){let $=l(_),g=$===-1?t:H(_);p=_,y=g,E[0]=E[1]=E[2]=E[3]=-1;for(let N=$;N!==-1&&N\u003Cg;N=l(N+1)){let w=C(N+9);if(w===N+9)continue;let A=K(\\\"tb\\\",w)?0:K(\\\"bt\\\",w)?1:K(\\\"rl\\\",w)?2:K(\\\"lr\\\",w)?3:-1;A!==-1&&(E[A]=N,b[A]=w+2)}}for(let $=0;$\u003C4;$++)if(E[$]>=_)return $;return-1},M=_=>{if(_\u003CS||_>x){let $=u(_),g=$===-1?t:H(_);S=_,x=g,I.fill(-1);for(let N=$;N!==-1&&N\u003Cg;N=u(N+1)){let w=e.charCodeAt(N+2)|32;I[(e.charCodeAt(N)===60?0:3)+(w===102?0:w===106?1:2)]=N}}for(let $=0;$\u003C6;$++)if(I[$]>=_)return $;return-1},T=(_,$)=>{let g=d(_);return g===-1||g+2>$?(L(14,_,$),!0):g===_?(o=$,!1):(L(14,_,g),!0)},R=_=>(n.push(_),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i,error:c});for(;;){if(o>=t){switch(a){case 0:L(2,t,t);break;case 6:L(22,t,t);break;case 7:L(24,t,t);break;case 8:L(25,t,t);break;case 10:L(32,t,t);break;case 12:L(39,t,t);break;case 14:L(36,t,t);break;case 3:L(12,t,t);break;case 18:L(20,t,t);break;case 4:case 19:L(14,t,t);break}return R(0)}let _=e.charCodeAt(o);switch(a){case 0:case 1:{let $=a===0,g=_|32;if($){if(g===99&&K(\\\"click\\\",o)&&!ot(e.charCodeAt(o+5))){L(26,o,o+5);continue}if(g===104&&K(\\\"href\\\",o)&&!ot(e.charCodeAt(o+4))){L(28,o,o+4);continue}if(_===34){let A=e.indexOf('\\\"',o+1);if(A!==-1){L(27,o,A+1);continue}}if(g===100&&K(\\\"default\\\",o)&&!ot(e.charCodeAt(o+7))){L(33,o,o+7);continue}let w=z(o);if(w!==-1){L(40+w,o,oe(b[w]));continue}if(_===10){let A=o+1;for(;e.charCodeAt(A)===10;)A++;L(2,o,A);continue}if(qe(_)){o=C(o);continue}}else if(_!==10&&qe(_)){let w=o+1;for(;w\u003Ct&&e.charCodeAt(w)!==10&&qe(e.charCodeAt(w));)w++;o=w;continue}if(_===35||_===37&&e.charCodeAt(o+1)===37&&e.charCodeAt(o+2)!==123){o=oe(o);continue}if(g===115){if($&&K(\\\"scale\\\",o)){let w=C(o+5);if(w>o+5){L(7,o,w),v(5);continue}}if(K(\\\"style\\\",o)){let w=C(o+5);if(w>o+5){L(34,o,w),v(13);continue}}if(K(\\\"state\\\",o)){let w=C(o+5);if(w>o+5){o=w,v(2);continue}if($&&K(\\\"diagram\\\",o+5)){let A=K(\\\"-v2\\\",o+12)?o+15:o+12;if(w=C(A),w>A){L(3,o,w);continue}}}}else if(g===99){if(K(\\\"class\\\",o)){let w=K(\\\"def\\\",o+5),A=w?o+8:o+5,D=C(A);if(D>A){L(w?29:37,o,D),v(w?9:11);continue}}}else if(g===97&&$&&(K(\\\"acctitle\\\",o)||K(\\\"accdescr\\\",o))){let w=(e.charCodeAt(o+3)|32)===116,A=C(o+8),D=e.charCodeAt(A);if(D===58){L(w?21:23,o,C(A+1)),v(w?6:7);continue}if(D===123&&!w){o=C(A+1),v(8);continue}}if($){if(_===123){L(10,o,o+1),v(1);continue}}else{let w=z(o);if(w!==-1){L(40+w,o,oe(b[w]));continue}if(_===125){L(11,o,o+1),G();continue}if(_===10){o++;continue}}if(g===110&&K(\\\"note\\\",o)){let w=C(o+4);if(w>o+4){L(19,o,w),v(15);continue}}if($&&g===104&&K(\\\"hide empty description\\\",o)&&!ot(e.charCodeAt(o+22))){L(6,o,o+22);continue}if(_===91&&e.charCodeAt(o+1)===42&&e.charCodeAt(o+2)===93){L(44,o,o+3);continue}let N=o;for(;N\u003Ct;){let w=e.charCodeAt(N);if(w===58||w===45||w===123||qe(w))break;N++}if(N>o){T(o,N);continue}if(_===58){for(N=o+1;N\u003Ct;){let w=e.charCodeAt(N);if(w===10||w===59)break;if(w===58){let A=e.charCodeAt(N+1);if(N+1>=t||A===58||A===10||A===59)break;N++}N++}if(N>o+1){O(4,e.slice(o,N).trim(),o,N);continue}if(e.charCodeAt(o+1)===58&&e.charCodeAt(o+2)===58){L(45,o,o+3);continue}}else if(_===45&&e.charCodeAt(o+1)===45){if(e.charCodeAt(o+2)===62){L(5,o,o+3);continue}if(!$){L(18,o,o+2);continue}}if(!$)return R(1);L(48,o,o+1);continue}case 2:{if(_!==10&&qe(_)){let w=o+1;for(;w\u003Ct&&e.charCodeAt(w)!==10&&qe(e.charCodeAt(w));)w++;o=w;continue}if(_===35||_===37&&e.charCodeAt(o+1)===37&&e.charCodeAt(o+2)!==123){o=oe(o);continue}let $=M(o);if($!==-1){let w=I[$],A=$===2||$===5;O(A?17:$%3===0?15:16,e.slice(o,w).trim(),o,w+(A?10:8)),G();continue}if(_===34){o++,v(3);continue}let g=_===10?C(o):o;if(K(\\\"as\\\",g)){let w=C(g+2);if(w>g+2){L(13,o,w),v(4);continue}}if(_===10){o++,G();continue}if(_===123){L(10,o,o+1),G(),v(1);continue}if(ot(_)){let w=Z(o),A=C(w);if(A>w&&ot(e.charCodeAt(A))){let D=m(A+1);if(D!==-1&&D\u003CH(A))return c=`Error: State name must be a single word. Found: \\\"${e.slice(o,D+1).trim()}\\\"`,R(1)}}let N=o+1;for(;N\u003Ct;){let w=e.charCodeAt(N);if(w===123||qe(w))break;N++}L(9,o,N);continue}case 3:{if(_===34){o++,G();continue}let $=e.indexOf('\\\"',o);L(12,o,$===-1?t:$);continue}case 4:{let $=o;for(;$\u003Ct;){let g=e.charCodeAt($);if(g===10||g===123)break;$++}T(o,$)&&G();continue}case 5:{if(_>=48&&_\u003C=57){let g=o+1;for(;g\u003Ct&&e.charCodeAt(g)>=48&&e.charCodeAt(g)\u003C=57;)g++;L(8,o,g);continue}let $=C(o);if($>o&&K(\\\"width\\\",$)&&!ot(e.charCodeAt($+5))){o=$+5,G();continue}return R(1)}case 6:L(22,o,oe(o)),G();continue;case 7:L(24,o,oe(o)),G();continue;case 8:{if(_===125){o++,G();continue}let $=e.indexOf(\\\"}\\\",o);L(25,o,$===-1?t:$);continue}case 9:{let $=K(\\\"default\\\",o)&&C(o+7)>o+7,g=$?o+7:Z(o),N=C(g);if(g===o||N===g)return R(1);L($?31:30,o,N),G(),v(10);continue}case 10:L(32,o,oe(o)),G();continue;case 11:{let $=Z(o);if($===o)return R(1);for(;e.charCodeAt($)===44;){let g=C($+1),N=Z(g);if(N===g)break;$=N}L(38,o,$),G(),v(12);continue}case 12:L(39,o,oe(o)),G();continue;case 13:{let $=o;for(;$\u003Ct&&(ot(e.charCodeAt($))||e.charCodeAt($)===44);)$++;let g=C($);if($===o||g===$)return R(1);L(35,o,g),G(),v(14);continue}case 14:L(36,o,oe(o)),G();continue;case 15:{if(K(\\\"left of\\\",o)&&!ot(e.charCodeAt(o+7))){L(46,o,o+7),G(),v(16);continue}if(K(\\\"right of\\\",o)&&!ot(e.charCodeAt(o+8))){L(47,o,o+8),G(),v(16);continue}if(_===34){o++,G(),v(18);continue}return R(1)}case 16:{let $=C(o),g=$;for(;g\u003Ct;){let N=e.charCodeAt(g);if(N===58||N===45||qe(N))break;g++}if(g===$)return R(1);T(o,g)&&(G(),v(17));continue}case 17:{let $=C(o);if(e.charCodeAt($)===58){let w=$+1;for(;w\u003Ct;){let A=e.charCodeAt(w);if(A===58||A===10||A===59)break;w++}if(w>$+1){O(20,e.slice(o+2,w).trim(),o,w),G();continue}}let g=e.indexOf(`\\r\\n`,o),N=-1;for(;g!==-1&&(N=C(g),!(K(\\\"end note\\\",N)&&!ot(e.charCodeAt(N+8))));)g=e.indexOf(`\\r\\n`,N);if(g===-1)return R(1);O(20,e.slice(o,N).trim(),o,N+8),G();continue}case 18:{let $=C(o);if(K(\\\"as\\\",$)){L(13,o,C($+2)),G(),v(19);continue}if(_===34){o++;continue}let g=e.indexOf('\\\"',o);L(20,o,g===-1?t:g);continue}case 19:T(o,oe(o))&&G();continue}}}var e$=[\\\"TB\\\",\\\"BT\\\",\\\"RL\\\",\\\"LR\\\"],bd=\\\"'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 RA(e,t){let{types:n,texts:r,starts:i,error:s}=_A(e),a=0,o=p=>{let y=n[a];throw y===1?s!==void 0?new Qe(s,\\\"syntax\\\",{type:\\\"state\\\",...cr(e,i[a])}):ft(\\\"state\\\",e,i[a],\\\"\\\",!0):ft(\\\"state\\\",e,i[a],`Expecting ${p}, got '${cp[y]}'`)},c=p=>(n[a]!==p&&o(`'${cp[p]}'`),r[a++]),l=()=>{let p=n[a];p!==14&&p!==44&&o(\\\"'ID', 'EDGE_STATE'\\\");let y=r[a++].trim();return n[a]!==45?{stmt:\\\"state\\\",id:y,type:\\\"default\\\",description:\\\"\\\"}:(a++,{stmt:\\\"state\\\",id:y,classes:[c(14).trim()],type:\\\"default\\\",description:\\\"\\\"})};for(;n[a]===2;)a++;n[a]!==3&&o(\\\"'NL', 'SD'\\\"),a++;let u=[],h=[],d=p=>{p!==\\\"nl\\\"&&u.push(p)},m=(p,y)=>{a++;let E=[];u.push({stmt:\\\"state\\\",id:p,type:\\\"default\\\",description:y,doc:E}),h.push(u),u=E};for(;;){let p=n[a];switch(p){case 2:a++;break;case 14:case 44:{let y=l();if(n[a]===4)y.description=t.trimColon(r[a++]),d(y);else if(n[a]===5){a++;let E=l();n[a]===4?d({stmt:\\\"relation\\\",state1:y,state2:E,description:t.trimColon(r[a++])}):d({stmt:\\\"relation\\\",state1:y,state2:E})}else d(y);break}case 6:d(r[a++]);break;case 7:a++,c(8),d(r[a-2]);break;case 9:n[a+1]===10?m(r[a++],\\\"\\\"):d(r[a++]);break;case 12:{let y=r[a++];c(13);let E=c(14);if(n[a]===10)m(E,y);else if(E.includes(\\\":\\\")){let b=E.split(\\\":\\\");d({stmt:\\\"state\\\",id:b[0],type:\\\"default\\\",description:[y.trim(),b[1]]})}else d({stmt:\\\"state\\\",id:E,type:\\\"default\\\",description:y.trim()});break}case 15:d({stmt:\\\"state\\\",id:r[a++],type:\\\"fork\\\"});break;case 16:d({stmt:\\\"state\\\",id:r[a++],type:\\\"join\\\"});break;case 17:d({stmt:\\\"state\\\",id:r[a++],type:\\\"choice\\\"});break;case 18:a++,d({stmt:\\\"state\\\",id:t.getDividerId(),type:\\\"divider\\\"});break;case 19:{let y=r[a++];if(n[a]===46||n[a]===47){let E=r[a++].trim(),b=c(14).trim();d({stmt:\\\"state\\\",id:b,note:{position:E,text:c(20).trim()}})}else n[a]!==20&&o(\\\"'NOTE_TEXT', 'left_of', 'right_of'\\\"),a++,c(13),c(14),d(y);break}case 40:case 41:case 42:case 43:{let y=e$[p-40];a++,t.setDirection(y),d({stmt:\\\"dir\\\",value:y});break}case 21:{a++;let y=c(22).trim();t.setAccTitle(y),d(y);break}case 23:{a++;let y=c(24).trim();t.setAccDescription(y),d(y);break}case 25:{let y=r[a++].trim();t.setAccDescription(y),d(y);break}case 26:{a++;let y=l(),E,b=\\\"\\\";n[a]===28?(a++,E=c(27)):(n[a]!==27&&o(\\\"'STRING', 'HREF'\\\"),E=r[a++],b=c(27)),c(2),d({stmt:\\\"click\\\",id:y,url:E,tooltip:b});break}case 29:{a++;let y=c(30).trim();d({stmt:\\\"classDef\\\",id:y,classes:c(32).trim()});break}case 34:{a++;let y=c(35).trim();d({stmt:\\\"style\\\",id:y,styleClass:c(36).trim()});break}case 37:{a++;let y=c(38).trim();d({stmt:\\\"applyClass\\\",id:y,styleClass:c(39).trim()});break}case 11:h.length===0&&o(`'$end', ${bd}`),a++,u=h.pop();break;case 0:return h.length>0&&o(`'STRUCT_STOP', ${bd}`),t.setRootDoc(u),u;default:o(h.length>0?`'STRUCT_STOP', ${bd}`:`'$end', ${bd}`)}}}var t$=40,n$=16,r$=44,mo=16,lp=10,s$=16,TA=10,dp=26,MA=8,i$=320,up=10,CA=8,NA=' fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"',yd=' fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"',o$=/(?:^| )statediagram-(?:state|cluster-alt|cluster|note)(?= |$)/g;var a$=new Map([[\\\"rectWithTitle\\\",1],[\\\"stateStart\\\",2],[\\\"stateEnd\\\",3],[\\\"choice\\\",4],[\\\"fork\\\",5],[\\\"join\\\",6],[\\\"note\\\",7],[\\\"divider\\\",10]]),c$=[\\\"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 IA(e){return e===\\\"TB\\\"||e===\\\"BT\\\"}function fp(e,t,n){let r=e.state?.[t];return typeof r==\\\"number\\\"&&r>0?Math.min(r,2e3):n}function kA(e){let t=0,n=e.length;for(;t\u003Cn&&e.charCodeAt(t)===34;)t++;for(;n>t&&e.charCodeAt(n-1)===34;)n--;return e.slice(t,n)}function $A(e,t,n){return e\u003Ct?t:e>n?n:e}function Ed(e,t,n,r,i){return`\u003Crect x=\\\"${f(e)}\\\" y=\\\"${f(t)}\\\" width=\\\"${f(n)}\\\" height=\\\"${f(r)}\\\"${i}/>`}function xd(e,t,n,r){let i=Bt(0,0);return i.isGroup=!0,i.dir=e,i.padX=t,i.padTop=n,i.padBottom=r,i}function OA(e,t,n){return Pn(e.direction)?Pt(n,r=>LA(e,t,n,r)):LA(e,t,n,!1)}function LA(e,t,n,r){let i=e.graph,s=t.flowchart?.curve,a=n.fontSize??16,o=Math.round(a*.875),c=n.measurer??ct(n.fontFamily,n.fontFamilyMono),l=fp(t,\\\"wrappingWidth\\\",200),u=n.padding??8,h=n.icons,d=r?\\\"TB\\\":ln(e.direction),m=Ge(void 0,!1,c,a,0),p=(V,X,le,de=0)=>Ge(V,!0,c,X,le,de),y=new Map,E=[],b=[],S=(V,X,le)=>(E.push({node:V,kind:X,style:void 0,label:m,lines:[],w:0,h:0,titleH:0}),le&&b.push(le),E.length-1);for(let V of i.nodes){if(V.shape===\\\"noteGroup\\\")continue;let X=V.isGroup?V.shape===\\\"divider\\\"?9:8:a$.get(V.shape)??0;y.set(V.id,S(V,X,void 0))}let x=E.length,I=[];for(let V=0;V\u003Cx;V++){let X=E[V].node.parentId,le=X===void 0?void 0:y.get(X);I.push(le!==void 0&&le!==V&&E[le].node.isGroup?le:-1)}{let V=[];for(let xe=0;xe\u003Cx;xe++)V.push([]);let X=[],le=new Uint8Array(x);for(let xe=0;xe\u003Cx;xe++)I[xe]===-1?(le[xe]=1,X.push(xe)):V[I[xe]].push(xe);let de=0,Se=()=>{for(;de\u003CX.length;de++)for(let xe of V[X[de]])le[xe]||(le[xe]=1,X.push(xe))};Se();let _e=new Int32Array(x).fill(-1);for(let xe=0;xe\u003Cx;xe++){if(le[xe])continue;let Me=xe;for(;_e[Me]!==xe;)_e[Me]=xe,Me=I[Me];I[Me]=-1,le[Me]=1,X.push(Me),Se()}}let L=new Int32Array(x).fill(-1);for(let V=0;V\u003Cx;V++){let X=E[V].node.noteFor,le=X===void 0?void 0:y.get(X);le!==void 0&&(L[V]=le,I[V]=I[le])}let O=V=>ln(E[V].node.dir),v=V=>IA(I[V]===-1?d:O(I[V])),G=new Int32Array(x),K=new Uint8Array(x),C=new Array(x).fill(1/0),Z=0,oe=new Int32Array(2*x);for(let V of i.edges){let X=y.get(V.start),le=y.get(V.end);if(!(X===void 0||le===void 0)){if(V.pattern===\\\"dashed\\\"){K[E[X].kind===7?le:X]=1;continue}G[X]=Math.max(G[X],++oe[2*X]),G[le]=Math.max(G[le],++oe[2*le+1]),C[X]===1/0&&(C[X]=Z++),C[le]===1/0&&(C[le]=Z++)}}for(let V=0;V\u003Cx;V++){let X=E[V],le=X.node,de=Ct(le.cssStyles.length>0?le.cssCompiledStyles.concat(le.cssStyles):le.cssCompiledStyles),Se=(de.bold?1:0)|(de.italic?2:0),_e=de.fontSize??a;X.style=de;let xe;switch(X.kind){case 8:X.label=p(le.label,_e,4e3,Se),X.titleH=X.label.height>0?X.label.height+12:0,xe=xd(O(V),mo,X.titleH+mo,mo),xe.minW=X.label.width+2*mo;break;case 9:xe=xd(O(V),lp,lp,lp);break;case 2:X.w=X.h=14;break;case 3:X.w=X.h=18;break;case 4:X.w=X.h=30;break;case 5:case 6:{let Me=$A(40*G[V]+16,72,320);X.w=v(V)?Me:CA,X.h=v(V)?CA:Me;break}case 10:break;case 7:X.label=p(le.label,o,Math.max(l,i$)),X.w=X.label.width+24,X.h=X.label.height+16;break;default:{X.label=p(le.label,_e,l,Se);let Me=X.label.width,Ce=X.label.height+2*TA;if(X.kind===1){Ce+=14;for(let ke of le.description){let be=p(ke===\\\"\\\"?\\\" \\\":ke,o,l,Se);X.lines.push(be),be.width>Me&&(Me=be.width),Ce+=be.height}}X.w=Math.max(Me+2*s$,56),X.h=Ce}}xe??=Bt(X.w,X.h),(X.kind===0||X.kind===1)&&(xe.span=(v(V)?X.w:X.h)-24),b.push(xe)}let H=[],z=[],M=[],T=new Int32Array(x),R=new Float64Array(x),_=new Float64Array(x),$=new Map,g=(V,X)=>{if(!b[V].isGroup)return!1;for(let le=I[X];le!==-1;le=I[le])if(le===V)return!0;return!1},N=(V,X)=>($.set(H.length,V),C.push(X?-1:1/0),S(void 0,10,Bt(0,0,V)));for(let V of i.edges){let X=y.get(V.start),le=y.get(V.end);if(X===void 0||le===void 0)continue;let de=p(V.label,o,l),Se=de.width>0?de.width+12:0;X===le?(T[X]++,R[X]=Math.max(R[X],Se),_[X]+=de.height):g(X,le)?X=N(X,!0):g(le,X)&&(le=N(le,!1)),M.push(V),z.push(de),H.push({src:X,dst:le,minlen:1,labelW:Se,labelH:de.height>0?de.height+4:0,route:[],labelX:0,labelY:0})}for(let V=0;V\u003Cx;V++){if(L[V]!==-1)continue;let X=b[V],le=0;if(T[V]>0){let Se=dp+(T[V]-1)*8;le=v(V)?Se+R[V]:Se*.75+4+_[V],X.isGroup||(v(V)?(X.w+=2*le,X.h=Math.max(X.h,_[V])):(X.h+=2*le,X.w=Math.max(X.w,R[V])),le=0)}if(!K[V]&&le===0){X.parent=I[V];continue}let de=v(V)?xd(\\\"LR\\\",le,0,0):xd(\\\"TB\\\",0,le,le);de.parent=I[V],C.push(C[V]),b[V].parent=S(void 0,10,de)}for(let V=0;V\u003Cx;V++)L[V]!==-1&&(b[V].parent=b[L[V]].parent);{let V=[];for(let xe=0;xe\u003Cb.length;xe++)V.push([]);let X=[];for(let xe=0;xe\u003Cb.length;xe++){let Me=b[xe].parent;Me>=0?V[Me].push(xe):X.push(xe)}let le=xe=>E[xe].kind===2?0:1,de=(xe,Me)=>le(xe)-le(Me)||(C[xe]===C[Me]?0:C[xe]\u003CC[Me]?-1:1)||xe-Me,Se=0,_e=X.sort(de).reverse();for(;_e.length>0;){let xe=_e.pop();b[xe].seq=Se++;let Me=V[xe].sort(de);for(let Ce=Me.length-1;Ce>=0;Ce--)_e.push(Me[Ce])}}let w=On(b,H,d,{nodeSep:fp(t,\\\"nodeSpacing\\\",t$),edgeSep:n$,rankSep:fp(t,\\\"rankSpacing\\\",r$),portSep:20,tracks:s===\\\"step\\\"||s===\\\"stepBefore\\\"||s===\\\"stepAfter\\\",straight:s===\\\"linear\\\",headRoom:Rt(\\\"arrow_point\\\")}),A=Math.ceil(w.width+2*u),D=Math.ceil(w.height+2*u),U=[],B=new Map;for(let V of H){let X=V.route;for(let le=3;le\u003CX.length-3;le+=3){let de=Math.round(X[le+1]),Se=B.get(de);Se?Se.push(X[le]):B.set(de,[X[le]])}}let F=[];for(let V=0;V\u003Cb.length;V++)F.push([]);let W=[];for(let V=0;V\u003Cb.length;V++){let X=b[V].parent;X>=0?F[X].push(V):W.push(V)}let j=W.slice();for(let V=0;V\u003CW.length;V++)for(let X of F[W[V]])W.push(X);let Q=\\\"\\\",Y=[],ne=\\\"\\\",q=\\\"\\\",k=\\\"\\\",J=(V,X,le,de,Se)=>{let _e=V.filter(Ce=>E[Ce].kind===9);if(_e.length\u003C2)return;let xe=(Ce,ke)=>ke?b[Ce].x-b[Ce].w/2:b[Ce].y-b[Ce].h/2,Me=(Ce,ke)=>ke?b[Ce].x+b[Ce].w/2:b[Ce].y+b[Ce].h/2;for(let Ce of[!0,!1]){let ke=_e.slice().sort((Ae,ie)=>xe(Ae,Ce)-xe(ie,Ce)||Ae-ie),be=!0;for(let Ae=1;Ae\u003Cke.length;Ae++)Me(ke[Ae-1],Ce)>xe(ke[Ae],Ce)+.5&&(be=!1);if(be){for(let Ae=1;Ae\u003Cke.length;Ae++){let ie=f((Me(ke[Ae-1],Ce)+xe(ke[Ae],Ce))/2+u);ne+=`\u003Cpath class=\\\"pele-divider\\\" d=\\\"M${Ce?`${ie},${f(le)}V${f(Se)}`:`${f(X)},${ie}H${f(de)}`}\\\"/>`}return}}for(let Ce of _e){let ke=b[Ce];ne+=Ed(ke.x-ke.w/2+u,ke.y-ke.h/2+u,ke.w,ke.h,` class=\\\"pele-divider\\\" rx=\\\"${up}\\\"`)}};J(j,u/2,u/2,A-u/2,D-u/2);for(let V of W){let X=E[V],le=X.node,de=X.style;if(le===void 0||de===void 0||X.kind>=9)continue;let Se=b[V],_e=Se.x+u,xe=Se.y+u,Me=X.w,Ce=X.h,ke=vt(de),be=` class=\\\"pele-label\\\"${ke}${de.text}`,Ae;switch(X.kind){case 8:{let Te=_e-Se.w/2,ye=xe-Se.h/2;Mn(de.shape)&&Y.push({box:[Te,ye,Te+Se.w,ye+Se.h],shape:de.shape}),Ae=Ed(Te,ye,Se.w,Se.h,` rx=\\\"${up}\\\" fill=\\\"var(--_a)\\\"${vn(de.shape)?\\\"\\\":' fill-opacity=\\\"0.5\\\"'} stroke=\\\"var(--_b)\\\"${de.shape}`),X.titleH>0&&(Ae+=`\u003Cpath d=\\\"M${f(Te)},${f(ye+X.titleH)}H${f(Te+Se.w)}\\\"${yd}${de.line}/>`+Ne(X.label,l$(Se,X.label.width,B)+u,ye+X.titleH/2,` class=\\\"pele-cluster-label\\\"${ke}${de.text}`,h)),J(F[V],Te,ye+X.titleH,Te+Se.w,ye+Se.h);break}case 2:Ae=`\u003Ccircle r=\\\"7\\\" fill=\\\"var(--_l)\\\"${de.shape}/>`;break;case 3:Ae=`\u003Ccircle r=\\\"8.5\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_l)\\\"${de.line}/>\u003Ccircle r=\\\"5\\\" fill=\\\"var(--_l)\\\"${de.shape}/>`;break;case 4:Ae=`\u003Cpolygon points=\\\"0,${f(-Ce/2)} ${f(Me/2)},0 0,${f(Ce/2)} ${f(-Me/2)},0\\\"${NA}${de.shape}/>`;break;case 5:case 6:Ae=Ed(-Me/2,-Ce/2,Me,Ce,` rx=\\\"2\\\" fill=\\\"var(--_l)\\\"${de.shape}`);break;case 7:{let Te=f(Me/2),ye=f(Ce/2),we=f(Me/2-MA),Ie=f(MA-Ce/2);Ae=`\u003Cpath d=\\\"M-${Te},-${ye}H${we}L${Te},${Ie}V${ye}H-${Te}Z\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"/>\u003Cpath d=\\\"M${we},-${ye}V${Ie}H${Te}\\\"${yd}/>`+Ne(X.label,0,0,` class=\\\"pele-label\\\" font-size=\\\"${o}\\\" fill=\\\"var(--_m)\\\"`,h);break}default:{if(Ae=Ed(-Me/2,-Ce/2,Me,Ce,` rx=\\\"${f(Math.min(up,Ce/2))}\\\"${NA}${de.shape}`),X.kind===0){Ae+=Ne(X.label,0,0,be,h);break}let Te=TA-Ce/2+X.label.height;Ae+=`\u003Cpath d=\\\"M${f(-Me/2)},${f(Te+6)}H${f(Me/2)}\\\"${yd}${de.line}/>`+Ne(X.label,0,Te-X.label.height/2,be,h),Te+=14;for(let ye of X.lines)Ae+=Ne(ye,0,Te+ye.height/2,` class=\\\"pele-state-description\\\" font-size=\\\"${o}\\\"${ke}${de.text}`,h),Te+=ye.height}}let ie=e.links.get(le.id);if(ie){let Te=bt(kA(ie.tooltip));Te&&(Ae=`\u003Ctitle>${rt(Te)}\u003C/title>`+Ae),Ae=Zn(Ae,Qn(kA(ie.url)),le.id,U,n,' target=\\\"_blank\\\"')}let me=`\u003Cg class=\\\"${c$[X.kind]}${It(le.cssClasses.replace(o$,\\\"\\\"))}\\\" data-id=\\\"${Ue(le.id)}\\\"`;X.kind===8?Q+=`${me}>${Ae}\u003C/g>`:X.kind===7?k+=`${me} transform=\\\"translate(${f(_e)},${f(xe)})\\\">${Ae}\u003C/g>`:q+=`${me} transform=\\\"translate(${f(_e)},${f(xe)})\\\">${Ae}\u003C/g>`}let te=(V,X,le)=>{let de=b[le];if(de.isGroup)return;let Se=E[le],_e=Se.kind===5||Se.kind===6,xe=X===0?3:X-3;for(let Me of[1,0]){let Ce=Me?de.h:de.w,ke=Me?Se.h:Se.w,be=Me?Se.w:Se.h,Ae=(Me?de.y:de.x)+u,ie=(Me?de.x:de.y)+u,me=V[X+Me]-Ae;if(!(Math.abs(Math.abs(me)-Ce/2)>=.5)){V[X+Me]-=Math.sign(me)*(Ce-ke)/2,_e&&be>ke&&(V[X+1-Me]=$A(V[xe+1-Me],ie-be/2+6,ie+be/2-6));return}}},se=_c();for(let V=0;V\u003CH.length;V++){let X=H[V];X.src===X.dst||X.route.length\u003C6||M[V].pattern===\\\"dashed\\\"||se.add(X.dst,Jn(X.route,X.route.length-3,b[X.dst]),\\\"arrow_point\\\")}let re=\\\"\\\",P=\\\"\\\",ee=\\\"\\\",ae=new Int32Array(x),ue=new Float64Array(x);for(let V=0;V\u003CH.length;V++){let X=H[V],le=M[V],de=z[V],Se=le.pattern===\\\"dashed\\\",_e=Se?\\\"none\\\":\\\"arrow_point\\\",xe;if(X.src===X.dst){let ke=b[X.src],be=E[X.src],Ae=ae[X.src]++,ie=v(X.src),me=ke.isGroup?ke.w:be.w,Te=ke.isGroup?ke.h:be.h,ye=(ie?me:Te)/2,we=Math.max(Math.min((ie?Te:me)/2-4,8+Ae*6),2),Ie=dp+Ae*8,ve=Rt(_e)/(Math.hypot(Ie,we)||1),Pe=(Fe,Ve)=>ke.x+u+(ie?ye+Fe:-Ve),he=(Fe,Ve)=>ke.y+u+(ie?Ve:ye+Fe),Re=(Fe,Ve)=>`${f(Pe(Fe,Ve))},${f(he(Fe,Ve))}`;xe={d:`M${Re(0,-we)}C${Re(Ie,-2*we)} ${Re(Ie,2*we)} ${Re(Ie*ve,we+we*ve)}`,sx:0,sy:0,sdx:0,sdy:0,ex:Pe(0,we),ey:he(0,we),edx:Pe(-Ie,-we)-Pe(0,0),edy:he(-Ie,-we)-he(0,0)};let Be=Math.hypot(xe.edx,xe.edy)||1;xe.edx/=Be,xe.edy/=Be;let ge=dp+(T[X.src]-1)*8,Le=ue[X.src]+de.height/2;ue[X.src]+=de.height,X.labelX=ie?ke.x+ye+ge+4+X.labelW/2:ke.x,X.labelY=ie?ke.y-_[X.src]/2+Le:ke.y+ye+ge*.75+4+Le}else{let ke=X.route.slice(),be=se.of(X.src,Jn(ke,0,b[X.src])),Ae=se.of(X.dst,Jn(ke,ke.length-3,b[X.dst]));for(let me=0;me\u003Cke.length;me+=3)ke[me]+=u,ke[me+1]+=u;te(ke,0,X.src),te(ke,ke.length-3,X.dst);let ie=$.get(V);if(ie!==void 0&&ke.length>=6){let me=b[ie],Te=E[X.src].kind===10,ye=Te?0:ke.length-3,we=(me.dir===\\\"TB\\\"||me.dir===\\\"LR\\\")===Te,Ie=IA(me.dir)?[ke[ye],me.y+u+(we?E[ie].titleH-me.h/2:me.h/2),0]:[me.x+u+(we?-me.w/2:me.w/2),ke[ye+1],1];ke=Te?Ie.concat(ke):ke.concat(Ie)}xe=Cn(ke,typeof s==\\\"string\\\"?s:void 0,0,Rt(_e),be,Ae)}let Me=Mr(xe.d,[xe.ex,xe.ey],Y,\\\"\\\",xe.tokens);Me===\\\"\\\"&&(re+=Cr(xe,\\\"none\\\",_e));let Ce=Se?`pele-note-edge\\\" stroke=\\\"${Me||\\\"var(--_b)\\\"}\\\" stroke-dasharray=\\\"3 4`:Me?`pele-transition\\\" stroke=\\\"${Me}`:\\\"pele-transition\\\";if(P+=`\u003Cg class=\\\"pele-edge ${Ce}\\\" data-id=\\\"${Ue(le.id)}\\\">\u003Cpath d=\\\"${xe.d}\\\"/>`+_t(_e,xe.ex,xe.ey,xe.edx,xe.edy,Me||\\\"var(--_l)\\\")+\\\"\u003C/g>\\\",de.width>0){let ke=X.labelX+u,be=X.labelY+u;ee+=dn(le.id,de,ke,be,\\\"\\\",h)}}let ce=Fc(e.title,c,a,u,A,D,(Q?`\u003Cg class=\\\"pele-clusters\\\">${Q}\u003C/g>`:\\\"\\\")+(ne?`\u003Cg class=\\\"pele-dividers\\\" stroke-dasharray=\\\"4 4\\\"${yd}>${ne}\u003C/g>`:\\\"\\\")+Dn(re)+(P?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${P}\u003C/g>`:\\\"\\\")+(ee?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${o}\\\">${ee}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${q}${k}\u003C/g>`);return{svg:at(\\\"state\\\",ce.width,ce.height,a,n,e,ce.content),width:ce.width,height:ce.height,links:U}}function l$(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,s=t/2,a=e.x,o=-1;for(let c of[e.x,i+mo+s,i+e.w-mo-s]){let l=1/0;for(let u of r)u>i&&u\u003Ci+e.w&&(l=Math.min(l,Math.abs(u-c)-s));if(l>=6)return c;l>o+.5&&(o=l,a=c)}return a}var DA={type:\\\"state\\\",math:!0,parse(e,t,n){let r=new gd;return n&&(r.title=n),RA(e,r),r},render:OA};var d$=34,u$=24,f$=8,h$=2e4,vA=1e4,hp=2e6,PA=4,p$=3,FA=8,pp=20,BA=20,WA=14,m$=3;function GA(e,t,n,r,i=u$){let s=e.length;if(s===0)return{width:0,height:0};let a=n===\\\"LR\\\"||n===\\\"RL\\\",o=n===\\\"BT\\\"||n===\\\"RL\\\",c=[];for(let H=s-1;H>=0;H--)e[H].parent\u003C0&&e[H].isGroup&&c.push(H);let l=Math.max(1,c.length),u=new Int32Array(s).fill(-1);c.forEach((H,z)=>u[H]=z);let h=new Uint8Array(s);for(let H=0;H\u003Cs;H++)e[H].parent>=0&&(h[e[H].parent]=1);let d=new Float64Array(l).fill(i),m=i,p=H=>{let z=H,M=i;for(let R=0;e[z].parent>=0&&R\u003CvA;R++)z=e[z].parent,u[z]\u003C0&&(M+=Math.max(e[z].padX,e[z].padTop,e[z].padBottom));let T=Math.max(0,u[z]);return M>d[T]&&(d[T]=M),M>m&&(m=M),T},y=new Int32Array(s).fill(-1),E=[];for(let H=0;H\u003Cs;H++)u[H]>=0||(!e[H].isGroup||!h[H])&&(y[H]=E.length,E.push(H));let b=H=>a?H.w:H.h,S=H=>a?H.h:H.w,x=E.map(H=>Ys(S(e[H]),b(e[H]))),I=[],L=[],O=1;{let H=new Set;for(let z=0;z\u003Ct.length;z++){let M=t[z],T=y[M.src],R=y[M.dst];if(T\u003C0||R\u003C0||T===R)continue;let _=Math.min(T,R)*E.length+Math.max(T,R);(M.labelW>0||H.has(_))&&(O=2),H.add(_),I.push(Hs(T,R,M.minlen,a?M.labelH:M.labelW,a?M.labelW:M.labelH)),L.push(z)}}Do(x,I),vo(x,I,O);let v=I.length,G=Int32Array.from(E,p),K=(H,z)=>{let M=d.map((he,Re)=>z[Re]?Math.max(he,BA):he),T=new Uint8Array(l),R=0,_=new Int32Array(v);for(let he=0;he\u003Cv;he++)_[he]=Math.abs(x[I[he].head].rank-x[I[he].tail].rank),H[he]||(R+=_[he]-1);let $=R>h$,g=E.length+($?0:R),N=new Int32Array(g),w=new Int32Array(g),A=new Float64Array(g),D=new Float64Array(g),U=new Uint8Array(g),B=0;for(let he=0;he\u003CE.length;he++)N[he]=x[he].rank,w[he]=G[he],A[he]=x[he].w,D[he]=x[he].h,N[he]>B&&(B=N[he]);let F=new Int32Array(v).fill(-1),W=new Int32Array(v).fill(-1),j=[];{let he=E.length;for(let Re=0;Re\u003Cv;Re++){let Be=I[Re],ge=Be.reversed?Be.head:Be.tail,Le=Be.reversed?Be.tail:Be.head;if($||_[Re]\u003C2||H[Re]){j.push(ge,Le);continue}let Fe=N[ge],Ve=N[Le],Oe=-1;Be.labelW>0&&(Oe=Fe+(Ve-Fe>>1),O===2&&(Oe&1)===0&&Oe--),F[Re]=he;let je=ge;for(let Je=Fe+1;Je\u003CVe;Je++){let $e=he++;N[$e]=Je,w[$e]=w[ge]+Math.round((w[Le]-w[ge])*(Je-Fe)/(Ve-Fe)),U[$e]=1,Je===Oe&&(A[$e]=Be.labelW,D[$e]=Be.labelH,W[Re]=$e),j.push(je,$e),je=$e}j.push(je,Le)}}let Q=new Int32Array(g+1),Y=new Int32Array(g+1);for(let he=0;he\u003Cj.length;he+=2)Y[j[he]+1]++,Q[j[he+1]+1]++;for(let he=0;he\u003Cg;he++)Q[he+1]+=Q[he],Y[he+1]+=Y[he];let ne=new Int32Array(j.length/2),q=new Int32Array(j.length/2);{let he=Q.slice(0,g),Re=Y.slice(0,g);for(let Be=0;Be\u003Cj.length;Be+=2)q[Re[j[Be]]++]=j[Be+1],ne[he[j[Be+1]]++]=j[Be]}let k=[];for(let he=0;he\u003C=B;he++)k.push([]);for(let he=0;he\u003Cg;he++)k[N[he]].push(he);let J=new Float64Array(g),te=new Float64Array(g),se=he=>{he.sort((Re,Be)=>w[Re]-w[Be]||te[Re]-te[Be]||Re-Be);for(let Re=0;Re\u003Che.length;Re++)J[he[Re]]=Re};for(let he of k){for(let Re=0;Re\u003Che.length;Re++)te[he[Re]]=Re;se(he)}for(let he=0;he\u003Cf$&&B>0;he++){let Re=(he&1)===0;for(let Be=1;Be\u003C=B;Be++){let ge=k[Re?Be:B-Be],Le=Re?Q:Y,Fe=Re?ne:q;for(let Ve of ge){let Oe=0,je=Le[Ve+1]-Le[Ve];for(let Je=Le[Ve];Je\u003CLe[Ve+1];Je++)Oe+=J[Fe[Je]];te[Ve]=je>0?Oe/je:J[Ve]}se(ge)}}let re=(he,Re)=>U[he]||U[Re]?r.edgeSep:r.nodeSep,P=(he,Re)=>{let Be=0;for(;Be\u003Che.length;){let ge=Be;for(;ge+1\u003Che.length&&w[he[ge+1]]===w[he[Be]];)ge++;Re(he,Be,ge),Be=ge+1}},ee=(he,Re,Be)=>{let ge=A[he[Re]];for(let Le=Re;Le\u003CBe;Le++)ge+=re(he[Le],he[Le+1])+A[he[Le+1]];return ge},ae=new Float64Array(l),ue=c.length>0?d$:0;for(let he=0;he\u003Cc.length;he++){let Re=e[c[he]];ae[he]=Math.max(0,Re.minW-2*M[he]),Re.padTop>ue&&(ue=Re.padTop)}for(let he of k)P(he,(Re,Be,ge)=>{let Le=ee(he,Be,ge);Le>ae[w[he[Be]]]&&(ae[w[he[Be]]]=Le)});let ce=new Float64Array(l+1);for(let he=0;he\u003Cl;he++)ce[he+1]=ce[he]+ae[he]+2*M[he];let pe=new Float64Array(g),V=new Float64Array(g),X=(he,Re,Be)=>{let ge=w[he[Re]],Le=(ce[ge]+M[ge]+(ce[ge+1]-M[ge])-ee(he,Re,Be))/2;for(let Fe=Re;Fe\u003C=Be;Fe++)pe[he[Fe]]=Le+A[he[Fe]]/2,Fe\u003CBe&&(Le+=A[he[Fe]]+re(he[Fe],he[Fe+1]))},le=(he,Re,Be)=>{let ge=w[he[Re]],Le=ce[ge]+M[ge];for(let Ve=Re;Ve\u003C=Be;Ve++){let Oe=he[Ve];pe[Oe]=Math.max(V[Oe],Le+A[Oe]/2),Ve\u003CBe&&(Le=pe[Oe]+A[Oe]/2+re(Oe,he[Ve+1]))}let Fe=ce[ge+1]-M[ge];for(let Ve=Be;Ve>=Re;Ve--){let Oe=he[Ve];pe[Oe]=Math.min(pe[Oe],Fe-A[Oe]/2),Ve>Re&&(Fe=pe[Oe]-A[Oe]/2-re(he[Ve-1],Oe))}};for(let he of k)P(he,X);for(let he=0;he\u003C4&&B>0;he++){let Re=(he&1)===0;for(let Be=1;Be\u003C=B;Be++){let ge=k[Re?Be:B-Be],Le=Re?Q:Y,Fe=Re?ne:q;for(let Ve of ge){let Oe=0,je=0;for(let Je=Le[Ve];Je\u003CLe[Ve+1];Je++)w[Fe[Je]]===w[Ve]&&(Oe+=pe[Fe[Je]],je++);V[Ve]=je>0?Oe/je:pe[Ve]}P(ge,le)}}let de=new Float64Array(B+1),Se=new Float64Array(B+1),_e=new Float64Array(B+1).fill(r.rankSep/O);if(H.some(he=>he===1)){let he=r.rankSep/O;_e.fill(he/m$);for(let Re=0;Re\u003Cv;Re++){let Be=I[Re],ge=Be.reversed?Be.head:Be.tail,Le=Be.reversed?Be.tail:Be.head;if(H[Re]){if(Be.labelH\u003C=0||_[Re]>O)continue;let Ve=Math.min(he,(Be.labelH+2*pp-Math.min(D[ge],D[Le])/2)/_[Re]);for(let Oe=N[ge];Oe\u003CN[Le];Oe++)Ve>_e[Oe]&&(_e[Oe]=Ve);continue}let Fe=F[Re];if(Fe\u003C0||_[Re]\u003C=O*Be.minlen){for(let Ve=N[ge];Ve\u003CN[Le];Ve++)_e[Ve]=he;continue}for(let Ve=Fe-1;Ve\u003CFe+_[Re]-1;Ve++){let Oe=Ve\u003CFe?ge:Ve,je=Ve+1\u003CFe+_[Re]-1?Ve+1:Le;(w[Oe]!==w[je]||Math.abs(pe[Oe]-pe[je])>=.5)&&(_e[N[Oe]]=he)}}}let xe=ue+m;for(let he=0;he\u003C=B;he++){let Re=0;for(let Be of k[he])D[Be]>Re&&(Re=D[Be]);de[he]=xe,Se[he]=xe+Re,xe+=Re+(he===B?0:_e[he])}let Me=xe+m,Ce=ce[l],ke=he=>o?ue+Me-he:he,be=(he,Re)=>a?ke(Re):he,Ae=(he,Re)=>a?he:ke(Re),ie=a?1:0;for(let he=0;he\u003CE.length;he++){let Re=e[E[he]],Be=(de[N[he]]+Se[N[he]])/2;Re.x=be(pe[he],Be),Re.y=Ae(pe[he],Be)}for(let he=0;he\u003Cc.length;he++){let Re=e[c[he]],Be=(ce[he]+ce[he+1])/2,ge=ce[he+1]-ce[he];Re.x=a?Me/2:Be,Re.y=a?Be:Me/2,Re.w=a?Me:ge,Re.h=a?ge:Me,Re.padTop=ue}let me=new Int32Array(s),Te=[];for(let he=0;he\u003Cs;he++){if(!e[he].isGroup||u[he]>=0||y[he]>=0)continue;let Re=0;for(let Be=e[he].parent;Be>=0&&Re\u003CvA;Be=e[Be].parent)Re++;me[he]=Re,Te.push(he)}Te.sort((he,Re)=>me[Re]-me[he]||he-Re);let ye=new Float64Array(s*4);for(let he=0;he\u003Cs;he++)ye[he*4]=1/0,ye[he*4+1]=1/0,ye[he*4+2]=-1/0,ye[he*4+3]=-1/0;let we=(he,Re)=>{Re.x-Re.w/2\u003Cye[he*4]&&(ye[he*4]=Re.x-Re.w/2),Re.y-Re.h/2\u003Cye[he*4+1]&&(ye[he*4+1]=Re.y-Re.h/2),Re.x+Re.w/2>ye[he*4+2]&&(ye[he*4+2]=Re.x+Re.w/2),Re.y+Re.h/2>ye[he*4+3]&&(ye[he*4+3]=Re.y+Re.h/2)};for(let he of E)e[he].parent>=0&&u[e[he].parent]\u003C0&&we(e[he].parent,e[he]);for(let he of Te){let Re=e[he];if(ye[he*4]===1/0)continue;let Be=Math.max(ye[he*4+2]-ye[he*4]+2*Re.padX,Re.minW);Re.x=(ye[he*4]+ye[he*4+2])/2,Re.w=Be,Re.y=(ye[he*4+1]-Re.padTop+ye[he*4+3]+Re.padBottom)/2,Re.h=ye[he*4+3]-ye[he*4+1]+Re.padTop+Re.padBottom,Re.parent>=0&&u[Re.parent]\u003C0&&we(Re.parent,Re)}for(let he of t)he.route=[];for(let he=0;he\u003Cv;he++){let Re=I[he],Be=t[L[he]],ge=Re.reversed?Re.head:Re.tail,Le=Re.reversed?Re.tail:Re.head,Fe=[pe[ge],Se[N[ge]]-(Se[N[ge]]-de[N[ge]]-D[ge])/2],Ve=F[he];if(Ve>=0)for(let Je=Ve;Je\u003CVe+_[he]-1;Je++)Fe.push(pe[Je],de[N[Je]]),Se[N[Je]]>de[N[Je]]&&Fe.push(pe[Je],Se[N[Je]]);Fe.push(pe[Le],de[N[Le]]+(Se[N[Le]]-de[N[Le]]-D[Le])/2);let Oe=[];for(let Je=0;Je\u003CFe.length;Je+=2)Oe.push(be(Fe[Je],Fe[Je+1]),Ae(Fe[Je],Fe[Je+1]),ie);if(Re.reversed)for(let Je=0,$e=Oe.length-3;Je\u003C$e;Je+=3,$e-=3)for(let Ze=0;Ze\u003C2;Ze++){let tt=Oe[Je+Ze];Oe[Je+Ze]=Oe[$e+Ze],Oe[$e+Ze]=tt}Be.route=Oe;let je=W[he];if(je>=0){let Je=(de[N[je]]+Se[N[je]])/2;Be.labelX=be(pe[je],Je),Be.labelY=Ae(pe[je],Je)}else Be.labelX=(Oe[0]+Oe[Oe.length-3])/2,Be.labelY=(Oe[1]+Oe[Oe.length-2])/2}for(let he of t){if(he.route.length>0||he.src===he.dst)continue;let Re=e[he.src],Be=e[he.dst],[ge,Le]=UA(Re,Be),[Fe,Ve]=UA(Be,Re),Oe=Math.abs(Fe-ge)>Math.abs(Ve-Le)?1:0;he.route=[ge,Le,Oe,Fe,Ve,Oe],he.labelX=(ge+Fe)/2,he.labelY=(Le+Ve)/2}let Ie=new Uint8Array(v),ve=t.reduce((he,Re)=>he+Re.route.length/3,0),Pe=v*(E.length+t.length+ve);if(Pe\u003C=hp){let he=Oe=>(de[N[Oe]]+Se[N[Oe]])/2,Re=t.map(Oe=>[a?Oe.labelY:Oe.labelX,ke(a?Oe.labelX:Oe.labelY)]),Be=(Oe,je,Je,$e,Ze,tt,mt,dt)=>Je>Ze-mt/2&&Oe\u003CZe+mt/2&&$e>tt-dt/2&&je\u003Ctt+dt/2,ge=(Oe,je,Je,$e,Ze,tt,mt)=>{for(let dt=0;dt\u003CE.length;dt++)if(dt!==Ze&&dt!==tt&&Be(Oe,je,Je,$e,pe[dt],he(dt),A[dt]+8,D[dt]+8))return!1;for(let dt=0;dt\u003Ct.length;dt++){let Ee=t[dt];if(dt!==mt&&Ee.labelW>0&&Ee.src!==Ee.dst&&Be(Oe,je,Je,$e,Re[dt][0],Re[dt][1],a?Ee.labelH:Ee.labelW,a?Ee.labelW:Ee.labelH))return!1}return!0},Le=(Oe,je,Je,$e,Ze)=>{let tt=0;for(let mt=0;mt\u003Ct.length;mt++){if(mt===Ze)continue;let dt=t[mt].route;for(let Ee=3;Ee\u003Cdt.length;Ee+=3)if(Math.max(dt[Ee-3],dt[Ee])>Oe&&Math.min(dt[Ee-3],dt[Ee])\u003CJe&&Math.max(dt[Ee-2],dt[Ee+1])>je&&Math.min(dt[Ee-2],dt[Ee+1])\u003C$e){tt++;break}}return tt},Fe=(Oe,je,Je)=>{let $e=0;for(let Ze=0;Ze\u003Ct.length;Ze++){let tt=t[Ze].route;if(Ze===Je||tt.length===0)continue;let mt=tt.length-3;(Math.abs(tt[0]-Oe)\u003C1&&Math.abs(tt[1]-je)\u003C1||Math.abs(tt[mt]-Oe)\u003C1&&Math.abs(tt[mt+1]-je)\u003C1)&&$e++}return $e},Ve=(Oe,je,Je,$e,Ze)=>{let tt=Math.abs(Je-Oe)\u003C.5,mt=tt?Math.min(je,$e):Math.min(Oe,Je),dt=tt?Math.max(je,$e):Math.max(Oe,Je),Ee=tt?Oe:je;for(let We=0;We\u003Ct.length;We++){let De=t[We];if(We===Ze||De.src===t[Ze].src||De.dst===t[Ze].dst)continue;let Xe=De.route;for(let ze=3;ze\u003CXe.length;ze+=3){let et=Xe[ze-3+(tt?0:1)],Ye=Xe[ze+(tt?0:1)];if(Math.abs(et-Ee)>=PA||Math.abs(Ye-Ee)>=PA)continue;let He=Xe[ze-3+(tt?1:0)],nt=Xe[ze+(tt?1:0)];if(Math.min(dt,Math.max(He,nt))-Math.max(mt,Math.min(He,nt))>1)return!0}}return!1};for(let Oe=0;Oe\u003Cv;Oe++){let je=I[Oe],Je=L[Oe],$e=t[Je],Ze=je.tail,tt=je.head;if(w[Ze]===w[tt]||Math.abs(pe[tt]-pe[Ze])\u003C1)continue;let mt=pe[Ze],dt=pe[tt],Ee=he(Ze),We=he(tt),De=Math.sign(dt-mt),Xe=Math.sign(We-Ee),ze=(Ye,He)=>{for(let st=2;st\u003CYe.length;st+=2)if(!ge(Math.min(Ye[st-2],Ye[st])-He,Math.min(Ye[st-1],Ye[st+1])-He,Math.max(Ye[st-2],Ye[st])+He,Math.max(Ye[st-1],Ye[st+1])+He,Ze,tt,Je)||Ve(be(Ye[st-2],Ye[st-1]),Ae(Ye[st-2],Ye[st-1]),be(Ye[st],Ye[st+1]),Ae(Ye[st],Ye[st+1]),Je))return!1;let nt=0,it=0,wt=-1;if($e.labelW>0){let st=je.labelW,pt=je.labelH;for(let gt=2;gt\u003CYe.length;gt+=2){let yt=(Ye[gt-2]+Ye[gt])/2,Nt=(Ye[gt-1]+Ye[gt+1])/2,Ft=Math.abs(Ye[gt]-Ye[gt-2]),jn=Math.abs(Ye[gt+1]-Ye[gt-1]),En=Ft+jn;if(En\u003C=wt||(Ft>0?Ft\u003Cst+8:jn\u003Cpt+8)||yt-st/2\u003C0||yt+st/2>Ce||Nt-pt/2\u003C0||Nt+pt/2>Me||!ge(yt-st/2,Nt-pt/2,yt+st/2,Nt+pt/2,-1,-1,Je))continue;let Sr=be(yt,Nt),an=Ae(yt,Nt);Le(Sr-$e.labelW/2,an-$e.labelH/2,Sr+$e.labelW/2,an+$e.labelH/2,Je)>0||(nt=yt,it=Nt,wt=En)}if(wt\u003C0)return!1}let ut=[Ye[0],Ye[1]];for(let st=2;st\u003CYe.length;st+=2){let pt=Ye[st]-Ye[st-2],gt=Ye[st+1]-Ye[st-1],yt=Math.abs(pt)+Math.abs(gt),Nt=st>2?pp:0,Ft=st+2\u003CYe.length?pp:0;yt>Nt+Ft+1&&(Nt&&ut.push(Ye[st-2]+pt/yt*Nt,Ye[st-1]+gt/yt*Nt),Ft&&ut.push(Ye[st]-pt/yt*Ft,Ye[st+1]-gt/yt*Ft)),ut.push(Ye[st],Ye[st+1])}$e.route=[];for(let st=0;st\u003Cut.length;st+=2){let pt=st===0?ut[0]!==ut[2]:ut[st]!==ut[st-2];$e.route.push(be(ut[st],ut[st+1]),Ae(ut[st],ut[st+1]),pt?1-ie:ie)}return $e.labelW>0&&($e.labelX=be(nt,it),$e.labelY=Ae(nt,it),Re[Je]=[nt,it]),Ie[Oe]=1,!0};if(ze([mt+De*A[Ze]/2,Ee,dt,Ee,dt,We-Xe*D[tt]/2],2)||ze([mt,Ee+Xe*D[Ze]/2,mt,We,dt-De*A[tt]/2,We],2)||Pe>hp/FA)continue;let et=[];for(let Ye of w[Ze]\u003Cw[tt]?[w[tt],w[Ze]]:[w[Ze],w[tt]]){let He=Math.max(M[Ye]-WA,Math.min(M[Ye]/2,BA-WA));for(let nt of[ce[Ye]+He,ce[Ye+1]-He]){if(Math.abs(nt-mt)\u003CA[Ze]/2+4||Math.abs(nt-dt)\u003CA[tt]/2+4)continue;let it=[mt+Math.sign(nt-mt)*A[Ze]/2,Ee,nt,Ee,nt,We,dt+Math.sign(nt-dt)*A[tt]/2,We],wt=(Fe(be(it[0],it[1]),Ae(it[0],it[1]),Je)+Fe(be(it[6],it[7]),Ae(it[6],it[7]),Je))*1e6;for(let ut=2;ut\u003Cit.length;ut+=2){let st=be(it[ut-2],it[ut-1]),pt=Ae(it[ut-2],it[ut-1]),gt=be(it[ut],it[ut+1]),yt=Ae(it[ut],it[ut+1]);wt+=Le(Math.min(st,gt),Math.min(pt,yt),Math.max(st,gt),Math.max(pt,yt),Je)*1e6+Math.abs(gt-st)+Math.abs(yt-pt)}et.push({pts:it,cost:wt,lane:Ye})}}et.sort((Ye,He)=>Ye.cost-He.cost);for(let Ye of et)if(ze(Ye.pts,1)){T[Ye.lane]=1;break}}}return{width:a?Me:Ce,height:a?Ce:Me,routed:Ie,margins:T,work:Pe}},C=new Uint8Array(v),Z=new Uint8Array(l),oe=K(C,Z);for(let H=0;H\u003Cp$&&oe.work\u003C=hp/FA;H++){let z=H===0?oe.routed:C.map((M,T)=>M&oe.routed[T]);if(z.every((M,T)=>M===C[T])&&oe.margins.every((M,T)=>M===Z[T]))break;C=z,Z=oe.margins,oe=K(C,Z)}return C.some((H,z)=>H&&!oe.routed[z])&&(oe=K(new Uint8Array(v),new Uint8Array(l))),{width:oe.width,height:oe.height}}function UA(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.max(e.w/2,.5),s=Math.max(e.h/2,.5);if(Math.abs(n)\u003Ci&&Math.abs(r)\u003Cs){let o=i-Math.abs(n),c=s-Math.abs(r);return o\u003Cc?[e.x+(n\u003C0?-i:i),t.y]:[t.x,e.y+(r\u003C0?-s:s)]}let a=Math.min(n!==0?i/Math.abs(n):1/0,r!==0?s/Math.abs(r):1/0);return[e.x+n*a,e.y+r*a]}var YA=\\\"__swimlane_default__\\\";function g$(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 n of e.nodes)!n.isGroup&&n.parentId===void 0&&(n.parentId=YA);e.nodes.push({id:YA,label:void 0,labelType:\\\"text\\\",shape:\\\"rect\\\",isGroup:!0,parentId:void 0,cssStyles:[],cssCompiledStyles:[],cssClasses:\\\"\\\",dir:void 0})}}function b$(e,t,n,r,i,s,a){let o=e.x-e.w/2,c=e.y-e.h/2,l=s===\\\"LR\\\"||s===\\\"RL\\\",u=l?o+e.padTop/2:e.x,h=l?e.y:c+e.padTop/2,d=Ne(t,u,h,` class=\\\"pele-cluster-label\\\"${vt(n,\\\"var(--_m)\\\")}${n.text}`,a);return`\u003Cg class=\\\"pele-cluster pele-lane${r}\\\" data-id=\\\"${i}\\\">\u003Crect x=\\\"${f(o)}\\\" y=\\\"${f(c)}\\\" width=\\\"${f(e.w)}\\\" height=\\\"${f(e.h)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"/>\u003Crect x=\\\"${f(o)}\\\" y=\\\"${f(c)}\\\" width=\\\"${f(l?e.padTop:e.w)}\\\" height=\\\"${f(l?e.h:e.padTop)}\\\" fill=\\\"var(--_a)\\\" stroke=\\\"var(--_b)\\\"${n.shape}/>`+(l&&d?`\u003Cg transform=\\\"rotate(-90 ${f(u)} ${f(h)})\\\">${d}\u003C/g>`:d)+\\\"\u003C/g>\\\"}function y$(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 E$={type:\\\"swimlane\\\",prepare:g$,layout:(e,t,n,r,i)=>GA(e,t,n,r,i?12:void 0),drawGroup:b$,filledBox:y$},HA={type:\\\"swimlane\\\",math:!0,parse:yl.parse,render:(e,t,n)=>bl(e,t,n,E$)};var Ad=class{constructor(){fe(this,\\\"type\\\",\\\"timeline\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"direction\\\",\\\"LR\\\");fe(this,\\\"sections\\\",[]);fe(this,\\\"periods\\\",[]);fe(this,\\\"currentSection\\\",\\\"\\\")}getCommonDb(){return this}setDiagramTitle(t){this.title=t}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}setDirection(t){this.direction=t}addSection(t){this.currentSection=t,this.sections.push(t)}addTask(t,n,r){this.periods.push({text:t,events:r?[r]:[],section:this.currentSection,sectionIndex:this.sections.length-1})}addEvent(t){let n=this.periods[this.periods.length-1];if(!n)throw new Qe(\\\"An event needs a time period before it.\\\",\\\"semantic\\\",{type:\\\"timeline\\\"});n.events.push(t)}};var KA=[\\\"$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 zA(e){let t=e.length,n=[],r=[],i=[],s={types:n,texts:r,starts:i},a=0,o=(c,l)=>{n.push(c),r.push(e.slice(a,l)),i.push(a),a=l};for(;a=Pl(e,a),!(a>=t);){let c=e.charCodeAt(a),l=a+1;if(c===10){for(;e.charCodeAt(l)===10;)l++;o(3,l);continue}if(nr(e,a,\\\"timeline\\\")){for(l=a+8;e.charCodeAt(l)===32||e.charCodeAt(l)===9;)l++;let u=nr(e,l,\\\"lr\\\");if(l>a+8&&(u||nr(e,l,\\\"td\\\"))&&!ot(e.charCodeAt(l+2))){o(u?5:6,l+2);continue}if(!ot(e.charCodeAt(a+8))){o(4,a+8);continue}}if(nr(e,a,\\\"title\\\")){for(l=a+5;e.charCodeAt(l)!==10&&qe(e.charCodeAt(l));)l++;if(l===t||e.charCodeAt(l)===10){a=l;continue}let u=e.charCodeAt(a+5);if(u!==13&&qe(u)){o(7,wa(e,a+6));continue}}if(l=Fl(e,a,s,8),l!==a){a=l;continue}if(nr(e,a,\\\"section\\\")&&qe(e.charCodeAt(a+7))){for(l=a+8;l\u003Ct&&e.charCodeAt(l)!==58&&e.charCodeAt(l)!==10;)l++;if(l>a+8){o(13,l);continue}}if(c!==58){l=a+1;for(let u=e.charCodeAt(l);l\u003Ct&&u!==35&&u!==58&&u!==10;u=e.charCodeAt(++l));o(14,l);continue}if(qe(e.charCodeAt(a+1))){for(l=a+2;l\u003Ct;l++){let u=e.charCodeAt(l);if(u===10||u===58&&qe(e.charCodeAt(l+1)))break}if(l>a+2){o(15,l);continue}}o(2,a+1)}return(i.length===0||i[i.length-1]\u003Ct)&&o(1,t),o(0,t),s}var x$=\\\"'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'period', 'event'\\\";function VA(e,t){let{types:n,texts:r,starts:i}=zA(e),s=(o,c)=>{let l=n[o]===0?\\\"1\\\":KA[n[o]];throw ft(\\\"timeline\\\",e,i[o],`Expecting ${c}, got '${l}'`)},a=n[0];a!==4&&a!==5&&a!==6&&s(0,\\\"'timeline', 'timeline_lr', 'timeline_td'\\\"),a!==4&&t.setDirection(a===5?\\\"LR\\\":\\\"TD\\\");for(let o=1;;o++){let c=r[o];switch(n[o]){case 3:break;case 7:t.getCommonDb().setDiagramTitle(c.substring(6));break;case 8:t.getCommonDb().setAccTitle(r[++o].trim());break;case 10:t.getCommonDb().setAccDescription(r[++o].trim());break;case 12:t.getCommonDb().setAccDescription(c.trim());break;case 13:t.addSection(c.substring(8));break;case 14:t.addTask(c,0,\\\"\\\");break;case 15:t.addEvent(c.substring(2));break;case 1:return;default:s(o,x$)}}}var Sd=12,jA=8,A$=152,S$=216,w$=264,bi=20,go=20,wd=14,Da=8,mp=8,_d=12,_$=' fill=\\\"var(--_bg)\\\"',XA=' fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"';function gp(e,t,n,r,i){return`\u003Crect x=\\\"${f(e)}\\\" y=\\\"${f(t)}\\\" width=\\\"${f(n)}\\\" height=\\\"${f(r)}\\\"${At(i)}/>`}function QA(e,t,n){return e.direction===\\\"TD\\\"?qA(e,t,n,!0):Pt(n,r=>qA(e,t,n,r))}function qA(e,t,n,r){let i=n.fontSize??16,s=Math.round(i*.875),a=n.measurer??ct(n.fontFamily,n.fontFamilyMono),o=n.padding??8,c=t.timeline?.disableMulticolor!==!0,l=e.periods,u=e.sections.length>0,h=e.sections.map((se,re)=>({section:re,periods:[]})),d={section:-1,periods:[]};l.forEach((se,re)=>(h[se.sectionIndex]??d).periods.push(re)),d.periods.length>0&&h.unshift(d);let m=r&&n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth-2*o:1/0,p=go+wd*2+4*Sd,y=Math.min(A$,Math.max(80,Math.round((m-p)*.38))),E=Math.min(w$,Math.max(110,m-p-y)),b=y,S=()=>r?E:b,x=l.map(se=>br(se.text,a,i,b)),I=l.map(se=>se.events.map(re=>br(re,a,s,S()))),L=0;for(let se of x)L=Math.max(L,se.width);if(!r)for(let se of I)for(let re of se)L=Math.max(L,re.width);let O=L>b;if(r)for(let se of I)for(let re of se)O||=re.width>E;O&&(b=Math.min(Math.max(Math.ceil(L),y),m===1/0?S$:y),x=l.map(se=>Wn(se.text,a,i,b)),I=l.map(se=>se.events.map(re=>Wn(re,a,s,S()))));let v=Math.round(i*1.5),G=b+2*Sd,K=S()+2*Sd,C=se=>Math.max(se.height,v)+2*jA,Z=se=>Math.max(se.height,Math.round(s*1.5))+2*jA,oe=(se,re)=>se.section>=0?se.section:u?void 0:c?re:0,H=(se,re)=>{let P=oe(se,re);return P===void 0?\\\"var(--_m)\\\":Et(P)},z=se=>(se===void 0?\\\"\\\":fs(se))||_$,M=!1;for(let se of I)se.length>0&&(M=!0);let T=0;for(let se of h)T+=Math.max(se.periods.length,1);let R=G+bi,_=l.length>0,$=r?G+(M?go+wd*2+K:_?go+_d:0):T>0?T*R-bi+(_?_d+Lt:0):0,g=Wn(e.title,a,i,Math.max($,320),1),N=g.height>0?g.height+16:0,w=Math.max($,g.width),A=o+(w-$)/2,D=o+N,U=(se,re)=>Wn(e.sections[se.section],a,i,re-2*Sd,1),B=(se,re,P,ee,ae,ue)=>gp(P,ee,ae,ue,` fill=\\\"${Et(se.section)}\\\"`)+Ne(re,P+ae/2,ee+ue/2,' font-weight=\\\"var(--_hw)\\\"'+z(se.section)),F=(se,re,P,ee,ae,ue)=>gp(ee,ae,G,ue,` fill=\\\"${P}\\\"`)+Ne(x[se],ee+G/2,ae+ue/2,z(oe(re,se))),W=(se,re,P,ee,ae)=>'\u003Cg class=\\\"pele-node pele-event\\\">'+gp(P,ee,K,ae,` fill=\\\"${re}\\\" fill-opacity=\\\"0.16\\\"`)+Ne(se,P+K/2,ee+ae/2,` font-size=\\\"${s}\\\"`)+\\\"\u003C/g>\\\",j=(se,re,P)=>`\u003Ccircle class=\\\"pele-dot\\\" cx=\\\"${f(se)}\\\" cy=\\\"${f(re)}\\\" r=\\\"4\\\" fill=\\\"${P}\\\" stroke=\\\"var(--_bg)\\\" stroke-width=\\\"2\\\"/>`,Q=se=>se.section>=0?`\u003Cg class=\\\"pele-cluster pele-section\\\" data-id=\\\"${Ue(e.sections[se.section].trim())}\\\">`:\\\"\\\",Y=se=>`\u003Cg class=\\\"pele-node pele-period\\\" data-id=\\\"${Ue(l[se].text.trim())}\\\">`,ne=\\\"\\\",q;if(r){let se=A+G+go,re=se+wd,P=re+wd,ee=D;for(let ae of h){if(ne+=Q(ae),ae.section>=0){let ue=U(ae,$),ce=C(ue);ne+=B(ae,ue,A,ee,$,ce),ee+=ce+mp+4}for(let ue of ae.periods){let ce=H(ae,ue),pe=C(x[ue]),V=I[ue].length>0?Z(I[ue][0]):pe,X=ee+Math.max(pe,V)/2,le=`M${f(A+G)},${f(X)}H${f(se)}`,de=\\\"\\\",Se=X-V/2,_e=X;for(let xe of I[ue]){let Me=Z(xe);_e=Se+Me/2,le+=`M${f(re)},${f(_e)}H${f(P)}`,de+=W(xe,ce,P,Se,Me),Se+=Me+Da}de&&(le+=`M${f(se)},${f(X)}H${f(re)}V${f(_e)}`),ne+=Y(ue)+F(ue,ae,ce,A,X-pe/2,pe)+`\u003Cpath class=\\\"pele-edge\\\" d=\\\"${le}\\\"${XA}/>`+j(se,X,ce)+de+\\\"\u003C/g>\\\",ee=Math.max(X+pe/2,Se-Da)+bi}ae.periods.length===0&&(ee+=bi-mp-4),ae.section>=0&&(ne+=\\\"\u003C/g>\\\")}if(h.length>0&&(ee-=bi),_){let ae=ee+_d+Lt;ne=`\u003Cpath class=\\\"pele-axis\\\" d=\\\"M${f(se)},${f(D)}V${f(ae-Lt+1)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>`+_t(\\\"arrow_point\\\",se,ae,0,1,\\\"var(--_l)\\\")+ne,ee=ae}q=ee+o}else{let se=0,re=h.map(V=>{if(V.section\u003C0)return;let X=U(V,Math.max(V.periods.length,1)*R-bi);return se=Math.max(se,C(X)),X}),P=0;for(let V of x)P=Math.max(P,C(V));let ee=D+(u?se+mp:0),ae=ee+P+(P>0?go:0),ue=ae+go,ce=_?ae+_d:D+se,pe=0;if(h.forEach((V,X)=>{let le=Math.max(V.periods.length,1),de=A+pe*R;ne+=Q(V);let Se=re[X];Se&&(ne+=B(V,Se,de,D,le*R-bi,se)),V.periods.forEach((_e,xe)=>{let Me=H(V,_e),Ce=de+xe*R,ke=Ce+G/2,be=`M${f(ke)},${f(ee+P)}V${f(I[_e].length>0?ue:ae)}`,Ae=\\\"\\\",ie=ue;for(let me of I[_e]){let Te=Z(me);ie>ue&&(be+=`M${f(ke)},${f(ie-Da)}V${f(ie)}`),Ae+=W(me,Me,Ce,ie,Te),ie+=Te+Da}ce=Math.max(ce,ie-Da),ne+=Y(_e)+F(_e,V,Me,Ce,ee,P)+`\u003Cpath class=\\\"pele-edge\\\" d=\\\"${be}\\\"${XA}/>`+j(ke,ae,Me)+Ae+\\\"\u003C/g>\\\"}),V.section>=0&&(ne+=\\\"\u003C/g>\\\"),pe+=le}),_){let V=A+$;ne=`\u003Cpath class=\\\"pele-axis\\\" d=\\\"M${f(A)},${f(ae)}H${f(V-Lt+1)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\"/>`+_t(\\\"arrow_point\\\",V,ae,1,0,\\\"var(--_l)\\\")+ne}q=ce+o}let k=Math.ceil(w+2*o),J=Math.ceil(Math.max(q,o*2)),te=Ne(g,k/2,o+g.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+ne;return{svg:at(\\\"timeline\\\",k,J,i,n,e,te),width:k,height:J,links:[]}}var ZA={type:\\\"timeline\\\",parse(e,t,n){let r=new Ad;return r.title=n,VA(e,r),r},render:QA};var bp=/[─━│┃└┗├┣]/,tS=/[└┗├┣]/,R$=/[─━]/,JA=/^[\\\\s│┃]+$/,T$=/^[\\\\s─━│┃└┗├┣]+$/,M$=/^\\\\s*(title[\\\\t ]|accTitle[\\\\t ]*:|accDescr[\\\\t ]*[:{])/,C$=/^\\\\s*%%/,N$=\\\" \\\";function I$(e){return e.some(t=>bp.test(t))}function k$(e){for(let t of e){let n=tS.exec(t);if(n?.index&&n.index>0)return n.index}return 4}function nS(e,t){return e.replace(/\\\\bline\\\\s+(\\\\d+)\\\\b/gi,(n,r)=>{let i=t.get(parseInt(r,10));return i?`line ${i}`:n})}function yp(e,t){let n=0;for(let r=1;r\u003Ct;r++)n=e.indexOf(`\\r\\n`,n)+1;return n}function eS(e,t,n){let{line:r}=cr(e,yp(e,t+1));throw new Qe(`Line ${r}: ${n}`,\\\"syntax\\\",{type:\\\"treeView\\\",line:r})}function $$(e,t){let n=0;for(let r=0;n\u003Ce.length&&r\u003Ct;n++)r+=e[n]===\\\"\\t\\\"?4:1;return n}function rS(e){let t=new Map,n=new Map;if(!bp.test(e))return{text:e,lineMap:t,columns:n};let r=e.split(`\\r\\n`),i=-1;for(let u=0;u\u003Cr.length;u++)if(r[u].trim()===\\\"treeView-beta\\\"){i=u;break}if(i===-1)return{text:e,lineMap:t,columns:n};let s=u=>u.trim()===\\\"\\\"||C$.test(u)||M$.test(u),a=[];for(let u=i+1;u\u003Cr.length;u++){let h=r[u];s(h)||JA.test(h)||a.push(h.replace(/\\\\t/g,\\\" \\\"))}if(!I$(a))return{text:e,lineMap:t,columns:n};let o=k$(a),c=[],l=(u,h,d)=>{c.push(u),t.set(c.length,h+1),d&&n.set(c.length,d)};for(let u=0;u\u003C=i;u++)l(r[u],u);for(let u=i+1;u\u003Cr.length;u++){let h=r[u];if(s(h)){l(h,u);continue}if(JA.test(h))continue;let d=h.replace(/\\\\t/g,\\\" \\\"),m=tS.exec(d);if(m){let p=Math.round(m.index/o)+1,y=m.index+1;for(;y\u003Cd.length&&R$.test(d[y]);)y++;for(;y\u003Cd.length&&d[y]===\\\" \\\";)y++;let E=d.slice(y).trimEnd();E||eS(e,u,\\\"Empty node — expected a filename or directory name after the box-drawing prefix\\\");let b=N$.repeat(p);l(b+E,u,S=>$$(h,y+Math.max(S-b.length,0)))}else{if(T$.test(d))continue;bp.test(d)?l(h,u):/^\\\\s+/.test(d)?eS(e,u,\\\"Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.\\\"):l(h,u)}}return{text:c.join(`\\r\\n`),lineMap:t,columns:n}}function L$(e,t){if(e.startsWith(\\\"##\\\",t)||e.startsWith(\\\"icon(\\\",t))return!0;if(!e.startsWith(\\\":::\\\",t))return!1;let n=t+3;for(;Xn(e.charCodeAt(n));)n++;let r=e.charCodeAt(n);return r>=65&&r\u003C=90||r>=97&&r\u003C=122||r===95}function O$(e,t){let n=e.charCodeAt(t);if(Xn(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\u003Cr;){let s=e.charCodeAt(i);if(s===10||s===13)break;if(Xn(s)){let a=i+1;for(;Xn(e.charCodeAt(a));)a++;if(L$(e,a))break;i=a}else i++}return i}var sS={name:\\\"BARE_NAME\\\",pattern:/(?!:::|icon\\\\(|##)[^ \\\\t\\\\n\\\\r\\\"'](?:(?![ \\\\t]+:::[ \\\\t]*[A-Za-z_]|[ \\\\t]+icon\\\\(|[ \\\\t]+##)[^\\\\n\\\\r])*/y,match:O$},iS=[{...Jt(\\\"treeView-beta\\\"),longer:[sS]},Zi(),Xt,er(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},sS];function oS(e){let t=e.length;for(;t>0&&Xn(e.charCodeAt(t-1));)t--;return t===e.length?e:e.slice(0,t)}function Ep(e,t){switch(e){case\\\"INDENTATION\\\":return t?.length||0;case\\\"QUOTED_NAME\\\":return t.substring(1,t.length-1);case\\\"BARE_NAME\\\":return oS(t);case\\\"CLASS_ANNOTATION\\\":return t.trim().substring(3).trim();case\\\"ICON_ANNOTATION\\\":{let n=t.trim();return n.substring(5,n.length-1)}case\\\"DESC_ANNOTATION\\\":return t.trim().substring(2).trim();default:return}}function aS(e){let t=new Ut(Yt(e,iS,\\\"treeView\\\"),iS,\\\"treeView\\\"),n={$type:\\\"TreeView\\\",nodes:[]};for(t.expect(0);;)if(t.kind===1)n.accDescr=Vt(t.take());else if(t.kind===2)n.accTitle=zt(t.take());else if(t.kind===3)n.title=Kt(t.take());else break;for(;t.kind!==-1;){let r={$type:\\\"TreeNode\\\",name:\\\"\\\"};if(t.kind===7&&(r.indent=t.take().length),t.kind===8){let i=t.take();r.name=i.substring(1,i.length-1)}else t.kind===12?r.name=oS(t.take()):t.fail(\\\"a name\\\");for(;;)if(t.kind===4)r.classAnnotation=Ep(\\\"CLASS_ANNOTATION\\\",t.take());else if(t.kind===5)r.iconAnnotation=Ep(\\\"ICON_ANNOTATION\\\",t.take());else if(t.kind===6)r.descAnnotation=Ep(\\\"DESC_ANNOTATION\\\",t.take());else break;n.nodes.push(r)}return n}var xp=class{constructor(){fe(this,\\\"count\\\",1);fe(this,\\\"root\\\",{id:0,level:-1,name:\\\"/\\\",nodeType:\\\"directory\\\",children:[]});fe(this,\\\"stack\\\",[this.root])}addNode(t,n,r,i,s,a){let o=this.stack;for(;t\u003C=o[o.length-1].level;)o.pop();let c={id:this.count++,level:t,name:n,nodeType:r,icon:s,cssClass:i,description:a,children:[]};o[o.length-1].children.push(c),o.push(c)}};function D$(e,t){for(let n of e.nodes){let r=typeof n.indent==\\\"number\\\"?n.indent:0,i=n.name,s=i.endsWith(\\\"/\\\");s&&(i=i.slice(0,-1));let a=n.iconAnnotation;t.addNode(r,i,s?\\\"directory\\\":\\\"file\\\",n.classAnnotation||void 0,a!==void 0?a||\\\"none\\\":void 0,n.descAnnotation||void 0)}}function cS(e){let{text:t,lineMap:n,columns:r}=rS(e);try{return aS(t)}catch(i){if(!(i instanceof Qe)||t===e)throw i;let s=n.get(i.line);if(s===void 0)throw i;let a=i.column>0?r.get(i.line)?.(i.column-1)??i.column-1:0,o=cr(e,yp(e,s)+a),c=i.message.includes(`\\r\\n`)?i.message.indexOf(`\\r\\n`):i.message.length,l=i.message.slice(c),u=nS(i.message.slice(0,c),new Map([[i.line,o.line]]))+(i.snippet?l.replace(i.snippet,()=>o.snippet):l);throw new Qe(u,i.code,{type:i.type,line:o.line,column:i.column>0?o.column:0,snippet:i.snippet?o.snippet:\\\"\\\"})}}function lS(e,t){let n=new xp;return D$(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,`\\r\\n`):void 0,root:n.root,count:n.count}}var va=\\\"mermaid-treeview\\\",Rd=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 Ap(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 v$(e,t){let n=Ap(t?.filenameIcons,e);if(n)return n;let r=e.lastIndexOf(\\\".\\\");if(r>0){let i=e.substring(r).toLowerCase();return Ap(t?.extensionIcons,i)??Ap(t?.extensionIcons,i.slice(1))}}function dS(e,t){return e.includes(\\\":\\\")?e:Rd.has(e)||!t?`${va}:${e}`:`${t}:${e}`}function Sp(e,t){if(e.icon!==\\\"none\\\"){if(e.icon)return dS(e.icon,t.defaultIconPack);if(t.showIcons){if(e.nodeType===\\\"file\\\"){let n=v$(e.name,t);if(n===\\\"none\\\")return;if(n)return dS(n,t.defaultIconPack)}return`${va}:${e.nodeType===\\\"directory\\\"?\\\"folder\\\":\\\"file\\\"}`}}}function uS(e){let t=r=>typeof r==\\\"object\\\"&&r!==null&&!Array.isArray(r)?r: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 P$=6,F$=16,B$=7,W$=4,Td=4;function Md(e,t,n,r,i){let s=e.treeView?.[t];return typeof s==\\\"number\\\"&&s>=r&&s\u003C=i?s:n}function U$(e){return{paddingX:Md(e,\\\"paddingX\\\",5,0,100),paddingY:Md(e,\\\"paddingY\\\",2,0,100),rowIndent:Md(e,\\\"rowIndent\\\",15,0,400),lineThickness:Md(e,\\\"lineThickness\\\",1,.25,12)}}function fS(e,t,n){return An(n,r=>G$(e,t,n,r))}function G$(e,t,n,r){let i=n.fontSize??16,s=n.measurer??ct(n.fontFamily,n.fontFamilyMono),a=n.padding??8,o=uS(t),c=Array.isArray(n.monospace)&&n.monospace.includes(\\\"files\\\"),l=c?` font-family=\\\"${fr}\\\"`:\\\"\\\",{paddingX:u,paddingY:h,rowIndent:d,lineThickness:m}=U$(t),p=0,y=e.root.children.map(A=>[A,0]);for(let A=0;r&&A\u003Cy.length;A++){let[D,U]=y[A];p=Math.max(p,U);for(let B of D.children)y.push([B,U+1])}let E=r?Math.min(d+u,Math.max(2,((n.maxWidth??320)-120)/Math.max(1,p))):d+u,b=Math.round(i*1.5)+2*h,S=i,x=Ge(e.title,!1,s,i,r?kt(n):4e3,1),I=x.height>0?x.height+12:0,L=A=>A.some(D=>Sp(D,o)!==void 0),O=[],v=new Map,G=[],K=(A,D)=>{let U=L(A);for(let B=A.length-1;B>=0;B--)G.push([A[B],D,U])};K(e.root.children,0);let C=0,Z=!1,oe=0;for(;G.length>0;){let[A,D,U]=G.pop(),B=D*E,F=bt(A.name),W=B+(U?S+P$:0),j=Math.max(40,(n.maxWidth??320)-2*a-2*Td-W),Q=(A.nodeType===\\\"directory\\\"?1:0)|(c?4:0),Y=r?Qs(F,s,i,j,Q):void 0,ne=r&&A.description?Qs(bt(A.description),s,i,j,2):void 0,q=Y?Y.width:s.width(F,i,Q);W+q>C&&(C=W+q);let k=A.cssClass!==void 0&&A.cssClass.split(/\\\\s+/).includes(\\\"highlight\\\");k&&(Z=!0);let J=r?Math.max(b,(Y?.height??0)+(ne?.height??0)+2*h):b,te=oe+(r?h+Math.max(S,Y?.height??0)/2:J/2),se={node:A,x:B,cy:te,icon:Sp(A,o),text:F,labelX:W,highlighted:k,label:Y,description:ne,top:oe,height:J};oe+=J,O.push(se),v.set(A,se),K(A.children,D+1)}let H=C+F$,z=C;for(let A of O){let D=A.node.description;if(!D)continue;let U=A.description?A.description.width:s.width(bt(D),i,2);z=Math.max(z,(r?A.labelX:H)+U)}z=Math.max(z,x.width);let M=a+(Z?Td:0),T=a+I,R=Math.ceil(z+2*M),_=Math.ceil(T+oe+a),$=\\\"\\\";for(let A of O){let D=A.node.children;if(D.length===0)continue;let U=M+A.x+B$,B=Math.max(U,M+A.x+E-u),F=T+v.get(D[D.length-1]).cy,W=Math.min(W$,B-U),j=`M${f(U)},${f(T+A.top+A.height-2)}V${f(F-W)}`;W>0&&(j+=`Q${f(U)},${f(F)} ${f(U+W)},${f(F)}H${f(B)}`);for(let Q=0;Q\u003CD.length-1&&B>U;Q++)j+=`M${f(U)},${f(T+v.get(D[Q]).cy)}H${f(B)}`;$+=`\u003Cpath d=\\\"${j}\\\"/>`}let g=i*.35,N=\\\"\\\";for(let A of O){let D=A.node,U=T+A.cy,B=D.nodeType===\\\"directory\\\",F=\\\"\\\";if(A.highlighted){let W=M+A.x-Td;F+=`\u003Crect class=\\\"pele-tree-highlight\\\" x=\\\"${f(W)}\\\" y=\\\"${f(T+A.top+1)}\\\" width=\\\"${f(R-M+Td-W)}\\\" height=\\\"${f(A.height-2)}\\\" fill=\\\"var(--_c)\\\" fill-opacity=\\\"0.14\\\"${ht}/>`}if(A.icon!==void 0){let W=A.icon.startsWith(va+\\\":\\\")?A.icon.slice(va.length+1):\\\"\\\",j=Rd.get(W)??Rd.get(B?\\\"folder\\\":\\\"file\\\"),Q=n.icons?.(A.icon)??`\u003Cpath d=\\\"${j}\\\" stroke=\\\"var(--_m)\\\" stroke-width=\\\"1.5\\\"/>`;F+=`\u003Csvg class=\\\"pele-icon\\\" data-icon=\\\"${Ue(A.icon)}\\\" x=\\\"${f(M+A.x)}\\\" y=\\\"${f(U-S/2)}\\\" width=\\\"${f(S)}\\\" height=\\\"${f(S)}\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\">${Q}\u003C/svg>`}A.label?F+=Zr(A.label,M+A.labelX,T+A.top+h,` class=\\\"pele-label\\\"${B?' font-weight=\\\"var(--_hw)\\\"':\\\"\\\"}${l}`):A.text!==\\\"\\\"&&(F+=`\u003Ctext class=\\\"pele-label\\\" x=\\\"${f(M+A.labelX)}\\\" y=\\\"${f(U+g)}\\\"${B?' font-weight=\\\"var(--_hw)\\\"':\\\"\\\"}${l} xml:space=\\\"preserve\\\">${rt(A.text)}\u003C/text>`),A.description?F+=Zr(A.description,M+A.labelX,T+A.top+h+(A.label?.height??0),' class=\\\"pele-tree-description\\\" font-style=\\\"italic\\\" fill=\\\"var(--_m)\\\"'):D.description&&(F+=`\u003Ctext class=\\\"pele-tree-description\\\" x=\\\"${f(M+H)}\\\" y=\\\"${f(U+g)}\\\" font-style=\\\"italic\\\" fill=\\\"var(--_m)\\\" xml:space=\\\"preserve\\\">${rt(bt(D.description))}\u003C/text>`),N+=`\u003Cg class=\\\"pele-node pele-tree-${B?\\\"dir\\\":\\\"file\\\"}${It(D.cssClass??\\\"\\\")}\\\" data-id=\\\"${Ue(D.name)}\\\">${F}\u003C/g>`}let w=Ne(x,R/2,a+x.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+($?`\u003Cg class=\\\"pele-tree-guides\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\" stroke-width=\\\"${f(m)}\\\">${$}\u003C/g>`:\\\"\\\")+N;return{svg:at(\\\"treeView\\\",R,_,i,n,e,w),width:R,height:_,links:[]}}var hS={type:\\\"treeView\\\",parse:(e,t,n)=>lS(cS(e),n),render:fS};function Y$(e){let t=[],n=[];for(let r of e){let i=r.type===\\\"Leaf\\\",s={name:r.name,children:i?void 0:[]};for(s.classSelector=r.classSelector,r.cssCompiledStyles&&(s.cssCompiledStyles=r.cssCompiledStyles),i&&r.value!==void 0&&(s.value=r.value);n.length>0&&n[n.length-1].level>=r.level;)n.pop();n.length===0?t.push(s):n[n.length-1].node.children.push(s),i||n.push({node:s,level:r.level})}return t}function pS(e,t){let n=new Map;for(let i of e.TreemapRows){if(i.$type!==\\\"ClassDefStatement\\\")continue;let s=n.get(i.className);s||n.set(i.className,s=[]);let a=(i.styleText??\\\"\\\").replace(/\\\\\\\\,/g,\\\"§§§\\\").replace(/,/g,\\\";\\\").replace(/§§§/g,\\\",\\\");for(let o of a.split(\\\";\\\"))s.push(o)}let r=[];for(let i of e.TreemapRows){if(i.$type!==\\\"TreemapRow\\\")continue;let s=i.item,a=s.classSelector?n.get(s.classSelector):void 0;r.push({level:i.indent??0,name:s.name,type:s.$type,value:s.$type===\\\"Leaf\\\"?s.value:void 0,classSelector:s.classSelector,cssCompiledStyles:a&&a.length>0?a: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,`\\r\\n`):void 0,roots:Y$(r),classes:n}}var mS=[sn,Xt,er(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}],H$=/classDef\\\\s+([A-Z_a-z]\\\\w+)(?:\\\\s+([^\\\\n\\\\r;]*))?;?/;function gS(e){let t=new Ut(Yt(e,mS,\\\"treemap\\\"),mS,\\\"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 s=t.kind;if(s===0){r.accDescr=Vt(t.take());continue}if(s===1){r.accTitle=zt(t.take());continue}if(s===2){r.title=Kt(t.take());continue}s!==8&&s!==14&&s!==4&&t.fail(\\\"a node, a class definition, or a title\\\");let a=s===8?t.take().length:void 0;if(t.kind===4){let d=H$.exec(t.take()),m={$type:\\\"ClassDefStatement\\\",className:d[1]};d[2]&&(m.styleText=d[2]),a!==void 0&&(m.indent=a),r.TreemapRows.push(m);continue}let o=t.expect(14).slice(1,-1),c=n[t.i]===8?t.i+1:t.i,l;n[c]===6||n[c]===7?(t.i=c+1,t.accept(8),l={$type:\\\"Leaf\\\",name:o,value:parseFloat(t.expect(13).replace(/,/g,\\\"\\\"))}):l={$type:\\\"Section\\\",name:o};let u=i();u!==void 0&&(l.classSelector=u);let h={$type:\\\"TreemapRow\\\",item:l};a!==void 0&&(h.indent=a),r.TreemapRows.push(h)}return r}var bS=/^(?:.?[\u003C>=^])?([-+( ])?(\\\\$)?0?\\\\d*(,)?(?:\\\\.(\\\\d+))?(~)?([a-zA-Z%])?$/;function yS(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 ES(e){let t=bS.exec(e===\\\"$0,0\\\"?\\\"$,\\\":e)??bS.exec(\\\",\\\"),n=t[1]===\\\"+\\\",r=t[3]!==void 0,i=t[4]===void 0?void 0:Math.min(Number(t[4]),20),s=t[6]??\\\"\\\";return a=>{let o=Math.abs(a),c,l=\\\"\\\";if(s===\\\"f\\\"?c=o.toFixed(i??6):s===\\\"%\\\"?(c=(o*100).toFixed(i??6),l=\\\"%\\\"):s===\\\"d\\\"?c=Math.round(o).toFixed(0):s===\\\"e\\\"?c=o.toExponential(i??6):c=String(Number(o.toPrecision(Math.max(1,i??12)))),t[5]&&c.includes(\\\".\\\")&&!c.includes(\\\"e\\\")&&(c=c.replace(/\\\\.?0+$/,\\\"\\\")),r&&!c.includes(\\\"e\\\")){let u=c.indexOf(\\\".\\\");c=u===-1?yS(c):yS(c.slice(0,u))+c.slice(u)}return(a\u003C0?\\\"-\\\":n?\\\"+\\\":\\\"\\\")+(t[2]??\\\"\\\")+c+l}}function xS(e,t,n){let r=e.children===void 0&&Number.isFinite(e.value)&&e.value>0?e.value:0;return{node:e,parent:t,series:n,value:r,children:[],headed:!1,header:0,x:0,y:0,w:0,h:0}}var Cd=(e,t,n)=>e>=t?Math.min(e,n):t;function K$(e,t,n,r,i,s,a){let o=t,c=0;for(;c\u003Ce.length;){let l=i*s/o,u=Math.min(i,s),h=e[c].value*l,d=h,m=Math.max(u*u*d/(h*h),h*h/(u*u*d)),p=c+1;for(;p\u003Ce.length;){let b=e[p].value*l,S=h+b,x=Math.max(u*u*d/(S*S),S*S/(u*u*b));if(x>m)break;m=x,h=S,p++}let y=h/u,E=0;for(let b=c;b\u003Cp;b++){let S=e[b],x=b===p-1?u-E:S.value*l/y,I=i>=s?n:n+E,L=i>=s?r+E:r,O=i>=s?y:x,v=i>=s?x:y,G=Math.round(I+O-a/2)>Math.round(I+a/2)?a/2:0,K=Math.round(L+v-a/2)>Math.round(L+a/2)?a/2:0;S.x=Math.round(I+G),S.y=Math.round(L+K),S.w=Math.round(I+O-G)-S.x,S.h=Math.round(L+v-K)-S.y,E+=x,o-=S.value}i>=s?(n+=y,i-=y):(r+=y,s-=y),c=p}}function AS(e,t,n,r){let i=e.map((d,m)=>xS(d,void 0,m)),s=i.slice();for(let d=0;d\u003Cs.length;d++){let m=s[d];for(let p of m.node.children??[]){let y=xS(p,m,m.series);m.children.push(y),s.push(y)}}for(let d=s.length-1;d>=0;d--){let m=s[d];m.parent&&(m.parent.value+=m.value)}let{gap:a,header:o,short:c,side:l}=r,u=[],h=(d,m,p,y,E)=>{let b=d.filter(x=>x.value>0).sort((x,I)=>I.value-x.value),S=0;for(let x of b)S+=x.value;if(!(b.length===0||!Number.isFinite(S))){y=Math.max(0,y),E=Math.max(0,E),y>0&&E>0&&K$(b,S,m-a/2,p-a/2,y+a,E+a,a);for(let x of b){let I=Cd(x.x,m,m+y),L=Cd(x.y,p,p+E);x.w=Cd(x.x+x.w,I,m+y)-I,x.h=Cd(x.y+x.h,L,p+E)-L,x.x=I,x.y=L,u.push(x)}}};h(i,0,0,t,n);for(let d=0;d\u003Cu.length;d++){let m=u[d];if(m.children.length===0)continue;let p=m.h-o-l>=12?o:c;m.headed=m.w>Math.max(24,2*l)&&m.h-p-l>=8,m.header=m.headed?p:0,m.headed?h(m.children,m.x+l,m.y+p,m.w-2*l,m.h-p-l):h(m.children,m.x,m.y,m.w,m.h)}return u}var wp=28,z$=18,_p=6,yi=1.25,SS=e=>rt(bt(e).trim()).trim();function V$(e){let t=0,n=e.slice();for(;n.length>0;){let r=n.pop();r.children!==void 0?n.push(...r.children):Number.isFinite(r.value)&&r.value>0&&t++}return t}function wS(e,t){let n=Math.min(t.w,t.h)/4;return n\u003C4?At(e).replace(\\\"rx:var(--_r)\\\",`rx:min(var(--_r),${f(n)}px)`):At(e)}function Nd(e,t,n,r,i){let s=e.treemap?.[t];return typeof s==\\\"number\\\"&&s>=r?Math.min(s,i):n}function _S(e,t,n){let r=n.fontSize??16,i=Math.round(r*.875),s=Math.round(r*.75),a=Math.round(r*.5625),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=t.treemap??{},l=n.padding??Nd(t,\\\"diagramPadding\\\",8,0,2e3),u=Math.round(gs(n,Nd(t,\\\"nodeWidth\\\",64,1,400)*10,200,2*l)),h=Math.round(Nd(t,\\\"nodeHeight\\\",40,1,400)*10),d=c.showValues!==!1,m=ES(typeof c.valueFormat==\\\"string\\\"?c.valueFormat:\\\",\\\"),p=Math.min(1,Math.max(0,Math.log10(u*h/Math.max(1,V$(e.roots))/800))),y=AS(e.roots,u,h,{gap:Nd(t,\\\"padding\\\",Math.round(2+2*p),0,200),header:wp,short:z$,side:Math.round(3+3*p)}),E=Ge(e.title,!1,o,r,kt(n),1),b=E.height>0?E.height+8:0,S=l+Math.max(0,(E.width-u)/2),x=l+b,I=\\\"\\\",L=\\\"\\\";for(let K of y){let C=K.node,Z=Ct(C.cssCompiledStyles??[]),oe=Et(K.series),H=S+K.x,z=x+K.y,M=bt(C.name).trim(),T=d?m(K.value):\\\"\\\",R=`data-id=\\\"${Ue(C.name)}\\\">`,_=SS(C.name),$=_===\\\"\\\"?[]:[_];for(let Y=K.parent;Y!==void 0&&!Y.headed;Y=Y.parent){let ne=SS(Y.node.name);ne!==\\\"\\\"&&$.unshift(ne)}let g=$.join(\\\" › \\\"),N=Y=>g===\\\"\\\"||Y===M&&g===_?\\\"\\\":`\u003Ctitle>${g}\u003C/title>`,w=`\u003Crect x=\\\"${f(H)}\\\" y=\\\"${f(z)}\\\" width=\\\"${f(K.w)}\\\" height=\\\"${f(K.h)}\\\" fill=\\\"${oe}\\\"`,A=Z.fontSize,D=(Z.bold?1:0)|(Z.italic?2:0),U=vn(Z.shape)?vt(Z):fs(K.series);if(C.children!==void 0){let Y=\\\"\\\",ne;if(K.headed){let J=K.header\u003Cwp,te=A??(J?s:i),se=A??s,re=K.w-2*_p-4,P=T?o.width(T,se,D):0,ee=!J&&P>0&&re-P-12>=3*te,ae=te*yi\u003CK.header?Ma(M,ee?re-P-12:re,te,te,o,D|1):void 0,ue=z+K.header/2+1;ne=ae?.text,ae&&(Y+=`\u003Ctext x=\\\"${f(H+_p+2)}\\\" y=\\\"${f(ue+te*.35)}\\\" font-weight=\\\"var(--_hw)\\\"${J?` font-size=\\\"${te}\\\"`:\\\"\\\"}${U}${Z.text}>${rt(ae.text)}\u003C/text>`),ee&&se*yi\u003C=wp&&(Y+=`\u003Ctext class=\\\"pele-value\\\" x=\\\"${f(H+K.w-_p-2)}\\\" y=\\\"${f(ue+se*.35)}\\\" font-size=\\\"${s}\\\" text-anchor=\\\"end\\\"${U||' fill=\\\"var(--_m)\\\"'}${Z.text}>${rt(T)}\u003C/text>`)}let q=/[\\\";]fill:/.test(Z.shape)?\\\"\\\":' fill-opacity=\\\"0.12\\\"',k=K.headed?`${w}${wS(`${q} stroke=\\\"${oe}\\\"${Z.shape}`,K)}/>`:`\u003Crect x=\\\"${f(H)}\\\" y=\\\"${f(z)}\\\" width=\\\"${f(K.w)}\\\" height=\\\"${f(K.h)}\\\" fill=\\\"none\\\"/>`;I+=`\u003Cg class=\\\"pele-node pele-section${It(C.classSelector??\\\"\\\")}\\\" ${R}${N(ne)}${k}${Y}\u003C/g>`;continue}let B=\\\"\\\",F=K.w-8,W=A??a,j=A===void 0?Math.min(r,Math.floor((K.h-4)/yi)):A*yi\u003C=K.h-4?A:0,Q=j>=W?Ma(M,F,j,W,o,D):void 0;if(Q){let Y=f(H+K.w/2),ne=z+K.h/2,q=A??Math.max(a,Math.round(Q.size*.8)),k=(Q.size+q)*yi;if(T&&k\u003C=K.h-4&&o.width(T,q,D)\u003C=F){let J=ne-k/2+Q.size*yi/2,te=ne+k/2-q*yi/2;B=`\u003Ctext x=\\\"${Y}\\\" y=\\\"${f(J+Q.size*.35)}\\\" font-size=\\\"${f(Q.size)}\\\"${U}${Z.text}>${rt(Q.text)}\u003C/text>\u003Ctext class=\\\"pele-value\\\" x=\\\"${Y}\\\" y=\\\"${f(te+q*.35)}\\\" font-size=\\\"${f(q)}\\\"${U}${Z.text}>${rt(T)}\u003C/text>`}else B=`\u003Ctext x=\\\"${Y}\\\" y=\\\"${f(ne+Q.size*.35)}\\\" font-size=\\\"${f(Q.size)}\\\"${U}${Z.text}>${rt(Q.text)}\u003C/text>`}L+=`\u003Cg class=\\\"pele-node pele-leaf${It(C.classSelector??\\\"\\\")}\\\" ${R}${N(Q?.text)}${w}${wS(Z.shape,K)}/>${B}\u003C/g>`}let O=Math.ceil(Math.max(u,E.width)+2*l),v=Math.ceil(h+b+2*l),G=Ne(E,O/2,l+E.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(I?`\u003Cg class=\\\"pele-sections\\\" font-size=\\\"${i}\\\">${I}\u003C/g>`:\\\"\\\")+(L?`\u003Cg class=\\\"pele-leaves\\\" text-anchor=\\\"middle\\\" fill=\\\"var(--_bg)\\\">${L}\u003C/g>`:\\\"\\\");return{svg:at(\\\"treemap\\\",O,v,r,n,e,G),width:O,height:v,links:[]}}var RS={type:\\\"treemap\\\",parse:(e,t,n)=>pS(gS(e),n),render:_S};var Rp=\\\"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(\\\" \\\");var Pa=1,CS=2,vs=new Uint8Array(128);for(let e=48;e\u003C=57;e++)vs[e]=Pa;for(let e=65;e\u003C=90;e++)vs[e]=vs[e+32]=Pa;vs[95]=Pa;for(let e of\\\"!#$&*+/=?^|~\\\")vs[e.charCodeAt(0)]=CS;var TS=[0,12,5,14,3,9,2,2,2,2,2,4,3,4,8,5,5,7,6,4,5];function Id(e){return e\u003C128&&(vs[e]&Pa)!==0}function Tp(e,t,n){for(let r=0;r\u003Cn.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function j$(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:Tp(e,t,\\\"extend\\\")?18:0;case 69:return Tp(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 Tp(e,t,\\\"include\\\")?17:0;case 116:return e.startsWith(\\\"true\\\",t)?19:0;case 117:return e.startsWith(\\\"usecase-beta\\\",t)?1:0;default:return 0}}function Ei(e,t){[e,t]=ls(e,t);let n=1,r=0;for(let i=0;i\u003Ct;i++){let s=e.charCodeAt(i);s!==10&&s!==13||(s===13&&i+1\u003Ct&&e.charCodeAt(i+1)===10&&i++,n++,r=i+1)}return[n,t-r+1]}function kd(e,t,n){let[r,i]=Ei(e,t);return`line ${r}, column ${i} [${ls(e,t)[1]},${ls(e,n)[1]})`}function NS(e,t,n){for(let r=t+1;r\u003Ce.length;r++){let i=e.charCodeAt(r);if(i===n)return r+1;if(i===10||i===13)return-1}return-1}function X$(e,t){let n=e.charCodeAt(t);return n!==34&&n!==39?!0:n===34&&e.charCodeAt(t+1)===96||NS(e,t,n)!==-1}function MS(e,t,n){let[r,i]=Ei(e,t),[s,a]=[ls(e,t)[1],ls(e,t+n)[1]];return new Qe(`Error lexing usecase diagram: unexpected character: ->${e.charAt(t)}\u003C- at offset: ${s}, skipped ${a-s} characters. at line ${r}, column ${i} [${s},${a})`,\\\"syntax\\\",{type:\\\"usecase\\\",line:r,column:i})}function IS(e){let t=[],n=[],r=[],i=e.length,s=0,a=!0,o=!1;for(;s\u003Ci;){let c=e.charCodeAt(s);if(c===32||c===9){s++;continue}let l,u=s+1,h=!1;if(c\u003C128&&(vs[c]&Pa)!==0){if(l=0,c===97&&a&&e.startsWith(\\\"acc\\\",s)){let d=e.startsWith(\\\"Descr\\\",s+3);if(d||e.startsWith(\\\"Title\\\",s+3)){let m=s+8;for(;Xn(e.charCodeAt(m));)m++;let p=e.charCodeAt(m);if(p===58)for(l=d?42:41,u=m+1;u\u003Ci&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;else if(p===123&&d&&!o){let y=e.indexOf(\\\"}\\\",m+1);y===-1?o=!0:(l=40,u=y+1)}}}else if(c===106&&e.startsWith(\\\"json\\\",s)&&Xn(e.charCodeAt(s+4))){let d=s+5;for(;Xn(e.charCodeAt(d));)d++;let m=d;for(;Id(e.charCodeAt(d));)d++;if(d>m){for(;Xn(e.charCodeAt(d));)d++;if(e.charCodeAt(d)===64){for(d++;Xn(e.charCodeAt(d));)d++;if(e.charCodeAt(d)===123){t.push(43),n.push(s),r.push(d),s=d;let p=0,y=!1,E=!1,b=d;for(;b\u003Ci;b++){let S=e.charCodeAt(b);if(y)E?E=!1:S===92?E=!0:S===34&&(y=!1);else if(S===34)y=!0;else if(S===123)p++;else if(S===125&&--p===0)break}t.push(b\u003Ci?44:45),n.push(d),s=b\u003Ci?b+1:i,r.push(s),a=!1;continue}}}}if(l===0){for(;u\u003Ci&&Id(e.charCodeAt(u));)u++;let d=j$(e,s,c);if(d!==0)d===1||u-s===TS[d]?(l=d,u=s+TS[d]):l=21;else if((c===111||c===120)&&e.charCodeAt(s+1)===45&&e.charCodeAt(s+2)===45)l=c===111?56:58,u=s+3;else if(xt(c)){let m=s+1;for(;xt(e.charCodeAt(m));)m++;if(e.charCodeAt(m)===46&&xt(e.charCodeAt(m+1))){for(l=22,u=m+2;xt(e.charCodeAt(u));)u++;for(;Vr(e.charCodeAt(u));)u++}else l=21}else for(l=21;e.charCodeAt(u)===45&&Id(e.charCodeAt(u+1));)for(l=27,u+=2;Id(e.charCodeAt(u));)u++}}else if(c===10)l=39,h=!0;else if(c===13)l=39,h=!0,e.charCodeAt(u)===10&&u++;else if(c===34||c===39){if(c===34&&e.charCodeAt(s+1)===96){let d=e.indexOf('`\\\"',s+2);l=d===-1?37:36,u=d===-1?i:d+2}else if(l=35,u=NS(e,s,c),u===-1){let d=s+1;for(;d\u003Ci&&!X$(e,d);)d++;throw MS(e,s,d-s)}}else if(c===37)if(a&&e.charCodeAt(u)===37)for(l=38;u\u003Ci&&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 d=e.charCodeAt(u),m=u-s===2;m&&d===124&&e.charCodeAt(u+1)===62?(l=46,u+=2):d===62?(l=53,u++):m&&(d===111||d===120)?(l=d===111?55:57,u++):l=59}else if(c===46){let d=e.charCodeAt(u);if(d===46&&e.charCodeAt(u+1)===62)l=47,u+=2;else if(xt(d)){for(l=22;xt(e.charCodeAt(u));)u++;for(;Vr(e.charCodeAt(u));)u++}else l=30}else if(c===60)if(e.charCodeAt(u)===60){if(t.push(48),n.push(s),r.push(s+2),a=!1,s+=2,s>=i)break;if(e.charCodeAt(s)===62&&e.charCodeAt(s+1)===62)l=49,u=s+2;else{let d=s,m=!1;for(;d\u003Ci;d++){let p=e.charCodeAt(d);if(p===10||p===13)break;if(p===62&&e.charCodeAt(d+1)===62){m=!0;break}}if(m&&e.slice(s,d).trim()!==\\\"\\\")t.push(50),n.push(s),r.push(d),l=49,s=d,u=d+2;else{for(;d\u003Ci&&e.charCodeAt(d)!==10&&e.charCodeAt(d)!==13;)d++;if(d===s){for(;d\u003Ci&&(e.charCodeAt(d)===10||e.charCodeAt(d)===13);)d++;throw MS(e,s,d-s)}l=51,u=d}}}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(;Za(e.charCodeAt(u));)u++;l=u>s+1?26:32}else if(c===92)e.charCodeAt(u)===44?(l=28,u++):l=33;else if(c\u003C127&&c>32)l=(vs[c]&CS)!==0?32:33;else for(l=34;u\u003Ci;){let d=e.charCodeAt(u);if(d>=32&&d\u003C127||d===9||d===10||d===13)break;u++}t.push(l),n.push(s),r.push(u),s=u,a=h}for(let c=0;c\u003C3;c++)t.push(0),n.push(i),r.push(i);return{types:t,starts:n,ends:r}}function kS(){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 $S(){return{elements:[],boundaries:[],jsons:[],relationships:[],notes:[],metadata:[],classes:[],styles:[],classDefs:[],direction:void 0,accTitle:\\\"\\\",accDescription:\\\"\\\"}}function Mp(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 q$(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 LS(e,t,n,r,i){let s=kS(),{actors:a,useCases:o,systemBoundaries:c}=s,l=new Map,u=new Map,h=new Map,d=new Map,m=new Map,p=g=>kd(e,g[0],g[1]),y=(g,N)=>{let[w,A]=Ei(e,N[0]);return new Qe(g,\\\"semantic\\\",{type:\\\"usecase\\\",line:w,column:A})},E=(g,N)=>{throw y(`${g} at ${p(N)}`,N)},b=(g,N,w,A,D)=>{let U=B=>B===void 0?\\\"\\\":` (label \\\"${B}\\\")`;throw y(`${g} at ${p(N)}${U(A)}; previous declaration at ${p(w)}${U(D)}`,N)},S=(g,N,w)=>E(`Metadata property '${w.key}' is invalid for ${N} '${g}'`,w.keySpan),x=(g,N)=>{let w=m.get(g);(w===void 0||N\u003Cw)&&m.set(g,N)},I=g=>[...g].sort((N,w)=>(m.get(N.id)??0)-(m.get(w.id)??0)),L=(g,N)=>{l.set(g.id,{kind:N,span:g.span,generated:g.generated,label:g.label.text})},O=(g,N)=>{let w=l.get(g.id);if(!w)return;let A=g.generated?g.label.text:void 0,D=w.generated?w.label:void 0;w.kind!==N&&b(`ID '${g.id}' is declared as both ${w.kind} and ${N}`,g.span,w.span,A,D),(w.generated||g.generated)&&b(`Generated ID '${g.id}' collides with another declaration`,g.span,w.span,A,D)},v=(g,N,w)=>{let A=l.get(g);A&&b(`ID '${g}' is declared more than once (${A.kind} and ${N})`,w,A.span,void 0,A.generated?A.label:void 0),l.set(g,{kind:N,span:w,generated:!1})},G=(g,N,w)=>{let{key:A,value:D}=N,U=B=>{!w&&B!==void 0&&B!==D&&b(`Actor '${g.id}' has conflicting ${A} metadata`,N.keySpan,g.span)};A===\\\"type\\\"&&(D===\\\"normal\\\"||D===\\\"hollow\\\"||D===\\\"awesome\\\")?(U(g.actorType),g.actorType=D):A===\\\"icon\\\"&&typeof D==\\\"string\\\"?(U(g.icon),g.icon=D):A===\\\"business\\\"&&typeof D==\\\"boolean\\\"?(U(g.business),g.business=D):S(g.id,\\\"actor\\\",N)},K=(g,N,w)=>{for(let A of N??[])g.kind===\\\"actor\\\"?G(g,A,w):A.key===\\\"business\\\"&&typeof A.value==\\\"boolean\\\"?(!w&&g.business!==void 0&&g.business!==A.value&&b(`Use case '${g.id}' has conflicting business metadata`,A.keySpan,g.span),g.business=A.value):S(g.id,\\\"usecase\\\",A)},C=g=>{let N;if(g.kind===\\\"actor\\\"){o.delete(g.id);let w={id:g.id,label:g.label.text,labelType:g.label.type,business:g.business??!1,classes:[...g.classes],type:g.icon?\\\"icon\\\":g.actorType??\\\"normal\\\",styles:a.get(g.id)?.styles??[]};g.icon&&(w.icon=g.icon),a.set(g.id,w),N=w}else a.delete(g.id),N={id:g.id,label:g.label.text,labelType:g.label.type,business:g.business??!1,classes:[...g.classes],shape:g.shape??\\\"ellipse\\\",styles:o.get(g.id)?.styles??[]},o.set(g.id,N);g.stereotype&&(N.stereotype=g.stereotype),g.parent?.id&&(N.parentId=g.parent.id)},Z=g=>{O(g,g.kind);let N=g.parent?.id?g.parent:void 0,w=u.get(g.id);if(!w){let A={kind:g.kind,id:g.id,label:g.label,span:g.span,generated:g.generated,classes:[...g.classes],parent:N,shape:g.shape,stereotype:g.stereotype,stereotypeSpan:g.stereotype?g.span:void 0};K(A,g.metadata,!1),u.set(g.id,A),L(g,g.kind);return}(w.label.text!==g.label.text||w.label.type!==g.label.type)&&b(`ID '${g.id}' has conflicting labels`,g.span,w.span),g.shape&&w.shape&&g.shape!==w.shape&&b(`Use case '${g.id}' has conflicting shapes`,g.span,w.span),N&&w.parent?.id&&N.id!==w.parent.id&&b(`Element '${g.id}' belongs to more than one system boundary`,N.span,w.parent.span),g.stereotype&&w.stereotype&&g.stereotype!==w.stereotype&&b(`Element '${g.id}' has conflicting stereotypes`,g.span,w.stereotypeSpan??w.span),w.shape??=g.shape,w.parent??=g.parent,w.stereotype??=g.stereotype,w.stereotypeSpan??=g.stereotype?g.span:void 0,Mp(w.classes,g.classes),K(w,g.metadata,!1)},oe=g=>{O(g,\\\"boundary\\\");let N=h.get(g.id);if(N){(N.label.text!==g.label.text||N.label.type!==g.label.type)&&b(`Boundary '${g.id}' has conflicting titles`,g.span,N.span),Mp(N.classes,g.classes);return}h.set(g.id,{...g,classes:[...g.classes],members:[]}),L(g,\\\"boundary\\\")},H=g=>{g.classed&&!g.declares&&E(`Relationship endpoint '${g.id}' uses ::: without declaring the node`,g.span);let N=l.get(g.id);return N?N.kind:(u.set(g.id,{...g,kind:\\\"usecase\\\",shape:\\\"ellipse\\\",classes:[]}),L(g,\\\"usecase\\\"),x(g.id,g.span[0]),\\\"usecase\\\")},z=(g,N)=>{let w=l.get(g)?.kind;return(w===\\\"actor\\\"?a.get(g):w===\\\"usecase\\\"?o.get(g):w===\\\"boundary\\\"?c.get(g):w===\\\"json\\\"?s.jsonNodes.get(g):d.get(g))??E(`Class/style target '${g}' is unresolved or anonymous`,N)},M=[];for(let{source:g,target:N}of t.relationships)x(g.id,g.span[0]),x(N.id,N.span[0]);for(let g of t.elements)x(g.id,g.span[0]),M.push({offset:g.span[0],run:()=>Z(g)});for(let g of t.boundaries)x(g.id,g.span[0]),M.push({offset:g.span[0],run:()=>oe(g)});for(let g of t.jsons)x(g.id,g.span[0]),M.push({offset:g.span[0],run:()=>v(g.id,\\\"json\\\",g.span)});for(let{id:g,idSpan:N}of t.relationships)g&&N&&M.push({offset:N[0],run:()=>v(g,\\\"edge\\\",N)});M.sort((g,N)=>g.offset-N.offset);for(let g of M)g.run();for(let g of I(u.values()))C(g);for(let g of I(h.values()))c.set(g.id,{id:g.id,label:g.label.text,labelType:g.label.type,type:\\\"rect\\\",members:[],classes:[],styles:[]});for(let g of I(t.jsons))s.jsonNodes.set(g.id,{id:g.id,value:g.value,propertyOrder:g.propertyOrder,classes:[...g.classes],styles:[]});let T=0;for(let g of t.relationships){let{source:N,target:w,type:A}=g,D=H(N),U=H(w),B=j=>j===\\\"actor\\\"||j===\\\"usecase\\\"||j===\\\"json\\\";B(D)||b(`Relationship source '${N.id}' cannot be ${D}`,N.span,l.get(N.id).span),B(U)||b(`Relationship target '${w.id}' cannot be ${U}`,w.span,l.get(w.id).span),(A===\\\"include\\\"||A===\\\"extend\\\")&&(D!==\\\"usecase\\\"||U!==\\\"usecase\\\")&&E(`${A} relationship requires use-case endpoints`,g.span),A===\\\"generalization\\\"&&(D===\\\"json\\\"||D!==U)&&E(\\\"Generalization requires actor-to-actor or use-case-to-use-case endpoints\\\",g.span),A===\\\"association\\\"&&(D===\\\"json\\\"||U===\\\"json\\\")&&g.arrowType>2&&E(`JSON relationship '${N.id}' to '${w.id}' permits only point, reversed-point, or markerless solid association`,g.span);let F=g.id??`edge-${T++}`,W={id:F,explicitId:!!g.id,source:N.id,target:w.id,type:A,arrowType:g.arrowType,minlen:g.minlen,classes:[],styles:[],animate:!1};g.label&&(W.label=g.label.text,W.labelType=g.label.type),s.relationships.push(W),d.set(F,W)}let R=new Map(a),_=new Map(o);a.clear(),o.clear();for(let g of I(u.values())){let N=R.get(g.id),w=_.get(g.id);N?a.set(g.id,N):w?o.set(g.id,w):C(g)}for(let{target:g,span:N,properties:w,statement:A}of t.metadata){let D=l.get(g);if(!D){let W=q$(w);return E(`Metadata target '${g}' is unresolved${W?` (metadata implies ${W})`:\\\"\\\"}`,N)}let U=D.kind;U===\\\"actor\\\"||U===\\\"usecase\\\"?K(u.get(g),w,!0):U===\\\"edge\\\"&&(A.kind=\\\"edgeMetadata\\\",A.edges=[{id:g,span:A.span,idSpan:N,metadata:A.metadata}],delete A.nodes);let B=h.get(g),F=d.get(g);for(let W of U===\\\"actor\\\"||U===\\\"usecase\\\"?[]:w){let{key:j,value:Q}=W;U===\\\"boundary\\\"&&B&&j===\\\"type\\\"&&(Q===\\\"rect\\\"||Q===\\\"package\\\")?B.type=Q:U===\\\"edge\\\"&&F&&j===\\\"animate\\\"&&typeof Q==\\\"boolean\\\"?F.animate=Q:U===\\\"edge\\\"&&F&&j===\\\"animation\\\"&&(Q===\\\"fast\\\"||Q===\\\"slow\\\")?(F.animation=Q,F.animate=!0):S(g,U,W)}}for(let g of s.relationships)g.animation&&(g.animate=!0);for(let g of u.values())g.kind===\\\"actor\\\"?(g.icon&&g.actorType&&g.actorType!==\\\"normal\\\"&&E(`Actor '${g.id}' cannot combine icon with type '${g.actorType}'`,g.span),g.business&&(g.icon||g.actorType===\\\"awesome\\\")&&E(`Business actor '${g.id}' must use normal or hollow geometry`,g.span)):g.shape===\\\"rect\\\"&&g.business&&E(`Rectangular use case '${g.id}' cannot be a business use case`,g.span),C(g);for(let g of[...t.elements].sort((N,w)=>N.span[0]-w.span[0])){if(!g.parent?.id)continue;let N=h.get(g.parent.id).members;N.includes(g.id)||N.push(g.id)}for(let g of h.values()){let N=c.get(g.id);N.type=g.type??\\\"rect\\\",N.members=g.members,N.classes=[...g.classes]}let $=0;for(let g of t.notes){let N=l.get(g.target);if(!N)return E(`Note target '${g.target}' is unresolved`,g.span);N.kind!==\\\"actor\\\"&&N.kind!==\\\"usecase\\\"&&b(`Note target '${g.target}' must be an actor or use case, not ${N.kind}`,g.span,N.span);let w=`note-${$++}`;s.notes.set(w,{id:w,target:g.target,label:g.label.text,labelType:g.label.type})}for(let g of t.classDefs)for(let N of g.ids)s.classDefs.set(N,{id:N,styles:[...g.styles]});for(let g of t.classes)for(let N of g.targets)Mp(z(N.id,N.span).classes,g.classes);for(let g of t.styles)z(g.target,g.span).styles.push(...g.styles);return s.direction=t.direction??s.direction,s.title=i,s.accTitle=t.accTitle,s.accDescription=t.accDescription,s.accDescr=t.accDescription.replace(/\\\\n\\\\s+/g,`\\r\\n`),s.source=e,s.headerSpan=n,s.statements=r,s}var Rn=class extends Error{constructor(n){super(\\\"Invalid JSON token\\\");fe(this,\\\"offset\\\",n)}};function OS(e){let t=new Map,n=[],r=[],i=e.length,s=0,a=\\\"\\\",o=0,c=()=>{for(;s\u003Ci;){let d=e.charCodeAt(s);if(d!==32&&d!==9&&d!==10&&d!==13)return;s++}},l=d=>{s++;let m=\\\"\\\";for(;s\u003Ci;){let p=s,y=e[s++];if(y==='\\\"')return m;if(y.charCodeAt(0)\u003C32)throw new Rn(p);if(y!==\\\"\\\\\\\\\\\"){d&&(m+=y);continue}let E=s,b=e[s++],S;if(b==='\\\"'||b===\\\"\\\\\\\\\\\"||b===\\\"/\\\")S=b;else if(b===\\\"b\\\")S=\\\"\\\\b\\\";else if(b===\\\"f\\\")S=\\\"\\\\f\\\";else if(b===\\\"n\\\")S=`\\r\\n`;else if(b===\\\"r\\\")S=\\\"\\\\r\\\";else if(b===\\\"t\\\")S=\\\"\\t\\\";else if(b===\\\"u\\\"){let x=e.slice(s,s+4);if(!/^[\\\\dA-Fa-f]{4}$/.test(x))throw new Rn(s);S=String.fromCharCode(parseInt(x,16)),s+=4}else throw new Rn(E);d&&(m+=S)}throw new Rn(s)},u=d=>{for(let m=0;m\u003Cd.length;m++)if(e[s+m]!==d[m])throw new Rn(s+m);s+=d.length},h=()=>{if(e.charCodeAt(s)===45&&s++,e.charCodeAt(s)===48)s++;else if(xt(e.charCodeAt(s)))for(;xt(e.charCodeAt(s));)s++;else throw new Rn(s);if(e.charCodeAt(s)===46){if(s++,!xt(e.charCodeAt(s)))throw new Rn(s);for(;xt(e.charCodeAt(s));)s++}if((e.charCodeAt(s)|32)===101){if(s++,(e.charCodeAt(s)===43||e.charCodeAt(s)===45)&&s++,!xt(e.charCodeAt(s)))throw new Rn(s);for(;xt(e.charCodeAt(s));)s++}};for(c();;)if(o===0){c();let d=e.charCodeAt(s);if(o=2,d===123){s++;let m=[];t.set(a,m),n.push(a),c(),e.charCodeAt(s)===125?s++:(r.push({object:!0,pointer:a,keys:m,ranges:new Map,key:\\\"\\\",from:0,index:0}),o=1)}else if(d===91)s++,c(),e.charCodeAt(s)===93?s++:(r.push({object:!1,pointer:a,keys:[],ranges:new Map,key:\\\"\\\",from:0,index:0}),a+=\\\"/0\\\",o=0);else if(d===34)l(!1);else if(d===116)u(\\\"true\\\");else if(d===102)u(\\\"false\\\");else if(d===110)u(\\\"null\\\");else if(d===45||xt(d))h();else throw new Rn(s)}else if(o===1){let d=r[r.length-1];if(e.charCodeAt(s)!==34)throw new Rn(s);let m=l(!0),p=d.ranges.get(m);if(p===void 0)d.keys.push(m);else for(let y=p[0];y\u003Cp[1];y++)t.delete(n[y]);if(d.key=m,d.from=n.length,c(),e.charCodeAt(s)!==58)throw new Rn(s);s++,a=`${d.pointer}/${m.replaceAll(\\\"~\\\",\\\"~0\\\").replaceAll(\\\"/\\\",\\\"~1\\\")}`,o=0}else{let d=r[r.length-1];if(d===void 0)break;d.object?d.ranges.set(d.key,[d.from,n.length]):d.index++,c();let m=e.charCodeAt(s);if(m===(d.object?125:93))s++,r.pop();else{if(m!==44)throw new Rn(s);s++,c(),a=`${d.pointer}/${d.index}`,o=d.object?1:0}}if(c(),s!==i)throw new Rn(s);return t}function Cp(e,t,n,r){let i=Math.min(Math.max(t,0),e.length);for(let s=0;s\u003Ci;s++){let a=e.charCodeAt(s);a===13?(n++,r=1):a===10?(s===0||e.charCodeAt(s-1)!==13)&&(n++,r=1):r++}return[n,r]}function Q$(e,t,n,r){let i=/\\\\bposition (\\\\d+)\\\\b/.exec(e);if(i)return Cp(t,parseInt(i[1],10),n,r);let s=/\\\\bline (\\\\d+) column (\\\\d+)\\\\b/.exec(e);if(s){let a=parseInt(s[1],10),o=parseInt(s[2],10);return[n+a-1,a===1?r+o-1:o]}if(/unexpected end|end of json input/i.test(e))return Cp(t,t.length,n,r)}function DS(e,t,n){return new Qe(`${e} (line ${t}, column ${n})`,\\\"syntax\\\",{type:\\\"usecase\\\",line:t,column:n})}function vS(e,t){let n;try{n=JSON.parse(e)}catch(r){let i=r instanceof Error?r.message:String(r),s=xo(e);if(s!==e)try{JSON.parse(s)}catch(l){l instanceof Error&&(i=l.message)}let[a,o]=t(),c=Q$(i,s,a,o);if(!c){let l=0;try{OS(s)}catch(u){u instanceof Rn&&(l=u.offset)}c=Cp(s,l,a,o)}throw DS(`Invalid JSON: ${i}`,c[0],c[1])}if(typeof n!=\\\"object\\\"||n===null||Array.isArray(n)){let[r,i]=t();throw DS(\\\"JSON value must have an object root\\\",r,i)}return{value:n,propertyOrder:OS(e)}}var HS=1,Lp=2,kp=4,KS=8,zS=16,VS=32,jS=64,vd=\\\"DEPENDENCY_ARROW|GENERALIZATION|FORWARD_SOLID|BACKWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|BACKWARD_CIRCLE|FORWARD_CROSS|BACKWARD_CROSS\\\",Pd=\\\"IDENTIFIER|PLAIN_STRING|MARKDOWN_STRING\\\",Z$=\\\"PLAIN_STRING|MARKDOWN_STRING|LABEL_TEXT\\\",XS=\\\"ACC_TITLE_LINE|ACC_DESCR_LINE|ACC_DESCR_BLOCK|DIRECTION|ACTOR|SYSTEM_BOUNDARY|NOTE|JSON_DECLARATION_START|CLASS_DEF|CLASS|STYLE\\\",qS=\\\"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 Si(e,t){for(let n of e.split(\\\"|\\\"))if(n===\\\"WORD\\\")for(let r=1;r\u003C=21;r++)Ar[r]|=t;else Ar[Rp.indexOf(n)]|=t}Si(`NEWLINE|COMMENT|${XS}|${Pd}`,HS);Si(`IDENTIFIER|${vd}`,Lp);Si(qS,kp);Si(`STEREOTYPE_START|CLASS_SEPARATOR|IDENTIFIER|${vd}|NEWLINE|EOF`,KS);Si(`NEWLINE|COMMENT|ACTOR|${Pd}`,zS);Si(\\\"FORWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|FORWARD_CROSS\\\",VS);Si(\\\"NEWLINE|IDENTIFIER|PLAIN_STRING|RBRACE\\\",jS);var J$=new Set([\\\"allowmixing\\\",\\\"newpage\\\",\\\"package\\\",\\\"rectangle\\\",\\\"skinparam\\\"]),kn=\\\"\\\",lt=[],bn=[],$n=[],Ke=0,QS=0,gn,Od,Ld=[],ZS=0,JS=0;function rn(e){return kn.slice(bn[e],$n[e])}function zn(e){return[bn[e],$n[e]]}function Fd(e){let[t,n]=Ei(kn,bn[Ke]);throw new Qe(`Error parsing usecase diagram: ${e} at ${kd(kn,bn[Ke],$n[Ke])}`,\\\"syntax\\\",{type:\\\"usecase\\\",line:t,column:n})}function e1(e){Fd(`Expecting token of type --> ${e} \u003C-- but found --> '${rn(Ke)}' \u003C--`)}function on(e){return lt[Ke]!==e&&e1(Rp[e]),Ke++}function sr(e){let t=e.split(\\\"|\\\").map((n,r)=>` ${r+1}. [${n}]`);Fd(`Expecting: one of these possible Token sequences:\\r\\n${t.join(`\\r\\n`)}\\r\\nbut found: '${rn(Ke)}'`)}function PS(){let e=Pd.split(\\\"|\\\"),t=e.flatMap(i=>[\\\"NEWLINE\\\",\\\"IDENTIFIER\\\",\\\"PLAIN_STRING\\\",\\\"RBRACE\\\"].map(s=>`${i}, METADATA_START, ${s}`)),n=`STEREOTYPE_START|CLASS_SEPARATOR|IDENTIFIER|${vd}|NEWLINE|EOF`.split(\\\"|\\\"),r=e.flatMap((i,s)=>(s===0?[\\\"LPAREN\\\",\\\"LBRACKET\\\",...n]:n).map(a=>`${i}, ${a}`));return[XS,...t,...r,...t].join(\\\"|\\\")}function FS(e){return e>=1&&e\u003C=21}function BS(e){return e>=1&&e\u003C=34}function Ai(){QS=$n[Ke-1],lt[Ke]===39?Ke++:lt[Ke]!==0&&sr(\\\"NEWLINE|EOF\\\")}function Wa(e){let t=lt[e]===36?2:lt[e]===35?1:0;return[bn[e]+t,$n[e]-t]}function $p(e){let t=Wa(e);return{text:kn.slice(t[0],t[1]),type:lt[e]===36?\\\"markdown\\\":\\\"text\\\",span:t}}function t1(e){return e.replace(/\\\\W/g,\\\"_\\\")}function Ba(){let e=lt[Ke];if(e===35||e===36)return $p(Ke++);BS(e)||sr(Z$);let t=Ke;for(;BS(lt[Ke]);)Ke++;let n=[bn[t],$n[Ke-1]];return{text:kn.slice(n[0],n[1]),type:\\\"text\\\",span:n}}function xi(e){return e===21||e===35}function WS(){let e=Ke;xi(lt[Ke])||sr(\\\"IDENTIFIER|PLAIN_STRING\\\"),Ke++,on(25);let t=Ke,n=lt[Ke];!xi(n)&&n!==19&&n!==20&&sr(\\\"IDENTIFIER|PLAIN_STRING|TRUE|FALSE\\\"),Ke++;let r=Wa(e),i=Wa(t);return{key:kn.slice(r[0],r[1]),value:n===19?!0:n===20?!1:kn.slice(i[0],i[1]),span:[bn[e],$n[t]],keySpan:r,valueSpan:i}}function eL(){let e=lt[Ke],t=lt[Ke+1],n=lt[Ke+2];return e===24?xi(t)||t===39&&(n===39||xi(n)):e!==39?!1:t===24||xi(t)||t===39&&(n===39||n===24||xi(n))}function Op(){on(60);let e=[];for(;lt[Ke]===39;)Ke++;if(xi(lt[Ke])){for(e.push(WS());eL();){if(lt[Ke]===24)Ke++;else{for(;lt[Ke]===39;)Ke++;lt[Ke]===24&&Ke++}for(;lt[Ke]===39;)Ke++;e.push(WS())}for(lt[Ke]===24&&Ke++;lt[Ke]===39;)Ke++}return on(62),e}function Dp(e){return e.map(({key:t,span:n,keySpan:r,valueSpan:i})=>({key:t,span:n,keySpan:r,valueSpan:i}))}function vp(e,t){do{Ke++;let n=on(21);e.push(rn(n)),t.push(zn(n))}while(lt[Ke]===24)}function n1(e){let t=Ke,n=lt[Ke],r={id:\\\"\\\",label:void 0,span:Wa(t),generated:n!==21,classes:[],classSpans:[],explicit:!1,nodeSpan:[0,0]};if(n===21){Ke++,r.id=rn(t);let i=lt[Ke];i===65||e&&i===63?(Ke++,r.label=Ba(),on(i===65?66:64),r.shape=i===65?\\\"ellipse\\\":\\\"rect\\\"):r.label=$p(t)}else n===35||n===36?(Ke++,r.label=$p(t),r.id=t1(r.label.text)):sr(Pd);return r}function Dd(e){let t=Ke,n=n1(!e);if(e&&(n.shape=void 0),lt[Ke]===60&&(n.metadata=Op()),lt[Ke]===48){Ke++;let r=on(50);on(49),n.stereotype=rn(r).trim(),n.stereotypeSpan=zn(r)}return lt[Ke]===52&&vp(n.classes,n.classSpans),n.explicit=!!(n.shape||n.metadata||n.stereotype),n.nodeSpan=[bn[t],$n[Ke-1]],n}function Pp(e,t){return{id:e.id,kind:t,label:e.label,span:e.span,generated:e.generated,parent:Od,shape:e.shape,metadata:e.metadata,stereotype:e.stereotype,classes:e.classes}}function US(e,t){return{id:e.id,label:e.label,span:e.span,generated:e.generated,declares:t,classed:e.classes.length>0}}function Fp(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=Dp(e.metadata)),e.classSpans.length>0&&(n.classSpans=e.classSpans),n}function Np(e){if(lt[Ke]\u003C1||lt[Ke]>36)return!1;for(let t=Ke+1;;t++){let n=lt[t];if(n===59||(Ar[n]&e)!==0)return!0;if(n\u003C1||n>36)return!1}}function Fa(e){let t=$n[e]-bn[e]-(lt[e]===59?0:1);return Math.max(1,t-1)}function r1(){let e=Ke,t={type:\\\"association\\\",arrowType:0,minlen:1,target:void 0,span:[0,0]};lt[Ke]===21&<[Ke+1]===23&&(t.explicitId=rn(Ke),t.explicitIdSpan=zn(Ke),Ke+=2);let n=Ke,r=lt[Ke++];if(r===47)on(25),lt[Ke]!==17&<[Ke]!==18&&sr(\\\"INCLUDE|EXTEND\\\"),t.type=lt[Ke]===17?\\\"include\\\":\\\"extend\\\",t.label={text:t.type,type:\\\"text\\\",span:zn(Ke)},Ke++;else if(r===46)t.type=\\\"generalization\\\";else if(r===53)t.minlen=Fa(n);else if(r===54)t.arrowType=1,$n[n]-bn[n]===3&&Np(0)?(t.label=Ba(),t.minlen=Fa(on(59))):t.minlen=Fa(n);else if(r===59)if(t.arrowType=2,$n[n]-bn[n]===2&&Np(VS)){t.label=Ba();let i=lt[Ke];i===53?t.arrowType=0:i===55?t.arrowType=3:i===57?t.arrowType=4:i!==59&&sr(\\\"FORWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|FORWARD_CROSS\\\"),(t.arrowType===0||t.arrowType===2)&&(t.minlen=Fa(Ke)),Ke++}else t.minlen=Fa(n);else r===55?t.arrowType=3:r===57?t.arrowType=4:r===56||r===58?(t.arrowType=r===56?5:6,Np(0)&&(t.label=Ba(),on(59))):(Ke--,sr(vd));return t.target=Dd(!1),t.span=[bn[e],$n[Ke-1]],t}function xr(e){return{kind:e,span:[0,0]}}function s1(e,t,n,r){let i=n.target;i.explicit&&gn.elements.push(Pp(i,\\\"usecase\\\")),gn.relationships.push({source:US(e,t),target:US(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(Fp(i,i.explicit));let s=xr(\\\"edge\\\");return s.nodes=r,s.edges=[{id:n.explicitId??`edge-${ZS++}`,span:s.span}],n.explicitIdSpan&&(s.edges[0].idSpan=n.explicitIdSpan),n.label&&(s.edges[0].labelSpan=n.label.span),s}function i1(e){let t=xr(\\\"node\\\");return t.nodes=e,t}function o1(e){Ke++;let t=[Dd(!0)],n;if(lt[Ke]===24)do Ke++,t.push(Dd(!0));while(lt[Ke]===24);else e&&(Ar[lt[Ke]]&Lp)!==0&&(n=r1());Ai();for(let i of t)gn.elements.push(Pp(i,\\\"actor\\\"));let r=t.map(i=>Fp(i,!0));return n?s1(t[0],!0,n,r):i1(r)}function a1(e){let t=Dd(!1),n=e&&(Ar[lt[Ke]]&Lp)!==0?r1():void 0;Ai(),n||(t.explicit=!0,t.shape??=\\\"ellipse\\\"),t.explicit&&gn.elements.push(Pp(t,\\\"usecase\\\"));let r=[Fp(t,t.explicit)];return n?s1(t,t.explicit,n,r):i1(r)}function tL(){Ke++;let e=n1(!0),t={id:e.id,label:e.label,span:e.span,generated:e.generated,classes:e.classes},n=lt[Ke]===60?Op():void 0;lt[Ke]===52&&vp(e.classes,e.classSpans),Ai(),gn.boundaries.push(t),Od=t;let r=[];for(;(Ar[lt[Ke]]&zS)!==0;)r.push(c1(!1));Od=void 0;let i=on(4);Ai();let s=xr(\\\"group\\\");return s.group=t.id,s.idSpan=t.span,s.titleSpan=t.label.span,s.endSpan=zn(i),s.classSpans=e.classSpans,r.length>0&&(s.children=r),n&&(s.metadata=Dp(n),gn.metadata.push({target:t.id,span:t.span,properties:n,statement:s})),s}function GS(){let e=Ke,t=lt[Ke];for(FS(t)||t===27?Ke++:t===59?(Ke++,FS(lt[Ke])||e1(\\\"WORD\\\"),Ke++):sr(\\\"WORD|CSS_IDENTIFIER|MARKERLESS_SOLID\\\"),on(25),(Ar[lt[Ke]]&kp)===0&&Fd(`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\\r\\n \u003C[${qS.replaceAll(\\\"|\\\",\\\"] ,[\\\")}]>\\r\\nbut found: '${rn(Ke)}'`);(Ar[lt[Ke]]&kp)!==0;)Ke++;return kn.slice(bn[e],$n[Ke-1]).replaceAll(\\\"\\\\\\\\,\\\",\\\",\\\")}function YS(){let e=[GS()];for(;lt[Ke]===24;)Ke++,e.push(GS());return e}function Ip(){let e=[on(21)];for(;lt[Ke]===24;)Ke++,e.push(on(21));return e}function $d(e){let t=Wa(e);return{id:rn(e),span:t,idSpan:t}}function nL(){let e=Ke,t=lt[Ke],n;if(t===41||t===42||t===40){Ke++;let r=rn(e);t===40?gn.accDescription=r.slice(r.indexOf(\\\"{\\\")+1,r.lastIndexOf(\\\"}\\\")).trim():t===42?gn.accDescription=r.slice(r.indexOf(\\\":\\\")+1).trim():gn.accTitle=r.slice(r.indexOf(\\\":\\\")+1).trim(),n=xr(t===41?\\\"accTitle\\\":\\\"accDescr\\\")}else if(t===5){Ke++;let r=lt[Ke];(r\u003C6||r>10)&&sr(\\\"TD|TB|BT|LR|RL\\\"),gn.direction=r===6?\\\"TB\\\":rn(Ke),Ke++,n=xr(\\\"direction\\\")}else{if(t===2)return o1(!0);if(t===3)return tL();if(t===11){Ke++,on(12);let r=on(21),i=Ba();gn.notes.push({target:rn(r),span:zn(r),label:i}),n=xr(\\\"note\\\"),n.ref=`note-${JS++}`,n.refSpan=i.span,n.nodes=[$d(r)]}else if(t===43){Ke++;let r=on(44),i=[],s=[];lt[Ke]===52&&vp(i,s);let a=bn[e]+4;for(;kn.charCodeAt(a)===32||kn.charCodeAt(a)===9;)a++;let o=a;for(;/\\\\w/.test(kn.charAt(o));)o++;let c={id:kn.slice(a,o),value:{},propertyOrder:new Map,span:[a,o],classes:i};gn.jsons.push(c),Ld.push([c,r]),n=xr(\\\"json\\\"),n.nodes=[{id:c.id,span:c.span,idSpan:c.span,defines:!0,classSpans:s}],n.classSpans=s}else if(t===14){Ke++;let r=Ip();gn.classDefs.push({ids:r.map(rn),styles:YS()}),n=xr(\\\"classDef\\\"),n.ref=rn(r[0]),n.refSpan=zn(r[0])}else if(t===15){Ke++;let r=Ip(),i=Ip();gn.classes.push({targets:r.map(s=>({id:rn(s),span:zn(s)})),classes:i.map(rn)}),n=xr(\\\"classAssign\\\"),n.ref=rn(i[0]),n.refSpan=zn(i[0]),n.nodes=r.map($d)}else if(t===16){Ke++;let r=on(21);gn.styles.push({target:rn(r),span:zn(r),styles:YS()}),n=xr(\\\"style\\\"),n.nodes=[$d(r)]}else{let r=lt[Ke+1];if(r===60){(Ar[lt[Ke+2]]&jS)===0&&sr(PS()),Ke++;let i=$d(e);t!==21&&(i.id=t1(kn.slice(i.span[0],i.span[1])));let s=Op();n=xr(\\\"metadata\\\"),n.nodes=[i],n.metadata=Dp(s),gn.metadata.push({target:i.id,span:i.span,properties:s,statement:n})}else return(!((Ar[r]&KS)!==0||t===21&&(r===65||r===63))||t===21&&J$.has(rn(e).toLowerCase()))&&sr(PS()),a1(!0)}}return Ai(),n}function c1(e){let t=Ke,n=lt[Ke];if(n===39)return Ke++,{kind:\\\"blank\\\",span:zn(t)};if(n===38)return Ke++,Ai(),{kind:\\\"comment\\\",span:zn(t)};let r=e?nL():n===2?o1(!1):a1(!1);if(r.span=[bn[t],QS],r.edges)for(let i of r.edges)i.span=r.span;return r}function l1(e,t){kn=e,{types:lt,starts:bn,ends:$n}=IS(e),Ke=0,gn=$S(),Od=void 0,Ld=[],ZS=0,JS=0;try{let n=on(1);Ai();let r=[];for(;(Ar[lt[Ke]]&HS)!==0;)r.push(c1(!0));lt[Ke]!==0&&Fd(`Redundant input, expecting EOF but found: ${rn(Ke)}`);for(let[i,s]of Ld){let a=vS(rn(s),()=>Ei(e,bn[s]));i.value=a.value,i.propertyOrder=a.propertyOrder}return LS(e,gn,zn(n),r,t)}finally{kn=\\\"\\\",lt=bn=$n=Ld=[]}}var rL={normal:\\\"usecaseActor\\\",hollow:\\\"usecaseActorHollow\\\",awesome:\\\"usecaseActorAwesome\\\",icon:\\\"usecaseActorIcon\\\"},Bp=[[\\\"none\\\",\\\"arrow_point\\\"],[\\\"arrow_point\\\",\\\"none\\\"],[\\\"none\\\",\\\"none\\\"],[\\\"none\\\",\\\"arrow_circle\\\"],[\\\"none\\\",\\\"arrow_cross\\\"],[\\\"arrow_circle\\\",\\\"none\\\"],[\\\"arrow_cross\\\",\\\"none\\\"]];function d1(e){return typeof e==\\\"string\\\"?e:e===null?\\\"null\\\":String(e)}function sL(e){let t=[],n=[[e.value,\\\"\\\",\\\"\\\"]],r=[];for(;n.length>0;){let[i,s,a]=n.pop();if(r.length=0,Array.isArray(i))i.length===0?t.push({key:s,accessibleKey:s,value:\\\"[]\\\"}):i.every(o=>o===null||typeof o!=\\\"object\\\")?i.forEach((o,c)=>t.push({key:c===0?s:\\\"\\\",accessibleKey:s,value:d1(o)})):i.forEach((o,c)=>r.push([o,`${s}[${c}]`,`${a}/${c}`]));else if(i!==null&&typeof i==\\\"object\\\"){let o=i,c=e.propertyOrder.get(a)??Object.keys(o);c.length===0&&t.push({key:s,accessibleKey:s,value:\\\"{}\\\"});for(let l of c)r.push([Object.prototype.hasOwnProperty.call(o,l)?o[l]:void 0,s?`${s}.${l}`:l,`${a}/${l.replaceAll(\\\"~\\\",\\\"~0\\\").replaceAll(\\\"/\\\",\\\"~1\\\")}`])}else t.push({key:s,accessibleKey:s,value:d1(i)});for(let o=r.length-1;o>=0;o--)n.push(r[o])}return t}function Ua(...e){return e.filter(Boolean).join(\\\" \\\")}function iL(e){return e.type===\\\"generalization\\\"?[\\\"none\\\",\\\"extension\\\"]:e.type!==\\\"association\\\"?Bp[0]:Bp[e.arrowType]??Bp[2]}function u1(e){let t=[],n=[],r=i=>{let s=new Map;for(let a of[\\\"default\\\",...i]){let o=e.classDefs.get(a);if(o)for(let c of o.styles){let l=c.trim(),u=l.indexOf(\\\":\\\"),h=(u===-1?l:l.slice(0,u)).trim();h&&s.set(h,l)}}return[...s.values()]};for(let i of e.actors.values())t.push({id:i.id,label:i.label,labelType:i.labelType,shape:rL[i.type],isGroup:!1,padding:10,cssClasses:Ua(\\\"default\\\",\\\"usecase-actor\\\",`usecase-actor-${i.type}`,i.business&&\\\"usecase-business\\\",...i.classes),cssStyles:[...i.styles],cssCompiledStyles:r(i.classes),actorType:i.type,business:i.business,icon:i.icon||void 0,stereotype:i.stereotype||void 0,parentId:i.parentId||void 0});for(let i of e.useCases.values()){let s=i.shape===\\\"ellipse\\\";t.push({id:i.id,label:i.label,labelType:i.labelType,shape:s?i.business?\\\"usecaseBusiness\\\":\\\"usecaseEllipse\\\":\\\"rect\\\",isGroup:!1,padding:s?20:10,cssClasses:Ua(\\\"default\\\",\\\"usecase-element\\\",`usecase-${i.shape}`,i.business&&\\\"usecase-business\\\",...i.classes),cssStyles:[...i.styles],cssCompiledStyles:r(i.classes),business:i.business,stereotype:i.stereotype||void 0,parentId:i.parentId||void 0})}for(let i of e.notes.values())t.push({id:i.id,label:i.label,labelType:i.labelType,shape:\\\"note\\\",isGroup:!1,padding:10,cssClasses:\\\"default usecase-note\\\",cssStyles:[],cssCompiledStyles:r([]),noteTarget:i.target});for(let i of e.jsonNodes.values())t.push({id:i.id,label:i.id,labelType:\\\"text\\\",shape:\\\"usecaseJsonTable\\\",isGroup:!1,padding:10,cssClasses:Ua(\\\"default\\\",\\\"usecase-json-table\\\",...i.classes),cssStyles:[...i.styles],cssCompiledStyles:r(i.classes),jsonRows:sL(i)});for(let i of e.systemBoundaries.values())t.push({id:i.id,label:i.label,labelType:i.labelType,shape:\\\"usecaseSystemBoundary\\\",isGroup:!0,padding:20,cssClasses:Ua(\\\"default\\\",\\\"system-boundary\\\",`system-boundary-${i.type}`,...i.classes),cssStyles:[...i.styles],cssCompiledStyles:r(i.classes),boundaryType:i.type});for(let i of e.relationships){let s=i.type===\\\"include\\\"||i.type===\\\"extend\\\",[a,o]=iL(i),c=i.animate||i.animation!==void 0,l={id:i.id,start:i.source,end:i.target,relationshipType:i.type,pattern:s?\\\"dotted\\\":\\\"solid\\\",arrowTypeStart:a,arrowTypeEnd:o,classes:Ua(\\\"default\\\",\\\"relationship\\\",`relationship-${i.type}`,...i.classes,c&&`edge-animation-${i.animation??\\\"fast\\\"}`),style:[...i.styles],cssCompiledStyles:r(i.classes),animate:i.animate,animation:i.animation,minlen:i.minlen,explicitId:i.explicitId,internal:!1};s?(l.label=i.type,l.labelType=\\\"text\\\"):i.type===\\\"association\\\"&&(i.label&&(l.label=i.label),i.labelType&&(l.labelType=i.labelType)),n.push(l)}for(let i of e.notes.values())n.push({id:`${i.id}-edge`,start:i.id,end:i.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 oL=32,aL=16,cL=72,Bd=20,Wp=26,Hp=40,Ya=60,f1=6,Up=6,Ga=10,Gp=8,Wd=9,Yd=12,lL=14,Ha=' fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"';function h1(e,t,n){let r=e.usecase?.[t];return typeof r==\\\"number\\\"&&r>0?Math.min(r,2e3):n}function dL(e){return e.replace(/[&\u003C>\\\\\\\\]/g,t=>`&#${t.charCodeAt(0)};`)}function Ps(e,t,n,r,i,s=0){return Ge(e&&!t?dL(e):e,t,n,r,i,s)}function Yp(e,t,n,r){let i=n===1||n===2?1:-1,s=n===1||n===3,a=(s?e.w:e.h)/2,o=0;if(e.kind===0)s?(a=Hp/2+3,o=(Ya-e.h)/2):a+=2;else if(e.kind===1){let c=(s?e.h:e.w)/2;a*=Math.sqrt(Math.max(1-(r/c)**2,0))}return s?[t.x+i*a,t.y+o+r]:[t.x+r,t.y+i*a]}function m1(e,t){let n=t===1||t===3;if(e.kind===0)return n?Ya*.5:Hp*.6;let r=n?e.h:e.w;return e.kind===1?r*.6:r-16}function uL(e,t,n){let r=new Map,i=(s,a,o,c)=>{let l=t[s];if(l.isGroup)return;let u=a[o]-l.x,h=a[o+1]-l.y,d;if(Math.abs(Math.abs(h)-l.h/2)\u003C.5)d=h\u003C0?0:2;else if(Math.abs(Math.abs(u)-l.w/2)\u003C.5)d=u\u003C0?3:1;else return;let m=s*4+d,p={route:a,at:o,toward:a[c+(d&1?1:0)]},y=r.get(m);y?y.push(p):r.set(m,[p])};for(let s of e){let a=s.route.length-3;s.src===s.dst||a\u003C3||(i(s.src,s.route,0,3),i(s.dst,s.route,a,a-3))}for(let[s,a]of r){let o=s>>2,c=s&3,l=n[o],u=a.length>1?Math.min(lL,m1(l,c)/(a.length-1)):0;a.sort((h,d)=>h.toward-d.toward);for(let h=0;h\u003Ca.length;h++){let[d,m]=Yp(l,t[o],c,(h-(a.length-1)/2)*u);a[h].route[a[h].at]=d,a[h].route[a[h].at+1]=m}}}function fL(e,t,n,r,i){let s=e-n*Yd,a=t-r*Yd,o=Yd*.5;return`\u003Cpath class=\\\"pele-marker\\\" d=\\\"M${f(e)},${f(t)}L${f(s-r*o)},${f(a+n*o)}L${f(s+r*o)},${f(a-n*o)}Z\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"${i}\\\" stroke-linejoin=\\\"round\\\"/>`}function Ud(e){return e===\\\"extension\\\"?Yd:Rt(e)}function Gd(e,t,n,r,i,s,a){return e===\\\"extension\\\"?fL(t,n,r,i,s):_t(e,t,n,r,i,s,a)}function hL(e,t){let n=e.node,r=e.style.shape,i=` fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"${e.style.line}`,s=-21,a=9,o;return n.actorType===\\\"hollow\\\"?(a=8,o=`\u003Ccircle cy=\\\"-21\\\" r=\\\"8\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${r}/>\u003Cpath 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\\\"?o=`\u003Cpath 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\\\"?(s=-14,a=12,o=`\u003Crect x=\\\"-22\\\" y=\\\"-26\\\" width=\\\"44\\\" height=\\\"44\\\"${At(Ha+r)}/>\u003Csvg class=\\\"pele-icon\\\" data-icon=\\\"${Ue(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??\\\"\\\")??\\\"\\\"}\u003C/svg>`):o=`\u003Ccircle cy=\\\"-21\\\" r=\\\"9\\\"${Ha}${r}/>\u003Cpath d=\\\"M0,-12V10M-14,-3H14M0,10L-12,30M0,10L12,30\\\"${i}/>`,n.business&&(o+=`\u003Cpath class=\\\"pele-business\\\" d=\\\"M${f(.12*a)},${f(s+.99*a)}L${f(.92*a)},${f(s-.39*a)}\\\"${i}/>`),o}function g1(e,t,n){return Pn(e.direction)?Pt(n,r=>p1(e,t,n,r)):p1(e,t,n,!1)}function p1(e,t,n,r){let i=u1(e),s=n.fontSize??16,a=Math.round(s*.875),o=Math.round(s*.8125),c=n.measurer??ct(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=n.icons,h=r?\\\"TB\\\":ln(e.direction),d=h===\\\"LR\\\"||h===\\\"RL\\\",m=new Map,p=[],y=[];i.nodes.forEach((g,N)=>m.set(g.id,N));for(let g of i.nodes){let N=Ct(g.cssStyles.length>0?g.cssCompiledStyles.concat(g.cssStyles):g.cssCompiledStyles),w=(N.bold?1:0)|(N.italic?2:0),A=N.fontSize??s,D=g.labelType===\\\"markdown\\\",U=Ps(g.stereotype&&`«${g.stereotype}»`,!1,c,o,200,w),B={node:g,kind:2,style:N,label:U,stereotype:U,w:0,h:0,rows:[],keyW:0,headH:0,loops:0},F;if(g.isGroup){B.kind=4,B.label=Ps(g.label,D,c,A,4e3,w);let W=B.label.height;F=Bt(0,0),F.isGroup=!0,F.padX=Bd,F.padBottom=Bd,F.padTop=g.boundaryType===\\\"package\\\"?W+2*Up+16:W>0?W+16:Bd,F.minW=B.label.width+2*Bd}else{if(g.jsonRows){B.kind=3,B.label=Ps(g.label,!1,c,A,4e3,w|1);let W=0;for(let j of g.jsonRows){let Q=Ps(j.key,!1,c,a,4e3,w),Y=Ps(j.value,!1,c,a,260,w);B.rows.push([Q,Y]),B.keyW=Math.max(B.keyW,Q.width),W=Math.max(W,Y.width),B.h+=Math.max(Q.height,Y.height,Math.round(a*1.5))+Gp}B.keyW>0&&(B.keyW+=2*Ga),B.headH=Math.max(B.label.height,Math.round(A*1.5))+Gp,B.w=Math.max(B.label.width+2*Ga,B.rows.length>0?B.keyW+W+2*Ga:0,72),B.h+=B.headH}else if(g.actorType)B.kind=0,B.label=Ps(g.label,D,c,A,140,w),B.w=Math.max(Hp,B.label.width,U.width),B.h=Ya+f1+U.height+B.label.height;else{B.label=Ps(g.label,D,c,g.shape===\\\"note\\\"?a:A,180,w);let W=Math.max(B.label.width,U.width),j=B.label.height+U.height;g.shape===\\\"usecaseEllipse\\\"||g.shape===\\\"usecaseBusiness\\\"?(B.kind=1,B.w=Math.max(W+2*g.padding+(g.business?16:4),88),B.h=Math.max(j+28,48)):g.shape===\\\"note\\\"?(B.w=W+2*g.padding+6,B.h=j+18):(B.w=Math.max(W+2*g.padding+12,80),B.h=Math.max(j+24,44))}F=Bt(B.w,B.h)}F.seq=p.length,p.push(B),y.push(F)}i.nodes.forEach((g,N)=>{y[N].parent=g.parentId!==void 0?m.get(g.parentId)??-1:-1});let E=[],b=[],S=[];for(let g of i.edges){let N=m.get(g.start),w=m.get(g.end);if(N===void 0||w===void 0)continue;let A=g.relationshipType===\\\"include\\\"||g.relationshipType===\\\"extend\\\",D=Ps(A?`«${g.label}»`:g.label,g.labelType===\\\"markdown\\\",c,a,200);N===w&&(p[N].loops++,d?y[N].h+=2*(Wp+(D.height>0?D.height+8:0)):y[N].w+=2*(Wp+(D.width>0?D.width+12:0))),S.push(g),b.push(D),E.push({src:N,dst:w,minlen:g.minlen,labelW:D.width>0?D.width+12:0,labelH:D.height>0?D.height+4:0,route:[],labelX:0,labelY:0})}let x=On(y,E,h,{nodeSep:h1(t,\\\"nodeSpacing\\\",oL),edgeSep:aL,rankSep:h1(t,\\\"rankSpacing\\\",cL),portSep:20}),I=yn(e.title,c,s,4e3),L=I.height>0?I.height+12:0,O=Math.max(x.width,I.width),v=l+(O-x.width)/2,G=l+L;Tr(y,E,v,G);let K=Math.ceil(O+2*l),C=Math.ceil(x.height+L+2*l),Z=new Map;for(let g of E)ur(Z,g.route);uL(E,y,p);let oe=\\\"\\\",H=[],z=\\\"\\\";for(let g=0;g\u003Cp.length;g++){let N=p[g],w=y[g],A=N.node,D=It(A.cssClasses.replace(/^default\\\\s?/,\\\"\\\")),U=Ue(A.id),B=N.style.text,F=N.style.shape,W=vt(N.style),j=W||' fill=\\\"var(--_m)\\\"',Q=N.w,Y=N.h;if(N.kind===4){let k=w.x-w.w/2,J=w.y-w.h/2;Mn(F)&&H.push({box:[k,J,k+w.w,J+w.h],shape:F});let te=` fill=\\\"var(--_a)\\\"${vn(F)?\\\"\\\":' fill-opacity=\\\"0.5\\\"'} stroke=\\\"var(--_b)\\\"${F}`,se=` class=\\\"pele-cluster-label\\\"${j}${B}`,re;if(A.boundaryType===\\\"package\\\"){let P=Math.min(N.label.width+2*Up+8,w.w),ee=N.label.height+2*Up;re=`\u003Crect class=\\\"pele-boundary-tab\\\" x=\\\"${f(k)}\\\" y=\\\"${f(J)}\\\" width=\\\"${f(P)}\\\" height=\\\"${f(ee)}\\\"${te}/>\u003Crect x=\\\"${f(k)}\\\" y=\\\"${f(J+ee)}\\\" width=\\\"${f(w.w)}\\\" height=\\\"${f(w.h-ee)}\\\"${te}/>`+Ne(N.label,k+P/2,J+ee/2,se,u)}else re=`\u003Crect x=\\\"${f(k)}\\\" y=\\\"${f(J)}\\\" width=\\\"${f(w.w)}\\\" height=\\\"${f(w.h)}\\\"${At(te)}/>`+Ne(N.label,pL(w,N.label.width,Z),J+8+N.label.height/2,se,u);oe+=`\u003Cg class=\\\"pele-cluster pele-boundary${D}\\\" data-id=\\\"${U}\\\">${re}\u003C/g>`;continue}let ne,q;if(N.kind===0){q=\\\"pele-actor\\\";let k=-Y/2,J=k+Ya+f1+N.stereotype.height/2;ne=`\u003Cg class=\\\"pele-actor-figure\\\" transform=\\\"translate(0,${f(k+Ya/2)})\\\">${hL(N,u)}\u003C/g>`+Ne(N.stereotype,0,J,` class=\\\"pele-stereotype\\\" font-size=\\\"${o}\\\" fill=\\\"var(--_m)\\\"`,u)+Ne(N.label,0,Y/2-N.label.height/2,` class=\\\"pele-label\\\"${B}`,u)}else if(N.kind===3){q=\\\"pele-json\\\";let k=-Q/2,J=-Y/2+N.headH,te=\\\"\\\",se=`M${f(k)},${f(J)}H${f(k+Q)}`;N.keyW>0&&(se+=`M${f(k+N.keyW)},${f(J)}V${f(Y/2)}`);for(let[re,P]of N.rows){let ee=Math.max(re.height,P.height,Math.round(a*1.5))+Gp;te+=Ne(re,k+Ga+re.width/2,J+ee/2,` class=\\\"pele-json-key\\\"${j}`,u)+mL(P,k+N.keyW+Ga,J+ee/2,` class=\\\"pele-json-value\\\"${W}${B}`,u),J+=ee}ne=`\u003Crect x=\\\"${f(k)}\\\" y=\\\"${f(-Y/2)}\\\" width=\\\"${f(Q)}\\\" height=\\\"${f(Y)}\\\"${At(Ha+F)}/>\u003Cpath class=\\\"pele-json-lines\\\" d=\\\"${se}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"${N.style.line}/>`+Ne(N.label,0,-Y/2+N.headH/2,` class=\\\"pele-label\\\" font-weight=\\\"var(--_hw)\\\"${W}${B}`,u)+`\u003Cg font-size=\\\"${a}\\\">${te}\u003C/g>`}else{let k=N.stereotype.height/2,J;if(N.kind===1){if(q=\\\"pele-usecase\\\",J=`\u003Cellipse rx=\\\"${f(Q/2)}\\\" ry=\\\"${f(Y/2)}\\\"${Ha}${F}/>`,A.business){let te=Q/2-15,se=Q/2-5,re=P=>Y/2*Math.sqrt(1-(P/(Q/2))**2);J+=`\u003Cpath class=\\\"pele-business\\\" d=\\\"M${f(te)},${f(re(te))}L${f(se)},${f(-re(se))}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"${N.style.line}/>`}}else if(A.shape===\\\"note\\\"){q=\\\"pele-note\\\";let te=Q/2,se=Y/2;J=`\u003Cpath d=\\\"M${f(-te)},${f(-se)}H${f(te-Wd)}L${f(te)},${f(Wd-se)}V${f(se)}H${f(-te)}Z\\\" fill=\\\"var(--_a)\\\" stroke=\\\"var(--_b)\\\" stroke-linejoin=\\\"round\\\"${F}/>\u003Cpath d=\\\"M${f(te-Wd)},${f(-se)}V${f(Wd-se)}H${f(te)}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\" stroke-linejoin=\\\"round\\\"${N.style.line}/>`}else q=\\\"pele-usecase\\\",J=`\u003Crect x=\\\"${f(-Q/2)}\\\" y=\\\"${f(-Y/2)}\\\" width=\\\"${f(Q)}\\\" height=\\\"${f(Y)}\\\"${At(Ha+F)}/>`;ne=J+Ne(N.stereotype,0,-N.label.height/2,` class=\\\"pele-stereotype\\\" font-size=\\\"${o}\\\"${j}`,u)+Ne(N.label,0,k,` class=\\\"pele-label\\\"${A.shape===\\\"note\\\"?` font-size=\\\"${a}\\\"`:\\\"\\\"}${W}${B}`,u)}z+=`\u003Cg class=\\\"pele-node ${q}${D}\\\" data-id=\\\"${U}\\\" transform=\\\"translate(${f(w.x)},${f(w.y)})\\\">${ne}\u003C/g>`}let M=\\\"\\\",T=\\\"\\\",R=\\\"\\\",_=new Map;for(let g=0;g\u003CE.length;g++){let N=E[g],w=S[g],A=b[g],D=w.style.length>0||w.cssCompiledStyles.length>0?Ct(w.cssCompiledStyles.concat(w.style)):void 0,U=w.arrowTypeStart,B=w.arrowTypeEnd,F;if(N.src===N.dst){let q=y[N.src],k=p[N.src],J=_.get(N.src)??0;_.set(N.src,J+1);let te=d?2:1,se=Math.min(m1(k,te)/2,8+J*6),re=Wp+J*8,[P,ee]=Yp(k,q,te,-se),[ae,ue]=Yp(k,q,te,se),ce=Math.hypot(re,se)||1,pe=d?se/ce:re/ce,V=d?re/ce:se/ce,X=Ud(U),le=Ud(B),de=(Ce,ke,be,Ae)=>d?`${f(Ce+be*se*(Ae?1:0))},${f(ke+Ae)}`:`${f(Ce+Ae)},${f(ke+be*se*(Ae?1:0))}`,Se=d?P-pe*X:P+pe*X,_e=d?ee+V*X:ee-V*X,xe=ae+pe*le,Me=ue+V*le;F={d:`M${f(Se)},${f(_e)}C${de(P,ee,-1,re)} ${de(ae,ue,1,re)} ${f(xe)},${f(Me)}`,sx:P,sy:ee,sdx:d?pe:-pe,sdy:d?-V:V,ex:ae,ey:ue,edx:-pe,edy:-V},d?(N.labelX=q.x,N.labelY=Math.max(ee,ue)+re*.75+6+A.height/2):(N.labelX=Math.max(P,ae)+re*.75+8+A.width/2,N.labelY=q.y)}else{if(N.route.length\u003C6)continue;F=Cn(N.route,void 0,Ud(U),Ud(B))}let W=Bo(F.d,[F.sx,F.sy,F.ex,F.ey],H,F.tokens),j=W&&Wo(W,D?.line),Q=j||(D?.stroke?rt(D.stroke):\\\"var(--_l)\\\");if(j===\\\"\\\"){let q=\\\"var(--_bg)\\\";M+=Go(F.d,Gd(U,F.sx,F.sy,F.sdx,F.sdy,q,q)+Gd(B,F.ex,F.ey,F.edx,F.edy,q,q),D?.line)}let Y=w.internal?\\\"2 3\\\":w.pattern===\\\"dotted\\\"?\\\"5 4\\\":w.animate?\\\"9 5\\\":\\\"\\\",ne=Gd(U,F.sx,F.sy,F.sdx,F.sdy,Q)+Gd(B,F.ex,F.ey,F.edx,F.edy,Q);if(T+=`\u003Cg class=\\\"pele-edge pele-${w.relationshipType}${It(w.classes.replace(/^default relationship relationship-\\\\S+\\\\s?/,\\\"\\\"))}\\\" data-id=\\\"${Ue(w.id)}\\\"${j?` stroke=\\\"${j}\\\"`:\\\"\\\"}${D?.line??\\\"\\\"}>\u003Cpath d=\\\"${F.d}\\\"${Y?` stroke-dasharray=\\\"${Y}\\\"`:\\\"\\\"}/>`+(W&&j?Uo(ne,W):ne)+\\\"\u003C/g>\\\",A.width>0){let q=N.labelX,k=N.labelY,J=w.relationshipType===\\\"include\\\"||w.relationshipType===\\\"extend\\\";R+=dn(w.id,A,q,k,(J?' fill=\\\"var(--_m)\\\"':\\\"\\\")+(D?.text??\\\"\\\"),u)}}return{svg:at(\\\"usecase\\\",K,C,s,n,e,Ne(I,K/2,l+I.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(oe?`\u003Cg class=\\\"pele-clusters\\\">${oe}\u003C/g>`:\\\"\\\")+Dn(M)+(T?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\" stroke=\\\"var(--_l)\\\" stroke-linecap=\\\"round\\\">${T}\u003C/g>`:\\\"\\\")+(R?`\u003Cg class=\\\"pele-edge-labels\\\" font-size=\\\"${a}\\\">${R}\u003C/g>`:\\\"\\\")+`\u003Cg class=\\\"pele-nodes\\\">${z}\u003C/g>`),width:K,height:C,links:[]}}function pL(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,s=e.x+e.w/2-6,a=r.filter(d=>d>i&&d\u003Cs).sort((d,m)=>d-m);a.push(s);let o=t/2+6,c=e.x,l=1/0,u=0,h=i;for(let d of a){if(d-h>=2*o){let m=Math.min(Math.max(e.x,h+o),d-o);Math.abs(m-e.x)\u003Cl&&(l=Math.abs(m-e.x),c=m)}else l===1/0&&d-h>u&&(u=d-h,c=(h+d)/2);h=d}return c}function mL(e,t,n,r,i){if(e.lines.length\u003C2)return Ne(e,t+e.width/2,n,r,i);let s=\\\"\\\";for(let a=0;a\u003Ce.lines.length;a++)s+=Ne(Ir(e,a),t+e.widths[a]/2,n-e.height/2+Nr(e,a),r,i);return s}var b1={type:\\\"usecase\\\",math:!0,parse:(e,t,n)=>l1(e,n),render:g1};function Fs(e){let t=e.trim();return t.length>=2&&t.startsWith('\\\"')&&t.endsWith('\\\"')?t.slice(1,-1):t}function Kp(e){return e.map(Fs).sort()}var Hd=class{constructor(){fe(this,\\\"type\\\",\\\"venn\\\");fe(this,\\\"title\\\");fe(this,\\\"subsets\\\",[]);fe(this,\\\"textNodes\\\",[]);fe(this,\\\"styles\\\",[]);fe(this,\\\"known\\\",new Set);fe(this,\\\"current\\\");fe(this,\\\"indent\\\",!1)}setDiagramTitle(t){this.title=t}addSubsetData(t,n,r){let i=Kp(t);this.current=i,i.length===1&&this.known.add(i[0]),this.subsets.push({sets:i,size:r??10/t.length**2,label:n?Fs(n):void 0})}addTextData(t,n,r){this.textNodes.push({sets:Kp(t),id:Fs(n),label:r?Fs(r):void 0})}addStyleData(t,n){let r=new Map;for(let[i,s]of n)r.set(i,s&&Fs(s));this.styles.push({targets:Kp(t),styles:r})}validateUnionIdentifiers(t){let n=t.map(Fs).filter(r=>!this.known.has(r));if(n.length>0)throw new Qe(`unknown set identifier: ${n.join(\\\", \\\")}`,\\\"semantic\\\",{type:\\\"venn\\\"})}getCurrentSets(){return this.current}getIndentMode(){return this.indent}setIndentMode(t){this.indent=t}};var zp=[\\\"$end\\\",\\\"INVALID\\\",\\\"EOF\\\",\\\"NEWLINE\\\",\\\"VENN\\\",\\\"TITLE\\\",\\\"SET\\\",\\\"UNION\\\",\\\"TEXT\\\",\\\"INDENT_TEXT\\\",\\\"STYLE\\\",\\\"BRACKET_LABEL\\\",\\\"NUMERIC\\\",\\\"HEXCOLOR\\\",\\\"RGBCOLOR\\\",\\\"RGBACOLOR\\\",\\\"IDENTIFIER\\\",\\\"STRING\\\",\\\"COMMA\\\",\\\"COLON\\\"],gL=[[\\\"venn-beta\\\",4],[\\\"set\\\",6],[\\\"union\\\",7],[\\\"text\\\",8],[\\\"style\\\",10]],Kd=class{constructor(t,n){fe(this,\\\"src\\\",t);fe(this,\\\"host\\\",n);fe(this,\\\"text\\\",\\\"\\\");fe(this,\\\"start\\\",0);fe(this,\\\"at\\\",0);fe(this,\\\"lineStart\\\",!1);fe(this,\\\"ended\\\",!1)}word(t,n){let r=this.src;for(let i=0;i\u003Cn.length;i++){let s=r.charCodeAt(t+i),a=n.charCodeAt(i);if(s!==a&&(s+32!==a||s\u003C65||s>90))return!1}return!0}keyword(t,n){return this.word(t,n)&&!ot(this.src.charCodeAt(t+n.length))}color(t,n){let r=this.src,i=t+1;for(let s=0;s\u003Cn;s++){for(;qe(r.charCodeAt(i));)i++;let a=i;for(;xt(r.charCodeAt(i))||r.charCodeAt(i)===46;)i++;if(i===a)return-1;for(;qe(r.charCodeAt(i));)i++;if(r.charCodeAt(i)!==(s===n-1?41:44))return-1;i++}return i}afterLineFeed(t){let n=t-1;for(;this.src.charCodeAt(n)===32||this.src.charCodeAt(n)===9;)n--;return this.src.charCodeAt(n)===10}lineEnd(t){let n=this.src.indexOf(`\\r\\n`,t);return n===-1?this.src.length:n}next(){let t=this.src,n=t.length;for(;;){let r=this.at;if(this.start=r,this.text=\\\"\\\",r>=n)return this.ended?0:(this.ended=!0,2);let i=t.charCodeAt(r);if(i===37&&t.charCodeAt(r+1)===37&&t.charCodeAt(r+2)!==123){this.at=this.lineEnd(r+2);continue}if(this.lineStart&&this.word(r,\\\"title\\\")&&this.afterLineFeed(r)&&t.slice(r+5,this.lineEnd(r+5)).trim()===\\\"\\\"){let s=this.lineEnd(r+5);for(;t.charCodeAt(s)===10||t.charCodeAt(s)===13;)s++;this.at=s;continue}if(this.lineStart){if(i===32||i===9){let s=r+1;for(;t.charCodeAt(s)===32||t.charCodeAt(s)===9;)s++;if(this.at=s,this.keyword(s,\\\"text\\\")&&this.host.getIndentMode())return this.at=s+4,this.lineStart=!1,this.text=t.slice(r,s),9;continue}i!==10&&i!==13&&(this.host.setIndentMode(!1),this.lineStart=!1)}if(i===10||i===13){for(r++;t.charCodeAt(r)===10||t.charCodeAt(r)===13;)r++;return this.lineStart=!0,this.token(3,r)}if(i===37&&t.charCodeAt(r+1)===37){this.at=this.lineEnd(r);continue}if(i===32||i===9){for(r++;t.charCodeAt(r)===32||t.charCodeAt(r)===9;)r++;this.at=r;continue}if((i|32)>=97&&(i|32)\u003C=122||i===95){let s=t.charCodeAt(r+5);if(this.word(r,\\\"title\\\")&&qe(s)&&s!==10&&s!==13){let a=r+6;for(;a\u003Cn;){let o=t.charCodeAt(a);if(o===35||o===10||o===59)break;a++}if(a>r+6)return this.token(5,a)}for(let[a,o]of gL)if(this.keyword(r,a)&&t.charCodeAt(r+a.length)!==45)return this.token(o,r+a.length);if(this.word(r,\\\"rgb\\\")){let a=(t.charCodeAt(r+3)|32)===97,o=r+(a?4:3),c=t.charCodeAt(o)===40?this.color(o,a?4:3):-1;if(c!==-1)return this.token(a?15:14,c)}for(r++;ot(t.charCodeAt(r))||t.charCodeAt(r)===45;)r++;return this.token(16,r)}if(i===91){if(t.charCodeAt(r+1)===34){let a=t.indexOf('\\\"',r+2);return a===-1||t.charCodeAt(a+1)!==93?1:(this.at=a+2,this.text=t.slice(r+2,a),11)}let s=r+1;for(;s\u003Cn&&t.charCodeAt(s)!==93&&t.charCodeAt(s)!==34;)s++;return s===r+1||t.charCodeAt(s)!==93?1:(this.at=s+1,this.text=t.slice(r+1,s).trim(),11)}if(xt(i)||i===46||i===43||i===45){(i===43||i===45)&&r++;let s=r;for(;xt(t.charCodeAt(r));)r++;if(r>s){if(t.charCodeAt(r)===46&&xt(t.charCodeAt(r+1)))for(r+=2;xt(t.charCodeAt(r));)r++}else if(t.charCodeAt(r)===46&&xt(t.charCodeAt(r+1)))for(r+=2;xt(t.charCodeAt(r));)r++;else return 1;return this.token(12,r)}if(i===35){let s=r+1;for(;s\u003Cr+9&&Za(t.charCodeAt(s));)s++;return s>=r+4?this.token(13,s):1}if(i===34){let s=t.indexOf('\\\"',r+1);return s===-1?1:this.token(17,s+1)}return i===44?this.token(18,r+1):i===58?this.token(19,r+1):1}}token(t,n){return this.text=this.src.slice(this.at,n),this.at=n,t}};var bL=\\\"'EOF', 'NEWLINE', 'TITLE', 'SET', 'UNION', 'TEXT', 'INDENT_TEXT', 'STYLE'\\\",yL=\\\"'NUMERIC', 'IDENTIFIER', 'STRING', 'HEXCOLOR', 'RGBCOLOR', 'RGBACOLOR'\\\";function y1(e,t){let n=new Kd(e,t),r=-1,i=()=>r===-1?r=n.next():r,s=m=>{throw i()===1?ft(\\\"venn\\\",e,n.start,\\\"\\\",!0):ft(\\\"venn\\\",e,n.start,`Expecting ${m}, got '${zp[r]}'`)},a=()=>(r=-1,n.text),o=m=>(i()!==m&&s(`'${zp[m]}'`),a()),c=()=>(i()!==16&&r!==17&&s(\\\"'IDENTIFIER', 'STRING'\\\"),a()),l=()=>{let m=[c()];for(;i()===18;)a(),m.push(c());return m},u=(m,p)=>{let y=i()===11?a():void 0,E;if(i()===19&&(a(),E=parseFloat(o(12))),p){if(m.length\u003C2)throw new Qe(\\\"union requires multiple identifiers\\\",\\\"semantic\\\",{type:\\\"venn\\\"});t.validateUnionIdentifiers(m)}t.addSubsetData(m,y,E),t.setIndentMode(!0)},h=m=>{let p=i();p!==16&&p!==17&&p!==12&&s(\\\"'NUMERIC', 'IDENTIFIER', 'STRING'\\\");let y=a(),E=p!==12&&i()===11?a():void 0;t.addTextData(m(),y,E)},d=()=>{let m=l(),p=[];for(;;){let y=o(16);o(19);let E;if(i()===17)E=a();else{let b=[];for(;i()===16||r>=12&&r\u003C=15;)b.push(a());b.length===0&&s(yL),E=b.join(\\\" \\\")}if(p.push([y,E]),i()!==18)break;a()}t.addStyleData(m,p)};for(;i()===3;)a();for(o(4);;){let m=i();if(m===2)return;if((m\u003C3||m>10||m===4)&&s(bL),a(),m===5)t.setDiagramTitle(n.text.slice(6));else if(m===6)u([c()],!1);else if(m===7)u(l(),!0);else if(m===8){let p=l();h(()=>p)}else m===9?h(()=>{let p=t.getCurrentSets();if(!p)throw new Qe(\\\"text requires set\\\",\\\"semantic\\\",{type:\\\"venn\\\"});return p}):m===10&&d()}}var zd=Math.PI*2;function EL(e){let t=new Set,n=new Map;for(let i of e)t.add(JSON.stringify([...i.sets].sort())),i.sets.length===1&&n.set(i.sets[0],i.size);let r=[];for(let i of e){if(i.sets.length\u003C3)continue;let s=[...i.sets].sort();for(let a=0;a\u003Cs.length-1;a++)for(let o=a+1;o\u003Cs.length;o++){let c=[s[a],s[o]],l=JSON.stringify(c);if(t.has(l))continue;t.add(l);let u=n.get(c[0]),h=n.get(c[1]);r.push({sets:c,size:u!==void 0&&h!==void 0?Math.min(u,h)/4:2.5,label:\\\"\\\"})}}return r.length>0?[...e,...r]:e}function xL(e,t,n){if(n>=e+t)return 0;let r=Math.min(e,t);if(n\u003C=Math.abs(e-t))return Math.PI*r*r;let i=e*e*Math.acos((n*n+e*e-t*t)/(2*n*e)),s=t*t*Math.acos((n*n+t*t-e*e)/(2*n*t)),a=.5*Math.sqrt(Math.max((-n+e+t)*(n+e-t)*(n-e+t)*(n+e+t),0));return i+s-a}function AL(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 s=0;s\u003C48;s++){let a=(r+i)/2;xL(e,t,a)>n?r=a:i=a}return(r+i)/2}function E1(e,t,n,r,i,s){let a=1/0;for(let o of t){let c=e[o],l=r-c.x,u=i-c.y,h=c.r-Math.sqrt(l*l+u*u);if(h\u003Ca){if(h\u003Cs)return h;a=h}}for(let o of n){let c=e[o],l=r-c.x,u=i-c.y,h=Math.sqrt(l*l+u*u)-c.r;if(h\u003Ca){if(h\u003Cs)return h;a=h}}return a}function Vd(e,t,n){let r=0,i=0,s=e[t[0]];for(let p of t){let y=e[p];r+=y.x/t.length,i+=y.y/t.length,y.r\u003Cs.r&&(s=y)}let a=s.r,o=r,c=i,l=E1(e,t,n,o,c,-1/0),u=0,h=(p,y)=>{let E=E1(e,t,n,p,y,l-a*1e-9);if(!(E>l-a*1e-9))return!1;let b=Math.hypot(p-r,y-i);return E>l+a*1e-9||b\u003Cu-a*1e-9?(l=E,u=b,o=p,c=y,!0):!1},d=10;for(let p=-d;p\u003C=d;p++)for(let y=-d;y\u003C=d;y++)y*y+p*p\u003C=d*d&&h(s.x+y*a/d,s.y+p*a/d);let m=a/d;for(let p=0;p\u003C40&&m>a*1e-6;p++){let y=!1;for(let E=0;E\u003C8;E++){let b=E*zd/8;h(o+Math.cos(b)*m,c+Math.sin(b)*m)&&(y=!0)}y||(m/=2)}return{x:o,y:c,margin:l}}function x1(e){let t=new Map;for(let E of e)for(let b of E.sets)t.has(b)||t.set(b,10);for(let E of e)E.sets.length===1&&t.set(E.sets[0],E.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 s=Math.sqrt(i/Math.PI);for(let[E,b]of t){n.set(E,r.length);let S=Number.isFinite(b)&&b>0?Math.sqrt(b/Math.PI):0;r.push({id:E,x:0,y:0,r:Math.max(S,s*.3)})}let a=r.length;if(a\u003C2)return r;let o=new Map;for(let E of EL(e)){if(E.sets.length!==2)continue;let b=n.get(E.sets[0]),S=n.get(E.sets[1]);b!==S&&o.set(Math.min(b,S)*a+Math.max(b,S),E.size)}let c=new Map;for(let[E,b]of o)c.set(E,AL(r[Math.floor(E/a)].r,r[E%a].r,b));let l=s*.15,u=(E,b)=>c.get(E*a+b)??r[E].r+r[b].r+l;if(a===2)return r[1].x=u(0,1),r;if(a===3){let E=u(0,1),b=u(0,2),S=u(1,2),x=e.some(I=>new Set(I.sets).size===3);for(let I=0;I\u003C40;I++){let L=E>0?(E*E+b*b-S*S)/(2*E):0;if(r[1].x=E,r[2].x=Math.max(-b,Math.min(b,L)),r[2].y=Math.sqrt(Math.max(b*b-L*L,0)),!x||Vd(r,[0,1,2],[]).margin>s*.12)break;E*=.94,b*=.94,S*=.94}return r}let h=0;for(let E of r)h+=2*E.r+l;let d=Math.min(300,Math.floor(3e6/(a*a)));if(a\u003C=64){let E=h/zd;r.forEach((b,S)=>{let x=S*zd/a-Math.PI/2;b.x=Math.cos(x)*E,b.y=Math.sin(x)*E})}else{let E=Math.ceil(Math.sqrt(a)),b=2*s+l;r.forEach((S,x)=>{S.x=x%E*b,S.y=Math.floor(x/E)*b})}let m=new Float64Array(a),p=new Float64Array(a),y=new Int32Array(a);for(let E=0;E\u003Cd;E++){m.fill(0),p.fill(0),y.fill(0);for(let b=0;b\u003Ca;b++)for(let S=b+1;S\u003Ca;S++){let x=c.get(b*a+S),I=r[b].r+r[S].r+l,L=r[S].x-r[b].x,O=r[S].y-r[b].y,v=Math.hypot(L,O);if(x===void 0&&v>=I)continue;v\u003C1e-9&&(L=Math.cos(b+S),O=Math.sin(b+S),v=1);let G=(v-(x??I))/2/v;m[b]+=L*G,p[b]+=O*G,m[S]-=L*G,p[S]-=O*G,y[b]++,y[S]++}for(let b=0;b\u003Ca;b++)y[b]!==0&&(r[b].x+=m[b]/y[b],r[b].y+=p[b]/y[b])}return r}function A1(e,t){let n=c=>`M${t(c.x-c.r)},${t(c.y)}A${t(c.r)},${t(c.r)} 0 1 1 ${t(c.x+c.r)},${t(c.y)}A${t(c.r)},${t(c.r)} 0 1 1 ${t(c.x-c.r)},${t(c.y)}Z`;if(e.length===1)return n(e[0]);let r=(c,l,u,h)=>{for(let d of e)if(d!==u&&d!==h&&Math.hypot(c-d.x,l-d.y)>d.r*(1+1e-9))return!1;return!0},i=[];for(let c=0;c\u003Ce.length;c++)for(let l=c+1;l\u003Ce.length;l++){let u=e[c],h=e[l],d=Math.hypot(h.x-u.x,h.y-u.y);if(d>=u.r+h.r||d\u003C=Math.abs(u.r-h.r)||d===0)continue;let m=(u.r*u.r-h.r*h.r+d*d)/(2*d),p=Math.sqrt(Math.max(u.r*u.r-m*m,0)),y=u.x+(h.x-u.x)*m/d,E=u.y+(h.y-u.y)*m/d;for(let b of[1,-1]){let S=y+b*p*(h.y-u.y)/d,x=E-b*p*(h.x-u.x)/d;r(S,x,u,h)&&i.push({x:S,y:x,a:u,b:h})}}if(i.length\u003C2){let c=e[0];for(let l of e)l.r\u003Cc.r&&(c=l);for(let l of e)if(l!==c&&Math.hypot(l.x-c.x,l.y-c.y)+c.r>l.r*(1+1e-9))return\\\"\\\";return n(c)}let s=0,a=0;for(let c of i)s+=c.x/i.length,a+=c.y/i.length;i.sort((c,l)=>Math.atan2(c.y-a,c.x-s)-Math.atan2(l.y-a,l.x-s));let o=\\\"\\\";for(let c=0;c\u003Ci.length;c++){let l=i[c],u=i[(c+1)%i.length];c===0&&(o=`M${t(l.x)},${t(l.y)}`);let h,d=0,m=1/0;for(let p of[l.a,l.b]){if(p!==u.a&&p!==u.b)continue;let y=Math.atan2(l.y-p.y,l.x-p.x),E=Math.atan2(u.y-p.y,u.x-p.x)-y;E\u003C=0&&(E+=zd);let b=p.x+p.r*Math.cos(y+E/2),S=p.y+p.r*Math.sin(y+E/2),x=Math.hypot(b-(l.x+u.x)/2,S-(l.y+u.y)/2);x\u003Cm&&(m=x,h=p,d=E>Math.PI?1:0)}h===void 0?o+=`L${t(u.x)},${t(u.y)}`:o+=`A${t(h.r)},${t(h.r)} 0 ${d} 1 ${t(u.x)},${t(u.y)}`}return o+\\\"Z\\\"}var SL=100,wL=1.6,S1=Ct([]);function Vp(e){return e.length===1?e[0]:JSON.stringify(e)}function w1(e,t,n){let r=n.fontSize??16,i=Math.round(r*.875),s=Math.round(r*.8125),a=n.measurer??ct(n.fontFamily,n.fontFamilyMono),o=n.padding??8,c=x1(e.subsets),l=new Map;c.forEach((g,N)=>l.set(g.id,N));let u=new Map;for(let{targets:g,styles:N}of e.styles){let w=Vp(g),A=u.get(w);A||u.set(w,A=new Map);for(let[D,U]of N)A.set(D,U)}let h=g=>{let N=u.get(g);if(!N)return S1;let w=[];for(let[A,D]of N)w.push(`${A}:${D}`);return Ct(w)},d=c.map(()=>[]);for(let g=0;g\u003Cc.length;g++)for(let N=g+1;N\u003Cc.length;N++)Math.hypot(c[g].x-c[N].x,c[g].y-c[N].y)\u003Cc[g].r+c[N].r&&(d[g].push(N),d[N].push(g));let m=new Map;for(let g of e.subsets)m.set(Vp(g.sets),g);let p=new Map;for(let[g,N]of m){let w=[...new Set(N.sets)],A=w.map(q=>l.get(q)),D=new Set(A),U=A[0];for(let q of A)c[q].r\u003Cc[U].r&&(U=q);let B=h(g),F=N.label??(N.sets.length===1?N.sets[0]:void 0),W=(B.bold?1:0)|(B.italic?2:0),j=d[U].filter(q=>!D.has(q)),Q=Vd(c,A,j),Y=j.length>0&&Q.margin\u003Cc[U].r*.2;Y&&(Q=Vd(c,A,[]));let ne={sets:w,inside:A,spot:Q,lines:[],style:B,across:Y};if(F){let q=w.length===1?r:i;ne.lines.push({id:void 0,raw:F,size:q,base:W,label:Ge(F,!1,a,q,4e3,W)})}p.set(g,ne)}for(let g of e.textNodes){let N=g.label??g.id;p.get(Vp(g.sets))?.lines.push({id:g.id,raw:N,size:s,base:0,label:Ge(N,!1,a,s,4e3)})}let y=0;for(let g of c)g.r>y&&(y=g.r);let E=y>0?SL/y:1,b=1;for(let g of p.values()){if(g.spot.margin\u003C=0)continue;let N=0,w=0;for(let D of g.lines)N=Math.max(N,D.label.width),w+=D.label.height;let A=Math.hypot(N,w)/2+4;b=Math.max(b,Math.min(A/(g.spot.margin*E),wL))}E*=b;for(let g of p.values()){let N=Math.max(g.spot.margin*E*1.8,72);for(let w of g.lines)w.label.width>N&&(w.label=Ge(w.raw,!1,a,w.size,N,w.base))}let S=1/0,x=1/0,I=-1/0,L=-1/0;for(let g of c)S=Math.min(S,(g.x-g.r)*E),x=Math.min(x,(g.y-g.r)*E),I=Math.max(I,(g.x+g.r)*E),L=Math.max(L,(g.y+g.r)*E);for(let g of p.values()){let N=0,w=0;for(let A of g.lines)N=Math.max(N,A.label.width),w+=A.label.height;S=Math.min(S,g.spot.x*E-N/2),I=Math.max(I,g.spot.x*E+N/2),x=Math.min(x,g.spot.y*E-w/2),L=Math.max(L,g.spot.y*E+w/2)}c.length===0&&(S=x=I=L=0);let O=Ge(e.title&&Fs(e.title),!1,a,r,4e3,1),v=O.height>0?O.height+12:0,G=Math.max(I-S,O.width),K=o+(G-(I-S))/2-S,C=o+v-x,Z=Math.ceil(G+2*o),oe=Math.ceil(L-x+v+2*o),H=c.map(g=>({id:g.id,x:g.x*E+K,y:g.y*E+C,r:g.r*E})),z=\\\"\\\";H.forEach((g,N)=>{let w=Et(N),A=p.get(g.id)?.style??S1;z+=`\u003Ccircle class=\\\"pele-venn-set\\\" data-id=\\\"${Ue(g.id)}\\\" cx=\\\"${f(g.x)}\\\" cy=\\\"${f(g.y)}\\\" r=\\\"${f(g.r)}\\\" fill=\\\"${w}\\\" fill-opacity=\\\"0.2\\\" stroke=\\\"${w}\\\"${A.shape}/>`});let M=[...p.values()].filter(g=>g.sets.length>1&&g.style.shape!==\\\"\\\"),T=g=>{if(g.across)return\\\"\\\";let N=g.sets.length===1&&/[\\\";]fill-opacity:/.test(g.style.shape)?g.style.shape:\\\"\\\";for(let w of M)w.sets.every(A=>g.sets.includes(A))&&(N=w.style.shape);return N},R=\\\"\\\",_=\\\"\\\";for(let g of p.values()){let N=Ue(g.sets.join(\\\"|\\\"));if(g.sets.length>1&&g.style.shape!==\\\"\\\"){let F=A1(g.inside.map(W=>H[W]),f);F!==\\\"\\\"&&(R+=`\u003Cpath class=\\\"pele-venn-overlap\\\" data-id=\\\"${N}\\\" d=\\\"${F}\\\" fill=\\\"none\\\"${g.style.shape}/>`)}let w=0;for(let F of g.lines)w+=F.label.height;if(w===0)continue;let A=g.spot.x*E+K,D=g.spot.y*E+C-w/2,U=T(g),B=\\\"\\\";for(let F of g.lines){let W=F.id===void 0?g.style.text:h(F.id).text,j=dr(U,W),Q=F.id===void 0?` class=\\\"pele-label\\\"${F.size===r?\\\"\\\":` font-size=\\\"${F.size}\\\"`}${j?` fill=\\\"${j}\\\"`:\\\"\\\"}${W}`:` class=\\\"pele-venn-text\\\" data-id=\\\"${Ue(F.id)}\\\" font-size=\\\"${s}\\\" fill=\\\"${j??\\\"var(--_m)\\\"}\\\"${W}`;B+=Ne(F.label,A,D+F.label.height/2,Q),D+=F.label.height}_+=`\u003Cg class=\\\"pele-venn-region\\\" data-id=\\\"${N}\\\">${B}\u003C/g>`}return{svg:at(\\\"venn\\\",Z,oe,r,n,{},Ne(O,Z/2,o+O.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg class=\\\"pele-venn-sets\\\">${z}\u003C/g>`+(R?`\u003Cg class=\\\"pele-venn-overlaps\\\">${R}\u003C/g>`:\\\"\\\")+(_?`\u003Cg class=\\\"pele-venn-labels\\\">${_}\u003C/g>`:\\\"\\\")),width:Z,height:oe,links:[]}}var _1={type:\\\"venn\\\",parse(e,t,n){let r=new Hd;return n&&(r.title=n),y1(e,r),r},render:w1};var jd=class{constructor(){fe(this,\\\"nodes\\\",new Map);fe(this,\\\"labels\\\");fe(this,\\\"links\\\",[]);fe(this,\\\"trends\\\",new Map);fe(this,\\\"pipelines\\\",new Map);fe(this,\\\"annotations\\\",[]);fe(this,\\\"notes\\\",[]);fe(this,\\\"accelerators\\\",[]);fe(this,\\\"deaccelerators\\\",[]);fe(this,\\\"annotationsBox\\\");fe(this,\\\"axes\\\",{});fe(this,\\\"size\\\")}addNode(t){let n=this.nodes.get(t.id)??{id:t.id,label:t.label};this.nodes.set(t.id,{...n,...t,className:t.className??n.className,labelOffsetX:t.labelOffsetX??n.labelOffsetX,labelOffsetY:t.labelOffsetY??n.labelOffsetY}),this.labels=void 0}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]});let n=this.nodes.get(t);n&&(n.isPipelineParent=!0)}addPipelineComponent(t,n){this.pipelines.get(t)?.componentIds.push(n);let r=this.nodes.get(n);r&&(r.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,n){this.annotationsBox={x:t,y:n}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,n){this.size={width:t,height:n}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(this.nodes.has(t))return t;if(!this.labels){this.labels=new Map;for(let[n,r]of this.nodes)this.labels.has(r.label)||this.labels.set(r.label,n)}return this.labels.get(t)??t}build(){let t=[];for(let n of this.nodes.values()){if(typeof n.x!=\\\"number\\\"||typeof n.y!=\\\"number\\\")throw new Qe(`Node \\\"${n.label}\\\" is missing coordinates`,\\\"semantic\\\",{type:\\\"wardley\\\"});t.push(n)}return{nodes:t,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 Xd(e,t){let n=e\u003C=1?e*100:e;if(n\u003C0||n>100)throw new Qe(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`,\\\"semantic\\\",{type:\\\"wardley\\\"});return n}function wi(e,t,n){return{x:Xd(t,`${n} evolution`),y:Xd(e,`${n} visibility`)}}function R1(e){return e===\\\"+\u003C>\\\"?\\\"bidirectional\\\":e===\\\"+\u003C\\\"?\\\"backward\\\":e===\\\"+>\\\"?\\\"forward\\\":void 0}function _L(e){if(!e?.startsWith(\\\"+\\\"))return{};let t=e.indexOf(\\\"'\\\",2),n=e[1]===\\\"'\\\"&&t!==-1?e.slice(2,t):void 0;return e.includes(\\\"\u003C>\\\")?{flow:\\\"bidirectional\\\",label:n}:e.includes(\\\"\u003C\\\")?{flow:\\\"backward\\\",label:n}:e.includes(\\\">\\\")?{flow:\\\"forward\\\",label:n}:{label:n}}function T1(e){return e?[(e.negX?-1:1)*e.offsetX,(e.negY?-1:1)*e.offsetY]:[void 0,void 0]}function RL(e,t){e.size&&t.setSize(e.size.width,e.size.height),e.evolution&&t.setAxes({stages:e.evolution.stages.map(n=>n.secondName?`${n.name.trim()} / ${n.secondName.trim()}`:n.name.trim()),stageBoundaries:e.evolution.stages.filter(n=>n.boundary!==void 0).map(n=>n.boundary)});for(let n of e.anchors){let r=wi(n.visibility,n.evolution,`Anchor \\\"${n.name}\\\"`);t.addNode({id:n.name,label:n.name,x:r.x,y:r.y,className:\\\"anchor\\\"})}for(let n of e.components){let r=wi(n.visibility,n.evolution,`Component \\\"${n.name}\\\"`),[i,s]=T1(n.label);t.addNode({id:n.name,label:n.name,x:r.x,y:r.y,className:\\\"component\\\",labelOffsetX:i,labelOffsetY:s,inertia:n.inertia,sourceStrategy:n.decorator?.strategy})}for(let n of e.notes){let r=wi(n.visibility,n.evolution,`Note \\\"${n.text}\\\"`);t.addNote({text:n.text,x:r.x,y:r.y})}for(let n of e.pipelines){let r=t.getNode(n.parent);if(!r||typeof r.y!=\\\"number\\\")throw new Qe(`Pipeline \\\"${n.parent}\\\" must reference an existing component with coordinates.`,\\\"semantic\\\",{type:\\\"wardley\\\"});let i=r.y;t.startPipeline(n.parent);for(let s of n.components){let a=`${n.parent}_${s.name}`,[o,c]=T1(s.label),l=Xd(s.evolution,`Pipeline component \\\"${s.name}\\\" evolution`);t.addNode({id:a,label:s.name,x:l,y:i,className:\\\"pipeline-component\\\",labelOffsetX:o,labelOffsetY:c,inertia:void 0,sourceStrategy:void 0}),t.addPipelineComponent(n.parent,a)}}for(let n of e.links){let r=!!n.arrow&&(n.arrow.includes(\\\"-.->\\\")||n.arrow.includes(\\\".-.\\\")),i=_L(n.arrow),s=R1(n.fromPort)??R1(n.toPort)??i.flow;t.addLink({source:t.resolveNodeId(n.from),target:t.resolveNodeId(n.to),dashed:r,label:i.label??n.linkLabel,flow:s})}for(let n of e.evolves){let r=t.getNode(n.component);r?.y!==void 0&&t.addTrend({nodeId:n.component,targetX:Xd(n.target,`Evolve target for \\\"${n.component}\\\"`),targetY:r.y})}if(e.annotations.length>0){let n=wi(e.annotations[0].x,e.annotations[0].y,\\\"Annotations box\\\");t.setAnnotationsBox(n.x,n.y)}for(let n of e.annotation){let r=wi(n.x,n.y,`Annotation ${n.number}`);t.addAnnotation({number:n.number,coordinates:[{x:r.x,y:r.y}],text:n.text})}for(let n of e.accelerators){let r=wi(n.x,n.y,`Accelerator \\\"${n.name}\\\"`);t.addAccelerator({name:n.name,x:r.x,y:r.y})}for(let n of e.deaccelerators){let r=wi(n.x,n.y,`Deaccelerator \\\"${n.name}\\\"`);t.addDeaccelerator({name:n.name,x:r.x,y:r.y})}}function M1(e,t){let n=new jd;return RL(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,`\\r\\n`):void 0,...n.build()}}function C1(e,t){let n=t;for(let r=e.charCodeAt(n);r>=48&&r\u003C=57;r=e.charCodeAt(n))n++;return n}function TL(){let e=0,t=0;return(n,r)=>{if((r\u003Ce||r>=t)&&(e=r,t=C1(n,r)),t===r||n.charCodeAt(t)!==46)return-1;let i=C1(n,t+1);return i>t+1?i:-1}}var N1={name:\\\"ARROW\\\",pattern:/->/y,first:\\\"-\\\"},I1={name:\\\"LINK_ARROW\\\",pattern:/-->|-\\\\.->|>|\\\\+'[^']*'\u003C>|\\\\+'[^']*'\u003C|\\\\+'[^']*'>/y,first:\\\"->+\\\"},Un=(e,t)=>({name:e,pattern:new RegExp(t,\\\"y\\\"),first:t[0]}),k1=[{name:\\\"[\\\",pattern:\\\"[\\\"},{name:\\\",\\\",pattern:\\\",\\\"},{name:\\\"]\\\",pattern:\\\"]\\\"},{name:\\\"@\\\",pattern:\\\"@\\\"},{name:\\\"/\\\",pattern:\\\"/\\\"},{name:\\\"(\\\",pattern:\\\"(\\\"},{name:\\\")\\\",pattern:\\\")\\\"},{name:\\\"-\\\",pattern:\\\"-\\\",longer:[N1,I1,Ht]},{name:\\\"{\\\",pattern:\\\"{\\\"},{name:\\\"}\\\",pattern:\\\"}\\\"},{name:\\\"WARDLEY_NUMBER\\\",pattern:/[0-9]+\\\\.[0-9]+/y,first:\\\"0123456789\\\",scanner:TL},N1,{name:\\\"LINK_PORT\\\",pattern:/\\\\+\u003C>|\\\\+>|\\\\+\u003C/y,first:\\\"+\\\"},I1,{name:\\\"LINK_LABEL\\\",pattern:/;[^\\\\n\\\\r]+/y,first:\\\";\\\"},{name:\\\"STRATEGY\\\",pattern:/build|buy|outsource|market/y,first:\\\"bom\\\"},Un(\\\"KW_WARDLEY\\\",\\\"wardley-beta\\\"),Un(\\\"KW_SIZE\\\",\\\"size\\\"),Un(\\\"KW_EVOLUTION\\\",\\\"evolution\\\"),Un(\\\"KW_ANCHOR\\\",\\\"anchor\\\"),Un(\\\"KW_COMPONENT\\\",\\\"component\\\"),Un(\\\"KW_LABEL\\\",\\\"label\\\"),Un(\\\"KW_INERTIA\\\",\\\"inertia\\\"),Un(\\\"KW_EVOLVE\\\",\\\"evolve\\\"),Un(\\\"KW_PIPELINE\\\",\\\"pipeline\\\"),Un(\\\"KW_NOTE\\\",\\\"note\\\"),Un(\\\"KW_ANNOTATIONS\\\",\\\"annotations\\\"),Un(\\\"KW_ANNOTATION\\\",\\\"annotation\\\"),Un(\\\"KW_ACCELERATOR\\\",\\\"accelerator\\\"),Un(\\\"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:\\\"\\t \\\"},Zi(),Xt,pr,{name:\\\"INT\\\",pattern:/0|[1-9][0-9]*(?!\\\\.)/y,first:\\\"0123456789\\\"},Fn,{name:\\\"ID\\\",pattern:/[\\\\w]([-\\\\w]*\\\\w)?/y,first:\\\"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\\\"},Sn,wn,Ht,Qt,Zt];function $1(e){let t=new Ut(Yt(e,k1,\\\"wardley\\\"),k1,\\\"wardley\\\"),n={$type:\\\"Wardley\\\",anchors:[],components:[],links:[],evolves:[],pipelines:[],notes:[],annotations:[],annotation:[],accelerators:[],deaccelerators:[]},r=m=>t.kinds[t.i]===m,i=()=>r(36)||r(37)||r(30),s=()=>r(36)?un(t.take()):r(37)||r(30)?t.take():t.fail(\\\"a name\\\"),a=()=>Number(t.expect(10)),o=()=>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=m=>{t.expect(0);let p=m();t.expect(1);let y=m();return t.expect(2),[p,y]},h=()=>{t.expect(21),t.expect(0);let m=t.accept(7),p=o();t.expect(1);let y=t.accept(7),E=o();return t.expect(2),{$type:\\\"Label\\\",negX:m,offsetX:p,negY:y,offsetY:E}},d=()=>{let m={$type:\\\"EvolutionStage\\\",name:s()};return t.accept(3)&&(m.boundary=a()),t.accept(4)&&(m.secondName=s()),m};for(;r(38);)t.i++;for(t.expect(16);!r(-1);)switch(t.kind){case 38:t.i++;break;case 32:n.accDescr=Vt(t.take()),l();break;case 33:n.accTitle=zt(t.take()),l();break;case 34:n.title=Kt(t.take()),l();break;case 17:{t.i++;let[m,p]=u(o);l(),n.size={$type:\\\"Size\\\",width:m,height:p};break}case 18:{t.i++;let m=[d()];for(t.expect(11),m.push(d());t.accept(11);)m.push(d());l(),n.evolution={$type:\\\"Evolution\\\",stages:m};break}case 19:{t.i++;let m=s(),[p,y]=u(a);l(),n.anchors.push({$type:\\\"Anchor\\\",name:m,visibility:p,evolution:y});break}case 20:{t.i++;let m={$type:\\\"Component\\\",name:s(),visibility:0,evolution:0,inertia:!1};[m.visibility,m.evolution]=u(a),r(21)&&(m.label=h()),r(5)&&t.kinds[t.i+1]===15&&(t.i++,m.decorator={$type:\\\"Decorator\\\",strategy:t.take()},t.expect(6)),t.accept(22)?m.inertia=!0:t.accept(5)&&(t.expect(22),t.expect(6),m.inertia=!0),l(),n.components.push(m);break}case 23:{t.i++;let m=s(),p=a();l(),n.evolves.push({$type:\\\"Evolve\\\",component:m,target:p});break}case 24:{t.i++;let m=s();for(t.expect(8),t.expect(38);r(38);)t.i++;let p=[];do{t.expect(20);let y={$type:\\\"PipelineComponent\\\",name:s(),evolution:0};t.expect(0),y.evolution=a(),t.expect(2),r(21)&&(y.label=h()),l(),p.push(y)}while(r(20));t.expect(9),l(),n.pipelines.push({$type:\\\"Pipeline\\\",parent:m,components:p});break}case 25:{t.i++;let m=un(t.expect(36)),[p,y]=u(a);l(),n.notes.push({$type:\\\"Note\\\",text:m,visibility:p,evolution:y});break}case 26:{t.i++;let[m,p]=u(c);l(),n.annotations.push({$type:\\\"Annotations\\\",x:m,y:p});break}case 27:{t.i++;let m=o();t.expect(1);let[p,y]=u(c),E=un(t.expect(36));l(),n.annotation.push({$type:\\\"Annotation\\\",number:m,x:p,y,text:E});break}case 28:case 29:{let m=t.kind===29;t.i++;let p=s(),[y,E]=u(a);l(),m?n.deaccelerators.push({$type:\\\"Deaccelerator\\\",name:p,x:y,y:E}):n.accelerators.push({$type:\\\"Accelerator\\\",name:p,x:y,y:E});break}default:{i()||t.fail(\\\"a statement\\\");let m={$type:\\\"Link\\\",from:s(),to:\\\"\\\"};r(12)&&(m.fromPort=t.take()),(r(13)||r(11))&&(m.arrow=t.take()),m.to=s(),r(12)&&(m.toPort=t.take()),r(14)&&(m.linkLabel=t.take().substring(1).trim()),l(),n.links.push(m)}}return n}var ML=[\\\"Genesis\\\",\\\"Custom Built\\\",\\\"Product\\\",\\\"Commodity\\\"],CL=48,Gt=6,_i=10,NL=8,qd=15,Ka=60,IL=30,L1=20,jp=\\\"var(--_c)\\\",Vn=\\\"var(--_l)\\\";function kL(e,t,n,r,i){let s=e[\\\"wardley-beta\\\"]?.[t];return typeof s==\\\"number\\\"&&s>=r&&s\u003C=i?s:n}function bo(e,t,n){return e\u003Ct?t:e>n?n:e}function O1(e,t,n,r){let i=Xr(e),s=\\\"\\\",a=n;for(let o of e.lines){let c=!0;for(let l of o){if(l.icon!==void 0)continue;let u=_r(l.style&~i);s+=`\u003Ctspan${c?` x=\\\"${f(t)}\\\" y=\\\"${f(a)}\\\"`:\\\"\\\"}${u}>${rt(l.text)}\u003C/tspan>`,c=!1}a+=e.lineHeight}return s===\\\"\\\"?\\\"\\\":`\u003Ctext${qn(r,i)} xml:space=\\\"preserve\\\">${s}\u003C/text>`}function D1(e,t,n,r){let i=typeof t==\\\"number\\\"&&Number.isFinite(t)?t:kL(e,n,r,1,1e6);return bo(i,200,1e4)-2*CL}function v1(e,t,n){let r=D1(t,e.size?.width,\\\"width\\\",900);return ms(n,r,160,(i,s)=>$L(e,t,n,i,r,s))}function $L(e,t,n,r,i,s){let a=n.fontSize??16,o=Math.round(a*.8125),c=Math.round(a*.6875),l=n.measurer??ct(n.fontFamily,n.fontFamilyMono),u=n.padding??8,h=D1(t,e.size?.height,\\\"height\\\",600)*Math.max(.75,r/i),d=t[\\\"wardley-beta\\\"]?.showGrid===!0,m=0,p=0,y=r,E=h,b=(V,X,le,de)=>{V\u003Cm&&(m=V),X\u003Cp&&(p=X),le>y&&(y=le),de>E&&(E=de)},S=(V,X,le,de)=>(b(X-V.width/2,le-V.height/2,X+V.width/2,le+V.height/2),Ne(V,X,le,de,n.icons)),x=(V,X,le,de)=>(b(X,le-V.size,X+V.width,le-V.size+V.height+4),O1(V,X,le,de)),I=(V,X,le=s?Math.max(64,Math.min(120,r/2)):4e3,de=0)=>Ge(V,!1,l,X,le,de),L=V=>V/100*r,O=V=>h-V/100*h,v=e.axes.stages&&e.axes.stages.length>0?e.axes.stages:ML,G=e.axes.stageBoundaries,K=G!==void 0&&G.length===v.length,C=\\\"\\\",Z=\\\"\\\",oe=h,H=0;if(v.forEach((V,X)=>{let le=K?H:X/v.length,de=K?bo(G[X],0,1):(X+1)/v.length;H=de,X>0&&(C+=`\u003Cpath class=\\\"pele-wardley-stage\\\" d=\\\"M${f(le*r)},0V${f(h)}\\\" stroke=\\\"var(--_b)\\\" stroke-dasharray=\\\"4 4\\\"/>`);let Se=I(V,o,Math.max(48,Math.abs(de-le)*r-12));Z+=S(Se,(le+de)/2*r,h+8+Se.height/2,` class=\\\"pele-wardley-stage-label\\\" font-size=\\\"${o}\\\" fill=\\\"var(--_m)\\\"`),oe=Math.max(oe,h+8+Se.height)}),d)for(let V=1;V\u003C4;V++)C+=`\u003Cpath class=\\\"pele-wardley-grid\\\" d=\\\"M${f(r*V/4)},0V${f(h)}M0,${f(h*V/4)}H${f(r)}\\\" stroke=\\\"var(--_b)\\\" stroke-dasharray=\\\"2 6\\\"/>`;C+=`\u003Cpath class=\\\"pele-wardley-axis\\\" d=\\\"M0,0V${f(h)}H${f(r)}\\\" stroke=\\\"${Vn}\\\"/>`;let z=I(e.axes.xLabel??\\\"Evolution\\\",o),M=I(e.axes.yLabel??\\\"Visibility\\\",o),T=` class=\\\"pele-wardley-axis-label\\\" font-size=\\\"${o}\\\" font-weight=\\\"var(--_hw)\\\"`,R=S(z,r/2,oe+6+z.height/2,T)+Ne(M,-16,h/2,`${T} transform=\\\"rotate(-90 -16 ${f(h/2)})\\\"`);b(-16-M.height/2,0,0,0);let _=oe+6+z.height+10,$=new Map;for(let V of e.nodes)$.set(V.id,{x:L(V.x),y:O(V.y),node:V});let g=\\\"\\\",N=new Map;for(let V of e.pipelines){N.set(V.nodeId,new Set(V.componentIds));let X=[];for(let Me of V.componentIds){let Ce=$.get(Me);Ce&&X.push(Ce)}if(X.length===0)continue;X.sort((Me,Ce)=>Me.x-Ce.x);let le=X[0].x,de=X[X.length-1].x,Se=X[0].y,_e=Se-2*Gt,xe=$.get(V.nodeId);xe&&(xe.x=(le+de)/2,xe.y=_e-_i/6),b(le-qd,_e,de+qd,_e+4*Gt),g+=`\u003Cg class=\\\"pele-wardley-pipeline\\\" data-id=\\\"${Ue(V.nodeId)}\\\">\u003Crect x=\\\"${f(le-qd)}\\\" y=\\\"${f(_e)}\\\" width=\\\"${f(de-le+2*qd)}\\\" height=\\\"${f(4*Gt)}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"var(--_b)\\\"${ht}/>`+(X.length>1?`\u003Cpath d=\\\"M${f(le)},${f(Se)}H${f(de)}\\\" stroke=\\\"${Vn}\\\" stroke-dasharray=\\\"4 4\\\"/>`:\\\"\\\")+\\\"\u003C/g>\\\"}let w=new Map,A=(V,X,le)=>{let de=V.node;if(de.className===\\\"anchor\\\"){let Se=w.get(de);return Se||w.set(de,Se=I(de.label,o,s?Math.max(64,r/2):4e3,1)),1/Math.hypot(X/(Se.width/2+5),le/(o*.8))}return de.isPipelineParent?_i/Math.SQRT2:de.sourceStrategy?2*Gt:Gt},D=new Map,U=(V,X,le)=>{Math.abs(X)\u003C.25||Math.abs(le)\u003C.25||D.set(V,(D.get(V)??0)|(X>0?le\u003C0?1:2:le\u003C0?4:8))},B=\\\"\\\";for(let V of e.links){let X=$.get(V.source),le=$.get(V.target);if(!X||!le||X===le||N.get(V.target)?.has(V.source))continue;let de=le.x-X.x,Se=le.y-X.y,_e=Math.hypot(de,Se);if(_e\u003C.01)continue;let xe=de/_e,Me=Se/_e,Ce=A(X,xe,Me),ke=A(le,xe,Me);if(Ce+ke>=_e)continue;U(X,xe,Me),U(le,-xe,-Me);let be=X.x+xe*Ce,Ae=X.y+Me*Ce,ie=le.x-xe*ke,me=le.y-Me*ke,Te=\\\"\\\";(V.flow===\\\"forward\\\"||V.flow===\\\"bidirectional\\\")&&(Te+=_t(\\\"arrow_point\\\",ie,me,xe,Me,Vn),ie-=xe*Rt(\\\"arrow_point\\\"),me-=Me*Rt(\\\"arrow_point\\\")),(V.flow===\\\"backward\\\"||V.flow===\\\"bidirectional\\\")&&(Te+=_t(\\\"arrow_point\\\",be,Ae,-xe,-Me,Vn),be+=xe*Rt(\\\"arrow_point\\\"),Ae+=Me*Rt(\\\"arrow_point\\\"));let ye=\\\"\\\";if(V.label){let we=I(V.label,c+1,200),Ie=xe>=0?1:-1,ve=Me*Ie,Pe=-xe*Ie,he=5+Math.abs(ve)*we.width/2+Math.abs(Pe)*we.height/2;ye=S(we,(X.x+le.x)/2+ve*he,(X.y+le.y)/2+Pe*he,` class=\\\"pele-edge-label\\\" font-size=\\\"${c+1}\\\" fill=\\\"var(--_m)\\\"`)}B+=`\u003Cg class=\\\"pele-edge${V.dashed?\\\" pele-wardley-dashed\\\":\\\"\\\"}\\\" data-id=\\\"${Ue(V.source)}-${Ue(V.target)}\\\">\u003Cpath d=\\\"M${f(be)},${f(Ae)}L${f(ie)},${f(me)}\\\" stroke=\\\"${Vn}\\\"${V.dashed?' stroke-dasharray=\\\"6 6\\\"':\\\"\\\"}/>`+Te+ye+\\\"\u003C/g>\\\"}let F=\\\"\\\";for(let V of e.trends){let X=$.get(V.nodeId);if(!X)continue;let le=L(V.targetX),de=O(V.targetY),Se=le-X.x,_e=de-X.y,xe=Math.hypot(Se,_e),Me=\\\"\\\",Ce=xe>0?A(X,Se/xe,_e/xe):0;if(xe>Ce+Gt+4){let ke=Se/xe,be=_e/xe,Ae=le-ke*(Gt+2),ie=de-be*(Gt+2);Me=`\u003Cpath d=\\\"M${f(X.x+ke*Ce)},${f(X.y+be*Ce)}L${f(Ae-ke*Rt(\\\"arrow_point\\\"))},${f(ie-be*Rt(\\\"arrow_point\\\"))}\\\" stroke=\\\"${jp}\\\" stroke-dasharray=\\\"4 4\\\"/>`+_t(\\\"arrow_point\\\",Ae,ie,ke,be,jp)}b(le-Gt,de-Gt,le+Gt,de+Gt),F+=`\u003Cg class=\\\"pele-wardley-trend\\\" data-id=\\\"${Ue(V.nodeId)}\\\">${Me}\u003Ccircle cx=\\\"${f(le)}\\\" cy=\\\"${f(de)}\\\" r=\\\"${Gt}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"${jp}\\\"/>\u003C/g>`}let W=\\\"\\\",j=1.2*Gt,Q=.7*Gt;for(let V of $.values()){let X=V.node,{x:le,y:de}=V,Se=X.className===\\\"anchor\\\",_e=X.sourceStrategy,xe=\\\"\\\";if(_e){let be=_e===\\\"outsource\\\"?\\\"var(--_m)\\\":_e===\\\"buy\\\"?\\\"var(--_a)\\\":_e===\\\"build\\\"?\\\"var(--_s)\\\":\\\"var(--_bg)\\\";xe+=`\u003Ccircle class=\\\"pele-wardley-${_e}\\\" cx=\\\"${f(le)}\\\" cy=\\\"${f(de)}\\\" r=\\\"${2*Gt}\\\" fill=\\\"${be}\\\" stroke=\\\"${Vn}\\\"/>`}if(_e===\\\"market\\\"){let be=j*Math.cos(Math.PI/6),Ae=de+j*Math.sin(Math.PI/6);xe+=`\u003Cpath d=\\\"M${f(le)},${f(de-j)}L${f(le-be)},${f(Ae)}H${f(le+be)}Z\\\" fill=\\\"none\\\" stroke=\\\"${Vn}\\\"/>`;for(let[ie,me]of[[le,de-j],[le-be,Ae],[le+be,Ae]])xe+=`\u003Ccircle cx=\\\"${f(ie)}\\\" cy=\\\"${f(me)}\\\" r=\\\"${f(Q)}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"${Vn}\\\"/>`}else X.isPipelineParent?xe+=`\u003Crect x=\\\"${f(le-_i/2)}\\\" y=\\\"${f(de-_i/2)}\\\" width=\\\"${_i}\\\" height=\\\"${_i}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"${Vn}\\\"/>`:Se||(xe+=`\u003Ccircle cx=\\\"${f(le)}\\\" cy=\\\"${f(de)}\\\" r=\\\"${Gt}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"${Vn}\\\"/>`);if(X.inertia===!0){let be=(X.isPipelineParent?_i/2:Gt)+10+(_e?Gt+4:0);xe+=`\u003Crect class=\\\"pele-wardley-inertia\\\" x=\\\"${f(le+be)}\\\" y=\\\"${f(de-Gt)}\\\" width=\\\"4\\\" height=\\\"${2*Gt}\\\" fill=\\\"${Vn}\\\"/>`}let Me=X.labelOffsetX===void 0?void 0:bo(X.labelOffsetX,-5e3,5e3),Ce=X.labelOffsetY===void 0?void 0:bo(X.labelOffsetY,-5e3,5e3),ke;if(Se){let be=w.get(X)??I(X.label,o,s?Math.max(64,r/2):4e3,1);ke=S(be,le+(Me??0),de+(Ce??-3),` class=\\\"pele-label\\\" font-size=\\\"${o}\\\" font-weight=\\\"var(--_hw)\\\"`)}else{let be=I(X.label,o),Ae=` class=\\\"pele-label\\\" font-size=\\\"${o}\\\"`,ie=NL+(_e?10:0);if(Me!==void 0||Ce!==void 0)ke=x(be,le+(Me??ie),de+(Ce??-ie),Ae);else if(X.inPipeline)ke=S(be,le,de+2*Gt+4+be.height/2,Ae);else{let me=D.get(V)??0,Te=(me&1)===0?1:(me&2)===0?2:(me&4)===0?4:(me&8)===0?8:1,ye=Te===1||Te===2,we=Te===1||Te===4;ke=x(be,ye?le+ie:le-ie-be.width,we?de-ie:de+ie+o*.75,Ae)}}b(le-2*Gt,de-2*Gt,le+2*Gt+20,de+2*Gt),W+=`\u003Cg class=\\\"pele-node pele-wardley-${Se?\\\"anchor\\\":X.isPipelineParent?\\\"pipeline-parent\\\":X.inPipeline?\\\"pipeline-component\\\":\\\"component\\\"}\\\" data-id=\\\"${Ue(X.id)}\\\">${xe}${ke}\u003C/g>`}let Y=\\\"\\\";for(let V of e.annotations){let X=I(String(V.number),c,4e3,1),le=\\\"\\\";for(let de of V.coordinates){let Se=L(de.x),_e=O(de.y),xe=Math.max(10,X.width/2+4);b(Se-xe,_e-xe,Se+xe,_e+xe),le+=`\u003Ccircle cx=\\\"${f(Se)}\\\" cy=\\\"${f(_e)}\\\" r=\\\"${f(xe)}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"${Vn}\\\"/>`+Ne(X,Se,_e,` font-size=\\\"${c}\\\" font-weight=\\\"var(--_hw)\\\"`)}Y+=`\u003Cg class=\\\"pele-wardley-annotation\\\" data-id=\\\"${Ue(String(V.number))}\\\">${le}\u003C/g>`}let ne=e.annotations.filter(V=>V.text).sort((V,X)=>V.number-X.number);if(ne.length>0){let V=ne.map(Ce=>I(`${Ce.number}. ${Ce.text}`,o,s?Math.max(80,r-20):320)),X=0,le=0;for(let Ce of V)X=Math.max(X,Ce.width),le+=Ce.height;X+=20,le+=14;let de=e.annotationsBox,Se=de?bo(L(de.x),0,Math.max(0,r-X)):0,_e=de?bo(O(de.y),0,Math.max(0,h-le)):_;b(Se,_e,Se+X,_e+le);let xe=\\\"\\\",Me=_e+7;for(let Ce of V)xe+=O1(Ce,Se+10,Me+Ce.lineHeight/2+o*.35,` font-size=\\\"${o}\\\"`),Me+=Ce.height;Y+=`\u003Cg class=\\\"pele-wardley-annotations\\\">\u003Crect x=\\\"${f(Se)}\\\" y=\\\"${f(_e)}\\\" width=\\\"${f(X)}\\\" height=\\\"${f(le)}\\\" fill=\\\"var(--_bg)\\\" stroke=\\\"var(--_b)\\\"${ht}/>${xe}\u003C/g>`}let q=\\\"\\\";for(let V of e.notes)q+=x(I(V.text,o,Math.min(360,r*.6),1),L(V.x),O(V.y),` class=\\\"pele-wardley-note\\\" font-size=\\\"${o}\\\" font-weight=\\\"var(--_hw)\\\"`);let k=\\\"\\\",J=(V,X,le,de)=>{let Se=L(X),_e=O(le),xe=IL/2,Me=de?Se+Ka:Se,Ce=de?Se:Se+Ka,ke=de?Se+Ka-L1:Se+L1,be=`M${f(Ce)},${f(_e-xe)}H${f(ke)}V${f(_e-xe-8)}L${f(Me)},${f(_e)}L${f(ke)},${f(_e+xe+8)}V${f(_e+xe)}H${f(Ce)}Z`;b(Se,_e-xe-8,Se+Ka,_e+xe+8),k+=`\u003Cg class=\\\"pele-wardley-${de?\\\"accelerator\\\":\\\"deaccelerator\\\"}\\\" data-id=\\\"${Ue(V)}\\\">\u003Cpath d=\\\"${be}\\\" fill=\\\"var(--_s)\\\" stroke=\\\"${Vn}\\\"/>`+S(I(V,c+1,160,1),Se+Ka/2,_e+xe+8+12,` font-size=\\\"${c+1}\\\" font-weight=\\\"var(--_hw)\\\"`)+\\\"\u003C/g>\\\"};for(let V of e.accelerators)J(V.name,V.x,V.y,!0);for(let V of e.deaccelerators)J(V.name,V.x,V.y,!1);let te=Ge(e.title,!1,l,a,s?Math.max(80,r):4e3,1),se=te.height>0?te.height+12:0,re=Math.min(m,r/2-te.width/2),P=Math.max(y,r/2+te.width/2),ee=u-re,ae=u+se-p,ue=Math.ceil(P-re+2*u),ce=Math.ceil(E-p+se+2*u),pe=Ne(te,ee+r/2,u+te.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+`\u003Cg transform=\\\"translate(${f(ee)},${f(ae)})\\\">\u003Cg class=\\\"pele-wardley-frame\\\" fill=\\\"none\\\">${C}\u003C/g>`+Z+R+g+(B?`\u003Cg class=\\\"pele-edges\\\" fill=\\\"none\\\">${B}\u003C/g>`:\\\"\\\")+(F?`\u003Cg class=\\\"pele-wardley-trends\\\" fill=\\\"none\\\">${F}\u003C/g>`:\\\"\\\")+W+Y+q+k+\\\"\u003C/g>\\\";return{svg:at(\\\"wardley\\\",ue,ce,a,n,e,pe),width:ue,height:ce,links:[]}}var P1={type:\\\"wardley\\\",section:\\\"wardley-beta\\\",parse:(e,t,n)=>M1($1(e),n),render:v1};var Qd=class{constructor(){fe(this,\\\"type\\\",\\\"xychart\\\");fe(this,\\\"title\\\");fe(this,\\\"accTitle\\\");fe(this,\\\"accDescr\\\");fe(this,\\\"orientation\\\");fe(this,\\\"xAxis\\\",{type:\\\"band\\\",title:\\\"\\\",categories:[]});fe(this,\\\"yAxis\\\",{type:\\\"linear\\\",title:\\\"\\\",min:1/0,max:-1/0});fe(this,\\\"hasSetXAxis\\\",!1);fe(this,\\\"hasSetYAxis\\\",!1);fe(this,\\\"plots\\\",[])}setOrientation(t){this.orientation=t===\\\"horizontal\\\"?\\\"horizontal\\\":\\\"vertical\\\"}setXAxisTitle(t){this.xAxis.title=t.text.trim()}setXAxisRangeData(t,n){this.xAxis={type:\\\"linear\\\",title:this.xAxis.title,min:t,max:n},this.hasSetXAxis=!0}setXAxisBand(t){this.xAxis={type:\\\"band\\\",title:this.xAxis.title,categories:t.map(n=>n.text.trim())},this.hasSetXAxis=!0}setYAxisTitle(t){this.yAxis.title=t.text.trim()}setYAxisRangeData(t,n){this.yAxis={type:\\\"linear\\\",title:this.yAxis.title,min:t,max:n},this.hasSetYAxis=!0}plotData(t){if(t.length===0)return[];this.hasSetXAxis||this.setXAxisRangeData(1,t.length);let n=this.xAxis;if(n.type===\\\"band\\\"&&t.length>n.categories.length&&(t=t.slice(0,n.categories.length)),!this.hasSetYAxis){let{min:i,max:s}=this.yAxis;for(let a of t)a\u003Ci&&(i=a),a>s&&(s=a);this.yAxis={type:\\\"linear\\\",title:this.yAxis.title,min:i,max:s}}if(n.type===\\\"band\\\")return n.categories.map((i,s)=>[i,t[s]]);if(t.length===1)return[[`${n.min}`,t[0]]];let r=(n.max-n.min)/(t.length-1);return t.map((i,s)=>[`${n.min+s*r}`,i])}addPlot(t,n,r){let i={type:t,title:n.text.trim(),data:this.plotData(r.map(s=>s.value))};t===\\\"line\\\"&&r.some(s=>s.label.trim()!==\\\"\\\")&&(i.pointLabels=r.map(s=>s.label.trim())),this.plots.push(i)}setLineData(t,n){this.addPlot(\\\"line\\\",t,n)}setBarData(t,n){this.addPlot(\\\"bar\\\",t,n)}setDiagramTitle(t){this.title=t}setAccTitle(t){this.accTitle=t.replace(/^\\\\s+/g,\\\"\\\")}setAccDescription(t){this.accDescr=t.replace(/\\\\n\\\\s+/g,`\\r\\n`)}};var Xp=[\\\"$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\\\"];var F1=[33,33,33,33,33,19,5,7,8],B1=\\\"`)\\\"+\\\" \\\".repeat(36)+'{ this.pushstate(md_string); }\\\\n\u003Cmd_string>(?:(?!`\\\").)+'+\\\" \\\".repeat(18)+\\\"{ return md_str; }\\\\n\u003Cmd_string>(?:`\\\",qp=new Uint8Array(128);for(let[e,t]of[[\\\":\\\",21],[\\\"+\\\",22],[\\\",\\\",23],[\\\"=\\\",24],[\\\"*\\\",25],[\\\"#\\\",26],[\\\"_\\\",27],[\\\".\\\",28],[\\\"&\\\",29],[\\\"-\\\",30],[\\\";\\\",32]])qp[e.charCodeAt(0)]=t;function W1(e){let t=e.length,n=[],r=[],i=[],s=[],a=0,o=0,c=(y,E,b)=>{n.push(y),r.push(e.slice(E,b)),i.push(E),o=b},l=y=>{s.push(a),a=y},u=()=>{s.length>0&&(a=s.pop())},h=y=>{let E=e.indexOf(`\\r\\n`,y);return E===-1?t:E},d=y=>{for(;y\u003Ct&&qe(e.charCodeAt(y));)y++;return y},m=y=>{for(;xt(e.charCodeAt(y));)y++;return y},p=y=>pn(e,o,y)&&!ot(e.charCodeAt(o+y.length));for(;o\u003Ct;){let y=e.charCodeAt(o);if(a===5){if(y===34)o++,u();else{let b=e.indexOf('\\\"',o);c(19,o,b===-1?t:b)}continue}if(a===6||a===7){c(F1[a],o,h(o)),u();continue}if(a===8){if(y===125)o++,u();else{let b=e.indexOf(\\\"}\\\",o);c(8,o,b===-1?t:b)}continue}let E=e.charCodeAt(o+1);if(y===37&&E===37){o=h(o+2);continue}if(y===10||y===13){if((a===1||a===3)&&(y===10||E===10)){c(2,o,y===10?o+1:o+2),u();continue}let b=o+1;for(let S=e.charCodeAt(b);S===10||S===13;S=e.charCodeAt(++b));c(2,o,b);continue}switch(y|32){case 116:if(p(\\\"title\\\")){c(3,o,o+5);continue}break;case 97:if(pn(e,o,\\\"acc\\\")){let b=pn(e,o+3,\\\"descr\\\");if(b||pn(e,o+3,\\\"title\\\")){let S=d(o+8),x=e.charCodeAt(S);if(x===58){c(b?6:4,o,d(S+1)),l(b?7:6);continue}if(x===123&&b){o=d(S+1),l(8);continue}}}break;case 120:if(p(\\\"xychart-beta\\\")){c(9,o,o+12);continue}if(p(\\\"xychart\\\")){c(9,o,o+7);continue}if(p(\\\"x-axis\\\")){c(11,o,o+6),l(1);continue}break;case 121:if(p(\\\"y-axis\\\")){c(12,o,o+6),l(1);continue}break;case 118:if(pn(e,o,\\\"vertical\\\")){c(10,o,o+8);continue}break;case 104:if(pn(e,o,\\\"horizontal\\\")){c(10,o,o+10);continue}break;case 108:if(p(\\\"line\\\")){c(14,o,o+4),l(3);continue}break;case 98:if(p(\\\"bar\\\")){c(15,o,o+3),l(3);continue}break}if(y===91){a===1?l(2):a===3&&l(4),c(17,o,o+1);continue}if(y===93){(a===4||a===2)&&u(),c(18,o,o+1);continue}if(a===1&&y===45&&E===45&&e.charCodeAt(o+2)===62){c(13,o,o+3);continue}if(a===1||a===4){let b=y===43||y===45?o+1:o,S=e.charCodeAt(b),x=-1;if(xt(S)?(x=m(b+1),e.charCodeAt(x)===46&&xt(e.charCodeAt(x+1))&&(x=m(x+2))):S===46&&xt(e.charCodeAt(b+1))&&(x=m(b+2)),x!==-1){c(16,o,x);continue}}if(y===96&&pn(e,o,B1)){o+=B1.length,u();continue}if(y===34){o++,l(5);continue}if(Vr(y)){let b=o+1;for(;Vr(e.charCodeAt(b));)b++;c(20,o,b);continue}if(xt(y)){c(31,o,m(o+1));continue}if(qe(y)){o=d(o+1);continue}if(y\u003C128&&qp[y]!==0){c(qp[y],o,o+1);continue}break}return o\u003Ct?(n.push(1),r.push(\\\"\\\"),i.push(o),{types:n,texts:r,starts:i}):(n.push(F1[a]),r.push(\\\"\\\"),i.push(t),n.push(0),r.push(\\\"\\\"),i.push(t),{types:n,texts:r,starts:i})}function Y1(...e){let t=new Uint8Array(34);for(let n of e)t[n]=1;return t}var U1=Y1(29,31,20,22,24,25,28,26,30,27),G1=Y1(2,32,33);function H1(e,t){let{types:n,texts:r,starts:i}=W1(e),s=0,a=d=>{let m=n[s];throw m===1?ft(\\\"xychart\\\",e,i[s],\\\"\\\",!0):ft(\\\"xychart\\\",e,i[s],`Expecting ${d}, got '${Xp[m]}'`)},o=d=>(n[s]!==d&&a(`'${Xp[d]}'`),r[s++]),c=d=>d===19||U1[d]===1,l=()=>{c(n[s])||a(\\\"'STR', 'ALPHA', 'NUM'\\\");let d=r[s++];if(n[s-1]!==19)for(;U1[n[s]]===1;)d+=r[s++];return{text:d,type:\\\"text\\\"}},u=()=>{let d=Number(o(16));return o(13),[d,Number(o(16))]},h=()=>{let d=[];for(o(17);;){let m=Number(o(16));if(d.push({value:m,label:n[s]===19?r[s++]:\\\"\\\"}),n[s]!==23)break;s++}return o(18),d};for(;;)if(G1[n[s]]===1)s++;else{if(n[s]!==9)break;n[++s]===10&&t.setOrientation(r[s++])}for(;n[s]!==0;){let d=n[s++];switch(d){case 3:t.setDiagramTitle(l().text.trim());break;case 11:case 12:{let m=c(n[s])?l():void 0;if(d===11&&n[s]===17){let p=[];do s++,p.push(l());while(n[s]===23);o(18),t.setXAxisBand(p)}else if(n[s]===16||m===void 0){let[p,y]=u();d===11?t.setXAxisRangeData(p,y):t.setYAxisRangeData(p,y)}d===11?t.setXAxisTitle(m??{type:\\\"text\\\",text:\\\"\\\"}):t.setYAxisTitle(m??{type:\\\"text\\\",text:\\\"\\\"});break}case 14:case 15:{let m=n[s]===17?{text:\\\"\\\",type:\\\"text\\\"}:l(),p=h();d===14?t.setLineData(m,p):t.setBarData(m,p);break}case 4:t.setAccTitle(o(5).trim());break;case 6:t.setAccDescription(o(7).trim());break;case 8:t.setAccDescription(r[s-1].trim());break;default:s--,a(\\\"'title', 'X_AXIS', 'Y_AXIS', 'LINE', 'BAR', 'acc_title', 'acc_descr', 'acc_descr_multiline_value'\\\")}for(;G1[n[s]]===1;)s++}}function Qp(e,t){let n=e/Math.max(t,1),r=Math.floor(Math.log10(n)),i=n/10**r,s=i>=7.07?10:i>=3.16?5:i>=1.41?2:1;return r\u003C0?-(10**-r)/s:s*10**r}function za(e,t){return e>0?t/e:t*-e}function yo(e,t){return e>0?t*e:t/-e}function Zp(e,t,n){let r=Math.round(za(n,e));yo(n,r)\u003Ce&&r++;let i=Math.round(za(n,t));yo(n,i)>t&&i--;let s=[];for(let a=r;a\u003C=i&&s.length\u003C100;a++)s.push(yo(n,a));return s}var K1=4,Eo=12,z1=26,V1=24,j1=1e300;function Jp(e){return typeof e==\\\"object\\\"&&e!==null&&!Array.isArray(e)?e:{}}function ir(e,t,n=!0){let r=e[t];return typeof r==\\\"boolean\\\"?r:n}function X1(e,t){return typeof e==\\\"number\\\"&&e>0?Math.round(Math.min(Math.max(e,100),4e3)):t}function Bs(e){return typeof e==\\\"number\\\"&&isFinite(e)?Math.min(Math.max(e,-j1),j1):void 0}function LL(e){let t=0;for(let n of e)t=Math.max(t,n.label.width);return t}function Zd(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?`\u003Ctext x=\\\"${f(t)}\\\" y=\\\"${f(n+e.size*.35)}\\\" text-anchor=\\\"${r}\\\">${rt(i[0].text)}\u003C/text>`:Ne(e,t+(r===\\\"start\\\"?e.width/2:r===\\\"end\\\"?-e.width/2:0),n,\\\"\\\")}function q1(e,t,n){if(e.plots.length===0)throw new Qe(\\\"No Plot to render, please provide a plot with some data\\\",\\\"semantic\\\",{type:\\\"xychart\\\"});let r=Jp(t.xyChart),i=n.fontSize??16,s=Math.round(i*.875),a=Math.round(i*.75),o=n.measurer??ct(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=X1(r.width,700),u=gs(n,l,240),h=Math.round(X1(r.height,500)*Math.max(.6,u/l)),d=(e.orientation??r.chartOrientation)===\\\"horizontal\\\",m=ir(r,\\\"showDataLabel\\\",!1),p=e.xAxis,y=e.plots,E=($e,Ze,tt)=>Ge($e,!1,o,Ze,tt),b=E(\\\"0\\\",s,4e3).height,S=E(\\\"0\\\",a,4e3).height,x=Ge(ir(r,\\\"showTitle\\\")?e.title:void 0,!1,o,i,u-2*c,1),I=x.height>0?x.height+12:0,L=[],O=0;ir(r,\\\"showLegend\\\")&&y.forEach(($e,Ze)=>{if($e.title===\\\"\\\")return;let tt=E($e.title,s,u*.3);L.push({index:Ze,label:tt}),O=Math.max(O,tt.width+Eo+8)});let v=L.length>0?O+V1:0,G=y.filter($e=>$e.type===\\\"bar\\\").length,K=Bs(e.yAxis.min)??1/0,C=Bs(e.yAxis.max)??-1/0,Z=e.hasSetYAxis&&isFinite(K)&&isFinite(C)&&K!==C;if(!Z){K=1/0,C=-1/0;for(let $e of y)for(let[,Ze]of $e.data){let tt=Bs(Ze);tt!==void 0&&(tt\u003CK&&(K=tt),tt>C&&(C=tt))}K>C&&(K=C=0),G>0&&(K=Math.min(K,0),C=Math.max(C,0)),K===C&&(K===0?C=1:(K-=Math.abs(K)/2,C+=Math.abs(C)/2))}let oe=($e,Ze)=>{let tt=Qp(Math.abs(C-K),Math.max(2,Math.min(10,Math.floor($e/Ze))));return Z||(K=yo(tt,Math.floor(za(tt,K)+1e-9)),C=yo(tt,Math.ceil(za(tt,C)-1e-9))),Zp(Math.min(K,C),Math.max(K,C),tt).map(mt=>({at:(mt-K)/(C-K),label:E(String(mt),s,4e3)}))},H=1;if(p.type===\\\"band\\\")H=Math.max(p.categories.length,1);else for(let $e of y)H=Math.max(H,$e.data.length);let z=1/H,M=p.type===\\\"band\\\"||G>0?z/2:0,T=Bs(p.type===\\\"linear\\\"?p.min:void 0),R=Bs(p.type===\\\"linear\\\"?p.max:void 0),_=T!==void 0&&R!==void 0&&T!==R,$=($e,Ze)=>p.type===\\\"band\\\"?($e+.5)*z:M+(Ze>1?$e/(Ze-1):_?0:.5)*(1-2*M),g=Jp(r.xAxis),N=Jp(r.yAxis),w=d?g:N,A=d?N:g,D=E(ir(w,\\\"showTitle\\\")?d?p.title:e.yAxis.title:void 0,s,h*.8),U=E(ir(A,\\\"showTitle\\\")?d?e.yAxis.title:p.title:void 0,s,u*.8),B=ir(w,\\\"showTick\\\")?K1:0,F=ir(A,\\\"showTick\\\")?K1:0,W=ir(w,\\\"showLabel\\\"),j=ir(A,\\\"showLabel\\\"),Q=d?u*.3:Math.max(48,(u-2*c-64-v)*z-8),Y=p.type===\\\"band\\\"&&ir(g,\\\"showLabel\\\")?p.categories.map($e=>E($e,s,Q)):[],ne=0,q=0;for(let $e of Y)ne=Math.max(ne,$e.width),q=Math.max(q,$e.height);let k=$e=>{let Ze=[];if(p.type===\\\"band\\\"){let tt=Y.length===0?8:d?q:ne+12,mt=Math.max(1,Math.ceil(tt/($e*z)));for(let dt=0;dt\u003Cp.categories.length;dt+=mt)Ze.push({at:(dt+.5)*z,label:Y[dt]??E(void 0,s,0)})}else if(_){let tt=Qp(Math.abs(R-T),Math.max(2,Math.min(10,Math.floor($e/(d?32:80)))));for(let mt of Zp(Math.min(T,R),Math.max(T,R),tt))Ze.push({at:M+(mt-T)/(R-T)*(1-2*M),label:E(String(mt),s,4e3)})}else T!==void 0&&Ze.push({at:.5,label:E(String(T),s,4e3)});return Ze},J=0,te=0;for(let $e of y){for(let Ze of $e.pointLabels??[])J=Math.max(J,o.width(Ze,a,0));if(m&&d&&$e.type===\\\"bar\\\")for(let[,Ze]of $e.data)te=Math.max(te,o.width(String(Bs(Ze)??\\\"\\\"),a,0))}let se=j?d||p.type!==\\\"band\\\"?b:q:0,re=F+(se>0?se+4:0)+(U.height>0?U.height+4:0),P=d?0:J>0||m?S+4:W?b/2:0,ee=c+I+P,ae=Math.max(1,h-c-re-ee),ue=ee+ae,ce=d?k(ae):oe(ae,56),pe=W?LL(ce):0,V=c+(D.height>0?D.height+6:0)+(pe>0?pe+6:0)+B,X=Math.max(J>0?J+12:0,te>0?te+8:0),le=d?Math.min(u*.25,X):0,de=Math.max(1,u-c-V-v-le),Se=d?oe(de,80):k(de);if(j&&v+le===0){let $e=0;for(let Ze of Se)$e=Math.max($e,Ze.at*de+Ze.label.width/2-de);de=Math.max(1,de-$e)}let _e=V+de,xe=($e,Ze)=>d?V+Ze*de:V+$e*de,Me=($e,Ze)=>d?ee+$e*ae:ue-Ze*ae,Ce=$e=>($e-K)/(C-K),ke=$e=>Math.min(Math.max($e,0),1),be=$e=>d?`M${f(xe(0,$e))},${f(ee)}V${f(ue)}`:`M${f(V)},${f(Me(0,$e))}H${f(_e)}`,Ae=\\\"\\\";for(let $e of d?Se:ce)Ae+=be($e.at);let ie=\\\"\\\",me=\\\"\\\";ir(w,\\\"showAxisLine\\\")&&(ie+=`M${f(V)},${f(ee)}V${f(ue)}`),ir(A,\\\"showAxisLine\\\")&&(ie+=`M${f(V)},${f(ue)}H${f(_e)}`);for(let $e of ce){let Ze=d?ee+$e.at*ae:ue-$e.at*ae;B&&(ie+=`M${f(V)},${f(Ze)}h${-B}`),W&&(me+=Zd($e.label,V-B-6,Ze,\\\"end\\\"))}for(let $e of Se){let Ze=V+$e.at*de;F&&(ie+=`M${f(Ze)},${f(ue)}v${F}`),j&&(me+=Zd($e.label,Ze,ue+F+4+$e.label.height/2,\\\"middle\\\"))}let Te=(d?ae:de)*z,we=Te*.7/Math.max(G,1),Ie=G>1?Math.min(2,we*.2):0,ve=ke(Ce(0));G>0&&ve>0&&ve\u003C1&&(ie+=be(ve));let Pe=\\\"\\\",he=\\\"\\\",Re=\\\"\\\",Be=\\\"\\\",ge=0;y.forEach(($e,Ze)=>{let tt=Et(Ze),mt=$e.title?` data-id=\\\"${Ue($e.title)}\\\"`:\\\"\\\",dt=p.type===\\\"band\\\"?Math.min($e.data.length,H):$e.data.length;if($e.type===\\\"bar\\\"){let et=(ge++-(G-1)/2)*we-(we-Ie)/2,Ye=\\\"\\\";for(let He=0;He\u003Cdt;He++){let nt=Bs($e.data[He][1]);if(nt===void 0)continue;let it=$(He,dt),wt=ke(Ce(nt)),ut=Math.min(ve,wt),st=Math.max(ve,wt),pt=d?xe(it,ut):xe(it,0)+et,gt=d?Me(it,0)+et:Me(it,st),yt=d?(st-ut)*de:we-Ie,Nt=d?we-Ie:(st-ut)*ae;if(Ye+=`\u003Crect x=\\\"${f(pt)}\\\" y=\\\"${f(gt)}\\\" width=\\\"${f(yt)}\\\" height=\\\"${f(Nt)}\\\"/>`,!m)continue;let Ft=String(nt),jn=o.width(Ft,a,0),En=wt>=ve?1:-1,Sr=pt+yt/2,an=gt+Nt/2,cn=\\\"middle\\\";if(d){if(Nt\u003Ca)continue;Sr=(En>0?pt+yt:pt)+En*6,cn=En>0?\\\"start\\\":\\\"end\\\"}else{if(jn+2>Te/G)continue;an=(En>0?gt:gt+Nt)-En*(S/2+2)}Re+=`\u003Ctext x=\\\"${f(Sr)}\\\" y=\\\"${f(an+a*.35)}\\\" text-anchor=\\\"${cn}\\\">${Ft}\u003C/text>`}Pe+=`\u003Cg class=\\\"pele-series pele-bars\\\"${mt} fill=\\\"${tt}\\\">${Ye}\u003C/g>`;return}let Ee=\\\"\\\",We=\\\"\\\",De=!1,Xe=0,ze=NaN;for(let et=0;et\u003Cdt;et++){let Ye=Bs($e.data[et][1]);if(Ye===void 0){ze=NaN;continue}let He=$(et,dt),nt=Ce(Ye),it=nt>=0&&nt\u003C=1;if(ze!==ze)it&&(Ee+=`M${f(xe(He,nt))},${f(Me(He,nt))}`),De=it;else{let pt=nt-ze,gt=0,yt=1;if(pt!==0){let Nt=-ze/pt,Ft=(1-ze)/pt;gt=Math.max(gt,Math.min(Nt,Ft)),yt=Math.min(yt,Math.max(Nt,Ft))}else it||(gt=2);if(gt\u003C=yt){let Nt=Xe+(He-Xe)*gt,Ft=ze+pt*gt,jn=Xe+(He-Xe)*yt,En=ze+pt*yt;(!De||gt>0)&&(Ee+=`M${f(xe(Nt,Ft))},${f(Me(Nt,Ft))}`),Ee+=`L${f(xe(jn,En))},${f(Me(jn,En))}`}De=it}if(Xe=He,ze=nt,!it)continue;let wt=xe(He,nt),ut=Me(He,nt);Te>=12&&(We+=`\u003Ccircle cx=\\\"${f(wt)}\\\" cy=\\\"${f(ut)}\\\" r=\\\"3\\\"/>`);let st=E($e.pointLabels?.[et],a,4e3);if(st.height>0){let pt=st.width/2;Be+=d?Zd(st,wt+10,ut,\\\"start\\\"):Zd(st,Math.max(Math.min(wt,_e-pt),V+pt),ut-6-st.height/2,\\\"middle\\\")}}he+=`\u003Cg class=\\\"pele-series pele-line\\\"${mt} fill=\\\"${tt}\\\">`+(Ee?`\u003Cpath d=\\\"${Ee}\\\" fill=\\\"none\\\" stroke=\\\"${tt}\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"/>`:\\\"\\\")+We+\\\"\u003C/g>\\\"});let Le=\\\"\\\";D.height>0&&(Le+=`\u003Cg transform=\\\"translate(${f(c+D.height/2)},${f(ee+ae/2)}) rotate(-90)\\\">${Ne(D,0,0,\\\"\\\")}\u003C/g>`),Le+=Ne(U,V+de/2,h-c-U.height/2,\\\"\\\");let Fe=\\\"\\\",Ve=0;for(let $e of L)Ve+=Math.max(z1,$e.label.height+6);let Oe=ee+Math.max(0,(ae-Ve)/2),je=_e+le+V1;for(let{index:$e,label:Ze}of L){let tt=Math.max(z1,Ze.height+6);if(Oe+tt>h)break;let mt=Oe+tt/2,dt=Et($e);Fe+=`\u003Cg class=\\\"pele-legend-item\\\" data-id=\\\"${Ue(y[$e].title)}\\\">`+(y[$e].type===\\\"bar\\\"?`\u003Crect x=\\\"${f(je)}\\\" y=\\\"${f(mt-Eo/2)}\\\" width=\\\"${Eo}\\\" height=\\\"${Eo}\\\" rx=\\\"2\\\" fill=\\\"${dt}\\\"/>`:`\u003Cpath d=\\\"M${f(je)},${f(mt)}h${Eo}\\\" stroke=\\\"${dt}\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\"/>`)+Ne(Ze,je+Eo+8+Ze.width/2,mt,\\\"\\\")+\\\"\u003C/g>\\\",Oe+=tt}let Je=Ne(x,u/2,c+x.height/2,' class=\\\"pele-title\\\" font-weight=\\\"var(--_tw)\\\"')+(Ae?`\u003Cpath class=\\\"pele-grid\\\" d=\\\"${Ae}\\\" stroke=\\\"var(--_a)\\\"/>`:\\\"\\\")+`\u003Cg class=\\\"pele-plot\\\">${Pe}${he}\u003C/g>`+(ie?`\u003Cpath class=\\\"pele-axis\\\" d=\\\"${ie}\\\" fill=\\\"none\\\" stroke=\\\"var(--_b)\\\"/>`:\\\"\\\")+(me?`\u003Cg class=\\\"pele-axis-labels\\\" font-size=\\\"${s}\\\" fill=\\\"var(--_m)\\\">${me}\u003C/g>`:\\\"\\\")+(Le?`\u003Cg class=\\\"pele-axis-titles\\\" font-size=\\\"${s}\\\">${Le}\u003C/g>`:\\\"\\\")+(Re?`\u003Cg class=\\\"pele-data-labels\\\" font-size=\\\"${a}\\\">${Re}\u003C/g>`:\\\"\\\")+(Be?`\u003Cg class=\\\"pele-point-labels\\\" font-size=\\\"${a}\\\">${Be}\u003C/g>`:\\\"\\\")+(Fe?`\u003Cg class=\\\"pele-legend\\\" font-size=\\\"${s}\\\">${Fe}\u003C/g>`:\\\"\\\");return{svg:at(\\\"xychart\\\",u,h,i,n,e,Je),width:u,height:h,links:[]}}var Q1={type:\\\"xychart\\\",section:\\\"xyChart\\\",parse(e,t,n){let r=new Qd;return r.title=n,H1(e,r),r},render:q1};var Z1=[yl,L0,Oy,A0,f0,ZA,o0,ry,H0,Q1,DA,CE,lb,Ux,Jx,T0,nx,RS,zE,SA,WE,Hb,Mb,Cx,jg,hS,by,P1,Ky,b1,_1,JE,HA];wu(...Z1);return iw(OL);})();\\r\\n// Lithic: expose the global build through the module system (TW evaluates this file as a CommonJS module).\\r\\nexports.pele = pele;\"}}}"}, {"created":"20260110200357387","title":"$:/plugins/xyvir/lithic-patch-streams","author":"Xyvir","description":"Structural refinements and configuration overrides (markdown as default node) for the Streams outliner ecosystem.","name":"Streams_LithicPatch","plugin-type":"plugin","version":"0.0.13","modified":"20260110200412717","parent-plugin":"$:/plugins/sq/streams","plugin-priority":"2","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/config/sq/streams/new-node-tiddler-template\":{\"title\":\"$:/config/sq/streams/new-node-tiddler-template\",\"caption\":\"Tiddler to use as new node template\",\"description\":\"T iddler to use as a template for new nodes\",\"settings-template\":\"$:/plugins/sq/streams/ui/templates/settings/input\",\"text\":\"$:/templates/streams-markdown\"},\"$:/config/sq/streams/new-node-title\":{\"title\":\"$:/config/sq/streams/new-node-title\",\"caption\":\"Template wikified for node title\",\"description\":\"Wikitext that is wikified to generate the title for new nodes\",\"settings-template\":\"$:/plugins/sq/streams/ui/templates/settings/input\",\"tags\":\"\",\"text\":\"\u003C\u003Cstream-root-title>>@\u003C\u003Cnow \\\"hh:0mm:0ss.XXX\\\">>\"},\"$:/config/sq/streams/node-max-width\":{\"title\":\"$:/config/sq/streams/node-max-width\",\"caption\":\"Maximum node width\",\"description\":\"Maximum displayed width of a Stream node\",\"settings-template\":\"$:/plugins/sq/streams/ui/templates/settings/input\"},\"$:/config/sq/streams/swipe-contextmenu-position\":{\"title\":\"$:/config/sq/streams/swipe-contextmenu-position\",\"caption\":\"Position of context menu shown on swiping.\",\"condition\":\"[[$:/config/sq/streams/swipe-enabled]get[text]match[yes]]\",\"description\":\"Position of context menu shown on swiping.\",\"option-names\":\"[[Right]] [[Left]]\",\"option-values\":\"right left\",\"settings-group\":\"swipe\",\"settings-template\":\"$:/plugins/sq/streams/ui/templates/settings/select\",\"text\":\"left\"},\"$:/lithic/mobile-keyboard-fix\":{\"title\":\"$:/lithic/mobile-keyboard-fix\",\"tags\":\"$:/tags/RawMarkup\",\"text\":\"\u003Cscript>\\nwindow.addEventListener('keydown', function(event) {\\n if (event.keyCode === 13 && event.getModifierState && (event.getModifierState(\\\"Shift\\\") || event.getModifierState(\\\"CapsLock\\\"))) {\\n try { Object.defineProperty(event, 'shiftKey', {value: true, configurable: true}); } catch (e) {}\\n }\\n}, true);\\n\u003C/script>\\n\"},\"$:/lithic/patch/streams/cascade/body-checkbox\":{\"title\":\"$:/lithic/patch/streams/cascade/body-checkbox\",\"list-before\":\"\",\"tags\":\"$:/tags/ViewTemplateBodyFilter\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"[has[parent]!has[draft.of]then[$:/plugins/sq/streams/templates/stream-row-body]]\\n\"},\"$:/lithic/streams-contextmenu-invert.js\":{\"title\":\"$:/lithic/streams-contextmenu-invert.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/lithic/streams-contextmenu-invert.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nKeeps the streams context menu above everything drawn on the page.\\n\\nRoot cause, in two parts. TW renders a $reveal popup inside the widget that owns\\nit, so the menu is a DOM descendant of the stream row it was opened from. The\\nnotebook theme then makes every story frame its own stacking context: position\\nrelative with a z-index of 200 minus its nth-child index, so an earlier frame\\noutranks a later one. A z-index on the menu, however high, only orders it inside\\nthe frame holding it, which is why a frame could be drawn over the whole menu, and\\nwhy a missing journal's placeholder stub painted in front of it.\\n\\nFix: promote the popup into the browser's top layer with the popover API, which is\\npainted above every stacking context and cannot be re-ordered by z-index.\\npopover=\\\"manual\\\" leaves TW in charge of opening and closing the menu (no light\\ndismiss), and the DOM position is deliberately left alone: the hover preview in\\n$:/lithic/streams/styles/ctx-preview matches on the menu's ancestry\\n(.stream-root:has(.sq-contextmenu ...)), and TW removes the node through its live\\nparentNode, so nothing depends on where the node sits.\\n\\nThe menu still gets the fixed positioning and z-index below, both for browsers\\nwithout the popover API and as the state the promotion starts from.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"streams-contextmenu-invert\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n\\n // Hand the menu to the browser's top layer. Geometry is cleared first so the UA\\n // popover box (inset 0 with auto margins) cannot move or centre it; the chrome\\n // that box also brings is reset by .tc-popup[popover] in $:/lithic/streams-menu-fix.\\n // Without the popover API the positioned fallback below is all there is, which is\\n // the behaviour this module shipped before.\\n function promoteToTopLayer(node) {\\n if (typeof node.showPopover !== \\\"function\\\") return;\\n try {\\n node.setAttribute(\\\"popover\\\",\\\"manual\\\");\\n if (!node.matches(\\\":popover-open\\\")) {\\n node.showPopover();\\n }\\n } catch (err) {\\n // Already open, or refused: the fixed positioning and z-index stand.\\n }\\n }\\n\\n function fixPopup(node) {\\n if (node.nodeType !== 1 || !node.classList || !node.classList.contains(\\\"tc-popup\\\")) return;\\n if (!node.querySelector(\\\".sq-contextmenu\\\")) return;\\n\\n // If the element hasn't laid out yet, defer one frame and retry\\n var rect = node.getBoundingClientRect();\\n if (rect.width === 0 || rect.height === 0) {\\n requestAnimationFrame(function() { fixPopup(node); });\\n return;\\n }\\n\\n var sidebarWidth = 0;\\n var sidebar = document.querySelector(\\\".nc-sidebar\\\");\\n if (sidebar) sidebarWidth = sidebar.getBoundingClientRect().right;\\n\\n // Use current viewport coordinates as the basis for fixed positioning.\\n // getBoundingClientRect() gives viewport-relative coords regardless of\\n // how the element is currently positioned.\\n var left = rect.left;\\n var top = rect.top;\\n\\n // Push right if the menu overlaps the sidebar\\n if (left \u003C sidebarWidth + 4) {\\n left = sidebarWidth + 4;\\n }\\n\\n // Push left if it overflows the right viewport edge\\n if (left + rect.width > window.innerWidth - 4) {\\n left = window.innerWidth - rect.width - 4;\\n }\\n\\n // Push up if it overflows the bottom viewport edge\\n if (top + rect.height > window.innerHeight - 4) {\\n top = top - rect.height;\\n }\\n if (top \u003C 4) top = 4;\\n\\n // Position at the corrected viewport coordinates, then promote. position:fixed\\n // keeps the menu at those coordinates once it is in the top layer, which is\\n // itself contained by the viewport.\\n node.style.position = \\\"fixed\\\";\\n node.style.inset = \\\"auto\\\";\\n node.style.margin = \\\"0\\\";\\n node.style.left = left + \\\"px\\\";\\n node.style.top = top + \\\"px\\\";\\n node.style.zIndex = \\\"100000\\\";\\n promoteToTopLayer(node);\\n }\\n\\n var observer = new MutationObserver(function(mutations) {\\n mutations.forEach(function(mutation) {\\n if (mutation.type === \\\"childList\\\") {\\n mutation.addedNodes.forEach(function(node) {\\n fixPopup(node);\\n });\\n }\\n });\\n });\\n\\n observer.observe(document.body, {\\n childList: true,\\n subtree: true\\n });\\n};\\n\\n})();\"},\"$:/lithic/streams-menu-fix\":{\"title\":\"$:/lithic/streams-menu-fix\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Adapt menu text to the contrast core's menu ink. This used to hard-bind the\\n palette foreground, which defeated the contrast roles below it (an !important\\n declaration cannot be outbid by specificity) and left the hover band's ink\\n unreadable on mid-luminance primaries. Retyped to text/css because the\\n wikitext parser rewrites a literal double hyphen into an en-dash, which would\\n silently kill these var() lookups. */\\n.sq-contextmenu .tc-menu-list-item, .sq-contextmenu .tc-menu-list-item a {\\n color: var(--lithic-c-menu-fg) !important;\\n fill: var(--lithic-c-menu-fg) !important;\\n}\\n\\n/* The Notebook theme applies `animation: pop` (which uses transform: scale) to .tc-drop-down.\\n An active CSS transform creates a new stacking context, trapping the popup below the sidebar\\n even with a high z-index on the outer tc-popup wrapper. The fix is to set z-index directly\\n on the animated element (.sq-contextmenu is also .tc-drop-down) so it wins within its\\n own stacking context relative to the fixed sidebar. */\\n.sq-contextmenu {\\n z-index: 100000 !important;\\n}\\n\\n/* Belt-and-suspenders: also raise the outer tc-popup wrapper */\\n.tc-popup:has(.sq-contextmenu) {\\n z-index: 100000 !important;\\n}\\n\\n/* The wrapper above is promoted into the browser's top layer (popover=\\\"manual\\\", set by\\n $:/lithic/streams-contextmenu-invert.js), and that is what actually lifts the menu above\\n every story frame without touching any z-index on the frames. A popover also picks up the\\n UA box, and this node is only the positioning wrapper: the menu's own background, border,\\n radius and shadow live on the inner .sq-contextmenu, so the wrapper's UA box is cleared\\n here rather than letting a canvas-coloured border and padding show around it. */\\n.tc-popup[popover] {\\n border: 0;\\n padding: 0;\\n background: transparent;\\n overflow: visible;\\n color: inherit;\\n}\"},\"$:/lithic/streams/contextmenu/alpha-sort\":{\"title\":\"$:/lithic/streams/contextmenu/alpha-sort\",\"tags\":\"$:/tags/streams/contextmenu\",\"sq-contextmenu-name\":\"alphasort\",\"sq-contextmenu-name-children\":\"alphasort children\",\"sq-contextmenu-name-siblings\":\"alphasort siblings\",\"sq-contextmenu-condition\":\"[\u003CcurrentTiddler>get[stream-list]enlist-input[]count[]!match[0]] ~[\u003CcurrentTiddler>get[parent]get[stream-list]enlist-input[]is[tiddler]count[]!match[0]!match[1]]\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\\\\whitespace trim\\n\\\\define alphasort-ops()\\n\u003C$let\\n\\tsorted={{{ [enlist{!!stream-list}sort[text]join[|]] }}}\\n>\\n\\t\u003C$list filter=\\\"[enlist{!!stream-list}join[|]match\u003Csorted>]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003CcurrentTiddler>> $field=\\\"stream-list\\\" $subfilter=\\\"[sort[text]reverse[]]\\\"/>\\n\\t\u003C/$list>\\n\\t\u003C$list filter=\\\"[enlist{!!stream-list}join[|]!match\u003Csorted>]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003CcurrentTiddler>> $field=\\\"stream-list\\\" $subfilter=\\\"[sort[text]]\\\"/>\\n\\t\u003C/$list>\\n\u003C/$let>\\n\\\\end\\n\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>get[stream-list]enlist-input[]count[]!match[0]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C\u003Calphasort-ops>>\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>get[stream-list]enlist-input[]count[]match[0]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$set name=\\\"currentTiddler\\\" filter=\\\"[\u003CcurrentTiddler>get[parent]]\\\" select=\\\"0\\\">\\n\\t\\t\u003C\u003Calphasort-ops>>\\n\\t\u003C/$set>\\n\u003C/$list>\"},\"$:/lithic/streams/contextmenu/cycle-leadmark\":{\"title\":\"$:/lithic/streams/contextmenu/cycle-leadmark\",\"tags\":\"$:/tags/streams/contextmenu\",\"sq-contextmenu-name\":\"cycle leadmark\",\"sq-contextmenu-name-children\":\"cycle child leadmarks\",\"sq-contextmenu-name-siblings\":\"cycle sibling leadmarks\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\\\\whitespace trim\\n\\\\define cycle-leadmark-mass()\\n\u003C$vars\\n\\ttodo1=\\\"[ ] \\\"\\n\\ttodo2=\\\"- [ ] \\\"\\n\\tdone1=\\\"[x] \\\"\\n\\tdone2=\\\"[X] \\\"\\n\\tdone3=\\\"- [x] \\\"\\n\\tdone4=\\\"- [X] \\\"\\n\\tnum1=\\\"\u003C\u003Cnum>> \\\"\\n>\\n\\t\u003C$let\\n\\t\\tsrcTodo={{{ [\u003Csource>tag[done]then\u003Ctodo1>] ~[\u003Cdone1>] }}}\\n\\t\\tnextState={{{ [\u003Csource>get[text]prefix\u003Cnum1>then[none]] ~[\u003Csource>get[text]prefix\u003Cdone1>then\u003Cnum1>] ~[\u003Csource>get[text]prefix\u003Cdone2>then\u003Cnum1>] ~[\u003Csource>get[text]prefix\u003Cdone3>then\u003Cnum1>] ~[\u003Csource>get[text]prefix\u003Cdone4>then\u003Cnum1>] ~[\u003Csource>get[text]prefix\u003Ctodo1>then\u003CsrcTodo>] ~[\u003Csource>get[text]prefix\u003Ctodo2>then\u003CsrcTodo>] ~[\u003Ctodo1>] }}}\\n\\t>\\n\\t\\t\u003C$let\\n\\t\\t\\tt={{{ [\u003Ctarget>get[text]] }}}\\n\\t\\t\\tstripped={{{ [\u003Ct>removeprefix\u003Ctodo1>] ~[\u003Ct>removeprefix\u003Ctodo2>] ~[\u003Ct>removeprefix\u003Cdone1>] ~[\u003Ct>removeprefix\u003Cdone2>] ~[\u003Ct>removeprefix\u003Cdone3>] ~[\u003Ct>removeprefix\u003Cdone4>] ~[\u003Ct>removeprefix\u003Cnum1>] ~[\u003Ct>] }}}\\n\\t\\t>\\n\\t\\t\\t\u003C$list filter=\\\"[\u003CnextState>match[none]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003Ctarget>> text=\u003C\u003Cstripped>>/>\\n\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C$list filter=\\\"[\u003CnextState>!match[none]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003Ctarget>> text={{{ [\u003Cstripped>addprefix\u003CnextState>] }}}/>\\n\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C$action-listops $tiddler=\u003C\u003Ctarget>> $tags=\\\"-[[done]]\\\"/>\\n\\t\\t\u003C/$let>\\n\\t\u003C/$let>\\n\u003C/$vars>\\n\\\\end\\n\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>get[stream-list]enlist-input[]is[tiddler]count[]!match[0]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$let source={{{ [\u003CcurrentTiddler>get[stream-list]enlist-input[]is[tiddler]first[]] }}}>\\n\\t\\t\u003C$list filter=\\\"[enlist{!!stream-list}is[tiddler]]\\\" variable=\\\"target\\\">\\n\\t\\t\\t\u003C\u003Ccycle-leadmark-mass>>\\n\\t\\t\u003C/$list>\\n\\t\u003C/$let>\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>get[stream-list]enlist-input[]is[tiddler]count[]match[0]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$let source=\u003C\u003CcurrentTiddler>>>\\n\\t\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>get[parent]get[stream-list]enlist-input[]is[tiddler]count[]!match[0]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\\t\u003C$set name=\\\"currentTiddler\\\" filter=\\\"[\u003CcurrentTiddler>get[parent]]\\\" select=\\\"0\\\">\\n\\t\\t\\t\\t\u003C$list filter=\\\"[enlist{!!stream-list}is[tiddler]]\\\" variable=\\\"target\\\">\\n\\t\\t\\t\\t\\t\u003C\u003Ccycle-leadmark-mass>>\\n\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C/$set>\\n\\t\\t\u003C/$list>\\n\\t\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>get[parent]get[stream-list]enlist-input[]is[tiddler]count[]match[0]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>is[tiddler]]\\\" variable=\\\"target\\\">\\n\\t\\t\\t\\t\u003C\u003Ccycle-leadmark-mass>>\\n\\t\\t\\t\u003C/$list>\\n\\t\\t\u003C/$list>\\n\\t\u003C/$let>\\n\u003C/$list>\"},\"$:/lithic/streams/contextmenu/highlight\":{\"title\":\"$:/lithic/streams/contextmenu/highlight\",\"tags\":\"$:/tags/streams/contextmenu\",\"sq-contextmenu-name\":\"highlight\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\u003C$action-listops $tiddler=\u003C\u003CcurrentTiddler>> $tags=\\\"+[toggle[Highlight]]\\\"/>\\n\"},\"$:/lithic/streams/styles/ctx-preview\":{\"title\":\"$:/lithic/streams/styles/ctx-preview\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\\\\rules except dash\\n\\\\whitespace trim\\n\\\\define ctx-preview-rules()\\n.stream-row[data-node-title=\\\"{{!!current}}\\\"] .stream-node-handle .stream-node-handle-inner {\\n\\tborder-color: \u003C\u003Ccolour primary>>;\\n}\\n\\\\end\\n/* Highlight band for the context-menu preview target.\\n\\n Colors come from the contrast core (--lithic-c-notify-bg / -fg) so this band is\\n byte-identical to the context-menu target band, and its ink is contrast-locked on\\n palettes whose own notification/message pair is unreadable. Do not swap these for\\n raw palette macros: those bypass the lock and drift from the menu band.\\n\\n The rule-set pragma above is load-bearing: the core dash rule rewrites a literal\\n double hyphen into an en-dash, which silently kills every var() below, so the\\n exclusion must stay. Keep this comment AFTER the define: pragmas are only\\n recognised in the leading block, so any non-pragma content ends the pragma scan\\n and leaves the define unparsed (which leaks its \\\\end token into the CSS).\\n\\n Static fallbacks live in the lithic-core contrast stylesheet. */\\n\\n\u003C$vars currentTiddler={{{[prefix[$:/state/sq-context-popup]]}}}>\\n\u003C\u003Cctx-preview-rules>>\\n\u003C$let\\n\\tctxCurrent={{{ [\u003CcurrentTiddler>get[current]!is[blank]first[]] }}}\\n>\\n\u003C$list filter=\\\"[\u003CctxCurrent>!is[blank]]\\\" variable=\\\"_NULL\\\">\\n\u003C$list filter=\\\"[\u003CctxCurrent>get[stream-list]enlist-input[]is[tiddler]count[]!match[0]]\\\" variable=\\\"_NULL\\\">\\n\u003C$list filter=\\\"[\u003CctxCurrent>get[stream-list]enlist-input[]is[tiddler]]\\\" variable=\\\"previewNode\\\">\\n.stream-root:has(.sq-contextmenu .sq-ctx-item:hover) [data-node-title=\\\"\u003C\u003CpreviewNode>>\\\"] {\\n\\tbackground: var(--lithic-c-notify-bg);\\n\\tcolor: var(--lithic-c-notify-fg);\\n}\\n.stream-root:has(.sq-contextmenu .sq-ctx-item:hover) [data-node-title=\\\"\u003C\u003CpreviewNode>>\\\"] .stream-node-handle .stream-node-handle-inner {\\n\\tborder: 5px solid \u003C\u003Ccolour primary>>;\\n\\topacity: 1;\\n}\\n\u003C/$list>\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CctxCurrent>get[stream-list]enlist-input[]is[tiddler]count[]match[0]]\\\" variable=\\\"_NULL\\\">\\n\u003C$list filter=\\\"[\u003CctxCurrent>get[parent]get[stream-list]enlist-input[]is[tiddler]]\\\" variable=\\\"previewNode\\\">\\n.stream-root:has(.sq-contextmenu .sq-ctx-item:hover) [data-node-title=\\\"\u003C\u003CpreviewNode>>\\\"] {\\n\\tbackground: var(--lithic-c-notify-bg);\\n\\tcolor: var(--lithic-c-notify-fg);\\n}\\n.stream-root:has(.sq-contextmenu .sq-ctx-item:hover) [data-node-title=\\\"\u003C\u003CpreviewNode>>\\\"] .stream-node-handle .stream-node-handle-inner {\\n\\tborder: 5px solid \u003C\u003Ccolour primary>>;\\n\\topacity: 1;\\n}\\n\u003C/$list>\\n\u003C/$list>\\n\u003C/$list>\\n\u003C/$let>\\n\u003C/$vars>\\n\"},\"$:/lithic/streams/styles/ctxmenu-vars\":{\"title\":\"$:/lithic/streams/styles/ctxmenu-vars\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/*\\nStreams context menu -- palette contrast override.\\n\\nUpstream $:/plugins/sq/streams contextmenu-styles.css hardcodes a light theme\\n(#4b5155 text on #dce0e2 border). This sheet re-skins the same selectors from\\nthe lithic contrast core (--lithic-c-menu-*): item text, icons, hover band and\\nborders are WCAG-checked against the live palette. Specificity is kept one\\nclass above upstream so ordering does not matter.\\n*/\\n\\n/* surface */\\n.tc-drop-down.sq-contextmenu {\\n\\tbackground-color: var(--lithic-c-menu-bg);\\n\\tborder: 1px solid var(--lithic-c-menu-border);\\n\\tbox-shadow: rgba(0, 0, 0, 0.35) 0px 2px 20px;\\n}\\n\\n/* item text */\\n.tc-drop-down.sq-contextmenu .tc-menu-list-item {\\n\\tcolor: var(--lithic-c-menu-fg);\\n\\tbackground: transparent;\\n}\\n\\n/* shortcut hints / icons */\\n.tc-drop-down.sq-contextmenu .sq-contextmenu-itemicon {\\n\\tcolor: var(--lithic-c-menu-muted);\\n}\\n\\n/* hover / focused item. The ink needs !important: the base item ink is pinned\\n !important by $:/lithic/streams-menu-fix, and an !important declaration cannot\\n be outbid by specificity, so without this the hover band keeps the base ink. */\\n.tc-drop-down.sq-contextmenu .tc-menu-list-item:hover,\\n.tc-drop-down.sq-contextmenu .tc-menu-list-item:focus {\\n\\tbackground: var(--lithic-c-menu-hover-bg);\\n\\tcolor: var(--lithic-c-menu-hover-fg) !important;\\n}\\n.tc-drop-down.sq-contextmenu .tc-menu-list-item:hover .sq-contextmenu-itemicon,\\n.tc-drop-down.sq-contextmenu .tc-menu-list-item:focus .sq-contextmenu-itemicon {\\n\\tcolor: var(--lithic-c-menu-hover-fg) !important;\\n}\\n\\n/* divider */\\n.tc-drop-down.sq-contextmenu .sq-contextmenu-divider {\\n\\tborder-top-color: var(--lithic-c-menu-border);\\n}\"},\"$:/lithic/streams/styles/highlight\":{\"title\":\"$:/lithic/streams/styles/highlight\",\"tags\":\"$:/tags/Stylesheet\",\"text\":\".stream-row[data-node-tags~=\\\"Highlight\\\"] > .sq-contextmenu-container .stream-node-handle-inner {\\n background-color: \u003C\u003Ccolour primary>>;\\n border-color: \u003C\u003Ccolour primary>>;\\n}\\n\\n.stream-row[data-node-tags~=\\\"Highlight\\\"] > .stream-node-block {\\n border: 1px solid \u003C\u003Ccolour primary>>;\\n border-radius: 4px;\\n padding: 2px 6px;\\n margin-left: -7px;\\n margin-top: -3px;\\n margin-bottom: -3px;\\n}\\n\"},\"$:/lithic/streams/styles/retain-fix.css\":{\"title\":\"$:/lithic/streams/styles/retain-fix.css\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"@media screen {\\n .stream-row-children[hidden] {\\n display: none !important;\\n }\\n}\\n\\n.stream-node-handle-inner {\\n border-radius: 1.5px !important;\\n}\\n\\n/* For rich/tall stream rows, make the handle grow to fill the vertical space */\\n.stream-row-rich:not(.stream-row-editing) > .stream-node-control {\\n bottom: 0 !important; /* Stretch control to full row height */\\n align-items: flex-start !important; /* Push children to top if it's a flex container */\\n}\\n\\n.stream-row-rich:not(.stream-row-editing) .stream-node-collapser {\\n margin-top: 4px !important; /* Keep arrow aligned with text baseline */\\n}\\n\\n.stream-row-rich:not(.stream-row-editing) .stream-node-handle {\\n height: 100% !important;\\n padding-top: 4px !important;\\n padding-bottom: 25px !important;\\n box-sizing: border-box !important;\\n}\\n\\n.stream-row-rich:not(.stream-row-editing) .stream-node-handle-inner {\\n height: 100% !important;\\n width: 6px !important;\\n min-height: 6px !important;\\n border-radius: 1.5px !important;\\n}\\n\"},\"$:/plugins/sq/streams/action-macros\":{\"title\":\"$:/plugins/sq/streams/action-macros\",\"tags\":\"$:/tags/Macro\",\"text\":\"\\\\define journal-date-pattern() ^[0-9]{1,2}(st|nd|rd|th) [A-Za-z]+ [0-9]{4}$\\n\\n\\\\define scaffold-missing-refs()\\n\u003C$list filter=\\\"[{!!parent}links[]first[]]\\\" variable=\\\"parentTag\\\">\\n \u003C$list filter=\\\"[\u003CcurrentTiddler>links[]is[missing]]\\\" variable=\\\"missingLink\\\">\\n \u003C$action-createtiddler $basetitle=\u003C\u003CmissingLink>> type=\\\"text/x-markdown\\\"/>\\n \u003C$action-listops $tiddler=\u003C\u003CmissingLink>> $tags=\\\"[\u003CparentTag>]\\\"/>\\n \u003C/$list>\\n\u003C/$list>\\n\\\\end\\n\\n\\\\define swiped-right-actions()\\n\u003C$list filter=\\\"[{$:/config/sq/streams/swipe-behaviour}match[contextmenu]]\\\" variable=\\\"_NULL\\\">\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"current\\\" $value=\u003C\u003Cdom-data-node-title>>/>\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"position\\\" $value={{$:/config/sq/streams/swipe-contextmenu-position}}/>\\n\u003C$action-popup $coords=\u003C\u003Ctv-popup-abs-coords>> $state=\u003C\u003Ccontextmenu-state>>/>\\n\u003C/$list>\\n\u003C$list filter=\\\"[{$:/config/sq/streams/swipe-behaviour}match[indent]]\\\" variable=\\\"_NULL\\\">\\n\u003C$vars currentTiddler=\u003C\u003Cdom-data-node-title>>>\\n\u003C\u003Cindent-node-actions>>\\n\u003C/$vars>\\n\u003C/$list>\\n\\\\end\\n\\n\\\\define swiped-left-actions()\\n\u003C$list filter=\\\"[{$:/config/sq/streams/swipe-behaviour}match[indent]]\\\" variable=\\\"_NULL\\\">\\n\u003C$vars currentTiddler=\u003C\u003Cdom-data-node-title>>>\\n\u003C\u003Cunindent-node-actions>>\\n\u003C/$vars>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define oncontext-menu-actions()\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"current\\\" $value=\u003C\u003Cdom-data-node-title>>/>\\n\u003C$action-setfield $tiddler=\u003C\u003Ccontextmenu-state>> $field=\\\"position\\\" $value=\\\"left\\\"/>\\n\u003C$action-popup $coords=\u003C\u003Ctv-popup-abs-coords>> $state=\u003C\u003Ccontextmenu-state>>/>\\n\\\\end\\n\\n\\n\\\\define node-ctrl-btn-actions()\\n\u003C$list filter=\\\"[\u003Cdom-data-btn-role>match[stream-node-visibility]]\\\" variable=\\\"NULL\\\">\\n\u003C$action-setfield $tiddler=\u003C\u003Cdom-data-rowchildren-visibility-state>> text={{{ [\u003Cdom-data-rowchildren-visibility-state>get[text]match[hide]then[show]else[hide]] }}} />\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003Cdom-data-btn-role>match[stream-node-decorator]]\\\" variable=\\\"NULL\\\">\\n\u003C$action-navigate $to=\u003C\u003Cdom-data-node-title>>/>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define toggle-row-edit-state()\\n\u003C$action-unselect/>\\n\u003C$list filter=\\\"[\u003Crow-edit-state>get[text]else[]!match\u003Cdom-data-node-title>]\\\" variable=\\\"NULL\\\">\\n\u003C$list filter=\\\"[[$:/status/IsReadOnly]get[text]!is[blank]else[no]!match[yes]]\\\" variable=\\\"NULL\\\">\\n\\t\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003Cdom-data-node-title>> />\\n\u003C/$list>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define save-edit-node-actions()\\n\u003C\u003Cscaffold-missing-refs>>\\n\u003C$action-deletetiddler $tiddler=\u003C\u003Crow-edit-state>> />\\n\\\\end\\n\\n\\n\\\\define indent-node-actions()\\n\u003C$vars previous-node={{{ [{!!parent}get[stream-list]enlist-input[]is[tiddler]before\u003CcurrentTiddler>] }}}>\\n\u003C$list filter=\\\"[\u003Cprevious-node>minlength[1]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$action-listops $tiddler=\u003C\u003Cprevious-node>> $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] [\u003CcurrentTiddler>]\\\"/>\\n\\t\u003C$action-listops $tiddler={{!!parent}} $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] -[\u003CcurrentTiddler>]\\\"/>\\n\\t\u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> parent=\u003C\u003Cprevious-node>> />\\n\\t\u003C$list filter=\\\"[\u003Cprevious-node>links[]first[]]\\\" variable=\\\"parentTag\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003CcurrentTiddler>> $tags=\\\"[\u003CparentTag>]\\\"/>\\n\\t\u003C/$list>\\n\u003C/$list>\\n\u003C/$vars>\\n\\\\end\\n\\n\\n\\\\define unindent-node-actions()\\n\u003C$vars new-parent={{{ [{!!parent}get[parent]] }}} new-next-node={{{ [{!!parent}get[parent]get[stream-list]enlist-input[]is[tiddler]after{!!parent}] }}}>\\n \u003C$list filter=\\\"[\u003Cnew-parent>minlength[1]]\\\" variable=\\\"_NULL\\\">\\n \u003C$action-listops $tiddler=\u003C\u003Cnew-parent>> $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] +[insertbefore:new-next-node\u003CcurrentTiddler>]\\\"/>\\n \u003C$action-listops $tiddler={{!!parent}} $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] -[\u003CcurrentTiddler>]\\\"/>\\n \u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> parent=\u003C\u003Cnew-parent>> />\\n \u003C/$list>\\n\u003C/$vars>\\n\\\\end\\n\\n\\n\\\\define demote-node-actions()\\n\u003C$list filter=\\\"[{!!parent}get[stream-list]enlist-input[]after\u003CcurrentTiddler>]\\\" variable=\\\"next-node\\\">\\n \u003C$action-listops $tiddler={{!!parent}} $field=\\\"stream-list\\\" $subfilter=\\\"+[insertbefore:currentTiddler\u003Cnext-node>]\\\"/>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define promote-node-actions()\\n\u003C$list filter=\\\"[{!!parent}get[stream-list]enlist-input[]before\u003CcurrentTiddler>]\\\" variable=\\\"previous-node\\\">\\n \u003C$action-listops $tiddler={{!!parent}} $field=\\\"stream-list\\\" $subfilter=\\\"+[insertbefore:previous-node\u003CcurrentTiddler>]\\\"/>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define save-node-actions()\\n\u003C\u003Cscaffold-missing-refs>>\\n\u003C$list filter=\\\"\\\"\\\"[{$:/config/sq/streams/split-at-caret}match[yes]]\\\"\\\"\\\" variable=\\\"_NULL\\\" emptyMessage=\u003C\u003Cadd-node-actions>> >\\n\u003C$list filter=\\\"[\u003CselectionEnd>!is[blank]else[0]!match[0]]\\\" variable=\\\"_NULL\\\">\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>get[text]length[]subtract\u003CselectionEnd>!match[0]]\\\" variable=\\\"_NULL\\\" emptyMessage=\u003C\u003Cadd-node-actions>>>\\n\\t\u003C$macrocall $name=\\\"add-node-actions\\\" startText={{{[\u003CcurrentTiddler>get[text]split[]rest\u003CselectionEnd>join[]trim[]]}}} streamList={{!!stream-list}} />\u003C$vars \\n\\t todo1=\\\"[ ] \\\" todo2=\\\"- [ ] \\\" done1=\\\"[x] \\\" done2=\\\"[X] \\\" done3=\\\"- [x] \\\" done4=\\\"- [X] \\\" num1=\\\"\u003C\u003Cnum>> \\\" bullet1=\\\"- \\\" bullet2=\\\"* \\\"\\n\\t>\\n\\t\u003C$let \\n\\t tText={{{ [\u003CcurrentTiddler>get[text]] }}}\\n\\t prefixText={{{ [\u003CtText>prefix\u003Cnum1>then\u003Cnum1>] ~[\u003CtText>prefix\u003Ctodo1>then\u003Ctodo1>] ~[\u003CtText>prefix\u003Ctodo2>then\u003Ctodo2>] ~[\u003CtText>prefix\u003Cdone1>then\u003Cdone1>] ~[\u003CtText>prefix\u003Cdone2>then\u003Cdone2>] ~[\u003CtText>prefix\u003Cdone3>then\u003Cdone3>] ~[\u003CtText>prefix\u003Cdone4>then\u003Cdone4>] ~[\u003CtText>prefix\u003Cbullet1>then\u003Cbullet1>] ~[\u003CtText>prefix\u003Cbullet2>then\u003Cbullet2>] }}}\\n\\t pLen={{{ [\u003CprefixText>length[]] ~[[0]] }}}\\n\\t>\\n\\t\u003C$action-setfield $tiddler=\\\"$:/state/sq/streams/caret-position\\\" text=\u003C\u003CpLen>>/>\\n\\t\u003C/$let>\\n\\t\u003C/$vars>\\n\\t\u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> text={{{[\u003CcurrentTiddler>get[text]split[]first\u003CselectionEnd>join[]]}}} stream-list=\\\"\\\"/>\\n\u003C/$list>\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CselectionEnd>!is[blank]else[0]match[0]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>!has[text]]\\\" variable=\\\"_NULL\\\" emptyMessage=\u003C\u003Cadd-node-actions \\\"\\\" \\\"title\\\">> >\\n\\t\\t\u003C$list filter=\\\"\\\"\\\"[{$:/config/sq/streams/exit-on-saving-empty-node}match[yes]]\\\"\\\"\\\" variable=\\\"_NULL\\\" emptyMessage=\u003C\u003Cadd-node-actions>> >\\n\\t\\t\\t\u003C\u003Ccancel-edit-node-actions>>\\n\\t\\t\u003C/$list>\\n\\t\u003C/$list>\\n\u003C/$list>\\n\u003C/$list>\\n\\\\end\\n\\n\\\\define add-new-node-actions()\\n\u003C$list filter=\\\"[[$:/status/IsReadOnly]get[text]!is[blank]else[no]!match[yes]]\\\" variable=\\\"NULL\\\">\\n\u003C\u003Cadd-node-actions>>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define add-node-actions(startText:\\\"\\\",insertPosition:\\\"after\\\",streamList:\\\"\\\")\\n\u003C$set name=\\\"parent\\\" filter=\\\"[\u003CcurrentTiddler>match\u003Cstream-root-title>] ~[{!!parent}] +[first[]]\\\" select=\\\"0\\\">\\n\u003C$wikify name=\\\"new-node\\\" text={{$:/config/sq/streams/new-node-title}}>\\n\u003C$wikify name=\\\"new-node\\\" text={{{[[\u003C\u003Cunusedtitle \\\"\\\"\\\"]addsuffix\u003Cnew-node>addsuffix[\\\"\\\"\\\">>]]}}}>\\n\u003C$vars \\n todo1=\\\"[ ] \\\" \\n todo2=\\\"- [ ] \\\" \\n done1=\\\"[x] \\\" \\n done2=\\\"[X] \\\" \\n done3=\\\"- [x] \\\" \\n done4=\\\"- [X] \\\"\\n num1=\\\"\u003C\u003Cnum>> \\\"\\n bullet1=\\\"- \\\"\\n bullet2=\\\"* \\\"\\n>\\n\u003C$let \\n tText={{{ [\u003CcurrentTiddler>get[text]] }}}\\n prefixText={{{ [\u003CtText>prefix\u003Cnum1>then\u003Cnum1>] ~[\u003CtText>prefix\u003Ctodo1>then\u003Ctodo1>] ~[\u003CtText>prefix\u003Ctodo2>then\u003Ctodo2>] ~[\u003CtText>prefix\u003Cdone1>then\u003Cdone1>] ~[\u003CtText>prefix\u003Cdone2>then\u003Cdone2>] ~[\u003CtText>prefix\u003Cdone3>then\u003Cdone3>] ~[\u003CtText>prefix\u003Cdone4>then\u003Cdone4>] ~[\u003CtText>prefix\u003Cbullet1>then\u003Cbullet1>] ~[\u003CtText>prefix\u003Cbullet2>then\u003Cbullet2>] }}}\\n actualStartText={{{ [\u003C__startText__>match[]then\u003CprefixText>] ~[\u003C__startText__>!match[]then\u003C__startText__>] }}}\\n>\\n\\t\u003C$action-createtiddler $basetitle=\u003C\u003Cnew-node>> text=\u003C\u003CactualStartText>> $template={{$:/config/sq/streams/new-node-tiddler-template}} parent=\u003C\u003Cparent>> stream-type=\\\"default\\\" stream-list=\u003C\u003C__streamList__>>/>\\n\\t\u003C$list filter=\\\"[\u003Cparent>links[]first[]]\\\" variable=\\\"parentTag\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003Cnew-node>> $tags=\\\"[\u003CparentTag>]\\\"/>\\n\\t\u003C/$list>\\n\\t\u003C$set name=\\\"parent-nodes\\\" filter=\\\"[\u003Cparent>get[stream-list]]\\\" select=\\\"0\\\">\\n\\t\u003C$set name=\\\"next-node\\\" filter=\\\"[enlist\u003Cparent-nodes>is[tiddler]$insertPosition$\u003CcurrentTiddler>]\\\" select=\\\"0\\\">\\n\\t\u003C$vars datePattern=\u003C\u003Cjournal-date-pattern>>>\\n\\t\u003C$list filter=\\\"[\u003Cparent>is[missing]regexp\u003CdatePattern>]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003Cparent>> $tags=\\\"Journal\\\"/> \u003C$action-setfield $tiddler=\u003C\u003Cparent>> raw-date=\u003C\u003Cdatecode \\\"parent\\\">> stream-type=\\\"default\\\" stream-list=\\\"\\\"/>\\n\\t\u003C/$list>\\n\\t\u003C/$vars>\\n\\t\u003C$action-listops $tiddler=\u003C\u003Cparent>> $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] +[insertbefore:next-node\u003Cnew-node>]\\\"/>\\n\\t\u003C$list filter=\\\"[\u003Cparent>!has[stream-type]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-setfield $tiddler=\u003C\u003Cparent>> stream-type=\\\"default\\\"/>\\n\\t\u003C/$list>\\n\\t\u003C$list filter=\\\"[enlist\u003C__streamList__>]\\\">\\n\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> parent=\u003C\u003Cnew-node>>/>\\n\\t\u003C/$list>\\n\\t\u003C/$set>\\n\\t\u003C/$set>\\n\\t\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003Cnew-node>>/>\\n\u003C/$let>\\n\u003C/$vars>\\n\u003C/$wikify>\\n\u003C/$wikify>\\n\u003C/$set>\\n\\\\end\\n\\n\\n\\\\define add-child-node-actions(startText:\\\"\\\",streamList:\\\"\\\")\\n\u003C$wikify name=\\\"new-node\\\" text={{$:/config/sq/streams/new-node-title}}>\\n\u003C$wikify name=\\\"new-node\\\" text={{{[[\u003C\u003Cunusedtitle \\\"\\\"\\\"]addsuffix\u003Cnew-node>addsuffix[\\\"\\\"\\\">>]]}}}>\\n\u003C$vars \\n todo1=\\\"[ ] \\\" \\n todo2=\\\"- [ ] \\\" \\n done1=\\\"[x] \\\" \\n done2=\\\"[X] \\\" \\n done3=\\\"- [x] \\\" \\n done4=\\\"- [X] \\\"\\n num1=\\\"\u003C\u003Cnum>> \\\"\\n bullet1=\\\"- \\\"\\n bullet2=\\\"* \\\"\\n>\\n\u003C$let \\n tText={{{ [\u003CcurrentTiddler>get[text]] }}}\\n prefixText={{{ [\u003CtText>prefix\u003Cnum1>then\u003Cnum1>] ~[\u003CtText>prefix\u003Ctodo1>then\u003Ctodo1>] ~[\u003CtText>prefix\u003Ctodo2>then\u003Ctodo2>] ~[\u003CtText>prefix\u003Cdone1>then\u003Cdone1>] ~[\u003CtText>prefix\u003Cdone2>then\u003Cdone2>] ~[\u003CtText>prefix\u003Cdone3>then\u003Cdone3>] ~[\u003CtText>prefix\u003Cdone4>then\u003Cdone4>] ~[\u003CtText>prefix\u003Cbullet1>then\u003Cbullet1>] ~[\u003CtText>prefix\u003Cbullet2>then\u003Cbullet2>] }}}\\n actualStartText={{{ [\u003C__startText__>match[]then\u003CprefixText>] ~[\u003C__startText__>!match[]then\u003C__startText__>] }}}\\n>\\n\\t\u003C$action-createtiddler $basetitle=\u003C\u003Cnew-node>> text=\u003C\u003CactualStartText>> $template={{$:/config/sq/streams/new-node-tiddler-template}} parent=\u003C\u003CcurrentTiddler>> stream-type=\\\"default\\\" stream-list=\u003C\u003C__streamList__>>/>\\n\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>links[]first[]]\\\" variable=\\\"parentTag\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003Cnew-node>> $tags=\\\"[\u003CparentTag>]\\\"/>\\n\\t\u003C/$list>\\n\\t\u003C$set name=\\\"first-child\\\" filter=\\\"[\u003CcurrentTiddler>get[stream-list]enlist-input[]is[tiddler]first[]]\\\" select=\\\"0\\\">\\n\\t\u003C$vars datePattern=\u003C\u003Cjournal-date-pattern>>>\\n\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>is[missing]regexp\u003CdatePattern>]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003CcurrentTiddler>> $tags=\\\"Journal\\\"/> \u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> raw-date=\u003C\u003Cdatecode \\\"currentTiddler\\\">> stream-type=\\\"default\\\" stream-list=\\\"\\\"/>\\n\\t\u003C/$list>\\n\\t\u003C/$vars>\\n\\t\u003C$action-listops $tiddler=\u003C\u003CcurrentTiddler>> $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] +[insertbefore:first-child\u003Cnew-node>]\\\"/>\\n\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>!has[stream-type]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> stream-type=\\\"default\\\"/>\\n\\t\u003C/$list>\\n\\t\u003C$list filter=\\\"[enlist\u003C__streamList__>]\\\">\\n\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> parent=\u003C\u003Cnew-node>>/>\\n\\t\u003C/$list>\\n\\t\u003C/$set>\\n\\t\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003Cnew-node>>/>\\n\\t\u003C$action-setfield $tiddler={{{ [[$:/state/sq/streams/visibility/]addsuffix\u003CcurrentTiddler>] }}} text=\\\"show\\\"/>\\n\u003C/$let>\\n\u003C/$vars>\\n\u003C/$wikify>\\n\u003C/$wikify>\\n\\\\end\\n\\n\\n\\\\define save-multiple-actions()\\n\u003C$action-confirm $message=\\\"Split into multiple nodes?\\\" $prompt={{$:/config/sq/streams/prompt-split-to-multiple}}>\\n\u003C$list filter=\\\"[{!!text}splitregexp{$:/config/sq/streams/node-split-regexp}rest[]reverse[]]\\\" variable=\\\"fragment\\\">\\n\\t\u003C$action-confirm $message=\\\"Split into multiple nodes?\\\" $prompt=\\\"no\\\">\\n\\t\\t\u003C$macrocall $name=\\\"add-node-actions\\\" startText=\u003C\u003Cfragment>> />\\n\\t\u003C/$action-confirm>\\n\u003C/$list>\\n\u003C$action-setfield $tiddler=\u003C\u003CcurrentTiddler>> text={{{[{!!text}splitregexp{$:/config/sq/streams/node-split-regexp}first[]]}}}/>\\n\u003C\u003Cadd-node-actions>>\\n\u003C/$action-confirm>\\n\\\\end\\n\\n\\n\\\\define cancel-edit-node-actions()\\n\u003C$vars \\n todo1=\\\"[ ] \\\" todo2=\\\"- [ ] \\\" done1=\\\"[x] \\\" done2=\\\"[X] \\\" done3=\\\"- [x] \\\" done4=\\\"- [X] \\\" num1=\\\"\u003C\u003Cnum>> \\\" bullet1=\\\"- \\\" bullet2=\\\"* \\\"\\n>\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>!has[stream-list]!has[text]] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Cnum1>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Ctodo1>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Ctodo2>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Cdone1>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Cdone2>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Cdone3>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Cdone4>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Cbullet1>] [\u003CcurrentTiddler>!has[stream-list]get[text]match\u003Cbullet2>]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$action-listops $tiddler={{{[{!!parent}]}}} $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] -[\u003CcurrentTiddler>]\\\"/>\\n\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CcurrentTiddler>> />\\n\u003C/$list>\\n\u003C/$vars>\\n\u003C$action-deletetiddler $tiddler=\u003C\u003Crow-edit-state>> />\\n\\\\end\\n\\n\\n\\\\define merge-with-previous-node-actions()\\n\u003C$list filter=\\\"\\\"\\\"[\u003CcurrentTiddler>!has[text]]\\\"\\\"\\\" variable=\\\"_NULL\\\">\\n\\t\u003C\u003Ccancel-edit-node-actions>>\\n\\t\u003C\u003Cfocus-higher-node-actions>>\\n\u003C/$list>\\n\\n\u003C$list filter=\\\"\\\"\\\"[\u003CcurrentTiddler>has[text]]\\\"\\\"\\\" variable=\\\"_NULL\\\">\\n\u003C$list filter=\\\"[\u003CselectionEnd>match[0]]\\\" variable=\\\"_NULL\\\">\\n\\n\u003C$set name=\\\"parent\\\" value={{!!parent}} select=\\\"0\\\">\\n\\t\u003C$set name=\\\"stream-list\\\" filter=\\\"[\u003Cparent>get[stream-list]]\\\" select=\\\"0\\\">\\n\\t\u003C$list filter=\\\"[enlist\u003Cstream-list>before\u003CcurrentTiddler>]\\\" variable=\\\"previous-node\\\">\\n\\t\\t\u003C$list filter=\\\"[\u003Cprevious-node>!has[stream-list]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-confirm $message=\\\"Merge with previous node?\\\" $prompt={{$:/config/sq/streams/prompt-merge-with-previous}}>\\n\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/sq/streams/caret-position\\\" text={{{[\u003Cprevious-node>get[text]length[]]}}}/>\\n\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003Cprevious-node>> text={{{[\u003Cprevious-node>get[text]!is[blank]else[]addsuffix{!!text}]}}} stream-list={{!!stream-list}}/>\\n\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003Cprevious-node>>/>\\n\\t\\t\\t\u003C$action-listops $tiddler={{!!parent}} $field=\\\"stream-list\\\" $subfilter=\\\"+[is[tiddler]] -[\u003CcurrentTiddler>]\\\"/>\\t\\t\\t\\n\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CcurrentTiddler>>/>\\n\\t\\t\u003C/$action-confirm>\\t\\n\\t\\t\u003C/$list>\\n\\t\u003C/$list>\\n\\t\u003C/$set>\\n\\t\u003C/$set>\\n\\t\\n\u003C/$list>\\n\u003C/$list>\\n\\n\\\\end\\n\\n\\n\\\\define delete-node-actions()\\n\u003C$action-confirm $message=\\\"Do you wish to delete this tiddler?\\\">\\n\\t\u003C$transclude tiddler=\\\"$:/plugins/sq/streams/delete-hook/actions\\\"/>\\n\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CcurrentTiddler>> />\\n\\t\u003C$list filter=\\\"[\u003Crow-edit-state>get[text]match\u003CcurrentTiddler>]\\\">\\n\\t\\t\u003C\u003Cfocus-higher-node-actions>>\\n\\t\u003C/$list>\\n\u003C/$action-confirm>\\n\\\\end\\n\\n\\n\\\\define rename-node-actions()\\n\u003C$action-withinput message=\\\"Rename this tiddler?\\\" default=\u003C\u003CcurrentTiddler>> actions=\\\"\\\"\\\"\\n\\t\u003C$action-sendmessage $message=\\\"tm-rename-tiddler\\\" from=\u003C\u003CcurrentTiddler>> to=\u003C\u003CuserInput>>/>\\n\\t\u003C$list filter=\\\"[\u003Crow-edit-state>match\u003CcurrentTiddler>]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003CuserInput>>/>\\n\\t\u003C/$list>\\n\\\"\\\"\\\"/>\\n\\\\end\\n\\n\\n\\\\define find-last-child()\\n\u003C$list filter=\\\"[enlist{!!stream-list}is[tiddler]last[]]\\\" emptyMessage=\\\"\\\"\\\"\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003CcurrentTiddler>>/>\\\"\\\"\\\">\\n\\t\u003C$macrocall $name=\\\"find-last-child\\\"/>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define focus-higher-node-actions()\\n\u003C$vars old-parent={{!!parent}} >\\n\u003C$list filter=\\\"[{!!parent}get[stream-list]enlist-input[]is[tiddler]before\u003CcurrentTiddler>]\\\" emptyMessage=\\\"\\\"\\\"\u003C$list filter=\\\"[\u003Cold-parent>!match\u003Cstream-root-title>]\\\">\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003Cold-parent>> />\u003C/$list>\\\"\\\"\\\">\\n\\t\u003C$macrocall $name=\\\"find-last-child\\\"/>\\n\u003C/$list>\\n\u003C/$vars>\\n\\\\end\\n\\n\\n\\\\define find-next-downwards-node()\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>has[parent]]\\\" variable=\\\"_NULL\\\">\\n\u003C$set name=\\\"old-parent\\\" value={{!!parent}} select=\\\"0\\\">\\n\u003C$set name=\\\"old-parent-nodes\\\" filter=\\\"[\u003Cold-parent>get[stream-list]]\\\" select=\\\"0\\\">\\n\u003C$list filter=\\\"[enlist\u003Cold-parent-nodes>is[tiddler]after\u003CcurrentTiddler>]\\\" emptyMessage=\\\"\\\"\\\"\u003C$set name=\\\"currentTiddler\\\" value=\u003C\u003Cold-parent>>>\u003C\u003Cfind-next-downwards-node>>\u003C/$set>\\\"\\\"\\\">\\n\\t\u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003CcurrentTiddler>>/>\\t\\n\u003C/$list>\\n\u003C/$set>\\n\u003C/$set>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define focus-lower-node-actions()\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>get[stream-list]enlist-input[]is[tiddler]first[]]\\\" variable=\\\"next-node\\\">\\n \u003C$action-setfield $tiddler=\u003C\u003Crow-edit-state>> text=\u003C\u003Cnext-node>> />\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CcurrentTiddler>!has[stream-list]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$set name=\\\"old-active-node\\\" value=\u003C\u003CcurrentTiddler>> >\\n\\t\\t\u003C\u003Cfind-next-downwards-node>>\\n\\t\u003C/$set>\\n\u003C/$list>\\n\\\\end\\n\\n\\n\\\\define node-drag-start-actions()\\n\u003C$action-setfield $tiddler=\u003C\u003Cdrag-title-state>> text=\u003C\u003CcurrentTiddler>>/>\\n\u003C$action-setfield $tiddler=\\\"$:/state/sq/nodes/global-drag-state\\\" text=\\\"yes\\\"/>\\n\u003C$set name=\\\"siblings\\\" filter=\\\"[{!!parent}get[stream-list]]\\\" select=\\\"0\\\">\\n\u003C$list filter=\\\"[enlist\u003Csiblings>after\u003CcurrentTiddler>]\\\" variable=\\\"next-node\\\">\\n\\t\u003C$action-setfield $tiddler=\u003C\u003Cdrag-title-nextsibling-state>> text=\u003C\u003Cnext-node>> />\\n\u003C/$set>\\n\\\\end\\n\\n\\n\\\\define node-drag-end-actions()\\n\u003C$action-deletetiddler $filter=\\\"\\\"\\\"[\u003Cdrag-title-state>][\u003Cdrag-title-nextsibling-state>][[$:/state/sq/nodes/global-drag-state]]\\\"\\\"\\\" />\\n\\\\end\\n\\n\\n\\\\define stream-drop-actions()\\n\u003C$vars startBrackets=\\\"[[\\\" endBrackets=\\\"]]\\\" parent=\u003C\u003CdropTargetTiddler>> >\\n\u003C$vars actionTiddler={{{[\u003CactionTiddler>trim:suffix\u003CendBrackets>trim:prefix\u003CstartBrackets>]}}}>\\n\u003C$list filter=\\\"[\u003CdropTargetTiddler>!has[stream-type]]\\\">\\n\\t\u003C$action-setfield $tiddler=\u003C\u003CdropTargetTiddler>> stream-type=\\\"default\\\"/>\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CactionTiddler>!has[stream-type]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$action-setfield $tiddler=\u003C\u003CactionTiddler>> stream-type=\\\"default\\\" />\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CactionTiddler>get[parent]!match\u003Cparent>] [\u003CactionTiddler>!has[parent]]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$wikify name=\\\"new-node\\\" text={{$:/config/sq/streams/new-node-title}}>\\n\\t\\t\u003C$list filter=\\\"[\u003Cmodifier>match{$:/config/sq/streams/dnd-modifier-copy-node}]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\\t\u003C$action-createtiddler $basetitle=\u003C\u003Cnew-node>> text={{{ [\u003CactionTiddler>get[text]] }}} parent=\u003C\u003Cparent>> stream-type=\\\"default\\\"/>\\n\\t\\t\\t\u003C$action-listops $tiddler=\u003C\u003CdropTargetTiddler>> $field=\\\"stream-list\\\" $subfilter=\\\"+[insertbefore:currentTiddler\u003Cnew-node>]\\\"/>\\n\\t\\t\u003C/$list>\\n\\t\\t\u003C$list filter=\\\"[\u003Cmodifier>match{$:/config/sq/streams/dnd-modifier-transclude-node}]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\\t\u003C$action-createtiddler $basetitle=\u003C\u003Cnew-node>> text={{{ [\u003CactionTiddler>addprefix[{{]addsuffix[}}]] }}} parent=\u003C\u003Cparent>> stream-type=\\\"default\\\"/>\\n\\t\\t\\t\u003C$action-listops $tiddler=\u003C\u003CdropTargetTiddler>> $field=\\\"stream-list\\\" $subfilter=\\\"+[insertbefore:currentTiddler\u003Cnew-node>]\\\"/>\\n\\t\\t\u003C/$list>\\n\\t\u003C/$wikify>\\n\\t\u003C$list filter=\\\"[\u003Cmodifier>match[normal]]\\\" variable=\\\"_NULL\\\">\\n\\t\\t\u003C$action-listops $tiddler=\u003C\u003CdropTargetTiddler>> $field=\\\"stream-list\\\" $subfilter=\\\"+[insertbefore:currentTiddler\u003CactionTiddler>]\\\"/>\\n\\t\\t\u003C$set name=\\\"original-parent\\\" filter=\\\"[\u003CactionTiddler>get[parent]]\\\" select=\\\"0\\\">\\n\\t\\t\\t\u003C$action-listops $tiddler=\u003C\u003Coriginal-parent>> $field=\\\"stream-list\\\" $subfilter=\\\"-[title\u003CactionTiddler>]\\\"/>\\n\\t\\t\u003C/$set>\\n\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CactionTiddler>> parent=\u003C\u003Cparent>>/>\\n\\t\u003C/$list>\\n\u003C/$list>\\n\u003C$list filter=\\\"[\u003CactionTiddler>get[parent]match\u003Cparent>]\\\" variable=\\\"_NULL\\\">\\n\\t\u003C$action-listops $tiddler=\u003C\u003CdropTargetTiddler>> $field=\\\"stream-list\\\" $subfilter=\\\"+[insertbefore:currentTiddler\u003CactionTiddler>]\\\"/>\\n\u003C/$list>\\n\u003C/$vars>\\n\u003C/$vars>\\n\\\\end\"},\"$:/plugins/sq/streams/contextmenu/contextmenu-template\":{\"title\":\"$:/plugins/sq/streams/contextmenu/contextmenu-template\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\\\\define menu-item(title,subtitle:\\\"\\\",actions:\\\"\\\",ctxclass:\\\"\\\")\\n\\t\\t\u003C$button class={{{ tc-menu-list-item tc-btn-invisible [\u003C__ctxclass__>match[yes]then[sq-ctx-item]] +[join[ ]] }}}\\n\\t\\t\\tactions=\u003C\u003C__actions__>> >\\n\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003Ccontextmenu-state>>/>\\n\\t\\t\\t\u003Cspan class=\\\"sq-contextmenu-itemwrapper\\\">\\n\\t\\t\\t\\t\u003Cspan class=\\\"sq-contextmenu-itemtext\\\">$title$\u003C/span>\\n\\t\\t\\t\\t\u003Cspan class=\\\"sq-contextmenu-itemicon\\\">\u003C$macrocall $name=\\\"displayshortcuts\\\" $output=\\\"text/plain\\\" shortcuts=\\\"$subtitle$\\\" prefix=\\\"\\\" separator=\\\" \\\" suffix=\\\"\\\"/>\u003C/span>\\n\\t\\t\\t\u003C/span>\\n\\t\\t\u003C/$button>\\n\\\\end\\n\\n\\\\define menu-divider() \u003Cdiv class=\\\"sq-contextmenu-divider\\\"/>\\n\\n\u003C$reveal type=\\\"popup\\\" state=\u003C\u003Ccontextmenu-state>> position={{{[\u003Ccontextmenu-state>get[position]]}}} tag=\\\"div\\\">\\n\\t\u003Cdiv class={{{tc-drop-down sq-contextmenu [\u003Ccontextmenu-state>get[position]match[right]then[sq-contextmenu-alignright]else[]] +[join[ ]]}}}>\\n\\t\\t\u003C$macrocall $name=\\\"menu-item\\\" title=\\\"insert node above\\\" actions=\\\"\\\"\\\"\u003C$macrocall $name=\\\"add-node-actions\\\" insertPosition=\\\"match\\\"/>\\\"\\\"\\\" />\\n\\t\\t\u003C$macrocall $name=\\\"menu-item\\\" title=\\\"insert subnode below\\\" actions=\\\"\\\"\\\"\u003C$macrocall $name=\\\"add-child-node-actions\\\"/>\\\"\\\"\\\" />\\n\\t\\t\u003C$macrocall $name=\\\"menu-item\\\" title=\\\"rename\\\" subtitle=\\\"((streams-rename))\\\" actions=\u003C\u003Crename-node-actions>>/>\\n\\t\\t\u003C$let\\n\\t\\t\\tctxChildCount={{{ [\u003CcurrentTiddler>get[stream-list]enlist-input[]count[]] }}}\\n\\t\\t\\tctxPeersCount={{{ [\u003CcurrentTiddler>get[parent]get[stream-list]enlist-input[]is[tiddler]count[]] }}}\\n\\t\\t\\tctxLabelKey={{{ [\u003CctxChildCount>!match[0]then[sq-contextmenu-name-children]] ~[\u003CctxPeersCount>match[1]then[sq-contextmenu-name]] ~[\u003CctxPeersCount>match[0]then[sq-contextmenu-name]] ~[[sq-contextmenu-name-siblings]] }}}\\n\\t\\t>\\n\\t\\t\\t\u003C$list filter=\\\"[all[shadows+tiddlers]tag[$:/tags/streams/contextmenu]]\\\" variable=\\\"listItem\\\">\\n\\t\\t\\t\\t\u003C$list filter={{{[\u003ClistItem>get[sq-contextmenu-condition]else[yes]]}}} variable=\\\"condResult\\\">\\n\\t\\t\\t\\t\\t\u003C$macrocall $name=\\\"menu-item\\\"\\n\\t\\t\\t\\t\\t\\ttitle={{{ [\u003ClistItem>get\u003CctxLabelKey>] ~[\u003ClistItem>get[sq-contextmenu-name]] +[first[]] }}}\\n\\t\\t\\t\\t\\t\\tsubtitle={{{[\u003ClistItem>get[key]] [\u003ClistItem>get[sq-contextmenu-subtitle]] +[first[]]}}} \\n\\t\\t\\t\\t\\t\\tactions={{{[\u003ClistItem>get[text]]}}}\\n\\t\\t\\t\\t\\t\\tctxclass={{{[\u003ClistItem>get[sq-contextmenu-name-children]!is[blank]then[yes]]}}} />\\n\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C/$list>\\n\\t\\t\u003C/$let>\\n\\t\u003C/div>\\n\u003C/$reveal>\"},\"$:/plugins/sq/streams/editor-template\":{\"title\":\"$:/plugins/sq/streams/editor-template\",\"tags\":\"\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\\\\define config-visibility-title()\\n$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$\\n\\\\end\\n\\\\whitespace trim\\n\\n\u003C$set name=\\\"isPreview\\\" value={{{ [[$:/state/showeditpreview]get[text]] ~[[no]] }}}>\\n\u003Cdiv class={{{ [[streams-unieditor-wrapper preview-]addsuffix\u003CisPreview>] }}}>\\n\\t\u003C$edit-uni \\n\\t\\ttiddler=\u003C\u003CcurrentTiddler>> \\n\\t\\tfield=\\\"text\\\" \\n\\t\\tfocus=\\\"yes\\\" \\n\\t\\tclass=\\\"streams-editor tc-edit-texteditor tc-edit-texteditor-body\\\"\\n\\t>\\n\\t\\t\u003C$set name=\\\"targetTiddler\\\" value=\u003C\u003CcurrentTiddler>>>\\n\\t\\t\\t\u003Cdiv class=\\\"tc-editor-toolbar\\\">\\n\\t\\t\\t\\t\u003C$list filter=\\\"[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]\\\">\\n\\t\\t\\t\\t\\t\u003C$reveal type=\\\"nomatch\\\" state=\u003C\u003Cconfig-visibility-title>> text=\\\"hide\\\" class=\\\"tc-text-editor-toolbar-item-wrapper\\\">\\n\\t\\t\\t\\t\\t\\t\u003C$transclude tiddler=\\\"$:/core/ui/EditTemplate/body/toolbar/button\\\" mode=\\\"inline\\\"/>\\n\\t\\t\\t\\t\\t\u003C/$reveal>\\n\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C/div>\\n\\t\\t\u003C/$set>\\n\\t\u003C/$edit-uni>\\n\\t\u003C$reveal state=\\\"$:/state/showeditpreview\\\" type=\\\"match\\\" text=\\\"yes\\\">\\n\\t\\t\u003Cdiv class=\\\"tc-tiddler-preview streams-preview\\\">\\n\\t\\t\\t\u003C$transclude tiddler=\u003C\u003CcurrentTiddler>> mode=\\\"block\\\" />\\n\\t\\t\u003C/div>\\n\\t\u003C/$reveal>\\n\u003C/div>\\n\u003C/$set>\\n\"},\"$:/plugins/sq/streams/keyboard-shortcuts/indent-node\":{\"title\":\"$:/plugins/sq/streams/keyboard-shortcuts/indent-node\",\"key\":\"((streams-indent))\",\"sq-contextmenu-name\":\"indent\",\"sq-contextmenu-subtitle\":\"\",\"tags\":\"$:/tags/streams/keyboard-shortcuts $:/tags/streams/contextmenu\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\u003C\u003Cindent-node-actions>>\"},\"$:/plugins/sq/streams/keyboard-shortcuts/shift-escape\":{\"title\":\"$:/plugins/sq/streams/keyboard-shortcuts/shift-escape\",\"tags\":\"$:/tags/streams/keyboard-shortcuts\",\"key\":\"shift-escape\",\"text\":\"\u003C\u003Ccancel-edit-node-actions>>\\n\"},\"$:/plugins/sq/streams/keyboard-shortcuts/unindent-node\":{\"title\":\"$:/plugins/sq/streams/keyboard-shortcuts/unindent-node\",\"key\":\"((streams-unindent))\",\"sq-contextmenu-name\":\"un-indent\",\"sq-contextmenu-subtitle\":\"\",\"tags\":\"$:/tags/streams/keyboard-shortcuts $:/tags/streams/contextmenu\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"\u003C\u003Cunindent-node-actions>>\"},\"$:/plugins/sq/streams/streams-edit\":{\"title\":\"$:/plugins/sq/streams/streams-edit\",\"module-type\":\"widget-subclass\",\"type\":\"application/javascript\",\"text\":\"/*\\\\\\n\\ntitle: $:/plugins/sq/streams/streams-edit\\ntype: application/javascript\\nmodule-type: widget-subclass\\n\\n\\\\*/\\n\\nexports.baseClass = \\\"edit\\\";\\nexports.name = \\\"streams-edit\\\";\\n\\nexports.constructor = function(parseTreeNode,options) {\\n\\tthis.initialise(parseTreeNode,options);\\n}\\nexports.prototype = {};\\n\\nexports.prototype.getEditorType = function() {\\n var EDITOR_MAPPING_PREFIX = \\\"$:/config/EditorTypeMappings/\\\";\\n var tiddler = this.wiki.getTiddler(this.editTitle);\\n\\tvar type = (tiddler && tiddler.fields && tiddler.fields.type) || \\\"text/vnd.tiddlywiki\\\";\\n\\tvar editorType;\\n\\tif(type === \\\"text/vnd.tiddlywiki\\\") {\\n\\t\\teditorType = this.wiki.getTiddlerText(\\\"$:/config/sq/streams/editor-engine\\\");\\n\\t\\tif((!$tw.wiki.getTiddler(\\\"$:/plugins/tiddlywiki/codemirror\\\") || $tw.wiki.getTiddlerText(\\\"$:/config/Plugins/Disabled/$:/plugins/tiddlywiki/codemirror\\\",\\\"no\\\") === \\\"yes\\\" || !$tw.modules.titles[\\\"$:/plugins/tiddlywiki/codemirror/edit-codemirror.js\\\"]) && (editorType === \\\"codemirror\\\") ) {\\n\\t\\t\\teditorType = \\\"text\\\";\\n\\t\\t}\\n\\t\\treturn editorType;\\n\\t}\\n\\teditorType = this.wiki.getTiddlerText(EDITOR_MAPPING_PREFIX + type);\\n\\tif(!editorType) {\\n\\t\\tvar typeInfo = $tw.config.contentTypeInfo[type];\\n\\t\\tif(typeInfo && typeInfo.encoding === \\\"base64\\\") {\\n\\t\\t\\teditorType = \\\"binary\\\";\\n\\t\\t} else {\\n\\t\\t\\teditorType = \\\"text\\\";\\n\\t\\t}\\n\\t}\\n\\treturn editorType;\\n};\"},\"$:/plugins/sq/streams/templates/stream-row-body\":{\"title\":\"$:/plugins/sq/streams/templates/stream-row-body\",\"tags\":\"\",\"text\":\"\u003C$vars \\n todo1=\\\"[ ] \\\" \\n todo2=\\\"- [ ] \\\" \\n done1=\\\"[x] \\\" \\n done2=\\\"[X] \\\" \\n done3=\\\"- [x] \\\" \\n done4=\\\"- [X] \\\"\\n>\\n\\n\u003C$list filter=\\\"[all[current]get[text]prefix\u003Ctodo1>] [all[current]get[text]prefix\u003Ctodo2>]\\\" variable=\\\"null\\\">\\n \u003Cdiv class=\\\"lithic-checkbox\\\" style=\\\"display:flex; align-items:flex-start;\\\">\\n \u003Cdiv style=\\\"margin-right:6px; margin-top:2px;\\\">\\n \u003C$checkbox tag=\\\"done\\\"/>\\n \u003C/div>\\n \\n \u003Cdiv style={{{ [all[current]tag[done]then[flex:1; text-decoration:line-through; opacity:0.6;]else[flex:1;]] }}}>\\n \u003C$let itemText={{{ [{!!text}removeprefix\u003Ctodo1>] ~[{!!text}removeprefix\u003Ctodo2>] }}}>\\n \u003C$transclude $variable=\\\"itemText\\\"/>\\n \u003C/$let>\\n \u003C/div>\\n \u003C/div>\\n\u003C/$list>\\n\\n\u003C$list filter=\\\"[all[current]get[text]prefix\u003Cdone1>] [all[current]get[text]prefix\u003Cdone2>] [all[current]get[text]prefix\u003Cdone3>] [all[current]get[text]prefix\u003Cdone4>]\\\" variable=\\\"null\\\">\\n \u003Cdiv class=\\\"lithic-checkbox\\\" style=\\\"display:flex; align-items:flex-start; opacity:0.6;\\\">\\n \u003Cdiv style=\\\"margin-right:6px; margin-top:2px;\\\">\\n \u003Cinput type=\\\"checkbox\\\" checked disabled>\\n \u003C/div>\\n \u003Cdiv style=\\\"flex:1; text-decoration: line-through;\\\">\\n \u003C$let itemText={{{ [{!!text}removeprefix\u003Cdone1>] ~[{!!text}removeprefix\u003Cdone2>] ~[{!!text}removeprefix\u003Cdone3>] ~[{!!text}removeprefix\u003Cdone4>] }}}>\\n \u003C$transclude $variable=\\\"itemText\\\"/>\\n \u003C/$let>\\n \u003C/div>\\n \u003C/div>\\n\u003C/$list>\\n\\n\u003C$list filter=\\\"[all[current]get[text]!prefix\u003Ctodo1>!prefix\u003Ctodo2>!prefix\u003Cdone1>!prefix\u003Cdone2>!prefix\u003Cdone3>!prefix\u003Cdone4>]\\\" variable=\\\"null\\\">\\n \u003C$list filter=\\\"[all[current]type[application/tldr]]\\\" variable=\\\"null\\\">\\n \u003C$whiteboard tiddler=\u003C\u003CcurrentTiddler>> height=\\\"540px\\\" readonly=\\\"yes\\\"/>\\n \u003C/$list>\\n \u003C$list filter=\\\"[all[current]!type[application/tldr]]\\\" variable=\\\"null\\\">\\n \u003C$transclude field=\\\"text\\\" mode=\\\"block\\\"/>\\n \u003C/$list>\\n\u003C/$list>\\n\\n\u003C/$vars>\"},\"$:/plugins/sq/streams/templates/stream-row-template\":{\"title\":\"$:/plugins/sq/streams/templates/stream-row-template\",\"tags\":\"tiddlystudy\",\"text\":\"\\\\whitespace trim\\n\u003C$qualify\\n\\tname=\\\"row-children-visibility-state\\\"\\n\\ttitle={{{ [[$:/state/sq/streams/visibility/]addsuffix\u003CcurrentTiddler>] }}}\\n>\\n\u003C$droppable \\n\\tactions=\u003C\u003Cstream-drop-actions>>\\n\\ttag=\\\"div\\\"\\n\\tclass={{{ stream-droppable [list[!!stream-list]is[tiddler]then[]else[stream-row-nochildren]] +[join[ ]]}}}\\n\\tenable={{{[\u003Cdrag-title-nextsibling-state>get[text]match\u003CcurrentTiddler>then[no]] ~[\u003Cenable-dnd>]}}}\\n\\tdisabledClass=\\\"stream-node-disabled\\\"\\n\\tdata-node-title=\u003C\u003CcurrentTiddler>>\\n>\\n\\t\u003Cdiv class=\\\"tc-droppable-placeholder\\\"/>\\n\\t\\n \u003Cdiv class={{{ stream-row [\u003Crow-children-visibility-state>get[text]match[hide]then[stream-row-children-collapsed]] [\u003CcurrentTiddler>get[text]regexp[\\\\n]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]search:text[\u003C\u003C]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]search:text[\u003C]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]search:text[{{]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]prefix[!]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]prefix[#]then[stream-row-rich]] [\u003CcurrentTiddler>type[application/tldr]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]regexp[\\\\[img]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]prefix[- ]then[stream-row-rich]] [\u003CcurrentTiddler>get[text]prefix[* ]then[stream-row-rich]] [\u003Crow-edit-state>get[text]match\u003CcurrentTiddler>then[stream-row-editing]] +[unique[]join[ ]]}}}\\n\\t\\tstyle=\\\"position: relative;\\\"\\n data-node-title=\u003C\u003CcurrentTiddler>>\\n\\t\\tdata-node-tags={{!!tags}}\\n\\t>\\n\\t\\t\u003C$draggable\\n\\t\\t\\ttag=\\\"div\\\"\\n\\t\\t\\ttiddler=\u003C\u003CcurrentTiddler>>\\n\\t\\t\\tstartactions=\u003C\u003Cnode-drag-start-actions>>\\n\\t\\t\\tendactions=\u003C\u003Cnode-drag-end-actions>>\\n\\t\\t\\tclass=\\\"stream-node-control sq-contextmenu-container\\\"\\n\\t\\t\\tdata-node-title=\u003C\u003CcurrentTiddler>>\\n\\t\\t>\\n\\t\\t\\t\u003Cbutton type=\\\"button\\\" class=\\\"tc-btn-invisible stream-node-ctrl-btn stream-node-collapser\\\" data-btn-role=\\\"stream-node-visibility\\\" data-rowchildren-visibility-state=\u003C\u003Crow-children-visibility-state>>>\\n\\t\\t\\t\\t{{$:/plugins/sq/streams/icons/node-expand-arrow}}\\n\\t\\t\\t\u003C/button>\\n\\t\\t\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>type[application/tldr]]\\\" variable=\\\"null\\\">\\n\\t\\t\\t\\t\u003C$button\\n\\t\\t\\t\\t\\tclass=\\\"tc-btn-invisible stream-node-handle stream-node-ctrl-btn\\\"\\n\\t\\t\\t\\t\\ttitle={{{ [\u003CcurrentTiddler>split[@]last[]] }}}\\n\\t\\t\\t\\t\\tdata-btn-role=\\\"stream-node-decorator\\\"\\n\\t\\t\\t\\t\\tdata-node-title=\u003C\u003CcurrentTiddler>>\\n\\t\\t\\t\\t\\ttooltip=\\\"Open in Whiteboard\\\"\\n\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/sidebar\\\" text=\\\"no\\\"/>\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/notebook-sidebar\\\" text=\\\"no\\\"/>\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/WhiteBoard\\\"/>\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\u003C\u003CcurrentTiddler>>/>\\n\\t\\t\\t\\t\\t\u003Cdiv class=\\\"stream-node-handle-inner\\\"/>\\n\\t\\t\\t\\t\u003C/$button>\\n\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C$list filter=\\\"[\u003CcurrentTiddler>!type[application/tldr]]\\\" variable=\\\"null\\\">\\n\\t\\t\\t\\t\u003Cdiv class=\\\"stream-node-handle tc-btn-invisible stream-node-ctrl-btn\\\" title={{{ [\u003CcurrentTiddler>split[@]last[]] }}} data-btn-role=\\\"stream-node-decorator\\\" data-node-title=\u003C\u003CcurrentTiddler>>>\\n\\t\\t\\t\\t\\t\u003Cdiv class=\\\"stream-node-handle-inner\\\"/>\\n\\t\\t\\t\\t\u003C/div>\\n\\t\\t\\t\u003C/$list>\\n\\n \u003C$list filter=\\\"[\u003CstoryTiddler>tag[Journal]]\\\" variable=\\\"ignore\\\">\\n \u003C$let \\n parent={{{ [\u003CcurrentTiddler>get[parent]] }}}\\n next-node={{{ [\u003Cparent>get[stream-list]enlist-input[]after\u003CcurrentTiddler>] }}}\\n \\n time-str-1={{{ [\u003CcurrentTiddler>split[@]last[]trim[]] }}}\\n h1={{{ [\u003Ctime-str-1>split[:]nth[1]trim[]] }}}\\n m1={{{ [\u003Ctime-str-1>split[:]nth[2]trim[]] }}}\\n total-1={{{ [\u003Ch1 >multiply[60]add\u003Cm1>] }}}\\n \\n time-str-2={{{ [\u003Cnext-node>split[@]last[]trim[]] }}}\\n h2={{{ [\u003Ctime-str-2>split[:]nth[1]trim[]] }}}\\n m2={{{ [\u003Ctime-str-2>split[:]nth[2]trim[]] }}}\\n total-2={{{ [\u003Ch2 >multiply[60]add\u003Cm2>] }}}\\n \\n diff={{{ [\u003Ctotal-2>subtract\u003Ctotal-1>abs[]] }}}\\n dropped={{{ [\u003Cdiff>divide[10]floor[]multiply[10]] }}}\\n chunks={{{ [\u003Cdropped>divide[30]round[]] }}}\\n \\n raw-result={{{ [\u003Cchunks>divide[2]fixed[1]] }}}\\n >\\n \u003C$list filter=\\\"[\u003Ctotal-1>!match[0]] :filter[\u003Ctotal-2>!match[0]] :filter[\u003Craw-result>!match[0.0]]\\\">\\n \u003Cdiv style=\\\"position: absolute; bottom: 2px; right: 1em; text-align: right; pointer-events: none; line-height: 1;\\\">\\n \u003Ccode style=\\\"font-size: 0.9em; padding: 1px 4px; border-radius: 4px; opacity: 0.8;\\\">\\n \u003Cspan style=\\\"margin-right: 1px;\\\">⏱\u003C/span>\\n \u003C$text text={{{ [\u003Craw-result>search-replace[.5],[ ½]trim:suffix[.0]trim:prefix[0]] }}} />\\n \u003C/code>\\n \u003C/div>\\n \u003C/$list>\\n \u003C/$let>\\n \u003C/$list>\\n \u003C$list filter=\\\"[\u003Crow-edit-state>get[text]match\u003CcurrentTiddler>]\\\" variable=\\\"none\\\">\\n \u003C$button \\n class=\\\"tc-btn-invisible stream-node-ctrl-btn\\\" \\n style=\\\"position: absolute; bottom: 2px; left: 0; width: 2em; text-align: center; height:auto; opacity:0.7; z-index: 10; transform: translate(1em, -1.5em);\\\" \\n tooltip=\\\"Done\\\" \\n aria-label=\\\"Finish Editing\\\"\\n >\\n \u003C\u003Ccancel-edit-node-actions>>\\n ✔\\n \u003C/$button>\\n \u003C/$list>\\n \u003C/$draggable>\\n\\t\\t\u003Cdiv class=\\\"stream-node-block\\\">\\n\\t\\t\\t\u003C$list filter=\\\"[\u003Crow-edit-state>get[text]!is[blank]else[]match\u003CcurrentTiddler>]\\\" variable=\\\"NULL\\\" emptyMessage=\\\"\\\"\\\"{{||$:/plugins/sq/streams/templates/stream-row-body}}\\\"\\\"\\\">\\n\\t\\t\\t\\t\u003C$keyboard-plus shortcutTag=\\\"$:/tags/streams/keyboard-shortcuts\\\">\\n\\t\\t\\t\\t\\t{{||$:/plugins/sq/streams/editor-template}}\\n\\t\\t\\t\\t\u003C/$keyboard-plus>\\t\\t\\t\\n\\t\\t\\t\u003C/$list>\\n {{||$:/plugins/kebi/tiddlystudy-references/filters-node}}\\n\\t\\t\u003C/div>\\n\\t\u003C/div>\\n\u003C/$droppable>\\n\u003C$reveal\\n\\ttag=\\\"div\\\"\\n\\ttype=\\\"nomatch\\\"\\n\\tstateTitle=\u003C\u003Crow-children-visibility-state>>\\n\\ttext=\\\"hide\\\"\\n\\tclass=\\\"stream-row-children\\\"\\n\\tretain=\\\"yes\\\"\\n>\\n\\t\\t{{||$:/plugins/sq/streams/templates/stream-root-template}}\\n\u003C/$reveal>\\n\u003C/$qualify>\\n\"},\"$:/templates/streams-markdown\":{\"title\":\"$:/templates/streams-markdown\",\"tags\":\"\",\"type\":\"text/x-markdown\",\"text\":\"\"}}}"}, -{"created":"20260110200549392","title":"$:/plugins/xyvir/lithic-patch-whiteboard","author":"Xyvir","description":"Integration logic and UI enhancements for whiteboard and freehand drawing tools within the Story River.","plugin-type":"plugin","version":"0.0.1","modified":"20260110230834139","parent-plugin":"$:/plugins/linonetwo/tw-whiteboard","plugin-priority":"2","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/DefaultCanvas\":{\"title\":\"$:/DefaultCanvas\",\"type\":\"application/tldr\",\"text\":\"{\\\"document\\\":{\\\"id\\\":\\\"doc\\\",\\\"name\\\":\\\"$:/DefaultCanvas\\\",\\\"version\\\":15.5,\\\"pages\\\":{\\\"page\\\":{\\\"id\\\":\\\"page\\\",\\\"name\\\":\\\"Page 1\\\",\\\"childIndex\\\":1,\\\"shapes\\\":{},\\\"bindings\\\":{}}},\\\"pageStates\\\":{\\\"page\\\":{\\\"id\\\":\\\"page\\\",\\\"selectedIds\\\":[],\\\"camera\\\":{\\\"point\\\":[0,0],\\\"zoom\\\":1}}},\\\"assets\\\":{}},\\\"updatedCount\\\":70}\"},\"$:/Lithic/Macros/draw\":{\"title\":\"$:/Lithic/Macros/draw\",\"tags\":\"$:/tags/Global\",\"text\":\"\\\\procedure draw(id, height:\\\"540px\\\")\\n\u003C$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [\u003Cid>removeprefix\u003Cleft>removesuffix\u003Cright>] ~[\u003Cid>] }}}\\n>\\n\u003C$vars boardTitle={{{ [\u003Cclean>!is[blank]] ~[\u003CcurrentTiddler>addsuffix[-draw]] }}}>\\n\u003Cdiv \\n class=\\\"tc-tiddler-frame lithic-inline-board\\\" \\n data-tiddler-title=\u003C\u003CboardTitle>> \\n style=\\\"border:none; box-shadow:none; background:none; padding:0; margin:0; position:relative;\\\"\\n>\\n \u003Cdiv class=\\\"tc-tiddler-body\\\" style=\\\"padding:0; margin:0; border:none;\\\">\\n \u003C$reveal state=\\\"$:/state/Lithic/BootComplete\\\" type=\\\"match\\\" text=\\\"yes\\\" default=\\\"no\\\">\\n \u003C$whiteboard tiddler=\u003C\u003CboardTitle>> height=\u003C\u003Cheight>> />\\n \u003C/$reveal>\\n \u003C/div>\\n\u003C/div>\\n\u003C/$vars>\\n\u003C/$let>\\n\\\\end\"},\"$:/Lithic/Macros/wb-image\":{\"title\":\"$:/Lithic/Macros/wb-image\",\"tags\":\"$:/tags/Macro\",\"text\":\"\\\\define wb-image(board, width:\\\"80%\\\")\\n\u003C$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [\u003C__board__>removeprefix\u003Cleft>removesuffix\u003Cright>] ~[\u003C__board__>] }}}\\n>\\n\u003C$wb-image board=\u003C\u003Cclean>> width=\u003C\u003C__width__>> />\\n\u003C/$let>\\n\\\\end\\n\"},\"$:/Lithic/Patches/AutoCloseKeepOpen.js\":{\"title\":\"$:/Lithic/Patches/AutoCloseKeepOpen.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/AutoCloseKeepOpen.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nWatches for the Text tool's specific style options (Align/Font) and automatically \\nturns off \\\"Keep Style Menu Open\\\" to prevent the shape.id crash bug.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-auto-close-keep-open\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n \\n function disableKeepOpen() {\\n var clicked = false;\\n \\n // 1. Check Preferences Menu Button by ID\\n var keepOpenBtn = document.getElementById('TD-Styles-Keep-Open');\\n if (keepOpenBtn && (keepOpenBtn.getAttribute('data-state') === 'checked' || keepOpenBtn.getAttribute('aria-checked') === 'true')) {\\n keepOpenBtn.click();\\n clicked = true;\\n }\\n \\n // 2. Check Palette Menu option by text\\n var spans = document.querySelectorAll('.tw-whiteboard-tldraw-container span');\\n for (var i = 0; i \u003C spans.length; i++) {\\n if (spans[i].textContent === \\\"Keep Style Menu Open\\\" || spans[i].textContent === \\\"Keep Open\\\") {\\n var wrapper = spans[i].closest('button, .c-kuOiws');\\n if (wrapper && wrapper.id !== 'TD-Styles-Keep-Open') {\\n // Look for the checked state\\n if (wrapper.querySelector('[data-state=\\\"checked\\\"]') || wrapper.getAttribute('data-state') === 'checked') {\\n wrapper.click();\\n clicked = true;\\n }\\n }\\n }\\n }\\n \\n if (clicked) {\\n setTimeout(function() {\\n var escEvent = new KeyboardEvent('keydown', {\\n key: 'Escape',\\n code: 'Escape',\\n keyCode: 27,\\n which: 27,\\n bubbles: true,\\n cancelable: true\\n });\\n document.dispatchEvent(escEvent);\\n }, 10);\\n }\\n }\\n\\n if (typeof document !== \\\"undefined\\\") {\\n var observer = new MutationObserver(function(mutations) {\\n // If the specific Text tool UI is present in the DOM\\n if (document.getElementById('TD-Styles-Align-Container')) {\\n disableKeepOpen();\\n }\\n });\\n \\n // Observe the document body for any DOM additions/removals\\n observer.observe(document.body, { childList: true, subtree: true });\\n }\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/BootDelay/StartupScript.js\":{\"title\":\"$:/Lithic/Patches/BootDelay/StartupScript.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/BootDelay/StartupScript.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nSets a state flag after the TiddlyWiki boot sequence is completely finished.\\nThis flag is used to delay the rendering of React widgets (like the whiteboard)\\nto prevent them from interfering with TiddlyWiki's initial core DOM setup.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-boot-delay-flag\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n // Wait a brief moment after the synchronous startup completes\\n // to ensure the DOM is fully settled.\\n setTimeout(function() {\\n $tw.wiki.setText(\\\"$:/state/Lithic/BootComplete\\\", \\\"text\\\", null, \\\"yes\\\");\\n console.log(\\\"[Lithic] Boot sequence completely settled. BootComplete flag set to 'yes'.\\\");\\n }, 250);\\n};\\n\\n})();\\n\"},\"$:/Lithic/Patches/IsolateDoubleClicks\":{\"title\":\"$:/Lithic/Patches/IsolateDoubleClicks\",\"module-type\":\"startup\",\"tags\":\"\",\"type\":\"application/javascript\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/IsolateDoubleClicks\\ntype: application/javascript\\nmodule-type: startup\\n\\nPrevents double-click events inside the Tldraw widget from bubbling up \\nand triggering the Streams \\\"double click to edit\\\" action.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-isolate-double-clicks\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n\\n var addIsolation = function (node) {\\n // Avoid attaching twice\\n if (node.dataset.lithicDblClickIsolated) return;\\n\\n // Listen for double clicks and kill them before they bubble to Streams\\n node.addEventListener('dblclick', function (e) {\\n e.stopPropagation();\\n // console.log(\\\"🛡️ Lithic: Stopped double-click from triggering Streams.\\\");\\n }, false); // Bubble phase\\n\\n node.dataset.lithicDblClickIsolated = \\\"active\\\";\\n };\\n\\n // Watch for new Tldraw containers appearing in the DOM\\n var observer = new MutationObserver(function (mutations) {\\n mutations.forEach(function (mutation) {\\n mutation.addedNodes.forEach(function (node) {\\n if (node.nodeType !== 1) return;\\n\\n // 1. Check if the added node IS the container\\n if (node.classList.contains('tw-whiteboard-tldraw-container')) {\\n addIsolation(node);\\n }\\n // 2. Check if the container is INSIDE the added node\\n else if (node.querySelector) {\\n var containers = node.querySelectorAll('.tw-whiteboard-tldraw-container');\\n for (var i = 0; i \u003C containers.length; i++) {\\n addIsolation(containers[i]);\\n }\\n }\\n });\\n });\\n });\\n\\n if (document.body) {\\n observer.observe(document.body, { childList: true, subtree: true });\\n }\\n };\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nAction widget to dispatch a synthetic paste event containing the comptext input to Tldraw.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar ActionDispatchPaste = function(parseTreeNode,options) {\\n this.initialise(parseTreeNode,options);\\n};\\n\\nActionDispatchPaste.prototype = new Widget();\\n\\nActionDispatchPaste.prototype.render = function(parent,nextSibling) {\\n this.computeAttributes();\\n this.execute();\\n};\\n\\nActionDispatchPaste.prototype.execute = function() {\\n this.tiddlerName = this.getAttribute(\\\"tiddler\\\", \\\"$:/temp/whiteboard-comptext-input\\\");\\n this.boardStateTiddler = \\\"$:/state/Whiteboard/PageLayout/tiddler\\\";\\n};\\n\\nActionDispatchPaste.prototype.refresh = function(changedTiddlers) {\\n var changedAttributes = this.computeAttributes();\\n if(changedAttributes.tiddler) {\\n this.refreshSelf();\\n return true;\\n }\\n return this.refreshChildren(changedTiddlers);\\n};\\n\\n// Generates a random UUID v4 ending with 'c001' so we can target it via CSS\\nfunction generateUUID() {\\n var base = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxc001'.replace(/[xy]/g, function(c) {\\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\\n return v.toString(16);\\n });\\n return base;\\n}\\n\\nActionDispatchPaste.prototype.invokeAction = function(triggeringWidget,event) {\\n var text = $tw.wiki.getTiddlerText(this.tiddlerName);\\n if (!text) return true; // nothing to paste\\n\\n // Determine which whiteboard is currently active\\n var currentBoard = $tw.wiki.getTiddlerText(this.boardStateTiddler);\\n if (!currentBoard) {\\n // Fallback to the first whiteboard modified\\n var tiddlers = $tw.wiki.filterTiddlers(\\\"[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]\\\");\\n if (tiddlers.length > 0) currentBoard = tiddlers[0];\\n }\\n \\n if (!currentBoard) return true;\\n\\n var boardText = $tw.wiki.getTiddlerText(currentBoard);\\n if (!boardText) return true;\\n\\n try {\\n var data = JSON.parse(boardText);\\n var page = data.document.pages.page;\\n \\n // Find the highest childIndex\\n var maxIndex = 0;\\n for (var shapeId in page.shapes) {\\n var shape = page.shapes[shapeId];\\n if (shape.childIndex > maxIndex) maxIndex = shape.childIndex;\\n }\\n\\n var newShapeId = generateUUID();\\n \\n // Create the new sticky note\\n var newShape = {\\n id: newShapeId,\\n type: \\\"sticky\\\",\\n name: \\\"Sticky\\\",\\n parentId: \\\"page\\\",\\n childIndex: maxIndex + 1,\\n point: [200, 200], // We can spawn it top-left or try to center it\\n size: [300, 300],\\n text: text,\\n rotation: 0,\\n style: {\\n color: \\\"black\\\",\\n size: \\\"small\\\",\\n isFilled: false,\\n dash: \\\"draw\\\",\\n scale: 1,\\n font: \\\"sans\\\",\\n textAlign: \\\"middle\\\"\\n }\\n };\\n\\n // Center it around the camera if possible\\n if (data.pageStates && data.pageStates.page && data.pageStates.page.camera) {\\n var cam = data.pageStates.page.camera.point;\\n newShape.point = [-(cam[0]) + 300, -(cam[1]) + 300];\\n }\\n\\n page.shapes[newShapeId] = newShape;\\n\\n // Write it back to the tiddler\\n $tw.wiki.setText(currentBoard, \\\"text\\\", null, JSON.stringify(data));\\n\\n } catch(e) {\\n console.error(\\\"Failed to inject shape into whiteboard JSON\\\", e);\\n }\\n\\n return true; // Action was invoked\\n};\\n\\nexports[\\\"action-dispatch-paste\\\"] = ActionDispatchPaste;\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/ComptextBridge.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/ComptextBridge.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/ComptextBridge.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nListens for hotkeys (/, [, {) to trigger the floating Comptext UI in the whiteboard.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-comptext-bridge\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n if (typeof window === \\\"undefined\\\" || typeof $tw === \\\"undefined\\\") return;\\n\\n window.addEventListener('keydown', function(event) {\\n // Check if we are in the whiteboard\\n var whiteboardContainer = document.querySelector('.tw-whiteboard-layout-container');\\n if (!whiteboardContainer) return;\\n\\n // Do not trigger if a modal or popup is already open\\n var isPopupOpen = $tw.wiki.getTiddlerText(\\\"$:/state/Whiteboard/ComptextPopup\\\") === \\\"open\\\";\\n if (isPopupOpen) return;\\n\\n // Check if the user is typing in an input field or contenteditable (e.g. existing sticky note)\\n var active = document.activeElement;\\n if (active) {\\n var tag = active.tagName.toUpperCase();\\n if (tag === 'INPUT' || tag === 'TEXTAREA' || active.isContentEditable) {\\n return;\\n }\\n }\\n\\n // Detect hotkeys\\n var key = event.key;\\n if (key === '/' || key === '[' || key === '{') {\\n // Prevent default Tldraw behaviors or scrolling\\n event.preventDefault();\\n event.stopPropagation();\\n\\n var prefill = key;\\n if (key === '[') prefill = '[[';\\n if (key === '{') prefill = '{{';\\n\\n // Set the temporary text\\n $tw.wiki.setText(\\\"$:/temp/whiteboard-comptext-input\\\", \\\"text\\\", null, prefill);\\n \\n // Open the popup\\n $tw.wiki.setText(\\\"$:/state/Whiteboard/ComptextPopup\\\", \\\"text\\\", null, \\\"open\\\");\\n\\n // We need to focus the edit-text widget. We can do it by waiting for the DOM to update.\\n setTimeout(function() {\\n var input = document.querySelector('.lithic-floating-comptext-input');\\n if (input) {\\n input.focus();\\n // Move cursor to the end\\n input.setSelectionRange(prefill.length, prefill.length);\\n }\\n }, 100);\\n }\\n }, true); // Use capture phase so Tldraw doesn't swallow it first!\\n\\n window.addEventListener('click', function(event) {\\n // Intercept clicks on the \\\"Insert Media\\\" button in Tldraw\\n var mediaBtn = event.target.closest('#TD-PrimaryTools-Image');\\n if (mediaBtn) {\\n event.preventDefault();\\n event.stopPropagation();\\n\\n // Clear the input and open the popup\\n $tw.wiki.setText(\\\"$:/temp/whiteboard-comptext-input\\\", \\\"text\\\", null, \\\"\\\");\\n $tw.wiki.setText(\\\"$:/state/Whiteboard/ComptextPopup\\\", \\\"text\\\", null, \\\"open\\\");\\n\\n // Focus the input\\n setTimeout(function() {\\n var input = document.querySelector('.lithic-floating-comptext-input');\\n if (input) {\\n input.focus();\\n }\\n }, 100);\\n }\\n }, true);\\n\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nSimulates a click on the tldraw trash can icon when the Delete or Backspace key is pressed,\\nas TiddlyWiki or Streams sometimes swallows keyboard shortcuts.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-delete-simulator\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n if (typeof document !== \\\"undefined\\\") {\\n document.addEventListener('keydown', function(e) {\\n // Only respond to Delete or Backspace\\n if (e.key !== 'Delete' && e.key !== 'Backspace') return;\\n \\n console.log(\\\"[DeleteSimulator] Caught key:\\\", e.key, \\\"Target:\\\", e.target);\\n \\n if (!e.target) return;\\n \\n // Ignore if typing in an input\\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.isContentEditable) {\\n console.log(\\\"[DeleteSimulator] Ignored because target is input/textarea/contenteditable.\\\");\\n return;\\n }\\n \\n // Also ignore if inside the tldraw text editor container\\n if (typeof e.target.closest === 'function') {\\n if (e.target.closest('.tl-text-editor') || e.target.closest('.c-fOQRlS') || e.target.closest('.tl-absolute')) {\\n console.log(\\\"[DeleteSimulator] Ignored because target is inside tldraw text editor.\\\");\\n return;\\n }\\n }\\n \\n var deleteBtnWrapper = document.getElementById('TD-Delete');\\n if (deleteBtnWrapper) {\\n console.log(\\\"[DeleteSimulator] Found #TD-Delete wrapper in DOM.\\\");\\n var deleteBtn = deleteBtnWrapper.querySelector('button');\\n if (deleteBtn) {\\n console.log(\\\"[DeleteSimulator] Found button inside wrapper! Dispatching pointerdown and click...\\\");\\n \\n var eventInit = { bubbles: true, cancelable: true, button: 0 };\\n deleteBtn.dispatchEvent(new PointerEvent('pointerdown', eventInit));\\n deleteBtn.dispatchEvent(new MouseEvent('mousedown', eventInit));\\n deleteBtn.dispatchEvent(new PointerEvent('pointerup', eventInit));\\n deleteBtn.dispatchEvent(new MouseEvent('mouseup', eventInit));\\n deleteBtn.click();\\n \\n e.preventDefault();\\n e.stopPropagation();\\n } else {\\n console.log(\\\"[DeleteSimulator] ERROR: Could not find \u003Cbutton> inside #TD-Delete\\\");\\n }\\n } else {\\n console.log(\\\"[DeleteSimulator] #TD-Delete not found in DOM.\\\");\\n }\\n }, true); // Use capture phase to act before other handlers\\n }\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/FirstVisitFit.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/FirstVisitFit.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/FirstVisitFit.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nThe first time a page is opened it is fitted to its content, not to the\\ncamera it was saved with.\\n\\ntldraw keeps a camera per page inside the document, so a board reopened on a\\npage you once zoomed into comes back at that zoom. That is right for a page\\nyou have already read and wrong for one you have not: a freshly imported PDF\\nopens at whatever the importer's own camera happened to be, at 100% on one\\ncorner of a sheet. So the first visit to a page in a session runs the board's\\nown zoomToFit, and every later visit leaves the saved camera alone, which is\\nwhat makes flipping back to a page you were working on land where you left it.\\n\\nBoth ways in end in the same fact, which is why one tracker covers them: the\\nlayout's board selector loads a whole different document into the widget, and\\nthe page controls change the page within it, so watching the document and the\\npage together catches a change of either.\\n\\nOnly the fullscreen layout is tracked. An inline board in the story river is\\nthe same tiddler drawn small, and fitting there would spend the page's first\\nvisit on a 540px board and then open the layout zoomed out to fit a strip.\\n\\nThe camera is moved through zoomToFit rather than recomputed here, so this is\\nthe same fit the View menu's Zoom to Fit performs, and it is saved the way any\\nother camera change is.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-first-visit-fit\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\n// The layout's own board, never an inline one from the story river.\\nvar BOARD_SELECTOR = \\\".tw-whiteboard-layout-container .tl-container\\\";\\n\\n// A React re-mount can replace the app behind a container, so it is resolved\\n// again now and then instead of being trusted for the life of the container.\\nvar RESOLVE_EVERY_FRAMES = 30;\\n\\nvar appCache = new WeakMap();\\nvar appIds = new WeakMap();\\nvar nextAppId = 0;\\nvar boards = [];\\nvar visited = Object.create(null);\\nvar frameHandle = null;\\nvar frame = 0;\\n\\nvar resolveApp = function(container, refresh) {\\n\\tif(!refresh && appCache.has(container)) return appCache.get(container);\\n\\tvar key = Object.keys(container).filter(function(name) {\\n\\t\\treturn name.indexOf(\\\"__reactFiber$\\\") === 0 || name.indexOf(\\\"__reactInternalInstance$\\\") === 0;\\n\\t})[0];\\n\\tif(!key) return null;\\n\\tvar found = null;\\n\\tvar walk = function(node) {\\n\\t\\tif(!node || found) return;\\n\\t\\tvar value = node.memoizedProps && node.memoizedProps.value;\\n\\t\\tif(value && typeof value.zoomToFit === \\\"function\\\" && typeof value.changePage === \\\"function\\\") {\\n\\t\\t\\tfound = value;\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\twalk(node.child);\\n\\t\\twalk(node.sibling);\\n\\t};\\n\\tvar fiber = container[key];\\n\\twhile(fiber && !found) {\\n\\t\\twalk(fiber);\\n\\t\\tfiber = fiber.return;\\n\\t}\\n\\tif(found) {\\n\\t\\tappCache.set(container, found);\\n\\t} else {\\n\\t\\tappCache.delete(container);\\n\\t}\\n\\treturn found;\\n};\\n\\n// Which board a document is, for the purpose of remembering visits. A tldraw\\n// document takes the tiddler's title as its name when it is saved, so that is\\n// the title; the identity only has to tell two boards apart.\\nvar boardName = function(app) {\\n\\tvar document = app.document || {};\\n\\tif(document.name) return document.name;\\n\\tif(!appIds.has(app)) appIds.set(app, \\\"board-\\\" + (++nextAppId));\\n\\treturn appIds.get(app);\\n};\\n\\nvar pageKey = function(app) {\\n\\tvar state = app.appState || {};\\n\\treturn boardName(app) + \\\"\\\\u001f\\\" + (state.currentPageId || \\\"\\\");\\n};\\n\\n// A board that has not been laid out yet has no size, and a fit against the\\n// wrong one is worse than no fit: a mount still settling measures its renderer\\n// at whatever it happens to be for a frame, and fitting to that parks the\\n// content in a corner at the minimum zoom. So the board is only fitted once\\n// its renderer agrees with its container at a size the container has held for\\n// two frames, which is the point the layout has stopped moving.\\nvar laidOut = function(board) {\\n\\tvar bounds = board.app.rendererBounds;\\n\\tvar container = board.container;\\n\\tif(!bounds || !bounds.width || !bounds.height) return false;\\n\\tif(Math.abs(bounds.width - container.clientWidth) > 2) return false;\\n\\tif(Math.abs(bounds.height - container.clientHeight) > 2) return false;\\n\\tvar size = container.clientWidth + \\\"x\\\" + container.clientHeight;\\n\\tif(board.size !== size) {\\n\\t\\tboard.size = size;\\n\\t\\treturn false;\\n\\t}\\n\\treturn true;\\n};\\n\\nvar fit = function(board) {\\n\\tvar app = board.app;\\n\\tif(!app || typeof app.zoomToFit !== \\\"function\\\") return true;\\n\\tif(!laidOut(board)) return false;\\n\\ttry {\\n\\t\\tapp.zoomToFit();\\n\\t} catch (error) {\\n\\t\\t// A board whose camera cannot be moved keeps the one it loaded with,\\n\\t\\t// which is the behaviour this patch exists to change but never to\\n\\t\\t// break.\\n\\t}\\n\\tvisited[board.key] = true;\\n\\treturn true;\\n};\\n\\nvar step = function() {\\n\\tframeHandle = null;\\n\\tframe++;\\n\\tvar live = [];\\n\\tfor(var i = 0; i \u003C boards.length; i++) {\\n\\t\\tvar board = boards[i];\\n\\t\\tif(!board.container.isConnected) continue;\\n\\t\\tif(frame % RESOLVE_EVERY_FRAMES === 0) {\\n\\t\\t\\tvar fresh = resolveApp(board.container, true);\\n\\t\\t\\tif(fresh && fresh !== board.app) {\\n\\t\\t\\t\\tboard.app = fresh;\\n\\t\\t\\t\\tboard.key = null;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tif(!board.app) {\\n\\t\\t\\tboard.app = resolveApp(board.container, false);\\n\\t\\t}\\n\\t\\tvar key = board.app ? pageKey(board.app) : null;\\n\\t\\tif(key && key !== board.key) {\\n\\t\\t\\tboard.key = key;\\n\\t\\t\\tboard.pending = !visited[key];\\n\\t\\t}\\n\\t\\tif(board.pending && fit(board)) {\\n\\t\\t\\tboard.pending = false;\\n\\t\\t}\\n\\t\\tlive.push(board);\\n\\t}\\n\\tboards = live;\\n\\tif(boards.length) frameHandle = requestAnimationFrame(step);\\n};\\n\\nvar track = function() {\\n\\tvar containers = document.querySelectorAll(BOARD_SELECTOR);\\n\\tfor(var i = 0; i \u003C containers.length; i++) {\\n\\t\\tvar container = containers[i];\\n\\t\\tvar known = false;\\n\\t\\tfor(var j = 0; j \u003C boards.length; j++) {\\n\\t\\t\\tif(boards[j].container === container) {\\n\\t\\t\\t\\tknown = true;\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tif(known) continue;\\n\\t\\tboards.push({\\n\\t\\t\\tcontainer: container,\\n\\t\\t\\tapp: resolveApp(container, false),\\n\\t\\t\\tkey: null,\\n\\t\\t\\tpending: false,\\n\\t\\t});\\n\\t}\\n\\tvar live = [];\\n\\tfor(var k = 0; k \u003C boards.length; k++) {\\n\\t\\tif(boards[k].container.isConnected) live.push(boards[k]);\\n\\t}\\n\\tboards = live;\\n\\tif(boards.length && frameHandle === null) {\\n\\t\\tframeHandle = requestAnimationFrame(step);\\n\\t}\\n};\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") return;\\n\\n\\t// The layout mounts and unmounts its board as the reader moves between the\\n\\t// story river and the whiteboard, so containers are found by watching the\\n\\t// page rather than by looking once.\\n\\tvar scheduled = false;\\n\\tvar observer = new MutationObserver(function() {\\n\\t\\tif(scheduled) return;\\n\\t\\tscheduled = true;\\n\\t\\tsetTimeout(function() {\\n\\t\\t\\tscheduled = false;\\n\\t\\t\\ttrack();\\n\\t\\t}, 25);\\n\\t});\\n\\tobserver.observe(document.body, { childList: true, subtree: true });\\n\\n\\ttrack();\\n};\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/LandscapeGate\":{\"title\":\"$:/Lithic/Patches/Whiteboard/LandscapeGate\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* The whiteboard layout is built for a wide screen: the board is a tldraw\\n canvas and the top bar is a fixed 400px strip of controls. Held in portrait,\\n a phone renders an unusable sliver of both. So the WhiteBoard page layout\\n mounts a gate (see .lithic-wb-rotate-gate there) and this sheet decides when\\n to show it: never in landscape, never on a desktop, and in portrait only on\\n a touch device no wider than a tablet.\\n\\n Three conditions, each with a job:\\n pointer: coarse a phone or tablet, never a resized desktop window\\n orientation portrait only, so rotating hides the gate instantly\\n max-width: 1024px leaves portrait monitors out of it\\n\\n Pure CSS: no script runs, the check happens before the first paint, and no\\n touch reaches the canvas while the gate is up.\\n\\n The gate is a message, not a page, so nothing behind it may move either. A\\n finger dragged on the gate is swallowed by touch-action, and the document\\n behind it is given nothing to scroll. Both are guarded by the gate's own\\n presence, so they exist exactly while the whiteboard layout is mounted:\\n leaving the layout (or rotating, which drops the media query) restores\\n ordinary scrolling in the same frame. */\\n\\n.lithic-wb-rotate-gate {\\n display: none;\\n}\\n\\n@media (pointer: coarse) and (orientation: portrait) and (max-width: 1024px) {\\n html:has(.lithic-wb-rotate-gate),\\n body:has(.lithic-wb-rotate-gate) {\\n overflow: hidden !important;\\n overscroll-behavior: none;\\n }\\n\\n .lithic-wb-rotate-gate {\\n position: fixed;\\n top: 0;\\n right: 0;\\n bottom: 0;\\n left: 0;\\n z-index: 9999999;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n justify-content: center;\\n gap: 1rem;\\n padding: 2rem;\\n box-sizing: border-box;\\n text-align: center;\\n background: var(--lithic-c-page);\\n color: var(--lithic-c-foreground);\\n touch-action: none;\\n }\\n}\\n\\n.lithic-wb-rotate-gate-glyph {\\n width: 4.5rem;\\n height: 4.5rem;\\n opacity: 0.85;\\n}\\n\\n.lithic-wb-rotate-gate-title {\\n margin: 0;\\n font-size: 1.2em;\\n font-weight: bold;\\n}\\n\\n.lithic-wb-rotate-gate-hint {\\n margin: 0;\\n max-width: 22em;\\n color: var(--lithic-c-foreground-muted);\\n}\\n\\n.lithic-wb-rotate-gate-exit {\\n margin-top: 0.75rem;\\n padding: 0.4rem 1.1rem;\\n border: 1px solid var(--lithic-c-menu-border);\\n border-radius: 2rem;\\n background: var(--lithic-c-menu-bg);\\n color: var(--lithic-c-menu-fg);\\n font: inherit;\\n cursor: pointer;\\n}\\n\\n.lithic-wb-rotate-gate-exit:hover {\\n background: color-mix(in srgb, var(--lithic-c-menu-fg) 10%, var(--lithic-c-menu-bg));\\n}\"},\"$:/Lithic/Patches/Whiteboard/LongPressRightClick.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/LongPressRightClick.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/LongPressRightClick.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nConsume Android hold-touch-to-right-click (long-press) events inside the\\nwhiteboard, while preserving deliberate right-clicks.\\n\\nOn Android / stylus devices, holding the stylus or finger still for a moment\\nwhile drawing registers as a `contextmenu` event, which opens tldraw's own\\ncontext menu mid-stroke. Debouncing or styles cannot help here, and we do NOT\\nwant to remove the right-click menu entirely: desktop mouse right-click must\\nkeep working, and the menu must stay available everywhere else in the wiki.\\n\\nHow this patch works:\\n\\n1. tldraw's menu is opened by React's `onContextMenu` handler on the Radix\\n trigger wrapping the whole board (the board renders inside\\n `div.tw-whiteboard-tldraw-container`). React attaches its listeners at the\\n mount container, so a document-level CAPTURE listener runs first: calling\\n `preventDefault()` + `stopImmediatePropagation()` there prevents both the\\n browser's native long-press menu and tldraw's menu from ever opening.\\n2. The patch only acts on `contextmenu` events whose target is inside the\\n whiteboard surface (`.tw-whiteboard-tldraw-container, .tl-container`).\\n3. Touch/stylus derivation is detected two ways:\\n - `event.sourceCapabilities.firesTouchEvents` (Chrome/Android reports true\\n for touch- and stylus-generated events),\\n - else a capture-phase `pointerdown` tracker: any non-mouse pointer\\n (`touch`/`pen`/`stylus`) in the last 2s marks the gesture as touch-based.\\n Mouse pointerdowns (right-click) are never treated as touch.\\n4. A hold time gate separates long-press from deliberate touch right-clicks:\\n Android fires its long-press `contextmenu` only after the hold timeout\\n (>~500ms after pointerdown), while a stylus barrel-button right-click fires\\n almost immediately. Events arriving \u003C200ms after the pointerdown pass\\n through, so stylus-button and two-finger right-clicks still work.\\n5. Targets that are inputs/textareas or `contentEditable` are passed through\\n unchanged, so long-press copy/paste while editing board text keeps the\\n native menu.\\n\\nNot a width/media-query fix: this listens on the event source (touch/stylus\\nvs. mouse), so it works regardless of viewport size or device category.\\n\\nThe wiki's own context menu (ahanniga `context-menu` plugin) already returns\\nearly for `.tw-whiteboard-layout-container`, so this patch is the only menu\\nsuppression the whiteboard needs.\\n\\nDiagnostics: every decision is recorded on `window.__lithicLongPressProbe`\\n({suppressed, reason}) for testing and debugging.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-long-press-right-click\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") {\\n\\t\\treturn;\\n\\t}\\n\\n\\tvar SCOPE_SELECTOR = \\\".tw-whiteboard-tldraw-container, .tl-container\\\";\\n\\t// A touch/stylus contextmenu arriving this soon after pointerdown is a\\n\\t// deliberate right-click (stylus barrel button, two-finger tap), not the\\n\\t// Android long-press, which only fires after the hold timeout.\\n\\tvar LONG_PRESS_MIN_MS = 200;\\n\\t// Touch gestures older than this no longer count as \\\"the current gesture\\\".\\n\\tvar TOUCH_GESTURE_WINDOW_MS = 2000;\\n\\n\\tvar lastPointerDown = {type: \\\"mouse\\\", time: 0};\\n\\n\\tvar probe = {suppressed: false, reason: \\\"\\\"};\\n\\twindow.__lithicLongPressProbe = probe;\\n\\n\\t// Track the most recent pointerdown of ANY kind (with its pointerType).\\n\\t// Mouse right-clicks overwrite the entry, so a mouse click right after a\\n\\t// touch gesture is never mistaken for it.\\n\\tdocument.addEventListener(\\\"pointerdown\\\", function(event) {\\n\\t\\tlastPointerDown = {type: event.pointerType || \\\"mouse\\\", time: Date.now()};\\n\\t}, true);\\n\\n\\tfunction isEditable(target) {\\n\\t\\treturn !!(target.closest && (target.closest(\\\"input, textarea\\\") || target.isContentEditable));\\n\\t}\\n\\n\\tdocument.addEventListener(\\\"contextmenu\\\", function(event) {\\n\\t\\tvar target = event.target;\\n\\t\\t// Only consume hold-touch right-clicks inside the whiteboard surface.\\n\\t\\tif(!target || !target.closest || !target.closest(SCOPE_SELECTOR)) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"outside-whiteboard\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Keep the native copy/paste menu while editing text on the board.\\n\\t\\tif(isEditable(target)) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"editable-target\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Touch/stylus-derived, or mouse/keyboard?\\n\\t\\tvar capsFiresTouch = !!(event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents === true);\\n\\t\\tvar elapsed = Date.now() - lastPointerDown.time;\\n\\t\\tvar sawRecentNonMouse = lastPointerDown.type !== \\\"mouse\\\" && elapsed \u003C TOUCH_GESTURE_WINDOW_MS;\\n\\t\\tif(!capsFiresTouch && !sawRecentNonMouse) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"mouse-or-keyboard\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Too fast to be a long-press -> deliberate touch right-click.\\n\\t\\tif(elapsed \u003C LONG_PRESS_MIN_MS) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"fast-touch-right-click\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Hold-touch-to-right-click inside the whiteboard: consume it.\\n\\t\\tevent.preventDefault();\\n\\t\\tevent.stopImmediatePropagation();\\n\\t\\tprobe.suppressed = true;\\n\\t\\tprobe.reason = \\\"touch-long-press\\\";\\n\\t}, true);\\n};\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/MiddleButtonPan.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/MiddleButtonPan.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/MiddleButtonPan.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nMiddle-button drag always pans the board, whatever the pointer is over.\\n\\ntldraw pans on a middle-button drag only when the pointer stays on a surface\\nthat has its own move handler: the empty canvas, a shape, the selection\\nbounds. A middle-button press on something else inside the board leaves the\\ngrab cursor showing and the camera still, and the pan only starts once the\\npointer leaves that thing and reaches the canvas. Dragging is not editing, so\\nthe button should never be told apart by what is underneath it.\\n\\nSo this patch owns the middle-button drag itself. It takes the press before\\nReact sees it (and prevents the browser's own middle-click behaviour, such as\\nautoscroll), then pans the camera from the pointer's own movement for as long\\nas the button is held. The camera is moved through the board's own state, so\\na pan is still a pan to the rest of the editor: undo history, cursors, the\\nsave indicator.\\n\\nThe board's app instance is found through the React tree of its container and\\ncached per container. When it cannot be found, nothing is intercepted and the\\nboard behaves exactly as it did before, which is the only honest fallback.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-middle-button-pan\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nvar BOARD_SELECTOR = \\\".tl-container\\\";\\nvar MIDDLE_BUTTON = 1;\\nvar MIDDLE_BUTTON_MASK = 4;\\n\\n// One drag at a time: the pointer belongs to a single board.\\nvar drag = null;\\nvar appCache = new WeakMap();\\n\\nvar boardOf = function(target) {\\n\\tif(!target || !target.closest) return null;\\n\\treturn target.closest(BOARD_SELECTOR);\\n};\\n\\nvar findApp = function(container) {\\n\\tif(appCache.has(container)) return appCache.get(container);\\n\\tvar key = Object.keys(container).filter(function(name) {\\n\\t\\treturn name.indexOf(\\\"__reactFiber$\\\") === 0 || name.indexOf(\\\"__reactInternalInstance$\\\") === 0;\\n\\t})[0];\\n\\tif(!key) return null;\\n\\tvar found = null;\\n\\tvar walk = function(node) {\\n\\t\\tif(!node || found) return;\\n\\t\\tvar value = node.memoizedProps && node.memoizedProps.value;\\n\\t\\tif(value && typeof value.createShapes === \\\"function\\\" && typeof value.pan === \\\"function\\\") {\\n\\t\\t\\tfound = value;\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\twalk(node.child);\\n\\t\\twalk(node.sibling);\\n\\t};\\n\\tvar fiber = container[key];\\n\\twhile(fiber && !found) {\\n\\t\\twalk(fiber);\\n\\t\\tfiber = fiber.return;\\n\\t}\\n\\tif(found) appCache.set(container, found);\\n\\treturn found;\\n};\\n\\nvar zoomOf = function(app) {\\n\\tvar camera = app.camera || (app.pageState && app.pageState.camera);\\n\\treturn camera && camera.zoom ? camera.zoom : 1;\\n};\\n\\nvar endDrag = function() {\\n\\tif(!drag) return;\\n\\tif(drag.container) drag.container.style.cursor = drag.previousCursor;\\n\\tdrag = null;\\n};\\n\\nvar onMouseDown = function(event) {\\n\\tif(event.button !== MIDDLE_BUTTON) return;\\n\\t// No autoscroll, no paste-on-middle-click: the board owns this button.\\n\\tif(boardOf(event.target)) event.preventDefault();\\n};\\n\\nvar onPointerDown = function(event) {\\n\\tif(event.button !== MIDDLE_BUTTON) return;\\n\\tvar container = boardOf(event.target);\\n\\tif(!container) return;\\n\\tvar app = findApp(container);\\n\\tif(!app) return;\\n\\tevent.preventDefault();\\n\\tevent.stopPropagation();\\n\\tendDrag();\\n\\tdrag = {\\n\\t\\tpointerId: event.pointerId,\\n\\t\\tx: event.clientX,\\n\\t\\ty: event.clientY,\\n\\t\\tapp: app,\\n\\t\\tcontainer: container,\\n\\t\\tpreviousCursor: container.style.cursor,\\n\\t};\\n\\tcontainer.style.cursor = \\\"grabbing\\\";\\n};\\n\\nvar onPointerMove = function(event) {\\n\\tif(!drag) return;\\n\\t// A release whose pointerup never arrived still ends the drag.\\n\\tif((event.buttons & MIDDLE_BUTTON_MASK) === 0) {\\n\\t\\tendDrag();\\n\\t\\treturn;\\n\\t}\\n\\tif(event.pointerId !== drag.pointerId) return;\\n\\tevent.preventDefault();\\n\\tevent.stopPropagation();\\n\\tvar dx = event.clientX - drag.x;\\n\\tvar dy = event.clientY - drag.y;\\n\\tif(dx === 0 && dy === 0) return;\\n\\tdrag.x = event.clientX;\\n\\tdrag.y = event.clientY;\\n\\tvar zoom = zoomOf(drag.app);\\n\\tdrag.app.pan([-dx / zoom, -dy / zoom]);\\n};\\n\\nvar onPointerUp = function(event) {\\n\\tif(!drag) return;\\n\\tif(event.pointerId !== drag.pointerId) return;\\n\\tevent.stopPropagation();\\n\\tendDrag();\\n};\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") return;\\n\\t// Capture phase throughout: React listens on the board's own root, so this\\n\\t// has to run first to be able to take the gesture away from it.\\n\\tdocument.addEventListener(\\\"mousedown\\\", onMouseDown, true);\\n\\tdocument.addEventListener(\\\"pointerdown\\\", onPointerDown, true);\\n\\twindow.addEventListener(\\\"pointermove\\\", onPointerMove, true);\\n\\twindow.addEventListener(\\\"pointerup\\\", onPointerUp, true);\\n\\twindow.addEventListener(\\\"pointercancel\\\", onPointerUp, true);\\n\\twindow.addEventListener(\\\"blur\\\", endDrag);\\n};\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/MobileViewport\":{\"title\":\"$:/Lithic/Patches/Whiteboard/MobileViewport\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* A phone's browser draws its own chrome over the page, so 100vh is the\\n viewport with that chrome hidden, not the one the reader can see. The board\\n is sized in vh: the page layout passes height=\\\"100vh\\\" to the whiteboard\\n widget, which writes it as an inline height on .tw-whiteboard-tldraw-container,\\n and tldraw anchors its bottom toolbar to the bottom of that box. On a phone\\n the box therefore runs on under the browser chrome, the toolbar is anchored\\n below the visible area, and no tool is reachable until the page is scrolled.\\n\\n dvh is the viewport that is actually on screen, so the box ends where the\\n reader's screen ends and the toolbar arrives with it. The vh line stays in\\n front of the dvh line for engines that have no dvh, and !important is the\\n only way to reach a height the widget set inline. Scoped to a coarse\\n pointer, so a desktop window keeps its 100vh. */\\n\\n@media (pointer: coarse) {\\n .tw-whiteboard-tldraw-container {\\n height: 100vh !important;\\n height: 100dvh !important;\\n }\\n}\"},\"$:/Lithic/Patches/Whiteboard/PageMenuOverflow\":{\"title\":\"$:/Lithic/Patches/Whiteboard/PageMenuOverflow\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Keep tldraw menus inside the viewport when they contain many items. The\\n stock bundle hardcodes max-height: 100vh on menu panels, which are anchored\\n below their trigger - so on the full-screen whiteboard layout a panel\\n extends past the bottom of the screen and the last item (\\\"Create page\\\")\\n can never be scrolled into view. Radix already computes the true available\\n space and exposes it as CSS vars; use those instead of the hardcoded 100vh.\\n The dropdown var covers the page select/zoom/style menus; the context-menu\\n var covers right-click menus (opened at the cursor). Both fall back to the\\n stock 100vh when absent, so nothing else is affected. */\\n\\n.tw-whiteboard-tldraw-container [role=\\\"menu\\\"] {\\n max-height: var(\\n --radix-dropdown-menu-content-available-height,\\n var(--radix-context-menu-content-available-height, 100vh)\\n ) !important;\\n}\"},\"$:/Lithic/Patches/Whiteboard/PageNav.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/PageNav.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/PageNav.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nAdds prev/next page navigation buttons immediately to the right of the tldraw\\npage-select dropdown (the #TD-Page trigger in the upper-left #TD-MenuPanel).\\nThis is pure whiteboard-internal navigation: the buttons drive the live\\nTldrawApp via app.changePage() and know nothing about TiddlyWiki's own board\\nselector in the top bar.\\n\\nThe page dropdown in this build ships without flanking chevrons, so helpers\\nare mounted next to it. Clicking calls changePage on the actual tldraw app\\ninstance, reached by walking the React fiber tree up from the trigger to the\\nTldrawContext.Provider (whose memoizedProps.value IS the app).\\n\\nBoth glyphs (chevron + bullet) are rendered into each button up front and the\\nvisible one is chosen with pure CSS via :disabled - navigating never mutates\\nthe button's DOM, so rapid/spam clicks can never be swallowed by the browser\\nsuppressing a click whose mousedown target was removed mid-press. The app is\\nresolved fresh from the live trigger at click time (with a cached fallback),\\nso transient React re-renders can't drop a click either.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-page-nav\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n var BUTTON_CLASS = \\\"lithic-wb-page-nav-btn\\\";\\n var SCAN_DEBOUNCE_MS = 25;\\n\\n // Stroke-style left/right chevrons (Feather icon set, 24x24 viewBox) so\\n // the buttons read unambiguously as prev/next navigation.\\n var ICON_PREV = '\u003Cpolyline points=\\\"15 18 9 12 15 6\\\"/>';\\n var ICON_NEXT = '\u003Cpolyline points=\\\"9 18 15 12 9 6\\\"/>';\\n\\n // Small bullet shown in place of the chevron when the button is disabled\\n // (no further page in that direction).\\n var DOT = '\u003Ccircle cx=\\\"5\\\" cy=\\\"5\\\" r=\\\"3.5\\\"/>';\\n\\n function chevronSvg(direction) {\\n return '\u003Csvg width=\\\"18\\\" height=\\\"18\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" ' +\\n 'stroke=\\\"currentColor\\\" stroke-width=\\\"2.5\\\" stroke-linecap=\\\"round\\\" ' +\\n 'stroke-linejoin=\\\"round\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\">' +\\n (direction === \\\"prev\\\" ? ICON_PREV : ICON_NEXT) +\\n \\\"\u003C/svg>\\\";\\n }\\n\\n function dotSvg() {\\n return '\u003Csvg width=\\\"10\\\" height=\\\"10\\\" viewBox=\\\"0 0 10 10\\\" ' +\\n 'fill=\\\"currentColor\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\">' +\\n DOT +\\n \\\"\u003C/svg>\\\";\\n }\\n\\n function directionOf(btn) {\\n return btn.classList.contains(\\\"lithic-wb-page-prev\\\") ? \\\"prev\\\" : \\\"next\\\";\\n }\\n\\n function makeButton(direction) {\\n var btn = document.createElement(\\\"button\\\");\\n btn.type = \\\"button\\\";\\n btn.className = BUTTON_CLASS + \\\" lithic-wb-page-\\\" + direction;\\n btn.setAttribute(\\\"aria-label\\\", direction === \\\"prev\\\" ? \\\"Previous page\\\" : \\\"Next page\\\");\\n btn.title = direction === \\\"prev\\\" ? \\\"Previous page\\\" : \\\"Next page\\\";\\n // Both glyphs are always present; CSS shows the chevron when enabled\\n // and the bullet when disabled (no DOM mutation while interacting).\\n btn.innerHTML =\\n '\u003Cspan class=\\\"lithic-wb-glyph lithic-wb-glyph-chevron\\\">' + chevronSvg(direction) + \\\"\u003C/span>\\\" +\\n '\u003Cspan class=\\\"lithic-wb-glyph lithic-wb-glyph-dot\\\">' + dotSvg() + \\\"\u003C/span>\\\";\\n return btn;\\n }\\n\\n // Walk the React fiber tree up from a page dropdown trigger to find the\\n // live TldrawApp. The TldrawContext.Provider fiber's memoizedProps.value\\n // is the app instance itself.\\n function findAppFrom(trigger) {\\n if (!trigger) return null;\\n var key = null;\\n for (var prop in trigger) {\\n if (prop.indexOf(\\\"__reactFiber$\\\") === 0 || prop.indexOf(\\\"__reactInternalInstance$\\\") === 0) {\\n key = prop;\\n break;\\n }\\n }\\n if (!key) return null;\\n var fiber = trigger[key];\\n var guard = 0;\\n while (fiber && guard++ \u003C 300) {\\n var props = fiber.memoizedProps;\\n if (props && props.value && typeof props.value === \\\"object\\\") {\\n var candidate = props.value;\\n if (typeof candidate.changePage === \\\"function\\\" &&\\n candidate.document && candidate.document.pages && candidate.appState) {\\n return candidate;\\n }\\n }\\n fiber = fiber.return;\\n }\\n return null;\\n }\\n\\n // The page dropdown trigger can be replaced by tldraw re-renders; find the\\n // CURRENT trigger that lives in the same menu panel as the button.\\n function liveTrigger(btn) {\\n var panel = btn.closest ? (btn.closest(\\\"#TD-MenuPanel\\\") || btn.closest(\\\".tw-whiteboard-tldraw-container\\\")) : null;\\n if (!panel) return null;\\n return panel.querySelector(\\\"#TD-Page\\\") || null;\\n }\\n\\n // Resolve the app for a button: prefer a fresh fiber walk from the live\\n // trigger; fall back to the last app cached on the button so a click is\\n // never dropped by a transient React state.\\n function resolveApp(btn, captured) {\\n var live = liveTrigger(btn) || captured;\\n var app = live ? findAppFrom(live) : null;\\n if (!app && live !== captured && captured) {\\n app = findAppFrom(captured);\\n }\\n if (app) {\\n btn._lithicApp = app;\\n } else {\\n app = btn._lithicApp || null;\\n }\\n return app;\\n }\\n\\n function getSortedPages(app) {\\n var pages = app.document.pages || {};\\n return Object.keys(pages)\\n .map(function (id) { return pages[id]; })\\n .sort(function (a, b) { return (a.childIndex || 0) - (b.childIndex || 0); });\\n }\\n\\n function getCurrentIndex(app) {\\n var pages = getSortedPages(app);\\n var currentId = app.appState.currentPageId;\\n for (var i = 0; i \u003C pages.length; i++) {\\n if (pages[i].id === currentId) return i;\\n }\\n return -1;\\n }\\n\\n function refreshDisabled(app, prevBtn, nextBtn) {\\n var idx = app ? getCurrentIndex(app) : -1;\\n var count = app ? getSortedPages(app).length : 0;\\n prevBtn.disabled = idx \u003C= 0;\\n nextBtn.disabled = idx === -1 || idx >= count - 1;\\n // The glyph swap is pure CSS (:disabled), so nothing here mutates DOM.\\n }\\n\\n function navigate(trigger, prevBtn, nextBtn, direction, event) {\\n if (event) {\\n event.preventDefault();\\n event.stopPropagation();\\n }\\n var app = resolveApp(nextBtn, trigger);\\n if (!app) return;\\n var pages = getSortedPages(app);\\n var idx = getCurrentIndex(app);\\n if (idx === -1) return;\\n var target = direction === \\\"prev\\\" ? idx - 1 : idx + 1;\\n if (target \u003C 0 || target >= pages.length) return;\\n app.changePage(pages[target].id);\\n refreshDisabled(app, prevBtn, nextBtn);\\n }\\n\\n function instrument(trigger) {\\n if (trigger.dataset.lithicPageNav === \\\"1\\\") return;\\n\\n // Clear any stale page-nav buttons already in the panel (e.g. from a\\n // previous trigger instance) so there is never more than one pair.\\n var panel = trigger.parentElement;\\n if (panel) {\\n var stale = panel.querySelectorAll(\\\".lithic-wb-page-prev, .lithic-wb-page-next\\\");\\n for (var s = 0; s \u003C stale.length; s++) {\\n stale[s].remove();\\n }\\n }\\n\\n // The buttons go to the RIGHT of the page select dropdown, as\\n // siblings of the trigger inside the menu panel's flex row.\\n var prevBtn = makeButton(\\\"prev\\\");\\n var nextBtn = makeButton(\\\"next\\\");\\n trigger.insertAdjacentElement(\\\"afterend\\\", prevBtn);\\n prevBtn.insertAdjacentElement(\\\"afterend\\\", nextBtn);\\n trigger.dataset.lithicPageNav = \\\"1\\\";\\n\\n // Keep tldraw (pointer handlers) and the radix dropdown trigger from\\n // ever seeing these interactions.\\n var stop = function (event) { event.stopPropagation(); };\\n prevBtn.addEventListener(\\\"pointerdown\\\", stop, true);\\n nextBtn.addEventListener(\\\"pointerdown\\\", stop, true);\\n prevBtn.addEventListener(\\\"mousedown\\\", stop, true);\\n nextBtn.addEventListener(\\\"mousedown\\\", stop, true);\\n\\n prevBtn.addEventListener(\\\"click\\\", function (event) {\\n navigate(trigger, prevBtn, nextBtn, \\\"prev\\\", event);\\n });\\n nextBtn.addEventListener(\\\"click\\\", function (event) {\\n navigate(trigger, prevBtn, nextBtn, \\\"next\\\", event);\\n });\\n\\n refreshDisabled(resolveApp(nextBtn, trigger), prevBtn, nextBtn);\\n\\n // Recompute the disabled state whenever the current page name changes\\n // (dropdown selection, page create/delete, or the wiki-side board\\n // switcher loading a different board into this widget).\\n var labelObserver = new MutationObserver(function () {\\n refreshDisabled(resolveApp(nextBtn, trigger), prevBtn, nextBtn);\\n });\\n labelObserver.observe(trigger, { childList: true, subtree: true, characterData: true });\\n }\\n\\n function scan() {\\n var containers = document.querySelectorAll(\\\".tw-whiteboard-tldraw-container\\\");\\n for (var i = 0; i \u003C containers.length; i++) {\\n var trigger = containers[i].querySelector(\\\"#TD-Page\\\");\\n if (!trigger) continue;\\n if (trigger.dataset.lithicPageNav !== \\\"1\\\") {\\n instrument(trigger);\\n }\\n var prev = trigger.nextElementSibling;\\n var next = prev ? prev.nextElementSibling : null;\\n if (prev && next &&\\n prev.classList && prev.classList.contains(\\\"lithic-wb-page-prev\\\") &&\\n next.classList && next.classList.contains(\\\"lithic-wb-page-next\\\")) {\\n var app = findAppFrom(trigger) || null;\\n if (app) {\\n prev._lithicApp = app;\\n next._lithicApp = app;\\n }\\n refreshDisabled(app, prev, next);\\n }\\n }\\n }\\n\\n exports.startup = function () {\\n if (typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") return;\\n\\n var scheduled = false;\\n var observer = new MutationObserver(function () {\\n if (scheduled) return;\\n scheduled = true;\\n setTimeout(function () {\\n scheduled = false;\\n scan();\\n }, SCAN_DEBOUNCE_MS);\\n });\\n observer.observe(document.body, { childList: true, subtree: true });\\n\\n scan();\\n };\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/PageNavStyle\":{\"title\":\"$:/Lithic/Patches/Whiteboard/PageNavStyle\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Prev/next page buttons beside the tldraw page-select dropdown,\\n mounted by $:/Lithic/Patches/Whiteboard/PageNav.js */\\n\\n.lithic-wb-page-prev,\\n.lithic-wb-page-next {\\n display: inline-flex !important;\\n align-items: center;\\n justify-content: center;\\n width: 38px !important;\\n height: 30px !important;\\n margin: 0 2px !important;\\n padding: 0 !important;\\n box-sizing: border-box;\\n position: relative !important;\\n top: 5px !important;\\n border: 1px solid transparent;\\n border-radius: 4px !important;\\n background-color: transparent !important;\\n color: inherit;\\n cursor: pointer;\\n}\\n\\n.lithic-wb-page-prev:hover:not(:disabled),\\n.lithic-wb-page-next:hover:not(:disabled) {\\n background-color: rgba(var(--lithic-c-foreground-rgb), 0.22) !important;\\n}\\n\\n.lithic-wb-page-prev:active:not(:disabled),\\n.lithic-wb-page-next:active:not(:disabled) {\\n background-color: rgba(var(--lithic-c-foreground-rgb), 0.32) !important;\\n}\\n\\n.lithic-wb-page-prev:disabled,\\n.lithic-wb-page-next:disabled {\\n opacity: 0.35;\\n cursor: default;\\n}\\n\\n/* Both glyphs are always in the DOM; :disabled picks which one shows. */\\n.lithic-wb-page-prev .lithic-wb-glyph,\\n.lithic-wb-page-next .lithic-wb-glyph {\\n display: inline-flex;\\n line-height: 0;\\n}\\n\\n.lithic-wb-page-prev .lithic-wb-glyph-dot,\\n.lithic-wb-page-next .lithic-wb-glyph-dot {\\n display: none;\\n}\\n\\n.lithic-wb-page-prev:disabled .lithic-wb-glyph-chevron,\\n.lithic-wb-page-next:disabled .lithic-wb-glyph-chevron {\\n display: none;\\n}\\n\\n.lithic-wb-page-prev:disabled .lithic-wb-glyph-dot,\\n.lithic-wb-page-next:disabled .lithic-wb-glyph-dot {\\n display: inline-flex;\\n}\\n\\n.lithic-wb-page-prev .lithic-wb-glyph-chevron svg,\\n.lithic-wb-page-next .lithic-wb-glyph-chevron svg {\\n display: block;\\n width: 18px;\\n height: 18px;\\n}\\n\\n.lithic-wb-page-prev .lithic-wb-glyph-dot svg,\\n.lithic-wb-page-next .lithic-wb-glyph-dot svg {\\n display: block;\\n width: 10px;\\n height: 10px;\\n}\\n\\n/* Touch pointers: this menu panel and the layout's own 400px bar are layered\\n over the same top strip as tldraw's right-hand cluster (undo/redo/zoom/\\n styles), and on a phone there is not room for all three side by side. Two\\n collisions have to be undone without moving anything on a desktop, where\\n there is room for all of them.\\n\\n First: the page arrows sat behind that bar (the bar is layered over the\\n board), so the last two panel items were unclickable. They move to a second\\n line below the panel. They are taken out of the flow rather than given a\\n grid row, because the panel shares its flex row with the right-hand cluster:\\n any in-flow child that grows makes the row taller and stretches that cluster\\n with it, so one extra line on the left was silently growing undo/redo on the\\n right. Positioned absolutely under the panel they add no height, and\\n overflow:visible lets them show below the panel's own 41px box. */\\n@media (pointer: coarse) {\\n #TD-MenuPanel {\\n position: relative !important;\\n height: 41px !important;\\n overflow: visible !important;\\n }\\n\\n /* The inline row only needed the 5px nudge up because the row itself was\\n 40px tall; on their own line the buttons sit flush and use margins. */\\n .lithic-wb-page-prev,\\n .lithic-wb-page-next {\\n position: absolute !important;\\n top: 41px !important;\\n margin: 4px 2px !important;\\n }\\n\\n .lithic-wb-page-prev {\\n left: 0 !important;\\n }\\n\\n .lithic-wb-page-next {\\n left: 42px !important;\\n }\\n}\\n\\n/* Second: that bar is centred at width:400px, so on a landscape phone narrower\\n than about 844px its right end covers undo/redo. It starts just right of the\\n panel instead and is capped so it stops short of the cluster's 222px, which\\n leaves the space next to the panel as the only place the bar can live. The\\n board search field is the one item that flexes, so the fixed buttons beside\\n it never spill back over the cluster.\\n\\n 124px clears the widest page label a board is likely to reach - the panel\\n measures 99px at \\\"Page 1\\\" and grows about a pixel per character, so even\\n \\\"Page 1234\\\" stays clear of the bar. */\\n@media (pointer: coarse) and (max-width: 1024px) {\\n .tw-whiteboard-layout-top-bar {\\n box-sizing: border-box !important;\\n left: 124px !important;\\n width: auto !important;\\n max-width: calc(100% - 356px) !important;\\n justify-content: flex-start !important;\\n }\\n\\n .tw-whiteboard-layout-top-bar > span:first-child {\\n flex: 0 1 auto;\\n min-width: 0;\\n }\\n\\n /* The search field carries an inline 230px width, so it cannot shrink on\\n its own - measured from the viewport it stays inside the bar's cap and\\n never slides over the buttons beside it. */\\n .lithic-wb-search-input {\\n width: min(230px, calc(100vw - 574px)) !important;\\n }\\n}\\n\\n/* A short landscape phone (iPhone SE and friends) cannot give the board search\\n field a width worth having beside the four buttons, so the field steps aside\\n and leaves them all at full size. The dropdown arrow next to it still opens\\n the board list. */\\n@media (pointer: coarse) and (max-width: 620px) {\\n .lithic-wb-search-input {\\n display: none !important;\\n }\\n}\"},\"$:/Lithic/Patches/Whiteboard/SaveButtonStyle\":{\"title\":\"$:/Lithic/Patches/Whiteboard/SaveButtonStyle\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Ensure the save-wiki button in the whiteboard top bar\\n matches the size and pill styling of the adjacent buttons */\\n\\n.lithic-wb-save-btn {\\n display: inline-flex;\\n align-items: center;\\n vertical-align: middle;\\n margin: 0 1px;\\n}\\n\\n.lithic-wb-save-btn button {\\n display: inline-flex !important;\\n align-items: center;\\n justify-content: center;\\n width: 3.2em !important;\\n height: 2.0em !important;\\n border-radius: 1.0em !important;\\n background: var(--lithic-c-menu-bg) !important;\\n border: 1px solid rgba(var(--lithic-c-menu-fg-rgb), 0.2) !important;\\n cursor: pointer;\\n padding: 0 !important;\\n box-sizing: border-box !important;\\n}\\n\\n.lithic-wb-save-btn button:hover {\\n background: color-mix(in srgb, var(--lithic-c-menu-fg) 10%, var(--lithic-c-menu-bg)) !important; /* slightly lighter on hover */\\n}\\n\\n/* Scale up the SVG icon inside */\\n.lithic-wb-save-btn button svg {\\n width: 1.2em;\\n height: 1.2em;\\n}\\n\\n/* Hide the broken Font selector in the Tldraw style menu */\\n#TD-Styles-Font-Container {\\n display: none !important;\\n}\\n\\n\\n\\n/* Comptext injected stickies are ALWAYS transparent (targeted via 'c001' UUID suffix) */\\ndiv[id$=\\\"c001\\\"][data-shape=\\\"sticky\\\"] .c-gLGcPs {\\n background-color: transparent !important;\\n text-shadow: none !important;\\n box-shadow: none !important;\\n}\\n\\n/* Replace the 'Insert Media' button icon with a Command Palette icon */\\n#TD-PrimaryTools-Image svg {\\n display: none !important;\\n}\\n\\n#TD-PrimaryTools-Image .c-lkmCgW::after {\\n content: \\\"$:>/\\\";\\n font-family: monospace;\\n font-size: 10px;\\n font-weight: bold;\\n color: currentColor;\\n display: inline-block;\\n line-height: 1;\\n}\\n\\n\"},\"$:/Lithic/Patches/Whiteboard/WriteBehind.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/WriteBehind.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/WriteBehind.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nWrite-behind buffer for whiteboard (application/tldr) tiddlers.\\n\\nThe linonetwo/tw-whiteboard widget writes the entire board JSON back to the\\nwiki store on every (500ms-debounced) stroke and dispatches tm-auto-save-wiki,\\nwhich serializes the ENTIRE wiki store whenever autosave is enabled. As the\\nwiki grows, every stroke pays O(wiki size) in serialization cost.\\n\\nThis patch decouples the board's working memory from the store, following the\\nsame model as the native \\\"edit tiddler\\\" dialog: the whiteboard's state is\\ntransient and is only written back to the tiddler (and thus to the wiki file\\non save) when the user actually saves the wiki or closes the board.\\n\\n1. Text writes to application/tldr tiddlers are buffered in memory instead of\\n hitting the store, so strokes fire no change events and never dirty the wiki.\\n2. The buffer is flushed BEFORE any real wiki save (tm-save-wiki /\\n tm-auto-save-wiki) by hooking the root widget's dispatchEvent, so the\\n serializer always includes the latest board state.\\n3. The buffer is flushed on pagehide/beforeunload as a crash safety net (this\\n also covers the board's final unmount write when the app closes).\\n\\nTrade-offs (strict mode):\\n- Until the wiki is saved, other consumers of the board tiddler (\u003C$wb-image>\\n widgets, the comptext paste bridge, other open boards) see the last saved\\n state, not live strokes. Use the whiteboard layout's Save button to commit.\\n- A hard crash before a save loses strokes made since the last save.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-write-behind\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof $tw === \\\"undefined\\\") {\\n\\t\\treturn;\\n\\t}\\n\\n\\tvar buffer = {};\\n\\tvar originalSetText = $tw.wiki.setText.bind($tw.wiki);\\n\\n\\tfunction isWhiteboard(title) {\\n\\t\\tvar tiddler = $tw.wiki.getTiddler(title);\\n\\t\\treturn !!(tiddler && tiddler.fields.type === \\\"application/tldr\\\");\\n\\t}\\n\\n\\tfunction flushBuffer() {\\n\\t\\tvar titles = Object.keys(buffer);\\n\\t\\tif(titles.length === 0) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\tvar pending = buffer;\\n\\t\\tbuffer = {};\\n\\t\\tfor(var i = 0; i \u003C titles.length; i++) {\\n\\t\\t\\tvar title = titles[i];\\n\\t\\t\\tif(!$tw.wiki.tiddlerExists(title)) {\\n\\t\\t\\t\\tcontinue; // board was deleted before the flush\\n\\t\\t\\t}\\n\\t\\t\\ttry {\\n\\t\\t\\t\\toriginalSetText(title, undefined, undefined, pending[title]);\\n\\t\\t\\t} catch(e) {\\n\\t\\t\\t\\tconsole.error(\\\"[Lithic] Whiteboard write-behind flush failed for \\\" + title, e);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n\\n\\t// 1. Buffer text writes to whiteboard tiddlers; everything else passes through.\\n\\t$tw.wiki.setText = function() {\\n\\t\\tvar title = arguments[0],\\n\\t\\t\\tfield = arguments[1],\\n\\t\\t\\tvalue = arguments[3];\\n\\t\\tif(typeof value !== \\\"string\\\" || !isWhiteboard(title)) {\\n\\t\\t\\treturn originalSetText.apply(null, arguments);\\n\\t\\t}\\n\\t\\t// Text writes to a whiteboard are buffered (the heavy per-stroke path).\\n\\t\\tif(!field || field === \\\"text\\\") {\\n\\t\\t\\tbuffer[title] = value;\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// The widget re-writes `type` on every save; if it is already the same\\n\\t\\t// value, skip it entirely so the per-stroke write cannot stamp a new\\n\\t\\t// `modified` timestamp (which would fire a change event and dirty the wiki).\\n\\t\\tif(field === \\\"type\\\" && $tw.wiki.getTiddler(title).fields.type === value) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\treturn originalSetText.apply(null, arguments);\\n\\t};\\n\\n\\t// 2. Flush before any real wiki save so the serializer sees the latest board.\\n\\tfunction installSaveHook() {\\n\\t\\tif(!$tw.rootWidget || $tw.rootWidget.__lithicWriteBehindHooked) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t$tw.rootWidget.__lithicWriteBehindHooked = true;\\n\\t\\tvar originalDispatch = $tw.rootWidget.dispatchEvent;\\n\\t\\t$tw.rootWidget.dispatchEvent = function(event) {\\n\\t\\t\\tif(event && (event.type === \\\"tm-save-wiki\\\" || event.type === \\\"tm-auto-save-wiki\\\")) {\\n\\t\\t\\t\\tflushBuffer();\\n\\t\\t\\t}\\n\\t\\t\\treturn originalDispatch.call(this, event);\\n\\t\\t};\\n\\t}\\n\\tinstallSaveHook();\\n\\tif(!$tw.rootWidget) {\\n\\t\\tvar tries = 0;\\n\\t\\tvar hookTimer = setInterval(function() {\\n\\t\\t\\ttries++;\\n\\t\\t\\tinstallSaveHook();\\n\\t\\t\\tif($tw.rootWidget || tries > 100) {\\n\\t\\t\\t\\tclearInterval(hookTimer);\\n\\t\\t\\t}\\n\\t\\t}, 50);\\n\\t}\\n\\n\\t// 3. Crash safety net: flush on page teardown.\\n\\twindow.addEventListener(\\\"pagehide\\\", flushBuffer);\\n\\twindow.addEventListener(\\\"beforeunload\\\", flushBuffer);\\n};\\n\\n})();\\n\"},\"$:/Lithic/Widgets/multi-wb-image.js\":{\"title\":\"$:/Lithic/Widgets/multi-wb-image.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Widgets/multi-wb-image.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nA widget to extract and display images from a list of whiteboard tiddlers.\\n\\\\*/\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar MultiWbImageWidget = function(parseTreeNode,options) {\\n\\tthis.initialise(parseTreeNode,options);\\n};\\n\\n/*\\nInherit from the base widget class\\n*/\\nMultiWbImageWidget.prototype = new Widget();\\n\\n/*\\nRender this widget into the DOM\\n*/\\nMultiWbImageWidget.prototype.render = function(parent,nextSibling) {\\n\\tthis.parentDomNode = parent;\\n\\tthis.computeAttributes();\\n\\tthis.execute();\\n \\n var container = this.document.createElement(\\\"div\\\");\\n container.className = this.className || \\\"multi-wb-image-container\\\";\\n \\n for (var i = 0; i \u003C this.boardTitles.length; i++) {\\n var boardTitle = this.boardTitles[i];\\n var imgNode = this.document.createElement(\\\"img\\\");\\n \\n if(this.width) {\\n imgNode.setAttribute(\\\"width\\\", this.width);\\n }\\n if(this.height) {\\n imgNode.setAttribute(\\\"height\\\", this.height);\\n }\\n \\n var src = this.extractImageSrc(boardTitle);\\n if(src) {\\n imgNode.setAttribute(\\\"src\\\", src);\\n } else {\\n imgNode.setAttribute(\\\"alt\\\", \\\"Whiteboard image not found: \\\" + boardTitle);\\n imgNode.style.border = \\\"1px dashed var(--lithic-c-code-warn)\\\";\\n imgNode.style.display = \\\"inline-block\\\";\\n if (!this.width) imgNode.style.width = \\\"100px\\\";\\n if (!this.height) imgNode.style.height = \\\"100px\\\";\\n }\\n container.appendChild(imgNode);\\n }\\n\\n\\tparent.insertBefore(container,nextSibling);\\n\\tthis.domNodes.push(container);\\n};\\n\\nMultiWbImageWidget.prototype.extractImageSrc = function(boardTitle) {\\n var tiddler = this.wiki.getTiddler(boardTitle);\\n if (!tiddler || !tiddler.fields.text) return null;\\n try {\\n var doc = JSON.parse(tiddler.fields.text);\\n if (doc && doc.document && doc.document.assets) {\\n var assets = doc.document.assets;\\n for (var id in assets) {\\n var asset = assets[id];\\n if (asset.type === \\\"image\\\") {\\n return asset.src;\\n }\\n }\\n }\\n } catch(e) {\\n console.error(\\\"MultiWbImageWidget parse error\\\", e);\\n }\\n return null;\\n};\\n\\n/*\\nCompute the internal state of the widget\\n*/\\nMultiWbImageWidget.prototype.execute = function() {\\n\\tvar boardsText = this.getAttribute(\\\"boards\\\") || this.getAttribute(\\\"text\\\") || this.getAttribute(\\\"list\\\") || \\\"\\\";\\n \\n var titles = [];\\n var lines = boardsText.split(\\\"\\\\n\\\");\\n for(var i=0; i\u003Clines.length; i++) {\\n var line = lines[i].trim();\\n if(!line) continue;\\n if(line.startsWith(\\\"[[\\\") && line.endsWith(\\\"]]\\\")) {\\n titles.push(line.substring(2, line.length - 2));\\n } else {\\n titles.push(line);\\n }\\n }\\n \\n\\tthis.boardTitles = titles;\\n\\tthis.width = this.getAttribute(\\\"scale\\\") || this.getAttribute(\\\"width\\\", \\\"80%\\\");\\n\\tthis.height = this.getAttribute(\\\"height\\\");\\n this.className = this.getAttribute(\\\"class\\\");\\n};\\n\\n/*\\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\\n*/\\nMultiWbImageWidget.prototype.refresh = function(changedTiddlers) {\\n\\tvar changedAttributes = this.computeAttributes();\\n\\tif(changedAttributes.scale || changedAttributes.boards || changedAttributes.text || changedAttributes.list || changedAttributes.width || changedAttributes.height || changedAttributes[\\\"class\\\"]) {\\n\\t\\tthis.refreshSelf();\\n\\t\\treturn true;\\n\\t}\\n if (this.boardTitles) {\\n for (var i = 0; i \u003C this.boardTitles.length; i++) {\\n if (changedTiddlers[this.boardTitles[i]]) {\\n this.refreshSelf();\\n return true;\\n }\\n }\\n }\\n\\treturn false;\\n};\\n\\nexports[\\\"multi-wb-image\\\"] = MultiWbImageWidget;\\nexports[\\\"multi.wb.image\\\"] = MultiWbImageWidget;\\n\\n})();\\n\"},\"$:/Lithic/Widgets/trigger-print.js\":{\"title\":\"$:/Lithic/Widgets/trigger-print.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Widgets/trigger-print.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nA hidden widget that triggers window.print() after a delay, and then cleans up.\\n\\\\*/\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar PrintWidget = function(parseTreeNode,options) {\\n\\tthis.initialise(parseTreeNode,options);\\n};\\n\\nPrintWidget.prototype = new Widget();\\n\\nPrintWidget.prototype.render = function(parent,nextSibling) {\\n\\tthis.parentDomNode = parent;\\n\\tthis.execute();\\n\\t\\n\\tif (typeof window !== \\\"undefined\\\" && !this.printed) {\\n\\t\\tthis.printed = true; // prevent infinite loops on re-render\\n\\t\\tvar self = this;\\n\\t\\tvar delay = parseInt(this.getAttribute(\\\"delay\\\", \\\"1000\\\"), 10);\\n\\t\\t\\n\\t\\tsetTimeout(function() {\\n\\t\\t\\twindow.print();\\n\\t\\t}, delay);\\n\\t}\\n};\\n\\nPrintWidget.prototype.execute = function() {};\\nPrintWidget.prototype.refresh = function() { return false; };\\n\\nexports[\\\"trigger-print\\\"] = PrintWidget;\\n\\n})();\\n\"},\"$:/Lithic/Widgets/wb-image.js\":{\"title\":\"$:/Lithic/Widgets/wb-image.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Widgets/wb-image.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nA widget to extract and display an image from a whiteboard's internal JSON assets.\\n\\\\*/\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar WbImageWidget = function(parseTreeNode,options) {\\n\\tthis.initialise(parseTreeNode,options);\\n};\\n\\n/*\\nInherit from the base widget class\\n*/\\nWbImageWidget.prototype = new Widget();\\n\\n/*\\nRender this widget into the DOM\\n*/\\nWbImageWidget.prototype.render = function(parent,nextSibling) {\\n\\tthis.parentDomNode = parent;\\n\\tthis.computeAttributes();\\n\\tthis.execute();\\n \\n var imgNode = this.document.createElement(\\\"img\\\");\\n if(this.width) {\\n imgNode.setAttribute(\\\"width\\\", this.width);\\n }\\n if(this.height) {\\n imgNode.setAttribute(\\\"height\\\", this.height);\\n }\\n if(this.className) {\\n imgNode.className = this.className;\\n }\\n \\n var src = this.extractImageSrc();\\n if(src) {\\n imgNode.setAttribute(\\\"src\\\", src);\\n } else {\\n // Fallback or error\\n imgNode.setAttribute(\\\"alt\\\", \\\"Whiteboard image not found\\\");\\n imgNode.style.border = \\\"1px dashed var(--lithic-c-code-warn)\\\";\\n imgNode.style.display = \\\"inline-block\\\";\\n if (!this.width) imgNode.style.width = \\\"100px\\\";\\n if (!this.height) imgNode.style.height = \\\"100px\\\";\\n }\\n\\n\\tparent.insertBefore(imgNode,nextSibling);\\n\\tthis.domNodes.push(imgNode);\\n};\\n\\nWbImageWidget.prototype.extractImageSrc = function() {\\n var tiddler = this.wiki.getTiddler(this.boardTitle);\\n if (!tiddler || !tiddler.fields.text) return null;\\n try {\\n var doc = JSON.parse(tiddler.fields.text);\\n if (doc && doc.document && doc.document.assets) {\\n var assets = doc.document.assets;\\n for (var id in assets) {\\n var asset = assets[id];\\n if (asset.type === \\\"image\\\") {\\n if (this.imageName && asset.fileName === this.imageName) {\\n return asset.src;\\n }\\n if (this.assetId && asset.id === this.assetId) {\\n return asset.src;\\n }\\n }\\n }\\n // If neither name nor assetId provided, fallback to the FIRST image found\\n if (!this.imageName && !this.assetId) {\\n for (var firstId in assets) {\\n if (assets[firstId].type === \\\"image\\\") {\\n return assets[firstId].src;\\n }\\n }\\n }\\n }\\n } catch(e) {\\n console.error(\\\"WbImageWidget parse error\\\", e);\\n }\\n return null;\\n};\\n\\n/*\\nCompute the internal state of the widget\\n*/\\nWbImageWidget.prototype.execute = function() {\\n\\tvar boardTitle = this.getAttribute(\\\"board\\\", this.getVariable(\\\"currentTiddler\\\"));\\n\\tif (boardTitle && boardTitle.startsWith(\\\"[[\\\") && boardTitle.endsWith(\\\"]]\\\")) {\\n\\t\\tboardTitle = boardTitle.substring(2, boardTitle.length - 2);\\n\\t}\\n\\tthis.boardTitle = boardTitle;\\n\\tthis.imageName = this.getAttribute(\\\"name\\\");\\n this.assetId = this.getAttribute(\\\"assetId\\\");\\n\\tthis.width = this.getAttribute(\\\"width\\\", \\\"80%\\\");\\n\\tthis.height = this.getAttribute(\\\"height\\\");\\n this.className = this.getAttribute(\\\"class\\\");\\n};\\n\\n/*\\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\\n*/\\nWbImageWidget.prototype.refresh = function(changedTiddlers) {\\n\\tvar changedAttributes = this.computeAttributes();\\n\\tif(changedAttributes.board || changedAttributes.name || changedAttributes.assetId || changedAttributes.width || changedAttributes.height || changedAttributes[\\\"class\\\"] || changedTiddlers[this.boardTitle]) {\\n\\t\\tthis.refreshSelf();\\n\\t\\treturn true;\\n\\t}\\n\\treturn false;\\n};\\n\\nexports[\\\"wb-image\\\"] = WbImageWidget;\\n\\n})();\\n\"},\"$:/lithic/buttons/FullscreenWhiteboard\":{\"title\":\"$:/lithic/buttons/FullscreenWhiteboard\",\"tags\":\"$:/tags/PageControls\",\"text\":\"\\\\whitespace trim\\n \u003C$button tooltip=\\\"Fullscreen Paint\\\" aria-label={{$:/language/Buttons/Edit/Caption}} class=\u003C\u003Ctv-config-toolbar-class>> >\\n \u003C$action-setfield $tiddler=\\\"$:/state/sidebar\\\" text=\\\"no\\\"/>\\n \u003C$action-setfield $tiddler=\\\"$:/state/notebook-sidebar\\\" text=\\\"no\\\"/>\\n \u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/WhiteBoard\\\"/>\\n \u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\\\"$:/DefaultCanvas\\\" />\\n \u003C$list filter=\\\"[\u003Ctv-config-toolbar-icons>match[yes]]\\\">\\n {{$:/core/images/palette}}\\n \u003C/$list>\\n \u003C$list filter=\\\"[\u003Ctv-config-toolbar-text>match[yes]]\\\">\\n \u003Cspan class=\\\"tc-btn-text\\\">\\n \u003C$text text=\\\"Fullscreen Whiteboard\\\"/>\\n \u003C/span>\\n \u003C/$list>\\n \u003C/$button>\"},\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/CreateNewTiddlerPopup\":{\"title\":\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/CreateNewTiddlerPopup\",\"tags\":\"\",\"text\":\"\\\\whitespace trim\\n\\n\\\\procedure do-create-whiteboard()\\n\u003C$set name=\\\"rawName\\\" value={{$:/state/lithic/new-whiteboard-name}}>\\n\u003C$set name=\\\"ts\\\" value={{{ [\u003Cnow>format[YYYY0MM0DD0hh0mm0ss]] }}}>\\n\u003C$set name=\\\"finalTitle\\\" value={{{ [\u003CrawName>!is[blank]then\u003CrawName>] ~[\u003Cts>addsuffix[-whiteboard]] }}}>\\n \u003C$action-createtiddler\\n $basetitle=\u003C\u003CfinalTitle>>\\n $template=\\\"$:/DefaultCanvas\\\"\\n type=\\\"application/tldr\\\"\\n $createdtitle=\\\"newTitle\\\"\\n />\\n \u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\u003C\u003CnewTitle>>/>\\n \u003C$action-setfield $tiddler=\\\"$:/state/lithic/new-whiteboard-name\\\" text=\\\"\\\"/>\\n \u003C$action-deletetiddler $tiddler=\\\"$:/state/Whiteboard/PageLayout/CreateNewTiddlerPopup\\\"/>\\n\u003C/$set>\\n\u003C/$set>\\n\u003C/$set>\\n\\\\end\\n\\n\u003Cdiv style=\\\"padding: 8px 10px; display: flex; gap: 6px; align-items: center;\\\" onclick=\\\"event.stopPropagation();\\\">\\n \u003C$keyboard key=\\\"Enter\\\" actions=\u003C\u003Cdo-create-whiteboard>>>\\n \u003C$edit-text\\n tiddler=\\\"$:/state/lithic/new-whiteboard-name\\\"\\n field=\\\"text\\\"\\n placeholder=\\\"Name (blank → timestamp)\\\"\\n tag=\\\"input\\\"\\n type=\\\"text\\\"\\n class=\\\"tc-edit-texteditor\\\"\\n style=\\\"padding: 5px 8px;\\\"\\n focus=\\\"true\\\"\\n />\\n \u003C/$keyboard>\\n \u003C$button class=\\\"tc-btn-big-green\\\" style=\\\"padding: 4px 14px; white-space: nowrap;\\\">\\n Create\\n \u003C\u003Cdo-create-whiteboard>>\\n \u003C/$button>\\n\u003C/div>\\n\"},\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/WhiteBoard\":{\"title\":\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/WhiteBoard\",\"description\":\"show `application/tldr` type tiddlers in full screen whiteboard\",\"name\":\"White Board\",\"tags\":\"$:/tags/Layout\",\"text\":\"\\\\whitespace trim\\n\\\\define containerClasses()\\ntc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$ tw-whiteboard-layout-container\\n\\\\end\\n\\\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\\n\\n\u003C$vars\\n\\ttv-config-toolbar-icons={{$:/config/Toolbar/Icons}}\\n\\ttv-config-toolbar-text={{$:/config/Toolbar/Text}}\\n\\ttv-config-toolbar-class={{$:/config/Toolbar/ButtonClass}}\\n\\ttv-show-missing-links={{$:/config/MissingLinks}}\\n\\tstoryviewTitle={{$:/view}}\\n\\tlanguageTitle={{{ [{$:/language}get[name]] }}}\\n\\tcurrentBoard={{{ [[$:/state/Whiteboard/PageLayout/tiddler]get[text]] ~[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]] }}}>\\n\\n\u003Cdiv class=\u003C\u003CcontainerClasses>>>\\n\\n\u003Cstyle>\\n/* Prevent horizontal scrolling from wide tooltips overflowing the screen edges */\\nbody { overflow-x: hidden; }\\n\u003C/style>\\n\\n\u003C$navigator story=\\\"$:/StoryList\\\" history=\\\"$:/HistoryList\\\" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>\\n\\n\u003Cmain class=\\\"tw-whiteboard-layout-main-area\\\">\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"nomatch\\\" text=\\\"\\\">\\n\\t\\t\u003C$whiteboard tiddler={{$:/state/Whiteboard/PageLayout/tiddler}} height=\\\"100vh\\\" />\\n\\t\u003C/$reveal>\\n\\t\u003C!-- default value, when first opened, select widget's state tiddler is empty, but default value filter gives a value, we show that tiddler -->\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"match\\\" text=\\\"\\\">\\n\\t\\t\u003C$list filter='[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]'>\\n\\t\\t\\t\u003C$whiteboard tiddler={{{[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]}}} height=\\\"100vh\\\" />\\n\\t\\t\u003C/$list>\\n\\t\u003C/$reveal>\\n\\t\u003C!-- Floating Comptext UI -->\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/ComptextPopup\\\" type=\\\"match\\\" text=\\\"open\\\">\\n\\t\\t\u003Cdiv class=\\\"lithic-floating-comptext-wrapper\\\" style=\\\"position:fixed; top:45%; left:50%; margin-left: -125px; margin-top: -30px; z-index: 999999; width: 250px; max-width: 90vw;\\\">\\n\\t\\t\\t\u003Cstyle>\\n\\t\\t\\t.lithic-floating-comptext-wrapper { position: relative; }\\n\\t\\t\\t.lithic-floating-comptext-wrapper .tc-block-dropdown.ect-block-dropdown {\\n\\t\\t\\t\\ttop: 100% !important;\\n\\t\\t\\t\\tleft: 0 !important;\\n\\t\\t\\t\\tmargin-top: 5px !important;\\n\\t\\t\\t\\tposition: absolute !important;\\n\\t\\t\\t\\twidth: 100% !important;\\n\\t\\t\\t\\tmax-width: 100% !important;\\n\\t\\t\\t}\\n\\t\\t\\t\u003C/style>\\n\\t\\t\\t\u003C$keyboard key=\\\"Escape\\\" actions=\\\"\u003C$action-setfield $tiddler='$:/state/Whiteboard/ComptextPopup' text='closed'/>\\\">\\n\\t\\t\\t\\t\u003C$keyboard key=\\\"Enter\\\" actions=\\\"\u003C$action-dispatch-paste tiddler='$:/temp/whiteboard-comptext-input'/>\u003C$action-setfield $tiddler='$:/state/Whiteboard/ComptextPopup' text='closed'/>\\\">\\n\\t\\t\\t\\t\\t\u003C$edit-comptext tag=\\\"input\\\" tiddler=\\\"$:/temp/whiteboard-comptext-input\\\" field=\\\"text\\\" class=\\\"tc-edit-texteditor lithic-floating-comptext-input\\\" placeholder=\\\"Type command or link...\\\" style=\\\"width: 100%; border: 1px solid \u003C\u003Ccolour table-border>>; padding: 8px; font-size: 1.2em; outline: none; box-sizing: border-box; background: \u003C\u003Ccolour page-background>>; box-shadow: 0 4px 10px rgba(0,0,0,0.1); border-radius: 4px;\\\" />\\n\\t\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\u003C/div>\\n\\t\u003C/$reveal>\\n\u003C/main>\\n\\n\u003C!-- put this below main, so nav bar is layered on top of the main. In UI, this nav in on the top of the page. -->\\n\u003Cnav class=\\\"tw-whiteboard-layout-top-bar\\\">\\n\\t\u003C!-- Searchable combobox replacing standard select -->\\n\\t\u003Cspan style=\\\"position:relative; display:inline-flex; align-items:center;\\\" onmousedown=\\\"event.stopPropagation();\\\" onpointerdown=\\\"event.stopPropagation();\\\" onclick=\\\"event.stopPropagation();\\\">\\n\\t\\t\\n\\n\\n\\t\\t\u003C$let\\n\\t\\t\\tsearchState=\\\"$:/state/Whiteboard/PageLayout/search\\\"\\n\\t\\t\\tdropdownState=\\\"$:/state/Whiteboard/PageLayout/dropdown\\\"\\n\\t\\t\\tcurrentBoard={{{ [[$:/state/Whiteboard/PageLayout/tiddler]get[text]] ~[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]] }}}\\n\\t\\t>\\n\\t\\t\\t\u003C$keyboard key=\\\"Escape\\\" actions=\\\"\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\u003C$action-setfield $tiddler=\u003C\u003CsearchState>> text=''/>\\\">\\n\\t\\t\\t\\t\u003Cstyle>\\n\\t\\t\\t\\t.lithic-wb-search-input { color: \u003C\u003Ccolour muted-foreground>> !important; }\\n\\t\\t\\t\\t.lithic-wb-search-input::placeholder { color: \u003C\u003Ccolour foreground>> !important; opacity: 1; }\\n\\t\\t\\t\\t\u003C/style>\\n\\t\\t\\t\\t\u003Cdiv style=\\\"display:flex; border: 1px solid \u003C\u003Ccolour table-border>>; background: \u003C\u003Ccolour page-background>>; align-items: stretch; border-radius: 3px;\\\">\\n\\t\\t\\t\\t\\t\u003C$keyboard key=\\\"Enter\\\" actions=\\\"\\\"\\\"\\n\\t\\t\\t\\t\\t\\t\u003C$let searchTerm={{{ [\u003CsearchState>get[text]] }}}>\\n\\t\\t\\t\\t\\t\\t\\t\u003C$list filter=\\\"[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]search:title\u003CsearchTerm>!sort[modified]limit[1]]\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\u003C\u003CcurrentTiddler>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CsearchState>> text=\\\"\\\"/>\\n\\t\\t\\t\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\\t\\t\\t\u003C/$let>\\n\\t\\t\\t\\t\\t\\\"\\\"\\\">\\n\\t\\t\\t\\t\\t\\t\u003C$edit-text \\n\\t\\t\\t\\t\\t\\t\\ttiddler=\u003C\u003CsearchState>> \\n\\t\\t\\t\\t\\t\\t\\ttag=\\\"input\\\" \\n\\t\\t\\t\\t\\t\\t\\tplaceholder={{{ [\u003CcurrentBoard>!is[blank]then\u003CcurrentBoard>] ~[[Search boards...]] }}}\\n\\t\\t\\t\\t\\t\\t\\tdefault=\\\"\\\" \\n\\t\\t\\t\\t\\t\\t\\tclass=\\\"tc-edit-texteditor lithic-wb-search-input\\\" \\n\\t\\t\\t\\t\\t\\t\\tstyle=\\\"width: 230px; padding: 4px 6px; border: none; outline: none; background: transparent; box-shadow: none;\\\"\\n\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\\t\\t\\t\u003C$button class=\\\"tc-btn-invisible\\\" style=\\\"padding: 2px 8px; border-left: 1px solid \u003C\u003Ccolour table-border>>; cursor: pointer; display: flex; align-items: center; justify-content: center; fill: currentColor;\\\">\\n\\t\\t\\t\\t\\t\\t\u003C$list filter=\\\"[\u003CdropdownState>get[text]match[open]]\\\" emptyMessage=\\\"\u003C$action-setfield $tiddler=\u003C\u003CdropdownState>> text='open'/>\u003Cspan style='width:1em; height:1em;'>{{$:/core/images/down-arrow}}\u003C/span>\\\">\\n\\t\\t\\t\\t\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\\n\\t\\t\\t\\t\\t\\t\\t\u003Cspan style=\\\"width:1em; height:1em;\\\">{{$:/core/images/up-arrow}}\u003C/span>\\n\\t\\t\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\\t\\t\u003C/$button>\\n\\t\\t\\t\\t\u003C/div>\\n\\n\\t\\t\\t\\t\u003C$list filter=\\\"[\u003CdropdownState>get[text]match[open]] [\u003CsearchState>get[text]!is[blank]] +[limit[1]then[show]]\\\" variable=\\\"ignore\\\">\\n\\t\\t\\t\\t\\t\u003Cdiv style=\\\"position:absolute; top:100%; left:0; z-index:9999; margin-top: 2px;\\\">\\n\\t\\t\\t\\t\\t\\t\u003Cdiv class=\\\"tc-drop-down\\\" style=\\\"min-width: 250px; max-height: 400px; overflow-y: auto;\\\">\\n\\t\\t\\t\\t\\t\\t\\t\u003C$let searchTerm={{{ [\u003CsearchState>get[text]] }}}>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$list filter=\\\"[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]search:title\u003CsearchTerm>!sort[modified]limit[10]]\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$button class=\\\"tc-btn-invisible\\\" style=\\\"display:block; width:100%; text-align:left; padding: 4px 8px;\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\u003C\u003CcurrentTiddler>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CsearchState>> text=\\\"\\\"/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$view field=\\\"title\\\"/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C/$button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\\t\\t\\t\\t\u003C/$let>\\n\\t\\t\\t\\t\\t\\t\u003C/div>\\n\\t\\t\\t\\t\\t\u003C/div>\\n\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\u003C/$let>\\n\\t\u003C/span>\\n\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"nomatch\\\" text=\\\"\\\">\\n\\t\\t\u003C$button tooltip=\\\"Open In StoryView\\\">\\n\\t\\t\\t{{$:/core/images/home-button}}\\n\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/core/ui/PageTemplate\\\"/>\\n\\t\\t\u003C/$button>\\n\\t\u003C/$reveal>\\n\\t\u003C!-- default value, when first opened, select widget's state tiddler is empty, but default value filter gives a value, we show that tiddler -->\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"match\\\" text=\\\"\\\">\\n\\t\\t\u003C$list filter='[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]'>\\n\\t\\t\\t\u003C$button tooltip=\\\"Open In StoryView\\\">\\n\\t\\t\\t\\t{{$:/core/images/home-button}}\\n\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/core/ui/PageTemplate\\\"/>\\n\\t\\t\\t\\t\u003C$action-navigate $to={{{[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]}}} />\\n\\t\\t\\t\u003C/$button>\\n\\t\\t\u003C/$list>\\n\\t\u003C/$reveal>\\n\\n\\t\u003C$button tooltip=\\\"New Whiteboard\\\" popup=\\\"$:/state/Whiteboard/PageLayout/CreateNewTiddlerPopup\\\">\\n\\t\\t{{$:/core/images/new-button}}\\n\\t\u003C/$button>\\n\\t\u003C$reveal type=\\\"popup\\\" state=\\\"$:/state/Whiteboard/PageLayout/CreateNewTiddlerPopup\\\">\\n\\t\\t{{$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/CreateNewTiddlerPopup}}\\n\\t\u003C/$reveal>\\n\\n\\t\u003Cspan class=\\\"lithic-wb-save-btn\\\">\\n\\t\\t\u003C$button tooltip=\\\"Print Sequential Whiteboard\\\" class=\\\"tc-btn-invisible\\\">\\n\\t\\t\\t{{$:/core/images/print-button}}\\n\\t\\t\\t\u003C$vars currentBoard={{{ [[$:/state/Whiteboard/PageLayout/tiddler]get[text]] ~[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]] }}}>\\n\\t\\t\\t\\t\u003C$vars wbHeight={{{ [\u003CcurrentBoard>get[whiteboard-height]] ~[[540px]] }}}>\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"\\\" />\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/StoryList\\\" list=\\\"\\\" />\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"Print Sequential Whiteboard\\\" text={{{ [[\u003C\u003Cdraw-sequential \\\"]] [\u003CcurrentBoard>] [[\\\" \\\"]] [\u003CwbHeight>] [[\\\">>\u003C$trigger-print delay=\\\"1000\\\" />]] +[join[]] }}} />\\n\\t\\t\\t\\t\\t\u003C$action-navigate $to=\\\"Print Sequential Whiteboard\\\" />\\n\\t\\t\\t\\t\u003C/$vars>\\n\\t\\t\\t\u003C/$vars>\\n\\t\\t\u003C/$button>\\n\\t\u003C/span>\\n\\n\\t\u003Cspan class=\\\"lithic-wb-save-btn\\\">{{$:/core/ui/Buttons/save-wiki}}\u003C/span>\\n\u003C/nav>\\n\\n{{$:/plugins/tobibeer/preview/popups}}\\n\u003C/$navigator>\\n\\n\u003C!-- Phones held in portrait cannot fit this layout: the board is taller than\\n\\tit is wide and the 400px top bar has no room for its controls. So instead\\n\\tof letting the board half-render, this gate covers the viewport and asks\\n\\tfor a rotation. It is hidden everywhere else, desktops included (see\\n\\t$:/Lithic/Patches/Whiteboard/LandscapeGate), and carries an exit so a\\n\\tportrait visitor is never trapped in the layout. -->\\n\u003Cdiv class=\\\"lithic-wb-rotate-gate\\\">\\n\\t\u003Csvg class=\\\"lithic-wb-rotate-gate-glyph\\\" width=\\\"72\\\" height=\\\"72\\\" viewBox=\\\"0 0 64 64\\\" aria-hidden=\\\"true\\\" focusable=\\\"false\\\">\\n\\t\\t\u003Cpath d=\\\"M54 32a22 22 0 1 1-22-22\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"3\\\" stroke-linecap=\\\"round\\\"/>\\n\\t\\t\u003Cpath d=\\\"M28 6 33 10 28 14\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"3\\\" stroke-linecap=\\\"round\\\"/>\\n\\t\\t\u003Crect x=\\\"23\\\" y=\\\"17\\\" width=\\\"18\\\" height=\\\"30\\\" rx=\\\"5\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"3\\\"/>\\n\\t\\t\u003Cpath d=\\\"M30 42h4\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\"/>\\n\\t\u003C/svg>\\n\\t\u003Cp class=\\\"lithic-wb-rotate-gate-title\\\">Rotate your device\u003C/p>\\n\\t\u003Cp class=\\\"lithic-wb-rotate-gate-hint\\\">The whiteboard needs a landscape screen.\u003C/p>\\n\\t\u003C$button class=\\\"lithic-wb-rotate-gate-exit\\\" tooltip=\\\"Open In StoryView\\\">\\n\\t\\tExit whiteboard\\n\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/core/ui/PageTemplate\\\"/>\\n\\t\u003C/$button>\\n\u003C/div>\\n\\n\u003C/div>\\n\\n\u003C/$vars>\"},\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/ViewToolbar/images/OpenInFullScreenWhiteBoardButtonImage\":{\"title\":\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/ViewToolbar/images/OpenInFullScreenWhiteBoardButtonImage\",\"tags\":\"$:/tags/Image\",\"text\":\"{{$:/core/images/palette}}\"},\"$:/plugins/xyvir/lithic-patch-whiteboard/tldr-parser.js\":{\"title\":\"$:/plugins/xyvir/lithic-patch-whiteboard/tldr-parser.js\",\"type\":\"application/javascript\",\"module-type\":\"parser\",\"text\":\"/*\\\\\\ntitle: $:/plugins/xyvir/lithic-patch-whiteboard/tldr-parser.js\\ntype: application/javascript\\nmodule-type: parser\\n\\nParses application/tldr to automatically render the whiteboard widget\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nvar TldrParser = function(type, text, options) {\\n var tiddlerTitle = \\\"\\\";\\n try {\\n var data = JSON.parse(text);\\n var docName = data.document ? data.document.name : \\\"\\\";\\n if (docName && options.wiki && options.wiki.tiddlerExists(docName)) {\\n tiddlerTitle = docName;\\n }\\n } catch(e) {}\\n\\n // Fallback search if the tiddler was not found under docName\\n if (!tiddlerTitle && options.wiki) {\\n options.wiki.eachTiddlerPlusShadows(function(tiddler, title) {\\n if (tiddler && tiddler.fields.type === \\\"application/tldr\\\" && tiddler.fields.text === text) {\\n tiddlerTitle = title;\\n }\\n });\\n }\\n\\n var tiddler = options.wiki ? options.wiki.getTiddler(tiddlerTitle) : null;\\n var height = (tiddler && tiddler.fields[\\\"whiteboard-height\\\"]) || \\\"540px\\\";\\n var wikitext = '\u003C$wb-image board=\\\"' + tiddlerTitle + '\\\" height=\\\"' + height + '\\\" width=\\\"80%\\\"/>';\\n var parser = options.wiki ? options.wiki.parseText(\\\"text/vnd.tiddlywiki\\\", wikitext, {parseAsInline: false}) : null;\\n this.tree = parser ? parser.tree : [];\\n};\\n\\nexports[\\\"application/tldr\\\"] = TldrParser;\\n})();\\n\"},\"$:/Lithic/Macros/draw-sequential\":{\"title\":\"$:/Lithic/Macros/draw-sequential\",\"tags\":\"$:/tags/Global\",\"text\":\"\\\\procedure draw-sequential(source, height:\\\"540px\\\")\\n\u003C$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [\u003Csource>removeprefix\u003Cleft>removesuffix\u003Cright>] ~[\u003Csource>] }}}\\n>\\n\u003Cdiv class=\\\"sequential-whiteboard-container\\\">\\n\u003C$let pageCount={{{ [\u003Cclean>get[text]jsonindexes[document],[pages]count[]] }}}>\\n\u003C$list filter=\\\"[range[0],\u003CpageCount>!match\u003CpageCount>]\\\" variable=\\\"targetIndex\\\">\\n\u003Cdiv class=\\\"lithic-seq-step\\\" style=\\\"margin-bottom: 5px; padding: 0; border: none; page-break-inside: avoid; break-inside: avoid;\\\">\\n\u003C$let pageTiddler={{{ [\u003Cclean>whiteboard-page\u003CtargetIndex>] }}}>\\n\u003C$whiteboard tiddler=\u003C\u003CpageTiddler>> height=\u003C\u003Cheight>> readonly=\\\"yes\\\" />\\n\u003C/$let>\\n\u003C/div>\\n\u003C/$list>\\n\u003C/$let>\\n\u003C/div>\\n\u003C/$let>\\n\\\\end\"},\"$:/Lithic/Filters/PruneWhiteboard.js\":{\"title\":\"$:/Lithic/Filters/PruneWhiteboard.js\",\"type\":\"application/javascript\",\"module-type\":\"filteroperator\",\"text\":\"(function(){\\n\\\"use strict\\\";\\n\\nexports[\\\"whiteboard-page\\\"] = function(source,operator,options) {\\n var results = [];\\n source(function(tiddler,title) {\\n var index = parseInt(operator.operand) || 0;\\n var sourceTiddler = options.wiki.getTiddler(title);\\n if(!sourceTiddler || sourceTiddler.fields.type !== \\\"application/tldr\\\") {\\n results.push(title); return;\\n }\\n try {\\n var data = JSON.parse(sourceTiddler.fields.text);\\n var root = data.document || data;\\n var pages = root.pages;\\n if(!pages) { results.push(title); return; }\\n\\n // Sort existing page IDs by childIndex\\n var pageIds = Object.keys(pages).sort((a,b) => (pages[a].childIndex || 0) - (pages[b].childIndex || 0));\\n \\n // Boundary check\\n if(index \u003C 0 || index >= pageIds.length) { results.push(title); return; }\\n \\n var targetId = pageIds[index];\\n var originalPage = pages[targetId];\\n\\n // CRITICAL TRICK: Rename this page to \\\"page\\\" so the widget defaults to it\\n var newPages = { \\\"page\\\": JSON.parse(JSON.stringify(originalPage)) };\\n newPages[\\\"page\\\"].id = \\\"page\\\";\\n newPages[\\\"page\\\"].name = \\\"Isolated Page \\\" + (index + 1);\\n\\n // Clone the page state if it exists, also renaming it to \\\"page\\\"\\n var newPageStates = {};\\n if(root.pageStates && root.pageStates[targetId]) {\\n newPageStates[\\\"page\\\"] = JSON.parse(JSON.stringify(root.pageStates[targetId]));\\n newPageStates[\\\"page\\\"].id = \\\"page\\\";\\n }\\n\\n // Construct the single-page document\\n var snapshotData = JSON.parse(JSON.stringify(data));\\n var snapRoot = snapshotData.document || snapshotData;\\n snapRoot.pages = newPages;\\n snapRoot.pageStates = newPageStates;\\n\\n var targetTitle = \\\"$:/temp/lithic/split/\\\" + title + \\\"/p\\\" + index;\\n var jsonString = JSON.stringify(snapshotData);\\n\\n if(options.wiki.getTiddlerText(targetTitle) !== jsonString) {\\n options.wiki.addTiddler(new $tw.Tiddler({\\n title: targetTitle, text: jsonString, type: \\\"application/tldr\\\", \\\"hide-body\\\": \\\"yes\\\"\\n }));\\n }\\n results.push(targetTitle);\\n } catch(e) { results.push(title); }\\n });\\n return results;\\n};\\n})();\"}}}"}, +{"created":"20260110200549392","title":"$:/plugins/xyvir/lithic-patch-whiteboard","author":"Xyvir","description":"Integration logic and UI enhancements for whiteboard and freehand drawing tools within the Story River.","plugin-type":"plugin","version":"0.0.1","modified":"20260110230834139","parent-plugin":"$:/plugins/linonetwo/tw-whiteboard","plugin-priority":"2","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/DefaultCanvas\":{\"title\":\"$:/DefaultCanvas\",\"type\":\"application/tldr\",\"text\":\"{\\\"document\\\":{\\\"id\\\":\\\"doc\\\",\\\"name\\\":\\\"$:/DefaultCanvas\\\",\\\"version\\\":15.5,\\\"pages\\\":{\\\"page\\\":{\\\"id\\\":\\\"page\\\",\\\"name\\\":\\\"Page 1\\\",\\\"childIndex\\\":1,\\\"shapes\\\":{},\\\"bindings\\\":{}}},\\\"pageStates\\\":{\\\"page\\\":{\\\"id\\\":\\\"page\\\",\\\"selectedIds\\\":[],\\\"camera\\\":{\\\"point\\\":[0,0],\\\"zoom\\\":1}}},\\\"assets\\\":{}},\\\"updatedCount\\\":70}\"},\"$:/Lithic/Macros/draw\":{\"title\":\"$:/Lithic/Macros/draw\",\"tags\":\"$:/tags/Global\",\"text\":\"\\\\procedure draw(id, height:\\\"540px\\\")\\n\u003C$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [\u003Cid>removeprefix\u003Cleft>removesuffix\u003Cright>] ~[\u003Cid>] }}}\\n>\\n\u003C$vars boardTitle={{{ [\u003Cclean>!is[blank]] ~[\u003CcurrentTiddler>addsuffix[-draw]] }}}>\\n\u003Cdiv \\n class=\\\"tc-tiddler-frame lithic-inline-board\\\" \\n data-tiddler-title=\u003C\u003CboardTitle>> \\n style=\\\"border:none; box-shadow:none; background:none; padding:0; margin:0; position:relative;\\\"\\n>\\n \u003Cdiv class=\\\"tc-tiddler-body\\\" style=\\\"padding:0; margin:0; border:none;\\\">\\n \u003C$reveal state=\\\"$:/state/Lithic/BootComplete\\\" type=\\\"match\\\" text=\\\"yes\\\" default=\\\"no\\\">\\n \u003C$whiteboard tiddler=\u003C\u003CboardTitle>> height=\u003C\u003Cheight>> />\\n \u003C/$reveal>\\n \u003C/div>\\n\u003C/div>\\n\u003C/$vars>\\n\u003C/$let>\\n\\\\end\"},\"$:/Lithic/Macros/wb-image\":{\"title\":\"$:/Lithic/Macros/wb-image\",\"tags\":\"$:/tags/Macro\",\"text\":\"\\\\define wb-image(board, width:\\\"80%\\\")\\n\u003C$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [\u003C__board__>removeprefix\u003Cleft>removesuffix\u003Cright>] ~[\u003C__board__>] }}}\\n>\\n\u003C$wb-image board=\u003C\u003Cclean>> width=\u003C\u003C__width__>> />\\n\u003C/$let>\\n\\\\end\\n\"},\"$:/Lithic/Patches/AutoCloseKeepOpen.js\":{\"title\":\"$:/Lithic/Patches/AutoCloseKeepOpen.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/AutoCloseKeepOpen.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nWatches for the Text tool's specific style options (Align/Font) and automatically \\nturns off \\\"Keep Style Menu Open\\\" to prevent the shape.id crash bug.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-auto-close-keep-open\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n \\n function disableKeepOpen() {\\n var clicked = false;\\n \\n // 1. Check Preferences Menu Button by ID\\n var keepOpenBtn = document.getElementById('TD-Styles-Keep-Open');\\n if (keepOpenBtn && (keepOpenBtn.getAttribute('data-state') === 'checked' || keepOpenBtn.getAttribute('aria-checked') === 'true')) {\\n keepOpenBtn.click();\\n clicked = true;\\n }\\n \\n // 2. Check Palette Menu option by text\\n var spans = document.querySelectorAll('.tw-whiteboard-tldraw-container span');\\n for (var i = 0; i \u003C spans.length; i++) {\\n if (spans[i].textContent === \\\"Keep Style Menu Open\\\" || spans[i].textContent === \\\"Keep Open\\\") {\\n var wrapper = spans[i].closest('button, .c-kuOiws');\\n if (wrapper && wrapper.id !== 'TD-Styles-Keep-Open') {\\n // Look for the checked state\\n if (wrapper.querySelector('[data-state=\\\"checked\\\"]') || wrapper.getAttribute('data-state') === 'checked') {\\n wrapper.click();\\n clicked = true;\\n }\\n }\\n }\\n }\\n \\n if (clicked) {\\n setTimeout(function() {\\n var escEvent = new KeyboardEvent('keydown', {\\n key: 'Escape',\\n code: 'Escape',\\n keyCode: 27,\\n which: 27,\\n bubbles: true,\\n cancelable: true\\n });\\n document.dispatchEvent(escEvent);\\n }, 10);\\n }\\n }\\n\\n if (typeof document !== \\\"undefined\\\") {\\n var observer = new MutationObserver(function(mutations) {\\n // If the specific Text tool UI is present in the DOM\\n if (document.getElementById('TD-Styles-Align-Container')) {\\n disableKeepOpen();\\n }\\n });\\n \\n // Observe the document body for any DOM additions/removals\\n observer.observe(document.body, { childList: true, subtree: true });\\n }\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/BootDelay/StartupScript.js\":{\"title\":\"$:/Lithic/Patches/BootDelay/StartupScript.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/BootDelay/StartupScript.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nSets a state flag after the TiddlyWiki boot sequence is completely finished.\\nThis flag is used to delay the rendering of React widgets (like the whiteboard)\\nto prevent them from interfering with TiddlyWiki's initial core DOM setup.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-boot-delay-flag\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n // Wait a brief moment after the synchronous startup completes\\n // to ensure the DOM is fully settled.\\n setTimeout(function() {\\n $tw.wiki.setText(\\\"$:/state/Lithic/BootComplete\\\", \\\"text\\\", null, \\\"yes\\\");\\n console.log(\\\"[Lithic] Boot sequence completely settled. BootComplete flag set to 'yes'.\\\");\\n }, 250);\\n};\\n\\n})();\\n\"},\"$:/Lithic/Patches/IsolateDoubleClicks\":{\"title\":\"$:/Lithic/Patches/IsolateDoubleClicks\",\"module-type\":\"startup\",\"tags\":\"\",\"type\":\"application/javascript\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/IsolateDoubleClicks\\ntype: application/javascript\\nmodule-type: startup\\n\\nPrevents double-click events inside the Tldraw widget from bubbling up \\nand triggering the Streams \\\"double click to edit\\\" action.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-isolate-double-clicks\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n\\n var addIsolation = function (node) {\\n // Avoid attaching twice\\n if (node.dataset.lithicDblClickIsolated) return;\\n\\n // Listen for double clicks and kill them before they bubble to Streams\\n node.addEventListener('dblclick', function (e) {\\n e.stopPropagation();\\n // console.log(\\\"🛡️ Lithic: Stopped double-click from triggering Streams.\\\");\\n }, false); // Bubble phase\\n\\n node.dataset.lithicDblClickIsolated = \\\"active\\\";\\n };\\n\\n // Watch for new Tldraw containers appearing in the DOM\\n var observer = new MutationObserver(function (mutations) {\\n mutations.forEach(function (mutation) {\\n mutation.addedNodes.forEach(function (node) {\\n if (node.nodeType !== 1) return;\\n\\n // 1. Check if the added node IS the container\\n if (node.classList.contains('tw-whiteboard-tldraw-container')) {\\n addIsolation(node);\\n }\\n // 2. Check if the container is INSIDE the added node\\n else if (node.querySelector) {\\n var containers = node.querySelectorAll('.tw-whiteboard-tldraw-container');\\n for (var i = 0; i \u003C containers.length; i++) {\\n addIsolation(containers[i]);\\n }\\n }\\n });\\n });\\n });\\n\\n if (document.body) {\\n observer.observe(document.body, { childList: true, subtree: true });\\n }\\n };\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nAction widget to dispatch a synthetic paste event containing the comptext input to Tldraw.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar ActionDispatchPaste = function(parseTreeNode,options) {\\n this.initialise(parseTreeNode,options);\\n};\\n\\nActionDispatchPaste.prototype = new Widget();\\n\\nActionDispatchPaste.prototype.render = function(parent,nextSibling) {\\n this.computeAttributes();\\n this.execute();\\n};\\n\\nActionDispatchPaste.prototype.execute = function() {\\n this.tiddlerName = this.getAttribute(\\\"tiddler\\\", \\\"$:/temp/whiteboard-comptext-input\\\");\\n this.boardStateTiddler = \\\"$:/state/Whiteboard/PageLayout/tiddler\\\";\\n};\\n\\nActionDispatchPaste.prototype.refresh = function(changedTiddlers) {\\n var changedAttributes = this.computeAttributes();\\n if(changedAttributes.tiddler) {\\n this.refreshSelf();\\n return true;\\n }\\n return this.refreshChildren(changedTiddlers);\\n};\\n\\n// Generates a random UUID v4 ending with 'c001' so we can target it via CSS\\nfunction generateUUID() {\\n var base = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxc001'.replace(/[xy]/g, function(c) {\\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\\n return v.toString(16);\\n });\\n return base;\\n}\\n\\nActionDispatchPaste.prototype.invokeAction = function(triggeringWidget,event) {\\n var text = $tw.wiki.getTiddlerText(this.tiddlerName);\\n if (!text) return true; // nothing to paste\\n\\n // Determine which whiteboard is currently active\\n var currentBoard = $tw.wiki.getTiddlerText(this.boardStateTiddler);\\n if (!currentBoard) {\\n // Fallback to the first whiteboard modified\\n var tiddlers = $tw.wiki.filterTiddlers(\\\"[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]\\\");\\n if (tiddlers.length > 0) currentBoard = tiddlers[0];\\n }\\n \\n if (!currentBoard) return true;\\n\\n var boardText = $tw.wiki.getTiddlerText(currentBoard);\\n if (!boardText) return true;\\n\\n try {\\n var data = JSON.parse(boardText);\\n var page = data.document.pages.page;\\n \\n // Find the highest childIndex\\n var maxIndex = 0;\\n for (var shapeId in page.shapes) {\\n var shape = page.shapes[shapeId];\\n if (shape.childIndex > maxIndex) maxIndex = shape.childIndex;\\n }\\n\\n var newShapeId = generateUUID();\\n \\n // Create the new sticky note\\n var newShape = {\\n id: newShapeId,\\n type: \\\"sticky\\\",\\n name: \\\"Sticky\\\",\\n parentId: \\\"page\\\",\\n childIndex: maxIndex + 1,\\n point: [200, 200], // We can spawn it top-left or try to center it\\n size: [300, 300],\\n text: text,\\n rotation: 0,\\n style: {\\n color: \\\"black\\\",\\n size: \\\"small\\\",\\n isFilled: false,\\n dash: \\\"draw\\\",\\n scale: 1,\\n font: \\\"sans\\\",\\n textAlign: \\\"middle\\\"\\n }\\n };\\n\\n // Center it around the camera if possible\\n if (data.pageStates && data.pageStates.page && data.pageStates.page.camera) {\\n var cam = data.pageStates.page.camera.point;\\n newShape.point = [-(cam[0]) + 300, -(cam[1]) + 300];\\n }\\n\\n page.shapes[newShapeId] = newShape;\\n\\n // Write it back to the tiddler\\n $tw.wiki.setText(currentBoard, \\\"text\\\", null, JSON.stringify(data));\\n\\n } catch(e) {\\n console.error(\\\"Failed to inject shape into whiteboard JSON\\\", e);\\n }\\n\\n return true; // Action was invoked\\n};\\n\\nexports[\\\"action-dispatch-paste\\\"] = ActionDispatchPaste;\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/ComptextBridge.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/ComptextBridge.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/ComptextBridge.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nListens for hotkeys (/, [, {) to trigger the floating Comptext UI in the whiteboard.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-comptext-bridge\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n if (typeof window === \\\"undefined\\\" || typeof $tw === \\\"undefined\\\") return;\\n\\n window.addEventListener('keydown', function(event) {\\n // Check if we are in the whiteboard\\n var whiteboardContainer = document.querySelector('.tw-whiteboard-layout-container');\\n if (!whiteboardContainer) return;\\n\\n // Do not trigger if a modal or popup is already open\\n var isPopupOpen = $tw.wiki.getTiddlerText(\\\"$:/state/Whiteboard/ComptextPopup\\\") === \\\"open\\\";\\n if (isPopupOpen) return;\\n\\n // Check if the user is typing in an input field or contenteditable (e.g. existing sticky note)\\n var active = document.activeElement;\\n if (active) {\\n var tag = active.tagName.toUpperCase();\\n if (tag === 'INPUT' || tag === 'TEXTAREA' || active.isContentEditable) {\\n return;\\n }\\n }\\n\\n // Detect hotkeys\\n var key = event.key;\\n if (key === '/' || key === '[' || key === '{') {\\n // Prevent default Tldraw behaviors or scrolling\\n event.preventDefault();\\n event.stopPropagation();\\n\\n var prefill = key;\\n if (key === '[') prefill = '[[';\\n if (key === '{') prefill = '{{';\\n\\n // Set the temporary text\\n $tw.wiki.setText(\\\"$:/temp/whiteboard-comptext-input\\\", \\\"text\\\", null, prefill);\\n \\n // Open the popup\\n $tw.wiki.setText(\\\"$:/state/Whiteboard/ComptextPopup\\\", \\\"text\\\", null, \\\"open\\\");\\n\\n // We need to focus the edit-text widget. We can do it by waiting for the DOM to update.\\n setTimeout(function() {\\n var input = document.querySelector('.lithic-floating-comptext-input');\\n if (input) {\\n input.focus();\\n // Move cursor to the end\\n input.setSelectionRange(prefill.length, prefill.length);\\n }\\n }, 100);\\n }\\n }, true); // Use capture phase so Tldraw doesn't swallow it first!\\n\\n window.addEventListener('click', function(event) {\\n // Intercept clicks on the \\\"Insert Media\\\" button in Tldraw\\n var mediaBtn = event.target.closest('#TD-PrimaryTools-Image');\\n if (mediaBtn) {\\n event.preventDefault();\\n event.stopPropagation();\\n\\n // Clear the input and open the popup\\n $tw.wiki.setText(\\\"$:/temp/whiteboard-comptext-input\\\", \\\"text\\\", null, \\\"\\\");\\n $tw.wiki.setText(\\\"$:/state/Whiteboard/ComptextPopup\\\", \\\"text\\\", null, \\\"open\\\");\\n\\n // Focus the input\\n setTimeout(function() {\\n var input = document.querySelector('.lithic-floating-comptext-input');\\n if (input) {\\n input.focus();\\n }\\n }, 100);\\n }\\n }, true);\\n\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nSimulates a click on the tldraw trash can icon when the Delete or Backspace key is pressed,\\nas TiddlyWiki or Streams sometimes swallows keyboard shortcuts.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-delete-simulator\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n if (typeof document !== \\\"undefined\\\") {\\n document.addEventListener('keydown', function(e) {\\n // Only respond to Delete or Backspace\\n if (e.key !== 'Delete' && e.key !== 'Backspace') return;\\n \\n console.log(\\\"[DeleteSimulator] Caught key:\\\", e.key, \\\"Target:\\\", e.target);\\n \\n if (!e.target) return;\\n \\n // Ignore if typing in an input\\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.isContentEditable) {\\n console.log(\\\"[DeleteSimulator] Ignored because target is input/textarea/contenteditable.\\\");\\n return;\\n }\\n \\n // Also ignore if inside the tldraw text editor container\\n if (typeof e.target.closest === 'function') {\\n if (e.target.closest('.tl-text-editor') || e.target.closest('.c-fOQRlS') || e.target.closest('.tl-absolute')) {\\n console.log(\\\"[DeleteSimulator] Ignored because target is inside tldraw text editor.\\\");\\n return;\\n }\\n }\\n \\n var deleteBtnWrapper = document.getElementById('TD-Delete');\\n if (deleteBtnWrapper) {\\n console.log(\\\"[DeleteSimulator] Found #TD-Delete wrapper in DOM.\\\");\\n var deleteBtn = deleteBtnWrapper.querySelector('button');\\n if (deleteBtn) {\\n console.log(\\\"[DeleteSimulator] Found button inside wrapper! Dispatching pointerdown and click...\\\");\\n \\n var eventInit = { bubbles: true, cancelable: true, button: 0 };\\n deleteBtn.dispatchEvent(new PointerEvent('pointerdown', eventInit));\\n deleteBtn.dispatchEvent(new MouseEvent('mousedown', eventInit));\\n deleteBtn.dispatchEvent(new PointerEvent('pointerup', eventInit));\\n deleteBtn.dispatchEvent(new MouseEvent('mouseup', eventInit));\\n deleteBtn.click();\\n \\n e.preventDefault();\\n e.stopPropagation();\\n } else {\\n console.log(\\\"[DeleteSimulator] ERROR: Could not find \u003Cbutton> inside #TD-Delete\\\");\\n }\\n } else {\\n console.log(\\\"[DeleteSimulator] #TD-Delete not found in DOM.\\\");\\n }\\n }, true); // Use capture phase to act before other handlers\\n }\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/FirstVisitFit.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/FirstVisitFit.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/FirstVisitFit.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nThe first time a page is opened it is fitted to its content, not to the\\ncamera it was saved with.\\n\\ntldraw keeps a camera per page inside the document, so a board reopened on a\\npage you once zoomed into comes back at that zoom. That is right for a page\\nyou have already read and wrong for one you have not: a freshly imported PDF\\nopens at whatever the importer's own camera happened to be, at 100% on one\\ncorner of a sheet. So the first visit to a page in a session runs the board's\\nown zoomToFit, and every later visit leaves the saved camera alone, which is\\nwhat makes flipping back to a page you were working on land where you left it.\\n\\nBoth ways in end in the same fact, which is why one tracker covers them: the\\nlayout's board selector loads a whole different document into the widget, and\\nthe page controls change the page within it, so watching the document and the\\npage together catches a change of either.\\n\\nOnly the fullscreen layout is tracked. An inline board in the story river is\\nthe same tiddler drawn small, and fitting there would spend the page's first\\nvisit on a 540px board and then open the layout zoomed out to fit a strip.\\n\\nThe camera is moved through zoomToFit rather than recomputed here, so this is\\nthe same fit the View menu's Zoom to Fit performs, and it is saved the way any\\nother camera change is.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-first-visit-fit\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\n// The layout's own board, never an inline one from the story river.\\nvar BOARD_SELECTOR = \\\".tw-whiteboard-layout-container .tl-container\\\";\\n\\n// A React re-mount can replace the app behind a container, so it is resolved\\n// again now and then instead of being trusted for the life of the container.\\nvar RESOLVE_EVERY_FRAMES = 30;\\n\\nvar appCache = new WeakMap();\\nvar appIds = new WeakMap();\\nvar nextAppId = 0;\\nvar boards = [];\\nvar visited = Object.create(null);\\nvar frameHandle = null;\\nvar frame = 0;\\n\\nvar resolveApp = function(container, refresh) {\\n\\tif(!refresh && appCache.has(container)) return appCache.get(container);\\n\\tvar key = Object.keys(container).filter(function(name) {\\n\\t\\treturn name.indexOf(\\\"__reactFiber$\\\") === 0 || name.indexOf(\\\"__reactInternalInstance$\\\") === 0;\\n\\t})[0];\\n\\tif(!key) return null;\\n\\tvar found = null;\\n\\tvar walk = function(node) {\\n\\t\\tif(!node || found) return;\\n\\t\\tvar value = node.memoizedProps && node.memoizedProps.value;\\n\\t\\tif(value && typeof value.zoomToFit === \\\"function\\\" && typeof value.changePage === \\\"function\\\") {\\n\\t\\t\\tfound = value;\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\twalk(node.child);\\n\\t\\twalk(node.sibling);\\n\\t};\\n\\tvar fiber = container[key];\\n\\twhile(fiber && !found) {\\n\\t\\twalk(fiber);\\n\\t\\tfiber = fiber.return;\\n\\t}\\n\\tif(found) {\\n\\t\\tappCache.set(container, found);\\n\\t} else {\\n\\t\\tappCache.delete(container);\\n\\t}\\n\\treturn found;\\n};\\n\\n// Which board a document is, for the purpose of remembering visits. A tldraw\\n// document takes the tiddler's title as its name when it is saved, so that is\\n// the title; the identity only has to tell two boards apart.\\nvar boardName = function(app) {\\n\\tvar document = app.document || {};\\n\\tif(document.name) return document.name;\\n\\tif(!appIds.has(app)) appIds.set(app, \\\"board-\\\" + (++nextAppId));\\n\\treturn appIds.get(app);\\n};\\n\\nvar pageKey = function(app) {\\n\\tvar state = app.appState || {};\\n\\treturn boardName(app) + \\\"\\\\u001f\\\" + (state.currentPageId || \\\"\\\");\\n};\\n\\n// A board that has not been laid out yet has no size, and a fit against the\\n// wrong one is worse than no fit: a mount still settling measures its renderer\\n// at whatever it happens to be for a frame, and fitting to that parks the\\n// content in a corner at the minimum zoom. So the board is only fitted once\\n// its renderer agrees with its container at a size the container has held for\\n// two frames, which is the point the layout has stopped moving.\\nvar laidOut = function(board) {\\n\\tvar bounds = board.app.rendererBounds;\\n\\tvar container = board.container;\\n\\tif(!bounds || !bounds.width || !bounds.height) return false;\\n\\tif(Math.abs(bounds.width - container.clientWidth) > 2) return false;\\n\\tif(Math.abs(bounds.height - container.clientHeight) > 2) return false;\\n\\tvar size = container.clientWidth + \\\"x\\\" + container.clientHeight;\\n\\tif(board.size !== size) {\\n\\t\\tboard.size = size;\\n\\t\\treturn false;\\n\\t}\\n\\treturn true;\\n};\\n\\nvar fit = function(board) {\\n\\tvar app = board.app;\\n\\tif(!app || typeof app.zoomToFit !== \\\"function\\\") return true;\\n\\tif(!laidOut(board)) return false;\\n\\ttry {\\n\\t\\tapp.zoomToFit();\\n\\t} catch (error) {\\n\\t\\t// A board whose camera cannot be moved keeps the one it loaded with,\\n\\t\\t// which is the behaviour this patch exists to change but never to\\n\\t\\t// break.\\n\\t}\\n\\tvisited[board.key] = true;\\n\\treturn true;\\n};\\n\\nvar step = function() {\\n\\tframeHandle = null;\\n\\tframe++;\\n\\tvar live = [];\\n\\tfor(var i = 0; i \u003C boards.length; i++) {\\n\\t\\tvar board = boards[i];\\n\\t\\tif(!board.container.isConnected) continue;\\n\\t\\tif(frame % RESOLVE_EVERY_FRAMES === 0) {\\n\\t\\t\\tvar fresh = resolveApp(board.container, true);\\n\\t\\t\\tif(fresh && fresh !== board.app) {\\n\\t\\t\\t\\tboard.app = fresh;\\n\\t\\t\\t\\tboard.key = null;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tif(!board.app) {\\n\\t\\t\\tboard.app = resolveApp(board.container, false);\\n\\t\\t}\\n\\t\\tvar key = board.app ? pageKey(board.app) : null;\\n\\t\\tif(key && key !== board.key) {\\n\\t\\t\\tboard.key = key;\\n\\t\\t\\tboard.pending = !visited[key];\\n\\t\\t}\\n\\t\\tif(board.pending && fit(board)) {\\n\\t\\t\\tboard.pending = false;\\n\\t\\t}\\n\\t\\tlive.push(board);\\n\\t}\\n\\tboards = live;\\n\\tif(boards.length) frameHandle = requestAnimationFrame(step);\\n};\\n\\nvar track = function() {\\n\\tvar containers = document.querySelectorAll(BOARD_SELECTOR);\\n\\tfor(var i = 0; i \u003C containers.length; i++) {\\n\\t\\tvar container = containers[i];\\n\\t\\tvar known = false;\\n\\t\\tfor(var j = 0; j \u003C boards.length; j++) {\\n\\t\\t\\tif(boards[j].container === container) {\\n\\t\\t\\t\\tknown = true;\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tif(known) continue;\\n\\t\\tboards.push({\\n\\t\\t\\tcontainer: container,\\n\\t\\t\\tapp: resolveApp(container, false),\\n\\t\\t\\tkey: null,\\n\\t\\t\\tpending: false,\\n\\t\\t});\\n\\t}\\n\\tvar live = [];\\n\\tfor(var k = 0; k \u003C boards.length; k++) {\\n\\t\\tif(boards[k].container.isConnected) live.push(boards[k]);\\n\\t}\\n\\tboards = live;\\n\\tif(boards.length && frameHandle === null) {\\n\\t\\tframeHandle = requestAnimationFrame(step);\\n\\t}\\n};\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") return;\\n\\n\\t// The layout mounts and unmounts its board as the reader moves between the\\n\\t// story river and the whiteboard, so containers are found by watching the\\n\\t// page rather than by looking once.\\n\\tvar scheduled = false;\\n\\tvar observer = new MutationObserver(function() {\\n\\t\\tif(scheduled) return;\\n\\t\\tscheduled = true;\\n\\t\\tsetTimeout(function() {\\n\\t\\t\\tscheduled = false;\\n\\t\\t\\ttrack();\\n\\t\\t}, 25);\\n\\t});\\n\\tobserver.observe(document.body, { childList: true, subtree: true });\\n\\n\\ttrack();\\n};\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/LandscapeGate\":{\"title\":\"$:/Lithic/Patches/Whiteboard/LandscapeGate\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* The whiteboard layout is built for a wide screen: the board is a tldraw\\n canvas and the top bar is a fixed 400px strip of controls. Held in portrait,\\n a phone renders an unusable sliver of both. So the WhiteBoard page layout\\n mounts a gate (see .lithic-wb-rotate-gate there) and this sheet decides when\\n to show it: never in landscape, never on a desktop, and in portrait only on\\n a touch device no wider than a tablet.\\n\\n Three conditions, each with a job:\\n pointer: coarse a phone or tablet, never a resized desktop window\\n orientation portrait only, so rotating hides the gate instantly\\n max-width: 1024px leaves portrait monitors out of it\\n\\n Pure CSS: no script runs, the check happens before the first paint, and no\\n touch reaches the canvas while the gate is up.\\n\\n The gate is a message, not a page, so nothing behind it may move either. A\\n finger dragged on the gate is swallowed by touch-action, and the document\\n behind it is given nothing to scroll. Both are guarded by the gate's own\\n presence, so they exist exactly while the whiteboard layout is mounted:\\n leaving the layout (or rotating, which drops the media query) restores\\n ordinary scrolling in the same frame. */\\n\\n.lithic-wb-rotate-gate {\\n display: none;\\n}\\n\\n@media (pointer: coarse) and (orientation: portrait) and (max-width: 1024px) {\\n html:has(.lithic-wb-rotate-gate),\\n body:has(.lithic-wb-rotate-gate) {\\n overflow: hidden !important;\\n overscroll-behavior: none;\\n }\\n\\n .lithic-wb-rotate-gate {\\n position: fixed;\\n top: 0;\\n right: 0;\\n bottom: 0;\\n left: 0;\\n z-index: 9999999;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n justify-content: center;\\n gap: 1rem;\\n padding: 2rem;\\n box-sizing: border-box;\\n text-align: center;\\n background: var(--lithic-c-page);\\n color: var(--lithic-c-foreground);\\n touch-action: none;\\n }\\n}\\n\\n.lithic-wb-rotate-gate-glyph {\\n width: 4.5rem;\\n height: 4.5rem;\\n opacity: 0.85;\\n}\\n\\n.lithic-wb-rotate-gate-title {\\n margin: 0;\\n font-size: 1.2em;\\n font-weight: bold;\\n}\\n\\n.lithic-wb-rotate-gate-hint {\\n margin: 0;\\n max-width: 22em;\\n color: var(--lithic-c-foreground-muted);\\n}\\n\\n.lithic-wb-rotate-gate-exit {\\n margin-top: 0.75rem;\\n padding: 0.4rem 1.1rem;\\n border: 1px solid var(--lithic-c-menu-border);\\n border-radius: 2rem;\\n background: var(--lithic-c-menu-bg);\\n color: var(--lithic-c-menu-fg);\\n font: inherit;\\n cursor: pointer;\\n}\\n\\n.lithic-wb-rotate-gate-exit:hover {\\n background: color-mix(in srgb, var(--lithic-c-menu-fg) 10%, var(--lithic-c-menu-bg));\\n}\"},\"$:/Lithic/Patches/Whiteboard/LongPressRightClick.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/LongPressRightClick.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/LongPressRightClick.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nConsume Android hold-touch-to-right-click (long-press) events inside the\\nwhiteboard, while preserving deliberate right-clicks.\\n\\nOn Android / stylus devices, holding the stylus or finger still for a moment\\nwhile drawing registers as a `contextmenu` event, which opens tldraw's own\\ncontext menu mid-stroke. Debouncing or styles cannot help here, and we do NOT\\nwant to remove the right-click menu entirely: desktop mouse right-click must\\nkeep working, and the menu must stay available everywhere else in the wiki.\\n\\nHow this patch works:\\n\\n1. tldraw's menu is opened by React's `onContextMenu` handler on the Radix\\n trigger wrapping the whole board (the board renders inside\\n `div.tw-whiteboard-tldraw-container`). React attaches its listeners at the\\n mount container, so a document-level CAPTURE listener runs first: calling\\n `preventDefault()` + `stopImmediatePropagation()` there prevents both the\\n browser's native long-press menu and tldraw's menu from ever opening.\\n2. The patch only acts on `contextmenu` events whose target is inside the\\n whiteboard surface (`.tw-whiteboard-tldraw-container, .tl-container`).\\n3. Touch/stylus derivation is detected two ways:\\n - `event.sourceCapabilities.firesTouchEvents` (Chrome/Android reports true\\n for touch- and stylus-generated events),\\n - else a capture-phase `pointerdown` tracker: any non-mouse pointer\\n (`touch`/`pen`/`stylus`) in the last 2s marks the gesture as touch-based.\\n Mouse pointerdowns (right-click) are never treated as touch.\\n4. A hold time gate separates long-press from deliberate touch right-clicks:\\n Android fires its long-press `contextmenu` only after the hold timeout\\n (>~500ms after pointerdown), while a stylus barrel-button right-click fires\\n almost immediately. Events arriving \u003C200ms after the pointerdown pass\\n through, so stylus-button and two-finger right-clicks still work.\\n5. Targets that are inputs/textareas or `contentEditable` are passed through\\n unchanged, so long-press copy/paste while editing board text keeps the\\n native menu.\\n\\nNot a width/media-query fix: this listens on the event source (touch/stylus\\nvs. mouse), so it works regardless of viewport size or device category.\\n\\nThe wiki's own context menu (ahanniga `context-menu` plugin) already returns\\nearly for `.tw-whiteboard-layout-container`, so this patch is the only menu\\nsuppression the whiteboard needs.\\n\\nDiagnostics: every decision is recorded on `window.__lithicLongPressProbe`\\n({suppressed, reason}) for testing and debugging.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-long-press-right-click\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") {\\n\\t\\treturn;\\n\\t}\\n\\n\\tvar SCOPE_SELECTOR = \\\".tw-whiteboard-tldraw-container, .tl-container\\\";\\n\\t// A touch/stylus contextmenu arriving this soon after pointerdown is a\\n\\t// deliberate right-click (stylus barrel button, two-finger tap), not the\\n\\t// Android long-press, which only fires after the hold timeout.\\n\\tvar LONG_PRESS_MIN_MS = 200;\\n\\t// Touch gestures older than this no longer count as \\\"the current gesture\\\".\\n\\tvar TOUCH_GESTURE_WINDOW_MS = 2000;\\n\\n\\tvar lastPointerDown = {type: \\\"mouse\\\", time: 0};\\n\\n\\tvar probe = {suppressed: false, reason: \\\"\\\"};\\n\\twindow.__lithicLongPressProbe = probe;\\n\\n\\t// Track the most recent pointerdown of ANY kind (with its pointerType).\\n\\t// Mouse right-clicks overwrite the entry, so a mouse click right after a\\n\\t// touch gesture is never mistaken for it.\\n\\tdocument.addEventListener(\\\"pointerdown\\\", function(event) {\\n\\t\\tlastPointerDown = {type: event.pointerType || \\\"mouse\\\", time: Date.now()};\\n\\t}, true);\\n\\n\\tfunction isEditable(target) {\\n\\t\\treturn !!(target.closest && (target.closest(\\\"input, textarea\\\") || target.isContentEditable));\\n\\t}\\n\\n\\tdocument.addEventListener(\\\"contextmenu\\\", function(event) {\\n\\t\\tvar target = event.target;\\n\\t\\t// Only consume hold-touch right-clicks inside the whiteboard surface.\\n\\t\\tif(!target || !target.closest || !target.closest(SCOPE_SELECTOR)) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"outside-whiteboard\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Keep the native copy/paste menu while editing text on the board.\\n\\t\\tif(isEditable(target)) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"editable-target\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Touch/stylus-derived, or mouse/keyboard?\\n\\t\\tvar capsFiresTouch = !!(event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents === true);\\n\\t\\tvar elapsed = Date.now() - lastPointerDown.time;\\n\\t\\tvar sawRecentNonMouse = lastPointerDown.type !== \\\"mouse\\\" && elapsed \u003C TOUCH_GESTURE_WINDOW_MS;\\n\\t\\tif(!capsFiresTouch && !sawRecentNonMouse) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"mouse-or-keyboard\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Too fast to be a long-press -> deliberate touch right-click.\\n\\t\\tif(elapsed \u003C LONG_PRESS_MIN_MS) {\\n\\t\\t\\tprobe.suppressed = false;\\n\\t\\t\\tprobe.reason = \\\"fast-touch-right-click\\\";\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// Hold-touch-to-right-click inside the whiteboard: consume it.\\n\\t\\tevent.preventDefault();\\n\\t\\tevent.stopImmediatePropagation();\\n\\t\\tprobe.suppressed = true;\\n\\t\\tprobe.reason = \\\"touch-long-press\\\";\\n\\t}, true);\\n};\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/MiddleButtonPan.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/MiddleButtonPan.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/MiddleButtonPan.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nMiddle-button drag always pans the board, whatever the pointer is over.\\n\\ntldraw pans on a middle-button drag only when the pointer stays on a surface\\nthat has its own move handler: the empty canvas, a shape, the selection\\nbounds. A middle-button press on something else inside the board leaves the\\ngrab cursor showing and the camera still, and the pan only starts once the\\npointer leaves that thing and reaches the canvas. Dragging is not editing, so\\nthe button should never be told apart by what is underneath it.\\n\\nSo this patch owns the middle-button drag itself. It takes the press before\\nReact sees it (and prevents the browser's own middle-click behaviour, such as\\nautoscroll), then pans the camera from the pointer's own movement for as long\\nas the button is held. The camera is moved through the board's own state, so\\na pan is still a pan to the rest of the editor: undo history, cursors, the\\nsave indicator.\\n\\nThe board's app instance is found through the React tree of its container and\\ncached per container. When it cannot be found, nothing is intercepted and the\\nboard behaves exactly as it did before, which is the only honest fallback.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-middle-button-pan\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nvar BOARD_SELECTOR = \\\".tl-container\\\";\\nvar MIDDLE_BUTTON = 1;\\nvar MIDDLE_BUTTON_MASK = 4;\\n\\n// One drag at a time: the pointer belongs to a single board.\\nvar drag = null;\\nvar appCache = new WeakMap();\\n\\nvar boardOf = function(target) {\\n\\tif(!target || !target.closest) return null;\\n\\treturn target.closest(BOARD_SELECTOR);\\n};\\n\\nvar findApp = function(container) {\\n\\tif(appCache.has(container)) return appCache.get(container);\\n\\tvar key = Object.keys(container).filter(function(name) {\\n\\t\\treturn name.indexOf(\\\"__reactFiber$\\\") === 0 || name.indexOf(\\\"__reactInternalInstance$\\\") === 0;\\n\\t})[0];\\n\\tif(!key) return null;\\n\\tvar found = null;\\n\\tvar walk = function(node) {\\n\\t\\tif(!node || found) return;\\n\\t\\tvar value = node.memoizedProps && node.memoizedProps.value;\\n\\t\\tif(value && typeof value.createShapes === \\\"function\\\" && typeof value.pan === \\\"function\\\") {\\n\\t\\t\\tfound = value;\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\twalk(node.child);\\n\\t\\twalk(node.sibling);\\n\\t};\\n\\tvar fiber = container[key];\\n\\twhile(fiber && !found) {\\n\\t\\twalk(fiber);\\n\\t\\tfiber = fiber.return;\\n\\t}\\n\\tif(found) appCache.set(container, found);\\n\\treturn found;\\n};\\n\\nvar zoomOf = function(app) {\\n\\tvar camera = app.camera || (app.pageState && app.pageState.camera);\\n\\treturn camera && camera.zoom ? camera.zoom : 1;\\n};\\n\\nvar endDrag = function() {\\n\\tif(!drag) return;\\n\\tif(drag.container) drag.container.style.cursor = drag.previousCursor;\\n\\tdrag = null;\\n};\\n\\nvar onMouseDown = function(event) {\\n\\tif(event.button !== MIDDLE_BUTTON) return;\\n\\t// No autoscroll, no paste-on-middle-click: the board owns this button.\\n\\tif(boardOf(event.target)) event.preventDefault();\\n};\\n\\nvar onPointerDown = function(event) {\\n\\tif(event.button !== MIDDLE_BUTTON) return;\\n\\tvar container = boardOf(event.target);\\n\\tif(!container) return;\\n\\tvar app = findApp(container);\\n\\tif(!app) return;\\n\\tevent.preventDefault();\\n\\tevent.stopPropagation();\\n\\tendDrag();\\n\\tdrag = {\\n\\t\\tpointerId: event.pointerId,\\n\\t\\tx: event.clientX,\\n\\t\\ty: event.clientY,\\n\\t\\tapp: app,\\n\\t\\tcontainer: container,\\n\\t\\tpreviousCursor: container.style.cursor,\\n\\t};\\n\\tcontainer.style.cursor = \\\"grabbing\\\";\\n};\\n\\nvar onPointerMove = function(event) {\\n\\tif(!drag) return;\\n\\t// A release whose pointerup never arrived still ends the drag.\\n\\tif((event.buttons & MIDDLE_BUTTON_MASK) === 0) {\\n\\t\\tendDrag();\\n\\t\\treturn;\\n\\t}\\n\\tif(event.pointerId !== drag.pointerId) return;\\n\\tevent.preventDefault();\\n\\tevent.stopPropagation();\\n\\tvar dx = event.clientX - drag.x;\\n\\tvar dy = event.clientY - drag.y;\\n\\tif(dx === 0 && dy === 0) return;\\n\\tdrag.x = event.clientX;\\n\\tdrag.y = event.clientY;\\n\\tvar zoom = zoomOf(drag.app);\\n\\tdrag.app.pan([-dx / zoom, -dy / zoom]);\\n};\\n\\nvar onPointerUp = function(event) {\\n\\tif(!drag) return;\\n\\tif(event.pointerId !== drag.pointerId) return;\\n\\tevent.stopPropagation();\\n\\tendDrag();\\n};\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") return;\\n\\t// Capture phase throughout: React listens on the board's own root, so this\\n\\t// has to run first to be able to take the gesture away from it.\\n\\tdocument.addEventListener(\\\"mousedown\\\", onMouseDown, true);\\n\\tdocument.addEventListener(\\\"pointerdown\\\", onPointerDown, true);\\n\\twindow.addEventListener(\\\"pointermove\\\", onPointerMove, true);\\n\\twindow.addEventListener(\\\"pointerup\\\", onPointerUp, true);\\n\\twindow.addEventListener(\\\"pointercancel\\\", onPointerUp, true);\\n\\twindow.addEventListener(\\\"blur\\\", endDrag);\\n};\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/MobileViewport\":{\"title\":\"$:/Lithic/Patches/Whiteboard/MobileViewport\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* A phone's browser draws its own chrome over the page, so 100vh is the\\n viewport with that chrome hidden, not the one the reader can see. The board\\n is sized in vh: the page layout passes height=\\\"100vh\\\" to the whiteboard\\n widget, which writes it as an inline height on .tw-whiteboard-tldraw-container,\\n and tldraw anchors its bottom toolbar to the bottom of that box. On a phone\\n the box therefore runs on under the browser chrome, the toolbar is anchored\\n below the visible area, and no tool is reachable until the page is scrolled.\\n\\n dvh is the viewport that is actually on screen, so the box ends where the\\n reader's screen ends and the toolbar arrives with it. The vh line stays in\\n front of the dvh line for engines that have no dvh, and !important is the\\n only way to reach a height the widget set inline. Scoped to a coarse\\n pointer, so a desktop window keeps its 100vh. */\\n\\n@media (pointer: coarse) {\\n .tw-whiteboard-tldraw-container {\\n height: 100vh !important;\\n height: 100dvh !important;\\n }\\n}\"},\"$:/Lithic/Patches/Whiteboard/PageMenuOverflow\":{\"title\":\"$:/Lithic/Patches/Whiteboard/PageMenuOverflow\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Keep tldraw menus inside the viewport when they contain many items. The\\n stock bundle hardcodes max-height: 100vh on menu panels, which are anchored\\n below their trigger - so on the full-screen whiteboard layout a panel\\n extends past the bottom of the screen and the last item (\\\"Create page\\\")\\n can never be scrolled into view. Radix already computes the true available\\n space and exposes it as CSS vars; use those instead of the hardcoded 100vh.\\n The dropdown var covers the page select/zoom/style menus; the context-menu\\n var covers right-click menus (opened at the cursor). Both fall back to the\\n stock 100vh when absent, so nothing else is affected. */\\n\\n.tw-whiteboard-tldraw-container [role=\\\"menu\\\"] {\\n max-height: var(\\n --radix-dropdown-menu-content-available-height,\\n var(--radix-context-menu-content-available-height, 100vh)\\n ) !important;\\n}\"},\"$:/Lithic/Patches/Whiteboard/PageNav.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/PageNav.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/PageNav.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nAdds prev/next page navigation buttons immediately to the right of the tldraw\\npage-select dropdown (the #TD-Page trigger in the upper-left #TD-MenuPanel).\\nThis is pure whiteboard-internal navigation: the buttons drive the live\\nTldrawApp via app.changePage() and know nothing about TiddlyWiki's own board\\nselector in the top bar.\\n\\nThe page dropdown in this build ships without flanking chevrons, so helpers\\nare mounted next to it. Clicking calls changePage on the actual tldraw app\\ninstance, reached by walking the React fiber tree up from the trigger to the\\nTldrawContext.Provider (whose memoizedProps.value IS the app).\\n\\nBoth glyphs (chevron + bullet) are rendered into each button up front and the\\nvisible one is chosen with pure CSS via :disabled - navigating never mutates\\nthe button's DOM, so rapid/spam clicks can never be swallowed by the browser\\nsuppressing a click whose mousedown target was removed mid-press. The app is\\nresolved fresh from the live trigger at click time (with a cached fallback),\\nso transient React re-renders can't drop a click either.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-page-nav\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n var BUTTON_CLASS = \\\"lithic-wb-page-nav-btn\\\";\\n var SCAN_DEBOUNCE_MS = 25;\\n\\n // Stroke-style left/right chevrons (Feather icon set, 24x24 viewBox) so\\n // the buttons read unambiguously as prev/next navigation.\\n var ICON_PREV = '\u003Cpolyline points=\\\"15 18 9 12 15 6\\\"/>';\\n var ICON_NEXT = '\u003Cpolyline points=\\\"9 18 15 12 9 6\\\"/>';\\n\\n // Small bullet shown in place of the chevron when the button is disabled\\n // (no further page in that direction).\\n var DOT = '\u003Ccircle cx=\\\"5\\\" cy=\\\"5\\\" r=\\\"3.5\\\"/>';\\n\\n function chevronSvg(direction) {\\n return '\u003Csvg width=\\\"18\\\" height=\\\"18\\\" viewBox=\\\"0 0 24 24\\\" fill=\\\"none\\\" ' +\\n 'stroke=\\\"currentColor\\\" stroke-width=\\\"2.5\\\" stroke-linecap=\\\"round\\\" ' +\\n 'stroke-linejoin=\\\"round\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\">' +\\n (direction === \\\"prev\\\" ? ICON_PREV : ICON_NEXT) +\\n \\\"\u003C/svg>\\\";\\n }\\n\\n function dotSvg() {\\n return '\u003Csvg width=\\\"10\\\" height=\\\"10\\\" viewBox=\\\"0 0 10 10\\\" ' +\\n 'fill=\\\"currentColor\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\">' +\\n DOT +\\n \\\"\u003C/svg>\\\";\\n }\\n\\n function directionOf(btn) {\\n return btn.classList.contains(\\\"lithic-wb-page-prev\\\") ? \\\"prev\\\" : \\\"next\\\";\\n }\\n\\n function makeButton(direction) {\\n var btn = document.createElement(\\\"button\\\");\\n btn.type = \\\"button\\\";\\n btn.className = BUTTON_CLASS + \\\" lithic-wb-page-\\\" + direction;\\n btn.setAttribute(\\\"aria-label\\\", direction === \\\"prev\\\" ? \\\"Previous page\\\" : \\\"Next page\\\");\\n btn.title = direction === \\\"prev\\\" ? \\\"Previous page\\\" : \\\"Next page\\\";\\n // Both glyphs are always present; CSS shows the chevron when enabled\\n // and the bullet when disabled (no DOM mutation while interacting).\\n btn.innerHTML =\\n '\u003Cspan class=\\\"lithic-wb-glyph lithic-wb-glyph-chevron\\\">' + chevronSvg(direction) + \\\"\u003C/span>\\\" +\\n '\u003Cspan class=\\\"lithic-wb-glyph lithic-wb-glyph-dot\\\">' + dotSvg() + \\\"\u003C/span>\\\";\\n return btn;\\n }\\n\\n // Walk the React fiber tree up from a page dropdown trigger to find the\\n // live TldrawApp. The TldrawContext.Provider fiber's memoizedProps.value\\n // is the app instance itself.\\n function findAppFrom(trigger) {\\n if (!trigger) return null;\\n var key = null;\\n for (var prop in trigger) {\\n if (prop.indexOf(\\\"__reactFiber$\\\") === 0 || prop.indexOf(\\\"__reactInternalInstance$\\\") === 0) {\\n key = prop;\\n break;\\n }\\n }\\n if (!key) return null;\\n var fiber = trigger[key];\\n var guard = 0;\\n while (fiber && guard++ \u003C 300) {\\n var props = fiber.memoizedProps;\\n if (props && props.value && typeof props.value === \\\"object\\\") {\\n var candidate = props.value;\\n if (typeof candidate.changePage === \\\"function\\\" &&\\n candidate.document && candidate.document.pages && candidate.appState) {\\n return candidate;\\n }\\n }\\n fiber = fiber.return;\\n }\\n return null;\\n }\\n\\n // The page dropdown trigger can be replaced by tldraw re-renders; find the\\n // CURRENT trigger that lives in the same menu panel as the button.\\n function liveTrigger(btn) {\\n var panel = btn.closest ? (btn.closest(\\\"#TD-MenuPanel\\\") || btn.closest(\\\".tw-whiteboard-tldraw-container\\\")) : null;\\n if (!panel) return null;\\n return panel.querySelector(\\\"#TD-Page\\\") || null;\\n }\\n\\n // Resolve the app for a button: prefer a fresh fiber walk from the live\\n // trigger; fall back to the last app cached on the button so a click is\\n // never dropped by a transient React state.\\n function resolveApp(btn, captured) {\\n var live = liveTrigger(btn) || captured;\\n var app = live ? findAppFrom(live) : null;\\n if (!app && live !== captured && captured) {\\n app = findAppFrom(captured);\\n }\\n if (app) {\\n btn._lithicApp = app;\\n } else {\\n app = btn._lithicApp || null;\\n }\\n return app;\\n }\\n\\n function getSortedPages(app) {\\n var pages = app.document.pages || {};\\n return Object.keys(pages)\\n .map(function (id) { return pages[id]; })\\n .sort(function (a, b) { return (a.childIndex || 0) - (b.childIndex || 0); });\\n }\\n\\n function getCurrentIndex(app) {\\n var pages = getSortedPages(app);\\n var currentId = app.appState.currentPageId;\\n for (var i = 0; i \u003C pages.length; i++) {\\n if (pages[i].id === currentId) return i;\\n }\\n return -1;\\n }\\n\\n function refreshDisabled(app, prevBtn, nextBtn) {\\n var idx = app ? getCurrentIndex(app) : -1;\\n var count = app ? getSortedPages(app).length : 0;\\n prevBtn.disabled = idx \u003C= 0;\\n nextBtn.disabled = idx === -1 || idx >= count - 1;\\n // The glyph swap is pure CSS (:disabled), so nothing here mutates DOM.\\n }\\n\\n function navigate(trigger, prevBtn, nextBtn, direction, event) {\\n if (event) {\\n event.preventDefault();\\n event.stopPropagation();\\n }\\n var app = resolveApp(nextBtn, trigger);\\n if (!app) return;\\n var pages = getSortedPages(app);\\n var idx = getCurrentIndex(app);\\n if (idx === -1) return;\\n var target = direction === \\\"prev\\\" ? idx - 1 : idx + 1;\\n if (target \u003C 0 || target >= pages.length) return;\\n app.changePage(pages[target].id);\\n refreshDisabled(app, prevBtn, nextBtn);\\n }\\n\\n function instrument(trigger) {\\n if (trigger.dataset.lithicPageNav === \\\"1\\\") return;\\n\\n // Clear any stale page-nav buttons already in the panel (e.g. from a\\n // previous trigger instance) so there is never more than one pair.\\n var panel = trigger.parentElement;\\n if (panel) {\\n var stale = panel.querySelectorAll(\\\".lithic-wb-page-prev, .lithic-wb-page-next\\\");\\n for (var s = 0; s \u003C stale.length; s++) {\\n stale[s].remove();\\n }\\n }\\n\\n // The buttons go to the RIGHT of the page select dropdown, as\\n // siblings of the trigger inside the menu panel's flex row.\\n var prevBtn = makeButton(\\\"prev\\\");\\n var nextBtn = makeButton(\\\"next\\\");\\n trigger.insertAdjacentElement(\\\"afterend\\\", prevBtn);\\n prevBtn.insertAdjacentElement(\\\"afterend\\\", nextBtn);\\n trigger.dataset.lithicPageNav = \\\"1\\\";\\n\\n // Keep tldraw (pointer handlers) and the radix dropdown trigger from\\n // ever seeing these interactions.\\n var stop = function (event) { event.stopPropagation(); };\\n prevBtn.addEventListener(\\\"pointerdown\\\", stop, true);\\n nextBtn.addEventListener(\\\"pointerdown\\\", stop, true);\\n prevBtn.addEventListener(\\\"mousedown\\\", stop, true);\\n nextBtn.addEventListener(\\\"mousedown\\\", stop, true);\\n\\n prevBtn.addEventListener(\\\"click\\\", function (event) {\\n navigate(trigger, prevBtn, nextBtn, \\\"prev\\\", event);\\n });\\n nextBtn.addEventListener(\\\"click\\\", function (event) {\\n navigate(trigger, prevBtn, nextBtn, \\\"next\\\", event);\\n });\\n\\n refreshDisabled(resolveApp(nextBtn, trigger), prevBtn, nextBtn);\\n\\n // Recompute the disabled state whenever the current page name changes\\n // (dropdown selection, page create/delete, or the wiki-side board\\n // switcher loading a different board into this widget).\\n var labelObserver = new MutationObserver(function () {\\n refreshDisabled(resolveApp(nextBtn, trigger), prevBtn, nextBtn);\\n });\\n labelObserver.observe(trigger, { childList: true, subtree: true, characterData: true });\\n }\\n\\n function scan() {\\n var containers = document.querySelectorAll(\\\".tw-whiteboard-tldraw-container\\\");\\n for (var i = 0; i \u003C containers.length; i++) {\\n var trigger = containers[i].querySelector(\\\"#TD-Page\\\");\\n if (!trigger) continue;\\n if (trigger.dataset.lithicPageNav !== \\\"1\\\") {\\n instrument(trigger);\\n }\\n var prev = trigger.nextElementSibling;\\n var next = prev ? prev.nextElementSibling : null;\\n if (prev && next &&\\n prev.classList && prev.classList.contains(\\\"lithic-wb-page-prev\\\") &&\\n next.classList && next.classList.contains(\\\"lithic-wb-page-next\\\")) {\\n var app = findAppFrom(trigger) || null;\\n if (app) {\\n prev._lithicApp = app;\\n next._lithicApp = app;\\n }\\n refreshDisabled(app, prev, next);\\n }\\n }\\n }\\n\\n exports.startup = function () {\\n if (typeof window === \\\"undefined\\\" || typeof document === \\\"undefined\\\") return;\\n\\n var scheduled = false;\\n var observer = new MutationObserver(function () {\\n if (scheduled) return;\\n scheduled = true;\\n setTimeout(function () {\\n scheduled = false;\\n scan();\\n }, SCAN_DEBOUNCE_MS);\\n });\\n observer.observe(document.body, { childList: true, subtree: true });\\n\\n scan();\\n };\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/PageNavStyle\":{\"title\":\"$:/Lithic/Patches/Whiteboard/PageNavStyle\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Prev/next page buttons beside the tldraw page-select dropdown,\\n mounted by $:/Lithic/Patches/Whiteboard/PageNav.js */\\n\\n.lithic-wb-page-prev,\\n.lithic-wb-page-next {\\n display: inline-flex !important;\\n align-items: center;\\n justify-content: center;\\n width: 38px !important;\\n height: 30px !important;\\n margin: 0 2px !important;\\n padding: 0 !important;\\n box-sizing: border-box;\\n position: relative !important;\\n top: 5px !important;\\n border: 1px solid transparent;\\n border-radius: 4px !important;\\n background-color: transparent !important;\\n color: inherit;\\n cursor: pointer;\\n}\\n\\n.lithic-wb-page-prev:hover:not(:disabled),\\n.lithic-wb-page-next:hover:not(:disabled) {\\n background-color: rgba(var(--lithic-c-foreground-rgb), 0.22) !important;\\n}\\n\\n.lithic-wb-page-prev:active:not(:disabled),\\n.lithic-wb-page-next:active:not(:disabled) {\\n background-color: rgba(var(--lithic-c-foreground-rgb), 0.32) !important;\\n}\\n\\n.lithic-wb-page-prev:disabled,\\n.lithic-wb-page-next:disabled {\\n opacity: 0.35;\\n cursor: default;\\n}\\n\\n/* Both glyphs are always in the DOM; :disabled picks which one shows. */\\n.lithic-wb-page-prev .lithic-wb-glyph,\\n.lithic-wb-page-next .lithic-wb-glyph {\\n display: inline-flex;\\n line-height: 0;\\n}\\n\\n.lithic-wb-page-prev .lithic-wb-glyph-dot,\\n.lithic-wb-page-next .lithic-wb-glyph-dot {\\n display: none;\\n}\\n\\n.lithic-wb-page-prev:disabled .lithic-wb-glyph-chevron,\\n.lithic-wb-page-next:disabled .lithic-wb-glyph-chevron {\\n display: none;\\n}\\n\\n.lithic-wb-page-prev:disabled .lithic-wb-glyph-dot,\\n.lithic-wb-page-next:disabled .lithic-wb-glyph-dot {\\n display: inline-flex;\\n}\\n\\n.lithic-wb-page-prev .lithic-wb-glyph-chevron svg,\\n.lithic-wb-page-next .lithic-wb-glyph-chevron svg {\\n display: block;\\n width: 18px;\\n height: 18px;\\n}\\n\\n.lithic-wb-page-prev .lithic-wb-glyph-dot svg,\\n.lithic-wb-page-next .lithic-wb-glyph-dot svg {\\n display: block;\\n width: 10px;\\n height: 10px;\\n}\\n\\n/* Touch pointers: this menu panel and the layout's own 400px bar are layered\\n over the same top strip as tldraw's right-hand cluster (undo/redo/zoom/\\n styles), and on a phone there is not room for all three side by side. Two\\n collisions have to be undone without moving anything on a desktop, where\\n there is room for all of them.\\n\\n First: the page arrows sat behind that bar (the bar is layered over the\\n board), so the last two panel items were unclickable. They move to a second\\n line below the panel. They are taken out of the flow rather than given a\\n grid row, because the panel shares its flex row with the right-hand cluster:\\n any in-flow child that grows makes the row taller and stretches that cluster\\n with it, so one extra line on the left was silently growing undo/redo on the\\n right. Positioned absolutely under the panel they add no height, and\\n overflow:visible lets them show below the panel's own 41px box. */\\n@media (pointer: coarse) {\\n #TD-MenuPanel {\\n position: relative !important;\\n height: 41px !important;\\n overflow: visible !important;\\n }\\n\\n /* The inline row only needed the 5px nudge up because the row itself was\\n 40px tall; on their own line the buttons sit flush and use margins. */\\n .lithic-wb-page-prev,\\n .lithic-wb-page-next {\\n position: absolute !important;\\n top: 41px !important;\\n margin: 4px 2px !important;\\n }\\n\\n .lithic-wb-page-prev {\\n left: 0 !important;\\n }\\n\\n .lithic-wb-page-next {\\n left: 42px !important;\\n }\\n}\\n\\n/* Second: that bar is centred at width:400px, so on a landscape phone narrower\\n than about 844px its right end covers undo/redo. It starts just right of the\\n panel instead and is capped so it stops short of the cluster's 222px, which\\n leaves the space next to the panel as the only place the bar can live. The\\n board search field is the one item that flexes, so the fixed buttons beside\\n it never spill back over the cluster.\\n\\n 124px clears the widest page label a board is likely to reach - the panel\\n measures 99px at \\\"Page 1\\\" and grows about a pixel per character, so even\\n \\\"Page 1234\\\" stays clear of the bar. */\\n@media (pointer: coarse) and (max-width: 1024px) {\\n .tw-whiteboard-layout-top-bar {\\n box-sizing: border-box !important;\\n left: 124px !important;\\n width: auto !important;\\n max-width: calc(100% - 356px) !important;\\n justify-content: flex-start !important;\\n }\\n\\n .tw-whiteboard-layout-top-bar > span:first-child {\\n flex: 0 1 auto;\\n min-width: 0;\\n }\\n\\n /* The search field carries an inline 230px width, so it cannot shrink on\\n its own - measured from the viewport it stays inside the bar's cap and\\n never slides over the buttons beside it. */\\n .lithic-wb-search-input {\\n width: min(230px, calc(100vw - 574px)) !important;\\n }\\n}\\n\\n/* A short landscape phone (iPhone SE and friends) cannot give the board search\\n field a width worth having beside the four buttons, so the field steps aside\\n and leaves them all at full size. The dropdown arrow next to it still opens\\n the board list. */\\n@media (pointer: coarse) and (max-width: 620px) {\\n .lithic-wb-search-input {\\n display: none !important;\\n }\\n}\"},\"$:/Lithic/Patches/Whiteboard/SaveButtonStyle\":{\"title\":\"$:/Lithic/Patches/Whiteboard/SaveButtonStyle\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/css\",\"text\":\"/* Ensure the save-wiki button in the whiteboard top bar\\n matches the size and pill styling of the adjacent buttons */\\n\\n.lithic-wb-save-btn {\\n display: inline-flex;\\n align-items: center;\\n vertical-align: middle;\\n margin: 0 1px;\\n}\\n\\n.lithic-wb-save-btn button {\\n display: inline-flex !important;\\n align-items: center;\\n justify-content: center;\\n width: 3.2em !important;\\n height: 2.0em !important;\\n border-radius: 1.0em !important;\\n background: var(--lithic-c-menu-bg) !important;\\n border: 1px solid rgba(var(--lithic-c-menu-fg-rgb), 0.2) !important;\\n cursor: pointer;\\n padding: 0 !important;\\n box-sizing: border-box !important;\\n}\\n\\n.lithic-wb-save-btn button:hover {\\n background: color-mix(in srgb, var(--lithic-c-menu-fg) 10%, var(--lithic-c-menu-bg)) !important; /* slightly lighter on hover */\\n}\\n\\n/* Scale up the SVG icon inside */\\n.lithic-wb-save-btn button svg {\\n width: 1.2em;\\n height: 1.2em;\\n}\\n\\n/* Hide the broken Font selector in the Tldraw style menu */\\n#TD-Styles-Font-Container {\\n display: none !important;\\n}\\n\\n\\n\\n/* Comptext injected stickies are ALWAYS transparent (targeted via 'c001' UUID suffix) */\\ndiv[id$=\\\"c001\\\"][data-shape=\\\"sticky\\\"] .c-gLGcPs {\\n background-color: transparent !important;\\n text-shadow: none !important;\\n box-shadow: none !important;\\n}\\n\\n/* Replace the 'Insert Media' button icon with a Command Palette icon */\\n#TD-PrimaryTools-Image svg {\\n display: none !important;\\n}\\n\\n#TD-PrimaryTools-Image .c-lkmCgW::after {\\n content: \\\"$:>/\\\";\\n font-family: monospace;\\n font-size: 10px;\\n font-weight: bold;\\n color: currentColor;\\n display: inline-block;\\n line-height: 1;\\n}\\n\\n\"},\"$:/Lithic/Patches/Whiteboard/WriteBehind.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/WriteBehind.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\ntitle: $:/Lithic/Patches/Whiteboard/WriteBehind.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nWrite-behind buffer for whiteboard (application/tldr) tiddlers.\\n\\nThe linonetwo/tw-whiteboard widget writes the entire board JSON back to the\\nwiki store on every (500ms-debounced) stroke and dispatches tm-auto-save-wiki,\\nwhich serializes the ENTIRE wiki store whenever autosave is enabled. As the\\nwiki grows, every stroke pays O(wiki size) in serialization cost.\\n\\nThis patch decouples the board's working memory from the store, following the\\nsame model as the native \\\"edit tiddler\\\" dialog: the whiteboard's state is\\ntransient and is only written back to the tiddler (and thus to the wiki file\\non save) when the user actually saves the wiki or closes the board.\\n\\n1. Text writes to application/tldr tiddlers are buffered in memory instead of\\n hitting the store, so strokes fire no change events and never dirty the wiki.\\n2. The buffer is flushed BEFORE any real wiki save (tm-save-wiki /\\n tm-auto-save-wiki) by hooking the root widget's dispatchEvent, so the\\n serializer always includes the latest board state.\\n3. The buffer is flushed on pagehide/beforeunload as a crash safety net (this\\n also covers the board's final unmount write when the app closes).\\n\\nCamera moves are view state, not content (see \\\"View state\\\" below).\\n\\nView state:\\ntldraw keeps the camera, the selection and the current page in `pageStates`,\\nand bumps a top-level `updatedCount` on every store change, so panning a board,\\nzooming it or flipping through an imported PDF looks exactly like drawing one\\nto a text-level diff. Entering the layout is enough to produce such a write:\\nthe board normalizes its document on mount and the first-visit fit moves the\\ncamera. Those writes used to flush immediately (the widget dispatches\\ntm-auto-save-wiki right after its own save), stamping `modified`, firing a\\nchange event and marking the whole wiki dirty, which is wrong for what is\\nreally a read: a board used as a picture viewer dirtied the wiki just by being\\nlooked at.\\n\\n`document.name` belongs in that set for the same reason, and it is what a fresh\\nimport hits: the widget sets it to the tiddler's title on every change, so a\\nboard whose document still carries the importer's name looked like an edit on\\nits first open in the layout. The title is the name of record and the widget\\nre-derives this one, so it is never authored, and it is written with the next\\nreal save like the camera.\\n\\nSo a buffered write whose document is unchanged once `updatedCount`,\\n`pageStates` and `document.name` are left out is held as view state instead.\\n\\n- A save that is happening anyway (the wiki is already dirty, or the reader\\n pressed Save) carries the camera along, so the board comes back where it was\\n left.\\n- A save that has nothing else to write does not, so panning and zooming never\\n dirty the wiki by themselves.\\n\\nTrade-offs (strict mode):\\n- Until the wiki is saved, other consumers of the board tiddler (\u003C$wb-image>\\n widgets, the comptext paste bridge, other open boards) see the last saved\\n state, not live strokes. Use the whiteboard layout's Save button to commit.\\n- A hard crash before a save loses strokes made since the last save.\\n- A view-only change (camera, selection, current page, the document's derived\\n name) is written on the next real save, not immediately.\\n*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-whiteboard-write-behind\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n\\tif(typeof window === \\\"undefined\\\" || typeof $tw === \\\"undefined\\\") {\\n\\t\\treturn;\\n\\t}\\n\\n\\t// title -> the latest text the board asked us to write\\n\\tvar buffer = {};\\n\\t// title -> true when that text differs from what was known only in view state\\n\\tvar viewOnly = {};\\n\\tvar originalSetText = $tw.wiki.setText.bind($tw.wiki);\\n\\n\\tfunction isWhiteboard(title) {\\n\\t\\tvar tiddler = $tw.wiki.getTiddler(title);\\n\\t\\treturn !!(tiddler && tiddler.fields.type === \\\"application/tldr\\\");\\n\\t}\\n\\n\\tfunction hasBuffered(title) {\\n\\t\\treturn Object.prototype.hasOwnProperty.call(buffer,title);\\n\\t}\\n\\n\\t// What the board was last seen holding, so a change can be judged against\\n\\t// the latest one rather than against the store's older copy.\\n\\tfunction knownText(title) {\\n\\t\\treturn hasBuffered(title) ? buffer[title] : $tw.wiki.getTiddlerText(title,\\\"\\\");\\n\\t}\\n\\n\\t// The document with everything that is not content left out: tldraw's own\\n\\t// change counter, the per-page view state (camera, selection, current page)\\n\\t// and `document.name`, which the widget re-derives from the tiddler title on\\n\\t// every change. A replacer serializes the rest in one pass, so what is\\n\\t// compared is exactly the board's content however the keys were ordered.\\n\\tfunction contentOf(text) {\\n\\t\\tvar parsed;\\n\\t\\ttry {\\n\\t\\t\\tparsed = JSON.parse(text);\\n\\t\\t} catch(e) {\\n\\t\\t\\treturn null;\\n\\t\\t}\\n\\t\\tif(!parsed || typeof parsed !== \\\"object\\\") {\\n\\t\\t\\treturn null;\\n\\t\\t}\\n\\t\\treturn JSON.stringify(parsed,function(key,value) {\\n\\t\\t\\tif(key === \\\"updatedCount\\\" || key === \\\"pageStates\\\") {\\n\\t\\t\\t\\treturn undefined;\\n\\t\\t\\t}\\n\\t\\t\\t// `this` is the object holding the key, so this drops the document's own\\n\\t\\t\\t// name and leaves every shape's and page's alone.\\n\\t\\t\\tif(key === \\\"name\\\" && this === parsed.document) {\\n\\t\\t\\t\\treturn undefined;\\n\\t\\t\\t}\\n\\t\\t\\treturn value;\\n\\t\\t});\\n\\t}\\n\\n\\tfunction isViewOnly(previous,next) {\\n\\t\\tif(!previous) {\\n\\t\\t\\treturn false;\\n\\t\\t}\\n\\t\\tvar before = contentOf(previous),\\n\\t\\t\\tafter = contentOf(next);\\n\\t\\treturn before !== null && after !== null && before === after;\\n\\t}\\n\\n\\t// Is the wiki already carrying changes a save would write? A camera move is\\n\\t// then free to ride along, because the file is being rewritten anyway.\\n\\tfunction saveHasContent() {\\n\\t\\treturn !$tw.saverHandler || typeof $tw.saverHandler.isDirty !== \\\"function\\\" || $tw.saverHandler.isDirty();\\n\\t}\\n\\n\\tfunction flushBuffer(flushViewState) {\\n\\t\\tvar titles = Object.keys(buffer);\\n\\t\\tif(titles.length === 0) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\tvar heldText = {},\\n\\t\\t\\theldViewOnly = {};\\n\\t\\tfor(var i = 0; i \u003C titles.length; i++) {\\n\\t\\t\\tvar title = titles[i];\\n\\t\\t\\tif(!flushViewState && viewOnly[title]) {\\n\\t\\t\\t\\theldText[title] = buffer[title];\\n\\t\\t\\t\\theldViewOnly[title] = true;\\n\\t\\t\\t\\tcontinue;\\n\\t\\t\\t}\\n\\t\\t\\tvar text = buffer[title];\\n\\t\\t\\tdelete buffer[title];\\n\\t\\t\\tdelete viewOnly[title];\\n\\t\\t\\tif(!$tw.wiki.tiddlerExists(title)) {\\n\\t\\t\\t\\tcontinue; // board was deleted before the flush\\n\\t\\t\\t}\\n\\t\\t\\ttry {\\n\\t\\t\\t\\toriginalSetText(title, undefined, undefined, text);\\n\\t\\t\\t} catch(e) {\\n\\t\\t\\t\\tconsole.error(\\\"[Lithic] Whiteboard write-behind flush failed for \\\" + title, e);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\t// Put held view state back, unless a write landed on that board while we\\n\\t\\t// were flushing (it would already carry the newer document).\\n\\t\\tfor(var heldTitle in heldText) {\\n\\t\\t\\tif(hasBuffered(heldTitle)) {\\n\\t\\t\\t\\tcontinue;\\n\\t\\t\\t}\\n\\t\\t\\tbuffer[heldTitle] = heldText[heldTitle];\\n\\t\\t\\tviewOnly[heldTitle] = heldViewOnly[heldTitle];\\n\\t\\t}\\n\\t}\\n\\n\\t// 1. Buffer text writes to whiteboard tiddlers; everything else passes through.\\n\\t$tw.wiki.setText = function() {\\n\\t\\tvar title = arguments[0],\\n\\t\\t\\tfield = arguments[1],\\n\\t\\t\\tvalue = arguments[3];\\n\\t\\tif(typeof value !== \\\"string\\\" || !isWhiteboard(title)) {\\n\\t\\t\\treturn originalSetText.apply(null, arguments);\\n\\t\\t}\\n\\t\\t// Text writes to a whiteboard are buffered (the heavy per-stroke path).\\n\\t\\tif(!field || field === \\\"text\\\") {\\n\\t\\t\\tviewOnly[title] = isViewOnly(knownText(title),value);\\n\\t\\t\\tbuffer[title] = value;\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t// The widget re-writes `type` on every save; if it is already the same\\n\\t\\t// value, skip it entirely so the per-stroke write cannot stamp a new\\n\\t\\t// `modified` timestamp (which would fire a change event and dirty the wiki).\\n\\t\\tif(field === \\\"type\\\" && $tw.wiki.getTiddler(title).fields.type === value) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\treturn originalSetText.apply(null, arguments);\\n\\t};\\n\\n\\t// 2. Flush before any real wiki save so the serializer sees the latest board.\\n\\tfunction installSaveHook() {\\n\\t\\tif(!$tw.rootWidget || $tw.rootWidget.__lithicWriteBehindHooked) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t$tw.rootWidget.__lithicWriteBehindHooked = true;\\n\\t\\tvar originalDispatch = $tw.rootWidget.dispatchEvent;\\n\\t\\t$tw.rootWidget.dispatchEvent = function(event) {\\n\\t\\t\\tif(event && event.type === \\\"tm-save-wiki\\\") {\\n\\t\\t\\t\\tflushBuffer(true);\\n\\t\\t\\t} else if(event && event.type === \\\"tm-auto-save-wiki\\\") {\\n\\t\\t\\t\\t// The board dispatches this after every camera move too, so only a\\n\\t\\t\\t\\t// save with something else to write carries the camera with it.\\n\\t\\t\\t\\tflushBuffer(saveHasContent());\\n\\t\\t\\t}\\n\\t\\t\\treturn originalDispatch.call(this, event);\\n\\t\\t};\\n\\t}\\n\\tinstallSaveHook();\\n\\tif(!$tw.rootWidget) {\\n\\t\\tvar tries = 0;\\n\\t\\tvar hookTimer = setInterval(function() {\\n\\t\\t\\ttries++;\\n\\t\\t\\tinstallSaveHook();\\n\\t\\t\\tif($tw.rootWidget || tries > 100) {\\n\\t\\t\\t\\tclearInterval(hookTimer);\\n\\t\\t\\t}\\n\\t\\t}, 50);\\n\\t}\\n\\n\\t// 3. Crash safety net: flush on page teardown, where the page is leaving and\\n\\t// a held camera can no longer dirty anything the reader will see.\\n\\twindow.addEventListener(\\\"pagehide\\\", function() { flushBuffer(true); });\\n\\twindow.addEventListener(\\\"beforeunload\\\", function() { flushBuffer(true); });\\n};\\n\\n})();\"},\"$:/Lithic/Widgets/multi-wb-image.js\":{\"title\":\"$:/Lithic/Widgets/multi-wb-image.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Widgets/multi-wb-image.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nA widget to extract and display images from a list of whiteboard tiddlers.\\n\\\\*/\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar MultiWbImageWidget = function(parseTreeNode,options) {\\n\\tthis.initialise(parseTreeNode,options);\\n};\\n\\n/*\\nInherit from the base widget class\\n*/\\nMultiWbImageWidget.prototype = new Widget();\\n\\n/*\\nRender this widget into the DOM\\n*/\\nMultiWbImageWidget.prototype.render = function(parent,nextSibling) {\\n\\tthis.parentDomNode = parent;\\n\\tthis.computeAttributes();\\n\\tthis.execute();\\n \\n var container = this.document.createElement(\\\"div\\\");\\n container.className = this.className || \\\"multi-wb-image-container\\\";\\n \\n for (var i = 0; i \u003C this.boardTitles.length; i++) {\\n var boardTitle = this.boardTitles[i];\\n var imgNode = this.document.createElement(\\\"img\\\");\\n \\n if(this.width) {\\n imgNode.setAttribute(\\\"width\\\", this.width);\\n }\\n if(this.height) {\\n imgNode.setAttribute(\\\"height\\\", this.height);\\n }\\n \\n var src = this.extractImageSrc(boardTitle);\\n if(src) {\\n imgNode.setAttribute(\\\"src\\\", src);\\n } else {\\n imgNode.setAttribute(\\\"alt\\\", \\\"Whiteboard image not found: \\\" + boardTitle);\\n imgNode.style.border = \\\"1px dashed var(--lithic-c-code-warn)\\\";\\n imgNode.style.display = \\\"inline-block\\\";\\n if (!this.width) imgNode.style.width = \\\"100px\\\";\\n if (!this.height) imgNode.style.height = \\\"100px\\\";\\n }\\n container.appendChild(imgNode);\\n }\\n\\n\\tparent.insertBefore(container,nextSibling);\\n\\tthis.domNodes.push(container);\\n};\\n\\nMultiWbImageWidget.prototype.extractImageSrc = function(boardTitle) {\\n var tiddler = this.wiki.getTiddler(boardTitle);\\n if (!tiddler || !tiddler.fields.text) return null;\\n try {\\n var doc = JSON.parse(tiddler.fields.text);\\n if (doc && doc.document && doc.document.assets) {\\n var assets = doc.document.assets;\\n for (var id in assets) {\\n var asset = assets[id];\\n if (asset.type === \\\"image\\\") {\\n return asset.src;\\n }\\n }\\n }\\n } catch(e) {\\n console.error(\\\"MultiWbImageWidget parse error\\\", e);\\n }\\n return null;\\n};\\n\\n/*\\nCompute the internal state of the widget\\n*/\\nMultiWbImageWidget.prototype.execute = function() {\\n\\tvar boardsText = this.getAttribute(\\\"boards\\\") || this.getAttribute(\\\"text\\\") || this.getAttribute(\\\"list\\\") || \\\"\\\";\\n \\n var titles = [];\\n var lines = boardsText.split(\\\"\\\\n\\\");\\n for(var i=0; i\u003Clines.length; i++) {\\n var line = lines[i].trim();\\n if(!line) continue;\\n if(line.startsWith(\\\"[[\\\") && line.endsWith(\\\"]]\\\")) {\\n titles.push(line.substring(2, line.length - 2));\\n } else {\\n titles.push(line);\\n }\\n }\\n \\n\\tthis.boardTitles = titles;\\n\\tthis.width = this.getAttribute(\\\"scale\\\") || this.getAttribute(\\\"width\\\", \\\"80%\\\");\\n\\tthis.height = this.getAttribute(\\\"height\\\");\\n this.className = this.getAttribute(\\\"class\\\");\\n};\\n\\n/*\\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\\n*/\\nMultiWbImageWidget.prototype.refresh = function(changedTiddlers) {\\n\\tvar changedAttributes = this.computeAttributes();\\n\\tif(changedAttributes.scale || changedAttributes.boards || changedAttributes.text || changedAttributes.list || changedAttributes.width || changedAttributes.height || changedAttributes[\\\"class\\\"]) {\\n\\t\\tthis.refreshSelf();\\n\\t\\treturn true;\\n\\t}\\n if (this.boardTitles) {\\n for (var i = 0; i \u003C this.boardTitles.length; i++) {\\n if (changedTiddlers[this.boardTitles[i]]) {\\n this.refreshSelf();\\n return true;\\n }\\n }\\n }\\n\\treturn false;\\n};\\n\\nexports[\\\"multi-wb-image\\\"] = MultiWbImageWidget;\\nexports[\\\"multi.wb.image\\\"] = MultiWbImageWidget;\\n\\n})();\\n\"},\"$:/Lithic/Widgets/trigger-print.js\":{\"title\":\"$:/Lithic/Widgets/trigger-print.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Widgets/trigger-print.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nA hidden widget that triggers window.print() after a delay, and then cleans up.\\n\\\\*/\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar PrintWidget = function(parseTreeNode,options) {\\n\\tthis.initialise(parseTreeNode,options);\\n};\\n\\nPrintWidget.prototype = new Widget();\\n\\nPrintWidget.prototype.render = function(parent,nextSibling) {\\n\\tthis.parentDomNode = parent;\\n\\tthis.execute();\\n\\t\\n\\tif (typeof window !== \\\"undefined\\\" && !this.printed) {\\n\\t\\tthis.printed = true; // prevent infinite loops on re-render\\n\\t\\tvar self = this;\\n\\t\\tvar delay = parseInt(this.getAttribute(\\\"delay\\\", \\\"1000\\\"), 10);\\n\\t\\t\\n\\t\\tsetTimeout(function() {\\n\\t\\t\\twindow.print();\\n\\t\\t}, delay);\\n\\t}\\n};\\n\\nPrintWidget.prototype.execute = function() {};\\nPrintWidget.prototype.refresh = function() { return false; };\\n\\nexports[\\\"trigger-print\\\"] = PrintWidget;\\n\\n})();\\n\"},\"$:/Lithic/Widgets/wb-image.js\":{\"title\":\"$:/Lithic/Widgets/wb-image.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Widgets/wb-image.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nA widget to extract and display an image from a whiteboard's internal JSON assets.\\n\\\\*/\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar WbImageWidget = function(parseTreeNode,options) {\\n\\tthis.initialise(parseTreeNode,options);\\n};\\n\\n/*\\nInherit from the base widget class\\n*/\\nWbImageWidget.prototype = new Widget();\\n\\n/*\\nRender this widget into the DOM\\n*/\\nWbImageWidget.prototype.render = function(parent,nextSibling) {\\n\\tthis.parentDomNode = parent;\\n\\tthis.computeAttributes();\\n\\tthis.execute();\\n \\n var imgNode = this.document.createElement(\\\"img\\\");\\n if(this.width) {\\n imgNode.setAttribute(\\\"width\\\", this.width);\\n }\\n if(this.height) {\\n imgNode.setAttribute(\\\"height\\\", this.height);\\n }\\n if(this.className) {\\n imgNode.className = this.className;\\n }\\n \\n var src = this.extractImageSrc();\\n if(src) {\\n imgNode.setAttribute(\\\"src\\\", src);\\n } else {\\n // Fallback or error\\n imgNode.setAttribute(\\\"alt\\\", \\\"Whiteboard image not found\\\");\\n imgNode.style.border = \\\"1px dashed var(--lithic-c-code-warn)\\\";\\n imgNode.style.display = \\\"inline-block\\\";\\n if (!this.width) imgNode.style.width = \\\"100px\\\";\\n if (!this.height) imgNode.style.height = \\\"100px\\\";\\n }\\n\\n\\tparent.insertBefore(imgNode,nextSibling);\\n\\tthis.domNodes.push(imgNode);\\n};\\n\\nWbImageWidget.prototype.extractImageSrc = function() {\\n var tiddler = this.wiki.getTiddler(this.boardTitle);\\n if (!tiddler || !tiddler.fields.text) return null;\\n try {\\n var doc = JSON.parse(tiddler.fields.text);\\n if (doc && doc.document && doc.document.assets) {\\n var assets = doc.document.assets;\\n for (var id in assets) {\\n var asset = assets[id];\\n if (asset.type === \\\"image\\\") {\\n if (this.imageName && asset.fileName === this.imageName) {\\n return asset.src;\\n }\\n if (this.assetId && asset.id === this.assetId) {\\n return asset.src;\\n }\\n }\\n }\\n // If neither name nor assetId provided, fallback to the FIRST image found\\n if (!this.imageName && !this.assetId) {\\n for (var firstId in assets) {\\n if (assets[firstId].type === \\\"image\\\") {\\n return assets[firstId].src;\\n }\\n }\\n }\\n }\\n } catch(e) {\\n console.error(\\\"WbImageWidget parse error\\\", e);\\n }\\n return null;\\n};\\n\\n/*\\nCompute the internal state of the widget\\n*/\\nWbImageWidget.prototype.execute = function() {\\n\\tvar boardTitle = this.getAttribute(\\\"board\\\", this.getVariable(\\\"currentTiddler\\\"));\\n\\tif (boardTitle && boardTitle.startsWith(\\\"[[\\\") && boardTitle.endsWith(\\\"]]\\\")) {\\n\\t\\tboardTitle = boardTitle.substring(2, boardTitle.length - 2);\\n\\t}\\n\\tthis.boardTitle = boardTitle;\\n\\tthis.imageName = this.getAttribute(\\\"name\\\");\\n this.assetId = this.getAttribute(\\\"assetId\\\");\\n\\tthis.width = this.getAttribute(\\\"width\\\", \\\"80%\\\");\\n\\tthis.height = this.getAttribute(\\\"height\\\");\\n this.className = this.getAttribute(\\\"class\\\");\\n};\\n\\n/*\\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\\n*/\\nWbImageWidget.prototype.refresh = function(changedTiddlers) {\\n\\tvar changedAttributes = this.computeAttributes();\\n\\tif(changedAttributes.board || changedAttributes.name || changedAttributes.assetId || changedAttributes.width || changedAttributes.height || changedAttributes[\\\"class\\\"] || changedTiddlers[this.boardTitle]) {\\n\\t\\tthis.refreshSelf();\\n\\t\\treturn true;\\n\\t}\\n\\treturn false;\\n};\\n\\nexports[\\\"wb-image\\\"] = WbImageWidget;\\n\\n})();\\n\"},\"$:/lithic/buttons/FullscreenWhiteboard\":{\"title\":\"$:/lithic/buttons/FullscreenWhiteboard\",\"tags\":\"$:/tags/PageControls\",\"text\":\"\\\\whitespace trim\\n \u003C$button tooltip=\\\"Fullscreen Paint\\\" aria-label={{$:/language/Buttons/Edit/Caption}} class=\u003C\u003Ctv-config-toolbar-class>> >\\n \u003C$action-setfield $tiddler=\\\"$:/state/sidebar\\\" text=\\\"no\\\"/>\\n \u003C$action-setfield $tiddler=\\\"$:/state/notebook-sidebar\\\" text=\\\"no\\\"/>\\n \u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/WhiteBoard\\\"/>\\n \u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\\\"$:/DefaultCanvas\\\" />\\n \u003C$list filter=\\\"[\u003Ctv-config-toolbar-icons>match[yes]]\\\">\\n {{$:/core/images/palette}}\\n \u003C/$list>\\n \u003C$list filter=\\\"[\u003Ctv-config-toolbar-text>match[yes]]\\\">\\n \u003Cspan class=\\\"tc-btn-text\\\">\\n \u003C$text text=\\\"Fullscreen Whiteboard\\\"/>\\n \u003C/span>\\n \u003C/$list>\\n \u003C/$button>\"},\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/CreateNewTiddlerPopup\":{\"title\":\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/CreateNewTiddlerPopup\",\"tags\":\"\",\"text\":\"\\\\whitespace trim\\n\\n\\\\procedure do-create-whiteboard()\\n\u003C$set name=\\\"rawName\\\" value={{$:/state/lithic/new-whiteboard-name}}>\\n\u003C$set name=\\\"ts\\\" value={{{ [\u003Cnow>format[YYYY0MM0DD0hh0mm0ss]] }}}>\\n\u003C$set name=\\\"finalTitle\\\" value={{{ [\u003CrawName>!is[blank]then\u003CrawName>] ~[\u003Cts>addsuffix[-whiteboard]] }}}>\\n \u003C$action-createtiddler\\n $basetitle=\u003C\u003CfinalTitle>>\\n $template=\\\"$:/DefaultCanvas\\\"\\n type=\\\"application/tldr\\\"\\n $createdtitle=\\\"newTitle\\\"\\n />\\n \u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\u003C\u003CnewTitle>>/>\\n \u003C$action-setfield $tiddler=\\\"$:/state/lithic/new-whiteboard-name\\\" text=\\\"\\\"/>\\n \u003C$action-deletetiddler $tiddler=\\\"$:/state/Whiteboard/PageLayout/CreateNewTiddlerPopup\\\"/>\\n\u003C/$set>\\n\u003C/$set>\\n\u003C/$set>\\n\\\\end\\n\\n\u003Cdiv style=\\\"padding: 8px 10px; display: flex; gap: 6px; align-items: center;\\\" onclick=\\\"event.stopPropagation();\\\">\\n \u003C$keyboard key=\\\"Enter\\\" actions=\u003C\u003Cdo-create-whiteboard>>>\\n \u003C$edit-text\\n tiddler=\\\"$:/state/lithic/new-whiteboard-name\\\"\\n field=\\\"text\\\"\\n placeholder=\\\"Name (blank → timestamp)\\\"\\n tag=\\\"input\\\"\\n type=\\\"text\\\"\\n class=\\\"tc-edit-texteditor\\\"\\n style=\\\"padding: 5px 8px;\\\"\\n focus=\\\"true\\\"\\n />\\n \u003C/$keyboard>\\n \u003C$button class=\\\"tc-btn-big-green\\\" style=\\\"padding: 4px 14px; white-space: nowrap;\\\">\\n Create\\n \u003C\u003Cdo-create-whiteboard>>\\n \u003C/$button>\\n\u003C/div>\\n\"},\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/WhiteBoard\":{\"title\":\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/WhiteBoard\",\"description\":\"show `application/tldr` type tiddlers in full screen whiteboard\",\"name\":\"White Board\",\"tags\":\"$:/tags/Layout\",\"text\":\"\\\\whitespace trim\\n\\\\define containerClasses()\\ntc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$ tw-whiteboard-layout-container\\n\\\\end\\n\\\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\\n\\n\u003C$vars\\n\\ttv-config-toolbar-icons={{$:/config/Toolbar/Icons}}\\n\\ttv-config-toolbar-text={{$:/config/Toolbar/Text}}\\n\\ttv-config-toolbar-class={{$:/config/Toolbar/ButtonClass}}\\n\\ttv-show-missing-links={{$:/config/MissingLinks}}\\n\\tstoryviewTitle={{$:/view}}\\n\\tlanguageTitle={{{ [{$:/language}get[name]] }}}\\n\\tcurrentBoard={{{ [[$:/state/Whiteboard/PageLayout/tiddler]get[text]] ~[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]] }}}>\\n\\n\u003Cdiv class=\u003C\u003CcontainerClasses>>>\\n\\n\u003Cstyle>\\n/* Prevent horizontal scrolling from wide tooltips overflowing the screen edges */\\nbody { overflow-x: hidden; }\\n\u003C/style>\\n\\n\u003C$navigator story=\\\"$:/StoryList\\\" history=\\\"$:/HistoryList\\\" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>\\n\\n\u003Cmain class=\\\"tw-whiteboard-layout-main-area\\\">\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"nomatch\\\" text=\\\"\\\">\\n\\t\\t\u003C$whiteboard tiddler={{$:/state/Whiteboard/PageLayout/tiddler}} height=\\\"100vh\\\" />\\n\\t\u003C/$reveal>\\n\\t\u003C!-- default value, when first opened, select widget's state tiddler is empty, but default value filter gives a value, we show that tiddler -->\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"match\\\" text=\\\"\\\">\\n\\t\\t\u003C$list filter='[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]'>\\n\\t\\t\\t\u003C$whiteboard tiddler={{{[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]}}} height=\\\"100vh\\\" />\\n\\t\\t\u003C/$list>\\n\\t\u003C/$reveal>\\n\\t\u003C!-- Floating Comptext UI -->\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/ComptextPopup\\\" type=\\\"match\\\" text=\\\"open\\\">\\n\\t\\t\u003Cdiv class=\\\"lithic-floating-comptext-wrapper\\\" style=\\\"position:fixed; top:45%; left:50%; margin-left: -125px; margin-top: -30px; z-index: 999999; width: 250px; max-width: 90vw;\\\">\\n\\t\\t\\t\u003Cstyle>\\n\\t\\t\\t.lithic-floating-comptext-wrapper { position: relative; }\\n\\t\\t\\t.lithic-floating-comptext-wrapper .tc-block-dropdown.ect-block-dropdown {\\n\\t\\t\\t\\ttop: 100% !important;\\n\\t\\t\\t\\tleft: 0 !important;\\n\\t\\t\\t\\tmargin-top: 5px !important;\\n\\t\\t\\t\\tposition: absolute !important;\\n\\t\\t\\t\\twidth: 100% !important;\\n\\t\\t\\t\\tmax-width: 100% !important;\\n\\t\\t\\t}\\n\\t\\t\\t\u003C/style>\\n\\t\\t\\t\u003C$keyboard key=\\\"Escape\\\" actions=\\\"\u003C$action-setfield $tiddler='$:/state/Whiteboard/ComptextPopup' text='closed'/>\\\">\\n\\t\\t\\t\\t\u003C$keyboard key=\\\"Enter\\\" actions=\\\"\u003C$action-dispatch-paste tiddler='$:/temp/whiteboard-comptext-input'/>\u003C$action-setfield $tiddler='$:/state/Whiteboard/ComptextPopup' text='closed'/>\\\">\\n\\t\\t\\t\\t\\t\u003C$edit-comptext tag=\\\"input\\\" tiddler=\\\"$:/temp/whiteboard-comptext-input\\\" field=\\\"text\\\" class=\\\"tc-edit-texteditor lithic-floating-comptext-input\\\" placeholder=\\\"Type command or link...\\\" style=\\\"width: 100%; border: 1px solid \u003C\u003Ccolour table-border>>; padding: 8px; font-size: 1.2em; outline: none; box-sizing: border-box; background: \u003C\u003Ccolour page-background>>; box-shadow: 0 4px 10px rgba(0,0,0,0.1); border-radius: 4px;\\\" />\\n\\t\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\u003C/div>\\n\\t\u003C/$reveal>\\n\u003C/main>\\n\\n\u003C!-- put this below main, so nav bar is layered on top of the main. In UI, this nav in on the top of the page. -->\\n\u003Cnav class=\\\"tw-whiteboard-layout-top-bar\\\">\\n\\t\u003C!-- Searchable combobox replacing standard select -->\\n\\t\u003Cspan style=\\\"position:relative; display:inline-flex; align-items:center;\\\" onmousedown=\\\"event.stopPropagation();\\\" onpointerdown=\\\"event.stopPropagation();\\\" onclick=\\\"event.stopPropagation();\\\">\\n\\t\\t\\n\\n\\n\\t\\t\u003C$let\\n\\t\\t\\tsearchState=\\\"$:/state/Whiteboard/PageLayout/search\\\"\\n\\t\\t\\tdropdownState=\\\"$:/state/Whiteboard/PageLayout/dropdown\\\"\\n\\t\\t\\tcurrentBoard={{{ [[$:/state/Whiteboard/PageLayout/tiddler]get[text]] ~[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]] }}}\\n\\t\\t>\\n\\t\\t\\t\u003C$keyboard key=\\\"Escape\\\" actions=\\\"\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\u003C$action-setfield $tiddler=\u003C\u003CsearchState>> text=''/>\\\">\\n\\t\\t\\t\\t\u003Cstyle>\\n\\t\\t\\t\\t.lithic-wb-search-input { color: \u003C\u003Ccolour muted-foreground>> !important; }\\n\\t\\t\\t\\t.lithic-wb-search-input::placeholder { color: \u003C\u003Ccolour foreground>> !important; opacity: 1; }\\n\\t\\t\\t\\t\u003C/style>\\n\\t\\t\\t\\t\u003Cdiv style=\\\"display:flex; border: 1px solid \u003C\u003Ccolour table-border>>; background: \u003C\u003Ccolour page-background>>; align-items: stretch; border-radius: 3px;\\\">\\n\\t\\t\\t\\t\\t\u003C$keyboard key=\\\"Enter\\\" actions=\\\"\\\"\\\"\\n\\t\\t\\t\\t\\t\\t\u003C$let searchTerm={{{ [\u003CsearchState>get[text]] }}}>\\n\\t\\t\\t\\t\\t\\t\\t\u003C$list filter=\\\"[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]search:title\u003CsearchTerm>!sort[modified]limit[1]]\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\u003C\u003CcurrentTiddler>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CsearchState>> text=\\\"\\\"/>\\n\\t\\t\\t\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\\t\\t\\t\u003C/$let>\\n\\t\\t\\t\\t\\t\\\"\\\"\\\">\\n\\t\\t\\t\\t\\t\\t\u003C$edit-text \\n\\t\\t\\t\\t\\t\\t\\ttiddler=\u003C\u003CsearchState>> \\n\\t\\t\\t\\t\\t\\t\\ttag=\\\"input\\\" \\n\\t\\t\\t\\t\\t\\t\\tplaceholder={{{ [\u003CcurrentBoard>!is[blank]then\u003CcurrentBoard>] ~[[Search boards...]] }}}\\n\\t\\t\\t\\t\\t\\t\\tdefault=\\\"\\\" \\n\\t\\t\\t\\t\\t\\t\\tclass=\\\"tc-edit-texteditor lithic-wb-search-input\\\" \\n\\t\\t\\t\\t\\t\\t\\tstyle=\\\"width: 230px; padding: 4px 6px; border: none; outline: none; background: transparent; box-shadow: none;\\\"\\n\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\\t\\t\\t\u003C$button class=\\\"tc-btn-invisible\\\" style=\\\"padding: 2px 8px; border-left: 1px solid \u003C\u003Ccolour table-border>>; cursor: pointer; display: flex; align-items: center; justify-content: center; fill: currentColor;\\\">\\n\\t\\t\\t\\t\\t\\t\u003C$list filter=\\\"[\u003CdropdownState>get[text]match[open]]\\\" emptyMessage=\\\"\u003C$action-setfield $tiddler=\u003C\u003CdropdownState>> text='open'/>\u003Cspan style='width:1em; height:1em;'>{{$:/core/images/down-arrow}}\u003C/span>\\\">\\n\\t\\t\\t\\t\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\\n\\t\\t\\t\\t\\t\\t\\t\u003Cspan style=\\\"width:1em; height:1em;\\\">{{$:/core/images/up-arrow}}\u003C/span>\\n\\t\\t\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\\t\\t\u003C/$button>\\n\\t\\t\\t\\t\u003C/div>\\n\\n\\t\\t\\t\\t\u003C$list filter=\\\"[\u003CdropdownState>get[text]match[open]] [\u003CsearchState>get[text]!is[blank]] +[limit[1]then[show]]\\\" variable=\\\"ignore\\\">\\n\\t\\t\\t\\t\\t\u003Cdiv style=\\\"position:absolute; top:100%; left:0; z-index:9999; margin-top: 2px;\\\">\\n\\t\\t\\t\\t\\t\\t\u003Cdiv class=\\\"tc-drop-down\\\" style=\\\"min-width: 250px; max-height: 400px; overflow-y: auto;\\\">\\n\\t\\t\\t\\t\\t\\t\\t\u003C$let searchTerm={{{ [\u003CsearchState>get[text]] }}}>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C$list filter=\\\"[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]search:title\u003CsearchTerm>!sort[modified]limit[10]]\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$button class=\\\"tc-btn-invisible\\\" style=\\\"display:block; width:100%; text-align:left; padding: 4px 8px;\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" text=\u003C\u003CcurrentTiddler>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-deletetiddler $tiddler=\u003C\u003CdropdownState>>/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\u003C\u003CsearchState>> text=\\\"\\\"/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C$view field=\\\"title\\\"/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\u003C/$button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\\t\\t\\t\\t\u003C/$let>\\n\\t\\t\\t\\t\\t\\t\u003C/div>\\n\\t\\t\\t\\t\\t\u003C/div>\\n\\t\\t\\t\\t\u003C/$list>\\n\\t\\t\\t\u003C/$keyboard>\\n\\t\\t\u003C/$let>\\n\\t\u003C/span>\\n\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"nomatch\\\" text=\\\"\\\">\\n\\t\\t\u003C$button tooltip=\\\"Open In StoryView\\\">\\n\\t\\t\\t{{$:/core/images/home-button}}\\n\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/core/ui/PageTemplate\\\"/>\\n\\t\\t\u003C/$button>\\n\\t\u003C/$reveal>\\n\\t\u003C!-- default value, when first opened, select widget's state tiddler is empty, but default value filter gives a value, we show that tiddler -->\\n\\t\u003C$reveal state=\\\"$:/state/Whiteboard/PageLayout/tiddler\\\" type=\\\"match\\\" text=\\\"\\\">\\n\\t\\t\u003C$list filter='[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]'>\\n\\t\\t\\t\u003C$button tooltip=\\\"Open In StoryView\\\">\\n\\t\\t\\t\\t{{$:/core/images/home-button}}\\n\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/core/ui/PageTemplate\\\"/>\\n\\t\\t\\t\\t\u003C$action-navigate $to={{{[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]}}} />\\n\\t\\t\\t\u003C/$button>\\n\\t\\t\u003C/$list>\\n\\t\u003C/$reveal>\\n\\n\\t\u003C$button tooltip=\\\"New Whiteboard\\\" popup=\\\"$:/state/Whiteboard/PageLayout/CreateNewTiddlerPopup\\\">\\n\\t\\t{{$:/core/images/new-button}}\\n\\t\u003C/$button>\\n\\t\u003C$reveal type=\\\"popup\\\" state=\\\"$:/state/Whiteboard/PageLayout/CreateNewTiddlerPopup\\\">\\n\\t\\t{{$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/PageLayout/CreateNewTiddlerPopup}}\\n\\t\u003C/$reveal>\\n\\n\\t\u003Cspan class=\\\"lithic-wb-save-btn\\\">\\n\\t\\t\u003C$button tooltip=\\\"Print Sequential Whiteboard\\\" class=\\\"tc-btn-invisible\\\">\\n\\t\\t\\t{{$:/core/images/print-button}}\\n\\t\\t\\t\u003C$vars currentBoard={{{ [[$:/state/Whiteboard/PageLayout/tiddler]get[text]] ~[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]] }}}>\\n\\t\\t\\t\\t\u003C$vars wbHeight={{{ [\u003CcurrentBoard>get[whiteboard-height]] ~[[540px]] }}}>\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"\\\" />\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"$:/StoryList\\\" list=\\\"\\\" />\\n\\t\\t\\t\\t\\t\u003C$action-setfield $tiddler=\\\"Print Sequential Whiteboard\\\" text={{{ [[\u003C\u003Cdraw-sequential \\\"]] [\u003CcurrentBoard>] [[\\\" \\\"]] [\u003CwbHeight>] [[\\\">>\u003C$trigger-print delay=\\\"1000\\\" />]] +[join[]] }}} />\\n\\t\\t\\t\\t\\t\u003C$action-navigate $to=\\\"Print Sequential Whiteboard\\\" />\\n\\t\\t\\t\\t\u003C/$vars>\\n\\t\\t\\t\u003C/$vars>\\n\\t\\t\u003C/$button>\\n\\t\u003C/span>\\n\\n\\t\u003Cspan class=\\\"lithic-wb-save-btn\\\">{{$:/core/ui/Buttons/save-wiki}}\u003C/span>\\n\u003C/nav>\\n\\n{{$:/plugins/tobibeer/preview/popups}}\\n\u003C/$navigator>\\n\\n\u003C!-- Phones held in portrait cannot fit this layout: the board is taller than\\n\\tit is wide and the 400px top bar has no room for its controls. So instead\\n\\tof letting the board half-render, this gate covers the viewport and asks\\n\\tfor a rotation. It is hidden everywhere else, desktops included (see\\n\\t$:/Lithic/Patches/Whiteboard/LandscapeGate), and carries an exit so a\\n\\tportrait visitor is never trapped in the layout. -->\\n\u003Cdiv class=\\\"lithic-wb-rotate-gate\\\">\\n\\t\u003Csvg class=\\\"lithic-wb-rotate-gate-glyph\\\" width=\\\"72\\\" height=\\\"72\\\" viewBox=\\\"0 0 64 64\\\" aria-hidden=\\\"true\\\" focusable=\\\"false\\\">\\n\\t\\t\u003Cpath d=\\\"M54 32a22 22 0 1 1-22-22\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"3\\\" stroke-linecap=\\\"round\\\"/>\\n\\t\\t\u003Cpath d=\\\"M28 6 33 10 28 14\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"3\\\" stroke-linecap=\\\"round\\\"/>\\n\\t\\t\u003Crect x=\\\"23\\\" y=\\\"17\\\" width=\\\"18\\\" height=\\\"30\\\" rx=\\\"5\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"3\\\"/>\\n\\t\\t\u003Cpath d=\\\"M30 42h4\\\" fill=\\\"none\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"2\\\" stroke-linecap=\\\"round\\\"/>\\n\\t\u003C/svg>\\n\\t\u003Cp class=\\\"lithic-wb-rotate-gate-title\\\">Rotate your device\u003C/p>\\n\\t\u003Cp class=\\\"lithic-wb-rotate-gate-hint\\\">The whiteboard needs a landscape screen.\u003C/p>\\n\\t\u003C$button class=\\\"lithic-wb-rotate-gate-exit\\\" tooltip=\\\"Open In StoryView\\\">\\n\\t\\tExit whiteboard\\n\\t\\t\u003C$action-setfield $tiddler=\\\"$:/layout\\\" text=\\\"$:/core/ui/PageTemplate\\\"/>\\n\\t\u003C/$button>\\n\u003C/div>\\n\\n\u003C/div>\\n\\n\u003C/$vars>\"},\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/ViewToolbar/images/OpenInFullScreenWhiteBoardButtonImage\":{\"title\":\"$:/plugins/linonetwo/tw-whiteboard/tiddlywiki-ui/ViewToolbar/images/OpenInFullScreenWhiteBoardButtonImage\",\"tags\":\"$:/tags/Image\",\"text\":\"{{$:/core/images/palette}}\"},\"$:/plugins/xyvir/lithic-patch-whiteboard/tldr-parser.js\":{\"title\":\"$:/plugins/xyvir/lithic-patch-whiteboard/tldr-parser.js\",\"type\":\"application/javascript\",\"module-type\":\"parser\",\"text\":\"/*\\\\\\ntitle: $:/plugins/xyvir/lithic-patch-whiteboard/tldr-parser.js\\ntype: application/javascript\\nmodule-type: parser\\n\\nParses application/tldr to automatically render the whiteboard widget\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nvar TldrParser = function(type, text, options) {\\n var tiddlerTitle = \\\"\\\";\\n try {\\n var data = JSON.parse(text);\\n var docName = data.document ? data.document.name : \\\"\\\";\\n if (docName && options.wiki && options.wiki.tiddlerExists(docName)) {\\n tiddlerTitle = docName;\\n }\\n } catch(e) {}\\n\\n // Fallback search if the tiddler was not found under docName\\n if (!tiddlerTitle && options.wiki) {\\n options.wiki.eachTiddlerPlusShadows(function(tiddler, title) {\\n if (tiddler && tiddler.fields.type === \\\"application/tldr\\\" && tiddler.fields.text === text) {\\n tiddlerTitle = title;\\n }\\n });\\n }\\n\\n var tiddler = options.wiki ? options.wiki.getTiddler(tiddlerTitle) : null;\\n var height = (tiddler && tiddler.fields[\\\"whiteboard-height\\\"]) || \\\"540px\\\";\\n var wikitext = '\u003C$wb-image board=\\\"' + tiddlerTitle + '\\\" height=\\\"' + height + '\\\" width=\\\"80%\\\"/>';\\n var parser = options.wiki ? options.wiki.parseText(\\\"text/vnd.tiddlywiki\\\", wikitext, {parseAsInline: false}) : null;\\n this.tree = parser ? parser.tree : [];\\n};\\n\\nexports[\\\"application/tldr\\\"] = TldrParser;\\n})();\\n\"},\"$:/Lithic/Macros/draw-sequential\":{\"title\":\"$:/Lithic/Macros/draw-sequential\",\"tags\":\"$:/tags/Global\",\"text\":\"\\\\procedure draw-sequential(source, height:\\\"540px\\\")\\n\u003C$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [\u003Csource>removeprefix\u003Cleft>removesuffix\u003Cright>] ~[\u003Csource>] }}}\\n>\\n\u003Cdiv class=\\\"sequential-whiteboard-container\\\">\\n\u003C$let pageCount={{{ [\u003Cclean>get[text]jsonindexes[document],[pages]count[]] }}}>\\n\u003C$list filter=\\\"[range[0],\u003CpageCount>!match\u003CpageCount>]\\\" variable=\\\"targetIndex\\\">\\n\u003Cdiv class=\\\"lithic-seq-step\\\" style=\\\"margin-bottom: 5px; padding: 0; border: none; page-break-inside: avoid; break-inside: avoid;\\\">\\n\u003C$let pageTiddler={{{ [\u003Cclean>whiteboard-page\u003CtargetIndex>] }}}>\\n\u003C$whiteboard tiddler=\u003C\u003CpageTiddler>> height=\u003C\u003Cheight>> readonly=\\\"yes\\\" />\\n\u003C/$let>\\n\u003C/div>\\n\u003C/$list>\\n\u003C/$let>\\n\u003C/div>\\n\u003C/$let>\\n\\\\end\"},\"$:/Lithic/Filters/PruneWhiteboard.js\":{\"title\":\"$:/Lithic/Filters/PruneWhiteboard.js\",\"type\":\"application/javascript\",\"module-type\":\"filteroperator\",\"text\":\"(function(){\\n\\\"use strict\\\";\\n\\nexports[\\\"whiteboard-page\\\"] = function(source,operator,options) {\\n var results = [];\\n source(function(tiddler,title) {\\n var index = parseInt(operator.operand) || 0;\\n var sourceTiddler = options.wiki.getTiddler(title);\\n if(!sourceTiddler || sourceTiddler.fields.type !== \\\"application/tldr\\\") {\\n results.push(title); return;\\n }\\n try {\\n var data = JSON.parse(sourceTiddler.fields.text);\\n var root = data.document || data;\\n var pages = root.pages;\\n if(!pages) { results.push(title); return; }\\n\\n // Sort existing page IDs by childIndex\\n var pageIds = Object.keys(pages).sort((a,b) => (pages[a].childIndex || 0) - (pages[b].childIndex || 0));\\n \\n // Boundary check\\n if(index \u003C 0 || index >= pageIds.length) { results.push(title); return; }\\n \\n var targetId = pageIds[index];\\n var originalPage = pages[targetId];\\n\\n // CRITICAL TRICK: Rename this page to \\\"page\\\" so the widget defaults to it\\n var newPages = { \\\"page\\\": JSON.parse(JSON.stringify(originalPage)) };\\n newPages[\\\"page\\\"].id = \\\"page\\\";\\n newPages[\\\"page\\\"].name = \\\"Isolated Page \\\" + (index + 1);\\n\\n // Clone the page state if it exists, also renaming it to \\\"page\\\"\\n var newPageStates = {};\\n if(root.pageStates && root.pageStates[targetId]) {\\n newPageStates[\\\"page\\\"] = JSON.parse(JSON.stringify(root.pageStates[targetId]));\\n newPageStates[\\\"page\\\"].id = \\\"page\\\";\\n }\\n\\n // Construct the single-page document\\n var snapshotData = JSON.parse(JSON.stringify(data));\\n var snapRoot = snapshotData.document || snapshotData;\\n snapRoot.pages = newPages;\\n snapRoot.pageStates = newPageStates;\\n\\n var targetTitle = \\\"$:/temp/lithic/split/\\\" + title + \\\"/p\\\" + index;\\n var jsonString = JSON.stringify(snapshotData);\\n\\n if(options.wiki.getTiddlerText(targetTitle) !== jsonString) {\\n options.wiki.addTiddler(new $tw.Tiddler({\\n title: targetTitle, text: jsonString, type: \\\"application/tldr\\\", \\\"hide-body\\\": \\\"yes\\\"\\n }));\\n }\\n results.push(targetTitle);\\n } catch(e) { results.push(title); }\\n });\\n return results;\\n};\\n})();\"}}}"}, {"title":"$:/plugins/xyvir/lithic-python-codeblocks","description":"Lithic Python Codeblocks","author":"Lithic","version":"0.0.1","core-version":">=5.0.0","source":"local","plugin-type":"plugin","plugin-priority":"2","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/config/EditorTypeMappings/text/x-python\":{\"title\":\"$:/config/EditorTypeMappings/text/x-python\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"uni\"},\"$:/config/HighlightPlugin/LanguageMappings\":{\"title\":\"$:/config/HighlightPlugin/LanguageMappings\",\"type\":\"application/json\",\"text\":\"{\\n \\\"text/x-python\\\": \\\"python\\\",\\n \\\"application/javascript\\\": \\\"javascript\\\",\\n \\\"text/css\\\": \\\"css\\\"\\n}\"},\"$:/config/HighlightPlugin/TypeMappings/text/x-python\":{\"title\":\"$:/config/HighlightPlugin/TypeMappings/text/x-python\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"python\"},\"$:/language/Docs/Types/text/x-python\":{\"title\":\"$:/language/Docs/Types/text/x-python\",\"description\":\"Python Source\",\"group\":\"Text\",\"name\":\"text/x-python\",\"tags\":\"$:/tags/FileType\",\"text\":\"Python Source\"},\"$:/lithic/cascade/python-highlight\":{\"title\":\"$:/lithic/cascade/python-highlight\",\"list-before\":\"\",\"tags\":\"$:/tags/ViewTemplateBodyFilter\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"[type[text/x-python]then[$:/core/ui/ViewTemplate/body/code]]\"}}}"}, {"title":"$:/plugins/xyvir/lithic-richlinks","description":"Displays external links as rich objects: YouTube, GitHub, Wikipedia, SoundCloud, jsFiddle, Disqus, tweets, PDFs, text files, images, audio, video, generic iframes. Nativized into a proper plugin from the RichLinks revisited demosite.","name":"Lithic Richlinks","plugin-type":"plugin","version":"0.0.1","author":"Xyvir","plugin-priority":"5","list":"readme","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/lithic/slashcommands/richlinks\":{\"title\":\"$:/lithic/slashcommands/richlinks\",\"caret-pos\":\"12\",\"text\":\"\u003C\u003Crichlink \\\"\\\">>\"},\"$:/plugins/richlink/d@disq.us\":{\"title\":\"$:/plugins/richlink/d@disq.us\",\"tags\":\"\",\"text\":\"\\\\define rl-disqus(id, height:\\\"300\\\")\\n\u003Ciframe src=\\\"https://embed.disqus.com/$id$\\\" width=\\\"100%\\\" height=\\\"$height$\\\" seamless=\\\"seamless\\\" scrolling=\\\"no\\\" frameborder=\\\"0\\\" allowtransparency=\\\"true\\\">\u003C/iframe>\\n\\\\end\\n\\n\u003C$set name=id filter=\\\"[\u003Clink>split:after[http://disq.us/]]\\\">\\n\u003C$macrocall $name=rl-disqus id=\u003C\u003Cid>> height=\u003C\u003C1>>/>\\n\u003C/$set>\"},\"$:/plugins/richlink/d@github\":{\"title\":\"$:/plugins/richlink/d@github\",\"tags\":\"\",\"text\":\"\\\\define btn(label, link) [[$label$|$link$]]\\n\\n\\\\define issue-button(link)\\n\u003C$list variable=label filter=\\\"[\u003Clink>split:after[TiddlyWiki5/]]\\\">\\n\u003Cdiv class=\\\"gh-issue\\\">\\n \u003C$macrocall $name=btn label=\u003C\u003Clabel>> link=\u003C\u003Clink>> />\\n {{$:/core/images/github}}\\n\u003C/div>\\n\u003C/$list>\\n\\\\end\\n\\n\u003C$macrocall $name=\\\"issue-button\\\" link=\\\"\u003C\u003Clink>>\\\" />\\n\"},\"$:/plugins/richlink/d@jsfiddle\":{\"title\":\"$:/plugins/richlink/d@jsfiddle\",\"tags\":\"\",\"text\":\"\\\\define jsfiddle(link, height:\\\"300\\\")\\n\u003Ciframe width=\\\"100%\\\" height=\\\"$height$\\\" src=\\\"$link$embedded/result,html,css,js/\\\" allowfullscreen=\\\"allowfullscreen\\\" frameborder=\\\"0\\\">\u003C/iframe>\\n\\\\end\\n\\n\u003C$macrocall $name=jsfiddle link=\u003C\u003Clink>> height=\u003C\u003C1>>/>\"},\"$:/plugins/richlink/d@soundcloud\":{\"title\":\"$:/plugins/richlink/d@soundcloud\",\"tags\":\"$:/tags/Macro\",\"text\":\"\\\\define soundcloud(link)\\n\u003Ciframe width=\\\"100%\\\" height=\\\"166\\\" scrolling=\\\"no\\\" frameborder=\\\"no\\\" src=\\\"https://w.soundcloud.com/player/?url=$link$&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false\\\">\u003C/iframe>\\n\\\\end\\n\\n\u003C$macrocall $name=soundcloud link=\u003C\u003Clink>>/>\"},\"$:/plugins/richlink/d@twitter\":{\"title\":\"$:/plugins/richlink/d@twitter\",\"tags\":\"$:/template/richlink\",\"text\":\"\u003C$list filter=\\\"[all[shadows]title[$:/plugins/tiddlywiki/twitter]]\\\">\\n\u003C$set name=\\\"xx\\\" filter=\\\"[\u003Clink>split:last[/]]\\\">\\n\u003C$twitter type=\\\"tweet\\\" tweetID=\u003C\u003Cxx>>/>\\n\u003C/$set>\\n\u003C/$list>\\n\u003C$list filter=\\\"[all[shadows]!title[$:/plugins/tiddlywiki/twitter]]\\\">\\n\u003Ca href=\u003C\u003Clink>> target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\" class=\\\"tc-tiddlylink-external\\\">View tweet\u003C/a>\\n\u003C/$list>\"},\"$:/plugins/richlink/d@wikipedia\":{\"title\":\"$:/plugins/richlink/d@wikipedia\",\"tags\":\"$:/templates/richlink\",\"text\":\"\u003Ca\\n class=\\\"rl-wikipedia\\\"\\n href={{{ [\u003Clink>] }}}\\n target=\\\"_blank\\\"\\n rel=\\\"noopener noreferrer\\\">\\n\\n \u003Cspan class=\\\"rl-wikipedia-icon\\\" aria-hidden=\\\"true\\\">\\n {{$:/core/images/globe}}\\n \u003C/span>\\n\\n \u003Cspan class=\\\"rl-wikipedia-title\\\">\\n \u003C$text text={{{ [\u003Clink>split[/wiki/]last[]split[?]first[]split[#]first[]decodeuricomponent[]search-replace:g[_],[ ]] }}}/>\\n \u003C/span>\\n\\n\u003C/a>\\n\"},\"$:/plugins/richlink/d@youtube\":{\"title\":\"$:/plugins/richlink/d@youtube\",\"tags\":\"\",\"text\":\"\\\\define rich-youtube(link)\\n\u003Ciframe class=rich-iframe src=\\\"$link$\\\" frameborder=\\\"0\\\" width=100% allowfullscreen/>\\n\\\\end\\n\\n\u003C$set name=link\\n filter=\\\"[\u003Clink>split[v=]last[]addprefix[https://www.youtube.com/embed/]] \\\" \\n emptyValue=\u003C\u003Clink>> >\\n\u003C$macrocall $name=rich-youtube link=\u003C\u003Clink>> />\\n\u003C/$set>\\n\"},\"$:/plugins/richlink/docs@tiddlywiki\":{\"title\":\"$:/plugins/richlink/docs@tiddlywiki\",\"tags\":\"\",\"text\":\"\\\\define btn(label, link) [[$label$|$link$]]\\n\\n\u003C$set name=label filter=\\\"[\u003Clink>split:after[#]search[%20]split[%20]] [\u003Clink>split:after[#]!search[%20]] \\\">\\n\u003Cdiv class=\\\"twd\\\">\\n\u003C$macrocall $name=btn label=\u003C\u003Clabel>> link=\u003C\u003Clink>>/> \\n\u003C/div>\\n\u003C/$set>\\n\"},\"$:/plugins/richlink/f@txt\":{\"title\":\"$:/plugins/richlink/f@txt\",\"tags\":\"\",\"text\":\"\\\\define rl-txt(link)\\n\u003C$let h={{{ [\u003C1>!is[blank]else[300px]] }}}>\\n\u003Cdiv class=\\\"rl-txt\\\">\\n \u003C$txtviewer\\n src=\u003C\u003Clink>>\\n height=\u003C\u003Ch>>\\n />\\n \u003Cdiv class=\\\"rl-txt-fallback\\\">\\n \u003Ca href=\\\"$link$\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">$link$\u003C/a>\\n \u003C/div>\\n\u003C/div>\\n\u003C/$let>\\n\\\\end\\n\\n\u003C$macrocall $name=rl-txt link=\u003C\u003Clink>> />\\n\"},\"$:/plugins/richlink/faudio@mp3@ogg@wav@flac\":{\"title\":\"$:/plugins/richlink/faudio@mp3@ogg@wav@flac\",\"tags\":\"\",\"text\":\"\u003Caudio src=\u003C\u003Clink>> controls preload=\\\"auto\\\" class=\\\"richlink-audio\\\"/>\\n\"},\"$:/plugins/richlink/fimg@jpg@jpeg@png@gif@webp@svg\":{\"title\":\"$:/plugins/richlink/fimg@jpg@jpeg@png@gif@webp@svg\",\"tags\":\"\",\"text\":\"\u003C$let\\n filename={{{ [\u003Clink>split[/]last[]split[?]first[]split[#]first[]decodeuricomponent[]] }}}\\n caption={{{ [\u003C1>!is[blank]else\u003Cfilename>] }}}>\\n\\n\u003Cdiv class=\\\"richlink-img\\\">\\n \u003Ca href=\u003C\u003Clink>> target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\\n \u003C$image source=\u003C\u003Clink>>/>\\n \u003C/a>\\n \u003Cspan class=\\\"richlink-img-caption\\\">\u003C$text text=\u003C\u003Ccaption>>/>\u003C/span>\\n\u003C/div>\\n\\n\u003C/$let>\\n\"},\"$:/plugins/richlink/fvideo@mp4@avi@webm@ogv\":{\"title\":\"$:/plugins/richlink/fvideo@mp4@avi@webm@ogv\",\"tags\":\"\",\"text\":\"\u003Cvideo src=\u003C\u003Clink>> controls preload=\\\"auto\\\" class=\\\"richlink-video\\\">\\n\u003Cp>Your browser doesn't support HTML5 video.\u003Cbr>Instead, go directly to \u003C\u003Clink>>\u003C/p> \\n\u003C/video>\\n\"},\"$:/plugins/richlink/iframe\":{\"title\":\"$:/plugins/richlink/iframe\",\"tags\":\"\",\"text\":\"\u003C$let\\n resolved-url={{{ [\u003Ciframe-url>!is[blank]] ~[\u003Clink>] }}}\\n resolved-description={{{ [\u003Ciframe-description>!is[blank]] ~[all[current]get[caption]!is[blank]] ~[all[current]get[title]] ~[\u003Cresolved-url>split[/]last[]split[?]first[]decodeuricomponent[]] }}}\\n resolved-site={{{ [\u003Ciframe-site>!is[blank]] ~[\u003Cresolved-url>split[://]last[]split[/]first[]search-replace:g[www.],[]] }}}\\n resolved-height={{{ [\u003Ciframe-height>!is[blank]] ~[\u003C1>!is[blank]] ~[[900px]] }}}>\\n\\n\u003C$list filter=\\\"[\u003Cresolved-url>!is[blank]]\\\">\\n\\n\u003Cdiv class=\\\"rl-iframe-card\\\">\\n \u003Cdiv class=\\\"rl-iframe-credit\\\">\\n \u003Ca class=\\\"rl-iframe-title\\\" href=\u003C\u003Cresolved-url>> target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\\n \u003C$text text=\u003C\u003Cresolved-description>>/>\\n \u003C/a>\\n\\n \u003Cspan class=\\\"rl-iframe-by\\\"> by \u003C/span>\\n\\n \u003Ca class=\\\"rl-iframe-site\\\" href=\u003C\u003Cresolved-url>> target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\\n \u003C$text text=\u003C\u003Cresolved-site>>/>\\n \u003C/a>\\n \u003C/div>\\n\\n \u003Cdiv class=\\\"rl-iframe-wrap\\\" style=`height: $(resolved-height)$;`>\\n \u003Ciframe\\n class=\\\"rl-iframe\\\"\\n src=\u003C\u003Cresolved-url>>\\n title=\u003C\u003Cresolved-description>>\\n loading=\\\"lazy\\\"\\n frameborder=\\\"0\\\"\\n allowfullscreen\\n referrerpolicy=\\\"no-referrer-when-downgrade\\\">\\n \u003C/iframe>\\n \u003C/div>\\n\u003C/div>\\n\\n\u003C/$list>\\n\\n\u003C$list filter=\\\"[\u003Cresolved-url>is[blank]]\\\">\\n \u003Cdiv class=\\\"rl-iframe-card rl-iframe-empty\\\">\\n \u003Cstrong>RichLinks iframe template\u003C/strong>\u003Cbr>\\n No iframe URL was supplied.\u003Cbr>\\n Use:\u003Cbr>\\n \u003Ccode><<richlink iframe \\\"url\\\" \\\"description\\\" \\\"site\\\" \\\"height\\\">>\u003C/code>\\n \u003C/div>\\n\u003C/$list>\\n\\n\u003C/$let>\\n\"},\"$:/plugins/richlink/macro\":{\"title\":\"$:/plugins/richlink/macro\",\"tags\":\"$:/tags/Macro\",\"text\":\"\\\\define abevregexp() ^(?:(?:[a-z]{2,3}|m)\\\\.)?([a-zA-Z0-9_]{5}).*\\n\\n\\\\define domainLinks()\\n\u003C$list filter=\\\"\\\"\\\"[\u003Clink>split[://]last[]search-replace::regexp[www.],[]search-replace::regexp\u003Cabevregexp>,[@$1]] +[limit[1]]\\\"\\\"\\\" >\\n \u003C$list filter=\\\"[all[shadows+tiddlers]prefix[$:/plugins/richlink/d]search:title:{!!title}]\\\">\\n \u003C$tiddler tiddler={{!!title}}>\\n \u003C$transclude/>\\n \u003C/$tiddler>\\n \u003C$list-empty>\\n \u003C$tiddler tiddler=\\\"$:/plugins/richlink/iframe\\\">\\n \u003C$transclude/>\\n \u003C/$tiddler>\\n \u003C/$list-empty>\\n \u003C/$list>\\n\u003C/$list>\\n\\\\end\\n\\n\\\\define applytemplate(signum)\\n\u003C$list filter=\\\"[all[shadows+tiddlers]prefix[$:/plugins/richlink/f]search:title:[$signum$]]\\\" emptyMessage=\u003C\u003CdomainLinks>>>\\n \u003C$tiddler tiddler={{!!title}}>\\n \u003C$transclude/>\\n \u003C/$tiddler>\\n\u003C/$list>\\n\\\\end\\n\\n\\\\define richlink(link, 1, 2, 3, 4)\\n\\n\u003C$vars command=\\\"$link$\\\">\\n\\n\u003C!-- FORCED IFRAME MODE -->\\n\u003C$list filter=\\\"[\u003Ccommand>match[iframe]]\\\">\\n \u003C$vars\\n iframe-url=\\\"$1$\\\"\\n iframe-description=\\\"$2$\\\"\\n iframe-site=\\\"$3$\\\"\\n iframe-height=\\\"$4$\\\">\\n \u003C$tiddler tiddler=\\\"$:/plugins/richlink/iframe\\\">\\n \u003C$transclude/>\\n \u003C/$tiddler>\\n \u003C/$vars>\\n\u003C/$list>\\n\\n\u003C!-- NORMAL MODE -->\\n\u003C$list filter=\\\"[\u003Ccommand>!match[iframe]]\\\">\\n \u003C$vars link=\\\"$link$\\\" 1=\\\"$1$\\\" 2=\\\"$2$\\\" 3=\\\"$3$\\\" 4=\\\"$4$\\\">\\n \u003C$list filter=\\\"\\\"\\\"[\u003Clink>split[.]last[]addprefix[@]] [\u003Clink>split[://]last[]search-replace::regexp[www.],[]search-replace::regexp\u003Cabevregexp>,[@$1]] +[limit[1]]\\\"\\\"\\\" >\\n \u003C$macrocall $name=applytemplate signum={{!!title}} />\\n \u003C/$list>\\n \u003C/$vars>\\n\u003C/$list>\\n\\n\u003C/$vars>\\n\\\\end\\n\\n\u003C$list filter=\\\"[all[current]has[richlink]get[richlink]]\\\" variable=\\\"link\\\">\\n{{$:/core/images/import-button}}\u003C$macrocall $name=richlink link=\u003C\u003Clink>>/>\\n\u003C/$list>\"},\"$:/plugins/richlink/richlink-styles\":{\"title\":\"$:/plugins/richlink/richlink-styles\",\"tags\":\"$:/tags/Stylesheet\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"/* Palette-reactive styling for the richlink plugin.\\n All colours come from the active TiddlyWiki palette via \u003C\u003Ccolour ...>>. */\\n\\n/* ---- Generic richlink card shell ---- */\\n\\n.rl-iframe-card,\\n.rl-txt {\\n display: block;\\n max-width: 48em;\\n margin: 0.35em 0;\\n padding: 0.45em 0.55em;\\n border: 1px solid \u003C\u003Ccolour tiddler-border>>;\\n border-radius: 0.45em;\\n background: \u003C\u003Ccolour background>>;\\n color: \u003C\u003Ccolour foreground>>;\\n}\\n\\n.rl-iframe-credit {\\n display: flex;\\n align-items: baseline;\\n gap: 0.35em;\\n line-height: 1.3;\\n margin-bottom: 0.45em;\\n}\\n\\n.rl-txt-fallback a {\\n color: \u003C\u003Ccolour primary>>;\\n text-decoration: none;\\n word-break: break-word;\\n}\\n\\n.rl-txt-fallback a:hover {\\n text-decoration: underline;\\n}\\n\\n/* ---- GitHub issue button ---- */\\n\\n.gh-issue {\\n display: inline;\\n border: 1px solid \u003C\u003Ccolour tiddler-border>>;\\n padding: 0px 0px 1px 5px;\\n border-radius: 3px;\\n margin-right: 5px;\\n background: \u003C\u003Ccolour background>>;\\n}\\n\\n.gh-issue a.tc-tiddlylink-external {\\n color: \u003C\u003Ccolour foreground>>;\\n text-decoration: none;\\n font-size: 80%;\\n}\\n\\n.gh-issue:hover a.tc-tiddlylink-external {\\n color: \u003C\u003Ccolour primary>>;\\n text-decoration: underline;\\n}\\n\\n.gh-issue svg {\\n width: .9em;\\n vertical-align: -.65em;\\n fill: currentColor;\\n}\\n\\n/* ---- Wikipedia link ---- */\\n\\n.rl-wikipedia {\\n display: inline-flex;\\n align-items: baseline;\\n gap: 0.28em;\\n color: \u003C\u003Ccolour primary>>;\\n text-decoration: none;\\n white-space: nowrap;\\n line-height: 1.2;\\n}\\n\\n.rl-wikipedia:hover .rl-wikipedia-title {\\n text-decoration: underline;\\n}\\n\\n.rl-wikipedia-icon {\\n display: inline-flex;\\n align-items: center;\\n justify-content: center;\\n width: 1em;\\n height: 1em;\\n color: \u003C\u003Ccolour muted-foreground>>;\\n transform: translateY(0.12em);\\n flex: 0 0 auto;\\n}\\n\\n.rl-wikipedia-icon svg {\\n width: 1em;\\n height: 1em;\\n fill: currentColor;\\n vertical-align: middle;\\n}\\n\\n.rl-wikipedia-title {\\n color: \u003C\u003Ccolour primary>>;\\n}\\n\\n/* ---- TiddlyWiki docs button ---- */\\n\\n.twd {\\n display: inline;\\n margin-right: 5px;\\n border: 1px solid \u003C\u003Ccolour tiddler-border>>;\\n border-radius: 3px;\\n padding: 1px 0px 1px 5px;\\n background: \u003C\u003Ccolour background>>;\\n font-size: 80%;\\n}\\n\\n.twd a.tc-tiddlylink-external {\\n color: \u003C\u003Ccolour foreground>>;\\n text-decoration: none;\\n}\\n\\n.twd a.tc-tiddlylink-external:hover {\\n color: \u003C\u003Ccolour primary>>;\\n text-decoration: underline;\\n}\\n\\n.twd svg {\\n width: 1em;\\n vertical-align: bottom;\\n fill: currentColor;\\n}\\n\\n/* ---- Embedded media (YouTube / audio / video) ---- */\\n\\n.rich-iframe {\\n width: 100%;\\n aspect-ratio: 16 / 9;\\n height: auto;\\n border: 0;\\n}\\n\\n.richlink-audio,\\n.richlink-video {\\n width: 100%;\\n display: block;\\n}\\n\\n/* ---- Text card ---- */\\n\\n.rl-txt-frame-wrap {\\n border: 1px solid \u003C\u003Ccolour tiddler-border>>;\\n border-radius: 0.4em;\\n overflow: hidden;\\n background: \u003C\u003Ccolour page-background>>;\\n color: \u003C\u003Ccolour foreground>> !important;\\n}\\n\\n.rl-txt-body {\\n margin: 0;\\n padding: 0.6em 0.8em;\\n max-height: 100%;\\n overflow: auto;\\n white-space: pre-wrap;\\n word-break: break-word;\\n font-family: inherit;\\n font-size: 0.9em;\\n line-height: 1.45;\\n color: \u003C\u003Ccolour foreground>> !important;\\n background: \u003C\u003Ccolour background>> !important;\\n}\\n\\n.rl-txt-fallback {\\n margin-top: 0.35em;\\n font-size: 0.8em;\\n color: \u003C\u003Ccolour muted-foreground>>;\\n word-break: break-all;\\n}\\n\\n/* ---- Image card ---- */\\n\\n.richlink-img {\\n display: inline-block;\\n background: \u003C\u003Ccolour background>>;\\n margin: 0 0 27px 30px;\\n padding: 10px 10px 15px;\\n text-align: center;\\n text-decoration: none;\\n color: \u003C\u003Ccolour foreground>>;\\n font-size: 18px;\\n box-shadow: 0 3px 6px rgba(0,0,0,.55);\\n}\\n\\n.richlink-img a {\\n display: block;\\n text-decoration: none;\\n}\\n\\n.richlink-img img {\\n display: block;\\n max-width: 100%;\\n height: auto;\\n}\\n\\n.richlink-img-caption {\\n display: block;\\n text-align: center;\\n color: \u003C\u003Ccolour muted-foreground>>;\\n font-size: 0.8em;\\n}\\n\\n/* ---- Generic iframe card ---- */\\n\\n.rl-iframe-credit,\\n.rl-iframe-title,\\n.rl-iframe-site,\\n.rl-iframe-by {\\n color: \u003C\u003Ccolour muted-foreground>>;\\n font-size: 13px;\\n}\\n\\n.rl-iframe-title,\\n.rl-iframe-site {\\n text-decoration: none;\\n}\\n\\n.rl-iframe-title:hover,\\n.rl-iframe-site:hover {\\n text-decoration: underline;\\n}\\n\\n.rl-iframe-wrap {\\n border: 1px solid \u003C\u003Ccolour tiddler-border>>;\\n border-radius: 0.4em;\\n overflow: hidden;\\n background: \u003C\u003Ccolour page-background>>;\\n}\\n\\n.rl-iframe {\\n display: block;\\n width: 100%;\\n height: 100%;\\n border: 0;\\n background: transparent;\\n}\\n\\n.rl-iframe-empty {\\n color: \u003C\u003Ccolour muted-foreground>>;\\n font-size: 0.9em;\\n}\\n\"},\"$:/plugins/richlink/txtviewer-widget.js\":{\"title\":\"$:/plugins/richlink/txtviewer-widget.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/plugins/richlink/txtviewer-widget.js\\ntype: application/javascript\\nmodule-type: widget\\n\\\\*/\\n\\n(function(){\\n\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\n/*\\nResolve a palette colour the same way \u003C\u003Ccolour>> does:\\n$:/palette (dictionary tiddler) -> $:/palettes/Vanilla -> $:/config/DefaultColourMappings/\u003Cname>.\\nValues that reference other colours (\u003C\u003Ccolour x>>) are resolved recursively.\\nNever throws: returns \\\"\\\" on any failure so callers simply skip the inline style.\\n*/\\nfunction paletteColour(name) {\\n try {\\n var wiki = $tw.wiki,\\n visited = {},\\n resolve = function(value) {\\n if(typeof value !== \\\"string\\\") {\\n return \\\"\\\";\\n }\\n var m = value.match(/^\u003C\u003Ccolour\\\\s+([^>]+)>>\\\\s*$/);\\n if(m && !visited[m[1]]) {\\n visited[m[1]] = true;\\n return paletteColour(m[1]);\\n }\\n return value;\\n },\\n lookup = function(title) {\\n var t = wiki.getTiddler(title);\\n if(!t || typeof t.fields.text !== \\\"string\\\") {\\n return undefined;\\n }\\n var re = new RegExp(\\\"^\\\" + name.replace(/[.*+?^${}()|[\\\\]\\\\\\\\]/g, \\\"\\\\\\\\$&\\\") + \\\"\\\\\\\\s*:\\\\\\\\s*(.*)$\\\", \\\"m\\\");\\n var m = t.fields.text.match(re);\\n return m ? m[1].trim() : undefined;\\n };\\n var val = lookup(wiki.getTiddlerText(\\\"$:/palette\\\"));\\n if(val === undefined) {\\n val = lookup(\\\"$:/palettes/Vanilla\\\");\\n }\\n if(val === undefined) {\\n val = wiki.getTiddlerText(\\\"$:/config/DefaultColourMappings/\\\" + name);\\n }\\n return resolve(val || \\\"\\\");\\n } catch(e) {\\n return \\\"\\\";\\n }\\n}\\n\\nvar TxtViewerWidget = function(parseTreeNode,options) {\\n this.initialise(parseTreeNode,options);\\n};\\n\\nTxtViewerWidget.prototype = new Widget();\\n\\nTxtViewerWidget.prototype.render = function(parent,nextSibling) {\\n this.parentDomNode = parent;\\n this.computeAttributes();\\n this.execute();\\n\\n var foreground = paletteColour(\\\"foreground\\\"),\\n background = paletteColour(\\\"background\\\"),\\n pageBackground = paletteColour(\\\"page-background\\\"),\\n border = paletteColour(\\\"tiddler-border\\\");\\n\\n var container = this.document.createElement(\\\"div\\\");\\n container.className = \\\"rl-txt-frame-wrap\\\";\\n container.style.height = this.height || \\\"300px\\\";\\n container.style.overflow = \\\"hidden\\\";\\n container.style.border = \\\"1px solid \\\" + border;\\n container.style.borderRadius = \\\"0.4em\\\";\\n container.style.background = pageBackground;\\n parent.insertBefore(container,nextSibling);\\n this.domNodes.push(container);\\n\\n var self = this;\\n\\n // Iframes are not subject to CORS, so this always displays the document —\\n // used when the cross-origin fetch is blocked by the host.\\n function renderIframeFallback() {\\n container.innerHTML = \\\"\\\";\\n var frame = self.document.createElement(\\\"iframe\\\");\\n frame.src = self.src;\\n frame.style.display = \\\"block\\\";\\n frame.style.width = \\\"100%\\\";\\n frame.style.height = \\\"100%\\\";\\n frame.style.border = \\\"0\\\";\\n // The embedded document is cross-origin, so we can't style its contents —\\n // it renders with browser defaults. Force a solid light background and\\n // light color-scheme so the default black text stays readable over the\\n // dark card.\\n frame.style.background = \\\"#ffffff\\\";\\n frame.style.colorScheme = \\\"light\\\";\\n frame.setAttribute(\\\"loading\\\",\\\"lazy\\\");\\n container.appendChild(frame);\\n }\\n\\n if(!self.src) {\\n container.textContent = \\\"No text source supplied\\\";\\n return;\\n }\\n\\n container.textContent = \\\"Loading text…\\\";\\n\\n fetch(self.src,{mode:\\\"cors\\\",credentials:\\\"omit\\\"}).then(function(response) {\\n if(!response.ok) {\\n throw new Error(\\\"HTTP \\\" + response.status);\\n }\\n return response.text();\\n }).then(function(text) {\\n // Success — render the text inline, styled by the active palette.\\n // Colours are applied inline so nothing in the host app can override them.\\n container.innerHTML = \\\"\\\";\\n var pre = self.document.createElement(\\\"pre\\\");\\n pre.className = \\\"rl-txt-body\\\";\\n pre.style.margin = \\\"0\\\";\\n pre.style.padding = \\\"0.6em 0.8em\\\";\\n pre.style.maxHeight = \\\"100%\\\";\\n pre.style.overflow = \\\"auto\\\";\\n pre.style.whiteSpace = \\\"pre-wrap\\\";\\n pre.style.wordBreak = \\\"break-word\\\";\\n pre.style.fontFamily = \\\"inherit\\\";\\n pre.style.fontSize = \\\"0.9em\\\";\\n pre.style.lineHeight = \\\"1.45\\\";\\n if(foreground) {\\n pre.style.color = foreground;\\n }\\n if(background) {\\n pre.style.background = background;\\n }\\n pre.textContent = text;\\n container.appendChild(pre);\\n }).catch(function() {\\n renderIframeFallback();\\n });\\n};\\n\\nTxtViewerWidget.prototype.execute = function() {\\n this.src = this.getAttribute(\\\"src\\\",\\\"\\\");\\n this.height = this.getAttribute(\\\"height\\\",\\\"300px\\\");\\n this.makeChildWidgets();\\n};\\n\\nTxtViewerWidget.prototype.refresh = function(changedTiddlers) {\\n var changedAttributes = this.computeAttributes();\\n if(changedAttributes.src || changedAttributes.height) {\\n this.refreshSelf();\\n return true;\\n }\\n return this.refreshChildren(changedTiddlers);\\n};\\n\\nexports.txtviewer = TxtViewerWidget;\\n\\n})();\\n\"},\"$:/plugins/xyvir/lithic-richlinks/readme\":{\"title\":\"$:/plugins/xyvir/lithic-richlinks/readme\",\"tags\":\"\",\"text\":\"!Lithic Richlinks\\n\\nDisplays external links as rich objects. Type:\\n\\n```\\n\u003C\u003Crichlink \\\"https://www.youtube.com/watch?v=VIDEO_ID\\\">>\\n```\\n\\nand the link is replaced by an embedded player, viewer or styled link depending on what it points to. One command, many shapes — the URL itself picks the template:\\n\\n* Domain templates (e.g. `d@youtube`, `d@github`, `d@wikipedia`, `d@soundcloud`, `d@jsfiddle`, `d@disq.us`, `d@twitter`, `docs@tiddlywiki`)\\n* File templates (e.g. `f@txt`, `fimg@jpg@jpeg@png@gif@webp@svg`, `faudio@mp3@ogg@wav@flac`, `fvideo@mp4@avi@webm@ogv`)\\n* Generic [[$:/plugins/richlink/iframe]] template as a fallback\\n\\n!Extra parameters\\n\\nSome templates accept extra parameters after the URL, e.g. an image caption or an iframe height:\\n\\n```\\n\u003C\u003Crichlink \\\"https://example.com/photo.jpg\\\" \\\"my caption\\\">>\\n\u003C\u003Crichlink iframe \\\"https://example.com/page\\\" \\\"description\\\" \\\"site\\\" \\\"600px\\\">>\\n```\\n\\nWithin a template the URL is available as `\u003C\u003Clink>>` and the extra parameters as `\u003C\u003C1>>`, `\u003C\u003C2>>`, `\u003C\u003C3>>` and `\u003C\u003C4>>`.\\n\\n!In the editor\\n\\nType `/richlinks` in the editor to insert `\u003C\u003Crichlink \\\"\\\">>` with the caret placed inside the quotes — just paste a URL.\\n\\n!Test links\\n\\nVerified embed-friendly URLs for each template:\\n\\n```\\n\u003C\u003Crichlink \\\"https://www.youtube.com/watch?v=dQw4w9WgXcQ\\\">> \u003C!-- d@youtube -->\\n\u003C\u003Crichlink \\\"https://github.com/Jermolene/TiddlyWiki5\\\">> \u003C!-- d@github -->\\n\u003C\u003Crichlink \\\"https://en.wikipedia.org/wiki/TiddlyWiki\\\">> \u003C!-- d@wikipedia -->\\n\u003C\u003Crichlink \\\"https://example.com/\\\">> \u003C!-- iframe fallback -->\\n\u003C\u003Crichlink iframe \\\"https://www.openstreetmap.org/export/embed.html?bbox=-0.004,51.476,0.006,51.482&layer=mapnik\\\" \\\"OpenStreetMap\\\" \\\"openstreetmap.org\\\" \\\"450px\\\">> \u003C!-- forced iframe -->\\n```\\n\\nIframe-embeddable targets (no `X-Frame-Options` / CSP `frame-ancestors` block): `example.com`, the OpenStreetMap / YouTube / Vimeo / Bing Maps embed endpoints, and Wikipedia pages.\\n\\n!Notes\\n\\n* The tweet template renders tweets via the official Twitter plugin when installed, and falls back to a plain link otherwise.\\n* Text files are fetched and rendered inline with palette colours when the host allows CORS (e.g. `raw.githubusercontent.com`); otherwise they fall back to an unstyled iframe.\\n* SoundCloud only embeds track/set URLs (e.g. `https://soundcloud.com/zedd/clarity-1`), not the homepage.\\n* Based on the [[RichLinks revisited demosite|https://richlinkrevistedii.tiddlyhost.com/]] by Mat von TWaddle and JanJo.\\n\"}}}"}, {"title":"$:/plugins/xyvir/lithic-save","description":"Publishing override for $:/core/save/all: excludes build-time tooling (the uglify plugin and related tiddlers) from saved/published wiki files, mirroring the uglify wizard's purge option.","name":"Lithic Save","plugin-type":"plugin","version":"0.0.1","core-version":">=5.3.0","plugin-priority":"1","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/core/save/all\":{\"title\":\"$:/core/save/all\",\"text\":\"\\\\define saveTiddlerFilter()\\n[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] $(publishFilter)$ -[[$:/plugins/flibbles/uglify]] -[[$:/plugins/flibbles/uglify-wizard]] -[[$:/layout]]\\n\\\\end\\n{{$:/core/templates/tiddlywiki5.html}}\"}}}"}, diff --git a/library/recipes/library/tiddlers/%24%3A%2Fplugins%2Fxyvir%2Flithic-patch-whiteboard.json b/library/recipes/library/tiddlers/%24%3A%2Fplugins%2Fxyvir%2Flithic-patch-whiteboard.json index 84ac359e..69f0f236 100644 --- a/library/recipes/library/tiddlers/%24%3A%2Fplugins%2Fxyvir%2Flithic-patch-whiteboard.json +++ b/library/recipes/library/tiddlers/%24%3A%2Fplugins%2Fxyvir%2Flithic-patch-whiteboard.json @@ -1 +1 @@ -{"created":"20260110200549392","title":"$:/plugins/xyvir/lithic-patch-whiteboard","author":"Xyvir","description":"Integration logic and UI enhancements for whiteboard and freehand drawing tools within the Story River.","plugin-type":"plugin","version":"0.0.1","modified":"20260110230834139","parent-plugin":"$:/plugins/linonetwo/tw-whiteboard","plugin-priority":"2","dependents":"","type":"application/json","text":"{\"tiddlers\":{\"$:/DefaultCanvas\":{\"title\":\"$:/DefaultCanvas\",\"type\":\"application/tldr\",\"text\":\"{\\\"document\\\":{\\\"id\\\":\\\"doc\\\",\\\"name\\\":\\\"$:/DefaultCanvas\\\",\\\"version\\\":15.5,\\\"pages\\\":{\\\"page\\\":{\\\"id\\\":\\\"page\\\",\\\"name\\\":\\\"Page 1\\\",\\\"childIndex\\\":1,\\\"shapes\\\":{},\\\"bindings\\\":{}}},\\\"pageStates\\\":{\\\"page\\\":{\\\"id\\\":\\\"page\\\",\\\"selectedIds\\\":[],\\\"camera\\\":{\\\"point\\\":[0,0],\\\"zoom\\\":1}}},\\\"assets\\\":{}},\\\"updatedCount\\\":70}\"},\"$:/Lithic/Macros/draw\":{\"title\":\"$:/Lithic/Macros/draw\",\"tags\":\"$:/tags/Global\",\"text\":\"\\\\procedure draw(id, height:\\\"540px\\\")\\n<$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [removeprefixremovesuffix] ~[] }}}\\n>\\n<$vars boardTitle={{{ [!is[blank]] ~[addsuffix[-draw]] }}}>\\n
> \\n style=\\\"border:none; box-shadow:none; background:none; padding:0; margin:0; position:relative;\\\"\\n>\\n
\\n <$reveal state=\\\"$:/state/Lithic/BootComplete\\\" type=\\\"match\\\" text=\\\"yes\\\" default=\\\"no\\\">\\n <$whiteboard tiddler=<> height=<> />\\n \\n
\\n
\\n\\n\\n\\\\end\"},\"$:/Lithic/Macros/wb-image\":{\"title\":\"$:/Lithic/Macros/wb-image\",\"tags\":\"$:/tags/Macro\",\"text\":\"\\\\define wb-image(board, width:\\\"80%\\\")\\n<$let\\n left=\\\"[[\\\"\\n right=\\\"]]\\\"\\n clean={{{ [<__board__>removeprefixremovesuffix] ~[<__board__>] }}}\\n>\\n<$wb-image board=<> width=<<__width__>> />\\n\\n\\\\end\\n\"},\"$:/Lithic/Patches/AutoCloseKeepOpen.js\":{\"title\":\"$:/Lithic/Patches/AutoCloseKeepOpen.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/AutoCloseKeepOpen.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nWatches for the Text tool's specific style options (Align/Font) and automatically \\nturns off \\\"Keep Style Menu Open\\\" to prevent the shape.id crash bug.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-auto-close-keep-open\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n \\n function disableKeepOpen() {\\n var clicked = false;\\n \\n // 1. Check Preferences Menu Button by ID\\n var keepOpenBtn = document.getElementById('TD-Styles-Keep-Open');\\n if (keepOpenBtn && (keepOpenBtn.getAttribute('data-state') === 'checked' || keepOpenBtn.getAttribute('aria-checked') === 'true')) {\\n keepOpenBtn.click();\\n clicked = true;\\n }\\n \\n // 2. Check Palette Menu option by text\\n var spans = document.querySelectorAll('.tw-whiteboard-tldraw-container span');\\n for (var i = 0; i < spans.length; i++) {\\n if (spans[i].textContent === \\\"Keep Style Menu Open\\\" || spans[i].textContent === \\\"Keep Open\\\") {\\n var wrapper = spans[i].closest('button, .c-kuOiws');\\n if (wrapper && wrapper.id !== 'TD-Styles-Keep-Open') {\\n // Look for the checked state\\n if (wrapper.querySelector('[data-state=\\\"checked\\\"]') || wrapper.getAttribute('data-state') === 'checked') {\\n wrapper.click();\\n clicked = true;\\n }\\n }\\n }\\n }\\n \\n if (clicked) {\\n setTimeout(function() {\\n var escEvent = new KeyboardEvent('keydown', {\\n key: 'Escape',\\n code: 'Escape',\\n keyCode: 27,\\n which: 27,\\n bubbles: true,\\n cancelable: true\\n });\\n document.dispatchEvent(escEvent);\\n }, 10);\\n }\\n }\\n\\n if (typeof document !== \\\"undefined\\\") {\\n var observer = new MutationObserver(function(mutations) {\\n // If the specific Text tool UI is present in the DOM\\n if (document.getElementById('TD-Styles-Align-Container')) {\\n disableKeepOpen();\\n }\\n });\\n \\n // Observe the document body for any DOM additions/removals\\n observer.observe(document.body, { childList: true, subtree: true });\\n }\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/BootDelay/StartupScript.js\":{\"title\":\"$:/Lithic/Patches/BootDelay/StartupScript.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/BootDelay/StartupScript.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nSets a state flag after the TiddlyWiki boot sequence is completely finished.\\nThis flag is used to delay the rendering of React widgets (like the whiteboard)\\nto prevent them from interfering with TiddlyWiki's initial core DOM setup.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nexports.name = \\\"lithic-boot-delay-flag\\\";\\nexports.platforms = [\\\"browser\\\"];\\nexports.after = [\\\"startup\\\"];\\nexports.synchronous = true;\\n\\nexports.startup = function() {\\n // Wait a brief moment after the synchronous startup completes\\n // to ensure the DOM is fully settled.\\n setTimeout(function() {\\n $tw.wiki.setText(\\\"$:/state/Lithic/BootComplete\\\", \\\"text\\\", null, \\\"yes\\\");\\n console.log(\\\"[Lithic] Boot sequence completely settled. BootComplete flag set to 'yes'.\\\");\\n }, 250);\\n};\\n\\n})();\\n\"},\"$:/Lithic/Patches/IsolateDoubleClicks\":{\"title\":\"$:/Lithic/Patches/IsolateDoubleClicks\",\"module-type\":\"startup\",\"tags\":\"\",\"type\":\"application/javascript\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/IsolateDoubleClicks\\ntype: application/javascript\\nmodule-type: startup\\n\\nPrevents double-click events inside the Tldraw widget from bubbling up \\nand triggering the Streams \\\"double click to edit\\\" action.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-isolate-double-clicks\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n\\n var addIsolation = function (node) {\\n // Avoid attaching twice\\n if (node.dataset.lithicDblClickIsolated) return;\\n\\n // Listen for double clicks and kill them before they bubble to Streams\\n node.addEventListener('dblclick', function (e) {\\n e.stopPropagation();\\n // console.log(\\\"🛡️ Lithic: Stopped double-click from triggering Streams.\\\");\\n }, false); // Bubble phase\\n\\n node.dataset.lithicDblClickIsolated = \\\"active\\\";\\n };\\n\\n // Watch for new Tldraw containers appearing in the DOM\\n var observer = new MutationObserver(function (mutations) {\\n mutations.forEach(function (mutation) {\\n mutation.addedNodes.forEach(function (node) {\\n if (node.nodeType !== 1) return;\\n\\n // 1. Check if the added node IS the container\\n if (node.classList.contains('tw-whiteboard-tldraw-container')) {\\n addIsolation(node);\\n }\\n // 2. Check if the container is INSIDE the added node\\n else if (node.querySelector) {\\n var containers = node.querySelectorAll('.tw-whiteboard-tldraw-container');\\n for (var i = 0; i < containers.length; i++) {\\n addIsolation(containers[i]);\\n }\\n }\\n });\\n });\\n });\\n\\n if (document.body) {\\n observer.observe(document.body, { childList: true, subtree: true });\\n }\\n };\\n\\n})();\"},\"$:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\",\"type\":\"application/javascript\",\"module-type\":\"widget\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/ActionDispatchPaste.js\\ntype: application/javascript\\nmodule-type: widget\\n\\nAction widget to dispatch a synthetic paste event containing the comptext input to Tldraw.\\n\\\\*/\\n(function(){\\n\\\"use strict\\\";\\n\\nvar Widget = require(\\\"$:/core/modules/widgets/widget.js\\\").widget;\\n\\nvar ActionDispatchPaste = function(parseTreeNode,options) {\\n this.initialise(parseTreeNode,options);\\n};\\n\\nActionDispatchPaste.prototype = new Widget();\\n\\nActionDispatchPaste.prototype.render = function(parent,nextSibling) {\\n this.computeAttributes();\\n this.execute();\\n};\\n\\nActionDispatchPaste.prototype.execute = function() {\\n this.tiddlerName = this.getAttribute(\\\"tiddler\\\", \\\"$:/temp/whiteboard-comptext-input\\\");\\n this.boardStateTiddler = \\\"$:/state/Whiteboard/PageLayout/tiddler\\\";\\n};\\n\\nActionDispatchPaste.prototype.refresh = function(changedTiddlers) {\\n var changedAttributes = this.computeAttributes();\\n if(changedAttributes.tiddler) {\\n this.refreshSelf();\\n return true;\\n }\\n return this.refreshChildren(changedTiddlers);\\n};\\n\\n// Generates a random UUID v4 ending with 'c001' so we can target it via CSS\\nfunction generateUUID() {\\n var base = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxc001'.replace(/[xy]/g, function(c) {\\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\\n return v.toString(16);\\n });\\n return base;\\n}\\n\\nActionDispatchPaste.prototype.invokeAction = function(triggeringWidget,event) {\\n var text = $tw.wiki.getTiddlerText(this.tiddlerName);\\n if (!text) return true; // nothing to paste\\n\\n // Determine which whiteboard is currently active\\n var currentBoard = $tw.wiki.getTiddlerText(this.boardStateTiddler);\\n if (!currentBoard) {\\n // Fallback to the first whiteboard modified\\n var tiddlers = $tw.wiki.filterTiddlers(\\\"[all[shadows+tiddlers]field:type[application/tldr]!prefix[$:/temp]!sort[modified]first[]]\\\");\\n if (tiddlers.length > 0) currentBoard = tiddlers[0];\\n }\\n \\n if (!currentBoard) return true;\\n\\n var boardText = $tw.wiki.getTiddlerText(currentBoard);\\n if (!boardText) return true;\\n\\n try {\\n var data = JSON.parse(boardText);\\n var page = data.document.pages.page;\\n \\n // Find the highest childIndex\\n var maxIndex = 0;\\n for (var shapeId in page.shapes) {\\n var shape = page.shapes[shapeId];\\n if (shape.childIndex > maxIndex) maxIndex = shape.childIndex;\\n }\\n\\n var newShapeId = generateUUID();\\n \\n // Create the new sticky note\\n var newShape = {\\n id: newShapeId,\\n type: \\\"sticky\\\",\\n name: \\\"Sticky\\\",\\n parentId: \\\"page\\\",\\n childIndex: maxIndex + 1,\\n point: [200, 200], // We can spawn it top-left or try to center it\\n size: [300, 300],\\n text: text,\\n rotation: 0,\\n style: {\\n color: \\\"black\\\",\\n size: \\\"small\\\",\\n isFilled: false,\\n dash: \\\"draw\\\",\\n scale: 1,\\n font: \\\"sans\\\",\\n textAlign: \\\"middle\\\"\\n }\\n };\\n\\n // Center it around the camera if possible\\n if (data.pageStates && data.pageStates.page && data.pageStates.page.camera) {\\n var cam = data.pageStates.page.camera.point;\\n newShape.point = [-(cam[0]) + 300, -(cam[1]) + 300];\\n }\\n\\n page.shapes[newShapeId] = newShape;\\n\\n // Write it back to the tiddler\\n $tw.wiki.setText(currentBoard, \\\"text\\\", null, JSON.stringify(data));\\n\\n } catch(e) {\\n console.error(\\\"Failed to inject shape into whiteboard JSON\\\", e);\\n }\\n\\n return true; // Action was invoked\\n};\\n\\nexports[\\\"action-dispatch-paste\\\"] = ActionDispatchPaste;\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/ComptextBridge.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/ComptextBridge.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/ComptextBridge.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nListens for hotkeys (/, [, {) to trigger the floating Comptext UI in the whiteboard.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-comptext-bridge\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n if (typeof window === \\\"undefined\\\" || typeof $tw === \\\"undefined\\\") return;\\n\\n window.addEventListener('keydown', function(event) {\\n // Check if we are in the whiteboard\\n var whiteboardContainer = document.querySelector('.tw-whiteboard-layout-container');\\n if (!whiteboardContainer) return;\\n\\n // Do not trigger if a modal or popup is already open\\n var isPopupOpen = $tw.wiki.getTiddlerText(\\\"$:/state/Whiteboard/ComptextPopup\\\") === \\\"open\\\";\\n if (isPopupOpen) return;\\n\\n // Check if the user is typing in an input field or contenteditable (e.g. existing sticky note)\\n var active = document.activeElement;\\n if (active) {\\n var tag = active.tagName.toUpperCase();\\n if (tag === 'INPUT' || tag === 'TEXTAREA' || active.isContentEditable) {\\n return;\\n }\\n }\\n\\n // Detect hotkeys\\n var key = event.key;\\n if (key === '/' || key === '[' || key === '{') {\\n // Prevent default Tldraw behaviors or scrolling\\n event.preventDefault();\\n event.stopPropagation();\\n\\n var prefill = key;\\n if (key === '[') prefill = '[[';\\n if (key === '{') prefill = '{{';\\n\\n // Set the temporary text\\n $tw.wiki.setText(\\\"$:/temp/whiteboard-comptext-input\\\", \\\"text\\\", null, prefill);\\n \\n // Open the popup\\n $tw.wiki.setText(\\\"$:/state/Whiteboard/ComptextPopup\\\", \\\"text\\\", null, \\\"open\\\");\\n\\n // We need to focus the edit-text widget. We can do it by waiting for the DOM to update.\\n setTimeout(function() {\\n var input = document.querySelector('.lithic-floating-comptext-input');\\n if (input) {\\n input.focus();\\n // Move cursor to the end\\n input.setSelectionRange(prefill.length, prefill.length);\\n }\\n }, 100);\\n }\\n }, true); // Use capture phase so Tldraw doesn't swallow it first!\\n\\n window.addEventListener('click', function(event) {\\n // Intercept clicks on the \\\"Insert Media\\\" button in Tldraw\\n var mediaBtn = event.target.closest('#TD-PrimaryTools-Image');\\n if (mediaBtn) {\\n event.preventDefault();\\n event.stopPropagation();\\n\\n // Clear the input and open the popup\\n $tw.wiki.setText(\\\"$:/temp/whiteboard-comptext-input\\\", \\\"text\\\", null, \\\"\\\");\\n $tw.wiki.setText(\\\"$:/state/Whiteboard/ComptextPopup\\\", \\\"text\\\", null, \\\"open\\\");\\n\\n // Focus the input\\n setTimeout(function() {\\n var input = document.querySelector('.lithic-floating-comptext-input');\\n if (input) {\\n input.focus();\\n }\\n }, 100);\\n }\\n }, true);\\n\\n };\\n\\n})();\\n\"},\"$:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\":{\"title\":\"$:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\",\"type\":\"application/javascript\",\"module-type\":\"startup\",\"text\":\"/*\\\\\\ntitle: $:/Lithic/Patches/Whiteboard/DeleteKeySimulator.js\\ntype: application/javascript\\nmodule-type: startup\\n\\nSimulates a click on the tldraw trash can icon when the Delete or Backspace key is pressed,\\nas TiddlyWiki or Streams sometimes swallows keyboard shortcuts.\\n\\\\*/\\n(function () {\\n \\\"use strict\\\";\\n\\n exports.name = \\\"lithic-whiteboard-delete-simulator\\\";\\n exports.platforms = [\\\"browser\\\"];\\n exports.after = [\\\"startup\\\"];\\n exports.synchronous = true;\\n\\n exports.startup = function () {\\n if (typeof document !== \\\"undefined\\\") {\\n document.addEventListener('keydown', function(e) {\\n // Only respond to Delete or Backspace\\n if (e.key !== 'Delete' && e.key !== 'Backspace') return;\\n \\n console.log(\\\"[DeleteSimulator] Caught key:\\\", e.key, \\\"Target:\\\", e.target);\\n \\n if (!e.target) return;\\n \\n // Ignore if typing in an input\\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.isContentEditable) {\\n console.log(\\\"[DeleteSimulator] Ignored because target is input/textarea/contenteditable.\\\");\\n return;\\n }\\n \\n // Also ignore if inside the tldraw text editor container\\n if (typeof e.target.closest === 'function') {\\n if (e.target.closest('.tl-text-editor') || e.target.closest('.c-fOQRlS') || e.target.closest('.tl-absolute')) {\\n console.log(\\\"[DeleteSimulator] Ignored because target is inside tldraw text editor.\\\");\\n return;\\n }\\n }\\n \\n var deleteBtnWrapper = document.getElementById('TD-Delete');\\n if (deleteBtnWrapper) {\\n console.log(\\\"[DeleteSimulator] Found #TD-Delete wrapper in DOM.\\\");\\n var deleteBtn = deleteBtnWrapper.querySelector('button');\\n if (deleteBtn) {\\n console.log(\\\"[DeleteSimulator] Found button inside wrapper! Dispatching pointerdown and click...\\\");\\n \\n var eventInit = { bubbles: true, cancelable: true, button: 0 };\\n deleteBtn.dispatchEvent(new PointerEvent('pointerdown', eventInit));\\n deleteBtn.dispatchEvent(new MouseEvent('mousedown', eventInit));\\n deleteBtn.dispatchEvent(new PointerEvent('pointerup', eventInit));\\n deleteBtn.dispatchEvent(new MouseEvent('mouseup', eventInit));\\n deleteBtn.click();\\n \\n e.preventDefault();\\n e.stopPropagation();\\n } else {\\n console.log(\\\"[DeleteSimulator] ERROR: Could not find