whipped 0.8.0 → 0.9.0

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 +1294 -259
  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-RwOyl_Kz.js +119 -0
  10. package/dist/web-ui/assets/arc-DmDBHE0H.js +131 -0
  11. package/dist/web-ui/assets/architectureDiagram-ZJ3FMSHR-RTwadm6J.js +8821 -0
  12. package/dist/web-ui/assets/blockDiagram-677ZJIJ3-Dvv5uMUE.js +3801 -0
  13. package/dist/web-ui/assets/c4Diagram-LMCZKHZV-bvr9R9cD.js +2479 -0
  14. package/dist/web-ui/assets/channel-BGhlETgZ.js +7 -0
  15. package/dist/web-ui/assets/chunk-2Q5K7J3B-BRq-Qbau.js +17 -0
  16. package/dist/web-ui/assets/chunk-32BRIVSS-Dy1BUZGx.js +116 -0
  17. package/dist/web-ui/assets/chunk-5VM5RSS4-DCUiIwIc.js +19 -0
  18. package/dist/web-ui/assets/chunk-EX3LRPZG-Cg_Vtzwz.js +1996 -0
  19. package/dist/web-ui/assets/chunk-JWPE2WC7-BW4n_ZhH.js +17 -0
  20. package/dist/web-ui/assets/chunk-MOJQB5TN-BykRa615.js +855 -0
  21. package/dist/web-ui/assets/chunk-RYQCIY6F-D4F7oV1d.js +476 -0
  22. package/dist/web-ui/assets/chunk-V7JOEXUC-DD4mm30h.js +2022 -0
  23. package/dist/web-ui/assets/chunk-VR4S4FIN-Fgvcluvk.js +25 -0
  24. package/dist/web-ui/assets/chunk-XXDRQBXY-C4FVmO5r.js +13 -0
  25. package/dist/web-ui/assets/classDiagram-OUVF2IWQ-DD4KIYF1.js +24 -0
  26. package/dist/web-ui/assets/classDiagram-v2-EOCWNBFH-DD4KIYF1.js +24 -0
  27. package/dist/web-ui/assets/cose-bilkent-JH36ORCC-ekFwvYt9.js +4943 -0
  28. package/dist/web-ui/assets/cynefin-VYW2F7L2-DTNV7gvQ.js +31527 -0
  29. package/dist/web-ui/assets/cynefinDiagram-TSTJHNR4-koYialeC.js +454 -0
  30. package/dist/web-ui/assets/cytoscape.esm-CaQ7Fomf.js +30346 -0
  31. package/dist/web-ui/assets/dagre-VKFMJZFB-Do43FV3o.js +526 -0
  32. package/dist/web-ui/assets/defaultLocale-B2RvLBDe.js +206 -0
  33. package/dist/web-ui/assets/diagram-FQU43EPY-D0STdny6.js +636 -0
  34. package/dist/web-ui/assets/diagram-G47NLZAW-D9g6BdZT.js +858 -0
  35. package/dist/web-ui/assets/diagram-NH7WQ7WH-zLW6CAmi.js +212 -0
  36. package/dist/web-ui/assets/diagram-OA4YK3LP-CA5tvsYw.js +492 -0
  37. package/dist/web-ui/assets/diagram-WEI45ONY-CLmYUHR0.js +309 -0
  38. package/dist/web-ui/assets/ebnfDiagram-CCIWWBDH-KkHubBI6.js +139 -0
  39. package/dist/web-ui/assets/erDiagram-Q63AITRT-BJna2u1n.js +1238 -0
  40. package/dist/web-ui/assets/flowDiagram-23GEKE2U-DVJKalah.js +2353 -0
  41. package/dist/web-ui/assets/ganttDiagram-NO4QXBWP-D9HwNV4u.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-B7wnoO0J.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-CuGz83Sg.js → index-DZ7I8r_C.js} +41629 -39831
  57. package/dist/web-ui/assets/infoDiagram-FWYZ7A6U-BY6XoiF8.js +32 -0
  58. package/dist/web-ui/assets/init-ZxktEp_H.js +16 -0
  59. package/dist/web-ui/assets/ishikawaDiagram-FXEZZL3T-BaZVnO8j.js +967 -0
  60. package/dist/web-ui/assets/journeyDiagram-5HDEW3XC-CUA6DUAQ.js +1256 -0
  61. package/dist/web-ui/assets/kanban-definition-HUTT4EX6-5W5tiWrd.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-CfvGIyDE.js +340 -0
  65. package/dist/web-ui/assets/map-BEO0Bu8q.js +298 -0
  66. package/dist/web-ui/assets/mermaid.core-BRk3IzY2.js +26639 -0
  67. package/dist/web-ui/assets/mindmap-definition-LN4V7U3C-2GmLg6ou.js +1183 -0
  68. package/dist/web-ui/assets/ordinal-DSZU4PqD.js +76 -0
  69. package/dist/web-ui/assets/pegDiagram-2B236MQR-gTEdrkJg.js +127 -0
  70. package/dist/web-ui/assets/pieDiagram-ENE6RG2P-CYXjIhqC.js +318 -0
  71. package/dist/web-ui/assets/quadrantDiagram-ABIIQ3AL-BStRZxwf.js +1341 -0
  72. package/dist/web-ui/assets/railroadDiagram-RFXS5EU6-btveDRG2.js +93 -0
  73. package/dist/web-ui/assets/requirementDiagram-TGXJPOKE-Cy_155rE.js +1205 -0
  74. package/dist/web-ui/assets/sankeyDiagram-HTMAVEWB-Chtvw3_G.js +1264 -0
  75. package/dist/web-ui/assets/sequenceDiagram-DBY2YBRQ-DDuMVEX1.js +4523 -0
  76. package/dist/web-ui/assets/sizeCapture-X5ZJPWSS-Bylf0o6J.js +64 -0
  77. package/dist/web-ui/assets/stateDiagram-2N3HPSRC-DIzLeR5G.js +453 -0
  78. package/dist/web-ui/assets/stateDiagram-v2-6OUMAXLB-zG_WjT1-.js +23 -0
  79. package/dist/web-ui/assets/swimlanes-5IMT3BWC-TKaCmVta.js +8575 -0
  80. package/dist/web-ui/assets/swimlanesDiagram-G3AALYLV-C5eB3qqS.js +21 -0
  81. package/dist/web-ui/assets/timeline-definition-FHXFAJF6-CC5Ujpcu.js +1606 -0
  82. package/dist/web-ui/assets/vennDiagram-L72KCM5P-DUSVXSYT.js +2523 -0
  83. package/dist/web-ui/assets/wardleyDiagram-EHGQE667-CoP9xn89.js +978 -0
  84. package/dist/web-ui/assets/xychartDiagram-FW5EYKEG-B9FqP_kk.js +1972 -0
  85. package/dist/web-ui/index.html +2 -2
  86. package/package.json +14 -16
@@ -0,0 +1,2479 @@
1
+ var _a, _b;
2
+ import { g as getNoteRect, d as drawRect } from "./chunk-32BRIVSS-Dy1BUZGx.js";
3
+ import { s as setAccDescription, g as getAccDescription, a as getAccTitle, b as setAccTitle, _ as __name, c as getConfig2, d as select, l as log, e as configureSvgSize, f as assignWithDepth_default, h as calculateTextWidth, i as sanitizeText, j as distExports, w as wrapLabel, k as common_default, m as calculateTextHeight } from "./mermaid.core-BRk3IzY2.js";
4
+ import "./index-DZ7I8r_C.js";
5
+ var parser = (function() {
6
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
7
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
8
+ return o2;
9
+ }, "o"), $V0 = [1, 24], $V1 = [1, 25], $V2 = [1, 26], $V3 = [1, 27], $V4 = [1, 28], $V5 = [1, 63], $V6 = [1, 64], $V7 = [1, 65], $V8 = [1, 66], $V9 = [1, 67], $Va = [1, 68], $Vb = [1, 69], $Vc = [1, 29], $Vd = [1, 30], $Ve = [1, 31], $Vf = [1, 32], $Vg = [1, 33], $Vh = [1, 34], $Vi = [1, 35], $Vj = [1, 36], $Vk = [1, 37], $Vl = [1, 38], $Vm = [1, 39], $Vn = [1, 40], $Vo = [1, 41], $Vp = [1, 42], $Vq = [1, 43], $Vr = [1, 44], $Vs = [1, 45], $Vt = [1, 46], $Vu = [1, 47], $Vv = [1, 48], $Vw = [1, 50], $Vx = [1, 51], $Vy = [1, 52], $Vz = [1, 53], $VA = [1, 54], $VB = [1, 55], $VC = [1, 56], $VD = [1, 57], $VE = [1, 58], $VF = [1, 59], $VG = [1, 60], $VH = [14, 42], $VI = [14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VJ = [12, 14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VK = [1, 82], $VL = [1, 83], $VM = [1, 84], $VN = [1, 85], $VO = [12, 14, 42], $VP = [12, 14, 33, 42], $VQ = [12, 14, 33, 42, 76, 77, 79, 80], $VR = [12, 33], $VS = [34, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74];
10
+ var parser2 = {
11
+ trace: /* @__PURE__ */ __name(function trace() {
12
+ }, "trace"),
13
+ yy: {},
14
+ symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "direction": 5, "direction_tb": 6, "direction_bt": 7, "direction_rl": 8, "direction_lr": 9, "graphConfig": 10, "C4_CONTEXT": 11, "NEWLINE": 12, "statements": 13, "EOF": 14, "C4_CONTAINER": 15, "C4_COMPONENT": 16, "C4_DYNAMIC": 17, "C4_DEPLOYMENT": 18, "otherStatements": 19, "diagramStatements": 20, "otherStatement": 21, "title": 22, "accDescription": 23, "acc_title": 24, "acc_title_value": 25, "acc_descr": 26, "acc_descr_value": 27, "acc_descr_multiline_value": 28, "boundaryStatement": 29, "boundaryStartStatement": 30, "boundaryStopStatement": 31, "boundaryStart": 32, "LBRACE": 33, "ENTERPRISE_BOUNDARY": 34, "attributes": 35, "SYSTEM_BOUNDARY": 36, "BOUNDARY": 37, "CONTAINER_BOUNDARY": 38, "NODE": 39, "NODE_L": 40, "NODE_R": 41, "RBRACE": 42, "diagramStatement": 43, "PERSON": 44, "PERSON_EXT": 45, "SYSTEM": 46, "SYSTEM_DB": 47, "SYSTEM_QUEUE": 48, "SYSTEM_EXT": 49, "SYSTEM_EXT_DB": 50, "SYSTEM_EXT_QUEUE": 51, "CONTAINER": 52, "CONTAINER_DB": 53, "CONTAINER_QUEUE": 54, "CONTAINER_EXT": 55, "CONTAINER_EXT_DB": 56, "CONTAINER_EXT_QUEUE": 57, "COMPONENT": 58, "COMPONENT_DB": 59, "COMPONENT_QUEUE": 60, "COMPONENT_EXT": 61, "COMPONENT_EXT_DB": 62, "COMPONENT_EXT_QUEUE": 63, "REL": 64, "BIREL": 65, "REL_U": 66, "REL_D": 67, "REL_L": 68, "REL_R": 69, "REL_B": 70, "REL_INDEX": 71, "UPDATE_EL_STYLE": 72, "UPDATE_REL_STYLE": 73, "UPDATE_LAYOUT_CONFIG": 74, "attribute": 75, "STR": 76, "STR_KEY": 77, "STR_VALUE": 78, "ATTRIBUTE": 79, "ATTRIBUTE_EMPTY": 80, "$accept": 0, "$end": 1 },
15
+ terminals_: { 2: "error", 6: "direction_tb", 7: "direction_bt", 8: "direction_rl", 9: "direction_lr", 11: "C4_CONTEXT", 12: "NEWLINE", 14: "EOF", 15: "C4_CONTAINER", 16: "C4_COMPONENT", 17: "C4_DYNAMIC", 18: "C4_DEPLOYMENT", 22: "title", 23: "accDescription", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "LBRACE", 34: "ENTERPRISE_BOUNDARY", 36: "SYSTEM_BOUNDARY", 37: "BOUNDARY", 38: "CONTAINER_BOUNDARY", 39: "NODE", 40: "NODE_L", 41: "NODE_R", 42: "RBRACE", 44: "PERSON", 45: "PERSON_EXT", 46: "SYSTEM", 47: "SYSTEM_DB", 48: "SYSTEM_QUEUE", 49: "SYSTEM_EXT", 50: "SYSTEM_EXT_DB", 51: "SYSTEM_EXT_QUEUE", 52: "CONTAINER", 53: "CONTAINER_DB", 54: "CONTAINER_QUEUE", 55: "CONTAINER_EXT", 56: "CONTAINER_EXT_DB", 57: "CONTAINER_EXT_QUEUE", 58: "COMPONENT", 59: "COMPONENT_DB", 60: "COMPONENT_QUEUE", 61: "COMPONENT_EXT", 62: "COMPONENT_EXT_DB", 63: "COMPONENT_EXT_QUEUE", 64: "REL", 65: "BIREL", 66: "REL_U", 67: "REL_D", 68: "REL_L", 69: "REL_R", 70: "REL_B", 71: "REL_INDEX", 72: "UPDATE_EL_STYLE", 73: "UPDATE_REL_STYLE", 74: "UPDATE_LAYOUT_CONFIG", 76: "STR", 77: "STR_KEY", 78: "STR_VALUE", 79: "ATTRIBUTE", 80: "ATTRIBUTE_EMPTY" },
16
+ productions_: [0, [3, 1], [3, 1], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [13, 1], [13, 1], [13, 2], [19, 1], [19, 2], [19, 3], [21, 1], [21, 1], [21, 2], [21, 2], [21, 1], [29, 3], [30, 3], [30, 3], [30, 4], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [31, 1], [20, 1], [20, 2], [20, 3], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 1], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [35, 1], [35, 2], [75, 1], [75, 2], [75, 1], [75, 1]],
17
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
18
+ var $0 = $$.length - 1;
19
+ switch (yystate) {
20
+ case 3:
21
+ yy.setDirection("TB");
22
+ break;
23
+ case 4:
24
+ yy.setDirection("BT");
25
+ break;
26
+ case 5:
27
+ yy.setDirection("RL");
28
+ break;
29
+ case 6:
30
+ yy.setDirection("LR");
31
+ break;
32
+ case 8:
33
+ case 9:
34
+ case 10:
35
+ case 11:
36
+ case 12:
37
+ yy.setC4Type($$[$0 - 3]);
38
+ break;
39
+ case 19:
40
+ yy.setTitle($$[$0].substring(6));
41
+ this.$ = $$[$0].substring(6);
42
+ break;
43
+ case 20:
44
+ yy.setAccDescription($$[$0].substring(15));
45
+ this.$ = $$[$0].substring(15);
46
+ break;
47
+ case 21:
48
+ this.$ = $$[$0].trim();
49
+ yy.setTitle(this.$);
50
+ break;
51
+ case 22:
52
+ case 23:
53
+ this.$ = $$[$0].trim();
54
+ yy.setAccDescription(this.$);
55
+ break;
56
+ case 28:
57
+ $$[$0].splice(2, 0, "ENTERPRISE");
58
+ yy.addPersonOrSystemBoundary(...$$[$0]);
59
+ this.$ = $$[$0];
60
+ break;
61
+ case 29:
62
+ $$[$0].splice(2, 0, "SYSTEM");
63
+ yy.addPersonOrSystemBoundary(...$$[$0]);
64
+ this.$ = $$[$0];
65
+ break;
66
+ case 30:
67
+ yy.addPersonOrSystemBoundary(...$$[$0]);
68
+ this.$ = $$[$0];
69
+ break;
70
+ case 31:
71
+ $$[$0].splice(2, 0, "CONTAINER");
72
+ yy.addContainerBoundary(...$$[$0]);
73
+ this.$ = $$[$0];
74
+ break;
75
+ case 32:
76
+ yy.addDeploymentNode("node", ...$$[$0]);
77
+ this.$ = $$[$0];
78
+ break;
79
+ case 33:
80
+ yy.addDeploymentNode("nodeL", ...$$[$0]);
81
+ this.$ = $$[$0];
82
+ break;
83
+ case 34:
84
+ yy.addDeploymentNode("nodeR", ...$$[$0]);
85
+ this.$ = $$[$0];
86
+ break;
87
+ case 35:
88
+ yy.popBoundaryParseStack();
89
+ break;
90
+ case 39:
91
+ yy.addPersonOrSystem("person", ...$$[$0]);
92
+ this.$ = $$[$0];
93
+ break;
94
+ case 40:
95
+ yy.addPersonOrSystem("external_person", ...$$[$0]);
96
+ this.$ = $$[$0];
97
+ break;
98
+ case 41:
99
+ yy.addPersonOrSystem("system", ...$$[$0]);
100
+ this.$ = $$[$0];
101
+ break;
102
+ case 42:
103
+ yy.addPersonOrSystem("system_db", ...$$[$0]);
104
+ this.$ = $$[$0];
105
+ break;
106
+ case 43:
107
+ yy.addPersonOrSystem("system_queue", ...$$[$0]);
108
+ this.$ = $$[$0];
109
+ break;
110
+ case 44:
111
+ yy.addPersonOrSystem("external_system", ...$$[$0]);
112
+ this.$ = $$[$0];
113
+ break;
114
+ case 45:
115
+ yy.addPersonOrSystem("external_system_db", ...$$[$0]);
116
+ this.$ = $$[$0];
117
+ break;
118
+ case 46:
119
+ yy.addPersonOrSystem("external_system_queue", ...$$[$0]);
120
+ this.$ = $$[$0];
121
+ break;
122
+ case 47:
123
+ yy.addContainer("container", ...$$[$0]);
124
+ this.$ = $$[$0];
125
+ break;
126
+ case 48:
127
+ yy.addContainer("container_db", ...$$[$0]);
128
+ this.$ = $$[$0];
129
+ break;
130
+ case 49:
131
+ yy.addContainer("container_queue", ...$$[$0]);
132
+ this.$ = $$[$0];
133
+ break;
134
+ case 50:
135
+ yy.addContainer("external_container", ...$$[$0]);
136
+ this.$ = $$[$0];
137
+ break;
138
+ case 51:
139
+ yy.addContainer("external_container_db", ...$$[$0]);
140
+ this.$ = $$[$0];
141
+ break;
142
+ case 52:
143
+ yy.addContainer("external_container_queue", ...$$[$0]);
144
+ this.$ = $$[$0];
145
+ break;
146
+ case 53:
147
+ yy.addComponent("component", ...$$[$0]);
148
+ this.$ = $$[$0];
149
+ break;
150
+ case 54:
151
+ yy.addComponent("component_db", ...$$[$0]);
152
+ this.$ = $$[$0];
153
+ break;
154
+ case 55:
155
+ yy.addComponent("component_queue", ...$$[$0]);
156
+ this.$ = $$[$0];
157
+ break;
158
+ case 56:
159
+ yy.addComponent("external_component", ...$$[$0]);
160
+ this.$ = $$[$0];
161
+ break;
162
+ case 57:
163
+ yy.addComponent("external_component_db", ...$$[$0]);
164
+ this.$ = $$[$0];
165
+ break;
166
+ case 58:
167
+ yy.addComponent("external_component_queue", ...$$[$0]);
168
+ this.$ = $$[$0];
169
+ break;
170
+ case 60:
171
+ yy.addRel("rel", ...$$[$0]);
172
+ this.$ = $$[$0];
173
+ break;
174
+ case 61:
175
+ yy.addRel("birel", ...$$[$0]);
176
+ this.$ = $$[$0];
177
+ break;
178
+ case 62:
179
+ yy.addRel("rel_u", ...$$[$0]);
180
+ this.$ = $$[$0];
181
+ break;
182
+ case 63:
183
+ yy.addRel("rel_d", ...$$[$0]);
184
+ this.$ = $$[$0];
185
+ break;
186
+ case 64:
187
+ yy.addRel("rel_l", ...$$[$0]);
188
+ this.$ = $$[$0];
189
+ break;
190
+ case 65:
191
+ yy.addRel("rel_r", ...$$[$0]);
192
+ this.$ = $$[$0];
193
+ break;
194
+ case 66:
195
+ yy.addRel("rel_b", ...$$[$0]);
196
+ this.$ = $$[$0];
197
+ break;
198
+ case 67:
199
+ $$[$0].splice(0, 1);
200
+ yy.addRel("rel", ...$$[$0]);
201
+ this.$ = $$[$0];
202
+ break;
203
+ case 68:
204
+ yy.updateElStyle("update_el_style", ...$$[$0]);
205
+ this.$ = $$[$0];
206
+ break;
207
+ case 69:
208
+ yy.updateRelStyle("update_rel_style", ...$$[$0]);
209
+ this.$ = $$[$0];
210
+ break;
211
+ case 70:
212
+ yy.updateLayoutConfig("update_layout_config", ...$$[$0]);
213
+ this.$ = $$[$0];
214
+ break;
215
+ case 71:
216
+ this.$ = [$$[$0]];
217
+ break;
218
+ case 72:
219
+ $$[$0].unshift($$[$0 - 1]);
220
+ this.$ = $$[$0];
221
+ break;
222
+ case 73:
223
+ case 75:
224
+ this.$ = $$[$0].trim();
225
+ break;
226
+ case 74:
227
+ let kv = {};
228
+ kv[$$[$0 - 1].trim()] = $$[$0].trim();
229
+ this.$ = kv;
230
+ break;
231
+ case 76:
232
+ this.$ = "";
233
+ break;
234
+ }
235
+ }, "anonymous"),
236
+ table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 7: [1, 6], 8: [1, 7], 9: [1, 8], 10: 4, 11: [1, 9], 15: [1, 10], 16: [1, 11], 17: [1, 12], 18: [1, 13] }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 7] }, { 1: [2, 3] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 12: [1, 14] }, { 12: [1, 15] }, { 12: [1, 16] }, { 12: [1, 17] }, { 12: [1, 18] }, { 13: 19, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 70, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 71, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 72, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 73, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 14: [1, 74] }, o($VH, [2, 13], { 43: 23, 29: 49, 30: 61, 32: 62, 20: 75, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o($VH, [2, 14]), o($VI, [2, 16], { 12: [1, 76] }), o($VH, [2, 36], { 12: [1, 77] }), o($VJ, [2, 19]), o($VJ, [2, 20]), { 25: [1, 78] }, { 27: [1, 79] }, o($VJ, [2, 23]), { 35: 80, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 86, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 87, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 88, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 89, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 90, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 91, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 92, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 93, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 94, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 95, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 96, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 97, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 98, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 99, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 100, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 101, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 102, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 103, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 104, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, o($VO, [2, 59]), { 35: 105, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 106, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 107, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 108, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 109, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 110, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 111, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 112, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 113, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 114, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 115, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 20: 116, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 12: [1, 118], 33: [1, 117] }, { 35: 119, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 120, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 121, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 122, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 123, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 124, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 125, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 14: [1, 126] }, { 14: [1, 127] }, { 14: [1, 128] }, { 14: [1, 129] }, { 1: [2, 8] }, o($VH, [2, 15]), o($VI, [2, 17], { 21: 22, 19: 130, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4 }), o($VH, [2, 37], { 19: 20, 20: 21, 21: 22, 43: 23, 29: 49, 30: 61, 32: 62, 13: 131, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o($VJ, [2, 21]), o($VJ, [2, 22]), o($VO, [2, 39]), o($VP, [2, 71], { 75: 81, 35: 132, 76: $VK, 77: $VL, 79: $VM, 80: $VN }), o($VQ, [2, 73]), { 78: [1, 133] }, o($VQ, [2, 75]), o($VQ, [2, 76]), o($VO, [2, 40]), o($VO, [2, 41]), o($VO, [2, 42]), o($VO, [2, 43]), o($VO, [2, 44]), o($VO, [2, 45]), o($VO, [2, 46]), o($VO, [2, 47]), o($VO, [2, 48]), o($VO, [2, 49]), o($VO, [2, 50]), o($VO, [2, 51]), o($VO, [2, 52]), o($VO, [2, 53]), o($VO, [2, 54]), o($VO, [2, 55]), o($VO, [2, 56]), o($VO, [2, 57]), o($VO, [2, 58]), o($VO, [2, 60]), o($VO, [2, 61]), o($VO, [2, 62]), o($VO, [2, 63]), o($VO, [2, 64]), o($VO, [2, 65]), o($VO, [2, 66]), o($VO, [2, 67]), o($VO, [2, 68]), o($VO, [2, 69]), o($VO, [2, 70]), { 31: 134, 42: [1, 135] }, { 12: [1, 136] }, { 33: [1, 137] }, o($VR, [2, 28]), o($VR, [2, 29]), o($VR, [2, 30]), o($VR, [2, 31]), o($VR, [2, 32]), o($VR, [2, 33]), o($VR, [2, 34]), { 1: [2, 9] }, { 1: [2, 10] }, { 1: [2, 11] }, { 1: [2, 12] }, o($VI, [2, 18]), o($VH, [2, 38]), o($VP, [2, 72]), o($VQ, [2, 74]), o($VO, [2, 24]), o($VO, [2, 35]), o($VS, [2, 25]), o($VS, [2, 26], { 12: [1, 138] }), o($VS, [2, 27])],
237
+ defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 7], 5: [2, 3], 6: [2, 4], 7: [2, 5], 8: [2, 6], 74: [2, 8], 126: [2, 9], 127: [2, 10], 128: [2, 11], 129: [2, 12] },
238
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
239
+ if (hash.recoverable) {
240
+ this.trace(str);
241
+ } else {
242
+ var error = new Error(str);
243
+ error.hash = hash;
244
+ throw error;
245
+ }
246
+ }, "parseError"),
247
+ parse: /* @__PURE__ */ __name(function parse(input) {
248
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
249
+ var args = lstack.slice.call(arguments, 1);
250
+ var lexer2 = Object.create(this.lexer);
251
+ var sharedState = { yy: {} };
252
+ for (var k in this.yy) {
253
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
254
+ sharedState.yy[k] = this.yy[k];
255
+ }
256
+ }
257
+ lexer2.setInput(input, sharedState.yy);
258
+ sharedState.yy.lexer = lexer2;
259
+ sharedState.yy.parser = this;
260
+ if (typeof lexer2.yylloc == "undefined") {
261
+ lexer2.yylloc = {};
262
+ }
263
+ var yyloc = lexer2.yylloc;
264
+ lstack.push(yyloc);
265
+ var ranges = lexer2.options && lexer2.options.ranges;
266
+ if (typeof sharedState.yy.parseError === "function") {
267
+ this.parseError = sharedState.yy.parseError;
268
+ } else {
269
+ this.parseError = Object.getPrototypeOf(this).parseError;
270
+ }
271
+ function popStack(n) {
272
+ stack.length = stack.length - 2 * n;
273
+ vstack.length = vstack.length - n;
274
+ lstack.length = lstack.length - n;
275
+ }
276
+ __name(popStack, "popStack");
277
+ function lex() {
278
+ var token;
279
+ token = tstack.pop() || lexer2.lex() || EOF;
280
+ if (typeof token !== "number") {
281
+ if (token instanceof Array) {
282
+ tstack = token;
283
+ token = tstack.pop();
284
+ }
285
+ token = self.symbols_[token] || token;
286
+ }
287
+ return token;
288
+ }
289
+ __name(lex, "lex");
290
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
291
+ while (true) {
292
+ state = stack[stack.length - 1];
293
+ if (this.defaultActions[state]) {
294
+ action = this.defaultActions[state];
295
+ } else {
296
+ if (symbol === null || typeof symbol == "undefined") {
297
+ symbol = lex();
298
+ }
299
+ action = table[state] && table[state][symbol];
300
+ }
301
+ if (typeof action === "undefined" || !action.length || !action[0]) {
302
+ var errStr = "";
303
+ expected = [];
304
+ for (p in table[state]) {
305
+ if (this.terminals_[p] && p > TERROR) {
306
+ expected.push("'" + this.terminals_[p] + "'");
307
+ }
308
+ }
309
+ if (lexer2.showPosition) {
310
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
311
+ } else {
312
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
313
+ }
314
+ this.parseError(errStr, {
315
+ text: lexer2.match,
316
+ token: this.terminals_[symbol] || symbol,
317
+ line: lexer2.yylineno,
318
+ loc: yyloc,
319
+ expected
320
+ });
321
+ }
322
+ if (action[0] instanceof Array && action.length > 1) {
323
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
324
+ }
325
+ switch (action[0]) {
326
+ case 1:
327
+ stack.push(symbol);
328
+ vstack.push(lexer2.yytext);
329
+ lstack.push(lexer2.yylloc);
330
+ stack.push(action[1]);
331
+ symbol = null;
332
+ {
333
+ yyleng = lexer2.yyleng;
334
+ yytext = lexer2.yytext;
335
+ yylineno = lexer2.yylineno;
336
+ yyloc = lexer2.yylloc;
337
+ }
338
+ break;
339
+ case 2:
340
+ len = this.productions_[action[1]][1];
341
+ yyval.$ = vstack[vstack.length - len];
342
+ yyval._$ = {
343
+ first_line: lstack[lstack.length - (len || 1)].first_line,
344
+ last_line: lstack[lstack.length - 1].last_line,
345
+ first_column: lstack[lstack.length - (len || 1)].first_column,
346
+ last_column: lstack[lstack.length - 1].last_column
347
+ };
348
+ if (ranges) {
349
+ yyval._$.range = [
350
+ lstack[lstack.length - (len || 1)].range[0],
351
+ lstack[lstack.length - 1].range[1]
352
+ ];
353
+ }
354
+ r = this.performAction.apply(yyval, [
355
+ yytext,
356
+ yyleng,
357
+ yylineno,
358
+ sharedState.yy,
359
+ action[1],
360
+ vstack,
361
+ lstack
362
+ ].concat(args));
363
+ if (typeof r !== "undefined") {
364
+ return r;
365
+ }
366
+ if (len) {
367
+ stack = stack.slice(0, -1 * len * 2);
368
+ vstack = vstack.slice(0, -1 * len);
369
+ lstack = lstack.slice(0, -1 * len);
370
+ }
371
+ stack.push(this.productions_[action[1]][0]);
372
+ vstack.push(yyval.$);
373
+ lstack.push(yyval._$);
374
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
375
+ stack.push(newState);
376
+ break;
377
+ case 3:
378
+ return true;
379
+ }
380
+ }
381
+ return true;
382
+ }, "parse")
383
+ };
384
+ var lexer = /* @__PURE__ */ (function() {
385
+ var lexer2 = {
386
+ EOF: 1,
387
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
388
+ if (this.yy.parser) {
389
+ this.yy.parser.parseError(str, hash);
390
+ } else {
391
+ throw new Error(str);
392
+ }
393
+ }, "parseError"),
394
+ // resets the lexer, sets new input
395
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
396
+ this.yy = yy || this.yy || {};
397
+ this._input = input;
398
+ this._more = this._backtrack = this.done = false;
399
+ this.yylineno = this.yyleng = 0;
400
+ this.yytext = this.matched = this.match = "";
401
+ this.conditionStack = ["INITIAL"];
402
+ this.yylloc = {
403
+ first_line: 1,
404
+ first_column: 0,
405
+ last_line: 1,
406
+ last_column: 0
407
+ };
408
+ if (this.options.ranges) {
409
+ this.yylloc.range = [0, 0];
410
+ }
411
+ this.offset = 0;
412
+ return this;
413
+ }, "setInput"),
414
+ // consumes and returns one char from the input
415
+ input: /* @__PURE__ */ __name(function() {
416
+ var ch = this._input[0];
417
+ this.yytext += ch;
418
+ this.yyleng++;
419
+ this.offset++;
420
+ this.match += ch;
421
+ this.matched += ch;
422
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
423
+ if (lines) {
424
+ this.yylineno++;
425
+ this.yylloc.last_line++;
426
+ } else {
427
+ this.yylloc.last_column++;
428
+ }
429
+ if (this.options.ranges) {
430
+ this.yylloc.range[1]++;
431
+ }
432
+ this._input = this._input.slice(1);
433
+ return ch;
434
+ }, "input"),
435
+ // unshifts one char (or a string) into the input
436
+ unput: /* @__PURE__ */ __name(function(ch) {
437
+ var len = ch.length;
438
+ var lines = ch.split(/(?:\r\n?|\n)/g);
439
+ this._input = ch + this._input;
440
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
441
+ this.offset -= len;
442
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
443
+ this.match = this.match.substr(0, this.match.length - 1);
444
+ this.matched = this.matched.substr(0, this.matched.length - 1);
445
+ if (lines.length - 1) {
446
+ this.yylineno -= lines.length - 1;
447
+ }
448
+ var r = this.yylloc.range;
449
+ this.yylloc = {
450
+ first_line: this.yylloc.first_line,
451
+ last_line: this.yylineno + 1,
452
+ first_column: this.yylloc.first_column,
453
+ 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
454
+ };
455
+ if (this.options.ranges) {
456
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
457
+ }
458
+ this.yyleng = this.yytext.length;
459
+ return this;
460
+ }, "unput"),
461
+ // When called from action, caches matched text and appends it on next action
462
+ more: /* @__PURE__ */ __name(function() {
463
+ this._more = true;
464
+ return this;
465
+ }, "more"),
466
+ // 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.
467
+ reject: /* @__PURE__ */ __name(function() {
468
+ if (this.options.backtrack_lexer) {
469
+ this._backtrack = true;
470
+ } else {
471
+ 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(), {
472
+ text: "",
473
+ token: null,
474
+ line: this.yylineno
475
+ });
476
+ }
477
+ return this;
478
+ }, "reject"),
479
+ // retain first n characters of the match
480
+ less: /* @__PURE__ */ __name(function(n) {
481
+ this.unput(this.match.slice(n));
482
+ }, "less"),
483
+ // displays already matched input, i.e. for error messages
484
+ pastInput: /* @__PURE__ */ __name(function() {
485
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
486
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
487
+ }, "pastInput"),
488
+ // displays upcoming input, i.e. for error messages
489
+ upcomingInput: /* @__PURE__ */ __name(function() {
490
+ var next = this.match;
491
+ if (next.length < 20) {
492
+ next += this._input.substr(0, 20 - next.length);
493
+ }
494
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
495
+ }, "upcomingInput"),
496
+ // displays the character position where the lexing error occurred, i.e. for error messages
497
+ showPosition: /* @__PURE__ */ __name(function() {
498
+ var pre = this.pastInput();
499
+ var c2 = new Array(pre.length + 1).join("-");
500
+ return pre + this.upcomingInput() + "\n" + c2 + "^";
501
+ }, "showPosition"),
502
+ // test the lexed token: return FALSE when not a match, otherwise return token
503
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
504
+ var token, lines, backup;
505
+ if (this.options.backtrack_lexer) {
506
+ backup = {
507
+ yylineno: this.yylineno,
508
+ yylloc: {
509
+ first_line: this.yylloc.first_line,
510
+ last_line: this.last_line,
511
+ first_column: this.yylloc.first_column,
512
+ last_column: this.yylloc.last_column
513
+ },
514
+ yytext: this.yytext,
515
+ match: this.match,
516
+ matches: this.matches,
517
+ matched: this.matched,
518
+ yyleng: this.yyleng,
519
+ offset: this.offset,
520
+ _more: this._more,
521
+ _input: this._input,
522
+ yy: this.yy,
523
+ conditionStack: this.conditionStack.slice(0),
524
+ done: this.done
525
+ };
526
+ if (this.options.ranges) {
527
+ backup.yylloc.range = this.yylloc.range.slice(0);
528
+ }
529
+ }
530
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
531
+ if (lines) {
532
+ this.yylineno += lines.length;
533
+ }
534
+ this.yylloc = {
535
+ first_line: this.yylloc.last_line,
536
+ last_line: this.yylineno + 1,
537
+ first_column: this.yylloc.last_column,
538
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
539
+ };
540
+ this.yytext += match[0];
541
+ this.match += match[0];
542
+ this.matches = match;
543
+ this.yyleng = this.yytext.length;
544
+ if (this.options.ranges) {
545
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
546
+ }
547
+ this._more = false;
548
+ this._backtrack = false;
549
+ this._input = this._input.slice(match[0].length);
550
+ this.matched += match[0];
551
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
552
+ if (this.done && this._input) {
553
+ this.done = false;
554
+ }
555
+ if (token) {
556
+ return token;
557
+ } else if (this._backtrack) {
558
+ for (var k in backup) {
559
+ this[k] = backup[k];
560
+ }
561
+ return false;
562
+ }
563
+ return false;
564
+ }, "test_match"),
565
+ // return next match in input
566
+ next: /* @__PURE__ */ __name(function() {
567
+ if (this.done) {
568
+ return this.EOF;
569
+ }
570
+ if (!this._input) {
571
+ this.done = true;
572
+ }
573
+ var token, match, tempMatch, index;
574
+ if (!this._more) {
575
+ this.yytext = "";
576
+ this.match = "";
577
+ }
578
+ var rules = this._currentRules();
579
+ for (var i = 0; i < rules.length; i++) {
580
+ tempMatch = this._input.match(this.rules[rules[i]]);
581
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
582
+ match = tempMatch;
583
+ index = i;
584
+ if (this.options.backtrack_lexer) {
585
+ token = this.test_match(tempMatch, rules[i]);
586
+ if (token !== false) {
587
+ return token;
588
+ } else if (this._backtrack) {
589
+ match = false;
590
+ continue;
591
+ } else {
592
+ return false;
593
+ }
594
+ } else if (!this.options.flex) {
595
+ break;
596
+ }
597
+ }
598
+ }
599
+ if (match) {
600
+ token = this.test_match(match, rules[index]);
601
+ if (token !== false) {
602
+ return token;
603
+ }
604
+ return false;
605
+ }
606
+ if (this._input === "") {
607
+ return this.EOF;
608
+ } else {
609
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
610
+ text: "",
611
+ token: null,
612
+ line: this.yylineno
613
+ });
614
+ }
615
+ }, "next"),
616
+ // return next match that has a token
617
+ lex: /* @__PURE__ */ __name(function lex() {
618
+ var r = this.next();
619
+ if (r) {
620
+ return r;
621
+ } else {
622
+ return this.lex();
623
+ }
624
+ }, "lex"),
625
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
626
+ begin: /* @__PURE__ */ __name(function begin(condition) {
627
+ this.conditionStack.push(condition);
628
+ }, "begin"),
629
+ // pop the previously active lexer condition state off the condition stack
630
+ popState: /* @__PURE__ */ __name(function popState() {
631
+ var n = this.conditionStack.length - 1;
632
+ if (n > 0) {
633
+ return this.conditionStack.pop();
634
+ } else {
635
+ return this.conditionStack[0];
636
+ }
637
+ }, "popState"),
638
+ // produce the lexer rule set which is active for the currently active lexer condition state
639
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
640
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
641
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
642
+ } else {
643
+ return this.conditions["INITIAL"].rules;
644
+ }
645
+ }, "_currentRules"),
646
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
647
+ topState: /* @__PURE__ */ __name(function topState(n) {
648
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
649
+ if (n >= 0) {
650
+ return this.conditionStack[n];
651
+ } else {
652
+ return "INITIAL";
653
+ }
654
+ }, "topState"),
655
+ // alias for begin(condition)
656
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
657
+ this.begin(condition);
658
+ }, "pushState"),
659
+ // return the number of states currently on the stack
660
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
661
+ return this.conditionStack.length;
662
+ }, "stateStackSize"),
663
+ options: {},
664
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
665
+ switch ($avoiding_name_collisions) {
666
+ case 0:
667
+ return 6;
668
+ case 1:
669
+ return 7;
670
+ case 2:
671
+ return 8;
672
+ case 3:
673
+ return 9;
674
+ case 4:
675
+ return 22;
676
+ case 5:
677
+ return 23;
678
+ case 6:
679
+ this.begin("acc_title");
680
+ return 24;
681
+ case 7:
682
+ this.popState();
683
+ return "acc_title_value";
684
+ case 8:
685
+ this.begin("acc_descr");
686
+ return 26;
687
+ case 9:
688
+ this.popState();
689
+ return "acc_descr_value";
690
+ case 10:
691
+ this.begin("acc_descr_multiline");
692
+ break;
693
+ case 11:
694
+ this.popState();
695
+ break;
696
+ case 12:
697
+ return "acc_descr_multiline_value";
698
+ case 13:
699
+ break;
700
+ case 14:
701
+ c;
702
+ break;
703
+ case 15:
704
+ return 12;
705
+ case 16:
706
+ break;
707
+ case 17:
708
+ return 11;
709
+ case 18:
710
+ return 15;
711
+ case 19:
712
+ return 16;
713
+ case 20:
714
+ return 17;
715
+ case 21:
716
+ return 18;
717
+ case 22:
718
+ this.begin("person_ext");
719
+ return 45;
720
+ case 23:
721
+ this.begin("person");
722
+ return 44;
723
+ case 24:
724
+ this.begin("system_ext_queue");
725
+ return 51;
726
+ case 25:
727
+ this.begin("system_ext_db");
728
+ return 50;
729
+ case 26:
730
+ this.begin("system_ext");
731
+ return 49;
732
+ case 27:
733
+ this.begin("system_queue");
734
+ return 48;
735
+ case 28:
736
+ this.begin("system_db");
737
+ return 47;
738
+ case 29:
739
+ this.begin("system");
740
+ return 46;
741
+ case 30:
742
+ this.begin("boundary");
743
+ return 37;
744
+ case 31:
745
+ this.begin("enterprise_boundary");
746
+ return 34;
747
+ case 32:
748
+ this.begin("system_boundary");
749
+ return 36;
750
+ case 33:
751
+ this.begin("container_ext_queue");
752
+ return 57;
753
+ case 34:
754
+ this.begin("container_ext_db");
755
+ return 56;
756
+ case 35:
757
+ this.begin("container_ext");
758
+ return 55;
759
+ case 36:
760
+ this.begin("container_queue");
761
+ return 54;
762
+ case 37:
763
+ this.begin("container_db");
764
+ return 53;
765
+ case 38:
766
+ this.begin("container");
767
+ return 52;
768
+ case 39:
769
+ this.begin("container_boundary");
770
+ return 38;
771
+ case 40:
772
+ this.begin("component_ext_queue");
773
+ return 63;
774
+ case 41:
775
+ this.begin("component_ext_db");
776
+ return 62;
777
+ case 42:
778
+ this.begin("component_ext");
779
+ return 61;
780
+ case 43:
781
+ this.begin("component_queue");
782
+ return 60;
783
+ case 44:
784
+ this.begin("component_db");
785
+ return 59;
786
+ case 45:
787
+ this.begin("component");
788
+ return 58;
789
+ case 46:
790
+ this.begin("node");
791
+ return 39;
792
+ case 47:
793
+ this.begin("node");
794
+ return 39;
795
+ case 48:
796
+ this.begin("node_l");
797
+ return 40;
798
+ case 49:
799
+ this.begin("node_r");
800
+ return 41;
801
+ case 50:
802
+ this.begin("rel");
803
+ return 64;
804
+ case 51:
805
+ this.begin("birel");
806
+ return 65;
807
+ case 52:
808
+ this.begin("rel_u");
809
+ return 66;
810
+ case 53:
811
+ this.begin("rel_u");
812
+ return 66;
813
+ case 54:
814
+ this.begin("rel_d");
815
+ return 67;
816
+ case 55:
817
+ this.begin("rel_d");
818
+ return 67;
819
+ case 56:
820
+ this.begin("rel_l");
821
+ return 68;
822
+ case 57:
823
+ this.begin("rel_l");
824
+ return 68;
825
+ case 58:
826
+ this.begin("rel_r");
827
+ return 69;
828
+ case 59:
829
+ this.begin("rel_r");
830
+ return 69;
831
+ case 60:
832
+ this.begin("rel_b");
833
+ return 70;
834
+ case 61:
835
+ this.begin("rel_index");
836
+ return 71;
837
+ case 62:
838
+ this.begin("update_el_style");
839
+ return 72;
840
+ case 63:
841
+ this.begin("update_rel_style");
842
+ return 73;
843
+ case 64:
844
+ this.begin("update_layout_config");
845
+ return 74;
846
+ case 65:
847
+ return "EOF_IN_STRUCT";
848
+ case 66:
849
+ this.begin("attribute");
850
+ return "ATTRIBUTE_EMPTY";
851
+ case 67:
852
+ this.begin("attribute");
853
+ break;
854
+ case 68:
855
+ this.popState();
856
+ this.popState();
857
+ break;
858
+ case 69:
859
+ return 80;
860
+ case 70:
861
+ break;
862
+ case 71:
863
+ return 80;
864
+ case 72:
865
+ this.begin("string");
866
+ break;
867
+ case 73:
868
+ this.popState();
869
+ break;
870
+ case 74:
871
+ return "STR";
872
+ case 75:
873
+ this.begin("string_kv");
874
+ break;
875
+ case 76:
876
+ this.begin("string_kv_key");
877
+ return "STR_KEY";
878
+ case 77:
879
+ this.popState();
880
+ this.begin("string_kv_value");
881
+ break;
882
+ case 78:
883
+ return "STR_VALUE";
884
+ case 79:
885
+ this.popState();
886
+ this.popState();
887
+ break;
888
+ case 80:
889
+ return "STR";
890
+ case 81:
891
+ return "LBRACE";
892
+ case 82:
893
+ return "RBRACE";
894
+ case 83:
895
+ return "SPACE";
896
+ case 84:
897
+ return "EOL";
898
+ case 85:
899
+ return 14;
900
+ }
901
+ }, "anonymous"),
902
+ rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:title\s[^#\n;]+)/, /^(?:accDescription\s[^#\n;]+)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:C4Context\b)/, /^(?:C4Container\b)/, /^(?:C4Component\b)/, /^(?:C4Dynamic\b)/, /^(?:C4Deployment\b)/, /^(?:Person_Ext\b)/, /^(?:Person\b)/, /^(?:SystemQueue_Ext\b)/, /^(?:SystemDb_Ext\b)/, /^(?:System_Ext\b)/, /^(?:SystemQueue\b)/, /^(?:SystemDb\b)/, /^(?:System\b)/, /^(?:Boundary\b)/, /^(?:Enterprise_Boundary\b)/, /^(?:System_Boundary\b)/, /^(?:ContainerQueue_Ext\b)/, /^(?:ContainerDb_Ext\b)/, /^(?:Container_Ext\b)/, /^(?:ContainerQueue\b)/, /^(?:ContainerDb\b)/, /^(?:Container\b)/, /^(?:Container_Boundary\b)/, /^(?:ComponentQueue_Ext\b)/, /^(?:ComponentDb_Ext\b)/, /^(?:Component_Ext\b)/, /^(?:ComponentQueue\b)/, /^(?:ComponentDb\b)/, /^(?:Component\b)/, /^(?:Deployment_Node\b)/, /^(?:Node\b)/, /^(?:Node_L\b)/, /^(?:Node_R\b)/, /^(?:Rel\b)/, /^(?:BiRel\b)/, /^(?:Rel_Up\b)/, /^(?:Rel_U\b)/, /^(?:Rel_Down\b)/, /^(?:Rel_D\b)/, /^(?:Rel_Left\b)/, /^(?:Rel_L\b)/, /^(?:Rel_Right\b)/, /^(?:Rel_R\b)/, /^(?:Rel_Back\b)/, /^(?:RelIndex\b)/, /^(?:UpdateElementStyle\b)/, /^(?:UpdateRelStyle\b)/, /^(?:UpdateLayoutConfig\b)/, /^(?:$)/, /^(?:[(][ ]*[,])/, /^(?:[(])/, /^(?:[)])/, /^(?:,,)/, /^(?:,)/, /^(?:[ ]*["]["])/, /^(?:[ ]*["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:[ ]*[\$])/, /^(?:[^=]*)/, /^(?:[=][ ]*["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:[^,]+)/, /^(?:\{)/, /^(?:\})/, /^(?:[\s]+)/, /^(?:[\n\r]+)/, /^(?:$)/],
903
+ conditions: { "acc_descr_multiline": { "rules": [11, 12], "inclusive": false }, "acc_descr": { "rules": [9], "inclusive": false }, "acc_title": { "rules": [7], "inclusive": false }, "string_kv_value": { "rules": [78, 79], "inclusive": false }, "string_kv_key": { "rules": [77], "inclusive": false }, "string_kv": { "rules": [76], "inclusive": false }, "string": { "rules": [73, 74], "inclusive": false }, "attribute": { "rules": [68, 69, 70, 71, 72, 75, 80], "inclusive": false }, "update_layout_config": { "rules": [65, 66, 67, 68], "inclusive": false }, "update_rel_style": { "rules": [65, 66, 67, 68], "inclusive": false }, "update_el_style": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_b": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_r": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_l": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_d": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_u": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_bi": { "rules": [], "inclusive": false }, "rel": { "rules": [65, 66, 67, 68], "inclusive": false }, "node_r": { "rules": [65, 66, 67, 68], "inclusive": false }, "node_l": { "rules": [65, 66, 67, 68], "inclusive": false }, "node": { "rules": [65, 66, 67, 68], "inclusive": false }, "index": { "rules": [], "inclusive": false }, "rel_index": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "component": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "container": { "rules": [65, 66, 67, 68], "inclusive": false }, "birel": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "enterprise_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "system": { "rules": [65, 66, 67, 68], "inclusive": false }, "person_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "person": { "rules": [65, 66, 67, 68], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 81, 82, 83, 84, 85], "inclusive": true } }
904
+ };
905
+ return lexer2;
906
+ })();
907
+ parser2.lexer = lexer;
908
+ function Parser() {
909
+ this.yy = {};
910
+ }
911
+ __name(Parser, "Parser");
912
+ Parser.prototype = parser2;
913
+ parser2.Parser = Parser;
914
+ return new Parser();
915
+ })();
916
+ parser.parser = parser;
917
+ var c4Diagram_default = parser;
918
+ var c4ShapeArray = [];
919
+ var boundaryParseStack = [""];
920
+ var currentBoundaryParse = "global";
921
+ var parentBoundaryParse = "";
922
+ var boundaries = [
923
+ {
924
+ alias: "global",
925
+ label: { text: "global" },
926
+ type: { text: "global" },
927
+ tags: null,
928
+ link: null,
929
+ parentBoundary: ""
930
+ }
931
+ ];
932
+ var rels = [];
933
+ var title = "";
934
+ var wrapEnabled = false;
935
+ var c4ShapeInRow = 4;
936
+ var c4BoundaryInRow = 2;
937
+ var c4Type;
938
+ var getC4Type = /* @__PURE__ */ __name(function() {
939
+ return c4Type;
940
+ }, "getC4Type");
941
+ var setC4Type = /* @__PURE__ */ __name(function(c4TypeParam) {
942
+ let sanitizedText = sanitizeText(c4TypeParam, getConfig2());
943
+ c4Type = sanitizedText;
944
+ }, "setC4Type");
945
+ var addRel = /* @__PURE__ */ __name(function(type, from, to, label, techn, descr, sprite, tags, link) {
946
+ if (type === void 0 || type === null || from === void 0 || from === null || to === void 0 || to === null || label === void 0 || label === null) {
947
+ return;
948
+ }
949
+ let rel = {};
950
+ const old = rels.find((rel2) => rel2.from === from && rel2.to === to);
951
+ if (old) {
952
+ rel = old;
953
+ } else {
954
+ rels.push(rel);
955
+ }
956
+ rel.type = type;
957
+ rel.from = from;
958
+ rel.to = to;
959
+ rel.label = { text: label };
960
+ if (techn === void 0 || techn === null) {
961
+ rel.techn = { text: "" };
962
+ } else {
963
+ if (typeof techn === "object") {
964
+ let [key, value] = Object.entries(techn)[0];
965
+ rel[key] = { text: value };
966
+ } else {
967
+ rel.techn = { text: techn };
968
+ }
969
+ }
970
+ if (descr === void 0 || descr === null) {
971
+ rel.descr = { text: "" };
972
+ } else {
973
+ if (typeof descr === "object") {
974
+ let [key, value] = Object.entries(descr)[0];
975
+ rel[key] = { text: value };
976
+ } else {
977
+ rel.descr = { text: descr };
978
+ }
979
+ }
980
+ if (typeof sprite === "object") {
981
+ let [key, value] = Object.entries(sprite)[0];
982
+ rel[key] = value;
983
+ } else {
984
+ rel.sprite = sprite;
985
+ }
986
+ if (typeof tags === "object") {
987
+ let [key, value] = Object.entries(tags)[0];
988
+ rel[key] = value;
989
+ } else {
990
+ rel.tags = tags;
991
+ }
992
+ if (typeof link === "object") {
993
+ let [key, value] = Object.entries(link)[0];
994
+ rel[key] = value;
995
+ } else {
996
+ rel.link = link;
997
+ }
998
+ rel.wrap = autoWrap();
999
+ }, "addRel");
1000
+ var addPersonOrSystem = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, descr, sprite, tags, link) {
1001
+ if (alias === null || label === null) {
1002
+ return;
1003
+ }
1004
+ let personOrSystem = {};
1005
+ const old = c4ShapeArray.find((personOrSystem2) => personOrSystem2.alias === alias);
1006
+ if (old && alias === old.alias) {
1007
+ personOrSystem = old;
1008
+ } else {
1009
+ personOrSystem.alias = alias;
1010
+ c4ShapeArray.push(personOrSystem);
1011
+ }
1012
+ if (label === void 0 || label === null) {
1013
+ personOrSystem.label = { text: "" };
1014
+ } else {
1015
+ personOrSystem.label = { text: label };
1016
+ }
1017
+ if (descr === void 0 || descr === null) {
1018
+ personOrSystem.descr = { text: "" };
1019
+ } else {
1020
+ if (typeof descr === "object") {
1021
+ let [key, value] = Object.entries(descr)[0];
1022
+ personOrSystem[key] = { text: value };
1023
+ } else {
1024
+ personOrSystem.descr = { text: descr };
1025
+ }
1026
+ }
1027
+ if (typeof sprite === "object") {
1028
+ let [key, value] = Object.entries(sprite)[0];
1029
+ personOrSystem[key] = value;
1030
+ } else {
1031
+ personOrSystem.sprite = sprite;
1032
+ }
1033
+ if (typeof tags === "object") {
1034
+ let [key, value] = Object.entries(tags)[0];
1035
+ personOrSystem[key] = value;
1036
+ } else {
1037
+ personOrSystem.tags = tags;
1038
+ }
1039
+ if (typeof link === "object") {
1040
+ let [key, value] = Object.entries(link)[0];
1041
+ personOrSystem[key] = value;
1042
+ } else {
1043
+ personOrSystem.link = link;
1044
+ }
1045
+ personOrSystem.typeC4Shape = { text: typeC4Shape };
1046
+ personOrSystem.parentBoundary = currentBoundaryParse;
1047
+ personOrSystem.wrap = autoWrap();
1048
+ }, "addPersonOrSystem");
1049
+ var addContainer = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
1050
+ if (alias === null || label === null) {
1051
+ return;
1052
+ }
1053
+ let container = {};
1054
+ const old = c4ShapeArray.find((container2) => container2.alias === alias);
1055
+ if (old && alias === old.alias) {
1056
+ container = old;
1057
+ } else {
1058
+ container.alias = alias;
1059
+ c4ShapeArray.push(container);
1060
+ }
1061
+ if (label === void 0 || label === null) {
1062
+ container.label = { text: "" };
1063
+ } else {
1064
+ container.label = { text: label };
1065
+ }
1066
+ if (techn === void 0 || techn === null) {
1067
+ container.techn = { text: "" };
1068
+ } else {
1069
+ if (typeof techn === "object") {
1070
+ let [key, value] = Object.entries(techn)[0];
1071
+ container[key] = { text: value };
1072
+ } else {
1073
+ container.techn = { text: techn };
1074
+ }
1075
+ }
1076
+ if (descr === void 0 || descr === null) {
1077
+ container.descr = { text: "" };
1078
+ } else {
1079
+ if (typeof descr === "object") {
1080
+ let [key, value] = Object.entries(descr)[0];
1081
+ container[key] = { text: value };
1082
+ } else {
1083
+ container.descr = { text: descr };
1084
+ }
1085
+ }
1086
+ if (typeof sprite === "object") {
1087
+ let [key, value] = Object.entries(sprite)[0];
1088
+ container[key] = value;
1089
+ } else {
1090
+ container.sprite = sprite;
1091
+ }
1092
+ if (typeof tags === "object") {
1093
+ let [key, value] = Object.entries(tags)[0];
1094
+ container[key] = value;
1095
+ } else {
1096
+ container.tags = tags;
1097
+ }
1098
+ if (typeof link === "object") {
1099
+ let [key, value] = Object.entries(link)[0];
1100
+ container[key] = value;
1101
+ } else {
1102
+ container.link = link;
1103
+ }
1104
+ container.wrap = autoWrap();
1105
+ container.typeC4Shape = { text: typeC4Shape };
1106
+ container.parentBoundary = currentBoundaryParse;
1107
+ }, "addContainer");
1108
+ var addComponent = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
1109
+ if (alias === null || label === null) {
1110
+ return;
1111
+ }
1112
+ let component = {};
1113
+ const old = c4ShapeArray.find((component2) => component2.alias === alias);
1114
+ if (old && alias === old.alias) {
1115
+ component = old;
1116
+ } else {
1117
+ component.alias = alias;
1118
+ c4ShapeArray.push(component);
1119
+ }
1120
+ if (label === void 0 || label === null) {
1121
+ component.label = { text: "" };
1122
+ } else {
1123
+ component.label = { text: label };
1124
+ }
1125
+ if (techn === void 0 || techn === null) {
1126
+ component.techn = { text: "" };
1127
+ } else {
1128
+ if (typeof techn === "object") {
1129
+ let [key, value] = Object.entries(techn)[0];
1130
+ component[key] = { text: value };
1131
+ } else {
1132
+ component.techn = { text: techn };
1133
+ }
1134
+ }
1135
+ if (descr === void 0 || descr === null) {
1136
+ component.descr = { text: "" };
1137
+ } else {
1138
+ if (typeof descr === "object") {
1139
+ let [key, value] = Object.entries(descr)[0];
1140
+ component[key] = { text: value };
1141
+ } else {
1142
+ component.descr = { text: descr };
1143
+ }
1144
+ }
1145
+ if (typeof sprite === "object") {
1146
+ let [key, value] = Object.entries(sprite)[0];
1147
+ component[key] = value;
1148
+ } else {
1149
+ component.sprite = sprite;
1150
+ }
1151
+ if (typeof tags === "object") {
1152
+ let [key, value] = Object.entries(tags)[0];
1153
+ component[key] = value;
1154
+ } else {
1155
+ component.tags = tags;
1156
+ }
1157
+ if (typeof link === "object") {
1158
+ let [key, value] = Object.entries(link)[0];
1159
+ component[key] = value;
1160
+ } else {
1161
+ component.link = link;
1162
+ }
1163
+ component.wrap = autoWrap();
1164
+ component.typeC4Shape = { text: typeC4Shape };
1165
+ component.parentBoundary = currentBoundaryParse;
1166
+ }, "addComponent");
1167
+ var addPersonOrSystemBoundary = /* @__PURE__ */ __name(function(alias, label, type, tags, link) {
1168
+ if (alias === null || label === null) {
1169
+ return;
1170
+ }
1171
+ let boundary = {};
1172
+ const old = boundaries.find((boundary2) => boundary2.alias === alias);
1173
+ if (old && alias === old.alias) {
1174
+ boundary = old;
1175
+ } else {
1176
+ boundary.alias = alias;
1177
+ boundaries.push(boundary);
1178
+ }
1179
+ if (label === void 0 || label === null) {
1180
+ boundary.label = { text: "" };
1181
+ } else {
1182
+ boundary.label = { text: label };
1183
+ }
1184
+ if (type === void 0 || type === null) {
1185
+ boundary.type = { text: "system" };
1186
+ } else {
1187
+ if (typeof type === "object") {
1188
+ let [key, value] = Object.entries(type)[0];
1189
+ boundary[key] = { text: value };
1190
+ } else {
1191
+ boundary.type = { text: type };
1192
+ }
1193
+ }
1194
+ if (typeof tags === "object") {
1195
+ let [key, value] = Object.entries(tags)[0];
1196
+ boundary[key] = value;
1197
+ } else {
1198
+ boundary.tags = tags;
1199
+ }
1200
+ if (typeof link === "object") {
1201
+ let [key, value] = Object.entries(link)[0];
1202
+ boundary[key] = value;
1203
+ } else {
1204
+ boundary.link = link;
1205
+ }
1206
+ boundary.parentBoundary = currentBoundaryParse;
1207
+ boundary.wrap = autoWrap();
1208
+ parentBoundaryParse = currentBoundaryParse;
1209
+ currentBoundaryParse = alias;
1210
+ boundaryParseStack.push(parentBoundaryParse);
1211
+ }, "addPersonOrSystemBoundary");
1212
+ var addContainerBoundary = /* @__PURE__ */ __name(function(alias, label, type, tags, link) {
1213
+ if (alias === null || label === null) {
1214
+ return;
1215
+ }
1216
+ let boundary = {};
1217
+ const old = boundaries.find((boundary2) => boundary2.alias === alias);
1218
+ if (old && alias === old.alias) {
1219
+ boundary = old;
1220
+ } else {
1221
+ boundary.alias = alias;
1222
+ boundaries.push(boundary);
1223
+ }
1224
+ if (label === void 0 || label === null) {
1225
+ boundary.label = { text: "" };
1226
+ } else {
1227
+ boundary.label = { text: label };
1228
+ }
1229
+ if (type === void 0 || type === null) {
1230
+ boundary.type = { text: "container" };
1231
+ } else {
1232
+ if (typeof type === "object") {
1233
+ let [key, value] = Object.entries(type)[0];
1234
+ boundary[key] = { text: value };
1235
+ } else {
1236
+ boundary.type = { text: type };
1237
+ }
1238
+ }
1239
+ if (typeof tags === "object") {
1240
+ let [key, value] = Object.entries(tags)[0];
1241
+ boundary[key] = value;
1242
+ } else {
1243
+ boundary.tags = tags;
1244
+ }
1245
+ if (typeof link === "object") {
1246
+ let [key, value] = Object.entries(link)[0];
1247
+ boundary[key] = value;
1248
+ } else {
1249
+ boundary.link = link;
1250
+ }
1251
+ boundary.parentBoundary = currentBoundaryParse;
1252
+ boundary.wrap = autoWrap();
1253
+ parentBoundaryParse = currentBoundaryParse;
1254
+ currentBoundaryParse = alias;
1255
+ boundaryParseStack.push(parentBoundaryParse);
1256
+ }, "addContainerBoundary");
1257
+ var addDeploymentNode = /* @__PURE__ */ __name(function(nodeType, alias, label, type, descr, sprite, tags, link) {
1258
+ if (alias === null || label === null) {
1259
+ return;
1260
+ }
1261
+ let boundary = {};
1262
+ const old = boundaries.find((boundary2) => boundary2.alias === alias);
1263
+ if (old && alias === old.alias) {
1264
+ boundary = old;
1265
+ } else {
1266
+ boundary.alias = alias;
1267
+ boundaries.push(boundary);
1268
+ }
1269
+ if (label === void 0 || label === null) {
1270
+ boundary.label = { text: "" };
1271
+ } else {
1272
+ boundary.label = { text: label };
1273
+ }
1274
+ if (type === void 0 || type === null) {
1275
+ boundary.type = { text: "node" };
1276
+ } else {
1277
+ if (typeof type === "object") {
1278
+ let [key, value] = Object.entries(type)[0];
1279
+ boundary[key] = { text: value };
1280
+ } else {
1281
+ boundary.type = { text: type };
1282
+ }
1283
+ }
1284
+ if (descr === void 0 || descr === null) {
1285
+ boundary.descr = { text: "" };
1286
+ } else {
1287
+ if (typeof descr === "object") {
1288
+ let [key, value] = Object.entries(descr)[0];
1289
+ boundary[key] = { text: value };
1290
+ } else {
1291
+ boundary.descr = { text: descr };
1292
+ }
1293
+ }
1294
+ if (typeof tags === "object") {
1295
+ let [key, value] = Object.entries(tags)[0];
1296
+ boundary[key] = value;
1297
+ } else {
1298
+ boundary.tags = tags;
1299
+ }
1300
+ if (typeof link === "object") {
1301
+ let [key, value] = Object.entries(link)[0];
1302
+ boundary[key] = value;
1303
+ } else {
1304
+ boundary.link = link;
1305
+ }
1306
+ boundary.nodeType = nodeType;
1307
+ boundary.parentBoundary = currentBoundaryParse;
1308
+ boundary.wrap = autoWrap();
1309
+ parentBoundaryParse = currentBoundaryParse;
1310
+ currentBoundaryParse = alias;
1311
+ boundaryParseStack.push(parentBoundaryParse);
1312
+ }, "addDeploymentNode");
1313
+ var popBoundaryParseStack = /* @__PURE__ */ __name(function() {
1314
+ currentBoundaryParse = parentBoundaryParse;
1315
+ boundaryParseStack.pop();
1316
+ parentBoundaryParse = boundaryParseStack.pop();
1317
+ boundaryParseStack.push(parentBoundaryParse);
1318
+ }, "popBoundaryParseStack");
1319
+ var updateElStyle = /* @__PURE__ */ __name(function(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) {
1320
+ let old = c4ShapeArray.find((element) => element.alias === elementName);
1321
+ if (old === void 0) {
1322
+ old = boundaries.find((element) => element.alias === elementName);
1323
+ if (old === void 0) {
1324
+ return;
1325
+ }
1326
+ }
1327
+ if (bgColor !== void 0 && bgColor !== null) {
1328
+ if (typeof bgColor === "object") {
1329
+ let [key, value] = Object.entries(bgColor)[0];
1330
+ old[key] = value;
1331
+ } else {
1332
+ old.bgColor = bgColor;
1333
+ }
1334
+ }
1335
+ if (fontColor !== void 0 && fontColor !== null) {
1336
+ if (typeof fontColor === "object") {
1337
+ let [key, value] = Object.entries(fontColor)[0];
1338
+ old[key] = value;
1339
+ } else {
1340
+ old.fontColor = fontColor;
1341
+ }
1342
+ }
1343
+ if (borderColor !== void 0 && borderColor !== null) {
1344
+ if (typeof borderColor === "object") {
1345
+ let [key, value] = Object.entries(borderColor)[0];
1346
+ old[key] = value;
1347
+ } else {
1348
+ old.borderColor = borderColor;
1349
+ }
1350
+ }
1351
+ if (shadowing !== void 0 && shadowing !== null) {
1352
+ if (typeof shadowing === "object") {
1353
+ let [key, value] = Object.entries(shadowing)[0];
1354
+ old[key] = value;
1355
+ } else {
1356
+ old.shadowing = shadowing;
1357
+ }
1358
+ }
1359
+ if (shape !== void 0 && shape !== null) {
1360
+ if (typeof shape === "object") {
1361
+ let [key, value] = Object.entries(shape)[0];
1362
+ old[key] = value;
1363
+ } else {
1364
+ old.shape = shape;
1365
+ }
1366
+ }
1367
+ if (sprite !== void 0 && sprite !== null) {
1368
+ if (typeof sprite === "object") {
1369
+ let [key, value] = Object.entries(sprite)[0];
1370
+ old[key] = value;
1371
+ } else {
1372
+ old.sprite = sprite;
1373
+ }
1374
+ }
1375
+ if (techn !== void 0 && techn !== null) {
1376
+ if (typeof techn === "object") {
1377
+ let [key, value] = Object.entries(techn)[0];
1378
+ old[key] = value;
1379
+ } else {
1380
+ old.techn = techn;
1381
+ }
1382
+ }
1383
+ if (legendText !== void 0 && legendText !== null) {
1384
+ if (typeof legendText === "object") {
1385
+ let [key, value] = Object.entries(legendText)[0];
1386
+ old[key] = value;
1387
+ } else {
1388
+ old.legendText = legendText;
1389
+ }
1390
+ }
1391
+ if (legendSprite !== void 0 && legendSprite !== null) {
1392
+ if (typeof legendSprite === "object") {
1393
+ let [key, value] = Object.entries(legendSprite)[0];
1394
+ old[key] = value;
1395
+ } else {
1396
+ old.legendSprite = legendSprite;
1397
+ }
1398
+ }
1399
+ }, "updateElStyle");
1400
+ var updateRelStyle = /* @__PURE__ */ __name(function(typeC4Shape, from, to, textColor, lineColor, offsetX, offsetY) {
1401
+ const old = rels.find((rel) => rel.from === from && rel.to === to);
1402
+ if (old === void 0) {
1403
+ return;
1404
+ }
1405
+ if (textColor !== void 0 && textColor !== null) {
1406
+ if (typeof textColor === "object") {
1407
+ let [key, value] = Object.entries(textColor)[0];
1408
+ old[key] = value;
1409
+ } else {
1410
+ old.textColor = textColor;
1411
+ }
1412
+ }
1413
+ if (lineColor !== void 0 && lineColor !== null) {
1414
+ if (typeof lineColor === "object") {
1415
+ let [key, value] = Object.entries(lineColor)[0];
1416
+ old[key] = value;
1417
+ } else {
1418
+ old.lineColor = lineColor;
1419
+ }
1420
+ }
1421
+ if (offsetX !== void 0 && offsetX !== null) {
1422
+ if (typeof offsetX === "object") {
1423
+ let [key, value] = Object.entries(offsetX)[0];
1424
+ old[key] = parseInt(value);
1425
+ } else {
1426
+ old.offsetX = parseInt(offsetX);
1427
+ }
1428
+ }
1429
+ if (offsetY !== void 0 && offsetY !== null) {
1430
+ if (typeof offsetY === "object") {
1431
+ let [key, value] = Object.entries(offsetY)[0];
1432
+ old[key] = parseInt(value);
1433
+ } else {
1434
+ old.offsetY = parseInt(offsetY);
1435
+ }
1436
+ }
1437
+ }, "updateRelStyle");
1438
+ var updateLayoutConfig = /* @__PURE__ */ __name(function(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) {
1439
+ let c4ShapeInRowValue = c4ShapeInRow;
1440
+ let c4BoundaryInRowValue = c4BoundaryInRow;
1441
+ if (typeof c4ShapeInRowParam === "object") {
1442
+ const value = Object.values(c4ShapeInRowParam)[0];
1443
+ c4ShapeInRowValue = parseInt(value);
1444
+ } else {
1445
+ c4ShapeInRowValue = parseInt(c4ShapeInRowParam);
1446
+ }
1447
+ if (typeof c4BoundaryInRowParam === "object") {
1448
+ const value = Object.values(c4BoundaryInRowParam)[0];
1449
+ c4BoundaryInRowValue = parseInt(value);
1450
+ } else {
1451
+ c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);
1452
+ }
1453
+ if (c4ShapeInRowValue >= 1) {
1454
+ c4ShapeInRow = c4ShapeInRowValue;
1455
+ }
1456
+ if (c4BoundaryInRowValue >= 1) {
1457
+ c4BoundaryInRow = c4BoundaryInRowValue;
1458
+ }
1459
+ }, "updateLayoutConfig");
1460
+ var getC4ShapeInRow = /* @__PURE__ */ __name(function() {
1461
+ return c4ShapeInRow;
1462
+ }, "getC4ShapeInRow");
1463
+ var getC4BoundaryInRow = /* @__PURE__ */ __name(function() {
1464
+ return c4BoundaryInRow;
1465
+ }, "getC4BoundaryInRow");
1466
+ var getCurrentBoundaryParse = /* @__PURE__ */ __name(function() {
1467
+ return currentBoundaryParse;
1468
+ }, "getCurrentBoundaryParse");
1469
+ var getParentBoundaryParse = /* @__PURE__ */ __name(function() {
1470
+ return parentBoundaryParse;
1471
+ }, "getParentBoundaryParse");
1472
+ var getC4ShapeArray = /* @__PURE__ */ __name(function(parentBoundary) {
1473
+ if (parentBoundary === void 0 || parentBoundary === null) {
1474
+ return c4ShapeArray;
1475
+ } else {
1476
+ return c4ShapeArray.filter((personOrSystem) => {
1477
+ return personOrSystem.parentBoundary === parentBoundary;
1478
+ });
1479
+ }
1480
+ }, "getC4ShapeArray");
1481
+ var getC4Shape = /* @__PURE__ */ __name(function(alias) {
1482
+ return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias);
1483
+ }, "getC4Shape");
1484
+ var getC4ShapeKeys = /* @__PURE__ */ __name(function(parentBoundary) {
1485
+ return Object.keys(getC4ShapeArray(parentBoundary));
1486
+ }, "getC4ShapeKeys");
1487
+ var getBoundaries = /* @__PURE__ */ __name(function(parentBoundary) {
1488
+ if (parentBoundary === void 0 || parentBoundary === null) {
1489
+ return boundaries;
1490
+ } else {
1491
+ return boundaries.filter((boundary) => boundary.parentBoundary === parentBoundary);
1492
+ }
1493
+ }, "getBoundaries");
1494
+ var getBoundarys = getBoundaries;
1495
+ var getRels = /* @__PURE__ */ __name(function() {
1496
+ return rels;
1497
+ }, "getRels");
1498
+ var getTitle = /* @__PURE__ */ __name(function() {
1499
+ return title;
1500
+ }, "getTitle");
1501
+ var setWrap = /* @__PURE__ */ __name(function(wrapSetting) {
1502
+ wrapEnabled = wrapSetting;
1503
+ }, "setWrap");
1504
+ var autoWrap = /* @__PURE__ */ __name(function() {
1505
+ return wrapEnabled;
1506
+ }, "autoWrap");
1507
+ var clear = /* @__PURE__ */ __name(function() {
1508
+ c4ShapeArray = [];
1509
+ boundaries = [
1510
+ {
1511
+ alias: "global",
1512
+ label: { text: "global" },
1513
+ type: { text: "global" },
1514
+ tags: null,
1515
+ link: null,
1516
+ parentBoundary: ""
1517
+ }
1518
+ ];
1519
+ parentBoundaryParse = "";
1520
+ currentBoundaryParse = "global";
1521
+ boundaryParseStack = [""];
1522
+ rels = [];
1523
+ boundaryParseStack = [""];
1524
+ title = "";
1525
+ wrapEnabled = false;
1526
+ c4ShapeInRow = 4;
1527
+ c4BoundaryInRow = 2;
1528
+ }, "clear");
1529
+ var LINETYPE = {
1530
+ SOLID: 0,
1531
+ DOTTED: 1,
1532
+ NOTE: 2,
1533
+ SOLID_CROSS: 3,
1534
+ DOTTED_CROSS: 4,
1535
+ SOLID_OPEN: 5,
1536
+ DOTTED_OPEN: 6,
1537
+ LOOP_START: 10,
1538
+ LOOP_END: 11,
1539
+ ALT_START: 12,
1540
+ ALT_ELSE: 13,
1541
+ ALT_END: 14,
1542
+ OPT_START: 15,
1543
+ OPT_END: 16,
1544
+ ACTIVE_START: 17,
1545
+ ACTIVE_END: 18,
1546
+ PAR_START: 19,
1547
+ PAR_AND: 20,
1548
+ PAR_END: 21,
1549
+ RECT_START: 22,
1550
+ RECT_END: 23,
1551
+ SOLID_POINT: 24,
1552
+ DOTTED_POINT: 25
1553
+ };
1554
+ var ARROWTYPE = {
1555
+ FILLED: 0,
1556
+ OPEN: 1
1557
+ };
1558
+ var PLACEMENT = {
1559
+ LEFTOF: 0,
1560
+ RIGHTOF: 1,
1561
+ OVER: 2
1562
+ };
1563
+ var setTitle = /* @__PURE__ */ __name(function(txt) {
1564
+ let sanitizedText = sanitizeText(txt, getConfig2());
1565
+ title = sanitizedText;
1566
+ }, "setTitle");
1567
+ var c4Db_default = {
1568
+ addPersonOrSystem,
1569
+ addPersonOrSystemBoundary,
1570
+ addContainer,
1571
+ addContainerBoundary,
1572
+ addComponent,
1573
+ addDeploymentNode,
1574
+ popBoundaryParseStack,
1575
+ addRel,
1576
+ updateElStyle,
1577
+ updateRelStyle,
1578
+ updateLayoutConfig,
1579
+ autoWrap,
1580
+ setWrap,
1581
+ getC4ShapeArray,
1582
+ getC4Shape,
1583
+ getC4ShapeKeys,
1584
+ getBoundaries,
1585
+ getBoundarys,
1586
+ getCurrentBoundaryParse,
1587
+ getParentBoundaryParse,
1588
+ getRels,
1589
+ getTitle,
1590
+ getC4Type,
1591
+ getC4ShapeInRow,
1592
+ getC4BoundaryInRow,
1593
+ setAccTitle,
1594
+ getAccTitle,
1595
+ getAccDescription,
1596
+ setAccDescription,
1597
+ getConfig: /* @__PURE__ */ __name(() => getConfig2().c4, "getConfig"),
1598
+ clear,
1599
+ LINETYPE,
1600
+ ARROWTYPE,
1601
+ PLACEMENT,
1602
+ setTitle,
1603
+ setC4Type
1604
+ // apply,
1605
+ };
1606
+ var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
1607
+ return drawRect(elem, rectData);
1608
+ }, "drawRect");
1609
+ var drawImage = /* @__PURE__ */ __name(function(elem, width, height, x, y, link) {
1610
+ const imageElem = elem.append("image");
1611
+ imageElem.attr("width", width);
1612
+ imageElem.attr("height", height);
1613
+ imageElem.attr("x", x);
1614
+ imageElem.attr("y", y);
1615
+ let sanitizedLink = link.startsWith("data:image/png;base64") ? link : distExports.sanitizeUrl(link);
1616
+ imageElem.attr("xlink:href", sanitizedLink);
1617
+ }, "drawImage");
1618
+ var drawRels = /* @__PURE__ */ __name((elem, rels2, conf2, diagramId) => {
1619
+ const relsElem = elem.append("g");
1620
+ let i = 0;
1621
+ for (let rel of rels2) {
1622
+ let textColor = rel.textColor ? rel.textColor : "#444444";
1623
+ let strokeColor = rel.lineColor ? rel.lineColor : "#444444";
1624
+ let offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0;
1625
+ let offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0;
1626
+ let url = "";
1627
+ if (i === 0) {
1628
+ let line = relsElem.append("line");
1629
+ line.attr("x1", rel.startPoint.x);
1630
+ line.attr("y1", rel.startPoint.y);
1631
+ line.attr("x2", rel.endPoint.x);
1632
+ line.attr("y2", rel.endPoint.y);
1633
+ line.attr("stroke-width", "1");
1634
+ line.attr("stroke", strokeColor);
1635
+ line.style("fill", "none");
1636
+ if (rel.type !== "rel_b") {
1637
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
1638
+ }
1639
+ if (rel.type === "birel" || rel.type === "rel_b") {
1640
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-arrowend)");
1641
+ }
1642
+ i = -1;
1643
+ } else {
1644
+ let line = relsElem.append("path");
1645
+ line.attr("fill", "none").attr("stroke-width", "1").attr("stroke", strokeColor).attr(
1646
+ "d",
1647
+ "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", rel.startPoint.x).replaceAll("starty", rel.startPoint.y).replaceAll(
1648
+ "controlx",
1649
+ rel.startPoint.x + (rel.endPoint.x - rel.startPoint.x) / 2 - (rel.endPoint.x - rel.startPoint.x) / 4
1650
+ ).replaceAll("controly", rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2).replaceAll("stopx", rel.endPoint.x).replaceAll("stopy", rel.endPoint.y)
1651
+ );
1652
+ if (rel.type !== "rel_b") {
1653
+ line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
1654
+ }
1655
+ if (rel.type === "birel" || rel.type === "rel_b") {
1656
+ line.attr("marker-start", "url(" + url + "#" + diagramId + "-arrowend)");
1657
+ }
1658
+ }
1659
+ let messageConf = conf2.messageFont();
1660
+ _drawTextCandidateFunc(conf2)(
1661
+ rel.label.text,
1662
+ relsElem,
1663
+ Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX,
1664
+ Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + offsetY,
1665
+ rel.label.width,
1666
+ rel.label.height,
1667
+ { fill: textColor },
1668
+ messageConf
1669
+ );
1670
+ if (rel.techn && rel.techn.text !== "") {
1671
+ messageConf = conf2.messageFont();
1672
+ _drawTextCandidateFunc(conf2)(
1673
+ "[" + rel.techn.text + "]",
1674
+ relsElem,
1675
+ Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX,
1676
+ Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + conf2.messageFontSize + 5 + offsetY,
1677
+ Math.max(rel.label.width, rel.techn.width),
1678
+ rel.techn.height,
1679
+ { fill: textColor, "font-style": "italic" },
1680
+ messageConf
1681
+ );
1682
+ }
1683
+ }
1684
+ }, "drawRels");
1685
+ var drawBoundary = /* @__PURE__ */ __name(function(elem, boundary, conf2) {
1686
+ const boundaryElem = elem.append("g");
1687
+ let fillColor = boundary.bgColor ? boundary.bgColor : "none";
1688
+ let strokeColor = boundary.borderColor ? boundary.borderColor : "#444444";
1689
+ let fontColor = boundary.fontColor ? boundary.fontColor : "black";
1690
+ let attrsValue = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" };
1691
+ if (boundary.nodeType) {
1692
+ attrsValue = { "stroke-width": 1 };
1693
+ }
1694
+ let rectData = {
1695
+ x: boundary.x,
1696
+ y: boundary.y,
1697
+ fill: fillColor,
1698
+ stroke: strokeColor,
1699
+ width: boundary.width,
1700
+ height: boundary.height,
1701
+ rx: 2.5,
1702
+ ry: 2.5,
1703
+ attrs: attrsValue
1704
+ };
1705
+ drawRect2(boundaryElem, rectData);
1706
+ let boundaryConf = conf2.boundaryFont();
1707
+ boundaryConf.fontWeight = "bold";
1708
+ boundaryConf.fontSize = boundaryConf.fontSize + 2;
1709
+ boundaryConf.fontColor = fontColor;
1710
+ _drawTextCandidateFunc(conf2)(
1711
+ boundary.label.text,
1712
+ boundaryElem,
1713
+ boundary.x,
1714
+ boundary.y + boundary.label.Y,
1715
+ boundary.width,
1716
+ boundary.height,
1717
+ { fill: "#444444" },
1718
+ boundaryConf
1719
+ );
1720
+ if (boundary.type && boundary.type.text !== "") {
1721
+ boundaryConf = conf2.boundaryFont();
1722
+ boundaryConf.fontColor = fontColor;
1723
+ _drawTextCandidateFunc(conf2)(
1724
+ boundary.type.text,
1725
+ boundaryElem,
1726
+ boundary.x,
1727
+ boundary.y + boundary.type.Y,
1728
+ boundary.width,
1729
+ boundary.height,
1730
+ { fill: "#444444" },
1731
+ boundaryConf
1732
+ );
1733
+ }
1734
+ if (boundary.descr && boundary.descr.text !== "") {
1735
+ boundaryConf = conf2.boundaryFont();
1736
+ boundaryConf.fontSize = boundaryConf.fontSize - 2;
1737
+ boundaryConf.fontColor = fontColor;
1738
+ _drawTextCandidateFunc(conf2)(
1739
+ boundary.descr.text,
1740
+ boundaryElem,
1741
+ boundary.x,
1742
+ boundary.y + boundary.descr.Y,
1743
+ boundary.width,
1744
+ boundary.height,
1745
+ { fill: "#444444" },
1746
+ boundaryConf
1747
+ );
1748
+ }
1749
+ }, "drawBoundary");
1750
+ var drawC4Shape = /* @__PURE__ */ __name(function(elem, c4Shape, conf2) {
1751
+ var _a2;
1752
+ let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf2[c4Shape.typeC4Shape.text + "_bg_color"];
1753
+ let strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf2[c4Shape.typeC4Shape.text + "_border_color"];
1754
+ let fontColor = c4Shape.fontColor ? c4Shape.fontColor : "#FFFFFF";
1755
+ let personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
1756
+ switch (c4Shape.typeC4Shape.text) {
1757
+ case "person":
1758
+ personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
1759
+ break;
1760
+ case "external_person":
1761
+ personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";
1762
+ break;
1763
+ }
1764
+ const c4ShapeElem = elem.append("g");
1765
+ c4ShapeElem.attr("class", "person-man");
1766
+ const rect = getNoteRect();
1767
+ switch (c4Shape.typeC4Shape.text) {
1768
+ case "person":
1769
+ case "external_person":
1770
+ case "system":
1771
+ case "external_system":
1772
+ case "container":
1773
+ case "external_container":
1774
+ case "component":
1775
+ case "external_component":
1776
+ rect.x = c4Shape.x;
1777
+ rect.y = c4Shape.y;
1778
+ rect.fill = fillColor;
1779
+ rect.width = c4Shape.width;
1780
+ rect.height = c4Shape.height;
1781
+ rect.stroke = strokeColor;
1782
+ rect.rx = 2.5;
1783
+ rect.ry = 2.5;
1784
+ rect.attrs = { "stroke-width": 0.5 };
1785
+ drawRect2(c4ShapeElem, rect);
1786
+ break;
1787
+ case "system_db":
1788
+ case "external_system_db":
1789
+ case "container_db":
1790
+ case "external_container_db":
1791
+ case "component_db":
1792
+ case "external_component_db":
1793
+ c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1794
+ "d",
1795
+ "Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2).replaceAll("height", c4Shape.height)
1796
+ );
1797
+ c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1798
+ "d",
1799
+ "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2)
1800
+ );
1801
+ break;
1802
+ case "system_queue":
1803
+ case "external_system_queue":
1804
+ case "container_queue":
1805
+ case "external_container_queue":
1806
+ case "component_queue":
1807
+ case "external_component_queue":
1808
+ c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1809
+ "d",
1810
+ "Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("width", c4Shape.width).replaceAll("half", c4Shape.height / 2)
1811
+ );
1812
+ c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr(
1813
+ "d",
1814
+ "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", c4Shape.x + c4Shape.width).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.height / 2)
1815
+ );
1816
+ break;
1817
+ }
1818
+ let c4ShapeFontConf = getC4ShapeFont(conf2, c4Shape.typeC4Shape.text);
1819
+ c4ShapeElem.append("text").attr("fill", fontColor).attr("font-family", c4ShapeFontConf.fontFamily).attr("font-size", c4ShapeFontConf.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", c4Shape.typeC4Shape.width).attr("x", c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr("y", c4Shape.y + c4Shape.typeC4Shape.Y).text("<<" + c4Shape.typeC4Shape.text + ">>");
1820
+ switch (c4Shape.typeC4Shape.text) {
1821
+ case "person":
1822
+ case "external_person":
1823
+ drawImage(
1824
+ c4ShapeElem,
1825
+ 48,
1826
+ 48,
1827
+ c4Shape.x + c4Shape.width / 2 - 24,
1828
+ c4Shape.y + c4Shape.image.Y,
1829
+ personImg
1830
+ );
1831
+ break;
1832
+ }
1833
+ let textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"]();
1834
+ textFontConf.fontWeight = "bold";
1835
+ textFontConf.fontSize = textFontConf.fontSize + 2;
1836
+ textFontConf.fontColor = fontColor;
1837
+ _drawTextCandidateFunc(conf2)(
1838
+ c4Shape.label.text,
1839
+ c4ShapeElem,
1840
+ c4Shape.x,
1841
+ c4Shape.y + c4Shape.label.Y,
1842
+ c4Shape.width,
1843
+ c4Shape.height,
1844
+ { fill: fontColor },
1845
+ textFontConf
1846
+ );
1847
+ textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"]();
1848
+ textFontConf.fontColor = fontColor;
1849
+ if (c4Shape.techn && ((_a2 = c4Shape.techn) == null ? void 0 : _a2.text) !== "") {
1850
+ _drawTextCandidateFunc(conf2)(
1851
+ c4Shape.techn.text,
1852
+ c4ShapeElem,
1853
+ c4Shape.x,
1854
+ c4Shape.y + c4Shape.techn.Y,
1855
+ c4Shape.width,
1856
+ c4Shape.height,
1857
+ { fill: fontColor, "font-style": "italic" },
1858
+ textFontConf
1859
+ );
1860
+ } else if (c4Shape.type && c4Shape.type.text !== "") {
1861
+ _drawTextCandidateFunc(conf2)(
1862
+ c4Shape.type.text,
1863
+ c4ShapeElem,
1864
+ c4Shape.x,
1865
+ c4Shape.y + c4Shape.type.Y,
1866
+ c4Shape.width,
1867
+ c4Shape.height,
1868
+ { fill: fontColor, "font-style": "italic" },
1869
+ textFontConf
1870
+ );
1871
+ }
1872
+ if (c4Shape.descr && c4Shape.descr.text !== "") {
1873
+ textFontConf = conf2.personFont();
1874
+ textFontConf.fontColor = fontColor;
1875
+ _drawTextCandidateFunc(conf2)(
1876
+ c4Shape.descr.text,
1877
+ c4ShapeElem,
1878
+ c4Shape.x,
1879
+ c4Shape.y + c4Shape.descr.Y,
1880
+ c4Shape.width,
1881
+ c4Shape.height,
1882
+ { fill: fontColor },
1883
+ textFontConf
1884
+ );
1885
+ }
1886
+ return c4Shape.height;
1887
+ }, "drawC4Shape");
1888
+ var insertDatabaseIcon = /* @__PURE__ */ __name(function(elem, id) {
1889
+ elem.append("defs").append("symbol").attr("id", id + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
1890
+ "d",
1891
+ "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"
1892
+ );
1893
+ }, "insertDatabaseIcon");
1894
+ var insertComputerIcon = /* @__PURE__ */ __name(function(elem, id) {
1895
+ elem.append("defs").append("symbol").attr("id", id + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1896
+ "d",
1897
+ "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"
1898
+ );
1899
+ }, "insertComputerIcon");
1900
+ var insertClockIcon = /* @__PURE__ */ __name(function(elem, id) {
1901
+ elem.append("defs").append("symbol").attr("id", id + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1902
+ "d",
1903
+ "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"
1904
+ );
1905
+ }, "insertClockIcon");
1906
+ var insertArrowHead = /* @__PURE__ */ __name(function(elem, id) {
1907
+ elem.append("defs").append("marker").attr("id", id + "-arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
1908
+ }, "insertArrowHead");
1909
+ var insertArrowEnd = /* @__PURE__ */ __name(function(elem, id) {
1910
+ elem.append("defs").append("marker").attr("id", id + "-arrowend").attr("refX", 1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z");
1911
+ }, "insertArrowEnd");
1912
+ var insertArrowFilledHead = /* @__PURE__ */ __name(function(elem, id) {
1913
+ elem.append("defs").append("marker").attr("id", id + "-filled-head").attr("refX", 18).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");
1914
+ }, "insertArrowFilledHead");
1915
+ var insertArrowCrossHead = /* @__PURE__ */ __name(function(elem, id) {
1916
+ const defs = elem.append("defs");
1917
+ const marker = defs.append("marker").attr("id", id + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4);
1918
+ marker.append("path").attr("fill", "black").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 9,2 V 6 L16,4 Z");
1919
+ marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 0,1 L 6,7 M 6,1 L 0,7");
1920
+ }, "insertArrowCrossHead");
1921
+ var getC4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => {
1922
+ return {
1923
+ fontFamily: cnf[typeC4Shape + "FontFamily"],
1924
+ fontSize: cnf[typeC4Shape + "FontSize"],
1925
+ fontWeight: cnf[typeC4Shape + "FontWeight"]
1926
+ };
1927
+ }, "getC4ShapeFont");
1928
+ var _drawTextCandidateFunc = /* @__PURE__ */ (function() {
1929
+ function byText(content, g, x, y, width, height, textAttrs) {
1930
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
1931
+ _setTextAttrs(text, textAttrs);
1932
+ }
1933
+ __name(byText, "byText");
1934
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
1935
+ const { fontSize, fontFamily, fontWeight } = conf2;
1936
+ const lines = content.split(common_default.lineBreakRegex);
1937
+ for (let i = 0; i < lines.length; i++) {
1938
+ const dy = i * fontSize - fontSize * (lines.length - 1) / 2;
1939
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", fontSize).style("font-weight", fontWeight).style("font-family", fontFamily);
1940
+ text.append("tspan").attr("dy", dy).text(lines[i]).attr("alignment-baseline", "mathematical");
1941
+ _setTextAttrs(text, textAttrs);
1942
+ }
1943
+ }
1944
+ __name(byTspan, "byTspan");
1945
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
1946
+ const s = g.append("switch");
1947
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
1948
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
1949
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
1950
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
1951
+ _setTextAttrs(text, textAttrs);
1952
+ }
1953
+ __name(byFo, "byFo");
1954
+ function _setTextAttrs(toText, fromTextAttrsDict) {
1955
+ for (const key in fromTextAttrsDict) {
1956
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
1957
+ toText.attr(key, fromTextAttrsDict[key]);
1958
+ }
1959
+ }
1960
+ }
1961
+ __name(_setTextAttrs, "_setTextAttrs");
1962
+ return function(conf2) {
1963
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
1964
+ };
1965
+ })();
1966
+ var svgDraw_default = {
1967
+ drawRect: drawRect2,
1968
+ drawBoundary,
1969
+ drawC4Shape,
1970
+ drawRels,
1971
+ drawImage,
1972
+ insertArrowHead,
1973
+ insertArrowEnd,
1974
+ insertArrowFilledHead,
1975
+ insertArrowCrossHead,
1976
+ insertDatabaseIcon,
1977
+ insertComputerIcon,
1978
+ insertClockIcon
1979
+ };
1980
+ var globalBoundaryMaxX = 0;
1981
+ var globalBoundaryMaxY = 0;
1982
+ var c4ShapeInRow2 = 4;
1983
+ var c4BoundaryInRow2 = 2;
1984
+ parser.yy = c4Db_default;
1985
+ var conf = {};
1986
+ var Bounds = (_a = class {
1987
+ constructor(diagObj) {
1988
+ this.name = "";
1989
+ this.data = {};
1990
+ this.data.startx = void 0;
1991
+ this.data.stopx = void 0;
1992
+ this.data.starty = void 0;
1993
+ this.data.stopy = void 0;
1994
+ this.data.widthLimit = void 0;
1995
+ this.nextData = {};
1996
+ this.nextData.startx = void 0;
1997
+ this.nextData.stopx = void 0;
1998
+ this.nextData.starty = void 0;
1999
+ this.nextData.stopy = void 0;
2000
+ this.nextData.cnt = 0;
2001
+ setConf(diagObj.db.getConfig());
2002
+ }
2003
+ setData(startx, stopx, starty, stopy) {
2004
+ this.nextData.startx = this.data.startx = startx;
2005
+ this.nextData.stopx = this.data.stopx = stopx;
2006
+ this.nextData.starty = this.data.starty = starty;
2007
+ this.nextData.stopy = this.data.stopy = stopy;
2008
+ }
2009
+ updateVal(obj, key, val, fun) {
2010
+ if (obj[key] === void 0) {
2011
+ obj[key] = val;
2012
+ } else {
2013
+ obj[key] = fun(val, obj[key]);
2014
+ }
2015
+ }
2016
+ insert(c4Shape) {
2017
+ this.nextData.cnt = this.nextData.cnt + 1;
2018
+ let _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2;
2019
+ let _stopx = _startx + c4Shape.width;
2020
+ let _starty = this.nextData.starty + c4Shape.margin * 2;
2021
+ let _stopy = _starty + c4Shape.height;
2022
+ if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow2) {
2023
+ _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX;
2024
+ _starty = this.nextData.stopy + c4Shape.margin * 2;
2025
+ this.nextData.stopx = _stopx = _startx + c4Shape.width;
2026
+ this.nextData.starty = this.nextData.stopy;
2027
+ this.nextData.stopy = _stopy = _starty + c4Shape.height;
2028
+ this.nextData.cnt = 1;
2029
+ }
2030
+ c4Shape.x = _startx;
2031
+ c4Shape.y = _starty;
2032
+ this.updateVal(this.data, "startx", _startx, Math.min);
2033
+ this.updateVal(this.data, "starty", _starty, Math.min);
2034
+ this.updateVal(this.data, "stopx", _stopx, Math.max);
2035
+ this.updateVal(this.data, "stopy", _stopy, Math.max);
2036
+ this.updateVal(this.nextData, "startx", _startx, Math.min);
2037
+ this.updateVal(this.nextData, "starty", _starty, Math.min);
2038
+ this.updateVal(this.nextData, "stopx", _stopx, Math.max);
2039
+ this.updateVal(this.nextData, "stopy", _stopy, Math.max);
2040
+ }
2041
+ init(diagObj) {
2042
+ this.name = "";
2043
+ this.data = {
2044
+ startx: void 0,
2045
+ stopx: void 0,
2046
+ starty: void 0,
2047
+ stopy: void 0,
2048
+ widthLimit: void 0
2049
+ };
2050
+ this.nextData = {
2051
+ startx: void 0,
2052
+ stopx: void 0,
2053
+ starty: void 0,
2054
+ stopy: void 0,
2055
+ cnt: 0
2056
+ };
2057
+ setConf(diagObj.db.getConfig());
2058
+ }
2059
+ bumpLastMargin(margin) {
2060
+ this.data.stopx += margin;
2061
+ this.data.stopy += margin;
2062
+ }
2063
+ }, __name(_a, "Bounds"), _a);
2064
+ var setConf = /* @__PURE__ */ __name(function(cnf) {
2065
+ assignWithDepth_default(conf, cnf);
2066
+ if (cnf.fontFamily) {
2067
+ conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily;
2068
+ }
2069
+ if (cnf.fontSize) {
2070
+ conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize;
2071
+ }
2072
+ if (cnf.fontWeight) {
2073
+ conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight;
2074
+ }
2075
+ }, "setConf");
2076
+ var c4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => {
2077
+ return {
2078
+ fontFamily: cnf[typeC4Shape + "FontFamily"],
2079
+ fontSize: cnf[typeC4Shape + "FontSize"],
2080
+ fontWeight: cnf[typeC4Shape + "FontWeight"]
2081
+ };
2082
+ }, "c4ShapeFont");
2083
+ var boundaryFont = /* @__PURE__ */ __name((cnf) => {
2084
+ return {
2085
+ fontFamily: cnf.boundaryFontFamily,
2086
+ fontSize: cnf.boundaryFontSize,
2087
+ fontWeight: cnf.boundaryFontWeight
2088
+ };
2089
+ }, "boundaryFont");
2090
+ var messageFont = /* @__PURE__ */ __name((cnf) => {
2091
+ return {
2092
+ fontFamily: cnf.messageFontFamily,
2093
+ fontSize: cnf.messageFontSize,
2094
+ fontWeight: cnf.messageFontWeight
2095
+ };
2096
+ }, "messageFont");
2097
+ function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) {
2098
+ if (!c4Shape[textType].width) {
2099
+ if (c4ShapeTextWrap) {
2100
+ c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf);
2101
+ c4Shape[textType].textLines = c4Shape[textType].text.split(common_default.lineBreakRegex).length;
2102
+ c4Shape[textType].width = textLimitWidth;
2103
+ c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf);
2104
+ } else {
2105
+ let lines = c4Shape[textType].text.split(common_default.lineBreakRegex);
2106
+ c4Shape[textType].textLines = lines.length;
2107
+ let lineHeight = 0;
2108
+ c4Shape[textType].height = 0;
2109
+ c4Shape[textType].width = 0;
2110
+ for (const line of lines) {
2111
+ c4Shape[textType].width = Math.max(
2112
+ calculateTextWidth(line, textConf),
2113
+ c4Shape[textType].width
2114
+ );
2115
+ lineHeight = calculateTextHeight(line, textConf);
2116
+ c4Shape[textType].height = c4Shape[textType].height + lineHeight;
2117
+ }
2118
+ }
2119
+ }
2120
+ }
2121
+ __name(calcC4ShapeTextWH, "calcC4ShapeTextWH");
2122
+ var drawBoundary2 = /* @__PURE__ */ __name(function(diagram2, boundary, bounds) {
2123
+ boundary.x = bounds.data.startx;
2124
+ boundary.y = bounds.data.starty;
2125
+ boundary.width = bounds.data.stopx - bounds.data.startx;
2126
+ boundary.height = bounds.data.stopy - bounds.data.starty;
2127
+ boundary.label.y = conf.c4ShapeMargin - 35;
2128
+ let boundaryTextWrap = boundary.wrap && conf.wrap;
2129
+ let boundaryLabelConf = boundaryFont(conf);
2130
+ boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2;
2131
+ boundaryLabelConf.fontWeight = "bold";
2132
+ let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf);
2133
+ calcC4ShapeTextWH("label", boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth);
2134
+ svgDraw_default.drawBoundary(diagram2, boundary, conf);
2135
+ }, "drawBoundary");
2136
+ var drawC4ShapeArray = /* @__PURE__ */ __name(function(currentBounds, diagram2, c4ShapeArray2, c4ShapeKeys) {
2137
+ let Y = 0;
2138
+ for (const c4ShapeKey of c4ShapeKeys) {
2139
+ Y = 0;
2140
+ const c4Shape = c4ShapeArray2[c4ShapeKey];
2141
+ let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2142
+ c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2;
2143
+ c4Shape.typeC4Shape.width = calculateTextWidth(
2144
+ "«" + c4Shape.typeC4Shape.text + "»",
2145
+ c4ShapeTypeConf
2146
+ );
2147
+ c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2;
2148
+ c4Shape.typeC4Shape.Y = conf.c4ShapePadding;
2149
+ Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4;
2150
+ c4Shape.image = { width: 0, height: 0, Y: 0 };
2151
+ switch (c4Shape.typeC4Shape.text) {
2152
+ case "person":
2153
+ case "external_person":
2154
+ c4Shape.image.width = 48;
2155
+ c4Shape.image.height = 48;
2156
+ c4Shape.image.Y = Y;
2157
+ Y = c4Shape.image.Y + c4Shape.image.height;
2158
+ break;
2159
+ }
2160
+ if (c4Shape.sprite) {
2161
+ c4Shape.image.width = 48;
2162
+ c4Shape.image.height = 48;
2163
+ c4Shape.image.Y = Y;
2164
+ Y = c4Shape.image.Y + c4Shape.image.height;
2165
+ }
2166
+ let c4ShapeTextWrap = c4Shape.wrap && conf.wrap;
2167
+ let textLimitWidth = conf.width - conf.c4ShapePadding * 2;
2168
+ let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2169
+ c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2;
2170
+ c4ShapeLabelConf.fontWeight = "bold";
2171
+ calcC4ShapeTextWH("label", c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth);
2172
+ c4Shape.label.Y = Y + 8;
2173
+ Y = c4Shape.label.Y + c4Shape.label.height;
2174
+ if (c4Shape.type && c4Shape.type.text !== "") {
2175
+ c4Shape.type.text = "[" + c4Shape.type.text + "]";
2176
+ let c4ShapeTypeConf2 = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2177
+ calcC4ShapeTextWH("type", c4Shape, c4ShapeTextWrap, c4ShapeTypeConf2, textLimitWidth);
2178
+ c4Shape.type.Y = Y + 5;
2179
+ Y = c4Shape.type.Y + c4Shape.type.height;
2180
+ } else if (c4Shape.techn && c4Shape.techn.text !== "") {
2181
+ c4Shape.techn.text = "[" + c4Shape.techn.text + "]";
2182
+ let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text);
2183
+ calcC4ShapeTextWH("techn", c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth);
2184
+ c4Shape.techn.Y = Y + 5;
2185
+ Y = c4Shape.techn.Y + c4Shape.techn.height;
2186
+ }
2187
+ let rectHeight = Y;
2188
+ let rectWidth = c4Shape.label.width;
2189
+ if (c4Shape.descr && c4Shape.descr.text !== "") {
2190
+ let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
2191
+ calcC4ShapeTextWH("descr", c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth);
2192
+ c4Shape.descr.Y = Y + 20;
2193
+ Y = c4Shape.descr.Y + c4Shape.descr.height;
2194
+ rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width);
2195
+ rectHeight = Y - c4Shape.descr.textLines * 5;
2196
+ }
2197
+ rectWidth = rectWidth + conf.c4ShapePadding;
2198
+ c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width);
2199
+ c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height);
2200
+ c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin;
2201
+ currentBounds.insert(c4Shape);
2202
+ svgDraw_default.drawC4Shape(diagram2, c4Shape, conf);
2203
+ }
2204
+ currentBounds.bumpLastMargin(conf.c4ShapeMargin);
2205
+ }, "drawC4ShapeArray");
2206
+ var Point = (_b = class {
2207
+ constructor(x, y) {
2208
+ this.x = x;
2209
+ this.y = y;
2210
+ }
2211
+ }, __name(_b, "Point"), _b);
2212
+ var getIntersectPoint = /* @__PURE__ */ __name(function(fromNode, endPoint) {
2213
+ let x1 = fromNode.x;
2214
+ let y1 = fromNode.y;
2215
+ let x2 = endPoint.x;
2216
+ let y2 = endPoint.y;
2217
+ let fromCenterX = x1 + fromNode.width / 2;
2218
+ let fromCenterY = y1 + fromNode.height / 2;
2219
+ let dx = Math.abs(x1 - x2);
2220
+ let dy = Math.abs(y1 - y2);
2221
+ let tanDYX = dy / dx;
2222
+ let fromDYX = fromNode.height / fromNode.width;
2223
+ let returnPoint = null;
2224
+ if (y1 == y2 && x1 < x2) {
2225
+ returnPoint = new Point(x1 + fromNode.width, fromCenterY);
2226
+ } else if (y1 == y2 && x1 > x2) {
2227
+ returnPoint = new Point(x1, fromCenterY);
2228
+ } else if (x1 == x2 && y1 < y2) {
2229
+ returnPoint = new Point(fromCenterX, y1 + fromNode.height);
2230
+ } else if (x1 == x2 && y1 > y2) {
2231
+ returnPoint = new Point(fromCenterX, y1);
2232
+ }
2233
+ if (x1 > x2 && y1 < y2) {
2234
+ if (fromDYX >= tanDYX) {
2235
+ returnPoint = new Point(x1, fromCenterY + tanDYX * fromNode.width / 2);
2236
+ } else {
2237
+ returnPoint = new Point(
2238
+ fromCenterX - dx / dy * fromNode.height / 2,
2239
+ y1 + fromNode.height
2240
+ );
2241
+ }
2242
+ } else if (x1 < x2 && y1 < y2) {
2243
+ if (fromDYX >= tanDYX) {
2244
+ returnPoint = new Point(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2);
2245
+ } else {
2246
+ returnPoint = new Point(
2247
+ fromCenterX + dx / dy * fromNode.height / 2,
2248
+ y1 + fromNode.height
2249
+ );
2250
+ }
2251
+ } else if (x1 < x2 && y1 > y2) {
2252
+ if (fromDYX >= tanDYX) {
2253
+ returnPoint = new Point(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2);
2254
+ } else {
2255
+ returnPoint = new Point(fromCenterX + fromNode.height / 2 * dx / dy, y1);
2256
+ }
2257
+ } else if (x1 > x2 && y1 > y2) {
2258
+ if (fromDYX >= tanDYX) {
2259
+ returnPoint = new Point(x1, fromCenterY - fromNode.width / 2 * tanDYX);
2260
+ } else {
2261
+ returnPoint = new Point(fromCenterX - fromNode.height / 2 * dx / dy, y1);
2262
+ }
2263
+ }
2264
+ return returnPoint;
2265
+ }, "getIntersectPoint");
2266
+ var getIntersectPoints = /* @__PURE__ */ __name(function(fromNode, endNode) {
2267
+ let endIntersectPoint = { x: 0, y: 0 };
2268
+ endIntersectPoint.x = endNode.x + endNode.width / 2;
2269
+ endIntersectPoint.y = endNode.y + endNode.height / 2;
2270
+ let startPoint = getIntersectPoint(fromNode, endIntersectPoint);
2271
+ endIntersectPoint.x = fromNode.x + fromNode.width / 2;
2272
+ endIntersectPoint.y = fromNode.y + fromNode.height / 2;
2273
+ let endPoint = getIntersectPoint(endNode, endIntersectPoint);
2274
+ return { startPoint, endPoint };
2275
+ }, "getIntersectPoints");
2276
+ var drawRels2 = /* @__PURE__ */ __name(function(diagram2, rels2, getC4ShapeObj, diagObj, diagramId) {
2277
+ let i = 0;
2278
+ for (let rel of rels2) {
2279
+ i = i + 1;
2280
+ let relTextWrap = rel.wrap && conf.wrap;
2281
+ let relConf = messageFont(conf);
2282
+ let diagramType = diagObj.db.getC4Type();
2283
+ if (diagramType === "C4Dynamic") {
2284
+ rel.label.text = i + ": " + rel.label.text;
2285
+ }
2286
+ let textLimitWidth = calculateTextWidth(rel.label.text, relConf);
2287
+ calcC4ShapeTextWH("label", rel, relTextWrap, relConf, textLimitWidth);
2288
+ if (rel.techn && rel.techn.text !== "") {
2289
+ textLimitWidth = calculateTextWidth(rel.techn.text, relConf);
2290
+ calcC4ShapeTextWH("techn", rel, relTextWrap, relConf, textLimitWidth);
2291
+ }
2292
+ if (rel.descr && rel.descr.text !== "") {
2293
+ textLimitWidth = calculateTextWidth(rel.descr.text, relConf);
2294
+ calcC4ShapeTextWH("descr", rel, relTextWrap, relConf, textLimitWidth);
2295
+ }
2296
+ let fromNode = getC4ShapeObj(rel.from);
2297
+ let endNode = getC4ShapeObj(rel.to);
2298
+ let points = getIntersectPoints(fromNode, endNode);
2299
+ rel.startPoint = points.startPoint;
2300
+ rel.endPoint = points.endPoint;
2301
+ }
2302
+ svgDraw_default.drawRels(diagram2, rels2, conf, diagramId);
2303
+ }, "drawRels");
2304
+ function drawInsideBoundary(diagram2, parentBoundaryAlias, parentBounds, currentBoundaries, diagObj) {
2305
+ let currentBounds = new Bounds(diagObj);
2306
+ currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow2, currentBoundaries.length);
2307
+ for (let [i, currentBoundary] of currentBoundaries.entries()) {
2308
+ let Y = 0;
2309
+ currentBoundary.image = { width: 0, height: 0, Y: 0 };
2310
+ if (currentBoundary.sprite) {
2311
+ currentBoundary.image.width = 48;
2312
+ currentBoundary.image.height = 48;
2313
+ currentBoundary.image.Y = Y;
2314
+ Y = currentBoundary.image.Y + currentBoundary.image.height;
2315
+ }
2316
+ let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap;
2317
+ let currentBoundaryLabelConf = boundaryFont(conf);
2318
+ currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2;
2319
+ currentBoundaryLabelConf.fontWeight = "bold";
2320
+ calcC4ShapeTextWH(
2321
+ "label",
2322
+ currentBoundary,
2323
+ currentBoundaryTextWrap,
2324
+ currentBoundaryLabelConf,
2325
+ currentBounds.data.widthLimit
2326
+ );
2327
+ currentBoundary.label.Y = Y + 8;
2328
+ Y = currentBoundary.label.Y + currentBoundary.label.height;
2329
+ if (currentBoundary.type && currentBoundary.type.text !== "") {
2330
+ currentBoundary.type.text = "[" + currentBoundary.type.text + "]";
2331
+ let currentBoundaryTypeConf = boundaryFont(conf);
2332
+ calcC4ShapeTextWH(
2333
+ "type",
2334
+ currentBoundary,
2335
+ currentBoundaryTextWrap,
2336
+ currentBoundaryTypeConf,
2337
+ currentBounds.data.widthLimit
2338
+ );
2339
+ currentBoundary.type.Y = Y + 5;
2340
+ Y = currentBoundary.type.Y + currentBoundary.type.height;
2341
+ }
2342
+ if (currentBoundary.descr && currentBoundary.descr.text !== "") {
2343
+ let currentBoundaryDescrConf = boundaryFont(conf);
2344
+ currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2;
2345
+ calcC4ShapeTextWH(
2346
+ "descr",
2347
+ currentBoundary,
2348
+ currentBoundaryTextWrap,
2349
+ currentBoundaryDescrConf,
2350
+ currentBounds.data.widthLimit
2351
+ );
2352
+ currentBoundary.descr.Y = Y + 20;
2353
+ Y = currentBoundary.descr.Y + currentBoundary.descr.height;
2354
+ }
2355
+ if (i == 0 || i % c4BoundaryInRow2 === 0) {
2356
+ let _x = parentBounds.data.startx + conf.diagramMarginX;
2357
+ let _y = parentBounds.data.stopy + conf.diagramMarginY + Y;
2358
+ currentBounds.setData(_x, _x, _y, _y);
2359
+ } else {
2360
+ let _x = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx;
2361
+ let _y = currentBounds.data.starty;
2362
+ currentBounds.setData(_x, _x, _y, _y);
2363
+ }
2364
+ currentBounds.name = currentBoundary.alias;
2365
+ let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias);
2366
+ let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias);
2367
+ if (currentPersonOrSystemKeys.length > 0) {
2368
+ drawC4ShapeArray(
2369
+ currentBounds,
2370
+ diagram2,
2371
+ currentPersonOrSystemArray,
2372
+ currentPersonOrSystemKeys
2373
+ );
2374
+ }
2375
+ parentBoundaryAlias = currentBoundary.alias;
2376
+ let nextCurrentBoundaries = diagObj.db.getBoundaries(parentBoundaryAlias);
2377
+ if (nextCurrentBoundaries.length > 0) {
2378
+ drawInsideBoundary(
2379
+ diagram2,
2380
+ parentBoundaryAlias,
2381
+ currentBounds,
2382
+ nextCurrentBoundaries,
2383
+ diagObj
2384
+ );
2385
+ }
2386
+ if (currentBoundary.alias !== "global") {
2387
+ drawBoundary2(diagram2, currentBoundary, currentBounds);
2388
+ }
2389
+ parentBounds.data.stopy = Math.max(
2390
+ currentBounds.data.stopy + conf.c4ShapeMargin,
2391
+ parentBounds.data.stopy
2392
+ );
2393
+ parentBounds.data.stopx = Math.max(
2394
+ currentBounds.data.stopx + conf.c4ShapeMargin,
2395
+ parentBounds.data.stopx
2396
+ );
2397
+ globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx);
2398
+ globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy);
2399
+ }
2400
+ }
2401
+ __name(drawInsideBoundary, "drawInsideBoundary");
2402
+ var draw = /* @__PURE__ */ __name(function(_text, id, _version, diagObj) {
2403
+ conf = getConfig2().c4;
2404
+ const securityLevel = getConfig2().securityLevel;
2405
+ let sandboxElement;
2406
+ if (securityLevel === "sandbox") {
2407
+ sandboxElement = select("#i" + id);
2408
+ }
2409
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
2410
+ let db = diagObj.db;
2411
+ diagObj.db.setWrap(conf.wrap);
2412
+ c4ShapeInRow2 = db.getC4ShapeInRow();
2413
+ c4BoundaryInRow2 = db.getC4BoundaryInRow();
2414
+ log.debug(`C:${JSON.stringify(conf, null, 2)}`);
2415
+ const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
2416
+ svgDraw_default.insertComputerIcon(diagram2, id);
2417
+ svgDraw_default.insertDatabaseIcon(diagram2, id);
2418
+ svgDraw_default.insertClockIcon(diagram2, id);
2419
+ let screenBounds = new Bounds(diagObj);
2420
+ screenBounds.setData(
2421
+ conf.diagramMarginX,
2422
+ conf.diagramMarginX,
2423
+ conf.diagramMarginY,
2424
+ conf.diagramMarginY
2425
+ );
2426
+ screenBounds.data.widthLimit = screen.availWidth;
2427
+ globalBoundaryMaxX = conf.diagramMarginX;
2428
+ globalBoundaryMaxY = conf.diagramMarginY;
2429
+ const title2 = diagObj.db.getTitle();
2430
+ let currentBoundaries = diagObj.db.getBoundaries("");
2431
+ drawInsideBoundary(diagram2, "", screenBounds, currentBoundaries, diagObj);
2432
+ svgDraw_default.insertArrowHead(diagram2, id);
2433
+ svgDraw_default.insertArrowEnd(diagram2, id);
2434
+ svgDraw_default.insertArrowCrossHead(diagram2, id);
2435
+ svgDraw_default.insertArrowFilledHead(diagram2, id);
2436
+ drawRels2(diagram2, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj, id);
2437
+ screenBounds.data.stopx = globalBoundaryMaxX;
2438
+ screenBounds.data.stopy = globalBoundaryMaxY;
2439
+ const box = screenBounds.data;
2440
+ let boxHeight = box.stopy - box.starty;
2441
+ let height = boxHeight + 2 * conf.diagramMarginY;
2442
+ let boxWidth = box.stopx - box.startx;
2443
+ const width = boxWidth + 2 * conf.diagramMarginX;
2444
+ if (title2) {
2445
+ diagram2.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr("y", box.starty + conf.diagramMarginY);
2446
+ }
2447
+ configureSvgSize(diagram2, height, width, conf.useMaxWidth);
2448
+ const extraVertForTitle = title2 ? 60 : 0;
2449
+ diagram2.attr(
2450
+ "viewBox",
2451
+ box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle)
2452
+ );
2453
+ log.debug(`models:`, box);
2454
+ }, "draw");
2455
+ var c4Renderer_default = {
2456
+ drawPersonOrSystemArray: drawC4ShapeArray,
2457
+ drawBoundary: drawBoundary2,
2458
+ setConf,
2459
+ draw
2460
+ };
2461
+ var getStyles = /* @__PURE__ */ __name((options) => `.person {
2462
+ stroke: ${options.personBorder};
2463
+ fill: ${options.personBkg};
2464
+ }
2465
+ `, "getStyles");
2466
+ var styles_default = getStyles;
2467
+ var diagram = {
2468
+ parser: c4Diagram_default,
2469
+ db: c4Db_default,
2470
+ renderer: c4Renderer_default,
2471
+ styles: styles_default,
2472
+ init: /* @__PURE__ */ __name(({ c4, wrap }) => {
2473
+ c4Renderer_default.setConf(c4);
2474
+ c4Db_default.setWrap(wrap);
2475
+ }, "init")
2476
+ };
2477
+ export {
2478
+ diagram
2479
+ };