gradio-leaderboard 0.0.12rc0__py3-none-any.whl → 0.0.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gradio_leaderboard/leaderboard.pyi +102 -72
- gradio_leaderboard/templates/component/Index-CzS_eGV6.js +34210 -0
- gradio_leaderboard/templates/component/_basePickBy-CPQEc5fh.js +151 -0
- gradio_leaderboard/templates/component/_baseUniq-DlEwemC3.js +615 -0
- gradio_leaderboard/templates/component/arc-4UNMf6Jv.js +83 -0
- gradio_leaderboard/templates/component/architectureDiagram-NQ2NVSRB-ClVp_eQQ.js +4629 -0
- gradio_leaderboard/templates/component/blockDiagram-PHRCVELO-CBZHEIQE.js +2255 -0
- gradio_leaderboard/templates/component/c4Diagram-6F6E4RAY-BcEP_NdH.js +1586 -0
- gradio_leaderboard/templates/component/channel-BK2Jce3b.js +5 -0
- gradio_leaderboard/templates/component/chunk-353BL4L5-D4dVjjbU.js +8 -0
- gradio_leaderboard/templates/component/chunk-67H74DCK-Dd9cOxfN.js +64 -0
- gradio_leaderboard/templates/component/chunk-6OLS64BW-CfumlcA2.js +1376 -0
- gradio_leaderboard/templates/component/chunk-AACKK3MU-4CpiDhxa.js +18 -0
- gradio_leaderboard/templates/component/chunk-BFAMUDN2-C6YyJRb4.js +8 -0
- gradio_leaderboard/templates/component/chunk-E2GYISFI-CbYUJnri.js +19 -0
- gradio_leaderboard/templates/component/chunk-QEP2MXWD-BYLoFCys.js +1380 -0
- gradio_leaderboard/templates/component/chunk-SKB7J2MH-DNiBnZKZ.js +19 -0
- gradio_leaderboard/templates/component/classDiagram-BGRH5UQR-BrG1RRX8.js +16 -0
- gradio_leaderboard/templates/component/classDiagram-v2-O24JOBDK-BrG1RRX8.js +16 -0
- gradio_leaderboard/templates/component/clone-BA6MvtJ3.js +8 -0
- gradio_leaderboard/templates/component/cytoscape.esm-Bdz5CrXX.js +18629 -0
- gradio_leaderboard/templates/component/dagre-FFZHY6LT-6RahWHGr.js +444 -0
- gradio_leaderboard/templates/component/defaultLocale-D7EN2tov.js +171 -0
- gradio_leaderboard/templates/component/diagram-3EMPZRKU-DtoOVTDy.js +526 -0
- gradio_leaderboard/templates/component/diagram-5UYTHUR4-MEp0H-U7.js +137 -0
- gradio_leaderboard/templates/component/diagram-ZTM2IBQH-22c5YuUh.js +217 -0
- gradio_leaderboard/templates/component/erDiagram-R3QVA2FD-DZp2MeDc.js +844 -0
- gradio_leaderboard/templates/component/flowDiagram-PKI6S5ZS-CfK9UZi3.js +1623 -0
- gradio_leaderboard/templates/component/ganttDiagram-EK5VF46D-waaD2Kup.js +2502 -0
- gradio_leaderboard/templates/component/gitGraphDiagram-GW3U2K7C-DJCAxNvz.js +699 -0
- gradio_leaderboard/templates/component/graph-CXm5uxKj.js +247 -0
- gradio_leaderboard/templates/component/index.js +2 -29469
- gradio_leaderboard/templates/component/infoDiagram-RLU2ROGC-_Rx9wF6U.js +24 -0
- gradio_leaderboard/templates/component/init-DjUOC4st.js +16 -0
- gradio_leaderboard/templates/component/journeyDiagram-EWQZEKCU-G-tt0noJ.js +836 -0
- gradio_leaderboard/templates/component/kanban-definition-ILFWEQ3N-2aHifLFR.js +718 -0
- gradio_leaderboard/templates/component/layout-DiZ88ySr.js +1324 -0
- gradio_leaderboard/templates/component/linear-D4M9Dm-w.js +259 -0
- gradio_leaderboard/templates/component/mermaid.core-D36e06XD.js +14941 -0
- gradio_leaderboard/templates/component/mindmap-definition-CZNETY7S-1Jow2c7r.js +3215 -0
- gradio_leaderboard/templates/component/ordinal-DfAQgscy.js +61 -0
- gradio_leaderboard/templates/component/pieDiagram-NIOCPIFQ-DU7jHSoi.js +162 -0
- gradio_leaderboard/templates/component/quadrantDiagram-2OG54O6I-GcojS_If.js +1028 -0
- gradio_leaderboard/templates/component/requirementDiagram-SO3GGRV7-CBRyajan.js +853 -0
- gradio_leaderboard/templates/component/sankeyDiagram-4UZDY2LN-CeZji6oR.js +820 -0
- gradio_leaderboard/templates/component/sequenceDiagram-ZIKVLSP4-DMygkr3Y.js +2284 -0
- gradio_leaderboard/templates/component/stateDiagram-XX37X6EN-DK2vsx2r.js +263 -0
- gradio_leaderboard/templates/component/stateDiagram-v2-GD6S3NHB-BoIkPrjk.js +16 -0
- gradio_leaderboard/templates/component/style.css +1 -1
- gradio_leaderboard/templates/component/timeline-definition-RI47OAVP-BQ_Jr8hZ.js +797 -0
- gradio_leaderboard/templates/component/treemap-FKARHQ26-2Ty0RcZX.js +12981 -0
- gradio_leaderboard/templates/component/xychartDiagram-H2YORKM3--C9dwTwV.js +1368 -0
- gradio_leaderboard/templates/example/index.js +201 -139
- {gradio_leaderboard-0.0.12rc0.dist-info → gradio_leaderboard-0.0.14.dist-info}/METADATA +3 -3
- gradio_leaderboard-0.0.14.dist-info/RECORD +59 -0
- {gradio_leaderboard-0.0.12rc0.dist-info → gradio_leaderboard-0.0.14.dist-info}/WHEEL +1 -1
- gradio_leaderboard/templates/component/__vite-browser-external-2447137e.js +0 -4
- gradio_leaderboard/templates/component/wrapper-6f348d45-19fa94bf.js +0 -2453
- gradio_leaderboard-0.0.12rc0.dist-info/RECORD +0 -12
@@ -0,0 +1,1376 @@
|
|
1
|
+
import { g as Zt } from "./chunk-BFAMUDN2-C6YyJRb4.js";
|
2
|
+
import { s as te } from "./chunk-SKB7J2MH-DNiBnZKZ.js";
|
3
|
+
import { _ as d, g as ee, s as se, b as ie, c as re, n as ae, o as ne, d as w, l as _, T as oe, e as U, t as le, z as ce, u as he } from "./mermaid.core-D36e06XD.js";
|
4
|
+
var kt = function() {
|
5
|
+
var t = /* @__PURE__ */ d(function(Y, a, c, r) {
|
6
|
+
for (c = c || {}, r = Y.length; r--; c[Y[r]] = a) ;
|
7
|
+
return c;
|
8
|
+
}, "o"), e = [1, 2], o = [1, 3], s = [1, 4], h = [2, 4], u = [1, 9], S = [1, 11], g = [1, 16], n = [1, 17], T = [1, 18], b = [1, 19], C = [1, 33], A = [1, 20], k = [1, 21], f = [1, 22], D = [1, 23], R = [1, 24], L = [1, 26], $ = [1, 27], I = [1, 28], P = [1, 29], et = [1, 30], st = [1, 31], it = [1, 32], rt = [1, 35], at = [1, 36], nt = [1, 37], ot = [1, 38], j = [1, 34], p = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], lt = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 39, 40, 41, 45, 48, 51, 52, 53, 54, 57], At = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], yt = {
|
9
|
+
trace: /* @__PURE__ */ d(function() {
|
10
|
+
}, "trace"),
|
11
|
+
yy: {},
|
12
|
+
symbols_: { error: 2, start: 3, SPACE: 4, NL: 5, SD: 6, document: 7, line: 8, statement: 9, classDefStatement: 10, styleStatement: 11, cssClassStatement: 12, idStatement: 13, DESCR: 14, "-->": 15, HIDE_EMPTY: 16, scale: 17, WIDTH: 18, COMPOSIT_STATE: 19, STRUCT_START: 20, STRUCT_STOP: 21, STATE_DESCR: 22, AS: 23, ID: 24, FORK: 25, JOIN: 26, CHOICE: 27, CONCURRENT: 28, note: 29, notePosition: 30, NOTE_TEXT: 31, direction: 32, acc_title: 33, acc_title_value: 34, acc_descr: 35, acc_descr_value: 36, acc_descr_multiline_value: 37, CLICK: 38, STRING: 39, HREF: 40, classDef: 41, CLASSDEF_ID: 42, CLASSDEF_STYLEOPTS: 43, DEFAULT: 44, style: 45, STYLE_IDS: 46, STYLEDEF_STYLEOPTS: 47, class: 48, CLASSENTITY_IDS: 49, STYLECLASS: 50, direction_tb: 51, direction_bt: 52, direction_rl: 53, direction_lr: 54, eol: 55, ";": 56, EDGE_STATE: 57, STYLE_SEPARATOR: 58, left_of: 59, right_of: 60, $accept: 0, $end: 1 },
|
13
|
+
terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "CLICK", 39: "STRING", 40: "HREF", 41: "classDef", 42: "CLASSDEF_ID", 43: "CLASSDEF_STYLEOPTS", 44: "DEFAULT", 45: "style", 46: "STYLE_IDS", 47: "STYLEDEF_STYLEOPTS", 48: "class", 49: "CLASSENTITY_IDS", 50: "STYLECLASS", 51: "direction_tb", 52: "direction_bt", 53: "direction_rl", 54: "direction_lr", 56: ";", 57: "EDGE_STATE", 58: "STYLE_SEPARATOR", 59: "left_of", 60: "right_of" },
|
14
|
+
productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [9, 5], [9, 5], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [55, 1], [55, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]],
|
15
|
+
performAction: /* @__PURE__ */ d(function(a, c, r, y, E, i, X) {
|
16
|
+
var l = i.length - 1;
|
17
|
+
switch (E) {
|
18
|
+
case 3:
|
19
|
+
return y.setRootDoc(i[l]), i[l];
|
20
|
+
case 4:
|
21
|
+
this.$ = [];
|
22
|
+
break;
|
23
|
+
case 5:
|
24
|
+
i[l] != "nl" && (i[l - 1].push(i[l]), this.$ = i[l - 1]);
|
25
|
+
break;
|
26
|
+
case 6:
|
27
|
+
case 7:
|
28
|
+
this.$ = i[l];
|
29
|
+
break;
|
30
|
+
case 8:
|
31
|
+
this.$ = "nl";
|
32
|
+
break;
|
33
|
+
case 12:
|
34
|
+
this.$ = i[l];
|
35
|
+
break;
|
36
|
+
case 13:
|
37
|
+
const J = i[l - 1];
|
38
|
+
J.description = y.trimColon(i[l]), this.$ = J;
|
39
|
+
break;
|
40
|
+
case 14:
|
41
|
+
this.$ = { stmt: "relation", state1: i[l - 2], state2: i[l] };
|
42
|
+
break;
|
43
|
+
case 15:
|
44
|
+
const gt = y.trimColon(i[l]);
|
45
|
+
this.$ = { stmt: "relation", state1: i[l - 3], state2: i[l - 1], description: gt };
|
46
|
+
break;
|
47
|
+
case 19:
|
48
|
+
this.$ = { stmt: "state", id: i[l - 3], type: "default", description: "", doc: i[l - 1] };
|
49
|
+
break;
|
50
|
+
case 20:
|
51
|
+
var B = i[l], H = i[l - 2].trim();
|
52
|
+
if (i[l].match(":")) {
|
53
|
+
var ht = i[l].split(":");
|
54
|
+
B = ht[0], H = [H, ht[1]];
|
55
|
+
}
|
56
|
+
this.$ = { stmt: "state", id: B, type: "default", description: H };
|
57
|
+
break;
|
58
|
+
case 21:
|
59
|
+
this.$ = { stmt: "state", id: i[l - 3], type: "default", description: i[l - 5], doc: i[l - 1] };
|
60
|
+
break;
|
61
|
+
case 22:
|
62
|
+
this.$ = { stmt: "state", id: i[l], type: "fork" };
|
63
|
+
break;
|
64
|
+
case 23:
|
65
|
+
this.$ = { stmt: "state", id: i[l], type: "join" };
|
66
|
+
break;
|
67
|
+
case 24:
|
68
|
+
this.$ = { stmt: "state", id: i[l], type: "choice" };
|
69
|
+
break;
|
70
|
+
case 25:
|
71
|
+
this.$ = { stmt: "state", id: y.getDividerId(), type: "divider" };
|
72
|
+
break;
|
73
|
+
case 26:
|
74
|
+
this.$ = { stmt: "state", id: i[l - 1].trim(), note: { position: i[l - 2].trim(), text: i[l].trim() } };
|
75
|
+
break;
|
76
|
+
case 29:
|
77
|
+
this.$ = i[l].trim(), y.setAccTitle(this.$);
|
78
|
+
break;
|
79
|
+
case 30:
|
80
|
+
case 31:
|
81
|
+
this.$ = i[l].trim(), y.setAccDescription(this.$);
|
82
|
+
break;
|
83
|
+
case 32:
|
84
|
+
this.$ = {
|
85
|
+
stmt: "click",
|
86
|
+
id: i[l - 3],
|
87
|
+
url: i[l - 2],
|
88
|
+
tooltip: i[l - 1]
|
89
|
+
};
|
90
|
+
break;
|
91
|
+
case 33:
|
92
|
+
this.$ = {
|
93
|
+
stmt: "click",
|
94
|
+
id: i[l - 3],
|
95
|
+
url: i[l - 1],
|
96
|
+
tooltip: ""
|
97
|
+
};
|
98
|
+
break;
|
99
|
+
case 34:
|
100
|
+
case 35:
|
101
|
+
this.$ = { stmt: "classDef", id: i[l - 1].trim(), classes: i[l].trim() };
|
102
|
+
break;
|
103
|
+
case 36:
|
104
|
+
this.$ = { stmt: "style", id: i[l - 1].trim(), styleClass: i[l].trim() };
|
105
|
+
break;
|
106
|
+
case 37:
|
107
|
+
this.$ = { stmt: "applyClass", id: i[l - 1].trim(), styleClass: i[l].trim() };
|
108
|
+
break;
|
109
|
+
case 38:
|
110
|
+
y.setDirection("TB"), this.$ = { stmt: "dir", value: "TB" };
|
111
|
+
break;
|
112
|
+
case 39:
|
113
|
+
y.setDirection("BT"), this.$ = { stmt: "dir", value: "BT" };
|
114
|
+
break;
|
115
|
+
case 40:
|
116
|
+
y.setDirection("RL"), this.$ = { stmt: "dir", value: "RL" };
|
117
|
+
break;
|
118
|
+
case 41:
|
119
|
+
y.setDirection("LR"), this.$ = { stmt: "dir", value: "LR" };
|
120
|
+
break;
|
121
|
+
case 44:
|
122
|
+
case 45:
|
123
|
+
this.$ = { stmt: "state", id: i[l].trim(), type: "default", description: "" };
|
124
|
+
break;
|
125
|
+
case 46:
|
126
|
+
this.$ = { stmt: "state", id: i[l - 2].trim(), classes: [i[l].trim()], type: "default", description: "" };
|
127
|
+
break;
|
128
|
+
case 47:
|
129
|
+
this.$ = { stmt: "state", id: i[l - 2].trim(), classes: [i[l].trim()], type: "default", description: "" };
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
}, "anonymous"),
|
133
|
+
table: [{ 3: 1, 4: e, 5: o, 6: s }, { 1: [3] }, { 3: 5, 4: e, 5: o, 6: s }, { 3: 6, 4: e, 5: o, 6: s }, t([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], h, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: u, 5: S, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 22: b, 24: C, 25: A, 26: k, 27: f, 28: D, 29: R, 32: 25, 33: L, 35: $, 37: I, 38: P, 41: et, 45: st, 48: it, 51: rt, 52: at, 53: nt, 54: ot, 57: j }, t(p, [2, 5]), { 9: 39, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 22: b, 24: C, 25: A, 26: k, 27: f, 28: D, 29: R, 32: 25, 33: L, 35: $, 37: I, 38: P, 41: et, 45: st, 48: it, 51: rt, 52: at, 53: nt, 54: ot, 57: j }, t(p, [2, 7]), t(p, [2, 8]), t(p, [2, 9]), t(p, [2, 10]), t(p, [2, 11]), t(p, [2, 12], { 14: [1, 40], 15: [1, 41] }), t(p, [2, 16]), { 18: [1, 42] }, t(p, [2, 18], { 20: [1, 43] }), { 23: [1, 44] }, t(p, [2, 22]), t(p, [2, 23]), t(p, [2, 24]), t(p, [2, 25]), { 30: 45, 31: [1, 46], 59: [1, 47], 60: [1, 48] }, t(p, [2, 28]), { 34: [1, 49] }, { 36: [1, 50] }, t(p, [2, 31]), { 13: 51, 24: C, 57: j }, { 42: [1, 52], 44: [1, 53] }, { 46: [1, 54] }, { 49: [1, 55] }, t(lt, [2, 44], { 58: [1, 56] }), t(lt, [2, 45], { 58: [1, 57] }), t(p, [2, 38]), t(p, [2, 39]), t(p, [2, 40]), t(p, [2, 41]), t(p, [2, 6]), t(p, [2, 13]), { 13: 58, 24: C, 57: j }, t(p, [2, 17]), t(At, h, { 7: 59 }), { 24: [1, 60] }, { 24: [1, 61] }, { 23: [1, 62] }, { 24: [2, 48] }, { 24: [2, 49] }, t(p, [2, 29]), t(p, [2, 30]), { 39: [1, 63], 40: [1, 64] }, { 43: [1, 65] }, { 43: [1, 66] }, { 47: [1, 67] }, { 50: [1, 68] }, { 24: [1, 69] }, { 24: [1, 70] }, t(p, [2, 14], { 14: [1, 71] }), { 4: u, 5: S, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 21: [1, 72], 22: b, 24: C, 25: A, 26: k, 27: f, 28: D, 29: R, 32: 25, 33: L, 35: $, 37: I, 38: P, 41: et, 45: st, 48: it, 51: rt, 52: at, 53: nt, 54: ot, 57: j }, t(p, [2, 20], { 20: [1, 73] }), { 31: [1, 74] }, { 24: [1, 75] }, { 39: [1, 76] }, { 39: [1, 77] }, t(p, [2, 34]), t(p, [2, 35]), t(p, [2, 36]), t(p, [2, 37]), t(lt, [2, 46]), t(lt, [2, 47]), t(p, [2, 15]), t(p, [2, 19]), t(At, h, { 7: 78 }), t(p, [2, 26]), t(p, [2, 27]), { 5: [1, 79] }, { 5: [1, 80] }, { 4: u, 5: S, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 21: [1, 81], 22: b, 24: C, 25: A, 26: k, 27: f, 28: D, 29: R, 32: 25, 33: L, 35: $, 37: I, 38: P, 41: et, 45: st, 48: it, 51: rt, 52: at, 53: nt, 54: ot, 57: j }, t(p, [2, 32]), t(p, [2, 33]), t(p, [2, 21])],
|
134
|
+
defaultActions: { 5: [2, 1], 6: [2, 2], 47: [2, 48], 48: [2, 49] },
|
135
|
+
parseError: /* @__PURE__ */ d(function(a, c) {
|
136
|
+
if (c.recoverable)
|
137
|
+
this.trace(a);
|
138
|
+
else {
|
139
|
+
var r = new Error(a);
|
140
|
+
throw r.hash = c, r;
|
141
|
+
}
|
142
|
+
}, "parseError"),
|
143
|
+
parse: /* @__PURE__ */ d(function(a) {
|
144
|
+
var c = this, r = [0], y = [], E = [null], i = [], X = this.table, l = "", B = 0, H = 0, ht = 2, J = 1, gt = i.slice.call(arguments, 1), m = Object.create(this.lexer), V = { yy: {} };
|
145
|
+
for (var Tt in this.yy)
|
146
|
+
Object.prototype.hasOwnProperty.call(this.yy, Tt) && (V.yy[Tt] = this.yy[Tt]);
|
147
|
+
m.setInput(a, V.yy), V.yy.lexer = m, V.yy.parser = this, typeof m.yylloc > "u" && (m.yylloc = {});
|
148
|
+
var Et = m.yylloc;
|
149
|
+
i.push(Et);
|
150
|
+
var qt = m.options && m.options.ranges;
|
151
|
+
typeof V.yy.parseError == "function" ? this.parseError = V.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
|
152
|
+
function Qt(O) {
|
153
|
+
r.length = r.length - 2 * O, E.length = E.length - O, i.length = i.length - O;
|
154
|
+
}
|
155
|
+
d(Qt, "popStack");
|
156
|
+
function xt() {
|
157
|
+
var O;
|
158
|
+
return O = y.pop() || m.lex() || J, typeof O != "number" && (O instanceof Array && (y = O, O = y.pop()), O = c.symbols_[O] || O), O;
|
159
|
+
}
|
160
|
+
d(xt, "lex");
|
161
|
+
for (var x, M, N, _t, z = {}, ut, F, Lt, dt; ; ) {
|
162
|
+
if (M = r[r.length - 1], this.defaultActions[M] ? N = this.defaultActions[M] : ((x === null || typeof x > "u") && (x = xt()), N = X[M] && X[M][x]), typeof N > "u" || !N.length || !N[0]) {
|
163
|
+
var mt = "";
|
164
|
+
dt = [];
|
165
|
+
for (ut in X[M])
|
166
|
+
this.terminals_[ut] && ut > ht && dt.push("'" + this.terminals_[ut] + "'");
|
167
|
+
m.showPosition ? mt = "Parse error on line " + (B + 1) + `:
|
168
|
+
` + m.showPosition() + `
|
169
|
+
Expecting ` + dt.join(", ") + ", got '" + (this.terminals_[x] || x) + "'" : mt = "Parse error on line " + (B + 1) + ": Unexpected " + (x == J ? "end of input" : "'" + (this.terminals_[x] || x) + "'"), this.parseError(mt, {
|
170
|
+
text: m.match,
|
171
|
+
token: this.terminals_[x] || x,
|
172
|
+
line: m.yylineno,
|
173
|
+
loc: Et,
|
174
|
+
expected: dt
|
175
|
+
});
|
176
|
+
}
|
177
|
+
if (N[0] instanceof Array && N.length > 1)
|
178
|
+
throw new Error("Parse Error: multiple actions possible at state: " + M + ", token: " + x);
|
179
|
+
switch (N[0]) {
|
180
|
+
case 1:
|
181
|
+
r.push(x), E.push(m.yytext), i.push(m.yylloc), r.push(N[1]), x = null, H = m.yyleng, l = m.yytext, B = m.yylineno, Et = m.yylloc;
|
182
|
+
break;
|
183
|
+
case 2:
|
184
|
+
if (F = this.productions_[N[1]][1], z.$ = E[E.length - F], z._$ = {
|
185
|
+
first_line: i[i.length - (F || 1)].first_line,
|
186
|
+
last_line: i[i.length - 1].last_line,
|
187
|
+
first_column: i[i.length - (F || 1)].first_column,
|
188
|
+
last_column: i[i.length - 1].last_column
|
189
|
+
}, qt && (z._$.range = [
|
190
|
+
i[i.length - (F || 1)].range[0],
|
191
|
+
i[i.length - 1].range[1]
|
192
|
+
]), _t = this.performAction.apply(z, [
|
193
|
+
l,
|
194
|
+
H,
|
195
|
+
B,
|
196
|
+
V.yy,
|
197
|
+
N[1],
|
198
|
+
E,
|
199
|
+
i
|
200
|
+
].concat(gt)), typeof _t < "u")
|
201
|
+
return _t;
|
202
|
+
F && (r = r.slice(0, -1 * F * 2), E = E.slice(0, -1 * F), i = i.slice(0, -1 * F)), r.push(this.productions_[N[1]][0]), E.push(z.$), i.push(z._$), Lt = X[r[r.length - 2]][r[r.length - 1]], r.push(Lt);
|
203
|
+
break;
|
204
|
+
case 3:
|
205
|
+
return !0;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
return !0;
|
209
|
+
}, "parse")
|
210
|
+
}, Jt = /* @__PURE__ */ function() {
|
211
|
+
var Y = {
|
212
|
+
EOF: 1,
|
213
|
+
parseError: /* @__PURE__ */ d(function(c, r) {
|
214
|
+
if (this.yy.parser)
|
215
|
+
this.yy.parser.parseError(c, r);
|
216
|
+
else
|
217
|
+
throw new Error(c);
|
218
|
+
}, "parseError"),
|
219
|
+
// resets the lexer, sets new input
|
220
|
+
setInput: /* @__PURE__ */ d(function(a, c) {
|
221
|
+
return this.yy = c || this.yy || {}, this._input = a, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
|
222
|
+
first_line: 1,
|
223
|
+
first_column: 0,
|
224
|
+
last_line: 1,
|
225
|
+
last_column: 0
|
226
|
+
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
|
227
|
+
}, "setInput"),
|
228
|
+
// consumes and returns one char from the input
|
229
|
+
input: /* @__PURE__ */ d(function() {
|
230
|
+
var a = this._input[0];
|
231
|
+
this.yytext += a, this.yyleng++, this.offset++, this.match += a, this.matched += a;
|
232
|
+
var c = a.match(/(?:\r\n?|\n).*/g);
|
233
|
+
return c ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), a;
|
234
|
+
}, "input"),
|
235
|
+
// unshifts one char (or a string) into the input
|
236
|
+
unput: /* @__PURE__ */ d(function(a) {
|
237
|
+
var c = a.length, r = a.split(/(?:\r\n?|\n)/g);
|
238
|
+
this._input = a + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - c), this.offset -= c;
|
239
|
+
var y = this.match.split(/(?:\r\n?|\n)/g);
|
240
|
+
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), r.length - 1 && (this.yylineno -= r.length - 1);
|
241
|
+
var E = this.yylloc.range;
|
242
|
+
return this.yylloc = {
|
243
|
+
first_line: this.yylloc.first_line,
|
244
|
+
last_line: this.yylineno + 1,
|
245
|
+
first_column: this.yylloc.first_column,
|
246
|
+
last_column: r ? (r.length === y.length ? this.yylloc.first_column : 0) + y[y.length - r.length].length - r[0].length : this.yylloc.first_column - c
|
247
|
+
}, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - c]), this.yyleng = this.yytext.length, this;
|
248
|
+
}, "unput"),
|
249
|
+
// When called from action, caches matched text and appends it on next action
|
250
|
+
more: /* @__PURE__ */ d(function() {
|
251
|
+
return this._more = !0, this;
|
252
|
+
}, "more"),
|
253
|
+
// 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.
|
254
|
+
reject: /* @__PURE__ */ d(function() {
|
255
|
+
if (this.options.backtrack_lexer)
|
256
|
+
this._backtrack = !0;
|
257
|
+
else
|
258
|
+
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).
|
259
|
+
` + this.showPosition(), {
|
260
|
+
text: "",
|
261
|
+
token: null,
|
262
|
+
line: this.yylineno
|
263
|
+
});
|
264
|
+
return this;
|
265
|
+
}, "reject"),
|
266
|
+
// retain first n characters of the match
|
267
|
+
less: /* @__PURE__ */ d(function(a) {
|
268
|
+
this.unput(this.match.slice(a));
|
269
|
+
}, "less"),
|
270
|
+
// displays already matched input, i.e. for error messages
|
271
|
+
pastInput: /* @__PURE__ */ d(function() {
|
272
|
+
var a = this.matched.substr(0, this.matched.length - this.match.length);
|
273
|
+
return (a.length > 20 ? "..." : "") + a.substr(-20).replace(/\n/g, "");
|
274
|
+
}, "pastInput"),
|
275
|
+
// displays upcoming input, i.e. for error messages
|
276
|
+
upcomingInput: /* @__PURE__ */ d(function() {
|
277
|
+
var a = this.match;
|
278
|
+
return a.length < 20 && (a += this._input.substr(0, 20 - a.length)), (a.substr(0, 20) + (a.length > 20 ? "..." : "")).replace(/\n/g, "");
|
279
|
+
}, "upcomingInput"),
|
280
|
+
// displays the character position where the lexing error occurred, i.e. for error messages
|
281
|
+
showPosition: /* @__PURE__ */ d(function() {
|
282
|
+
var a = this.pastInput(), c = new Array(a.length + 1).join("-");
|
283
|
+
return a + this.upcomingInput() + `
|
284
|
+
` + c + "^";
|
285
|
+
}, "showPosition"),
|
286
|
+
// test the lexed token: return FALSE when not a match, otherwise return token
|
287
|
+
test_match: /* @__PURE__ */ d(function(a, c) {
|
288
|
+
var r, y, E;
|
289
|
+
if (this.options.backtrack_lexer && (E = {
|
290
|
+
yylineno: this.yylineno,
|
291
|
+
yylloc: {
|
292
|
+
first_line: this.yylloc.first_line,
|
293
|
+
last_line: this.last_line,
|
294
|
+
first_column: this.yylloc.first_column,
|
295
|
+
last_column: this.yylloc.last_column
|
296
|
+
},
|
297
|
+
yytext: this.yytext,
|
298
|
+
match: this.match,
|
299
|
+
matches: this.matches,
|
300
|
+
matched: this.matched,
|
301
|
+
yyleng: this.yyleng,
|
302
|
+
offset: this.offset,
|
303
|
+
_more: this._more,
|
304
|
+
_input: this._input,
|
305
|
+
yy: this.yy,
|
306
|
+
conditionStack: this.conditionStack.slice(0),
|
307
|
+
done: this.done
|
308
|
+
}, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), y = a[0].match(/(?:\r\n?|\n).*/g), y && (this.yylineno += y.length), this.yylloc = {
|
309
|
+
first_line: this.yylloc.last_line,
|
310
|
+
last_line: this.yylineno + 1,
|
311
|
+
first_column: this.yylloc.last_column,
|
312
|
+
last_column: y ? y[y.length - 1].length - y[y.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + a[0].length
|
313
|
+
}, this.yytext += a[0], this.match += a[0], this.matches = a, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(a[0].length), this.matched += a[0], r = this.performAction.call(this, this.yy, this, c, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), r)
|
314
|
+
return r;
|
315
|
+
if (this._backtrack) {
|
316
|
+
for (var i in E)
|
317
|
+
this[i] = E[i];
|
318
|
+
return !1;
|
319
|
+
}
|
320
|
+
return !1;
|
321
|
+
}, "test_match"),
|
322
|
+
// return next match in input
|
323
|
+
next: /* @__PURE__ */ d(function() {
|
324
|
+
if (this.done)
|
325
|
+
return this.EOF;
|
326
|
+
this._input || (this.done = !0);
|
327
|
+
var a, c, r, y;
|
328
|
+
this._more || (this.yytext = "", this.match = "");
|
329
|
+
for (var E = this._currentRules(), i = 0; i < E.length; i++)
|
330
|
+
if (r = this._input.match(this.rules[E[i]]), r && (!c || r[0].length > c[0].length)) {
|
331
|
+
if (c = r, y = i, this.options.backtrack_lexer) {
|
332
|
+
if (a = this.test_match(r, E[i]), a !== !1)
|
333
|
+
return a;
|
334
|
+
if (this._backtrack) {
|
335
|
+
c = !1;
|
336
|
+
continue;
|
337
|
+
} else
|
338
|
+
return !1;
|
339
|
+
} else if (!this.options.flex)
|
340
|
+
break;
|
341
|
+
}
|
342
|
+
return c ? (a = this.test_match(c, E[y]), a !== !1 ? a : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
|
343
|
+
` + this.showPosition(), {
|
344
|
+
text: "",
|
345
|
+
token: null,
|
346
|
+
line: this.yylineno
|
347
|
+
});
|
348
|
+
}, "next"),
|
349
|
+
// return next match that has a token
|
350
|
+
lex: /* @__PURE__ */ d(function() {
|
351
|
+
var c = this.next();
|
352
|
+
return c || this.lex();
|
353
|
+
}, "lex"),
|
354
|
+
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
355
|
+
begin: /* @__PURE__ */ d(function(c) {
|
356
|
+
this.conditionStack.push(c);
|
357
|
+
}, "begin"),
|
358
|
+
// pop the previously active lexer condition state off the condition stack
|
359
|
+
popState: /* @__PURE__ */ d(function() {
|
360
|
+
var c = this.conditionStack.length - 1;
|
361
|
+
return c > 0 ? this.conditionStack.pop() : this.conditionStack[0];
|
362
|
+
}, "popState"),
|
363
|
+
// produce the lexer rule set which is active for the currently active lexer condition state
|
364
|
+
_currentRules: /* @__PURE__ */ d(function() {
|
365
|
+
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
|
366
|
+
}, "_currentRules"),
|
367
|
+
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
368
|
+
topState: /* @__PURE__ */ d(function(c) {
|
369
|
+
return c = this.conditionStack.length - 1 - Math.abs(c || 0), c >= 0 ? this.conditionStack[c] : "INITIAL";
|
370
|
+
}, "topState"),
|
371
|
+
// alias for begin(condition)
|
372
|
+
pushState: /* @__PURE__ */ d(function(c) {
|
373
|
+
this.begin(c);
|
374
|
+
}, "pushState"),
|
375
|
+
// return the number of states currently on the stack
|
376
|
+
stateStackSize: /* @__PURE__ */ d(function() {
|
377
|
+
return this.conditionStack.length;
|
378
|
+
}, "stateStackSize"),
|
379
|
+
options: { "case-insensitive": !0 },
|
380
|
+
performAction: /* @__PURE__ */ d(function(c, r, y, E) {
|
381
|
+
switch (y) {
|
382
|
+
case 0:
|
383
|
+
return 38;
|
384
|
+
case 1:
|
385
|
+
return 40;
|
386
|
+
case 2:
|
387
|
+
return 39;
|
388
|
+
case 3:
|
389
|
+
return 44;
|
390
|
+
case 4:
|
391
|
+
return 51;
|
392
|
+
case 5:
|
393
|
+
return 52;
|
394
|
+
case 6:
|
395
|
+
return 53;
|
396
|
+
case 7:
|
397
|
+
return 54;
|
398
|
+
case 8:
|
399
|
+
break;
|
400
|
+
case 9:
|
401
|
+
break;
|
402
|
+
case 10:
|
403
|
+
return 5;
|
404
|
+
case 11:
|
405
|
+
break;
|
406
|
+
case 12:
|
407
|
+
break;
|
408
|
+
case 13:
|
409
|
+
break;
|
410
|
+
case 14:
|
411
|
+
break;
|
412
|
+
case 15:
|
413
|
+
return this.pushState("SCALE"), 17;
|
414
|
+
case 16:
|
415
|
+
return 18;
|
416
|
+
case 17:
|
417
|
+
this.popState();
|
418
|
+
break;
|
419
|
+
case 18:
|
420
|
+
return this.begin("acc_title"), 33;
|
421
|
+
case 19:
|
422
|
+
return this.popState(), "acc_title_value";
|
423
|
+
case 20:
|
424
|
+
return this.begin("acc_descr"), 35;
|
425
|
+
case 21:
|
426
|
+
return this.popState(), "acc_descr_value";
|
427
|
+
case 22:
|
428
|
+
this.begin("acc_descr_multiline");
|
429
|
+
break;
|
430
|
+
case 23:
|
431
|
+
this.popState();
|
432
|
+
break;
|
433
|
+
case 24:
|
434
|
+
return "acc_descr_multiline_value";
|
435
|
+
case 25:
|
436
|
+
return this.pushState("CLASSDEF"), 41;
|
437
|
+
case 26:
|
438
|
+
return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
|
439
|
+
case 27:
|
440
|
+
return this.popState(), this.pushState("CLASSDEFID"), 42;
|
441
|
+
case 28:
|
442
|
+
return this.popState(), 43;
|
443
|
+
case 29:
|
444
|
+
return this.pushState("CLASS"), 48;
|
445
|
+
case 30:
|
446
|
+
return this.popState(), this.pushState("CLASS_STYLE"), 49;
|
447
|
+
case 31:
|
448
|
+
return this.popState(), 50;
|
449
|
+
case 32:
|
450
|
+
return this.pushState("STYLE"), 45;
|
451
|
+
case 33:
|
452
|
+
return this.popState(), this.pushState("STYLEDEF_STYLES"), 46;
|
453
|
+
case 34:
|
454
|
+
return this.popState(), 47;
|
455
|
+
case 35:
|
456
|
+
return this.pushState("SCALE"), 17;
|
457
|
+
case 36:
|
458
|
+
return 18;
|
459
|
+
case 37:
|
460
|
+
this.popState();
|
461
|
+
break;
|
462
|
+
case 38:
|
463
|
+
this.pushState("STATE");
|
464
|
+
break;
|
465
|
+
case 39:
|
466
|
+
return this.popState(), r.yytext = r.yytext.slice(0, -8).trim(), 25;
|
467
|
+
case 40:
|
468
|
+
return this.popState(), r.yytext = r.yytext.slice(0, -8).trim(), 26;
|
469
|
+
case 41:
|
470
|
+
return this.popState(), r.yytext = r.yytext.slice(0, -10).trim(), 27;
|
471
|
+
case 42:
|
472
|
+
return this.popState(), r.yytext = r.yytext.slice(0, -8).trim(), 25;
|
473
|
+
case 43:
|
474
|
+
return this.popState(), r.yytext = r.yytext.slice(0, -8).trim(), 26;
|
475
|
+
case 44:
|
476
|
+
return this.popState(), r.yytext = r.yytext.slice(0, -10).trim(), 27;
|
477
|
+
case 45:
|
478
|
+
return 51;
|
479
|
+
case 46:
|
480
|
+
return 52;
|
481
|
+
case 47:
|
482
|
+
return 53;
|
483
|
+
case 48:
|
484
|
+
return 54;
|
485
|
+
case 49:
|
486
|
+
this.pushState("STATE_STRING");
|
487
|
+
break;
|
488
|
+
case 50:
|
489
|
+
return this.pushState("STATE_ID"), "AS";
|
490
|
+
case 51:
|
491
|
+
return this.popState(), "ID";
|
492
|
+
case 52:
|
493
|
+
this.popState();
|
494
|
+
break;
|
495
|
+
case 53:
|
496
|
+
return "STATE_DESCR";
|
497
|
+
case 54:
|
498
|
+
return 19;
|
499
|
+
case 55:
|
500
|
+
this.popState();
|
501
|
+
break;
|
502
|
+
case 56:
|
503
|
+
return this.popState(), this.pushState("struct"), 20;
|
504
|
+
case 57:
|
505
|
+
break;
|
506
|
+
case 58:
|
507
|
+
return this.popState(), 21;
|
508
|
+
case 59:
|
509
|
+
break;
|
510
|
+
case 60:
|
511
|
+
return this.begin("NOTE"), 29;
|
512
|
+
case 61:
|
513
|
+
return this.popState(), this.pushState("NOTE_ID"), 59;
|
514
|
+
case 62:
|
515
|
+
return this.popState(), this.pushState("NOTE_ID"), 60;
|
516
|
+
case 63:
|
517
|
+
this.popState(), this.pushState("FLOATING_NOTE");
|
518
|
+
break;
|
519
|
+
case 64:
|
520
|
+
return this.popState(), this.pushState("FLOATING_NOTE_ID"), "AS";
|
521
|
+
case 65:
|
522
|
+
break;
|
523
|
+
case 66:
|
524
|
+
return "NOTE_TEXT";
|
525
|
+
case 67:
|
526
|
+
return this.popState(), "ID";
|
527
|
+
case 68:
|
528
|
+
return this.popState(), this.pushState("NOTE_TEXT"), 24;
|
529
|
+
case 69:
|
530
|
+
return this.popState(), r.yytext = r.yytext.substr(2).trim(), 31;
|
531
|
+
case 70:
|
532
|
+
return this.popState(), r.yytext = r.yytext.slice(0, -8).trim(), 31;
|
533
|
+
case 71:
|
534
|
+
return 6;
|
535
|
+
case 72:
|
536
|
+
return 6;
|
537
|
+
case 73:
|
538
|
+
return 16;
|
539
|
+
case 74:
|
540
|
+
return 57;
|
541
|
+
case 75:
|
542
|
+
return 24;
|
543
|
+
case 76:
|
544
|
+
return r.yytext = r.yytext.trim(), 14;
|
545
|
+
case 77:
|
546
|
+
return 15;
|
547
|
+
case 78:
|
548
|
+
return 28;
|
549
|
+
case 79:
|
550
|
+
return 58;
|
551
|
+
case 80:
|
552
|
+
return 5;
|
553
|
+
case 81:
|
554
|
+
return "INVALID";
|
555
|
+
}
|
556
|
+
}, "anonymous"),
|
557
|
+
rules: [/^(?:click\b)/i, /^(?:href\b)/i, /^(?:"[^"]*")/i, /^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<<fork>>)/i, /^(?:.*<<join>>)/i, /^(?:.*<<choice>>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i],
|
558
|
+
conditions: { LINE: { rules: [12, 13], inclusive: !1 }, struct: { rules: [12, 13, 25, 29, 32, 38, 45, 46, 47, 48, 57, 58, 59, 60, 74, 75, 76, 77, 78], inclusive: !1 }, FLOATING_NOTE_ID: { rules: [67], inclusive: !1 }, FLOATING_NOTE: { rules: [64, 65, 66], inclusive: !1 }, NOTE_TEXT: { rules: [69, 70], inclusive: !1 }, NOTE_ID: { rules: [68], inclusive: !1 }, NOTE: { rules: [61, 62, 63], inclusive: !1 }, STYLEDEF_STYLEOPTS: { rules: [], inclusive: !1 }, STYLEDEF_STYLES: { rules: [34], inclusive: !1 }, STYLE_IDS: { rules: [], inclusive: !1 }, STYLE: { rules: [33], inclusive: !1 }, CLASS_STYLE: { rules: [31], inclusive: !1 }, CLASS: { rules: [30], inclusive: !1 }, CLASSDEFID: { rules: [28], inclusive: !1 }, CLASSDEF: { rules: [26, 27], inclusive: !1 }, acc_descr_multiline: { rules: [23, 24], inclusive: !1 }, acc_descr: { rules: [21], inclusive: !1 }, acc_title: { rules: [19], inclusive: !1 }, SCALE: { rules: [16, 17, 36, 37], inclusive: !1 }, ALIAS: { rules: [], inclusive: !1 }, STATE_ID: { rules: [51], inclusive: !1 }, STATE_STRING: { rules: [52, 53], inclusive: !1 }, FORK_STATE: { rules: [], inclusive: !1 }, STATE: { rules: [12, 13, 39, 40, 41, 42, 43, 44, 49, 50, 54, 55, 56], inclusive: !1 }, ID: { rules: [12, 13], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 18, 20, 22, 25, 29, 32, 35, 38, 56, 60, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81], inclusive: !0 } }
|
559
|
+
};
|
560
|
+
return Y;
|
561
|
+
}();
|
562
|
+
yt.lexer = Jt;
|
563
|
+
function ct() {
|
564
|
+
this.yy = {};
|
565
|
+
}
|
566
|
+
return d(ct, "Parser"), ct.prototype = yt, yt.Parser = ct, new ct();
|
567
|
+
}();
|
568
|
+
kt.parser = kt;
|
569
|
+
var Ge = kt, ue = "TB", Ft = "TB", It = "dir", K = "state", W = "root", vt = "relation", de = "classDef", fe = "style", pe = "applyClass", Z = "default", Yt = "divider", Gt = "fill:none", Bt = "fill: #333", Vt = "c", Mt = "text", Ut = "normal", bt = "rect", Dt = "rectWithTitle", Se = "stateStart", ye = "stateEnd", Ot = "divider", Rt = "roundedWithTitle", ge = "note", Te = "noteGroup", tt = "statediagram", Ee = "state", _e = `${tt}-${Ee}`, jt = "transition", me = "note", be = "note-edge", De = `${jt} ${be}`, ke = `${tt}-${me}`, ve = "cluster", Ce = `${tt}-${ve}`, Ae = "cluster-alt", xe = `${tt}-${Ae}`, Ht = "parent", zt = "note", Le = "state", Ct = "----", Ie = `${Ct}${zt}`, Nt = `${Ct}${Ht}`, Wt = /* @__PURE__ */ d((t, e = Ft) => {
|
570
|
+
if (!t.doc)
|
571
|
+
return e;
|
572
|
+
let o = e;
|
573
|
+
for (const s of t.doc)
|
574
|
+
s.stmt === "dir" && (o = s.value);
|
575
|
+
return o;
|
576
|
+
}, "getDir"), Oe = /* @__PURE__ */ d(function(t, e) {
|
577
|
+
return e.db.getClasses();
|
578
|
+
}, "getClasses"), Re = /* @__PURE__ */ d(async function(t, e, o, s) {
|
579
|
+
_.info("REF0:"), _.info("Drawing state diagram (v2)", e);
|
580
|
+
const { securityLevel: h, state: u, layout: S } = w();
|
581
|
+
s.db.extract(s.db.getRootDocV2());
|
582
|
+
const g = s.db.getData(), n = Zt(e, h);
|
583
|
+
g.type = s.type, g.layoutAlgorithm = S, g.nodeSpacing = u?.nodeSpacing || 50, g.rankSpacing = u?.rankSpacing || 50, g.markers = ["barb"], g.diagramId = e, await ce(g, n);
|
584
|
+
const T = 8;
|
585
|
+
try {
|
586
|
+
(typeof s.db.getLinks == "function" ? s.db.getLinks() : /* @__PURE__ */ new Map()).forEach((C, A) => {
|
587
|
+
const k = typeof A == "string" ? A : typeof A?.id == "string" ? A.id : "";
|
588
|
+
if (!k) {
|
589
|
+
_.warn("⚠️ Invalid or missing stateId from key:", JSON.stringify(A));
|
590
|
+
return;
|
591
|
+
}
|
592
|
+
const f = n.node()?.querySelectorAll("g");
|
593
|
+
let D;
|
594
|
+
if (f?.forEach((I) => {
|
595
|
+
I.textContent?.trim() === k && (D = I);
|
596
|
+
}), !D) {
|
597
|
+
_.warn("⚠️ Could not find node matching text:", k);
|
598
|
+
return;
|
599
|
+
}
|
600
|
+
const R = D.parentNode;
|
601
|
+
if (!R) {
|
602
|
+
_.warn("⚠️ Node has no parent, cannot wrap:", k);
|
603
|
+
return;
|
604
|
+
}
|
605
|
+
const L = document.createElementNS("http://www.w3.org/2000/svg", "a"), $ = C.url.replace(/^"+|"+$/g, "");
|
606
|
+
if (L.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", $), L.setAttribute("target", "_blank"), C.tooltip) {
|
607
|
+
const I = C.tooltip.replace(/^"+|"+$/g, "");
|
608
|
+
L.setAttribute("title", I);
|
609
|
+
}
|
610
|
+
R.replaceChild(L, D), L.appendChild(D), _.info("🔗 Wrapped node in <a> tag for:", k, C.url);
|
611
|
+
});
|
612
|
+
} catch (b) {
|
613
|
+
_.error("❌ Error injecting clickable links:", b);
|
614
|
+
}
|
615
|
+
he.insertTitle(
|
616
|
+
n,
|
617
|
+
"statediagramTitleText",
|
618
|
+
u?.titleTopMargin ?? 25,
|
619
|
+
s.db.getDiagramTitle()
|
620
|
+
), te(n, T, tt, u?.useMaxWidth ?? !0);
|
621
|
+
}, "draw"), Be = {
|
622
|
+
getClasses: Oe,
|
623
|
+
draw: Re,
|
624
|
+
getDir: Wt
|
625
|
+
}, pt = /* @__PURE__ */ new Map(), G = 0;
|
626
|
+
function St(t = "", e = 0, o = "", s = Ct) {
|
627
|
+
const h = o !== null && o.length > 0 ? `${s}${o}` : "";
|
628
|
+
return `${Le}-${t}${h}-${e}`;
|
629
|
+
}
|
630
|
+
d(St, "stateDomId");
|
631
|
+
var Ne = /* @__PURE__ */ d((t, e, o, s, h, u, S, g) => {
|
632
|
+
_.trace("items", e), e.forEach((n) => {
|
633
|
+
switch (n.stmt) {
|
634
|
+
case K:
|
635
|
+
Q(t, n, o, s, h, u, S, g);
|
636
|
+
break;
|
637
|
+
case Z:
|
638
|
+
Q(t, n, o, s, h, u, S, g);
|
639
|
+
break;
|
640
|
+
case vt:
|
641
|
+
{
|
642
|
+
Q(
|
643
|
+
t,
|
644
|
+
n.state1,
|
645
|
+
o,
|
646
|
+
s,
|
647
|
+
h,
|
648
|
+
u,
|
649
|
+
S,
|
650
|
+
g
|
651
|
+
), Q(
|
652
|
+
t,
|
653
|
+
n.state2,
|
654
|
+
o,
|
655
|
+
s,
|
656
|
+
h,
|
657
|
+
u,
|
658
|
+
S,
|
659
|
+
g
|
660
|
+
);
|
661
|
+
const T = {
|
662
|
+
id: "edge" + G,
|
663
|
+
start: n.state1.id,
|
664
|
+
end: n.state2.id,
|
665
|
+
arrowhead: "normal",
|
666
|
+
arrowTypeEnd: "arrow_barb",
|
667
|
+
style: Gt,
|
668
|
+
labelStyle: "",
|
669
|
+
label: U.sanitizeText(n.description ?? "", w()),
|
670
|
+
arrowheadStyle: Bt,
|
671
|
+
labelpos: Vt,
|
672
|
+
labelType: Mt,
|
673
|
+
thickness: Ut,
|
674
|
+
classes: jt,
|
675
|
+
look: S
|
676
|
+
};
|
677
|
+
h.push(T), G++;
|
678
|
+
}
|
679
|
+
break;
|
680
|
+
}
|
681
|
+
});
|
682
|
+
}, "setupDoc"), wt = /* @__PURE__ */ d((t, e = Ft) => {
|
683
|
+
let o = e;
|
684
|
+
if (t.doc)
|
685
|
+
for (const s of t.doc)
|
686
|
+
s.stmt === "dir" && (o = s.value);
|
687
|
+
return o;
|
688
|
+
}, "getDir");
|
689
|
+
function q(t, e, o) {
|
690
|
+
if (!e.id || e.id === "</join></fork>" || e.id === "</choice>")
|
691
|
+
return;
|
692
|
+
e.cssClasses && (Array.isArray(e.cssCompiledStyles) || (e.cssCompiledStyles = []), e.cssClasses.split(" ").forEach((h) => {
|
693
|
+
const u = o.get(h);
|
694
|
+
u && (e.cssCompiledStyles = [...e.cssCompiledStyles ?? [], ...u.styles]);
|
695
|
+
}));
|
696
|
+
const s = t.find((h) => h.id === e.id);
|
697
|
+
s ? Object.assign(s, e) : t.push(e);
|
698
|
+
}
|
699
|
+
d(q, "insertOrUpdateNode");
|
700
|
+
function Kt(t) {
|
701
|
+
return t?.classes?.join(" ") ?? "";
|
702
|
+
}
|
703
|
+
d(Kt, "getClassesFromDbInfo");
|
704
|
+
function Xt(t) {
|
705
|
+
return t?.styles ?? [];
|
706
|
+
}
|
707
|
+
d(Xt, "getStylesFromDbInfo");
|
708
|
+
var Q = /* @__PURE__ */ d((t, e, o, s, h, u, S, g) => {
|
709
|
+
const n = e.id, T = o.get(n), b = Kt(T), C = Xt(T), A = w();
|
710
|
+
if (_.info("dataFetcher parsedItem", e, T, C), n !== "root") {
|
711
|
+
let k = bt;
|
712
|
+
e.start === !0 ? k = Se : e.start === !1 && (k = ye), e.type !== Z && (k = e.type), pt.get(n) || pt.set(n, {
|
713
|
+
id: n,
|
714
|
+
shape: k,
|
715
|
+
description: U.sanitizeText(n, A),
|
716
|
+
cssClasses: `${b} ${_e}`,
|
717
|
+
cssStyles: C
|
718
|
+
});
|
719
|
+
const f = pt.get(n);
|
720
|
+
e.description && (Array.isArray(f.description) ? (f.shape = Dt, f.description.push(e.description)) : f.description?.length && f.description.length > 0 ? (f.shape = Dt, f.description === n ? f.description = [e.description] : f.description = [f.description, e.description]) : (f.shape = bt, f.description = e.description), f.description = U.sanitizeTextOrArray(f.description, A)), f.description?.length === 1 && f.shape === Dt && (f.type === "group" ? f.shape = Rt : f.shape = bt), !f.type && e.doc && (_.info("Setting cluster for XCX", n, wt(e)), f.type = "group", f.isGroup = !0, f.dir = wt(e), f.shape = e.type === Yt ? Ot : Rt, f.cssClasses = `${f.cssClasses} ${Ce} ${u ? xe : ""}`);
|
721
|
+
const D = {
|
722
|
+
labelStyle: "",
|
723
|
+
shape: f.shape,
|
724
|
+
label: f.description,
|
725
|
+
cssClasses: f.cssClasses,
|
726
|
+
cssCompiledStyles: [],
|
727
|
+
cssStyles: f.cssStyles,
|
728
|
+
id: n,
|
729
|
+
dir: f.dir,
|
730
|
+
domId: St(n, G),
|
731
|
+
type: f.type,
|
732
|
+
isGroup: f.type === "group",
|
733
|
+
padding: 8,
|
734
|
+
rx: 10,
|
735
|
+
ry: 10,
|
736
|
+
look: S
|
737
|
+
};
|
738
|
+
if (D.shape === Ot && (D.label = ""), t && t.id !== "root" && (_.trace("Setting node ", n, " to be child of its parent ", t.id), D.parentId = t.id), D.centerLabel = !0, e.note) {
|
739
|
+
const R = {
|
740
|
+
labelStyle: "",
|
741
|
+
shape: ge,
|
742
|
+
label: e.note.text,
|
743
|
+
cssClasses: ke,
|
744
|
+
// useHtmlLabels: false,
|
745
|
+
cssStyles: [],
|
746
|
+
cssCompiledStyles: [],
|
747
|
+
id: n + Ie + "-" + G,
|
748
|
+
domId: St(n, G, zt),
|
749
|
+
type: f.type,
|
750
|
+
isGroup: f.type === "group",
|
751
|
+
padding: A.flowchart?.padding,
|
752
|
+
look: S,
|
753
|
+
position: e.note.position
|
754
|
+
}, L = n + Nt, $ = {
|
755
|
+
labelStyle: "",
|
756
|
+
shape: Te,
|
757
|
+
label: e.note.text,
|
758
|
+
cssClasses: f.cssClasses,
|
759
|
+
cssStyles: [],
|
760
|
+
id: n + Nt,
|
761
|
+
domId: St(n, G, Ht),
|
762
|
+
type: "group",
|
763
|
+
isGroup: !0,
|
764
|
+
padding: 16,
|
765
|
+
//getConfig().flowchart.padding
|
766
|
+
look: S,
|
767
|
+
position: e.note.position
|
768
|
+
};
|
769
|
+
G++, $.id = L, R.parentId = L, q(s, $, g), q(s, R, g), q(s, D, g);
|
770
|
+
let I = n, P = R.id;
|
771
|
+
e.note.position === "left of" && (I = R.id, P = n), h.push({
|
772
|
+
id: I + "-" + P,
|
773
|
+
start: I,
|
774
|
+
end: P,
|
775
|
+
arrowhead: "none",
|
776
|
+
arrowTypeEnd: "",
|
777
|
+
style: Gt,
|
778
|
+
labelStyle: "",
|
779
|
+
classes: De,
|
780
|
+
arrowheadStyle: Bt,
|
781
|
+
labelpos: Vt,
|
782
|
+
labelType: Mt,
|
783
|
+
thickness: Ut,
|
784
|
+
look: S
|
785
|
+
});
|
786
|
+
} else
|
787
|
+
q(s, D, g);
|
788
|
+
}
|
789
|
+
e.doc && (_.trace("Adding nodes children "), Ne(e, e.doc, o, s, h, !u, S, g));
|
790
|
+
}, "dataFetcher"), we = /* @__PURE__ */ d(() => {
|
791
|
+
pt.clear(), G = 0;
|
792
|
+
}, "reset"), v = {
|
793
|
+
START_NODE: "[*]",
|
794
|
+
START_TYPE: "start",
|
795
|
+
END_NODE: "[*]",
|
796
|
+
END_TYPE: "end",
|
797
|
+
COLOR_KEYWORD: "color",
|
798
|
+
FILL_KEYWORD: "fill",
|
799
|
+
BG_FILL: "bgFill",
|
800
|
+
STYLECLASS_SEP: ","
|
801
|
+
}, $t = /* @__PURE__ */ d(() => /* @__PURE__ */ new Map(), "newClassesList"), Pt = /* @__PURE__ */ d(() => ({
|
802
|
+
relations: [],
|
803
|
+
states: /* @__PURE__ */ new Map(),
|
804
|
+
documents: {}
|
805
|
+
}), "newDoc"), ft = /* @__PURE__ */ d((t) => JSON.parse(JSON.stringify(t)), "clone"), Ve = class {
|
806
|
+
constructor(t) {
|
807
|
+
this.version = t, this.nodes = [], this.edges = [], this.rootDoc = [], this.classes = $t(), this.documents = { root: Pt() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.dividerCnt = 0, this.links = /* @__PURE__ */ new Map(), this.getAccTitle = ee, this.setAccTitle = se, this.getAccDescription = ie, this.setAccDescription = re, this.setDiagramTitle = ae, this.getDiagramTitle = ne, this.clear(), this.setRootDoc = this.setRootDoc.bind(this), this.getDividerId = this.getDividerId.bind(this), this.setDirection = this.setDirection.bind(this), this.trimColon = this.trimColon.bind(this);
|
808
|
+
}
|
809
|
+
static {
|
810
|
+
d(this, "StateDB");
|
811
|
+
}
|
812
|
+
static {
|
813
|
+
this.relationType = {
|
814
|
+
AGGREGATION: 0,
|
815
|
+
EXTENSION: 1,
|
816
|
+
COMPOSITION: 2,
|
817
|
+
DEPENDENCY: 3
|
818
|
+
};
|
819
|
+
}
|
820
|
+
/**
|
821
|
+
* Convert all of the statements (stmts) that were parsed into states and relationships.
|
822
|
+
* This is done because a state diagram may have nested sections,
|
823
|
+
* where each section is a 'document' and has its own set of statements.
|
824
|
+
* Ex: the section within a fork has its own statements, and incoming and outgoing statements
|
825
|
+
* refer to the fork as a whole (document).
|
826
|
+
* See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
|
827
|
+
* This will push the statement into the list of statements for the current document.
|
828
|
+
*/
|
829
|
+
extract(t) {
|
830
|
+
this.clear(!0);
|
831
|
+
for (const s of Array.isArray(t) ? t : t.doc)
|
832
|
+
switch (s.stmt) {
|
833
|
+
case K:
|
834
|
+
this.addState(s.id.trim(), s.type, s.doc, s.description, s.note);
|
835
|
+
break;
|
836
|
+
case vt:
|
837
|
+
this.addRelation(s.state1, s.state2, s.description);
|
838
|
+
break;
|
839
|
+
case de:
|
840
|
+
this.addStyleClass(s.id.trim(), s.classes);
|
841
|
+
break;
|
842
|
+
case fe:
|
843
|
+
this.handleStyleDef(s);
|
844
|
+
break;
|
845
|
+
case pe:
|
846
|
+
this.setCssClass(s.id.trim(), s.styleClass);
|
847
|
+
break;
|
848
|
+
case "click":
|
849
|
+
this.addLink(s.id, s.url, s.tooltip);
|
850
|
+
break;
|
851
|
+
}
|
852
|
+
const e = this.getStates(), o = w();
|
853
|
+
we(), Q(
|
854
|
+
void 0,
|
855
|
+
this.getRootDocV2(),
|
856
|
+
e,
|
857
|
+
this.nodes,
|
858
|
+
this.edges,
|
859
|
+
!0,
|
860
|
+
o.look,
|
861
|
+
this.classes
|
862
|
+
);
|
863
|
+
for (const s of this.nodes)
|
864
|
+
if (Array.isArray(s.label)) {
|
865
|
+
if (s.description = s.label.slice(1), s.isGroup && s.description.length > 0)
|
866
|
+
throw new Error(
|
867
|
+
`Group nodes can only have label. Remove the additional description for node [${s.id}]`
|
868
|
+
);
|
869
|
+
s.label = s.label[0];
|
870
|
+
}
|
871
|
+
}
|
872
|
+
handleStyleDef(t) {
|
873
|
+
const e = t.id.trim().split(","), o = t.styleClass.split(",");
|
874
|
+
for (const s of e) {
|
875
|
+
let h = this.getState(s);
|
876
|
+
if (!h) {
|
877
|
+
const u = s.trim();
|
878
|
+
this.addState(u), h = this.getState(u);
|
879
|
+
}
|
880
|
+
h && (h.styles = o.map((u) => u.replace(/;/g, "")?.trim()));
|
881
|
+
}
|
882
|
+
}
|
883
|
+
setRootDoc(t) {
|
884
|
+
_.info("Setting root doc", t), this.rootDoc = t, this.version === 1 ? this.extract(t) : this.extract(this.getRootDocV2());
|
885
|
+
}
|
886
|
+
docTranslator(t, e, o) {
|
887
|
+
if (e.stmt === vt) {
|
888
|
+
this.docTranslator(t, e.state1, !0), this.docTranslator(t, e.state2, !1);
|
889
|
+
return;
|
890
|
+
}
|
891
|
+
if (e.stmt === K && (e.id === v.START_NODE ? (e.id = t.id + (o ? "_start" : "_end"), e.start = o) : e.id = e.id.trim()), e.stmt !== W && e.stmt !== K || !e.doc)
|
892
|
+
return;
|
893
|
+
const s = [];
|
894
|
+
let h = [];
|
895
|
+
for (const u of e.doc)
|
896
|
+
if (u.type === Yt) {
|
897
|
+
const S = ft(u);
|
898
|
+
S.doc = ft(h), s.push(S), h = [];
|
899
|
+
} else
|
900
|
+
h.push(u);
|
901
|
+
if (s.length > 0 && h.length > 0) {
|
902
|
+
const u = {
|
903
|
+
stmt: K,
|
904
|
+
id: oe(),
|
905
|
+
type: "divider",
|
906
|
+
doc: ft(h)
|
907
|
+
};
|
908
|
+
s.push(ft(u)), e.doc = s;
|
909
|
+
}
|
910
|
+
e.doc.forEach((u) => this.docTranslator(e, u, !0));
|
911
|
+
}
|
912
|
+
getRootDocV2() {
|
913
|
+
return this.docTranslator(
|
914
|
+
{ id: W, stmt: W },
|
915
|
+
{ id: W, stmt: W, doc: this.rootDoc },
|
916
|
+
!0
|
917
|
+
), { id: W, doc: this.rootDoc };
|
918
|
+
}
|
919
|
+
/**
|
920
|
+
* Function called by parser when a node definition has been found.
|
921
|
+
*
|
922
|
+
* @param descr - description for the state. Can be a string or a list or strings
|
923
|
+
* @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
|
924
|
+
* @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
|
925
|
+
* @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
|
926
|
+
*/
|
927
|
+
addState(t, e = Z, o = void 0, s = void 0, h = void 0, u = void 0, S = void 0, g = void 0) {
|
928
|
+
const n = t?.trim();
|
929
|
+
if (!this.currentDocument.states.has(n))
|
930
|
+
_.info("Adding state ", n, s), this.currentDocument.states.set(n, {
|
931
|
+
stmt: K,
|
932
|
+
id: n,
|
933
|
+
descriptions: [],
|
934
|
+
type: e,
|
935
|
+
doc: o,
|
936
|
+
note: h,
|
937
|
+
classes: [],
|
938
|
+
styles: [],
|
939
|
+
textStyles: []
|
940
|
+
});
|
941
|
+
else {
|
942
|
+
const T = this.currentDocument.states.get(n);
|
943
|
+
if (!T)
|
944
|
+
throw new Error(`State not found: ${n}`);
|
945
|
+
T.doc || (T.doc = o), T.type || (T.type = e);
|
946
|
+
}
|
947
|
+
if (s && (_.info("Setting state description", n, s), (Array.isArray(s) ? s : [s]).forEach((b) => this.addDescription(n, b.trim()))), h) {
|
948
|
+
const T = this.currentDocument.states.get(n);
|
949
|
+
if (!T)
|
950
|
+
throw new Error(`State not found: ${n}`);
|
951
|
+
T.note = h, T.note.text = U.sanitizeText(T.note.text, w());
|
952
|
+
}
|
953
|
+
u && (_.info("Setting state classes", n, u), (Array.isArray(u) ? u : [u]).forEach((b) => this.setCssClass(n, b.trim()))), S && (_.info("Setting state styles", n, S), (Array.isArray(S) ? S : [S]).forEach((b) => this.setStyle(n, b.trim()))), g && (_.info("Setting state styles", n, S), (Array.isArray(g) ? g : [g]).forEach((b) => this.setTextStyle(n, b.trim())));
|
954
|
+
}
|
955
|
+
clear(t) {
|
956
|
+
this.nodes = [], this.edges = [], this.documents = { root: Pt() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.classes = $t(), t || (this.links = /* @__PURE__ */ new Map(), le());
|
957
|
+
}
|
958
|
+
getState(t) {
|
959
|
+
return this.currentDocument.states.get(t);
|
960
|
+
}
|
961
|
+
getStates() {
|
962
|
+
return this.currentDocument.states;
|
963
|
+
}
|
964
|
+
logDocuments() {
|
965
|
+
_.info("Documents = ", this.documents);
|
966
|
+
}
|
967
|
+
getRelations() {
|
968
|
+
return this.currentDocument.relations;
|
969
|
+
}
|
970
|
+
/**
|
971
|
+
* Adds a clickable link to a state.
|
972
|
+
*/
|
973
|
+
addLink(t, e, o) {
|
974
|
+
this.links.set(t, { url: e, tooltip: o }), _.warn("Adding link", t, e, o);
|
975
|
+
}
|
976
|
+
/**
|
977
|
+
* Get all registered links.
|
978
|
+
*/
|
979
|
+
getLinks() {
|
980
|
+
return this.links;
|
981
|
+
}
|
982
|
+
/**
|
983
|
+
* If the id is a start node ( [*] ), then return a new id constructed from
|
984
|
+
* the start node name and the current start node count.
|
985
|
+
* else return the given id
|
986
|
+
*/
|
987
|
+
startIdIfNeeded(t = "") {
|
988
|
+
return t === v.START_NODE ? (this.startEndCount++, `${v.START_TYPE}${this.startEndCount}`) : t;
|
989
|
+
}
|
990
|
+
/**
|
991
|
+
* If the id is a start node ( [*] ), then return the start type ('start')
|
992
|
+
* else return the given type
|
993
|
+
*/
|
994
|
+
startTypeIfNeeded(t = "", e = Z) {
|
995
|
+
return t === v.START_NODE ? v.START_TYPE : e;
|
996
|
+
}
|
997
|
+
/**
|
998
|
+
* If the id is an end node ( [*] ), then return a new id constructed from
|
999
|
+
* the end node name and the current start_end node count.
|
1000
|
+
* else return the given id
|
1001
|
+
*/
|
1002
|
+
endIdIfNeeded(t = "") {
|
1003
|
+
return t === v.END_NODE ? (this.startEndCount++, `${v.END_TYPE}${this.startEndCount}`) : t;
|
1004
|
+
}
|
1005
|
+
/**
|
1006
|
+
* If the id is an end node ( [*] ), then return the end type
|
1007
|
+
* else return the given type
|
1008
|
+
*
|
1009
|
+
*/
|
1010
|
+
endTypeIfNeeded(t = "", e = Z) {
|
1011
|
+
return t === v.END_NODE ? v.END_TYPE : e;
|
1012
|
+
}
|
1013
|
+
addRelationObjs(t, e, o = "") {
|
1014
|
+
const s = this.startIdIfNeeded(t.id.trim()), h = this.startTypeIfNeeded(t.id.trim(), t.type), u = this.startIdIfNeeded(e.id.trim()), S = this.startTypeIfNeeded(e.id.trim(), e.type);
|
1015
|
+
this.addState(
|
1016
|
+
s,
|
1017
|
+
h,
|
1018
|
+
t.doc,
|
1019
|
+
t.description,
|
1020
|
+
t.note,
|
1021
|
+
t.classes,
|
1022
|
+
t.styles,
|
1023
|
+
t.textStyles
|
1024
|
+
), this.addState(
|
1025
|
+
u,
|
1026
|
+
S,
|
1027
|
+
e.doc,
|
1028
|
+
e.description,
|
1029
|
+
e.note,
|
1030
|
+
e.classes,
|
1031
|
+
e.styles,
|
1032
|
+
e.textStyles
|
1033
|
+
), this.currentDocument.relations.push({
|
1034
|
+
id1: s,
|
1035
|
+
id2: u,
|
1036
|
+
relationTitle: U.sanitizeText(o, w())
|
1037
|
+
});
|
1038
|
+
}
|
1039
|
+
/**
|
1040
|
+
* Add a relation between two items. The items may be full objects or just the string id of a state.
|
1041
|
+
*/
|
1042
|
+
addRelation(t, e, o) {
|
1043
|
+
if (typeof t == "object" && typeof e == "object")
|
1044
|
+
this.addRelationObjs(t, e, o);
|
1045
|
+
else if (typeof t == "string" && typeof e == "string") {
|
1046
|
+
const s = this.startIdIfNeeded(t.trim()), h = this.startTypeIfNeeded(t), u = this.endIdIfNeeded(e.trim()), S = this.endTypeIfNeeded(e);
|
1047
|
+
this.addState(s, h), this.addState(u, S), this.currentDocument.relations.push({
|
1048
|
+
id1: s,
|
1049
|
+
id2: u,
|
1050
|
+
relationTitle: o ? U.sanitizeText(o, w()) : void 0
|
1051
|
+
});
|
1052
|
+
}
|
1053
|
+
}
|
1054
|
+
addDescription(t, e) {
|
1055
|
+
const o = this.currentDocument.states.get(t), s = e.startsWith(":") ? e.replace(":", "").trim() : e;
|
1056
|
+
o?.descriptions?.push(U.sanitizeText(s, w()));
|
1057
|
+
}
|
1058
|
+
cleanupLabel(t) {
|
1059
|
+
return t.startsWith(":") ? t.slice(2).trim() : t.trim();
|
1060
|
+
}
|
1061
|
+
getDividerId() {
|
1062
|
+
return this.dividerCnt++, `divider-id-${this.dividerCnt}`;
|
1063
|
+
}
|
1064
|
+
/**
|
1065
|
+
* Called when the parser comes across a (style) class definition
|
1066
|
+
* @example classDef my-style fill:#f96;
|
1067
|
+
*
|
1068
|
+
* @param id - the id of this (style) class
|
1069
|
+
* @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
|
1070
|
+
*/
|
1071
|
+
addStyleClass(t, e = "") {
|
1072
|
+
this.classes.has(t) || this.classes.set(t, { id: t, styles: [], textStyles: [] });
|
1073
|
+
const o = this.classes.get(t);
|
1074
|
+
e && o && e.split(v.STYLECLASS_SEP).forEach((s) => {
|
1075
|
+
const h = s.replace(/([^;]*);/, "$1").trim();
|
1076
|
+
if (RegExp(v.COLOR_KEYWORD).exec(s)) {
|
1077
|
+
const S = h.replace(v.FILL_KEYWORD, v.BG_FILL).replace(v.COLOR_KEYWORD, v.FILL_KEYWORD);
|
1078
|
+
o.textStyles.push(S);
|
1079
|
+
}
|
1080
|
+
o.styles.push(h);
|
1081
|
+
});
|
1082
|
+
}
|
1083
|
+
getClasses() {
|
1084
|
+
return this.classes;
|
1085
|
+
}
|
1086
|
+
/**
|
1087
|
+
* Add a (style) class or css class to a state with the given id.
|
1088
|
+
* If the state isn't already in the list of known states, add it.
|
1089
|
+
* Might be called by parser when a style class or CSS class should be applied to a state
|
1090
|
+
*
|
1091
|
+
* @param itemIds - The id or a list of ids of the item(s) to apply the css class to
|
1092
|
+
* @param cssClassName - CSS class name
|
1093
|
+
*/
|
1094
|
+
setCssClass(t, e) {
|
1095
|
+
t.split(",").forEach((o) => {
|
1096
|
+
let s = this.getState(o);
|
1097
|
+
if (!s) {
|
1098
|
+
const h = o.trim();
|
1099
|
+
this.addState(h), s = this.getState(h);
|
1100
|
+
}
|
1101
|
+
s?.classes?.push(e);
|
1102
|
+
});
|
1103
|
+
}
|
1104
|
+
/**
|
1105
|
+
* Add a style to a state with the given id.
|
1106
|
+
* @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
|
1107
|
+
* where 'style' is the keyword
|
1108
|
+
* stateId is the id of a state
|
1109
|
+
* the rest of the string is the styleText (all of the attributes to be applied to the state)
|
1110
|
+
*
|
1111
|
+
* @param itemId - The id of item to apply the style to
|
1112
|
+
* @param styleText - the text of the attributes for the style
|
1113
|
+
*/
|
1114
|
+
setStyle(t, e) {
|
1115
|
+
this.getState(t)?.styles?.push(e);
|
1116
|
+
}
|
1117
|
+
/**
|
1118
|
+
* Add a text style to a state with the given id
|
1119
|
+
*
|
1120
|
+
* @param itemId - The id of item to apply the css class to
|
1121
|
+
* @param cssClassName - CSS class name
|
1122
|
+
*/
|
1123
|
+
setTextStyle(t, e) {
|
1124
|
+
this.getState(t)?.textStyles?.push(e);
|
1125
|
+
}
|
1126
|
+
/**
|
1127
|
+
* Finds the direction statement in the root document.
|
1128
|
+
* @returns the direction statement if present
|
1129
|
+
*/
|
1130
|
+
getDirectionStatement() {
|
1131
|
+
return this.rootDoc.find((t) => t.stmt === It);
|
1132
|
+
}
|
1133
|
+
getDirection() {
|
1134
|
+
return this.getDirectionStatement()?.value ?? ue;
|
1135
|
+
}
|
1136
|
+
setDirection(t) {
|
1137
|
+
const e = this.getDirectionStatement();
|
1138
|
+
e ? e.value = t : this.rootDoc.unshift({ stmt: It, value: t });
|
1139
|
+
}
|
1140
|
+
trimColon(t) {
|
1141
|
+
return t.startsWith(":") ? t.slice(1).trim() : t.trim();
|
1142
|
+
}
|
1143
|
+
getData() {
|
1144
|
+
const t = w();
|
1145
|
+
return {
|
1146
|
+
nodes: this.nodes,
|
1147
|
+
edges: this.edges,
|
1148
|
+
other: {},
|
1149
|
+
config: t,
|
1150
|
+
direction: Wt(this.getRootDocV2())
|
1151
|
+
};
|
1152
|
+
}
|
1153
|
+
getConfig() {
|
1154
|
+
return w().state;
|
1155
|
+
}
|
1156
|
+
}, $e = /* @__PURE__ */ d((t) => `
|
1157
|
+
defs #statediagram-barbEnd {
|
1158
|
+
fill: ${t.transitionColor};
|
1159
|
+
stroke: ${t.transitionColor};
|
1160
|
+
}
|
1161
|
+
g.stateGroup text {
|
1162
|
+
fill: ${t.nodeBorder};
|
1163
|
+
stroke: none;
|
1164
|
+
font-size: 10px;
|
1165
|
+
}
|
1166
|
+
g.stateGroup text {
|
1167
|
+
fill: ${t.textColor};
|
1168
|
+
stroke: none;
|
1169
|
+
font-size: 10px;
|
1170
|
+
|
1171
|
+
}
|
1172
|
+
g.stateGroup .state-title {
|
1173
|
+
font-weight: bolder;
|
1174
|
+
fill: ${t.stateLabelColor};
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
g.stateGroup rect {
|
1178
|
+
fill: ${t.mainBkg};
|
1179
|
+
stroke: ${t.nodeBorder};
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
g.stateGroup line {
|
1183
|
+
stroke: ${t.lineColor};
|
1184
|
+
stroke-width: 1;
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
.transition {
|
1188
|
+
stroke: ${t.transitionColor};
|
1189
|
+
stroke-width: 1;
|
1190
|
+
fill: none;
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
.stateGroup .composit {
|
1194
|
+
fill: ${t.background};
|
1195
|
+
border-bottom: 1px
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
.stateGroup .alt-composit {
|
1199
|
+
fill: #e0e0e0;
|
1200
|
+
border-bottom: 1px
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
.state-note {
|
1204
|
+
stroke: ${t.noteBorderColor};
|
1205
|
+
fill: ${t.noteBkgColor};
|
1206
|
+
|
1207
|
+
text {
|
1208
|
+
fill: ${t.noteTextColor};
|
1209
|
+
stroke: none;
|
1210
|
+
font-size: 10px;
|
1211
|
+
}
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
.stateLabel .box {
|
1215
|
+
stroke: none;
|
1216
|
+
stroke-width: 0;
|
1217
|
+
fill: ${t.mainBkg};
|
1218
|
+
opacity: 0.5;
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
.edgeLabel .label rect {
|
1222
|
+
fill: ${t.labelBackgroundColor};
|
1223
|
+
opacity: 0.5;
|
1224
|
+
}
|
1225
|
+
.edgeLabel {
|
1226
|
+
background-color: ${t.edgeLabelBackground};
|
1227
|
+
p {
|
1228
|
+
background-color: ${t.edgeLabelBackground};
|
1229
|
+
}
|
1230
|
+
rect {
|
1231
|
+
opacity: 0.5;
|
1232
|
+
background-color: ${t.edgeLabelBackground};
|
1233
|
+
fill: ${t.edgeLabelBackground};
|
1234
|
+
}
|
1235
|
+
text-align: center;
|
1236
|
+
}
|
1237
|
+
.edgeLabel .label text {
|
1238
|
+
fill: ${t.transitionLabelColor || t.tertiaryTextColor};
|
1239
|
+
}
|
1240
|
+
.label div .edgeLabel {
|
1241
|
+
color: ${t.transitionLabelColor || t.tertiaryTextColor};
|
1242
|
+
}
|
1243
|
+
|
1244
|
+
.stateLabel text {
|
1245
|
+
fill: ${t.stateLabelColor};
|
1246
|
+
font-size: 10px;
|
1247
|
+
font-weight: bold;
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
.node circle.state-start {
|
1251
|
+
fill: ${t.specialStateColor};
|
1252
|
+
stroke: ${t.specialStateColor};
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
.node .fork-join {
|
1256
|
+
fill: ${t.specialStateColor};
|
1257
|
+
stroke: ${t.specialStateColor};
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
.node circle.state-end {
|
1261
|
+
fill: ${t.innerEndBackground};
|
1262
|
+
stroke: ${t.background};
|
1263
|
+
stroke-width: 1.5
|
1264
|
+
}
|
1265
|
+
.end-state-inner {
|
1266
|
+
fill: ${t.compositeBackground || t.background};
|
1267
|
+
// stroke: ${t.background};
|
1268
|
+
stroke-width: 1.5
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
.node rect {
|
1272
|
+
fill: ${t.stateBkg || t.mainBkg};
|
1273
|
+
stroke: ${t.stateBorder || t.nodeBorder};
|
1274
|
+
stroke-width: 1px;
|
1275
|
+
}
|
1276
|
+
.node polygon {
|
1277
|
+
fill: ${t.mainBkg};
|
1278
|
+
stroke: ${t.stateBorder || t.nodeBorder};;
|
1279
|
+
stroke-width: 1px;
|
1280
|
+
}
|
1281
|
+
#statediagram-barbEnd {
|
1282
|
+
fill: ${t.lineColor};
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
.statediagram-cluster rect {
|
1286
|
+
fill: ${t.compositeTitleBackground};
|
1287
|
+
stroke: ${t.stateBorder || t.nodeBorder};
|
1288
|
+
stroke-width: 1px;
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
.cluster-label, .nodeLabel {
|
1292
|
+
color: ${t.stateLabelColor};
|
1293
|
+
// line-height: 1;
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
.statediagram-cluster rect.outer {
|
1297
|
+
rx: 5px;
|
1298
|
+
ry: 5px;
|
1299
|
+
}
|
1300
|
+
.statediagram-state .divider {
|
1301
|
+
stroke: ${t.stateBorder || t.nodeBorder};
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
.statediagram-state .title-state {
|
1305
|
+
rx: 5px;
|
1306
|
+
ry: 5px;
|
1307
|
+
}
|
1308
|
+
.statediagram-cluster.statediagram-cluster .inner {
|
1309
|
+
fill: ${t.compositeBackground || t.background};
|
1310
|
+
}
|
1311
|
+
.statediagram-cluster.statediagram-cluster-alt .inner {
|
1312
|
+
fill: ${t.altBackground ? t.altBackground : "#efefef"};
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
.statediagram-cluster .inner {
|
1316
|
+
rx:0;
|
1317
|
+
ry:0;
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
.statediagram-state rect.basic {
|
1321
|
+
rx: 5px;
|
1322
|
+
ry: 5px;
|
1323
|
+
}
|
1324
|
+
.statediagram-state rect.divider {
|
1325
|
+
stroke-dasharray: 10,10;
|
1326
|
+
fill: ${t.altBackground ? t.altBackground : "#efefef"};
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
.note-edge {
|
1330
|
+
stroke-dasharray: 5;
|
1331
|
+
}
|
1332
|
+
|
1333
|
+
.statediagram-note rect {
|
1334
|
+
fill: ${t.noteBkgColor};
|
1335
|
+
stroke: ${t.noteBorderColor};
|
1336
|
+
stroke-width: 1px;
|
1337
|
+
rx: 0;
|
1338
|
+
ry: 0;
|
1339
|
+
}
|
1340
|
+
.statediagram-note rect {
|
1341
|
+
fill: ${t.noteBkgColor};
|
1342
|
+
stroke: ${t.noteBorderColor};
|
1343
|
+
stroke-width: 1px;
|
1344
|
+
rx: 0;
|
1345
|
+
ry: 0;
|
1346
|
+
}
|
1347
|
+
|
1348
|
+
.statediagram-note text {
|
1349
|
+
fill: ${t.noteTextColor};
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
.statediagram-note .nodeLabel {
|
1353
|
+
color: ${t.noteTextColor};
|
1354
|
+
}
|
1355
|
+
.statediagram .edgeLabel {
|
1356
|
+
color: red; // ${t.noteTextColor};
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
#dependencyStart, #dependencyEnd {
|
1360
|
+
fill: ${t.lineColor};
|
1361
|
+
stroke: ${t.lineColor};
|
1362
|
+
stroke-width: 1;
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
.statediagramTitleText {
|
1366
|
+
text-anchor: middle;
|
1367
|
+
font-size: 18px;
|
1368
|
+
fill: ${t.textColor};
|
1369
|
+
}
|
1370
|
+
`, "getStyles"), Me = $e;
|
1371
|
+
export {
|
1372
|
+
Ve as S,
|
1373
|
+
Me as a,
|
1374
|
+
Be as b,
|
1375
|
+
Ge as s
|
1376
|
+
};
|