UNPKG

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