@life-exe/wiki-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/dist/analytics/index.d.ts +10 -0
  4. package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
  5. package/dist/chunks/arc-OroUeRL_.js +83 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
  7. package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
  8. package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
  9. package/dist/chunks/channel-Bdy1QZHo.js +5 -0
  10. package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
  11. package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
  12. package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
  13. package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
  14. package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
  15. package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
  16. package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
  17. package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
  18. package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
  19. package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
  20. package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
  21. package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
  22. package/dist/chunks/common-BJ4q25wy.js +12633 -0
  23. package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
  24. package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
  25. package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
  26. package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
  27. package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
  28. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  29. package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
  30. package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
  31. package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
  32. package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
  33. package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
  34. package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
  35. package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
  36. package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
  37. package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
  38. package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
  39. package/dist/chunks/index-f7Uzykhj.js +38262 -0
  40. package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
  41. package/dist/chunks/init-DjUOC4st.js +16 -0
  42. package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
  43. package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
  44. package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
  45. package/dist/chunks/katex-jHfnQmlp.js +11682 -0
  46. package/dist/chunks/layout-CgV9vOdp.js +1704 -0
  47. package/dist/chunks/linear-BzcaSMTS.js +259 -0
  48. package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
  49. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  50. package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
  51. package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
  52. package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
  53. package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
  54. package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
  55. package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
  56. package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
  57. package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
  58. package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
  59. package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
  60. package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
  61. package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
  62. package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
  63. package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
  64. package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
  65. package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
  66. package/dist/components/CodeBlock.d.ts +5 -0
  67. package/dist/components/CommunityLinks.d.ts +21 -0
  68. package/dist/components/CookieConsent.d.ts +2 -0
  69. package/dist/components/DocLinkCard.d.ts +6 -0
  70. package/dist/components/LecturePageView.d.ts +3 -0
  71. package/dist/components/MermaidDiagram.d.ts +3 -0
  72. package/dist/components/SearchPopup.d.ts +6 -0
  73. package/dist/components/WikiApp.d.ts +9 -0
  74. package/dist/components/WikiLayout.d.ts +2 -0
  75. package/dist/components/WikiPageView.d.ts +6 -0
  76. package/dist/components/ZoomableImage.d.ts +2 -0
  77. package/dist/context/LangContext.d.ts +2 -0
  78. package/dist/context/WikiContext.d.ts +18 -0
  79. package/dist/data.d.ts +8 -0
  80. package/dist/hooks/useLanguage.d.ts +4 -0
  81. package/dist/hooks/useTheme.d.ts +5 -0
  82. package/dist/hooks/useWiki.d.ts +2 -0
  83. package/dist/index.d.ts +24 -0
  84. package/dist/index.js +45 -0
  85. package/dist/languages/ue-cpp.d.ts +7 -0
  86. package/dist/languages/ue-cpp.js +21 -0
  87. package/dist/types.d.ts +119 -0
  88. package/dist/wiki-engine.css +1 -0
  89. package/package.json +76 -0
@@ -0,0 +1,461 @@
1
+ import { _ as m, ar as D, c as A, T as Y, l as p, as as _, at as T, au as b, av as z, aw as H, ax as J, ay as C, az as F, aA as W, aB as R, ak as P, ai as j, aC as q, aD as U } from "./index-f7Uzykhj.js";
2
+ import { l as K } from "./layout-CgV9vOdp.js";
3
+ var v = /* @__PURE__ */ m((t, e, d) => Math.max(e, Math.min(d, t)), "clamp"), B = /* @__PURE__ */ m((t = "TB") => {
4
+ switch (t) {
5
+ case "BT":
6
+ return "bottom";
7
+ case "LR":
8
+ return "right";
9
+ case "RL":
10
+ return "left";
11
+ case "TB":
12
+ default:
13
+ return "top";
14
+ }
15
+ }, "getDefaultSelfLoopSide"), Q = /* @__PURE__ */ m((t) => t === "flowchart" || t === "flowchart-v2" || t === "stateDiagram" || t === "er" || t === "classDiagram", "shouldMergeSelfLoopSegments"), V = [
16
+ "x",
17
+ "y",
18
+ "width",
19
+ "height",
20
+ "labelBBox",
21
+ "intersect",
22
+ "calcIntersect",
23
+ "diff",
24
+ "clusterNode"
25
+ ], Z = /* @__PURE__ */ m((t, e, d, g, s) => {
26
+ const h = [], L = /* @__PURE__ */ new Set();
27
+ if (d.forEach(({ start: l, end: r }) => {
28
+ l !== g && L.add(l), r !== g && L.add(r);
29
+ }), L.forEach((l) => {
30
+ const r = t.node(l);
31
+ typeof (r == null ? void 0 : r.x) == "number" && typeof (r == null ? void 0 : r.y) == "number" && h.push(r);
32
+ }), h.length === 0 && d.forEach(({ edge: l }) => {
33
+ (l.points ?? []).forEach((r) => {
34
+ typeof (r == null ? void 0 : r.x) == "number" && typeof (r == null ? void 0 : r.y) == "number" && h.push(r);
35
+ });
36
+ }), h.length === 0)
37
+ return B(s);
38
+ const c = h.reduce(
39
+ (l, r) => ({
40
+ x: l.x + r.x / h.length,
41
+ y: l.y + r.y / h.length
42
+ }),
43
+ { x: 0, y: 0 }
44
+ ), i = c.x - e.x, o = c.y - e.y;
45
+ return Math.abs(i) > Math.abs(o) ? i > 0 ? "right" : "left" : Math.abs(o) > 0 ? o > 0 ? "bottom" : "top" : B(s);
46
+ }, "getSelfLoopSide"), $ = /* @__PURE__ */ m((t, e = "top", d = 0, g = 0) => {
47
+ const s = t.x, h = t.y - d, L = t.width / 2, c = t.height / 2, i = Math.max(36, Math.min(100, t.width * 0.8)), o = v(Math.max(g, t.width * 0.35), 36, i), l = v(Math.min(t.width, t.height) * 0.45, 24, 48);
48
+ switch (e) {
49
+ case "bottom": {
50
+ const r = h + c;
51
+ return [
52
+ { x: s - o / 2, y: r },
53
+ { x: s - o / 2, y: r + l },
54
+ { x: s + o / 2, y: r + l },
55
+ { x: s + o / 2, y: r }
56
+ ];
57
+ }
58
+ case "right": {
59
+ const r = s + L;
60
+ return [
61
+ { x: r, y: h - o / 2 },
62
+ { x: r + l, y: h - o / 2 },
63
+ { x: r + l, y: h + o / 2 },
64
+ { x: r, y: h + o / 2 }
65
+ ];
66
+ }
67
+ case "left": {
68
+ const r = s - L;
69
+ return [
70
+ { x: r, y: h - o / 2 },
71
+ { x: r - l, y: h - o / 2 },
72
+ { x: r - l, y: h + o / 2 },
73
+ { x: r, y: h + o / 2 }
74
+ ];
75
+ }
76
+ case "top":
77
+ default: {
78
+ const r = h - c;
79
+ return [
80
+ { x: s - o / 2, y: r },
81
+ { x: s - o / 2, y: r - l },
82
+ { x: s + o / 2, y: r - l },
83
+ { x: s + o / 2, y: r }
84
+ ];
85
+ }
86
+ }
87
+ }, "getSelfLoopPoints"), ee = /* @__PURE__ */ m((t, e, d = "top", g = 0, s = {}) => {
88
+ const L = t.x, c = t.y - g, i = s.width ?? 0, o = s.height ?? 0;
89
+ switch (d) {
90
+ case "bottom":
91
+ return { x: L, y: Math.max(...e.map((l) => l.y)) + o / 2 + 4 };
92
+ case "right":
93
+ return { x: Math.max(...e.map((l) => l.x)) + i / 2 + 4, y: c };
94
+ case "left":
95
+ return { x: Math.min(...e.map((l) => l.x)) - i / 2 - 4, y: c };
96
+ case "top":
97
+ default:
98
+ return { x: L, y: Math.min(...e.map((l) => l.y)) - o / 2 - 4 };
99
+ }
100
+ }, "getSelfLoopLabelPosition"), M = /* @__PURE__ */ m((t, e = 0, { mergeSelfLoops: d = !0 } = {}) => {
101
+ var L;
102
+ const g = /* @__PURE__ */ new Map(), s = [], h = (L = t.graph()) == null ? void 0 : L.rankdir;
103
+ return t.edges().forEach((c) => {
104
+ const i = t.edge(c);
105
+ if (d && i.selfLoop) {
106
+ const o = i.selfLoop.id;
107
+ g.has(o) || g.set(o, []), g.get(o).push({ edge: i, start: c.v, end: c.w });
108
+ } else
109
+ s.push({ edge: i, start: c.v, end: c.w });
110
+ }), g.forEach((c) => {
111
+ if (c.length !== 3) {
112
+ c.forEach((E) => s.push(E));
113
+ return;
114
+ }
115
+ c.sort((E, x) => E.edge.selfLoop.order - x.edge.selfLoop.order);
116
+ const [i, o, l] = c, r = i.edge.originalEdge ?? o.edge.originalEdge ?? l.edge.originalEdge ?? o.edge, a = t.node(r.start);
117
+ if (!a) {
118
+ c.forEach((E) => s.push(E));
119
+ return;
120
+ }
121
+ const w = {
122
+ width: o.edge.width,
123
+ height: o.edge.height
124
+ }, y = Z(t, a, c, r.start, h), f = $(a, y, e, w.width ?? 0), n = ee(a, f, y, e, w), u = {
125
+ ...o.edge,
126
+ ...r,
127
+ id: r.id,
128
+ points: f,
129
+ start: r.start,
130
+ end: r.end,
131
+ x: n.x,
132
+ y: n.y,
133
+ width: w.width,
134
+ height: w.height,
135
+ labelStyle: o.edge.labelStyle,
136
+ fromCluster: i.edge.fromCluster ?? o.edge.fromCluster ?? l.edge.fromCluster,
137
+ toCluster: i.edge.toCluster ?? o.edge.toCluster ?? l.edge.toCluster
138
+ };
139
+ delete u.selfLoop, delete u.originalEdge, s.push({ edge: u, start: u.start, end: u.end });
140
+ }), s;
141
+ }, "getEdgesToRender"), k = /* @__PURE__ */ m(async ({
142
+ element: t,
143
+ graph: e,
144
+ diagramType: d,
145
+ id: g,
146
+ parentCluster: s,
147
+ siteConfig: h
148
+ }) => {
149
+ const L = e.graph().rankdir;
150
+ p.trace("Dir in recursive render - dir:", L);
151
+ const {
152
+ clusters: c,
153
+ edgePaths: i,
154
+ edgeLabels: o,
155
+ nodes: l,
156
+ rootGroups: r
157
+ } = z(t, {
158
+ edgePathsClass: "edgePaths"
159
+ });
160
+ e.nodes() ? p.info("Recursive render XXX", e.nodes()) : p.info("No nodes found for", e), e.edges().length > 0 && p.info("Recursive edges", e.edge(e.edges()[0]));
161
+ const a = Q(d);
162
+ await Promise.all(
163
+ e.nodes().map(async function(f) {
164
+ const n = e.node(f);
165
+ if (s !== void 0) {
166
+ const u = JSON.parse(JSON.stringify(s.clusterData));
167
+ p.trace(
168
+ `Setting data for parent cluster XXX
169
+ Node.id = `,
170
+ f,
171
+ `
172
+ data=`,
173
+ u.height,
174
+ `
175
+ Parent cluster`,
176
+ s.height
177
+ ), e.setNode(s.id, u), e.parent(f) || (p.trace("Setting parent", f, s.id), e.setParent(f, s.id, u));
178
+ }
179
+ if (p.info("(Insert) Node XXX" + f + ": " + JSON.stringify(e.node(f))), n != null && n.clusterNode) {
180
+ p.info("Cluster identified XBX", f, n.width, e.node(f));
181
+ const { ranksep: u, nodesep: E } = e.graph();
182
+ n.graph.setGraph({
183
+ ...n.graph.graph(),
184
+ ranksep: u + 25,
185
+ nodesep: E
186
+ });
187
+ const x = await ne({
188
+ element: l,
189
+ graph: n.graph,
190
+ diagramType: d,
191
+ id: g,
192
+ parentCluster: e.node(f),
193
+ siteConfig: h
194
+ }), S = x.elem;
195
+ H(n, S), n.diff = x.diff || 0, p.info(
196
+ "New compound node after recursive render XAX",
197
+ f,
198
+ "width",
199
+ // node,
200
+ n.width,
201
+ "height",
202
+ n.height
203
+ // node.x,
204
+ // node.y
205
+ ), J(S, n);
206
+ } else
207
+ e.children(f).length > 0 ? (p.trace(
208
+ "Cluster - the non recursive path XBX",
209
+ f,
210
+ n.id,
211
+ n,
212
+ n.width,
213
+ "Graph:",
214
+ e
215
+ ), p.trace(C(n.id, e)), b.set(n.id, { id: C(n.id, e), node: n })) : (p.trace("Node - the non recursive path XAX", f, l, e.node(f), L), await F(l, e.node(f), { config: h, dir: L }));
216
+ })
217
+ ), await (/* @__PURE__ */ m(async () => {
218
+ const f = e.edges().map(async function(n) {
219
+ var E, x, S, X;
220
+ const u = e.edge(n.v, n.w, n.name);
221
+ if (p.info("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), p.info("Edge " + n.v + " -> " + n.w + ": ", n, " ", JSON.stringify(e.edge(n))), p.info(
222
+ "Fix",
223
+ b,
224
+ "ids:",
225
+ n.v,
226
+ n.w,
227
+ "Translating: ",
228
+ b.get(n.v),
229
+ b.get(n.w)
230
+ ), a && u.selfLoop) {
231
+ if (u.selfLoop.order !== 1)
232
+ return;
233
+ const N = {
234
+ ...u.originalEdge,
235
+ ...u,
236
+ id: u.selfLoop.id,
237
+ startLabelLeft: ((E = u.originalEdge) == null ? void 0 : E.startLabelLeft) ?? u.startLabelLeft,
238
+ startLabelRight: ((x = u.originalEdge) == null ? void 0 : x.startLabelRight) ?? u.startLabelRight,
239
+ endLabelLeft: ((S = u.originalEdge) == null ? void 0 : S.endLabelLeft) ?? u.endLabelLeft,
240
+ endLabelRight: ((X = u.originalEdge) == null ? void 0 : X.endLabelRight) ?? u.endLabelRight
241
+ };
242
+ await R(o, N), u.width = N.width, u.height = N.height, u.labelStyle = N.labelStyle;
243
+ return;
244
+ }
245
+ await R(o, u);
246
+ });
247
+ await Promise.all(f);
248
+ }, "processEdges"))();
249
+ const { subGraphTitleTotalMargin: y } = W(h);
250
+ return {
251
+ elem: r,
252
+ graph: e,
253
+ groups: { clusters: c, edgePaths: i, edgeLabels: o, nodes: l, rootGroups: r },
254
+ diagramType: d,
255
+ id: g,
256
+ mergeSelfLoops: a,
257
+ subGraphTitleTotalMargin: y
258
+ };
259
+ }, "measureDagreGraph"), G = /* @__PURE__ */ m((t) => {
260
+ p.info("############################################# XXX"), p.info("### Layout ### XXX"), p.info("############################################# XXX"), K(t);
261
+ }, "runDagreGraphLayout"), te = /* @__PURE__ */ m((t, e, d) => {
262
+ const g = t.node(e);
263
+ if (!g)
264
+ return;
265
+ const s = { ...g };
266
+ return g != null && g.clusterNode ? s.y = (g.y ?? 0) + d : t.children(e).length > 0 ? s.height = (g.height ?? 0) + d : s.y = (g.y ?? 0) + d / 2, s;
267
+ }, "normalizeDagreNode"), I = /* @__PURE__ */ m((t, e) => {
268
+ V.forEach((d) => {
269
+ e[d] !== void 0 && (t[d] = e[d]);
270
+ });
271
+ }, "applyDagreNodeLayout"), re = /* @__PURE__ */ m((t, e, d, g) => ({
272
+ ...t,
273
+ start: t.start ?? e,
274
+ end: t.end ?? d,
275
+ points: (t.points ?? []).map((s) => ({
276
+ ...s,
277
+ y: typeof s.y == "number" ? s.y + g : s.y
278
+ }))
279
+ }), "normalizeDagreEdge"), ae = /* @__PURE__ */ m((t, e) => {
280
+ const { graph: d, mergeSelfLoops: g, subGraphTitleTotalMargin: s = 0 } = e, h = new Map(t.nodes.map((c) => [c.id, c]));
281
+ D(d).forEach((c) => {
282
+ const i = te(d, c, s);
283
+ if (!i)
284
+ return;
285
+ I(d.node(c), i);
286
+ const o = h.get(c);
287
+ o && I(o, i);
288
+ });
289
+ const L = s / 2;
290
+ return t.edges = M(d, L, { mergeSelfLoops: g }).map(
291
+ ({ edge: c, start: i, end: o }) => re(c, i, o, L)
292
+ ), t;
293
+ }, "applyDagreLayoutResult"), oe = /* @__PURE__ */ m(async ({
294
+ elem: t,
295
+ graph: e,
296
+ groups: { clusters: d, edgePaths: g },
297
+ diagramType: s,
298
+ id: h,
299
+ mergeSelfLoops: L,
300
+ subGraphTitleTotalMargin: c
301
+ }) => {
302
+ let i = 0;
303
+ await Promise.all(
304
+ D(e).map(async function(r) {
305
+ var w;
306
+ const a = e.node(r);
307
+ if (p.info(
308
+ "Position XBX => " + r + ": (" + a.x,
309
+ "," + a.y,
310
+ ") width: ",
311
+ a.width,
312
+ " height: ",
313
+ a.height
314
+ ), a != null && a.clusterNode)
315
+ a.y += c, p.info(
316
+ "A tainted cluster node XBX1",
317
+ r,
318
+ a.id,
319
+ a.width,
320
+ a.height,
321
+ a.x,
322
+ a.y,
323
+ e.parent(r)
324
+ ), b.get(a.id).node = a, P(a);
325
+ else if (e.children(r).length > 0) {
326
+ p.info(
327
+ "A pure cluster node XBX1",
328
+ r,
329
+ a.id,
330
+ a.x,
331
+ a.y,
332
+ a.width,
333
+ a.height,
334
+ e.parent(r)
335
+ ), a.height += c, e.node(a.parentId);
336
+ const y = (a == null ? void 0 : a.padding) / 2 || 0, f = ((w = a == null ? void 0 : a.labelBBox) == null ? void 0 : w.height) || 0, n = f - y || 0;
337
+ p.debug("OffsetY", n, "labelHeight", f, "halfPadding", y), await j(d, a), b.get(a.id).node = a;
338
+ } else {
339
+ const y = e.node(a.parentId);
340
+ a.y += c / 2, p.info(
341
+ "A regular node XBX1 - using the padding",
342
+ a.id,
343
+ "parent",
344
+ a.parentId,
345
+ a.width,
346
+ a.height,
347
+ a.x,
348
+ a.y,
349
+ "offsetY",
350
+ a.offsetY,
351
+ "parent",
352
+ y,
353
+ y == null ? void 0 : y.offsetY,
354
+ a
355
+ ), P(a);
356
+ }
357
+ })
358
+ );
359
+ const o = c / 2;
360
+ return M(e, o, { mergeSelfLoops: L }).forEach(function({ edge: r, start: a, end: w }) {
361
+ p.info("Edge " + a + " -> " + w + ": " + JSON.stringify(r), r), r.points.forEach((u) => u.y += o);
362
+ const y = e.node(a), f = e.node(w), n = q(g, r, b, s, y, f, h);
363
+ U(r, n);
364
+ }), e.nodes().forEach(function(r) {
365
+ const a = e.node(r);
366
+ p.info(r, a.type, a.diff), a.isGroup && (i = a.diff);
367
+ }), p.warn("Returning from recursive render XAX", t, i), { elem: t, diff: i };
368
+ }, "paintDagreLayoutCore"), ne = /* @__PURE__ */ m(async (t) => {
369
+ const e = await k(t);
370
+ return G(e.graph), await oe(e);
371
+ }, "renderDagreSubgraph"), O = /* @__PURE__ */ m((t) => {
372
+ var d, g, s, h, L, c;
373
+ const e = new Y({
374
+ multigraph: !0,
375
+ compound: !0
376
+ }).setGraph({
377
+ rankdir: t.direction,
378
+ // Precedence: an explicit top-level config override (only present when a
379
+ // user sets it - it has no schema default) > the value the diagram's own
380
+ // renderer put on data4Layout (usually derived from that diagram's config)
381
+ // > the flowchart config as a generic fallback. The flowchart keys have
382
+ // schema defaults and therefore always exist, so they must come last or
383
+ // they silently shadow every diagram's own spacing (see #7932).
384
+ nodesep: ((d = t.config) == null ? void 0 : d.nodeSpacing) || t.nodeSpacing || ((s = (g = t.config) == null ? void 0 : g.flowchart) == null ? void 0 : s.nodeSpacing),
385
+ ranksep: ((h = t.config) == null ? void 0 : h.rankSpacing) || t.rankSpacing || ((c = (L = t.config) == null ? void 0 : L.flowchart) == null ? void 0 : c.rankSpacing),
386
+ marginx: 8,
387
+ marginy: 8
388
+ }).setDefaultEdgeLabel(function() {
389
+ return {};
390
+ });
391
+ return t.nodes.forEach((i) => {
392
+ e.setNode(i.id, { ...i }), i.parentId && e.setParent(i.id, i.parentId);
393
+ }), p.debug("Edges:", t.edges), t.edges.forEach((i) => {
394
+ if (i.start === i.end) {
395
+ const o = i.start, l = o + "---" + o + "---1", r = o + "---" + o + "---2", a = e.node(o);
396
+ e.setNode(l, {
397
+ domId: l,
398
+ id: l,
399
+ parentId: a.parentId,
400
+ labelStyle: "",
401
+ label: "",
402
+ padding: 0,
403
+ shape: "labelRect",
404
+ // shape: 'rect',
405
+ style: "",
406
+ width: 10,
407
+ height: 10
408
+ }), e.setParent(l, a.parentId), e.setNode(r, {
409
+ domId: r,
410
+ id: r,
411
+ parentId: a.parentId,
412
+ labelStyle: "",
413
+ padding: 0,
414
+ // shape: 'rect',
415
+ shape: "labelRect",
416
+ label: "",
417
+ style: "",
418
+ width: 10,
419
+ height: 10
420
+ }), e.setParent(r, a.parentId);
421
+ const w = structuredClone(i), y = structuredClone(i), f = structuredClone(i), n = structuredClone(i);
422
+ y.originalEdge = w, y.selfLoop = { id: w.id, order: 0 }, f.originalEdge = w, f.selfLoop = { id: w.id, order: 1 }, n.originalEdge = w, n.selfLoop = { id: w.id, order: 2 }, y.label = "", y.arrowTypeEnd = "none", y.endLabelLeft = "", y.endLabelRight = "", y.startLabelLeft = "", y.id = o + "-cyclic-special-1", f.startLabelRight = "", f.startLabelLeft = "", f.endLabelLeft = "", f.endLabelRight = "", f.arrowTypeStart = "none", f.arrowTypeEnd = "none", f.id = o + "-cyclic-special-mid", n.label = "", n.startLabelRight = "", n.startLabelLeft = "", n.arrowTypeStart = "none", a.isGroup && (y.fromCluster = o, n.toCluster = o), n.id = o + "-cyclic-special-2", n.arrowTypeStart = "none", e.setEdge(o, l, y, o + "-cyclic-special-0"), e.setEdge(l, r, f, o + "-cyclic-special-1"), e.setEdge(r, o, n, o + "-cyclic-special-2");
423
+ } else
424
+ e.setEdge(i.start, i.end, { ...i }, i.id);
425
+ }), _(e), { graph: e };
426
+ }, "prepareLayoutForDagre"), se = /* @__PURE__ */ m(async (t, { element: e, preparedLayout: d }) => {
427
+ const g = d ?? O(t), s = A(), h = await k({
428
+ element: e,
429
+ graph: g.graph,
430
+ diagramType: t.type,
431
+ id: t.diagramId,
432
+ parentCluster: void 0,
433
+ siteConfig: s
434
+ });
435
+ return g.measuredLayout = h, h;
436
+ }, "measureDagreLayout"), ie = /* @__PURE__ */ m((t, e) => {
437
+ var g;
438
+ const d = (g = e.preparedLayout) == null ? void 0 : g.measuredLayout;
439
+ if (!d)
440
+ throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");
441
+ return G(d.graph), ae(t, d), d;
442
+ }, "runDagreLayoutCore"), de = /* @__PURE__ */ m((t, { measure: e }) => D(e.graph).map((d) => e.graph.node(d)).filter(Boolean), "getDagrePaintNodes"), le = /* @__PURE__ */ m((t, e, { measure: d }) => t ? d.graph.node(t) : void 0, "getDagreEdgeNode"), fe = T({
443
+ prepareLayout: O,
444
+ measureLayout: se,
445
+ runLayoutCore: ie,
446
+ paintOptions: {
447
+ clusterDb: b,
448
+ getNodes: de,
449
+ getEdgeNode: le,
450
+ skipNode: /* @__PURE__ */ m((t, { measure: e }) => !e.graph.hasNode(t.id), "skipNode"),
451
+ isCluster: /* @__PURE__ */ m((t, { measure: e }) => e.graph.hasNode(t.id) && (e.graph.children(t.id) ?? []).length > 0, "isCluster")
452
+ }
453
+ });
454
+ export {
455
+ ae as applyDagreLayoutResult,
456
+ M as getEdgesToRender,
457
+ se as measureDagreLayout,
458
+ O as prepareLayoutForDagre,
459
+ fe as render,
460
+ ie as runDagreLayoutCore
461
+ };
@@ -0,0 +1,171 @@
1
+ function J(n) {
2
+ return Math.abs(n = Math.round(n)) >= 1e21 ? n.toLocaleString("en").replace(/,/g, "") : n.toString(10);
3
+ }
4
+ function j(n, t) {
5
+ if (!isFinite(n) || n === 0) return null;
6
+ var e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e"), i = n.slice(0, e);
7
+ return [
8
+ i.length > 1 ? i[0] + i.slice(2) : i,
9
+ +n.slice(e + 1)
10
+ ];
11
+ }
12
+ function K(n) {
13
+ return n = j(Math.abs(n)), n ? n[1] : NaN;
14
+ }
15
+ function Q(n, t) {
16
+ return function(e, i) {
17
+ for (var o = e.length, a = [], c = 0, h = n[0], M = 0; o > 0 && h > 0 && (M + h + 1 > i && (h = Math.max(1, i - M)), a.push(e.substring(o -= h, o + h)), !((M += h + 1) > i)); )
18
+ h = n[c = (c + 1) % n.length];
19
+ return a.reverse().join(t);
20
+ };
21
+ }
22
+ function V(n) {
23
+ return function(t) {
24
+ return t.replace(/[0-9]/g, function(e) {
25
+ return n[+e];
26
+ });
27
+ };
28
+ }
29
+ var W = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
30
+ function $(n) {
31
+ if (!(t = W.exec(n))) throw new Error("invalid format: " + n);
32
+ var t;
33
+ return new L({
34
+ fill: t[1],
35
+ align: t[2],
36
+ sign: t[3],
37
+ symbol: t[4],
38
+ zero: t[5],
39
+ width: t[6],
40
+ comma: t[7],
41
+ precision: t[8] && t[8].slice(1),
42
+ trim: t[9],
43
+ type: t[10]
44
+ });
45
+ }
46
+ $.prototype = L.prototype;
47
+ function L(n) {
48
+ this.fill = n.fill === void 0 ? " " : n.fill + "", this.align = n.align === void 0 ? ">" : n.align + "", this.sign = n.sign === void 0 ? "-" : n.sign + "", this.symbol = n.symbol === void 0 ? "" : n.symbol + "", this.zero = !!n.zero, this.width = n.width === void 0 ? void 0 : +n.width, this.comma = !!n.comma, this.precision = n.precision === void 0 ? void 0 : +n.precision, this.trim = !!n.trim, this.type = n.type === void 0 ? "" : n.type + "";
49
+ }
50
+ L.prototype.toString = function() {
51
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
52
+ };
53
+ function _(n) {
54
+ n: for (var t = n.length, e = 1, i = -1, o; e < t; ++e)
55
+ switch (n[e]) {
56
+ case ".":
57
+ i = o = e;
58
+ break;
59
+ case "0":
60
+ i === 0 && (i = e), o = e;
61
+ break;
62
+ default:
63
+ if (!+n[e]) break n;
64
+ i > 0 && (i = 0);
65
+ break;
66
+ }
67
+ return i > 0 ? n.slice(0, i) + n.slice(o + 1) : n;
68
+ }
69
+ var N;
70
+ function v(n, t) {
71
+ var e = j(n, t);
72
+ if (!e) return N = void 0, n.toPrecision(t);
73
+ var i = e[0], o = e[1], a = o - (N = Math.max(-8, Math.min(8, Math.floor(o / 3))) * 3) + 1, c = i.length;
74
+ return a === c ? i : a > c ? i + new Array(a - c + 1).join("0") : a > 0 ? i.slice(0, a) + "." + i.slice(a) : "0." + new Array(1 - a).join("0") + j(n, Math.max(0, t + a - 1))[0];
75
+ }
76
+ function X(n, t) {
77
+ var e = j(n, t);
78
+ if (!e) return n + "";
79
+ var i = e[0], o = e[1];
80
+ return o < 0 ? "0." + new Array(-o).join("0") + i : i.length > o + 1 ? i.slice(0, o + 1) + "." + i.slice(o + 1) : i + new Array(o - i.length + 2).join("0");
81
+ }
82
+ const O = {
83
+ "%": (n, t) => (n * 100).toFixed(t),
84
+ b: (n) => Math.round(n).toString(2),
85
+ c: (n) => n + "",
86
+ d: J,
87
+ e: (n, t) => n.toExponential(t),
88
+ f: (n, t) => n.toFixed(t),
89
+ g: (n, t) => n.toPrecision(t),
90
+ o: (n) => Math.round(n).toString(8),
91
+ p: (n, t) => X(n * 100, t),
92
+ r: X,
93
+ s: v,
94
+ X: (n) => Math.round(n).toString(16).toUpperCase(),
95
+ x: (n) => Math.round(n).toString(16)
96
+ };
97
+ function R(n) {
98
+ return n;
99
+ }
100
+ var U = Array.prototype.map, Y = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
101
+ function nn(n) {
102
+ var t = n.grouping === void 0 || n.thousands === void 0 ? R : Q(U.call(n.grouping, Number), n.thousands + ""), e = n.currency === void 0 ? "" : n.currency[0] + "", i = n.currency === void 0 ? "" : n.currency[1] + "", o = n.decimal === void 0 ? "." : n.decimal + "", a = n.numerals === void 0 ? R : V(U.call(n.numerals, String)), c = n.percent === void 0 ? "%" : n.percent + "", h = n.minus === void 0 ? "−" : n.minus + "", M = n.nan === void 0 ? "NaN" : n.nan + "";
103
+ function T(f, g) {
104
+ f = $(f);
105
+ var b = f.fill, p = f.align, m = f.sign, w = f.symbol, S = f.zero, E = f.width, F = f.comma, y = f.precision, C = f.trim, d = f.type;
106
+ d === "n" ? (F = !0, d = "g") : O[d] || (y === void 0 && (y = 12), C = !0, d = "g"), (S || b === "0" && p === "=") && (S = !0, b = "0", p = "=");
107
+ var q = (g && g.prefix !== void 0 ? g.prefix : "") + (w === "$" ? e : w === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : ""), B = (w === "$" ? i : /[%p]/.test(d) ? c : "") + (g && g.suffix !== void 0 ? g.suffix : ""), D = O[d], H = /[defgprs%]/.test(d);
108
+ y = y === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, y)) : Math.max(0, Math.min(20, y));
109
+ function G(r) {
110
+ var l = q, u = B, x, I, k;
111
+ if (d === "c")
112
+ u = D(r) + u, r = "";
113
+ else {
114
+ r = +r;
115
+ var P = r < 0 || 1 / r < 0;
116
+ if (r = isNaN(r) ? M : D(Math.abs(r), y), C && (r = _(r)), P && +r == 0 && m !== "+" && (P = !1), l = (P ? m === "(" ? m : h : m === "-" || m === "(" ? "" : m) + l, u = (d === "s" && !isNaN(r) && N !== void 0 ? Y[8 + N / 3] : "") + u + (P && m === "(" ? ")" : ""), H) {
117
+ for (x = -1, I = r.length; ++x < I; )
118
+ if (k = r.charCodeAt(x), 48 > k || k > 57) {
119
+ u = (k === 46 ? o + r.slice(x + 1) : r.slice(x)) + u, r = r.slice(0, x);
120
+ break;
121
+ }
122
+ }
123
+ }
124
+ F && !S && (r = t(r, 1 / 0));
125
+ var z = l.length + r.length + u.length, s = z < E ? new Array(E - z + 1).join(b) : "";
126
+ switch (F && S && (r = t(s + r, s.length ? E - u.length : 1 / 0), s = ""), p) {
127
+ case "<":
128
+ r = l + r + u + s;
129
+ break;
130
+ case "=":
131
+ r = l + s + r + u;
132
+ break;
133
+ case "^":
134
+ r = s.slice(0, z = s.length >> 1) + l + r + u + s.slice(z);
135
+ break;
136
+ default:
137
+ r = s + l + r + u;
138
+ break;
139
+ }
140
+ return a(r);
141
+ }
142
+ return G.toString = function() {
143
+ return f + "";
144
+ }, G;
145
+ }
146
+ function Z(f, g) {
147
+ var b = Math.max(-8, Math.min(8, Math.floor(K(g) / 3))) * 3, p = Math.pow(10, -b), m = T((f = $(f), f.type = "f", f), { suffix: Y[8 + b / 3] });
148
+ return function(w) {
149
+ return m(p * w);
150
+ };
151
+ }
152
+ return {
153
+ format: T,
154
+ formatPrefix: Z
155
+ };
156
+ }
157
+ var A, tn, rn;
158
+ en({
159
+ thousands: ",",
160
+ grouping: [3],
161
+ currency: ["$", ""]
162
+ });
163
+ function en(n) {
164
+ return A = nn(n), tn = A.format, rn = A.formatPrefix, A;
165
+ }
166
+ export {
167
+ rn as a,
168
+ tn as b,
169
+ K as e,
170
+ $ as f
171
+ };