1 | import { I as commonDb, J as parseDirective$1, v as clear$1, c as getConfig, l as log, p as setupGraphViewbox } from "./mermaid-a953d906.js";
|
2 | import { select, arc } from "d3";
|
3 | import { isDark, lighten, darken } from "khroma";
|
4 | import "ts-dedent";
|
5 | import "dayjs/esm/index.js";
|
6 | import "@braintree/sanitize-url";
|
7 | import "dompurify";
|
8 | import "lodash-es/memoize.js";
|
9 | import "stylis";
|
10 | import "lodash-es/isEmpty.js";
|
11 | var parser = function() {
|
12 | var o = function(k, v, o2, l) {
|
13 | for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
|
14 | ;
|
15 | return o2;
|
16 | }, $V0 = [1, 2], $V1 = [1, 5], $V2 = [6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 17], $V6 = [1, 18], $V7 = [1, 19], $V8 = [1, 23], $V9 = [1, 24], $Va = [1, 27], $Vb = [4, 6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28];
|
17 | var parser2 = {
|
18 | trace: function trace() {
|
19 | },
|
20 | yy: {},
|
21 | symbols_: { "error": 2, "start": 3, "timeline": 4, "document": 5, "EOF": 6, "directive": 7, "line": 8, "SPACE": 9, "statement": 10, "NEWLINE": 11, "openDirective": 12, "typeDirective": 13, "closeDirective": 14, ":": 15, "argDirective": 16, "title": 17, "acc_title": 18, "acc_title_value": 19, "acc_descr": 20, "acc_descr_value": 21, "acc_descr_multiline_value": 22, "section": 23, "period_statement": 24, "event_statement": 25, "period": 26, "event": 27, "open_directive": 28, "type_directive": 29, "arg_directive": 30, "close_directive": 31, "$accept": 0, "$end": 1 },
|
22 | terminals_: { 2: "error", 4: "timeline", 6: "EOF", 9: "SPACE", 11: "NEWLINE", 15: ":", 17: "title", 18: "acc_title", 19: "acc_title_value", 20: "acc_descr", 21: "acc_descr_value", 22: "acc_descr_multiline_value", 23: "section", 26: "period", 27: "event", 28: "open_directive", 29: "type_directive", 30: "arg_directive", 31: "close_directive" },
|
23 | productions_: [0, [3, 3], [3, 2], [5, 0], [5, 2], [8, 2], [8, 1], [8, 1], [8, 1], [7, 4], [7, 6], [10, 1], [10, 2], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [24, 1], [25, 1], [12, 1], [13, 1], [16, 1], [14, 1]],
|
24 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
25 | var $0 = $$.length - 1;
|
26 | switch (yystate) {
|
27 | case 1:
|
28 | return $$[$0 - 1];
|
29 | case 3:
|
30 | this.$ = [];
|
31 | break;
|
32 | case 4:
|
33 | $$[$0 - 1].push($$[$0]);
|
34 | this.$ = $$[$0 - 1];
|
35 | break;
|
36 | case 5:
|
37 | case 6:
|
38 | this.$ = $$[$0];
|
39 | break;
|
40 | case 7:
|
41 | case 8:
|
42 | this.$ = [];
|
43 | break;
|
44 | case 11:
|
45 | yy.getCommonDb().setDiagramTitle($$[$0].substr(6));
|
46 | this.$ = $$[$0].substr(6);
|
47 | break;
|
48 | case 12:
|
49 | this.$ = $$[$0].trim();
|
50 | yy.getCommonDb().setAccTitle(this.$);
|
51 | break;
|
52 | case 13:
|
53 | case 14:
|
54 | this.$ = $$[$0].trim();
|
55 | yy.getCommonDb().setAccDescription(this.$);
|
56 | break;
|
57 | case 15:
|
58 | yy.addSection($$[$0].substr(8));
|
59 | this.$ = $$[$0].substr(8);
|
60 | break;
|
61 | case 19:
|
62 | yy.addTask($$[$0], 0, "");
|
63 | this.$ = $$[$0];
|
64 | break;
|
65 | case 20:
|
66 | yy.addEvent($$[$0].substr(2));
|
67 | this.$ = $$[$0];
|
68 | break;
|
69 | case 21:
|
70 | yy.parseDirective("%%{", "open_directive");
|
71 | break;
|
72 | case 22:
|
73 | yy.parseDirective($$[$0], "type_directive");
|
74 | break;
|
75 | case 23:
|
76 | $$[$0] = $$[$0].trim().replace(/'/g, '"');
|
77 | yy.parseDirective($$[$0], "arg_directive");
|
78 | break;
|
79 | case 24:
|
80 | yy.parseDirective("}%%", "close_directive", "timeline");
|
81 | break;
|
82 | }
|
83 | },
|
84 | table: [{ 3: 1, 4: $V0, 7: 3, 12: 4, 28: $V1 }, { 1: [3] }, o($V2, [2, 3], { 5: 6 }), { 3: 7, 4: $V0, 7: 3, 12: 4, 28: $V1 }, { 13: 8, 29: [1, 9] }, { 29: [2, 21] }, { 6: [1, 10], 7: 22, 8: 11, 9: [1, 12], 10: 13, 11: [1, 14], 12: 4, 17: $V3, 18: $V4, 20: $V5, 22: $V6, 23: $V7, 24: 20, 25: 21, 26: $V8, 27: $V9, 28: $V1 }, { 1: [2, 2] }, { 14: 25, 15: [1, 26], 31: $Va }, o([15, 31], [2, 22]), o($V2, [2, 8], { 1: [2, 1] }), o($V2, [2, 4]), { 7: 22, 10: 28, 12: 4, 17: $V3, 18: $V4, 20: $V5, 22: $V6, 23: $V7, 24: 20, 25: 21, 26: $V8, 27: $V9, 28: $V1 }, o($V2, [2, 6]), o($V2, [2, 7]), o($V2, [2, 11]), { 19: [1, 29] }, { 21: [1, 30] }, o($V2, [2, 14]), o($V2, [2, 15]), o($V2, [2, 16]), o($V2, [2, 17]), o($V2, [2, 18]), o($V2, [2, 19]), o($V2, [2, 20]), { 11: [1, 31] }, { 16: 32, 30: [1, 33] }, { 11: [2, 24] }, o($V2, [2, 5]), o($V2, [2, 12]), o($V2, [2, 13]), o($Vb, [2, 9]), { 14: 34, 31: $Va }, { 31: [2, 23] }, { 11: [1, 35] }, o($Vb, [2, 10])],
|
85 | defaultActions: { 5: [2, 21], 7: [2, 2], 27: [2, 24], 33: [2, 23] },
|
86 | parseError: function parseError(str, hash) {
|
87 | if (hash.recoverable) {
|
88 | this.trace(str);
|
89 | } else {
|
90 | var error = new Error(str);
|
91 | error.hash = hash;
|
92 | throw error;
|
93 | }
|
94 | },
|
95 | parse: function parse(input) {
|
96 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
|
97 | var args = lstack.slice.call(arguments, 1);
|
98 | var lexer2 = Object.create(this.lexer);
|
99 | var sharedState = { yy: {} };
|
100 | for (var k in this.yy) {
|
101 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
102 | sharedState.yy[k] = this.yy[k];
|
103 | }
|
104 | }
|
105 | lexer2.setInput(input, sharedState.yy);
|
106 | sharedState.yy.lexer = lexer2;
|
107 | sharedState.yy.parser = this;
|
108 | if (typeof lexer2.yylloc == "undefined") {
|
109 | lexer2.yylloc = {};
|
110 | }
|
111 | var yyloc = lexer2.yylloc;
|
112 | lstack.push(yyloc);
|
113 | var ranges = lexer2.options && lexer2.options.ranges;
|
114 | if (typeof sharedState.yy.parseError === "function") {
|
115 | this.parseError = sharedState.yy.parseError;
|
116 | } else {
|
117 | this.parseError = Object.getPrototypeOf(this).parseError;
|
118 | }
|
119 | function lex() {
|
120 | var token;
|
121 | token = tstack.pop() || lexer2.lex() || EOF;
|
122 | if (typeof token !== "number") {
|
123 | if (token instanceof Array) {
|
124 | tstack = token;
|
125 | token = tstack.pop();
|
126 | }
|
127 | token = self.symbols_[token] || token;
|
128 | }
|
129 | return token;
|
130 | }
|
131 | var symbol, state, action, r, yyval = {}, p, len, newState, expected;
|
132 | while (true) {
|
133 | state = stack[stack.length - 1];
|
134 | if (this.defaultActions[state]) {
|
135 | action = this.defaultActions[state];
|
136 | } else {
|
137 | if (symbol === null || typeof symbol == "undefined") {
|
138 | symbol = lex();
|
139 | }
|
140 | action = table[state] && table[state][symbol];
|
141 | }
|
142 | if (typeof action === "undefined" || !action.length || !action[0]) {
|
143 | var errStr = "";
|
144 | expected = [];
|
145 | for (p in table[state]) {
|
146 | if (this.terminals_[p] && p > TERROR) {
|
147 | expected.push("'" + this.terminals_[p] + "'");
|
148 | }
|
149 | }
|
150 | if (lexer2.showPosition) {
|
151 | errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
152 | } else {
|
153 | errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
154 | }
|
155 | this.parseError(errStr, {
|
156 | text: lexer2.match,
|
157 | token: this.terminals_[symbol] || symbol,
|
158 | line: lexer2.yylineno,
|
159 | loc: yyloc,
|
160 | expected
|
161 | });
|
162 | }
|
163 | if (action[0] instanceof Array && action.length > 1) {
|
164 | throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
165 | }
|
166 | switch (action[0]) {
|
167 | case 1:
|
168 | stack.push(symbol);
|
169 | vstack.push(lexer2.yytext);
|
170 | lstack.push(lexer2.yylloc);
|
171 | stack.push(action[1]);
|
172 | symbol = null;
|
173 | {
|
174 | yyleng = lexer2.yyleng;
|
175 | yytext = lexer2.yytext;
|
176 | yylineno = lexer2.yylineno;
|
177 | yyloc = lexer2.yylloc;
|
178 | }
|
179 | break;
|
180 | case 2:
|
181 | len = this.productions_[action[1]][1];
|
182 | yyval.$ = vstack[vstack.length - len];
|
183 | yyval._$ = {
|
184 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
185 | last_line: lstack[lstack.length - 1].last_line,
|
186 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
187 | last_column: lstack[lstack.length - 1].last_column
|
188 | };
|
189 | if (ranges) {
|
190 | yyval._$.range = [
|
191 | lstack[lstack.length - (len || 1)].range[0],
|
192 | lstack[lstack.length - 1].range[1]
|
193 | ];
|
194 | }
|
195 | r = this.performAction.apply(yyval, [
|
196 | yytext,
|
197 | yyleng,
|
198 | yylineno,
|
199 | sharedState.yy,
|
200 | action[1],
|
201 | vstack,
|
202 | lstack
|
203 | ].concat(args));
|
204 | if (typeof r !== "undefined") {
|
205 | return r;
|
206 | }
|
207 | if (len) {
|
208 | stack = stack.slice(0, -1 * len * 2);
|
209 | vstack = vstack.slice(0, -1 * len);
|
210 | lstack = lstack.slice(0, -1 * len);
|
211 | }
|
212 | stack.push(this.productions_[action[1]][0]);
|
213 | vstack.push(yyval.$);
|
214 | lstack.push(yyval._$);
|
215 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
216 | stack.push(newState);
|
217 | break;
|
218 | case 3:
|
219 | return true;
|
220 | }
|
221 | }
|
222 | return true;
|
223 | }
|
224 | };
|
225 | var lexer = function() {
|
226 | var lexer2 = {
|
227 | EOF: 1,
|
228 | parseError: function parseError(str, hash) {
|
229 | if (this.yy.parser) {
|
230 | this.yy.parser.parseError(str, hash);
|
231 | } else {
|
232 | throw new Error(str);
|
233 | }
|
234 | },
|
235 |
|
236 | setInput: function(input, yy) {
|
237 | this.yy = yy || this.yy || {};
|
238 | this._input = input;
|
239 | this._more = this._backtrack = this.done = false;
|
240 | this.yylineno = this.yyleng = 0;
|
241 | this.yytext = this.matched = this.match = "";
|
242 | this.conditionStack = ["INITIAL"];
|
243 | this.yylloc = {
|
244 | first_line: 1,
|
245 | first_column: 0,
|
246 | last_line: 1,
|
247 | last_column: 0
|
248 | };
|
249 | if (this.options.ranges) {
|
250 | this.yylloc.range = [0, 0];
|
251 | }
|
252 | this.offset = 0;
|
253 | return this;
|
254 | },
|
255 |
|
256 | input: function() {
|
257 | var ch = this._input[0];
|
258 | this.yytext += ch;
|
259 | this.yyleng++;
|
260 | this.offset++;
|
261 | this.match += ch;
|
262 | this.matched += ch;
|
263 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
264 | if (lines) {
|
265 | this.yylineno++;
|
266 | this.yylloc.last_line++;
|
267 | } else {
|
268 | this.yylloc.last_column++;
|
269 | }
|
270 | if (this.options.ranges) {
|
271 | this.yylloc.range[1]++;
|
272 | }
|
273 | this._input = this._input.slice(1);
|
274 | return ch;
|
275 | },
|
276 |
|
277 | unput: function(ch) {
|
278 | var len = ch.length;
|
279 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
280 | this._input = ch + this._input;
|
281 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
282 | this.offset -= len;
|
283 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
284 | this.match = this.match.substr(0, this.match.length - 1);
|
285 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
286 | if (lines.length - 1) {
|
287 | this.yylineno -= lines.length - 1;
|
288 | }
|
289 | var r = this.yylloc.range;
|
290 | this.yylloc = {
|
291 | first_line: this.yylloc.first_line,
|
292 | last_line: this.yylineno + 1,
|
293 | first_column: this.yylloc.first_column,
|
294 | 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
|
295 | };
|
296 | if (this.options.ranges) {
|
297 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
298 | }
|
299 | this.yyleng = this.yytext.length;
|
300 | return this;
|
301 | },
|
302 |
|
303 | more: function() {
|
304 | this._more = true;
|
305 | return this;
|
306 | },
|
307 |
|
308 | reject: function() {
|
309 | if (this.options.backtrack_lexer) {
|
310 | this._backtrack = true;
|
311 | } else {
|
312 | 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(), {
|
313 | text: "",
|
314 | token: null,
|
315 | line: this.yylineno
|
316 | });
|
317 | }
|
318 | return this;
|
319 | },
|
320 |
|
321 | less: function(n) {
|
322 | this.unput(this.match.slice(n));
|
323 | },
|
324 |
|
325 | pastInput: function() {
|
326 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
327 | return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
328 | },
|
329 |
|
330 | upcomingInput: function() {
|
331 | var next = this.match;
|
332 | if (next.length < 20) {
|
333 | next += this._input.substr(0, 20 - next.length);
|
334 | }
|
335 | return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
336 | },
|
337 |
|
338 | showPosition: function() {
|
339 | var pre = this.pastInput();
|
340 | var c = new Array(pre.length + 1).join("-");
|
341 | return pre + this.upcomingInput() + "\n" + c + "^";
|
342 | },
|
343 |
|
344 | test_match: function(match, indexed_rule) {
|
345 | var token, lines, backup;
|
346 | if (this.options.backtrack_lexer) {
|
347 | backup = {
|
348 | yylineno: this.yylineno,
|
349 | yylloc: {
|
350 | first_line: this.yylloc.first_line,
|
351 | last_line: this.last_line,
|
352 | first_column: this.yylloc.first_column,
|
353 | last_column: this.yylloc.last_column
|
354 | },
|
355 | yytext: this.yytext,
|
356 | match: this.match,
|
357 | matches: this.matches,
|
358 | matched: this.matched,
|
359 | yyleng: this.yyleng,
|
360 | offset: this.offset,
|
361 | _more: this._more,
|
362 | _input: this._input,
|
363 | yy: this.yy,
|
364 | conditionStack: this.conditionStack.slice(0),
|
365 | done: this.done
|
366 | };
|
367 | if (this.options.ranges) {
|
368 | backup.yylloc.range = this.yylloc.range.slice(0);
|
369 | }
|
370 | }
|
371 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
372 | if (lines) {
|
373 | this.yylineno += lines.length;
|
374 | }
|
375 | this.yylloc = {
|
376 | first_line: this.yylloc.last_line,
|
377 | last_line: this.yylineno + 1,
|
378 | first_column: this.yylloc.last_column,
|
379 | last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
380 | };
|
381 | this.yytext += match[0];
|
382 | this.match += match[0];
|
383 | this.matches = match;
|
384 | this.yyleng = this.yytext.length;
|
385 | if (this.options.ranges) {
|
386 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
387 | }
|
388 | this._more = false;
|
389 | this._backtrack = false;
|
390 | this._input = this._input.slice(match[0].length);
|
391 | this.matched += match[0];
|
392 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
393 | if (this.done && this._input) {
|
394 | this.done = false;
|
395 | }
|
396 | if (token) {
|
397 | return token;
|
398 | } else if (this._backtrack) {
|
399 | for (var k in backup) {
|
400 | this[k] = backup[k];
|
401 | }
|
402 | return false;
|
403 | }
|
404 | return false;
|
405 | },
|
406 |
|
407 | next: function() {
|
408 | if (this.done) {
|
409 | return this.EOF;
|
410 | }
|
411 | if (!this._input) {
|
412 | this.done = true;
|
413 | }
|
414 | var token, match, tempMatch, index;
|
415 | if (!this._more) {
|
416 | this.yytext = "";
|
417 | this.match = "";
|
418 | }
|
419 | var rules = this._currentRules();
|
420 | for (var i = 0; i < rules.length; i++) {
|
421 | tempMatch = this._input.match(this.rules[rules[i]]);
|
422 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
423 | match = tempMatch;
|
424 | index = i;
|
425 | if (this.options.backtrack_lexer) {
|
426 | token = this.test_match(tempMatch, rules[i]);
|
427 | if (token !== false) {
|
428 | return token;
|
429 | } else if (this._backtrack) {
|
430 | match = false;
|
431 | continue;
|
432 | } else {
|
433 | return false;
|
434 | }
|
435 | } else if (!this.options.flex) {
|
436 | break;
|
437 | }
|
438 | }
|
439 | }
|
440 | if (match) {
|
441 | token = this.test_match(match, rules[index]);
|
442 | if (token !== false) {
|
443 | return token;
|
444 | }
|
445 | return false;
|
446 | }
|
447 | if (this._input === "") {
|
448 | return this.EOF;
|
449 | } else {
|
450 | return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
451 | text: "",
|
452 | token: null,
|
453 | line: this.yylineno
|
454 | });
|
455 | }
|
456 | },
|
457 |
|
458 | lex: function lex() {
|
459 | var r = this.next();
|
460 | if (r) {
|
461 | return r;
|
462 | } else {
|
463 | return this.lex();
|
464 | }
|
465 | },
|
466 |
|
467 | begin: function begin(condition) {
|
468 | this.conditionStack.push(condition);
|
469 | },
|
470 |
|
471 | popState: function popState() {
|
472 | var n = this.conditionStack.length - 1;
|
473 | if (n > 0) {
|
474 | return this.conditionStack.pop();
|
475 | } else {
|
476 | return this.conditionStack[0];
|
477 | }
|
478 | },
|
479 |
|
480 | _currentRules: function _currentRules() {
|
481 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
482 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
483 | } else {
|
484 | return this.conditions["INITIAL"].rules;
|
485 | }
|
486 | },
|
487 |
|
488 | topState: function topState(n) {
|
489 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
490 | if (n >= 0) {
|
491 | return this.conditionStack[n];
|
492 | } else {
|
493 | return "INITIAL";
|
494 | }
|
495 | },
|
496 |
|
497 | pushState: function pushState(condition) {
|
498 | this.begin(condition);
|
499 | },
|
500 |
|
501 | stateStackSize: function stateStackSize() {
|
502 | return this.conditionStack.length;
|
503 | },
|
504 | options: { "case-insensitive": true },
|
505 | performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
506 | switch ($avoiding_name_collisions) {
|
507 | case 0:
|
508 | this.begin("open_directive");
|
509 | return 28;
|
510 | case 1:
|
511 | this.begin("type_directive");
|
512 | return 29;
|
513 | case 2:
|
514 | this.popState();
|
515 | this.begin("arg_directive");
|
516 | return 15;
|
517 | case 3:
|
518 | this.popState();
|
519 | this.popState();
|
520 | return 31;
|
521 | case 4:
|
522 | return 30;
|
523 | case 5:
|
524 | break;
|
525 | case 6:
|
526 | break;
|
527 | case 7:
|
528 | return 11;
|
529 | case 8:
|
530 | break;
|
531 | case 9:
|
532 | break;
|
533 | case 10:
|
534 | return 4;
|
535 | case 11:
|
536 | return 17;
|
537 | case 12:
|
538 | this.begin("acc_title");
|
539 | return 18;
|
540 | case 13:
|
541 | this.popState();
|
542 | return "acc_title_value";
|
543 | case 14:
|
544 | this.begin("acc_descr");
|
545 | return 20;
|
546 | case 15:
|
547 | this.popState();
|
548 | return "acc_descr_value";
|
549 | case 16:
|
550 | this.begin("acc_descr_multiline");
|
551 | break;
|
552 | case 17:
|
553 | this.popState();
|
554 | break;
|
555 | case 18:
|
556 | return "acc_descr_multiline_value";
|
557 | case 19:
|
558 | return 23;
|
559 | case 20:
|
560 | return 27;
|
561 | case 21:
|
562 | return 26;
|
563 | case 22:
|
564 | return 6;
|
565 | case 23:
|
566 | return "INVALID";
|
567 | }
|
568 | },
|
569 | rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?::\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?:$)/i, /^(?:.)/i],
|
570 | conditions: { "open_directive": { "rules": [1], "inclusive": false }, "type_directive": { "rules": [2, 3], "inclusive": false }, "arg_directive": { "rules": [3, 4], "inclusive": false }, "acc_descr_multiline": { "rules": [17, 18], "inclusive": false }, "acc_descr": { "rules": [15], "inclusive": false }, "acc_title": { "rules": [13], "inclusive": false }, "INITIAL": { "rules": [0, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 19, 20, 21, 22, 23], "inclusive": true } }
|
571 | };
|
572 | return lexer2;
|
573 | }();
|
574 | parser2.lexer = lexer;
|
575 | function Parser() {
|
576 | this.yy = {};
|
577 | }
|
578 | Parser.prototype = parser2;
|
579 | parser2.Parser = Parser;
|
580 | return new Parser();
|
581 | }();
|
582 | parser.parser = parser;
|
583 | const parser$1 = parser;
|
584 | let currentSection = "";
|
585 | let currentTaskId = 0;
|
586 | const sections = [];
|
587 | const tasks = [];
|
588 | const rawTasks = [];
|
589 | const getCommonDb = () => commonDb;
|
590 | const parseDirective = (statement, context, type) => {
|
591 | parseDirective$1(globalThis, statement, context, type);
|
592 | };
|
593 | const clear = function() {
|
594 | sections.length = 0;
|
595 | tasks.length = 0;
|
596 | currentSection = "";
|
597 | rawTasks.length = 0;
|
598 | clear$1();
|
599 | };
|
600 | const addSection = function(txt) {
|
601 | currentSection = txt;
|
602 | sections.push(txt);
|
603 | };
|
604 | const getSections = function() {
|
605 | return sections;
|
606 | };
|
607 | const getTasks = function() {
|
608 | let allItemsProcessed = compileTasks();
|
609 | const maxDepth = 100;
|
610 | let iterationCount = 0;
|
611 | while (!allItemsProcessed && iterationCount < maxDepth) {
|
612 | allItemsProcessed = compileTasks();
|
613 | iterationCount++;
|
614 | }
|
615 | tasks.push(...rawTasks);
|
616 | return tasks;
|
617 | };
|
618 | const addTask = function(period, length, event) {
|
619 | const rawTask = {
|
620 | id: currentTaskId++,
|
621 | section: currentSection,
|
622 | type: currentSection,
|
623 | task: period,
|
624 | score: length ? length : 0,
|
625 |
|
626 | events: event ? [event] : []
|
627 | };
|
628 | rawTasks.push(rawTask);
|
629 | };
|
630 | const addEvent = function(event) {
|
631 | const currentTask = rawTasks.find((task) => task.id === currentTaskId - 1);
|
632 | currentTask.events.push(event);
|
633 | };
|
634 | const addTaskOrg = function(descr) {
|
635 | const newTask = {
|
636 | section: currentSection,
|
637 | type: currentSection,
|
638 | description: descr,
|
639 | task: descr,
|
640 | classes: []
|
641 | };
|
642 | tasks.push(newTask);
|
643 | };
|
644 | const compileTasks = function() {
|
645 | const compileTask = function(pos) {
|
646 | return rawTasks[pos].processed;
|
647 | };
|
648 | let allProcessed = true;
|
649 | for (const [i, rawTask] of rawTasks.entries()) {
|
650 | compileTask(i);
|
651 | allProcessed = allProcessed && rawTask.processed;
|
652 | }
|
653 | return allProcessed;
|
654 | };
|
655 | const timelineDb = {
|
656 | clear,
|
657 | getCommonDb,
|
658 | addSection,
|
659 | getSections,
|
660 | getTasks,
|
661 | addTask,
|
662 | addTaskOrg,
|
663 | addEvent,
|
664 | parseDirective
|
665 | };
|
666 | const db = Object.freeze( Object.defineProperty({
|
667 | __proto__: null,
|
668 | addEvent,
|
669 | addSection,
|
670 | addTask,
|
671 | addTaskOrg,
|
672 | clear,
|
673 | default: timelineDb,
|
674 | getCommonDb,
|
675 | getSections,
|
676 | getTasks,
|
677 | parseDirective
|
678 | }, Symbol.toStringTag, { value: "Module" }));
|
679 | const MAX_SECTIONS = 12;
|
680 | const drawRect = function(elem, rectData) {
|
681 | const rectElem = elem.append("rect");
|
682 | rectElem.attr("x", rectData.x);
|
683 | rectElem.attr("y", rectData.y);
|
684 | rectElem.attr("fill", rectData.fill);
|
685 | rectElem.attr("stroke", rectData.stroke);
|
686 | rectElem.attr("width", rectData.width);
|
687 | rectElem.attr("height", rectData.height);
|
688 | rectElem.attr("rx", rectData.rx);
|
689 | rectElem.attr("ry", rectData.ry);
|
690 | if (rectData.class !== void 0) {
|
691 | rectElem.attr("class", rectData.class);
|
692 | }
|
693 | return rectElem;
|
694 | };
|
695 | const drawFace = function(element, faceData) {
|
696 | const radius = 15;
|
697 | const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible");
|
698 | const face = element.append("g");
|
699 | face.append("circle").attr("cx", faceData.cx - radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
|
700 | face.append("circle").attr("cx", faceData.cx + radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
|
701 | function smile(face2) {
|
702 | const arc$1 = arc().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
|
703 | face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
|
704 | }
|
705 | function sad(face2) {
|
706 | const arc$1 = arc().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
|
707 | face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
|
708 | }
|
709 | function ambivalent(face2) {
|
710 | face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
|
711 | }
|
712 | if (faceData.score > 3) {
|
713 | smile(face);
|
714 | } else if (faceData.score < 3) {
|
715 | sad(face);
|
716 | } else {
|
717 | ambivalent(face);
|
718 | }
|
719 | return circleElement;
|
720 | };
|
721 | const drawCircle = function(element, circleData) {
|
722 | const circleElement = element.append("circle");
|
723 | circleElement.attr("cx", circleData.cx);
|
724 | circleElement.attr("cy", circleData.cy);
|
725 | circleElement.attr("class", "actor-" + circleData.pos);
|
726 | circleElement.attr("fill", circleData.fill);
|
727 | circleElement.attr("stroke", circleData.stroke);
|
728 | circleElement.attr("r", circleData.r);
|
729 | if (circleElement.class !== void 0) {
|
730 | circleElement.attr("class", circleElement.class);
|
731 | }
|
732 | if (circleData.title !== void 0) {
|
733 | circleElement.append("title").text(circleData.title);
|
734 | }
|
735 | return circleElement;
|
736 | };
|
737 | const drawText = function(elem, textData) {
|
738 | const nText = textData.text.replace(/<br\s*\/?>/gi, " ");
|
739 | const textElem = elem.append("text");
|
740 | textElem.attr("x", textData.x);
|
741 | textElem.attr("y", textData.y);
|
742 | textElem.attr("class", "legend");
|
743 | textElem.style("text-anchor", textData.anchor);
|
744 | if (textData.class !== void 0) {
|
745 | textElem.attr("class", textData.class);
|
746 | }
|
747 | const span = textElem.append("tspan");
|
748 | span.attr("x", textData.x + textData.textMargin * 2);
|
749 | span.text(nText);
|
750 | return textElem;
|
751 | };
|
752 | const drawLabel = function(elem, txtObject) {
|
753 | function genPoints(x, y, width, height, cut) {
|
754 | return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
|
755 | }
|
756 | const polygon = elem.append("polygon");
|
757 | polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
|
758 | polygon.attr("class", "labelBox");
|
759 | txtObject.y = txtObject.y + txtObject.labelMargin;
|
760 | txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
|
761 | drawText(elem, txtObject);
|
762 | };
|
763 | const drawSection = function(elem, section, conf) {
|
764 | const g = elem.append("g");
|
765 | const rect = getNoteRect();
|
766 | rect.x = section.x;
|
767 | rect.y = section.y;
|
768 | rect.fill = section.fill;
|
769 | rect.width = conf.width;
|
770 | rect.height = conf.height;
|
771 | rect.class = "journey-section section-type-" + section.num;
|
772 | rect.rx = 3;
|
773 | rect.ry = 3;
|
774 | drawRect(g, rect);
|
775 | _drawTextCandidateFunc(conf)(
|
776 | section.text,
|
777 | g,
|
778 | rect.x,
|
779 | rect.y,
|
780 | rect.width,
|
781 | rect.height,
|
782 | { class: "journey-section section-type-" + section.num },
|
783 | conf,
|
784 | section.colour
|
785 | );
|
786 | };
|
787 | let taskCount = -1;
|
788 | const drawTask = function(elem, task, conf) {
|
789 | const center = task.x + conf.width / 2;
|
790 | const g = elem.append("g");
|
791 | taskCount++;
|
792 | const maxHeight = 300 + 5 * 30;
|
793 | g.append("line").attr("id", "task" + taskCount).attr("x1", center).attr("y1", task.y).attr("x2", center).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666");
|
794 | drawFace(g, {
|
795 | cx: center,
|
796 | cy: 300 + (5 - task.score) * 30,
|
797 | score: task.score
|
798 | });
|
799 | const rect = getNoteRect();
|
800 | rect.x = task.x;
|
801 | rect.y = task.y;
|
802 | rect.fill = task.fill;
|
803 | rect.width = conf.width;
|
804 | rect.height = conf.height;
|
805 | rect.class = "task task-type-" + task.num;
|
806 | rect.rx = 3;
|
807 | rect.ry = 3;
|
808 | drawRect(g, rect);
|
809 | task.x + 14;
|
810 | _drawTextCandidateFunc(conf)(
|
811 | task.task,
|
812 | g,
|
813 | rect.x,
|
814 | rect.y,
|
815 | rect.width,
|
816 | rect.height,
|
817 | { class: "task" },
|
818 | conf,
|
819 | task.colour
|
820 | );
|
821 | };
|
822 | const drawBackgroundRect = function(elem, bounds) {
|
823 | const rectElem = drawRect(elem, {
|
824 | x: bounds.startx,
|
825 | y: bounds.starty,
|
826 | width: bounds.stopx - bounds.startx,
|
827 | height: bounds.stopy - bounds.starty,
|
828 | fill: bounds.fill,
|
829 | class: "rect"
|
830 | });
|
831 | rectElem.lower();
|
832 | };
|
833 | const getTextObj = function() {
|
834 | return {
|
835 | x: 0,
|
836 | y: 0,
|
837 | fill: void 0,
|
838 | "text-anchor": "start",
|
839 | width: 100,
|
840 | height: 100,
|
841 | textMargin: 0,
|
842 | rx: 0,
|
843 | ry: 0
|
844 | };
|
845 | };
|
846 | const getNoteRect = function() {
|
847 | return {
|
848 | x: 0,
|
849 | y: 0,
|
850 | width: 100,
|
851 | anchor: "start",
|
852 | height: 100,
|
853 | rx: 0,
|
854 | ry: 0
|
855 | };
|
856 | };
|
857 | const _drawTextCandidateFunc = function() {
|
858 | function byText(content, g, x, y, width, height, textAttrs, colour) {
|
859 | const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
|
860 | _setTextAttrs(text, textAttrs);
|
861 | }
|
862 | function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
|
863 | const { taskFontSize, taskFontFamily } = conf;
|
864 | const lines = content.split(/<br\s*\/?>/gi);
|
865 | for (let i = 0; i < lines.length; i++) {
|
866 | const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
|
867 | const text = g.append("text").attr("x", x + width / 2).attr("y", y).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily);
|
868 | text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
|
869 | text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
|
870 | _setTextAttrs(text, textAttrs);
|
871 | }
|
872 | }
|
873 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
874 | const body = g.append("switch");
|
875 | const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
|
876 | const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
|
877 | text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
|
878 | byTspan(content, body, x, y, width, height, textAttrs, conf);
|
879 | _setTextAttrs(text, textAttrs);
|
880 | }
|
881 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
882 | for (const key in fromTextAttrsDict) {
|
883 | if (key in fromTextAttrsDict) {
|
884 | toText.attr(key, fromTextAttrsDict[key]);
|
885 | }
|
886 | }
|
887 | }
|
888 | return function(conf) {
|
889 | return conf.textPlacement === "fo" ? byFo : conf.textPlacement === "old" ? byText : byTspan;
|
890 | };
|
891 | }();
|
892 | const initGraphics = function(graphics) {
|
893 | graphics.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
|
894 | };
|
895 | function wrap(text, width) {
|
896 | text.each(function() {
|
897 | var text2 = select(this), words = text2.text().split(/(\s+|<br>)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
|
898 | for (let j = 0; j < words.length; j++) {
|
899 | word = words[words.length - 1 - j];
|
900 | line.push(word);
|
901 | tspan.text(line.join(" ").trim());
|
902 | if (tspan.node().getComputedTextLength() > width || word === "<br>") {
|
903 | line.pop();
|
904 | tspan.text(line.join(" ").trim());
|
905 | if (word === "<br>") {
|
906 | line = [""];
|
907 | } else {
|
908 | line = [word];
|
909 | }
|
910 | tspan = text2.append("tspan").attr("x", 0).attr("y", y).attr("dy", lineHeight + "em").text(word);
|
911 | }
|
912 | }
|
913 | });
|
914 | }
|
915 | const drawNode = function(elem, node, fullSection, conf) {
|
916 | const section = fullSection % MAX_SECTIONS - 1;
|
917 | const nodeElem = elem.append("g");
|
918 | node.section = section;
|
919 | nodeElem.attr(
|
920 | "class",
|
921 | (node.class ? node.class + " " : "") + "timeline-node " + ("section-" + section)
|
922 | );
|
923 | const bkgElem = nodeElem.append("g");
|
924 | const textElem = nodeElem.append("g");
|
925 | const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width);
|
926 | const bbox = txt.node().getBBox();
|
927 | const fontSize = conf.fontSize && conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
|
928 | node.height = bbox.height + fontSize * 1.1 * 0.5 + node.padding;
|
929 | node.height = Math.max(node.height, node.maxHeight);
|
930 | node.width = node.width + 2 * node.padding;
|
931 | textElem.attr("transform", "translate(" + node.width / 2 + ", " + node.padding / 2 + ")");
|
932 | defaultBkg(bkgElem, node, section);
|
933 | return node;
|
934 | };
|
935 | const getVirtualNodeHeight = function(elem, node, conf) {
|
936 | const textElem = elem.append("g");
|
937 | const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width);
|
938 | const bbox = txt.node().getBBox();
|
939 | const fontSize = conf.fontSize && conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize;
|
940 | textElem.remove();
|
941 | return bbox.height + fontSize * 1.1 * 0.5 + node.padding;
|
942 | };
|
943 | const defaultBkg = function(elem, node, section) {
|
944 | const rd = 5;
|
945 | elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + node.type).attr(
|
946 | "d",
|
947 | `M0 ${node.height - rd} v${-node.height + 2 * rd} q0,-5 5,-5 h${node.width - 2 * rd} q5,0 5,5 v${node.height - rd} H0 Z`
|
948 | );
|
949 | elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node.height).attr("x2", node.width).attr("y2", node.height);
|
950 | };
|
951 | const svgDraw = {
|
952 | drawRect,
|
953 | drawCircle,
|
954 | drawSection,
|
955 | drawText,
|
956 | drawLabel,
|
957 | drawTask,
|
958 | drawBackgroundRect,
|
959 | getTextObj,
|
960 | getNoteRect,
|
961 | initGraphics,
|
962 | drawNode,
|
963 | getVirtualNodeHeight
|
964 | };
|
965 | const draw = function(text, id, version, diagObj) {
|
966 | var _a, _b, _c, _d;
|
967 | const conf = getConfig();
|
968 | const LEFT_MARGIN = conf.leftMargin ?? 50;
|
969 | (_b = (_a = diagObj.db).clear) == null ? void 0 : _b.call(_a);
|
970 | diagObj.parser.parse(text + "\n");
|
971 | log.debug("timeline", diagObj.db);
|
972 | const securityLevel = conf.securityLevel;
|
973 | let sandboxElement;
|
974 | if (securityLevel === "sandbox") {
|
975 | sandboxElement = select("#i" + id);
|
976 | }
|
977 | const root = securityLevel === "sandbox" ? (
|
978 |
|
979 | select(sandboxElement.nodes()[0].contentDocument.body)
|
980 | ) : select("body");
|
981 | const svg = root.select("#" + id);
|
982 | svg.append("g");
|
983 | const tasks2 = diagObj.db.getTasks();
|
984 | const title = diagObj.db.getCommonDb().getDiagramTitle();
|
985 | log.debug("task", tasks2);
|
986 | svgDraw.initGraphics(svg);
|
987 | const sections2 = diagObj.db.getSections();
|
988 | log.debug("sections", sections2);
|
989 | let maxSectionHeight = 0;
|
990 | let maxTaskHeight = 0;
|
991 | let depthY = 0;
|
992 | let sectionBeginY = 0;
|
993 | let masterX = 50 + LEFT_MARGIN;
|
994 | let masterY = 50;
|
995 | sectionBeginY = 50;
|
996 | let sectionNumber = 0;
|
997 | let hasSections = true;
|
998 | sections2.forEach(function(section) {
|
999 | const sectionNode = {
|
1000 | number: sectionNumber,
|
1001 | descr: section,
|
1002 | section: sectionNumber,
|
1003 | width: 150,
|
1004 | padding: 20,
|
1005 | maxHeight: maxSectionHeight
|
1006 | };
|
1007 | const sectionHeight = svgDraw.getVirtualNodeHeight(svg, sectionNode, conf);
|
1008 | log.debug("sectionHeight before draw", sectionHeight);
|
1009 | maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20);
|
1010 | });
|
1011 | let maxEventCount = 0;
|
1012 | let maxEventLineLength = 0;
|
1013 | log.debug("tasks.length", tasks2.length);
|
1014 | for (const [i, task] of tasks2.entries()) {
|
1015 | const taskNode = {
|
1016 | number: i,
|
1017 | descr: task,
|
1018 | section: task.section,
|
1019 | width: 150,
|
1020 | padding: 20,
|
1021 | maxHeight: maxTaskHeight
|
1022 | };
|
1023 | const taskHeight = svgDraw.getVirtualNodeHeight(svg, taskNode, conf);
|
1024 | log.debug("taskHeight before draw", taskHeight);
|
1025 | maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20);
|
1026 | maxEventCount = Math.max(maxEventCount, task.events.length);
|
1027 | let maxEventLineLengthTemp = 0;
|
1028 | for (let j = 0; j < task.events.length; j++) {
|
1029 | const event = task.events[j];
|
1030 | const eventNode = {
|
1031 | descr: event,
|
1032 | section: task.section,
|
1033 | number: task.section,
|
1034 | width: 150,
|
1035 | padding: 20,
|
1036 | maxHeight: 50
|
1037 | };
|
1038 | maxEventLineLengthTemp += svgDraw.getVirtualNodeHeight(svg, eventNode, conf);
|
1039 | }
|
1040 | maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp);
|
1041 | }
|
1042 | log.debug("maxSectionHeight before draw", maxSectionHeight);
|
1043 | log.debug("maxTaskHeight before draw", maxTaskHeight);
|
1044 | if (sections2 && sections2.length > 0) {
|
1045 | sections2.forEach((section) => {
|
1046 | const tasksForSection = tasks2.filter((task) => task.section === section);
|
1047 | const sectionNode = {
|
1048 | number: sectionNumber,
|
1049 | descr: section,
|
1050 | section: sectionNumber,
|
1051 | width: 200 * Math.max(tasksForSection.length, 1) - 50,
|
1052 | padding: 20,
|
1053 | maxHeight: maxSectionHeight
|
1054 | };
|
1055 | log.debug("sectionNode", sectionNode);
|
1056 | const sectionNodeWrapper = svg.append("g");
|
1057 | const node = svgDraw.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf);
|
1058 | log.debug("sectionNode output", node);
|
1059 | sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`);
|
1060 | masterY += maxSectionHeight + 50;
|
1061 | if (tasksForSection.length > 0) {
|
1062 | drawTasks(
|
1063 | svg,
|
1064 | tasksForSection,
|
1065 | sectionNumber,
|
1066 | masterX,
|
1067 | masterY,
|
1068 | maxTaskHeight,
|
1069 | conf,
|
1070 | maxEventCount,
|
1071 | maxEventLineLength,
|
1072 | maxSectionHeight,
|
1073 | false
|
1074 | );
|
1075 | }
|
1076 | masterX += 200 * Math.max(tasksForSection.length, 1);
|
1077 | masterY = sectionBeginY;
|
1078 | sectionNumber++;
|
1079 | });
|
1080 | } else {
|
1081 | hasSections = false;
|
1082 | drawTasks(
|
1083 | svg,
|
1084 | tasks2,
|
1085 | sectionNumber,
|
1086 | masterX,
|
1087 | masterY,
|
1088 | maxTaskHeight,
|
1089 | conf,
|
1090 | maxEventCount,
|
1091 | maxEventLineLength,
|
1092 | maxSectionHeight,
|
1093 | true
|
1094 | );
|
1095 | }
|
1096 | const box = svg.node().getBBox();
|
1097 | log.debug("bounds", box);
|
1098 | if (title) {
|
1099 | svg.append("text").text(title).attr("x", box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20);
|
1100 | }
|
1101 | depthY = hasSections ? maxSectionHeight + maxTaskHeight + 150 : maxTaskHeight + 100;
|
1102 | const lineWrapper = svg.append("g").attr("class", "lineWrapper");
|
1103 | lineWrapper.append("line").attr("x1", LEFT_MARGIN).attr("y1", depthY).attr("x2", box.width + 3 * LEFT_MARGIN).attr("y2", depthY).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
|
1104 | setupGraphViewbox(
|
1105 | void 0,
|
1106 | svg,
|
1107 | ((_c = conf.timeline) == null ? void 0 : _c.padding) ?? 50,
|
1108 | ((_d = conf.timeline) == null ? void 0 : _d.useMaxWidth) ?? false
|
1109 | );
|
1110 | };
|
1111 | const drawTasks = function(diagram2, tasks2, sectionColor, masterX, masterY, maxTaskHeight, conf, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections) {
|
1112 | var _a;
|
1113 | for (const task of tasks2) {
|
1114 | const taskNode = {
|
1115 | descr: task.task,
|
1116 | section: sectionColor,
|
1117 | number: sectionColor,
|
1118 | width: 150,
|
1119 | padding: 20,
|
1120 | maxHeight: maxTaskHeight
|
1121 | };
|
1122 | log.debug("taskNode", taskNode);
|
1123 | const taskWrapper = diagram2.append("g").attr("class", "taskWrapper");
|
1124 | const node = svgDraw.drawNode(taskWrapper, taskNode, sectionColor, conf);
|
1125 | const taskHeight = node.height;
|
1126 | log.debug("taskHeight after draw", taskHeight);
|
1127 | taskWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
|
1128 | maxTaskHeight = Math.max(maxTaskHeight, taskHeight);
|
1129 | if (task.events) {
|
1130 | const lineWrapper = diagram2.append("g").attr("class", "lineWrapper");
|
1131 | let lineLength = maxTaskHeight;
|
1132 | masterY += 100;
|
1133 | lineLength = lineLength + drawEvents(diagram2, task.events, sectionColor, masterX, masterY, conf);
|
1134 | masterY -= 100;
|
1135 | lineWrapper.append("line").attr("x1", masterX + 190 / 2).attr("y1", masterY + maxTaskHeight).attr("x2", masterX + 190 / 2).attr(
|
1136 | "y2",
|
1137 | masterY + maxTaskHeight + (isWithoutSections ? maxTaskHeight : maxSectionHeight) + maxEventLineLength + 120
|
1138 | ).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
|
1139 | }
|
1140 | masterX = masterX + 200;
|
1141 | if (isWithoutSections && !((_a = conf.timeline) == null ? void 0 : _a.disableMulticolor)) {
|
1142 | sectionColor++;
|
1143 | }
|
1144 | }
|
1145 | masterY = masterY - 10;
|
1146 | };
|
1147 | const drawEvents = function(diagram2, events, sectionColor, masterX, masterY, conf) {
|
1148 | let maxEventHeight = 0;
|
1149 | const eventBeginY = masterY;
|
1150 | masterY = masterY + 100;
|
1151 | for (const event of events) {
|
1152 | const eventNode = {
|
1153 | descr: event,
|
1154 | section: sectionColor,
|
1155 | number: sectionColor,
|
1156 | width: 150,
|
1157 | padding: 20,
|
1158 | maxHeight: 50
|
1159 | };
|
1160 | log.debug("eventNode", eventNode);
|
1161 | const eventWrapper = diagram2.append("g").attr("class", "eventWrapper");
|
1162 | const node = svgDraw.drawNode(eventWrapper, eventNode, sectionColor, conf);
|
1163 | const eventHeight = node.height;
|
1164 | maxEventHeight = maxEventHeight + eventHeight;
|
1165 | eventWrapper.attr("transform", `translate(${masterX}, ${masterY})`);
|
1166 | masterY = masterY + 10 + eventHeight;
|
1167 | }
|
1168 | masterY = eventBeginY;
|
1169 | return maxEventHeight;
|
1170 | };
|
1171 | const renderer = {
|
1172 | setConf: () => {
|
1173 | },
|
1174 | draw
|
1175 | };
|
1176 | const genSections = (options) => {
|
1177 | let sections2 = "";
|
1178 | for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
|
1179 | options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i];
|
1180 | if (isDark(options["lineColor" + i])) {
|
1181 | options["lineColor" + i] = lighten(options["lineColor" + i], 20);
|
1182 | } else {
|
1183 | options["lineColor" + i] = darken(options["lineColor" + i], 20);
|
1184 | }
|
1185 | }
|
1186 | for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
|
1187 | const sw = "" + (17 - 3 * i);
|
1188 | sections2 += `
|
1189 | .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} path {
|
1190 | fill: ${options["cScale" + i]};
|
1191 | }
|
1192 | .section-${i - 1} text {
|
1193 | fill: ${options["cScaleLabel" + i]};
|
1194 | }
|
1195 | .node-icon-${i - 1} {
|
1196 | font-size: 40px;
|
1197 | color: ${options["cScaleLabel" + i]};
|
1198 | }
|
1199 | .section-edge-${i - 1}{
|
1200 | stroke: ${options["cScale" + i]};
|
1201 | }
|
1202 | .edge-depth-${i - 1}{
|
1203 | stroke-width: ${sw};
|
1204 | }
|
1205 | .section-${i - 1} line {
|
1206 | stroke: ${options["cScaleInv" + i]} ;
|
1207 | stroke-width: 3;
|
1208 | }
|
1209 |
|
1210 | .lineWrapper line{
|
1211 | stroke: ${options["cScaleLabel" + i]} ;
|
1212 | }
|
1213 |
|
1214 | .disabled, .disabled circle, .disabled text {
|
1215 | fill: lightgray;
|
1216 | }
|
1217 | .disabled text {
|
1218 | fill: #efefef;
|
1219 | }
|
1220 | `;
|
1221 | }
|
1222 | return sections2;
|
1223 | };
|
1224 | const getStyles = (options) => `
|
1225 | .edge {
|
1226 | stroke-width: 3;
|
1227 | }
|
1228 | ${genSections(options)}
|
1229 | .section-root rect, .section-root path, .section-root circle {
|
1230 | fill: ${options.git0};
|
1231 | }
|
1232 | .section-root text {
|
1233 | fill: ${options.gitBranchLabel0};
|
1234 | }
|
1235 | .icon-container {
|
1236 | height:100%;
|
1237 | display: flex;
|
1238 | justify-content: center;
|
1239 | align-items: center;
|
1240 | }
|
1241 | .edge {
|
1242 | fill: none;
|
1243 | }
|
1244 | .eventWrapper {
|
1245 | filter: brightness(120%);
|
1246 | }
|
1247 | `;
|
1248 | const styles = getStyles;
|
1249 | const diagram = {
|
1250 | db,
|
1251 | renderer,
|
1252 | parser: parser$1,
|
1253 | styles
|
1254 | };
|
1255 | export {
|
1256 | diagram
|
1257 | };
|