UNPKG

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