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