1 | import { l as log, U as selectSvgElement, k as configureSvgSize } from "./mermaid-dcacb631.js";
|
2 | var parser = function() {
|
3 | var o = function(k, v, o2, l) {
|
4 | for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
|
5 | ;
|
6 | return o2;
|
7 | }, $V0 = [6, 9, 10];
|
8 | var parser2 = {
|
9 | trace: function trace() {
|
10 | },
|
11 | yy: {},
|
12 | symbols_: { "error": 2, "start": 3, "info": 4, "document": 5, "EOF": 6, "line": 7, "statement": 8, "NL": 9, "showInfo": 10, "$accept": 0, "$end": 1 },
|
13 | terminals_: { 2: "error", 4: "info", 6: "EOF", 9: "NL", 10: "showInfo" },
|
14 | productions_: [0, [3, 3], [5, 0], [5, 2], [7, 1], [7, 1], [8, 1]],
|
15 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
16 | $$.length - 1;
|
17 | switch (yystate) {
|
18 | case 1:
|
19 | return yy;
|
20 | case 4:
|
21 | break;
|
22 | case 6:
|
23 | yy.setInfo(true);
|
24 | break;
|
25 | }
|
26 | },
|
27 | table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: 6, 9: [1, 7], 10: [1, 8] }, { 1: [2, 1] }, o($V0, [2, 3]), o($V0, [2, 4]), o($V0, [2, 5]), o($V0, [2, 6])],
|
28 | defaultActions: { 4: [2, 1] },
|
29 | parseError: function parseError(str, hash) {
|
30 | if (hash.recoverable) {
|
31 | this.trace(str);
|
32 | } else {
|
33 | var error = new Error(str);
|
34 | error.hash = hash;
|
35 | throw error;
|
36 | }
|
37 | },
|
38 | parse: function parse(input) {
|
39 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
|
40 | var args = lstack.slice.call(arguments, 1);
|
41 | var lexer2 = Object.create(this.lexer);
|
42 | var sharedState = { yy: {} };
|
43 | for (var k in this.yy) {
|
44 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
45 | sharedState.yy[k] = this.yy[k];
|
46 | }
|
47 | }
|
48 | lexer2.setInput(input, sharedState.yy);
|
49 | sharedState.yy.lexer = lexer2;
|
50 | sharedState.yy.parser = this;
|
51 | if (typeof lexer2.yylloc == "undefined") {
|
52 | lexer2.yylloc = {};
|
53 | }
|
54 | var yyloc = lexer2.yylloc;
|
55 | lstack.push(yyloc);
|
56 | var ranges = lexer2.options && lexer2.options.ranges;
|
57 | if (typeof sharedState.yy.parseError === "function") {
|
58 | this.parseError = sharedState.yy.parseError;
|
59 | } else {
|
60 | this.parseError = Object.getPrototypeOf(this).parseError;
|
61 | }
|
62 | function lex() {
|
63 | var token;
|
64 | token = tstack.pop() || lexer2.lex() || EOF;
|
65 | if (typeof token !== "number") {
|
66 | if (token instanceof Array) {
|
67 | tstack = token;
|
68 | token = tstack.pop();
|
69 | }
|
70 | token = self.symbols_[token] || token;
|
71 | }
|
72 | return token;
|
73 | }
|
74 | var symbol, state, action, r, yyval = {}, p, len, newState, expected;
|
75 | while (true) {
|
76 | state = stack[stack.length - 1];
|
77 | if (this.defaultActions[state]) {
|
78 | action = this.defaultActions[state];
|
79 | } else {
|
80 | if (symbol === null || typeof symbol == "undefined") {
|
81 | symbol = lex();
|
82 | }
|
83 | action = table[state] && table[state][symbol];
|
84 | }
|
85 | if (typeof action === "undefined" || !action.length || !action[0]) {
|
86 | var errStr = "";
|
87 | expected = [];
|
88 | for (p in table[state]) {
|
89 | if (this.terminals_[p] && p > TERROR) {
|
90 | expected.push("'" + this.terminals_[p] + "'");
|
91 | }
|
92 | }
|
93 | if (lexer2.showPosition) {
|
94 | errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
95 | } else {
|
96 | errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
97 | }
|
98 | this.parseError(errStr, {
|
99 | text: lexer2.match,
|
100 | token: this.terminals_[symbol] || symbol,
|
101 | line: lexer2.yylineno,
|
102 | loc: yyloc,
|
103 | expected
|
104 | });
|
105 | }
|
106 | if (action[0] instanceof Array && action.length > 1) {
|
107 | throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
108 | }
|
109 | switch (action[0]) {
|
110 | case 1:
|
111 | stack.push(symbol);
|
112 | vstack.push(lexer2.yytext);
|
113 | lstack.push(lexer2.yylloc);
|
114 | stack.push(action[1]);
|
115 | symbol = null;
|
116 | {
|
117 | yyleng = lexer2.yyleng;
|
118 | yytext = lexer2.yytext;
|
119 | yylineno = lexer2.yylineno;
|
120 | yyloc = lexer2.yylloc;
|
121 | }
|
122 | break;
|
123 | case 2:
|
124 | len = this.productions_[action[1]][1];
|
125 | yyval.$ = vstack[vstack.length - len];
|
126 | yyval._$ = {
|
127 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
128 | last_line: lstack[lstack.length - 1].last_line,
|
129 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
130 | last_column: lstack[lstack.length - 1].last_column
|
131 | };
|
132 | if (ranges) {
|
133 | yyval._$.range = [
|
134 | lstack[lstack.length - (len || 1)].range[0],
|
135 | lstack[lstack.length - 1].range[1]
|
136 | ];
|
137 | }
|
138 | r = this.performAction.apply(yyval, [
|
139 | yytext,
|
140 | yyleng,
|
141 | yylineno,
|
142 | sharedState.yy,
|
143 | action[1],
|
144 | vstack,
|
145 | lstack
|
146 | ].concat(args));
|
147 | if (typeof r !== "undefined") {
|
148 | return r;
|
149 | }
|
150 | if (len) {
|
151 | stack = stack.slice(0, -1 * len * 2);
|
152 | vstack = vstack.slice(0, -1 * len);
|
153 | lstack = lstack.slice(0, -1 * len);
|
154 | }
|
155 | stack.push(this.productions_[action[1]][0]);
|
156 | vstack.push(yyval.$);
|
157 | lstack.push(yyval._$);
|
158 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
159 | stack.push(newState);
|
160 | break;
|
161 | case 3:
|
162 | return true;
|
163 | }
|
164 | }
|
165 | return true;
|
166 | }
|
167 | };
|
168 | var lexer = function() {
|
169 | var lexer2 = {
|
170 | EOF: 1,
|
171 | parseError: function parseError(str, hash) {
|
172 | if (this.yy.parser) {
|
173 | this.yy.parser.parseError(str, hash);
|
174 | } else {
|
175 | throw new Error(str);
|
176 | }
|
177 | },
|
178 |
|
179 | setInput: function(input, yy) {
|
180 | this.yy = yy || this.yy || {};
|
181 | this._input = input;
|
182 | this._more = this._backtrack = this.done = false;
|
183 | this.yylineno = this.yyleng = 0;
|
184 | this.yytext = this.matched = this.match = "";
|
185 | this.conditionStack = ["INITIAL"];
|
186 | this.yylloc = {
|
187 | first_line: 1,
|
188 | first_column: 0,
|
189 | last_line: 1,
|
190 | last_column: 0
|
191 | };
|
192 | if (this.options.ranges) {
|
193 | this.yylloc.range = [0, 0];
|
194 | }
|
195 | this.offset = 0;
|
196 | return this;
|
197 | },
|
198 |
|
199 | input: function() {
|
200 | var ch = this._input[0];
|
201 | this.yytext += ch;
|
202 | this.yyleng++;
|
203 | this.offset++;
|
204 | this.match += ch;
|
205 | this.matched += ch;
|
206 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
207 | if (lines) {
|
208 | this.yylineno++;
|
209 | this.yylloc.last_line++;
|
210 | } else {
|
211 | this.yylloc.last_column++;
|
212 | }
|
213 | if (this.options.ranges) {
|
214 | this.yylloc.range[1]++;
|
215 | }
|
216 | this._input = this._input.slice(1);
|
217 | return ch;
|
218 | },
|
219 |
|
220 | unput: function(ch) {
|
221 | var len = ch.length;
|
222 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
223 | this._input = ch + this._input;
|
224 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
225 | this.offset -= len;
|
226 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
227 | this.match = this.match.substr(0, this.match.length - 1);
|
228 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
229 | if (lines.length - 1) {
|
230 | this.yylineno -= lines.length - 1;
|
231 | }
|
232 | var r = this.yylloc.range;
|
233 | this.yylloc = {
|
234 | first_line: this.yylloc.first_line,
|
235 | last_line: this.yylineno + 1,
|
236 | first_column: this.yylloc.first_column,
|
237 | 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
|
238 | };
|
239 | if (this.options.ranges) {
|
240 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
241 | }
|
242 | this.yyleng = this.yytext.length;
|
243 | return this;
|
244 | },
|
245 |
|
246 | more: function() {
|
247 | this._more = true;
|
248 | return this;
|
249 | },
|
250 |
|
251 | reject: function() {
|
252 | if (this.options.backtrack_lexer) {
|
253 | this._backtrack = true;
|
254 | } else {
|
255 | 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(), {
|
256 | text: "",
|
257 | token: null,
|
258 | line: this.yylineno
|
259 | });
|
260 | }
|
261 | return this;
|
262 | },
|
263 |
|
264 | less: function(n) {
|
265 | this.unput(this.match.slice(n));
|
266 | },
|
267 |
|
268 | pastInput: function() {
|
269 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
270 | return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
271 | },
|
272 |
|
273 | upcomingInput: function() {
|
274 | var next = this.match;
|
275 | if (next.length < 20) {
|
276 | next += this._input.substr(0, 20 - next.length);
|
277 | }
|
278 | return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
279 | },
|
280 |
|
281 | showPosition: function() {
|
282 | var pre = this.pastInput();
|
283 | var c = new Array(pre.length + 1).join("-");
|
284 | return pre + this.upcomingInput() + "\n" + c + "^";
|
285 | },
|
286 |
|
287 | test_match: function(match, indexed_rule) {
|
288 | var token, lines, backup;
|
289 | if (this.options.backtrack_lexer) {
|
290 | backup = {
|
291 | yylineno: this.yylineno,
|
292 | yylloc: {
|
293 | first_line: this.yylloc.first_line,
|
294 | last_line: this.last_line,
|
295 | first_column: this.yylloc.first_column,
|
296 | last_column: this.yylloc.last_column
|
297 | },
|
298 | yytext: this.yytext,
|
299 | match: this.match,
|
300 | matches: this.matches,
|
301 | matched: this.matched,
|
302 | yyleng: this.yyleng,
|
303 | offset: this.offset,
|
304 | _more: this._more,
|
305 | _input: this._input,
|
306 | yy: this.yy,
|
307 | conditionStack: this.conditionStack.slice(0),
|
308 | done: this.done
|
309 | };
|
310 | if (this.options.ranges) {
|
311 | backup.yylloc.range = this.yylloc.range.slice(0);
|
312 | }
|
313 | }
|
314 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
315 | if (lines) {
|
316 | this.yylineno += lines.length;
|
317 | }
|
318 | this.yylloc = {
|
319 | first_line: this.yylloc.last_line,
|
320 | last_line: this.yylineno + 1,
|
321 | first_column: this.yylloc.last_column,
|
322 | last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
323 | };
|
324 | this.yytext += match[0];
|
325 | this.match += match[0];
|
326 | this.matches = match;
|
327 | this.yyleng = this.yytext.length;
|
328 | if (this.options.ranges) {
|
329 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
330 | }
|
331 | this._more = false;
|
332 | this._backtrack = false;
|
333 | this._input = this._input.slice(match[0].length);
|
334 | this.matched += match[0];
|
335 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
336 | if (this.done && this._input) {
|
337 | this.done = false;
|
338 | }
|
339 | if (token) {
|
340 | return token;
|
341 | } else if (this._backtrack) {
|
342 | for (var k in backup) {
|
343 | this[k] = backup[k];
|
344 | }
|
345 | return false;
|
346 | }
|
347 | return false;
|
348 | },
|
349 |
|
350 | next: function() {
|
351 | if (this.done) {
|
352 | return this.EOF;
|
353 | }
|
354 | if (!this._input) {
|
355 | this.done = true;
|
356 | }
|
357 | var token, match, tempMatch, index;
|
358 | if (!this._more) {
|
359 | this.yytext = "";
|
360 | this.match = "";
|
361 | }
|
362 | var rules = this._currentRules();
|
363 | for (var i = 0; i < rules.length; i++) {
|
364 | tempMatch = this._input.match(this.rules[rules[i]]);
|
365 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
366 | match = tempMatch;
|
367 | index = i;
|
368 | if (this.options.backtrack_lexer) {
|
369 | token = this.test_match(tempMatch, rules[i]);
|
370 | if (token !== false) {
|
371 | return token;
|
372 | } else if (this._backtrack) {
|
373 | match = false;
|
374 | continue;
|
375 | } else {
|
376 | return false;
|
377 | }
|
378 | } else if (!this.options.flex) {
|
379 | break;
|
380 | }
|
381 | }
|
382 | }
|
383 | if (match) {
|
384 | token = this.test_match(match, rules[index]);
|
385 | if (token !== false) {
|
386 | return token;
|
387 | }
|
388 | return false;
|
389 | }
|
390 | if (this._input === "") {
|
391 | return this.EOF;
|
392 | } else {
|
393 | return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
394 | text: "",
|
395 | token: null,
|
396 | line: this.yylineno
|
397 | });
|
398 | }
|
399 | },
|
400 |
|
401 | lex: function lex() {
|
402 | var r = this.next();
|
403 | if (r) {
|
404 | return r;
|
405 | } else {
|
406 | return this.lex();
|
407 | }
|
408 | },
|
409 |
|
410 | begin: function begin(condition) {
|
411 | this.conditionStack.push(condition);
|
412 | },
|
413 |
|
414 | popState: function popState() {
|
415 | var n = this.conditionStack.length - 1;
|
416 | if (n > 0) {
|
417 | return this.conditionStack.pop();
|
418 | } else {
|
419 | return this.conditionStack[0];
|
420 | }
|
421 | },
|
422 |
|
423 | _currentRules: function _currentRules() {
|
424 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
425 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
426 | } else {
|
427 | return this.conditions["INITIAL"].rules;
|
428 | }
|
429 | },
|
430 |
|
431 | topState: function topState(n) {
|
432 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
433 | if (n >= 0) {
|
434 | return this.conditionStack[n];
|
435 | } else {
|
436 | return "INITIAL";
|
437 | }
|
438 | },
|
439 |
|
440 | pushState: function pushState(condition) {
|
441 | this.begin(condition);
|
442 | },
|
443 |
|
444 | stateStackSize: function stateStackSize() {
|
445 | return this.conditionStack.length;
|
446 | },
|
447 | options: { "case-insensitive": true },
|
448 | performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
449 | switch ($avoiding_name_collisions) {
|
450 | case 0:
|
451 | return 4;
|
452 | case 1:
|
453 | return 9;
|
454 | case 2:
|
455 | return "space";
|
456 | case 3:
|
457 | return 10;
|
458 | case 4:
|
459 | return 6;
|
460 | case 5:
|
461 | return "TXT";
|
462 | }
|
463 | },
|
464 | rules: [/^(?:info\b)/i, /^(?:[\s\n\r]+)/i, /^(?:[\s]+)/i, /^(?:showInfo\b)/i, /^(?:$)/i, /^(?:.)/i],
|
465 | conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5], "inclusive": true } }
|
466 | };
|
467 | return lexer2;
|
468 | }();
|
469 | parser2.lexer = lexer;
|
470 | function Parser() {
|
471 | this.yy = {};
|
472 | }
|
473 | Parser.prototype = parser2;
|
474 | parser2.Parser = Parser;
|
475 | return new Parser();
|
476 | }();
|
477 | parser.parser = parser;
|
478 | const parser$1 = parser;
|
479 | const DEFAULT_INFO_DB = {
|
480 | info: false
|
481 | };
|
482 | let info = DEFAULT_INFO_DB.info;
|
483 | const setInfo = (toggle) => {
|
484 | info = toggle;
|
485 | };
|
486 | const getInfo = () => info;
|
487 | const clear = () => {
|
488 | info = DEFAULT_INFO_DB.info;
|
489 | };
|
490 | const db = {
|
491 | clear,
|
492 | setInfo,
|
493 | getInfo
|
494 | };
|
495 | const draw = (text, id, version) => {
|
496 | log.debug("rendering info diagram\n" + text);
|
497 | const svg = selectSvgElement(id);
|
498 | configureSvgSize(svg, 100, 400, true);
|
499 | const group = svg.append("g");
|
500 | group.append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${version}`);
|
501 | };
|
502 | const renderer = { draw };
|
503 | const diagram = {
|
504 | parser: parser$1,
|
505 | db,
|
506 | renderer
|
507 | };
|
508 | export {
|
509 | diagram
|
510 | };
|