UNPKG

110 kBJavaScriptView Raw
1import { g as we, D as _e, C as ke, c as st, s as $t, b as Pe, a as Le, E as Ie, l as X, d as Nt, e as te, f as _, Y as ee, a4 as at, r as se, _ as Bt, a5 as Ae, a6 as wt, h as Ne, j as It, k as ve, A as B } from "./mermaid-9f2aa176.js";
2import { d as Se, a as Me, b as Re, c as Ce, e as zt, g as vt } from "./svgDrawCommon-ecc5f780.js";
3var Yt = function() {
4 var t = function(ht, w, P, I) {
5 for (P = P || {}, I = ht.length; I--; P[ht[I]] = w)
6 ;
7 return P;
8 }, e = [1, 2], c = [1, 3], s = [1, 4], r = [2, 4], i = [1, 9], o = [1, 11], l = [1, 13], u = [1, 14], n = [1, 16], x = [1, 17], T = [1, 18], p = [1, 24], g = [1, 25], m = [1, 26], k = [1, 27], A = [1, 28], V = [1, 29], S = [1, 30], O = [1, 31], R = [1, 32], q = [1, 33], z = [1, 34], J = [1, 35], $ = [1, 36], H = [1, 37], U = [1, 38], F = [1, 39], W = [1, 41], Z = [1, 42], K = [1, 43], Q = [1, 44], tt = [1, 45], v = [1, 46], y = [1, 4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], L = [4, 5, 16, 50, 52, 53], j = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], nt = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], N = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 48, 50, 52, 53, 54, 59, 60, 61, 62, 70], Gt = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 50, 52, 53, 54, 59, 60, 61, 62, 70], dt = [68, 69, 70], ot = [1, 120], Mt = {
9 trace: function() {
10 },
11 yy: {},
12 symbols_: { error: 2, start: 3, SPACE: 4, NEWLINE: 5, SD: 6, document: 7, line: 8, statement: 9, box_section: 10, box_line: 11, participant_statement: 12, create: 13, box: 14, restOfLine: 15, end: 16, signal: 17, autonumber: 18, NUM: 19, off: 20, activate: 21, actor: 22, deactivate: 23, note_statement: 24, links_statement: 25, link_statement: 26, properties_statement: 27, details_statement: 28, title: 29, legacy_title: 30, acc_title: 31, acc_title_value: 32, acc_descr: 33, acc_descr_value: 34, acc_descr_multiline_value: 35, loop: 36, rect: 37, opt: 38, alt: 39, else_sections: 40, par: 41, par_sections: 42, par_over: 43, critical: 44, option_sections: 45, break: 46, option: 47, and: 48, else: 49, participant: 50, AS: 51, participant_actor: 52, destroy: 53, note: 54, placement: 55, text2: 56, over: 57, actor_pair: 58, links: 59, link: 60, properties: 61, details: 62, spaceList: 63, ",": 64, left_of: 65, right_of: 66, signaltype: 67, "+": 68, "-": 69, ACTOR: 70, SOLID_OPEN_ARROW: 71, DOTTED_OPEN_ARROW: 72, SOLID_ARROW: 73, DOTTED_ARROW: 74, SOLID_CROSS: 75, DOTTED_CROSS: 76, SOLID_POINT: 77, DOTTED_POINT: 78, TXT: 79, $accept: 0, $end: 1 },
13 terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 13: "create", 14: "box", 15: "restOfLine", 16: "end", 18: "autonumber", 19: "NUM", 20: "off", 21: "activate", 23: "deactivate", 29: "title", 30: "legacy_title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "loop", 37: "rect", 38: "opt", 39: "alt", 41: "par", 43: "par_over", 44: "critical", 46: "break", 47: "option", 48: "and", 49: "else", 50: "participant", 51: "AS", 52: "participant_actor", 53: "destroy", 54: "note", 57: "over", 59: "links", 60: "link", 61: "properties", 62: "details", 64: ",", 65: "left_of", 66: "right_of", 68: "+", 69: "-", 70: "ACTOR", 71: "SOLID_OPEN_ARROW", 72: "DOTTED_OPEN_ARROW", 73: "SOLID_ARROW", 74: "DOTTED_ARROW", 75: "SOLID_CROSS", 76: "DOTTED_CROSS", 77: "SOLID_POINT", 78: "DOTTED_POINT", 79: "TXT" },
14 productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [10, 0], [10, 2], [11, 2], [11, 1], [11, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [45, 1], [45, 4], [42, 1], [42, 4], [40, 1], [40, 4], [12, 5], [12, 3], [12, 5], [12, 3], [12, 3], [24, 4], [24, 4], [25, 3], [26, 3], [27, 3], [28, 3], [63, 2], [63, 1], [58, 3], [58, 1], [55, 1], [55, 1], [17, 5], [17, 5], [17, 4], [22, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [56, 1]],
15 performAction: function(w, P, I, b, M, d, Et) {
16 var h = d.length - 1;
17 switch (M) {
18 case 3:
19 return b.apply(d[h]), d[h];
20 case 4:
21 case 9:
22 this.$ = [];
23 break;
24 case 5:
25 case 10:
26 d[h - 1].push(d[h]), this.$ = d[h - 1];
27 break;
28 case 6:
29 case 7:
30 case 11:
31 case 12:
32 this.$ = d[h];
33 break;
34 case 8:
35 case 13:
36 this.$ = [];
37 break;
38 case 15:
39 d[h].type = "createParticipant", this.$ = d[h];
40 break;
41 case 16:
42 d[h - 1].unshift({ type: "boxStart", boxData: b.parseBoxData(d[h - 2]) }), d[h - 1].push({ type: "boxEnd", boxText: d[h - 2] }), this.$ = d[h - 1];
43 break;
44 case 18:
45 this.$ = { type: "sequenceIndex", sequenceIndex: Number(d[h - 2]), sequenceIndexStep: Number(d[h - 1]), sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER };
46 break;
47 case 19:
48 this.$ = { type: "sequenceIndex", sequenceIndex: Number(d[h - 1]), sequenceIndexStep: 1, sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER };
49 break;
50 case 20:
51 this.$ = { type: "sequenceIndex", sequenceVisible: !1, signalType: b.LINETYPE.AUTONUMBER };
52 break;
53 case 21:
54 this.$ = { type: "sequenceIndex", sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER };
55 break;
56 case 22:
57 this.$ = { type: "activeStart", signalType: b.LINETYPE.ACTIVE_START, actor: d[h - 1] };
58 break;
59 case 23:
60 this.$ = { type: "activeEnd", signalType: b.LINETYPE.ACTIVE_END, actor: d[h - 1] };
61 break;
62 case 29:
63 b.setDiagramTitle(d[h].substring(6)), this.$ = d[h].substring(6);
64 break;
65 case 30:
66 b.setDiagramTitle(d[h].substring(7)), this.$ = d[h].substring(7);
67 break;
68 case 31:
69 this.$ = d[h].trim(), b.setAccTitle(this.$);
70 break;
71 case 32:
72 case 33:
73 this.$ = d[h].trim(), b.setAccDescription(this.$);
74 break;
75 case 34:
76 d[h - 1].unshift({ type: "loopStart", loopText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.LOOP_START }), d[h - 1].push({ type: "loopEnd", loopText: d[h - 2], signalType: b.LINETYPE.LOOP_END }), this.$ = d[h - 1];
77 break;
78 case 35:
79 d[h - 1].unshift({ type: "rectStart", color: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.RECT_START }), d[h - 1].push({ type: "rectEnd", color: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.RECT_END }), this.$ = d[h - 1];
80 break;
81 case 36:
82 d[h - 1].unshift({ type: "optStart", optText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.OPT_START }), d[h - 1].push({ type: "optEnd", optText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.OPT_END }), this.$ = d[h - 1];
83 break;
84 case 37:
85 d[h - 1].unshift({ type: "altStart", altText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.ALT_START }), d[h - 1].push({ type: "altEnd", signalType: b.LINETYPE.ALT_END }), this.$ = d[h - 1];
86 break;
87 case 38:
88 d[h - 1].unshift({ type: "parStart", parText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.PAR_START }), d[h - 1].push({ type: "parEnd", signalType: b.LINETYPE.PAR_END }), this.$ = d[h - 1];
89 break;
90 case 39:
91 d[h - 1].unshift({ type: "parStart", parText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.PAR_OVER_START }), d[h - 1].push({ type: "parEnd", signalType: b.LINETYPE.PAR_END }), this.$ = d[h - 1];
92 break;
93 case 40:
94 d[h - 1].unshift({ type: "criticalStart", criticalText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.CRITICAL_START }), d[h - 1].push({ type: "criticalEnd", signalType: b.LINETYPE.CRITICAL_END }), this.$ = d[h - 1];
95 break;
96 case 41:
97 d[h - 1].unshift({ type: "breakStart", breakText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.BREAK_START }), d[h - 1].push({ type: "breakEnd", optText: b.parseMessage(d[h - 2]), signalType: b.LINETYPE.BREAK_END }), this.$ = d[h - 1];
98 break;
99 case 43:
100 this.$ = d[h - 3].concat([{ type: "option", optionText: b.parseMessage(d[h - 1]), signalType: b.LINETYPE.CRITICAL_OPTION }, d[h]]);
101 break;
102 case 45:
103 this.$ = d[h - 3].concat([{ type: "and", parText: b.parseMessage(d[h - 1]), signalType: b.LINETYPE.PAR_AND }, d[h]]);
104 break;
105 case 47:
106 this.$ = d[h - 3].concat([{ type: "else", altText: b.parseMessage(d[h - 1]), signalType: b.LINETYPE.ALT_ELSE }, d[h]]);
107 break;
108 case 48:
109 d[h - 3].draw = "participant", d[h - 3].type = "addParticipant", d[h - 3].description = b.parseMessage(d[h - 1]), this.$ = d[h - 3];
110 break;
111 case 49:
112 d[h - 1].draw = "participant", d[h - 1].type = "addParticipant", this.$ = d[h - 1];
113 break;
114 case 50:
115 d[h - 3].draw = "actor", d[h - 3].type = "addParticipant", d[h - 3].description = b.parseMessage(d[h - 1]), this.$ = d[h - 3];
116 break;
117 case 51:
118 d[h - 1].draw = "actor", d[h - 1].type = "addParticipant", this.$ = d[h - 1];
119 break;
120 case 52:
121 d[h - 1].type = "destroyParticipant", this.$ = d[h - 1];
122 break;
123 case 53:
124 this.$ = [d[h - 1], { type: "addNote", placement: d[h - 2], actor: d[h - 1].actor, text: d[h] }];
125 break;
126 case 54:
127 d[h - 2] = [].concat(d[h - 1], d[h - 1]).slice(0, 2), d[h - 2][0] = d[h - 2][0].actor, d[h - 2][1] = d[h - 2][1].actor, this.$ = [d[h - 1], { type: "addNote", placement: b.PLACEMENT.OVER, actor: d[h - 2].slice(0, 2), text: d[h] }];
128 break;
129 case 55:
130 this.$ = [d[h - 1], { type: "addLinks", actor: d[h - 1].actor, text: d[h] }];
131 break;
132 case 56:
133 this.$ = [d[h - 1], { type: "addALink", actor: d[h - 1].actor, text: d[h] }];
134 break;
135 case 57:
136 this.$ = [d[h - 1], { type: "addProperties", actor: d[h - 1].actor, text: d[h] }];
137 break;
138 case 58:
139 this.$ = [d[h - 1], { type: "addDetails", actor: d[h - 1].actor, text: d[h] }];
140 break;
141 case 61:
142 this.$ = [d[h - 2], d[h]];
143 break;
144 case 62:
145 this.$ = d[h];
146 break;
147 case 63:
148 this.$ = b.PLACEMENT.LEFTOF;
149 break;
150 case 64:
151 this.$ = b.PLACEMENT.RIGHTOF;
152 break;
153 case 65:
154 this.$ = [
155 d[h - 4],
156 d[h - 1],
157 { type: "addMessage", from: d[h - 4].actor, to: d[h - 1].actor, signalType: d[h - 3], msg: d[h], activate: !0 },
158 { type: "activeStart", signalType: b.LINETYPE.ACTIVE_START, actor: d[h - 1] }
159 ];
160 break;
161 case 66:
162 this.$ = [
163 d[h - 4],
164 d[h - 1],
165 { type: "addMessage", from: d[h - 4].actor, to: d[h - 1].actor, signalType: d[h - 3], msg: d[h] },
166 { type: "activeEnd", signalType: b.LINETYPE.ACTIVE_END, actor: d[h - 4] }
167 ];
168 break;
169 case 67:
170 this.$ = [d[h - 3], d[h - 1], { type: "addMessage", from: d[h - 3].actor, to: d[h - 1].actor, signalType: d[h - 2], msg: d[h] }];
171 break;
172 case 68:
173 this.$ = { type: "addParticipant", actor: d[h] };
174 break;
175 case 69:
176 this.$ = b.LINETYPE.SOLID_OPEN;
177 break;
178 case 70:
179 this.$ = b.LINETYPE.DOTTED_OPEN;
180 break;
181 case 71:
182 this.$ = b.LINETYPE.SOLID;
183 break;
184 case 72:
185 this.$ = b.LINETYPE.DOTTED;
186 break;
187 case 73:
188 this.$ = b.LINETYPE.SOLID_CROSS;
189 break;
190 case 74:
191 this.$ = b.LINETYPE.DOTTED_CROSS;
192 break;
193 case 75:
194 this.$ = b.LINETYPE.SOLID_POINT;
195 break;
196 case 76:
197 this.$ = b.LINETYPE.DOTTED_POINT;
198 break;
199 case 77:
200 this.$ = b.parseMessage(d[h].trim().substring(1));
201 break;
202 }
203 },
204 table: [{ 3: 1, 4: e, 5: c, 6: s }, { 1: [3] }, { 3: 5, 4: e, 5: c, 6: s }, { 3: 6, 4: e, 5: c, 6: s }, t([1, 4, 5, 13, 14, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], r, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, t(y, [2, 5]), { 9: 47, 12: 12, 13: l, 14: u, 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, t(y, [2, 7]), t(y, [2, 8]), t(y, [2, 14]), { 12: 48, 50: H, 52: U, 53: F }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 70: v }, { 22: 55, 70: v }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, t(y, [2, 29]), t(y, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, t(y, [2, 33]), { 15: [1, 63] }, { 15: [1, 64] }, { 15: [1, 65] }, { 15: [1, 66] }, { 15: [1, 67] }, { 15: [1, 68] }, { 15: [1, 69] }, { 15: [1, 70] }, { 22: 71, 70: v }, { 22: 72, 70: v }, { 22: 73, 70: v }, { 67: 74, 71: [1, 75], 72: [1, 76], 73: [1, 77], 74: [1, 78], 75: [1, 79], 76: [1, 80], 77: [1, 81], 78: [1, 82] }, { 55: 83, 57: [1, 84], 65: [1, 85], 66: [1, 86] }, { 22: 87, 70: v }, { 22: 88, 70: v }, { 22: 89, 70: v }, { 22: 90, 70: v }, t([5, 51, 64, 71, 72, 73, 74, 75, 76, 77, 78, 79], [2, 68]), t(y, [2, 6]), t(y, [2, 15]), t(L, [2, 9], { 10: 91 }), t(y, [2, 17]), { 5: [1, 93], 19: [1, 92] }, { 5: [1, 94] }, t(y, [2, 21]), { 5: [1, 95] }, { 5: [1, 96] }, t(y, [2, 24]), t(y, [2, 25]), t(y, [2, 26]), t(y, [2, 27]), t(y, [2, 28]), t(y, [2, 31]), t(y, [2, 32]), t(j, r, { 7: 97 }), t(j, r, { 7: 98 }), t(j, r, { 7: 99 }), t(nt, r, { 40: 100, 7: 101 }), t(N, r, { 42: 102, 7: 103 }), t(N, r, { 7: 103, 42: 104 }), t(Gt, r, { 45: 105, 7: 106 }), t(j, r, { 7: 107 }), { 5: [1, 109], 51: [1, 108] }, { 5: [1, 111], 51: [1, 110] }, { 5: [1, 112] }, { 22: 115, 68: [1, 113], 69: [1, 114], 70: v }, t(dt, [2, 69]), t(dt, [2, 70]), t(dt, [2, 71]), t(dt, [2, 72]), t(dt, [2, 73]), t(dt, [2, 74]), t(dt, [2, 75]), t(dt, [2, 76]), { 22: 116, 70: v }, { 22: 118, 58: 117, 70: v }, { 70: [2, 63] }, { 70: [2, 64] }, { 56: 119, 79: ot }, { 56: 121, 79: ot }, { 56: 122, 79: ot }, { 56: 123, 79: ot }, { 4: [1, 126], 5: [1, 128], 11: 125, 12: 127, 16: [1, 124], 50: H, 52: U, 53: F }, { 5: [1, 129] }, t(y, [2, 19]), t(y, [2, 20]), t(y, [2, 22]), t(y, [2, 23]), { 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 16: [1, 130], 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, { 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 16: [1, 131], 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, { 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 16: [1, 132], 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, { 16: [1, 133] }, { 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 16: [2, 46], 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 49: [1, 134], 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, { 16: [1, 135] }, { 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 16: [2, 44], 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 48: [1, 136], 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, { 16: [1, 137] }, { 16: [1, 138] }, { 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 16: [2, 42], 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 47: [1, 139], 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, { 4: i, 5: o, 8: 8, 9: 10, 12: 12, 13: l, 14: u, 16: [1, 140], 17: 15, 18: n, 21: x, 22: 40, 23: T, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: p, 30: g, 31: m, 33: k, 35: A, 36: V, 37: S, 38: O, 39: R, 41: q, 43: z, 44: J, 46: $, 50: H, 52: U, 53: F, 54: W, 59: Z, 60: K, 61: Q, 62: tt, 70: v }, { 15: [1, 141] }, t(y, [2, 49]), { 15: [1, 142] }, t(y, [2, 51]), t(y, [2, 52]), { 22: 143, 70: v }, { 22: 144, 70: v }, { 56: 145, 79: ot }, { 56: 146, 79: ot }, { 56: 147, 79: ot }, { 64: [1, 148], 79: [2, 62] }, { 5: [2, 55] }, { 5: [2, 77] }, { 5: [2, 56] }, { 5: [2, 57] }, { 5: [2, 58] }, t(y, [2, 16]), t(L, [2, 10]), { 12: 149, 50: H, 52: U, 53: F }, t(L, [2, 12]), t(L, [2, 13]), t(y, [2, 18]), t(y, [2, 34]), t(y, [2, 35]), t(y, [2, 36]), t(y, [2, 37]), { 15: [1, 150] }, t(y, [2, 38]), { 15: [1, 151] }, t(y, [2, 39]), t(y, [2, 40]), { 15: [1, 152] }, t(y, [2, 41]), { 5: [1, 153] }, { 5: [1, 154] }, { 56: 155, 79: ot }, { 56: 156, 79: ot }, { 5: [2, 67] }, { 5: [2, 53] }, { 5: [2, 54] }, { 22: 157, 70: v }, t(L, [2, 11]), t(nt, r, { 7: 101, 40: 158 }), t(N, r, { 7: 103, 42: 159 }), t(Gt, r, { 7: 106, 45: 160 }), t(y, [2, 48]), t(y, [2, 50]), { 5: [2, 65] }, { 5: [2, 66] }, { 79: [2, 61] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }],
205 defaultActions: { 5: [2, 1], 6: [2, 2], 85: [2, 63], 86: [2, 64], 119: [2, 55], 120: [2, 77], 121: [2, 56], 122: [2, 57], 123: [2, 58], 145: [2, 67], 146: [2, 53], 147: [2, 54], 155: [2, 65], 156: [2, 66], 157: [2, 61], 158: [2, 47], 159: [2, 45], 160: [2, 43] },
206 parseError: function(w, P) {
207 if (P.recoverable)
208 this.trace(w);
209 else {
210 var I = new Error(w);
211 throw I.hash = P, I;
212 }
213 },
214 parse: function(w) {
215 var P = this, I = [0], b = [], M = [null], d = [], Et = this.table, h = "", kt = 0, Xt = 0, Te = 2, Jt = 1, be = d.slice.call(arguments, 1), Y = Object.create(this.lexer), ut = { yy: {} };
216 for (var Ct in this.yy)
217 Object.prototype.hasOwnProperty.call(this.yy, Ct) && (ut.yy[Ct] = this.yy[Ct]);
218 Y.setInput(w, ut.yy), ut.yy.lexer = Y, ut.yy.parser = this, typeof Y.yylloc > "u" && (Y.yylloc = {});
219 var Dt = Y.yylloc;
220 d.push(Dt);
221 var Ee = Y.options && Y.options.ranges;
222 typeof ut.yy.parseError == "function" ? this.parseError = ut.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
223 function me() {
224 var lt;
225 return lt = b.pop() || Y.lex() || Jt, typeof lt != "number" && (lt instanceof Array && (b = lt, lt = b.pop()), lt = P.symbols_[lt] || lt), lt;
226 }
227 for (var G, pt, et, Vt, yt = {}, Pt, ct, Zt, Lt; ; ) {
228 if (pt = I[I.length - 1], this.defaultActions[pt] ? et = this.defaultActions[pt] : ((G === null || typeof G > "u") && (G = me()), et = Et[pt] && Et[pt][G]), typeof et > "u" || !et.length || !et[0]) {
229 var Ot = "";
230 Lt = [];
231 for (Pt in Et[pt])
232 this.terminals_[Pt] && Pt > Te && Lt.push("'" + this.terminals_[Pt] + "'");
233 Y.showPosition ? Ot = "Parse error on line " + (kt + 1) + `:
234` + Y.showPosition() + `
235Expecting ` + Lt.join(", ") + ", got '" + (this.terminals_[G] || G) + "'" : Ot = "Parse error on line " + (kt + 1) + ": Unexpected " + (G == Jt ? "end of input" : "'" + (this.terminals_[G] || G) + "'"), this.parseError(Ot, {
236 text: Y.match,
237 token: this.terminals_[G] || G,
238 line: Y.yylineno,
239 loc: Dt,
240 expected: Lt
241 });
242 }
243 if (et[0] instanceof Array && et.length > 1)
244 throw new Error("Parse Error: multiple actions possible at state: " + pt + ", token: " + G);
245 switch (et[0]) {
246 case 1:
247 I.push(G), M.push(Y.yytext), d.push(Y.yylloc), I.push(et[1]), G = null, Xt = Y.yyleng, h = Y.yytext, kt = Y.yylineno, Dt = Y.yylloc;
248 break;
249 case 2:
250 if (ct = this.productions_[et[1]][1], yt.$ = M[M.length - ct], yt._$ = {
251 first_line: d[d.length - (ct || 1)].first_line,
252 last_line: d[d.length - 1].last_line,
253 first_column: d[d.length - (ct || 1)].first_column,
254 last_column: d[d.length - 1].last_column
255 }, Ee && (yt._$.range = [
256 d[d.length - (ct || 1)].range[0],
257 d[d.length - 1].range[1]
258 ]), Vt = this.performAction.apply(yt, [
259 h,
260 Xt,
261 kt,
262 ut.yy,
263 et[1],
264 M,
265 d
266 ].concat(be)), typeof Vt < "u")
267 return Vt;
268 ct && (I = I.slice(0, -1 * ct * 2), M = M.slice(0, -1 * ct), d = d.slice(0, -1 * ct)), I.push(this.productions_[et[1]][0]), M.push(yt.$), d.push(yt._$), Zt = Et[I[I.length - 2]][I[I.length - 1]], I.push(Zt);
269 break;
270 case 3:
271 return !0;
272 }
273 }
274 return !0;
275 }
276 }, ye = function() {
277 var ht = {
278 EOF: 1,
279 parseError: function(P, I) {
280 if (this.yy.parser)
281 this.yy.parser.parseError(P, I);
282 else
283 throw new Error(P);
284 },
285 // resets the lexer, sets new input
286 setInput: function(w, P) {
287 return this.yy = P || this.yy || {}, this._input = w, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
288 first_line: 1,
289 first_column: 0,
290 last_line: 1,
291 last_column: 0
292 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
293 },
294 // consumes and returns one char from the input
295 input: function() {
296 var w = this._input[0];
297 this.yytext += w, this.yyleng++, this.offset++, this.match += w, this.matched += w;
298 var P = w.match(/(?:\r\n?|\n).*/g);
299 return P ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), w;
300 },
301 // unshifts one char (or a string) into the input
302 unput: function(w) {
303 var P = w.length, I = w.split(/(?:\r\n?|\n)/g);
304 this._input = w + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - P), this.offset -= P;
305 var b = this.match.split(/(?:\r\n?|\n)/g);
306 this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), I.length - 1 && (this.yylineno -= I.length - 1);
307 var M = this.yylloc.range;
308 return this.yylloc = {
309 first_line: this.yylloc.first_line,
310 last_line: this.yylineno + 1,
311 first_column: this.yylloc.first_column,
312 last_column: I ? (I.length === b.length ? this.yylloc.first_column : 0) + b[b.length - I.length].length - I[0].length : this.yylloc.first_column - P
313 }, this.options.ranges && (this.yylloc.range = [M[0], M[0] + this.yyleng - P]), this.yyleng = this.yytext.length, this;
314 },
315 // When called from action, caches matched text and appends it on next action
316 more: function() {
317 return this._more = !0, this;
318 },
319 // 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.
320 reject: function() {
321 if (this.options.backtrack_lexer)
322 this._backtrack = !0;
323 else
324 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).
325` + this.showPosition(), {
326 text: "",
327 token: null,
328 line: this.yylineno
329 });
330 return this;
331 },
332 // retain first n characters of the match
333 less: function(w) {
334 this.unput(this.match.slice(w));
335 },
336 // displays already matched input, i.e. for error messages
337 pastInput: function() {
338 var w = this.matched.substr(0, this.matched.length - this.match.length);
339 return (w.length > 20 ? "..." : "") + w.substr(-20).replace(/\n/g, "");
340 },
341 // displays upcoming input, i.e. for error messages
342 upcomingInput: function() {
343 var w = this.match;
344 return w.length < 20 && (w += this._input.substr(0, 20 - w.length)), (w.substr(0, 20) + (w.length > 20 ? "..." : "")).replace(/\n/g, "");
345 },
346 // displays the character position where the lexing error occurred, i.e. for error messages
347 showPosition: function() {
348 var w = this.pastInput(), P = new Array(w.length + 1).join("-");
349 return w + this.upcomingInput() + `
350` + P + "^";
351 },
352 // test the lexed token: return FALSE when not a match, otherwise return token
353 test_match: function(w, P) {
354 var I, b, M;
355 if (this.options.backtrack_lexer && (M = {
356 yylineno: this.yylineno,
357 yylloc: {
358 first_line: this.yylloc.first_line,
359 last_line: this.last_line,
360 first_column: this.yylloc.first_column,
361 last_column: this.yylloc.last_column
362 },
363 yytext: this.yytext,
364 match: this.match,
365 matches: this.matches,
366 matched: this.matched,
367 yyleng: this.yyleng,
368 offset: this.offset,
369 _more: this._more,
370 _input: this._input,
371 yy: this.yy,
372 conditionStack: this.conditionStack.slice(0),
373 done: this.done
374 }, this.options.ranges && (M.yylloc.range = this.yylloc.range.slice(0))), b = w[0].match(/(?:\r\n?|\n).*/g), b && (this.yylineno += b.length), this.yylloc = {
375 first_line: this.yylloc.last_line,
376 last_line: this.yylineno + 1,
377 first_column: this.yylloc.last_column,
378 last_column: b ? b[b.length - 1].length - b[b.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + w[0].length
379 }, this.yytext += w[0], this.match += w[0], this.matches = w, 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(w[0].length), this.matched += w[0], I = this.performAction.call(this, this.yy, this, P, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), I)
380 return I;
381 if (this._backtrack) {
382 for (var d in M)
383 this[d] = M[d];
384 return !1;
385 }
386 return !1;
387 },
388 // return next match in input
389 next: function() {
390 if (this.done)
391 return this.EOF;
392 this._input || (this.done = !0);
393 var w, P, I, b;
394 this._more || (this.yytext = "", this.match = "");
395 for (var M = this._currentRules(), d = 0; d < M.length; d++)
396 if (I = this._input.match(this.rules[M[d]]), I && (!P || I[0].length > P[0].length)) {
397 if (P = I, b = d, this.options.backtrack_lexer) {
398 if (w = this.test_match(I, M[d]), w !== !1)
399 return w;
400 if (this._backtrack) {
401 P = !1;
402 continue;
403 } else
404 return !1;
405 } else if (!this.options.flex)
406 break;
407 }
408 return P ? (w = this.test_match(P, M[b]), w !== !1 ? w : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
409` + this.showPosition(), {
410 text: "",
411 token: null,
412 line: this.yylineno
413 });
414 },
415 // return next match that has a token
416 lex: function() {
417 var P = this.next();
418 return P || this.lex();
419 },
420 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
421 begin: function(P) {
422 this.conditionStack.push(P);
423 },
424 // pop the previously active lexer condition state off the condition stack
425 popState: function() {
426 var P = this.conditionStack.length - 1;
427 return P > 0 ? this.conditionStack.pop() : this.conditionStack[0];
428 },
429 // produce the lexer rule set which is active for the currently active lexer condition state
430 _currentRules: function() {
431 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
432 },
433 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
434 topState: function(P) {
435 return P = this.conditionStack.length - 1 - Math.abs(P || 0), P >= 0 ? this.conditionStack[P] : "INITIAL";
436 },
437 // alias for begin(condition)
438 pushState: function(P) {
439 this.begin(P);
440 },
441 // return the number of states currently on the stack
442 stateStackSize: function() {
443 return this.conditionStack.length;
444 },
445 options: { "case-insensitive": !0 },
446 performAction: function(P, I, b, M) {
447 switch (b) {
448 case 0:
449 return 5;
450 case 1:
451 break;
452 case 2:
453 break;
454 case 3:
455 break;
456 case 4:
457 break;
458 case 5:
459 break;
460 case 6:
461 return 19;
462 case 7:
463 return this.begin("LINE"), 14;
464 case 8:
465 return this.begin("ID"), 50;
466 case 9:
467 return this.begin("ID"), 52;
468 case 10:
469 return 13;
470 case 11:
471 return this.begin("ID"), 53;
472 case 12:
473 return I.yytext = I.yytext.trim(), this.begin("ALIAS"), 70;
474 case 13:
475 return this.popState(), this.popState(), this.begin("LINE"), 51;
476 case 14:
477 return this.popState(), this.popState(), 5;
478 case 15:
479 return this.begin("LINE"), 36;
480 case 16:
481 return this.begin("LINE"), 37;
482 case 17:
483 return this.begin("LINE"), 38;
484 case 18:
485 return this.begin("LINE"), 39;
486 case 19:
487 return this.begin("LINE"), 49;
488 case 20:
489 return this.begin("LINE"), 41;
490 case 21:
491 return this.begin("LINE"), 43;
492 case 22:
493 return this.begin("LINE"), 48;
494 case 23:
495 return this.begin("LINE"), 44;
496 case 24:
497 return this.begin("LINE"), 47;
498 case 25:
499 return this.begin("LINE"), 46;
500 case 26:
501 return this.popState(), 15;
502 case 27:
503 return 16;
504 case 28:
505 return 65;
506 case 29:
507 return 66;
508 case 30:
509 return 59;
510 case 31:
511 return 60;
512 case 32:
513 return 61;
514 case 33:
515 return 62;
516 case 34:
517 return 57;
518 case 35:
519 return 54;
520 case 36:
521 return this.begin("ID"), 21;
522 case 37:
523 return this.begin("ID"), 23;
524 case 38:
525 return 29;
526 case 39:
527 return 30;
528 case 40:
529 return this.begin("acc_title"), 31;
530 case 41:
531 return this.popState(), "acc_title_value";
532 case 42:
533 return this.begin("acc_descr"), 33;
534 case 43:
535 return this.popState(), "acc_descr_value";
536 case 44:
537 this.begin("acc_descr_multiline");
538 break;
539 case 45:
540 this.popState();
541 break;
542 case 46:
543 return "acc_descr_multiline_value";
544 case 47:
545 return 6;
546 case 48:
547 return 18;
548 case 49:
549 return 20;
550 case 50:
551 return 64;
552 case 51:
553 return 5;
554 case 52:
555 return I.yytext = I.yytext.trim(), 70;
556 case 53:
557 return 73;
558 case 54:
559 return 74;
560 case 55:
561 return 71;
562 case 56:
563 return 72;
564 case 57:
565 return 75;
566 case 58:
567 return 76;
568 case 59:
569 return 77;
570 case 60:
571 return 78;
572 case 61:
573 return 79;
574 case 62:
575 return 68;
576 case 63:
577 return 69;
578 case 64:
579 return 5;
580 case 65:
581 return "INVALID";
582 }
583 },
584 rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:[^\->:\n,;]+?([\-]*[^\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/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, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]+)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i],
585 conditions: { acc_descr_multiline: { rules: [45, 46], inclusive: !1 }, acc_descr: { rules: [43], inclusive: !1 }, acc_title: { rules: [41], inclusive: !1 }, ID: { rules: [2, 3, 12], inclusive: !1 }, ALIAS: { rules: [2, 3, 13, 14], inclusive: !1 }, LINE: { rules: [2, 3, 26], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 44, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65], inclusive: !0 } }
586 };
587 return ht;
588 }();
589 Mt.lexer = ye;
590 function Rt() {
591 this.yy = {};
592 }
593 return Rt.prototype = Mt, Mt.Parser = Rt, new Rt();
594}();
595Yt.parser = Yt;
596const De = Yt;
597class Ve {
598 /**
599 * @param init - Function that creates the default state.
600 */
601 constructor(e) {
602 this.init = e, this.records = this.init();
603 }
604 reset() {
605 this.records = this.init();
606 }
607}
608const E = new Ve(() => ({
609 prevActor: void 0,
610 actors: {},
611 createdActors: {},
612 destroyedActors: {},
613 boxes: [],
614 messages: [],
615 notes: [],
616 sequenceNumbersEnabled: !1,
617 wrapEnabled: void 0,
618 currentBox: void 0,
619 lastCreated: void 0,
620 lastDestroyed: void 0
621})), Oe = function(t) {
622 E.records.boxes.push({
623 name: t.text,
624 wrap: t.wrap === void 0 && gt() || !!t.wrap,
625 fill: t.color,
626 actorKeys: []
627 }), E.records.currentBox = E.records.boxes.slice(-1)[0];
628}, Ft = function(t, e, c, s) {
629 let r = E.records.currentBox;
630 const i = E.records.actors[t];
631 if (i) {
632 if (E.records.currentBox && i.box && E.records.currentBox !== i.box)
633 throw new Error(
634 "A same participant should only be defined in one Box: " + i.name + " can't be in '" + i.box.name + "' and in '" + E.records.currentBox.name + "' at the same time."
635 );
636 if (r = i.box ? i.box : E.records.currentBox, i.box = r, i && e === i.name && c == null)
637 return;
638 }
639 (c == null || c.text == null) && (c = { text: e, wrap: null, type: s }), (s == null || c.text == null) && (c = { text: e, wrap: null, type: s }), E.records.actors[t] = {
640 box: r,
641 name: e,
642 description: c.text,
643 wrap: c.wrap === void 0 && gt() || !!c.wrap,
644 prevActor: E.records.prevActor,
645 links: {},
646 properties: {},
647 actorCnt: null,
648 rectData: null,
649 type: s || "participant"
650 }, E.records.prevActor && E.records.actors[E.records.prevActor] && (E.records.actors[E.records.prevActor].nextActor = t), E.records.currentBox && E.records.currentBox.actorKeys.push(t), E.records.prevActor = t;
651}, Be = (t) => {
652 let e, c = 0;
653 for (e = 0; e < E.records.messages.length; e++)
654 E.records.messages[e].type === mt.ACTIVE_START && E.records.messages[e].from.actor === t && c++, E.records.messages[e].type === mt.ACTIVE_END && E.records.messages[e].from.actor === t && c--;
655 return c;
656}, Ye = function(t, e, c, s) {
657 E.records.messages.push({
658 from: t,
659 to: e,
660 message: c.text,
661 wrap: c.wrap === void 0 && gt() || !!c.wrap,
662 answer: s
663 });
664}, C = function(t, e, c = { text: void 0, wrap: void 0 }, s, r = !1) {
665 if (s === mt.ACTIVE_END && Be(t.actor) < 1) {
666 let o = new Error("Trying to inactivate an inactive participant (" + t.actor + ")");
667 throw o.hash = {
668 text: "->>-",
669 token: "->>-",
670 line: "1",
671 loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
672 expected: ["'ACTIVE_PARTICIPANT'"]
673 }, o;
674 }
675 return E.records.messages.push({
676 from: t,
677 to: e,
678 message: c.text,
679 wrap: c.wrap === void 0 && gt() || !!c.wrap,
680 type: s,
681 activate: r
682 }), !0;
683}, Fe = function() {
684 return E.records.boxes.length > 0;
685}, We = function() {
686 return E.records.boxes.some((t) => t.name);
687}, qe = function() {
688 return E.records.messages;
689}, ze = function() {
690 return E.records.boxes;
691}, He = function() {
692 return E.records.actors;
693}, Ue = function() {
694 return E.records.createdActors;
695}, Ke = function() {
696 return E.records.destroyedActors;
697}, _t = function(t) {
698 return E.records.actors[t];
699}, Ge = function() {
700 return Object.keys(E.records.actors);
701}, Xe = function() {
702 E.records.sequenceNumbersEnabled = !0;
703}, Je = function() {
704 E.records.sequenceNumbersEnabled = !1;
705}, Ze = () => E.records.sequenceNumbersEnabled, Qe = function(t) {
706 E.records.wrapEnabled = t;
707}, gt = () => E.records.wrapEnabled !== void 0 ? E.records.wrapEnabled : st().sequence.wrap, je = function() {
708 E.reset(), Ie();
709}, $e = function(t) {
710 const e = t.trim(), c = {
711 text: e.replace(/^:?(?:no)?wrap:/, "").trim(),
712 wrap: e.match(/^:?wrap:/) !== null ? !0 : e.match(/^:?nowrap:/) !== null ? !1 : void 0
713 };
714 return X.debug("parseMessage:", c), c;
715}, t0 = function(t) {
716 const e = t.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/);
717 let c = e != null && e[1] ? e[1].trim() : "transparent", s = e != null && e[2] ? e[2].trim() : void 0;
718 if (window && window.CSS)
719 window.CSS.supports("color", c) || (c = "transparent", s = t.trim());
720 else {
721 const r = new Option().style;
722 r.color = c, r.color !== c && (c = "transparent", s = t.trim());
723 }
724 return {
725 color: c,
726 text: s !== void 0 ? Nt(s.replace(/^:?(?:no)?wrap:/, ""), st()) : void 0,
727 wrap: s !== void 0 ? s.match(/^:?wrap:/) !== null ? !0 : s.match(/^:?nowrap:/) !== null ? !1 : void 0 : void 0
728 };
729}, mt = {
730 SOLID: 0,
731 DOTTED: 1,
732 NOTE: 2,
733 SOLID_CROSS: 3,
734 DOTTED_CROSS: 4,
735 SOLID_OPEN: 5,
736 DOTTED_OPEN: 6,
737 LOOP_START: 10,
738 LOOP_END: 11,
739 ALT_START: 12,
740 ALT_ELSE: 13,
741 ALT_END: 14,
742 OPT_START: 15,
743 OPT_END: 16,
744 ACTIVE_START: 17,
745 ACTIVE_END: 18,
746 PAR_START: 19,
747 PAR_AND: 20,
748 PAR_END: 21,
749 RECT_START: 22,
750 RECT_END: 23,
751 SOLID_POINT: 24,
752 DOTTED_POINT: 25,
753 AUTONUMBER: 26,
754 CRITICAL_START: 27,
755 CRITICAL_OPTION: 28,
756 CRITICAL_END: 29,
757 BREAK_START: 30,
758 BREAK_END: 31,
759 PAR_OVER_START: 32
760}, e0 = {
761 FILLED: 0,
762 OPEN: 1
763}, s0 = {
764 LEFTOF: 0,
765 RIGHTOF: 1,
766 OVER: 2
767}, ne = function(t, e, c) {
768 const s = {
769 actor: t,
770 placement: e,
771 message: c.text,
772 wrap: c.wrap === void 0 && gt() || !!c.wrap
773 }, r = [].concat(t, t);
774 E.records.notes.push(s), E.records.messages.push({
775 from: r[0],
776 to: r[1],
777 message: c.text,
778 wrap: c.wrap === void 0 && gt() || !!c.wrap,
779 type: mt.NOTE,
780 placement: e
781 });
782}, re = function(t, e) {
783 const c = _t(t);
784 try {
785 let s = Nt(e.text, st());
786 s = s.replace(/&amp;/g, "&"), s = s.replace(/&equals;/g, "=");
787 const r = JSON.parse(s);
788 Ht(c, r);
789 } catch (s) {
790 X.error("error while parsing actor link text", s);
791 }
792}, n0 = function(t, e) {
793 const c = _t(t);
794 try {
795 const o = {};
796 let l = Nt(e.text, st());
797 var s = l.indexOf("@");
798 l = l.replace(/&amp;/g, "&"), l = l.replace(/&equals;/g, "=");
799 var r = l.slice(0, s - 1).trim(), i = l.slice(s + 1).trim();
800 o[r] = i, Ht(c, o);
801 } catch (o) {
802 X.error("error while parsing actor link text", o);
803 }
804};
805function Ht(t, e) {
806 if (t.links == null)
807 t.links = e;
808 else
809 for (let c in e)
810 t.links[c] = e[c];
811}
812const ie = function(t, e) {
813 const c = _t(t);
814 try {
815 let s = Nt(e.text, st());
816 const r = JSON.parse(s);
817 ae(c, r);
818 } catch (s) {
819 X.error("error while parsing actor properties text", s);
820 }
821};
822function ae(t, e) {
823 if (t.properties == null)
824 t.properties = e;
825 else
826 for (let c in e)
827 t.properties[c] = e[c];
828}
829function r0() {
830 E.records.currentBox = void 0;
831}
832const oe = function(t, e) {
833 const c = _t(t), s = document.getElementById(e.text);
834 try {
835 const r = s.innerHTML, i = JSON.parse(r);
836 i.properties && ae(c, i.properties), i.links && Ht(c, i.links);
837 } catch (r) {
838 X.error("error while parsing actor details text", r);
839 }
840}, i0 = function(t, e) {
841 if (t !== void 0 && t.properties !== void 0)
842 return t.properties[e];
843}, ce = function(t) {
844 if (Array.isArray(t))
845 t.forEach(function(e) {
846 ce(e);
847 });
848 else
849 switch (t.type) {
850 case "sequenceIndex":
851 E.records.messages.push({
852 from: void 0,
853 to: void 0,
854 message: {
855 start: t.sequenceIndex,
856 step: t.sequenceIndexStep,
857 visible: t.sequenceVisible
858 },
859 wrap: !1,
860 type: t.signalType
861 });
862 break;
863 case "addParticipant":
864 Ft(t.actor, t.actor, t.description, t.draw);
865 break;
866 case "createParticipant":
867 if (E.records.actors[t.actor])
868 throw new Error(
869 "It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior"
870 );
871 E.records.lastCreated = t.actor, Ft(t.actor, t.actor, t.description, t.draw), E.records.createdActors[t.actor] = E.records.messages.length;
872 break;
873 case "destroyParticipant":
874 E.records.lastDestroyed = t.actor, E.records.destroyedActors[t.actor] = E.records.messages.length;
875 break;
876 case "activeStart":
877 C(t.actor, void 0, void 0, t.signalType);
878 break;
879 case "activeEnd":
880 C(t.actor, void 0, void 0, t.signalType);
881 break;
882 case "addNote":
883 ne(t.actor, t.placement, t.text);
884 break;
885 case "addLinks":
886 re(t.actor, t.text);
887 break;
888 case "addALink":
889 n0(t.actor, t.text);
890 break;
891 case "addProperties":
892 ie(t.actor, t.text);
893 break;
894 case "addDetails":
895 oe(t.actor, t.text);
896 break;
897 case "addMessage":
898 if (E.records.lastCreated) {
899 if (t.to !== E.records.lastCreated)
900 throw new Error(
901 "The created participant " + E.records.lastCreated + " does not have an associated creating message after its declaration. Please check the sequence diagram."
902 );
903 E.records.lastCreated = void 0;
904 } else if (E.records.lastDestroyed) {
905 if (t.to !== E.records.lastDestroyed && t.from !== E.records.lastDestroyed)
906 throw new Error(
907 "The destroyed participant " + E.records.lastDestroyed + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
908 );
909 E.records.lastDestroyed = void 0;
910 }
911 C(t.from, t.to, t.msg, t.signalType, t.activate);
912 break;
913 case "boxStart":
914 Oe(t.boxData);
915 break;
916 case "boxEnd":
917 r0();
918 break;
919 case "loopStart":
920 C(void 0, void 0, t.loopText, t.signalType);
921 break;
922 case "loopEnd":
923 C(void 0, void 0, void 0, t.signalType);
924 break;
925 case "rectStart":
926 C(void 0, void 0, t.color, t.signalType);
927 break;
928 case "rectEnd":
929 C(void 0, void 0, void 0, t.signalType);
930 break;
931 case "optStart":
932 C(void 0, void 0, t.optText, t.signalType);
933 break;
934 case "optEnd":
935 C(void 0, void 0, void 0, t.signalType);
936 break;
937 case "altStart":
938 C(void 0, void 0, t.altText, t.signalType);
939 break;
940 case "else":
941 C(void 0, void 0, t.altText, t.signalType);
942 break;
943 case "altEnd":
944 C(void 0, void 0, void 0, t.signalType);
945 break;
946 case "setAccTitle":
947 $t(t.text);
948 break;
949 case "parStart":
950 C(void 0, void 0, t.parText, t.signalType);
951 break;
952 case "and":
953 C(void 0, void 0, t.parText, t.signalType);
954 break;
955 case "parEnd":
956 C(void 0, void 0, void 0, t.signalType);
957 break;
958 case "criticalStart":
959 C(void 0, void 0, t.criticalText, t.signalType);
960 break;
961 case "option":
962 C(void 0, void 0, t.optionText, t.signalType);
963 break;
964 case "criticalEnd":
965 C(void 0, void 0, void 0, t.signalType);
966 break;
967 case "breakStart":
968 C(void 0, void 0, t.breakText, t.signalType);
969 break;
970 case "breakEnd":
971 C(void 0, void 0, void 0, t.signalType);
972 break;
973 }
974}, Qt = {
975 addActor: Ft,
976 addMessage: Ye,
977 addSignal: C,
978 addLinks: re,
979 addDetails: oe,
980 addProperties: ie,
981 autoWrap: gt,
982 setWrap: Qe,
983 enableSequenceNumbers: Xe,
984 disableSequenceNumbers: Je,
985 showSequenceNumbers: Ze,
986 getMessages: qe,
987 getActors: He,
988 getCreatedActors: Ue,
989 getDestroyedActors: Ke,
990 getActor: _t,
991 getActorKeys: Ge,
992 getActorProperty: i0,
993 getAccTitle: we,
994 getBoxes: ze,
995 getDiagramTitle: _e,
996 setDiagramTitle: ke,
997 getConfig: () => st().sequence,
998 clear: je,
999 parseMessage: $e,
1000 parseBoxData: t0,
1001 LINETYPE: mt,
1002 ARROWTYPE: e0,
1003 PLACEMENT: s0,
1004 addNote: ne,
1005 setAccTitle: $t,
1006 apply: ce,
1007 setAccDescription: Pe,
1008 getAccDescription: Le,
1009 hasAtLeastOneBox: Fe,
1010 hasAtLeastOneBoxWithTitle: We
1011}, a0 = (t) => `.actor {
1012 stroke: ${t.actorBorder};
1013 fill: ${t.actorBkg};
1014 }
1015
1016 text.actor > tspan {
1017 fill: ${t.actorTextColor};
1018 stroke: none;
1019 }
1020
1021 .actor-line {
1022 stroke: ${t.actorLineColor};
1023 }
1024
1025 .messageLine0 {
1026 stroke-width: 1.5;
1027 stroke-dasharray: none;
1028 stroke: ${t.signalColor};
1029 }
1030
1031 .messageLine1 {
1032 stroke-width: 1.5;
1033 stroke-dasharray: 2, 2;
1034 stroke: ${t.signalColor};
1035 }
1036
1037 #arrowhead path {
1038 fill: ${t.signalColor};
1039 stroke: ${t.signalColor};
1040 }
1041
1042 .sequenceNumber {
1043 fill: ${t.sequenceNumberColor};
1044 }
1045
1046 #sequencenumber {
1047 fill: ${t.signalColor};
1048 }
1049
1050 #crosshead path {
1051 fill: ${t.signalColor};
1052 stroke: ${t.signalColor};
1053 }
1054
1055 .messageText {
1056 fill: ${t.signalTextColor};
1057 stroke: none;
1058 }
1059
1060 .labelBox {
1061 stroke: ${t.labelBoxBorderColor};
1062 fill: ${t.labelBoxBkgColor};
1063 }
1064
1065 .labelText, .labelText > tspan {
1066 fill: ${t.labelTextColor};
1067 stroke: none;
1068 }
1069
1070 .loopText, .loopText > tspan {
1071 fill: ${t.loopTextColor};
1072 stroke: none;
1073 }
1074
1075 .loopLine {
1076 stroke-width: 2px;
1077 stroke-dasharray: 2, 2;
1078 stroke: ${t.labelBoxBorderColor};
1079 fill: ${t.labelBoxBorderColor};
1080 }
1081
1082 .note {
1083 //stroke: #decc93;
1084 stroke: ${t.noteBorderColor};
1085 fill: ${t.noteBkgColor};
1086 }
1087
1088 .noteText, .noteText > tspan {
1089 fill: ${t.noteTextColor};
1090 stroke: none;
1091 }
1092
1093 .activation0 {
1094 fill: ${t.activationBkgColor};
1095 stroke: ${t.activationBorderColor};
1096 }
1097
1098 .activation1 {
1099 fill: ${t.activationBkgColor};
1100 stroke: ${t.activationBorderColor};
1101 }
1102
1103 .activation2 {
1104 fill: ${t.activationBkgColor};
1105 stroke: ${t.activationBorderColor};
1106 }
1107
1108 .actorPopupMenu {
1109 position: absolute;
1110 }
1111
1112 .actorPopupMenuPanel {
1113 position: absolute;
1114 fill: ${t.actorBkg};
1115 box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
1116 filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
1117}
1118 .actor-man line {
1119 stroke: ${t.actorBorder};
1120 fill: ${t.actorBkg};
1121 }
1122 .actor-man circle, line {
1123 stroke: ${t.actorBorder};
1124 fill: ${t.actorBkg};
1125 stroke-width: 2px;
1126 }
1127`, o0 = a0, ft = 18 * 2, le = "actor-top", de = "actor-bottom", Ut = function(t, e) {
1128 return Se(t, e);
1129}, c0 = function(t, e, c, s, r) {
1130 if (e.links === void 0 || e.links === null || Object.keys(e.links).length === 0)
1131 return { height: 0, width: 0 };
1132 const i = e.links, o = e.actorCnt, l = e.rectData;
1133 var u = "none";
1134 r && (u = "block !important");
1135 const n = t.append("g");
1136 n.attr("id", "actor" + o + "_popup"), n.attr("class", "actorPopupMenu"), n.attr("display", u);
1137 var x = "";
1138 l.class !== void 0 && (x = " " + l.class);
1139 let T = l.width > c ? l.width : c;
1140 const p = n.append("rect");
1141 if (p.attr("class", "actorPopupMenuPanel" + x), p.attr("x", l.x), p.attr("y", l.height), p.attr("fill", l.fill), p.attr("stroke", l.stroke), p.attr("width", T), p.attr("height", l.height), p.attr("rx", l.rx), p.attr("ry", l.ry), i != null) {
1142 var g = 20;
1143 for (let A in i) {
1144 var m = n.append("a"), k = te.sanitizeUrl(i[A]);
1145 m.attr("xlink:href", k), m.attr("target", "_blank"), P0(s)(
1146 A,
1147 m,
1148 l.x + 10,
1149 l.height + g,
1150 T,
1151 20,
1152 { class: "actor" },
1153 s
1154 ), g += 30;
1155 }
1156 }
1157 return p.attr("height", g), { height: l.height + g, width: T };
1158}, l0 = function(t) {
1159 return "var pu = document.getElementById('" + t + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
1160}, At = async function(t, e, c = null) {
1161 let s = t.append("foreignObject");
1162 const r = await se(e.text, Bt()), o = s.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(r).node().getBoundingClientRect();
1163 if (s.attr("height", Math.round(o.height)).attr("width", Math.round(o.width)), e.class === "noteText") {
1164 const l = t.node().firstChild;
1165 l.setAttribute("height", o.height + 2 * e.textMargin);
1166 const u = l.getBBox();
1167 s.attr("x", Math.round(u.x + u.width / 2 - o.width / 2)).attr("y", Math.round(u.y + u.height / 2 - o.height / 2));
1168 } else if (c) {
1169 let { startx: l, stopx: u, starty: n } = c;
1170 if (l > u) {
1171 const x = l;
1172 l = u, u = x;
1173 }
1174 s.attr("x", Math.round(l + Math.abs(l - u) / 2 - o.width / 2)), e.class === "loopText" ? s.attr("y", Math.round(n)) : s.attr("y", Math.round(n - o.height));
1175 }
1176 return [s];
1177}, bt = function(t, e) {
1178 let c = 0, s = 0;
1179 const r = e.text.split(_.lineBreakRegex), [i, o] = ee(e.fontSize);
1180 let l = [], u = 0, n = () => e.y;
1181 if (e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0)
1182 switch (e.valign) {
1183 case "top":
1184 case "start":
1185 n = () => Math.round(e.y + e.textMargin);
1186 break;
1187 case "middle":
1188 case "center":
1189 n = () => Math.round(e.y + (c + s + e.textMargin) / 2);
1190 break;
1191 case "bottom":
1192 case "end":
1193 n = () => Math.round(
1194 e.y + (c + s + 2 * e.textMargin) - e.textMargin
1195 );
1196 break;
1197 }
1198 if (e.anchor !== void 0 && e.textMargin !== void 0 && e.width !== void 0)
1199 switch (e.anchor) {
1200 case "left":
1201 case "start":
1202 e.x = Math.round(e.x + e.textMargin), e.anchor = "start", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
1203 break;
1204 case "middle":
1205 case "center":
1206 e.x = Math.round(e.x + e.width / 2), e.anchor = "middle", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
1207 break;
1208 case "right":
1209 case "end":
1210 e.x = Math.round(e.x + e.width - e.textMargin), e.anchor = "end", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
1211 break;
1212 }
1213 for (let [x, T] of r.entries()) {
1214 e.textMargin !== void 0 && e.textMargin === 0 && i !== void 0 && (u = x * i);
1215 const p = t.append("text");
1216 p.attr("x", e.x), p.attr("y", n()), e.anchor !== void 0 && p.attr("text-anchor", e.anchor).attr("dominant-baseline", e.dominantBaseline).attr("alignment-baseline", e.alignmentBaseline), e.fontFamily !== void 0 && p.style("font-family", e.fontFamily), o !== void 0 && p.style("font-size", o), e.fontWeight !== void 0 && p.style("font-weight", e.fontWeight), e.fill !== void 0 && p.attr("fill", e.fill), e.class !== void 0 && p.attr("class", e.class), e.dy !== void 0 ? p.attr("dy", e.dy) : u !== 0 && p.attr("dy", u);
1217 const g = T || Ae;
1218 if (e.tspan) {
1219 const m = p.append("tspan");
1220 m.attr("x", e.x), e.fill !== void 0 && m.attr("fill", e.fill), m.text(g);
1221 } else
1222 p.text(g);
1223 e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0 && (s += (p._groups || p)[0][0].getBBox().height, c = s), l.push(p);
1224 }
1225 return l;
1226}, he = function(t, e) {
1227 function c(r, i, o, l, u) {
1228 return r + "," + i + " " + (r + o) + "," + i + " " + (r + o) + "," + (i + l - u) + " " + (r + o - u * 1.2) + "," + (i + l) + " " + r + "," + (i + l);
1229 }
1230 const s = t.append("polygon");
1231 return s.attr("points", c(e.x, e.y, e.width, e.height, 7)), s.attr("class", "labelBox"), e.y = e.y + e.height / 2, bt(t, e), s;
1232};
1233let it = -1;
1234const ue = (t, e, c, s) => {
1235 t.select && c.forEach((r) => {
1236 const i = e[r], o = t.select("#actor" + i.actorCnt);
1237 !s.mirrorActors && i.stopy ? o.attr("y2", i.stopy + i.height / 2) : s.mirrorActors && o.attr("y2", i.stopy);
1238 });
1239}, d0 = async function(t, e, c, s) {
1240 const r = s ? e.stopy : e.starty, i = e.x + e.width / 2, o = r + 5, l = t.append("g").lower();
1241 var u = l;
1242 s || (it++, Object.keys(e.links || {}).length && !c.forceMenus && u.attr("onclick", l0(`actor${it}_popup`)).attr("cursor", "pointer"), u.append("line").attr("id", "actor" + it).attr("x1", i).attr("y1", o).attr("x2", i).attr("y2", 2e3).attr("class", "actor-line").attr("class", "200").attr("stroke-width", "0.5px").attr("stroke", "#999"), u = l.append("g"), e.actorCnt = it, e.links != null && u.attr("id", "root-" + it));
1243 const n = vt();
1244 var x = "actor";
1245 e.properties != null && e.properties.class ? x = e.properties.class : n.fill = "#eaeaea", s ? x += ` ${de}` : x += ` ${le}`, n.x = e.x, n.y = r, n.width = e.width, n.height = e.height, n.class = x, n.rx = 3, n.ry = 3, n.name = e.name;
1246 const T = Ut(u, n);
1247 if (e.rectData = n, e.properties != null && e.properties.icon) {
1248 const g = e.properties.icon.trim();
1249 g.charAt(0) === "@" ? Re(u, n.x + n.width - 20, n.y + 10, g.substr(1)) : Ce(u, n.x + n.width - 20, n.y + 10, g);
1250 }
1251 await Kt(c, at(e.description))(
1252 e.description,
1253 u,
1254 n.x,
1255 n.y,
1256 n.width,
1257 n.height,
1258 { class: "actor" },
1259 c
1260 );
1261 let p = e.height;
1262 if (T.node) {
1263 const g = T.node().getBBox();
1264 e.height = g.height, p = g.height;
1265 }
1266 return p;
1267}, h0 = async function(t, e, c, s) {
1268 const r = s ? e.stopy : e.starty, i = e.x + e.width / 2, o = r + 80;
1269 t.lower(), s || (it++, t.append("line").attr("id", "actor" + it).attr("x1", i).attr("y1", o).attr("x2", i).attr("y2", 2e3).attr("class", "actor-line").attr("class", "200").attr("stroke-width", "0.5px").attr("stroke", "#999"), e.actorCnt = it);
1270 const l = t.append("g");
1271 let u = "actor-man";
1272 s ? u += ` ${de}` : u += ` ${le}`, l.attr("class", u), l.attr("name", e.name);
1273 const n = vt();
1274 n.x = e.x, n.y = r, n.fill = "#eaeaea", n.width = e.width, n.height = e.height, n.class = "actor", n.rx = 3, n.ry = 3, l.append("line").attr("id", "actor-man-torso" + it).attr("x1", i).attr("y1", r + 25).attr("x2", i).attr("y2", r + 45), l.append("line").attr("id", "actor-man-arms" + it).attr("x1", i - ft / 2).attr("y1", r + 33).attr("x2", i + ft / 2).attr("y2", r + 33), l.append("line").attr("x1", i - ft / 2).attr("y1", r + 60).attr("x2", i).attr("y2", r + 45), l.append("line").attr("x1", i).attr("y1", r + 45).attr("x2", i + ft / 2 - 2).attr("y2", r + 60);
1275 const x = l.append("circle");
1276 x.attr("cx", e.x + e.width / 2), x.attr("cy", r + 10), x.attr("r", 15), x.attr("width", e.width), x.attr("height", e.height);
1277 const T = l.node().getBBox();
1278 return e.height = T.height, await Kt(c, at(e.description))(
1279 e.description,
1280 l,
1281 n.x,
1282 n.y + 35,
1283 n.width,
1284 n.height,
1285 { class: "actor" },
1286 c
1287 ), e.height;
1288}, u0 = async function(t, e, c, s) {
1289 switch (e.type) {
1290 case "actor":
1291 return await h0(t, e, c, s);
1292 case "participant":
1293 return await d0(t, e, c, s);
1294 }
1295}, p0 = async function(t, e, c) {
1296 const r = t.append("g");
1297 pe(r, e), e.name && await Kt(c)(
1298 e.name,
1299 r,
1300 e.x,
1301 e.y + (e.textMaxHeight || 0) / 2,
1302 e.width,
1303 0,
1304 { class: "text" },
1305 c
1306 ), r.lower();
1307}, f0 = function(t) {
1308 return t.append("g");
1309}, g0 = function(t, e, c, s, r) {
1310 const i = vt(), o = e.anchored;
1311 i.x = e.startx, i.y = e.starty, i.class = "activation" + r % 3, i.width = e.stopx - e.startx, i.height = c - e.starty, Ut(o, i);
1312}, x0 = async function(t, e, c, s) {
1313 const {
1314 boxMargin: r,
1315 boxTextMargin: i,
1316 labelBoxHeight: o,
1317 labelBoxWidth: l,
1318 messageFontFamily: u,
1319 messageFontSize: n,
1320 messageFontWeight: x
1321 } = s, T = t.append("g"), p = function(k, A, V, S) {
1322 return T.append("line").attr("x1", k).attr("y1", A).attr("x2", V).attr("y2", S).attr("class", "loopLine");
1323 };
1324 p(e.startx, e.starty, e.stopx, e.starty), p(e.stopx, e.starty, e.stopx, e.stopy), p(e.startx, e.stopy, e.stopx, e.stopy), p(e.startx, e.starty, e.startx, e.stopy), e.sections !== void 0 && e.sections.forEach(function(k) {
1325 p(e.startx, k.y, e.stopx, k.y).style(
1326 "stroke-dasharray",
1327 "3, 3"
1328 );
1329 });
1330 let g = zt();
1331 g.text = c, g.x = e.startx, g.y = e.starty, g.fontFamily = u, g.fontSize = n, g.fontWeight = x, g.anchor = "middle", g.valign = "middle", g.tspan = !1, g.width = l || 50, g.height = o || 20, g.textMargin = i, g.class = "labelText", he(T, g), g = fe(), g.text = e.title, g.x = e.startx + l / 2 + (e.stopx - e.startx) / 2, g.y = e.starty + r + i, g.anchor = "middle", g.valign = "middle", g.textMargin = i, g.class = "loopText", g.fontFamily = u, g.fontSize = n, g.fontWeight = x, g.wrap = !0;
1332 let m = at(g.text) ? await At(T, g, e) : bt(T, g);
1333 if (e.sectionTitles !== void 0) {
1334 for (const [k, A] of Object.entries(e.sectionTitles))
1335 if (A.message) {
1336 g.text = A.message, g.x = e.startx + (e.stopx - e.startx) / 2, g.y = e.sections[k].y + r + i, g.class = "loopText", g.anchor = "middle", g.valign = "middle", g.tspan = !1, g.fontFamily = u, g.fontSize = n, g.fontWeight = x, g.wrap = e.wrap, at(g.text) ? (e.starty = e.sections[k].y, await At(T, g, e)) : bt(T, g);
1337 let V = Math.round(
1338 m.map((S) => (S._groups || S)[0][0].getBBox().height).reduce((S, O) => S + O)
1339 );
1340 e.sections[k].height += V - (r + i);
1341 }
1342 }
1343 return e.height = Math.round(e.stopy - e.starty), T;
1344}, pe = function(t, e) {
1345 Me(t, e);
1346}, y0 = function(t) {
1347 t.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
1348 "d",
1349 "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
1350 );
1351}, T0 = function(t) {
1352 t.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1353 "d",
1354 "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
1355 );
1356}, b0 = function(t) {
1357 t.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1358 "d",
1359 "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
1360 );
1361}, E0 = function(t) {
1362 t.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 7.9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
1363}, m0 = function(t) {
1364 t.append("defs").append("marker").attr("id", "filled-head").attr("refX", 15.5).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
1365}, w0 = function(t) {
1366 t.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
1367}, _0 = function(t) {
1368 t.append("defs").append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5).append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1pt").attr("d", "M 1,2 L 6,7 M 6,2 L 1,7");
1369}, fe = function() {
1370 return {
1371 x: 0,
1372 y: 0,
1373 fill: void 0,
1374 anchor: void 0,
1375 style: "#666",
1376 width: void 0,
1377 height: void 0,
1378 textMargin: 0,
1379 rx: 0,
1380 ry: 0,
1381 tspan: !0,
1382 valign: void 0
1383 };
1384}, k0 = function() {
1385 return {
1386 x: 0,
1387 y: 0,
1388 fill: "#EDF2AE",
1389 stroke: "#666",
1390 width: 100,
1391 anchor: "start",
1392 height: 100,
1393 rx: 0,
1394 ry: 0
1395 };
1396}, Kt = function() {
1397 function t(i, o, l, u, n, x, T) {
1398 const p = o.append("text").attr("x", l + n / 2).attr("y", u + x / 2 + 5).style("text-anchor", "middle").text(i);
1399 r(p, T);
1400 }
1401 function e(i, o, l, u, n, x, T, p) {
1402 const { actorFontSize: g, actorFontFamily: m, actorFontWeight: k } = p, [A, V] = ee(g), S = i.split(_.lineBreakRegex);
1403 for (let O = 0; O < S.length; O++) {
1404 const R = O * A - A * (S.length - 1) / 2, q = o.append("text").attr("x", l + n / 2).attr("y", u).style("text-anchor", "middle").style("font-size", V).style("font-weight", k).style("font-family", m);
1405 q.append("tspan").attr("x", l + n / 2).attr("dy", R).text(S[O]), q.attr("y", u + x / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), r(q, T);
1406 }
1407 }
1408 function c(i, o, l, u, n, x, T, p) {
1409 const g = o.append("switch"), k = g.append("foreignObject").attr("x", l).attr("y", u).attr("width", n).attr("height", x).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
1410 k.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), e(i, g, l, u, n, x, T, p), r(k, T);
1411 }
1412 async function s(i, o, l, u, n, x, T, p) {
1413 const g = await wt(i, Bt()), m = o.append("switch"), A = m.append("foreignObject").attr("x", l + n / 2 - g.width / 2).attr("y", u + x / 2 - g.height / 2).attr("width", g.width).attr("height", g.height).append("xhtml:div").style("height", "100%").style("width", "100%");
1414 A.append("div").style("text-align", "center").style("vertical-align", "middle").html(await se(i, Bt())), e(i, m, l, u, n, x, T, p), r(A, T);
1415 }
1416 function r(i, o) {
1417 for (const l in o)
1418 o.hasOwnProperty(l) && i.attr(l, o[l]);
1419 }
1420 return function(i, o = !1) {
1421 return o ? s : i.textPlacement === "fo" ? c : i.textPlacement === "old" ? t : e;
1422 };
1423}(), P0 = function() {
1424 function t(r, i, o, l, u, n, x) {
1425 const T = i.append("text").attr("x", o).attr("y", l).style("text-anchor", "start").text(r);
1426 s(T, x);
1427 }
1428 function e(r, i, o, l, u, n, x, T) {
1429 const { actorFontSize: p, actorFontFamily: g, actorFontWeight: m } = T, k = r.split(_.lineBreakRegex);
1430 for (let A = 0; A < k.length; A++) {
1431 const V = A * p - p * (k.length - 1) / 2, S = i.append("text").attr("x", o).attr("y", l).style("text-anchor", "start").style("font-size", p).style("font-weight", m).style("font-family", g);
1432 S.append("tspan").attr("x", o).attr("dy", V).text(k[A]), S.attr("y", l + n / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), s(S, x);
1433 }
1434 }
1435 function c(r, i, o, l, u, n, x, T) {
1436 const p = i.append("switch"), m = p.append("foreignObject").attr("x", o).attr("y", l).attr("width", u).attr("height", n).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
1437 m.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(r), e(r, p, o, l, u, n, x, T), s(m, x);
1438 }
1439 function s(r, i) {
1440 for (const o in i)
1441 i.hasOwnProperty(o) && r.attr(o, i[o]);
1442 }
1443 return function(r) {
1444 return r.textPlacement === "fo" ? c : r.textPlacement === "old" ? t : e;
1445 };
1446}(), D = {
1447 drawRect: Ut,
1448 drawText: bt,
1449 drawLabel: he,
1450 drawActor: u0,
1451 drawBox: p0,
1452 drawPopup: c0,
1453 anchorElement: f0,
1454 drawActivation: g0,
1455 drawLoop: x0,
1456 drawBackgroundRect: pe,
1457 insertArrowHead: E0,
1458 insertArrowFilledHead: m0,
1459 insertSequenceNumber: w0,
1460 insertArrowCrossHead: _0,
1461 insertDatabaseIcon: y0,
1462 insertComputerIcon: T0,
1463 insertClockIcon: b0,
1464 getTextObj: fe,
1465 getNoteRect: k0,
1466 fixLifeLineHeights: ue,
1467 sanitizeUrl: te.sanitizeUrl
1468};
1469let a = {};
1470const f = {
1471 data: {
1472 startx: void 0,
1473 stopx: void 0,
1474 starty: void 0,
1475 stopy: void 0
1476 },
1477 verticalPos: 0,
1478 sequenceItems: [],
1479 activations: [],
1480 models: {
1481 getHeight: function() {
1482 return Math.max.apply(
1483 null,
1484 this.actors.length === 0 ? [0] : this.actors.map((t) => t.height || 0)
1485 ) + (this.loops.length === 0 ? 0 : this.loops.map((t) => t.height || 0).reduce((t, e) => t + e)) + (this.messages.length === 0 ? 0 : this.messages.map((t) => t.height || 0).reduce((t, e) => t + e)) + (this.notes.length === 0 ? 0 : this.notes.map((t) => t.height || 0).reduce((t, e) => t + e));
1486 },
1487 clear: function() {
1488 this.actors = [], this.boxes = [], this.loops = [], this.messages = [], this.notes = [];
1489 },
1490 addBox: function(t) {
1491 this.boxes.push(t);
1492 },
1493 addActor: function(t) {
1494 this.actors.push(t);
1495 },
1496 addLoop: function(t) {
1497 this.loops.push(t);
1498 },
1499 addMessage: function(t) {
1500 this.messages.push(t);
1501 },
1502 addNote: function(t) {
1503 this.notes.push(t);
1504 },
1505 lastActor: function() {
1506 return this.actors[this.actors.length - 1];
1507 },
1508 lastLoop: function() {
1509 return this.loops[this.loops.length - 1];
1510 },
1511 lastMessage: function() {
1512 return this.messages[this.messages.length - 1];
1513 },
1514 lastNote: function() {
1515 return this.notes[this.notes.length - 1];
1516 },
1517 actors: [],
1518 boxes: [],
1519 loops: [],
1520 messages: [],
1521 notes: []
1522 },
1523 init: function() {
1524 this.sequenceItems = [], this.activations = [], this.models.clear(), this.data = {
1525 startx: void 0,
1526 stopx: void 0,
1527 starty: void 0,
1528 stopy: void 0
1529 }, this.verticalPos = 0, xe(st());
1530 },
1531 updateVal: function(t, e, c, s) {
1532 t[e] === void 0 ? t[e] = c : t[e] = s(c, t[e]);
1533 },
1534 updateBounds: function(t, e, c, s) {
1535 const r = this;
1536 let i = 0;
1537 function o(l) {
1538 return function(n) {
1539 i++;
1540 const x = r.sequenceItems.length - i + 1;
1541 r.updateVal(n, "starty", e - x * a.boxMargin, Math.min), r.updateVal(n, "stopy", s + x * a.boxMargin, Math.max), r.updateVal(f.data, "startx", t - x * a.boxMargin, Math.min), r.updateVal(f.data, "stopx", c + x * a.boxMargin, Math.max), l !== "activation" && (r.updateVal(n, "startx", t - x * a.boxMargin, Math.min), r.updateVal(n, "stopx", c + x * a.boxMargin, Math.max), r.updateVal(f.data, "starty", e - x * a.boxMargin, Math.min), r.updateVal(f.data, "stopy", s + x * a.boxMargin, Math.max));
1542 };
1543 }
1544 this.sequenceItems.forEach(o()), this.activations.forEach(o("activation"));
1545 },
1546 insert: function(t, e, c, s) {
1547 const r = _.getMin(t, c), i = _.getMax(t, c), o = _.getMin(e, s), l = _.getMax(e, s);
1548 this.updateVal(f.data, "startx", r, Math.min), this.updateVal(f.data, "starty", o, Math.min), this.updateVal(f.data, "stopx", i, Math.max), this.updateVal(f.data, "stopy", l, Math.max), this.updateBounds(r, o, i, l);
1549 },
1550 newActivation: function(t, e, c) {
1551 const s = c[t.from.actor], r = St(t.from.actor).length || 0, i = s.x + s.width / 2 + (r - 1) * a.activationWidth / 2;
1552 this.activations.push({
1553 startx: i,
1554 starty: this.verticalPos + 2,
1555 stopx: i + a.activationWidth,
1556 stopy: void 0,
1557 actor: t.from.actor,
1558 anchored: D.anchorElement(e)
1559 });
1560 },
1561 endActivation: function(t) {
1562 const e = this.activations.map(function(c) {
1563 return c.actor;
1564 }).lastIndexOf(t.from.actor);
1565 return this.activations.splice(e, 1)[0];
1566 },
1567 createLoop: function(t = { message: void 0, wrap: !1, width: void 0 }, e) {
1568 return {
1569 startx: void 0,
1570 starty: this.verticalPos,
1571 stopx: void 0,
1572 stopy: void 0,
1573 title: t.message,
1574 wrap: t.wrap,
1575 width: t.width,
1576 height: 0,
1577 fill: e
1578 };
1579 },
1580 newLoop: function(t = { message: void 0, wrap: !1, width: void 0 }, e) {
1581 this.sequenceItems.push(this.createLoop(t, e));
1582 },
1583 endLoop: function() {
1584 return this.sequenceItems.pop();
1585 },
1586 isLoopOverlap: function() {
1587 return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : !1;
1588 },
1589 addSectionToLoop: function(t) {
1590 const e = this.sequenceItems.pop();
1591 e.sections = e.sections || [], e.sectionTitles = e.sectionTitles || [], e.sections.push({ y: f.getVerticalPos(), height: 0 }), e.sectionTitles.push(t), this.sequenceItems.push(e);
1592 },
1593 saveVerticalPos: function() {
1594 this.isLoopOverlap() && (this.savedVerticalPos = this.verticalPos);
1595 },
1596 resetVerticalPos: function() {
1597 this.isLoopOverlap() && (this.verticalPos = this.savedVerticalPos);
1598 },
1599 bumpVerticalPos: function(t) {
1600 this.verticalPos = this.verticalPos + t, this.data.stopy = _.getMax(this.data.stopy, this.verticalPos);
1601 },
1602 getVerticalPos: function() {
1603 return this.verticalPos;
1604 },
1605 getBounds: function() {
1606 return { bounds: this.data, models: this.models };
1607 }
1608}, L0 = async function(t, e) {
1609 f.bumpVerticalPos(a.boxMargin), e.height = a.boxMargin, e.starty = f.getVerticalPos();
1610 const c = vt();
1611 c.x = e.startx, c.y = e.starty, c.width = e.width || a.width, c.class = "note";
1612 const s = t.append("g"), r = D.drawRect(s, c), i = zt();
1613 i.x = e.startx, i.y = e.starty, i.width = c.width, i.dy = "1em", i.text = e.message, i.class = "noteText", i.fontFamily = a.noteFontFamily, i.fontSize = a.noteFontSize, i.fontWeight = a.noteFontWeight, i.anchor = a.noteAlign, i.textMargin = a.noteMargin, i.valign = "center";
1614 const o = at(i.text) ? await At(s, i) : bt(s, i), l = Math.round(
1615 o.map((u) => (u._groups || u)[0][0].getBBox().height).reduce((u, n) => u + n)
1616 );
1617 r.attr("height", l + 2 * a.noteMargin), e.height += l + 2 * a.noteMargin, f.bumpVerticalPos(l + 2 * a.noteMargin), e.stopy = e.starty + l + 2 * a.noteMargin, e.stopx = e.startx + c.width, f.insert(e.startx, e.starty, e.stopx, e.stopy), f.models.addNote(e);
1618}, xt = (t) => ({
1619 fontFamily: t.messageFontFamily,
1620 fontSize: t.messageFontSize,
1621 fontWeight: t.messageFontWeight
1622}), Tt = (t) => ({
1623 fontFamily: t.noteFontFamily,
1624 fontSize: t.noteFontSize,
1625 fontWeight: t.noteFontWeight
1626}), Wt = (t) => ({
1627 fontFamily: t.actorFontFamily,
1628 fontSize: t.actorFontSize,
1629 fontWeight: t.actorFontWeight
1630});
1631async function I0(t, e) {
1632 f.bumpVerticalPos(10);
1633 const { startx: c, stopx: s, message: r } = e, i = _.splitBreaks(r).length, o = at(r), l = o ? await wt(r, st()) : B.calculateTextDimensions(r, xt(a));
1634 if (!o) {
1635 const T = l.height / i;
1636 e.height += T, f.bumpVerticalPos(T);
1637 }
1638 let u, n = l.height - 10;
1639 const x = l.width;
1640 if (c === s) {
1641 u = f.getVerticalPos() + n, a.rightAngles || (n += a.boxMargin, u = f.getVerticalPos() + n), n += 30;
1642 const T = _.getMax(x / 2, a.width / 2);
1643 f.insert(
1644 c - T,
1645 f.getVerticalPos() - 10 + n,
1646 s + T,
1647 f.getVerticalPos() + 30 + n
1648 );
1649 } else
1650 n += a.boxMargin, u = f.getVerticalPos() + n, f.insert(c, u - 10, s, u);
1651 return f.bumpVerticalPos(n), e.height += n, e.stopy = e.starty + e.height, f.insert(e.fromBounds, e.starty, e.toBounds, e.stopy), u;
1652}
1653const A0 = async function(t, e, c, s) {
1654 const { startx: r, stopx: i, starty: o, message: l, type: u, sequenceIndex: n, sequenceVisible: x } = e, T = B.calculateTextDimensions(l, xt(a)), p = zt();
1655 p.x = r, p.y = o + 10, p.width = i - r, p.class = "messageText", p.dy = "1em", p.text = l, p.fontFamily = a.messageFontFamily, p.fontSize = a.messageFontSize, p.fontWeight = a.messageFontWeight, p.anchor = a.messageAlign, p.valign = "center", p.textMargin = a.wrapPadding, p.tspan = !1, at(p.text) ? await At(t, p, { startx: r, stopx: i, starty: c }) : bt(t, p);
1656 const g = T.width;
1657 let m;
1658 r === i ? a.rightAngles ? m = t.append("path").attr(
1659 "d",
1660 `M ${r},${c} H ${r + _.getMax(a.width / 2, g / 2)} V ${c + 25} H ${r}`
1661 ) : m = t.append("path").attr(
1662 "d",
1663 "M " + r + "," + c + " C " + (r + 60) + "," + (c - 10) + " " + (r + 60) + "," + (c + 30) + " " + r + "," + (c + 20)
1664 ) : (m = t.append("line"), m.attr("x1", r), m.attr("y1", c), m.attr("x2", i), m.attr("y2", c)), u === s.db.LINETYPE.DOTTED || u === s.db.LINETYPE.DOTTED_CROSS || u === s.db.LINETYPE.DOTTED_POINT || u === s.db.LINETYPE.DOTTED_OPEN ? (m.style("stroke-dasharray", "3, 3"), m.attr("class", "messageLine1")) : m.attr("class", "messageLine0");
1665 let k = "";
1666 a.arrowMarkerAbsolute && (k = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, k = k.replace(/\(/g, "\\("), k = k.replace(/\)/g, "\\)")), m.attr("stroke-width", 2), m.attr("stroke", "none"), m.style("fill", "none"), (u === s.db.LINETYPE.SOLID || u === s.db.LINETYPE.DOTTED) && m.attr("marker-end", "url(" + k + "#arrowhead)"), (u === s.db.LINETYPE.SOLID_POINT || u === s.db.LINETYPE.DOTTED_POINT) && m.attr("marker-end", "url(" + k + "#filled-head)"), (u === s.db.LINETYPE.SOLID_CROSS || u === s.db.LINETYPE.DOTTED_CROSS) && m.attr("marker-end", "url(" + k + "#crosshead)"), (x || a.showSequenceNumbers) && (m.attr("marker-start", "url(" + k + "#sequencenumber)"), t.append("text").attr("x", r).attr("y", c + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(n));
1667}, N0 = async function(t, e, c, s, r, i, o) {
1668 let l = 0, u = 0, n, x = 0;
1669 for (const T of s) {
1670 const p = e[T], g = p.box;
1671 n && n != g && (o || f.models.addBox(n), u += a.boxMargin + n.margin), g && g != n && (o || (g.x = l + u, g.y = r), u += g.margin), p.width = p.width || a.width, p.height = _.getMax(p.height || a.height, a.height), p.margin = p.margin || a.actorMargin, x = _.getMax(x, p.height), c[p.name] && (u += p.width / 2), p.x = l + u, p.starty = f.getVerticalPos(), f.insert(p.x, r, p.x + p.width, p.height), l += p.width + u, p.box && (p.box.width = l + g.margin - p.box.x), u = p.margin, n = p.box, f.models.addActor(p);
1672 }
1673 n && !o && f.models.addBox(n), f.bumpVerticalPos(x);
1674}, qt = async function(t, e, c, s) {
1675 if (s) {
1676 let r = 0;
1677 f.bumpVerticalPos(a.boxMargin * 2);
1678 for (const i of c) {
1679 const o = e[i];
1680 o.stopy || (o.stopy = f.getVerticalPos());
1681 const l = await D.drawActor(t, o, a, !0);
1682 r = _.getMax(r, l);
1683 }
1684 f.bumpVerticalPos(r + a.boxMargin);
1685 } else
1686 for (const r of c) {
1687 const i = e[r];
1688 await D.drawActor(t, i, a, !1);
1689 }
1690}, ge = function(t, e, c, s) {
1691 let r = 0, i = 0;
1692 for (const o of c) {
1693 const l = e[o], u = R0(l), n = D.drawPopup(
1694 t,
1695 l,
1696 u,
1697 a,
1698 a.forceMenus,
1699 s
1700 );
1701 n.height > r && (r = n.height), n.width + l.x > i && (i = n.width + l.x);
1702 }
1703 return { maxHeight: r, maxWidth: i };
1704}, xe = function(t) {
1705 Ne(a, t), t.fontFamily && (a.actorFontFamily = a.noteFontFamily = a.messageFontFamily = t.fontFamily), t.fontSize && (a.actorFontSize = a.noteFontSize = a.messageFontSize = t.fontSize), t.fontWeight && (a.actorFontWeight = a.noteFontWeight = a.messageFontWeight = t.fontWeight);
1706}, St = function(t) {
1707 return f.activations.filter(function(e) {
1708 return e.actor === t;
1709 });
1710}, jt = function(t, e) {
1711 const c = e[t], s = St(t), r = s.reduce(function(o, l) {
1712 return _.getMin(o, l.startx);
1713 }, c.x + c.width / 2 - 1), i = s.reduce(function(o, l) {
1714 return _.getMax(o, l.stopx);
1715 }, c.x + c.width / 2 + 1);
1716 return [r, i];
1717};
1718function rt(t, e, c, s, r) {
1719 f.bumpVerticalPos(c);
1720 let i = s;
1721 if (e.id && e.message && t[e.id]) {
1722 const o = t[e.id].width, l = xt(a);
1723 e.message = B.wrapLabel(`[${e.message}]`, o - 2 * a.wrapPadding, l), e.width = o, e.wrap = !0;
1724 const u = B.calculateTextDimensions(e.message, l), n = _.getMax(u.height, a.labelBoxHeight);
1725 i = s + n, X.debug(`${n} - ${e.message}`);
1726 }
1727 r(e), f.bumpVerticalPos(i);
1728}
1729function v0(t, e, c, s, r, i, o) {
1730 function l(n, x) {
1731 n.x < r[t.from].x ? (f.insert(
1732 e.stopx - x,
1733 e.starty,
1734 e.startx,
1735 e.stopy + n.height / 2 + a.noteMargin
1736 ), e.stopx = e.stopx + x) : (f.insert(
1737 e.startx,
1738 e.starty,
1739 e.stopx + x,
1740 e.stopy + n.height / 2 + a.noteMargin
1741 ), e.stopx = e.stopx - x);
1742 }
1743 function u(n, x) {
1744 n.x < r[t.to].x ? (f.insert(
1745 e.startx - x,
1746 e.starty,
1747 e.stopx,
1748 e.stopy + n.height / 2 + a.noteMargin
1749 ), e.startx = e.startx + x) : (f.insert(
1750 e.stopx,
1751 e.starty,
1752 e.startx + x,
1753 e.stopy + n.height / 2 + a.noteMargin
1754 ), e.startx = e.startx - x);
1755 }
1756 if (i[t.to] == s) {
1757 const n = r[t.to], x = n.type == "actor" ? ft / 2 + 3 : n.width / 2 + 3;
1758 l(n, x), n.starty = c - n.height / 2, f.bumpVerticalPos(n.height / 2);
1759 } else if (o[t.from] == s) {
1760 const n = r[t.from];
1761 if (a.mirrorActors) {
1762 const x = n.type == "actor" ? ft / 2 : n.width / 2;
1763 u(n, x);
1764 }
1765 n.stopy = c - n.height / 2, f.bumpVerticalPos(n.height / 2);
1766 } else if (o[t.to] == s) {
1767 const n = r[t.to];
1768 if (a.mirrorActors) {
1769 const x = n.type == "actor" ? ft / 2 + 3 : n.width / 2 + 3;
1770 l(n, x);
1771 }
1772 n.stopy = c - n.height / 2, f.bumpVerticalPos(n.height / 2);
1773 }
1774}
1775const S0 = async function(t, e, c, s) {
1776 const { securityLevel: r, sequence: i } = st();
1777 a = i;
1778 let o;
1779 r === "sandbox" && (o = It("#i" + e));
1780 const l = r === "sandbox" ? It(o.nodes()[0].contentDocument.body) : It("body"), u = r === "sandbox" ? o.nodes()[0].contentDocument : document;
1781 f.init(), X.debug(s.db);
1782 const n = r === "sandbox" ? l.select(`[id="${e}"]`) : It(`[id="${e}"]`), x = s.db.getActors(), T = s.db.getCreatedActors(), p = s.db.getDestroyedActors(), g = s.db.getBoxes();
1783 let m = s.db.getActorKeys();
1784 const k = s.db.getMessages(), A = s.db.getDiagramTitle(), V = s.db.hasAtLeastOneBox(), S = s.db.hasAtLeastOneBoxWithTitle(), O = await M0(x, k, s);
1785 if (a.height = await C0(x, O, g), D.insertComputerIcon(n), D.insertDatabaseIcon(n), D.insertClockIcon(n), V && (f.bumpVerticalPos(a.boxMargin), S && f.bumpVerticalPos(g[0].textMaxHeight)), a.hideUnusedParticipants === !0) {
1786 const y = /* @__PURE__ */ new Set();
1787 k.forEach((L) => {
1788 y.add(L.from), y.add(L.to);
1789 }), m = m.filter((L) => y.has(L));
1790 }
1791 await N0(n, x, T, m, 0, k, !1);
1792 const R = await O0(k, x, O, s);
1793 D.insertArrowHead(n), D.insertArrowCrossHead(n), D.insertArrowFilledHead(n), D.insertSequenceNumber(n);
1794 function q(y, L) {
1795 const j = f.endActivation(y);
1796 j.starty + 18 > L && (j.starty = L - 6, L += 12), D.drawActivation(
1797 n,
1798 j,
1799 L,
1800 a,
1801 St(y.from.actor).length
1802 ), f.insert(j.startx, L - 10, j.stopx, L);
1803 }
1804 let z = 1, J = 1;
1805 const $ = [], H = [];
1806 let U = 0;
1807 for (const y of k) {
1808 let L, j, nt;
1809 switch (y.type) {
1810 case s.db.LINETYPE.NOTE:
1811 f.resetVerticalPos(), j = y.noteModel, await L0(n, j);
1812 break;
1813 case s.db.LINETYPE.ACTIVE_START:
1814 f.newActivation(y, n, x);
1815 break;
1816 case s.db.LINETYPE.ACTIVE_END:
1817 q(y, f.getVerticalPos());
1818 break;
1819 case s.db.LINETYPE.LOOP_START:
1820 rt(
1821 R,
1822 y,
1823 a.boxMargin,
1824 a.boxMargin + a.boxTextMargin,
1825 (N) => f.newLoop(N)
1826 );
1827 break;
1828 case s.db.LINETYPE.LOOP_END:
1829 L = f.endLoop(), await D.drawLoop(n, L, "loop", a), f.bumpVerticalPos(L.stopy - f.getVerticalPos()), f.models.addLoop(L);
1830 break;
1831 case s.db.LINETYPE.RECT_START:
1832 rt(
1833 R,
1834 y,
1835 a.boxMargin,
1836 a.boxMargin,
1837 (N) => f.newLoop(void 0, N.message)
1838 );
1839 break;
1840 case s.db.LINETYPE.RECT_END:
1841 L = f.endLoop(), H.push(L), f.models.addLoop(L), f.bumpVerticalPos(L.stopy - f.getVerticalPos());
1842 break;
1843 case s.db.LINETYPE.OPT_START:
1844 rt(
1845 R,
1846 y,
1847 a.boxMargin,
1848 a.boxMargin + a.boxTextMargin,
1849 (N) => f.newLoop(N)
1850 );
1851 break;
1852 case s.db.LINETYPE.OPT_END:
1853 L = f.endLoop(), await D.drawLoop(n, L, "opt", a), f.bumpVerticalPos(L.stopy - f.getVerticalPos()), f.models.addLoop(L);
1854 break;
1855 case s.db.LINETYPE.ALT_START:
1856 rt(
1857 R,
1858 y,
1859 a.boxMargin,
1860 a.boxMargin + a.boxTextMargin,
1861 (N) => f.newLoop(N)
1862 );
1863 break;
1864 case s.db.LINETYPE.ALT_ELSE:
1865 rt(
1866 R,
1867 y,
1868 a.boxMargin + a.boxTextMargin,
1869 a.boxMargin,
1870 (N) => f.addSectionToLoop(N)
1871 );
1872 break;
1873 case s.db.LINETYPE.ALT_END:
1874 L = f.endLoop(), await D.drawLoop(n, L, "alt", a), f.bumpVerticalPos(L.stopy - f.getVerticalPos()), f.models.addLoop(L);
1875 break;
1876 case s.db.LINETYPE.PAR_START:
1877 case s.db.LINETYPE.PAR_OVER_START:
1878 rt(
1879 R,
1880 y,
1881 a.boxMargin,
1882 a.boxMargin + a.boxTextMargin,
1883 (N) => f.newLoop(N)
1884 ), f.saveVerticalPos();
1885 break;
1886 case s.db.LINETYPE.PAR_AND:
1887 rt(
1888 R,
1889 y,
1890 a.boxMargin + a.boxTextMargin,
1891 a.boxMargin,
1892 (N) => f.addSectionToLoop(N)
1893 );
1894 break;
1895 case s.db.LINETYPE.PAR_END:
1896 L = f.endLoop(), await D.drawLoop(n, L, "par", a), f.bumpVerticalPos(L.stopy - f.getVerticalPos()), f.models.addLoop(L);
1897 break;
1898 case s.db.LINETYPE.AUTONUMBER:
1899 z = y.message.start || z, J = y.message.step || J, y.message.visible ? s.db.enableSequenceNumbers() : s.db.disableSequenceNumbers();
1900 break;
1901 case s.db.LINETYPE.CRITICAL_START:
1902 rt(
1903 R,
1904 y,
1905 a.boxMargin,
1906 a.boxMargin + a.boxTextMargin,
1907 (N) => f.newLoop(N)
1908 );
1909 break;
1910 case s.db.LINETYPE.CRITICAL_OPTION:
1911 rt(
1912 R,
1913 y,
1914 a.boxMargin + a.boxTextMargin,
1915 a.boxMargin,
1916 (N) => f.addSectionToLoop(N)
1917 );
1918 break;
1919 case s.db.LINETYPE.CRITICAL_END:
1920 L = f.endLoop(), await D.drawLoop(n, L, "critical", a), f.bumpVerticalPos(L.stopy - f.getVerticalPos()), f.models.addLoop(L);
1921 break;
1922 case s.db.LINETYPE.BREAK_START:
1923 rt(
1924 R,
1925 y,
1926 a.boxMargin,
1927 a.boxMargin + a.boxTextMargin,
1928 (N) => f.newLoop(N)
1929 );
1930 break;
1931 case s.db.LINETYPE.BREAK_END:
1932 L = f.endLoop(), await D.drawLoop(n, L, "break", a), f.bumpVerticalPos(L.stopy - f.getVerticalPos()), f.models.addLoop(L);
1933 break;
1934 default:
1935 try {
1936 nt = y.msgModel, nt.starty = f.getVerticalPos(), nt.sequenceIndex = z, nt.sequenceVisible = s.db.showSequenceNumbers();
1937 const N = await I0(n, nt);
1938 v0(
1939 y,
1940 nt,
1941 N,
1942 U,
1943 x,
1944 T,
1945 p
1946 ), $.push({ messageModel: nt, lineStartY: N }), f.models.addMessage(nt);
1947 } catch (N) {
1948 X.error("error while drawing message", N);
1949 }
1950 }
1951 [
1952 s.db.LINETYPE.SOLID_OPEN,
1953 s.db.LINETYPE.DOTTED_OPEN,
1954 s.db.LINETYPE.SOLID,
1955 s.db.LINETYPE.DOTTED,
1956 s.db.LINETYPE.SOLID_CROSS,
1957 s.db.LINETYPE.DOTTED_CROSS,
1958 s.db.LINETYPE.SOLID_POINT,
1959 s.db.LINETYPE.DOTTED_POINT
1960 ].includes(y.type) && (z = z + J), U++;
1961 }
1962 X.debug("createdActors", T), X.debug("destroyedActors", p), await qt(n, x, m, !1);
1963 for (const y of $)
1964 await A0(n, y.messageModel, y.lineStartY, s);
1965 a.mirrorActors && await qt(n, x, m, !0), H.forEach((y) => D.drawBackgroundRect(n, y)), ue(n, x, m, a);
1966 for (const y of f.models.boxes)
1967 y.height = f.getVerticalPos() - y.y, f.insert(y.x, y.y, y.x + y.width, y.height), y.startx = y.x, y.starty = y.y, y.stopx = y.startx + y.width, y.stopy = y.starty + y.height, y.stroke = "rgb(0,0,0, 0.5)", await D.drawBox(n, y, a);
1968 V && f.bumpVerticalPos(a.boxMargin);
1969 const F = ge(n, x, m, u), { bounds: W } = f.getBounds();
1970 let Z = W.stopy - W.starty;
1971 Z < F.maxHeight && (Z = F.maxHeight);
1972 let K = Z + 2 * a.diagramMarginY;
1973 a.mirrorActors && (K = K - a.boxMargin + a.bottomMarginAdj);
1974 let Q = W.stopx - W.startx;
1975 Q < F.maxWidth && (Q = F.maxWidth);
1976 const tt = Q + 2 * a.diagramMarginX;
1977 A && n.append("text").text(A).attr("x", (W.stopx - W.startx) / 2 - 2 * a.diagramMarginX).attr("y", -25), ve(n, K, tt, a.useMaxWidth);
1978 const v = A ? 40 : 0;
1979 n.attr(
1980 "viewBox",
1981 W.startx - a.diagramMarginX + " -" + (a.diagramMarginY + v) + " " + tt + " " + (K + v)
1982 ), X.debug("models:", f.models);
1983};
1984async function M0(t, e, c) {
1985 const s = {};
1986 for (const r of e)
1987 if (t[r.to] && t[r.from]) {
1988 const i = t[r.to];
1989 if (r.placement === c.db.PLACEMENT.LEFTOF && !i.prevActor || r.placement === c.db.PLACEMENT.RIGHTOF && !i.nextActor)
1990 continue;
1991 const o = r.placement !== void 0, l = !o, u = o ? Tt(a) : xt(a), n = r.wrap ? B.wrapLabel(r.message, a.width - 2 * a.wrapPadding, u) : r.message, T = (at(n) ? await wt(r.message, st()) : B.calculateTextDimensions(n, u)).width + 2 * a.wrapPadding;
1992 l && r.from === i.nextActor ? s[r.to] = _.getMax(
1993 s[r.to] || 0,
1994 T
1995 ) : l && r.from === i.prevActor ? s[r.from] = _.getMax(
1996 s[r.from] || 0,
1997 T
1998 ) : l && r.from === r.to ? (s[r.from] = _.getMax(
1999 s[r.from] || 0,
2000 T / 2
2001 ), s[r.to] = _.getMax(
2002 s[r.to] || 0,
2003 T / 2
2004 )) : r.placement === c.db.PLACEMENT.RIGHTOF ? s[r.from] = _.getMax(
2005 s[r.from] || 0,
2006 T
2007 ) : r.placement === c.db.PLACEMENT.LEFTOF ? s[i.prevActor] = _.getMax(
2008 s[i.prevActor] || 0,
2009 T
2010 ) : r.placement === c.db.PLACEMENT.OVER && (i.prevActor && (s[i.prevActor] = _.getMax(
2011 s[i.prevActor] || 0,
2012 T / 2
2013 )), i.nextActor && (s[r.from] = _.getMax(
2014 s[r.from] || 0,
2015 T / 2
2016 )));
2017 }
2018 return X.debug("maxMessageWidthPerActor:", s), s;
2019}
2020const R0 = function(t) {
2021 let e = 0;
2022 const c = Wt(a);
2023 for (const s in t.links) {
2024 const i = B.calculateTextDimensions(s, c).width + 2 * a.wrapPadding + 2 * a.boxMargin;
2025 e < i && (e = i);
2026 }
2027 return e;
2028};
2029async function C0(t, e, c) {
2030 let s = 0;
2031 for (const i of Object.keys(t)) {
2032 const o = t[i];
2033 o.wrap && (o.description = B.wrapLabel(
2034 o.description,
2035 a.width - 2 * a.wrapPadding,
2036 Wt(a)
2037 ));
2038 const l = at(o.description) ? await wt(o.description, st()) : B.calculateTextDimensions(o.description, Wt(a));
2039 o.width = o.wrap ? a.width : _.getMax(a.width, l.width + 2 * a.wrapPadding), o.height = o.wrap ? _.getMax(l.height, a.height) : a.height, s = _.getMax(s, o.height);
2040 }
2041 for (const i in e) {
2042 const o = t[i];
2043 if (!o)
2044 continue;
2045 const l = t[o.nextActor];
2046 if (!l) {
2047 const T = e[i] + a.actorMargin - o.width / 2;
2048 o.margin = _.getMax(T, a.actorMargin);
2049 continue;
2050 }
2051 const n = e[i] + a.actorMargin - o.width / 2 - l.width / 2;
2052 o.margin = _.getMax(n, a.actorMargin);
2053 }
2054 let r = 0;
2055 return c.forEach((i) => {
2056 const o = xt(a);
2057 let l = i.actorKeys.reduce((x, T) => x += t[T].width + (t[T].margin || 0), 0);
2058 l -= 2 * a.boxTextMargin, i.wrap && (i.name = B.wrapLabel(i.name, l - 2 * a.wrapPadding, o));
2059 const u = B.calculateTextDimensions(i.name, o);
2060 r = _.getMax(u.height, r);
2061 const n = _.getMax(l, u.width + 2 * a.wrapPadding);
2062 if (i.margin = a.boxTextMargin, l < n) {
2063 const x = (n - l) / 2;
2064 i.margin += x;
2065 }
2066 }), c.forEach((i) => i.textMaxHeight = r), _.getMax(s, a.height);
2067}
2068const D0 = async function(t, e, c) {
2069 const s = e[t.from].x, r = e[t.to].x, i = t.wrap && t.message;
2070 let o = at(t.message) ? await wt(t.message, st()) : B.calculateTextDimensions(
2071 i ? B.wrapLabel(t.message, a.width, Tt(a)) : t.message,
2072 Tt(a)
2073 );
2074 const l = {
2075 width: i ? a.width : _.getMax(a.width, o.width + 2 * a.noteMargin),
2076 height: 0,
2077 startx: e[t.from].x,
2078 stopx: 0,
2079 starty: 0,
2080 stopy: 0,
2081 message: t.message
2082 };
2083 return t.placement === c.db.PLACEMENT.RIGHTOF ? (l.width = i ? _.getMax(a.width, o.width) : _.getMax(
2084 e[t.from].width / 2 + e[t.to].width / 2,
2085 o.width + 2 * a.noteMargin
2086 ), l.startx = s + (e[t.from].width + a.actorMargin) / 2) : t.placement === c.db.PLACEMENT.LEFTOF ? (l.width = i ? _.getMax(a.width, o.width + 2 * a.noteMargin) : _.getMax(
2087 e[t.from].width / 2 + e[t.to].width / 2,
2088 o.width + 2 * a.noteMargin
2089 ), l.startx = s - l.width + (e[t.from].width - a.actorMargin) / 2) : t.to === t.from ? (o = B.calculateTextDimensions(
2090 i ? B.wrapLabel(
2091 t.message,
2092 _.getMax(a.width, e[t.from].width),
2093 Tt(a)
2094 ) : t.message,
2095 Tt(a)
2096 ), l.width = i ? _.getMax(a.width, e[t.from].width) : _.getMax(
2097 e[t.from].width,
2098 a.width,
2099 o.width + 2 * a.noteMargin
2100 ), l.startx = s + (e[t.from].width - l.width) / 2) : (l.width = Math.abs(s + e[t.from].width / 2 - (r + e[t.to].width / 2)) + a.actorMargin, l.startx = s < r ? s + e[t.from].width / 2 - a.actorMargin / 2 : r + e[t.to].width / 2 - a.actorMargin / 2), i && (l.message = B.wrapLabel(
2101 t.message,
2102 l.width - 2 * a.wrapPadding,
2103 Tt(a)
2104 )), X.debug(
2105 `NM:[${l.startx},${l.stopx},${l.starty},${l.stopy}:${l.width},${l.height}=${t.message}]`
2106 ), l;
2107}, V0 = function(t, e, c) {
2108 if (![
2109 c.db.LINETYPE.SOLID_OPEN,
2110 c.db.LINETYPE.DOTTED_OPEN,
2111 c.db.LINETYPE.SOLID,
2112 c.db.LINETYPE.DOTTED,
2113 c.db.LINETYPE.SOLID_CROSS,
2114 c.db.LINETYPE.DOTTED_CROSS,
2115 c.db.LINETYPE.SOLID_POINT,
2116 c.db.LINETYPE.DOTTED_POINT
2117 ].includes(t.type))
2118 return {};
2119 const [s, r] = jt(t.from, e), [i, o] = jt(t.to, e), l = s <= i, u = l ? r : s;
2120 let n = l ? i : o;
2121 const x = Math.abs(i - o) > 2, T = (k) => l ? -k : k;
2122 t.from === t.to ? n = u : (t.activate && !x && (n += T(a.activationWidth / 2 - 1)), [c.db.LINETYPE.SOLID_OPEN, c.db.LINETYPE.DOTTED_OPEN].includes(t.type) || (n += T(3)));
2123 const p = [s, r, i, o], g = Math.abs(u - n);
2124 t.wrap && t.message && (t.message = B.wrapLabel(
2125 t.message,
2126 _.getMax(g + 2 * a.wrapPadding, a.width),
2127 xt(a)
2128 ));
2129 const m = B.calculateTextDimensions(t.message, xt(a));
2130 return {
2131 width: _.getMax(
2132 t.wrap ? 0 : m.width + 2 * a.wrapPadding,
2133 g + 2 * a.wrapPadding,
2134 a.width
2135 ),
2136 height: 0,
2137 startx: u,
2138 stopx: n,
2139 starty: 0,
2140 stopy: 0,
2141 message: t.message,
2142 type: t.type,
2143 wrap: t.wrap,
2144 fromBounds: Math.min.apply(null, p),
2145 toBounds: Math.max.apply(null, p)
2146 };
2147}, O0 = async function(t, e, c, s) {
2148 const r = {}, i = [];
2149 let o, l, u;
2150 for (const n of t) {
2151 switch (n.id = B.random({ length: 10 }), n.type) {
2152 case s.db.LINETYPE.LOOP_START:
2153 case s.db.LINETYPE.ALT_START:
2154 case s.db.LINETYPE.OPT_START:
2155 case s.db.LINETYPE.PAR_START:
2156 case s.db.LINETYPE.PAR_OVER_START:
2157 case s.db.LINETYPE.CRITICAL_START:
2158 case s.db.LINETYPE.BREAK_START:
2159 i.push({
2160 id: n.id,
2161 msg: n.message,
2162 from: Number.MAX_SAFE_INTEGER,
2163 to: Number.MIN_SAFE_INTEGER,
2164 width: 0
2165 });
2166 break;
2167 case s.db.LINETYPE.ALT_ELSE:
2168 case s.db.LINETYPE.PAR_AND:
2169 case s.db.LINETYPE.CRITICAL_OPTION:
2170 n.message && (o = i.pop(), r[o.id] = o, r[n.id] = o, i.push(o));
2171 break;
2172 case s.db.LINETYPE.LOOP_END:
2173 case s.db.LINETYPE.ALT_END:
2174 case s.db.LINETYPE.OPT_END:
2175 case s.db.LINETYPE.PAR_END:
2176 case s.db.LINETYPE.CRITICAL_END:
2177 case s.db.LINETYPE.BREAK_END:
2178 o = i.pop(), r[o.id] = o;
2179 break;
2180 case s.db.LINETYPE.ACTIVE_START:
2181 {
2182 const T = e[n.from ? n.from.actor : n.to.actor], p = St(n.from ? n.from.actor : n.to.actor).length, g = T.x + T.width / 2 + (p - 1) * a.activationWidth / 2, m = {
2183 startx: g,
2184 stopx: g + a.activationWidth,
2185 actor: n.from.actor,
2186 enabled: !0
2187 };
2188 f.activations.push(m);
2189 }
2190 break;
2191 case s.db.LINETYPE.ACTIVE_END:
2192 {
2193 const T = f.activations.map((p) => p.actor).lastIndexOf(n.from.actor);
2194 delete f.activations.splice(T, 1)[0];
2195 }
2196 break;
2197 }
2198 n.placement !== void 0 ? (l = await D0(n, e, s), n.noteModel = l, i.forEach((T) => {
2199 o = T, o.from = _.getMin(o.from, l.startx), o.to = _.getMax(o.to, l.startx + l.width), o.width = _.getMax(o.width, Math.abs(o.from - o.to)) - a.labelBoxWidth;
2200 })) : (u = V0(n, e, s), n.msgModel = u, u.startx && u.stopx && i.length > 0 && i.forEach((T) => {
2201 if (o = T, u.startx === u.stopx) {
2202 const p = e[n.from], g = e[n.to];
2203 o.from = _.getMin(
2204 p.x - u.width / 2,
2205 p.x - p.width / 2,
2206 o.from
2207 ), o.to = _.getMax(
2208 g.x + u.width / 2,
2209 g.x + p.width / 2,
2210 o.to
2211 ), o.width = _.getMax(o.width, Math.abs(o.to - o.from)) - a.labelBoxWidth;
2212 } else
2213 o.from = _.getMin(u.startx, o.from), o.to = _.getMax(u.stopx, o.to), o.width = _.getMax(o.width, u.width) - a.labelBoxWidth;
2214 }));
2215 }
2216 return f.activations = [], X.debug("Loop type widths:", r), r;
2217}, B0 = {
2218 bounds: f,
2219 drawActors: qt,
2220 drawActorsPopup: ge,
2221 setConf: xe,
2222 draw: S0
2223}, W0 = {
2224 parser: De,
2225 db: Qt,
2226 renderer: B0,
2227 styles: o0,
2228 init: ({ wrap: t }) => {
2229 Qt.setWrap(t);
2230 }
2231};
2232export {
2233 W0 as diagram
2234};