@zombie-mermaid/svg-renderer 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2994 @@
1
+ import e from "elkjs/lib/elk.bundled.js";
2
+ import { buildStyleBlock as t, escapeAttr as n, escapeXml as r, formatCssColor as i, getReadableTextColor as a, measureMultilineText as o, measureTextWidth as s, mixSrgb as c, parseCssColor as l, renderMultilineText as u, renderMultilineTextWithBackground as d, resolveNodeStyle as f, safeHref as p, sanitizeClassName as m, styleOpenTag as h, svgOpenTag as g } from "@zombie-mermaid/core";
3
+ import { CHART_ACCENT_FALLBACK as _, formatClassMember as v, getSeriesColor as y } from "@zombie-mermaid/mermaid-parser";
4
+ //#region packages/svg-renderer/src/edge-curves.ts
5
+ function b(e) {
6
+ return `M ${e.x} ${e.y}`;
7
+ }
8
+ function x(e) {
9
+ return b(e[0]) + e.slice(1).map((e) => ` L ${e.x} ${e.y}`).join("");
10
+ }
11
+ function S(e) {
12
+ if (e.length < 3) return x(e);
13
+ let t = e[e.length - 1], n = [b(e[0])], r = (e, t, n) => ` C ${(2 * e.x + t.x) / 3} ${(2 * e.y + t.y) / 3}, ${(e.x + 2 * t.x) / 3} ${(e.y + 2 * t.y) / 3}, ${(e.x + 4 * t.x + n.x) / 6} ${(e.y + 4 * t.y + n.y) / 6}`;
14
+ n.push(` L ${(5 * e[0].x + e[1].x) / 6} ${(5 * e[0].y + e[1].y) / 6}`);
15
+ for (let t = 2; t < e.length; t++) n.push(r(e[t - 2], e[t - 1], e[t]));
16
+ return n.push(r(e[e.length - 2], t, t)), n.push(` L ${t.x} ${t.y}`), n.join("");
17
+ }
18
+ function C(e) {
19
+ if (e.length < 3) return x(e);
20
+ let t = [b(e[0])];
21
+ for (let n = 1; n < e.length - 1; n++) {
22
+ let r = e[n - 1], i = e[n], a = e[n + 1], o = Math.hypot(i.x - r.x, i.y - r.y), s = Math.hypot(a.x - i.x, a.y - i.y);
23
+ if (o === 0 || s === 0) {
24
+ t.push(` L ${i.x} ${i.y}`);
25
+ continue;
26
+ }
27
+ let c = Math.min(12, o / 2, s / 2), l = i.x - (i.x - r.x) / o * c, u = i.y - (i.y - r.y) / o * c, d = i.x + (a.x - i.x) / s * c, f = i.y + (a.y - i.y) / s * c;
28
+ t.push(` L ${l} ${u}`), t.push(` Q ${i.x} ${i.y}, ${d} ${f}`);
29
+ }
30
+ let n = e[e.length - 1];
31
+ return t.push(` L ${n.x} ${n.y}`), t.join("");
32
+ }
33
+ function w(e, t) {
34
+ let n = [b(e[0])], r = e.length - 1;
35
+ for (let i = 0; i < r; i++) {
36
+ let a = e[i], o = e[i + 1];
37
+ if (i === r - 1) {
38
+ n.push(` L ${o.x} ${o.y}`);
39
+ break;
40
+ }
41
+ if (t === "before") n.push(` L ${a.x} ${o.y} L ${o.x} ${o.y}`);
42
+ else if (t === "after") n.push(` L ${o.x} ${a.y} L ${o.x} ${o.y}`);
43
+ else {
44
+ let e = (a.y + o.y) / 2;
45
+ n.push(` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`);
46
+ }
47
+ }
48
+ return n.join("");
49
+ }
50
+ function T(e, t = "linear") {
51
+ if (e.length === 0) return "";
52
+ if (e.length === 1) return b(e[0]);
53
+ switch (t) {
54
+ case "basis": return S(e);
55
+ case "natural": return C(e);
56
+ case "step": return w(e, "mid");
57
+ case "stepBefore": return w(e, "before");
58
+ case "stepAfter": return w(e, "after");
59
+ default: return x(e);
60
+ }
61
+ }
62
+ //#endregion
63
+ //#region packages/svg-renderer/src/elk-instance.ts
64
+ var E = null, D = null, O = 20;
65
+ function k(e = O) {
66
+ if (!Number.isInteger(e) || e < 1) throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);
67
+ return {
68
+ map: /* @__PURE__ */ new Map(),
69
+ maxSize: e
70
+ };
71
+ }
72
+ function A(e) {
73
+ if (Array.isArray(e)) return `[${e.map(A).join(",")}]`;
74
+ if (typeof e == "object" && e) {
75
+ let t = e;
76
+ return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${A(t[e])}`).join(",")}}`;
77
+ }
78
+ return JSON.stringify(e);
79
+ }
80
+ function j() {
81
+ if (E && D) return D;
82
+ let t = [], n = globalThis.setTimeout;
83
+ globalThis.setTimeout = (e, r) => r === 0 ? (t.push(e), 0) : n(e, r);
84
+ let r = globalThis, i = "self" in r, a = r.self;
85
+ if (i && r.document === void 0 && delete r.self, E = new e(), !E) throw Error("ELKBundled construction unexpectedly produced no instance");
86
+ return i && (r.self = a), globalThis.setTimeout = n, t.forEach((e) => e()), D = E.worker.worker, D;
87
+ }
88
+ function M(e, t) {
89
+ let n = t, r = n ? A(e) : void 0;
90
+ if (n && r !== void 0) {
91
+ let e = n.map.get(r);
92
+ if (e) return n.map.delete(r), n.map.set(r, e), e;
93
+ }
94
+ let i = j(), a, o, s = i.onmessage;
95
+ if (i.onmessage = (e) => {
96
+ e.data.error ? o = e.data.error : a = e.data.data;
97
+ }, i.dispatcher.saveDispatch({ data: {
98
+ id: 0,
99
+ cmd: "layout",
100
+ graph: e
101
+ } }), i.onmessage = s, o) throw o;
102
+ if (!a) throw Error("ELK layout did not return synchronously");
103
+ if (n && r !== void 0 && (n.map.set(r, a), n.map.size > n.maxSize)) {
104
+ let e = n.map.keys().next().value;
105
+ e !== void 0 && n.map.delete(e);
106
+ }
107
+ return a;
108
+ }
109
+ //#endregion
110
+ //#region packages/svg-renderer/src/styles.ts
111
+ function N(e, t, n) {
112
+ return s(e, t, n);
113
+ }
114
+ function P(e, t) {
115
+ return e.length * t * .6;
116
+ }
117
+ var ee = "'JetBrains Mono'", te = `${ee}, 'SF Mono', 'Fira Code', ui-monospace, monospace`, F = {
118
+ nodeLabel: 13,
119
+ edgeLabel: 11,
120
+ groupHeader: 12
121
+ };
122
+ function I(e) {
123
+ return {
124
+ nodeLabel: e?.nodeLabel ?? F.nodeLabel,
125
+ edgeLabel: e?.edgeLabel ?? F.edgeLabel,
126
+ groupHeader: e?.groupHeader ?? F.groupHeader
127
+ };
128
+ }
129
+ var L = {
130
+ nodeLabel: 500,
131
+ edgeLabel: 400,
132
+ groupHeader: 600
133
+ }, ne = 12, R = {
134
+ horizontal: 20,
135
+ vertical: 10,
136
+ diamondExtra: 24
137
+ }, z = {
138
+ outerBox: 1,
139
+ innerBox: .75,
140
+ connector: 1
141
+ }, B = "0.35em", V = {
142
+ width: 8,
143
+ height: 5
144
+ }, re = {
145
+ font: "Inter",
146
+ padding: 40,
147
+ nodeSpacing: 28,
148
+ layerSpacing: 48,
149
+ mergeEdges: !0,
150
+ thoroughness: 3,
151
+ fontSizes: F
152
+ }, ie = {
153
+ flowchart: "DOWN",
154
+ state: "DOWN",
155
+ class: "DOWN",
156
+ er: "RIGHT"
157
+ };
158
+ function ae(e, t) {
159
+ switch (e) {
160
+ case "LR": return "RIGHT";
161
+ case "RL": return "LEFT";
162
+ case "BT": return "UP";
163
+ case "TD":
164
+ case "TB": return "DOWN";
165
+ default: return t;
166
+ }
167
+ }
168
+ function oe(e) {
169
+ let t = typeof e == "number" ? {
170
+ top: e,
171
+ left: e,
172
+ bottom: e,
173
+ right: e
174
+ } : e;
175
+ return `[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`;
176
+ }
177
+ function se(e) {
178
+ return {
179
+ "elk.algorithm": "layered",
180
+ "elk.direction": e.direction,
181
+ "elk.spacing.nodeNode": String(e.nodeSpacing),
182
+ "elk.layered.spacing.nodeNodeBetweenLayers": String(e.layerSpacing),
183
+ "elk.padding": oe(e.padding),
184
+ "elk.edgeRouting": "ORTHOGONAL"
185
+ };
186
+ }
187
+ function H(e, t, n) {
188
+ let r = {
189
+ id: e,
190
+ width: t.width,
191
+ height: t.height
192
+ };
193
+ return n !== void 0 && (r.labels = [{ text: n }]), r;
194
+ }
195
+ var ce = {
196
+ "elk.edgeLabels.inline": "true",
197
+ "elk.edgeLabels.placement": "CENTER"
198
+ };
199
+ function le(e, t) {
200
+ let n = o(e, t.fontSize, L.edgeLabel), r = {
201
+ text: e,
202
+ width: n.width + 8,
203
+ height: n.height + 6
204
+ };
205
+ return t.layoutOptions && (r.layoutOptions = { ...t.layoutOptions }), r;
206
+ }
207
+ function U(e) {
208
+ let t = {
209
+ id: e.id,
210
+ sources: [e.source],
211
+ targets: [e.target]
212
+ };
213
+ return e.label && (t.labels = [le(e.label, e.labelStyle)]), t;
214
+ }
215
+ //#endregion
216
+ //#region packages/svg-renderer/src/layout-engine/to-elk.ts
217
+ function ue(e) {
218
+ return ae(e, ie.flowchart);
219
+ }
220
+ function de(e) {
221
+ return {
222
+ ...se(e),
223
+ "elk.spacing.edgeEdge": "12",
224
+ "elk.layered.spacing.edgeEdgeBetweenLayers": "12",
225
+ "elk.layered.spacing.edgeNodeBetweenLayers": "12",
226
+ "elk.layered.nodePlacement.bk.fixedAlignment": "BALANCED",
227
+ "elk.contentAlignment": "H_CENTER V_CENTER"
228
+ };
229
+ }
230
+ function fe(e) {
231
+ return {
232
+ fontSize: e.fontSizes.edgeLabel,
233
+ layoutOptions: ce
234
+ };
235
+ }
236
+ function pe(e, t, n, r) {
237
+ let i = o(t, r, L.nodeLabel), a = i.width + R.horizontal * 2, s = i.height + R.vertical * 2;
238
+ if (n === "diamond") {
239
+ let e = Math.max(a, s) + R.diamondExtra;
240
+ a = e, s = e;
241
+ }
242
+ if (n === "circle" || n === "doublecircle") {
243
+ let e = Math.ceil(Math.sqrt(a * a + s * s)) + 8;
244
+ a = n === "doublecircle" ? e + 12 : e, s = a;
245
+ }
246
+ return n === "hexagon" && (a += R.horizontal), (n === "trapezoid" || n === "trapezoid-alt" || n === "parallelogram" || n === "parallelogram-alt") && (a += R.horizontal), n === "asymmetric" && (a += 12), n === "cylinder" && (s += 14), n === "state-start" || n === "state-end" ? {
247
+ width: 28,
248
+ height: 28
249
+ } : (a = Math.max(a, 60), s = Math.max(s, 36), {
250
+ width: a,
251
+ height: s
252
+ });
253
+ }
254
+ var me = " root";
255
+ function he(e) {
256
+ for (let t of e) if (t.direction !== void 0 || he(t.children)) return !0;
257
+ return !1;
258
+ }
259
+ function ge(e, t) {
260
+ for (let n of e.nodeIds) t.add(n);
261
+ for (let n of e.children) ge(n, t);
262
+ }
263
+ function _e(e, t) {
264
+ let n = /* @__PURE__ */ new Set();
265
+ if (ge(e, n), n.size === 0) return !0;
266
+ let r = (t) => n.has(t) || t === e.id;
267
+ return !t.edges.some((e) => r(e.source) !== r(e.target));
268
+ }
269
+ function ve(e) {
270
+ let t = /* @__PURE__ */ new Map();
271
+ function n(e, r) {
272
+ let i = [...r, e.id];
273
+ t.set(e.id, i);
274
+ for (let t of e.children) n(t, i);
275
+ }
276
+ for (let t of e) n(t, []);
277
+ return t;
278
+ }
279
+ function ye(e, t) {
280
+ let n = 0;
281
+ for (; n < e.length && n < t.length && e[n] === t[n];) n++;
282
+ return n;
283
+ }
284
+ function be(e, t) {
285
+ let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
286
+ for (let t of e.subgraphs) r.add(t.id), Se(t, n, r);
287
+ let i = Ce(e.subgraphs), a = ve(e.subgraphs), o = (e) => e ? a.get(e) ?? [] : [], s = /* @__PURE__ */ new Map();
288
+ s.set(null, []);
289
+ let c = [];
290
+ for (let t = 0; t < e.edges.length; t++) {
291
+ let n = e.edges[t], r = i.get(n.source), a = i.get(n.target);
292
+ if (r && r === a) {
293
+ let e = s.get(r) ?? [];
294
+ s.set(r, e), e.push({
295
+ index: t,
296
+ edge: n
297
+ });
298
+ } else !r && !a ? s.get(null).push({
299
+ index: t,
300
+ edge: n
301
+ }) : c.push({
302
+ index: t,
303
+ edge: n,
304
+ srcChain: o(r),
305
+ tgtChain: o(a)
306
+ });
307
+ }
308
+ let l = he(e.subgraphs), u = [], d = [], f = {
309
+ ...de({
310
+ direction: ue(e.direction),
311
+ nodeSpacing: t.nodeSpacing,
312
+ layerSpacing: t.layerSpacing,
313
+ padding: t.padding
314
+ }),
315
+ "elk.layered.thoroughness": String(re.thoroughness),
316
+ "elk.layered.highDegreeNodes.treatment": "true",
317
+ "elk.layered.highDegreeNodes.threshold": "8",
318
+ "elk.layered.compaction.postCompaction.strategy": "LEFT_RIGHT_CONSTRAINT_LOCKING",
319
+ "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
320
+ "elk.layered.wrapping.strategy": "OFF",
321
+ "elk.hierarchyHandling": l ? "SEPARATE" : "INCLUDE_CHILDREN"
322
+ }, p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
323
+ function h(e, t) {
324
+ let n = p.get(e) ?? /* @__PURE__ */ new Set();
325
+ p.set(e, n), n.add(t);
326
+ }
327
+ function g(e, t) {
328
+ let n = m.get(e) ?? [];
329
+ m.set(e, n), n.push(t);
330
+ }
331
+ if (l) for (let { index: e, edge: n, srcChain: r, tgtChain: i } of c) {
332
+ let a = ye(r, i), o = n.source;
333
+ if (r.length > a) {
334
+ for (let t = r.length - 1; t >= a; t--) {
335
+ let i = r[t], a = `${i}_out_${e}`;
336
+ h(i, a);
337
+ let o = t === r.length - 1 ? n.source : `${r[t + 1]}_out_${e}`;
338
+ g(i, {
339
+ id: `e${e}_s${t}`,
340
+ sources: [o],
341
+ targets: [a]
342
+ });
343
+ }
344
+ o = `${r[a]}_out_${e}`;
345
+ }
346
+ let s = n.target;
347
+ if (i.length > a) {
348
+ for (let t = a; t <= i.length - 1; t++) {
349
+ let r = i[t], a = `${r}_in_${e}`;
350
+ h(r, a);
351
+ let o = t === i.length - 1 ? n.target : `${i[t + 1]}_in_${e}`;
352
+ g(r, {
353
+ id: `e${e}_t${t}`,
354
+ sources: [a],
355
+ targets: [o]
356
+ });
357
+ }
358
+ s = `${i[a]}_in_${e}`;
359
+ }
360
+ g(a > 0 ? r[a - 1] : me, U({
361
+ id: `e${e}`,
362
+ source: o,
363
+ target: s,
364
+ label: n.label,
365
+ labelStyle: fe(t)
366
+ }));
367
+ }
368
+ for (let [i, a] of e.nodes) if (!n.has(i) && !r.has(i)) {
369
+ let e = pe(i, a.label, a.shape, t.fontSizes.nodeLabel);
370
+ u.push(H(i, e, a.label));
371
+ }
372
+ for (let n of [...e.subgraphs].reverse()) u.push(xe(n, e, t, s, p, m, e.direction));
373
+ for (let { index: e, edge: n } of s.get(null)) n.source !== n.target && d.push(U({
374
+ id: `e${e}`,
375
+ source: n.source,
376
+ target: n.target,
377
+ label: n.label,
378
+ labelStyle: fe(t)
379
+ }));
380
+ if (l) for (let e of m.get(me) ?? []) d.push(e);
381
+ else for (let { index: e, edge: n } of c) d.push(U({
382
+ id: `e${e}`,
383
+ source: n.source,
384
+ target: n.target,
385
+ label: n.label,
386
+ labelStyle: fe(t)
387
+ }));
388
+ return {
389
+ id: "root",
390
+ layoutOptions: f,
391
+ children: u,
392
+ edges: d
393
+ };
394
+ }
395
+ function xe(e, t, n, r, i, a, o) {
396
+ let s = e.direction !== void 0 && _e(e, t) ? e.direction : o, c = de({
397
+ direction: ue(s),
398
+ nodeSpacing: n.nodeSpacing,
399
+ layerSpacing: n.layerSpacing,
400
+ padding: {
401
+ top: 44,
402
+ left: 16,
403
+ bottom: 16,
404
+ right: 16
405
+ }
406
+ }), l, u = i.get(e.id);
407
+ u && u.size > 0 && (l = [...u].map((e) => ({ id: e })));
408
+ let d = [];
409
+ for (let r of e.nodeIds) {
410
+ let e = t.nodes.get(r);
411
+ if (e) {
412
+ let t = pe(r, e.label, e.shape, n.fontSizes.nodeLabel);
413
+ d.push(H(r, t, e.label));
414
+ }
415
+ }
416
+ for (let o of [...e.children].reverse()) d.push(xe(o, t, n, r, i, a, s));
417
+ let f = [], p = r.get(e.id) ?? [];
418
+ for (let { index: e, edge: t } of p) t.source !== t.target && f.push(U({
419
+ id: `e${e}`,
420
+ source: t.source,
421
+ target: t.target,
422
+ label: t.label,
423
+ labelStyle: fe(n)
424
+ }));
425
+ for (let t of a.get(e.id) ?? []) f.push(t);
426
+ return {
427
+ id: e.id,
428
+ layoutOptions: c,
429
+ labels: e.label ? [{ text: e.label }] : void 0,
430
+ ports: l,
431
+ children: d,
432
+ edges: f
433
+ };
434
+ }
435
+ function Se(e, t, n) {
436
+ for (let n of e.nodeIds) t.add(n);
437
+ for (let r of e.children) n.add(r.id), Se(r, t, n);
438
+ }
439
+ function Ce(e) {
440
+ let t = /* @__PURE__ */ new Map();
441
+ function n(e) {
442
+ for (let n of e.nodeIds) t.set(n, e.id);
443
+ for (let t of e.children) n(t);
444
+ }
445
+ for (let t of e) n(t);
446
+ return t;
447
+ }
448
+ //#endregion
449
+ //#region packages/svg-renderer/src/shape-clipping.ts
450
+ function we(e, t, n) {
451
+ if (e.length < 2 || t.shape === "rectangle" || t.shape === "rounded" || t.shape === "stadium") return e;
452
+ let r = [...e];
453
+ if (t.shape === "diamond") {
454
+ if (n) r[0] = Te(e[0], e[1], t);
455
+ else {
456
+ let n = e.length - 1;
457
+ r[n] = Te(e[n], e[n - 1], t);
458
+ }
459
+ }
460
+ return r;
461
+ }
462
+ function Te(e, t, n) {
463
+ let r = n.x + n.width / 2, i = n.y + n.height / 2, a = {
464
+ x: r,
465
+ y: n.y
466
+ }, o = {
467
+ x: n.x + n.width,
468
+ y: i
469
+ }, s = {
470
+ x: r,
471
+ y: n.y + n.height
472
+ }, c = {
473
+ x: n.x,
474
+ y: i
475
+ }, l = e.x - t.x, u = e.y - t.y;
476
+ if (Math.abs(l) < Math.abs(u)) {
477
+ let t = e.x;
478
+ return u > 0 ? t <= r ? De(t, c, a) ?? a : De(t, a, o) ?? a : t <= r ? De(t, s, c) ?? s : De(t, o, s) ?? s;
479
+ }
480
+ {
481
+ let t = e.y;
482
+ return l > 0 ? t <= i ? Ee(t, a, c) ?? c : Ee(t, c, s) ?? c : t <= i ? Ee(t, a, o) ?? o : Ee(t, o, s) ?? o;
483
+ }
484
+ }
485
+ function Ee(e, t, n) {
486
+ let r = n.y - t.y;
487
+ if (Math.abs(r) < .001) return null;
488
+ let i = (e - t.y) / r;
489
+ return i < 0 || i > 1 ? null : {
490
+ x: t.x + i * (n.x - t.x),
491
+ y: e
492
+ };
493
+ }
494
+ function De(e, t, n) {
495
+ let r = n.x - t.x;
496
+ if (Math.abs(r) < .001) return null;
497
+ let i = (e - t.x) / r;
498
+ return i < 0 || i > 1 ? null : {
499
+ x: e,
500
+ y: t.y + i * (n.y - t.y)
501
+ };
502
+ }
503
+ //#endregion
504
+ //#region packages/svg-renderer/src/layout-engine/layer-alignment.ts
505
+ function Oe(e, t, n) {
506
+ if (e.length === 0) return;
507
+ let r = n === "LR" || n === "RL", i = /* @__PURE__ */ new Set();
508
+ for (let e of t) i.add(`${e.source}:${e.target}`), i.add(`${e.target}:${e.source}`);
509
+ let a = re.layerSpacing * .6, o = [...e].sort((e, t) => r ? e.x - t.x : e.y - t.y), s = [], c = [o[0]];
510
+ for (let e = 1; e < o.length; e++) {
511
+ let t = (r ? o[e].x : o[e].y) - (r ? o[e - 1].x : o[e - 1].y), n = c.some((t) => i.has(`${t.id}:${o[e].id}`));
512
+ t <= a && !n ? c.push(o[e]) : (s.push(c), c = [o[e]]);
513
+ }
514
+ s.push(c);
515
+ let l = /* @__PURE__ */ new Map();
516
+ for (let e of s) {
517
+ if (e.length <= 1) continue;
518
+ let t = e.map((e) => r ? e.x : e.y), n = Math.min(...t), i = Math.max(...t);
519
+ if (i - n <= 1) continue;
520
+ let a = (n + i) / 2;
521
+ for (let t of e) {
522
+ let e = a - (r ? t.x : t.y);
523
+ Math.abs(e) > .5 && (r ? t.x = a : t.y = a, l.set(t.id, e));
524
+ }
525
+ }
526
+ if (l.size !== 0) for (let e of t) {
527
+ if (e.points.length < 2) continue;
528
+ let t = l.get(e.source), n = l.get(e.target);
529
+ if (t != null) {
530
+ let n = e.points[0];
531
+ r ? (n.x += t, e.points.length > 1 && e.points[1].x === n.x - t && (e.points[1].x += t)) : (n.y += t, e.points.length > 1 && e.points[1].y === n.y - t && (e.points[1].y += t));
532
+ }
533
+ if (n != null) {
534
+ let t = e.points[e.points.length - 1];
535
+ if (r) {
536
+ if (t.x += n, e.points.length > 1) {
537
+ let r = e.points[e.points.length - 2];
538
+ r.x === t.x - n && (r.x += n);
539
+ }
540
+ } else if (t.y += n, e.points.length > 1) {
541
+ let r = e.points[e.points.length - 2];
542
+ r.y === t.y - n && (r.y += n);
543
+ }
544
+ }
545
+ }
546
+ }
547
+ //#endregion
548
+ //#region packages/svg-renderer/src/layout-engine/edge-bundling.ts
549
+ var ke = .5;
550
+ function Ae(e, t, n) {
551
+ for (let r = 0; r < e.length - 1; r++) {
552
+ let i = e[r], a = e[r + 1], o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y);
553
+ for (let e of t) {
554
+ if (n.has(e.id)) continue;
555
+ let t = e.x + ke, r = e.x + e.width - ke, i = e.y + ke, a = e.y + e.height - ke;
556
+ if (!(t >= r || i >= a) && o < r && s > t && c < a && l > i) return !1;
557
+ }
558
+ }
559
+ return !0;
560
+ }
561
+ function je(e, t, n) {
562
+ let r = [];
563
+ for (let i of n) e >= i.x && e <= i.x + i.width && t >= i.y && t <= i.y + i.height && (r.push(i), r.push(...je(e, t, i.children)));
564
+ return r;
565
+ }
566
+ function Me(e, t, n, r, i) {
567
+ let a = i === "LR", o = i === "RL", s = i === "BT", c = a || o, l = new Set(je(t, n, r).map((e) => e.id)), u = je(c ? e : t, c ? n : e, r).find((e) => !l.has(e.id));
568
+ return u ? a ? u.x - 12 : o ? u.x + u.width + 12 : s ? u.y + u.height + 12 : u.y - 12 : e;
569
+ }
570
+ function Ne(e, t, n, r) {
571
+ let i = new Map(t.map((e) => [e.id, e])), a = /* @__PURE__ */ new Set(), o = r === "LR", s = r === "RL", c = r === "BT", l = o || s, u = /* @__PURE__ */ new Map();
572
+ for (let t of e) {
573
+ if (t.source === t.target) continue;
574
+ let e = u.get(t.source) ?? [];
575
+ u.set(t.source, e), e.push(t);
576
+ }
577
+ for (let [e, d] of u) {
578
+ if (d.length < 2) continue;
579
+ let u = d[0].style;
580
+ if (d.some((e) => e.label || e.style !== u)) continue;
581
+ let f = i.get(e);
582
+ if (!f) continue;
583
+ let p = [];
584
+ for (let e of d) {
585
+ let t = i.get(e.target);
586
+ t && (o ? t.x > f.x + f.width : s ? t.x + t.width < f.x : c ? t.y + t.height < f.y : t.y > f.y + f.height) && p.push({
587
+ edge: e,
588
+ node: t
589
+ });
590
+ }
591
+ if (p.length < 2) continue;
592
+ let m = f.x + f.width / 2, h = f.y + f.height / 2;
593
+ if (l) {
594
+ let i = o ? f.x + f.width : f.x, s = h, c = i + ((o ? Math.min(...p.map((e) => e.node.x)) : Math.max(...p.map((e) => e.node.x + e.node.width))) - i) / 2;
595
+ c = Me(c, m, h, n, r);
596
+ let l = [];
597
+ for (let { edge: n, node: r } of p) {
598
+ let a = o ? r.x : r.x + r.width, u = r.y + r.height / 2, d = [
599
+ {
600
+ x: i,
601
+ y: s
602
+ },
603
+ {
604
+ x: c,
605
+ y: s
606
+ },
607
+ {
608
+ x: c,
609
+ y: u
610
+ },
611
+ {
612
+ x: a,
613
+ y: u
614
+ }
615
+ ];
616
+ Ae(d, t, /* @__PURE__ */ new Set([e, r.id])) && l.push({
617
+ edge: n,
618
+ points: d
619
+ });
620
+ }
621
+ if (l.length < 2) continue;
622
+ for (let { edge: e, points: t } of l) e.points = t, a.add(e);
623
+ } else {
624
+ let i = m, o = c ? f.y : f.y + f.height, s = o + ((c ? Math.max(...p.map((e) => e.node.y + e.node.height)) : Math.min(...p.map((e) => e.node.y))) - o) / 2;
625
+ s = Me(s, m, h, n, r);
626
+ let l = [];
627
+ for (let { edge: n, node: r } of p) {
628
+ let a = r.x + r.width / 2, u = c ? r.y + r.height : r.y, d = [
629
+ {
630
+ x: i,
631
+ y: o
632
+ },
633
+ {
634
+ x: i,
635
+ y: s
636
+ },
637
+ {
638
+ x: a,
639
+ y: s
640
+ },
641
+ {
642
+ x: a,
643
+ y: u
644
+ }
645
+ ];
646
+ Ae(d, t, /* @__PURE__ */ new Set([e, r.id])) && l.push({
647
+ edge: n,
648
+ points: d
649
+ });
650
+ }
651
+ if (l.length < 2) continue;
652
+ for (let { edge: e, points: t } of l) e.points = t, a.add(e);
653
+ }
654
+ }
655
+ let d = /* @__PURE__ */ new Map();
656
+ for (let t of e) {
657
+ if (a.has(t) || t.source === t.target) continue;
658
+ let e = d.get(t.target) ?? [];
659
+ d.set(t.target, e), e.push(t);
660
+ }
661
+ for (let [e, a] of d) {
662
+ if (a.length < 2) continue;
663
+ let u = a[0].style;
664
+ if (a.some((e) => e.label || e.style !== u)) continue;
665
+ let d = i.get(e);
666
+ if (!d) continue;
667
+ let f = [];
668
+ for (let e of a) {
669
+ let t = i.get(e.source);
670
+ t && (o ? t.x + t.width < d.x : s ? t.x > d.x + d.width : c ? t.y > d.y + d.height : t.y + t.height < d.y) && f.push({
671
+ edge: e,
672
+ node: t
673
+ });
674
+ }
675
+ if (f.length < 2) continue;
676
+ let p = d.x + d.width / 2, m = d.y + d.height / 2;
677
+ if (l) {
678
+ let i = o ? d.x : d.x + d.width, a = m, s = o ? Math.max(...f.map((e) => e.node.x + e.node.width)) : Math.min(...f.map((e) => e.node.x)), c = s + (i - s) / 2;
679
+ c = Me(c, p, m, n, r);
680
+ let l = [];
681
+ for (let { edge: n, node: r } of f) {
682
+ let s = o ? r.x + r.width : r.x, u = r.y + r.height / 2, d = [
683
+ {
684
+ x: s,
685
+ y: u
686
+ },
687
+ {
688
+ x: c,
689
+ y: u
690
+ },
691
+ {
692
+ x: c,
693
+ y: a
694
+ },
695
+ {
696
+ x: i,
697
+ y: a
698
+ }
699
+ ];
700
+ Ae(d, t, /* @__PURE__ */ new Set([r.id, e])) && l.push({
701
+ edge: n,
702
+ points: d
703
+ });
704
+ }
705
+ if (l.length < 2) continue;
706
+ for (let { edge: e, points: t } of l) e.points = t;
707
+ } else {
708
+ let i = p, a = c ? d.y + d.height : d.y, o = c ? Math.min(...f.map((e) => e.node.y)) : Math.max(...f.map((e) => e.node.y + e.node.height)), s = o + (a - o) / 2;
709
+ s = Me(s, p, m, n, r);
710
+ let l = [];
711
+ for (let { edge: n, node: r } of f) {
712
+ let o = r.x + r.width / 2, u = [
713
+ {
714
+ x: o,
715
+ y: c ? r.y : r.y + r.height
716
+ },
717
+ {
718
+ x: o,
719
+ y: s
720
+ },
721
+ {
722
+ x: i,
723
+ y: s
724
+ },
725
+ {
726
+ x: i,
727
+ y: a
728
+ }
729
+ ];
730
+ Ae(u, t, /* @__PURE__ */ new Set([r.id, e])) && l.push({
731
+ edge: n,
732
+ points: u
733
+ });
734
+ }
735
+ if (l.length < 2) continue;
736
+ for (let { edge: e, points: t } of l) e.points = t;
737
+ }
738
+ }
739
+ }
740
+ //#endregion
741
+ //#region packages/svg-renderer/src/layout-engine/elk-adapter-utils.ts
742
+ function Pe(e, t = 0, n = 0) {
743
+ let r = [];
744
+ if (!e.sections || e.sections.length === 0) return r;
745
+ let i = e.sections[0];
746
+ if (r.push({
747
+ x: i.startPoint.x + t,
748
+ y: i.startPoint.y + n
749
+ }), i.bendPoints) for (let e of i.bendPoints) r.push({
750
+ x: e.x + t,
751
+ y: e.y + n
752
+ });
753
+ return r.push({
754
+ x: i.endPoint.x + t,
755
+ y: i.endPoint.y + n
756
+ }), r;
757
+ }
758
+ function Fe(e, t = 0, n = 0) {
759
+ if (!e.labels || e.labels.length === 0) return;
760
+ let r = e.labels[0];
761
+ if (r.x != null && r.y != null) return {
762
+ x: r.x + (r.width ?? 0) / 2 + t,
763
+ y: r.y + (r.height ?? 0) / 2 + n
764
+ };
765
+ }
766
+ //#endregion
767
+ //#region packages/svg-renderer/src/layout-engine/from-elk.ts
768
+ var Ie = 16, Le = 28, Re = 18, ze = 28, Be = 10;
769
+ function Ve(e, t) {
770
+ let n = e.x + e.width, r = e.y + e.height / 2, i = Math.min(ze, e.height * .6) / 2, a = Le + t * Re, o = [];
771
+ for (let e = 0; e <= Ie; e++) {
772
+ let t = Math.PI * e / Ie;
773
+ o.push({
774
+ x: n + a * Math.sin(t),
775
+ y: r - i * Math.cos(t)
776
+ });
777
+ }
778
+ return {
779
+ points: o,
780
+ labelPosition: {
781
+ x: n + a + Be,
782
+ y: r
783
+ }
784
+ };
785
+ }
786
+ function He(e, t, n) {
787
+ let r = /* @__PURE__ */ new Map();
788
+ for (let i = 0; i < e.edges.length; i++) {
789
+ let a = e.edges[i];
790
+ if (a.source !== a.target) continue;
791
+ let o = t.get(a.source);
792
+ if (!o) continue;
793
+ let s = r.get(o.id) ?? 0;
794
+ r.set(o.id, s + 1);
795
+ let { points: c, labelPosition: l } = Ve(o, s);
796
+ n.push({
797
+ source: a.source,
798
+ target: a.target,
799
+ label: a.label,
800
+ style: a.style,
801
+ hasArrowStart: a.hasArrowStart,
802
+ hasArrowEnd: a.hasArrowEnd,
803
+ points: c,
804
+ labelPosition: a.label ? l : void 0,
805
+ inlineStyle: $e(i, e),
806
+ id: a.id,
807
+ animate: a.animate
808
+ });
809
+ }
810
+ }
811
+ function Ue(e) {
812
+ let t = [];
813
+ for (let n of e) t.push({
814
+ x: n.x,
815
+ y: n.y,
816
+ right: n.x + n.width,
817
+ bottom: n.y + n.height
818
+ }), t.push(...Ue(n.children));
819
+ return t;
820
+ }
821
+ function We(e, t, n = !1) {
822
+ let r = [], i = [], a = [], o = /* @__PURE__ */ new Set();
823
+ for (let e of t.subgraphs) Qe(e, o);
824
+ Ge(e, t, o, r, a, 0, 0);
825
+ let s = Ue(a);
826
+ Je(e, t, i, 0, 0, s.length > 0 ? {
827
+ leftX: Math.min(...s.map((e) => e.x)) - 20,
828
+ rightX: Math.max(...s.map((e) => e.right)) + 20
829
+ } : void 0), Oe(r, i, t.direction);
830
+ let c = new Map(r.map((e) => [e.id, e]));
831
+ He(t, c, i), n && Ne(i, r, a, t.direction);
832
+ for (let e of i) {
833
+ let t = c.get(e.source), n = c.get(e.target);
834
+ t && (e.points = we(e.points, t, !0)), n && (e.points = we(e.points, n, !1));
835
+ }
836
+ let l = e.width ?? 800, u = e.height ?? 600, d = V.width, f = re.padding;
837
+ for (let e of i) {
838
+ for (let t of e.points) l = Math.max(l, t.x + d + f), u = Math.max(u, t.y + d + f);
839
+ e.labelPosition && (l = Math.max(l, e.labelPosition.x + 60 + f), u = Math.max(u, e.labelPosition.y + 20 + f));
840
+ }
841
+ return {
842
+ width: l,
843
+ height: u,
844
+ nodes: r,
845
+ edges: i,
846
+ groups: a
847
+ };
848
+ }
849
+ function Ge(e, t, n, r, i, a, o) {
850
+ if (e.children) for (let s of e.children) {
851
+ let e = (s.x ?? 0) + a, c = (s.y ?? 0) + o, l = s.width ?? 0, u = s.height ?? 0;
852
+ if (n.has(s.id)) {
853
+ let a = [];
854
+ Ge(s, t, n, r, a, e, c);
855
+ let o = Ze(t.subgraphs, s.id);
856
+ i.push({
857
+ id: s.id,
858
+ label: o?.label ?? "",
859
+ x: e,
860
+ y: c,
861
+ width: l,
862
+ height: u,
863
+ children: a
864
+ });
865
+ } else {
866
+ let a = t.nodes.get(s.id);
867
+ if (a) {
868
+ let n = f(s.id, t), i = t.classAssignments.get(s.id);
869
+ r.push({
870
+ id: s.id,
871
+ label: a.label,
872
+ shape: a.shape,
873
+ x: e,
874
+ y: c,
875
+ width: l,
876
+ height: u,
877
+ inlineStyle: n,
878
+ className: i,
879
+ interaction: t.interactions.get(s.id)
880
+ });
881
+ }
882
+ s.children && s.children.length > 0 && Ge(s, t, n, r, i, e, c);
883
+ }
884
+ }
885
+ }
886
+ function Ke(e) {
887
+ let t = /^e(\d+)$/.exec(e);
888
+ if (t) return {
889
+ edgeIndex: parseInt(t[1], 10),
890
+ role: "bridge"
891
+ };
892
+ let n = /^e(\d+)_([st])(\d+)$/.exec(e);
893
+ if (n) return {
894
+ edgeIndex: parseInt(n[1], 10),
895
+ role: n[2] === "s" ? "source" : "target",
896
+ level: parseInt(n[3], 10)
897
+ };
898
+ }
899
+ function qe(e) {
900
+ if (e.length === 0) return {
901
+ x: 0,
902
+ y: 0
903
+ };
904
+ if (e.length === 1) return e[0];
905
+ let t = 0;
906
+ for (let n = 1; n < e.length; n++) {
907
+ let r = e[n].x - e[n - 1].x, i = e[n].y - e[n - 1].y;
908
+ t += Math.sqrt(r * r + i * i);
909
+ }
910
+ let n = t / 2;
911
+ for (let t = 1; t < e.length; t++) {
912
+ let r = e[t].x - e[t - 1].x, i = e[t].y - e[t - 1].y, a = Math.sqrt(r * r + i * i);
913
+ if (n <= a) {
914
+ let o = n / a;
915
+ return {
916
+ x: e[t - 1].x + o * r,
917
+ y: e[t - 1].y + o * i
918
+ };
919
+ }
920
+ n -= a;
921
+ }
922
+ return e[e.length - 1];
923
+ }
924
+ function Je(e, t, n, r, i, a) {
925
+ let o = /* @__PURE__ */ new Map();
926
+ Xe(e, o, 0, 0);
927
+ let s = 0;
928
+ for (let [e, r] of o) {
929
+ let i = t.edges[e];
930
+ if (!i) continue;
931
+ let o = [], c = (e) => {
932
+ !e || e.points.length === 0 || (o.length > 0 ? o.push(...e.points.slice(1)) : o.push(...e.points));
933
+ }, l = [...r.sourceHops.keys()].sort((e, t) => t - e);
934
+ for (let e of l) c(r.sourceHops.get(e));
935
+ c(r.bridge);
936
+ let u = [...r.targetHops.keys()].sort((e, t) => e - t);
937
+ for (let e of u) c(r.targetHops.get(e));
938
+ let d;
939
+ i.label && o.length >= 2 && (d = r.bridge?.labelPosition ?? qe(o));
940
+ let f = Ye(o, a, s);
941
+ f !== o && s++, i.label && f !== o && f.length >= 2 && (d = qe(f)), n.push({
942
+ source: i.source,
943
+ target: i.target,
944
+ label: i.label,
945
+ style: i.style,
946
+ hasArrowStart: i.hasArrowStart,
947
+ hasArrowEnd: i.hasArrowEnd,
948
+ points: f,
949
+ labelPosition: d,
950
+ inlineStyle: $e(e, t),
951
+ id: i.id,
952
+ animate: i.animate
953
+ });
954
+ }
955
+ }
956
+ function Ye(e, t, n = 0) {
957
+ if (e.length < 2) return e;
958
+ let r = !1;
959
+ for (let t = 1; t < e.length; t++) {
960
+ let n = Math.abs(e[t].x - e[t - 1].x), i = Math.abs(e[t].y - e[t - 1].y);
961
+ if (n > 1 && i > 1) {
962
+ r = !0;
963
+ break;
964
+ }
965
+ }
966
+ if (!r) return e;
967
+ let i = [e[0]];
968
+ for (let r = 1; r < e.length; r++) {
969
+ let a = i[i.length - 1], o = e[r], s = Math.abs(o.x - a.x), c = Math.abs(o.y - a.y);
970
+ if (s > 1 && c > 1) {
971
+ if (t) {
972
+ let e = n % 2 == 0, r = Math.floor(n / 2) * 12, s = e ? t.rightX + r : t.leftX - r;
973
+ i.push({
974
+ x: s,
975
+ y: a.y
976
+ }), i.push({
977
+ x: s,
978
+ y: o.y
979
+ });
980
+ } else {
981
+ let e = (a.y + o.y) / 2;
982
+ i.push({
983
+ x: a.x,
984
+ y: e
985
+ }), i.push({
986
+ x: o.x,
987
+ y: e
988
+ });
989
+ }
990
+ }
991
+ i.push(o);
992
+ }
993
+ return i;
994
+ }
995
+ function Xe(e, t, n, r) {
996
+ if (e.edges) for (let i of e.edges) {
997
+ let e = Ke(i.id);
998
+ if (!e) continue;
999
+ let { edgeIndex: a } = e, o = Pe(i, n, r), s = Fe(i, n, r), c = t.get(a) ?? {
1000
+ sourceHops: /* @__PURE__ */ new Map(),
1001
+ targetHops: /* @__PURE__ */ new Map()
1002
+ };
1003
+ t.set(a, c);
1004
+ let l = {
1005
+ edgeIndex: a,
1006
+ points: o,
1007
+ labelPosition: s
1008
+ };
1009
+ e.role === "bridge" ? c.bridge = l : e.role === "source" ? c.sourceHops.set(e.level, l) : c.targetHops.set(e.level, l);
1010
+ }
1011
+ if (e.children) for (let i of e.children) Xe(i, t, n + (i.x ?? 0), r + (i.y ?? 0));
1012
+ }
1013
+ function Ze(e, t) {
1014
+ for (let n of e) {
1015
+ if (n.id === t) return n;
1016
+ let e = Ze(n.children, t);
1017
+ if (e) return e;
1018
+ }
1019
+ }
1020
+ function Qe(e, t) {
1021
+ t.add(e.id);
1022
+ for (let n of e.children) Qe(n, t);
1023
+ }
1024
+ function $e(e, t) {
1025
+ let n, r = t.linkStyles.get("default");
1026
+ r && (n = { ...r });
1027
+ let i = t.linkStyles.get(e);
1028
+ return i && (n = n ? {
1029
+ ...n,
1030
+ ...i
1031
+ } : { ...i }), n;
1032
+ }
1033
+ //#endregion
1034
+ //#region packages/svg-renderer/src/layout-engine.ts
1035
+ function et(e, t = {}) {
1036
+ let n = {
1037
+ ...re,
1038
+ ...t,
1039
+ fontSizes: I(t.fontSizes)
1040
+ };
1041
+ return We(M(be(e, n), t.layoutCache), e, n.mergeEdges);
1042
+ }
1043
+ function tt(e, t = {}) {
1044
+ return be(e, {
1045
+ ...re,
1046
+ ...t,
1047
+ fontSizes: I(t.fontSizes)
1048
+ });
1049
+ }
1050
+ //#endregion
1051
+ //#region packages/svg-renderer/src/renderer.ts
1052
+ function nt(e, n, r = "Inter", i = !1, a = F, o = "linear", s, c = !0, l = !0, u, d, f = {}) {
1053
+ let m = [], h = l && e.nodes.some((e) => !!p(e.interaction?.href));
1054
+ m.push(G(g(e.width, e.height, n, i, u, d, h, f.styleAttribute), s)), m.push(t(r, !1, f.nonce)), c && e.edges.some((e) => e.animate) && m.push(rt(f.nonce)), m.push("<defs>"), m.push(it());
1055
+ let _ = /* @__PURE__ */ new Set();
1056
+ for (let t of e.edges) t.inlineStyle?.stroke && _.add(t.inlineStyle.stroke);
1057
+ for (let e of _) m.push(at(e));
1058
+ m.push("</defs>");
1059
+ for (let t of e.groups) m.push(ct(t, r, a));
1060
+ for (let t of e.edges) m.push(lt(t, o, c));
1061
+ for (let t of e.edges) t.label && m.push(dt(t, r, a));
1062
+ for (let t of e.nodes) m.push(ht(t, r, a, l));
1063
+ return m.push("</svg>"), m.join("\n");
1064
+ }
1065
+ function rt(e) {
1066
+ return [
1067
+ h(e),
1068
+ " @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }",
1069
+ " .edge-animated { animation: zm-edge-dash 1s linear infinite; }",
1070
+ " @media (prefers-reduced-motion: reduce) {",
1071
+ " .edge-animated { animation: none; }",
1072
+ " }",
1073
+ "</style>"
1074
+ ].join("\n");
1075
+ }
1076
+ function it() {
1077
+ return ot("var(--_arrow)", "");
1078
+ }
1079
+ function at(e) {
1080
+ return ot(n(e), `-${st(e)}`);
1081
+ }
1082
+ function ot(e, t) {
1083
+ let n = V.width, r = V.height, i = n - 1, a = `fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`, o = `<polygon points="0 0, ${n} ${r / 2}, 0 ${r}" ${a} />`, s = (e, t) => ` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r / 2}" orient="${t}">\n ${o}\n </marker>`;
1084
+ return s(`arrowhead${t}`, "auto") + "\n" + s(`arrowhead-start${t}`, "auto-start-reverse");
1085
+ }
1086
+ function st(e) {
1087
+ return e.replace(/[^a-zA-Z0-9]/g, (e) => e.charCodeAt(0).toString(16));
1088
+ }
1089
+ function ct(e, t, r) {
1090
+ let i = r.groupHeader + 16, a = [];
1091
+ a.push(`<g class="subgraph" data-id="${n(e.id)}" data-label="${n(e.label)}">`), a.push(` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`), a.push(` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${i}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`), a.push(" " + u(e.label, e.x + 12, e.y + i / 2, r.groupHeader, `font-size="${r.groupHeader}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));
1092
+ for (let n of e.children) a.push(ct(n, t, r));
1093
+ return a.push("</g>"), a.join("\n");
1094
+ }
1095
+ function lt(e, t, r = !0) {
1096
+ if (e.points.length < 2) return "";
1097
+ let i = r && (e.animate ?? !1), a = t !== "linear", o = e.style === "invisible", s = e.style === "dotted" ? " stroke-dasharray=\"4 4\"" : "", c = e.style === "thick" ? z.connector * 2 : z.connector, l = o ? "none" : n(e.inlineStyle?.stroke ?? "var(--_line)"), u = n(e.inlineStyle?.["stroke-width"] ?? String(c)), d = e.inlineStyle?.stroke ? `-${st(e.inlineStyle.stroke)}` : "", f = "";
1098
+ o || (e.hasArrowEnd && (f += ` marker-end="url(#arrowhead${d})"`), e.hasArrowStart && (f += ` marker-start="url(#arrowhead-start${d})"`));
1099
+ let p = [
1100
+ `class="edge${i ? " edge-animated" : ""}"`,
1101
+ `data-from="${n(e.source)}"`,
1102
+ `data-to="${n(e.target)}"`,
1103
+ `data-style="${e.style}"`,
1104
+ `data-arrow-start="${e.hasArrowStart}"`,
1105
+ `data-arrow-end="${e.hasArrowEnd}"`
1106
+ ];
1107
+ e.label && p.push(`data-label="${n(e.label)}"`), e.id && p.push(`data-id="${n(e.id)}"`);
1108
+ let m = i && !s ? " stroke-dasharray=\"8 6\"" : "", h = a ? `d="${T(e.points, t)}"` : `points="${ut(e.points)}"`;
1109
+ return `<${a ? "path" : "polyline"} ${p.join(" ")} ${h} fill="none" stroke="${l}" stroke-width="${u}"${s}${m}${f} />`;
1110
+ }
1111
+ function ut(e) {
1112
+ return e.map((e) => `${e.x},${e.y}`).join(" ");
1113
+ }
1114
+ function dt(e, t, r) {
1115
+ if (!e.label) return "";
1116
+ let i = e.label, a = e.labelPosition ?? pt(e.points), s = o(i, r.edgeLabel, L.edgeLabel), c = d(i, a.x, a.y, s.width, s.height, r.edgeLabel, 8, `text-anchor="middle" font-size="${r.edgeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text-sec)"`, "rx=\"2\" ry=\"2\" fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"1\"");
1117
+ return `<g class="edge-label" data-from="${n(e.source)}" data-to="${n(e.target)}" data-label="${n(i)}">\n ${c.replace(/\n/g, "\n ")}\n</g>`;
1118
+ }
1119
+ function ft(e, t) {
1120
+ let n = e[t];
1121
+ if (!n)
1122
+ /* v8 ignore next */
1123
+ throw Error(`edgeMidpoint: missing point at index ${t}`);
1124
+ return n;
1125
+ }
1126
+ function pt(e) {
1127
+ if (e.length === 0) return {
1128
+ x: 0,
1129
+ y: 0
1130
+ };
1131
+ if (e.length === 1) return e[0];
1132
+ let t = 0;
1133
+ for (let n = 1; n < e.length; n++) t += mt(ft(e, n - 1), ft(e, n));
1134
+ let n = t / 2;
1135
+ for (let t = 1; t < e.length; t++) {
1136
+ let r = ft(e, t - 1), i = ft(e, t), a = mt(r, i);
1137
+ if (n <= a) {
1138
+ let e = n / a;
1139
+ return {
1140
+ x: r.x + e * (i.x - r.x),
1141
+ y: r.y + e * (i.y - r.y)
1142
+ };
1143
+ }
1144
+ n -= a;
1145
+ }
1146
+ return e[e.length - 1];
1147
+ }
1148
+ function mt(e, t) {
1149
+ return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
1150
+ }
1151
+ function ht(e, t, i, a = !0) {
1152
+ let o = gt(e), s = Xt(e, t, i), c = [], l = m(e.className), u = l ? `node ${l}` : "node", d = e.interaction, f = [
1153
+ `class="${u}"`,
1154
+ `data-id="${n(e.id)}"`,
1155
+ `data-label="${n(e.label)}"`,
1156
+ `data-shape="${e.shape}"`
1157
+ ];
1158
+ c.push(`<g ${f.join(" ")}>`);
1159
+ let h = a ? p(d?.href) : void 0, g = h ? " " : " ";
1160
+ if (h) {
1161
+ let e = d?.target ? ` target="${n(d.target)}"` : "";
1162
+ c.push(` <a href="${n(h)}"${e}>`);
1163
+ }
1164
+ return a && d?.tooltip && c.push(`${g}<title>${r(d.tooltip)}</title>`), c.push(`${g}${o.replace(/\n/g, `\n${g}`)}`), s && c.push(`${g}${s.replace(/\n/g, `\n${g}`)}`), h && c.push(" </a>"), c.push("</g>"), c.join("\n");
1165
+ }
1166
+ function gt(e) {
1167
+ let { x: t, y: r, width: i, height: a, shape: o, inlineStyle: s } = e, c = n(s?.fill ?? "var(--_node-fill)"), l = n(s?.stroke ?? "var(--_node-stroke)"), u = n(s?.["stroke-width"] ?? String(z.innerBox));
1168
+ switch (o) {
1169
+ case "diamond": return xt(t, r, i, a, c, l, u);
1170
+ case "rounded": return vt(t, r, i, a, c, l, u);
1171
+ case "stadium": return yt(t, r, i, a, c, l, u);
1172
+ case "circle": return bt(t, r, i, a, c, l, u);
1173
+ case "subroutine": return St(t, r, i, a, c, l, u);
1174
+ case "doublecircle": return Ct(t, r, i, a, c, l, u);
1175
+ case "hexagon": return wt(t, r, i, a, c, l, u);
1176
+ case "cylinder": return Tt(t, r, i, a, c, l, u);
1177
+ case "asymmetric": return Et(t, r, i, a, c, l, u);
1178
+ case "trapezoid": return Dt(t, r, i, a, c, l, u);
1179
+ case "trapezoid-alt": return Ot(t, r, i, a, c, l, u);
1180
+ case "parallelogram": return kt(t, r, i, a, c, l, u);
1181
+ case "parallelogram-alt": return At(t, r, i, a, c, l, u);
1182
+ case "state-start": return Jt(t, r, i, a);
1183
+ case "state-end": return Yt(t, r, i, a);
1184
+ case "document": return jt(t, r, i, a, c, l, u);
1185
+ case "stacked-document": return Mt(t, r, i, a, c, l, u, !0);
1186
+ case "stacked-process": return Mt(t, r, i, a, c, l, u, !1);
1187
+ case "card": return Nt(t, r, i, a, c, l, u);
1188
+ case "lined-process": return Pt(t, r, i, a, c, l, u);
1189
+ case "divided-process": return Ft(t, r, i, a, c, l, u);
1190
+ case "window-pane": return It(t, r, i, a, c, l, u);
1191
+ case "triangle": return Lt(t, r, i, a, c, l, u, !1);
1192
+ case "flipped-triangle": return Lt(t, r, i, a, c, l, u, !0);
1193
+ case "filled-circle": return Rt(t, r, i, a, l);
1194
+ case "crossed-circle": return zt(t, r, i, a, c, l, u);
1195
+ case "fork-join": return Bt(t, r, i, a, l);
1196
+ case "notched-pentagon": return Vt(t, r, i, a, c, l, u);
1197
+ case "sloped-rectangle": return Ht(t, r, i, a, c, l, u);
1198
+ case "flag": return Ut(t, r, i, a, c, l, u);
1199
+ case "bow-tie-rectangle": return Wt(t, r, i, a, c, l, u);
1200
+ case "half-rounded-rectangle": return Gt(t, r, i, a, c, l, u);
1201
+ case "brace": return Kt(t, r, i, a, c, l, u, "left");
1202
+ case "brace-right": return Kt(t, r, i, a, c, l, u, "right");
1203
+ case "braces": return Kt(t, r, i, a, c, l, u, "both");
1204
+ case "bolt": return qt(t, r, i, a, c, l, u);
1205
+ case "text":
1206
+ case "anchor": return "";
1207
+ default: return _t(t, r, i, a, c, l, u);
1208
+ }
1209
+ }
1210
+ function _t(e, t, n, r, i, a, o) {
1211
+ return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1212
+ }
1213
+ function vt(e, t, n, r, i, a, o) {
1214
+ return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1215
+ }
1216
+ function yt(e, t, n, r, i, a, o) {
1217
+ let s = r / 2;
1218
+ return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1219
+ }
1220
+ function bt(e, t, n, r, i, a, o) {
1221
+ return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${Math.min(n, r) / 2}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1222
+ }
1223
+ function xt(e, t, n, r, i, a, o) {
1224
+ let s = e + n / 2, c = t + r / 2, l = n / 2, u = r / 2;
1225
+ return `<polygon points="${[
1226
+ `${s},${c - u}`,
1227
+ `${s + l},${c}`,
1228
+ `${s},${c + u}`,
1229
+ `${s - l},${c}`
1230
+ ].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1231
+ }
1232
+ function St(e, t, n, r, i, a, o) {
1233
+ return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e + 8}" y1="${t}" x2="${e + 8}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e + n - 8}" y1="${t}" x2="${e + n - 8}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />`;
1234
+ }
1235
+ function Ct(e, t, n, r, i, a, o) {
1236
+ let s = e + n / 2, c = t + r / 2, l = Math.min(n, r) / 2;
1237
+ return `<circle cx="${s}" cy="${c}" r="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n<circle cx="${s}" cy="${c}" r="${l - 5}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1238
+ }
1239
+ function wt(e, t, n, r, i, a, o) {
1240
+ let s = r / 4;
1241
+ return `<polygon points="${[
1242
+ `${e + s},${t}`,
1243
+ `${e + n - s},${t}`,
1244
+ `${e + n},${t + r / 2}`,
1245
+ `${e + n - s},${t + r}`,
1246
+ `${e + s},${t + r}`,
1247
+ `${e},${t + r / 2}`
1248
+ ].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1249
+ }
1250
+ function Tt(e, t, n, r, i, a, o) {
1251
+ let s = e + n / 2, c = t + 7, l = r - 14;
1252
+ return `<rect x="${e}" y="${c}" width="${n}" height="${l}" fill="${i}" stroke="none" />\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c + l}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e + n}" y1="${c}" x2="${e + n}" y2="${c + l}" stroke="${a}" stroke-width="${o}" />\n<ellipse cx="${s}" cy="${t + r - 7}" rx="${n / 2}" ry="7" fill="${i}" stroke="${a}" stroke-width="${o}" />\n<ellipse cx="${s}" cy="${c}" rx="${n / 2}" ry="7" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1253
+ }
1254
+ function Et(e, t, n, r, i, a, o) {
1255
+ return `<polygon points="${[
1256
+ `${e + 12},${t}`,
1257
+ `${e + n},${t}`,
1258
+ `${e + n},${t + r}`,
1259
+ `${e + 12},${t + r}`,
1260
+ `${e},${t + r / 2}`
1261
+ ].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1262
+ }
1263
+ function Dt(e, t, n, r, i, a, o) {
1264
+ let s = n * .15;
1265
+ return `<polygon points="${[
1266
+ `${e + s},${t}`,
1267
+ `${e + n - s},${t}`,
1268
+ `${e + n},${t + r}`,
1269
+ `${e},${t + r}`
1270
+ ].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1271
+ }
1272
+ function Ot(e, t, n, r, i, a, o) {
1273
+ let s = n * .15;
1274
+ return `<polygon points="${[
1275
+ `${e},${t}`,
1276
+ `${e + n},${t}`,
1277
+ `${e + n - s},${t + r}`,
1278
+ `${e + s},${t + r}`
1279
+ ].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1280
+ }
1281
+ function kt(e, t, n, r, i, a, o) {
1282
+ let s = n * .15;
1283
+ return `<polygon points="${[
1284
+ `${e + s},${t}`,
1285
+ `${e + n},${t}`,
1286
+ `${e + n - s},${t + r}`,
1287
+ `${e},${t + r}`
1288
+ ].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1289
+ }
1290
+ function At(e, t, n, r, i, a, o) {
1291
+ let s = n * .15;
1292
+ return `<polygon points="${[
1293
+ `${e},${t}`,
1294
+ `${e + n - s},${t}`,
1295
+ `${e + n},${t + r}`,
1296
+ `${e + s},${t + r}`
1297
+ ].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
1298
+ }
1299
+ function W(e, t, n) {
1300
+ return `fill="${e}" stroke="${t}" stroke-width="${n}"`;
1301
+ }
1302
+ function jt(e, t, n, r, i, a, o) {
1303
+ let s = Math.min(10, r * .16), c = t + r - s;
1304
+ return `<path d="${`M ${e} ${t} L ${e + n} ${t} L ${e + n} ${c} C ${e + n * .75} ${c + s * 1.8} ${e + n * .25} ${c - s * .8} ${e} ${c} Z`}" ${W(i, a, o)} />`;
1305
+ }
1306
+ function Mt(e, t, n, r, i, a, o, s) {
1307
+ let c = n - 10, l = r - 10, u = [];
1308
+ for (let n = 2; n >= 1; n--) u.push(`<rect x="${e + 5 * n}" y="${t + 5 * (2 - n)}" width="${c}" height="${l}" ${W(i, a, o)} />`);
1309
+ return u.push(s ? jt(e, t + 10, c, l, i, a, o) : `<rect x="${e}" y="${t + 10}" width="${c}" height="${l}" ${W(i, a, o)} />`), u.join("\n");
1310
+ }
1311
+ function Nt(e, t, n, r, i, a, o) {
1312
+ let s = Math.min(14, n * .12, r * .3);
1313
+ return `<polygon points="${[
1314
+ `${e + s},${t}`,
1315
+ `${e + n},${t}`,
1316
+ `${e + n},${t + r}`,
1317
+ `${e},${t + r}`,
1318
+ `${e},${t + s}`
1319
+ ].join(" ")}" ${W(i, a, o)} />`;
1320
+ }
1321
+ function Pt(e, t, n, r, i, a, o) {
1322
+ let s = Math.min(12, n * .12);
1323
+ return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${W(i, a, o)} />\n<line x1="${e + s}" y1="${t}" x2="${e + s}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />`;
1324
+ }
1325
+ function Ft(e, t, n, r, i, a, o) {
1326
+ let s = t + Math.min(16, r * .3);
1327
+ return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${W(i, a, o)} />\n<line x1="${e}" y1="${s}" x2="${e + n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`;
1328
+ }
1329
+ function It(e, t, n, r, i, a, o) {
1330
+ let s = e + Math.min(16, n * .16), c = t + Math.min(14, r * .28);
1331
+ return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${W(i, a, o)} />\n<line x1="${s}" y1="${t}" x2="${s}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e}" y1="${c}" x2="${e + n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`;
1332
+ }
1333
+ function Lt(e, t, n, r, i, a, o, s) {
1334
+ return `<polygon points="${(s ? [
1335
+ `${e},${t}`,
1336
+ `${e + n},${t}`,
1337
+ `${e + n / 2},${t + r}`
1338
+ ] : [
1339
+ `${e + n / 2},${t}`,
1340
+ `${e + n},${t + r}`,
1341
+ `${e},${t + r}`
1342
+ ]).join(" ")}" ${W(i, a, o)} />`;
1343
+ }
1344
+ function Rt(e, t, n, r, i) {
1345
+ let a = Math.min(n, r) / 2 - 2;
1346
+ return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${a}" fill="${i}" stroke="${i}" />`;
1347
+ }
1348
+ function zt(e, t, n, r, i, a, o) {
1349
+ let s = e + n / 2, c = t + r / 2, l = Math.min(n, r) / 2 - 2, u = l / Math.SQRT2;
1350
+ return `<circle cx="${s}" cy="${c}" r="${l}" ${W(i, a, o)} />\n<line x1="${s - u}" y1="${c - u}" x2="${s + u}" y2="${c + u}" stroke="${a}" stroke-width="${o}" />\n<line x1="${s + u}" y1="${c - u}" x2="${s - u}" y2="${c + u}" stroke="${a}" stroke-width="${o}" />`;
1351
+ }
1352
+ function Bt(e, t, n, r, i) {
1353
+ let a = Math.min(8, r);
1354
+ return `<rect x="${e}" y="${t + (r - a) / 2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`;
1355
+ }
1356
+ function Vt(e, t, n, r, i, a, o) {
1357
+ let s = Math.min(14, n * .12, r * .3);
1358
+ return `<polygon points="${[
1359
+ `${e + s},${t}`,
1360
+ `${e + n - s},${t}`,
1361
+ `${e + n},${t + s}`,
1362
+ `${e + n},${t + r}`,
1363
+ `${e},${t + r}`,
1364
+ `${e},${t + s}`
1365
+ ].join(" ")}" ${W(i, a, o)} />`;
1366
+ }
1367
+ function Ht(e, t, n, r, i, a, o) {
1368
+ return `<polygon points="${[
1369
+ `${e},${t + Math.min(12, r * .3)}`,
1370
+ `${e + n},${t}`,
1371
+ `${e + n},${t + r}`,
1372
+ `${e},${t + r}`
1373
+ ].join(" ")}" ${W(i, a, o)} />`;
1374
+ }
1375
+ function Ut(e, t, n, r, i, a, o) {
1376
+ let s = Math.min(8, r * .14);
1377
+ return `<path d="${`M ${e} ${t + s} C ${e + n * .25} ${t - s} ${e + n * .75} ${t + s * 2} ${e + n} ${t + s} L ${e + n} ${t + r - s} C ${e + n * .75} ${t + r + s} ${e + n * .25} ${t + r - s * 2} ${e} ${t + r - s} Z`}" ${W(i, a, o)} />`;
1378
+ }
1379
+ function Wt(e, t, n, r, i, a, o) {
1380
+ let s = Math.min(14, n * .12);
1381
+ return `<path d="${`M ${e + s} ${t} L ${e + n} ${t} Q ${e + n - s * 1.4} ${t + r / 2} ${e + n} ${t + r} L ${e + s} ${t + r} Q ${e + s * 1.4} ${t + r / 2} ${e + s} ${t} Z`}" ${W(i, a, o)} />`;
1382
+ }
1383
+ function Gt(e, t, n, r, i, a, o) {
1384
+ let s = r / 2, c = Math.max(0, n - s);
1385
+ return `<path d="${`M ${e} ${t} L ${e + c} ${t} A ${s} ${s} 0 0 1 ${e + c} ${t + r} L ${e} ${t + r} Z`}" ${W(i, a, o)} />`;
1386
+ }
1387
+ function Kt(e, t, n, r, i, a, o, s) {
1388
+ let c = Math.min(10, n * .12), l = [`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`], u = `M ${e + c} ${t} Q ${e} ${t} ${e} ${t + r * .25} Q ${e} ${t + r / 2} ${e - c * .4} ${t + r / 2} Q ${e} ${t + r / 2} ${e} ${t + r * .75} Q ${e} ${t + r} ${e + c} ${t + r}`, d = `M ${e + n - c} ${t} Q ${e + n} ${t} ${e + n} ${t + r * .25} Q ${e + n} ${t + r / 2} ${e + n + c * .4} ${t + r / 2} Q ${e + n} ${t + r / 2} ${e + n} ${t + r * .75} Q ${e + n} ${t + r} ${e + n - c} ${t + r}`;
1389
+ return (s === "left" || s === "both") && l.push(`<path d="${u}" fill="none" stroke="${a}" stroke-width="${o}" />`), (s === "right" || s === "both") && l.push(`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`), l.join("\n");
1390
+ }
1391
+ function qt(e, t, n, r, i, a, o) {
1392
+ return `<polygon points="${[
1393
+ `${e + n * .42},${t}`,
1394
+ `${e + n},${t}`,
1395
+ `${e + n * .62},${t + r * .42}`,
1396
+ `${e + n},${t + r * .42}`,
1397
+ `${e + n * .3},${t + r}`,
1398
+ `${e + n * .5},${t + r * .55}`,
1399
+ `${e},${t + r * .55}`
1400
+ ].join(" ")}" ${W(i, a, o)} />`;
1401
+ }
1402
+ function Jt(e, t, n, r) {
1403
+ return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${Math.min(n, r) / 2 - 2}" fill="var(--_text)" stroke="none" />`;
1404
+ }
1405
+ function Yt(e, t, n, r) {
1406
+ let i = e + n / 2, a = t + r / 2, o = Math.min(n, r) / 2 - 2, s = o - 4;
1407
+ return `<circle cx="${i}" cy="${a}" r="${o}" fill="none" stroke="var(--_text)" stroke-width="${z.innerBox * 2}" />\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`;
1408
+ }
1409
+ function Xt(e, t, r) {
1410
+ if ((e.shape === "state-start" || e.shape === "state-end") && !e.label) return "";
1411
+ let i = e.x + e.width / 2, o = e.y + e.height / 2, s = n(e.inlineStyle?.color ?? a(e.inlineStyle?.fill, "var(--_text)")), c = `text-anchor="middle" font-size="${r.nodeLabel}" font-weight="${L.nodeLabel}" fill="${s}"`, l = e.inlineStyle?.["font-family"];
1412
+ return l && (c += ` style="font-family: ${n(l)};"`), u(e.label, i, o, r.nodeLabel, c);
1413
+ }
1414
+ function Zt(e) {
1415
+ return n(e).replace(/\r/g, "&#13;").replace(/\n/g, "&#10;").replace(/\t/g, "&#9;");
1416
+ }
1417
+ function G(e, t) {
1418
+ return t === void 0 ? e : e.replace("<svg ", `<svg data-src="${Zt(t)}" `);
1419
+ }
1420
+ //#endregion
1421
+ //#region packages/svg-renderer/src/resolve-colors.ts
1422
+ var Qt = class {
1423
+ raw = /* @__PURE__ */ new Map();
1424
+ resolved = /* @__PURE__ */ new Map();
1425
+ inProgress = /* @__PURE__ */ new Set();
1426
+ declare(e, t) {
1427
+ this.raw.set(e, t), this.resolved.delete(e);
1428
+ }
1429
+ lookup(e) {
1430
+ if (this.resolved.has(e)) return this.resolved.get(e);
1431
+ let t = this.raw.get(e);
1432
+ if (t === void 0 || this.inProgress.has(e)) return;
1433
+ this.inProgress.add(e);
1434
+ let n = on(t, this).trim();
1435
+ this.inProgress.delete(e);
1436
+ let r = !/\bvar\(|\bcolor-mix\(/.test(n);
1437
+ return this.resolved.set(e, r ? n : void 0), r ? n : void 0;
1438
+ }
1439
+ };
1440
+ function $t(e, t) {
1441
+ let n = 0;
1442
+ for (let r = t; r < e.length; r++) {
1443
+ let t = e[r];
1444
+ if (t === "(") n++;
1445
+ else if (t === ")" && (n--, n === 0)) return r;
1446
+ }
1447
+ return -1;
1448
+ }
1449
+ function en(e) {
1450
+ let t = [], n = 0, r = 0;
1451
+ for (let i = 0; i < e.length; i++) {
1452
+ let a = e[i];
1453
+ a === "(" ? n++ : a === ")" ? n-- : a === "," && n === 0 && (t.push(e.slice(r, i)), r = i + 1);
1454
+ }
1455
+ return t.push(e.slice(r)), t;
1456
+ }
1457
+ var tn = "(?<![\\w-])(var|color-mix)\\(";
1458
+ function nn(e, t) {
1459
+ let [n, ...r] = en(e), i = (n ?? "").trim(), a = t.lookup(i);
1460
+ return a === void 0 ? r.length > 0 ? r.join(",").trim() : null : a;
1461
+ }
1462
+ function rn(e) {
1463
+ let t = e.trim().split(/\s+/), n, r;
1464
+ for (let e of t) if (/^[\d.]+%$/.test(e)) {
1465
+ if (r !== void 0) return null;
1466
+ r = Number(e.slice(0, -1));
1467
+ } else {
1468
+ if (n !== void 0) return null;
1469
+ n = e;
1470
+ }
1471
+ return n === void 0 ? null : {
1472
+ color: n,
1473
+ pct: r
1474
+ };
1475
+ }
1476
+ function an(e) {
1477
+ let t = en(e);
1478
+ if (t.length !== 3) return null;
1479
+ let [n, r, a] = t;
1480
+ if (n === void 0 || r === void 0 || a === void 0 || !/^\s*in\s+srgb\s*$/i.test(n)) return null;
1481
+ let o = rn(r), s = rn(a);
1482
+ if (!o || !s) return null;
1483
+ let u = l(o.color), d = l(s.color);
1484
+ if (!u || !d) return null;
1485
+ let f = c(u, d, o.pct, s.pct);
1486
+ return f ? i(f) : null;
1487
+ }
1488
+ function on(e, t) {
1489
+ let n = "", r = 0, i = new RegExp(tn, "g"), a;
1490
+ for (; (a = i.exec(e)) !== null;) {
1491
+ let o = a[1];
1492
+ if (o === void 0) continue;
1493
+ let s = a.index, c = s + o.length, l = $t(e, c);
1494
+ if (l === -1) break;
1495
+ let u = on(e.slice(c + 1, l), t), d = o === "var" ? nn(u, t) : an(u);
1496
+ n += e.slice(r, s), n += d ?? `${o}(${u})`, r = l + 1, i.lastIndex = r;
1497
+ }
1498
+ return n + e.slice(r);
1499
+ }
1500
+ function sn(e, t) {
1501
+ let n = new Qt();
1502
+ for (let [e, r] of Object.entries(t)) n.declare(e, r);
1503
+ return on(e, n);
1504
+ }
1505
+ var cn = /(--[\w-]+)\s*:\s*([^;{}]+)/g, ln = /(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g, un = /* @__PURE__ */ new Set(["data-src"]);
1506
+ function dn(e, t) {
1507
+ cn.lastIndex = 0;
1508
+ let n;
1509
+ for (; (n = cn.exec(e)) !== null;) {
1510
+ let [, e, r] = n;
1511
+ e !== void 0 && r !== void 0 && t.declare(e, r.trim());
1512
+ }
1513
+ }
1514
+ function fn(e, t) {
1515
+ return e.replace(ln, (e, n, r, i, a) => {
1516
+ if (un.has(r)) return e;
1517
+ let o = a[0] ?? "\"";
1518
+ return `${n}${r}${i}${o}${on(a.slice(1, -1), t)}${o}`;
1519
+ });
1520
+ }
1521
+ function pn(e, t) {
1522
+ let n = new Qt();
1523
+ n.declare("--bg", t.bg), n.declare("--fg", t.fg), t.line && n.declare("--line", t.line), t.accent && n.declare("--accent", t.accent), t.muted && n.declare("--muted", t.muted), t.surface && n.declare("--surface", t.surface), t.border && n.declare("--border", t.border);
1524
+ for (let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)) {
1525
+ let e = t[1];
1526
+ e !== void 0 && dn(e, n);
1527
+ }
1528
+ for (let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)) {
1529
+ let e = t[1];
1530
+ e !== void 0 && dn(e.slice(1, -1), n);
1531
+ }
1532
+ let r = "", i = 0;
1533
+ for (; i < e.length;) {
1534
+ let t = e.indexOf("<", i);
1535
+ if (t === -1) break;
1536
+ if (r += e.slice(i, t), e.startsWith("<style", t)) {
1537
+ let a = e.indexOf(">", t), o = e.indexOf("</style>", t);
1538
+ if (a === -1 || o === -1) break;
1539
+ r += e.slice(t, a + 1), r += on(e.slice(a + 1, o), n), r += "</style>", i = o + 8;
1540
+ continue;
1541
+ }
1542
+ let a = -1, o = null;
1543
+ for (let n = t + 1; n < e.length; n++) {
1544
+ let t = e[n];
1545
+ if (o !== null) t === o && (o = null);
1546
+ else if (t === "\"" || t === "'") o = t;
1547
+ else if (t === ">") {
1548
+ a = n;
1549
+ break;
1550
+ }
1551
+ }
1552
+ if (a === -1) break;
1553
+ let s = e.slice(t, a + 1);
1554
+ r += s.startsWith("<!") || s.startsWith("<?") || s.startsWith("</") ? s : fn(s, n), i = a + 1;
1555
+ }
1556
+ return r + e.slice(i);
1557
+ }
1558
+ //#endregion
1559
+ //#region packages/svg-renderer/src/class/layout.ts
1560
+ var K = {
1561
+ padding: 40,
1562
+ boxPadX: 8,
1563
+ headerBaseHeight: 32,
1564
+ annotationHeight: 16,
1565
+ memberRowHeight: 20,
1566
+ sectionPadY: 8,
1567
+ emptySectionHeight: 8,
1568
+ minWidth: 120,
1569
+ memberFontSize: 11,
1570
+ memberFontWeight: 400,
1571
+ nodeSpacing: 40,
1572
+ layerSpacing: 60,
1573
+ notePadX: 10,
1574
+ notePadY: 6
1575
+ };
1576
+ function mn(e) {
1577
+ return `note ${e}`;
1578
+ }
1579
+ function hn(e) {
1580
+ return `${e} link`;
1581
+ }
1582
+ function gn(e, t) {
1583
+ let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = I(t.fontSizes);
1584
+ for (let t of e.classes) {
1585
+ let e = t.annotation ? K.headerBaseHeight + K.annotationHeight : K.headerBaseHeight, r = t.attributes.length > 0 ? t.attributes.length * K.memberRowHeight + K.sectionPadY : K.emptySectionHeight, a = t.methods.length > 0 ? t.methods.length * K.memberRowHeight + K.sectionPadY : K.emptySectionHeight, o = N(t.label, i.nodeLabel, L.nodeLabel), s = yn(t.attributes), c = yn(t.methods), l = Math.max(K.minWidth, o + K.boxPadX * 2, s + K.boxPadX * 2, c + K.boxPadX * 2), u = e + r + a;
1586
+ n.set(t.id, {
1587
+ width: l,
1588
+ height: u,
1589
+ headerHeight: e,
1590
+ attrHeight: r,
1591
+ methodHeight: a
1592
+ });
1593
+ }
1594
+ let a = [];
1595
+ for (let [e, t] of n) a.push(H(e, t));
1596
+ let s = { fontSize: i.edgeLabel }, c = [];
1597
+ for (let [t, n] of e.relationships.entries()) c.push(U({
1598
+ id: `e${t}`,
1599
+ source: n.from,
1600
+ target: n.to,
1601
+ label: n.label,
1602
+ labelStyle: s
1603
+ }));
1604
+ let l = new Set(n.keys());
1605
+ for (let [t, n] of e.notes.entries()) {
1606
+ let e = mn(t), u = o(n.text, i.edgeLabel, L.edgeLabel), d = {
1607
+ width: u.width + K.notePadX * 2,
1608
+ height: u.height + K.notePadY * 2
1609
+ };
1610
+ r.set(e, d), a.push(H(e, d)), n.forClass !== void 0 && l.has(n.forClass) && c.push(U({
1611
+ id: hn(e),
1612
+ source: e,
1613
+ target: n.forClass,
1614
+ labelStyle: s
1615
+ }));
1616
+ }
1617
+ return {
1618
+ elkGraph: {
1619
+ id: "root",
1620
+ layoutOptions: {
1621
+ ...se({
1622
+ direction: ae(void 0, ie.class),
1623
+ nodeSpacing: K.nodeSpacing,
1624
+ layerSpacing: K.layerSpacing,
1625
+ padding: K.padding
1626
+ }),
1627
+ "elk.edgeLabels.placement": "CENTER"
1628
+ },
1629
+ children: a,
1630
+ edges: c
1631
+ },
1632
+ classSizes: n,
1633
+ noteSizes: r
1634
+ };
1635
+ }
1636
+ function _n(e, t, n, r) {
1637
+ let i = /* @__PURE__ */ new Map();
1638
+ for (let e of t.classes) i.set(e.id, e);
1639
+ let a = [];
1640
+ for (let r of e.children ?? []) {
1641
+ let e = i.get(r.id);
1642
+ if (e) {
1643
+ let i = n.get(e.id);
1644
+ if (!i)
1645
+ /* v8 ignore next */
1646
+ throw Error(`Missing computed size for class "${e.id}"`);
1647
+ a.push({
1648
+ id: e.id,
1649
+ label: e.label,
1650
+ annotation: e.annotation,
1651
+ attributes: e.attributes,
1652
+ methods: e.methods,
1653
+ x: r.x ?? 0,
1654
+ y: r.y ?? 0,
1655
+ width: r.width ?? i.width,
1656
+ height: r.height ?? i.height,
1657
+ headerHeight: i.headerHeight,
1658
+ attrHeight: i.attrHeight,
1659
+ methodHeight: i.methodHeight,
1660
+ interaction: t.interactions.get(e.id),
1661
+ inlineStyle: f(e.id, t),
1662
+ className: t.classAssignments.get(e.id)
1663
+ });
1664
+ }
1665
+ }
1666
+ let o = [], s = e.edges ?? [];
1667
+ for (let [e, n] of t.relationships.entries()) {
1668
+ let t = s[e];
1669
+ if (!t)
1670
+ /* v8 ignore next */
1671
+ throw Error(`Missing ELK edge for relationship ${e}`);
1672
+ let r = Pe(t), i = Fe(t);
1673
+ o.push({
1674
+ from: n.from,
1675
+ to: n.to,
1676
+ type: n.type,
1677
+ markerAt: n.markerAt,
1678
+ label: n.label,
1679
+ fromCardinality: n.fromCardinality,
1680
+ toCardinality: n.toCardinality,
1681
+ points: r,
1682
+ labelPosition: i
1683
+ });
1684
+ }
1685
+ let c = /* @__PURE__ */ new Map();
1686
+ for (let e of s.slice(t.relationships.length)) c.set(e.id, e);
1687
+ let l = /* @__PURE__ */ new Map();
1688
+ for (let t of e.children ?? []) l.set(t.id, t);
1689
+ let u = [];
1690
+ for (let [e, n] of t.notes.entries()) {
1691
+ let t = mn(e), i = l.get(t), a = r.get(t);
1692
+ if (!i || !a)
1693
+ /* v8 ignore next */
1694
+ throw Error(`Missing layout for note ${e}`);
1695
+ let o = c.get(hn(t));
1696
+ u.push({
1697
+ id: t,
1698
+ text: n.text,
1699
+ ...o && n.forClass !== void 0 ? { forClass: n.forClass } : {},
1700
+ x: i.x ?? 0,
1701
+ y: i.y ?? 0,
1702
+ width: i.width ?? a.width,
1703
+ height: i.height ?? a.height,
1704
+ ...o ? { linkPoints: Pe(o) } : {}
1705
+ });
1706
+ }
1707
+ return {
1708
+ width: e.width ?? 600,
1709
+ height: e.height ?? 400,
1710
+ classes: a,
1711
+ relationships: o,
1712
+ notes: u
1713
+ };
1714
+ }
1715
+ function vn(e, t = {}) {
1716
+ if (e.classes.length === 0 && e.notes.length === 0) return {
1717
+ width: 0,
1718
+ height: 0,
1719
+ classes: [],
1720
+ relationships: [],
1721
+ notes: []
1722
+ };
1723
+ let { elkGraph: n, classSizes: r, noteSizes: i } = gn(e, t);
1724
+ return _n(M(n, t.layoutCache), e, r, i);
1725
+ }
1726
+ function yn(e) {
1727
+ if (e.length === 0) return 0;
1728
+ let t = 0;
1729
+ for (let n of e) {
1730
+ let e = P(v(n), K.memberFontSize);
1731
+ e > t && (t = e);
1732
+ }
1733
+ return t;
1734
+ }
1735
+ //#endregion
1736
+ //#region packages/svg-renderer/src/class/renderer.ts
1737
+ var bn = {
1738
+ memberSize: 11,
1739
+ memberWeight: 400,
1740
+ annotationSize: 10,
1741
+ annotationWeight: 500
1742
+ };
1743
+ function xn(e, n, r = "Inter", i = !1, a = F, o, s, c, l = !0, u = {}) {
1744
+ let d = [], f = l && e.classes.some((e) => !!p(e.interaction?.href));
1745
+ d.push(G(g(e.width, e.height, n, i, s, c, f, u.styleAttribute), o)), d.push(t(r, !0, u.nonce)), d.push("<defs>"), d.push(Sn()), d.push("</defs>");
1746
+ for (let t of e.relationships) d.push(On(t));
1747
+ for (let t of e.notes) d.push(Dn(t));
1748
+ for (let t of e.classes) d.push(Cn(t, a, l));
1749
+ for (let t of e.notes) d.push(En(t, a));
1750
+ for (let t of e.relationships) d.push(jn(t, a));
1751
+ return d.push("</svg>"), d.join("\n");
1752
+ }
1753
+ function Sn() {
1754
+ return " <marker id=\"cls-inherit\" markerWidth=\"12\" markerHeight=\"10\" refX=\"12\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"0 0, 12 5, 0 10\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-composition\" markerWidth=\"12\" markerHeight=\"10\" refX=\"0\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"6 0, 12 5, 6 10, 0 5\" fill=\"var(--_arrow)\" stroke=\"var(--_arrow)\" stroke-width=\"1\" />\n </marker>\n <marker id=\"cls-aggregation\" markerWidth=\"12\" markerHeight=\"10\" refX=\"0\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"6 0, 12 5, 6 10, 0 5\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-arrow\" markerWidth=\"8\" markerHeight=\"6\" refX=\"8\" refY=\"3\" orient=\"auto-start-reverse\">\n <polyline points=\"0 0, 8 3, 0 6\" fill=\"none\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>";
1755
+ }
1756
+ function Cn(e, t, r = !0) {
1757
+ let { x: i, y: o, width: s, height: c, headerHeight: l, attrHeight: d, inlineStyle: f } = e, h = [], g = e.interaction, _ = n(f?.fill ?? "var(--_node-fill)"), v = n(f?.stroke ?? "var(--_node-stroke)"), y = n(f?.["stroke-width"] ?? String(z.outerBox)), b = f?.fill ? _ : "var(--_group-hdr)", x = f?.color ? n(f.color) : f?.fill ? n(a(f.fill, "var(--_text)")) : void 0, S = e.annotation ? ` data-annotation="${n(e.annotation)}"` : "", C = m(e.className), w = [
1758
+ `class="${C ? `class-node ${C}` : "class-node"}"`,
1759
+ `data-id="${n(e.id)}"`,
1760
+ `data-label="${n(e.label)}"`
1761
+ ];
1762
+ h.push(`<g ${w.join(" ")}${S}>`);
1763
+ let T = r ? p(g?.href) : void 0;
1764
+ if (T) {
1765
+ let e = g?.target ? ` target="${n(g.target)}"` : "";
1766
+ h.push(` <a href="${n(T)}"${e}>`);
1767
+ }
1768
+ r && g?.tooltip && h.push(` <title>${Pn(g.tooltip)}</title>`), h.push(` <rect x="${i}" y="${o}" width="${s}" height="${c}" rx="0" ry="0" fill="${_}" stroke="${v}" stroke-width="${y}" />`), h.push(` <rect x="${i}" y="${o}" width="${s}" height="${l}" rx="0" ry="0" fill="${b}" stroke="${v}" stroke-width="${y}" />`);
1769
+ let E = o + l / 2;
1770
+ if (e.annotation) {
1771
+ let t = o + 12;
1772
+ h.push(` <text x="${i + s / 2}" y="${t}" text-anchor="middle" dy="${B}" font-size="${bn.annotationSize}" font-weight="${bn.annotationWeight}" font-style="italic" fill="${x ?? "var(--_text-muted)"}">&lt;&lt;${Pn(e.annotation)}&gt;&gt;</text>`), E = o + l / 2 + 6;
1773
+ }
1774
+ h.push(" " + u(e.label, i + s / 2, E, t.nodeLabel, `text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${x ?? "var(--_text)"}"`));
1775
+ let D = o + l;
1776
+ h.push(` <line x1="${i}" y1="${D}" x2="${i + s}" y2="${D}" stroke="${v}" stroke-width="${z.innerBox}" />`);
1777
+ for (let t = 0; t < e.attributes.length; t++) {
1778
+ let n = e.attributes[t], r = D + 4 + t * 20 + 10;
1779
+ h.push(" " + wn(n, i + K.boxPadX, r, x));
1780
+ }
1781
+ let O = D + d;
1782
+ h.push(` <line x1="${i}" y1="${O}" x2="${i + s}" y2="${O}" stroke="${v}" stroke-width="${z.innerBox}" />`);
1783
+ for (let t = 0; t < e.methods.length; t++) {
1784
+ let n = e.methods[t], r = O + 4 + t * 20 + 10;
1785
+ h.push(" " + wn(n, i + K.boxPadX, r, x));
1786
+ }
1787
+ return T && h.push(" </a>"), h.push("</g>"), h.join("\n");
1788
+ }
1789
+ function wn(e, t, n, r) {
1790
+ let i = e.isAbstract ? " font-style=\"italic\"" : "", a = e.isStatic ? " text-decoration=\"underline\"" : "", o = r ?? "var(--_text-faint)", s = r ?? "var(--_text-sec)", c = r ?? "var(--_text-muted)", l = [];
1791
+ e.visibility && l.push(`<tspan fill="${o}">${Pn(e.visibility)} </tspan>`);
1792
+ let u = e.isMethod ? `${e.name}(${e.params || ""})` : e.name;
1793
+ return l.push(`<tspan fill="${s}">${Pn(u)}</tspan>`), e.type && (l.push(`<tspan fill="${o}">: </tspan>`), l.push(`<tspan fill="${c}">${Pn(e.type)}</tspan>`)), `<text x="${t}" y="${n}" class="mono" dy="${B}" font-size="${bn.memberSize}" font-weight="${bn.memberWeight}"${i}${a}>${l.join("")}</text>`;
1794
+ }
1795
+ var Tn = 6;
1796
+ function En(e, t) {
1797
+ let { x: r, y: i, width: a, height: o } = e, s = e.forClass === void 0 ? "" : ` data-for="${n(e.forClass)}"`, c = [
1798
+ `${r},${i}`,
1799
+ `${r + a - Tn},${i}`,
1800
+ `${r + a},${i + Tn}`,
1801
+ `${r + a},${i + o}`,
1802
+ `${r},${i + o}`
1803
+ ].join(" "), l = `${r + a - Tn},${i} ${r + a},${i + Tn} ${r + a - Tn},${i + Tn}`;
1804
+ return `<g class="class-note"${s}>\n <polygon points="${c}" fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />\n <polygon points="${l}" fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />\n ${u(e.text, r + a / 2, i + o / 2, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}\n</g>`;
1805
+ }
1806
+ function Dn(e) {
1807
+ if (!e.linkPoints || e.linkPoints.length < 2) return "";
1808
+ let t = e.linkPoints.map((e) => `${e.x},${e.y}`).join(" ");
1809
+ return `<polyline class="class-note-link"${e.forClass === void 0 ? "" : ` data-for="${n(e.forClass)}"`} points="${t}" fill="none" stroke="var(--_line)" stroke-width="${z.connector}" stroke-dasharray="2 3" />`;
1810
+ }
1811
+ function On(e) {
1812
+ if (e.points.length < 2) return "";
1813
+ let t = e.points.map((e) => `${e.x},${e.y}`).join(" "), r = e.type === "dependency" || e.type === "realization" ? " stroke-dasharray=\"6 4\"" : "", i = kn(e.type, e.markerAt), a = [
1814
+ "class=\"class-relationship\"",
1815
+ `data-from="${n(e.from)}"`,
1816
+ `data-to="${n(e.to)}"`,
1817
+ `data-type="${e.type}"`,
1818
+ `data-marker-at="${e.markerAt}"`
1819
+ ];
1820
+ return e.label && a.push(`data-label="${n(e.label)}"`), e.fromCardinality && a.push(`data-from-cardinality="${n(e.fromCardinality)}"`), e.toCardinality && a.push(`data-to-cardinality="${n(e.toCardinality)}"`), `<polyline ${a.join(" ")} points="${t}" fill="none" stroke="var(--_line)" stroke-width="${z.connector}"${r}${i} />`;
1821
+ }
1822
+ function kn(e, t) {
1823
+ let n = An(e);
1824
+ return n ? t === "from" ? ` marker-start="url(#${n})"` : ` marker-end="url(#${n})"` : "";
1825
+ }
1826
+ function An(e) {
1827
+ switch (e) {
1828
+ case "inheritance":
1829
+ case "realization": return "cls-inherit";
1830
+ case "composition": return "cls-composition";
1831
+ case "aggregation": return "cls-aggregation";
1832
+ case "association":
1833
+ case "dependency": return "cls-arrow";
1834
+ default: return null;
1835
+ }
1836
+ }
1837
+ function jn(e, t) {
1838
+ if (!e.label && !e.fromCardinality && !e.toCardinality || e.points.length < 2) return "";
1839
+ let n = [];
1840
+ if (e.label) {
1841
+ let r = e.labelPosition ?? Mn(e.points);
1842
+ n.push(u(e.label, r.x, r.y - 8, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
1843
+ }
1844
+ if (e.fromCardinality && e.points.length >= 2) {
1845
+ let r = e.points[0], i = e.points[1], a = Nn(r, i);
1846
+ n.push(u(e.fromCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
1847
+ }
1848
+ if (e.toCardinality && e.points.length >= 2) {
1849
+ let r = e.points[e.points.length - 1], i = e.points[e.points.length - 2], a = Nn(r, i);
1850
+ n.push(u(e.toCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
1851
+ }
1852
+ return n.join("\n");
1853
+ }
1854
+ function Mn(e) {
1855
+ return e.length === 0 ? {
1856
+ x: 0,
1857
+ y: 0
1858
+ } : e[Math.floor(e.length / 2)];
1859
+ }
1860
+ function Nn(e, t) {
1861
+ let n = t.x - e.x, r = t.y - e.y;
1862
+ return Math.abs(n) > Math.abs(r) ? {
1863
+ x: n > 0 ? 14 : -14,
1864
+ y: -10
1865
+ } : {
1866
+ x: -14,
1867
+ y: r > 0 ? 14 : -14
1868
+ };
1869
+ }
1870
+ var Pn = r, q = {
1871
+ padding: 40,
1872
+ boxPadX: 14,
1873
+ headerHeight: 34,
1874
+ rowHeight: 22,
1875
+ minWidth: 140,
1876
+ attrFontSize: 11,
1877
+ attrFontWeight: 400,
1878
+ nodeSpacing: 70,
1879
+ layerSpacing: 90
1880
+ };
1881
+ function Fn(e, t) {
1882
+ let n = /* @__PURE__ */ new Map(), r = I(t.fontSizes);
1883
+ for (let t of e.entities) {
1884
+ let e = N(t.label, r.nodeLabel, L.nodeLabel), i = 0;
1885
+ for (let e of t.attributes) {
1886
+ let t = P(`${e.type} ${e.name}${e.keys.length > 0 ? " " + e.keys.join(",") : ""}`, q.attrFontSize);
1887
+ t > i && (i = t);
1888
+ }
1889
+ let a = Math.max(q.minWidth, e + q.boxPadX * 2, i + q.boxPadX * 2), o = q.headerHeight + Math.max(t.attributes.length, 1) * q.rowHeight;
1890
+ n.set(t.id, {
1891
+ width: a,
1892
+ height: o
1893
+ });
1894
+ }
1895
+ let i = [];
1896
+ for (let [e, t] of n) i.push(H(e, t));
1897
+ let a = { fontSize: r.edgeLabel }, o = [];
1898
+ for (let [t, n] of e.relationships.entries()) o.push(U({
1899
+ id: `e${t}`,
1900
+ source: n.entity1,
1901
+ target: n.entity2,
1902
+ label: n.label,
1903
+ labelStyle: a
1904
+ }));
1905
+ return {
1906
+ elkGraph: {
1907
+ id: "root",
1908
+ layoutOptions: {
1909
+ ...se({
1910
+ direction: ae(e.direction, ie.er),
1911
+ nodeSpacing: q.nodeSpacing,
1912
+ layerSpacing: q.layerSpacing,
1913
+ padding: q.padding
1914
+ }),
1915
+ "elk.edgeLabels.placement": "CENTER"
1916
+ },
1917
+ children: i,
1918
+ edges: o
1919
+ },
1920
+ entitySizes: n
1921
+ };
1922
+ }
1923
+ function In(e, t, n) {
1924
+ let r = /* @__PURE__ */ new Map();
1925
+ for (let e of t.entities) r.set(e.id, e);
1926
+ let i = [];
1927
+ for (let t of e.children ?? []) {
1928
+ let e = r.get(t.id);
1929
+ if (e) {
1930
+ let r = n.get(e.id);
1931
+ if (!r)
1932
+ /* v8 ignore next */
1933
+ throw Error(`Missing computed size for entity "${e.id}"`);
1934
+ i.push({
1935
+ id: e.id,
1936
+ label: e.label,
1937
+ attributes: e.attributes,
1938
+ x: t.x ?? 0,
1939
+ y: t.y ?? 0,
1940
+ width: t.width ?? r.width,
1941
+ height: t.height ?? r.height,
1942
+ headerHeight: q.headerHeight,
1943
+ rowHeight: q.rowHeight
1944
+ });
1945
+ }
1946
+ }
1947
+ let a = [];
1948
+ for (let [n, r] of (e.edges ?? []).entries()) {
1949
+ let e = t.relationships[n], i = Pe(r);
1950
+ a.push({
1951
+ entity1: e.entity1,
1952
+ entity2: e.entity2,
1953
+ cardinality1: e.cardinality1,
1954
+ cardinality2: e.cardinality2,
1955
+ label: e.label,
1956
+ identifying: e.identifying,
1957
+ points: i
1958
+ });
1959
+ }
1960
+ return {
1961
+ width: e.width ?? 600,
1962
+ height: e.height ?? 400,
1963
+ entities: i,
1964
+ relationships: a
1965
+ };
1966
+ }
1967
+ function Ln(e, t = {}) {
1968
+ if (e.entities.length === 0) return {
1969
+ width: 0,
1970
+ height: 0,
1971
+ entities: [],
1972
+ relationships: []
1973
+ };
1974
+ let { elkGraph: n, entitySizes: r } = Fn(e, t);
1975
+ return In(M(n, t.layoutCache), e, r);
1976
+ }
1977
+ //#endregion
1978
+ //#region packages/svg-renderer/src/er/renderer.ts
1979
+ var J = {
1980
+ attrSize: 11,
1981
+ attrWeight: 400,
1982
+ keySize: 9,
1983
+ keyWeight: 600
1984
+ };
1985
+ function Rn(e, n, r = "Inter", i = !1, a = F, o, s, c, l = {}) {
1986
+ let u = [];
1987
+ u.push(G(g(e.width, e.height, n, i, s, c, void 0, l.styleAttribute), o)), u.push(t(r, !0, l.nonce)), u.push("<defs>"), u.push("</defs>");
1988
+ for (let t of e.relationships) u.push(Vn(t));
1989
+ for (let t of e.entities) u.push(zn(t, a));
1990
+ for (let t of e.relationships) u.push(Un(t));
1991
+ for (let t of e.relationships) u.push(Hn(t, a));
1992
+ return u.push("</svg>"), u.join("\n");
1993
+ }
1994
+ function zn(e, t) {
1995
+ let { id: r, x: i, y: a, width: o, height: s, headerHeight: c, rowHeight: l, label: d, attributes: f } = e, p = [];
1996
+ p.push(`<g class="entity" data-id="${n(r)}" data-label="${n(d)}">`), p.push(` <rect x="${i}" y="${a}" width="${o}" height="${s}" rx="0" ry="0" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`), p.push(` <rect x="${i}" y="${a}" width="${o}" height="${c}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`), p.push(" " + u(d, i + o / 2, a + c / 2, t.nodeLabel, `text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="var(--_text)"`));
1997
+ let m = a + c;
1998
+ p.push(` <line x1="${i}" y1="${m}" x2="${i + o}" y2="${m}" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />`);
1999
+ for (let e = 0; e < f.length; e++) {
2000
+ let t = f[e], n = m + e * l + l / 2;
2001
+ p.push(" " + Bn(t, i, n, o).replace(/\n/g, "\n "));
2002
+ }
2003
+ return f.length === 0 && p.push(` <text x="${i + o / 2}" y="${m + l / 2}" text-anchor="middle" dy="${B}" font-size="${J.attrSize}" fill="var(--_text-faint)" font-style="italic">(no attributes)</text>`), p.push("</g>"), p.join("\n");
2004
+ }
2005
+ function Bn(e, t, n, r) {
2006
+ let i = [], a = e.comment && e.comment.length > 0;
2007
+ if (e.comment && e.comment.length > 0) {
2008
+ let t = e.comment.replace(/<br\s*\/?>/gi, "\n");
2009
+ i.push(`<g><title>${Kn(t)}</title>`);
2010
+ }
2011
+ let o = 0;
2012
+ e.keys.length > 0 && (o = N(e.keys.join(","), J.keySize, J.keyWeight) + 8, i.push(`<rect x="${t + 6}" y="${n - 7}" width="${o}" height="14" rx="2" ry="2" fill="var(--_key-badge)" />`), i.push(`<text x="${t + 6 + o / 2}" y="${n}" text-anchor="middle" dy="${B}" font-size="${J.keySize}" font-weight="${J.keyWeight}" fill="var(--_text-sec)">${e.keys.join(",")}</text>`));
2013
+ let s = t + 8 + (o > 0 ? o + 6 : 0);
2014
+ i.push(`<text x="${s}" y="${n}" class="mono" dy="${B}" font-size="${J.attrSize}" font-weight="${J.attrWeight}"><tspan fill="var(--_text-muted)">${Kn(e.type)}</tspan></text>`);
2015
+ let c = t + r - 8;
2016
+ return i.push(`<text x="${c}" y="${n}" class="mono" text-anchor="end" dy="${B}" font-size="${J.attrSize}" font-weight="${J.attrWeight}"><tspan fill="var(--_text-sec)">${Kn(e.name)}</tspan></text>`), a && i.push("</g>"), i.join("\n");
2017
+ }
2018
+ function Vn(e) {
2019
+ if (e.points.length < 2) return "";
2020
+ let t = e.points.map((e) => `${e.x},${e.y}`).join(" "), r = e.identifying ? "" : " stroke-dasharray=\"6 4\"", i = e.label ? ` data-label="${n(e.label)}"` : "";
2021
+ return `<polyline ${[
2022
+ "class=\"er-relationship\"",
2023
+ `data-entity1="${n(e.entity1)}"`,
2024
+ `data-entity2="${n(e.entity2)}"`,
2025
+ `data-cardinality1="${e.cardinality1}"`,
2026
+ `data-cardinality2="${e.cardinality2}"`,
2027
+ `data-identifying="${e.identifying}"`
2028
+ ].join(" ")}${i} points="${t}" fill="none" stroke="var(--_line)" stroke-width="${z.connector}"${r} />`;
2029
+ }
2030
+ function Hn(e, t) {
2031
+ if (!e.label || e.points.length < 2) return "";
2032
+ let n = Gn(e.points), r = o(e.label, t.edgeLabel, L.edgeLabel), i = r.width + 8, a = r.height + 6;
2033
+ return `<rect x="${n.x - i / 2}" y="${n.y - a / 2}" width="${i}" height="${a}" rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />\n${u(e.label, n.x, n.y, t.edgeLabel, `text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`;
2034
+ }
2035
+ function Un(e) {
2036
+ if (e.points.length < 2) return "";
2037
+ let t = [], n = e.points[0], r = e.points[1];
2038
+ t.push(Wn(n, r, e.cardinality1));
2039
+ let i = e.points[e.points.length - 1], a = e.points[e.points.length - 2];
2040
+ return t.push(Wn(i, a, e.cardinality2)), t.join("\n");
2041
+ }
2042
+ function Wn(e, t, n) {
2043
+ let r = [], i = z.connector + .25, a = e.x - t.x, o = e.y - t.y, s = Math.sqrt(a * a + o * o);
2044
+ if (s === 0) return "";
2045
+ let c = a / s, l = o / s, u = -l, d = c, f = e.x - c * 4, p = e.y - l * 4, m = e.x - c * 16, h = e.y - l * 16, g = n === "one" || n === "zero-one", _ = n === "many" || n === "zero-many", v = n === "zero-one" || n === "zero-many";
2046
+ if (g) {
2047
+ r.push(`<line x1="${f + u * 6}" y1="${p + d * 6}" x2="${f - u * 6}" y2="${p - d * 6}" stroke="var(--_line)" stroke-width="${i}" />`);
2048
+ let e = f - c * 4, t = p - l * 4;
2049
+ r.push(`<line x1="${e + u * 6}" y1="${t + d * 6}" x2="${e - u * 6}" y2="${t - d * 6}" stroke="var(--_line)" stroke-width="${i}" />`);
2050
+ }
2051
+ if (_) {
2052
+ let e = f, t = p;
2053
+ r.push(`<line x1="${e + u * 7}" y1="${t + d * 7}" x2="${m}" y2="${h}" stroke="var(--_line)" stroke-width="${i}" />`), r.push(`<line x1="${e}" y1="${t}" x2="${m}" y2="${h}" stroke="var(--_line)" stroke-width="${i}" />`), r.push(`<line x1="${e - u * 7}" y1="${t - d * 7}" x2="${m}" y2="${h}" stroke="var(--_line)" stroke-width="${i}" />`);
2054
+ }
2055
+ if (v) {
2056
+ let t = _ ? 20 : 12, n = e.x - c * t, a = e.y - l * t;
2057
+ r.push(`<circle cx="${n}" cy="${a}" r="4" fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`);
2058
+ }
2059
+ return r.join("\n");
2060
+ }
2061
+ function Gn(e) {
2062
+ if (e.length === 0) return {
2063
+ x: 0,
2064
+ y: 0
2065
+ };
2066
+ if (e.length === 1) return e[0];
2067
+ let t = 0;
2068
+ for (let n = 1; n < e.length; n++) {
2069
+ let r = e[n].x - e[n - 1].x, i = e[n].y - e[n - 1].y;
2070
+ t += Math.sqrt(r * r + i * i);
2071
+ }
2072
+ if (t === 0) return e[0];
2073
+ let n = t / 2, r = 0;
2074
+ for (let t = 1; t < e.length; t++) {
2075
+ let i = e[t].x - e[t - 1].x, a = e[t].y - e[t - 1].y, o = Math.sqrt(i * i + a * a);
2076
+ if (r + o >= n) {
2077
+ let s = o > 0 ? (n - r) / o : 0;
2078
+ return {
2079
+ x: e[t - 1].x + i * s,
2080
+ y: e[t - 1].y + a * s
2081
+ };
2082
+ }
2083
+ r += o;
2084
+ }
2085
+ return e[e.length - 1];
2086
+ }
2087
+ var Kn = r, qn = {
2088
+ padding: 30,
2089
+ actorGap: 140,
2090
+ actorHeight: 40,
2091
+ actorPadX: 16,
2092
+ headerGap: 20,
2093
+ messageRowHeight: 40,
2094
+ selfMessageHeight: 30,
2095
+ activationWidth: 10,
2096
+ blockPadX: 10,
2097
+ blockPadTop: 40,
2098
+ blockPadBottom: 8,
2099
+ blockHeaderExtra: 28,
2100
+ dividerExtra: 24,
2101
+ noteWidth: 60,
2102
+ notePadX: 12,
2103
+ notePadY: 6,
2104
+ noteGap: 10,
2105
+ noteOffsetAfterMessage: 8,
2106
+ noteStackGap: 4,
2107
+ boxPad: 10
2108
+ };
2109
+ function Jn(e) {
2110
+ return e + 8;
2111
+ }
2112
+ function Yn(e) {
2113
+ return {
2114
+ ...qn,
2115
+ actorHeight: e?.actorHeight ?? qn.actorHeight,
2116
+ headerGap: e?.headerGap ?? qn.headerGap,
2117
+ messageRowHeight: e?.messageRowHeight ?? qn.messageRowHeight,
2118
+ noteOffsetAfterMessage: e?.noteOffsetAfterMessage ?? qn.noteOffsetAfterMessage,
2119
+ noteStackGap: e?.noteStackGap ?? qn.noteStackGap
2120
+ };
2121
+ }
2122
+ function Xn(e, t = {}) {
2123
+ if (e.actors.length === 0) return {
2124
+ width: 0,
2125
+ height: 0,
2126
+ actors: [],
2127
+ lifelines: [],
2128
+ messages: [],
2129
+ activations: [],
2130
+ blocks: [],
2131
+ notes: [],
2132
+ boxes: []
2133
+ };
2134
+ let n = Yn(t.sequence), r = I(t.fontSizes), i = e.actors.map((e) => {
2135
+ let t = N(e.label, r.nodeLabel, L.nodeLabel);
2136
+ return Math.max(t + n.actorPadX * 2, 80);
2137
+ }), a = [], o = n.padding + i[0] / 2;
2138
+ for (let t = 0; t < e.actors.length; t++) {
2139
+ if (t > 0) {
2140
+ let e = Math.max(n.actorGap, (i[t - 1] + i[t]) / 2 + 40);
2141
+ o += e;
2142
+ }
2143
+ a.push(o);
2144
+ }
2145
+ let s = /* @__PURE__ */ new Map();
2146
+ for (let t = 0; t < e.actors.length; t++) s.set(e.actors[t].id, t);
2147
+ let c = e.boxes.filter((e) => e.actorIds.length > 0), l = c.some((e) => e.label !== ""), u = c.length === 0 ? 0 : n.boxPad + (l ? Jn(r.edgeLabel) : 0), d = n.padding + u, f = e.actors.map((e, t) => ({
2148
+ id: e.id,
2149
+ label: e.label,
2150
+ type: e.type,
2151
+ x: a[t],
2152
+ y: d,
2153
+ width: i[t],
2154
+ height: n.actorHeight
2155
+ })), p = c.map((e) => {
2156
+ let t = e.actorIds.map((e) => s.get(e) ?? 0), r = Math.min(...t), o = Math.max(...t), c = a[r] - i[r] / 2 - n.boxPad, l = a[o] + i[o] / 2 + n.boxPad, u = {
2157
+ label: e.label,
2158
+ x: c,
2159
+ y: n.padding,
2160
+ width: l - c,
2161
+ height: 0
2162
+ };
2163
+ return e.color !== void 0 && (u.color = e.color), u;
2164
+ }), m = d + n.actorHeight + n.headerGap, h = [], g = /* @__PURE__ */ new Map();
2165
+ for (let t of e.blocks) {
2166
+ let e = g.get(t.startIndex) ?? 0;
2167
+ g.set(t.startIndex, Math.max(e, n.blockHeaderExtra));
2168
+ for (let e of t.dividers) {
2169
+ let t = g.get(e.index) ?? 0;
2170
+ g.set(e.index, Math.max(t, n.dividerExtra));
2171
+ }
2172
+ }
2173
+ let _ = /* @__PURE__ */ new Map();
2174
+ for (let t of e.notes) {
2175
+ let e = _.get(t.afterIndex) ?? [];
2176
+ e.push(t), _.set(t.afterIndex, e);
2177
+ }
2178
+ let v = [], y = _.get(-1);
2179
+ if (y && y.length > 0) {
2180
+ let e = m;
2181
+ for (let t of y) {
2182
+ let o = Math.max(n.noteWidth, N(t.text, r.edgeLabel, L.edgeLabel) + n.notePadX * 2), c = r.edgeLabel + n.notePadY * 2, l = s.get(t.actorIds[0] ?? "") ?? 0, u;
2183
+ if (t.position === "left") u = a[l] - i[l] / 2 - o - n.noteGap;
2184
+ else if (t.position === "right") u = a[l] + i[l] / 2 + n.noteGap;
2185
+ else if (t.actorIds.length > 1) {
2186
+ let e = s.get(t.actorIds[t.actorIds.length - 1] ?? "") ?? l;
2187
+ u = (a[l] + a[e]) / 2 - o / 2;
2188
+ } else u = a[l] - o / 2;
2189
+ v.push({
2190
+ text: t.text,
2191
+ x: u,
2192
+ y: e,
2193
+ width: o,
2194
+ height: c,
2195
+ position: t.position,
2196
+ actors: t.actorIds
2197
+ }), e += c + n.noteStackGap;
2198
+ }
2199
+ m = Math.max(m, e + n.messageRowHeight / 2);
2200
+ }
2201
+ let b = /* @__PURE__ */ new Map(), x = [];
2202
+ function S(e, t) {
2203
+ let n = b.get(e) ?? [];
2204
+ b.set(e, n);
2205
+ let r = n.length;
2206
+ n.push({
2207
+ startY: t,
2208
+ depth: r
2209
+ });
2210
+ }
2211
+ function C(e, t) {
2212
+ let r = b.get(e);
2213
+ if (!r || r.length === 0) return;
2214
+ let { startY: i, depth: o } = r.pop(), c = s.get(e) ?? 0, l = o * 4;
2215
+ x.push({
2216
+ actorId: e,
2217
+ x: a[c] - n.activationWidth / 2 + l,
2218
+ topY: i,
2219
+ bottomY: t,
2220
+ width: n.activationWidth
2221
+ });
2222
+ }
2223
+ let w = /* @__PURE__ */ new Map();
2224
+ for (let t of e.activations) {
2225
+ let e = w.get(t.afterIndex) ?? [];
2226
+ e.push(t), w.set(t.afterIndex, e);
2227
+ }
2228
+ function T(e, t) {
2229
+ for (let n of w.get(e) ?? []) n.kind === "start" ? S(n.actorId, t) : C(n.actorId, t);
2230
+ }
2231
+ T(-1, m);
2232
+ for (let t = 0; t < e.messages.length; t++) {
2233
+ let o = e.messages[t], c = s.get(o.from) ?? 0, l = s.get(o.to) ?? 0, u = o.from === o.to, d = g.get(t) ?? 0;
2234
+ d > 0 && (m += d);
2235
+ let f = a[c], p = a[l], y = !u && e.actors[l].createdAt === t;
2236
+ if (y) {
2237
+ let e = i[l] / 2;
2238
+ p += f < p ? -e : e;
2239
+ }
2240
+ h.push({
2241
+ from: o.from,
2242
+ to: o.to,
2243
+ label: o.label,
2244
+ lineStyle: o.lineStyle,
2245
+ arrowHead: o.arrowHead,
2246
+ x1: f,
2247
+ x2: p,
2248
+ y: m,
2249
+ isSelf: u,
2250
+ bidirectional: o.bidirectional ?? !1,
2251
+ seqNumber: o.seqNumber
2252
+ }), o.activate && S(o.to, m), o.deactivate && C(o.from, m), T(t, m), m += u ? n.selfMessageHeight + n.messageRowHeight : n.messageRowHeight, y && (m += n.actorHeight / 2);
2253
+ let b = _.get(t);
2254
+ if (b && b.length > 0) {
2255
+ let e = u ? n.selfMessageHeight : 0, o = h[t].y + e + n.noteOffsetAfterMessage;
2256
+ for (let e of b) {
2257
+ let t = Math.max(n.noteWidth, N(e.text, r.edgeLabel, L.edgeLabel) + n.notePadX * 2), c = r.edgeLabel + n.notePadY * 2, l = s.get(e.actorIds[0] ?? "") ?? 0, u;
2258
+ if (e.position === "left") u = a[l] - i[l] / 2 - t - n.noteGap;
2259
+ else if (e.position === "right") u = a[l] + i[l] / 2 + n.noteGap;
2260
+ else if (e.actorIds.length > 1) {
2261
+ let n = s.get(e.actorIds[e.actorIds.length - 1] ?? "") ?? l;
2262
+ u = (a[l] + a[n]) / 2 - t / 2;
2263
+ } else u = a[l] - t / 2;
2264
+ v.push({
2265
+ text: e.text,
2266
+ x: u,
2267
+ y: o,
2268
+ width: t,
2269
+ height: c,
2270
+ position: e.position,
2271
+ actors: e.actorIds
2272
+ }), o += c + n.noteStackGap;
2273
+ }
2274
+ m = Math.max(m, o + n.messageRowHeight / 2);
2275
+ }
2276
+ }
2277
+ for (let [e, t] of b) for (let { startY: r, depth: i } of t) {
2278
+ let t = s.get(e) ?? 0, o = i * 4;
2279
+ x.push({
2280
+ actorId: e,
2281
+ x: a[t] - n.activationWidth / 2 + o,
2282
+ topY: r,
2283
+ bottomY: m - n.messageRowHeight / 2,
2284
+ width: n.activationWidth
2285
+ });
2286
+ }
2287
+ let E = e.blocks.map((t) => {
2288
+ let o = h[t.startIndex], c = h[t.endIndex], l = (o?.y ?? m) - n.blockPadTop, u = (c?.y ?? m) + n.blockPadBottom + 12, d = /* @__PURE__ */ new Set();
2289
+ for (let n = t.startIndex; n <= t.endIndex; n++) {
2290
+ let t = e.messages[n];
2291
+ t && (d.add(s.get(t.from) ?? 0), d.add(s.get(t.to) ?? 0));
2292
+ }
2293
+ if (d.size === 0) for (let t = 0; t < e.actors.length; t++) d.add(t);
2294
+ let f = Math.min(...d), p = Math.max(...d), g = a[f] - i[f] / 2 - n.blockPadX, _ = a[p] + i[p] / 2 + n.blockPadX, v = t.dividers.map((e) => {
2295
+ let t = h[e.index], n = t?.y ?? m, i = 28;
2296
+ if (e.label && t?.label) {
2297
+ let n = N(`[${e.label}]`, r.edgeLabel, L.edgeLabel), a = g + 8, o = a + n, s = N(t.label, r.edgeLabel, L.edgeLabel), c = t.isSelf ? t.x1 + 36 : (t.x1 + t.x2) / 2 - s / 2, l = c + s;
2298
+ o > c && a < l && (i = 36);
2299
+ }
2300
+ return {
2301
+ y: n - i,
2302
+ label: e.label
2303
+ };
2304
+ });
2305
+ return {
2306
+ type: t.type,
2307
+ label: t.label,
2308
+ x: g,
2309
+ y: l,
2310
+ width: _ - g,
2311
+ height: u - l,
2312
+ dividers: v
2313
+ };
2314
+ }), D = v, O = m + n.padding, k = n.padding, A = 0;
2315
+ for (let e of f) k = Math.min(k, e.x - e.width / 2), A = Math.max(A, e.x + e.width / 2);
2316
+ for (let e of E) k = Math.min(k, e.x), A = Math.max(A, e.x + e.width);
2317
+ for (let e of D) k = Math.min(k, e.x), A = Math.max(A, e.x + e.width);
2318
+ for (let e of p) k = Math.min(k, e.x), A = Math.max(A, e.x + e.width);
2319
+ for (let e of h) if (e.isSelf && e.label) {
2320
+ let t = e.x1 + 30 + 8, n = N(e.label, r.edgeLabel, L.edgeLabel);
2321
+ A = Math.max(A, t + n + 8);
2322
+ }
2323
+ let j = k < n.padding ? n.padding - k : 0;
2324
+ if (j > 0) {
2325
+ for (let e of f) e.x += j;
2326
+ for (let e of h) e.x1 += j, e.x2 += j;
2327
+ for (let e of x) e.x += j;
2328
+ for (let e of E) e.x += j;
2329
+ for (let e of D) e.x += j;
2330
+ for (let e of p) e.x += j;
2331
+ for (let e = 0; e < a.length; e++) a[e] += j;
2332
+ }
2333
+ for (let t = 0; t < e.actors.length; t++) {
2334
+ let r = e.actors[t].createdAt;
2335
+ r !== void 0 && (f[t].y = (h[r]?.y ?? m) - n.actorHeight / 2);
2336
+ }
2337
+ let M = e.actors.map((e, t) => {
2338
+ let r = e.destroyedAt, i = {
2339
+ actorId: e.id,
2340
+ x: a[t],
2341
+ topY: f[t].y + n.actorHeight,
2342
+ bottomY: r === void 0 ? O - n.padding : h[r]?.y ?? m
2343
+ };
2344
+ return r !== void 0 && (i.destroyed = !0), i;
2345
+ });
2346
+ for (let e of p) e.height = O - n.padding + n.boxPad - e.y;
2347
+ let P = A + j + n.padding;
2348
+ return {
2349
+ width: Math.max(P, 200),
2350
+ height: Math.max(O, 100),
2351
+ actors: f,
2352
+ lifelines: M,
2353
+ messages: h,
2354
+ activations: x,
2355
+ blocks: E,
2356
+ notes: D,
2357
+ boxes: p
2358
+ };
2359
+ }
2360
+ //#endregion
2361
+ //#region packages/svg-renderer/src/sequence/renderer.ts
2362
+ function Zn(e, n, r = "Inter", i = !1, a = F, o, s, c, l = {}) {
2363
+ let u = [];
2364
+ u.push(G(g(e.width, e.height, n, i, s, c, void 0, l.styleAttribute), o)), u.push(t(r, !1, l.nonce)), u.push("<defs>"), u.push(Qn()), u.push("</defs>");
2365
+ for (let t of e.boxes) u.push(or(t, a));
2366
+ for (let t of e.blocks) u.push(sr(t, a));
2367
+ for (let t of e.lifelines) u.push(er(t));
2368
+ for (let t of e.activations) u.push(nr(t));
2369
+ for (let t of e.messages) u.push(rr(t, a));
2370
+ for (let t of e.notes) u.push(cr(t, a));
2371
+ for (let t of e.actors) u.push($n(t, a));
2372
+ return u.push("</svg>"), u.join("\n");
2373
+ }
2374
+ function Qn() {
2375
+ let e = V.width, t = V.height;
2376
+ return ` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">\n <polygon points="0 0, ${e} ${t / 2}, 0 ${t}" fill="var(--_arrow)" />\n </marker>\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">\n <polyline points="0 0, ${e} ${t / 2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />\n </marker>`;
2377
+ }
2378
+ function $n(e, t) {
2379
+ let { id: r, x: i, y: a, width: o, height: s, label: c, type: l } = e, d = [];
2380
+ if (d.push(`<g class="actor" data-id="${n(r)}" data-label="${n(c)}" data-type="${l}">`), l === "actor") {
2381
+ let e = s / 24 * .9, n = i - 12 * e, r = a + (s - 24 * e) / 2, o = z.outerBox / e, l = "var(--_line)";
2382
+ d.push(` <g transform="translate(${n},${r}) scale(${e})">\n <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" fill="none" stroke="${l}" stroke-width="${o}" />\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${l}" stroke-width="${o}" />\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${l}" stroke-width="${o}" />\n </g>`), d.push(" " + u(c, i, a + s + 14, t.nodeLabel, `font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${L.nodeLabel}" fill="var(--_text)"`));
2383
+ } else {
2384
+ let e = i - o / 2;
2385
+ d.push(` <rect x="${e}" y="${a}" width="${o}" height="${s}" rx="4" ry="4" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`), d.push(" " + u(c, i, a + s / 2, t.nodeLabel, `font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${L.nodeLabel}" fill="var(--_text)"`));
2386
+ }
2387
+ return d.push("</g>"), d.join("\n");
2388
+ }
2389
+ function er(e) {
2390
+ let t = `<line class="lifeline" data-actor="${n(e.actorId)}" x1="${e.x}" y1="${e.topY}" x2="${e.x}" y2="${e.bottomY}" stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`;
2391
+ if (!e.destroyed) return t;
2392
+ let { x: r, bottomY: i } = e, a = tr;
2393
+ return t + `\n<path class="destroy" data-actor="${n(e.actorId)}" d="M${r - a} ${i - a} L${r + a} ${i + a} M${r + a} ${i - a} L${r - a} ${i + a}" fill="none" stroke="var(--_line)" stroke-width="${z.outerBox}" stroke-linecap="round" />`;
2394
+ }
2395
+ var tr = 8;
2396
+ function nr(e) {
2397
+ return `<rect class="activation" data-actor="${n(e.actorId)}" x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY - e.topY}" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />`;
2398
+ }
2399
+ function rr(e, t) {
2400
+ let r = [], i = e.lineStyle === "dashed" ? " stroke-dasharray=\"6 4\"" : "", a = e.arrowHead === "filled" ? "seq-arrow" : "seq-arrow-open", o = e.bidirectional ? ` marker-start="url(#${a})"` : "";
2401
+ if (r.push(`<g class="message" data-from="${n(e.from)}" data-to="${n(e.to)}" data-label="${n(e.label)}" data-line-style="${e.lineStyle}" data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`), e.isSelf) r.push(` <polyline points="${e.x1},${e.y} ${e.x1 + 30},${e.y} ${e.x1 + 30},${e.y + 20} ${e.x2},${e.y + 20}" fill="none" stroke="var(--_line)" stroke-width="${z.connector}"${i} marker-end="url(#${a})"${o} />`), r.push(" " + u(e.label, e.x1 + 30 + 8, e.y + 10, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="start" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
2402
+ else {
2403
+ r.push(` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" stroke="var(--_line)" stroke-width="${z.connector}"${i} marker-end="url(#${a})"${o} />`);
2404
+ let n = (e.x1 + e.x2) / 2;
2405
+ r.push(" " + u(e.label, n, e.y - 10, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
2406
+ }
2407
+ return e.seqNumber !== void 0 && r.push(" " + ir(e, t)), r.push("</g>"), r.join("\n");
2408
+ }
2409
+ function ir(e, t) {
2410
+ let n = Math.max(t.edgeLabel - 2, 8), r = e.bidirectional ? e.x1 + Math.sign(e.x2 - e.x1) * (8 + V.width) : e.x1;
2411
+ return `<g class="seq-number"><circle cx="${r}" cy="${e.y}" r="8" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${z.innerBox}" />` + u(String(e.seqNumber), r, e.y, n, `font-size="${n}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_arrow)"`) + "</g>";
2412
+ }
2413
+ var ar = 35;
2414
+ function or(e, t) {
2415
+ let r = e.label ? ` data-label="${n(e.label)}"` : "", i = e.color === void 0 ? "" : ` data-color="${n(e.color)}"`, a = e.color === void 0 ? "none" : `color-mix(in srgb, ${n(e.color)} ${ar}%, var(--bg))`, o = [`<g class="participant-box"${r}${i}>`, ` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" fill="${a}" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />`];
2416
+ return e.label && o.push(" " + u(e.label, e.x + e.width / 2, e.y + Jn(t.edgeLabel) / 2, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)), o.push("</g>"), o.join("\n");
2417
+ }
2418
+ function sr(e, t) {
2419
+ let r = [], i = e.label ? ` data-label="${n(e.label)}"` : "";
2420
+ r.push(`<g class="block" data-type="${n(e.type)}"${i}>`), r.push(` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`);
2421
+ let a = `${e.type}${e.label ? ` [${e.label}]` : ""}`, o = a.split("\n")[0], s = N(o, t.edgeLabel, L.groupHeader) + 16;
2422
+ r.push(` <rect x="${e.x}" y="${e.y}" width="${s}" height="18" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${z.outerBox}" />`), r.push(" " + u(a, e.x + 6, e.y + 9, t.edgeLabel, `font-size="${t.edgeLabel}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));
2423
+ for (let n of e.dividers) r.push(` <line x1="${e.x}" y1="${n.y}" x2="${e.x + e.width}" y2="${n.y}" stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`), n.label && r.push(" " + u(`[${n.label}]`, e.x + 8, n.y + 14, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="start" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
2424
+ return r.push("</g>"), r.join("\n");
2425
+ }
2426
+ function cr(e, t) {
2427
+ let { x: r, y: i, width: a, height: o } = e, s = e.actors && e.actors.length > 0 ? ` data-actors="${e.actors.map(n).join(",")}"` : "";
2428
+ return `<g class="note"${e.position ? ` data-position="${n(e.position)}"` : ""}${s}>\n <polygon points="${[
2429
+ `${r},${i}`,
2430
+ `${r + a - 6},${i}`,
2431
+ `${r + a},${i + 6}`,
2432
+ `${r + a},${i + o}`,
2433
+ `${r},${i + o}`
2434
+ ].join(" ")}" fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />\n <polygon points="${r + a - 6},${i} ${r + a},${i + 6} ${r + a - 6},${i + 6}" fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${z.innerBox}" />\n ${u(e.text, r + a / 2, i + o / 2, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}\n</g>`;
2435
+ }
2436
+ //#endregion
2437
+ //#region packages/svg-renderer/src/xychart/layout.ts
2438
+ var Y = {
2439
+ plotWidth: 600,
2440
+ plotHeight: 340,
2441
+ padding: 22,
2442
+ titleFontSize: 18,
2443
+ titleFontWeight: 600,
2444
+ titleHeight: 42,
2445
+ axisLabelFontSize: 14,
2446
+ axisLabelFontWeight: 400,
2447
+ axisTitleFontSize: 15,
2448
+ axisTitleFontWeight: 500,
2449
+ xLabelHeight: 38,
2450
+ yLabelWidth: 58,
2451
+ yLabelGap: 18,
2452
+ axisTitlePad: 30,
2453
+ tickLength: 4,
2454
+ barPadRatio: .2,
2455
+ barGroupGap: 0,
2456
+ maxBarWidth: 40,
2457
+ legendFontSize: 14,
2458
+ legendFontWeight: 400,
2459
+ legendHeight: 28,
2460
+ legendSwatchW: 14,
2461
+ legendSwatchH: 14,
2462
+ legendGap: 6,
2463
+ legendItemGap: 16
2464
+ };
2465
+ function lr(e, t = {}) {
2466
+ return e.horizontal ? dr(e) : ur(e);
2467
+ }
2468
+ function ur(e) {
2469
+ let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
2470
+ if (!a)
2471
+ /* v8 ignore next */
2472
+ throw Error("XY chart: y-axis range was not set by the parser");
2473
+ let o = _r(a.min, a.max), s = Math.max(...o.map((e) => N(vr(e), Y.axisLabelFontSize, Y.axisLabelFontWeight)), Y.yLabelWidth), c = Y.padding + (t ? Y.titleHeight : 0) + (i ? Y.legendHeight : 0), l = Y.padding + Y.xLabelHeight + (n ? Y.axisTitlePad : 0), u = Y.padding + s + Y.yLabelGap + (r ? Y.axisTitlePad : 0), d = Y.padding, f = Y.plotWidth, p = Y.plotHeight, m = u + f + d, h = c + p + l, g = {
2474
+ x: u,
2475
+ y: c,
2476
+ width: f,
2477
+ height: p
2478
+ }, _ = fr(e), v = (e) => u + (e + .5) * (f / _), y = f / _, b = (e) => {
2479
+ let t = (e - a.min) / (a.max - a.min || 1);
2480
+ return c + p - t * p;
2481
+ }, x = mr(e, v, c + p, y), S = o.map((e) => ({
2482
+ label: vr(e),
2483
+ x: u,
2484
+ y: b(e),
2485
+ tx: u - Y.tickLength,
2486
+ ty: b(e),
2487
+ labelX: u - Y.yLabelGap,
2488
+ labelY: b(e),
2489
+ textAnchor: "end"
2490
+ })), C = o.map((e) => ({
2491
+ x1: u,
2492
+ y1: b(e),
2493
+ x2: u + f,
2494
+ y2: b(e)
2495
+ })), w = pr(e, _), T = e.series.map((e, t) => t), E = hr(e, v, b, y, a.min, w, T), D = gr(e, v, b, w, T), O = Y.padding + (t ? Y.titleHeight : 0) + Y.legendHeight / 2, k = i ? yr(e, m / 2, O, T) : [], A = {
2496
+ x1: u,
2497
+ y1: c + p,
2498
+ x2: u + f,
2499
+ y2: c + p
2500
+ }, j = {
2501
+ x1: u,
2502
+ y1: c,
2503
+ x2: u,
2504
+ y2: c + p
2505
+ }, M = {
2506
+ ticks: x,
2507
+ line: A,
2508
+ ...e.xAxis.title ? { title: {
2509
+ text: e.xAxis.title,
2510
+ x: u + f / 2,
2511
+ y: h - Y.padding
2512
+ } } : {}
2513
+ }, P = {
2514
+ ticks: S,
2515
+ line: j,
2516
+ ...e.yAxis.title ? { title: {
2517
+ text: e.yAxis.title,
2518
+ x: Y.padding + 4,
2519
+ y: c + p / 2,
2520
+ rotate: -90
2521
+ } } : {}
2522
+ };
2523
+ return {
2524
+ width: m,
2525
+ height: h,
2526
+ title: e.title ? {
2527
+ text: e.title,
2528
+ x: m / 2,
2529
+ y: Y.padding + Y.titleFontSize
2530
+ } : void 0,
2531
+ xAxis: M,
2532
+ yAxis: P,
2533
+ plotArea: g,
2534
+ bars: E,
2535
+ lines: D,
2536
+ gridLines: C,
2537
+ legend: k
2538
+ };
2539
+ }
2540
+ function dr(e) {
2541
+ let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
2542
+ if (!a)
2543
+ /* v8 ignore next */
2544
+ throw Error("XY chart: y-axis range was not set by the parser");
2545
+ let o = _r(a.min, a.max), s = fr(e), c = pr(e, s), l = Math.max(...c.map((e) => N(e, Y.axisLabelFontSize, Y.axisLabelFontWeight)), 40), u = Y.padding + (t ? Y.titleHeight : 0) + (i ? Y.legendHeight : 0), d = Y.padding + Y.xLabelHeight + (r ? Y.axisTitlePad : 0), f = Y.padding + l + Y.yLabelGap + (n ? Y.axisTitlePad : 0), p = Y.padding, m = Y.plotWidth, h = Y.plotHeight, g = f + m + p, _ = u + h + d, v = {
2546
+ x: f,
2547
+ y: u,
2548
+ width: m,
2549
+ height: h
2550
+ }, y = (e) => {
2551
+ let t = (e - a.min) / (a.max - a.min || 1);
2552
+ return f + t * m;
2553
+ }, b = h / s, x = (e) => u + (e + .5) * b, S = o.map((e) => ({
2554
+ label: vr(e),
2555
+ x: y(e),
2556
+ y: u + h,
2557
+ tx: y(e),
2558
+ ty: u + h + Y.tickLength,
2559
+ labelX: y(e),
2560
+ labelY: u + h + 18,
2561
+ textAnchor: "middle"
2562
+ })), C = c.map((e, t) => ({
2563
+ label: e,
2564
+ x: f,
2565
+ y: x(t),
2566
+ tx: f - Y.tickLength,
2567
+ ty: x(t),
2568
+ labelX: f - Y.yLabelGap,
2569
+ labelY: x(t),
2570
+ textAnchor: "end"
2571
+ })), w = o.map((e) => ({
2572
+ x1: y(e),
2573
+ y1: u,
2574
+ x2: y(e),
2575
+ y2: u + h
2576
+ })), T = e.series.map((e, t) => t), E = e.series.filter((e) => e.type === "bar").length, D = [];
2577
+ if (E > 0) {
2578
+ let t = b * (1 - Y.barPadRatio), n = E > 1 ? (t - (E - 1) * Y.barGroupGap) / E : t, r = Math.min(n, Y.maxBarWidth), i = E > 1 ? r * E + Y.barGroupGap * (E - 1) : r, o = 0, s = 0;
2579
+ for (let t of e.series) {
2580
+ if (t.type !== "bar") {
2581
+ s++;
2582
+ continue;
2583
+ }
2584
+ for (let e = 0; e < t.data.length; e++) {
2585
+ let n = x(e) - i / 2 + o * (r + Y.barGroupGap), l = y(Math.max(t.data[e], a.min)), u = y(Math.max(0, a.min));
2586
+ D.push({
2587
+ x: Math.min(u, l),
2588
+ y: n,
2589
+ width: Math.abs(l - u),
2590
+ height: r,
2591
+ value: t.data[e],
2592
+ label: c[e],
2593
+ seriesIndex: o,
2594
+ colorIndex: T[s]
2595
+ });
2596
+ }
2597
+ o++, s++;
2598
+ }
2599
+ }
2600
+ let O = [], k = 0, A = 0;
2601
+ for (let t of e.series) {
2602
+ if (t.type !== "line") {
2603
+ A++;
2604
+ continue;
2605
+ }
2606
+ let e = t.data.map((e, t) => ({
2607
+ x: y(e),
2608
+ y: x(t),
2609
+ value: e,
2610
+ label: c[t]
2611
+ }));
2612
+ O.push({
2613
+ points: e,
2614
+ seriesIndex: k,
2615
+ colorIndex: T[A]
2616
+ }), k++, A++;
2617
+ }
2618
+ let j = {
2619
+ x1: f,
2620
+ y1: u + h,
2621
+ x2: f + m,
2622
+ y2: u + h
2623
+ }, M = {
2624
+ x1: f,
2625
+ y1: u,
2626
+ x2: f,
2627
+ y2: u + h
2628
+ }, P = {
2629
+ ticks: S,
2630
+ line: j,
2631
+ ...e.yAxis.title ? { title: {
2632
+ text: e.yAxis.title,
2633
+ x: f + m / 2,
2634
+ y: _ - Y.padding
2635
+ } } : {}
2636
+ }, ee = {
2637
+ ticks: C,
2638
+ line: M,
2639
+ ...e.xAxis.title ? { title: {
2640
+ text: e.xAxis.title,
2641
+ x: Y.padding + 4,
2642
+ y: u + h / 2,
2643
+ rotate: -90
2644
+ } } : {}
2645
+ }, te = e.title ? {
2646
+ text: e.title,
2647
+ x: g / 2,
2648
+ y: Y.padding + Y.titleFontSize
2649
+ } : void 0, F = Y.padding + (t ? Y.titleHeight : 0) + Y.legendHeight / 2;
2650
+ return {
2651
+ width: g,
2652
+ height: _,
2653
+ horizontal: !0,
2654
+ title: te,
2655
+ xAxis: P,
2656
+ yAxis: ee,
2657
+ plotArea: v,
2658
+ bars: D,
2659
+ lines: O,
2660
+ gridLines: w,
2661
+ legend: i ? yr(e, g / 2, F, T) : []
2662
+ };
2663
+ }
2664
+ function fr(e) {
2665
+ if (e.xAxis.categories) return e.xAxis.categories.length;
2666
+ for (let t of e.series) if (t.data.length > 0) return t.data.length;
2667
+ return 1;
2668
+ }
2669
+ function pr(e, t) {
2670
+ if (e.xAxis.categories) return e.xAxis.categories;
2671
+ if (e.xAxis.range) {
2672
+ let { min: n, max: r } = e.xAxis.range, i = t > 1 ? (r - n) / (t - 1) : 0;
2673
+ return Array.from({ length: t }, (e, t) => vr(n + i * t));
2674
+ }
2675
+ return Array.from({ length: t }, (e, t) => String(t + 1));
2676
+ }
2677
+ function mr(e, t, n, r) {
2678
+ return pr(e, fr(e)).map((e, r) => ({
2679
+ label: e,
2680
+ x: t(r),
2681
+ y: n,
2682
+ tx: t(r),
2683
+ ty: n + Y.tickLength,
2684
+ labelX: t(r),
2685
+ labelY: n + 18,
2686
+ textAnchor: "middle"
2687
+ }));
2688
+ }
2689
+ function hr(e, t, n, r, i, a, o) {
2690
+ let s = e.series.filter((e) => e.type === "bar").length;
2691
+ if (s === 0) return [];
2692
+ let c = r * (1 - Y.barPadRatio), l = s > 1 ? (c - (s - 1) * Y.barGroupGap) / s : c, u = Math.min(l, Y.maxBarWidth), d = s > 1 ? u * s + Y.barGroupGap * (s - 1) : u, f = [], p = 0, m = 0;
2693
+ for (let r of e.series) {
2694
+ if (r.type !== "bar") {
2695
+ m++;
2696
+ continue;
2697
+ }
2698
+ for (let e = 0; e < r.data.length; e++) {
2699
+ let s = t(e) - d / 2 + p * (u + Y.barGroupGap), c = n(r.data[e]), l = n(Math.max(0, i));
2700
+ f.push({
2701
+ x: s,
2702
+ y: Math.min(c, l),
2703
+ width: u,
2704
+ height: Math.abs(l - c),
2705
+ value: r.data[e],
2706
+ label: a[e],
2707
+ seriesIndex: p,
2708
+ colorIndex: o[m]
2709
+ });
2710
+ }
2711
+ p++, m++;
2712
+ }
2713
+ return f;
2714
+ }
2715
+ function gr(e, t, n, r, i) {
2716
+ let a = [], o = 0, s = 0;
2717
+ for (let c of e.series) {
2718
+ if (c.type !== "line") {
2719
+ s++;
2720
+ continue;
2721
+ }
2722
+ let e = c.data.map((e, i) => ({
2723
+ x: t(i),
2724
+ y: n(e),
2725
+ value: e,
2726
+ label: r[i]
2727
+ }));
2728
+ a.push({
2729
+ points: e,
2730
+ seriesIndex: o,
2731
+ colorIndex: i[s]
2732
+ }), o++, s++;
2733
+ }
2734
+ return a;
2735
+ }
2736
+ function _r(e, t) {
2737
+ let n = t - e;
2738
+ if (n <= 0) return [e];
2739
+ let r = n / 6, i = 10 ** Math.floor(Math.log10(r)), a = r / i, o;
2740
+ o = a <= 1.5 ? i : a <= 3 ? 2 * i : a <= 7 ? 5 * i : 10 * i;
2741
+ let s = Math.ceil(e / o) * o, c = [];
2742
+ for (let e = s; e <= t + o * .001; e += o) c.push(Math.round(e * 1e10) / 1e10);
2743
+ return c;
2744
+ }
2745
+ function vr(e) {
2746
+ return Number.isInteger(e) ? String(e) : e.toFixed(+(Math.abs(e) < 10));
2747
+ }
2748
+ function yr(e, t, n, r) {
2749
+ let i = [], a = 0, o = 0;
2750
+ for (let t = 0; t < e.series.length; t++) {
2751
+ let s = e.series[t], c = s.type === "bar" ? `Bar ${a + 1}` : `Line ${o + 1}`;
2752
+ i.push({
2753
+ label: c,
2754
+ x: 0,
2755
+ y: n,
2756
+ type: s.type,
2757
+ seriesIndex: s.type === "bar" ? a : o,
2758
+ colorIndex: r[t]
2759
+ }), s.type === "bar" ? a++ : o++;
2760
+ }
2761
+ let s = i.map((e) => {
2762
+ let t = N(e.label, Y.legendFontSize, Y.legendFontWeight);
2763
+ return Y.legendSwatchW + Y.legendGap + t;
2764
+ }), c = t - (s.reduce((e, t) => e + t, 0) + (i.length - 1) * Y.legendItemGap) / 2;
2765
+ for (let e = 0; e < i.length; e++) i[e].x = c, c += s[e] + Y.legendItemGap;
2766
+ return i;
2767
+ }
2768
+ //#endregion
2769
+ //#region packages/svg-renderer/src/xychart/renderer.ts
2770
+ var X = {
2771
+ titleSize: 18,
2772
+ titleWeight: 600,
2773
+ axisTitleSize: 15,
2774
+ axisTitleWeight: 500,
2775
+ labelSize: 14,
2776
+ labelWeight: 400,
2777
+ legendSize: 14,
2778
+ legendWeight: 400,
2779
+ dotRadius: 5,
2780
+ lineWidth: 2.5,
2781
+ barRadius: 8
2782
+ }, Z = {
2783
+ fontSize: 15,
2784
+ fontWeight: 500,
2785
+ height: 32,
2786
+ padX: 14,
2787
+ offsetY: 12,
2788
+ rx: 8,
2789
+ minY: 4,
2790
+ pointerSize: 6
2791
+ };
2792
+ function br(e, n, r = "Inter", i = !1, a = !1, o, s, c, l = {}) {
2793
+ let u = [], d = Math.max(0, ...e.bars.map((e) => e.colorIndex), ...e.lines.map((e) => e.colorIndex)), f = G(g(e.width, e.height, n, i, s, c, void 0, l.styleAttribute).replace("<svg ", `<svg data-xychart-colors="${d}" `), o);
2794
+ u.push(f), u.push(t(r, !1, l.nonce));
2795
+ let p = Math.max(...e.lines.map((e) => e.points.length), 0), m = p > 0 && p <= 12, { style: h, defs: _ } = xr(e, a, m, n.accent, n.bg, l.nonce);
2796
+ u.push(h), _ && u.push(_);
2797
+ let { plotArea: v } = e, y = e.xAxis.ticks.map((e) => e.x), b = e.horizontal ? e.yAxis.ticks.map((e) => e.y) : e.gridLines.map((e) => e.y1), x = y.length > 1 ? Math.abs(y[1] - y[0]) : v.width / 6, S = b.length > 1 ? Math.abs(b[1] - b[0]) : v.height / 6, C = x / Math.max(1, Math.round(x / 20)), w = S / Math.max(1, Math.round(S / 20)), T = y[0] ?? v.x, E = b[0] ?? v.y, D = T - Math.ceil((T - v.x) / C) * C, O = E - Math.ceil((E - v.y) / w) * w;
2798
+ for (let e = O; e <= v.y + v.height + .5; e += w) for (let t = D; t <= v.x + v.width + .5; t += C) u.push(`<circle cx="${Q(t)}" cy="${Q(e)}" r="1.5" class="xychart-grid"/>`);
2799
+ let k = [];
2800
+ for (let t of e.bars) {
2801
+ let n = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`, r = e.horizontal ? Cr(t.x, t.y, t.width, t.height, X.barRadius) : Sr(t.x, t.y, t.width, t.height, X.barRadius);
2802
+ if (u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`), a) {
2803
+ let e = Dr(t.value), n = t.label ? `${t.label}: ${e}` : e, r = Er(t.x + t.width / 2, t.y, e);
2804
+ k.push(`<g class="xychart-bar-group"><rect x="${Q(t.x)}" y="${Q(t.y)}" width="${Q(t.width)}" height="${Q(t.height)}" fill="transparent"/><title>${$(n)}</title>` + r + "</g>");
2805
+ }
2806
+ }
2807
+ for (let t of e.lines) {
2808
+ if (t.points.length === 0) continue;
2809
+ let e = wr(t.points);
2810
+ u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`), u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`);
2811
+ }
2812
+ let A = [];
2813
+ if (a || m) {
2814
+ let t = /* @__PURE__ */ new Map();
2815
+ for (let n of e.legend) n.type === "line" && t.set(n.seriesIndex, n.label);
2816
+ let n = /* @__PURE__ */ new Map();
2817
+ for (let t of e.lines) for (let e of t.points) {
2818
+ let r = Q(e.x), i = n.get(r) ?? [];
2819
+ n.set(r, i), i.push({
2820
+ x: e.x,
2821
+ y: e.y,
2822
+ value: e.value,
2823
+ label: e.label,
2824
+ seriesIndex: t.seriesIndex,
2825
+ colorIndex: t.colorIndex
2826
+ });
2827
+ }
2828
+ for (let e of n.values()) {
2829
+ let n = e[0].x, r = e[0].label || "";
2830
+ if (a && e.length > 1) {
2831
+ let i = Math.min(...e.map((e) => e.y)), a = Math.max(...e.map((e) => e.y)), o = X.dotRadius * 3, s = `<rect x="${Q(n - o)}" y="${Q(i - o)}" width="${Q(o * 2)}" height="${Q(a - i + o * 2)}" fill="transparent" class="xychart-hit"/>`, c = e.map((e) => ({
2832
+ text: Dr(e.value),
2833
+ legendLabel: t.get(e.seriesIndex) || `Line ${e.seriesIndex + 1}`
2834
+ })), l = Tr(n, i - X.dotRadius, r, c), u = c.map((e) => e.text), d = r ? `${r}: ${u.join(" · ")}` : u.join(" · "), f = `<g class="xychart-dot-group">${s}`;
2835
+ for (let t of e) {
2836
+ let e = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`;
2837
+ f += `<circle cx="${Q(t.x)}" cy="${Q(t.y)}" r="${X.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`;
2838
+ }
2839
+ f += `<title>${$(d)}</title>${l}</g>`, A.push(f);
2840
+ } else if (a) {
2841
+ let t = e[0], r = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`, i = Dr(t.value), a = t.label ? `${t.label}: ${i}` : i, o = Er(n, t.y - X.dotRadius, i), s = m ? `<circle cx="${Q(n)}" cy="${Q(t.y)}" r="${X.dotRadius * 3}" fill="transparent" class="xychart-hit"/>` : "";
2842
+ A.push(`<g class="xychart-dot-group">${s}<circle cx="${Q(t.x)}" cy="${Q(t.y)}" r="${X.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${$(a)}</title>${o}</g>`);
2843
+ } else for (let t of e) {
2844
+ let e = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`;
2845
+ u.push(`<circle cx="${Q(t.x)}" cy="${Q(t.y)}" r="${X.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`);
2846
+ }
2847
+ }
2848
+ }
2849
+ for (let t of e.xAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${X.labelSize}" font-weight="${X.labelWeight}" dy="${B}" class="xychart-label">${$(t.label)}</text>`);
2850
+ for (let t of e.yAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${X.labelSize}" font-weight="${X.labelWeight}" dy="${B}" class="xychart-label">${$(t.label)}</text>`);
2851
+ if (e.xAxis.title) {
2852
+ let t = e.xAxis.title, n = t.rotate ? ` transform="rotate(${t.rotate},${t.x},${t.y})"` : "";
2853
+ u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${X.axisTitleSize}" font-weight="${X.axisTitleWeight}" dy="${B}" class="xychart-axis-title">${$(t.text)}</text>`);
2854
+ }
2855
+ if (e.yAxis.title) {
2856
+ let t = e.yAxis.title, n = t.rotate ? ` transform="rotate(${t.rotate},${t.x},${t.y})"` : "";
2857
+ u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${X.axisTitleSize}" font-weight="${X.axisTitleWeight}" dy="${B}" class="xychart-axis-title">${$(t.text)}</text>`);
2858
+ }
2859
+ e.title && u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${X.titleSize}" font-weight="${X.titleWeight}" dy="${B}" class="xychart-title">${$(e.title.text)}</text>`);
2860
+ for (let t of e.legend) {
2861
+ if (t.type === "bar") u.push(`<rect x="${t.x}" y="${t.y - 7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);
2862
+ else {
2863
+ let e = t.y;
2864
+ u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x + 14}" y2="${e}" stroke-width="${X.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`);
2865
+ }
2866
+ u.push(`<text x="${t.x + 14 + 6}" y="${t.y}" text-anchor="start" font-size="${X.legendSize}" font-weight="${X.legendWeight}" dy="${B}" class="xychart-label">${$(t.label)}</text>`);
2867
+ }
2868
+ for (let e of k) u.push(e);
2869
+ for (let e of A) u.push(e);
2870
+ return u.push("</svg>"), u.join("\n");
2871
+ }
2872
+ function xr(e, t, n, r, i, a) {
2873
+ let o = r ?? _, s = /* @__PURE__ */ new Set();
2874
+ for (let t of e.bars) s.add(t.colorIndex);
2875
+ for (let t of e.lines) s.add(t.colorIndex);
2876
+ let c = [];
2877
+ for (let e of [...s].sort((e, t) => e - t)) {
2878
+ let t = e === 0 ? `var(--accent, ${_})` : y(e, o, i);
2879
+ c.push(` --xychart-color-${e}: ${t};`), c.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`);
2880
+ }
2881
+ let l = [];
2882
+ for (let e of [...s].sort((e, t) => e - t)) {
2883
+ let t = `var(--xychart-color-${e})`;
2884
+ l.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`), l.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`), l.push(` circle.xychart-color-${e} { fill: ${t}; }`);
2885
+ }
2886
+ let u = t ? `
2887
+ .xychart-tip { opacity: 0; pointer-events: none; }
2888
+ .xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
2889
+ .xychart-tip-text { fill: var(--bg); font-size: ${Z.fontSize}px; font-weight: ${Z.fontWeight}; }
2890
+ .xychart-tip-ptr { fill: var(--_text); }
2891
+ .xychart-bar-group:hover .xychart-tip,
2892
+ .xychart-dot-group:hover .xychart-tip { opacity: 1; }` : "", d = c.length > 0 ? `\n svg {\n${c.join("\n")}\n }` : "";
2893
+ return {
2894
+ style: `${h(a)}
2895
+ .xychart-grid { fill: var(--_inner-stroke); stroke: none; opacity: 0.65; }
2896
+ .xychart-bar { stroke-width: 1.5; }
2897
+ .xychart-line { fill: none; stroke-width: ${X.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
2898
+ .xychart-line-shadow { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.12; }
2899
+ .xychart-dot { stroke: var(--bg); stroke-width: 2; }
2900
+ .xychart-label { fill: var(--_text-muted); }
2901
+ .xychart-axis-title { fill: var(--_text-sec); }
2902
+ .xychart-title { fill: var(--_text); }${d}
2903
+ ${l.join("\n")}${u}
2904
+ </style>`,
2905
+ defs: ""
2906
+ };
2907
+ }
2908
+ function Sr(e, t, n, r, i) {
2909
+ let a = Math.min(i, n / 2, r / 2);
2910
+ return a <= 0 ? `M${Q(e)},${Q(t)} h${Q(n)} v${Q(r)} h${Q(-n)} Z` : [
2911
+ `M${Q(e)},${Q(t + a)}`,
2912
+ `Q${Q(e)},${Q(t)} ${Q(e + a)},${Q(t)}`,
2913
+ `L${Q(e + n - a)},${Q(t)}`,
2914
+ `Q${Q(e + n)},${Q(t)} ${Q(e + n)},${Q(t + a)}`,
2915
+ `L${Q(e + n)},${Q(t + r - a)}`,
2916
+ `Q${Q(e + n)},${Q(t + r)} ${Q(e + n - a)},${Q(t + r)}`,
2917
+ `L${Q(e + a)},${Q(t + r)}`,
2918
+ `Q${Q(e)},${Q(t + r)} ${Q(e)},${Q(t + r - a)}`,
2919
+ "Z"
2920
+ ].join(" ");
2921
+ }
2922
+ function Cr(e, t, n, r, i) {
2923
+ let a = Math.min(i, n / 2, r / 2);
2924
+ return a <= 0 ? `M${Q(e)},${Q(t)} h${Q(n)} v${Q(r)} h${Q(-n)} Z` : [
2925
+ `M${Q(e + a)},${Q(t)}`,
2926
+ `L${Q(e + n - a)},${Q(t)}`,
2927
+ `Q${Q(e + n)},${Q(t)} ${Q(e + n)},${Q(t + a)}`,
2928
+ `L${Q(e + n)},${Q(t + r - a)}`,
2929
+ `Q${Q(e + n)},${Q(t + r)} ${Q(e + n - a)},${Q(t + r)}`,
2930
+ `L${Q(e + a)},${Q(t + r)}`,
2931
+ `Q${Q(e)},${Q(t + r)} ${Q(e)},${Q(t + r - a)}`,
2932
+ `L${Q(e)},${Q(t + a)}`,
2933
+ `Q${Q(e)},${Q(t)} ${Q(e + a)},${Q(t)}`,
2934
+ "Z"
2935
+ ].join(" ");
2936
+ }
2937
+ function wr(e) {
2938
+ if (e.length === 0) return "";
2939
+ if (e.length === 1) return `M${Q(e[0].x)},${Q(e[0].y)}`;
2940
+ if (e.length === 2) return `M${Q(e[0].x)},${Q(e[0].y)} L${Q(e[1].x)},${Q(e[1].y)}`;
2941
+ let t = e.length, n = [], r = [];
2942
+ for (let i = 0; i < t - 1; i++) n.push(e[i + 1].x - e[i].x), r.push(n[i] === 0 ? 0 : (e[i + 1].y - e[i].y) / n[i]);
2943
+ let i = Array(t).fill(0);
2944
+ if (t > 2) {
2945
+ let e = Array(t).fill(0), a = Array(t).fill(0);
2946
+ for (let i = 1; i < t - 1; i++) {
2947
+ let t = 2 * (n[i - 1] + n[i]), o = 3 * (r[i] - r[i - 1]);
2948
+ if (i === 1) e[i] = n[i] / t, a[i] = o / t;
2949
+ else {
2950
+ let r = t - n[i - 1] * e[i - 1];
2951
+ e[i] = n[i] / r, a[i] = (o - n[i - 1] * a[i - 1]) / r;
2952
+ }
2953
+ }
2954
+ for (let n = t - 2; n >= 1; n--) i[n] = a[n] - e[n] * i[n + 1];
2955
+ }
2956
+ let a = Array(t).fill(0);
2957
+ for (let e = 0; e < t - 1; e++) a[e] = r[e] - n[e] * (2 * i[e] + i[e + 1]) / 3;
2958
+ a[t - 1] = r[t - 2] + n[t - 2] * i[t - 2] / 3;
2959
+ let o = `M${Q(e[0].x)},${Q(e[0].y)}`;
2960
+ for (let r = 0; r < t - 1; r++) {
2961
+ let t = n[r] / 3, i = e[r].x + t, s = e[r].y + a[r] * t, c = e[r + 1].x - t, l = e[r + 1].y - a[r + 1] * t;
2962
+ o += ` C${Q(i)},${Q(s)} ${Q(c)},${Q(l)} ${Q(e[r + 1].x)},${Q(e[r + 1].y)}`;
2963
+ }
2964
+ return o;
2965
+ }
2966
+ function Tr(e, t, n, r) {
2967
+ let i = N(n, Z.fontSize, 600), a = Math.max(...r.map((e) => {
2968
+ let t = N(e.legendLabel, Z.fontSize, Z.fontWeight), n = N(e.text, Z.fontSize, Z.fontWeight);
2969
+ return t + 10 + n;
2970
+ })), o = Math.max(i, a) + Z.padX * 2, s = 26 + r.length * 20 + 6, c = Math.max(Z.minY, t - Z.offsetY - s - Z.pointerSize), l = e - o / 2, u = e, d = c + s, f = Z.pointerSize, p = `<polygon points="${Q(u - f)},${Q(d)} ${Q(u + f)},${Q(d)} ${Q(u)},${Q(d + f)}" class="xychart-tip xychart-tip-ptr"/>`, m = `<rect x="${Q(l)}" y="${Q(c)}" width="${Q(o)}" height="${s}" rx="${Z.rx}" class="xychart-tip xychart-tip-bg"/>`;
2971
+ m += p;
2972
+ let h = c + 6 + 10;
2973
+ m += `<text x="${Q(e)}" y="${Q(h)}" text-anchor="middle" font-weight="600" font-size="${Z.fontSize}" dy="${B}" class="xychart-tip xychart-tip-text">${$(n)}</text>`;
2974
+ let g = l + Z.padX, _ = l + o - Z.padX;
2975
+ for (let e of r) h += 20, m += `<text x="${Q(g)}" y="${Q(h)}" text-anchor="start" font-size="${Z.fontSize}" font-weight="${Z.fontWeight}" dy="${B}" class="xychart-tip xychart-tip-text">${$(e.legendLabel)}</text>`, m += `<text x="${Q(_)}" y="${Q(h)}" text-anchor="end" font-size="${Z.fontSize}" font-weight="${Z.fontWeight}" dy="${B}" class="xychart-tip xychart-tip-text">${$(e.text)}</text>`;
2976
+ return m;
2977
+ }
2978
+ function Er(e, t, n) {
2979
+ let r = N(n, Z.fontSize, Z.fontWeight) + Z.padX * 2, i = Z.height, a = Math.max(Z.minY, t - Z.offsetY - i - Z.pointerSize), o = e - r / 2, s = e, c = a + i / 2, l = e, u = a + i, d = Z.pointerSize, f = `<polygon points="${Q(l - d)},${Q(u)} ${Q(l + d)},${Q(u)} ${Q(l)},${Q(u + d)}" class="xychart-tip xychart-tip-ptr"/>`;
2980
+ return `<rect x="${Q(o)}" y="${Q(a)}" width="${Q(r)}" height="${i}" rx="${Z.rx}" class="xychart-tip xychart-tip-bg"/>` + f + `<text x="${Q(s)}" y="${Q(c)}" text-anchor="middle" dy="${B}" class="xychart-tip xychart-tip-text">${$(n)}</text>`;
2981
+ }
2982
+ function Dr(e) {
2983
+ return Number.isInteger(e) ? e.toLocaleString("en-US") : e.toFixed(+(Math.abs(e) < 10));
2984
+ }
2985
+ function Q(e) {
2986
+ return String(Math.round(e * 10) / 10);
2987
+ }
2988
+ function $(e) {
2989
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2990
+ }
2991
+ //#endregion
2992
+ export { V as ARROW_HEAD, K as CLS, ie as ELK_DIRECTION_FALLBACK, F as FONT_SIZES, L as FONT_WEIGHTS, ne as GROUP_HEADER_CONTENT_PAD, ce as INLINE_CENTERED_EDGE_LABEL, ee as MONO_FONT, te as MONO_FONT_STACK, R as NODE_PADDING, z as STROKE_WIDTHS, B as TEXT_BASELINE_SHIFT, se as baseElkLayoutOptions, Jn as boxLabelHeight, U as buildElkEdge, le as buildElkEdgeLabel, H as buildElkLeafNode, mn as classNoteId, we as clipEdgeToShape, tt as convertToElkFormat, k as createLayoutCache, ae as directionToElk, M as elkLayoutSync, oe as elkPadding, P as estimateMonoTextWidth, N as estimateTextWidth, sn as evaluateCssColorValue, Fe as extractEdgeLabelPosition, Pe as extractEdgePoints, vn as layoutClassDiagramSync, Ln as layoutErDiagramSync, et as layoutGraphSync, Xn as layoutSequenceDiagram, lr as layoutXYChart, T as pointsToPath, xn as renderClassSvg, Rn as renderErSvg, Zn as renderSequenceSvg, nt as renderSvg, br as renderXYChartSvg, pn as resolveCssColors, I as resolveFontSizes, G as withDataSrc };
2993
+
2994
+ //# sourceMappingURL=index.js.map