UNPKG

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