@readme/markdown 7.10.2 → 7.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3674 @@
1
+ "use strict";
2
+ exports.id = 687;
3
+ exports.ids = [687];
4
+ exports.modules = {
5
+
6
+ /***/ 6509:
7
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
+
9
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
+ /* harmony export */ m: () => (/* binding */ ImperativeState)
11
+ /* harmony export */ });
12
+ /* harmony import */ var _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6322);
13
+
14
+
15
+ // src/utils/imperativeState.ts
16
+ var ImperativeState = class {
17
+ /**
18
+ * @param init - Function that creates the default state.
19
+ */
20
+ constructor(init) {
21
+ this.init = init;
22
+ this.records = this.init();
23
+ }
24
+ static {
25
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)(this, "ImperativeState");
26
+ }
27
+ reset() {
28
+ this.records = this.init();
29
+ }
30
+ };
31
+
32
+
33
+
34
+
35
+ /***/ }),
36
+
37
+ /***/ 242:
38
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
39
+
40
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
41
+ /* harmony export */ CP: () => (/* binding */ drawEmbeddedImage),
42
+ /* harmony export */ HT: () => (/* binding */ getTextObj),
43
+ /* harmony export */ PB: () => (/* binding */ getNoteRect),
44
+ /* harmony export */ aC: () => (/* binding */ drawImage),
45
+ /* harmony export */ lC: () => (/* binding */ drawBackgroundRect),
46
+ /* harmony export */ m: () => (/* binding */ drawText),
47
+ /* harmony export */ tk: () => (/* binding */ drawRect)
48
+ /* harmony export */ });
49
+ /* harmony import */ var _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6322);
50
+ /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6750);
51
+
52
+
53
+ // src/diagrams/common/svgDrawCommon.ts
54
+
55
+ var drawRect = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((element, rectData) => {
56
+ const rectElement = element.append("rect");
57
+ rectElement.attr("x", rectData.x);
58
+ rectElement.attr("y", rectData.y);
59
+ rectElement.attr("fill", rectData.fill);
60
+ rectElement.attr("stroke", rectData.stroke);
61
+ rectElement.attr("width", rectData.width);
62
+ rectElement.attr("height", rectData.height);
63
+ if (rectData.name) {
64
+ rectElement.attr("name", rectData.name);
65
+ }
66
+ if (rectData.rx) {
67
+ rectElement.attr("rx", rectData.rx);
68
+ }
69
+ if (rectData.ry) {
70
+ rectElement.attr("ry", rectData.ry);
71
+ }
72
+ if (rectData.attrs !== void 0) {
73
+ for (const attrKey in rectData.attrs) {
74
+ rectElement.attr(attrKey, rectData.attrs[attrKey]);
75
+ }
76
+ }
77
+ if (rectData.class) {
78
+ rectElement.attr("class", rectData.class);
79
+ }
80
+ return rectElement;
81
+ }, "drawRect");
82
+ var drawBackgroundRect = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((element, bounds) => {
83
+ const rectData = {
84
+ x: bounds.startx,
85
+ y: bounds.starty,
86
+ width: bounds.stopx - bounds.startx,
87
+ height: bounds.stopy - bounds.starty,
88
+ fill: bounds.fill,
89
+ stroke: bounds.stroke,
90
+ class: "rect"
91
+ };
92
+ const rectElement = drawRect(element, rectData);
93
+ rectElement.lower();
94
+ }, "drawBackgroundRect");
95
+ var drawText = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((element, textData) => {
96
+ const nText = textData.text.replace(_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .lineBreakRegex */ .H1, " ");
97
+ const textElem = element.append("text");
98
+ textElem.attr("x", textData.x);
99
+ textElem.attr("y", textData.y);
100
+ textElem.attr("class", "legend");
101
+ textElem.style("text-anchor", textData.anchor);
102
+ if (textData.class) {
103
+ textElem.attr("class", textData.class);
104
+ }
105
+ const tspan = textElem.append("tspan");
106
+ tspan.attr("x", textData.x + textData.textMargin * 2);
107
+ tspan.text(nText);
108
+ return textElem;
109
+ }, "drawText");
110
+ var drawImage = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((elem, x, y, link) => {
111
+ const imageElement = elem.append("image");
112
+ imageElement.attr("x", x);
113
+ imageElement.attr("y", y);
114
+ const sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__/* .sanitizeUrl */ .J)(link);
115
+ imageElement.attr("xlink:href", sanitizedLink);
116
+ }, "drawImage");
117
+ var drawEmbeddedImage = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((element, x, y, link) => {
118
+ const imageElement = element.append("use");
119
+ imageElement.attr("x", x);
120
+ imageElement.attr("y", y);
121
+ const sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__/* .sanitizeUrl */ .J)(link);
122
+ imageElement.attr("xlink:href", `#${sanitizedLink}`);
123
+ }, "drawEmbeddedImage");
124
+ var getNoteRect = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)(() => {
125
+ const noteRectData = {
126
+ x: 0,
127
+ y: 0,
128
+ width: 100,
129
+ height: 100,
130
+ fill: "#EDF2AE",
131
+ stroke: "#666",
132
+ anchor: "start",
133
+ rx: 0,
134
+ ry: 0
135
+ };
136
+ return noteRectData;
137
+ }, "getNoteRect");
138
+ var getTextObj = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)(() => {
139
+ const testObject = {
140
+ x: 0,
141
+ y: 0,
142
+ width: 100,
143
+ height: 100,
144
+ "text-anchor": "start",
145
+ style: "#666",
146
+ textMargin: 0,
147
+ rx: 0,
148
+ ry: 0,
149
+ tspan: true
150
+ };
151
+ return testObject;
152
+ }, "getTextObj");
153
+
154
+
155
+
156
+
157
+ /***/ }),
158
+
159
+ /***/ 6687:
160
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
161
+
162
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
163
+ /* harmony export */ diagram: () => (/* binding */ diagram)
164
+ /* harmony export */ });
165
+ /* harmony import */ var _chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(242);
166
+ /* harmony import */ var _chunk_6JKP7OK7_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6509);
167
+ /* harmony import */ var _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2843);
168
+ /* harmony import */ var _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6322);
169
+ /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8066);
170
+ /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6750);
171
+
172
+
173
+
174
+
175
+
176
+ // src/diagrams/sequence/parser/sequenceDiagram.jison
177
+ var parser = function() {
178
+ var o = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(k, v, o2, l) {
179
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
180
+ return o2;
181
+ }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 13], $V7 = [1, 14], $V8 = [1, 16], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 24], $Vc = [1, 25], $Vd = [1, 26], $Ve = [1, 27], $Vf = [1, 28], $Vg = [1, 29], $Vh = [1, 30], $Vi = [1, 31], $Vj = [1, 32], $Vk = [1, 33], $Vl = [1, 34], $Vm = [1, 35], $Vn = [1, 36], $Vo = [1, 37], $Vp = [1, 38], $Vq = [1, 39], $Vr = [1, 41], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [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], $Vy = [4, 5, 16, 50, 52, 53], $Vz = [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], $VA = [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], $VB = [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], $VC = [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], $VD = [68, 69, 70], $VE = [1, 122];
182
+ var parser2 = {
183
+ trace: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function trace() {
184
+ }, "trace"),
185
+ yy: {},
186
+ 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, "BIDIRECTIONAL_SOLID_ARROW": 74, "DOTTED_ARROW": 75, "BIDIRECTIONAL_DOTTED_ARROW": 76, "SOLID_CROSS": 77, "DOTTED_CROSS": 78, "SOLID_POINT": 79, "DOTTED_POINT": 80, "TXT": 81, "$accept": 0, "$end": 1 },
187
+ 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: "BIDIRECTIONAL_SOLID_ARROW", 75: "DOTTED_ARROW", 76: "BIDIRECTIONAL_DOTTED_ARROW", 77: "SOLID_CROSS", 78: "DOTTED_CROSS", 79: "SOLID_POINT", 80: "DOTTED_POINT", 81: "TXT" },
188
+ 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], [67, 1], [67, 1], [56, 1]],
189
+ performAction: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
190
+ var $0 = $$.length - 1;
191
+ switch (yystate) {
192
+ case 3:
193
+ yy.apply($$[$0]);
194
+ return $$[$0];
195
+ break;
196
+ case 4:
197
+ case 9:
198
+ this.$ = [];
199
+ break;
200
+ case 5:
201
+ case 10:
202
+ $$[$0 - 1].push($$[$0]);
203
+ this.$ = $$[$0 - 1];
204
+ break;
205
+ case 6:
206
+ case 7:
207
+ case 11:
208
+ case 12:
209
+ this.$ = $$[$0];
210
+ break;
211
+ case 8:
212
+ case 13:
213
+ this.$ = [];
214
+ break;
215
+ case 15:
216
+ $$[$0].type = "createParticipant";
217
+ this.$ = $$[$0];
218
+ break;
219
+ case 16:
220
+ $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) });
221
+ $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] });
222
+ this.$ = $$[$0 - 1];
223
+ break;
224
+ case 18:
225
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
226
+ break;
227
+ case 19:
228
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
229
+ break;
230
+ case 20:
231
+ this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER };
232
+ break;
233
+ case 21:
234
+ this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
235
+ break;
236
+ case 22:
237
+ this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor };
238
+ break;
239
+ case 23:
240
+ this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1].actor };
241
+ break;
242
+ case 29:
243
+ yy.setDiagramTitle($$[$0].substring(6));
244
+ this.$ = $$[$0].substring(6);
245
+ break;
246
+ case 30:
247
+ yy.setDiagramTitle($$[$0].substring(7));
248
+ this.$ = $$[$0].substring(7);
249
+ break;
250
+ case 31:
251
+ this.$ = $$[$0].trim();
252
+ yy.setAccTitle(this.$);
253
+ break;
254
+ case 32:
255
+ case 33:
256
+ this.$ = $$[$0].trim();
257
+ yy.setAccDescription(this.$);
258
+ break;
259
+ case 34:
260
+ $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START });
261
+ $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END });
262
+ this.$ = $$[$0 - 1];
263
+ break;
264
+ case 35:
265
+ $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START });
266
+ $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END });
267
+ this.$ = $$[$0 - 1];
268
+ break;
269
+ case 36:
270
+ $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START });
271
+ $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END });
272
+ this.$ = $$[$0 - 1];
273
+ break;
274
+ case 37:
275
+ $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START });
276
+ $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END });
277
+ this.$ = $$[$0 - 1];
278
+ break;
279
+ case 38:
280
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START });
281
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
282
+ this.$ = $$[$0 - 1];
283
+ break;
284
+ case 39:
285
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START });
286
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
287
+ this.$ = $$[$0 - 1];
288
+ break;
289
+ case 40:
290
+ $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START });
291
+ $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END });
292
+ this.$ = $$[$0 - 1];
293
+ break;
294
+ case 41:
295
+ $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START });
296
+ $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END });
297
+ this.$ = $$[$0 - 1];
298
+ break;
299
+ case 43:
300
+ this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]);
301
+ break;
302
+ case 45:
303
+ this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]);
304
+ break;
305
+ case 47:
306
+ this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]);
307
+ break;
308
+ case 48:
309
+ $$[$0 - 3].draw = "participant";
310
+ $$[$0 - 3].type = "addParticipant";
311
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
312
+ this.$ = $$[$0 - 3];
313
+ break;
314
+ case 49:
315
+ $$[$0 - 1].draw = "participant";
316
+ $$[$0 - 1].type = "addParticipant";
317
+ this.$ = $$[$0 - 1];
318
+ break;
319
+ case 50:
320
+ $$[$0 - 3].draw = "actor";
321
+ $$[$0 - 3].type = "addParticipant";
322
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
323
+ this.$ = $$[$0 - 3];
324
+ break;
325
+ case 51:
326
+ $$[$0 - 1].draw = "actor";
327
+ $$[$0 - 1].type = "addParticipant";
328
+ this.$ = $$[$0 - 1];
329
+ break;
330
+ case 52:
331
+ $$[$0 - 1].type = "destroyParticipant";
332
+ this.$ = $$[$0 - 1];
333
+ break;
334
+ case 53:
335
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }];
336
+ break;
337
+ case 54:
338
+ $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2);
339
+ $$[$0 - 2][0] = $$[$0 - 2][0].actor;
340
+ $$[$0 - 2][1] = $$[$0 - 2][1].actor;
341
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }];
342
+ break;
343
+ case 55:
344
+ this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }];
345
+ break;
346
+ case 56:
347
+ this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }];
348
+ break;
349
+ case 57:
350
+ this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }];
351
+ break;
352
+ case 58:
353
+ this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }];
354
+ break;
355
+ case 61:
356
+ this.$ = [$$[$0 - 2], $$[$0]];
357
+ break;
358
+ case 62:
359
+ this.$ = $$[$0];
360
+ break;
361
+ case 63:
362
+ this.$ = yy.PLACEMENT.LEFTOF;
363
+ break;
364
+ case 64:
365
+ this.$ = yy.PLACEMENT.RIGHTOF;
366
+ break;
367
+ case 65:
368
+ this.$ = [
369
+ $$[$0 - 4],
370
+ $$[$0 - 1],
371
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true },
372
+ { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor }
373
+ ];
374
+ break;
375
+ case 66:
376
+ this.$ = [
377
+ $$[$0 - 4],
378
+ $$[$0 - 1],
379
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] },
380
+ { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4].actor }
381
+ ];
382
+ break;
383
+ case 67:
384
+ this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }];
385
+ break;
386
+ case 68:
387
+ this.$ = { type: "addParticipant", actor: $$[$0] };
388
+ break;
389
+ case 69:
390
+ this.$ = yy.LINETYPE.SOLID_OPEN;
391
+ break;
392
+ case 70:
393
+ this.$ = yy.LINETYPE.DOTTED_OPEN;
394
+ break;
395
+ case 71:
396
+ this.$ = yy.LINETYPE.SOLID;
397
+ break;
398
+ case 72:
399
+ this.$ = yy.LINETYPE.BIDIRECTIONAL_SOLID;
400
+ break;
401
+ case 73:
402
+ this.$ = yy.LINETYPE.DOTTED;
403
+ break;
404
+ case 74:
405
+ this.$ = yy.LINETYPE.BIDIRECTIONAL_DOTTED;
406
+ break;
407
+ case 75:
408
+ this.$ = yy.LINETYPE.SOLID_CROSS;
409
+ break;
410
+ case 76:
411
+ this.$ = yy.LINETYPE.DOTTED_CROSS;
412
+ break;
413
+ case 77:
414
+ this.$ = yy.LINETYPE.SOLID_POINT;
415
+ break;
416
+ case 78:
417
+ this.$ = yy.LINETYPE.DOTTED_POINT;
418
+ break;
419
+ case 79:
420
+ this.$ = yy.parseMessage($$[$0].trim().substring(1));
421
+ break;
422
+ }
423
+ }, "anonymous"),
424
+ table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o([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], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, o($Vx, [2, 5]), { 9: 47, 12: 12, 13: $V6, 14: $V7, 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, o($Vx, [2, 7]), o($Vx, [2, 8]), o($Vx, [2, 14]), { 12: 48, 50: $Vo, 52: $Vp, 53: $Vq }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 70: $Vw }, { 22: 55, 70: $Vw }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, o($Vx, [2, 29]), o($Vx, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, o($Vx, [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: $Vw }, { 22: 72, 70: $Vw }, { 22: 73, 70: $Vw }, { 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], 79: [1, 83], 80: [1, 84] }, { 55: 85, 57: [1, 86], 65: [1, 87], 66: [1, 88] }, { 22: 89, 70: $Vw }, { 22: 90, 70: $Vw }, { 22: 91, 70: $Vw }, { 22: 92, 70: $Vw }, o([5, 51, 64, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81], [2, 68]), o($Vx, [2, 6]), o($Vx, [2, 15]), o($Vy, [2, 9], { 10: 93 }), o($Vx, [2, 17]), { 5: [1, 95], 19: [1, 94] }, { 5: [1, 96] }, o($Vx, [2, 21]), { 5: [1, 97] }, { 5: [1, 98] }, o($Vx, [2, 24]), o($Vx, [2, 25]), o($Vx, [2, 26]), o($Vx, [2, 27]), o($Vx, [2, 28]), o($Vx, [2, 31]), o($Vx, [2, 32]), o($Vz, $V3, { 7: 99 }), o($Vz, $V3, { 7: 100 }), o($Vz, $V3, { 7: 101 }), o($VA, $V3, { 40: 102, 7: 103 }), o($VB, $V3, { 42: 104, 7: 105 }), o($VB, $V3, { 7: 105, 42: 106 }), o($VC, $V3, { 45: 107, 7: 108 }), o($Vz, $V3, { 7: 109 }), { 5: [1, 111], 51: [1, 110] }, { 5: [1, 113], 51: [1, 112] }, { 5: [1, 114] }, { 22: 117, 68: [1, 115], 69: [1, 116], 70: $Vw }, o($VD, [2, 69]), o($VD, [2, 70]), o($VD, [2, 71]), o($VD, [2, 72]), o($VD, [2, 73]), o($VD, [2, 74]), o($VD, [2, 75]), o($VD, [2, 76]), o($VD, [2, 77]), o($VD, [2, 78]), { 22: 118, 70: $Vw }, { 22: 120, 58: 119, 70: $Vw }, { 70: [2, 63] }, { 70: [2, 64] }, { 56: 121, 81: $VE }, { 56: 123, 81: $VE }, { 56: 124, 81: $VE }, { 56: 125, 81: $VE }, { 4: [1, 128], 5: [1, 130], 11: 127, 12: 129, 16: [1, 126], 50: $Vo, 52: $Vp, 53: $Vq }, { 5: [1, 131] }, o($Vx, [2, 19]), o($Vx, [2, 20]), o($Vx, [2, 22]), o($Vx, [2, 23]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 132], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 133], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 134], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 135] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 46], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 49: [1, 136], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 137] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 44], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 48: [1, 138], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 139] }, { 16: [1, 140] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 42], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 47: [1, 141], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 142], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 15: [1, 143] }, o($Vx, [2, 49]), { 15: [1, 144] }, o($Vx, [2, 51]), o($Vx, [2, 52]), { 22: 145, 70: $Vw }, { 22: 146, 70: $Vw }, { 56: 147, 81: $VE }, { 56: 148, 81: $VE }, { 56: 149, 81: $VE }, { 64: [1, 150], 81: [2, 62] }, { 5: [2, 55] }, { 5: [2, 79] }, { 5: [2, 56] }, { 5: [2, 57] }, { 5: [2, 58] }, o($Vx, [2, 16]), o($Vy, [2, 10]), { 12: 151, 50: $Vo, 52: $Vp, 53: $Vq }, o($Vy, [2, 12]), o($Vy, [2, 13]), o($Vx, [2, 18]), o($Vx, [2, 34]), o($Vx, [2, 35]), o($Vx, [2, 36]), o($Vx, [2, 37]), { 15: [1, 152] }, o($Vx, [2, 38]), { 15: [1, 153] }, o($Vx, [2, 39]), o($Vx, [2, 40]), { 15: [1, 154] }, o($Vx, [2, 41]), { 5: [1, 155] }, { 5: [1, 156] }, { 56: 157, 81: $VE }, { 56: 158, 81: $VE }, { 5: [2, 67] }, { 5: [2, 53] }, { 5: [2, 54] }, { 22: 159, 70: $Vw }, o($Vy, [2, 11]), o($VA, $V3, { 7: 103, 40: 160 }), o($VB, $V3, { 7: 105, 42: 161 }), o($VC, $V3, { 7: 108, 45: 162 }), o($Vx, [2, 48]), o($Vx, [2, 50]), { 5: [2, 65] }, { 5: [2, 66] }, { 81: [2, 61] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }],
425
+ defaultActions: { 5: [2, 1], 6: [2, 2], 87: [2, 63], 88: [2, 64], 121: [2, 55], 122: [2, 79], 123: [2, 56], 124: [2, 57], 125: [2, 58], 147: [2, 67], 148: [2, 53], 149: [2, 54], 157: [2, 65], 158: [2, 66], 159: [2, 61], 160: [2, 47], 161: [2, 45], 162: [2, 43] },
426
+ parseError: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parseError(str, hash) {
427
+ if (hash.recoverable) {
428
+ this.trace(str);
429
+ } else {
430
+ var error = new Error(str);
431
+ error.hash = hash;
432
+ throw error;
433
+ }
434
+ }, "parseError"),
435
+ parse: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parse(input) {
436
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
437
+ var args = lstack.slice.call(arguments, 1);
438
+ var lexer2 = Object.create(this.lexer);
439
+ var sharedState = { yy: {} };
440
+ for (var k in this.yy) {
441
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
442
+ sharedState.yy[k] = this.yy[k];
443
+ }
444
+ }
445
+ lexer2.setInput(input, sharedState.yy);
446
+ sharedState.yy.lexer = lexer2;
447
+ sharedState.yy.parser = this;
448
+ if (typeof lexer2.yylloc == "undefined") {
449
+ lexer2.yylloc = {};
450
+ }
451
+ var yyloc = lexer2.yylloc;
452
+ lstack.push(yyloc);
453
+ var ranges = lexer2.options && lexer2.options.ranges;
454
+ if (typeof sharedState.yy.parseError === "function") {
455
+ this.parseError = sharedState.yy.parseError;
456
+ } else {
457
+ this.parseError = Object.getPrototypeOf(this).parseError;
458
+ }
459
+ function popStack(n) {
460
+ stack.length = stack.length - 2 * n;
461
+ vstack.length = vstack.length - n;
462
+ lstack.length = lstack.length - n;
463
+ }
464
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(popStack, "popStack");
465
+ function lex() {
466
+ var token;
467
+ token = tstack.pop() || lexer2.lex() || EOF;
468
+ if (typeof token !== "number") {
469
+ if (token instanceof Array) {
470
+ tstack = token;
471
+ token = tstack.pop();
472
+ }
473
+ token = self.symbols_[token] || token;
474
+ }
475
+ return token;
476
+ }
477
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(lex, "lex");
478
+ var symbol, preErrorSymbol, state2, action, a, r, yyval = {}, p, len, newState, expected;
479
+ while (true) {
480
+ state2 = stack[stack.length - 1];
481
+ if (this.defaultActions[state2]) {
482
+ action = this.defaultActions[state2];
483
+ } else {
484
+ if (symbol === null || typeof symbol == "undefined") {
485
+ symbol = lex();
486
+ }
487
+ action = table[state2] && table[state2][symbol];
488
+ }
489
+ if (typeof action === "undefined" || !action.length || !action[0]) {
490
+ var errStr = "";
491
+ expected = [];
492
+ for (p in table[state2]) {
493
+ if (this.terminals_[p] && p > TERROR) {
494
+ expected.push("'" + this.terminals_[p] + "'");
495
+ }
496
+ }
497
+ if (lexer2.showPosition) {
498
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
499
+ } else {
500
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
501
+ }
502
+ this.parseError(errStr, {
503
+ text: lexer2.match,
504
+ token: this.terminals_[symbol] || symbol,
505
+ line: lexer2.yylineno,
506
+ loc: yyloc,
507
+ expected
508
+ });
509
+ }
510
+ if (action[0] instanceof Array && action.length > 1) {
511
+ throw new Error("Parse Error: multiple actions possible at state: " + state2 + ", token: " + symbol);
512
+ }
513
+ switch (action[0]) {
514
+ case 1:
515
+ stack.push(symbol);
516
+ vstack.push(lexer2.yytext);
517
+ lstack.push(lexer2.yylloc);
518
+ stack.push(action[1]);
519
+ symbol = null;
520
+ if (!preErrorSymbol) {
521
+ yyleng = lexer2.yyleng;
522
+ yytext = lexer2.yytext;
523
+ yylineno = lexer2.yylineno;
524
+ yyloc = lexer2.yylloc;
525
+ if (recovering > 0) {
526
+ recovering--;
527
+ }
528
+ } else {
529
+ symbol = preErrorSymbol;
530
+ preErrorSymbol = null;
531
+ }
532
+ break;
533
+ case 2:
534
+ len = this.productions_[action[1]][1];
535
+ yyval.$ = vstack[vstack.length - len];
536
+ yyval._$ = {
537
+ first_line: lstack[lstack.length - (len || 1)].first_line,
538
+ last_line: lstack[lstack.length - 1].last_line,
539
+ first_column: lstack[lstack.length - (len || 1)].first_column,
540
+ last_column: lstack[lstack.length - 1].last_column
541
+ };
542
+ if (ranges) {
543
+ yyval._$.range = [
544
+ lstack[lstack.length - (len || 1)].range[0],
545
+ lstack[lstack.length - 1].range[1]
546
+ ];
547
+ }
548
+ r = this.performAction.apply(yyval, [
549
+ yytext,
550
+ yyleng,
551
+ yylineno,
552
+ sharedState.yy,
553
+ action[1],
554
+ vstack,
555
+ lstack
556
+ ].concat(args));
557
+ if (typeof r !== "undefined") {
558
+ return r;
559
+ }
560
+ if (len) {
561
+ stack = stack.slice(0, -1 * len * 2);
562
+ vstack = vstack.slice(0, -1 * len);
563
+ lstack = lstack.slice(0, -1 * len);
564
+ }
565
+ stack.push(this.productions_[action[1]][0]);
566
+ vstack.push(yyval.$);
567
+ lstack.push(yyval._$);
568
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
569
+ stack.push(newState);
570
+ break;
571
+ case 3:
572
+ return true;
573
+ }
574
+ }
575
+ return true;
576
+ }, "parse")
577
+ };
578
+ var lexer = /* @__PURE__ */ function() {
579
+ var lexer2 = {
580
+ EOF: 1,
581
+ parseError: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parseError(str, hash) {
582
+ if (this.yy.parser) {
583
+ this.yy.parser.parseError(str, hash);
584
+ } else {
585
+ throw new Error(str);
586
+ }
587
+ }, "parseError"),
588
+ // resets the lexer, sets new input
589
+ setInput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(input, yy) {
590
+ this.yy = yy || this.yy || {};
591
+ this._input = input;
592
+ this._more = this._backtrack = this.done = false;
593
+ this.yylineno = this.yyleng = 0;
594
+ this.yytext = this.matched = this.match = "";
595
+ this.conditionStack = ["INITIAL"];
596
+ this.yylloc = {
597
+ first_line: 1,
598
+ first_column: 0,
599
+ last_line: 1,
600
+ last_column: 0
601
+ };
602
+ if (this.options.ranges) {
603
+ this.yylloc.range = [0, 0];
604
+ }
605
+ this.offset = 0;
606
+ return this;
607
+ }, "setInput"),
608
+ // consumes and returns one char from the input
609
+ input: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
610
+ var ch = this._input[0];
611
+ this.yytext += ch;
612
+ this.yyleng++;
613
+ this.offset++;
614
+ this.match += ch;
615
+ this.matched += ch;
616
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
617
+ if (lines) {
618
+ this.yylineno++;
619
+ this.yylloc.last_line++;
620
+ } else {
621
+ this.yylloc.last_column++;
622
+ }
623
+ if (this.options.ranges) {
624
+ this.yylloc.range[1]++;
625
+ }
626
+ this._input = this._input.slice(1);
627
+ return ch;
628
+ }, "input"),
629
+ // unshifts one char (or a string) into the input
630
+ unput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(ch) {
631
+ var len = ch.length;
632
+ var lines = ch.split(/(?:\r\n?|\n)/g);
633
+ this._input = ch + this._input;
634
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
635
+ this.offset -= len;
636
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
637
+ this.match = this.match.substr(0, this.match.length - 1);
638
+ this.matched = this.matched.substr(0, this.matched.length - 1);
639
+ if (lines.length - 1) {
640
+ this.yylineno -= lines.length - 1;
641
+ }
642
+ var r = this.yylloc.range;
643
+ this.yylloc = {
644
+ first_line: this.yylloc.first_line,
645
+ last_line: this.yylineno + 1,
646
+ first_column: this.yylloc.first_column,
647
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
648
+ };
649
+ if (this.options.ranges) {
650
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
651
+ }
652
+ this.yyleng = this.yytext.length;
653
+ return this;
654
+ }, "unput"),
655
+ // When called from action, caches matched text and appends it on next action
656
+ more: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
657
+ this._more = true;
658
+ return this;
659
+ }, "more"),
660
+ // 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.
661
+ reject: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
662
+ if (this.options.backtrack_lexer) {
663
+ this._backtrack = true;
664
+ } else {
665
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
666
+ text: "",
667
+ token: null,
668
+ line: this.yylineno
669
+ });
670
+ }
671
+ return this;
672
+ }, "reject"),
673
+ // retain first n characters of the match
674
+ less: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(n) {
675
+ this.unput(this.match.slice(n));
676
+ }, "less"),
677
+ // displays already matched input, i.e. for error messages
678
+ pastInput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
679
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
680
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
681
+ }, "pastInput"),
682
+ // displays upcoming input, i.e. for error messages
683
+ upcomingInput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
684
+ var next = this.match;
685
+ if (next.length < 20) {
686
+ next += this._input.substr(0, 20 - next.length);
687
+ }
688
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
689
+ }, "upcomingInput"),
690
+ // displays the character position where the lexing error occurred, i.e. for error messages
691
+ showPosition: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
692
+ var pre = this.pastInput();
693
+ var c = new Array(pre.length + 1).join("-");
694
+ return pre + this.upcomingInput() + "\n" + c + "^";
695
+ }, "showPosition"),
696
+ // test the lexed token: return FALSE when not a match, otherwise return token
697
+ test_match: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(match, indexed_rule) {
698
+ var token, lines, backup;
699
+ if (this.options.backtrack_lexer) {
700
+ backup = {
701
+ yylineno: this.yylineno,
702
+ yylloc: {
703
+ first_line: this.yylloc.first_line,
704
+ last_line: this.last_line,
705
+ first_column: this.yylloc.first_column,
706
+ last_column: this.yylloc.last_column
707
+ },
708
+ yytext: this.yytext,
709
+ match: this.match,
710
+ matches: this.matches,
711
+ matched: this.matched,
712
+ yyleng: this.yyleng,
713
+ offset: this.offset,
714
+ _more: this._more,
715
+ _input: this._input,
716
+ yy: this.yy,
717
+ conditionStack: this.conditionStack.slice(0),
718
+ done: this.done
719
+ };
720
+ if (this.options.ranges) {
721
+ backup.yylloc.range = this.yylloc.range.slice(0);
722
+ }
723
+ }
724
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
725
+ if (lines) {
726
+ this.yylineno += lines.length;
727
+ }
728
+ this.yylloc = {
729
+ first_line: this.yylloc.last_line,
730
+ last_line: this.yylineno + 1,
731
+ first_column: this.yylloc.last_column,
732
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
733
+ };
734
+ this.yytext += match[0];
735
+ this.match += match[0];
736
+ this.matches = match;
737
+ this.yyleng = this.yytext.length;
738
+ if (this.options.ranges) {
739
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
740
+ }
741
+ this._more = false;
742
+ this._backtrack = false;
743
+ this._input = this._input.slice(match[0].length);
744
+ this.matched += match[0];
745
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
746
+ if (this.done && this._input) {
747
+ this.done = false;
748
+ }
749
+ if (token) {
750
+ return token;
751
+ } else if (this._backtrack) {
752
+ for (var k in backup) {
753
+ this[k] = backup[k];
754
+ }
755
+ return false;
756
+ }
757
+ return false;
758
+ }, "test_match"),
759
+ // return next match in input
760
+ next: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
761
+ if (this.done) {
762
+ return this.EOF;
763
+ }
764
+ if (!this._input) {
765
+ this.done = true;
766
+ }
767
+ var token, match, tempMatch, index;
768
+ if (!this._more) {
769
+ this.yytext = "";
770
+ this.match = "";
771
+ }
772
+ var rules = this._currentRules();
773
+ for (var i = 0; i < rules.length; i++) {
774
+ tempMatch = this._input.match(this.rules[rules[i]]);
775
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
776
+ match = tempMatch;
777
+ index = i;
778
+ if (this.options.backtrack_lexer) {
779
+ token = this.test_match(tempMatch, rules[i]);
780
+ if (token !== false) {
781
+ return token;
782
+ } else if (this._backtrack) {
783
+ match = false;
784
+ continue;
785
+ } else {
786
+ return false;
787
+ }
788
+ } else if (!this.options.flex) {
789
+ break;
790
+ }
791
+ }
792
+ }
793
+ if (match) {
794
+ token = this.test_match(match, rules[index]);
795
+ if (token !== false) {
796
+ return token;
797
+ }
798
+ return false;
799
+ }
800
+ if (this._input === "") {
801
+ return this.EOF;
802
+ } else {
803
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
804
+ text: "",
805
+ token: null,
806
+ line: this.yylineno
807
+ });
808
+ }
809
+ }, "next"),
810
+ // return next match that has a token
811
+ lex: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function lex() {
812
+ var r = this.next();
813
+ if (r) {
814
+ return r;
815
+ } else {
816
+ return this.lex();
817
+ }
818
+ }, "lex"),
819
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
820
+ begin: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function begin(condition) {
821
+ this.conditionStack.push(condition);
822
+ }, "begin"),
823
+ // pop the previously active lexer condition state off the condition stack
824
+ popState: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function popState() {
825
+ var n = this.conditionStack.length - 1;
826
+ if (n > 0) {
827
+ return this.conditionStack.pop();
828
+ } else {
829
+ return this.conditionStack[0];
830
+ }
831
+ }, "popState"),
832
+ // produce the lexer rule set which is active for the currently active lexer condition state
833
+ _currentRules: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function _currentRules() {
834
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
835
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
836
+ } else {
837
+ return this.conditions["INITIAL"].rules;
838
+ }
839
+ }, "_currentRules"),
840
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
841
+ topState: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function topState(n) {
842
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
843
+ if (n >= 0) {
844
+ return this.conditionStack[n];
845
+ } else {
846
+ return "INITIAL";
847
+ }
848
+ }, "topState"),
849
+ // alias for begin(condition)
850
+ pushState: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function pushState(condition) {
851
+ this.begin(condition);
852
+ }, "pushState"),
853
+ // return the number of states currently on the stack
854
+ stateStackSize: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function stateStackSize() {
855
+ return this.conditionStack.length;
856
+ }, "stateStackSize"),
857
+ options: { "case-insensitive": true },
858
+ performAction: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
859
+ var YYSTATE = YY_START;
860
+ switch ($avoiding_name_collisions) {
861
+ case 0:
862
+ return 5;
863
+ break;
864
+ case 1:
865
+ break;
866
+ case 2:
867
+ break;
868
+ case 3:
869
+ break;
870
+ case 4:
871
+ break;
872
+ case 5:
873
+ break;
874
+ case 6:
875
+ return 19;
876
+ break;
877
+ case 7:
878
+ this.begin("LINE");
879
+ return 14;
880
+ break;
881
+ case 8:
882
+ this.begin("ID");
883
+ return 50;
884
+ break;
885
+ case 9:
886
+ this.begin("ID");
887
+ return 52;
888
+ break;
889
+ case 10:
890
+ return 13;
891
+ break;
892
+ case 11:
893
+ this.begin("ID");
894
+ return 53;
895
+ break;
896
+ case 12:
897
+ yy_.yytext = yy_.yytext.trim();
898
+ this.begin("ALIAS");
899
+ return 70;
900
+ break;
901
+ case 13:
902
+ this.popState();
903
+ this.popState();
904
+ this.begin("LINE");
905
+ return 51;
906
+ break;
907
+ case 14:
908
+ this.popState();
909
+ this.popState();
910
+ return 5;
911
+ break;
912
+ case 15:
913
+ this.begin("LINE");
914
+ return 36;
915
+ break;
916
+ case 16:
917
+ this.begin("LINE");
918
+ return 37;
919
+ break;
920
+ case 17:
921
+ this.begin("LINE");
922
+ return 38;
923
+ break;
924
+ case 18:
925
+ this.begin("LINE");
926
+ return 39;
927
+ break;
928
+ case 19:
929
+ this.begin("LINE");
930
+ return 49;
931
+ break;
932
+ case 20:
933
+ this.begin("LINE");
934
+ return 41;
935
+ break;
936
+ case 21:
937
+ this.begin("LINE");
938
+ return 43;
939
+ break;
940
+ case 22:
941
+ this.begin("LINE");
942
+ return 48;
943
+ break;
944
+ case 23:
945
+ this.begin("LINE");
946
+ return 44;
947
+ break;
948
+ case 24:
949
+ this.begin("LINE");
950
+ return 47;
951
+ break;
952
+ case 25:
953
+ this.begin("LINE");
954
+ return 46;
955
+ break;
956
+ case 26:
957
+ this.popState();
958
+ return 15;
959
+ break;
960
+ case 27:
961
+ return 16;
962
+ break;
963
+ case 28:
964
+ return 65;
965
+ break;
966
+ case 29:
967
+ return 66;
968
+ break;
969
+ case 30:
970
+ return 59;
971
+ break;
972
+ case 31:
973
+ return 60;
974
+ break;
975
+ case 32:
976
+ return 61;
977
+ break;
978
+ case 33:
979
+ return 62;
980
+ break;
981
+ case 34:
982
+ return 57;
983
+ break;
984
+ case 35:
985
+ return 54;
986
+ break;
987
+ case 36:
988
+ this.begin("ID");
989
+ return 21;
990
+ break;
991
+ case 37:
992
+ this.begin("ID");
993
+ return 23;
994
+ break;
995
+ case 38:
996
+ return 29;
997
+ break;
998
+ case 39:
999
+ return 30;
1000
+ break;
1001
+ case 40:
1002
+ this.begin("acc_title");
1003
+ return 31;
1004
+ break;
1005
+ case 41:
1006
+ this.popState();
1007
+ return "acc_title_value";
1008
+ break;
1009
+ case 42:
1010
+ this.begin("acc_descr");
1011
+ return 33;
1012
+ break;
1013
+ case 43:
1014
+ this.popState();
1015
+ return "acc_descr_value";
1016
+ break;
1017
+ case 44:
1018
+ this.begin("acc_descr_multiline");
1019
+ break;
1020
+ case 45:
1021
+ this.popState();
1022
+ break;
1023
+ case 46:
1024
+ return "acc_descr_multiline_value";
1025
+ break;
1026
+ case 47:
1027
+ return 6;
1028
+ break;
1029
+ case 48:
1030
+ return 18;
1031
+ break;
1032
+ case 49:
1033
+ return 20;
1034
+ break;
1035
+ case 50:
1036
+ return 64;
1037
+ break;
1038
+ case 51:
1039
+ return 5;
1040
+ break;
1041
+ case 52:
1042
+ yy_.yytext = yy_.yytext.trim();
1043
+ return 70;
1044
+ break;
1045
+ case 53:
1046
+ return 73;
1047
+ break;
1048
+ case 54:
1049
+ return 74;
1050
+ break;
1051
+ case 55:
1052
+ return 75;
1053
+ break;
1054
+ case 56:
1055
+ return 76;
1056
+ break;
1057
+ case 57:
1058
+ return 71;
1059
+ break;
1060
+ case 58:
1061
+ return 72;
1062
+ break;
1063
+ case 59:
1064
+ return 77;
1065
+ break;
1066
+ case 60:
1067
+ return 78;
1068
+ break;
1069
+ case 61:
1070
+ return 79;
1071
+ break;
1072
+ case 62:
1073
+ return 80;
1074
+ break;
1075
+ case 63:
1076
+ return 81;
1077
+ break;
1078
+ case 64:
1079
+ return 68;
1080
+ break;
1081
+ case 65:
1082
+ return 69;
1083
+ break;
1084
+ case 66:
1085
+ return 5;
1086
+ break;
1087
+ case 67:
1088
+ return "INVALID";
1089
+ break;
1090
+ }
1091
+ }, "anonymous"),
1092
+ 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, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]+)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i],
1093
+ conditions: { "acc_descr_multiline": { "rules": [45, 46], "inclusive": false }, "acc_descr": { "rules": [43], "inclusive": false }, "acc_title": { "rules": [41], "inclusive": false }, "ID": { "rules": [2, 3, 12], "inclusive": false }, "ALIAS": { "rules": [2, 3, 13, 14], "inclusive": false }, "LINE": { "rules": [2, 3, 26], "inclusive": false }, "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, 66, 67], "inclusive": true } }
1094
+ };
1095
+ return lexer2;
1096
+ }();
1097
+ parser2.lexer = lexer;
1098
+ function Parser() {
1099
+ this.yy = {};
1100
+ }
1101
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(Parser, "Parser");
1102
+ Parser.prototype = parser2;
1103
+ parser2.Parser = Parser;
1104
+ return new Parser();
1105
+ }();
1106
+ parser.parser = parser;
1107
+ var sequenceDiagram_default = parser;
1108
+
1109
+ // src/diagrams/sequence/sequenceDb.ts
1110
+ var state = new _chunk_6JKP7OK7_mjs__WEBPACK_IMPORTED_MODULE_1__/* .ImperativeState */ .m(() => ({
1111
+ prevActor: void 0,
1112
+ actors: /* @__PURE__ */ new Map(),
1113
+ createdActors: /* @__PURE__ */ new Map(),
1114
+ destroyedActors: /* @__PURE__ */ new Map(),
1115
+ boxes: [],
1116
+ messages: [],
1117
+ notes: [],
1118
+ sequenceNumbersEnabled: false,
1119
+ wrapEnabled: void 0,
1120
+ currentBox: void 0,
1121
+ lastCreated: void 0,
1122
+ lastDestroyed: void 0
1123
+ }));
1124
+ var addBox = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(data) {
1125
+ state.records.boxes.push({
1126
+ name: data.text,
1127
+ wrap: data.wrap ?? autoWrap(),
1128
+ fill: data.color,
1129
+ actorKeys: []
1130
+ });
1131
+ state.records.currentBox = state.records.boxes.slice(-1)[0];
1132
+ }, "addBox");
1133
+ var addActor = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(id, name, description, type) {
1134
+ let assignedBox = state.records.currentBox;
1135
+ const old = state.records.actors.get(id);
1136
+ if (old) {
1137
+ if (state.records.currentBox && old.box && state.records.currentBox !== old.box) {
1138
+ throw new Error(
1139
+ `A same participant should only be defined in one Box: ${old.name} can't be in '${old.box.name}' and in '${state.records.currentBox.name}' at the same time.`
1140
+ );
1141
+ }
1142
+ assignedBox = old.box ? old.box : state.records.currentBox;
1143
+ old.box = assignedBox;
1144
+ if (old && name === old.name && description == null) {
1145
+ return;
1146
+ }
1147
+ }
1148
+ if (description?.text == null) {
1149
+ description = { text: name, type };
1150
+ }
1151
+ if (type == null || description.text == null) {
1152
+ description = { text: name, type };
1153
+ }
1154
+ state.records.actors.set(id, {
1155
+ box: assignedBox,
1156
+ name,
1157
+ description: description.text,
1158
+ wrap: description.wrap ?? autoWrap(),
1159
+ prevActor: state.records.prevActor,
1160
+ links: {},
1161
+ properties: {},
1162
+ actorCnt: null,
1163
+ rectData: null,
1164
+ type: type ?? "participant"
1165
+ });
1166
+ if (state.records.prevActor) {
1167
+ const prevActorInRecords = state.records.actors.get(state.records.prevActor);
1168
+ if (prevActorInRecords) {
1169
+ prevActorInRecords.nextActor = id;
1170
+ }
1171
+ }
1172
+ if (state.records.currentBox) {
1173
+ state.records.currentBox.actorKeys.push(id);
1174
+ }
1175
+ state.records.prevActor = id;
1176
+ }, "addActor");
1177
+ var activationCount = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((part) => {
1178
+ let i;
1179
+ let count = 0;
1180
+ if (!part) {
1181
+ return 0;
1182
+ }
1183
+ for (i = 0; i < state.records.messages.length; i++) {
1184
+ if (state.records.messages[i].type === LINETYPE.ACTIVE_START && state.records.messages[i].from === part) {
1185
+ count++;
1186
+ }
1187
+ if (state.records.messages[i].type === LINETYPE.ACTIVE_END && state.records.messages[i].from === part) {
1188
+ count--;
1189
+ }
1190
+ }
1191
+ return count;
1192
+ }, "activationCount");
1193
+ var addMessage = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(idFrom, idTo, message, answer) {
1194
+ state.records.messages.push({
1195
+ from: idFrom,
1196
+ to: idTo,
1197
+ message: message.text,
1198
+ wrap: message.wrap ?? autoWrap(),
1199
+ answer
1200
+ });
1201
+ }, "addMessage");
1202
+ var addSignal = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(idFrom, idTo, message, messageType, activate = false) {
1203
+ if (messageType === LINETYPE.ACTIVE_END) {
1204
+ const cnt = activationCount(idFrom ?? "");
1205
+ if (cnt < 1) {
1206
+ const error = new Error("Trying to inactivate an inactive participant (" + idFrom + ")");
1207
+ error.hash = {
1208
+ text: "->>-",
1209
+ token: "->>-",
1210
+ line: "1",
1211
+ loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
1212
+ expected: ["'ACTIVE_PARTICIPANT'"]
1213
+ };
1214
+ throw error;
1215
+ }
1216
+ }
1217
+ state.records.messages.push({
1218
+ from: idFrom,
1219
+ to: idTo,
1220
+ message: message?.text ?? "",
1221
+ wrap: message?.wrap ?? autoWrap(),
1222
+ type: messageType,
1223
+ activate
1224
+ });
1225
+ return true;
1226
+ }, "addSignal");
1227
+ var hasAtLeastOneBox = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1228
+ return state.records.boxes.length > 0;
1229
+ }, "hasAtLeastOneBox");
1230
+ var hasAtLeastOneBoxWithTitle = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1231
+ return state.records.boxes.some((b) => b.name);
1232
+ }, "hasAtLeastOneBoxWithTitle");
1233
+ var getMessages = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1234
+ return state.records.messages;
1235
+ }, "getMessages");
1236
+ var getBoxes = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1237
+ return state.records.boxes;
1238
+ }, "getBoxes");
1239
+ var getActors = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1240
+ return state.records.actors;
1241
+ }, "getActors");
1242
+ var getCreatedActors = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1243
+ return state.records.createdActors;
1244
+ }, "getCreatedActors");
1245
+ var getDestroyedActors = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1246
+ return state.records.destroyedActors;
1247
+ }, "getDestroyedActors");
1248
+ var getActor = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(id) {
1249
+ return state.records.actors.get(id);
1250
+ }, "getActor");
1251
+ var getActorKeys = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1252
+ return [...state.records.actors.keys()];
1253
+ }, "getActorKeys");
1254
+ var enableSequenceNumbers = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1255
+ state.records.sequenceNumbersEnabled = true;
1256
+ }, "enableSequenceNumbers");
1257
+ var disableSequenceNumbers = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1258
+ state.records.sequenceNumbersEnabled = false;
1259
+ }, "disableSequenceNumbers");
1260
+ var showSequenceNumbers = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => state.records.sequenceNumbersEnabled, "showSequenceNumbers");
1261
+ var setWrap = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(wrapSetting) {
1262
+ state.records.wrapEnabled = wrapSetting;
1263
+ }, "setWrap");
1264
+ var extractWrap = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((text) => {
1265
+ if (text === void 0) {
1266
+ return {};
1267
+ }
1268
+ text = text.trim();
1269
+ const wrap = /^:?wrap:/.exec(text) !== null ? true : /^:?nowrap:/.exec(text) !== null ? false : void 0;
1270
+ const cleanedText = (wrap === void 0 ? text : text.replace(/^:?(?:no)?wrap:/, "")).trim();
1271
+ return { cleanedText, wrap };
1272
+ }, "extractWrap");
1273
+ var autoWrap = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1274
+ if (state.records.wrapEnabled !== void 0) {
1275
+ return state.records.wrapEnabled;
1276
+ }
1277
+ return (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)().sequence?.wrap ?? false;
1278
+ }, "autoWrap");
1279
+ var clear2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1280
+ state.reset();
1281
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .clear */ .IU)();
1282
+ }, "clear");
1283
+ var parseMessage = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(str) {
1284
+ const trimmedStr = str.trim();
1285
+ const { wrap, cleanedText } = extractWrap(trimmedStr);
1286
+ const message = {
1287
+ text: cleanedText,
1288
+ wrap
1289
+ };
1290
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug(`parseMessage: ${JSON.stringify(message)}`);
1291
+ return message;
1292
+ }, "parseMessage");
1293
+ var parseBoxData = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(str) {
1294
+ const match = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(str);
1295
+ let color = match?.[1] ? match[1].trim() : "transparent";
1296
+ let title = match?.[2] ? match[2].trim() : void 0;
1297
+ if (window?.CSS) {
1298
+ if (!window.CSS.supports("color", color)) {
1299
+ color = "transparent";
1300
+ title = str.trim();
1301
+ }
1302
+ } else {
1303
+ const style = new Option().style;
1304
+ style.color = color;
1305
+ if (style.color !== color) {
1306
+ color = "transparent";
1307
+ title = str.trim();
1308
+ }
1309
+ }
1310
+ const { wrap, cleanedText } = extractWrap(title);
1311
+ return {
1312
+ text: cleanedText ? (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeText */ .jZ)(cleanedText, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()) : void 0,
1313
+ color,
1314
+ wrap
1315
+ };
1316
+ }, "parseBoxData");
1317
+ var LINETYPE = {
1318
+ SOLID: 0,
1319
+ DOTTED: 1,
1320
+ NOTE: 2,
1321
+ SOLID_CROSS: 3,
1322
+ DOTTED_CROSS: 4,
1323
+ SOLID_OPEN: 5,
1324
+ DOTTED_OPEN: 6,
1325
+ LOOP_START: 10,
1326
+ LOOP_END: 11,
1327
+ ALT_START: 12,
1328
+ ALT_ELSE: 13,
1329
+ ALT_END: 14,
1330
+ OPT_START: 15,
1331
+ OPT_END: 16,
1332
+ ACTIVE_START: 17,
1333
+ ACTIVE_END: 18,
1334
+ PAR_START: 19,
1335
+ PAR_AND: 20,
1336
+ PAR_END: 21,
1337
+ RECT_START: 22,
1338
+ RECT_END: 23,
1339
+ SOLID_POINT: 24,
1340
+ DOTTED_POINT: 25,
1341
+ AUTONUMBER: 26,
1342
+ CRITICAL_START: 27,
1343
+ CRITICAL_OPTION: 28,
1344
+ CRITICAL_END: 29,
1345
+ BREAK_START: 30,
1346
+ BREAK_END: 31,
1347
+ PAR_OVER_START: 32,
1348
+ BIDIRECTIONAL_SOLID: 33,
1349
+ BIDIRECTIONAL_DOTTED: 34
1350
+ };
1351
+ var ARROWTYPE = {
1352
+ FILLED: 0,
1353
+ OPEN: 1
1354
+ };
1355
+ var PLACEMENT = {
1356
+ LEFTOF: 0,
1357
+ RIGHTOF: 1,
1358
+ OVER: 2
1359
+ };
1360
+ var addNote = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actor, placement, message) {
1361
+ const note = {
1362
+ actor,
1363
+ placement,
1364
+ message: message.text,
1365
+ wrap: message.wrap ?? autoWrap()
1366
+ };
1367
+ const actors = [].concat(actor, actor);
1368
+ state.records.notes.push(note);
1369
+ state.records.messages.push({
1370
+ from: actors[0],
1371
+ to: actors[1],
1372
+ message: message.text,
1373
+ wrap: message.wrap ?? autoWrap(),
1374
+ type: LINETYPE.NOTE,
1375
+ placement
1376
+ });
1377
+ }, "addNote");
1378
+ var addLinks = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actorId, text) {
1379
+ const actor = getActor(actorId);
1380
+ try {
1381
+ let sanitizedText = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeText */ .jZ)(text.text, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
1382
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1383
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1384
+ const links = JSON.parse(sanitizedText);
1385
+ insertLinks(actor, links);
1386
+ } catch (e) {
1387
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.error("error while parsing actor link text", e);
1388
+ }
1389
+ }, "addLinks");
1390
+ var addALink = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actorId, text) {
1391
+ const actor = getActor(actorId);
1392
+ try {
1393
+ const links = {};
1394
+ let sanitizedText = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeText */ .jZ)(text.text, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
1395
+ const sep = sanitizedText.indexOf("@");
1396
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1397
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1398
+ const label = sanitizedText.slice(0, sep - 1).trim();
1399
+ const link = sanitizedText.slice(sep + 1).trim();
1400
+ links[label] = link;
1401
+ insertLinks(actor, links);
1402
+ } catch (e) {
1403
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.error("error while parsing actor link text", e);
1404
+ }
1405
+ }, "addALink");
1406
+ function insertLinks(actor, links) {
1407
+ if (actor.links == null) {
1408
+ actor.links = links;
1409
+ } else {
1410
+ for (const key in links) {
1411
+ actor.links[key] = links[key];
1412
+ }
1413
+ }
1414
+ }
1415
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(insertLinks, "insertLinks");
1416
+ var addProperties = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actorId, text) {
1417
+ const actor = getActor(actorId);
1418
+ try {
1419
+ const sanitizedText = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeText */ .jZ)(text.text, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
1420
+ const properties = JSON.parse(sanitizedText);
1421
+ insertProperties(actor, properties);
1422
+ } catch (e) {
1423
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.error("error while parsing actor properties text", e);
1424
+ }
1425
+ }, "addProperties");
1426
+ function insertProperties(actor, properties) {
1427
+ if (actor.properties == null) {
1428
+ actor.properties = properties;
1429
+ } else {
1430
+ for (const key in properties) {
1431
+ actor.properties[key] = properties[key];
1432
+ }
1433
+ }
1434
+ }
1435
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(insertProperties, "insertProperties");
1436
+ function boxEnd() {
1437
+ state.records.currentBox = void 0;
1438
+ }
1439
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(boxEnd, "boxEnd");
1440
+ var addDetails = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actorId, text) {
1441
+ const actor = getActor(actorId);
1442
+ const elem = document.getElementById(text.text);
1443
+ try {
1444
+ const text2 = elem.innerHTML;
1445
+ const details = JSON.parse(text2);
1446
+ if (details.properties) {
1447
+ insertProperties(actor, details.properties);
1448
+ }
1449
+ if (details.links) {
1450
+ insertLinks(actor, details.links);
1451
+ }
1452
+ } catch (e) {
1453
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.error("error while parsing actor details text", e);
1454
+ }
1455
+ }, "addDetails");
1456
+ var getActorProperty = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actor, key) {
1457
+ if (actor?.properties !== void 0) {
1458
+ return actor.properties[key];
1459
+ }
1460
+ return void 0;
1461
+ }, "getActorProperty");
1462
+ var apply = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(param) {
1463
+ if (Array.isArray(param)) {
1464
+ param.forEach(function(item) {
1465
+ apply(item);
1466
+ });
1467
+ } else {
1468
+ switch (param.type) {
1469
+ case "sequenceIndex":
1470
+ state.records.messages.push({
1471
+ from: void 0,
1472
+ to: void 0,
1473
+ message: {
1474
+ start: param.sequenceIndex,
1475
+ step: param.sequenceIndexStep,
1476
+ visible: param.sequenceVisible
1477
+ },
1478
+ wrap: false,
1479
+ type: param.signalType
1480
+ });
1481
+ break;
1482
+ case "addParticipant":
1483
+ addActor(param.actor, param.actor, param.description, param.draw);
1484
+ break;
1485
+ case "createParticipant":
1486
+ if (state.records.actors.has(param.actor)) {
1487
+ throw new Error(
1488
+ "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"
1489
+ );
1490
+ }
1491
+ state.records.lastCreated = param.actor;
1492
+ addActor(param.actor, param.actor, param.description, param.draw);
1493
+ state.records.createdActors.set(param.actor, state.records.messages.length);
1494
+ break;
1495
+ case "destroyParticipant":
1496
+ state.records.lastDestroyed = param.actor;
1497
+ state.records.destroyedActors.set(param.actor, state.records.messages.length);
1498
+ break;
1499
+ case "activeStart":
1500
+ addSignal(param.actor, void 0, void 0, param.signalType);
1501
+ break;
1502
+ case "activeEnd":
1503
+ addSignal(param.actor, void 0, void 0, param.signalType);
1504
+ break;
1505
+ case "addNote":
1506
+ addNote(param.actor, param.placement, param.text);
1507
+ break;
1508
+ case "addLinks":
1509
+ addLinks(param.actor, param.text);
1510
+ break;
1511
+ case "addALink":
1512
+ addALink(param.actor, param.text);
1513
+ break;
1514
+ case "addProperties":
1515
+ addProperties(param.actor, param.text);
1516
+ break;
1517
+ case "addDetails":
1518
+ addDetails(param.actor, param.text);
1519
+ break;
1520
+ case "addMessage":
1521
+ if (state.records.lastCreated) {
1522
+ if (param.to !== state.records.lastCreated) {
1523
+ throw new Error(
1524
+ "The created participant " + state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
1525
+ );
1526
+ } else {
1527
+ state.records.lastCreated = void 0;
1528
+ }
1529
+ } else if (state.records.lastDestroyed) {
1530
+ if (param.to !== state.records.lastDestroyed && param.from !== state.records.lastDestroyed) {
1531
+ throw new Error(
1532
+ "The destroyed participant " + state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
1533
+ );
1534
+ } else {
1535
+ state.records.lastDestroyed = void 0;
1536
+ }
1537
+ }
1538
+ addSignal(param.from, param.to, param.msg, param.signalType, param.activate);
1539
+ break;
1540
+ case "boxStart":
1541
+ addBox(param.boxData);
1542
+ break;
1543
+ case "boxEnd":
1544
+ boxEnd();
1545
+ break;
1546
+ case "loopStart":
1547
+ addSignal(void 0, void 0, param.loopText, param.signalType);
1548
+ break;
1549
+ case "loopEnd":
1550
+ addSignal(void 0, void 0, void 0, param.signalType);
1551
+ break;
1552
+ case "rectStart":
1553
+ addSignal(void 0, void 0, param.color, param.signalType);
1554
+ break;
1555
+ case "rectEnd":
1556
+ addSignal(void 0, void 0, void 0, param.signalType);
1557
+ break;
1558
+ case "optStart":
1559
+ addSignal(void 0, void 0, param.optText, param.signalType);
1560
+ break;
1561
+ case "optEnd":
1562
+ addSignal(void 0, void 0, void 0, param.signalType);
1563
+ break;
1564
+ case "altStart":
1565
+ addSignal(void 0, void 0, param.altText, param.signalType);
1566
+ break;
1567
+ case "else":
1568
+ addSignal(void 0, void 0, param.altText, param.signalType);
1569
+ break;
1570
+ case "altEnd":
1571
+ addSignal(void 0, void 0, void 0, param.signalType);
1572
+ break;
1573
+ case "setAccTitle":
1574
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setAccTitle */ .SV)(param.text);
1575
+ break;
1576
+ case "parStart":
1577
+ addSignal(void 0, void 0, param.parText, param.signalType);
1578
+ break;
1579
+ case "and":
1580
+ addSignal(void 0, void 0, param.parText, param.signalType);
1581
+ break;
1582
+ case "parEnd":
1583
+ addSignal(void 0, void 0, void 0, param.signalType);
1584
+ break;
1585
+ case "criticalStart":
1586
+ addSignal(void 0, void 0, param.criticalText, param.signalType);
1587
+ break;
1588
+ case "option":
1589
+ addSignal(void 0, void 0, param.optionText, param.signalType);
1590
+ break;
1591
+ case "criticalEnd":
1592
+ addSignal(void 0, void 0, void 0, param.signalType);
1593
+ break;
1594
+ case "breakStart":
1595
+ addSignal(void 0, void 0, param.breakText, param.signalType);
1596
+ break;
1597
+ case "breakEnd":
1598
+ addSignal(void 0, void 0, void 0, param.signalType);
1599
+ break;
1600
+ }
1601
+ }
1602
+ }, "apply");
1603
+ var sequenceDb_default = {
1604
+ addActor,
1605
+ addMessage,
1606
+ addSignal,
1607
+ addLinks,
1608
+ addDetails,
1609
+ addProperties,
1610
+ autoWrap,
1611
+ setWrap,
1612
+ enableSequenceNumbers,
1613
+ disableSequenceNumbers,
1614
+ showSequenceNumbers,
1615
+ getMessages,
1616
+ getActors,
1617
+ getCreatedActors,
1618
+ getDestroyedActors,
1619
+ getActor,
1620
+ getActorKeys,
1621
+ getActorProperty,
1622
+ getAccTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getAccTitle */ .iN,
1623
+ getBoxes,
1624
+ getDiagramTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getDiagramTitle */ .ab,
1625
+ setDiagramTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setDiagramTitle */ .ke,
1626
+ getConfig: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)().sequence, "getConfig"),
1627
+ clear: clear2,
1628
+ parseMessage,
1629
+ parseBoxData,
1630
+ LINETYPE,
1631
+ ARROWTYPE,
1632
+ PLACEMENT,
1633
+ addNote,
1634
+ setAccTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setAccTitle */ .SV,
1635
+ apply,
1636
+ setAccDescription: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setAccDescription */ .EI,
1637
+ getAccDescription: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getAccDescription */ .m7,
1638
+ hasAtLeastOneBox,
1639
+ hasAtLeastOneBoxWithTitle
1640
+ };
1641
+
1642
+ // src/diagrams/sequence/styles.js
1643
+ var getStyles = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((options) => `.actor {
1644
+ stroke: ${options.actorBorder};
1645
+ fill: ${options.actorBkg};
1646
+ }
1647
+
1648
+ text.actor > tspan {
1649
+ fill: ${options.actorTextColor};
1650
+ stroke: none;
1651
+ }
1652
+
1653
+ .actor-line {
1654
+ stroke: ${options.actorLineColor};
1655
+ }
1656
+
1657
+ .messageLine0 {
1658
+ stroke-width: 1.5;
1659
+ stroke-dasharray: none;
1660
+ stroke: ${options.signalColor};
1661
+ }
1662
+
1663
+ .messageLine1 {
1664
+ stroke-width: 1.5;
1665
+ stroke-dasharray: 2, 2;
1666
+ stroke: ${options.signalColor};
1667
+ }
1668
+
1669
+ #arrowhead path {
1670
+ fill: ${options.signalColor};
1671
+ stroke: ${options.signalColor};
1672
+ }
1673
+
1674
+ .sequenceNumber {
1675
+ fill: ${options.sequenceNumberColor};
1676
+ }
1677
+
1678
+ #sequencenumber {
1679
+ fill: ${options.signalColor};
1680
+ }
1681
+
1682
+ #crosshead path {
1683
+ fill: ${options.signalColor};
1684
+ stroke: ${options.signalColor};
1685
+ }
1686
+
1687
+ .messageText {
1688
+ fill: ${options.signalTextColor};
1689
+ stroke: none;
1690
+ }
1691
+
1692
+ .labelBox {
1693
+ stroke: ${options.labelBoxBorderColor};
1694
+ fill: ${options.labelBoxBkgColor};
1695
+ }
1696
+
1697
+ .labelText, .labelText > tspan {
1698
+ fill: ${options.labelTextColor};
1699
+ stroke: none;
1700
+ }
1701
+
1702
+ .loopText, .loopText > tspan {
1703
+ fill: ${options.loopTextColor};
1704
+ stroke: none;
1705
+ }
1706
+
1707
+ .loopLine {
1708
+ stroke-width: 2px;
1709
+ stroke-dasharray: 2, 2;
1710
+ stroke: ${options.labelBoxBorderColor};
1711
+ fill: ${options.labelBoxBorderColor};
1712
+ }
1713
+
1714
+ .note {
1715
+ //stroke: #decc93;
1716
+ stroke: ${options.noteBorderColor};
1717
+ fill: ${options.noteBkgColor};
1718
+ }
1719
+
1720
+ .noteText, .noteText > tspan {
1721
+ fill: ${options.noteTextColor};
1722
+ stroke: none;
1723
+ }
1724
+
1725
+ .activation0 {
1726
+ fill: ${options.activationBkgColor};
1727
+ stroke: ${options.activationBorderColor};
1728
+ }
1729
+
1730
+ .activation1 {
1731
+ fill: ${options.activationBkgColor};
1732
+ stroke: ${options.activationBorderColor};
1733
+ }
1734
+
1735
+ .activation2 {
1736
+ fill: ${options.activationBkgColor};
1737
+ stroke: ${options.activationBorderColor};
1738
+ }
1739
+
1740
+ .actorPopupMenu {
1741
+ position: absolute;
1742
+ }
1743
+
1744
+ .actorPopupMenuPanel {
1745
+ position: absolute;
1746
+ fill: ${options.actorBkg};
1747
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
1748
+ filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
1749
+ }
1750
+ .actor-man line {
1751
+ stroke: ${options.actorBorder};
1752
+ fill: ${options.actorBkg};
1753
+ }
1754
+ .actor-man circle, line {
1755
+ stroke: ${options.actorBorder};
1756
+ fill: ${options.actorBkg};
1757
+ stroke-width: 2px;
1758
+ }
1759
+ `, "getStyles");
1760
+ var styles_default = getStyles;
1761
+
1762
+ // src/diagrams/sequence/sequenceRenderer.ts
1763
+
1764
+
1765
+ // src/diagrams/sequence/svgDraw.js
1766
+
1767
+ var ACTOR_TYPE_WIDTH = 18 * 2;
1768
+ var TOP_ACTOR_CLASS = "actor-top";
1769
+ var BOTTOM_ACTOR_CLASS = "actor-bottom";
1770
+ var ACTOR_BOX_CLASS = "actor-box";
1771
+ var ACTOR_MAN_FIGURE_CLASS = "actor-man";
1772
+ var drawRect2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, rectData) {
1773
+ return (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .drawRect */ .tk)(elem, rectData);
1774
+ }, "drawRect");
1775
+ var drawPopup = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, actor, minMenuWidth, textAttrs, forceMenus) {
1776
+ if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) {
1777
+ return { height: 0, width: 0 };
1778
+ }
1779
+ const links = actor.links;
1780
+ const actorCnt2 = actor.actorCnt;
1781
+ const rectData = actor.rectData;
1782
+ var displayValue = "none";
1783
+ if (forceMenus) {
1784
+ displayValue = "block !important";
1785
+ }
1786
+ const g = elem.append("g");
1787
+ g.attr("id", "actor" + actorCnt2 + "_popup");
1788
+ g.attr("class", "actorPopupMenu");
1789
+ g.attr("display", displayValue);
1790
+ var actorClass = "";
1791
+ if (rectData.class !== void 0) {
1792
+ actorClass = " " + rectData.class;
1793
+ }
1794
+ let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
1795
+ const rectElem = g.append("rect");
1796
+ rectElem.attr("class", "actorPopupMenuPanel" + actorClass);
1797
+ rectElem.attr("x", rectData.x);
1798
+ rectElem.attr("y", rectData.height);
1799
+ rectElem.attr("fill", rectData.fill);
1800
+ rectElem.attr("stroke", rectData.stroke);
1801
+ rectElem.attr("width", menuWidth);
1802
+ rectElem.attr("height", rectData.height);
1803
+ rectElem.attr("rx", rectData.rx);
1804
+ rectElem.attr("ry", rectData.ry);
1805
+ if (links != null) {
1806
+ var linkY = 20;
1807
+ for (let key in links) {
1808
+ var linkElem = g.append("a");
1809
+ var sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_5__/* .sanitizeUrl */ .J)(links[key]);
1810
+ linkElem.attr("xlink:href", sanitizedLink);
1811
+ linkElem.attr("target", "_blank");
1812
+ _drawMenuItemTextCandidateFunc(textAttrs)(
1813
+ key,
1814
+ linkElem,
1815
+ rectData.x + 10,
1816
+ rectData.height + linkY,
1817
+ menuWidth,
1818
+ 20,
1819
+ { class: "actor" },
1820
+ textAttrs
1821
+ );
1822
+ linkY += 30;
1823
+ }
1824
+ }
1825
+ rectElem.attr("height", linkY);
1826
+ return { height: rectData.height + linkY, width: menuWidth };
1827
+ }, "drawPopup");
1828
+ var popupMenuToggle = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(popId) {
1829
+ return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
1830
+ }, "popupMenuToggle");
1831
+ var drawKatex = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(elem, textData, msgModel = null) {
1832
+ let textElem = elem.append("foreignObject");
1833
+ const lines = await (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .renderKatex */ .VJ)(textData.text, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig */ .zj)());
1834
+ const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(lines);
1835
+ const dim = divElem.node().getBoundingClientRect();
1836
+ textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width));
1837
+ if (textData.class === "noteText") {
1838
+ const rectElem = elem.node().firstChild;
1839
+ rectElem.setAttribute("height", dim.height + 2 * textData.textMargin);
1840
+ const rectDim = rectElem.getBBox();
1841
+ textElem.attr("x", Math.round(rectDim.x + rectDim.width / 2 - dim.width / 2)).attr("y", Math.round(rectDim.y + rectDim.height / 2 - dim.height / 2));
1842
+ } else if (msgModel) {
1843
+ let { startx, stopx, starty } = msgModel;
1844
+ if (startx > stopx) {
1845
+ const temp = startx;
1846
+ startx = stopx;
1847
+ stopx = temp;
1848
+ }
1849
+ textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2));
1850
+ if (textData.class === "loopText") {
1851
+ textElem.attr("y", Math.round(starty));
1852
+ } else {
1853
+ textElem.attr("y", Math.round(starty - dim.height));
1854
+ }
1855
+ }
1856
+ return [textElem];
1857
+ }, "drawKatex");
1858
+ var drawText = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, textData) {
1859
+ let prevTextHeight = 0;
1860
+ let textHeight = 0;
1861
+ const lines = textData.text.split(_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.lineBreakRegex);
1862
+ const [_textFontSize, _textFontSizePx] = (0,_chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .parseFontSize */ .I5)(textData.fontSize);
1863
+ let textElems = [];
1864
+ let dy = 0;
1865
+ let yfunc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => textData.y, "yfunc");
1866
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1867
+ switch (textData.valign) {
1868
+ case "top":
1869
+ case "start":
1870
+ yfunc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => Math.round(textData.y + textData.textMargin), "yfunc");
1871
+ break;
1872
+ case "middle":
1873
+ case "center":
1874
+ yfunc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2), "yfunc");
1875
+ break;
1876
+ case "bottom":
1877
+ case "end":
1878
+ yfunc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => Math.round(
1879
+ textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin
1880
+ ), "yfunc");
1881
+ break;
1882
+ }
1883
+ }
1884
+ if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) {
1885
+ switch (textData.anchor) {
1886
+ case "left":
1887
+ case "start":
1888
+ textData.x = Math.round(textData.x + textData.textMargin);
1889
+ textData.anchor = "start";
1890
+ textData.dominantBaseline = "middle";
1891
+ textData.alignmentBaseline = "middle";
1892
+ break;
1893
+ case "middle":
1894
+ case "center":
1895
+ textData.x = Math.round(textData.x + textData.width / 2);
1896
+ textData.anchor = "middle";
1897
+ textData.dominantBaseline = "middle";
1898
+ textData.alignmentBaseline = "middle";
1899
+ break;
1900
+ case "right":
1901
+ case "end":
1902
+ textData.x = Math.round(textData.x + textData.width - textData.textMargin);
1903
+ textData.anchor = "end";
1904
+ textData.dominantBaseline = "middle";
1905
+ textData.alignmentBaseline = "middle";
1906
+ break;
1907
+ }
1908
+ }
1909
+ for (let [i, line] of lines.entries()) {
1910
+ if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) {
1911
+ dy = i * _textFontSize;
1912
+ }
1913
+ const textElem = elem.append("text");
1914
+ textElem.attr("x", textData.x);
1915
+ textElem.attr("y", yfunc());
1916
+ if (textData.anchor !== void 0) {
1917
+ textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline);
1918
+ }
1919
+ if (textData.fontFamily !== void 0) {
1920
+ textElem.style("font-family", textData.fontFamily);
1921
+ }
1922
+ if (_textFontSizePx !== void 0) {
1923
+ textElem.style("font-size", _textFontSizePx);
1924
+ }
1925
+ if (textData.fontWeight !== void 0) {
1926
+ textElem.style("font-weight", textData.fontWeight);
1927
+ }
1928
+ if (textData.fill !== void 0) {
1929
+ textElem.attr("fill", textData.fill);
1930
+ }
1931
+ if (textData.class !== void 0) {
1932
+ textElem.attr("class", textData.class);
1933
+ }
1934
+ if (textData.dy !== void 0) {
1935
+ textElem.attr("dy", textData.dy);
1936
+ } else if (dy !== 0) {
1937
+ textElem.attr("dy", dy);
1938
+ }
1939
+ const text = line || _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .ZERO_WIDTH_SPACE */ .pe;
1940
+ if (textData.tspan) {
1941
+ const span = textElem.append("tspan");
1942
+ span.attr("x", textData.x);
1943
+ if (textData.fill !== void 0) {
1944
+ span.attr("fill", textData.fill);
1945
+ }
1946
+ span.text(text);
1947
+ } else {
1948
+ textElem.text(text);
1949
+ }
1950
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1951
+ textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
1952
+ prevTextHeight = textHeight;
1953
+ }
1954
+ textElems.push(textElem);
1955
+ }
1956
+ return textElems;
1957
+ }, "drawText");
1958
+ var drawLabel = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, txtObject) {
1959
+ function genPoints(x, y, width, height, cut) {
1960
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
1961
+ }
1962
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(genPoints, "genPoints");
1963
+ const polygon = elem.append("polygon");
1964
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
1965
+ polygon.attr("class", "labelBox");
1966
+ txtObject.y = txtObject.y + txtObject.height / 2;
1967
+ drawText(elem, txtObject);
1968
+ return polygon;
1969
+ }, "drawLabel");
1970
+ var actorCnt = -1;
1971
+ var fixLifeLineHeights = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((diagram2, actors, actorKeys, conf2) => {
1972
+ if (!diagram2.select) {
1973
+ return;
1974
+ }
1975
+ actorKeys.forEach((actorKey) => {
1976
+ const actor = actors.get(actorKey);
1977
+ const actorDOM = diagram2.select("#actor" + actor.actorCnt);
1978
+ if (!conf2.mirrorActors && actor.stopy) {
1979
+ actorDOM.attr("y2", actor.stopy + actor.height / 2);
1980
+ } else if (conf2.mirrorActors) {
1981
+ actorDOM.attr("y2", actor.stopy);
1982
+ }
1983
+ });
1984
+ }, "fixLifeLineHeights");
1985
+ var drawActorTypeParticipant = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, actor, conf2, isFooter) {
1986
+ const actorY = isFooter ? actor.stopy : actor.starty;
1987
+ const center = actor.x + actor.width / 2;
1988
+ const centerY = actorY + actor.height;
1989
+ const boxplusLineGroup = elem.append("g").lower();
1990
+ var g = boxplusLineGroup;
1991
+ if (!isFooter) {
1992
+ actorCnt++;
1993
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
1994
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
1995
+ }
1996
+ g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name);
1997
+ g = boxplusLineGroup.append("g");
1998
+ actor.actorCnt = actorCnt;
1999
+ if (actor.links != null) {
2000
+ g.attr("id", "root-" + actorCnt);
2001
+ }
2002
+ }
2003
+ const rect = (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getNoteRect */ .PB)();
2004
+ var cssclass = "actor";
2005
+ if (actor.properties?.class) {
2006
+ cssclass = actor.properties.class;
2007
+ } else {
2008
+ rect.fill = "#eaeaea";
2009
+ }
2010
+ if (isFooter) {
2011
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2012
+ } else {
2013
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2014
+ }
2015
+ rect.x = actor.x;
2016
+ rect.y = actorY;
2017
+ rect.width = actor.width;
2018
+ rect.height = actor.height;
2019
+ rect.class = cssclass;
2020
+ rect.rx = 3;
2021
+ rect.ry = 3;
2022
+ rect.name = actor.name;
2023
+ const rectElem = drawRect2(g, rect);
2024
+ actor.rectData = rect;
2025
+ if (actor.properties?.icon) {
2026
+ const iconSrc = actor.properties.icon.trim();
2027
+ if (iconSrc.charAt(0) === "@") {
2028
+ (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .drawEmbeddedImage */ .CP)(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
2029
+ } else {
2030
+ (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .drawImage */ .aC)(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
2031
+ }
2032
+ }
2033
+ _drawTextCandidateFunc(conf2, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(actor.description))(
2034
+ actor.description,
2035
+ g,
2036
+ rect.x,
2037
+ rect.y,
2038
+ rect.width,
2039
+ rect.height,
2040
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2041
+ conf2
2042
+ );
2043
+ let height = actor.height;
2044
+ if (rectElem.node) {
2045
+ const bounds2 = rectElem.node().getBBox();
2046
+ actor.height = bounds2.height;
2047
+ height = bounds2.height;
2048
+ }
2049
+ return height;
2050
+ }, "drawActorTypeParticipant");
2051
+ var drawActorTypeActor = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, actor, conf2, isFooter) {
2052
+ const actorY = isFooter ? actor.stopy : actor.starty;
2053
+ const center = actor.x + actor.width / 2;
2054
+ const centerY = actorY + 80;
2055
+ const line = elem.append("g").lower();
2056
+ if (!isFooter) {
2057
+ actorCnt++;
2058
+ line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name);
2059
+ actor.actorCnt = actorCnt;
2060
+ }
2061
+ const actElem = elem.append("g");
2062
+ let cssClass = ACTOR_MAN_FIGURE_CLASS;
2063
+ if (isFooter) {
2064
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2065
+ } else {
2066
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2067
+ }
2068
+ actElem.attr("class", cssClass);
2069
+ actElem.attr("name", actor.name);
2070
+ const rect = (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getNoteRect */ .PB)();
2071
+ rect.x = actor.x;
2072
+ rect.y = actorY;
2073
+ rect.fill = "#eaeaea";
2074
+ rect.width = actor.width;
2075
+ rect.height = actor.height;
2076
+ rect.class = "actor";
2077
+ rect.rx = 3;
2078
+ rect.ry = 3;
2079
+ actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center).attr("y1", actorY + 25).attr("x2", center).attr("y2", actorY + 45);
2080
+ actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center - ACTOR_TYPE_WIDTH / 2).attr("y1", actorY + 33).attr("x2", center + ACTOR_TYPE_WIDTH / 2).attr("y2", actorY + 33);
2081
+ actElem.append("line").attr("x1", center - ACTOR_TYPE_WIDTH / 2).attr("y1", actorY + 60).attr("x2", center).attr("y2", actorY + 45);
2082
+ actElem.append("line").attr("x1", center).attr("y1", actorY + 45).attr("x2", center + ACTOR_TYPE_WIDTH / 2 - 2).attr("y2", actorY + 60);
2083
+ const circle = actElem.append("circle");
2084
+ circle.attr("cx", actor.x + actor.width / 2);
2085
+ circle.attr("cy", actorY + 10);
2086
+ circle.attr("r", 15);
2087
+ circle.attr("width", actor.width);
2088
+ circle.attr("height", actor.height);
2089
+ const bounds2 = actElem.node().getBBox();
2090
+ actor.height = bounds2.height;
2091
+ _drawTextCandidateFunc(conf2, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(actor.description))(
2092
+ actor.description,
2093
+ actElem,
2094
+ rect.x,
2095
+ rect.y + 35,
2096
+ rect.width,
2097
+ rect.height,
2098
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2099
+ conf2
2100
+ );
2101
+ return actor.height;
2102
+ }, "drawActorTypeActor");
2103
+ var drawActor = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(elem, actor, conf2, isFooter) {
2104
+ switch (actor.type) {
2105
+ case "actor":
2106
+ return await drawActorTypeActor(elem, actor, conf2, isFooter);
2107
+ case "participant":
2108
+ return await drawActorTypeParticipant(elem, actor, conf2, isFooter);
2109
+ }
2110
+ }, "drawActor");
2111
+ var drawBox = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, box, conf2) {
2112
+ const boxplusTextGroup = elem.append("g");
2113
+ const g = boxplusTextGroup;
2114
+ drawBackgroundRect2(g, box);
2115
+ if (box.name) {
2116
+ _drawTextCandidateFunc(conf2)(
2117
+ box.name,
2118
+ g,
2119
+ box.x,
2120
+ box.y + (box.textMaxHeight || 0) / 2,
2121
+ box.width,
2122
+ 0,
2123
+ { class: "text" },
2124
+ conf2
2125
+ );
2126
+ }
2127
+ g.lower();
2128
+ }, "drawBox");
2129
+ var anchorElement = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2130
+ return elem.append("g");
2131
+ }, "anchorElement");
2132
+ var drawActivation = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, bounds2, verticalPos, conf2, actorActivations2) {
2133
+ const rect = (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getNoteRect */ .PB)();
2134
+ const g = bounds2.anchored;
2135
+ rect.x = bounds2.startx;
2136
+ rect.y = bounds2.starty;
2137
+ rect.class = "activation" + actorActivations2 % 3;
2138
+ rect.width = bounds2.stopx - bounds2.startx;
2139
+ rect.height = verticalPos - bounds2.starty;
2140
+ drawRect2(g, rect);
2141
+ }, "drawActivation");
2142
+ var drawLoop = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(elem, loopModel, labelText, conf2) {
2143
+ const {
2144
+ boxMargin,
2145
+ boxTextMargin,
2146
+ labelBoxHeight,
2147
+ labelBoxWidth,
2148
+ messageFontFamily: fontFamily,
2149
+ messageFontSize: fontSize,
2150
+ messageFontWeight: fontWeight
2151
+ } = conf2;
2152
+ const g = elem.append("g");
2153
+ const drawLoopLine = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(startx, starty, stopx, stopy) {
2154
+ return g.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine");
2155
+ }, "drawLoopLine");
2156
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
2157
+ drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
2158
+ drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
2159
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
2160
+ if (loopModel.sections !== void 0) {
2161
+ loopModel.sections.forEach(function(item) {
2162
+ drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
2163
+ "stroke-dasharray",
2164
+ "3, 3"
2165
+ );
2166
+ });
2167
+ }
2168
+ let txt = (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getTextObj */ .HT)();
2169
+ txt.text = labelText;
2170
+ txt.x = loopModel.startx;
2171
+ txt.y = loopModel.starty;
2172
+ txt.fontFamily = fontFamily;
2173
+ txt.fontSize = fontSize;
2174
+ txt.fontWeight = fontWeight;
2175
+ txt.anchor = "middle";
2176
+ txt.valign = "middle";
2177
+ txt.tspan = false;
2178
+ txt.width = labelBoxWidth || 50;
2179
+ txt.height = labelBoxHeight || 20;
2180
+ txt.textMargin = boxTextMargin;
2181
+ txt.class = "labelText";
2182
+ drawLabel(g, txt);
2183
+ txt = getTextObj2();
2184
+ txt.text = loopModel.title;
2185
+ txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
2186
+ txt.y = loopModel.starty + boxMargin + boxTextMargin;
2187
+ txt.anchor = "middle";
2188
+ txt.valign = "middle";
2189
+ txt.textMargin = boxTextMargin;
2190
+ txt.class = "loopText";
2191
+ txt.fontFamily = fontFamily;
2192
+ txt.fontSize = fontSize;
2193
+ txt.fontWeight = fontWeight;
2194
+ txt.wrap = true;
2195
+ let textElem = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(txt.text) ? await drawKatex(g, txt, loopModel) : drawText(g, txt);
2196
+ if (loopModel.sectionTitles !== void 0) {
2197
+ for (const [idx, item] of Object.entries(loopModel.sectionTitles)) {
2198
+ if (item.message) {
2199
+ txt.text = item.message;
2200
+ txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
2201
+ txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
2202
+ txt.class = "loopText";
2203
+ txt.anchor = "middle";
2204
+ txt.valign = "middle";
2205
+ txt.tspan = false;
2206
+ txt.fontFamily = fontFamily;
2207
+ txt.fontSize = fontSize;
2208
+ txt.fontWeight = fontWeight;
2209
+ txt.wrap = loopModel.wrap;
2210
+ if ((0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(txt.text)) {
2211
+ loopModel.starty = loopModel.sections[idx].y;
2212
+ await drawKatex(g, txt, loopModel);
2213
+ } else {
2214
+ drawText(g, txt);
2215
+ }
2216
+ let sectionHeight = Math.round(
2217
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
2218
+ );
2219
+ loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
2220
+ }
2221
+ }
2222
+ }
2223
+ loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
2224
+ return g;
2225
+ }, "drawLoop");
2226
+ var drawBackgroundRect2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem, bounds2) {
2227
+ (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .drawBackgroundRect */ .lC)(elem, bounds2);
2228
+ }, "drawBackgroundRect");
2229
+ var insertDatabaseIcon = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2230
+ elem.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
2231
+ "d",
2232
+ "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"
2233
+ );
2234
+ }, "insertDatabaseIcon");
2235
+ var insertComputerIcon = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2236
+ elem.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2237
+ "d",
2238
+ "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"
2239
+ );
2240
+ }, "insertComputerIcon");
2241
+ var insertClockIcon = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2242
+ elem.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2243
+ "d",
2244
+ "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"
2245
+ );
2246
+ }, "insertClockIcon");
2247
+ var insertArrowHead = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2248
+ elem.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-start-reverse").append("path").attr("d", "M -1 0 L 10 5 L 0 10 z");
2249
+ }, "insertArrowHead");
2250
+ var insertArrowFilledHead = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2251
+ elem.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");
2252
+ }, "insertArrowFilledHead");
2253
+ var insertSequenceNumber = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2254
+ elem.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);
2255
+ }, "insertSequenceNumber");
2256
+ var insertArrowCrossHead = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(elem) {
2257
+ const defs = elem.append("defs");
2258
+ const marker = defs.append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5);
2259
+ marker.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");
2260
+ }, "insertArrowCrossHead");
2261
+ var getTextObj2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2262
+ return {
2263
+ x: 0,
2264
+ y: 0,
2265
+ fill: void 0,
2266
+ anchor: void 0,
2267
+ style: "#666",
2268
+ width: void 0,
2269
+ height: void 0,
2270
+ textMargin: 0,
2271
+ rx: 0,
2272
+ ry: 0,
2273
+ tspan: true,
2274
+ valign: void 0
2275
+ };
2276
+ }, "getTextObj");
2277
+ var getNoteRect2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2278
+ return {
2279
+ x: 0,
2280
+ y: 0,
2281
+ fill: "#EDF2AE",
2282
+ stroke: "#666",
2283
+ width: 100,
2284
+ anchor: "start",
2285
+ height: 100,
2286
+ rx: 0,
2287
+ ry: 0
2288
+ };
2289
+ }, "getNoteRect");
2290
+ var _drawTextCandidateFunc = /* @__PURE__ */ function() {
2291
+ function byText(content, g, x, y, width, height, textAttrs) {
2292
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
2293
+ _setTextAttrs(text, textAttrs);
2294
+ }
2295
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(byText, "byText");
2296
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2297
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2298
+ const [_actorFontSize, _actorFontSizePx] = (0,_chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .parseFontSize */ .I5)(actorFontSize);
2299
+ const lines = content.split(_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.lineBreakRegex);
2300
+ for (let i = 0; i < lines.length; i++) {
2301
+ const dy = i * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
2302
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").style("font-size", _actorFontSizePx).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
2303
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
2304
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2305
+ _setTextAttrs(text, textAttrs);
2306
+ }
2307
+ }
2308
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(byTspan, "byTspan");
2309
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2310
+ const s = g.append("switch");
2311
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2312
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2313
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2314
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2315
+ _setTextAttrs(text, textAttrs);
2316
+ }
2317
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(byFo, "byFo");
2318
+ async function byKatex(content, g, x, y, width, height, textAttrs, conf2) {
2319
+ const dim = await (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .calculateMathMLDimensions */ .Dl)(content, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig */ .zj)());
2320
+ const s = g.append("switch");
2321
+ const f = s.append("foreignObject").attr("x", x + width / 2 - dim.width / 2).attr("y", y + height / 2 - dim.height / 2).attr("width", dim.width).attr("height", dim.height);
2322
+ const text = f.append("xhtml:div").style("height", "100%").style("width", "100%");
2323
+ text.append("div").style("text-align", "center").style("vertical-align", "middle").html(await (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .renderKatex */ .VJ)(content, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig */ .zj)()));
2324
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2325
+ _setTextAttrs(text, textAttrs);
2326
+ }
2327
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(byKatex, "byKatex");
2328
+ function _setTextAttrs(toText, fromTextAttrsDict) {
2329
+ for (const key in fromTextAttrsDict) {
2330
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
2331
+ toText.attr(key, fromTextAttrsDict[key]);
2332
+ }
2333
+ }
2334
+ }
2335
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(_setTextAttrs, "_setTextAttrs");
2336
+ return function(conf2, hasKatex2 = false) {
2337
+ if (hasKatex2) {
2338
+ return byKatex;
2339
+ }
2340
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2341
+ };
2342
+ }();
2343
+ var _drawMenuItemTextCandidateFunc = /* @__PURE__ */ function() {
2344
+ function byText(content, g, x, y, width, height, textAttrs) {
2345
+ const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").text(content);
2346
+ _setTextAttrs(text, textAttrs);
2347
+ }
2348
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(byText, "byText");
2349
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2350
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2351
+ const lines = content.split(_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.lineBreakRegex);
2352
+ for (let i = 0; i < lines.length; i++) {
2353
+ const dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
2354
+ const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").style("font-size", actorFontSize).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
2355
+ text.append("tspan").attr("x", x).attr("dy", dy).text(lines[i]);
2356
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2357
+ _setTextAttrs(text, textAttrs);
2358
+ }
2359
+ }
2360
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(byTspan, "byTspan");
2361
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2362
+ const s = g.append("switch");
2363
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2364
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2365
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2366
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2367
+ _setTextAttrs(text, textAttrs);
2368
+ }
2369
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(byFo, "byFo");
2370
+ function _setTextAttrs(toText, fromTextAttrsDict) {
2371
+ for (const key in fromTextAttrsDict) {
2372
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
2373
+ toText.attr(key, fromTextAttrsDict[key]);
2374
+ }
2375
+ }
2376
+ }
2377
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(_setTextAttrs, "_setTextAttrs");
2378
+ return function(conf2) {
2379
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2380
+ };
2381
+ }();
2382
+ var svgDraw_default = {
2383
+ drawRect: drawRect2,
2384
+ drawText,
2385
+ drawLabel,
2386
+ drawActor,
2387
+ drawBox,
2388
+ drawPopup,
2389
+ anchorElement,
2390
+ drawActivation,
2391
+ drawLoop,
2392
+ drawBackgroundRect: drawBackgroundRect2,
2393
+ insertArrowHead,
2394
+ insertArrowFilledHead,
2395
+ insertSequenceNumber,
2396
+ insertArrowCrossHead,
2397
+ insertDatabaseIcon,
2398
+ insertComputerIcon,
2399
+ insertClockIcon,
2400
+ getTextObj: getTextObj2,
2401
+ getNoteRect: getNoteRect2,
2402
+ fixLifeLineHeights,
2403
+ sanitizeUrl: _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_5__/* .sanitizeUrl */ .J
2404
+ };
2405
+
2406
+ // src/diagrams/sequence/sequenceRenderer.ts
2407
+ var conf = {};
2408
+ var bounds = {
2409
+ data: {
2410
+ startx: void 0,
2411
+ stopx: void 0,
2412
+ starty: void 0,
2413
+ stopy: void 0
2414
+ },
2415
+ verticalPos: 0,
2416
+ sequenceItems: [],
2417
+ activations: [],
2418
+ models: {
2419
+ getHeight: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2420
+ return Math.max.apply(
2421
+ null,
2422
+ this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
2423
+ ) + (this.loops.length === 0 ? 0 : this.loops.map((it) => it.height || 0).reduce((acc, h) => acc + h)) + (this.messages.length === 0 ? 0 : this.messages.map((it) => it.height || 0).reduce((acc, h) => acc + h)) + (this.notes.length === 0 ? 0 : this.notes.map((it) => it.height || 0).reduce((acc, h) => acc + h));
2424
+ }, "getHeight"),
2425
+ clear: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2426
+ this.actors = [];
2427
+ this.boxes = [];
2428
+ this.loops = [];
2429
+ this.messages = [];
2430
+ this.notes = [];
2431
+ }, "clear"),
2432
+ addBox: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(boxModel) {
2433
+ this.boxes.push(boxModel);
2434
+ }, "addBox"),
2435
+ addActor: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actorModel) {
2436
+ this.actors.push(actorModel);
2437
+ }, "addActor"),
2438
+ addLoop: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(loopModel) {
2439
+ this.loops.push(loopModel);
2440
+ }, "addLoop"),
2441
+ addMessage: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(msgModel) {
2442
+ this.messages.push(msgModel);
2443
+ }, "addMessage"),
2444
+ addNote: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(noteModel) {
2445
+ this.notes.push(noteModel);
2446
+ }, "addNote"),
2447
+ lastActor: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2448
+ return this.actors[this.actors.length - 1];
2449
+ }, "lastActor"),
2450
+ lastLoop: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2451
+ return this.loops[this.loops.length - 1];
2452
+ }, "lastLoop"),
2453
+ lastMessage: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2454
+ return this.messages[this.messages.length - 1];
2455
+ }, "lastMessage"),
2456
+ lastNote: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2457
+ return this.notes[this.notes.length - 1];
2458
+ }, "lastNote"),
2459
+ actors: [],
2460
+ boxes: [],
2461
+ loops: [],
2462
+ messages: [],
2463
+ notes: []
2464
+ },
2465
+ init: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2466
+ this.sequenceItems = [];
2467
+ this.activations = [];
2468
+ this.models.clear();
2469
+ this.data = {
2470
+ startx: void 0,
2471
+ stopx: void 0,
2472
+ starty: void 0,
2473
+ stopy: void 0
2474
+ };
2475
+ this.verticalPos = 0;
2476
+ setConf((0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
2477
+ }, "init"),
2478
+ updateVal: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(obj, key, val, fun) {
2479
+ if (obj[key] === void 0) {
2480
+ obj[key] = val;
2481
+ } else {
2482
+ obj[key] = fun(val, obj[key]);
2483
+ }
2484
+ }, "updateVal"),
2485
+ updateBounds: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(startx, starty, stopx, stopy) {
2486
+ const _self = this;
2487
+ let cnt = 0;
2488
+ function updateFn(type) {
2489
+ return /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function updateItemBounds(item) {
2490
+ cnt++;
2491
+ const n = _self.sequenceItems.length - cnt + 1;
2492
+ _self.updateVal(item, "starty", starty - n * conf.boxMargin, Math.min);
2493
+ _self.updateVal(item, "stopy", stopy + n * conf.boxMargin, Math.max);
2494
+ _self.updateVal(bounds.data, "startx", startx - n * conf.boxMargin, Math.min);
2495
+ _self.updateVal(bounds.data, "stopx", stopx + n * conf.boxMargin, Math.max);
2496
+ if (!(type === "activation")) {
2497
+ _self.updateVal(item, "startx", startx - n * conf.boxMargin, Math.min);
2498
+ _self.updateVal(item, "stopx", stopx + n * conf.boxMargin, Math.max);
2499
+ _self.updateVal(bounds.data, "starty", starty - n * conf.boxMargin, Math.min);
2500
+ _self.updateVal(bounds.data, "stopy", stopy + n * conf.boxMargin, Math.max);
2501
+ }
2502
+ }, "updateItemBounds");
2503
+ }
2504
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(updateFn, "updateFn");
2505
+ this.sequenceItems.forEach(updateFn());
2506
+ this.activations.forEach(updateFn("activation"));
2507
+ }, "updateBounds"),
2508
+ insert: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(startx, starty, stopx, stopy) {
2509
+ const _startx = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMin(startx, stopx);
2510
+ const _stopx = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(startx, stopx);
2511
+ const _starty = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMin(starty, stopy);
2512
+ const _stopy = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(starty, stopy);
2513
+ this.updateVal(bounds.data, "startx", _startx, Math.min);
2514
+ this.updateVal(bounds.data, "starty", _starty, Math.min);
2515
+ this.updateVal(bounds.data, "stopx", _stopx, Math.max);
2516
+ this.updateVal(bounds.data, "stopy", _stopy, Math.max);
2517
+ this.updateBounds(_startx, _starty, _stopx, _stopy);
2518
+ }, "insert"),
2519
+ newActivation: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(message, diagram2, actors) {
2520
+ const actorRect = actors.get(message.from);
2521
+ const stackedSize = actorActivations(message.from).length || 0;
2522
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
2523
+ this.activations.push({
2524
+ startx: x,
2525
+ starty: this.verticalPos + 2,
2526
+ stopx: x + conf.activationWidth,
2527
+ stopy: void 0,
2528
+ actor: message.from,
2529
+ anchored: svgDraw_default.anchorElement(diagram2)
2530
+ });
2531
+ }, "newActivation"),
2532
+ endActivation: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(message) {
2533
+ const lastActorActivationIdx = this.activations.map(function(activation) {
2534
+ return activation.actor;
2535
+ }).lastIndexOf(message.from);
2536
+ return this.activations.splice(lastActorActivationIdx, 1)[0];
2537
+ }, "endActivation"),
2538
+ createLoop: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
2539
+ return {
2540
+ startx: void 0,
2541
+ starty: this.verticalPos,
2542
+ stopx: void 0,
2543
+ stopy: void 0,
2544
+ title: title.message,
2545
+ wrap: title.wrap,
2546
+ width: title.width,
2547
+ height: 0,
2548
+ fill
2549
+ };
2550
+ }, "createLoop"),
2551
+ newLoop: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
2552
+ this.sequenceItems.push(this.createLoop(title, fill));
2553
+ }, "newLoop"),
2554
+ endLoop: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2555
+ return this.sequenceItems.pop();
2556
+ }, "endLoop"),
2557
+ isLoopOverlap: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2558
+ return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false;
2559
+ }, "isLoopOverlap"),
2560
+ addSectionToLoop: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(message) {
2561
+ const loop = this.sequenceItems.pop();
2562
+ loop.sections = loop.sections || [];
2563
+ loop.sectionTitles = loop.sectionTitles || [];
2564
+ loop.sections.push({ y: bounds.getVerticalPos(), height: 0 });
2565
+ loop.sectionTitles.push(message);
2566
+ this.sequenceItems.push(loop);
2567
+ }, "addSectionToLoop"),
2568
+ saveVerticalPos: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2569
+ if (this.isLoopOverlap()) {
2570
+ this.savedVerticalPos = this.verticalPos;
2571
+ }
2572
+ }, "saveVerticalPos"),
2573
+ resetVerticalPos: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2574
+ if (this.isLoopOverlap()) {
2575
+ this.verticalPos = this.savedVerticalPos;
2576
+ }
2577
+ }, "resetVerticalPos"),
2578
+ bumpVerticalPos: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(bump) {
2579
+ this.verticalPos = this.verticalPos + bump;
2580
+ this.data.stopy = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(this.data.stopy, this.verticalPos);
2581
+ }, "bumpVerticalPos"),
2582
+ getVerticalPos: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2583
+ return this.verticalPos;
2584
+ }, "getVerticalPos"),
2585
+ getBounds: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
2586
+ return { bounds: this.data, models: this.models };
2587
+ }, "getBounds")
2588
+ };
2589
+ var drawNote = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(elem, noteModel) {
2590
+ bounds.bumpVerticalPos(conf.boxMargin);
2591
+ noteModel.height = conf.boxMargin;
2592
+ noteModel.starty = bounds.getVerticalPos();
2593
+ const rect = (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getNoteRect */ .PB)();
2594
+ rect.x = noteModel.startx;
2595
+ rect.y = noteModel.starty;
2596
+ rect.width = noteModel.width || conf.width;
2597
+ rect.class = "note";
2598
+ const g = elem.append("g");
2599
+ const rectElem = svgDraw_default.drawRect(g, rect);
2600
+ const textObj = (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getTextObj */ .HT)();
2601
+ textObj.x = noteModel.startx;
2602
+ textObj.y = noteModel.starty;
2603
+ textObj.width = rect.width;
2604
+ textObj.dy = "1em";
2605
+ textObj.text = noteModel.message;
2606
+ textObj.class = "noteText";
2607
+ textObj.fontFamily = conf.noteFontFamily;
2608
+ textObj.fontSize = conf.noteFontSize;
2609
+ textObj.fontWeight = conf.noteFontWeight;
2610
+ textObj.anchor = conf.noteAlign;
2611
+ textObj.textMargin = conf.noteMargin;
2612
+ textObj.valign = "center";
2613
+ const textElem = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(textObj.text) ? await drawKatex(g, textObj) : drawText(g, textObj);
2614
+ const textHeight = Math.round(
2615
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
2616
+ );
2617
+ rectElem.attr("height", textHeight + 2 * conf.noteMargin);
2618
+ noteModel.height += textHeight + 2 * conf.noteMargin;
2619
+ bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
2620
+ noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
2621
+ noteModel.stopx = noteModel.startx + rect.width;
2622
+ bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
2623
+ bounds.models.addNote(noteModel);
2624
+ }, "drawNote");
2625
+ var messageFont = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((cnf) => {
2626
+ return {
2627
+ fontFamily: cnf.messageFontFamily,
2628
+ fontSize: cnf.messageFontSize,
2629
+ fontWeight: cnf.messageFontWeight
2630
+ };
2631
+ }, "messageFont");
2632
+ var noteFont = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((cnf) => {
2633
+ return {
2634
+ fontFamily: cnf.noteFontFamily,
2635
+ fontSize: cnf.noteFontSize,
2636
+ fontWeight: cnf.noteFontWeight
2637
+ };
2638
+ }, "noteFont");
2639
+ var actorFont = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((cnf) => {
2640
+ return {
2641
+ fontFamily: cnf.actorFontFamily,
2642
+ fontSize: cnf.actorFontSize,
2643
+ fontWeight: cnf.actorFontWeight
2644
+ };
2645
+ }, "actorFont");
2646
+ async function boundMessage(_diagram, msgModel) {
2647
+ bounds.bumpVerticalPos(10);
2648
+ const { startx, stopx, message } = msgModel;
2649
+ const lines = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.splitBreaks(message).length;
2650
+ const isKatexMsg = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(message);
2651
+ const textDims = isKatexMsg ? await (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .calculateMathMLDimensions */ .Dl)(message, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()) : _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(message, messageFont(conf));
2652
+ if (!isKatexMsg) {
2653
+ const lineHeight = textDims.height / lines;
2654
+ msgModel.height += lineHeight;
2655
+ bounds.bumpVerticalPos(lineHeight);
2656
+ }
2657
+ let lineStartY;
2658
+ let totalOffset = textDims.height - 10;
2659
+ const textWidth = textDims.width;
2660
+ if (startx === stopx) {
2661
+ lineStartY = bounds.getVerticalPos() + totalOffset;
2662
+ if (!conf.rightAngles) {
2663
+ totalOffset += conf.boxMargin;
2664
+ lineStartY = bounds.getVerticalPos() + totalOffset;
2665
+ }
2666
+ totalOffset += 30;
2667
+ const dx = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(textWidth / 2, conf.width / 2);
2668
+ bounds.insert(
2669
+ startx - dx,
2670
+ bounds.getVerticalPos() - 10 + totalOffset,
2671
+ stopx + dx,
2672
+ bounds.getVerticalPos() + 30 + totalOffset
2673
+ );
2674
+ } else {
2675
+ totalOffset += conf.boxMargin;
2676
+ lineStartY = bounds.getVerticalPos() + totalOffset;
2677
+ bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
2678
+ }
2679
+ bounds.bumpVerticalPos(totalOffset);
2680
+ msgModel.height += totalOffset;
2681
+ msgModel.stopy = msgModel.starty + msgModel.height;
2682
+ bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
2683
+ return lineStartY;
2684
+ }
2685
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(boundMessage, "boundMessage");
2686
+ var drawMessage = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(diagram2, msgModel, lineStartY, diagObj) {
2687
+ const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
2688
+ const textDims = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(message, messageFont(conf));
2689
+ const textObj = (0,_chunk_V35ELUW5_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getTextObj */ .HT)();
2690
+ textObj.x = startx;
2691
+ textObj.y = starty + 10;
2692
+ textObj.width = stopx - startx;
2693
+ textObj.class = "messageText";
2694
+ textObj.dy = "1em";
2695
+ textObj.text = message;
2696
+ textObj.fontFamily = conf.messageFontFamily;
2697
+ textObj.fontSize = conf.messageFontSize;
2698
+ textObj.fontWeight = conf.messageFontWeight;
2699
+ textObj.anchor = conf.messageAlign;
2700
+ textObj.valign = "center";
2701
+ textObj.textMargin = conf.wrapPadding;
2702
+ textObj.tspan = false;
2703
+ if ((0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(textObj.text)) {
2704
+ await drawKatex(diagram2, textObj, { startx, stopx, starty: lineStartY });
2705
+ } else {
2706
+ drawText(diagram2, textObj);
2707
+ }
2708
+ const textWidth = textDims.width;
2709
+ let line;
2710
+ if (startx === stopx) {
2711
+ if (conf.rightAngles) {
2712
+ line = diagram2.append("path").attr(
2713
+ "d",
2714
+ `M ${startx},${lineStartY} H ${startx + _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(conf.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}`
2715
+ );
2716
+ } else {
2717
+ line = diagram2.append("path").attr(
2718
+ "d",
2719
+ "M " + startx + "," + lineStartY + " C " + (startx + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20)
2720
+ );
2721
+ }
2722
+ } else {
2723
+ line = diagram2.append("line");
2724
+ line.attr("x1", startx);
2725
+ line.attr("y1", lineStartY);
2726
+ line.attr("x2", stopx);
2727
+ line.attr("y2", lineStartY);
2728
+ }
2729
+ if (type === diagObj.db.LINETYPE.DOTTED || type === diagObj.db.LINETYPE.DOTTED_CROSS || type === diagObj.db.LINETYPE.DOTTED_POINT || type === diagObj.db.LINETYPE.DOTTED_OPEN || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
2730
+ line.style("stroke-dasharray", "3, 3");
2731
+ line.attr("class", "messageLine1");
2732
+ } else {
2733
+ line.attr("class", "messageLine0");
2734
+ }
2735
+ let url = "";
2736
+ if (conf.arrowMarkerAbsolute) {
2737
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
2738
+ url = url.replace(/\(/g, "\\(");
2739
+ url = url.replace(/\)/g, "\\)");
2740
+ }
2741
+ line.attr("stroke-width", 2);
2742
+ line.attr("stroke", "none");
2743
+ line.style("fill", "none");
2744
+ if (type === diagObj.db.LINETYPE.SOLID || type === diagObj.db.LINETYPE.DOTTED) {
2745
+ line.attr("marker-end", "url(" + url + "#arrowhead)");
2746
+ }
2747
+ if (type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
2748
+ line.attr("marker-start", "url(" + url + "#arrowhead)");
2749
+ line.attr("marker-end", "url(" + url + "#arrowhead)");
2750
+ }
2751
+ if (type === diagObj.db.LINETYPE.SOLID_POINT || type === diagObj.db.LINETYPE.DOTTED_POINT) {
2752
+ line.attr("marker-end", "url(" + url + "#filled-head)");
2753
+ }
2754
+ if (type === diagObj.db.LINETYPE.SOLID_CROSS || type === diagObj.db.LINETYPE.DOTTED_CROSS) {
2755
+ line.attr("marker-end", "url(" + url + "#crosshead)");
2756
+ }
2757
+ if (sequenceVisible || conf.showSequenceNumbers) {
2758
+ line.attr("marker-start", "url(" + url + "#sequencenumber)");
2759
+ diagram2.append("text").attr("x", startx).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex);
2760
+ }
2761
+ }, "drawMessage");
2762
+ var addActorRenderingData = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(diagram2, actors, createdActors, actorKeys, verticalPos, messages, isFooter) {
2763
+ let prevWidth = 0;
2764
+ let prevMargin = 0;
2765
+ let prevBox = void 0;
2766
+ let maxHeight = 0;
2767
+ for (const actorKey of actorKeys) {
2768
+ const actor = actors.get(actorKey);
2769
+ const box = actor.box;
2770
+ if (prevBox && prevBox != box) {
2771
+ if (!isFooter) {
2772
+ bounds.models.addBox(prevBox);
2773
+ }
2774
+ prevMargin += conf.boxMargin + prevBox.margin;
2775
+ }
2776
+ if (box && box != prevBox) {
2777
+ if (!isFooter) {
2778
+ box.x = prevWidth + prevMargin;
2779
+ box.y = verticalPos;
2780
+ }
2781
+ prevMargin += box.margin;
2782
+ }
2783
+ actor.width = actor.width || conf.width;
2784
+ actor.height = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(actor.height || conf.height, conf.height);
2785
+ actor.margin = actor.margin || conf.actorMargin;
2786
+ maxHeight = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(maxHeight, actor.height);
2787
+ if (createdActors.get(actor.name)) {
2788
+ prevMargin += actor.width / 2;
2789
+ }
2790
+ actor.x = prevWidth + prevMargin;
2791
+ actor.starty = bounds.getVerticalPos();
2792
+ bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
2793
+ prevWidth += actor.width + prevMargin;
2794
+ if (actor.box) {
2795
+ actor.box.width = prevWidth + box.margin - actor.box.x;
2796
+ }
2797
+ prevMargin = actor.margin;
2798
+ prevBox = actor.box;
2799
+ bounds.models.addActor(actor);
2800
+ }
2801
+ if (prevBox && !isFooter) {
2802
+ bounds.models.addBox(prevBox);
2803
+ }
2804
+ bounds.bumpVerticalPos(maxHeight);
2805
+ }, "addActorRenderingData");
2806
+ var drawActors = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(diagram2, actors, actorKeys, isFooter) {
2807
+ if (!isFooter) {
2808
+ for (const actorKey of actorKeys) {
2809
+ const actor = actors.get(actorKey);
2810
+ await svgDraw_default.drawActor(diagram2, actor, conf, false);
2811
+ }
2812
+ } else {
2813
+ let maxHeight = 0;
2814
+ bounds.bumpVerticalPos(conf.boxMargin * 2);
2815
+ for (const actorKey of actorKeys) {
2816
+ const actor = actors.get(actorKey);
2817
+ if (!actor.stopy) {
2818
+ actor.stopy = bounds.getVerticalPos();
2819
+ }
2820
+ const height = await svgDraw_default.drawActor(diagram2, actor, conf, true);
2821
+ maxHeight = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(maxHeight, height);
2822
+ }
2823
+ bounds.bumpVerticalPos(maxHeight + conf.boxMargin);
2824
+ }
2825
+ }, "drawActors");
2826
+ var drawActorsPopup = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(diagram2, actors, actorKeys, doc) {
2827
+ let maxHeight = 0;
2828
+ let maxWidth = 0;
2829
+ for (const actorKey of actorKeys) {
2830
+ const actor = actors.get(actorKey);
2831
+ const minMenuWidth = getRequiredPopupWidth(actor);
2832
+ const menuDimensions = svgDraw_default.drawPopup(
2833
+ diagram2,
2834
+ actor,
2835
+ minMenuWidth,
2836
+ conf,
2837
+ conf.forceMenus,
2838
+ doc
2839
+ );
2840
+ if (menuDimensions.height > maxHeight) {
2841
+ maxHeight = menuDimensions.height;
2842
+ }
2843
+ if (menuDimensions.width + actor.x > maxWidth) {
2844
+ maxWidth = menuDimensions.width + actor.x;
2845
+ }
2846
+ }
2847
+ return { maxHeight, maxWidth };
2848
+ }, "drawActorsPopup");
2849
+ var setConf = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(cnf) {
2850
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .assignWithDepth_default */ .hH)(conf, cnf);
2851
+ if (cnf.fontFamily) {
2852
+ conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
2853
+ }
2854
+ if (cnf.fontSize) {
2855
+ conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
2856
+ }
2857
+ if (cnf.fontWeight) {
2858
+ conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
2859
+ }
2860
+ }, "setConf");
2861
+ var actorActivations = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actor) {
2862
+ return bounds.activations.filter(function(activation) {
2863
+ return activation.actor === actor;
2864
+ });
2865
+ }, "actorActivations");
2866
+ var activationBounds = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actor, actors) {
2867
+ const actorObj = actors.get(actor);
2868
+ const activations = actorActivations(actor);
2869
+ const left = activations.reduce(
2870
+ function(acc, activation) {
2871
+ return _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMin(acc, activation.startx);
2872
+ },
2873
+ actorObj.x + actorObj.width / 2 - 1
2874
+ );
2875
+ const right = activations.reduce(
2876
+ function(acc, activation) {
2877
+ return _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(acc, activation.stopx);
2878
+ },
2879
+ actorObj.x + actorObj.width / 2 + 1
2880
+ );
2881
+ return [left, right];
2882
+ }, "activationBounds");
2883
+ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
2884
+ bounds.bumpVerticalPos(preMargin);
2885
+ let heightAdjust = postMargin;
2886
+ if (msg.id && msg.message && loopWidths[msg.id]) {
2887
+ const loopWidth = loopWidths[msg.id].width;
2888
+ const textConf = messageFont(conf);
2889
+ msg.message = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
2890
+ msg.width = loopWidth;
2891
+ msg.wrap = true;
2892
+ const textDims = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(msg.message, textConf);
2893
+ const totalOffset = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(textDims.height, conf.labelBoxHeight);
2894
+ heightAdjust = postMargin + totalOffset;
2895
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug(`${totalOffset} - ${msg.message}`);
2896
+ }
2897
+ addLoopFn(msg);
2898
+ bounds.bumpVerticalPos(heightAdjust);
2899
+ }
2900
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(adjustLoopHeightForWrap, "adjustLoopHeightForWrap");
2901
+ function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors, createdActors, destroyedActors) {
2902
+ function receiverAdjustment(actor, adjustment) {
2903
+ if (actor.x < actors.get(msg.from).x) {
2904
+ bounds.insert(
2905
+ msgModel.stopx - adjustment,
2906
+ msgModel.starty,
2907
+ msgModel.startx,
2908
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2909
+ );
2910
+ msgModel.stopx = msgModel.stopx + adjustment;
2911
+ } else {
2912
+ bounds.insert(
2913
+ msgModel.startx,
2914
+ msgModel.starty,
2915
+ msgModel.stopx + adjustment,
2916
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2917
+ );
2918
+ msgModel.stopx = msgModel.stopx - adjustment;
2919
+ }
2920
+ }
2921
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(receiverAdjustment, "receiverAdjustment");
2922
+ function senderAdjustment(actor, adjustment) {
2923
+ if (actor.x < actors.get(msg.to).x) {
2924
+ bounds.insert(
2925
+ msgModel.startx - adjustment,
2926
+ msgModel.starty,
2927
+ msgModel.stopx,
2928
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2929
+ );
2930
+ msgModel.startx = msgModel.startx + adjustment;
2931
+ } else {
2932
+ bounds.insert(
2933
+ msgModel.stopx,
2934
+ msgModel.starty,
2935
+ msgModel.startx + adjustment,
2936
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2937
+ );
2938
+ msgModel.startx = msgModel.startx - adjustment;
2939
+ }
2940
+ }
2941
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(senderAdjustment, "senderAdjustment");
2942
+ if (createdActors.get(msg.to) == index) {
2943
+ const actor = actors.get(msg.to);
2944
+ const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
2945
+ receiverAdjustment(actor, adjustment);
2946
+ actor.starty = lineStartY - actor.height / 2;
2947
+ bounds.bumpVerticalPos(actor.height / 2);
2948
+ } else if (destroyedActors.get(msg.from) == index) {
2949
+ const actor = actors.get(msg.from);
2950
+ if (conf.mirrorActors) {
2951
+ const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2;
2952
+ senderAdjustment(actor, adjustment);
2953
+ }
2954
+ actor.stopy = lineStartY - actor.height / 2;
2955
+ bounds.bumpVerticalPos(actor.height / 2);
2956
+ } else if (destroyedActors.get(msg.to) == index) {
2957
+ const actor = actors.get(msg.to);
2958
+ if (conf.mirrorActors) {
2959
+ const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
2960
+ receiverAdjustment(actor, adjustment);
2961
+ }
2962
+ actor.stopy = lineStartY - actor.height / 2;
2963
+ bounds.bumpVerticalPos(actor.height / 2);
2964
+ }
2965
+ }
2966
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(adjustCreatedDestroyedData, "adjustCreatedDestroyedData");
2967
+ var draw = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(_text, id, _version, diagObj) {
2968
+ const { securityLevel, sequence } = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)();
2969
+ conf = sequence;
2970
+ let sandboxElement;
2971
+ if (securityLevel === "sandbox") {
2972
+ sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_4__/* .select */ .Ltv)("#i" + id);
2973
+ }
2974
+ const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_4__/* .select */ .Ltv)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_4__/* .select */ .Ltv)("body");
2975
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
2976
+ bounds.init();
2977
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug(diagObj.db);
2978
+ const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : (0,d3__WEBPACK_IMPORTED_MODULE_4__/* .select */ .Ltv)(`[id="${id}"]`);
2979
+ const actors = diagObj.db.getActors();
2980
+ const createdActors = diagObj.db.getCreatedActors();
2981
+ const destroyedActors = diagObj.db.getDestroyedActors();
2982
+ const boxes = diagObj.db.getBoxes();
2983
+ let actorKeys = diagObj.db.getActorKeys();
2984
+ const messages = diagObj.db.getMessages();
2985
+ const title = diagObj.db.getDiagramTitle();
2986
+ const hasBoxes = diagObj.db.hasAtLeastOneBox();
2987
+ const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle();
2988
+ const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors, messages, diagObj);
2989
+ conf.height = await calculateActorMargins(actors, maxMessageWidthPerActor, boxes);
2990
+ svgDraw_default.insertComputerIcon(diagram2);
2991
+ svgDraw_default.insertDatabaseIcon(diagram2);
2992
+ svgDraw_default.insertClockIcon(diagram2);
2993
+ if (hasBoxes) {
2994
+ bounds.bumpVerticalPos(conf.boxMargin);
2995
+ if (hasBoxTitles) {
2996
+ bounds.bumpVerticalPos(boxes[0].textMaxHeight);
2997
+ }
2998
+ }
2999
+ if (conf.hideUnusedParticipants === true) {
3000
+ const newActors = /* @__PURE__ */ new Set();
3001
+ messages.forEach((message) => {
3002
+ newActors.add(message.from);
3003
+ newActors.add(message.to);
3004
+ });
3005
+ actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey));
3006
+ }
3007
+ addActorRenderingData(diagram2, actors, createdActors, actorKeys, 0, messages, false);
3008
+ const loopWidths = await calculateLoopBounds(messages, actors, maxMessageWidthPerActor, diagObj);
3009
+ svgDraw_default.insertArrowHead(diagram2);
3010
+ svgDraw_default.insertArrowCrossHead(diagram2);
3011
+ svgDraw_default.insertArrowFilledHead(diagram2);
3012
+ svgDraw_default.insertSequenceNumber(diagram2);
3013
+ function activeEnd(msg, verticalPos) {
3014
+ const activationData = bounds.endActivation(msg);
3015
+ if (activationData.starty + 18 > verticalPos) {
3016
+ activationData.starty = verticalPos - 6;
3017
+ verticalPos += 12;
3018
+ }
3019
+ svgDraw_default.drawActivation(
3020
+ diagram2,
3021
+ activationData,
3022
+ verticalPos,
3023
+ conf,
3024
+ actorActivations(msg.from).length
3025
+ );
3026
+ bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
3027
+ }
3028
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(activeEnd, "activeEnd");
3029
+ let sequenceIndex = 1;
3030
+ let sequenceIndexStep = 1;
3031
+ const messagesToDraw = [];
3032
+ const backgrounds = [];
3033
+ let index = 0;
3034
+ for (const msg of messages) {
3035
+ let loopModel, noteModel, msgModel;
3036
+ switch (msg.type) {
3037
+ case diagObj.db.LINETYPE.NOTE:
3038
+ bounds.resetVerticalPos();
3039
+ noteModel = msg.noteModel;
3040
+ await drawNote(diagram2, noteModel);
3041
+ break;
3042
+ case diagObj.db.LINETYPE.ACTIVE_START:
3043
+ bounds.newActivation(msg, diagram2, actors);
3044
+ break;
3045
+ case diagObj.db.LINETYPE.ACTIVE_END:
3046
+ activeEnd(msg, bounds.getVerticalPos());
3047
+ break;
3048
+ case diagObj.db.LINETYPE.LOOP_START:
3049
+ adjustLoopHeightForWrap(
3050
+ loopWidths,
3051
+ msg,
3052
+ conf.boxMargin,
3053
+ conf.boxMargin + conf.boxTextMargin,
3054
+ (message) => bounds.newLoop(message)
3055
+ );
3056
+ break;
3057
+ case diagObj.db.LINETYPE.LOOP_END:
3058
+ loopModel = bounds.endLoop();
3059
+ await svgDraw_default.drawLoop(diagram2, loopModel, "loop", conf);
3060
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3061
+ bounds.models.addLoop(loopModel);
3062
+ break;
3063
+ case diagObj.db.LINETYPE.RECT_START:
3064
+ adjustLoopHeightForWrap(
3065
+ loopWidths,
3066
+ msg,
3067
+ conf.boxMargin,
3068
+ conf.boxMargin,
3069
+ (message) => bounds.newLoop(void 0, message.message)
3070
+ );
3071
+ break;
3072
+ case diagObj.db.LINETYPE.RECT_END:
3073
+ loopModel = bounds.endLoop();
3074
+ backgrounds.push(loopModel);
3075
+ bounds.models.addLoop(loopModel);
3076
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3077
+ break;
3078
+ case diagObj.db.LINETYPE.OPT_START:
3079
+ adjustLoopHeightForWrap(
3080
+ loopWidths,
3081
+ msg,
3082
+ conf.boxMargin,
3083
+ conf.boxMargin + conf.boxTextMargin,
3084
+ (message) => bounds.newLoop(message)
3085
+ );
3086
+ break;
3087
+ case diagObj.db.LINETYPE.OPT_END:
3088
+ loopModel = bounds.endLoop();
3089
+ await svgDraw_default.drawLoop(diagram2, loopModel, "opt", conf);
3090
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3091
+ bounds.models.addLoop(loopModel);
3092
+ break;
3093
+ case diagObj.db.LINETYPE.ALT_START:
3094
+ adjustLoopHeightForWrap(
3095
+ loopWidths,
3096
+ msg,
3097
+ conf.boxMargin,
3098
+ conf.boxMargin + conf.boxTextMargin,
3099
+ (message) => bounds.newLoop(message)
3100
+ );
3101
+ break;
3102
+ case diagObj.db.LINETYPE.ALT_ELSE:
3103
+ adjustLoopHeightForWrap(
3104
+ loopWidths,
3105
+ msg,
3106
+ conf.boxMargin + conf.boxTextMargin,
3107
+ conf.boxMargin,
3108
+ (message) => bounds.addSectionToLoop(message)
3109
+ );
3110
+ break;
3111
+ case diagObj.db.LINETYPE.ALT_END:
3112
+ loopModel = bounds.endLoop();
3113
+ await svgDraw_default.drawLoop(diagram2, loopModel, "alt", conf);
3114
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3115
+ bounds.models.addLoop(loopModel);
3116
+ break;
3117
+ case diagObj.db.LINETYPE.PAR_START:
3118
+ case diagObj.db.LINETYPE.PAR_OVER_START:
3119
+ adjustLoopHeightForWrap(
3120
+ loopWidths,
3121
+ msg,
3122
+ conf.boxMargin,
3123
+ conf.boxMargin + conf.boxTextMargin,
3124
+ (message) => bounds.newLoop(message)
3125
+ );
3126
+ bounds.saveVerticalPos();
3127
+ break;
3128
+ case diagObj.db.LINETYPE.PAR_AND:
3129
+ adjustLoopHeightForWrap(
3130
+ loopWidths,
3131
+ msg,
3132
+ conf.boxMargin + conf.boxTextMargin,
3133
+ conf.boxMargin,
3134
+ (message) => bounds.addSectionToLoop(message)
3135
+ );
3136
+ break;
3137
+ case diagObj.db.LINETYPE.PAR_END:
3138
+ loopModel = bounds.endLoop();
3139
+ await svgDraw_default.drawLoop(diagram2, loopModel, "par", conf);
3140
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3141
+ bounds.models.addLoop(loopModel);
3142
+ break;
3143
+ case diagObj.db.LINETYPE.AUTONUMBER:
3144
+ sequenceIndex = msg.message.start || sequenceIndex;
3145
+ sequenceIndexStep = msg.message.step || sequenceIndexStep;
3146
+ if (msg.message.visible) {
3147
+ diagObj.db.enableSequenceNumbers();
3148
+ } else {
3149
+ diagObj.db.disableSequenceNumbers();
3150
+ }
3151
+ break;
3152
+ case diagObj.db.LINETYPE.CRITICAL_START:
3153
+ adjustLoopHeightForWrap(
3154
+ loopWidths,
3155
+ msg,
3156
+ conf.boxMargin,
3157
+ conf.boxMargin + conf.boxTextMargin,
3158
+ (message) => bounds.newLoop(message)
3159
+ );
3160
+ break;
3161
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
3162
+ adjustLoopHeightForWrap(
3163
+ loopWidths,
3164
+ msg,
3165
+ conf.boxMargin + conf.boxTextMargin,
3166
+ conf.boxMargin,
3167
+ (message) => bounds.addSectionToLoop(message)
3168
+ );
3169
+ break;
3170
+ case diagObj.db.LINETYPE.CRITICAL_END:
3171
+ loopModel = bounds.endLoop();
3172
+ await svgDraw_default.drawLoop(diagram2, loopModel, "critical", conf);
3173
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3174
+ bounds.models.addLoop(loopModel);
3175
+ break;
3176
+ case diagObj.db.LINETYPE.BREAK_START:
3177
+ adjustLoopHeightForWrap(
3178
+ loopWidths,
3179
+ msg,
3180
+ conf.boxMargin,
3181
+ conf.boxMargin + conf.boxTextMargin,
3182
+ (message) => bounds.newLoop(message)
3183
+ );
3184
+ break;
3185
+ case diagObj.db.LINETYPE.BREAK_END:
3186
+ loopModel = bounds.endLoop();
3187
+ await svgDraw_default.drawLoop(diagram2, loopModel, "break", conf);
3188
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3189
+ bounds.models.addLoop(loopModel);
3190
+ break;
3191
+ default:
3192
+ try {
3193
+ msgModel = msg.msgModel;
3194
+ msgModel.starty = bounds.getVerticalPos();
3195
+ msgModel.sequenceIndex = sequenceIndex;
3196
+ msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
3197
+ const lineStartY = await boundMessage(diagram2, msgModel);
3198
+ adjustCreatedDestroyedData(
3199
+ msg,
3200
+ msgModel,
3201
+ lineStartY,
3202
+ index,
3203
+ actors,
3204
+ createdActors,
3205
+ destroyedActors
3206
+ );
3207
+ messagesToDraw.push({ messageModel: msgModel, lineStartY });
3208
+ bounds.models.addMessage(msgModel);
3209
+ } catch (e) {
3210
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.error("error while drawing message", e);
3211
+ }
3212
+ }
3213
+ if ([
3214
+ diagObj.db.LINETYPE.SOLID_OPEN,
3215
+ diagObj.db.LINETYPE.DOTTED_OPEN,
3216
+ diagObj.db.LINETYPE.SOLID,
3217
+ diagObj.db.LINETYPE.DOTTED,
3218
+ diagObj.db.LINETYPE.SOLID_CROSS,
3219
+ diagObj.db.LINETYPE.DOTTED_CROSS,
3220
+ diagObj.db.LINETYPE.SOLID_POINT,
3221
+ diagObj.db.LINETYPE.DOTTED_POINT,
3222
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
3223
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
3224
+ ].includes(msg.type)) {
3225
+ sequenceIndex = sequenceIndex + sequenceIndexStep;
3226
+ }
3227
+ index++;
3228
+ }
3229
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug("createdActors", createdActors);
3230
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug("destroyedActors", destroyedActors);
3231
+ await drawActors(diagram2, actors, actorKeys, false);
3232
+ for (const e of messagesToDraw) {
3233
+ await drawMessage(diagram2, e.messageModel, e.lineStartY, diagObj);
3234
+ }
3235
+ if (conf.mirrorActors) {
3236
+ await drawActors(diagram2, actors, actorKeys, true);
3237
+ }
3238
+ backgrounds.forEach((e) => svgDraw_default.drawBackgroundRect(diagram2, e));
3239
+ fixLifeLineHeights(diagram2, actors, actorKeys, conf);
3240
+ for (const box2 of bounds.models.boxes) {
3241
+ box2.height = bounds.getVerticalPos() - box2.y;
3242
+ bounds.insert(box2.x, box2.y, box2.x + box2.width, box2.height);
3243
+ box2.startx = box2.x;
3244
+ box2.starty = box2.y;
3245
+ box2.stopx = box2.startx + box2.width;
3246
+ box2.stopy = box2.starty + box2.height;
3247
+ box2.stroke = "rgb(0,0,0, 0.5)";
3248
+ svgDraw_default.drawBox(diagram2, box2, conf);
3249
+ }
3250
+ if (hasBoxes) {
3251
+ bounds.bumpVerticalPos(conf.boxMargin);
3252
+ }
3253
+ const requiredBoxSize = drawActorsPopup(diagram2, actors, actorKeys, doc);
3254
+ const { bounds: box } = bounds.getBounds();
3255
+ if (box.startx === void 0) {
3256
+ box.startx = 0;
3257
+ }
3258
+ if (box.starty === void 0) {
3259
+ box.starty = 0;
3260
+ }
3261
+ if (box.stopx === void 0) {
3262
+ box.stopx = 0;
3263
+ }
3264
+ if (box.stopy === void 0) {
3265
+ box.stopy = 0;
3266
+ }
3267
+ let boxHeight = box.stopy - box.starty;
3268
+ if (boxHeight < requiredBoxSize.maxHeight) {
3269
+ boxHeight = requiredBoxSize.maxHeight;
3270
+ }
3271
+ let height = boxHeight + 2 * conf.diagramMarginY;
3272
+ if (conf.mirrorActors) {
3273
+ height = height - conf.boxMargin + conf.bottomMarginAdj;
3274
+ }
3275
+ let boxWidth = box.stopx - box.startx;
3276
+ if (boxWidth < requiredBoxSize.maxWidth) {
3277
+ boxWidth = requiredBoxSize.maxWidth;
3278
+ }
3279
+ const width = boxWidth + 2 * conf.diagramMarginX;
3280
+ if (title) {
3281
+ diagram2.append("text").text(title).attr("x", (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr("y", -25);
3282
+ }
3283
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .configureSvgSize */ .a$)(diagram2, height, width, conf.useMaxWidth);
3284
+ const extraVertForTitle = title ? 40 : 0;
3285
+ diagram2.attr(
3286
+ "viewBox",
3287
+ box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle)
3288
+ );
3289
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug(`models:`, bounds.models);
3290
+ }, "draw");
3291
+ async function getMaxMessageWidthPerActor(actors, messages, diagObj) {
3292
+ const maxMessageWidthPerActor = {};
3293
+ for (const msg of messages) {
3294
+ if (actors.get(msg.to) && actors.get(msg.from)) {
3295
+ const actor = actors.get(msg.to);
3296
+ if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
3297
+ continue;
3298
+ }
3299
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
3300
+ continue;
3301
+ }
3302
+ const isNote = msg.placement !== void 0;
3303
+ const isMessage = !isNote;
3304
+ const textFont = isNote ? noteFont(conf) : messageFont(conf);
3305
+ const wrappedMessage = msg.wrap ? _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
3306
+ const messageDimensions = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(wrappedMessage) ? await (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .calculateMathMLDimensions */ .Dl)(msg.message, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()) : _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(wrappedMessage, textFont);
3307
+ const messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
3308
+ if (isMessage && msg.from === actor.nextActor) {
3309
+ maxMessageWidthPerActor[msg.to] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3310
+ maxMessageWidthPerActor[msg.to] || 0,
3311
+ messageWidth
3312
+ );
3313
+ } else if (isMessage && msg.from === actor.prevActor) {
3314
+ maxMessageWidthPerActor[msg.from] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3315
+ maxMessageWidthPerActor[msg.from] || 0,
3316
+ messageWidth
3317
+ );
3318
+ } else if (isMessage && msg.from === msg.to) {
3319
+ maxMessageWidthPerActor[msg.from] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3320
+ maxMessageWidthPerActor[msg.from] || 0,
3321
+ messageWidth / 2
3322
+ );
3323
+ maxMessageWidthPerActor[msg.to] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3324
+ maxMessageWidthPerActor[msg.to] || 0,
3325
+ messageWidth / 2
3326
+ );
3327
+ } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
3328
+ maxMessageWidthPerActor[msg.from] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3329
+ maxMessageWidthPerActor[msg.from] || 0,
3330
+ messageWidth
3331
+ );
3332
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
3333
+ maxMessageWidthPerActor[actor.prevActor] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3334
+ maxMessageWidthPerActor[actor.prevActor] || 0,
3335
+ messageWidth
3336
+ );
3337
+ } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
3338
+ if (actor.prevActor) {
3339
+ maxMessageWidthPerActor[actor.prevActor] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3340
+ maxMessageWidthPerActor[actor.prevActor] || 0,
3341
+ messageWidth / 2
3342
+ );
3343
+ }
3344
+ if (actor.nextActor) {
3345
+ maxMessageWidthPerActor[msg.from] = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3346
+ maxMessageWidthPerActor[msg.from] || 0,
3347
+ messageWidth / 2
3348
+ );
3349
+ }
3350
+ }
3351
+ }
3352
+ }
3353
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor);
3354
+ return maxMessageWidthPerActor;
3355
+ }
3356
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(getMaxMessageWidthPerActor, "getMaxMessageWidthPerActor");
3357
+ var getRequiredPopupWidth = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(actor) {
3358
+ let requiredPopupWidth = 0;
3359
+ const textFont = actorFont(conf);
3360
+ for (const key in actor.links) {
3361
+ const labelDimensions = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(key, textFont);
3362
+ const labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
3363
+ if (requiredPopupWidth < labelWidth) {
3364
+ requiredPopupWidth = labelWidth;
3365
+ }
3366
+ }
3367
+ return requiredPopupWidth;
3368
+ }, "getRequiredPopupWidth");
3369
+ async function calculateActorMargins(actors, actorToMessageWidth, boxes) {
3370
+ let maxHeight = 0;
3371
+ for (const prop of actors.keys()) {
3372
+ const actor = actors.get(prop);
3373
+ if (actor.wrap) {
3374
+ actor.description = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(
3375
+ actor.description,
3376
+ conf.width - 2 * conf.wrapPadding,
3377
+ actorFont(conf)
3378
+ );
3379
+ }
3380
+ const actDims = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(actor.description) ? await (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .calculateMathMLDimensions */ .Dl)(actor.description, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()) : _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(actor.description, actorFont(conf));
3381
+ actor.width = actor.wrap ? conf.width : _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(conf.width, actDims.width + 2 * conf.wrapPadding);
3382
+ actor.height = actor.wrap ? _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(actDims.height, conf.height) : conf.height;
3383
+ maxHeight = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(maxHeight, actor.height);
3384
+ }
3385
+ for (const actorKey in actorToMessageWidth) {
3386
+ const actor = actors.get(actorKey);
3387
+ if (!actor) {
3388
+ continue;
3389
+ }
3390
+ const nextActor = actors.get(actor.nextActor);
3391
+ if (!nextActor) {
3392
+ const messageWidth2 = actorToMessageWidth[actorKey];
3393
+ const actorWidth2 = messageWidth2 + conf.actorMargin - actor.width / 2;
3394
+ actor.margin = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(actorWidth2, conf.actorMargin);
3395
+ continue;
3396
+ }
3397
+ const messageWidth = actorToMessageWidth[actorKey];
3398
+ const actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
3399
+ actor.margin = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(actorWidth, conf.actorMargin);
3400
+ }
3401
+ let maxBoxHeight = 0;
3402
+ boxes.forEach((box) => {
3403
+ const textFont = messageFont(conf);
3404
+ let totalWidth = box.actorKeys.reduce((total, aKey) => {
3405
+ return total += actors.get(aKey).width + (actors.get(aKey).margin || 0);
3406
+ }, 0);
3407
+ totalWidth -= 2 * conf.boxTextMargin;
3408
+ if (box.wrap) {
3409
+ box.name = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
3410
+ }
3411
+ const boxMsgDimensions = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(box.name, textFont);
3412
+ maxBoxHeight = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(boxMsgDimensions.height, maxBoxHeight);
3413
+ const minWidth = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(totalWidth, boxMsgDimensions.width + 2 * conf.wrapPadding);
3414
+ box.margin = conf.boxTextMargin;
3415
+ if (totalWidth < minWidth) {
3416
+ const missing = (minWidth - totalWidth) / 2;
3417
+ box.margin += missing;
3418
+ }
3419
+ });
3420
+ boxes.forEach((box) => box.textMaxHeight = maxBoxHeight);
3421
+ return _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(maxHeight, conf.height);
3422
+ }
3423
+ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(calculateActorMargins, "calculateActorMargins");
3424
+ var buildNoteModel = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(msg, actors, diagObj) {
3425
+ const fromActor = actors.get(msg.from);
3426
+ const toActor = actors.get(msg.to);
3427
+ const startx = fromActor.x;
3428
+ const stopx = toActor.x;
3429
+ const shouldWrap = msg.wrap && msg.message;
3430
+ let textDimensions = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .hasKatex */ .Wi)(msg.message) ? await (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .calculateMathMLDimensions */ .Dl)(msg.message, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()) : _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(
3431
+ shouldWrap ? _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message,
3432
+ noteFont(conf)
3433
+ );
3434
+ const noteModel = {
3435
+ width: shouldWrap ? conf.width : _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin),
3436
+ height: 0,
3437
+ startx: fromActor.x,
3438
+ stopx: 0,
3439
+ starty: 0,
3440
+ stopy: 0,
3441
+ message: msg.message
3442
+ };
3443
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
3444
+ noteModel.width = shouldWrap ? _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(conf.width, textDimensions.width) : _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3445
+ fromActor.width / 2 + toActor.width / 2,
3446
+ textDimensions.width + 2 * conf.noteMargin
3447
+ );
3448
+ noteModel.startx = startx + (fromActor.width + conf.actorMargin) / 2;
3449
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
3450
+ noteModel.width = shouldWrap ? _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin) : _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3451
+ fromActor.width / 2 + toActor.width / 2,
3452
+ textDimensions.width + 2 * conf.noteMargin
3453
+ );
3454
+ noteModel.startx = startx - noteModel.width + (fromActor.width - conf.actorMargin) / 2;
3455
+ } else if (msg.to === msg.from) {
3456
+ textDimensions = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(
3457
+ shouldWrap ? _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(msg.message, _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(conf.width, fromActor.width), noteFont(conf)) : msg.message,
3458
+ noteFont(conf)
3459
+ );
3460
+ noteModel.width = shouldWrap ? _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(conf.width, fromActor.width) : _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(fromActor.width, conf.width, textDimensions.width + 2 * conf.noteMargin);
3461
+ noteModel.startx = startx + (fromActor.width - noteModel.width) / 2;
3462
+ } else {
3463
+ noteModel.width = Math.abs(startx + fromActor.width / 2 - (stopx + toActor.width / 2)) + conf.actorMargin;
3464
+ noteModel.startx = startx < stopx ? startx + fromActor.width / 2 - conf.actorMargin / 2 : stopx + toActor.width / 2 - conf.actorMargin / 2;
3465
+ }
3466
+ if (shouldWrap) {
3467
+ noteModel.message = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(
3468
+ msg.message,
3469
+ noteModel.width - 2 * conf.wrapPadding,
3470
+ noteFont(conf)
3471
+ );
3472
+ }
3473
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug(
3474
+ `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]`
3475
+ );
3476
+ return noteModel;
3477
+ }, "buildNoteModel");
3478
+ var buildMessageModel = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(msg, actors, diagObj) {
3479
+ if (![
3480
+ diagObj.db.LINETYPE.SOLID_OPEN,
3481
+ diagObj.db.LINETYPE.DOTTED_OPEN,
3482
+ diagObj.db.LINETYPE.SOLID,
3483
+ diagObj.db.LINETYPE.DOTTED,
3484
+ diagObj.db.LINETYPE.SOLID_CROSS,
3485
+ diagObj.db.LINETYPE.DOTTED_CROSS,
3486
+ diagObj.db.LINETYPE.SOLID_POINT,
3487
+ diagObj.db.LINETYPE.DOTTED_POINT,
3488
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
3489
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
3490
+ ].includes(msg.type)) {
3491
+ return {};
3492
+ }
3493
+ const [fromLeft, fromRight] = activationBounds(msg.from, actors);
3494
+ const [toLeft, toRight] = activationBounds(msg.to, actors);
3495
+ const isArrowToRight = fromLeft <= toLeft;
3496
+ let startx = isArrowToRight ? fromRight : fromLeft;
3497
+ let stopx = isArrowToRight ? toLeft : toRight;
3498
+ const isArrowToActivation = Math.abs(toLeft - toRight) > 2;
3499
+ const adjustValue = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((value) => {
3500
+ return isArrowToRight ? -value : value;
3501
+ }, "adjustValue");
3502
+ if (msg.from === msg.to) {
3503
+ stopx = startx;
3504
+ } else {
3505
+ if (msg.activate && !isArrowToActivation) {
3506
+ stopx += adjustValue(conf.activationWidth / 2 - 1);
3507
+ }
3508
+ if (![diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN].includes(msg.type)) {
3509
+ stopx += adjustValue(3);
3510
+ }
3511
+ if ([diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID, diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(
3512
+ msg.type
3513
+ )) {
3514
+ startx -= adjustValue(3);
3515
+ }
3516
+ }
3517
+ const allBounds = [fromLeft, fromRight, toLeft, toRight];
3518
+ const boundedWidth = Math.abs(startx - stopx);
3519
+ if (msg.wrap && msg.message) {
3520
+ msg.message = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.wrapLabel(
3521
+ msg.message,
3522
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(boundedWidth + 2 * conf.wrapPadding, conf.width),
3523
+ messageFont(conf)
3524
+ );
3525
+ }
3526
+ const msgDims = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.calculateTextDimensions(msg.message, messageFont(conf));
3527
+ return {
3528
+ width: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3529
+ msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
3530
+ boundedWidth + 2 * conf.wrapPadding,
3531
+ conf.width
3532
+ ),
3533
+ height: 0,
3534
+ startx,
3535
+ stopx,
3536
+ starty: 0,
3537
+ stopy: 0,
3538
+ message: msg.message,
3539
+ type: msg.type,
3540
+ wrap: msg.wrap,
3541
+ fromBounds: Math.min.apply(null, allBounds),
3542
+ toBounds: Math.max.apply(null, allBounds)
3543
+ };
3544
+ }, "buildMessageModel");
3545
+ var calculateLoopBounds = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(messages, actors, _maxWidthPerActor, diagObj) {
3546
+ const loops = {};
3547
+ const stack = [];
3548
+ let current, noteModel, msgModel;
3549
+ for (const msg of messages) {
3550
+ msg.id = _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.random({ length: 10 });
3551
+ switch (msg.type) {
3552
+ case diagObj.db.LINETYPE.LOOP_START:
3553
+ case diagObj.db.LINETYPE.ALT_START:
3554
+ case diagObj.db.LINETYPE.OPT_START:
3555
+ case diagObj.db.LINETYPE.PAR_START:
3556
+ case diagObj.db.LINETYPE.PAR_OVER_START:
3557
+ case diagObj.db.LINETYPE.CRITICAL_START:
3558
+ case diagObj.db.LINETYPE.BREAK_START:
3559
+ stack.push({
3560
+ id: msg.id,
3561
+ msg: msg.message,
3562
+ from: Number.MAX_SAFE_INTEGER,
3563
+ to: Number.MIN_SAFE_INTEGER,
3564
+ width: 0
3565
+ });
3566
+ break;
3567
+ case diagObj.db.LINETYPE.ALT_ELSE:
3568
+ case diagObj.db.LINETYPE.PAR_AND:
3569
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
3570
+ if (msg.message) {
3571
+ current = stack.pop();
3572
+ loops[current.id] = current;
3573
+ loops[msg.id] = current;
3574
+ stack.push(current);
3575
+ }
3576
+ break;
3577
+ case diagObj.db.LINETYPE.LOOP_END:
3578
+ case diagObj.db.LINETYPE.ALT_END:
3579
+ case diagObj.db.LINETYPE.OPT_END:
3580
+ case diagObj.db.LINETYPE.PAR_END:
3581
+ case diagObj.db.LINETYPE.CRITICAL_END:
3582
+ case diagObj.db.LINETYPE.BREAK_END:
3583
+ current = stack.pop();
3584
+ loops[current.id] = current;
3585
+ break;
3586
+ case diagObj.db.LINETYPE.ACTIVE_START:
3587
+ {
3588
+ const actorRect = actors.get(msg.from ? msg.from : msg.to.actor);
3589
+ const stackedSize = actorActivations(msg.from ? msg.from : msg.to.actor).length;
3590
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
3591
+ const toAdd = {
3592
+ startx: x,
3593
+ stopx: x + conf.activationWidth,
3594
+ actor: msg.from,
3595
+ enabled: true
3596
+ };
3597
+ bounds.activations.push(toAdd);
3598
+ }
3599
+ break;
3600
+ case diagObj.db.LINETYPE.ACTIVE_END:
3601
+ {
3602
+ const lastActorActivationIdx = bounds.activations.map((a) => a.actor).lastIndexOf(msg.from);
3603
+ bounds.activations.splice(lastActorActivationIdx, 1).splice(0, 1);
3604
+ }
3605
+ break;
3606
+ }
3607
+ const isNote = msg.placement !== void 0;
3608
+ if (isNote) {
3609
+ noteModel = await buildNoteModel(msg, actors, diagObj);
3610
+ msg.noteModel = noteModel;
3611
+ stack.forEach((stk) => {
3612
+ current = stk;
3613
+ current.from = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMin(current.from, noteModel.startx);
3614
+ current.to = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(current.to, noteModel.startx + noteModel.width);
3615
+ current.width = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
3616
+ });
3617
+ } else {
3618
+ msgModel = buildMessageModel(msg, actors, diagObj);
3619
+ msg.msgModel = msgModel;
3620
+ if (msgModel.startx && msgModel.stopx && stack.length > 0) {
3621
+ stack.forEach((stk) => {
3622
+ current = stk;
3623
+ if (msgModel.startx === msgModel.stopx) {
3624
+ const from = actors.get(msg.from);
3625
+ const to = actors.get(msg.to);
3626
+ current.from = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMin(
3627
+ from.x - msgModel.width / 2,
3628
+ from.x - from.width / 2,
3629
+ current.from
3630
+ );
3631
+ current.to = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(
3632
+ to.x + msgModel.width / 2,
3633
+ to.x + from.width / 2,
3634
+ current.to
3635
+ );
3636
+ current.width = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
3637
+ } else {
3638
+ current.from = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMin(msgModel.startx, current.from);
3639
+ current.to = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(msgModel.stopx, current.to);
3640
+ current.width = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.getMax(current.width, msgModel.width) - conf.labelBoxWidth;
3641
+ }
3642
+ });
3643
+ }
3644
+ }
3645
+ }
3646
+ bounds.activations = [];
3647
+ _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.debug("Loop type widths:", loops);
3648
+ return loops;
3649
+ }, "calculateLoopBounds");
3650
+ var sequenceRenderer_default = {
3651
+ bounds,
3652
+ drawActors,
3653
+ drawActorsPopup,
3654
+ setConf,
3655
+ draw
3656
+ };
3657
+
3658
+ // src/diagrams/sequence/sequenceDiagram.ts
3659
+ var diagram = {
3660
+ parser: sequenceDiagram_default,
3661
+ db: sequenceDb_default,
3662
+ renderer: sequenceRenderer_default,
3663
+ styles: styles_default,
3664
+ init: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(({ wrap }) => {
3665
+ sequenceDb_default.setWrap(wrap);
3666
+ }, "init")
3667
+ };
3668
+
3669
+
3670
+
3671
+ /***/ })
3672
+
3673
+ };
3674
+ ;