UNPKG

34 kBJavaScriptView Raw
1import { ay as bt, az as kt, B as vt, j as Z, c as wt, l as T, t as St, aA as Et, aB as Tt, aC as It } from "./mermaid-9357f3d0.js";
2import { d as it } from "./arc-b5db4c05.js";
3import "./constant-2fe7eae5.js";
4var Y = function() {
5 var n = function(k, r, a, h) {
6 for (a = a || {}, h = k.length; h--; a[k[h]] = r)
7 ;
8 return a;
9 }, t = [1, 2], e = [1, 5], s = [6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28], i = [1, 15], o = [1, 16], l = [1, 17], y = [1, 18], f = [1, 19], d = [1, 23], m = [1, 24], S = [1, 27], _ = [4, 6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28], b = {
10 trace: function() {
11 },
12 yy: {},
13 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 },
14 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" },
15 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]],
16 performAction: function(r, a, h, u, g, c, M) {
17 var x = c.length - 1;
18 switch (g) {
19 case 1:
20 return c[x - 1];
21 case 3:
22 this.$ = [];
23 break;
24 case 4:
25 c[x - 1].push(c[x]), this.$ = c[x - 1];
26 break;
27 case 5:
28 case 6:
29 this.$ = c[x];
30 break;
31 case 7:
32 case 8:
33 this.$ = [];
34 break;
35 case 11:
36 u.getCommonDb().setDiagramTitle(c[x].substr(6)), this.$ = c[x].substr(6);
37 break;
38 case 12:
39 this.$ = c[x].trim(), u.getCommonDb().setAccTitle(this.$);
40 break;
41 case 13:
42 case 14:
43 this.$ = c[x].trim(), u.getCommonDb().setAccDescription(this.$);
44 break;
45 case 15:
46 u.addSection(c[x].substr(8)), this.$ = c[x].substr(8);
47 break;
48 case 19:
49 u.addTask(c[x], 0, ""), this.$ = c[x];
50 break;
51 case 20:
52 u.addEvent(c[x].substr(2)), this.$ = c[x];
53 break;
54 case 21:
55 u.parseDirective("%%{", "open_directive");
56 break;
57 case 22:
58 u.parseDirective(c[x], "type_directive");
59 break;
60 case 23:
61 c[x] = c[x].trim().replace(/'/g, '"'), u.parseDirective(c[x], "arg_directive");
62 break;
63 case 24:
64 u.parseDirective("}%%", "close_directive", "timeline");
65 break;
66 }
67 },
68 table: [{ 3: 1, 4: t, 7: 3, 12: 4, 28: e }, { 1: [3] }, n(s, [2, 3], { 5: 6 }), { 3: 7, 4: t, 7: 3, 12: 4, 28: e }, { 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: i, 18: o, 20: l, 22: y, 23: f, 24: 20, 25: 21, 26: d, 27: m, 28: e }, { 1: [2, 2] }, { 14: 25, 15: [1, 26], 31: S }, n([15, 31], [2, 22]), n(s, [2, 8], { 1: [2, 1] }), n(s, [2, 4]), { 7: 22, 10: 28, 12: 4, 17: i, 18: o, 20: l, 22: y, 23: f, 24: 20, 25: 21, 26: d, 27: m, 28: e }, n(s, [2, 6]), n(s, [2, 7]), n(s, [2, 11]), { 19: [1, 29] }, { 21: [1, 30] }, n(s, [2, 14]), n(s, [2, 15]), n(s, [2, 16]), n(s, [2, 17]), n(s, [2, 18]), n(s, [2, 19]), n(s, [2, 20]), { 11: [1, 31] }, { 16: 32, 30: [1, 33] }, { 11: [2, 24] }, n(s, [2, 5]), n(s, [2, 12]), n(s, [2, 13]), n(_, [2, 9]), { 14: 34, 31: S }, { 31: [2, 23] }, { 11: [1, 35] }, n(_, [2, 10])],
69 defaultActions: { 5: [2, 21], 7: [2, 2], 27: [2, 24], 33: [2, 23] },
70 parseError: function(r, a) {
71 if (a.recoverable)
72 this.trace(r);
73 else {
74 var h = new Error(r);
75 throw h.hash = a, h;
76 }
77 },
78 parse: function(r) {
79 var a = this, h = [0], u = [], g = [null], c = [], M = this.table, x = "", C = 0, O = 0, G = 2, j = 1, P = c.slice.call(arguments, 1), p = Object.create(this.lexer), E = { yy: {} };
80 for (var L in this.yy)
81 Object.prototype.hasOwnProperty.call(this.yy, L) && (E.yy[L] = this.yy[L]);
82 p.setInput(r, E.yy), E.yy.lexer = p, E.yy.parser = this, typeof p.yylloc > "u" && (p.yylloc = {});
83 var H = p.yylloc;
84 c.push(H);
85 var z = p.options && p.options.ranges;
86 typeof E.yy.parseError == "function" ? this.parseError = E.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
87 function et() {
88 var A;
89 return A = u.pop() || p.lex() || j, typeof A != "number" && (A instanceof Array && (u = A, A = u.pop()), A = a.symbols_[A] || A), A;
90 }
91 for (var w, V, N, Q, F = {}, q, $, nt, U; ; ) {
92 if (V = h[h.length - 1], this.defaultActions[V] ? N = this.defaultActions[V] : ((w === null || typeof w > "u") && (w = et()), N = M[V] && M[V][w]), typeof N > "u" || !N.length || !N[0]) {
93 var X = "";
94 U = [];
95 for (q in M[V])
96 this.terminals_[q] && q > G && U.push("'" + this.terminals_[q] + "'");
97 p.showPosition ? X = "Parse error on line " + (C + 1) + `:
98` + p.showPosition() + `
99Expecting ` + U.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : X = "Parse error on line " + (C + 1) + ": Unexpected " + (w == j ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(X, {
100 text: p.match,
101 token: this.terminals_[w] || w,
102 line: p.yylineno,
103 loc: H,
104 expected: U
105 });
106 }
107 if (N[0] instanceof Array && N.length > 1)
108 throw new Error("Parse Error: multiple actions possible at state: " + V + ", token: " + w);
109 switch (N[0]) {
110 case 1:
111 h.push(w), g.push(p.yytext), c.push(p.yylloc), h.push(N[1]), w = null, O = p.yyleng, x = p.yytext, C = p.yylineno, H = p.yylloc;
112 break;
113 case 2:
114 if ($ = this.productions_[N[1]][1], F.$ = g[g.length - $], F._$ = {
115 first_line: c[c.length - ($ || 1)].first_line,
116 last_line: c[c.length - 1].last_line,
117 first_column: c[c.length - ($ || 1)].first_column,
118 last_column: c[c.length - 1].last_column
119 }, z && (F._$.range = [
120 c[c.length - ($ || 1)].range[0],
121 c[c.length - 1].range[1]
122 ]), Q = this.performAction.apply(F, [
123 x,
124 O,
125 C,
126 E.yy,
127 N[1],
128 g,
129 c
130 ].concat(P)), typeof Q < "u")
131 return Q;
132 $ && (h = h.slice(0, -1 * $ * 2), g = g.slice(0, -1 * $), c = c.slice(0, -1 * $)), h.push(this.productions_[N[1]][0]), g.push(F.$), c.push(F._$), nt = M[h[h.length - 2]][h[h.length - 1]], h.push(nt);
133 break;
134 case 3:
135 return !0;
136 }
137 }
138 return !0;
139 }
140 }, v = function() {
141 var k = {
142 EOF: 1,
143 parseError: function(a, h) {
144 if (this.yy.parser)
145 this.yy.parser.parseError(a, h);
146 else
147 throw new Error(a);
148 },
149 // resets the lexer, sets new input
150 setInput: function(r, a) {
151 return this.yy = a || this.yy || {}, this._input = r, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
152 first_line: 1,
153 first_column: 0,
154 last_line: 1,
155 last_column: 0
156 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
157 },
158 // consumes and returns one char from the input
159 input: function() {
160 var r = this._input[0];
161 this.yytext += r, this.yyleng++, this.offset++, this.match += r, this.matched += r;
162 var a = r.match(/(?:\r\n?|\n).*/g);
163 return a ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), r;
164 },
165 // unshifts one char (or a string) into the input
166 unput: function(r) {
167 var a = r.length, h = r.split(/(?:\r\n?|\n)/g);
168 this._input = r + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - a), this.offset -= a;
169 var u = this.match.split(/(?:\r\n?|\n)/g);
170 this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), h.length - 1 && (this.yylineno -= h.length - 1);
171 var g = this.yylloc.range;
172 return this.yylloc = {
173 first_line: this.yylloc.first_line,
174 last_line: this.yylineno + 1,
175 first_column: this.yylloc.first_column,
176 last_column: h ? (h.length === u.length ? this.yylloc.first_column : 0) + u[u.length - h.length].length - h[0].length : this.yylloc.first_column - a
177 }, this.options.ranges && (this.yylloc.range = [g[0], g[0] + this.yyleng - a]), this.yyleng = this.yytext.length, this;
178 },
179 // When called from action, caches matched text and appends it on next action
180 more: function() {
181 return this._more = !0, this;
182 },
183 // 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.
184 reject: function() {
185 if (this.options.backtrack_lexer)
186 this._backtrack = !0;
187 else
188 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).
189` + this.showPosition(), {
190 text: "",
191 token: null,
192 line: this.yylineno
193 });
194 return this;
195 },
196 // retain first n characters of the match
197 less: function(r) {
198 this.unput(this.match.slice(r));
199 },
200 // displays already matched input, i.e. for error messages
201 pastInput: function() {
202 var r = this.matched.substr(0, this.matched.length - this.match.length);
203 return (r.length > 20 ? "..." : "") + r.substr(-20).replace(/\n/g, "");
204 },
205 // displays upcoming input, i.e. for error messages
206 upcomingInput: function() {
207 var r = this.match;
208 return r.length < 20 && (r += this._input.substr(0, 20 - r.length)), (r.substr(0, 20) + (r.length > 20 ? "..." : "")).replace(/\n/g, "");
209 },
210 // displays the character position where the lexing error occurred, i.e. for error messages
211 showPosition: function() {
212 var r = this.pastInput(), a = new Array(r.length + 1).join("-");
213 return r + this.upcomingInput() + `
214` + a + "^";
215 },
216 // test the lexed token: return FALSE when not a match, otherwise return token
217 test_match: function(r, a) {
218 var h, u, g;
219 if (this.options.backtrack_lexer && (g = {
220 yylineno: this.yylineno,
221 yylloc: {
222 first_line: this.yylloc.first_line,
223 last_line: this.last_line,
224 first_column: this.yylloc.first_column,
225 last_column: this.yylloc.last_column
226 },
227 yytext: this.yytext,
228 match: this.match,
229 matches: this.matches,
230 matched: this.matched,
231 yyleng: this.yyleng,
232 offset: this.offset,
233 _more: this._more,
234 _input: this._input,
235 yy: this.yy,
236 conditionStack: this.conditionStack.slice(0),
237 done: this.done
238 }, this.options.ranges && (g.yylloc.range = this.yylloc.range.slice(0))), u = r[0].match(/(?:\r\n?|\n).*/g), u && (this.yylineno += u.length), this.yylloc = {
239 first_line: this.yylloc.last_line,
240 last_line: this.yylineno + 1,
241 first_column: this.yylloc.last_column,
242 last_column: u ? u[u.length - 1].length - u[u.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + r[0].length
243 }, this.yytext += r[0], this.match += r[0], this.matches = r, 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(r[0].length), this.matched += r[0], h = this.performAction.call(this, this.yy, this, a, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), h)
244 return h;
245 if (this._backtrack) {
246 for (var c in g)
247 this[c] = g[c];
248 return !1;
249 }
250 return !1;
251 },
252 // return next match in input
253 next: function() {
254 if (this.done)
255 return this.EOF;
256 this._input || (this.done = !0);
257 var r, a, h, u;
258 this._more || (this.yytext = "", this.match = "");
259 for (var g = this._currentRules(), c = 0; c < g.length; c++)
260 if (h = this._input.match(this.rules[g[c]]), h && (!a || h[0].length > a[0].length)) {
261 if (a = h, u = c, this.options.backtrack_lexer) {
262 if (r = this.test_match(h, g[c]), r !== !1)
263 return r;
264 if (this._backtrack) {
265 a = !1;
266 continue;
267 } else
268 return !1;
269 } else if (!this.options.flex)
270 break;
271 }
272 return a ? (r = this.test_match(a, g[u]), r !== !1 ? r : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
273` + this.showPosition(), {
274 text: "",
275 token: null,
276 line: this.yylineno
277 });
278 },
279 // return next match that has a token
280 lex: function() {
281 var a = this.next();
282 return a || this.lex();
283 },
284 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
285 begin: function(a) {
286 this.conditionStack.push(a);
287 },
288 // pop the previously active lexer condition state off the condition stack
289 popState: function() {
290 var a = this.conditionStack.length - 1;
291 return a > 0 ? this.conditionStack.pop() : this.conditionStack[0];
292 },
293 // produce the lexer rule set which is active for the currently active lexer condition state
294 _currentRules: function() {
295 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
296 },
297 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
298 topState: function(a) {
299 return a = this.conditionStack.length - 1 - Math.abs(a || 0), a >= 0 ? this.conditionStack[a] : "INITIAL";
300 },
301 // alias for begin(condition)
302 pushState: function(a) {
303 this.begin(a);
304 },
305 // return the number of states currently on the stack
306 stateStackSize: function() {
307 return this.conditionStack.length;
308 },
309 options: { "case-insensitive": !0 },
310 performAction: function(a, h, u, g) {
311 switch (u) {
312 case 0:
313 return this.begin("open_directive"), 28;
314 case 1:
315 return this.begin("type_directive"), 29;
316 case 2:
317 return this.popState(), this.begin("arg_directive"), 15;
318 case 3:
319 return this.popState(), this.popState(), 31;
320 case 4:
321 return 30;
322 case 5:
323 break;
324 case 6:
325 break;
326 case 7:
327 return 11;
328 case 8:
329 break;
330 case 9:
331 break;
332 case 10:
333 return 4;
334 case 11:
335 return 17;
336 case 12:
337 return this.begin("acc_title"), 18;
338 case 13:
339 return this.popState(), "acc_title_value";
340 case 14:
341 return this.begin("acc_descr"), 20;
342 case 15:
343 return this.popState(), "acc_descr_value";
344 case 16:
345 this.begin("acc_descr_multiline");
346 break;
347 case 17:
348 this.popState();
349 break;
350 case 18:
351 return "acc_descr_multiline_value";
352 case 19:
353 return 23;
354 case 20:
355 return 27;
356 case 21:
357 return 26;
358 case 22:
359 return 6;
360 case 23:
361 return "INVALID";
362 }
363 },
364 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],
365 conditions: { open_directive: { rules: [1], inclusive: !1 }, type_directive: { rules: [2, 3], inclusive: !1 }, arg_directive: { rules: [3, 4], inclusive: !1 }, acc_descr_multiline: { rules: [17, 18], inclusive: !1 }, acc_descr: { rules: [15], inclusive: !1 }, acc_title: { rules: [13], inclusive: !1 }, INITIAL: { rules: [0, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 19, 20, 21, 22, 23], inclusive: !0 } }
366 };
367 return k;
368 }();
369 b.lexer = v;
370 function I() {
371 this.yy = {};
372 }
373 return I.prototype = b, b.Parser = I, new I();
374}();
375Y.parser = Y;
376const Nt = Y;
377let W = "", ct = 0;
378const D = [], J = [], B = [], lt = () => bt, ot = (n, t, e) => {
379 kt(globalThis, n, t, e);
380}, ht = function() {
381 D.length = 0, J.length = 0, W = "", B.length = 0, vt();
382}, dt = function(n) {
383 W = n, D.push(n);
384}, ut = function() {
385 return D;
386}, pt = function() {
387 let n = st();
388 const t = 100;
389 let e = 0;
390 for (; !n && e < t; )
391 n = st(), e++;
392 return J.push(...B), J;
393}, yt = function(n, t, e) {
394 const s = {
395 id: ct++,
396 section: W,
397 type: W,
398 task: n,
399 score: t || 0,
400 //if event is defined, then add it the events array
401 events: e ? [e] : []
402 };
403 B.push(s);
404}, gt = function(n) {
405 B.find((e) => e.id === ct - 1).events.push(n);
406}, ft = function(n) {
407 const t = {
408 section: W,
409 type: W,
410 description: n,
411 task: n,
412 classes: []
413 };
414 J.push(t);
415}, st = function() {
416 const n = function(e) {
417 return B[e].processed;
418 };
419 let t = !0;
420 for (const [e, s] of B.entries())
421 n(e), t = t && s.processed;
422 return t;
423}, Mt = {
424 clear: ht,
425 getCommonDb: lt,
426 addSection: dt,
427 getSections: ut,
428 getTasks: pt,
429 addTask: yt,
430 addTaskOrg: ft,
431 addEvent: gt,
432 parseDirective: ot
433}, Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
434 __proto__: null,
435 addEvent: gt,
436 addSection: dt,
437 addTask: yt,
438 addTaskOrg: ft,
439 clear: ht,
440 default: Mt,
441 getCommonDb: lt,
442 getSections: ut,
443 getTasks: pt,
444 parseDirective: ot
445}, Symbol.toStringTag, { value: "Module" })), $t = 12, K = function(n, t) {
446 const e = n.append("rect");
447 return e.attr("x", t.x), e.attr("y", t.y), e.attr("fill", t.fill), e.attr("stroke", t.stroke), e.attr("width", t.width), e.attr("height", t.height), e.attr("rx", t.rx), e.attr("ry", t.ry), t.class !== void 0 && e.attr("class", t.class), e;
448}, At = function(n, t) {
449 const s = n.append("circle").attr("cx", t.cx).attr("cy", t.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), i = n.append("g");
450 i.append("circle").attr("cx", t.cx - 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), i.append("circle").attr("cx", t.cx + 15 / 3).attr("cy", t.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
451 function o(f) {
452 const d = it().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
453 f.append("path").attr("class", "mouth").attr("d", d).attr("transform", "translate(" + t.cx + "," + (t.cy + 2) + ")");
454 }
455 function l(f) {
456 const d = it().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
457 f.append("path").attr("class", "mouth").attr("d", d).attr("transform", "translate(" + t.cx + "," + (t.cy + 7) + ")");
458 }
459 function y(f) {
460 f.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", t.cx - 5).attr("y1", t.cy + 7).attr("x2", t.cx + 5).attr("y2", t.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
461 }
462 return t.score > 3 ? o(i) : t.score < 3 ? l(i) : y(i), s;
463}, Pt = function(n, t) {
464 const e = n.append("circle");
465 return e.attr("cx", t.cx), e.attr("cy", t.cy), e.attr("class", "actor-" + t.pos), e.attr("fill", t.fill), e.attr("stroke", t.stroke), e.attr("r", t.r), e.class !== void 0 && e.attr("class", e.class), t.title !== void 0 && e.append("title").text(t.title), e;
466}, mt = function(n, t) {
467 const e = t.text.replace(/<br\s*\/?>/gi, " "), s = n.append("text");
468 s.attr("x", t.x), s.attr("y", t.y), s.attr("class", "legend"), s.style("text-anchor", t.anchor), t.class !== void 0 && s.attr("class", t.class);
469 const i = s.append("tspan");
470 return i.attr("x", t.x + t.textMargin * 2), i.text(e), s;
471}, Ht = function(n, t) {
472 function e(i, o, l, y, f) {
473 return i + "," + o + " " + (i + l) + "," + o + " " + (i + l) + "," + (o + y - f) + " " + (i + l - f * 1.2) + "," + (o + y) + " " + i + "," + (o + y);
474 }
475 const s = n.append("polygon");
476 s.attr("points", e(t.x, t.y, 50, 20, 7)), s.attr("class", "labelBox"), t.y = t.y + t.labelMargin, t.x = t.x + 0.5 * t.labelMargin, mt(n, t);
477}, Ct = function(n, t, e) {
478 const s = n.append("g"), i = tt();
479 i.x = t.x, i.y = t.y, i.fill = t.fill, i.width = e.width, i.height = e.height, i.class = "journey-section section-type-" + t.num, i.rx = 3, i.ry = 3, K(s, i), xt(e)(
480 t.text,
481 s,
482 i.x,
483 i.y,
484 i.width,
485 i.height,
486 { class: "journey-section section-type-" + t.num },
487 e,
488 t.colour
489 );
490};
491let rt = -1;
492const zt = function(n, t, e) {
493 const s = t.x + e.width / 2, i = n.append("g");
494 rt++;
495 const o = 300 + 5 * 30;
496 i.append("line").attr("id", "task" + rt).attr("x1", s).attr("y1", t.y).attr("x2", s).attr("y2", o).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), At(i, {
497 cx: s,
498 cy: 300 + (5 - t.score) * 30,
499 score: t.score
500 });
501 const l = tt();
502 l.x = t.x, l.y = t.y, l.fill = t.fill, l.width = e.width, l.height = e.height, l.class = "task task-type-" + t.num, l.rx = 3, l.ry = 3, K(i, l), t.x + 14, xt(e)(
503 t.task,
504 i,
505 l.x,
506 l.y,
507 l.width,
508 l.height,
509 { class: "task" },
510 e,
511 t.colour
512 );
513}, Vt = function(n, t) {
514 K(n, {
515 x: t.startx,
516 y: t.starty,
517 width: t.stopx - t.startx,
518 height: t.stopy - t.starty,
519 fill: t.fill,
520 class: "rect"
521 }).lower();
522}, Rt = function() {
523 return {
524 x: 0,
525 y: 0,
526 fill: void 0,
527 "text-anchor": "start",
528 width: 100,
529 height: 100,
530 textMargin: 0,
531 rx: 0,
532 ry: 0
533 };
534}, tt = function() {
535 return {
536 x: 0,
537 y: 0,
538 width: 100,
539 anchor: "start",
540 height: 100,
541 rx: 0,
542 ry: 0
543 };
544}, xt = function() {
545 function n(i, o, l, y, f, d, m, S) {
546 const _ = o.append("text").attr("x", l + f / 2).attr("y", y + d / 2 + 5).style("font-color", S).style("text-anchor", "middle").text(i);
547 s(_, m);
548 }
549 function t(i, o, l, y, f, d, m, S, _) {
550 const { taskFontSize: b, taskFontFamily: v } = S, I = i.split(/<br\s*\/?>/gi);
551 for (let k = 0; k < I.length; k++) {
552 const r = k * b - b * (I.length - 1) / 2, a = o.append("text").attr("x", l + f / 2).attr("y", y).attr("fill", _).style("text-anchor", "middle").style("font-size", b).style("font-family", v);
553 a.append("tspan").attr("x", l + f / 2).attr("dy", r).text(I[k]), a.attr("y", y + d / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), s(a, m);
554 }
555 }
556 function e(i, o, l, y, f, d, m, S) {
557 const _ = o.append("switch"), v = _.append("foreignObject").attr("x", l).attr("y", y).attr("width", f).attr("height", d).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
558 v.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), t(i, _, l, y, f, d, m, S), s(v, m);
559 }
560 function s(i, o) {
561 for (const l in o)
562 l in o && i.attr(l, o[l]);
563 }
564 return function(i) {
565 return i.textPlacement === "fo" ? e : i.textPlacement === "old" ? n : t;
566 };
567}(), Ft = function(n) {
568 n.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");
569};
570function _t(n, t) {
571 n.each(function() {
572 var e = Z(this), s = e.text().split(/(\s+|<br>)/).reverse(), i, o = [], l = 1.1, y = e.attr("y"), f = parseFloat(e.attr("dy")), d = e.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", f + "em");
573 for (let m = 0; m < s.length; m++)
574 i = s[s.length - 1 - m], o.push(i), d.text(o.join(" ").trim()), (d.node().getComputedTextLength() > t || i === "<br>") && (o.pop(), d.text(o.join(" ").trim()), i === "<br>" ? o = [""] : o = [i], d = e.append("tspan").attr("x", 0).attr("y", y).attr("dy", l + "em").text(i));
575 });
576}
577const Wt = function(n, t, e, s) {
578 const i = e % $t - 1, o = n.append("g");
579 t.section = i, o.attr(
580 "class",
581 (t.class ? t.class + " " : "") + "timeline-node " + ("section-" + i)
582 );
583 const l = o.append("g"), y = o.append("g"), d = y.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(_t, t.width).node().getBBox(), m = s.fontSize && s.fontSize.replace ? s.fontSize.replace("px", "") : s.fontSize;
584 return t.height = d.height + m * 1.1 * 0.5 + t.padding, t.height = Math.max(t.height, t.maxHeight), t.width = t.width + 2 * t.padding, y.attr("transform", "translate(" + t.width / 2 + ", " + t.padding / 2 + ")"), Ot(l, t, i), t;
585}, Bt = function(n, t, e) {
586 const s = n.append("g"), o = s.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(_t, t.width).node().getBBox(), l = e.fontSize && e.fontSize.replace ? e.fontSize.replace("px", "") : e.fontSize;
587 return s.remove(), o.height + l * 1.1 * 0.5 + t.padding;
588}, Ot = function(n, t, e) {
589 n.append("path").attr("id", "node-" + t.id).attr("class", "node-bkg node-" + t.type).attr(
590 "d",
591 `M0 ${t.height - 5} v${-t.height + 2 * 5} q0,-5 5,-5 h${t.width - 2 * 5} q5,0 5,5 v${t.height - 5} H0 Z`
592 ), n.append("line").attr("class", "node-line-" + e).attr("x1", 0).attr("y1", t.height).attr("x2", t.width).attr("y2", t.height);
593}, R = {
594 drawRect: K,
595 drawCircle: Pt,
596 drawSection: Ct,
597 drawText: mt,
598 drawLabel: Ht,
599 drawTask: zt,
600 drawBackgroundRect: Vt,
601 getTextObj: Rt,
602 getNoteRect: tt,
603 initGraphics: Ft,
604 drawNode: Wt,
605 getVirtualNodeHeight: Bt
606}, jt = function(n, t, e, s) {
607 var C, O, G, j;
608 const i = wt(), o = i.leftMargin ?? 50;
609 (O = (C = s.db).clear) == null || O.call(C), s.parser.parse(n + `
610`), T.debug("timeline", s.db);
611 const l = i.securityLevel;
612 let y;
613 l === "sandbox" && (y = Z("#i" + t));
614 const d = (l === "sandbox" ? (
615 // @ts-ignore d3 types are wrong
616 Z(y.nodes()[0].contentDocument.body)
617 ) : Z("body")).select("#" + t);
618 d.append("g");
619 const m = s.db.getTasks(), S = s.db.getCommonDb().getDiagramTitle();
620 T.debug("task", m), R.initGraphics(d);
621 const _ = s.db.getSections();
622 T.debug("sections", _);
623 let b = 0, v = 0, I = 0, k = 0, r = 50 + o, a = 50;
624 k = 50;
625 let h = 0, u = !0;
626 _.forEach(function(P) {
627 const p = {
628 number: h,
629 descr: P,
630 section: h,
631 width: 150,
632 padding: 20,
633 maxHeight: b
634 }, E = R.getVirtualNodeHeight(d, p, i);
635 T.debug("sectionHeight before draw", E), b = Math.max(b, E + 20);
636 });
637 let g = 0, c = 0;
638 T.debug("tasks.length", m.length);
639 for (const [P, p] of m.entries()) {
640 const E = {
641 number: P,
642 descr: p,
643 section: p.section,
644 width: 150,
645 padding: 20,
646 maxHeight: v
647 }, L = R.getVirtualNodeHeight(d, E, i);
648 T.debug("taskHeight before draw", L), v = Math.max(v, L + 20), g = Math.max(g, p.events.length);
649 let H = 0;
650 for (let z = 0; z < p.events.length; z++) {
651 const w = {
652 descr: p.events[z],
653 section: p.section,
654 number: p.section,
655 width: 150,
656 padding: 20,
657 maxHeight: 50
658 };
659 H += R.getVirtualNodeHeight(d, w, i);
660 }
661 c = Math.max(c, H);
662 }
663 T.debug("maxSectionHeight before draw", b), T.debug("maxTaskHeight before draw", v), _ && _.length > 0 ? _.forEach((P) => {
664 const p = m.filter((z) => z.section === P), E = {
665 number: h,
666 descr: P,
667 section: h,
668 width: 200 * Math.max(p.length, 1) - 50,
669 padding: 20,
670 maxHeight: b
671 };
672 T.debug("sectionNode", E);
673 const L = d.append("g"), H = R.drawNode(L, E, h, i);
674 T.debug("sectionNode output", H), L.attr("transform", `translate(${r}, ${k})`), a += b + 50, p.length > 0 && at(
675 d,
676 p,
677 h,
678 r,
679 a,
680 v,
681 i,
682 g,
683 c,
684 b,
685 !1
686 ), r += 200 * Math.max(p.length, 1), a = k, h++;
687 }) : (u = !1, at(
688 d,
689 m,
690 h,
691 r,
692 a,
693 v,
694 i,
695 g,
696 c,
697 b,
698 !0
699 ));
700 const M = d.node().getBBox();
701 T.debug("bounds", M), S && d.append("text").text(S).attr("x", M.width / 2 - o).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), I = u ? b + v + 150 : v + 100, d.append("g").attr("class", "lineWrapper").append("line").attr("x1", o).attr("y1", I).attr("x2", M.width + 3 * o).attr("y2", I).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"), St(
702 void 0,
703 d,
704 ((G = i.timeline) == null ? void 0 : G.padding) ?? 50,
705 ((j = i.timeline) == null ? void 0 : j.useMaxWidth) ?? !1
706 );
707}, at = function(n, t, e, s, i, o, l, y, f, d, m) {
708 var S;
709 for (const _ of t) {
710 const b = {
711 descr: _.task,
712 section: e,
713 number: e,
714 width: 150,
715 padding: 20,
716 maxHeight: o
717 };
718 T.debug("taskNode", b);
719 const v = n.append("g").attr("class", "taskWrapper"), k = R.drawNode(v, b, e, l).height;
720 if (T.debug("taskHeight after draw", k), v.attr("transform", `translate(${s}, ${i})`), o = Math.max(o, k), _.events) {
721 const r = n.append("g").attr("class", "lineWrapper");
722 let a = o;
723 i += 100, a = a + Gt(n, _.events, e, s, i, l), i -= 100, r.append("line").attr("x1", s + 190 / 2).attr("y1", i + o).attr("x2", s + 190 / 2).attr(
724 "y2",
725 i + o + (m ? o : d) + f + 120
726 ).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
727 }
728 s = s + 200, m && !((S = l.timeline) != null && S.disableMulticolor) && e++;
729 }
730 i = i - 10;
731}, Gt = function(n, t, e, s, i, o) {
732 let l = 0;
733 const y = i;
734 i = i + 100;
735 for (const f of t) {
736 const d = {
737 descr: f,
738 section: e,
739 number: e,
740 width: 150,
741 padding: 20,
742 maxHeight: 50
743 };
744 T.debug("eventNode", d);
745 const m = n.append("g").attr("class", "eventWrapper"), _ = R.drawNode(m, d, e, o).height;
746 l = l + _, m.attr("transform", `translate(${s}, ${i})`), i = i + 10 + _;
747 }
748 return i = y, l;
749}, qt = {
750 setConf: () => {
751 },
752 draw: jt
753}, Ut = (n) => {
754 let t = "";
755 for (let e = 0; e < n.THEME_COLOR_LIMIT; e++)
756 n["lineColor" + e] = n["lineColor" + e] || n["cScaleInv" + e], Et(n["lineColor" + e]) ? n["lineColor" + e] = Tt(n["lineColor" + e], 20) : n["lineColor" + e] = It(n["lineColor" + e], 20);
757 for (let e = 0; e < n.THEME_COLOR_LIMIT; e++) {
758 const s = "" + (17 - 3 * e);
759 t += `
760 .section-${e - 1} rect, .section-${e - 1} path, .section-${e - 1} circle, .section-${e - 1} path {
761 fill: ${n["cScale" + e]};
762 }
763 .section-${e - 1} text {
764 fill: ${n["cScaleLabel" + e]};
765 }
766 .node-icon-${e - 1} {
767 font-size: 40px;
768 color: ${n["cScaleLabel" + e]};
769 }
770 .section-edge-${e - 1}{
771 stroke: ${n["cScale" + e]};
772 }
773 .edge-depth-${e - 1}{
774 stroke-width: ${s};
775 }
776 .section-${e - 1} line {
777 stroke: ${n["cScaleInv" + e]} ;
778 stroke-width: 3;
779 }
780
781 .lineWrapper line{
782 stroke: ${n["cScaleLabel" + e]} ;
783 }
784
785 .disabled, .disabled circle, .disabled text {
786 fill: lightgray;
787 }
788 .disabled text {
789 fill: #efefef;
790 }
791 `;
792 }
793 return t;
794}, Zt = (n) => `
795 .edge {
796 stroke-width: 3;
797 }
798 ${Ut(n)}
799 .section-root rect, .section-root path, .section-root circle {
800 fill: ${n.git0};
801 }
802 .section-root text {
803 fill: ${n.gitBranchLabel0};
804 }
805 .icon-container {
806 height:100%;
807 display: flex;
808 justify-content: center;
809 align-items: center;
810 }
811 .edge {
812 fill: none;
813 }
814 .eventWrapper {
815 filter: brightness(120%);
816 }
817`, Jt = Zt, Yt = {
818 db: Lt,
819 renderer: qt,
820 parser: Nt,
821 styles: Jt
822};
823export {
824 Yt as diagram
825};