UNPKG

47.4 kBJavaScriptView Raw
1import { c as getConfig, g as getAccTitle, s as setAccTitle, a as getAccDescription, b as setAccDescription, q as setDiagramTitle, t as getDiagramTitle, l as log, e as common, v as clear$1, I as generateId } from "./mermaid-6dc72991.js";
2var 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 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 15], $V7 = [1, 16], $V8 = [1, 17], $V9 = [1, 18], $Va = [1, 30], $Vb = [1, 19], $Vc = [1, 20], $Vd = [1, 21], $Ve = [1, 22], $Vf = [1, 23], $Vg = [1, 25], $Vh = [1, 26], $Vi = [1, 27], $Vj = [1, 28], $Vk = [1, 29], $Vl = [1, 32], $Vm = [1, 33], $Vn = [1, 34], $Vo = [1, 35], $Vp = [1, 31], $Vq = [1, 4, 5, 15, 16, 18, 20, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50], $Vr = [1, 4, 5, 13, 14, 15, 16, 18, 20, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50], $Vs = [4, 5, 15, 16, 18, 20, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50];
8 var parser2 = {
9 trace: function trace() {
10 },
11 yy: {},
12 symbols_: { "error": 2, "start": 3, "SPACE": 4, "NL": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "classDefStatement": 10, "cssClassStatement": 11, "idStatement": 12, "DESCR": 13, "-->": 14, "HIDE_EMPTY": 15, "scale": 16, "WIDTH": 17, "COMPOSIT_STATE": 18, "STRUCT_START": 19, "STRUCT_STOP": 20, "STATE_DESCR": 21, "AS": 22, "ID": 23, "FORK": 24, "JOIN": 25, "CHOICE": 26, "CONCURRENT": 27, "note": 28, "notePosition": 29, "NOTE_TEXT": 30, "direction": 31, "acc_title": 32, "acc_title_value": 33, "acc_descr": 34, "acc_descr_value": 35, "acc_descr_multiline_value": 36, "classDef": 37, "CLASSDEF_ID": 38, "CLASSDEF_STYLEOPTS": 39, "DEFAULT": 40, "class": 41, "CLASSENTITY_IDS": 42, "STYLECLASS": 43, "direction_tb": 44, "direction_bt": 45, "direction_rl": 46, "direction_lr": 47, "eol": 48, ";": 49, "EDGE_STATE": 50, "STYLE_SEPARATOR": 51, "left_of": 52, "right_of": 53, "$accept": 0, "$end": 1 },
13 terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 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", 30: "NOTE_TEXT", 32: "acc_title", 33: "acc_title_value", 34: "acc_descr", 35: "acc_descr_value", 36: "acc_descr_multiline_value", 37: "classDef", 38: "CLASSDEF_ID", 39: "CLASSDEF_STYLEOPTS", 40: "DEFAULT", 41: "class", 42: "CLASSENTITY_IDS", 43: "STYLECLASS", 44: "direction_tb", 45: "direction_bt", 46: "direction_rl", 47: "direction_lr", 49: ";", 50: "EDGE_STATE", 51: "STYLE_SEPARATOR", 52: "left_of", 53: "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, 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], [10, 3], [10, 3], [11, 3], [31, 1], [31, 1], [31, 1], [31, 1], [48, 1], [48, 1], [12, 1], [12, 1], [12, 3], [12, 3], [29, 1], [29, 1]],
15 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
16 var $0 = $$.length - 1;
17 switch (yystate) {
18 case 3:
19 yy.setRootDoc($$[$0]);
20 return $$[$0];
21 case 4:
22 this.$ = [];
23 break;
24 case 5:
25 if ($$[$0] != "nl") {
26 $$[$0 - 1].push($$[$0]);
27 this.$ = $$[$0 - 1];
28 }
29 break;
30 case 6:
31 case 7:
32 this.$ = $$[$0];
33 break;
34 case 8:
35 this.$ = "nl";
36 break;
37 case 11:
38 this.$ = $$[$0];
39 break;
40 case 12:
41 const stateStmt = $$[$0 - 1];
42 stateStmt.description = yy.trimColon($$[$0]);
43 this.$ = stateStmt;
44 break;
45 case 13:
46 this.$ = { stmt: "relation", state1: $$[$0 - 2], state2: $$[$0] };
47 break;
48 case 14:
49 const relDescription = yy.trimColon($$[$0]);
50 this.$ = { stmt: "relation", state1: $$[$0 - 3], state2: $$[$0 - 1], description: relDescription };
51 break;
52 case 18:
53 this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: "", doc: $$[$0 - 1] };
54 break;
55 case 19:
56 var id = $$[$0];
57 var description = $$[$0 - 2].trim();
58 if ($$[$0].match(":")) {
59 var parts = $$[$0].split(":");
60 id = parts[0];
61 description = [description, parts[1]];
62 }
63 this.$ = { stmt: "state", id, type: "default", description };
64 break;
65 case 20:
66 this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: $$[$0 - 5], doc: $$[$0 - 1] };
67 break;
68 case 21:
69 this.$ = { stmt: "state", id: $$[$0], type: "fork" };
70 break;
71 case 22:
72 this.$ = { stmt: "state", id: $$[$0], type: "join" };
73 break;
74 case 23:
75 this.$ = { stmt: "state", id: $$[$0], type: "choice" };
76 break;
77 case 24:
78 this.$ = { stmt: "state", id: yy.getDividerId(), type: "divider" };
79 break;
80 case 25:
81 this.$ = { stmt: "state", id: $$[$0 - 1].trim(), note: { position: $$[$0 - 2].trim(), text: $$[$0].trim() } };
82 break;
83 case 28:
84 this.$ = $$[$0].trim();
85 yy.setAccTitle(this.$);
86 break;
87 case 29:
88 case 30:
89 this.$ = $$[$0].trim();
90 yy.setAccDescription(this.$);
91 break;
92 case 31:
93 case 32:
94 this.$ = { stmt: "classDef", id: $$[$0 - 1].trim(), classes: $$[$0].trim() };
95 break;
96 case 33:
97 this.$ = { stmt: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
98 break;
99 case 34:
100 yy.setDirection("TB");
101 this.$ = { stmt: "dir", value: "TB" };
102 break;
103 case 35:
104 yy.setDirection("BT");
105 this.$ = { stmt: "dir", value: "BT" };
106 break;
107 case 36:
108 yy.setDirection("RL");
109 this.$ = { stmt: "dir", value: "RL" };
110 break;
111 case 37:
112 yy.setDirection("LR");
113 this.$ = { stmt: "dir", value: "LR" };
114 break;
115 case 40:
116 case 41:
117 this.$ = { stmt: "state", id: $$[$0].trim(), type: "default", description: "" };
118 break;
119 case 42:
120 this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
121 break;
122 case 43:
123 this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
124 break;
125 }
126 },
127 table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o([1, 4, 5, 15, 16, 18, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 15: $V6, 16: $V7, 18: $V8, 21: $V9, 23: $Va, 24: $Vb, 25: $Vc, 26: $Vd, 27: $Ve, 28: $Vf, 31: 24, 32: $Vg, 34: $Vh, 36: $Vi, 37: $Vj, 41: $Vk, 44: $Vl, 45: $Vm, 46: $Vn, 47: $Vo, 50: $Vp }, o($Vq, [2, 5]), { 9: 36, 10: 12, 11: 13, 12: 14, 15: $V6, 16: $V7, 18: $V8, 21: $V9, 23: $Va, 24: $Vb, 25: $Vc, 26: $Vd, 27: $Ve, 28: $Vf, 31: 24, 32: $Vg, 34: $Vh, 36: $Vi, 37: $Vj, 41: $Vk, 44: $Vl, 45: $Vm, 46: $Vn, 47: $Vo, 50: $Vp }, o($Vq, [2, 7]), o($Vq, [2, 8]), o($Vq, [2, 9]), o($Vq, [2, 10]), o($Vq, [2, 11], { 13: [1, 37], 14: [1, 38] }), o($Vq, [2, 15]), { 17: [1, 39] }, o($Vq, [2, 17], { 19: [1, 40] }), { 22: [1, 41] }, o($Vq, [2, 21]), o($Vq, [2, 22]), o($Vq, [2, 23]), o($Vq, [2, 24]), { 29: 42, 30: [1, 43], 52: [1, 44], 53: [1, 45] }, o($Vq, [2, 27]), { 33: [1, 46] }, { 35: [1, 47] }, o($Vq, [2, 30]), { 38: [1, 48], 40: [1, 49] }, { 42: [1, 50] }, o($Vr, [2, 40], { 51: [1, 51] }), o($Vr, [2, 41], { 51: [1, 52] }), o($Vq, [2, 34]), o($Vq, [2, 35]), o($Vq, [2, 36]), o($Vq, [2, 37]), o($Vq, [2, 6]), o($Vq, [2, 12]), { 12: 53, 23: $Va, 50: $Vp }, o($Vq, [2, 16]), o($Vs, $V3, { 7: 54 }), { 23: [1, 55] }, { 23: [1, 56] }, { 22: [1, 57] }, { 23: [2, 44] }, { 23: [2, 45] }, o($Vq, [2, 28]), o($Vq, [2, 29]), { 39: [1, 58] }, { 39: [1, 59] }, { 43: [1, 60] }, { 23: [1, 61] }, { 23: [1, 62] }, o($Vq, [2, 13], { 13: [1, 63] }), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 15: $V6, 16: $V7, 18: $V8, 20: [1, 64], 21: $V9, 23: $Va, 24: $Vb, 25: $Vc, 26: $Vd, 27: $Ve, 28: $Vf, 31: 24, 32: $Vg, 34: $Vh, 36: $Vi, 37: $Vj, 41: $Vk, 44: $Vl, 45: $Vm, 46: $Vn, 47: $Vo, 50: $Vp }, o($Vq, [2, 19], { 19: [1, 65] }), { 30: [1, 66] }, { 23: [1, 67] }, o($Vq, [2, 31]), o($Vq, [2, 32]), o($Vq, [2, 33]), o($Vr, [2, 42]), o($Vr, [2, 43]), o($Vq, [2, 14]), o($Vq, [2, 18]), o($Vs, $V3, { 7: 68 }), o($Vq, [2, 25]), o($Vq, [2, 26]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 15: $V6, 16: $V7, 18: $V8, 20: [1, 69], 21: $V9, 23: $Va, 24: $Vb, 25: $Vc, 26: $Vd, 27: $Ve, 28: $Vf, 31: 24, 32: $Vg, 34: $Vh, 36: $Vi, 37: $Vj, 41: $Vk, 44: $Vl, 45: $Vm, 46: $Vn, 47: $Vo, 50: $Vp }, o($Vq, [2, 20])],
128 defaultActions: { 5: [2, 1], 6: [2, 2], 44: [2, 44], 45: [2, 45] },
129 parseError: function parseError(str, hash) {
130 if (hash.recoverable) {
131 this.trace(str);
132 } else {
133 var error = new Error(str);
134 error.hash = hash;
135 throw error;
136 }
137 },
138 parse: function parse(input) {
139 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
140 var args = lstack.slice.call(arguments, 1);
141 var lexer2 = Object.create(this.lexer);
142 var sharedState = { yy: {} };
143 for (var k in this.yy) {
144 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
145 sharedState.yy[k] = this.yy[k];
146 }
147 }
148 lexer2.setInput(input, sharedState.yy);
149 sharedState.yy.lexer = lexer2;
150 sharedState.yy.parser = this;
151 if (typeof lexer2.yylloc == "undefined") {
152 lexer2.yylloc = {};
153 }
154 var yyloc = lexer2.yylloc;
155 lstack.push(yyloc);
156 var ranges = lexer2.options && lexer2.options.ranges;
157 if (typeof sharedState.yy.parseError === "function") {
158 this.parseError = sharedState.yy.parseError;
159 } else {
160 this.parseError = Object.getPrototypeOf(this).parseError;
161 }
162 function lex() {
163 var token;
164 token = tstack.pop() || lexer2.lex() || EOF;
165 if (typeof token !== "number") {
166 if (token instanceof Array) {
167 tstack = token;
168 token = tstack.pop();
169 }
170 token = self.symbols_[token] || token;
171 }
172 return token;
173 }
174 var symbol, state, action, r, yyval = {}, p, len, newState, expected;
175 while (true) {
176 state = stack[stack.length - 1];
177 if (this.defaultActions[state]) {
178 action = this.defaultActions[state];
179 } else {
180 if (symbol === null || typeof symbol == "undefined") {
181 symbol = lex();
182 }
183 action = table[state] && table[state][symbol];
184 }
185 if (typeof action === "undefined" || !action.length || !action[0]) {
186 var errStr = "";
187 expected = [];
188 for (p in table[state]) {
189 if (this.terminals_[p] && p > TERROR) {
190 expected.push("'" + this.terminals_[p] + "'");
191 }
192 }
193 if (lexer2.showPosition) {
194 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
195 } else {
196 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
197 }
198 this.parseError(errStr, {
199 text: lexer2.match,
200 token: this.terminals_[symbol] || symbol,
201 line: lexer2.yylineno,
202 loc: yyloc,
203 expected
204 });
205 }
206 if (action[0] instanceof Array && action.length > 1) {
207 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
208 }
209 switch (action[0]) {
210 case 1:
211 stack.push(symbol);
212 vstack.push(lexer2.yytext);
213 lstack.push(lexer2.yylloc);
214 stack.push(action[1]);
215 symbol = null;
216 {
217 yyleng = lexer2.yyleng;
218 yytext = lexer2.yytext;
219 yylineno = lexer2.yylineno;
220 yyloc = lexer2.yylloc;
221 }
222 break;
223 case 2:
224 len = this.productions_[action[1]][1];
225 yyval.$ = vstack[vstack.length - len];
226 yyval._$ = {
227 first_line: lstack[lstack.length - (len || 1)].first_line,
228 last_line: lstack[lstack.length - 1].last_line,
229 first_column: lstack[lstack.length - (len || 1)].first_column,
230 last_column: lstack[lstack.length - 1].last_column
231 };
232 if (ranges) {
233 yyval._$.range = [
234 lstack[lstack.length - (len || 1)].range[0],
235 lstack[lstack.length - 1].range[1]
236 ];
237 }
238 r = this.performAction.apply(yyval, [
239 yytext,
240 yyleng,
241 yylineno,
242 sharedState.yy,
243 action[1],
244 vstack,
245 lstack
246 ].concat(args));
247 if (typeof r !== "undefined") {
248 return r;
249 }
250 if (len) {
251 stack = stack.slice(0, -1 * len * 2);
252 vstack = vstack.slice(0, -1 * len);
253 lstack = lstack.slice(0, -1 * len);
254 }
255 stack.push(this.productions_[action[1]][0]);
256 vstack.push(yyval.$);
257 lstack.push(yyval._$);
258 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
259 stack.push(newState);
260 break;
261 case 3:
262 return true;
263 }
264 }
265 return true;
266 }
267 };
268 var lexer = function() {
269 var lexer2 = {
270 EOF: 1,
271 parseError: function parseError(str, hash) {
272 if (this.yy.parser) {
273 this.yy.parser.parseError(str, hash);
274 } else {
275 throw new Error(str);
276 }
277 },
278 // resets the lexer, sets new input
279 setInput: function(input, yy) {
280 this.yy = yy || this.yy || {};
281 this._input = input;
282 this._more = this._backtrack = this.done = false;
283 this.yylineno = this.yyleng = 0;
284 this.yytext = this.matched = this.match = "";
285 this.conditionStack = ["INITIAL"];
286 this.yylloc = {
287 first_line: 1,
288 first_column: 0,
289 last_line: 1,
290 last_column: 0
291 };
292 if (this.options.ranges) {
293 this.yylloc.range = [0, 0];
294 }
295 this.offset = 0;
296 return this;
297 },
298 // consumes and returns one char from the input
299 input: function() {
300 var ch = this._input[0];
301 this.yytext += ch;
302 this.yyleng++;
303 this.offset++;
304 this.match += ch;
305 this.matched += ch;
306 var lines = ch.match(/(?:\r\n?|\n).*/g);
307 if (lines) {
308 this.yylineno++;
309 this.yylloc.last_line++;
310 } else {
311 this.yylloc.last_column++;
312 }
313 if (this.options.ranges) {
314 this.yylloc.range[1]++;
315 }
316 this._input = this._input.slice(1);
317 return ch;
318 },
319 // unshifts one char (or a string) into the input
320 unput: function(ch) {
321 var len = ch.length;
322 var lines = ch.split(/(?:\r\n?|\n)/g);
323 this._input = ch + this._input;
324 this.yytext = this.yytext.substr(0, this.yytext.length - len);
325 this.offset -= len;
326 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
327 this.match = this.match.substr(0, this.match.length - 1);
328 this.matched = this.matched.substr(0, this.matched.length - 1);
329 if (lines.length - 1) {
330 this.yylineno -= lines.length - 1;
331 }
332 var r = this.yylloc.range;
333 this.yylloc = {
334 first_line: this.yylloc.first_line,
335 last_line: this.yylineno + 1,
336 first_column: this.yylloc.first_column,
337 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
338 };
339 if (this.options.ranges) {
340 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
341 }
342 this.yyleng = this.yytext.length;
343 return this;
344 },
345 // When called from action, caches matched text and appends it on next action
346 more: function() {
347 this._more = true;
348 return this;
349 },
350 // 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.
351 reject: function() {
352 if (this.options.backtrack_lexer) {
353 this._backtrack = true;
354 } else {
355 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(), {
356 text: "",
357 token: null,
358 line: this.yylineno
359 });
360 }
361 return this;
362 },
363 // retain first n characters of the match
364 less: function(n) {
365 this.unput(this.match.slice(n));
366 },
367 // displays already matched input, i.e. for error messages
368 pastInput: function() {
369 var past = this.matched.substr(0, this.matched.length - this.match.length);
370 return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
371 },
372 // displays upcoming input, i.e. for error messages
373 upcomingInput: function() {
374 var next = this.match;
375 if (next.length < 20) {
376 next += this._input.substr(0, 20 - next.length);
377 }
378 return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
379 },
380 // displays the character position where the lexing error occurred, i.e. for error messages
381 showPosition: function() {
382 var pre = this.pastInput();
383 var c = new Array(pre.length + 1).join("-");
384 return pre + this.upcomingInput() + "\n" + c + "^";
385 },
386 // test the lexed token: return FALSE when not a match, otherwise return token
387 test_match: function(match, indexed_rule) {
388 var token, lines, backup;
389 if (this.options.backtrack_lexer) {
390 backup = {
391 yylineno: this.yylineno,
392 yylloc: {
393 first_line: this.yylloc.first_line,
394 last_line: this.last_line,
395 first_column: this.yylloc.first_column,
396 last_column: this.yylloc.last_column
397 },
398 yytext: this.yytext,
399 match: this.match,
400 matches: this.matches,
401 matched: this.matched,
402 yyleng: this.yyleng,
403 offset: this.offset,
404 _more: this._more,
405 _input: this._input,
406 yy: this.yy,
407 conditionStack: this.conditionStack.slice(0),
408 done: this.done
409 };
410 if (this.options.ranges) {
411 backup.yylloc.range = this.yylloc.range.slice(0);
412 }
413 }
414 lines = match[0].match(/(?:\r\n?|\n).*/g);
415 if (lines) {
416 this.yylineno += lines.length;
417 }
418 this.yylloc = {
419 first_line: this.yylloc.last_line,
420 last_line: this.yylineno + 1,
421 first_column: this.yylloc.last_column,
422 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
423 };
424 this.yytext += match[0];
425 this.match += match[0];
426 this.matches = match;
427 this.yyleng = this.yytext.length;
428 if (this.options.ranges) {
429 this.yylloc.range = [this.offset, this.offset += this.yyleng];
430 }
431 this._more = false;
432 this._backtrack = false;
433 this._input = this._input.slice(match[0].length);
434 this.matched += match[0];
435 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
436 if (this.done && this._input) {
437 this.done = false;
438 }
439 if (token) {
440 return token;
441 } else if (this._backtrack) {
442 for (var k in backup) {
443 this[k] = backup[k];
444 }
445 return false;
446 }
447 return false;
448 },
449 // return next match in input
450 next: function() {
451 if (this.done) {
452 return this.EOF;
453 }
454 if (!this._input) {
455 this.done = true;
456 }
457 var token, match, tempMatch, index;
458 if (!this._more) {
459 this.yytext = "";
460 this.match = "";
461 }
462 var rules = this._currentRules();
463 for (var i = 0; i < rules.length; i++) {
464 tempMatch = this._input.match(this.rules[rules[i]]);
465 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
466 match = tempMatch;
467 index = i;
468 if (this.options.backtrack_lexer) {
469 token = this.test_match(tempMatch, rules[i]);
470 if (token !== false) {
471 return token;
472 } else if (this._backtrack) {
473 match = false;
474 continue;
475 } else {
476 return false;
477 }
478 } else if (!this.options.flex) {
479 break;
480 }
481 }
482 }
483 if (match) {
484 token = this.test_match(match, rules[index]);
485 if (token !== false) {
486 return token;
487 }
488 return false;
489 }
490 if (this._input === "") {
491 return this.EOF;
492 } else {
493 return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
494 text: "",
495 token: null,
496 line: this.yylineno
497 });
498 }
499 },
500 // return next match that has a token
501 lex: function lex() {
502 var r = this.next();
503 if (r) {
504 return r;
505 } else {
506 return this.lex();
507 }
508 },
509 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
510 begin: function begin(condition) {
511 this.conditionStack.push(condition);
512 },
513 // pop the previously active lexer condition state off the condition stack
514 popState: function popState() {
515 var n = this.conditionStack.length - 1;
516 if (n > 0) {
517 return this.conditionStack.pop();
518 } else {
519 return this.conditionStack[0];
520 }
521 },
522 // produce the lexer rule set which is active for the currently active lexer condition state
523 _currentRules: function _currentRules() {
524 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
525 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
526 } else {
527 return this.conditions["INITIAL"].rules;
528 }
529 },
530 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
531 topState: function topState(n) {
532 n = this.conditionStack.length - 1 - Math.abs(n || 0);
533 if (n >= 0) {
534 return this.conditionStack[n];
535 } else {
536 return "INITIAL";
537 }
538 },
539 // alias for begin(condition)
540 pushState: function pushState(condition) {
541 this.begin(condition);
542 },
543 // return the number of states currently on the stack
544 stateStackSize: function stateStackSize() {
545 return this.conditionStack.length;
546 },
547 options: { "case-insensitive": true },
548 performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
549 switch ($avoiding_name_collisions) {
550 case 0:
551 return 40;
552 case 1:
553 return 44;
554 case 2:
555 return 45;
556 case 3:
557 return 46;
558 case 4:
559 return 47;
560 case 5:
561 break;
562 case 6:
563 break;
564 case 7:
565 return 5;
566 case 8:
567 break;
568 case 9:
569 break;
570 case 10:
571 break;
572 case 11:
573 break;
574 case 12:
575 this.pushState("SCALE");
576 return 16;
577 case 13:
578 return 17;
579 case 14:
580 this.popState();
581 break;
582 case 15:
583 this.begin("acc_title");
584 return 32;
585 case 16:
586 this.popState();
587 return "acc_title_value";
588 case 17:
589 this.begin("acc_descr");
590 return 34;
591 case 18:
592 this.popState();
593 return "acc_descr_value";
594 case 19:
595 this.begin("acc_descr_multiline");
596 break;
597 case 20:
598 this.popState();
599 break;
600 case 21:
601 return "acc_descr_multiline_value";
602 case 22:
603 this.pushState("CLASSDEF");
604 return 37;
605 case 23:
606 this.popState();
607 this.pushState("CLASSDEFID");
608 return "DEFAULT_CLASSDEF_ID";
609 case 24:
610 this.popState();
611 this.pushState("CLASSDEFID");
612 return 38;
613 case 25:
614 this.popState();
615 return 39;
616 case 26:
617 this.pushState("CLASS");
618 return 41;
619 case 27:
620 this.popState();
621 this.pushState("CLASS_STYLE");
622 return 42;
623 case 28:
624 this.popState();
625 return 43;
626 case 29:
627 this.pushState("SCALE");
628 return 16;
629 case 30:
630 return 17;
631 case 31:
632 this.popState();
633 break;
634 case 32:
635 this.pushState("STATE");
636 break;
637 case 33:
638 this.popState();
639 yy_.yytext = yy_.yytext.slice(0, -8).trim();
640 return 24;
641 case 34:
642 this.popState();
643 yy_.yytext = yy_.yytext.slice(0, -8).trim();
644 return 25;
645 case 35:
646 this.popState();
647 yy_.yytext = yy_.yytext.slice(0, -10).trim();
648 return 26;
649 case 36:
650 this.popState();
651 yy_.yytext = yy_.yytext.slice(0, -8).trim();
652 return 24;
653 case 37:
654 this.popState();
655 yy_.yytext = yy_.yytext.slice(0, -8).trim();
656 return 25;
657 case 38:
658 this.popState();
659 yy_.yytext = yy_.yytext.slice(0, -10).trim();
660 return 26;
661 case 39:
662 return 44;
663 case 40:
664 return 45;
665 case 41:
666 return 46;
667 case 42:
668 return 47;
669 case 43:
670 this.pushState("STATE_STRING");
671 break;
672 case 44:
673 this.pushState("STATE_ID");
674 return "AS";
675 case 45:
676 this.popState();
677 return "ID";
678 case 46:
679 this.popState();
680 break;
681 case 47:
682 return "STATE_DESCR";
683 case 48:
684 return 18;
685 case 49:
686 this.popState();
687 break;
688 case 50:
689 this.popState();
690 this.pushState("struct");
691 return 19;
692 case 51:
693 break;
694 case 52:
695 this.popState();
696 return 20;
697 case 53:
698 break;
699 case 54:
700 this.begin("NOTE");
701 return 28;
702 case 55:
703 this.popState();
704 this.pushState("NOTE_ID");
705 return 52;
706 case 56:
707 this.popState();
708 this.pushState("NOTE_ID");
709 return 53;
710 case 57:
711 this.popState();
712 this.pushState("FLOATING_NOTE");
713 break;
714 case 58:
715 this.popState();
716 this.pushState("FLOATING_NOTE_ID");
717 return "AS";
718 case 59:
719 break;
720 case 60:
721 return "NOTE_TEXT";
722 case 61:
723 this.popState();
724 return "ID";
725 case 62:
726 this.popState();
727 this.pushState("NOTE_TEXT");
728 return 23;
729 case 63:
730 this.popState();
731 yy_.yytext = yy_.yytext.substr(2).trim();
732 return 30;
733 case 64:
734 this.popState();
735 yy_.yytext = yy_.yytext.slice(0, -8).trim();
736 return 30;
737 case 65:
738 return 6;
739 case 66:
740 return 6;
741 case 67:
742 return 15;
743 case 68:
744 return 50;
745 case 69:
746 return 23;
747 case 70:
748 yy_.yytext = yy_.yytext.trim();
749 return 13;
750 case 71:
751 return 14;
752 case 72:
753 return 27;
754 case 73:
755 return 51;
756 case 74:
757 return 5;
758 case 75:
759 return "INVALID";
760 }
761 },
762 rules: [/^(?: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, /^(?: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],
763 conditions: { "LINE": { "rules": [9, 10], "inclusive": false }, "struct": { "rules": [9, 10, 22, 26, 32, 39, 40, 41, 42, 51, 52, 53, 54, 68, 69, 70, 71, 72], "inclusive": false }, "FLOATING_NOTE_ID": { "rules": [61], "inclusive": false }, "FLOATING_NOTE": { "rules": [58, 59, 60], "inclusive": false }, "NOTE_TEXT": { "rules": [63, 64], "inclusive": false }, "NOTE_ID": { "rules": [62], "inclusive": false }, "NOTE": { "rules": [55, 56, 57], "inclusive": false }, "CLASS_STYLE": { "rules": [28], "inclusive": false }, "CLASS": { "rules": [27], "inclusive": false }, "CLASSDEFID": { "rules": [25], "inclusive": false }, "CLASSDEF": { "rules": [23, 24], "inclusive": false }, "acc_descr_multiline": { "rules": [20, 21], "inclusive": false }, "acc_descr": { "rules": [18], "inclusive": false }, "acc_title": { "rules": [16], "inclusive": false }, "SCALE": { "rules": [13, 14, 30, 31], "inclusive": false }, "ALIAS": { "rules": [], "inclusive": false }, "STATE_ID": { "rules": [45], "inclusive": false }, "STATE_STRING": { "rules": [46, 47], "inclusive": false }, "FORK_STATE": { "rules": [], "inclusive": false }, "STATE": { "rules": [9, 10, 33, 34, 35, 36, 37, 38, 43, 44, 48, 49, 50], "inclusive": false }, "ID": { "rules": [9, 10], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 15, 17, 19, 22, 26, 29, 32, 50, 54, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75], "inclusive": true } }
764 };
765 return lexer2;
766 }();
767 parser2.lexer = lexer;
768 function Parser() {
769 this.yy = {};
770 }
771 Parser.prototype = parser2;
772 parser2.Parser = Parser;
773 return new Parser();
774}();
775parser.parser = parser;
776const parser$1 = parser;
777const DEFAULT_DIAGRAM_DIRECTION = "LR";
778const DEFAULT_NESTED_DOC_DIR = "TB";
779const STMT_STATE = "state";
780const STMT_RELATION = "relation";
781const STMT_CLASSDEF = "classDef";
782const STMT_APPLYCLASS = "applyClass";
783const DEFAULT_STATE_TYPE = "default";
784const DIVIDER_TYPE = "divider";
785const START_NODE = "[*]";
786const START_TYPE = "start";
787const END_NODE = START_NODE;
788const END_TYPE = "end";
789const COLOR_KEYWORD = "color";
790const FILL_KEYWORD = "fill";
791const BG_FILL = "bgFill";
792const STYLECLASS_SEP = ",";
793function newClassesList() {
794 return {};
795}
796let direction = DEFAULT_DIAGRAM_DIRECTION;
797let rootDoc = [];
798let classes = newClassesList();
799const newDoc = () => {
800 return {
801 relations: [],
802 states: {},
803 documents: {}
804 };
805};
806let documents = {
807 root: newDoc()
808};
809let currentDocument = documents.root;
810let startEndCount = 0;
811let dividerCnt = 0;
812const lineType = {
813 LINE: 0,
814 DOTTED_LINE: 1
815};
816const relationType = {
817 AGGREGATION: 0,
818 EXTENSION: 1,
819 COMPOSITION: 2,
820 DEPENDENCY: 3
821};
822const clone = (o) => JSON.parse(JSON.stringify(o));
823const setRootDoc = (o) => {
824 log.info("Setting root doc", o);
825 rootDoc = o;
826};
827const getRootDoc = () => rootDoc;
828const docTranslator = (parent, node, first) => {
829 if (node.stmt === STMT_RELATION) {
830 docTranslator(parent, node.state1, true);
831 docTranslator(parent, node.state2, false);
832 } else {
833 if (node.stmt === STMT_STATE) {
834 if (node.id === "[*]") {
835 node.id = first ? parent.id + "_start" : parent.id + "_end";
836 node.start = first;
837 } else {
838 node.id = node.id.trim();
839 }
840 }
841 if (node.doc) {
842 const doc = [];
843 let currentDoc = [];
844 let i;
845 for (i = 0; i < node.doc.length; i++) {
846 if (node.doc[i].type === DIVIDER_TYPE) {
847 const newNode = clone(node.doc[i]);
848 newNode.doc = clone(currentDoc);
849 doc.push(newNode);
850 currentDoc = [];
851 } else {
852 currentDoc.push(node.doc[i]);
853 }
854 }
855 if (doc.length > 0 && currentDoc.length > 0) {
856 const newNode = {
857 stmt: STMT_STATE,
858 id: generateId(),
859 type: "divider",
860 doc: clone(currentDoc)
861 };
862 doc.push(clone(newNode));
863 node.doc = doc;
864 }
865 node.doc.forEach((docNode) => docTranslator(node, docNode, true));
866 }
867 }
868};
869const getRootDocV2 = () => {
870 docTranslator({ id: "root" }, { id: "root", doc: rootDoc }, true);
871 return { id: "root", doc: rootDoc };
872};
873const extract = (_doc) => {
874 let doc;
875 if (_doc.doc) {
876 doc = _doc.doc;
877 } else {
878 doc = _doc;
879 }
880 log.info(doc);
881 clear(true);
882 log.info("Extract", doc);
883 doc.forEach((item) => {
884 switch (item.stmt) {
885 case STMT_STATE:
886 addState(
887 item.id.trim(),
888 item.type,
889 item.doc,
890 item.description,
891 item.note,
892 item.classes,
893 item.styles,
894 item.textStyles
895 );
896 break;
897 case STMT_RELATION:
898 addRelation(item.state1, item.state2, item.description);
899 break;
900 case STMT_CLASSDEF:
901 addStyleClass(item.id.trim(), item.classes);
902 break;
903 case STMT_APPLYCLASS:
904 setCssClass(item.id.trim(), item.styleClass);
905 break;
906 }
907 });
908};
909const addState = function(id, type = DEFAULT_STATE_TYPE, doc = null, descr = null, note = null, classes2 = null, styles2 = null, textStyles = null) {
910 const trimmedId = id == null ? void 0 : id.trim();
911 if (currentDocument.states[trimmedId] === void 0) {
912 log.info("Adding state ", trimmedId, descr);
913 currentDocument.states[trimmedId] = {
914 id: trimmedId,
915 descriptions: [],
916 type,
917 doc,
918 note,
919 classes: [],
920 styles: [],
921 textStyles: []
922 };
923 } else {
924 if (!currentDocument.states[trimmedId].doc) {
925 currentDocument.states[trimmedId].doc = doc;
926 }
927 if (!currentDocument.states[trimmedId].type) {
928 currentDocument.states[trimmedId].type = type;
929 }
930 }
931 if (descr) {
932 log.info("Setting state description", trimmedId, descr);
933 if (typeof descr === "string") {
934 addDescription(trimmedId, descr.trim());
935 }
936 if (typeof descr === "object") {
937 descr.forEach((des) => addDescription(trimmedId, des.trim()));
938 }
939 }
940 if (note) {
941 currentDocument.states[trimmedId].note = note;
942 currentDocument.states[trimmedId].note.text = common.sanitizeText(
943 currentDocument.states[trimmedId].note.text,
944 getConfig()
945 );
946 }
947 if (classes2) {
948 log.info("Setting state classes", trimmedId, classes2);
949 const classesList = typeof classes2 === "string" ? [classes2] : classes2;
950 classesList.forEach((cssClass) => setCssClass(trimmedId, cssClass.trim()));
951 }
952 if (styles2) {
953 log.info("Setting state styles", trimmedId, styles2);
954 const stylesList = typeof styles2 === "string" ? [styles2] : styles2;
955 stylesList.forEach((style) => setStyle(trimmedId, style.trim()));
956 }
957 if (textStyles) {
958 log.info("Setting state styles", trimmedId, styles2);
959 const textStylesList = typeof textStyles === "string" ? [textStyles] : textStyles;
960 textStylesList.forEach((textStyle) => setTextStyle(trimmedId, textStyle.trim()));
961 }
962};
963const clear = function(saveCommon) {
964 documents = {
965 root: newDoc()
966 };
967 currentDocument = documents.root;
968 startEndCount = 0;
969 classes = newClassesList();
970 if (!saveCommon) {
971 clear$1();
972 }
973};
974const getState = function(id) {
975 return currentDocument.states[id];
976};
977const getStates = function() {
978 return currentDocument.states;
979};
980const logDocuments = function() {
981 log.info("Documents = ", documents);
982};
983const getRelations = function() {
984 return currentDocument.relations;
985};
986function startIdIfNeeded(id = "") {
987 let fixedId = id;
988 if (id === START_NODE) {
989 startEndCount++;
990 fixedId = `${START_TYPE}${startEndCount}`;
991 }
992 return fixedId;
993}
994function startTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
995 return id === START_NODE ? START_TYPE : type;
996}
997function endIdIfNeeded(id = "") {
998 let fixedId = id;
999 if (id === END_NODE) {
1000 startEndCount++;
1001 fixedId = `${END_TYPE}${startEndCount}`;
1002 }
1003 return fixedId;
1004}
1005function endTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1006 return id === END_NODE ? END_TYPE : type;
1007}
1008function addRelationObjs(item1, item2, relationTitle) {
1009 let id1 = startIdIfNeeded(item1.id.trim());
1010 let type1 = startTypeIfNeeded(item1.id.trim(), item1.type);
1011 let id2 = startIdIfNeeded(item2.id.trim());
1012 let type2 = startTypeIfNeeded(item2.id.trim(), item2.type);
1013 addState(
1014 id1,
1015 type1,
1016 item1.doc,
1017 item1.description,
1018 item1.note,
1019 item1.classes,
1020 item1.styles,
1021 item1.textStyles
1022 );
1023 addState(
1024 id2,
1025 type2,
1026 item2.doc,
1027 item2.description,
1028 item2.note,
1029 item2.classes,
1030 item2.styles,
1031 item2.textStyles
1032 );
1033 currentDocument.relations.push({
1034 id1,
1035 id2,
1036 relationTitle: common.sanitizeText(relationTitle, getConfig())
1037 });
1038}
1039const addRelation = function(item1, item2, title) {
1040 if (typeof item1 === "object") {
1041 addRelationObjs(item1, item2, title);
1042 } else {
1043 const id1 = startIdIfNeeded(item1.trim());
1044 const type1 = startTypeIfNeeded(item1);
1045 const id2 = endIdIfNeeded(item2.trim());
1046 const type2 = endTypeIfNeeded(item2);
1047 addState(id1, type1);
1048 addState(id2, type2);
1049 currentDocument.relations.push({
1050 id1,
1051 id2,
1052 title: common.sanitizeText(title, getConfig())
1053 });
1054 }
1055};
1056const addDescription = function(id, descr) {
1057 const theState = currentDocument.states[id];
1058 const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr;
1059 theState.descriptions.push(common.sanitizeText(_descr, getConfig()));
1060};
1061const cleanupLabel = function(label) {
1062 if (label.substring(0, 1) === ":") {
1063 return label.substr(2).trim();
1064 } else {
1065 return label.trim();
1066 }
1067};
1068const getDividerId = () => {
1069 dividerCnt++;
1070 return "divider-id-" + dividerCnt;
1071};
1072const addStyleClass = function(id, styleAttributes = "") {
1073 if (classes[id] === void 0) {
1074 classes[id] = { id, styles: [], textStyles: [] };
1075 }
1076 const foundClass = classes[id];
1077 if (styleAttributes !== void 0 && styleAttributes !== null) {
1078 styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
1079 const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
1080 if (attrib.match(COLOR_KEYWORD)) {
1081 const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
1082 const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
1083 foundClass.textStyles.push(newStyle2);
1084 }
1085 foundClass.styles.push(fixedAttrib);
1086 });
1087 }
1088};
1089const getClasses = function() {
1090 return classes;
1091};
1092const setCssClass = function(itemIds, cssClassName) {
1093 itemIds.split(",").forEach(function(id) {
1094 let foundState = getState(id);
1095 if (foundState === void 0) {
1096 const trimmedId = id.trim();
1097 addState(trimmedId);
1098 foundState = getState(trimmedId);
1099 }
1100 foundState.classes.push(cssClassName);
1101 });
1102};
1103const setStyle = function(itemId, styleText) {
1104 const item = getState(itemId);
1105 if (item !== void 0) {
1106 item.textStyles.push(styleText);
1107 }
1108};
1109const setTextStyle = function(itemId, cssClassName) {
1110 const item = getState(itemId);
1111 if (item !== void 0) {
1112 item.textStyles.push(cssClassName);
1113 }
1114};
1115const getDirection = () => direction;
1116const setDirection = (dir) => {
1117 direction = dir;
1118};
1119const trimColon = (str) => str && str[0] === ":" ? str.substr(1).trim() : str.trim();
1120const db = {
1121 getConfig: () => getConfig().state,
1122 addState,
1123 clear,
1124 getState,
1125 getStates,
1126 getRelations,
1127 getClasses,
1128 getDirection,
1129 addRelation,
1130 getDividerId,
1131 setDirection,
1132 cleanupLabel,
1133 lineType,
1134 relationType,
1135 logDocuments,
1136 getRootDoc,
1137 setRootDoc,
1138 getRootDocV2,
1139 extract,
1140 trimColon,
1141 getAccTitle,
1142 setAccTitle,
1143 getAccDescription,
1144 setAccDescription,
1145 addStyleClass,
1146 setCssClass,
1147 addDescription,
1148 setDiagramTitle,
1149 getDiagramTitle
1150};
1151const getStyles = (options) => `
1152defs #statediagram-barbEnd {
1153 fill: ${options.transitionColor};
1154 stroke: ${options.transitionColor};
1155 }
1156g.stateGroup text {
1157 fill: ${options.nodeBorder};
1158 stroke: none;
1159 font-size: 10px;
1160}
1161g.stateGroup text {
1162 fill: ${options.textColor};
1163 stroke: none;
1164 font-size: 10px;
1165
1166}
1167g.stateGroup .state-title {
1168 font-weight: bolder;
1169 fill: ${options.stateLabelColor};
1170}
1171
1172g.stateGroup rect {
1173 fill: ${options.mainBkg};
1174 stroke: ${options.nodeBorder};
1175}
1176
1177g.stateGroup line {
1178 stroke: ${options.lineColor};
1179 stroke-width: 1;
1180}
1181
1182.transition {
1183 stroke: ${options.transitionColor};
1184 stroke-width: 1;
1185 fill: none;
1186}
1187
1188.stateGroup .composit {
1189 fill: ${options.background};
1190 border-bottom: 1px
1191}
1192
1193.stateGroup .alt-composit {
1194 fill: #e0e0e0;
1195 border-bottom: 1px
1196}
1197
1198.state-note {
1199 stroke: ${options.noteBorderColor};
1200 fill: ${options.noteBkgColor};
1201
1202 text {
1203 fill: ${options.noteTextColor};
1204 stroke: none;
1205 font-size: 10px;
1206 }
1207}
1208
1209.stateLabel .box {
1210 stroke: none;
1211 stroke-width: 0;
1212 fill: ${options.mainBkg};
1213 opacity: 0.5;
1214}
1215
1216.edgeLabel .label rect {
1217 fill: ${options.labelBackgroundColor};
1218 opacity: 0.5;
1219}
1220.edgeLabel .label text {
1221 fill: ${options.transitionLabelColor || options.tertiaryTextColor};
1222}
1223.label div .edgeLabel {
1224 color: ${options.transitionLabelColor || options.tertiaryTextColor};
1225}
1226
1227.stateLabel text {
1228 fill: ${options.stateLabelColor};
1229 font-size: 10px;
1230 font-weight: bold;
1231}
1232
1233.node circle.state-start {
1234 fill: ${options.specialStateColor};
1235 stroke: ${options.specialStateColor};
1236}
1237
1238.node .fork-join {
1239 fill: ${options.specialStateColor};
1240 stroke: ${options.specialStateColor};
1241}
1242
1243.node circle.state-end {
1244 fill: ${options.innerEndBackground};
1245 stroke: ${options.background};
1246 stroke-width: 1.5
1247}
1248.end-state-inner {
1249 fill: ${options.compositeBackground || options.background};
1250 // stroke: ${options.background};
1251 stroke-width: 1.5
1252}
1253
1254.node rect {
1255 fill: ${options.stateBkg || options.mainBkg};
1256 stroke: ${options.stateBorder || options.nodeBorder};
1257 stroke-width: 1px;
1258}
1259.node polygon {
1260 fill: ${options.mainBkg};
1261 stroke: ${options.stateBorder || options.nodeBorder};;
1262 stroke-width: 1px;
1263}
1264#statediagram-barbEnd {
1265 fill: ${options.lineColor};
1266}
1267
1268.statediagram-cluster rect {
1269 fill: ${options.compositeTitleBackground};
1270 stroke: ${options.stateBorder || options.nodeBorder};
1271 stroke-width: 1px;
1272}
1273
1274.cluster-label, .nodeLabel {
1275 color: ${options.stateLabelColor};
1276}
1277
1278.statediagram-cluster rect.outer {
1279 rx: 5px;
1280 ry: 5px;
1281}
1282.statediagram-state .divider {
1283 stroke: ${options.stateBorder || options.nodeBorder};
1284}
1285
1286.statediagram-state .title-state {
1287 rx: 5px;
1288 ry: 5px;
1289}
1290.statediagram-cluster.statediagram-cluster .inner {
1291 fill: ${options.compositeBackground || options.background};
1292}
1293.statediagram-cluster.statediagram-cluster-alt .inner {
1294 fill: ${options.altBackground ? options.altBackground : "#efefef"};
1295}
1296
1297.statediagram-cluster .inner {
1298 rx:0;
1299 ry:0;
1300}
1301
1302.statediagram-state rect.basic {
1303 rx: 5px;
1304 ry: 5px;
1305}
1306.statediagram-state rect.divider {
1307 stroke-dasharray: 10,10;
1308 fill: ${options.altBackground ? options.altBackground : "#efefef"};
1309}
1310
1311.note-edge {
1312 stroke-dasharray: 5;
1313}
1314
1315.statediagram-note rect {
1316 fill: ${options.noteBkgColor};
1317 stroke: ${options.noteBorderColor};
1318 stroke-width: 1px;
1319 rx: 0;
1320 ry: 0;
1321}
1322.statediagram-note rect {
1323 fill: ${options.noteBkgColor};
1324 stroke: ${options.noteBorderColor};
1325 stroke-width: 1px;
1326 rx: 0;
1327 ry: 0;
1328}
1329
1330.statediagram-note text {
1331 fill: ${options.noteTextColor};
1332}
1333
1334.statediagram-note .nodeLabel {
1335 color: ${options.noteTextColor};
1336}
1337.statediagram .edgeLabel {
1338 color: red; // ${options.noteTextColor};
1339}
1340
1341#dependencyStart, #dependencyEnd {
1342 fill: ${options.lineColor};
1343 stroke: ${options.lineColor};
1344 stroke-width: 1;
1345}
1346
1347.statediagramTitleText {
1348 text-anchor: middle;
1349 font-size: 18px;
1350 fill: ${options.textColor};
1351}
1352`;
1353const styles = getStyles;
1354export {
1355 DEFAULT_STATE_TYPE as D,
1356 STMT_RELATION as S,
1357 DIVIDER_TYPE as a,
1358 STMT_STATE as b,
1359 DEFAULT_NESTED_DOC_DIR as c,
1360 db as d,
1361 parser$1 as p,
1362 styles as s
1363};