whipped 0.8.1 → 0.9.1

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.
Files changed (86) hide show
  1. package/dist/cli.js +1296 -311
  2. package/dist/mcp-server.js +150 -2
  3. package/dist/migrations/014_companion_sessions.sql +34 -0
  4. package/dist/migrations/015_companion_worktree_mode.sql +45 -0
  5. package/dist/migrations/016_companion_plans.sql +22 -0
  6. package/dist/migrations/017_companion_saved_plans.sql +23 -0
  7. package/dist/migrations/018_generalize_plan_session_ref.sql +29 -0
  8. package/dist/migrations/019_rename_plan_to_canvas.sql +20 -0
  9. package/dist/web-ui/assets/abnfDiagram-VRR7QNED-CMDqE9Fd.js +119 -0
  10. package/dist/web-ui/assets/arc-Dbpy-AQ8.js +131 -0
  11. package/dist/web-ui/assets/architectureDiagram-ZJ3FMSHR-BKEqdC5c.js +8821 -0
  12. package/dist/web-ui/assets/blockDiagram-677ZJIJ3-CTsEohS4.js +3801 -0
  13. package/dist/web-ui/assets/c4Diagram-LMCZKHZV-Dn6mvxwq.js +2479 -0
  14. package/dist/web-ui/assets/channel-CGIzRjBJ.js +7 -0
  15. package/dist/web-ui/assets/chunk-2Q5K7J3B-DYVO9tIE.js +17 -0
  16. package/dist/web-ui/assets/chunk-32BRIVSS-CqBj7LwD.js +116 -0
  17. package/dist/web-ui/assets/chunk-5VM5RSS4-D6as2qUK.js +19 -0
  18. package/dist/web-ui/assets/chunk-EX3LRPZG-Daf_kmKB.js +1996 -0
  19. package/dist/web-ui/assets/chunk-JWPE2WC7-Ab-zf2K1.js +17 -0
  20. package/dist/web-ui/assets/chunk-MOJQB5TN-DnYfTlwW.js +855 -0
  21. package/dist/web-ui/assets/chunk-RYQCIY6F-BkiNDZ_4.js +476 -0
  22. package/dist/web-ui/assets/chunk-V7JOEXUC-DCb_30mT.js +2022 -0
  23. package/dist/web-ui/assets/chunk-VR4S4FIN-CO86AkST.js +25 -0
  24. package/dist/web-ui/assets/chunk-XXDRQBXY--g2YuB3U.js +13 -0
  25. package/dist/web-ui/assets/classDiagram-OUVF2IWQ-C25Jck2H.js +24 -0
  26. package/dist/web-ui/assets/classDiagram-v2-EOCWNBFH-C25Jck2H.js +24 -0
  27. package/dist/web-ui/assets/cose-bilkent-JH36ORCC-DhhXza2J.js +4943 -0
  28. package/dist/web-ui/assets/cynefin-VYW2F7L2-CaR1DgV9.js +31527 -0
  29. package/dist/web-ui/assets/cynefinDiagram-TSTJHNR4-CLGnTJf1.js +454 -0
  30. package/dist/web-ui/assets/cytoscape.esm-CaQ7Fomf.js +30346 -0
  31. package/dist/web-ui/assets/dagre-VKFMJZFB-DitV5zjf.js +526 -0
  32. package/dist/web-ui/assets/defaultLocale-B2RvLBDe.js +206 -0
  33. package/dist/web-ui/assets/diagram-FQU43EPY-C1rGhyyl.js +636 -0
  34. package/dist/web-ui/assets/diagram-G47NLZAW-CTQhjAQX.js +858 -0
  35. package/dist/web-ui/assets/diagram-NH7WQ7WH-DI8N7xbl.js +212 -0
  36. package/dist/web-ui/assets/diagram-OA4YK3LP-WcmQFHPD.js +492 -0
  37. package/dist/web-ui/assets/diagram-WEI45ONY-P5J7jo04.js +309 -0
  38. package/dist/web-ui/assets/ebnfDiagram-CCIWWBDH-VgG6WhIs.js +139 -0
  39. package/dist/web-ui/assets/erDiagram-Q63AITRT-aQJn3J15.js +1238 -0
  40. package/dist/web-ui/assets/flowDiagram-23GEKE2U-mdFXB92B.js +2353 -0
  41. package/dist/web-ui/assets/ganttDiagram-NO4QXBWP-CqDgijmY.js +3733 -0
  42. package/dist/web-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  43. package/dist/web-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  44. package/dist/web-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  45. package/dist/web-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  46. package/dist/web-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
  47. package/dist/web-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
  48. package/dist/web-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
  49. package/dist/web-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
  50. package/dist/web-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
  51. package/dist/web-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
  52. package/dist/web-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  53. package/dist/web-ui/assets/gitGraphDiagram-IHSO6WYX-8juiaoTk.js +1385 -0
  54. package/dist/web-ui/assets/graph-BMLV0goG.js +2042 -0
  55. package/dist/web-ui/assets/{index-CRXPsGTP.css → index-DPjATOCj.css} +800 -1207
  56. package/dist/web-ui/assets/{index-BMFVAmy4.js → index-DddtVpjm.js} +41479 -39640
  57. package/dist/web-ui/assets/infoDiagram-FWYZ7A6U-C2g8E3ea.js +32 -0
  58. package/dist/web-ui/assets/init-ZxktEp_H.js +16 -0
  59. package/dist/web-ui/assets/ishikawaDiagram-FXEZZL3T-cBRjKZAE.js +967 -0
  60. package/dist/web-ui/assets/journeyDiagram-5HDEW3XC-BvGisWzY.js +1256 -0
  61. package/dist/web-ui/assets/kanban-definition-HUTT4EX6-xCU5FVAS.js +1055 -0
  62. package/dist/web-ui/assets/katex-CqNtglxf.js +14499 -0
  63. package/dist/web-ui/assets/layout-BNmRhaUB.js +2359 -0
  64. package/dist/web-ui/assets/linear-uVfTbk22.js +340 -0
  65. package/dist/web-ui/assets/map-BEO0Bu8q.js +298 -0
  66. package/dist/web-ui/assets/mermaid.core-D-SdXkuv.js +26639 -0
  67. package/dist/web-ui/assets/mindmap-definition-LN4V7U3C-BXMrLpcc.js +1183 -0
  68. package/dist/web-ui/assets/ordinal-DSZU4PqD.js +76 -0
  69. package/dist/web-ui/assets/pegDiagram-2B236MQR-4QY6zfTY.js +127 -0
  70. package/dist/web-ui/assets/pieDiagram-ENE6RG2P-CvA8hnwZ.js +318 -0
  71. package/dist/web-ui/assets/quadrantDiagram-ABIIQ3AL-b9LyRoDu.js +1341 -0
  72. package/dist/web-ui/assets/railroadDiagram-RFXS5EU6-xnbYx8zt.js +93 -0
  73. package/dist/web-ui/assets/requirementDiagram-TGXJPOKE-DXgeFZvD.js +1205 -0
  74. package/dist/web-ui/assets/sankeyDiagram-HTMAVEWB-N3WPRpVR.js +1264 -0
  75. package/dist/web-ui/assets/sequenceDiagram-DBY2YBRQ-CasLOrw_.js +4523 -0
  76. package/dist/web-ui/assets/sizeCapture-X5ZJPWSS-DlBvxVbP.js +64 -0
  77. package/dist/web-ui/assets/stateDiagram-2N3HPSRC-fp4Rfa7y.js +453 -0
  78. package/dist/web-ui/assets/stateDiagram-v2-6OUMAXLB-B1Sbo4u9.js +23 -0
  79. package/dist/web-ui/assets/swimlanes-5IMT3BWC-D8woP0NL.js +8575 -0
  80. package/dist/web-ui/assets/swimlanesDiagram-G3AALYLV-BkAvTJ1E.js +21 -0
  81. package/dist/web-ui/assets/timeline-definition-FHXFAJF6-Bri3dfoP.js +1606 -0
  82. package/dist/web-ui/assets/vennDiagram-L72KCM5P-DTZlIjiw.js +2523 -0
  83. package/dist/web-ui/assets/wardleyDiagram-EHGQE667-CCyt_RTI.js +978 -0
  84. package/dist/web-ui/assets/xychartDiagram-FW5EYKEG-DtQR47sr.js +1972 -0
  85. package/dist/web-ui/index.html +2 -2
  86. package/package.json +1 -1
@@ -0,0 +1,4523 @@
1
+ var _a;
2
+ import { I as ImperativeState } from "./chunk-2Q5K7J3B-DYVO9tIE.js";
3
+ import { _ as __name, F as setConfig2, c as getConfig2, d as select, l as log, j as distExports, e as configureSvgSize, f as assignWithDepth_default, k as common_default, b as setAccTitle, s as setAccDescription, n as setDiagramTitle, a as getAccTitle, g as getAccDescription, o as getDiagramTitle, G as load, J as JSON_SCHEMA, p as clear, i as sanitizeText, x as utils_default, H as hasKatex, I as calculateMathMLDimensions, K as parseFontSize, Z as ZERO_WIDTH_SPACE, y as getConfig, L as getUrl, M as renderKatexSanitized } from "./mermaid.core-D-SdXkuv.js";
4
+ import { a as drawBackgroundRect, b as getTextObj, g as getNoteRect, d as drawRect, c as drawEmbeddedImage, e as drawImage } from "./chunk-32BRIVSS-CqBj7LwD.js";
5
+ import "./index-DddtVpjm.js";
6
+ var parser = (function() {
7
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
8
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
9
+ return o2;
10
+ }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 14], $V8 = [1, 15], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 19], $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, 40], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [1, 47], $Vy = [1, 4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 49, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $Vz = [1, 74], $VA = [1, 80], $VB = [1, 81], $VC = [1, 82], $VD = [1, 83], $VE = [1, 84], $VF = [1, 85], $VG = [1, 86], $VH = [1, 87], $VI = [1, 88], $VJ = [1, 89], $VK = [1, 90], $VL = [1, 91], $VM = [1, 92], $VN = [1, 93], $VO = [1, 94], $VP = [1, 95], $VQ = [1, 96], $VR = [1, 97], $VS = [1, 98], $VT = [1, 99], $VU = [1, 100], $VV = [1, 101], $VW = [1, 102], $VX = [1, 103], $VY = [1, 104], $VZ = [1, 105], $V_ = [2, 78], $V$ = [4, 5, 17, 51, 53, 54], $V01 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V11 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V21 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 49, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V31 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V41 = [5, 52], $V51 = [70, 71, 72, 73], $V61 = [1, 151];
11
+ var parser2 = {
12
+ trace: /* @__PURE__ */ __name(function trace() {
13
+ }, "trace"),
14
+ yy: {},
15
+ symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "INVALID": 10, "box_section": 11, "box_line": 12, "participant_statement": 13, "create": 14, "box": 15, "restOfLine": 16, "end": 17, "signal": 18, "autonumber": 19, "NUM": 20, "off": 21, "activate": 22, "actor": 23, "deactivate": 24, "note_statement": 25, "links_statement": 26, "link_statement": 27, "properties_statement": 28, "details_statement": 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": 40, "else_sections": 41, "par": 42, "par_sections": 43, "par_over": 44, "critical": 45, "option_sections": 46, "break": 47, "option": 48, "and": 49, "else": 50, "participant": 51, "AS": 52, "participant_actor": 53, "destroy": 54, "actor_with_config": 55, "note": 56, "placement": 57, "text2": 58, "over": 59, "actor_pair": 60, "links": 61, "link": 62, "properties": 63, "details": 64, "spaceList": 65, ",": 66, "left_of": 67, "right_of": 68, "signaltype": 69, "+": 70, "-": 71, "()": 72, "ACTOR": 73, "config_object": 74, "CONFIG_START": 75, "CONFIG_CONTENT": 76, "CONFIG_END": 77, "SOLID_OPEN_ARROW": 78, "DOTTED_OPEN_ARROW": 79, "SOLID_ARROW": 80, "SOLID_ARROW_TOP": 81, "SOLID_ARROW_BOTTOM": 82, "STICK_ARROW_TOP": 83, "STICK_ARROW_BOTTOM": 84, "SOLID_ARROW_TOP_DOTTED": 85, "SOLID_ARROW_BOTTOM_DOTTED": 86, "STICK_ARROW_TOP_DOTTED": 87, "STICK_ARROW_BOTTOM_DOTTED": 88, "SOLID_ARROW_TOP_REVERSE": 89, "SOLID_ARROW_BOTTOM_REVERSE": 90, "STICK_ARROW_TOP_REVERSE": 91, "STICK_ARROW_BOTTOM_REVERSE": 92, "SOLID_ARROW_TOP_REVERSE_DOTTED": 93, "SOLID_ARROW_BOTTOM_REVERSE_DOTTED": 94, "STICK_ARROW_TOP_REVERSE_DOTTED": 95, "STICK_ARROW_BOTTOM_REVERSE_DOTTED": 96, "BIDIRECTIONAL_SOLID_ARROW": 97, "DOTTED_ARROW": 98, "BIDIRECTIONAL_DOTTED_ARROW": 99, "SOLID_CROSS": 100, "DOTTED_CROSS": 101, "SOLID_POINT": 102, "DOTTED_POINT": 103, "TXT": 104, "$accept": 0, "$end": 1 },
16
+ terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 10: "INVALID", 14: "create", 15: "box", 16: "restOfLine", 17: "end", 19: "autonumber", 20: "NUM", 21: "off", 22: "activate", 24: "deactivate", 30: "title", 31: "legacy_title", 32: "acc_title", 33: "acc_title_value", 34: "acc_descr", 35: "acc_descr_value", 36: "acc_descr_multiline_value", 37: "loop", 38: "rect", 39: "opt", 40: "alt", 42: "par", 44: "par_over", 45: "critical", 47: "break", 48: "option", 49: "and", 50: "else", 51: "participant", 52: "AS", 53: "participant_actor", 54: "destroy", 56: "note", 59: "over", 61: "links", 62: "link", 63: "properties", 64: "details", 66: ",", 67: "left_of", 68: "right_of", 70: "+", 71: "-", 72: "()", 73: "ACTOR", 75: "CONFIG_START", 76: "CONFIG_CONTENT", 77: "CONFIG_END", 78: "SOLID_OPEN_ARROW", 79: "DOTTED_OPEN_ARROW", 80: "SOLID_ARROW", 81: "SOLID_ARROW_TOP", 82: "SOLID_ARROW_BOTTOM", 83: "STICK_ARROW_TOP", 84: "STICK_ARROW_BOTTOM", 85: "SOLID_ARROW_TOP_DOTTED", 86: "SOLID_ARROW_BOTTOM_DOTTED", 87: "STICK_ARROW_TOP_DOTTED", 88: "STICK_ARROW_BOTTOM_DOTTED", 89: "SOLID_ARROW_TOP_REVERSE", 90: "SOLID_ARROW_BOTTOM_REVERSE", 91: "STICK_ARROW_TOP_REVERSE", 92: "STICK_ARROW_BOTTOM_REVERSE", 93: "SOLID_ARROW_TOP_REVERSE_DOTTED", 94: "SOLID_ARROW_BOTTOM_REVERSE_DOTTED", 95: "STICK_ARROW_TOP_REVERSE_DOTTED", 96: "STICK_ARROW_BOTTOM_REVERSE_DOTTED", 97: "BIDIRECTIONAL_SOLID_ARROW", 98: "DOTTED_ARROW", 99: "BIDIRECTIONAL_DOTTED_ARROW", 100: "SOLID_CROSS", 101: "DOTTED_CROSS", 102: "SOLID_POINT", 103: "DOTTED_POINT", 104: "TXT" },
17
+ productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [8, 1], [11, 0], [11, 2], [12, 2], [12, 1], [12, 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], [46, 1], [46, 4], [43, 1], [43, 4], [41, 1], [41, 4], [13, 5], [13, 3], [13, 5], [13, 3], [13, 3], [13, 5], [13, 3], [13, 5], [13, 3], [25, 4], [25, 4], [26, 3], [27, 3], [28, 3], [29, 3], [65, 2], [65, 1], [60, 3], [60, 1], [57, 1], [57, 1], [18, 5], [18, 5], [18, 5], [18, 5], [18, 6], [18, 4], [55, 2], [74, 3], [23, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [58, 1]],
18
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
19
+ var $0 = $$.length - 1;
20
+ switch (yystate) {
21
+ case 3:
22
+ yy.apply($$[$0]);
23
+ return $$[$0];
24
+ case 4:
25
+ case 10:
26
+ this.$ = [];
27
+ break;
28
+ case 5:
29
+ case 11:
30
+ $$[$0 - 1].push($$[$0]);
31
+ this.$ = $$[$0 - 1];
32
+ break;
33
+ case 6:
34
+ case 7:
35
+ case 12:
36
+ case 13:
37
+ this.$ = $$[$0];
38
+ break;
39
+ case 8:
40
+ case 9:
41
+ case 14:
42
+ this.$ = [];
43
+ break;
44
+ case 16:
45
+ $$[$0].type = "createParticipant";
46
+ this.$ = $$[$0];
47
+ break;
48
+ case 17:
49
+ $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) });
50
+ $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] });
51
+ this.$ = $$[$0 - 1];
52
+ break;
53
+ case 19:
54
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
55
+ break;
56
+ case 20:
57
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
58
+ break;
59
+ case 21:
60
+ this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER };
61
+ break;
62
+ case 22:
63
+ this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
64
+ break;
65
+ case 23:
66
+ this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor };
67
+ break;
68
+ case 24:
69
+ this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1].actor };
70
+ break;
71
+ case 30:
72
+ yy.setDiagramTitle($$[$0].substring(6));
73
+ this.$ = $$[$0].substring(6);
74
+ break;
75
+ case 31:
76
+ yy.setDiagramTitle($$[$0].substring(7));
77
+ this.$ = $$[$0].substring(7);
78
+ break;
79
+ case 32:
80
+ this.$ = $$[$0].trim();
81
+ yy.setAccTitle(this.$);
82
+ break;
83
+ case 33:
84
+ case 34:
85
+ this.$ = $$[$0].trim();
86
+ yy.setAccDescription(this.$);
87
+ break;
88
+ case 35:
89
+ $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START });
90
+ $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END });
91
+ this.$ = $$[$0 - 1];
92
+ break;
93
+ case 36:
94
+ $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START });
95
+ $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END });
96
+ this.$ = $$[$0 - 1];
97
+ break;
98
+ case 37:
99
+ $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START });
100
+ $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END });
101
+ this.$ = $$[$0 - 1];
102
+ break;
103
+ case 38:
104
+ $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START });
105
+ $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END });
106
+ this.$ = $$[$0 - 1];
107
+ break;
108
+ case 39:
109
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START });
110
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
111
+ this.$ = $$[$0 - 1];
112
+ break;
113
+ case 40:
114
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START });
115
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
116
+ this.$ = $$[$0 - 1];
117
+ break;
118
+ case 41:
119
+ $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START });
120
+ $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END });
121
+ this.$ = $$[$0 - 1];
122
+ break;
123
+ case 42:
124
+ $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START });
125
+ $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END });
126
+ this.$ = $$[$0 - 1];
127
+ break;
128
+ case 44:
129
+ this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]);
130
+ break;
131
+ case 46:
132
+ this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]);
133
+ break;
134
+ case 48:
135
+ this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]);
136
+ break;
137
+ case 49:
138
+ $$[$0 - 3].draw = "participant";
139
+ $$[$0 - 3].type = "addParticipant";
140
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
141
+ this.$ = $$[$0 - 3];
142
+ break;
143
+ case 50:
144
+ $$[$0 - 1].draw = "participant";
145
+ $$[$0 - 1].type = "addParticipant";
146
+ this.$ = $$[$0 - 1];
147
+ break;
148
+ case 51:
149
+ $$[$0 - 3].draw = "actor";
150
+ $$[$0 - 3].type = "addParticipant";
151
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
152
+ this.$ = $$[$0 - 3];
153
+ break;
154
+ case 52:
155
+ case 57:
156
+ $$[$0 - 1].draw = "actor";
157
+ $$[$0 - 1].type = "addParticipant";
158
+ this.$ = $$[$0 - 1];
159
+ break;
160
+ case 53:
161
+ $$[$0 - 1].type = "destroyParticipant";
162
+ this.$ = $$[$0 - 1];
163
+ break;
164
+ case 54:
165
+ $$[$0 - 3].draw = "participant";
166
+ $$[$0 - 3].type = "addParticipant";
167
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
168
+ this.$ = $$[$0 - 3];
169
+ break;
170
+ case 55:
171
+ $$[$0 - 1].draw = "participant";
172
+ $$[$0 - 1].type = "addParticipant";
173
+ this.$ = $$[$0 - 1];
174
+ break;
175
+ case 56:
176
+ $$[$0 - 3].draw = "actor";
177
+ $$[$0 - 3].type = "addParticipant";
178
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
179
+ this.$ = $$[$0 - 3];
180
+ break;
181
+ case 58:
182
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }];
183
+ break;
184
+ case 59:
185
+ $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2);
186
+ $$[$0 - 2][0] = $$[$0 - 2][0].actor;
187
+ $$[$0 - 2][1] = $$[$0 - 2][1].actor;
188
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }];
189
+ break;
190
+ case 60:
191
+ this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }];
192
+ break;
193
+ case 61:
194
+ this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }];
195
+ break;
196
+ case 62:
197
+ this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }];
198
+ break;
199
+ case 63:
200
+ this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }];
201
+ break;
202
+ case 66:
203
+ this.$ = [$$[$0 - 2], $$[$0]];
204
+ break;
205
+ case 67:
206
+ this.$ = $$[$0];
207
+ break;
208
+ case 68:
209
+ this.$ = yy.PLACEMENT.LEFTOF;
210
+ break;
211
+ case 69:
212
+ this.$ = yy.PLACEMENT.RIGHTOF;
213
+ break;
214
+ case 70:
215
+ this.$ = [
216
+ $$[$0 - 4],
217
+ $$[$0 - 1],
218
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true },
219
+ { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor }
220
+ ];
221
+ break;
222
+ case 71:
223
+ this.$ = [
224
+ $$[$0 - 4],
225
+ $$[$0 - 1],
226
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] },
227
+ { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4].actor }
228
+ ];
229
+ break;
230
+ case 72:
231
+ this.$ = [
232
+ $$[$0 - 4],
233
+ $$[$0 - 1],
234
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION },
235
+ { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor }
236
+ ];
237
+ break;
238
+ case 73:
239
+ this.$ = [
240
+ $$[$0 - 4],
241
+ $$[$0 - 1],
242
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0], activate: false, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE },
243
+ { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 4].actor }
244
+ ];
245
+ break;
246
+ case 74:
247
+ this.$ = [
248
+ $$[$0 - 5],
249
+ $$[$0 - 1],
250
+ { type: "addMessage", from: $$[$0 - 5].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_DUAL },
251
+ { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor },
252
+ { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 5].actor }
253
+ ];
254
+ break;
255
+ case 75:
256
+ this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }];
257
+ break;
258
+ case 76:
259
+ this.$ = {
260
+ type: "addParticipant",
261
+ actor: $$[$0 - 1],
262
+ config: $$[$0]
263
+ };
264
+ break;
265
+ case 77:
266
+ this.$ = $$[$0 - 1].trim();
267
+ break;
268
+ case 78:
269
+ this.$ = { type: "addParticipant", actor: $$[$0] };
270
+ break;
271
+ case 79:
272
+ this.$ = yy.LINETYPE.SOLID_OPEN;
273
+ break;
274
+ case 80:
275
+ this.$ = yy.LINETYPE.DOTTED_OPEN;
276
+ break;
277
+ case 81:
278
+ this.$ = yy.LINETYPE.SOLID;
279
+ break;
280
+ case 82:
281
+ this.$ = yy.LINETYPE.SOLID_TOP;
282
+ break;
283
+ case 83:
284
+ this.$ = yy.LINETYPE.SOLID_BOTTOM;
285
+ break;
286
+ case 84:
287
+ this.$ = yy.LINETYPE.STICK_TOP;
288
+ break;
289
+ case 85:
290
+ this.$ = yy.LINETYPE.STICK_BOTTOM;
291
+ break;
292
+ case 86:
293
+ this.$ = yy.LINETYPE.SOLID_TOP_DOTTED;
294
+ break;
295
+ case 87:
296
+ this.$ = yy.LINETYPE.SOLID_BOTTOM_DOTTED;
297
+ break;
298
+ case 88:
299
+ this.$ = yy.LINETYPE.STICK_TOP_DOTTED;
300
+ break;
301
+ case 89:
302
+ this.$ = yy.LINETYPE.STICK_BOTTOM_DOTTED;
303
+ break;
304
+ case 90:
305
+ this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE;
306
+ break;
307
+ case 91:
308
+ this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;
309
+ break;
310
+ case 92:
311
+ this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE;
312
+ break;
313
+ case 93:
314
+ this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;
315
+ break;
316
+ case 94:
317
+ this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;
318
+ break;
319
+ case 95:
320
+ this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;
321
+ break;
322
+ case 96:
323
+ this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;
324
+ break;
325
+ case 97:
326
+ this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
327
+ break;
328
+ case 98:
329
+ this.$ = yy.LINETYPE.BIDIRECTIONAL_SOLID;
330
+ break;
331
+ case 99:
332
+ this.$ = yy.LINETYPE.DOTTED;
333
+ break;
334
+ case 100:
335
+ this.$ = yy.LINETYPE.BIDIRECTIONAL_DOTTED;
336
+ break;
337
+ case 101:
338
+ this.$ = yy.LINETYPE.SOLID_CROSS;
339
+ break;
340
+ case 102:
341
+ this.$ = yy.LINETYPE.DOTTED_CROSS;
342
+ break;
343
+ case 103:
344
+ this.$ = yy.LINETYPE.SOLID_POINT;
345
+ break;
346
+ case 104:
347
+ this.$ = yy.LINETYPE.DOTTED_POINT;
348
+ break;
349
+ case 105:
350
+ this.$ = yy.parseMessage($$[$0].trim().substring(1));
351
+ break;
352
+ }
353
+ }, "anonymous"),
354
+ 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, 10, 14, 15, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o($Vy, [2, 5]), { 9: 48, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o($Vy, [2, 7]), o($Vy, [2, 8]), o($Vy, [2, 9]), o($Vy, [2, 15]), { 13: 49, 51: $Vp, 53: $Vq, 54: $Vr }, { 16: [1, 50] }, { 5: [1, 51] }, { 5: [1, 54], 20: [1, 52], 21: [1, 53] }, { 23: 55, 73: $Vx }, { 23: 56, 73: $Vx }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, { 5: [1, 61] }, o($Vy, [2, 30]), o($Vy, [2, 31]), { 33: [1, 62] }, { 35: [1, 63] }, o($Vy, [2, 34]), { 16: [1, 64] }, { 16: [1, 65] }, { 16: [1, 66] }, { 16: [1, 67] }, { 16: [1, 68] }, { 16: [1, 69] }, { 16: [1, 70] }, { 16: [1, 71] }, { 23: 72, 55: 73, 73: $Vz }, { 23: 75, 55: 76, 73: $Vz }, { 23: 77, 73: $Vx }, { 69: 78, 72: [1, 79], 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, { 57: 106, 59: [1, 107], 67: [1, 108], 68: [1, 109] }, { 23: 110, 73: $Vx }, { 23: 111, 73: $Vx }, { 23: 112, 73: $Vx }, { 23: 113, 73: $Vx }, o([5, 66, 72, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104], $V_), o($Vy, [2, 6]), o($Vy, [2, 16]), o($V$, [2, 10], { 11: 114 }), o($Vy, [2, 18]), { 5: [1, 116], 20: [1, 115] }, { 5: [1, 117] }, o($Vy, [2, 22]), { 5: [1, 118] }, { 5: [1, 119] }, o($Vy, [2, 25]), o($Vy, [2, 26]), o($Vy, [2, 27]), o($Vy, [2, 28]), o($Vy, [2, 29]), o($Vy, [2, 32]), o($Vy, [2, 33]), o($V01, $V3, { 7: 120 }), o($V01, $V3, { 7: 121 }), o($V01, $V3, { 7: 122 }), o($V11, $V3, { 41: 123, 7: 124 }), o($V21, $V3, { 43: 125, 7: 126 }), o($V21, $V3, { 7: 126, 43: 127 }), o($V31, $V3, { 46: 128, 7: 129 }), o($V01, $V3, { 7: 130 }), { 5: [1, 132], 52: [1, 131] }, { 5: [1, 134], 52: [1, 133] }, o($V41, $V_, { 74: 135, 75: [1, 136] }), { 5: [1, 138], 52: [1, 137] }, { 5: [1, 140], 52: [1, 139] }, { 5: [1, 141] }, { 23: 145, 70: [1, 142], 71: [1, 143], 72: [1, 144], 73: $Vx }, { 69: 146, 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, o($V51, [2, 79]), o($V51, [2, 80]), o($V51, [2, 81]), o($V51, [2, 82]), o($V51, [2, 83]), o($V51, [2, 84]), o($V51, [2, 85]), o($V51, [2, 86]), o($V51, [2, 87]), o($V51, [2, 88]), o($V51, [2, 89]), o($V51, [2, 90]), o($V51, [2, 91]), o($V51, [2, 92]), o($V51, [2, 93]), o($V51, [2, 94]), o($V51, [2, 95]), o($V51, [2, 96]), o($V51, [2, 97]), o($V51, [2, 98]), o($V51, [2, 99]), o($V51, [2, 100]), o($V51, [2, 101]), o($V51, [2, 102]), o($V51, [2, 103]), o($V51, [2, 104]), { 23: 147, 73: $Vx }, { 23: 149, 60: 148, 73: $Vx }, { 73: [2, 68] }, { 73: [2, 69] }, { 58: 150, 104: $V61 }, { 58: 152, 104: $V61 }, { 58: 153, 104: $V61 }, { 58: 154, 104: $V61 }, { 4: [1, 157], 5: [1, 159], 12: 156, 13: 158, 17: [1, 155], 51: $Vp, 53: $Vq, 54: $Vr }, { 5: [1, 160] }, o($Vy, [2, 20]), o($Vy, [2, 21]), o($Vy, [2, 23]), o($Vy, [2, 24]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 161], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 162], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 163], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 164] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 47], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 50: [1, 165], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 166] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 45], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 49: [1, 167], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 168] }, { 17: [1, 169] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 43], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 48: [1, 170], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 171], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 16: [1, 172] }, o($Vy, [2, 50]), { 16: [1, 173] }, o($Vy, [2, 55]), o($V41, [2, 76]), { 76: [1, 174] }, { 16: [1, 175] }, o($Vy, [2, 52]), { 16: [1, 176] }, o($Vy, [2, 57]), o($Vy, [2, 53]), { 23: 177, 73: $Vx }, { 23: 178, 73: $Vx }, { 23: 179, 73: $Vx }, { 58: 180, 104: $V61 }, { 23: 181, 72: [1, 182], 73: $Vx }, { 58: 183, 104: $V61 }, { 58: 184, 104: $V61 }, { 66: [1, 185], 104: [2, 67] }, { 5: [2, 60] }, { 5: [2, 105] }, { 5: [2, 61] }, { 5: [2, 62] }, { 5: [2, 63] }, o($Vy, [2, 17]), o($V$, [2, 11]), { 13: 186, 51: $Vp, 53: $Vq, 54: $Vr }, o($V$, [2, 13]), o($V$, [2, 14]), o($Vy, [2, 19]), o($Vy, [2, 35]), o($Vy, [2, 36]), o($Vy, [2, 37]), o($Vy, [2, 38]), { 16: [1, 187] }, o($Vy, [2, 39]), { 16: [1, 188] }, o($Vy, [2, 40]), o($Vy, [2, 41]), { 16: [1, 189] }, o($Vy, [2, 42]), { 5: [1, 190] }, { 5: [1, 191] }, { 77: [1, 192] }, { 5: [1, 193] }, { 5: [1, 194] }, { 58: 195, 104: $V61 }, { 58: 196, 104: $V61 }, { 58: 197, 104: $V61 }, { 5: [2, 75] }, { 58: 198, 104: $V61 }, { 23: 199, 73: $Vx }, { 5: [2, 58] }, { 5: [2, 59] }, { 23: 200, 73: $Vx }, o($V$, [2, 12]), o($V11, $V3, { 7: 124, 41: 201 }), o($V21, $V3, { 7: 126, 43: 202 }), o($V31, $V3, { 7: 129, 46: 203 }), o($Vy, [2, 49]), o($Vy, [2, 54]), o($V41, [2, 77]), o($Vy, [2, 51]), o($Vy, [2, 56]), { 5: [2, 70] }, { 5: [2, 71] }, { 5: [2, 72] }, { 5: [2, 73] }, { 58: 204, 104: $V61 }, { 104: [2, 66] }, { 17: [2, 48] }, { 17: [2, 46] }, { 17: [2, 44] }, { 5: [2, 74] }],
355
+ defaultActions: { 5: [2, 1], 6: [2, 2], 108: [2, 68], 109: [2, 69], 150: [2, 60], 151: [2, 105], 152: [2, 61], 153: [2, 62], 154: [2, 63], 180: [2, 75], 183: [2, 58], 184: [2, 59], 195: [2, 70], 196: [2, 71], 197: [2, 72], 198: [2, 73], 200: [2, 66], 201: [2, 48], 202: [2, 46], 203: [2, 44], 204: [2, 74] },
356
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
357
+ if (hash.recoverable) {
358
+ this.trace(str);
359
+ } else {
360
+ var error = new Error(str);
361
+ error.hash = hash;
362
+ throw error;
363
+ }
364
+ }, "parseError"),
365
+ parse: /* @__PURE__ */ __name(function parse(input) {
366
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
367
+ var args = lstack.slice.call(arguments, 1);
368
+ var lexer2 = Object.create(this.lexer);
369
+ var sharedState = { yy: {} };
370
+ for (var k in this.yy) {
371
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
372
+ sharedState.yy[k] = this.yy[k];
373
+ }
374
+ }
375
+ lexer2.setInput(input, sharedState.yy);
376
+ sharedState.yy.lexer = lexer2;
377
+ sharedState.yy.parser = this;
378
+ if (typeof lexer2.yylloc == "undefined") {
379
+ lexer2.yylloc = {};
380
+ }
381
+ var yyloc = lexer2.yylloc;
382
+ lstack.push(yyloc);
383
+ var ranges = lexer2.options && lexer2.options.ranges;
384
+ if (typeof sharedState.yy.parseError === "function") {
385
+ this.parseError = sharedState.yy.parseError;
386
+ } else {
387
+ this.parseError = Object.getPrototypeOf(this).parseError;
388
+ }
389
+ function popStack(n) {
390
+ stack.length = stack.length - 2 * n;
391
+ vstack.length = vstack.length - n;
392
+ lstack.length = lstack.length - n;
393
+ }
394
+ __name(popStack, "popStack");
395
+ function lex() {
396
+ var token;
397
+ token = tstack.pop() || lexer2.lex() || EOF;
398
+ if (typeof token !== "number") {
399
+ if (token instanceof Array) {
400
+ tstack = token;
401
+ token = tstack.pop();
402
+ }
403
+ token = self.symbols_[token] || token;
404
+ }
405
+ return token;
406
+ }
407
+ __name(lex, "lex");
408
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
409
+ while (true) {
410
+ state = stack[stack.length - 1];
411
+ if (this.defaultActions[state]) {
412
+ action = this.defaultActions[state];
413
+ } else {
414
+ if (symbol === null || typeof symbol == "undefined") {
415
+ symbol = lex();
416
+ }
417
+ action = table[state] && table[state][symbol];
418
+ }
419
+ if (typeof action === "undefined" || !action.length || !action[0]) {
420
+ var errStr = "";
421
+ expected = [];
422
+ for (p in table[state]) {
423
+ if (this.terminals_[p] && p > TERROR) {
424
+ expected.push("'" + this.terminals_[p] + "'");
425
+ }
426
+ }
427
+ if (lexer2.showPosition) {
428
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
429
+ } else {
430
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
431
+ }
432
+ this.parseError(errStr, {
433
+ text: lexer2.match,
434
+ token: this.terminals_[symbol] || symbol,
435
+ line: lexer2.yylineno,
436
+ loc: yyloc,
437
+ expected
438
+ });
439
+ }
440
+ if (action[0] instanceof Array && action.length > 1) {
441
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
442
+ }
443
+ switch (action[0]) {
444
+ case 1:
445
+ stack.push(symbol);
446
+ vstack.push(lexer2.yytext);
447
+ lstack.push(lexer2.yylloc);
448
+ stack.push(action[1]);
449
+ symbol = null;
450
+ {
451
+ yyleng = lexer2.yyleng;
452
+ yytext = lexer2.yytext;
453
+ yylineno = lexer2.yylineno;
454
+ yyloc = lexer2.yylloc;
455
+ }
456
+ break;
457
+ case 2:
458
+ len = this.productions_[action[1]][1];
459
+ yyval.$ = vstack[vstack.length - len];
460
+ yyval._$ = {
461
+ first_line: lstack[lstack.length - (len || 1)].first_line,
462
+ last_line: lstack[lstack.length - 1].last_line,
463
+ first_column: lstack[lstack.length - (len || 1)].first_column,
464
+ last_column: lstack[lstack.length - 1].last_column
465
+ };
466
+ if (ranges) {
467
+ yyval._$.range = [
468
+ lstack[lstack.length - (len || 1)].range[0],
469
+ lstack[lstack.length - 1].range[1]
470
+ ];
471
+ }
472
+ r = this.performAction.apply(yyval, [
473
+ yytext,
474
+ yyleng,
475
+ yylineno,
476
+ sharedState.yy,
477
+ action[1],
478
+ vstack,
479
+ lstack
480
+ ].concat(args));
481
+ if (typeof r !== "undefined") {
482
+ return r;
483
+ }
484
+ if (len) {
485
+ stack = stack.slice(0, -1 * len * 2);
486
+ vstack = vstack.slice(0, -1 * len);
487
+ lstack = lstack.slice(0, -1 * len);
488
+ }
489
+ stack.push(this.productions_[action[1]][0]);
490
+ vstack.push(yyval.$);
491
+ lstack.push(yyval._$);
492
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
493
+ stack.push(newState);
494
+ break;
495
+ case 3:
496
+ return true;
497
+ }
498
+ }
499
+ return true;
500
+ }, "parse")
501
+ };
502
+ var lexer = /* @__PURE__ */ (function() {
503
+ var lexer2 = {
504
+ EOF: 1,
505
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
506
+ if (this.yy.parser) {
507
+ this.yy.parser.parseError(str, hash);
508
+ } else {
509
+ throw new Error(str);
510
+ }
511
+ }, "parseError"),
512
+ // resets the lexer, sets new input
513
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
514
+ this.yy = yy || this.yy || {};
515
+ this._input = input;
516
+ this._more = this._backtrack = this.done = false;
517
+ this.yylineno = this.yyleng = 0;
518
+ this.yytext = this.matched = this.match = "";
519
+ this.conditionStack = ["INITIAL"];
520
+ this.yylloc = {
521
+ first_line: 1,
522
+ first_column: 0,
523
+ last_line: 1,
524
+ last_column: 0
525
+ };
526
+ if (this.options.ranges) {
527
+ this.yylloc.range = [0, 0];
528
+ }
529
+ this.offset = 0;
530
+ return this;
531
+ }, "setInput"),
532
+ // consumes and returns one char from the input
533
+ input: /* @__PURE__ */ __name(function() {
534
+ var ch = this._input[0];
535
+ this.yytext += ch;
536
+ this.yyleng++;
537
+ this.offset++;
538
+ this.match += ch;
539
+ this.matched += ch;
540
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
541
+ if (lines) {
542
+ this.yylineno++;
543
+ this.yylloc.last_line++;
544
+ } else {
545
+ this.yylloc.last_column++;
546
+ }
547
+ if (this.options.ranges) {
548
+ this.yylloc.range[1]++;
549
+ }
550
+ this._input = this._input.slice(1);
551
+ return ch;
552
+ }, "input"),
553
+ // unshifts one char (or a string) into the input
554
+ unput: /* @__PURE__ */ __name(function(ch) {
555
+ var len = ch.length;
556
+ var lines = ch.split(/(?:\r\n?|\n)/g);
557
+ this._input = ch + this._input;
558
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
559
+ this.offset -= len;
560
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
561
+ this.match = this.match.substr(0, this.match.length - 1);
562
+ this.matched = this.matched.substr(0, this.matched.length - 1);
563
+ if (lines.length - 1) {
564
+ this.yylineno -= lines.length - 1;
565
+ }
566
+ var r = this.yylloc.range;
567
+ this.yylloc = {
568
+ first_line: this.yylloc.first_line,
569
+ last_line: this.yylineno + 1,
570
+ first_column: this.yylloc.first_column,
571
+ 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
572
+ };
573
+ if (this.options.ranges) {
574
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
575
+ }
576
+ this.yyleng = this.yytext.length;
577
+ return this;
578
+ }, "unput"),
579
+ // When called from action, caches matched text and appends it on next action
580
+ more: /* @__PURE__ */ __name(function() {
581
+ this._more = true;
582
+ return this;
583
+ }, "more"),
584
+ // 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.
585
+ reject: /* @__PURE__ */ __name(function() {
586
+ if (this.options.backtrack_lexer) {
587
+ this._backtrack = true;
588
+ } else {
589
+ 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(), {
590
+ text: "",
591
+ token: null,
592
+ line: this.yylineno
593
+ });
594
+ }
595
+ return this;
596
+ }, "reject"),
597
+ // retain first n characters of the match
598
+ less: /* @__PURE__ */ __name(function(n) {
599
+ this.unput(this.match.slice(n));
600
+ }, "less"),
601
+ // displays already matched input, i.e. for error messages
602
+ pastInput: /* @__PURE__ */ __name(function() {
603
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
604
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
605
+ }, "pastInput"),
606
+ // displays upcoming input, i.e. for error messages
607
+ upcomingInput: /* @__PURE__ */ __name(function() {
608
+ var next = this.match;
609
+ if (next.length < 20) {
610
+ next += this._input.substr(0, 20 - next.length);
611
+ }
612
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
613
+ }, "upcomingInput"),
614
+ // displays the character position where the lexing error occurred, i.e. for error messages
615
+ showPosition: /* @__PURE__ */ __name(function() {
616
+ var pre = this.pastInput();
617
+ var c = new Array(pre.length + 1).join("-");
618
+ return pre + this.upcomingInput() + "\n" + c + "^";
619
+ }, "showPosition"),
620
+ // test the lexed token: return FALSE when not a match, otherwise return token
621
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
622
+ var token, lines, backup;
623
+ if (this.options.backtrack_lexer) {
624
+ backup = {
625
+ yylineno: this.yylineno,
626
+ yylloc: {
627
+ first_line: this.yylloc.first_line,
628
+ last_line: this.last_line,
629
+ first_column: this.yylloc.first_column,
630
+ last_column: this.yylloc.last_column
631
+ },
632
+ yytext: this.yytext,
633
+ match: this.match,
634
+ matches: this.matches,
635
+ matched: this.matched,
636
+ yyleng: this.yyleng,
637
+ offset: this.offset,
638
+ _more: this._more,
639
+ _input: this._input,
640
+ yy: this.yy,
641
+ conditionStack: this.conditionStack.slice(0),
642
+ done: this.done
643
+ };
644
+ if (this.options.ranges) {
645
+ backup.yylloc.range = this.yylloc.range.slice(0);
646
+ }
647
+ }
648
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
649
+ if (lines) {
650
+ this.yylineno += lines.length;
651
+ }
652
+ this.yylloc = {
653
+ first_line: this.yylloc.last_line,
654
+ last_line: this.yylineno + 1,
655
+ first_column: this.yylloc.last_column,
656
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
657
+ };
658
+ this.yytext += match[0];
659
+ this.match += match[0];
660
+ this.matches = match;
661
+ this.yyleng = this.yytext.length;
662
+ if (this.options.ranges) {
663
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
664
+ }
665
+ this._more = false;
666
+ this._backtrack = false;
667
+ this._input = this._input.slice(match[0].length);
668
+ this.matched += match[0];
669
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
670
+ if (this.done && this._input) {
671
+ this.done = false;
672
+ }
673
+ if (token) {
674
+ return token;
675
+ } else if (this._backtrack) {
676
+ for (var k in backup) {
677
+ this[k] = backup[k];
678
+ }
679
+ return false;
680
+ }
681
+ return false;
682
+ }, "test_match"),
683
+ // return next match in input
684
+ next: /* @__PURE__ */ __name(function() {
685
+ if (this.done) {
686
+ return this.EOF;
687
+ }
688
+ if (!this._input) {
689
+ this.done = true;
690
+ }
691
+ var token, match, tempMatch, index;
692
+ if (!this._more) {
693
+ this.yytext = "";
694
+ this.match = "";
695
+ }
696
+ var rules = this._currentRules();
697
+ for (var i = 0; i < rules.length; i++) {
698
+ tempMatch = this._input.match(this.rules[rules[i]]);
699
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
700
+ match = tempMatch;
701
+ index = i;
702
+ if (this.options.backtrack_lexer) {
703
+ token = this.test_match(tempMatch, rules[i]);
704
+ if (token !== false) {
705
+ return token;
706
+ } else if (this._backtrack) {
707
+ match = false;
708
+ continue;
709
+ } else {
710
+ return false;
711
+ }
712
+ } else if (!this.options.flex) {
713
+ break;
714
+ }
715
+ }
716
+ }
717
+ if (match) {
718
+ token = this.test_match(match, rules[index]);
719
+ if (token !== false) {
720
+ return token;
721
+ }
722
+ return false;
723
+ }
724
+ if (this._input === "") {
725
+ return this.EOF;
726
+ } else {
727
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
728
+ text: "",
729
+ token: null,
730
+ line: this.yylineno
731
+ });
732
+ }
733
+ }, "next"),
734
+ // return next match that has a token
735
+ lex: /* @__PURE__ */ __name(function lex() {
736
+ var r = this.next();
737
+ if (r) {
738
+ return r;
739
+ } else {
740
+ return this.lex();
741
+ }
742
+ }, "lex"),
743
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
744
+ begin: /* @__PURE__ */ __name(function begin(condition) {
745
+ this.conditionStack.push(condition);
746
+ }, "begin"),
747
+ // pop the previously active lexer condition state off the condition stack
748
+ popState: /* @__PURE__ */ __name(function popState() {
749
+ var n = this.conditionStack.length - 1;
750
+ if (n > 0) {
751
+ return this.conditionStack.pop();
752
+ } else {
753
+ return this.conditionStack[0];
754
+ }
755
+ }, "popState"),
756
+ // produce the lexer rule set which is active for the currently active lexer condition state
757
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
758
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
759
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
760
+ } else {
761
+ return this.conditions["INITIAL"].rules;
762
+ }
763
+ }, "_currentRules"),
764
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
765
+ topState: /* @__PURE__ */ __name(function topState(n) {
766
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
767
+ if (n >= 0) {
768
+ return this.conditionStack[n];
769
+ } else {
770
+ return "INITIAL";
771
+ }
772
+ }, "topState"),
773
+ // alias for begin(condition)
774
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
775
+ this.begin(condition);
776
+ }, "pushState"),
777
+ // return the number of states currently on the stack
778
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
779
+ return this.conditionStack.length;
780
+ }, "stateStackSize"),
781
+ options: { "case-insensitive": true },
782
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
783
+ switch ($avoiding_name_collisions) {
784
+ case 0:
785
+ return 5;
786
+ case 1:
787
+ break;
788
+ case 2:
789
+ break;
790
+ case 3:
791
+ break;
792
+ case 4:
793
+ break;
794
+ case 5:
795
+ break;
796
+ case 6:
797
+ return 20;
798
+ case 7:
799
+ this.begin("CONFIG");
800
+ return 75;
801
+ case 8:
802
+ return 76;
803
+ case 9:
804
+ this.popState();
805
+ this.begin("ALIAS");
806
+ return 77;
807
+ case 10:
808
+ this.popState();
809
+ this.popState();
810
+ return 77;
811
+ case 11:
812
+ yy_.yytext = yy_.yytext.trim();
813
+ return 73;
814
+ case 12:
815
+ yy_.yytext = yy_.yytext.trim();
816
+ this.begin("ALIAS");
817
+ return 73;
818
+ case 13:
819
+ yy_.yytext = yy_.yytext.trim();
820
+ this.popState();
821
+ return 73;
822
+ case 14:
823
+ this.popState();
824
+ return 10;
825
+ case 15:
826
+ yy_.yytext = yy_.yytext.trim();
827
+ this.popState();
828
+ return 10;
829
+ case 16:
830
+ this.begin("LINE");
831
+ return 15;
832
+ case 17:
833
+ this.begin("ID");
834
+ return 51;
835
+ case 18:
836
+ this.begin("ID");
837
+ return 53;
838
+ case 19:
839
+ return 14;
840
+ case 20:
841
+ this.begin("ID");
842
+ return 54;
843
+ case 21:
844
+ this.popState();
845
+ this.popState();
846
+ this.begin("LINE");
847
+ return 52;
848
+ case 22:
849
+ this.popState();
850
+ this.popState();
851
+ return 5;
852
+ case 23:
853
+ this.begin("LINE");
854
+ return 37;
855
+ case 24:
856
+ this.begin("LINE");
857
+ return 38;
858
+ case 25:
859
+ this.begin("LINE");
860
+ return 39;
861
+ case 26:
862
+ this.begin("LINE");
863
+ return 40;
864
+ case 27:
865
+ this.begin("LINE");
866
+ return 50;
867
+ case 28:
868
+ this.begin("LINE");
869
+ return 42;
870
+ case 29:
871
+ this.begin("LINE");
872
+ return 44;
873
+ case 30:
874
+ this.begin("LINE");
875
+ return 49;
876
+ case 31:
877
+ this.begin("LINE");
878
+ return 45;
879
+ case 32:
880
+ this.begin("LINE");
881
+ return 48;
882
+ case 33:
883
+ this.begin("LINE");
884
+ return 47;
885
+ case 34:
886
+ this.popState();
887
+ return 16;
888
+ case 35:
889
+ return 17;
890
+ case 36:
891
+ return 67;
892
+ case 37:
893
+ return 68;
894
+ case 38:
895
+ return 61;
896
+ case 39:
897
+ return 62;
898
+ case 40:
899
+ return 63;
900
+ case 41:
901
+ return 64;
902
+ case 42:
903
+ return 59;
904
+ case 43:
905
+ return 56;
906
+ case 44:
907
+ this.begin("ID");
908
+ return 22;
909
+ case 45:
910
+ this.begin("ID");
911
+ return 24;
912
+ case 46:
913
+ return 30;
914
+ case 47:
915
+ return 31;
916
+ case 48:
917
+ this.begin("acc_title");
918
+ return 32;
919
+ case 49:
920
+ this.popState();
921
+ return "acc_title_value";
922
+ case 50:
923
+ this.begin("acc_descr");
924
+ return 34;
925
+ case 51:
926
+ this.popState();
927
+ return "acc_descr_value";
928
+ case 52:
929
+ this.begin("acc_descr_multiline");
930
+ break;
931
+ case 53:
932
+ this.popState();
933
+ break;
934
+ case 54:
935
+ return "acc_descr_multiline_value";
936
+ case 55:
937
+ return 6;
938
+ case 56:
939
+ return 19;
940
+ case 57:
941
+ return 21;
942
+ case 58:
943
+ return 66;
944
+ case 59:
945
+ return 5;
946
+ case 60:
947
+ yy_.yytext = yy_.yytext.trim();
948
+ return 73;
949
+ case 61:
950
+ return 80;
951
+ case 62:
952
+ return 97;
953
+ case 63:
954
+ return 98;
955
+ case 64:
956
+ return 99;
957
+ case 65:
958
+ return 78;
959
+ case 66:
960
+ return 79;
961
+ case 67:
962
+ return 100;
963
+ case 68:
964
+ return 101;
965
+ case 69:
966
+ return 102;
967
+ case 70:
968
+ return 103;
969
+ case 71:
970
+ return 85;
971
+ case 72:
972
+ return 86;
973
+ case 73:
974
+ return 87;
975
+ case 74:
976
+ return 88;
977
+ case 75:
978
+ return 93;
979
+ case 76:
980
+ return 94;
981
+ case 77:
982
+ return 95;
983
+ case 78:
984
+ return 96;
985
+ case 79:
986
+ return 81;
987
+ case 80:
988
+ return 82;
989
+ case 81:
990
+ return 83;
991
+ case 82:
992
+ return 84;
993
+ case 83:
994
+ return 89;
995
+ case 84:
996
+ return 90;
997
+ case 85:
998
+ return 91;
999
+ case 86:
1000
+ return 92;
1001
+ case 87:
1002
+ return 104;
1003
+ case 88:
1004
+ return 104;
1005
+ case 89:
1006
+ return 70;
1007
+ case 90:
1008
+ return 71;
1009
+ case 91:
1010
+ return 72;
1011
+ case 92:
1012
+ return 5;
1013
+ case 93:
1014
+ return 10;
1015
+ }
1016
+ }, "anonymous"),
1017
+ rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:([0-9]+(\.[0-9]{1,2})?|\.[0-9]{1,2})(?=[ \n]+))/i, /^(?:@\{)/i, /^(?:[^\}]+)/i, /^(?:\}(?=\s+as\s))/i, /^(?:\})/i, /^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i, /^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i, /^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i, /^(?:[^<>:\n,;@]*<[^\n]*)/i, /^(?:[^\n]+)/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/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, /^(?:--\|\\)/i, /^(?:--\|\/)/i, /^(?:--\\\\)/i, /^(?:--\/\/)/i, /^(?:\/\|--)/i, /^(?:\\\|--)/i, /^(?:\/\/--)/i, /^(?:\\\\--)/i, /^(?:-\|\\)/i, /^(?:-\|\/)/i, /^(?:-\\\\)/i, /^(?:-\/\/)/i, /^(?:\/\|-)/i, /^(?:\\\|-)/i, /^(?:\/\/-)/i, /^(?:\\\\-)/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:\(\))/i, /^(?:$)/i, /^(?:.)/i],
1018
+ conditions: { "acc_descr_multiline": { "rules": [53, 54], "inclusive": false }, "acc_descr": { "rules": [51], "inclusive": false }, "acc_title": { "rules": [49], "inclusive": false }, "ID": { "rules": [2, 3, 7, 11, 12, 13, 14, 15], "inclusive": false }, "ALIAS": { "rules": [2, 3, 21, 22], "inclusive": false }, "LINE": { "rules": [2, 3, 34], "inclusive": false }, "CONFIG": { "rules": [8, 9, 10], "inclusive": false }, "CONFIG_DATA": { "rules": [], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 4, 5, 6, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93], "inclusive": true } }
1019
+ };
1020
+ return lexer2;
1021
+ })();
1022
+ parser2.lexer = lexer;
1023
+ function Parser() {
1024
+ this.yy = {};
1025
+ }
1026
+ __name(Parser, "Parser");
1027
+ Parser.prototype = parser2;
1028
+ parser2.Parser = Parser;
1029
+ return new Parser();
1030
+ })();
1031
+ parser.parser = parser;
1032
+ var sequenceDiagram_default = parser;
1033
+ var LINETYPE = {
1034
+ SOLID: 0,
1035
+ DOTTED: 1,
1036
+ NOTE: 2,
1037
+ SOLID_CROSS: 3,
1038
+ DOTTED_CROSS: 4,
1039
+ SOLID_OPEN: 5,
1040
+ DOTTED_OPEN: 6,
1041
+ LOOP_START: 10,
1042
+ LOOP_END: 11,
1043
+ ALT_START: 12,
1044
+ ALT_ELSE: 13,
1045
+ ALT_END: 14,
1046
+ OPT_START: 15,
1047
+ OPT_END: 16,
1048
+ ACTIVE_START: 17,
1049
+ ACTIVE_END: 18,
1050
+ PAR_START: 19,
1051
+ PAR_AND: 20,
1052
+ PAR_END: 21,
1053
+ RECT_START: 22,
1054
+ RECT_END: 23,
1055
+ SOLID_POINT: 24,
1056
+ DOTTED_POINT: 25,
1057
+ AUTONUMBER: 26,
1058
+ CRITICAL_START: 27,
1059
+ CRITICAL_OPTION: 28,
1060
+ CRITICAL_END: 29,
1061
+ BREAK_START: 30,
1062
+ BREAK_END: 31,
1063
+ PAR_OVER_START: 32,
1064
+ BIDIRECTIONAL_SOLID: 33,
1065
+ BIDIRECTIONAL_DOTTED: 34,
1066
+ SOLID_TOP: 41,
1067
+ SOLID_BOTTOM: 42,
1068
+ STICK_TOP: 43,
1069
+ STICK_BOTTOM: 44,
1070
+ SOLID_ARROW_TOP_REVERSE: 45,
1071
+ SOLID_ARROW_BOTTOM_REVERSE: 46,
1072
+ STICK_ARROW_TOP_REVERSE: 47,
1073
+ STICK_ARROW_BOTTOM_REVERSE: 48,
1074
+ SOLID_TOP_DOTTED: 51,
1075
+ SOLID_BOTTOM_DOTTED: 52,
1076
+ STICK_TOP_DOTTED: 53,
1077
+ STICK_BOTTOM_DOTTED: 54,
1078
+ SOLID_ARROW_TOP_REVERSE_DOTTED: 55,
1079
+ SOLID_ARROW_BOTTOM_REVERSE_DOTTED: 56,
1080
+ STICK_ARROW_TOP_REVERSE_DOTTED: 57,
1081
+ STICK_ARROW_BOTTOM_REVERSE_DOTTED: 58,
1082
+ CENTRAL_CONNECTION: 59,
1083
+ CENTRAL_CONNECTION_REVERSE: 60,
1084
+ CENTRAL_CONNECTION_DUAL: 61
1085
+ };
1086
+ var ARROWTYPE = {
1087
+ FILLED: 0,
1088
+ OPEN: 1
1089
+ };
1090
+ var PLACEMENT = {
1091
+ LEFTOF: 0,
1092
+ RIGHTOF: 1,
1093
+ OVER: 2
1094
+ };
1095
+ var PARTICIPANT_TYPE = {
1096
+ ACTOR: "actor",
1097
+ CONTROL: "control",
1098
+ DATABASE: "database",
1099
+ ENTITY: "entity"
1100
+ };
1101
+ var SequenceDB = (_a = class {
1102
+ constructor() {
1103
+ this.state = new ImperativeState(() => ({
1104
+ prevActor: void 0,
1105
+ actors: /* @__PURE__ */ new Map(),
1106
+ createdActors: /* @__PURE__ */ new Map(),
1107
+ destroyedActors: /* @__PURE__ */ new Map(),
1108
+ boxes: [],
1109
+ messages: [],
1110
+ notes: [],
1111
+ sequenceNumbersEnabled: false,
1112
+ wrapEnabled: void 0,
1113
+ currentBox: void 0,
1114
+ lastCreated: void 0,
1115
+ lastDestroyed: void 0
1116
+ }));
1117
+ this.setAccTitle = setAccTitle;
1118
+ this.setAccDescription = setAccDescription;
1119
+ this.setDiagramTitle = setDiagramTitle;
1120
+ this.getAccTitle = getAccTitle;
1121
+ this.getAccDescription = getAccDescription;
1122
+ this.getDiagramTitle = getDiagramTitle;
1123
+ this.apply = this.apply.bind(this);
1124
+ this.parseBoxData = this.parseBoxData.bind(this);
1125
+ this.parseMessage = this.parseMessage.bind(this);
1126
+ this.clear();
1127
+ this.setWrap(getConfig2().wrap);
1128
+ this.LINETYPE = LINETYPE;
1129
+ this.ARROWTYPE = ARROWTYPE;
1130
+ this.PLACEMENT = PLACEMENT;
1131
+ }
1132
+ addBox(data) {
1133
+ this.state.records.boxes.push({
1134
+ name: data.text,
1135
+ wrap: data.wrap ?? this.autoWrap(),
1136
+ fill: data.color,
1137
+ actorKeys: []
1138
+ });
1139
+ this.state.records.currentBox = this.state.records.boxes.slice(-1)[0];
1140
+ }
1141
+ addActor(id, name, description, type, metadata) {
1142
+ let assignedBox = this.state.records.currentBox;
1143
+ let doc;
1144
+ if (metadata !== void 0) {
1145
+ let yamlData;
1146
+ if (!metadata.includes("\n")) {
1147
+ yamlData = "{\n" + metadata + "\n}";
1148
+ } else {
1149
+ yamlData = metadata + "\n";
1150
+ }
1151
+ doc = load(yamlData, { schema: JSON_SCHEMA });
1152
+ }
1153
+ type = (doc == null ? void 0 : doc.type) ?? type;
1154
+ if ((doc == null ? void 0 : doc.alias) && (!description || description.text === name)) {
1155
+ description = { text: doc.alias, wrap: description == null ? void 0 : description.wrap, type };
1156
+ }
1157
+ const old = this.state.records.actors.get(id);
1158
+ if (old) {
1159
+ if (this.state.records.currentBox && old.box && this.state.records.currentBox !== old.box) {
1160
+ throw new Error(
1161
+ `A same participant should only be defined in one Box: ${old.name} can't be in '${old.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`
1162
+ );
1163
+ }
1164
+ assignedBox = old.box ? old.box : this.state.records.currentBox;
1165
+ old.box = assignedBox;
1166
+ if (old && name === old.name && description == null) {
1167
+ return;
1168
+ }
1169
+ }
1170
+ if ((description == null ? void 0 : description.text) == null) {
1171
+ description = { text: name, type };
1172
+ }
1173
+ if (type == null || description.text == null) {
1174
+ description = { text: name, type };
1175
+ }
1176
+ this.state.records.actors.set(id, {
1177
+ box: assignedBox,
1178
+ name,
1179
+ description: description.text,
1180
+ wrap: description.wrap ?? this.autoWrap(),
1181
+ prevActor: this.state.records.prevActor,
1182
+ links: {},
1183
+ properties: {},
1184
+ actorCnt: null,
1185
+ rectData: null,
1186
+ type: type ?? "participant"
1187
+ });
1188
+ if (this.state.records.prevActor) {
1189
+ const prevActorInRecords = this.state.records.actors.get(this.state.records.prevActor);
1190
+ if (prevActorInRecords) {
1191
+ prevActorInRecords.nextActor = id;
1192
+ }
1193
+ }
1194
+ if (this.state.records.currentBox) {
1195
+ this.state.records.currentBox.actorKeys.push(id);
1196
+ }
1197
+ this.state.records.prevActor = id;
1198
+ }
1199
+ activationCount(part) {
1200
+ let i;
1201
+ let count = 0;
1202
+ if (!part) {
1203
+ return 0;
1204
+ }
1205
+ for (i = 0; i < this.state.records.messages.length; i++) {
1206
+ if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[i].from === part) {
1207
+ count++;
1208
+ }
1209
+ if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[i].from === part) {
1210
+ count--;
1211
+ }
1212
+ }
1213
+ return count;
1214
+ }
1215
+ addMessage(idFrom, idTo, message, answer) {
1216
+ this.state.records.messages.push({
1217
+ id: this.state.records.messages.length.toString(),
1218
+ from: idFrom,
1219
+ to: idTo,
1220
+ message: message.text,
1221
+ wrap: message.wrap ?? this.autoWrap(),
1222
+ answer
1223
+ });
1224
+ }
1225
+ addSignal(idFrom, idTo, message, messageType, activate = false, centralConnection) {
1226
+ if (messageType === this.LINETYPE.ACTIVE_END) {
1227
+ const cnt = this.activationCount(idFrom ?? "");
1228
+ if (cnt < 1) {
1229
+ const error = new Error("Trying to inactivate an inactive participant (" + idFrom + ")");
1230
+ error.hash = {
1231
+ text: "->>-",
1232
+ token: "->>-",
1233
+ line: "1",
1234
+ loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
1235
+ expected: ["'ACTIVE_PARTICIPANT'"]
1236
+ };
1237
+ throw error;
1238
+ }
1239
+ }
1240
+ this.state.records.messages.push({
1241
+ id: this.state.records.messages.length.toString(),
1242
+ from: idFrom,
1243
+ to: idTo,
1244
+ message: (message == null ? void 0 : message.text) ?? "",
1245
+ wrap: (message == null ? void 0 : message.wrap) ?? this.autoWrap(),
1246
+ type: messageType,
1247
+ activate,
1248
+ centralConnection: centralConnection ?? 0
1249
+ });
1250
+ return true;
1251
+ }
1252
+ hasAtLeastOneBox() {
1253
+ return this.state.records.boxes.length > 0;
1254
+ }
1255
+ hasAtLeastOneBoxWithTitle() {
1256
+ return this.state.records.boxes.some((b) => b.name);
1257
+ }
1258
+ getMessages() {
1259
+ return this.state.records.messages;
1260
+ }
1261
+ getBoxes() {
1262
+ return this.state.records.boxes;
1263
+ }
1264
+ getActors() {
1265
+ return this.state.records.actors;
1266
+ }
1267
+ getCreatedActors() {
1268
+ return this.state.records.createdActors;
1269
+ }
1270
+ getDestroyedActors() {
1271
+ return this.state.records.destroyedActors;
1272
+ }
1273
+ getActor(id) {
1274
+ return this.state.records.actors.get(id);
1275
+ }
1276
+ getActorKeys() {
1277
+ return [...this.state.records.actors.keys()];
1278
+ }
1279
+ enableSequenceNumbers() {
1280
+ this.state.records.sequenceNumbersEnabled = true;
1281
+ }
1282
+ disableSequenceNumbers() {
1283
+ this.state.records.sequenceNumbersEnabled = false;
1284
+ }
1285
+ showSequenceNumbers() {
1286
+ return this.state.records.sequenceNumbersEnabled;
1287
+ }
1288
+ setWrap(wrapSetting) {
1289
+ this.state.records.wrapEnabled = wrapSetting;
1290
+ }
1291
+ extractWrap(text) {
1292
+ if (text === void 0) {
1293
+ return {};
1294
+ }
1295
+ text = text.trim();
1296
+ const wrap = /^:?wrap:/.exec(text) !== null ? true : /^:?nowrap:/.exec(text) !== null ? false : void 0;
1297
+ const cleanedText = (wrap === void 0 ? text : text.replace(/^:?(?:no)?wrap:/, "")).trim();
1298
+ return { cleanedText, wrap };
1299
+ }
1300
+ autoWrap() {
1301
+ var _a2;
1302
+ if (this.state.records.wrapEnabled !== void 0) {
1303
+ return this.state.records.wrapEnabled;
1304
+ }
1305
+ return ((_a2 = getConfig2().sequence) == null ? void 0 : _a2.wrap) ?? false;
1306
+ }
1307
+ clear() {
1308
+ this.state.reset();
1309
+ clear();
1310
+ }
1311
+ parseMessage(str) {
1312
+ const trimmedStr = str.trim();
1313
+ const { wrap, cleanedText } = this.extractWrap(trimmedStr);
1314
+ const message = {
1315
+ text: cleanedText,
1316
+ wrap
1317
+ };
1318
+ log.debug(`parseMessage: ${JSON.stringify(message)}`);
1319
+ return message;
1320
+ }
1321
+ // We expect the box statement to be color first then description
1322
+ // The color can be rgb,rgba,hsl,hsla, or css code names #hex codes are not supported for now because of the way the char # is handled
1323
+ // We extract first segment as color, the rest of the line is considered as text
1324
+ parseBoxData(str) {
1325
+ const match = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(str);
1326
+ let color = (match == null ? void 0 : match[1]) ? match[1].trim() : "transparent";
1327
+ let title = (match == null ? void 0 : match[2]) ? match[2].trim() : void 0;
1328
+ if (window == null ? void 0 : window.CSS) {
1329
+ if (!window.CSS.supports("color", color)) {
1330
+ color = "transparent";
1331
+ title = str.trim();
1332
+ }
1333
+ } else {
1334
+ const style = new Option().style;
1335
+ style.color = color;
1336
+ if (style.color !== color) {
1337
+ color = "transparent";
1338
+ title = str.trim();
1339
+ }
1340
+ }
1341
+ const { wrap, cleanedText } = this.extractWrap(title);
1342
+ return {
1343
+ text: cleanedText ? sanitizeText(cleanedText, getConfig2()) : void 0,
1344
+ color,
1345
+ wrap
1346
+ };
1347
+ }
1348
+ addNote(actor, placement, message) {
1349
+ const note = {
1350
+ actor,
1351
+ placement,
1352
+ message: message.text,
1353
+ wrap: message.wrap ?? this.autoWrap()
1354
+ };
1355
+ const actors = [].concat(actor, actor);
1356
+ this.state.records.notes.push(note);
1357
+ this.state.records.messages.push({
1358
+ id: this.state.records.messages.length.toString(),
1359
+ from: actors[0],
1360
+ to: actors[1],
1361
+ message: message.text,
1362
+ wrap: message.wrap ?? this.autoWrap(),
1363
+ type: this.LINETYPE.NOTE,
1364
+ placement
1365
+ });
1366
+ }
1367
+ addLinks(actorId, text) {
1368
+ const actor = this.getActor(actorId);
1369
+ try {
1370
+ let sanitizedText = sanitizeText(text.text, getConfig2());
1371
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1372
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1373
+ const links = JSON.parse(sanitizedText);
1374
+ this.insertLinks(actor, links);
1375
+ } catch (e) {
1376
+ log.error("error while parsing actor link text", e);
1377
+ }
1378
+ }
1379
+ addALink(actorId, text) {
1380
+ const actor = this.getActor(actorId);
1381
+ try {
1382
+ const links = {};
1383
+ let sanitizedText = sanitizeText(text.text, getConfig2());
1384
+ const sep = sanitizedText.indexOf("@");
1385
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1386
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1387
+ const label = sanitizedText.slice(0, sep - 1).trim();
1388
+ const link = sanitizedText.slice(sep + 1).trim();
1389
+ links[label] = link;
1390
+ this.insertLinks(actor, links);
1391
+ } catch (e) {
1392
+ log.error("error while parsing actor link text", e);
1393
+ }
1394
+ }
1395
+ insertLinks(actor, links) {
1396
+ if (actor.links == null) {
1397
+ actor.links = links;
1398
+ } else {
1399
+ for (const key in links) {
1400
+ actor.links[key] = links[key];
1401
+ }
1402
+ }
1403
+ }
1404
+ addProperties(actorId, text) {
1405
+ const actor = this.getActor(actorId);
1406
+ try {
1407
+ const sanitizedText = sanitizeText(text.text, getConfig2());
1408
+ const properties = JSON.parse(sanitizedText);
1409
+ this.insertProperties(actor, properties);
1410
+ } catch (e) {
1411
+ log.error("error while parsing actor properties text", e);
1412
+ }
1413
+ }
1414
+ insertProperties(actor, properties) {
1415
+ if (actor.properties == null) {
1416
+ actor.properties = properties;
1417
+ } else {
1418
+ for (const key in properties) {
1419
+ actor.properties[key] = properties[key];
1420
+ }
1421
+ }
1422
+ }
1423
+ boxEnd() {
1424
+ this.state.records.currentBox = void 0;
1425
+ }
1426
+ addDetails(actorId, text) {
1427
+ const actor = this.getActor(actorId);
1428
+ const elem = document.getElementById(text.text);
1429
+ try {
1430
+ const text2 = elem.innerHTML;
1431
+ const details = JSON.parse(text2);
1432
+ if (details.properties) {
1433
+ this.insertProperties(actor, details.properties);
1434
+ }
1435
+ if (details.links) {
1436
+ this.insertLinks(actor, details.links);
1437
+ }
1438
+ } catch (e) {
1439
+ log.error("error while parsing actor details text", e);
1440
+ }
1441
+ }
1442
+ getActorProperty(actor, key) {
1443
+ if ((actor == null ? void 0 : actor.properties) !== void 0) {
1444
+ return actor.properties[key];
1445
+ }
1446
+ return void 0;
1447
+ }
1448
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
1449
+ apply(param) {
1450
+ if (Array.isArray(param)) {
1451
+ param.forEach((item) => {
1452
+ this.apply(item);
1453
+ });
1454
+ } else {
1455
+ switch (param.type) {
1456
+ case "sequenceIndex":
1457
+ this.state.records.messages.push({
1458
+ id: this.state.records.messages.length.toString(),
1459
+ from: void 0,
1460
+ to: void 0,
1461
+ message: {
1462
+ start: param.sequenceIndex,
1463
+ step: param.sequenceIndexStep,
1464
+ visible: param.sequenceVisible
1465
+ },
1466
+ wrap: false,
1467
+ type: param.signalType
1468
+ });
1469
+ break;
1470
+ case "addParticipant":
1471
+ this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
1472
+ break;
1473
+ case "createParticipant":
1474
+ if (this.state.records.actors.has(param.actor)) {
1475
+ throw new Error(
1476
+ "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"
1477
+ );
1478
+ }
1479
+ this.state.records.lastCreated = param.actor;
1480
+ this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
1481
+ this.state.records.createdActors.set(param.actor, this.state.records.messages.length);
1482
+ break;
1483
+ case "destroyParticipant":
1484
+ this.state.records.lastDestroyed = param.actor;
1485
+ this.state.records.destroyedActors.set(param.actor, this.state.records.messages.length);
1486
+ break;
1487
+ case "activeStart":
1488
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1489
+ break;
1490
+ case "centralConnection":
1491
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1492
+ break;
1493
+ case "centralConnectionReverse":
1494
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1495
+ break;
1496
+ case "activeEnd":
1497
+ this.addSignal(param.actor, void 0, void 0, param.signalType);
1498
+ break;
1499
+ case "addNote":
1500
+ this.addNote(param.actor, param.placement, param.text);
1501
+ break;
1502
+ case "addLinks":
1503
+ this.addLinks(param.actor, param.text);
1504
+ break;
1505
+ case "addALink":
1506
+ this.addALink(param.actor, param.text);
1507
+ break;
1508
+ case "addProperties":
1509
+ this.addProperties(param.actor, param.text);
1510
+ break;
1511
+ case "addDetails":
1512
+ this.addDetails(param.actor, param.text);
1513
+ break;
1514
+ case "addMessage":
1515
+ if (this.state.records.lastCreated) {
1516
+ if (param.to !== this.state.records.lastCreated) {
1517
+ throw new Error(
1518
+ "The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
1519
+ );
1520
+ } else {
1521
+ this.state.records.lastCreated = void 0;
1522
+ }
1523
+ } else if (this.state.records.lastDestroyed) {
1524
+ if (param.to !== this.state.records.lastDestroyed && param.from !== this.state.records.lastDestroyed) {
1525
+ throw new Error(
1526
+ "The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
1527
+ );
1528
+ } else {
1529
+ this.state.records.lastDestroyed = void 0;
1530
+ }
1531
+ }
1532
+ this.addSignal(
1533
+ param.from,
1534
+ param.to,
1535
+ param.msg,
1536
+ param.signalType,
1537
+ param.activate,
1538
+ param.centralConnection
1539
+ );
1540
+ break;
1541
+ case "boxStart":
1542
+ this.addBox(param.boxData);
1543
+ break;
1544
+ case "boxEnd":
1545
+ this.boxEnd();
1546
+ break;
1547
+ case "loopStart":
1548
+ this.addSignal(void 0, void 0, param.loopText, param.signalType);
1549
+ break;
1550
+ case "loopEnd":
1551
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1552
+ break;
1553
+ case "rectStart":
1554
+ this.addSignal(void 0, void 0, param.color, param.signalType);
1555
+ break;
1556
+ case "rectEnd":
1557
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1558
+ break;
1559
+ case "optStart":
1560
+ this.addSignal(void 0, void 0, param.optText, param.signalType);
1561
+ break;
1562
+ case "optEnd":
1563
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1564
+ break;
1565
+ case "altStart":
1566
+ this.addSignal(void 0, void 0, param.altText, param.signalType);
1567
+ break;
1568
+ case "else":
1569
+ this.addSignal(void 0, void 0, param.altText, param.signalType);
1570
+ break;
1571
+ case "altEnd":
1572
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1573
+ break;
1574
+ case "setAccTitle":
1575
+ setAccTitle(param.text);
1576
+ break;
1577
+ case "parStart":
1578
+ this.addSignal(void 0, void 0, param.parText, param.signalType);
1579
+ break;
1580
+ case "and":
1581
+ this.addSignal(void 0, void 0, param.parText, param.signalType);
1582
+ break;
1583
+ case "parEnd":
1584
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1585
+ break;
1586
+ case "criticalStart":
1587
+ this.addSignal(void 0, void 0, param.criticalText, param.signalType);
1588
+ break;
1589
+ case "option":
1590
+ this.addSignal(void 0, void 0, param.optionText, param.signalType);
1591
+ break;
1592
+ case "criticalEnd":
1593
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1594
+ break;
1595
+ case "breakStart":
1596
+ this.addSignal(void 0, void 0, param.breakText, param.signalType);
1597
+ break;
1598
+ case "breakEnd":
1599
+ this.addSignal(void 0, void 0, void 0, param.signalType);
1600
+ break;
1601
+ }
1602
+ }
1603
+ }
1604
+ getConfig() {
1605
+ return getConfig2().sequence;
1606
+ }
1607
+ }, __name(_a, "SequenceDB"), _a);
1608
+ var getStyles = /* @__PURE__ */ __name((options) => {
1609
+ const dropShadow = options.dropShadow ?? "none";
1610
+ const { look } = getConfig2();
1611
+ return `.actor {
1612
+ stroke: ${options.actorBorder};
1613
+ fill: ${options.actorBkg};
1614
+ stroke-width: ${options.strokeWidth ?? 1};
1615
+ }
1616
+
1617
+ rect.actor.outer-path[data-look="neo"] {
1618
+ filter: ${dropShadow};
1619
+ }
1620
+
1621
+ rect.note[data-look="neo"] {
1622
+ stroke:${options.noteBorderColor};
1623
+ fill:${options.noteBkgColor};
1624
+ filter: ${dropShadow};
1625
+ }
1626
+
1627
+ text.actor > tspan {
1628
+ fill: ${options.actorTextColor};
1629
+ stroke: none;
1630
+ }
1631
+
1632
+ .actor-line {
1633
+ stroke: ${options.actorLineColor};
1634
+ }
1635
+
1636
+ .innerArc {
1637
+ stroke-width: 1.5;
1638
+ stroke-dasharray: none;
1639
+ }
1640
+
1641
+ .messageLine0 {
1642
+ stroke-width: 1.5;
1643
+ stroke-dasharray: none;
1644
+ stroke: ${options.signalColor};
1645
+ }
1646
+
1647
+ .messageLine1 {
1648
+ stroke-width: 1.5;
1649
+ stroke-dasharray: 2, 2;
1650
+ stroke: ${options.signalColor};
1651
+ }
1652
+
1653
+ [id$="-arrowhead"] path {
1654
+ fill: ${options.signalColor};
1655
+ stroke: ${options.signalColor};
1656
+ }
1657
+
1658
+ .sequenceNumber {
1659
+ fill: ${options.sequenceNumberColor};
1660
+ }
1661
+
1662
+ [id$="-sequencenumber"] {
1663
+ fill: ${options.signalColor};
1664
+ }
1665
+
1666
+ [id$="-crosshead"] path {
1667
+ fill: ${options.signalColor};
1668
+ stroke: ${options.signalColor};
1669
+ }
1670
+
1671
+ .messageText {
1672
+ fill: ${options.signalTextColor};
1673
+ stroke: none;
1674
+ }
1675
+
1676
+ .labelBox {
1677
+ stroke: ${options.labelBoxBorderColor};
1678
+ fill: ${options.labelBoxBkgColor};
1679
+ filter: ${look === "neo" ? dropShadow : "none"};
1680
+ }
1681
+
1682
+ .labelText, .labelText > tspan {
1683
+ fill: ${options.labelTextColor};
1684
+ stroke: none;
1685
+ }
1686
+
1687
+ .loopText, .loopText > tspan {
1688
+ fill: ${options.loopTextColor};
1689
+ stroke: none;
1690
+ }
1691
+
1692
+ .sectionTitle, .sectionTitle > tspan {
1693
+ fill: ${options.loopTextColor};
1694
+ stroke: none;
1695
+ }
1696
+
1697
+ .loopLine {
1698
+ stroke-width: 2px;
1699
+ stroke-dasharray: 2, 2;
1700
+ stroke: ${options.labelBoxBorderColor};
1701
+ fill: ${options.labelBoxBorderColor};
1702
+ }
1703
+
1704
+ .note {
1705
+ //stroke: #decc93;
1706
+ stroke: ${options.noteBorderColor};
1707
+ fill: ${options.noteBkgColor};
1708
+ }
1709
+
1710
+ .noteText, .noteText > tspan {
1711
+ fill: ${options.noteTextColor};
1712
+ stroke: none;
1713
+ ${options.noteFontWeight ? `font-weight: ${options.noteFontWeight};` : ""}
1714
+ }
1715
+
1716
+ .activation0 {
1717
+ fill: ${options.activationBkgColor};
1718
+ stroke: ${options.activationBorderColor};
1719
+ }
1720
+
1721
+ .activation1 {
1722
+ fill: ${options.activationBkgColor};
1723
+ stroke: ${options.activationBorderColor};
1724
+ }
1725
+
1726
+ .activation2 {
1727
+ fill: ${options.activationBkgColor};
1728
+ stroke: ${options.activationBorderColor};
1729
+ }
1730
+
1731
+ .actorPopupMenu {
1732
+ position: absolute;
1733
+ }
1734
+
1735
+ .actorPopupMenuPanel {
1736
+ position: absolute;
1737
+ fill: ${options.actorBkg};
1738
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
1739
+ filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
1740
+ }
1741
+ .actor-man circle, line {
1742
+ fill: ${options.actorBkg};
1743
+ stroke-width: 2px;
1744
+ }
1745
+
1746
+ g rect.rect {
1747
+ filter: ${dropShadow};
1748
+ stroke: ${options.nodeBorder};
1749
+ }
1750
+ `;
1751
+ }, "getStyles");
1752
+ var styles_default = getStyles;
1753
+ var ACTOR_TYPE_WIDTH = 18 * 2;
1754
+ var TOP_ACTOR_CLASS = "actor-top";
1755
+ var BOTTOM_ACTOR_CLASS = "actor-bottom";
1756
+ var ACTOR_BOX_CLASS = "actor-box";
1757
+ var ACTOR_MAN_FIGURE_CLASS = "actor-man";
1758
+ var COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
1759
+ var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
1760
+ const rectElement = drawRect(elem, rectData);
1761
+ if (getConfig().look === "neo") {
1762
+ rectElement.attr("data-look", "neo");
1763
+ }
1764
+ return rectElement;
1765
+ }, "drawRect");
1766
+ var drawPopup = /* @__PURE__ */ __name(function(elem, actor, minMenuWidth, textAttrs, forceMenus) {
1767
+ if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) {
1768
+ return { height: 0, width: 0 };
1769
+ }
1770
+ const links = actor.links;
1771
+ const actorCnt2 = actor.actorCnt;
1772
+ const rectData = actor.rectData;
1773
+ var displayValue = "none";
1774
+ if (forceMenus) {
1775
+ displayValue = "block !important";
1776
+ }
1777
+ const g = elem.append("g");
1778
+ g.attr("id", "actor" + actorCnt2 + "_popup");
1779
+ g.attr("class", "actorPopupMenu");
1780
+ g.attr("display", displayValue);
1781
+ var actorClass = "";
1782
+ if (rectData.class !== void 0) {
1783
+ actorClass = " " + rectData.class;
1784
+ }
1785
+ let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
1786
+ const rectElem = g.append("rect");
1787
+ rectElem.attr("class", "actorPopupMenuPanel" + actorClass);
1788
+ rectElem.attr("x", rectData.x);
1789
+ rectElem.attr("y", rectData.height);
1790
+ rectElem.attr("fill", rectData.fill);
1791
+ rectElem.attr("stroke", rectData.stroke);
1792
+ rectElem.attr("width", menuWidth);
1793
+ rectElem.attr("height", rectData.height);
1794
+ rectElem.attr("rx", rectData.rx);
1795
+ rectElem.attr("ry", rectData.ry);
1796
+ if (links != null) {
1797
+ var linkY = 20;
1798
+ for (let key in links) {
1799
+ var linkElem = g.append("a");
1800
+ var sanitizedLink = distExports.sanitizeUrl(links[key]);
1801
+ linkElem.attr("xlink:href", sanitizedLink);
1802
+ linkElem.attr("target", "_blank");
1803
+ _drawMenuItemTextCandidateFunc(textAttrs)(
1804
+ key,
1805
+ linkElem,
1806
+ rectData.x + 10,
1807
+ rectData.height + linkY,
1808
+ menuWidth,
1809
+ 20,
1810
+ { class: "actor" },
1811
+ textAttrs
1812
+ );
1813
+ linkY += 30;
1814
+ }
1815
+ }
1816
+ rectElem.attr("height", linkY);
1817
+ return { height: rectData.height + linkY, width: menuWidth };
1818
+ }, "drawPopup");
1819
+ var popupMenuToggle = /* @__PURE__ */ __name(function(popId) {
1820
+ return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
1821
+ }, "popupMenuToggle");
1822
+ var drawKatex = /* @__PURE__ */ __name(async function(elem, textData, msgModel = null) {
1823
+ let textElem = elem.append("foreignObject");
1824
+ const linesSanitized = await renderKatexSanitized(textData.text, getConfig());
1825
+ const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(linesSanitized);
1826
+ const dim = divElem.node().getBoundingClientRect();
1827
+ textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width));
1828
+ if (textData.class === "noteText") {
1829
+ const rectElem = elem.node().firstChild;
1830
+ rectElem.setAttribute("height", dim.height + 2 * textData.textMargin);
1831
+ const rectDim = rectElem.getBBox();
1832
+ 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));
1833
+ } else if (msgModel) {
1834
+ let { startx, stopx, starty } = msgModel;
1835
+ if (startx > stopx) {
1836
+ const temp = startx;
1837
+ startx = stopx;
1838
+ stopx = temp;
1839
+ }
1840
+ textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2));
1841
+ if (textData.class === "loopText") {
1842
+ textElem.attr("y", Math.round(starty));
1843
+ } else {
1844
+ textElem.attr("y", Math.round(starty - dim.height));
1845
+ }
1846
+ }
1847
+ return [textElem];
1848
+ }, "drawKatex");
1849
+ var drawText = /* @__PURE__ */ __name(function(elem, textData) {
1850
+ let prevTextHeight = 0;
1851
+ let textHeight = 0;
1852
+ const lines = textData.text.split(common_default.lineBreakRegex);
1853
+ const [_textFontSize, _textFontSizePx] = parseFontSize(textData.fontSize);
1854
+ let textElems = [];
1855
+ let dy = 0;
1856
+ let yfunc = /* @__PURE__ */ __name(() => textData.y, "yfunc");
1857
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1858
+ switch (textData.valign) {
1859
+ case "top":
1860
+ case "start":
1861
+ yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + textData.textMargin), "yfunc");
1862
+ break;
1863
+ case "middle":
1864
+ case "center":
1865
+ yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2), "yfunc");
1866
+ break;
1867
+ case "bottom":
1868
+ case "end":
1869
+ yfunc = /* @__PURE__ */ __name(() => Math.round(
1870
+ textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin
1871
+ ), "yfunc");
1872
+ break;
1873
+ }
1874
+ }
1875
+ if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) {
1876
+ switch (textData.anchor) {
1877
+ case "left":
1878
+ case "start":
1879
+ textData.x = Math.round(textData.x + textData.textMargin);
1880
+ textData.anchor = "start";
1881
+ textData.dominantBaseline = "middle";
1882
+ textData.alignmentBaseline = "middle";
1883
+ break;
1884
+ case "middle":
1885
+ case "center":
1886
+ textData.x = Math.round(textData.x + textData.width / 2);
1887
+ textData.anchor = "middle";
1888
+ textData.dominantBaseline = "middle";
1889
+ textData.alignmentBaseline = "middle";
1890
+ break;
1891
+ case "right":
1892
+ case "end":
1893
+ textData.x = Math.round(textData.x + textData.width - textData.textMargin);
1894
+ textData.anchor = "end";
1895
+ textData.dominantBaseline = "middle";
1896
+ textData.alignmentBaseline = "middle";
1897
+ break;
1898
+ }
1899
+ }
1900
+ for (let [i, line] of lines.entries()) {
1901
+ if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) {
1902
+ dy = i * _textFontSize;
1903
+ }
1904
+ const textElem = elem.append("text");
1905
+ textElem.attr("x", textData.x);
1906
+ textElem.attr("y", yfunc());
1907
+ if (textData.anchor !== void 0) {
1908
+ textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline);
1909
+ }
1910
+ if (textData.fontFamily !== void 0) {
1911
+ textElem.style("font-family", textData.fontFamily);
1912
+ }
1913
+ if (_textFontSizePx !== void 0) {
1914
+ textElem.style("font-size", _textFontSizePx);
1915
+ }
1916
+ if (textData.fontWeight !== void 0) {
1917
+ textElem.style("font-weight", textData.fontWeight);
1918
+ }
1919
+ if (textData.fill !== void 0) {
1920
+ textElem.attr("fill", textData.fill);
1921
+ }
1922
+ if (textData.class !== void 0) {
1923
+ textElem.attr("class", textData.class);
1924
+ }
1925
+ if (textData.dy !== void 0) {
1926
+ textElem.attr("dy", textData.dy);
1927
+ } else if (dy !== 0) {
1928
+ textElem.attr("dy", dy);
1929
+ }
1930
+ const text = line || ZERO_WIDTH_SPACE;
1931
+ if (textData.tspan) {
1932
+ const span = textElem.append("tspan");
1933
+ span.attr("x", textData.x);
1934
+ if (textData.fill !== void 0) {
1935
+ span.attr("fill", textData.fill);
1936
+ }
1937
+ span.text(text);
1938
+ } else {
1939
+ textElem.text(text);
1940
+ }
1941
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1942
+ textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
1943
+ prevTextHeight = textHeight;
1944
+ }
1945
+ textElems.push(textElem);
1946
+ }
1947
+ return textElems;
1948
+ }, "drawText");
1949
+ var drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
1950
+ function genPoints(x, y, width, height, cut) {
1951
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
1952
+ }
1953
+ __name(genPoints, "genPoints");
1954
+ const polygon = elem.append("polygon");
1955
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
1956
+ polygon.attr("class", "labelBox");
1957
+ txtObject.y = txtObject.y + txtObject.height / 2;
1958
+ drawText(elem, txtObject);
1959
+ return polygon;
1960
+ }, "drawLabel");
1961
+ var actorCnt = -1;
1962
+ var fixLifeLineHeights = /* @__PURE__ */ __name((diagram2, actors, actorKeys, conf2) => {
1963
+ if (!diagram2.select) {
1964
+ return;
1965
+ }
1966
+ actorKeys.forEach((actorKey) => {
1967
+ const actor = actors.get(actorKey);
1968
+ const actorDOM = diagram2.select("#actor" + actor.actorCnt);
1969
+ if (!conf2.mirrorActors && actor.stopy) {
1970
+ actorDOM.attr("y2", actor.stopy + actor.height / 2);
1971
+ } else if (conf2.mirrorActors) {
1972
+ actorDOM.attr("y2", actor.stopy);
1973
+ }
1974
+ });
1975
+ }, "fixLifeLineHeights");
1976
+ var drawActorTypeParticipant = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
1977
+ var _a2, _b;
1978
+ const actorY = isFooter ? actor.stopy : actor.starty;
1979
+ const center = actor.x + actor.width / 2;
1980
+ const centerY = actorY + actor.height;
1981
+ const { look, theme, themeVariables } = conf2;
1982
+ const { bkgColorArray, borderColorArray } = themeVariables;
1983
+ const boxplusLineGroup = elem.append("g").lower();
1984
+ var g = boxplusLineGroup;
1985
+ if (!isFooter) {
1986
+ actorCnt++;
1987
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
1988
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
1989
+ }
1990
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
1991
+ g = boxplusLineGroup.append("g");
1992
+ actor.actorCnt = actorCnt;
1993
+ if (actor.links != null) {
1994
+ g.attr("id", "root-" + actorCnt);
1995
+ }
1996
+ if (look === "neo") {
1997
+ g.attr("data-look", "neo");
1998
+ }
1999
+ }
2000
+ const rect = getNoteRect();
2001
+ var cssclass = "actor";
2002
+ if ((_a2 = actor.properties) == null ? void 0 : _a2.class) {
2003
+ cssclass = actor.properties.class;
2004
+ } else {
2005
+ rect.fill = "#eaeaea";
2006
+ }
2007
+ if (isFooter) {
2008
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2009
+ } else {
2010
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2011
+ }
2012
+ rect.x = actor.x;
2013
+ rect.y = actorY;
2014
+ rect.width = actor.width;
2015
+ rect.height = actor.height;
2016
+ rect.class = cssclass;
2017
+ rect.rx = 3;
2018
+ rect.ry = 3;
2019
+ rect.name = actor.name;
2020
+ if (look === "neo") {
2021
+ rect.rx = 6;
2022
+ rect.ry = 6;
2023
+ }
2024
+ const rectElem = drawRect2(g, rect);
2025
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2026
+ if (COLOR_THEMES.has(theme)) {
2027
+ rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2028
+ rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2029
+ }
2030
+ if (look === "neo") {
2031
+ rectElem.attr("filter", "url(#drop-shadow)");
2032
+ }
2033
+ actor.rectData = rect;
2034
+ if ((_b = actor.properties) == null ? void 0 : _b.icon) {
2035
+ const iconSrc = actor.properties.icon.trim();
2036
+ if (iconSrc.charAt(0) === "@") {
2037
+ drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
2038
+ } else {
2039
+ drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
2040
+ }
2041
+ }
2042
+ if (!isFooter) {
2043
+ g.attr("data-et", "participant");
2044
+ g.attr("data-type", "participant");
2045
+ g.attr("data-id", actor.name);
2046
+ }
2047
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2048
+ actor.description,
2049
+ g,
2050
+ rect.x,
2051
+ rect.y,
2052
+ rect.width,
2053
+ rect.height,
2054
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2055
+ conf2
2056
+ );
2057
+ let height = actor.height;
2058
+ if (rectElem.node) {
2059
+ const bounds2 = rectElem.node().getBBox();
2060
+ actor.height = bounds2.height;
2061
+ height = bounds2.height;
2062
+ }
2063
+ return height;
2064
+ }, "drawActorTypeParticipant");
2065
+ var drawActorTypeCollections = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2066
+ var _a2, _b;
2067
+ const actorY = isFooter ? actor.stopy : actor.starty;
2068
+ const center = actor.x + actor.width / 2;
2069
+ const centerY = actorY + actor.height;
2070
+ const { look, theme, themeVariables } = conf2;
2071
+ const { bkgColorArray, borderColorArray } = themeVariables;
2072
+ const boxplusLineGroup = elem.append("g").lower();
2073
+ var g = boxplusLineGroup;
2074
+ if (!isFooter) {
2075
+ actorCnt++;
2076
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2077
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2078
+ }
2079
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
2080
+ g = boxplusLineGroup.append("g");
2081
+ actor.actorCnt = actorCnt;
2082
+ if (actor.links != null) {
2083
+ g.attr("id", "root-" + actorCnt);
2084
+ }
2085
+ if (look === "neo") {
2086
+ g.attr("data-look", "neo");
2087
+ }
2088
+ }
2089
+ const rect = getNoteRect();
2090
+ var cssclass = "actor";
2091
+ if ((_a2 = actor.properties) == null ? void 0 : _a2.class) {
2092
+ cssclass = actor.properties.class;
2093
+ } else {
2094
+ rect.fill = "#eaeaea";
2095
+ }
2096
+ if (isFooter) {
2097
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2098
+ } else {
2099
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2100
+ }
2101
+ rect.x = actor.x;
2102
+ rect.y = actorY;
2103
+ rect.width = actor.width;
2104
+ rect.height = actor.height;
2105
+ rect.class = cssclass;
2106
+ rect.name = actor.name;
2107
+ const offset = 6;
2108
+ const shadowRect = {
2109
+ ...rect,
2110
+ x: rect.x + (isFooter ? -offset : -offset),
2111
+ y: rect.y + (isFooter ? +offset : +offset),
2112
+ class: "actor"
2113
+ };
2114
+ const rectElem = drawRect2(g, rect);
2115
+ const stackedRect = drawRect2(g, shadowRect);
2116
+ actor.rectData = rect;
2117
+ if (look === "neo") {
2118
+ g.attr("filter", "url(#drop-shadow)");
2119
+ }
2120
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2121
+ if (COLOR_THEMES.has(theme)) {
2122
+ rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2123
+ rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2124
+ stackedRect.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2125
+ stackedRect.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2126
+ }
2127
+ if ((_b = actor.properties) == null ? void 0 : _b.icon) {
2128
+ const iconSrc = actor.properties.icon.trim();
2129
+ if (iconSrc.charAt(0) === "@") {
2130
+ drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
2131
+ } else {
2132
+ drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
2133
+ }
2134
+ }
2135
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2136
+ actor.description,
2137
+ g,
2138
+ rect.x - offset,
2139
+ rect.y + offset,
2140
+ rect.width,
2141
+ rect.height,
2142
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2143
+ conf2
2144
+ );
2145
+ let height = actor.height;
2146
+ if (rectElem.node) {
2147
+ const bounds2 = rectElem.node().getBBox();
2148
+ actor.height = bounds2.height;
2149
+ height = bounds2.height;
2150
+ }
2151
+ if (!isFooter) {
2152
+ g.attr("data-et", "participant");
2153
+ g.attr("data-type", "collections");
2154
+ g.attr("data-id", actor.name);
2155
+ }
2156
+ return height;
2157
+ }, "drawActorTypeCollections");
2158
+ var drawActorTypeQueue = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2159
+ var _a2, _b;
2160
+ const actorY = isFooter ? actor.stopy : actor.starty;
2161
+ const center = actor.x + actor.width / 2;
2162
+ const centerY = actorY + actor.height;
2163
+ const { look, theme, themeVariables } = conf2;
2164
+ const { bkgColorArray, borderColorArray } = themeVariables;
2165
+ const boxplusLineGroup = elem.append("g").lower();
2166
+ let g = boxplusLineGroup;
2167
+ if (!isFooter) {
2168
+ actorCnt++;
2169
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2170
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2171
+ }
2172
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
2173
+ g = boxplusLineGroup.append("g");
2174
+ actor.actorCnt = actorCnt;
2175
+ if (actor.links != null) {
2176
+ g.attr("id", "root-" + actorCnt);
2177
+ }
2178
+ if (look === "neo") {
2179
+ g.attr("data-look", "neo");
2180
+ }
2181
+ }
2182
+ const rect = getNoteRect();
2183
+ let cssclass = "actor";
2184
+ if ((_a2 = actor.properties) == null ? void 0 : _a2.class) {
2185
+ cssclass = actor.properties.class;
2186
+ } else {
2187
+ rect.fill = "#eaeaea";
2188
+ }
2189
+ if (isFooter) {
2190
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2191
+ } else {
2192
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2193
+ }
2194
+ g.attr("class", cssclass);
2195
+ rect.x = actor.x;
2196
+ rect.y = actorY;
2197
+ rect.width = actor.width;
2198
+ rect.height = actor.height;
2199
+ rect.name = actor.name;
2200
+ const ry = rect.height / 2;
2201
+ const rx = ry / (2.5 + rect.height / 50);
2202
+ const cylinderGroup = g.append("g");
2203
+ const cylinderArc = g.append("g");
2204
+ const cylinderPath = `M ${rect.x},${rect.y + ry}
2205
+ a ${rx},${ry} 0 0 0 0,${rect.height}
2206
+ h ${rect.width - 2 * rx}
2207
+ a ${rx},${ry} 0 0 0 0,-${rect.height}
2208
+ Z
2209
+ `;
2210
+ cylinderGroup.append("path").attr("d", cylinderPath);
2211
+ cylinderArc.append("path").attr(
2212
+ "d",
2213
+ `M ${rect.x},${rect.y + ry}
2214
+ a ${rx},${ry} 0 0 0 0,${rect.height}`
2215
+ );
2216
+ cylinderGroup.attr("transform", `translate(${rx}, ${-(rect.height / 2)})`);
2217
+ cylinderArc.attr("transform", `translate(${rect.width - rx}, ${-rect.height / 2})`);
2218
+ actor.rectData = rect;
2219
+ if (look === "neo") {
2220
+ cylinderGroup.attr("filter", "url(#drop-shadow)");
2221
+ }
2222
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2223
+ if (COLOR_THEMES.has(theme)) {
2224
+ cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2225
+ cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2226
+ cylinderArc.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2227
+ cylinderArc.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2228
+ }
2229
+ if ((_b = actor.properties) == null ? void 0 : _b.icon) {
2230
+ const iconSrc = actor.properties.icon.trim();
2231
+ const iconX = rect.x + rect.width - 20;
2232
+ const iconY = rect.y + 10;
2233
+ if (iconSrc.charAt(0) === "@") {
2234
+ drawEmbeddedImage(g, iconX, iconY, iconSrc.substr(1));
2235
+ } else {
2236
+ drawImage(g, iconX, iconY, iconSrc);
2237
+ }
2238
+ }
2239
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2240
+ actor.description,
2241
+ g,
2242
+ rect.x,
2243
+ rect.y,
2244
+ rect.width,
2245
+ rect.height,
2246
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2247
+ conf2
2248
+ );
2249
+ let height = actor.height;
2250
+ const lastPath = cylinderGroup.select("path:last-child");
2251
+ if (lastPath.node()) {
2252
+ const bounds2 = lastPath.node().getBBox();
2253
+ actor.height = bounds2.height;
2254
+ height = bounds2.height;
2255
+ }
2256
+ if (!isFooter) {
2257
+ g.attr("data-et", "participant");
2258
+ g.attr("data-type", "queue");
2259
+ g.attr("data-id", actor.name);
2260
+ }
2261
+ return height;
2262
+ }, "drawActorTypeQueue");
2263
+ var drawActorTypeControl = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, diagramId, actorIndexMap) {
2264
+ var _a2;
2265
+ const actorY = isFooter ? actor.stopy : actor.starty;
2266
+ const center = actor.x + actor.width / 2;
2267
+ const centerY = actorY + 75;
2268
+ const { look, theme, themeVariables } = conf2;
2269
+ const { bkgColorArray, borderColorArray, actorBorder, actorBkg } = themeVariables;
2270
+ const line = elem.append("g").lower();
2271
+ if (!isFooter) {
2272
+ actorCnt++;
2273
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
2274
+ actor.actorCnt = actorCnt;
2275
+ }
2276
+ const actElem = elem.append("g");
2277
+ let cssClass = ACTOR_MAN_FIGURE_CLASS;
2278
+ if (isFooter) {
2279
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2280
+ } else {
2281
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2282
+ }
2283
+ actElem.attr("class", cssClass);
2284
+ actElem.attr("name", actor.name);
2285
+ const rect = getNoteRect();
2286
+ rect.x = actor.x;
2287
+ rect.y = actorY;
2288
+ rect.fill = "#eaeaea";
2289
+ rect.width = actor.width;
2290
+ rect.height = actor.height;
2291
+ rect.class = "actor";
2292
+ const cx = actor.x + actor.width / 2;
2293
+ const cy = actorY + 32;
2294
+ const r = 22;
2295
+ actElem.append("defs").append("marker").attr("id", diagramId + "-filled-head-control").attr("refX", 11).attr("refY", 5.8).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "172.5").attr("stroke-width", 1.2).append("path").attr("d", "M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z");
2296
+ actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r).attr("filter", `${look === "neo" ? "url(#drop-shadow)" : ""}`);
2297
+ actElem.append("line").attr("marker-end", "url(#" + diagramId + "-filled-head-control)").attr("transform", `translate(${cx}, ${cy - r})`);
2298
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2299
+ if (COLOR_THEMES.has(theme)) {
2300
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2301
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2302
+ } else {
2303
+ actElem.style("stroke", actorBorder);
2304
+ actElem.style("fill", actorBkg);
2305
+ }
2306
+ const bounds2 = actElem.node().getBBox();
2307
+ actor.height = bounds2.height + 2 * (((_a2 = conf2 == null ? void 0 : conf2.sequence) == null ? void 0 : _a2.labelBoxHeight) ?? 0);
2308
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2309
+ actor.description,
2310
+ actElem,
2311
+ rect.x,
2312
+ rect.y + r + (!isFooter ? 12 : 5),
2313
+ rect.width,
2314
+ rect.height,
2315
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2316
+ conf2
2317
+ );
2318
+ if (!isFooter) {
2319
+ actElem.attr("data-et", "participant");
2320
+ actElem.attr("data-type", "control");
2321
+ actElem.attr("data-id", actor.name);
2322
+ }
2323
+ return actor.height;
2324
+ }, "drawActorTypeControl");
2325
+ var drawActorTypeEntity = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2326
+ var _a2;
2327
+ const actorY = isFooter ? actor.stopy : actor.starty;
2328
+ const center = actor.x + actor.width / 2;
2329
+ const centerY = actorY + 75;
2330
+ const { look, theme, themeVariables } = conf2;
2331
+ const { bkgColorArray, borderColorArray } = themeVariables;
2332
+ const line = elem.append("g").lower();
2333
+ const actElem = elem.append("g");
2334
+ let cssClass = "actor";
2335
+ if (isFooter) {
2336
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2337
+ } else {
2338
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2339
+ }
2340
+ actElem.attr("class", cssClass);
2341
+ actElem.attr("name", actor.name);
2342
+ const rect = getNoteRect();
2343
+ rect.x = actor.x;
2344
+ rect.y = actorY;
2345
+ rect.fill = "#eaeaea";
2346
+ rect.width = actor.width;
2347
+ rect.height = actor.height;
2348
+ rect.class = "actor";
2349
+ const cx = actor.x + actor.width / 2;
2350
+ const cy = actorY + (!isFooter ? 25 : 10);
2351
+ const r = 22;
2352
+ actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r).attr("width", actor.width).attr("height", actor.height);
2353
+ actElem.append("line").attr("x1", cx - r).attr("x2", cx + r).attr("y1", cy + r).attr("y2", cy + r).attr("stroke-width", 2);
2354
+ if (look === "neo") {
2355
+ actElem.attr("filter", "url(#drop-shadow)");
2356
+ }
2357
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2358
+ if (COLOR_THEMES.has(theme)) {
2359
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2360
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2361
+ }
2362
+ const bounds2 = actElem.node().getBBox();
2363
+ actor.height = bounds2.height + (((_a2 = conf2 == null ? void 0 : conf2.sequence) == null ? void 0 : _a2.labelBoxHeight) ?? 0);
2364
+ if (!isFooter) {
2365
+ actorCnt++;
2366
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
2367
+ actor.actorCnt = actorCnt;
2368
+ }
2369
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2370
+ actor.description,
2371
+ actElem,
2372
+ rect.x,
2373
+ rect.y + (!isFooter ? 30 : 15),
2374
+ rect.width,
2375
+ rect.height,
2376
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2377
+ conf2
2378
+ );
2379
+ if (!isFooter) {
2380
+ actElem.attr("transform", `translate(${0}, ${r / 2 - 5})`);
2381
+ actElem.attr("data-et", "participant");
2382
+ actElem.attr("data-type", "entity");
2383
+ actElem.attr("data-id", actor.name);
2384
+ } else {
2385
+ actElem.attr("transform", `translate(${0}, ${r})`);
2386
+ }
2387
+ return actor.height;
2388
+ }, "drawActorTypeEntity");
2389
+ var drawActorTypeDatabase = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2390
+ var _a2;
2391
+ const actorY = isFooter ? actor.stopy : actor.starty;
2392
+ const center = actor.x + actor.width / 2;
2393
+ const centerY = actorY + actor.height + 2 * conf2.boxTextMargin;
2394
+ const { theme, themeVariables, look } = conf2;
2395
+ const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2396
+ const boxplusLineGroup = elem.append("g").lower();
2397
+ let g = boxplusLineGroup;
2398
+ if (!isFooter) {
2399
+ actorCnt++;
2400
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2401
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2402
+ }
2403
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
2404
+ g = boxplusLineGroup.append("g");
2405
+ actor.actorCnt = actorCnt;
2406
+ if (actor.links != null) {
2407
+ g.attr("id", "root-" + actorCnt);
2408
+ }
2409
+ if (look === "neo") {
2410
+ g.attr("data-look", "neo");
2411
+ }
2412
+ }
2413
+ const rect = getNoteRect();
2414
+ let cssclass = "actor";
2415
+ if ((_a2 = actor.properties) == null ? void 0 : _a2.class) {
2416
+ cssclass = actor.properties.class;
2417
+ } else {
2418
+ rect.fill = "#eaeaea";
2419
+ }
2420
+ if (isFooter) {
2421
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2422
+ } else {
2423
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
2424
+ }
2425
+ rect.x = actor.x;
2426
+ rect.y = actorY;
2427
+ rect.width = actor.width;
2428
+ rect.height = actor.height;
2429
+ rect.class = cssclass;
2430
+ rect.name = actor.name;
2431
+ rect.x = actor.x;
2432
+ rect.y = actorY;
2433
+ const w = rect.width / 3;
2434
+ const h = rect.width / 3;
2435
+ const rx = w / 2;
2436
+ const ry = rx / (2.5 + w / 50);
2437
+ const cylinderGroup = g.append("g");
2438
+ cylinderGroup.attr("class", cssclass);
2439
+ const d = `
2440
+ M ${rect.x},${rect.y + ry}
2441
+ a ${rx},${ry} 0 0 0 ${w},0
2442
+ a ${rx},${ry} 0 0 0 -${w},0
2443
+ l 0,${h - 2 * ry}
2444
+ a ${rx},${ry} 0 0 0 ${w},0
2445
+ l 0,-${h - 2 * ry}
2446
+ `;
2447
+ cylinderGroup.append("path").attr("d", d);
2448
+ if (look === "neo") {
2449
+ cylinderGroup.attr("filter", "url(#drop-shadow)");
2450
+ }
2451
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2452
+ if (COLOR_THEMES.has(theme)) {
2453
+ cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2454
+ cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2455
+ } else {
2456
+ cylinderGroup.style("stroke", actorBorder);
2457
+ }
2458
+ cylinderGroup.attr("transform", `translate(${w}, ${ry})`);
2459
+ actor.rectData = rect;
2460
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2461
+ actor.description,
2462
+ g,
2463
+ rect.x,
2464
+ rect.y + 35,
2465
+ rect.width,
2466
+ rect.height,
2467
+ { class: `actor ${ACTOR_BOX_CLASS}` },
2468
+ conf2
2469
+ );
2470
+ const lastPath = cylinderGroup.select("path:last-child");
2471
+ if (lastPath.node()) {
2472
+ const bounds2 = lastPath.node().getBBox();
2473
+ actor.height = bounds2.height + (conf2.sequence.labelBoxHeight ?? 0);
2474
+ }
2475
+ if (!isFooter) {
2476
+ g.attr("data-et", "participant");
2477
+ g.attr("data-type", "database");
2478
+ g.attr("data-id", actor.name);
2479
+ }
2480
+ return actor.height;
2481
+ }, "drawActorTypeDatabase");
2482
+ var drawActorTypeBoundary = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2483
+ const actorY = isFooter ? actor.stopy : actor.starty;
2484
+ const center = actor.x + actor.width / 2;
2485
+ const centerY = actorY + 80;
2486
+ const radius = 22;
2487
+ const line = elem.append("g").lower();
2488
+ const { look, theme, themeVariables } = conf2;
2489
+ const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2490
+ if (!isFooter) {
2491
+ actorCnt++;
2492
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
2493
+ actor.actorCnt = actorCnt;
2494
+ }
2495
+ const actElem = elem.append("g");
2496
+ let cssClass = ACTOR_MAN_FIGURE_CLASS;
2497
+ if (isFooter) {
2498
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2499
+ } else {
2500
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2501
+ }
2502
+ actElem.attr("class", cssClass);
2503
+ actElem.attr("name", actor.name);
2504
+ const rect = getNoteRect();
2505
+ rect.x = actor.x;
2506
+ rect.y = actorY;
2507
+ rect.fill = "#eaeaea";
2508
+ rect.width = actor.width;
2509
+ rect.height = actor.height;
2510
+ rect.class = "actor";
2511
+ actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius * 2.5).attr("y1", actorY + 12).attr("x2", actor.x + actor.width / 2 - 15).attr("y2", actorY + 12);
2512
+ actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius * 2.5).attr("y1", actorY + 2).attr("x2", actor.x + actor.width / 2 - radius * 2.5).attr("y2", actorY + 22);
2513
+ actElem.append("circle").attr("cx", actor.x + actor.width / 2).attr("cy", actorY + 12).attr("r", radius);
2514
+ if (look === "neo") {
2515
+ actElem.attr("filter", "url(#drop-shadow)");
2516
+ }
2517
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2518
+ if (COLOR_THEMES.has(theme)) {
2519
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2520
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2521
+ } else {
2522
+ actElem.style("stroke", actorBorder);
2523
+ }
2524
+ const bounds2 = actElem.node().getBBox();
2525
+ actor.height = bounds2.height + (conf2.sequence.labelBoxHeight ?? 0);
2526
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2527
+ actor.description,
2528
+ actElem,
2529
+ rect.x,
2530
+ rect.y + 15,
2531
+ rect.width,
2532
+ rect.height,
2533
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2534
+ conf2
2535
+ );
2536
+ actElem.attr("transform", `translate(0,${radius / 2 + 10})`);
2537
+ if (!isFooter) {
2538
+ actElem.attr("data-et", "participant");
2539
+ actElem.attr("data-type", "boundary");
2540
+ actElem.attr("data-id", actor.name);
2541
+ }
2542
+ return actor.height;
2543
+ }, "drawActorTypeBoundary");
2544
+ var drawActorTypeActor = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2545
+ const actorY = isFooter ? actor.stopy : actor.starty;
2546
+ const center = actor.x + actor.width / 2;
2547
+ const centerY = actorY + 80;
2548
+ const { look, theme, themeVariables } = conf2;
2549
+ const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2550
+ const line = elem.append("g").lower();
2551
+ if (!isFooter) {
2552
+ actorCnt++;
2553
+ 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).attr("data-et", "life-line").attr("data-id", actor.name);
2554
+ actor.actorCnt = actorCnt;
2555
+ }
2556
+ const actElem = elem.append("g");
2557
+ let cssClass = ACTOR_MAN_FIGURE_CLASS;
2558
+ if (isFooter) {
2559
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2560
+ } else {
2561
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
2562
+ }
2563
+ actElem.attr("class", cssClass);
2564
+ actElem.attr("name", actor.name);
2565
+ if (!isFooter) {
2566
+ actElem.attr("data-et", "participant").attr("data-type", "actor").attr("data-id", actor.name);
2567
+ }
2568
+ const scale = look === "neo" ? 0.5 : 1;
2569
+ const adjustedActorY = look === "neo" ? actorY + (1 - scale) * 30 : actorY;
2570
+ actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center).attr("y1", adjustedActorY + 25 * scale).attr("x2", center).attr("y2", adjustedActorY + 45 * scale);
2571
+ actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center - ACTOR_TYPE_WIDTH / 2 * scale).attr("y1", adjustedActorY + 33 * scale).attr("x2", center + ACTOR_TYPE_WIDTH / 2 * scale).attr("y2", adjustedActorY + 33 * scale);
2572
+ actElem.append("line").attr("x1", center - ACTOR_TYPE_WIDTH / 2 * scale).attr("y1", adjustedActorY + 60 * scale).attr("x2", center).attr("y2", adjustedActorY + 45 * scale);
2573
+ actElem.append("line").attr("x1", center).attr("y1", adjustedActorY + 45 * scale).attr("x2", center + (ACTOR_TYPE_WIDTH / 2 - 2) * scale).attr("y2", adjustedActorY + 60 * scale);
2574
+ const circle = actElem.append("circle");
2575
+ circle.attr("cx", actor.x + actor.width / 2);
2576
+ circle.attr("cy", adjustedActorY + 10 * scale);
2577
+ circle.attr("r", 15 * scale);
2578
+ circle.attr("width", actor.width * scale);
2579
+ circle.attr("height", actor.height * scale);
2580
+ const bounds2 = actElem.node().getBBox();
2581
+ actor.height = bounds2.height;
2582
+ const rect = getNoteRect();
2583
+ rect.x = actor.x;
2584
+ rect.y = adjustedActorY;
2585
+ rect.fill = "#eaeaea";
2586
+ rect.width = actor.width;
2587
+ rect.height = actor.height / scale;
2588
+ rect.class = "actor";
2589
+ rect.rx = 3;
2590
+ rect.ry = 3;
2591
+ const actorCount = actorIndexMap.get(actor.name) ?? 0;
2592
+ if (COLOR_THEMES.has(theme)) {
2593
+ actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2594
+ actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2595
+ } else {
2596
+ actElem.style("stroke", actorBorder);
2597
+ }
2598
+ _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2599
+ actor.description,
2600
+ actElem,
2601
+ rect.x,
2602
+ adjustedActorY + 35 * scale - (look === "neo" ? 10 : 0),
2603
+ rect.width,
2604
+ rect.height,
2605
+ { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2606
+ conf2
2607
+ );
2608
+ return actor.height;
2609
+ }, "drawActorTypeActor");
2610
+ var drawActor = /* @__PURE__ */ __name(async function(elem, actor, conf2, isFooter, diagramId, diagObj, actorIndexMap) {
2611
+ const resolvedActorIndexMap = actorIndexMap ?? new Map(
2612
+ [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
2613
+ );
2614
+ switch (actor.type) {
2615
+ case "actor":
2616
+ return await drawActorTypeActor(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2617
+ case "participant":
2618
+ return await drawActorTypeParticipant(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2619
+ case "boundary":
2620
+ return await drawActorTypeBoundary(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2621
+ case "control":
2622
+ return await drawActorTypeControl(
2623
+ elem,
2624
+ actor,
2625
+ conf2,
2626
+ isFooter,
2627
+ diagramId,
2628
+ resolvedActorIndexMap
2629
+ );
2630
+ case "entity":
2631
+ return await drawActorTypeEntity(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2632
+ case "database":
2633
+ return await drawActorTypeDatabase(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2634
+ case "collections":
2635
+ return await drawActorTypeCollections(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2636
+ case "queue":
2637
+ return await drawActorTypeQueue(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2638
+ }
2639
+ }, "drawActor");
2640
+ var drawBox = /* @__PURE__ */ __name(function(elem, box, conf2) {
2641
+ const boxplusTextGroup = elem.append("g");
2642
+ const g = boxplusTextGroup;
2643
+ drawBackgroundRect2(g, box);
2644
+ if (box.name) {
2645
+ _drawTextCandidateFunc(conf2)(
2646
+ box.name,
2647
+ g,
2648
+ box.x,
2649
+ box.y + conf2.boxTextMargin + (box.textMaxHeight || 0) / 2,
2650
+ box.width,
2651
+ 0,
2652
+ { class: "text" },
2653
+ conf2
2654
+ );
2655
+ }
2656
+ g.lower();
2657
+ }, "drawBox");
2658
+ var anchorElement = /* @__PURE__ */ __name(function(elem) {
2659
+ return elem.append("g");
2660
+ }, "anchorElement");
2661
+ var drawActivation = /* @__PURE__ */ __name(function(_elem, bounds2, verticalPos, conf2, actorActivations2, diagObj, actorIndexMap) {
2662
+ const { theme, themeVariables } = conf2;
2663
+ const { bkgColorArray, borderColorArray, mainBkg } = themeVariables;
2664
+ const rect = getNoteRect();
2665
+ const g = bounds2.anchored;
2666
+ const actor = bounds2.actor;
2667
+ rect.x = bounds2.startx;
2668
+ rect.y = bounds2.starty;
2669
+ rect.class = "activation" + actorActivations2 % 3;
2670
+ rect.width = bounds2.stopx - bounds2.startx;
2671
+ rect.height = verticalPos - bounds2.starty;
2672
+ const rectElem = drawRect2(g, rect);
2673
+ const resolvedActorIndexMap = actorIndexMap ?? new Map(
2674
+ [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
2675
+ );
2676
+ const actorCount = resolvedActorIndexMap.get(actor) ?? 0;
2677
+ if (COLOR_THEMES.has(theme)) {
2678
+ rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2679
+ rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length] ?? mainBkg);
2680
+ }
2681
+ }, "drawActivation");
2682
+ var drawLoop = /* @__PURE__ */ __name(async function(elem, loopModel, labelText, conf2, msg) {
2683
+ const {
2684
+ boxMargin,
2685
+ boxTextMargin,
2686
+ labelBoxHeight,
2687
+ labelBoxWidth,
2688
+ messageFontFamily: fontFamily,
2689
+ messageFontSize: fontSize,
2690
+ messageFontWeight: fontWeight
2691
+ } = conf2;
2692
+ const g = elem.append("g").attr("data-et", "control-structure").attr("data-id", "i" + msg.id);
2693
+ const drawLoopLine = /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
2694
+ return g.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine");
2695
+ }, "drawLoopLine");
2696
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
2697
+ drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
2698
+ drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
2699
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
2700
+ if (loopModel.sections !== void 0) {
2701
+ loopModel.sections.forEach(function(item) {
2702
+ drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
2703
+ "stroke-dasharray",
2704
+ "3, 3"
2705
+ );
2706
+ });
2707
+ }
2708
+ let txt = getTextObj();
2709
+ txt.text = labelText;
2710
+ txt.x = loopModel.startx;
2711
+ txt.y = loopModel.starty;
2712
+ txt.fontFamily = fontFamily;
2713
+ txt.fontSize = fontSize;
2714
+ txt.fontWeight = fontWeight;
2715
+ txt.anchor = "middle";
2716
+ txt.valign = "middle";
2717
+ txt.tspan = false;
2718
+ txt.width = Math.max(labelBoxWidth ?? 0, 50);
2719
+ txt.height = labelBoxHeight + (conf2.look === "neo" ? 15 : 0) || 20;
2720
+ txt.textMargin = boxTextMargin;
2721
+ txt.class = "labelText";
2722
+ drawLabel(g, txt);
2723
+ txt = getTextObj2();
2724
+ txt.text = loopModel.title;
2725
+ txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
2726
+ txt.y = loopModel.starty + boxMargin + boxTextMargin;
2727
+ txt.anchor = "middle";
2728
+ txt.valign = "middle";
2729
+ txt.textMargin = boxTextMargin;
2730
+ txt.class = "loopText";
2731
+ txt.fontFamily = fontFamily;
2732
+ txt.fontSize = fontSize;
2733
+ txt.fontWeight = fontWeight;
2734
+ txt.wrap = true;
2735
+ let textElem = hasKatex(txt.text) ? await drawKatex(g, txt, loopModel) : drawText(g, txt);
2736
+ if (loopModel.sectionTitles !== void 0) {
2737
+ for (const [idx, item] of Object.entries(loopModel.sectionTitles)) {
2738
+ if (item.message) {
2739
+ txt.text = item.message;
2740
+ txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
2741
+ txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
2742
+ txt.class = "sectionTitle";
2743
+ txt.anchor = "middle";
2744
+ txt.valign = "middle";
2745
+ txt.tspan = false;
2746
+ txt.fontFamily = fontFamily;
2747
+ txt.fontSize = fontSize;
2748
+ txt.fontWeight = fontWeight;
2749
+ txt.wrap = loopModel.wrap;
2750
+ if (hasKatex(txt.text)) {
2751
+ loopModel.starty = loopModel.sections[idx].y;
2752
+ await drawKatex(g, txt, loopModel);
2753
+ } else {
2754
+ drawText(g, txt);
2755
+ }
2756
+ let sectionHeight = Math.round(
2757
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
2758
+ );
2759
+ loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
2760
+ }
2761
+ }
2762
+ }
2763
+ loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
2764
+ return g;
2765
+ }, "drawLoop");
2766
+ var drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds2) {
2767
+ drawBackgroundRect(elem, bounds2);
2768
+ }, "drawBackgroundRect");
2769
+ var insertDatabaseIcon = /* @__PURE__ */ __name(function(elem, id) {
2770
+ elem.append("defs").append("symbol").attr("id", id + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
2771
+ "d",
2772
+ "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"
2773
+ );
2774
+ }, "insertDatabaseIcon");
2775
+ var insertComputerIcon = /* @__PURE__ */ __name(function(elem, id) {
2776
+ elem.append("defs").append("symbol").attr("id", id + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2777
+ "d",
2778
+ "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"
2779
+ );
2780
+ }, "insertComputerIcon");
2781
+ var insertClockIcon = /* @__PURE__ */ __name(function(elem, id) {
2782
+ elem.append("defs").append("symbol").attr("id", id + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2783
+ "d",
2784
+ "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"
2785
+ );
2786
+ }, "insertClockIcon");
2787
+ var insertArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2788
+ elem.append("defs").append("marker").attr("id", 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");
2789
+ }, "insertArrowHead");
2790
+ var insertArrowFilledHead = /* @__PURE__ */ __name(function(elem, id) {
2791
+ elem.append("defs").append("marker").attr("id", 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");
2792
+ }, "insertArrowFilledHead");
2793
+ var insertSequenceNumber = /* @__PURE__ */ __name(function(elem, id) {
2794
+ elem.append("defs").append("marker").attr("id", 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);
2795
+ }, "insertSequenceNumber");
2796
+ var insertArrowCrossHead = /* @__PURE__ */ __name(function(elem, id) {
2797
+ const defs = elem.append("defs");
2798
+ const marker = defs.append("marker").attr("id", id + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5);
2799
+ 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");
2800
+ }, "insertArrowCrossHead");
2801
+ var insertDropShadow = /* @__PURE__ */ __name(function(elem, conf2) {
2802
+ const { theme } = conf2;
2803
+ elem.append("defs").append("filter").attr("id", "drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme === "redux" || theme === "redux-color" ? "#000000" : "#FFFFFF"}`);
2804
+ }, "insertDropShadow");
2805
+ var getTextObj2 = /* @__PURE__ */ __name(function() {
2806
+ return {
2807
+ x: 0,
2808
+ y: 0,
2809
+ fill: void 0,
2810
+ anchor: void 0,
2811
+ style: "#666",
2812
+ width: void 0,
2813
+ height: void 0,
2814
+ textMargin: 0,
2815
+ rx: 0,
2816
+ ry: 0,
2817
+ tspan: true,
2818
+ valign: void 0
2819
+ };
2820
+ }, "getTextObj");
2821
+ var getNoteRect2 = /* @__PURE__ */ __name(function() {
2822
+ return {
2823
+ x: 0,
2824
+ y: 0,
2825
+ fill: "#EDF2AE",
2826
+ stroke: "#666",
2827
+ width: 100,
2828
+ anchor: "start",
2829
+ height: 100,
2830
+ rx: 0,
2831
+ ry: 0
2832
+ };
2833
+ }, "getNoteRect");
2834
+ var _drawTextCandidateFunc = /* @__PURE__ */ (function() {
2835
+ function byText(content, g, x, y, width, height, textAttrs) {
2836
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
2837
+ _setTextAttrs(text, textAttrs);
2838
+ }
2839
+ __name(byText, "byText");
2840
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2841
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2842
+ const [_actorFontSize, _actorFontSizePx] = parseFontSize(actorFontSize);
2843
+ const lines = content.split(common_default.lineBreakRegex);
2844
+ for (let i = 0; i < lines.length; i++) {
2845
+ const dy = i * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
2846
+ 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);
2847
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
2848
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2849
+ _setTextAttrs(text, textAttrs);
2850
+ }
2851
+ }
2852
+ __name(byTspan, "byTspan");
2853
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2854
+ const s = g.append("switch");
2855
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2856
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2857
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2858
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2859
+ _setTextAttrs(text, textAttrs);
2860
+ }
2861
+ __name(byFo, "byFo");
2862
+ async function byKatex(content, g, x, y, width, height, textAttrs, conf2) {
2863
+ const dim = await calculateMathMLDimensions(content, getConfig());
2864
+ const s = g.append("switch");
2865
+ 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);
2866
+ const text = f.append("xhtml:div").style("height", "100%").style("width", "100%");
2867
+ text.append("div").style("text-align", "center").style("vertical-align", "middle").html(await renderKatexSanitized(content, getConfig()));
2868
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2869
+ _setTextAttrs(text, textAttrs);
2870
+ }
2871
+ __name(byKatex, "byKatex");
2872
+ function _setTextAttrs(toText, fromTextAttrsDict) {
2873
+ for (const key in fromTextAttrsDict) {
2874
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
2875
+ toText.attr(key, fromTextAttrsDict[key]);
2876
+ }
2877
+ }
2878
+ }
2879
+ __name(_setTextAttrs, "_setTextAttrs");
2880
+ return function(conf2, hasKatex2 = false) {
2881
+ if (hasKatex2) {
2882
+ return byKatex;
2883
+ }
2884
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2885
+ };
2886
+ })();
2887
+ var _drawMenuItemTextCandidateFunc = /* @__PURE__ */ (function() {
2888
+ function byText(content, g, x, y, width, height, textAttrs) {
2889
+ const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").text(content);
2890
+ _setTextAttrs(text, textAttrs);
2891
+ }
2892
+ __name(byText, "byText");
2893
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2894
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2895
+ const lines = content.split(common_default.lineBreakRegex);
2896
+ for (let i = 0; i < lines.length; i++) {
2897
+ const dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
2898
+ 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);
2899
+ text.append("tspan").attr("x", x).attr("dy", dy).text(lines[i]);
2900
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2901
+ _setTextAttrs(text, textAttrs);
2902
+ }
2903
+ }
2904
+ __name(byTspan, "byTspan");
2905
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2906
+ const s = g.append("switch");
2907
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2908
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2909
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2910
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2911
+ _setTextAttrs(text, textAttrs);
2912
+ }
2913
+ __name(byFo, "byFo");
2914
+ function _setTextAttrs(toText, fromTextAttrsDict) {
2915
+ for (const key in fromTextAttrsDict) {
2916
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
2917
+ toText.attr(key, fromTextAttrsDict[key]);
2918
+ }
2919
+ }
2920
+ }
2921
+ __name(_setTextAttrs, "_setTextAttrs");
2922
+ return function(conf2) {
2923
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2924
+ };
2925
+ })();
2926
+ var insertSolidTopArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2927
+ elem.append("defs").append("marker").attr("id", id + "-solidTopArrowHead").attr("refX", 7.9).attr("refY", 7.25).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 8 L 0 8 z");
2928
+ }, "insertSolidTopArrowHead");
2929
+ var insertSolidBottomArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2930
+ elem.append("defs").append("marker").attr("id", id + "-solidBottomArrowHead").attr("refX", 7.9).attr("refY", 0.75).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 0 L 0 8 z");
2931
+ }, "insertSolidBottomArrowHead");
2932
+ var insertStickTopArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2933
+ elem.append("defs").append("marker").attr("id", id + "-stickTopArrowHead").attr("refX", 7.5).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 7 7").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
2934
+ }, "insertStickTopArrowHead");
2935
+ var insertStickBottomArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2936
+ elem.append("defs").append("marker").attr("id", id + "-stickBottomArrowHead").attr("refX", 7.5).attr("refY", 0).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 7 L 7 0").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
2937
+ }, "insertStickBottomArrowHead");
2938
+ var svgDraw_default = {
2939
+ drawRect: drawRect2,
2940
+ drawText,
2941
+ drawLabel,
2942
+ drawActor,
2943
+ drawBox,
2944
+ drawPopup,
2945
+ anchorElement,
2946
+ drawActivation,
2947
+ drawLoop,
2948
+ drawBackgroundRect: drawBackgroundRect2,
2949
+ insertArrowHead,
2950
+ insertArrowFilledHead,
2951
+ insertSequenceNumber,
2952
+ insertArrowCrossHead,
2953
+ insertDatabaseIcon,
2954
+ insertComputerIcon,
2955
+ insertClockIcon,
2956
+ getTextObj: getTextObj2,
2957
+ getNoteRect: getNoteRect2,
2958
+ fixLifeLineHeights,
2959
+ sanitizeUrl: distExports.sanitizeUrl,
2960
+ insertDropShadow,
2961
+ insertSolidTopArrowHead,
2962
+ insertSolidBottomArrowHead,
2963
+ insertStickTopArrowHead,
2964
+ insertStickBottomArrowHead
2965
+ };
2966
+ var conf = {};
2967
+ var bounds = {
2968
+ data: {
2969
+ startx: void 0,
2970
+ stopx: void 0,
2971
+ starty: void 0,
2972
+ stopy: void 0
2973
+ },
2974
+ verticalPos: 0,
2975
+ sequenceItems: [],
2976
+ activations: [],
2977
+ models: {
2978
+ getHeight: /* @__PURE__ */ __name(function() {
2979
+ return Math.max.apply(
2980
+ null,
2981
+ this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
2982
+ ) + (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));
2983
+ }, "getHeight"),
2984
+ clear: /* @__PURE__ */ __name(function() {
2985
+ this.actors = [];
2986
+ this.boxes = [];
2987
+ this.loops = [];
2988
+ this.messages = [];
2989
+ this.notes = [];
2990
+ }, "clear"),
2991
+ addBox: /* @__PURE__ */ __name(function(boxModel) {
2992
+ this.boxes.push(boxModel);
2993
+ }, "addBox"),
2994
+ addActor: /* @__PURE__ */ __name(function(actorModel) {
2995
+ this.actors.push(actorModel);
2996
+ }, "addActor"),
2997
+ addLoop: /* @__PURE__ */ __name(function(loopModel) {
2998
+ this.loops.push(loopModel);
2999
+ }, "addLoop"),
3000
+ addMessage: /* @__PURE__ */ __name(function(msgModel) {
3001
+ this.messages.push(msgModel);
3002
+ }, "addMessage"),
3003
+ addNote: /* @__PURE__ */ __name(function(noteModel) {
3004
+ this.notes.push(noteModel);
3005
+ }, "addNote"),
3006
+ lastActor: /* @__PURE__ */ __name(function() {
3007
+ return this.actors[this.actors.length - 1];
3008
+ }, "lastActor"),
3009
+ lastLoop: /* @__PURE__ */ __name(function() {
3010
+ return this.loops[this.loops.length - 1];
3011
+ }, "lastLoop"),
3012
+ lastMessage: /* @__PURE__ */ __name(function() {
3013
+ return this.messages[this.messages.length - 1];
3014
+ }, "lastMessage"),
3015
+ lastNote: /* @__PURE__ */ __name(function() {
3016
+ return this.notes[this.notes.length - 1];
3017
+ }, "lastNote"),
3018
+ actors: [],
3019
+ boxes: [],
3020
+ loops: [],
3021
+ messages: [],
3022
+ notes: []
3023
+ },
3024
+ init: /* @__PURE__ */ __name(function() {
3025
+ this.sequenceItems = [];
3026
+ this.activations = [];
3027
+ this.models.clear();
3028
+ this.data = {
3029
+ startx: void 0,
3030
+ stopx: void 0,
3031
+ starty: void 0,
3032
+ stopy: void 0
3033
+ };
3034
+ this.verticalPos = 0;
3035
+ setConf(getConfig2());
3036
+ }, "init"),
3037
+ updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
3038
+ if (obj[key] === void 0) {
3039
+ obj[key] = val;
3040
+ } else {
3041
+ obj[key] = fun(val, obj[key]);
3042
+ }
3043
+ }, "updateVal"),
3044
+ updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
3045
+ const _self = this;
3046
+ let cnt = 0;
3047
+ function updateFn(type) {
3048
+ return /* @__PURE__ */ __name(function updateItemBounds(item) {
3049
+ cnt++;
3050
+ const n = _self.sequenceItems.length - cnt + 1;
3051
+ _self.updateVal(item, "starty", starty - n * conf.boxMargin, Math.min);
3052
+ _self.updateVal(item, "stopy", stopy + n * conf.boxMargin, Math.max);
3053
+ _self.updateVal(bounds.data, "startx", startx - n * conf.boxMargin, Math.min);
3054
+ _self.updateVal(bounds.data, "stopx", stopx + n * conf.boxMargin, Math.max);
3055
+ if (!(type === "activation")) {
3056
+ _self.updateVal(item, "startx", startx - n * conf.boxMargin, Math.min);
3057
+ _self.updateVal(item, "stopx", stopx + n * conf.boxMargin, Math.max);
3058
+ _self.updateVal(bounds.data, "starty", starty - n * conf.boxMargin, Math.min);
3059
+ _self.updateVal(bounds.data, "stopy", stopy + n * conf.boxMargin, Math.max);
3060
+ }
3061
+ }, "updateItemBounds");
3062
+ }
3063
+ __name(updateFn, "updateFn");
3064
+ this.sequenceItems.forEach(updateFn());
3065
+ this.activations.forEach(updateFn("activation"));
3066
+ }, "updateBounds"),
3067
+ insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
3068
+ const _startx = common_default.getMin(startx, stopx);
3069
+ const _stopx = common_default.getMax(startx, stopx);
3070
+ const _starty = common_default.getMin(starty, stopy);
3071
+ const _stopy = common_default.getMax(starty, stopy);
3072
+ this.updateVal(bounds.data, "startx", _startx, Math.min);
3073
+ this.updateVal(bounds.data, "starty", _starty, Math.min);
3074
+ this.updateVal(bounds.data, "stopx", _stopx, Math.max);
3075
+ this.updateVal(bounds.data, "stopy", _stopy, Math.max);
3076
+ this.updateBounds(_startx, _starty, _stopx, _stopy);
3077
+ }, "insert"),
3078
+ newActivation: /* @__PURE__ */ __name(function(message, diagram2, actors) {
3079
+ const actorRect = actors.get(message.from);
3080
+ const stackedSize = actorActivations(message.from).length || 0;
3081
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
3082
+ this.activations.push({
3083
+ startx: x,
3084
+ starty: this.verticalPos + 2,
3085
+ stopx: x + conf.activationWidth,
3086
+ stopy: void 0,
3087
+ actor: message.from,
3088
+ anchored: svgDraw_default.anchorElement(diagram2)
3089
+ });
3090
+ }, "newActivation"),
3091
+ endActivation: /* @__PURE__ */ __name(function(message) {
3092
+ const lastActorActivationIdx = this.activations.map(function(activation) {
3093
+ return activation.actor;
3094
+ }).lastIndexOf(message.from);
3095
+ return this.activations.splice(lastActorActivationIdx, 1)[0];
3096
+ }, "endActivation"),
3097
+ createLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
3098
+ return {
3099
+ startx: void 0,
3100
+ starty: this.verticalPos,
3101
+ stopx: void 0,
3102
+ stopy: void 0,
3103
+ title: title.message,
3104
+ wrap: title.wrap,
3105
+ width: title.width,
3106
+ height: 0,
3107
+ fill
3108
+ };
3109
+ }, "createLoop"),
3110
+ newLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
3111
+ this.sequenceItems.push(this.createLoop(title, fill));
3112
+ }, "newLoop"),
3113
+ endLoop: /* @__PURE__ */ __name(function() {
3114
+ return this.sequenceItems.pop();
3115
+ }, "endLoop"),
3116
+ isLoopOverlap: /* @__PURE__ */ __name(function() {
3117
+ return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false;
3118
+ }, "isLoopOverlap"),
3119
+ addSectionToLoop: /* @__PURE__ */ __name(function(message) {
3120
+ const loop = this.sequenceItems.pop();
3121
+ loop.sections = loop.sections || [];
3122
+ loop.sectionTitles = loop.sectionTitles || [];
3123
+ loop.sections.push({ y: bounds.getVerticalPos(), height: 0 });
3124
+ loop.sectionTitles.push(message);
3125
+ this.sequenceItems.push(loop);
3126
+ }, "addSectionToLoop"),
3127
+ saveVerticalPos: /* @__PURE__ */ __name(function() {
3128
+ if (this.isLoopOverlap()) {
3129
+ this.savedVerticalPos = this.verticalPos;
3130
+ }
3131
+ }, "saveVerticalPos"),
3132
+ resetVerticalPos: /* @__PURE__ */ __name(function() {
3133
+ if (this.isLoopOverlap()) {
3134
+ this.verticalPos = this.savedVerticalPos;
3135
+ }
3136
+ }, "resetVerticalPos"),
3137
+ bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
3138
+ this.verticalPos = this.verticalPos + bump;
3139
+ this.data.stopy = common_default.getMax(this.data.stopy, this.verticalPos);
3140
+ }, "bumpVerticalPos"),
3141
+ getVerticalPos: /* @__PURE__ */ __name(function() {
3142
+ return this.verticalPos;
3143
+ }, "getVerticalPos"),
3144
+ getBounds: /* @__PURE__ */ __name(function() {
3145
+ return { bounds: this.data, models: this.models };
3146
+ }, "getBounds")
3147
+ };
3148
+ var drawNote = /* @__PURE__ */ __name(async function(elem, noteModel, id) {
3149
+ bounds.bumpVerticalPos(conf.boxMargin);
3150
+ noteModel.height = conf.boxMargin;
3151
+ noteModel.starty = bounds.getVerticalPos();
3152
+ const rect = getNoteRect();
3153
+ rect.x = noteModel.startx;
3154
+ rect.y = noteModel.starty;
3155
+ rect.width = noteModel.width || conf.width;
3156
+ rect.class = "note";
3157
+ const g = elem.append("g");
3158
+ g.attr("data-et", "note");
3159
+ g.attr("data-id", "i" + id);
3160
+ const rectElem = svgDraw_default.drawRect(g, rect);
3161
+ const textObj = getTextObj();
3162
+ textObj.x = noteModel.startx;
3163
+ textObj.y = noteModel.starty;
3164
+ textObj.width = rect.width;
3165
+ textObj.dy = "1em";
3166
+ textObj.text = noteModel.message;
3167
+ textObj.class = "noteText";
3168
+ textObj.fontFamily = conf.noteFontFamily;
3169
+ textObj.fontSize = conf.noteFontSize;
3170
+ textObj.fontWeight = conf.noteFontWeight;
3171
+ textObj.anchor = conf.noteAlign;
3172
+ textObj.textMargin = conf.noteMargin;
3173
+ textObj.valign = "center";
3174
+ const textElem = hasKatex(textObj.text) ? await drawKatex(g, textObj) : drawText(g, textObj);
3175
+ const textHeight = Math.round(
3176
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
3177
+ );
3178
+ rectElem.attr("height", textHeight + 2 * conf.noteMargin);
3179
+ noteModel.height += textHeight + 2 * conf.noteMargin;
3180
+ bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
3181
+ noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
3182
+ noteModel.stopx = noteModel.startx + rect.width;
3183
+ bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
3184
+ bounds.models.addNote(noteModel);
3185
+ }, "drawNote");
3186
+ var drawCentralConnection = /* @__PURE__ */ __name(function(elem, msg, msgModel, diagObj, startx, stopx, lineStartY) {
3187
+ const actors = diagObj.db.getActors();
3188
+ const fromActor = actors.get(msg.from);
3189
+ const toActor = actors.get(msg.to);
3190
+ const isAutoNumberOn = msgModel.sequenceVisible;
3191
+ let fromCenter = fromActor.x + fromActor.width / 2;
3192
+ let toCenter = toActor.x + toActor.width / 2;
3193
+ const isLeftToRight = fromCenter <= toCenter;
3194
+ const isReverse = isReverseArrowType(msg, diagObj);
3195
+ const g = elem.append("g");
3196
+ const CENTRAL_CONNECTION_CIRCLE_OFFSET = 16.5;
3197
+ const getCircleOffset = /* @__PURE__ */ __name((isLeftToRight2, isReverse2) => {
3198
+ const baseOffset = isLeftToRight2 ? CENTRAL_CONNECTION_CIRCLE_OFFSET : -CENTRAL_CONNECTION_CIRCLE_OFFSET;
3199
+ return isReverse2 ? -baseOffset : baseOffset;
3200
+ }, "getCircleOffset");
3201
+ const drawCircle = /* @__PURE__ */ __name((cx) => {
3202
+ g.append("circle").attr("cx", cx).attr("cy", lineStartY).attr("r", 5).attr("width", 10).attr("height", 10);
3203
+ }, "drawCircle");
3204
+ const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
3205
+ if (isAutoNumberOn) {
3206
+ switch (msg.centralConnection) {
3207
+ case CENTRAL_CONNECTION:
3208
+ if (isReverse) {
3209
+ toCenter += getCircleOffset(isLeftToRight, true);
3210
+ }
3211
+ break;
3212
+ case CENTRAL_CONNECTION_REVERSE:
3213
+ if (!isReverse) {
3214
+ fromCenter += getCircleOffset(isLeftToRight, false);
3215
+ }
3216
+ break;
3217
+ case CENTRAL_CONNECTION_DUAL:
3218
+ if (isReverse) {
3219
+ toCenter += getCircleOffset(isLeftToRight, true);
3220
+ } else {
3221
+ fromCenter += getCircleOffset(isLeftToRight, false);
3222
+ }
3223
+ break;
3224
+ }
3225
+ }
3226
+ switch (msg.centralConnection) {
3227
+ case CENTRAL_CONNECTION:
3228
+ drawCircle(toCenter);
3229
+ break;
3230
+ case CENTRAL_CONNECTION_REVERSE:
3231
+ drawCircle(fromCenter);
3232
+ break;
3233
+ case CENTRAL_CONNECTION_DUAL:
3234
+ drawCircle(fromCenter);
3235
+ drawCircle(toCenter);
3236
+ break;
3237
+ }
3238
+ }, "drawCentralConnection");
3239
+ var messageFont = /* @__PURE__ */ __name((cnf) => {
3240
+ return {
3241
+ fontFamily: cnf.messageFontFamily,
3242
+ fontSize: cnf.messageFontSize,
3243
+ fontWeight: cnf.messageFontWeight
3244
+ };
3245
+ }, "messageFont");
3246
+ var noteFont = /* @__PURE__ */ __name((cnf) => {
3247
+ return {
3248
+ fontFamily: cnf.noteFontFamily,
3249
+ fontSize: cnf.noteFontSize,
3250
+ fontWeight: cnf.noteFontWeight
3251
+ };
3252
+ }, "noteFont");
3253
+ var actorFont = /* @__PURE__ */ __name((cnf) => {
3254
+ return {
3255
+ fontFamily: cnf.actorFontFamily,
3256
+ fontSize: cnf.actorFontSize,
3257
+ fontWeight: cnf.actorFontWeight
3258
+ };
3259
+ }, "actorFont");
3260
+ async function boundMessage(_diagram, msgModel) {
3261
+ bounds.bumpVerticalPos(10);
3262
+ const { startx, stopx, message } = msgModel;
3263
+ const lines = common_default.splitBreaks(message).length;
3264
+ const isKatexMsg = hasKatex(message);
3265
+ const textDims = isKatexMsg ? await calculateMathMLDimensions(message, getConfig2()) : utils_default.calculateTextDimensions(message, messageFont(conf));
3266
+ if (!isKatexMsg) {
3267
+ const lineHeight = textDims.height / lines;
3268
+ msgModel.height += lineHeight;
3269
+ bounds.bumpVerticalPos(lineHeight);
3270
+ }
3271
+ let lineStartY;
3272
+ let totalOffset = textDims.height - 10;
3273
+ const textWidth = textDims.width;
3274
+ if (startx === stopx) {
3275
+ lineStartY = bounds.getVerticalPos() + totalOffset;
3276
+ if (!conf.rightAngles) {
3277
+ totalOffset += conf.boxMargin;
3278
+ lineStartY = bounds.getVerticalPos() + totalOffset;
3279
+ }
3280
+ totalOffset += 30;
3281
+ const dx = common_default.getMax(textWidth / 2, conf.width / 2);
3282
+ bounds.insert(
3283
+ startx - dx,
3284
+ bounds.getVerticalPos() - 10 + totalOffset,
3285
+ stopx + dx,
3286
+ bounds.getVerticalPos() + 30 + totalOffset
3287
+ );
3288
+ } else {
3289
+ totalOffset += conf.boxMargin;
3290
+ lineStartY = bounds.getVerticalPos() + totalOffset;
3291
+ bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
3292
+ }
3293
+ bounds.bumpVerticalPos(totalOffset);
3294
+ msgModel.height += totalOffset;
3295
+ msgModel.stopy = msgModel.starty + msgModel.height;
3296
+ bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
3297
+ return lineStartY;
3298
+ }
3299
+ __name(boundMessage, "boundMessage");
3300
+ var drawMessage = /* @__PURE__ */ __name(async function(diagram2, msgModel, lineStartY, diagObj, msg, diagramId) {
3301
+ const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
3302
+ const textDims = utils_default.calculateTextDimensions(message, messageFont(conf));
3303
+ const textObj = getTextObj();
3304
+ textObj.x = Math.min(startx, stopx);
3305
+ textObj.y = starty + 10;
3306
+ textObj.width = Math.abs(stopx - startx);
3307
+ textObj.class = "messageText";
3308
+ textObj.dy = "1em";
3309
+ textObj.text = message;
3310
+ textObj.fontFamily = conf.messageFontFamily;
3311
+ textObj.fontSize = conf.messageFontSize;
3312
+ textObj.fontWeight = conf.messageFontWeight;
3313
+ textObj.anchor = conf.messageAlign;
3314
+ textObj.valign = "center";
3315
+ textObj.textMargin = conf.wrapPadding;
3316
+ textObj.tspan = false;
3317
+ if (hasKatex(textObj.text)) {
3318
+ await drawKatex(diagram2, textObj, { startx, stopx, starty: lineStartY });
3319
+ } else {
3320
+ drawText(diagram2, textObj);
3321
+ }
3322
+ const textWidth = textDims.width;
3323
+ let line;
3324
+ if (startx === stopx) {
3325
+ const isAutoNumberOn = sequenceVisible || conf.showSequenceNumbers;
3326
+ const isReverse = isReverseArrowType(msg, diagObj);
3327
+ const isBidirectional = isBidirectionalArrowType(msg, diagObj);
3328
+ const lineStartX = startx + (isAutoNumberOn && (isReverse || isBidirectional) ? 10 : 0);
3329
+ if (conf.rightAngles) {
3330
+ line = diagram2.append("path").attr(
3331
+ "d",
3332
+ `M ${lineStartX},${lineStartY} H ${startx + common_default.getMax(conf.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}`
3333
+ );
3334
+ } else {
3335
+ line = diagram2.append("path").attr(
3336
+ "d",
3337
+ "M " + lineStartX + "," + lineStartY + " C " + (lineStartX + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20)
3338
+ );
3339
+ }
3340
+ if (hasCentralConnection(msg, diagObj)) {
3341
+ drawCentralConnection(diagram2, msg, msgModel, diagObj, startx, stopx, lineStartY);
3342
+ }
3343
+ } else {
3344
+ line = diagram2.append("line");
3345
+ line.attr("x1", startx);
3346
+ line.attr("y1", lineStartY);
3347
+ line.attr("x2", stopx);
3348
+ line.attr("y2", lineStartY);
3349
+ if (hasCentralConnection(msg, diagObj)) {
3350
+ drawCentralConnection(diagram2, msg, msgModel, diagObj, startx, stopx, lineStartY);
3351
+ }
3352
+ }
3353
+ 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 || type === diagObj.db.LINETYPE.SOLID_TOP_DOTTED || type === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED || type === diagObj.db.LINETYPE.STICK_TOP_DOTTED || type === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
3354
+ line.style("stroke-dasharray", "3, 3");
3355
+ line.attr("class", "messageLine1");
3356
+ } else {
3357
+ line.attr("class", "messageLine0");
3358
+ }
3359
+ line.attr("data-et", "message");
3360
+ line.attr("data-id", "i" + msgModel.id);
3361
+ line.attr("data-from", msgModel.from);
3362
+ line.attr("data-to", msgModel.to);
3363
+ let url = "";
3364
+ if (conf.arrowMarkerAbsolute) {
3365
+ url = getUrl(true);
3366
+ }
3367
+ line.attr("stroke-width", 2);
3368
+ line.attr("stroke", "none");
3369
+ line.style("fill", "none");
3370
+ if (type === diagObj.db.LINETYPE.SOLID_TOP || type === diagObj.db.LINETYPE.SOLID_TOP_DOTTED) {
3371
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-solidTopArrowHead)");
3372
+ }
3373
+ if (type === diagObj.db.LINETYPE.SOLID_BOTTOM || type === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED) {
3374
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-solidBottomArrowHead)");
3375
+ }
3376
+ if (type === diagObj.db.LINETYPE.STICK_TOP || type === diagObj.db.LINETYPE.STICK_TOP_DOTTED) {
3377
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-stickTopArrowHead)");
3378
+ }
3379
+ if (type === diagObj.db.LINETYPE.STICK_BOTTOM || type === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED) {
3380
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-stickBottomArrowHead)");
3381
+ }
3382
+ if (type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED) {
3383
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-solidBottomArrowHead)");
3384
+ }
3385
+ if (type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED) {
3386
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-solidTopArrowHead)");
3387
+ }
3388
+ if (type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED) {
3389
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-stickBottomArrowHead)");
3390
+ }
3391
+ if (type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
3392
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-stickTopArrowHead)");
3393
+ }
3394
+ if (type === diagObj.db.LINETYPE.SOLID || type === diagObj.db.LINETYPE.DOTTED) {
3395
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
3396
+ }
3397
+ if (type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
3398
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-arrowhead)");
3399
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
3400
+ }
3401
+ if (type === diagObj.db.LINETYPE.SOLID_POINT || type === diagObj.db.LINETYPE.DOTTED_POINT) {
3402
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-filled-head)");
3403
+ }
3404
+ if (type === diagObj.db.LINETYPE.SOLID_CROSS || type === diagObj.db.LINETYPE.DOTTED_CROSS) {
3405
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-crosshead)");
3406
+ }
3407
+ if (sequenceVisible || conf.showSequenceNumbers) {
3408
+ const isBidirectional = type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED;
3409
+ const isReverseArrowType2 = type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
3410
+ const SEQUENCE_NUMBER_RADIUS = 6;
3411
+ const hasCentralConn = hasCentralConnection(msg, diagObj);
3412
+ let lineStartX = startx;
3413
+ let lineStopX = stopx;
3414
+ if (isBidirectional) {
3415
+ if (startx < stopx) {
3416
+ lineStartX = startx + SEQUENCE_NUMBER_RADIUS * 2;
3417
+ } else {
3418
+ lineStartX = startx - SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? -5 : 0);
3419
+ lineStartX += (msg == null ? void 0 : msg.centralConnection) === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || (msg == null ? void 0 : msg.centralConnection) === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
3420
+ }
3421
+ line.attr("x1", lineStartX);
3422
+ } else if (isReverseArrowType2) {
3423
+ if (stopx > startx) {
3424
+ lineStopX = stopx - 2 * SEQUENCE_NUMBER_RADIUS;
3425
+ } else {
3426
+ lineStopX = stopx - SEQUENCE_NUMBER_RADIUS;
3427
+ lineStartX += (msg == null ? void 0 : msg.centralConnection) === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || (msg == null ? void 0 : msg.centralConnection) === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
3428
+ }
3429
+ lineStopX += hasCentralConn ? 15 : 0;
3430
+ line.attr("x2", lineStopX);
3431
+ line.attr("x1", lineStartX);
3432
+ } else {
3433
+ line.attr("x1", startx + SEQUENCE_NUMBER_RADIUS);
3434
+ }
3435
+ let autonumberX = 0;
3436
+ const isSelfMessage = startx === stopx;
3437
+ const isLeftToRight = startx <= stopx;
3438
+ if (isSelfMessage) {
3439
+ autonumberX = msgModel.fromBounds + 1;
3440
+ } else if (isReverseArrowType2) {
3441
+ autonumberX = isLeftToRight ? msgModel.toBounds - 1 : msgModel.fromBounds + 1;
3442
+ } else {
3443
+ autonumberX = isLeftToRight ? msgModel.fromBounds + 1 : msgModel.toBounds - 1;
3444
+ }
3445
+ let fontSize = "12px";
3446
+ const sequenceIndexLength = sequenceIndex.toString().length;
3447
+ if (sequenceIndexLength > 5) {
3448
+ fontSize = "7px";
3449
+ } else if (sequenceIndexLength > 3) {
3450
+ fontSize = "9px";
3451
+ }
3452
+ diagram2.append("line").attr("x1", autonumberX).attr("y1", lineStartY).attr("x2", autonumberX).attr("y2", lineStartY).attr("stroke-width", 0).attr("marker-start", "url(" + url + "#" + diagramId + "-sequencenumber)");
3453
+ diagram2.append("text").attr("x", autonumberX).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", fontSize).attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex);
3454
+ }
3455
+ }, "drawMessage");
3456
+ var addActorRenderingData = /* @__PURE__ */ __name(function(diagram2, actors, createdActors, actorKeys, verticalPos, messages, isFooter) {
3457
+ let prevWidth = 0;
3458
+ let prevMargin = 0;
3459
+ let prevBox = void 0;
3460
+ let maxHeight = 0;
3461
+ for (const actorKey of actorKeys) {
3462
+ const actor = actors.get(actorKey);
3463
+ const box = actor.box;
3464
+ if (prevBox && prevBox != box) {
3465
+ if (!isFooter) {
3466
+ bounds.models.addBox(prevBox);
3467
+ }
3468
+ prevMargin += conf.boxMargin + prevBox.margin;
3469
+ }
3470
+ if (box && box != prevBox) {
3471
+ if (!isFooter) {
3472
+ box.x = prevWidth + prevMargin;
3473
+ box.y = verticalPos;
3474
+ }
3475
+ prevMargin += box.margin;
3476
+ }
3477
+ actor.width = common_default.getMax(actor.width || conf.width, conf.width);
3478
+ actor.height = common_default.getMax(actor.height || conf.height, conf.height);
3479
+ actor.margin = actor.margin || conf.actorMargin;
3480
+ maxHeight = common_default.getMax(maxHeight, actor.height);
3481
+ if (createdActors.get(actor.name)) {
3482
+ prevMargin += actor.width / 2;
3483
+ }
3484
+ actor.x = prevWidth + prevMargin;
3485
+ actor.starty = bounds.getVerticalPos();
3486
+ bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
3487
+ prevWidth += actor.width + prevMargin;
3488
+ if (actor.box) {
3489
+ actor.box.width = prevWidth + box.margin - actor.box.x;
3490
+ }
3491
+ prevMargin = actor.margin;
3492
+ prevBox = actor.box;
3493
+ bounds.models.addActor(actor);
3494
+ }
3495
+ if (prevBox && !isFooter) {
3496
+ bounds.models.addBox(prevBox);
3497
+ }
3498
+ bounds.bumpVerticalPos(maxHeight);
3499
+ }, "addActorRenderingData");
3500
+ var drawActors = /* @__PURE__ */ __name(async function(diagram2, actors, actorKeys, isFooter, diagramId, diagObj, actorIndexMap) {
3501
+ if (!isFooter) {
3502
+ for (const actorKey of actorKeys) {
3503
+ const actor = actors.get(actorKey);
3504
+ await svgDraw_default.drawActor(diagram2, actor, conf, false, diagramId, diagObj, actorIndexMap);
3505
+ }
3506
+ } else {
3507
+ let maxHeight = 0;
3508
+ bounds.bumpVerticalPos(conf.boxMargin * 2);
3509
+ for (const actorKey of actorKeys) {
3510
+ const actor = actors.get(actorKey);
3511
+ if (!actor.stopy) {
3512
+ actor.stopy = bounds.getVerticalPos();
3513
+ }
3514
+ const height = await svgDraw_default.drawActor(
3515
+ diagram2,
3516
+ actor,
3517
+ conf,
3518
+ true,
3519
+ diagramId,
3520
+ diagObj,
3521
+ actorIndexMap
3522
+ );
3523
+ maxHeight = common_default.getMax(maxHeight, height);
3524
+ }
3525
+ bounds.bumpVerticalPos(maxHeight + conf.boxMargin);
3526
+ }
3527
+ }, "drawActors");
3528
+ var drawActorsPopup = /* @__PURE__ */ __name(function(diagram2, actors, actorKeys, doc) {
3529
+ let maxHeight = 0;
3530
+ let maxWidth = 0;
3531
+ for (const actorKey of actorKeys) {
3532
+ const actor = actors.get(actorKey);
3533
+ const minMenuWidth = getRequiredPopupWidth(actor);
3534
+ const menuDimensions = svgDraw_default.drawPopup(
3535
+ diagram2,
3536
+ actor,
3537
+ minMenuWidth,
3538
+ conf,
3539
+ conf.forceMenus,
3540
+ doc
3541
+ );
3542
+ if (menuDimensions.height > maxHeight) {
3543
+ maxHeight = menuDimensions.height;
3544
+ }
3545
+ if (menuDimensions.width + actor.x > maxWidth) {
3546
+ maxWidth = menuDimensions.width + actor.x;
3547
+ }
3548
+ }
3549
+ return { maxHeight, maxWidth };
3550
+ }, "drawActorsPopup");
3551
+ var setConf = /* @__PURE__ */ __name(function(cnf) {
3552
+ assignWithDepth_default(conf, cnf);
3553
+ if (cnf.fontFamily) {
3554
+ conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
3555
+ }
3556
+ if (cnf.fontSize) {
3557
+ conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
3558
+ }
3559
+ if (cnf.fontWeight) {
3560
+ conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
3561
+ }
3562
+ }, "setConf");
3563
+ var actorActivations = /* @__PURE__ */ __name(function(actor) {
3564
+ return bounds.activations.filter(function(activation) {
3565
+ return activation.actor === actor;
3566
+ });
3567
+ }, "actorActivations");
3568
+ var activationBounds = /* @__PURE__ */ __name(function(actor, actors) {
3569
+ const actorObj = actors.get(actor);
3570
+ const activations = actorActivations(actor);
3571
+ const left = activations.reduce(
3572
+ function(acc, activation) {
3573
+ return common_default.getMin(acc, activation.startx);
3574
+ },
3575
+ actorObj.x + actorObj.width / 2 - 1
3576
+ );
3577
+ const right = activations.reduce(
3578
+ function(acc, activation) {
3579
+ return common_default.getMax(acc, activation.stopx);
3580
+ },
3581
+ actorObj.x + actorObj.width / 2 + 1
3582
+ );
3583
+ return [left, right];
3584
+ }, "activationBounds");
3585
+ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
3586
+ bounds.bumpVerticalPos(preMargin);
3587
+ let heightAdjust = postMargin;
3588
+ if (msg.id && msg.message && loopWidths[msg.id]) {
3589
+ const loopWidth = loopWidths[msg.id].width;
3590
+ const textConf = messageFont(conf);
3591
+ msg.message = utils_default.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
3592
+ msg.width = loopWidth;
3593
+ msg.wrap = true;
3594
+ const textDims = utils_default.calculateTextDimensions(msg.message, textConf);
3595
+ const totalOffset = common_default.getMax(textDims.height, conf.labelBoxHeight);
3596
+ heightAdjust = postMargin + totalOffset;
3597
+ log.debug(`${totalOffset} - ${msg.message}`);
3598
+ }
3599
+ addLoopFn(msg);
3600
+ bounds.bumpVerticalPos(heightAdjust);
3601
+ }
3602
+ __name(adjustLoopHeightForWrap, "adjustLoopHeightForWrap");
3603
+ function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors, createdActors, destroyedActors) {
3604
+ function receiverAdjustment(actor, adjustment) {
3605
+ if (actor.x < actors.get(msg.from).x) {
3606
+ bounds.insert(
3607
+ msgModel.stopx - adjustment,
3608
+ msgModel.starty,
3609
+ msgModel.startx,
3610
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3611
+ );
3612
+ msgModel.stopx = msgModel.stopx + adjustment;
3613
+ } else {
3614
+ bounds.insert(
3615
+ msgModel.startx,
3616
+ msgModel.starty,
3617
+ msgModel.stopx + adjustment,
3618
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3619
+ );
3620
+ msgModel.stopx = msgModel.stopx - adjustment;
3621
+ }
3622
+ }
3623
+ __name(receiverAdjustment, "receiverAdjustment");
3624
+ function senderAdjustment(actor, adjustment) {
3625
+ if (actor.x < actors.get(msg.to).x) {
3626
+ bounds.insert(
3627
+ msgModel.startx - adjustment,
3628
+ msgModel.starty,
3629
+ msgModel.stopx,
3630
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3631
+ );
3632
+ msgModel.startx = msgModel.startx + adjustment;
3633
+ } else {
3634
+ bounds.insert(
3635
+ msgModel.stopx,
3636
+ msgModel.starty,
3637
+ msgModel.startx + adjustment,
3638
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
3639
+ );
3640
+ msgModel.startx = msgModel.startx - adjustment;
3641
+ }
3642
+ }
3643
+ __name(senderAdjustment, "senderAdjustment");
3644
+ const actorArray = [
3645
+ PARTICIPANT_TYPE.ACTOR,
3646
+ PARTICIPANT_TYPE.CONTROL,
3647
+ PARTICIPANT_TYPE.ENTITY,
3648
+ PARTICIPANT_TYPE.DATABASE
3649
+ ];
3650
+ if (createdActors.get(msg.to) == index) {
3651
+ const actor = actors.get(msg.to);
3652
+ const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
3653
+ receiverAdjustment(actor, adjustment);
3654
+ actor.starty = lineStartY - actor.height / 2;
3655
+ bounds.bumpVerticalPos(actor.height / 2);
3656
+ } else if (destroyedActors.get(msg.from) == index) {
3657
+ const actor = actors.get(msg.from);
3658
+ if (conf.mirrorActors) {
3659
+ const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2;
3660
+ senderAdjustment(actor, adjustment);
3661
+ }
3662
+ actor.stopy = lineStartY - actor.height / 2;
3663
+ bounds.bumpVerticalPos(actor.height / 2);
3664
+ } else if (destroyedActors.get(msg.to) == index) {
3665
+ const actor = actors.get(msg.to);
3666
+ if (conf.mirrorActors) {
3667
+ const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
3668
+ receiverAdjustment(actor, adjustment);
3669
+ }
3670
+ actor.stopy = lineStartY - actor.height / 2;
3671
+ bounds.bumpVerticalPos(actor.height / 2);
3672
+ }
3673
+ }
3674
+ __name(adjustCreatedDestroyedData, "adjustCreatedDestroyedData");
3675
+ var draw = /* @__PURE__ */ __name(async function(_text, id, _version, diagObj) {
3676
+ const { securityLevel, sequence, look, themeVariables } = getConfig2();
3677
+ conf = sequence;
3678
+ let sandboxElement;
3679
+ if (securityLevel === "sandbox") {
3680
+ sandboxElement = select("#i" + id);
3681
+ }
3682
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
3683
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
3684
+ bounds.init();
3685
+ log.debug(diagObj.db);
3686
+ const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
3687
+ const actors = diagObj.db.getActors();
3688
+ const createdActors = diagObj.db.getCreatedActors();
3689
+ const destroyedActors = diagObj.db.getDestroyedActors();
3690
+ const boxes = diagObj.db.getBoxes();
3691
+ let actorKeys = diagObj.db.getActorKeys();
3692
+ const messages = diagObj.db.getMessages();
3693
+ const title = diagObj.db.getDiagramTitle();
3694
+ const hasBoxes = diagObj.db.hasAtLeastOneBox();
3695
+ const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle();
3696
+ const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors, messages, diagObj);
3697
+ conf.height = await calculateActorMargins(actors, maxMessageWidthPerActor, boxes);
3698
+ svgDraw_default.insertComputerIcon(diagram2, id);
3699
+ svgDraw_default.insertDatabaseIcon(diagram2, id);
3700
+ svgDraw_default.insertClockIcon(diagram2, id);
3701
+ if (hasBoxes) {
3702
+ bounds.bumpVerticalPos(conf.boxMargin);
3703
+ if (hasBoxTitles) {
3704
+ bounds.bumpVerticalPos(boxes[0].textMaxHeight);
3705
+ }
3706
+ }
3707
+ if (conf.hideUnusedParticipants === true) {
3708
+ const newActors = /* @__PURE__ */ new Set();
3709
+ messages.forEach((message) => {
3710
+ newActors.add(message.from);
3711
+ newActors.add(message.to);
3712
+ });
3713
+ actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey));
3714
+ }
3715
+ const actorIndexMap = new Map(
3716
+ actorKeys.map((actorKey, index2) => {
3717
+ var _a2;
3718
+ return [((_a2 = actors.get(actorKey)) == null ? void 0 : _a2.name) ?? actorKey, index2];
3719
+ })
3720
+ );
3721
+ addActorRenderingData(diagram2, actors, createdActors, actorKeys, 0, messages, false);
3722
+ const loopWidths = await calculateLoopBounds(messages, actors, maxMessageWidthPerActor, diagObj);
3723
+ svgDraw_default.insertArrowHead(diagram2, id);
3724
+ svgDraw_default.insertArrowCrossHead(diagram2, id);
3725
+ svgDraw_default.insertArrowFilledHead(diagram2, id);
3726
+ svgDraw_default.insertSequenceNumber(diagram2, id);
3727
+ svgDraw_default.insertSolidTopArrowHead(diagram2, id);
3728
+ svgDraw_default.insertSolidBottomArrowHead(diagram2, id);
3729
+ svgDraw_default.insertStickTopArrowHead(diagram2, id);
3730
+ svgDraw_default.insertStickBottomArrowHead(diagram2, id);
3731
+ if (look === "neo") {
3732
+ svgDraw_default.insertDropShadow(diagram2, conf);
3733
+ }
3734
+ function activeEnd(msg, verticalPos) {
3735
+ const activationData = bounds.endActivation(msg);
3736
+ if (activationData.starty + 18 > verticalPos) {
3737
+ activationData.starty = verticalPos - 6;
3738
+ verticalPos += 12;
3739
+ }
3740
+ svgDraw_default.drawActivation(
3741
+ diagram2,
3742
+ activationData,
3743
+ verticalPos,
3744
+ conf,
3745
+ actorActivations(msg.from).length,
3746
+ diagObj,
3747
+ actorIndexMap
3748
+ );
3749
+ bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
3750
+ }
3751
+ __name(activeEnd, "activeEnd");
3752
+ let sequenceIndex = 1;
3753
+ let sequenceIndexStep = 1;
3754
+ const messagesToDraw = [];
3755
+ const backgrounds = [];
3756
+ let index = 0;
3757
+ for (const msg of messages) {
3758
+ let loopModel, noteModel, msgModel;
3759
+ switch (msg.type) {
3760
+ case diagObj.db.LINETYPE.NOTE:
3761
+ bounds.resetVerticalPos();
3762
+ noteModel = msg.noteModel;
3763
+ await drawNote(diagram2, noteModel, msg.id);
3764
+ break;
3765
+ case diagObj.db.LINETYPE.ACTIVE_START:
3766
+ bounds.newActivation(msg, diagram2, actors);
3767
+ break;
3768
+ case diagObj.db.LINETYPE.CENTRAL_CONNECTION:
3769
+ bounds.newActivation(msg, diagram2, actors);
3770
+ break;
3771
+ case diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE:
3772
+ bounds.newActivation(msg, diagram2, actors);
3773
+ break;
3774
+ case diagObj.db.LINETYPE.ACTIVE_END:
3775
+ activeEnd(msg, bounds.getVerticalPos());
3776
+ break;
3777
+ case diagObj.db.LINETYPE.LOOP_START:
3778
+ adjustLoopHeightForWrap(
3779
+ loopWidths,
3780
+ msg,
3781
+ conf.boxMargin,
3782
+ conf.boxMargin + conf.boxTextMargin,
3783
+ (message) => bounds.newLoop(message)
3784
+ );
3785
+ break;
3786
+ case diagObj.db.LINETYPE.LOOP_END:
3787
+ loopModel = bounds.endLoop();
3788
+ await svgDraw_default.drawLoop(diagram2, loopModel, "loop", conf, msg);
3789
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3790
+ bounds.models.addLoop(loopModel);
3791
+ break;
3792
+ case diagObj.db.LINETYPE.RECT_START:
3793
+ adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, (message) => {
3794
+ let fill = message.message;
3795
+ if (!fill) {
3796
+ fill = (themeVariables == null ? void 0 : themeVariables.rectBkgColor) || (themeVariables == null ? void 0 : themeVariables.actorBkg) || "rgba(128, 128, 128, 0.5)";
3797
+ }
3798
+ bounds.newLoop(void 0, fill);
3799
+ });
3800
+ break;
3801
+ case diagObj.db.LINETYPE.RECT_END:
3802
+ loopModel = bounds.endLoop();
3803
+ backgrounds.push(loopModel);
3804
+ bounds.models.addLoop(loopModel);
3805
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3806
+ break;
3807
+ case diagObj.db.LINETYPE.OPT_START:
3808
+ adjustLoopHeightForWrap(
3809
+ loopWidths,
3810
+ msg,
3811
+ conf.boxMargin,
3812
+ conf.boxMargin + conf.boxTextMargin,
3813
+ (message) => bounds.newLoop(message)
3814
+ );
3815
+ break;
3816
+ case diagObj.db.LINETYPE.OPT_END:
3817
+ loopModel = bounds.endLoop();
3818
+ await svgDraw_default.drawLoop(diagram2, loopModel, "opt", conf, msg);
3819
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3820
+ bounds.models.addLoop(loopModel);
3821
+ break;
3822
+ case diagObj.db.LINETYPE.ALT_START:
3823
+ adjustLoopHeightForWrap(
3824
+ loopWidths,
3825
+ msg,
3826
+ conf.boxMargin,
3827
+ conf.boxMargin + conf.boxTextMargin,
3828
+ (message) => bounds.newLoop(message)
3829
+ );
3830
+ break;
3831
+ case diagObj.db.LINETYPE.ALT_ELSE:
3832
+ adjustLoopHeightForWrap(
3833
+ loopWidths,
3834
+ msg,
3835
+ conf.boxMargin + conf.boxTextMargin,
3836
+ conf.boxMargin,
3837
+ (message) => bounds.addSectionToLoop(message)
3838
+ );
3839
+ break;
3840
+ case diagObj.db.LINETYPE.ALT_END:
3841
+ loopModel = bounds.endLoop();
3842
+ await svgDraw_default.drawLoop(diagram2, loopModel, "alt", conf, msg);
3843
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3844
+ bounds.models.addLoop(loopModel);
3845
+ break;
3846
+ case diagObj.db.LINETYPE.PAR_START:
3847
+ case diagObj.db.LINETYPE.PAR_OVER_START:
3848
+ adjustLoopHeightForWrap(
3849
+ loopWidths,
3850
+ msg,
3851
+ conf.boxMargin,
3852
+ conf.boxMargin + conf.boxTextMargin,
3853
+ (message) => bounds.newLoop(message)
3854
+ );
3855
+ bounds.saveVerticalPos();
3856
+ break;
3857
+ case diagObj.db.LINETYPE.PAR_AND:
3858
+ adjustLoopHeightForWrap(
3859
+ loopWidths,
3860
+ msg,
3861
+ conf.boxMargin + conf.boxTextMargin,
3862
+ conf.boxMargin,
3863
+ (message) => bounds.addSectionToLoop(message)
3864
+ );
3865
+ break;
3866
+ case diagObj.db.LINETYPE.PAR_END:
3867
+ loopModel = bounds.endLoop();
3868
+ await svgDraw_default.drawLoop(diagram2, loopModel, "par", conf, msg);
3869
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3870
+ bounds.models.addLoop(loopModel);
3871
+ break;
3872
+ case diagObj.db.LINETYPE.AUTONUMBER:
3873
+ sequenceIndex = msg.message.start || sequenceIndex;
3874
+ sequenceIndexStep = msg.message.step || sequenceIndexStep;
3875
+ if (msg.message.visible) {
3876
+ diagObj.db.enableSequenceNumbers();
3877
+ } else {
3878
+ diagObj.db.disableSequenceNumbers();
3879
+ }
3880
+ break;
3881
+ case diagObj.db.LINETYPE.CRITICAL_START:
3882
+ adjustLoopHeightForWrap(
3883
+ loopWidths,
3884
+ msg,
3885
+ conf.boxMargin,
3886
+ conf.boxMargin + conf.boxTextMargin,
3887
+ (message) => bounds.newLoop(message)
3888
+ );
3889
+ break;
3890
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
3891
+ adjustLoopHeightForWrap(
3892
+ loopWidths,
3893
+ msg,
3894
+ conf.boxMargin + conf.boxTextMargin,
3895
+ conf.boxMargin,
3896
+ (message) => bounds.addSectionToLoop(message)
3897
+ );
3898
+ break;
3899
+ case diagObj.db.LINETYPE.CRITICAL_END:
3900
+ loopModel = bounds.endLoop();
3901
+ await svgDraw_default.drawLoop(diagram2, loopModel, "critical", conf, msg);
3902
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3903
+ bounds.models.addLoop(loopModel);
3904
+ break;
3905
+ case diagObj.db.LINETYPE.BREAK_START:
3906
+ adjustLoopHeightForWrap(
3907
+ loopWidths,
3908
+ msg,
3909
+ conf.boxMargin,
3910
+ conf.boxMargin + conf.boxTextMargin,
3911
+ (message) => bounds.newLoop(message)
3912
+ );
3913
+ break;
3914
+ case diagObj.db.LINETYPE.BREAK_END:
3915
+ loopModel = bounds.endLoop();
3916
+ await svgDraw_default.drawLoop(diagram2, loopModel, "break", conf, msg);
3917
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3918
+ bounds.models.addLoop(loopModel);
3919
+ break;
3920
+ default:
3921
+ try {
3922
+ msgModel = msg.msgModel;
3923
+ msgModel.starty = bounds.getVerticalPos();
3924
+ msgModel.sequenceIndex = sequenceIndex;
3925
+ msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
3926
+ msgModel.id = msg.id;
3927
+ msgModel.from = msg.from;
3928
+ msgModel.to = msg.to;
3929
+ const lineStartY = await boundMessage(diagram2, msgModel);
3930
+ adjustCreatedDestroyedData(
3931
+ msg,
3932
+ msgModel,
3933
+ lineStartY,
3934
+ index,
3935
+ actors,
3936
+ createdActors,
3937
+ destroyedActors
3938
+ );
3939
+ messagesToDraw.push({ messageModel: msgModel, lineStartY, msg });
3940
+ bounds.models.addMessage(msgModel);
3941
+ } catch (e) {
3942
+ log.error("error while drawing message", e);
3943
+ }
3944
+ }
3945
+ if ([
3946
+ diagObj.db.LINETYPE.SOLID_OPEN,
3947
+ diagObj.db.LINETYPE.DOTTED_OPEN,
3948
+ diagObj.db.LINETYPE.SOLID,
3949
+ diagObj.db.LINETYPE.SOLID_TOP,
3950
+ diagObj.db.LINETYPE.SOLID_BOTTOM,
3951
+ diagObj.db.LINETYPE.STICK_TOP,
3952
+ diagObj.db.LINETYPE.STICK_BOTTOM,
3953
+ diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
3954
+ diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
3955
+ diagObj.db.LINETYPE.STICK_TOP_DOTTED,
3956
+ diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
3957
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
3958
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
3959
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
3960
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
3961
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
3962
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
3963
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
3964
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
3965
+ diagObj.db.LINETYPE.DOTTED,
3966
+ diagObj.db.LINETYPE.SOLID_CROSS,
3967
+ diagObj.db.LINETYPE.DOTTED_CROSS,
3968
+ diagObj.db.LINETYPE.SOLID_POINT,
3969
+ diagObj.db.LINETYPE.DOTTED_POINT,
3970
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
3971
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
3972
+ ].includes(msg.type)) {
3973
+ sequenceIndex = Math.round((sequenceIndex + sequenceIndexStep) * 100) / 100;
3974
+ }
3975
+ index++;
3976
+ }
3977
+ log.debug("createdActors", createdActors);
3978
+ log.debug("destroyedActors", destroyedActors);
3979
+ await drawActors(diagram2, actors, actorKeys, false, id, diagObj, actorIndexMap);
3980
+ for (const e of messagesToDraw) {
3981
+ await drawMessage(diagram2, e.messageModel, e.lineStartY, diagObj, e.msg, id);
3982
+ }
3983
+ if (conf.mirrorActors) {
3984
+ await drawActors(diagram2, actors, actorKeys, true, id, diagObj, actorIndexMap);
3985
+ }
3986
+ backgrounds.forEach((e) => svgDraw_default.drawBackgroundRect(diagram2, e));
3987
+ fixLifeLineHeights(diagram2, actors, actorKeys, conf);
3988
+ for (const box2 of bounds.models.boxes) {
3989
+ box2.height = bounds.getVerticalPos() - box2.y;
3990
+ bounds.insert(box2.x, box2.y, box2.x + box2.width, box2.height);
3991
+ const boxPadding = conf.boxMargin * 2;
3992
+ box2.startx = box2.x - boxPadding;
3993
+ box2.starty = box2.y - boxPadding * 0.25;
3994
+ box2.stopx = box2.startx + box2.width + 2 * boxPadding;
3995
+ box2.stopy = box2.starty + box2.height + boxPadding * 0.75;
3996
+ box2.stroke = "rgb(0,0,0, 0.5)";
3997
+ svgDraw_default.drawBox(diagram2, box2, conf);
3998
+ }
3999
+ if (hasBoxes) {
4000
+ bounds.bumpVerticalPos(conf.boxMargin);
4001
+ }
4002
+ const requiredBoxSize = drawActorsPopup(diagram2, actors, actorKeys, doc);
4003
+ const { bounds: box } = bounds.getBounds();
4004
+ if (box.startx === void 0) {
4005
+ box.startx = 0;
4006
+ }
4007
+ if (box.starty === void 0) {
4008
+ box.starty = 0;
4009
+ }
4010
+ if (box.stopx === void 0) {
4011
+ box.stopx = 0;
4012
+ }
4013
+ if (box.stopy === void 0) {
4014
+ box.stopy = 0;
4015
+ }
4016
+ let boxHeight = box.stopy - box.starty;
4017
+ if (boxHeight < requiredBoxSize.maxHeight) {
4018
+ boxHeight = requiredBoxSize.maxHeight;
4019
+ }
4020
+ let height = boxHeight + 2 * conf.diagramMarginY;
4021
+ if (conf.mirrorActors) {
4022
+ height = height - conf.boxMargin + conf.bottomMarginAdj;
4023
+ }
4024
+ let boxWidth = box.stopx - box.startx;
4025
+ if (boxWidth < requiredBoxSize.maxWidth) {
4026
+ boxWidth = requiredBoxSize.maxWidth;
4027
+ }
4028
+ const width = boxWidth + 2 * conf.diagramMarginX;
4029
+ if (title) {
4030
+ diagram2.append("text").text(title).attr("x", (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr("y", -25);
4031
+ }
4032
+ configureSvgSize(diagram2, height, width, conf.useMaxWidth);
4033
+ const extraVertForTitle = title ? 40 : 0;
4034
+ const extraHeightForNeoActors = actors.size && look === "neo" ? 30 : 0;
4035
+ diagram2.attr(
4036
+ "viewBox",
4037
+ box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle + extraHeightForNeoActors)
4038
+ );
4039
+ log.debug(`models:`, bounds.models);
4040
+ }, "draw");
4041
+ async function getMaxMessageWidthPerActor(actors, messages, diagObj) {
4042
+ const maxMessageWidthPerActor = {};
4043
+ for (const msg of messages) {
4044
+ if (actors.get(msg.to) && actors.get(msg.from)) {
4045
+ const actor = actors.get(msg.to);
4046
+ if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
4047
+ continue;
4048
+ }
4049
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
4050
+ continue;
4051
+ }
4052
+ const isNote = msg.placement !== void 0;
4053
+ const isMessage = !isNote;
4054
+ const textFont = isNote ? noteFont(conf) : messageFont(conf);
4055
+ const wrappedMessage = msg.wrap ? utils_default.wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
4056
+ const messageDimensions = hasKatex(wrappedMessage) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(wrappedMessage, textFont);
4057
+ const messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
4058
+ if (isMessage && msg.from === actor.nextActor) {
4059
+ maxMessageWidthPerActor[msg.to] = common_default.getMax(
4060
+ maxMessageWidthPerActor[msg.to] || 0,
4061
+ messageWidth
4062
+ );
4063
+ } else if (isMessage && msg.from === actor.prevActor) {
4064
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4065
+ maxMessageWidthPerActor[msg.from] || 0,
4066
+ messageWidth
4067
+ );
4068
+ } else if (isMessage && msg.from === msg.to) {
4069
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4070
+ maxMessageWidthPerActor[msg.from] || 0,
4071
+ messageWidth / 2
4072
+ );
4073
+ maxMessageWidthPerActor[msg.to] = common_default.getMax(
4074
+ maxMessageWidthPerActor[msg.to] || 0,
4075
+ messageWidth / 2
4076
+ );
4077
+ } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
4078
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4079
+ maxMessageWidthPerActor[msg.from] || 0,
4080
+ messageWidth
4081
+ );
4082
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
4083
+ maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
4084
+ maxMessageWidthPerActor[actor.prevActor] || 0,
4085
+ messageWidth
4086
+ );
4087
+ } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
4088
+ if (actor.prevActor) {
4089
+ maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
4090
+ maxMessageWidthPerActor[actor.prevActor] || 0,
4091
+ messageWidth / 2
4092
+ );
4093
+ }
4094
+ if (actor.nextActor) {
4095
+ maxMessageWidthPerActor[msg.from] = common_default.getMax(
4096
+ maxMessageWidthPerActor[msg.from] || 0,
4097
+ messageWidth / 2
4098
+ );
4099
+ }
4100
+ }
4101
+ }
4102
+ }
4103
+ log.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor);
4104
+ return maxMessageWidthPerActor;
4105
+ }
4106
+ __name(getMaxMessageWidthPerActor, "getMaxMessageWidthPerActor");
4107
+ var getRequiredPopupWidth = /* @__PURE__ */ __name(function(actor) {
4108
+ let requiredPopupWidth = 0;
4109
+ const textFont = actorFont(conf);
4110
+ for (const key in actor.links) {
4111
+ const labelDimensions = utils_default.calculateTextDimensions(key, textFont);
4112
+ const labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
4113
+ if (requiredPopupWidth < labelWidth) {
4114
+ requiredPopupWidth = labelWidth;
4115
+ }
4116
+ }
4117
+ return requiredPopupWidth;
4118
+ }, "getRequiredPopupWidth");
4119
+ async function calculateActorMargins(actors, actorToMessageWidth, boxes) {
4120
+ let maxHeight = 0;
4121
+ for (const prop of actors.keys()) {
4122
+ const actor = actors.get(prop);
4123
+ if (actor.wrap) {
4124
+ actor.description = utils_default.wrapLabel(
4125
+ actor.description,
4126
+ conf.width - 2 * conf.wrapPadding,
4127
+ actorFont(conf)
4128
+ );
4129
+ }
4130
+ const actDims = hasKatex(actor.description) ? await calculateMathMLDimensions(actor.description, getConfig2()) : utils_default.calculateTextDimensions(actor.description, actorFont(conf));
4131
+ actor.width = actor.wrap ? conf.width : common_default.getMax(conf.width, actDims.width + 2 * conf.wrapPadding);
4132
+ actor.height = actor.wrap ? common_default.getMax(actDims.height, conf.height) : conf.height;
4133
+ maxHeight = common_default.getMax(maxHeight, actor.height);
4134
+ }
4135
+ for (const actorKey in actorToMessageWidth) {
4136
+ const actor = actors.get(actorKey);
4137
+ if (!actor) {
4138
+ continue;
4139
+ }
4140
+ const nextActor = actors.get(actor.nextActor);
4141
+ if (!nextActor) {
4142
+ const messageWidth2 = actorToMessageWidth[actorKey];
4143
+ const actorWidth2 = messageWidth2 + conf.actorMargin - actor.width / 2;
4144
+ actor.margin = common_default.getMax(actorWidth2, conf.actorMargin);
4145
+ continue;
4146
+ }
4147
+ const messageWidth = actorToMessageWidth[actorKey];
4148
+ const actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
4149
+ actor.margin = common_default.getMax(actorWidth, conf.actorMargin);
4150
+ }
4151
+ let maxBoxHeight = 0;
4152
+ boxes.forEach((box) => {
4153
+ const textFont = messageFont(conf);
4154
+ let totalWidth = box.actorKeys.reduce((total, aKey) => {
4155
+ return total += actors.get(aKey).width + (actors.get(aKey).margin || 0);
4156
+ }, 0);
4157
+ const standardBoxPadding = conf.boxMargin * 8;
4158
+ totalWidth += standardBoxPadding;
4159
+ totalWidth -= 2 * conf.boxTextMargin;
4160
+ if (box.wrap) {
4161
+ box.name = utils_default.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
4162
+ }
4163
+ const boxMsgDimensions = utils_default.calculateTextDimensions(box.name, textFont);
4164
+ maxBoxHeight = common_default.getMax(boxMsgDimensions.height, maxBoxHeight);
4165
+ const minWidth = common_default.getMax(totalWidth, boxMsgDimensions.width + 2 * conf.wrapPadding);
4166
+ box.margin = conf.boxTextMargin;
4167
+ if (totalWidth < minWidth) {
4168
+ const missing = (minWidth - totalWidth) / 2;
4169
+ box.margin += missing;
4170
+ }
4171
+ });
4172
+ boxes.forEach((box) => box.textMaxHeight = maxBoxHeight);
4173
+ return common_default.getMax(maxHeight, conf.height);
4174
+ }
4175
+ __name(calculateActorMargins, "calculateActorMargins");
4176
+ var buildNoteModel = /* @__PURE__ */ __name(async function(msg, actors, diagObj) {
4177
+ const fromActor = actors.get(msg.from);
4178
+ const toActor = actors.get(msg.to);
4179
+ const startx = fromActor.x;
4180
+ const stopx = toActor.x;
4181
+ const shouldWrap = msg.wrap && msg.message;
4182
+ let textDimensions = hasKatex(msg.message) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(
4183
+ shouldWrap ? utils_default.wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message,
4184
+ noteFont(conf)
4185
+ );
4186
+ const noteModel = {
4187
+ width: shouldWrap ? conf.width : common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin),
4188
+ height: 0,
4189
+ startx: fromActor.x,
4190
+ stopx: 0,
4191
+ starty: 0,
4192
+ stopy: 0,
4193
+ message: msg.message
4194
+ };
4195
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
4196
+ noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width) : common_default.getMax(
4197
+ fromActor.width / 2 + toActor.width / 2,
4198
+ textDimensions.width + 2 * conf.noteMargin
4199
+ );
4200
+ noteModel.startx = startx + (fromActor.width + conf.actorMargin) / 2;
4201
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
4202
+ noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin) : common_default.getMax(
4203
+ fromActor.width / 2 + toActor.width / 2,
4204
+ textDimensions.width + 2 * conf.noteMargin
4205
+ );
4206
+ noteModel.startx = startx - noteModel.width + (fromActor.width - conf.actorMargin) / 2;
4207
+ } else if (msg.to === msg.from) {
4208
+ textDimensions = utils_default.calculateTextDimensions(
4209
+ shouldWrap ? utils_default.wrapLabel(msg.message, common_default.getMax(conf.width, fromActor.width), noteFont(conf)) : msg.message,
4210
+ noteFont(conf)
4211
+ );
4212
+ noteModel.width = shouldWrap ? common_default.getMax(conf.width, fromActor.width) : common_default.getMax(fromActor.width, conf.width, textDimensions.width + 2 * conf.noteMargin);
4213
+ noteModel.startx = startx + (fromActor.width - noteModel.width) / 2;
4214
+ } else {
4215
+ noteModel.width = Math.abs(startx + fromActor.width / 2 - (stopx + toActor.width / 2)) + conf.actorMargin;
4216
+ noteModel.startx = startx < stopx ? startx + fromActor.width / 2 - conf.actorMargin / 2 : stopx + toActor.width / 2 - conf.actorMargin / 2;
4217
+ }
4218
+ if (shouldWrap) {
4219
+ noteModel.message = utils_default.wrapLabel(
4220
+ msg.message,
4221
+ noteModel.width - 2 * conf.wrapPadding,
4222
+ noteFont(conf)
4223
+ );
4224
+ }
4225
+ log.debug(
4226
+ `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]`
4227
+ );
4228
+ return noteModel;
4229
+ }, "buildNoteModel");
4230
+ var CENTRAL_CONNECTION_BASE_OFFSET = 4;
4231
+ var hasCentralConnection = /* @__PURE__ */ __name(function(msg, diagObj) {
4232
+ const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
4233
+ return [CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL].includes(
4234
+ msg.centralConnection
4235
+ );
4236
+ }, "hasCentralConnection");
4237
+ var calculateCentralConnectionOffset = /* @__PURE__ */ __name(function(msg, diagObj, isArrowToRight) {
4238
+ const {
4239
+ CENTRAL_CONNECTION_REVERSE,
4240
+ CENTRAL_CONNECTION_DUAL,
4241
+ BIDIRECTIONAL_SOLID,
4242
+ BIDIRECTIONAL_DOTTED
4243
+ } = diagObj.db.LINETYPE;
4244
+ let offset = 0;
4245
+ if (msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) {
4246
+ offset += CENTRAL_CONNECTION_BASE_OFFSET;
4247
+ }
4248
+ if ((msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) && (msg.type === BIDIRECTIONAL_SOLID || msg.type === BIDIRECTIONAL_DOTTED)) {
4249
+ offset += isArrowToRight ? 0 : -6;
4250
+ }
4251
+ return offset;
4252
+ }, "calculateCentralConnectionOffset");
4253
+ var isReverseArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
4254
+ const {
4255
+ SOLID_ARROW_TOP_REVERSE,
4256
+ SOLID_ARROW_TOP_REVERSE_DOTTED,
4257
+ SOLID_ARROW_BOTTOM_REVERSE,
4258
+ SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4259
+ STICK_ARROW_TOP_REVERSE,
4260
+ STICK_ARROW_TOP_REVERSE_DOTTED,
4261
+ STICK_ARROW_BOTTOM_REVERSE,
4262
+ STICK_ARROW_BOTTOM_REVERSE_DOTTED
4263
+ } = diagObj.db.LINETYPE;
4264
+ return [
4265
+ SOLID_ARROW_TOP_REVERSE,
4266
+ SOLID_ARROW_TOP_REVERSE_DOTTED,
4267
+ SOLID_ARROW_BOTTOM_REVERSE,
4268
+ SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4269
+ STICK_ARROW_TOP_REVERSE,
4270
+ STICK_ARROW_TOP_REVERSE_DOTTED,
4271
+ STICK_ARROW_BOTTOM_REVERSE,
4272
+ STICK_ARROW_BOTTOM_REVERSE_DOTTED
4273
+ ].includes(msg.type);
4274
+ }, "isReverseArrowType");
4275
+ var isBidirectionalArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
4276
+ const { BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED } = diagObj.db.LINETYPE;
4277
+ return [BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED].includes(msg.type);
4278
+ }, "isBidirectionalArrowType");
4279
+ var buildMessageModel = /* @__PURE__ */ __name(function(msg, actors, diagObj) {
4280
+ const { look } = getConfig2();
4281
+ if (![
4282
+ diagObj.db.LINETYPE.SOLID_OPEN,
4283
+ diagObj.db.LINETYPE.DOTTED_OPEN,
4284
+ diagObj.db.LINETYPE.SOLID,
4285
+ diagObj.db.LINETYPE.SOLID_TOP,
4286
+ diagObj.db.LINETYPE.SOLID_BOTTOM,
4287
+ diagObj.db.LINETYPE.STICK_TOP,
4288
+ diagObj.db.LINETYPE.STICK_BOTTOM,
4289
+ diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
4290
+ diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
4291
+ diagObj.db.LINETYPE.STICK_TOP_DOTTED,
4292
+ diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
4293
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4294
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
4295
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
4296
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
4297
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4298
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4299
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
4300
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
4301
+ diagObj.db.LINETYPE.DOTTED,
4302
+ diagObj.db.LINETYPE.SOLID_CROSS,
4303
+ diagObj.db.LINETYPE.DOTTED_CROSS,
4304
+ diagObj.db.LINETYPE.SOLID_POINT,
4305
+ diagObj.db.LINETYPE.DOTTED_POINT,
4306
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
4307
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
4308
+ ].includes(msg.type)) {
4309
+ return {};
4310
+ }
4311
+ const [fromLeft, fromRight] = activationBounds(msg.from, actors);
4312
+ const [toLeft, toRight] = activationBounds(msg.to, actors);
4313
+ const isArrowToRight = fromLeft <= toLeft;
4314
+ let startx = isArrowToRight ? fromRight : fromLeft;
4315
+ let stopx = isArrowToRight ? toLeft : toRight;
4316
+ if (look === "neo") {
4317
+ const offset = 3;
4318
+ if (msg.type !== diagObj.db.LINETYPE.SOLID_OPEN) {
4319
+ stopx += isArrowToRight ? -offset : offset;
4320
+ }
4321
+ if (msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
4322
+ startx += isArrowToRight ? offset : -offset;
4323
+ }
4324
+ }
4325
+ startx += calculateCentralConnectionOffset(msg, diagObj, isArrowToRight);
4326
+ const isArrowToActivation = Math.abs(toLeft - toRight) > 2;
4327
+ const adjustValue = /* @__PURE__ */ __name((value) => {
4328
+ return isArrowToRight ? -value : value;
4329
+ }, "adjustValue");
4330
+ if (msg.from === msg.to) {
4331
+ stopx = startx;
4332
+ } else {
4333
+ if (msg.activate && !isArrowToActivation) {
4334
+ stopx += adjustValue(conf.activationWidth / 2 - 1);
4335
+ }
4336
+ if (![
4337
+ diagObj.db.LINETYPE.SOLID_OPEN,
4338
+ diagObj.db.LINETYPE.DOTTED_OPEN,
4339
+ diagObj.db.LINETYPE.STICK_TOP,
4340
+ diagObj.db.LINETYPE.STICK_BOTTOM,
4341
+ diagObj.db.LINETYPE.STICK_TOP_DOTTED,
4342
+ diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
4343
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4344
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4345
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
4346
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
4347
+ diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
4348
+ diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
4349
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4350
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
4351
+ ].includes(msg.type)) {
4352
+ stopx += adjustValue(3);
4353
+ }
4354
+ if ([
4355
+ diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
4356
+ diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED,
4357
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4358
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4359
+ diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4360
+ diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
4361
+ ].includes(msg.type)) {
4362
+ startx -= adjustValue(3);
4363
+ }
4364
+ }
4365
+ const allBounds = [fromLeft, fromRight, toLeft, toRight];
4366
+ const boundedWidth = Math.abs(startx - stopx);
4367
+ if (msg.wrap && msg.message) {
4368
+ msg.message = utils_default.wrapLabel(
4369
+ msg.message,
4370
+ common_default.getMax(boundedWidth + 2 * conf.wrapPadding, conf.width),
4371
+ messageFont(conf)
4372
+ );
4373
+ }
4374
+ const msgDims = utils_default.calculateTextDimensions(msg.message, messageFont(conf));
4375
+ return {
4376
+ width: common_default.getMax(
4377
+ msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
4378
+ boundedWidth + 2 * conf.wrapPadding,
4379
+ conf.width
4380
+ ),
4381
+ height: 0,
4382
+ startx,
4383
+ stopx,
4384
+ starty: 0,
4385
+ stopy: 0,
4386
+ message: msg.message,
4387
+ type: msg.type,
4388
+ wrap: msg.wrap,
4389
+ fromBounds: Math.min.apply(null, allBounds),
4390
+ toBounds: Math.max.apply(null, allBounds)
4391
+ };
4392
+ }, "buildMessageModel");
4393
+ var calculateLoopBounds = /* @__PURE__ */ __name(async function(messages, actors, _maxWidthPerActor, diagObj) {
4394
+ const loops = {};
4395
+ const stack = [];
4396
+ let current, noteModel, msgModel;
4397
+ for (const msg of messages) {
4398
+ switch (msg.type) {
4399
+ case diagObj.db.LINETYPE.LOOP_START:
4400
+ case diagObj.db.LINETYPE.ALT_START:
4401
+ case diagObj.db.LINETYPE.OPT_START:
4402
+ case diagObj.db.LINETYPE.PAR_START:
4403
+ case diagObj.db.LINETYPE.PAR_OVER_START:
4404
+ case diagObj.db.LINETYPE.CRITICAL_START:
4405
+ case diagObj.db.LINETYPE.BREAK_START:
4406
+ stack.push({
4407
+ id: msg.id,
4408
+ msg: msg.message,
4409
+ from: Number.MAX_SAFE_INTEGER,
4410
+ to: Number.MIN_SAFE_INTEGER,
4411
+ width: 0
4412
+ });
4413
+ break;
4414
+ case diagObj.db.LINETYPE.ALT_ELSE:
4415
+ case diagObj.db.LINETYPE.PAR_AND:
4416
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
4417
+ if (msg.message) {
4418
+ current = stack.pop();
4419
+ loops[current.id] = current;
4420
+ loops[msg.id] = current;
4421
+ stack.push(current);
4422
+ }
4423
+ break;
4424
+ case diagObj.db.LINETYPE.LOOP_END:
4425
+ case diagObj.db.LINETYPE.ALT_END:
4426
+ case diagObj.db.LINETYPE.OPT_END:
4427
+ case diagObj.db.LINETYPE.PAR_END:
4428
+ case diagObj.db.LINETYPE.CRITICAL_END:
4429
+ case diagObj.db.LINETYPE.BREAK_END:
4430
+ current = stack.pop();
4431
+ loops[current.id] = current;
4432
+ break;
4433
+ case diagObj.db.LINETYPE.ACTIVE_START:
4434
+ {
4435
+ const actorRect = actors.get(msg.from ? msg.from : msg.to.actor);
4436
+ const stackedSize = actorActivations(msg.from ? msg.from : msg.to.actor).length;
4437
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
4438
+ const toAdd = {
4439
+ startx: x,
4440
+ stopx: x + conf.activationWidth,
4441
+ actor: msg.from,
4442
+ enabled: true
4443
+ };
4444
+ bounds.activations.push(toAdd);
4445
+ }
4446
+ break;
4447
+ case diagObj.db.LINETYPE.ACTIVE_END:
4448
+ {
4449
+ const lastActorActivationIdx = bounds.activations.map((a) => a.actor).lastIndexOf(msg.from);
4450
+ bounds.activations.splice(lastActorActivationIdx, 1).splice(0, 1);
4451
+ }
4452
+ break;
4453
+ }
4454
+ const isNote = msg.placement !== void 0;
4455
+ if (isNote) {
4456
+ noteModel = await buildNoteModel(msg, actors, diagObj);
4457
+ msg.noteModel = noteModel;
4458
+ stack.forEach((stk) => {
4459
+ current = stk;
4460
+ current.from = common_default.getMin(current.from, noteModel.startx);
4461
+ current.to = common_default.getMax(current.to, noteModel.startx + noteModel.width);
4462
+ current.width = common_default.getMax(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
4463
+ });
4464
+ } else {
4465
+ msgModel = buildMessageModel(msg, actors, diagObj);
4466
+ msg.msgModel = msgModel;
4467
+ if (msgModel.startx && msgModel.stopx && stack.length > 0) {
4468
+ stack.forEach((stk) => {
4469
+ current = stk;
4470
+ if (msgModel.startx === msgModel.stopx) {
4471
+ const from = actors.get(msg.from);
4472
+ const to = actors.get(msg.to);
4473
+ current.from = common_default.getMin(
4474
+ from.x - msgModel.width / 2,
4475
+ from.x - from.width / 2,
4476
+ current.from
4477
+ );
4478
+ current.to = common_default.getMax(
4479
+ to.x + msgModel.width / 2,
4480
+ to.x + from.width / 2,
4481
+ current.to
4482
+ );
4483
+ current.width = common_default.getMax(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
4484
+ } else {
4485
+ current.from = common_default.getMin(msgModel.startx, current.from);
4486
+ current.to = common_default.getMax(msgModel.stopx, current.to);
4487
+ current.width = common_default.getMax(current.width, msgModel.width) - conf.labelBoxWidth;
4488
+ }
4489
+ });
4490
+ }
4491
+ }
4492
+ }
4493
+ bounds.activations = [];
4494
+ log.debug("Loop type widths:", loops);
4495
+ return loops;
4496
+ }, "calculateLoopBounds");
4497
+ var sequenceRenderer_default = {
4498
+ bounds,
4499
+ drawActors,
4500
+ drawActorsPopup,
4501
+ setConf,
4502
+ draw
4503
+ };
4504
+ var diagram = {
4505
+ parser: sequenceDiagram_default,
4506
+ get db() {
4507
+ return new SequenceDB();
4508
+ },
4509
+ renderer: sequenceRenderer_default,
4510
+ styles: styles_default,
4511
+ init: /* @__PURE__ */ __name((cnf) => {
4512
+ if (!cnf.sequence) {
4513
+ cnf.sequence = {};
4514
+ }
4515
+ if (cnf.wrap) {
4516
+ cnf.sequence.wrap = cnf.wrap;
4517
+ setConfig2({ sequence: { wrap: cnf.wrap } });
4518
+ }
4519
+ }, "init")
4520
+ };
4521
+ export {
4522
+ diagram
4523
+ };