UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.

1,427 lines 1.16 MB
import { l as log, c as getConfig, W as defaultConfig, d as sanitizeText, P as commonjsGlobal, Q as getDefaultExportFromCjs, Y as parseFontSize, U as selectSvgElement, t as setupGraphViewbox, j as d3select, at as isDark, au as lighten, av as darken } from "./mermaid-dcacb631.js"; import { a as createText } from "./createText-b70fe78a.js"; var parser = function() { var o = function(k, v, o2, l) { for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ; return o2; }, $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 6, 13, 15, 16, 19, 22], $Vd = [1, 33], $Ve = [1, 34], $Vf = [1, 6, 7, 11, 13, 15, 16, 19, 22]; var parser2 = { trace: function trace() { }, yy: {}, symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "MINDMAP": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "ICON": 15, "CLASS": 16, "nodeWithId": 17, "nodeWithoutId": 18, "NODE_DSTART": 19, "NODE_DESCR": 20, "NODE_DEND": 21, "NODE_ID": 22, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" }, productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; switch (yystate) { case 6: case 7: return yy; case 8: yy.getLogger().trace("Stop NL "); break; case 9: yy.getLogger().trace("Stop EOF "); break; case 11: yy.getLogger().trace("Stop NL2 "); break; case 12: yy.getLogger().trace("Stop EOF2 "); break; case 15: yy.getLogger().info("Node: ", $$[$0].id); yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type); break; case 16: yy.getLogger().trace("Icon: ", $$[$0]); yy.decorateNode({ icon: $$[$0] }); break; case 17: case 21: yy.decorateNode({ class: $$[$0] }); break; case 18: yy.getLogger().trace("SPACELIST"); break; case 19: yy.getLogger().trace("Node: ", $$[$0].id); yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type); break; case 20: yy.decorateNode({ icon: $$[$0] }); break; case 25: yy.getLogger().trace("node found ..", $$[$0 - 2]); this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; break; case 26: this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT }; break; case 27: yy.getLogger().trace("node found ..", $$[$0 - 3]); this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; break; } }, table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($V7, [2, 3]), { 1: [2, 2] }, o($V7, [2, 4]), o($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o($Vb, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: $V5, 22: $V6 }), o($Vb, [2, 18]), o($Vb, [2, 19]), o($Vb, [2, 20]), o($Vb, [2, 21]), o($Vb, [2, 23]), o($Vb, [2, 24]), o($Vb, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: $V8, 7: $V9, 10: 32, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($Vc, [2, 14], { 7: $Vd, 11: $Ve }), o($Vf, [2, 8]), o($Vf, [2, 9]), o($Vf, [2, 10]), o($Vb, [2, 15]), o($Vb, [2, 16]), o($Vb, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, o($Vc, [2, 13], { 7: $Vd, 11: $Ve }), o($Vf, [2, 11]), o($Vf, [2, 12]), { 21: [1, 37] }, o($Vb, [2, 25]), o($Vb, [2, 27])], defaultActions: { 2: [2, 1], 6: [2, 2] }, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer2 = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer2.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer2; sharedState.yy.parser = this; if (typeof lexer2.yylloc == "undefined") { lexer2.yylloc = {}; } var yyloc = lexer2.yylloc; lstack.push(yyloc); var ranges = lexer2.options && lexer2.options.ranges; if (typeof sharedState.yy.parseError === "function") { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function lex() { var token; token = tstack.pop() || lexer2.lex() || EOF; if (typeof token !== "number") { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self2.symbols_[token] || token; } return token; } var symbol, state, action, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == "undefined") { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === "undefined" || !action.length || !action[0]) { var errStr = ""; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push("'" + this.terminals_[p] + "'"); } } if (lexer2.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, { text: lexer2.match, token: this.terminals_[symbol] || symbol, line: lexer2.yylineno, loc: yyloc, expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer2.yytext); lstack.push(lexer2.yylloc); stack.push(action[1]); symbol = null; { yyleng = lexer2.yyleng; yytext = lexer2.yytext; yylineno = lexer2.yylineno; yyloc = lexer2.yylloc; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; } }; var lexer = function() { var lexer2 = { EOF: 1, parseError: function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput: function(input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ""; this.conditionStack = ["INITIAL"]; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0, 0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input: function() { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput: function(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more: function() { this._more = true; return this; }, // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. reject: function() { if (this.options.backtrack_lexer) { this._backtrack = true; } else { return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less: function(n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput: function() { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput: function() { var next2 = this.match; if (next2.length < 20) { next2 += this._input.substr(0, 20 - next2.length); } return (next2.substr(0, 20) + (next2.length > 20 ? "..." : "")).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition: function() { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match: function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { for (var k in backup) { this[k] = backup[k]; } return false; } return false; }, // return next match in input next: function() { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ""; this.match = ""; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; } else { return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } return false; } if (this._input === "") { return this.EOF; } else { return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex: function lex() { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin: function begin(condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState: function popState() { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules: function _currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState: function topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState: function pushState(condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize: function stateStackSize() { return this.conditionStack.length; }, options: { "case-insensitive": true }, performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { switch ($avoiding_name_collisions) { case 0: yy.getLogger().trace("Found comment", yy_.yytext); return 6; case 1: return 8; case 2: this.begin("CLASS"); break; case 3: this.popState(); return 16; case 4: this.popState(); break; case 5: yy.getLogger().trace("Begin icon"); this.begin("ICON"); break; case 6: yy.getLogger().trace("SPACELINE"); return 6; case 7: return 7; case 8: return 15; case 9: yy.getLogger().trace("end icon"); this.popState(); break; case 10: yy.getLogger().trace("Exploding node"); this.begin("NODE"); return 19; case 11: yy.getLogger().trace("Cloud"); this.begin("NODE"); return 19; case 12: yy.getLogger().trace("Explosion Bang"); this.begin("NODE"); return 19; case 13: yy.getLogger().trace("Cloud Bang"); this.begin("NODE"); return 19; case 14: this.begin("NODE"); return 19; case 15: this.begin("NODE"); return 19; case 16: this.begin("NODE"); return 19; case 17: this.begin("NODE"); return 19; case 18: return 13; case 19: return 22; case 20: return 11; case 21: this.begin("NSTR2"); break; case 22: return "NODE_DESCR"; case 23: this.popState(); break; case 24: yy.getLogger().trace("Starting NSTR"); this.begin("NSTR"); break; case 25: yy.getLogger().trace("description:", yy_.yytext); return "NODE_DESCR"; case 26: this.popState(); break; case 27: this.popState(); yy.getLogger().trace("node end ))"); return "NODE_DEND"; case 28: this.popState(); yy.getLogger().trace("node end )"); return "NODE_DEND"; case 29: this.popState(); yy.getLogger().trace("node end ...", yy_.yytext); return "NODE_DEND"; case 30: this.popState(); yy.getLogger().trace("node end (("); return "NODE_DEND"; case 31: this.popState(); yy.getLogger().trace("node end (-"); return "NODE_DEND"; case 32: this.popState(); yy.getLogger().trace("node end (-"); return "NODE_DEND"; case 33: this.popState(); yy.getLogger().trace("node end (("); return "NODE_DEND"; case 34: this.popState(); yy.getLogger().trace("node end (("); return "NODE_DEND"; case 35: yy.getLogger().trace("Long description:", yy_.yytext); return 20; case 36: yy.getLogger().trace("Long description:", yy_.yytext); return 20; } }, rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i], conditions: { "CLASS": { "rules": [3, 4], "inclusive": false }, "ICON": { "rules": [8, 9], "inclusive": false }, "NSTR2": { "rules": [22, 23], "inclusive": false }, "NSTR": { "rules": [25, 26], "inclusive": false }, "NODE": { "rules": [21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "inclusive": true } } }; return lexer2; }(); parser2.lexer = lexer; function Parser() { this.yy = {}; } Parser.prototype = parser2; parser2.Parser = Parser; return new Parser(); }(); parser.parser = parser; const parser$1 = parser; let nodes = []; let cnt = 0; let elements = {}; const clear = () => { nodes = []; cnt = 0; elements = {}; }; const getParent = function(level) { for (let i = nodes.length - 1; i >= 0; i--) { if (nodes[i].level < level) { return nodes[i]; } } return null; }; const getMindmap = () => { return nodes.length > 0 ? nodes[0] : null; }; const addNode = (level, id, descr, type) => { var _a, _b; log.info("addNode", level, id, descr, type); const conf = getConfig(); let padding = ((_a = conf.mindmap) == null ? void 0 : _a.padding) ?? defaultConfig.mindmap.padding; switch (type) { case nodeType.ROUNDED_RECT: case nodeType.RECT: case nodeType.HEXAGON: padding *= 2; } const node = { id: cnt++, nodeId: sanitizeText(id, conf), level, descr: sanitizeText(descr, conf), type, children: [], width: ((_b = conf.mindmap) == null ? void 0 : _b.maxNodeWidth) ?? defaultConfig.mindmap.maxNodeWidth, padding }; const parent = getParent(level); if (parent) { parent.children.push(node); nodes.push(node); } else { if (nodes.length === 0) { nodes.push(node); } else { throw new Error( 'There can be only one root. No parent could be found for ("' + node.descr + '")' ); } } }; const nodeType = { DEFAULT: 0, NO_BORDER: 0, ROUNDED_RECT: 1, RECT: 2, CIRCLE: 3, CLOUD: 4, BANG: 5, HEXAGON: 6 }; const getType = (startStr, endStr) => { log.debug("In get type", startStr, endStr); switch (startStr) { case "[": return nodeType.RECT; case "(": return endStr === ")" ? nodeType.ROUNDED_RECT : nodeType.CLOUD; case "((": return nodeType.CIRCLE; case ")": return nodeType.CLOUD; case "))": return nodeType.BANG; case "{{": return nodeType.HEXAGON; default: return nodeType.DEFAULT; } }; const setElementForId = (id, element) => { elements[id] = element; }; const decorateNode = (decoration) => { if (!decoration) { return; } const config = getConfig(); const node = nodes[nodes.length - 1]; if (decoration.icon) { node.icon = sanitizeText(decoration.icon, config); } if (decoration.class) { node.class = sanitizeText(decoration.class, config); } }; const type2Str = (type) => { switch (type) { case nodeType.DEFAULT: return "no-border"; case nodeType.RECT: return "rect"; case nodeType.ROUNDED_RECT: return "rounded-rect"; case nodeType.CIRCLE: return "circle"; case nodeType.CLOUD: return "cloud"; case nodeType.BANG: return "bang"; case nodeType.HEXAGON: return "hexgon"; default: return "no-border"; } }; const getLogger = () => log; const getElementById = (id) => elements[id]; const db = { clear, addNode, getMindmap, nodeType, getType, setElementForId, decorateNode, type2Str, getLogger, getElementById }; const db$1 = db; var cytoscape_umd = { exports: {} }; (function(module, exports) { (function(global, factory) { module.exports = factory(); })(commonjsGlobal, function() { function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof(obj); } function _classCallCheck(instance2, Constructor) { if (!(instance2 instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i2 = 0; i2 < props.length; i2++) { var descriptor = props[i2]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _slicedToArray(arr, i2) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i2) || _unsupportedIterableToArray(arr, i2) || _nonIterableRest(); } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArrayLimit(arr, i2) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i2 && _arr.length === i2) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) arr2[i2] = arr[i2]; return arr2; } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var _window = typeof window === "undefined" ? null : window; var navigator = _window ? _window.navigator : null; _window ? _window.document : null; var typeofstr = _typeof(""); var typeofobj = _typeof({}); var typeoffn = _typeof(function() { }); var typeofhtmlele = typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement); var instanceStr = function instanceStr2(obj) { return obj && obj.instanceString && fn$6(obj.instanceString) ? obj.instanceString() : null; }; var string = function string2(obj) { return obj != null && _typeof(obj) == typeofstr; }; var fn$6 = function fn2(obj) { return obj != null && _typeof(obj) === typeoffn; }; var array = function array2(obj) { return !elementOrCollection(obj) && (Array.isArray ? Array.isArray(obj) : obj != null && obj instanceof Array); }; var plainObject = function plainObject2(obj) { return obj != null && _typeof(obj) === typeofobj && !array(obj) && obj.constructor === Object; }; var object = function object2(obj) { return obj != null && _typeof(obj) === typeofobj; }; var number$1 = function number2(obj) { return obj != null && _typeof(obj) === _typeof(1) && !isNaN(obj); }; var integer = function integer2(obj) { return number$1(obj) && Math.floor(obj) === obj; }; var htmlElement = function htmlElement2(obj) { if ("undefined" === typeofhtmlele) { return void 0; } else { return null != obj && obj instanceof HTMLElement; } }; var elementOrCollection = function elementOrCollection2(obj) { return element(obj) || collection(obj); }; var element = function element2(obj) { return instanceStr(obj) === "collection" && obj._private.single; }; var collection = function collection2(obj) { return instanceStr(obj) === "collection" && !obj._private.single; }; var core = function core2(obj) { return instanceStr(obj) === "core"; }; var stylesheet = function stylesheet2(obj) { return instanceStr(obj) === "stylesheet"; }; var event = function event2(obj) { return instanceStr(obj) === "event"; }; var emptyString = function emptyString2(obj) { if (obj === void 0 || obj === null) { return true; } else if (obj === "" || obj.match(/^\s+$/)) { return true; } return false; }; var domElement = function domElement2(obj) { if (typeof HTMLElement === "undefined") { return false; } else { return obj instanceof HTMLElement; } }; var boundingBox = function boundingBox2(obj) { return plainObject(obj) && number$1(obj.x1) && number$1(obj.x2) && number$1(obj.y1) && number$1(obj.y2); }; var promise = function promise2(obj) { return object(obj) && fn$6(obj.then); }; var ms = function ms2() { return navigator && navigator.userAgent.match(/msie|trident|edge/i); }; var memoize$1 = function memoize2(fn2, keyFn) { if (!keyFn) { keyFn = function keyFn2() { if (arguments.length === 1) { return arguments[0]; } else if (arguments.length === 0) { return "undefined"; } var args = []; for (var i2 = 0; i2 < arguments.length; i2++) { args.push(arguments[i2]); } return args.join("$"); }; } var memoizedFn = function memoizedFn2() { var self2 = this; var args = arguments; var ret; var k = keyFn.apply(self2, args); var cache2 = memoizedFn2.cache; if (!(ret = cache2[k])) { ret = cache2[k] = fn2.apply(self2, args); } return ret; }; memoizedFn.cache = {}; return memoizedFn; }; var camel2dash = memoize$1(function(str) { return str.replace(/([A-Z])/g, function(v) { return "-" + v.toLowerCase(); }); }); var dash2camel = memoize$1(function(str) { return str.replace(/(-\w)/g, function(v) { return v[1].toUpperCase(); }); }); var prependCamel = memoize$1(function(prefix, str) { return prefix + str[0].toUpperCase() + str.substring(1); }, function(prefix, str) { return prefix + "$" + str; }); var capitalize = function capitalize2(str) { if (emptyString(str)) { return str; } return str.charAt(0).toUpperCase() + str.substring(1); }; var number = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))"; var rgba = "rgb[a]?\\((" + number + "[%]?)\\s*,\\s*(" + number + "[%]?)\\s*,\\s*(" + number + "[%]?)(?:\\s*,\\s*(" + number + "))?\\)"; var rgbaNoBackRefs = "rgb[a]?\\((?:" + number + "[%]?)\\s*,\\s*(?:" + number + "[%]?)\\s*,\\s*(?:" + number + "[%]?)(?:\\s*,\\s*(?:" + number + "))?\\)"; var hsla = "hsl[a]?\\((" + number + ")\\s*,\\s*(" + number + "[%])\\s*,\\s*(" + number + "[%])(?:\\s*,\\s*(" + number + "))?\\)"; var hslaNoBackRefs = "hsl[a]?\\((?:" + number + ")\\s*,\\s*(?:" + number + "[%])\\s*,\\s*(?:" + number + "[%])(?:\\s*,\\s*(?:" + number + "))?\\)"; var hex3 = "\\#[0-9a-fA-F]{3}"; var hex6 = "\\#[0-9a-fA-F]{6}"; var ascending = function ascending2(a, b) { if (a < b) { return -1; } else if (a > b) { return 1; } else { return 0; } }; var descending = function descending2(a, b) { return -1 * ascending(a, b); }; var extend = Object.assign != null ? Object.assign.bind(Object) : function(tgt) { var args = arguments; for (var i2 = 1; i2 < args.length; i2++) { var obj = args[i2]; if (obj == null) { continue; } var keys = Object.keys(obj); for (var j = 0; j < keys.length; j++) { var k = keys[j]; tgt[k] = obj[k]; } } return tgt; }; var hex2tuple = function hex2tuple2(hex) { if (!(hex.length === 4 || hex.length === 7) || hex[0] !== "#") { return; } var shortHex = hex.length === 4; var r, g, b; var base = 16; if (shortHex) { r = parseInt(hex[1] + hex[1], base); g = parseInt(hex[2] + hex[2], base); b = parseInt(hex[3] + hex[3], base); } else { r = parseInt(hex[1] + hex[2], base); g = parseInt(hex[3] + hex[4], base); b = parseInt(hex[5] + hex[6], base); } return [r, g, b]; }; var hsl2tuple = function hsl2tuple2(hsl) { var ret; var h, s, l, a, r, g, b; function hue2rgb(p3, q2, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p3 + (q2 - p3) * 6 * t; if (t < 1 / 2) return q2; if (t < 2 / 3) return p3 + (q2 - p3) * (2 / 3 - t) * 6; return p3; } var m = new RegExp("^" + hsla + "$").exec(hsl); if (m) { h = parseInt(m[1]); if (h < 0) { h = (360 - -1 * h % 360) % 360; } else if (h > 360) { h = h % 360; } h /= 360; s = parseFloat(m[2]); if (s < 0 || s > 100) { return; } s = s / 100; l = parseFloat(m[3]); if (l < 0 || l > 100) { return; } l = l / 100; a = m[4]; if (a !== void 0) { a = parseFloat(a); if (a < 0 || a > 1) { return; } } if (s === 0) { r = g = b = Math.round(l * 255); } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p2 = 2 * l - q; r = Math.round(255 * hue2rgb(p2, q, h + 1 / 3)); g = Math.round(255 * hue2rgb(p2, q, h)); b = Math.round(255 * hue2rgb(p2, q, h - 1 / 3)); } ret = [r, g, b, a]; } return ret; }; var rgb2tuple = function rgb2tuple2(rgb) { var ret; var m = new RegExp("^" + rgba + "$").exec(rgb); if (m) { ret = []; var isPct = []; for (var i2 = 1; i2 <= 3; i2++) { var channel = m[i2]; if (channel[channel.length - 1] === "%") { isPct[i2] = true; } channel = parseFloat(channel); if (isPct[i2]) { channel = channel / 100 * 255; } if (channel < 0 || channel > 255) { return; } ret.push(Math.floor(channel)); } var atLeastOneIsPct = isPct[1] || isPct[2] || isPct[3]; var allArePct = isPct[1] && isPct[2] && isPct[3]; if (atLeastOneIsPct && !allArePct) { return; } var alpha = m[4]; if (alpha !== void 0) { alpha = parseFloat(alpha); if (alpha < 0 || alpha > 1) { return; } ret.push(alpha); } } return ret; }; var colorname2tuple = function colorname2tuple2(color) { return colors[color.toLowerCase()]; }; var color2tuple = function color2tuple2(color) { return (array(color) ? color : null) || colorname2tuple(color) || hex2tuple(color) || rgb2tuple(color) || hsl2tuple(color); }; var colors = { // special colour names transparent: [0, 0, 0, 0], // NB alpha === 0 // regular colours aliceblue: [240, 248, 255], antiquewhite: [250, 235, 215], aqua: [0, 255, 255], aquamarine: [127, 255, 212], azure: [240, 255, 255], beige: [245, 245, 220], bisque: [255, 228, 196], black: [0, 0, 0], blanchedalmond: [255, 235, 205], blue: [0, 0, 255], blueviolet: [138, 43, 226], brown: [165, 42, 42], burlywood: [222, 184, 135], cadetblue: [95, 158, 160], chartreuse: [127, 255, 0], chocolate: [210, 105, 30], coral: [255, 127, 80], cornflowerblue: [100, 149, 237], cornsilk: [255, 248, 220], crimson: [220, 20, 60], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgoldenrod: [184, 134, 11], darkgray: [169, 169, 169], darkgreen: [0, 100, 0], darkgrey: [169, 169, 169], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkseagreen: [143, 188, 143], darkslateblue: [72, 61, 139], darkslategray: [47, 79, 79], darkslategrey: [47, 79, 79], darkturquoise: [0, 206, 209], darkviolet: [148, 0, 211], deeppink: [255, 20, 147], deepskyblue: [0, 191, 255], dimgray: [105, 105, 105], dimgrey: [105, 105, 105], dodgerblue: [30, 144, 255], firebrick: [178, 34, 34], floralwhite: [255, 250, 240], forestgreen: [34, 139, 34], fuchsia: [255, 0, 255], gainsboro: [220, 220, 220], ghostwhite: [248, 248, 255], gold: [255, 215, 0], goldenrod: [218, 165, 32], gray: [128, 128, 128], grey: [128, 128, 128], green: [0, 128, 0], greenyellow: [173, 255, 47], honeydew: [240, 255, 240], hotpink: [255, 105, 180], indianred: [205, 92, 92], indigo: [75, 0, 130], ivory: [255, 255, 240], khaki: [240, 230, 140], lavender: [230, 230, 250], lavenderblush: [255, 240, 245], lawngreen: [124, 252, 0], lemonchiffon: [255, 250, 205], lightblue: [173, 216, 230], lightcoral: [240, 128, 128], lightcyan: [224, 255, 255], lightgoldenrodyellow: [250, 250, 210], lightgray: [211, 211, 211], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightsalmon: [255, 160, 122], lightseagreen: [32, 178, 170], lightskyblue: [135, 206, 250], lightslategray: [119, 136, 153], lightslategrey: [119, 136, 153], lightsteelblue: [176, 196, 222], lightyellow: [255, 255, 224], lime: [0, 255, 0], limegreen: [50, 205, 50], linen: [250, 240, 230], magenta: [255, 0, 255], maroon: [128, 0, 0], mediumaquamarine: [102, 205, 170], mediumblue: [0, 0, 205], mediumorchid: [186, 85, 211], mediumpurple: [147, 112, 219], mediumseagreen: [60, 179, 113], mediumslateblue: [123, 104, 238], mediumspringgreen: [0, 250, 154], mediumturquoise: [72, 209, 204], mediumvioletred: [199, 21, 133], midnightblue: [25, 25, 112], mintcream: [245, 255, 250], mistyrose: [255, 228, 225], moccasin: [255, 228, 181], navajowhite: [255, 222, 173], navy: [0, 0, 128], oldlace: [253, 245, 230], olive: [128, 128, 0], olivedrab: [107, 142, 35], orange: [255, 165, 0], orangered: [255, 69, 0], orchid: [218, 112, 214], palegoldenrod: [238, 232, 170], palegreen: [152, 251, 152], paleturquoise: [175, 238, 238], palevioletred: [219, 112, 147], papayawhip: [255, 239, 213], peachpuff: [255, 218, 185], peru: [205, 133, 63], pink: [255, 192, 203], plum: [221, 160, 221], powderblue: [176, 224, 230], purple: [128, 0, 128], red: [255, 0, 0], rosybrown: [188, 143, 143], royalblue: [65, 105, 225], saddlebrown: [139, 69, 19], salmon: [250, 128, 114], sandybrown: [244, 164, 96], seagreen: [46, 139, 87], seashell: [255, 245, 238], sienna: [160, 82, 45], silver: [192, 192, 192], skyblue: [135, 206, 235], slateblue: [106, 90, 205], slategray: [112, 128, 144], slategrey: [112, 128, 144], snow: [255, 250, 250], springgreen: [0, 255, 127], steelblue: [70, 130, 180], tan: [210, 180, 140], teal: [0, 128, 128], thistle: [216, 191, 216], tomato: [255, 99, 71], turquoise: [64, 224, 208], violet: [238, 130, 238], wheat: [245, 222, 179], white: [255, 255, 255], whitesmoke: [245, 245, 245], yellow: [255, 255, 0], yellowgreen: [154, 205, 50] }; var setMap = function setMap2(options) { var obj = options.map; var keys = options.keys; var l = keys.length; for (var i2 = 0; i2 < l; i2++) { var key = keys[i2]; if (plainObject(key)) { throw Error("Tried to set map with object key"); } if (i2 < keys.length - 1) { if (obj[key] == null) { obj[key] = {}; } obj = obj[key]; } else { obj[key] = options.value; } } }; var getMap = function getMap2(options) { var obj = options.map; var keys = options.keys; var l = keys.length; for (var i2 = 0; i2 < l; i2++) { var key = keys[i2]; if (plainObject(key)) { throw Error("Tried to get map with object key"); } obj = obj[key]; if (obj == null) { return obj; } } return obj; }; function isObject(value) { var type = typeof value; return value != null && (type == "object" || type == "function"); } var isObject_1 = isObject; var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : {}; function createCommonjsModule(fn2, module2) { return module2 = { exports: {} }, fn2(module2, module2.exports), module2.exports; } var freeGlobal = typeof commonjsGlobal$1 == "object" && commonjsGlobal$1 && commonjsGlobal$1.Object === Object && commonjsGlobal$1; var _freeGlobal = freeGlobal; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = _freeGlobal || freeSelf || Function("return this")(); var _root = root; var now = function() { return _root.Date.now(); }; var now_1 = now; var reWhitespace = /\s/; function trimmedEndIndex(string2) { var index = string2.length; while (index-- && reWhitespace.test(string2.charAt(index))) { } return index; } var _trimmedEndIndex = trimmedEndIndex; var reTrimStart = /^\s+/; function baseTrim(string2) { return string2 ? string2.slice(0, _trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2; } var _baseTrim = baseTrim; var Symbol$1 = _root.Symbol; var _Symbol = Symbol$1; var objectProto$5 = Object.prototype; var hasOwnProperty$4 = objectProto$5.hasOwnProperty; var nativeObjectToString$1 = objectProto$5.toString; var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : void 0; function getRawTag(value) { var isOwn = hasOwnProperty$4.call(value, symToStringTag$1), tag = value[symToStringTag$1]; try { value[symToStringTag$1] = void 0; var unmasked = true; } catch (e) { } var result = nativeObjectToString$1.call(value); if (unmasked) { if (isOwn) { value[symToStringTag$1] = tag; } else { delete value[symToStringTag$1]; } } return result; } var _getRawTag = getRawTag; var objectProto$4 = Object.prototype; var nativeObjectToString = objectProto$4.toString; function objectToString(value) { return nativeObjectToString.call(value); } var _objectToString = objectToString; var nullTag = "[object Null]", undefinedTag = "[object Undefined]"; var symToStringTag = _Symbol ? _Symbol.toStringTag : void 0; function baseGetTag(value) { if (value == null) { return value === void 0 ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value) ? _getRawTag(value) : _objectToString(value); } var _baseGetTag = baseGetTag; function isObjectLike(value) { return value != null && typeof value == "object"; } var isObjectLike_1 = isObjectLike; var symbolTag = "[object Symbol]"; function isSymbol(value) { return typeof value == "symbol" || isObjectLike_1(value) && _baseGetTag(value) == symbolTag; } var isSymbol_1 = isSymbol; var NAN = 0 / 0; var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; var reIsBinary = /^0b[01]+$/i; var reIsOctal = /^0o[0-7]+$/i; var freeParseInt = parseInt; function toNumber(value) { if (typeof value == "number") { return value; } if (isSymbol_1(