@umami/shiso 1.12.0 → 1.13.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 (121) hide show
  1. package/dist/chunks/App.js +76 -49
  2. package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
  3. package/dist/chunks/arc.js +130 -0
  4. package/dist/chunks/architecture-7GRP2DOG.js +4 -0
  5. package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
  6. package/dist/chunks/array.js +8 -0
  7. package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
  8. package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
  9. package/dist/chunks/channel.js +9 -0
  10. package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
  11. package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
  12. package/dist/chunks/chunk-5VM5RSS4.js +21 -0
  13. package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
  14. package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
  15. package/dist/chunks/chunk-F27PBJKO.js +95 -0
  16. package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
  17. package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
  18. package/dist/chunks/chunk-GVQU2GXP.js +58 -0
  19. package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
  20. package/dist/chunks/chunk-JWPE2WC7.js +12 -0
  21. package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
  22. package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
  23. package/dist/chunks/chunk-P2QGCYS3.js +95 -0
  24. package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
  25. package/dist/chunks/chunk-PWAF6VOD.js +467 -0
  26. package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
  27. package/dist/chunks/chunk-SVP7TREG.js +686 -0
  28. package/dist/chunks/chunk-TICWLB2K.js +3800 -0
  29. package/dist/chunks/chunk-XXDRQBXY.js +12 -0
  30. package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
  31. package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
  32. package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
  33. package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
  34. package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
  35. package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
  36. package/dist/chunks/cytoscape.esm.js +28282 -0
  37. package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
  38. package/dist/chunks/dagre.js +4235 -0
  39. package/dist/chunks/defaultLocale.js +246 -0
  40. package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
  41. package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
  42. package/dist/chunks/diagram-VSXAHHWV.js +553 -0
  43. package/dist/chunks/diagram-VX7I27RA.js +798 -0
  44. package/dist/chunks/diagram-Z3DM3KII.js +186 -0
  45. package/dist/chunks/dist.js +92 -0
  46. package/dist/chunks/docs.js +987 -91
  47. package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
  48. package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
  49. package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
  50. package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
  51. package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
  52. package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
  53. package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
  54. package/dist/chunks/graphlib.js +4194 -0
  55. package/dist/chunks/info-A6RAGUB7.js +4 -0
  56. package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
  57. package/dist/chunks/init.js +14 -0
  58. package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
  59. package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
  60. package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
  61. package/dist/chunks/katex.js +26463 -0
  62. package/dist/chunks/line.js +48 -0
  63. package/dist/chunks/linear.js +391 -0
  64. package/dist/chunks/mermaid-parser.core.js +754 -0
  65. package/dist/chunks/mermaid.core.js +4898 -0
  66. package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
  67. package/dist/chunks/ordinal.js +84 -0
  68. package/dist/chunks/packet-AYTQ26CC.js +4 -0
  69. package/dist/chunks/path.js +106 -0
  70. package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
  71. package/dist/chunks/pie-WAS4IAKB.js +4 -0
  72. package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
  73. package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
  74. package/dist/chunks/radar-RG4KPBEZ.js +4 -0
  75. package/dist/chunks/railroad-74A4TZTK.js +4 -0
  76. package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
  77. package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
  78. package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
  79. package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
  80. package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
  81. package/dist/chunks/rough.esm.js +1396 -0
  82. package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
  83. package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
  84. package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
  85. package/dist/chunks/src.js +2653 -0
  86. package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
  87. package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
  88. package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
  89. package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
  90. package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
  91. package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
  92. package/dist/chunks/treemap-WGGIJYW6.js +4 -0
  93. package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
  94. package/dist/chunks/wardley-WFR3VGLG.js +4 -0
  95. package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
  96. package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
  97. package/dist/components.js +2 -2
  98. package/dist/entry-client.js +1 -1
  99. package/dist/entry-server.js +1 -1
  100. package/docs.schema.json +1 -1
  101. package/package.json +2 -1
  102. package/scripts/expand-navigation-globs.mjs +77 -8
  103. package/src/components/CodeBlock.tsx +36 -0
  104. package/src/components/Docs.tsx +44 -21
  105. package/src/components/OpenApiOperation.tsx +28 -20
  106. package/src/components/SideNav.tsx +8 -3
  107. package/src/components/docs/Changelog.tsx +163 -0
  108. package/src/components/docs/Mermaid.tsx +164 -0
  109. package/src/components/docs/Panel.tsx +23 -0
  110. package/src/components/docs/ParamField.tsx +17 -5
  111. package/src/components/docs/PropertiesTable.tsx +2 -2
  112. package/src/components/docs/ResponseField.tsx +17 -5
  113. package/src/components/docs/Tiles.tsx +59 -0
  114. package/src/components/docs/Tree.tsx +359 -0
  115. package/src/components/docs/Update.tsx +72 -0
  116. package/src/components/docs/index.ts +7 -0
  117. package/src/components/docs/panel-context.tsx +25 -0
  118. package/src/components/docs/styles.ts +49 -0
  119. package/src/components/icons/index.ts +4 -0
  120. package/src/lib/rehype-shiki.ts +18 -1
  121. package/types/components.d.ts +79 -0
@@ -0,0 +1,1308 @@
1
+ import { n as __name } from "./chunk-Y2CYZVJY.js";
2
+ import { p as select_default } from "./src.js";
3
+ import { H as setAccDescription, J as setupGraphViewbox, K as setDiagramTitle, U as setAccTitle, a as clear, d as defaultConfig2, s as common_default, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-DU6HZSFF.js";
4
+ import { t as ordinal } from "./ordinal.js";
5
+
6
+ //#region ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js
7
+ function colors_default(specifier) {
8
+ var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
9
+ while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
10
+ return colors;
11
+ }
12
+
13
+ //#endregion
14
+ //#region ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Tableau10.js
15
+ var Tableau10_default = colors_default("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
16
+
17
+ //#endregion
18
+ //#region ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/max.js
19
+ function max(values, valueof) {
20
+ let max;
21
+ if (valueof === void 0) {
22
+ for (const value of values) if (value != null && (max < value || max === void 0 && value >= value)) max = value;
23
+ } else {
24
+ let index = -1;
25
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (max < value || max === void 0 && value >= value)) max = value;
26
+ }
27
+ return max;
28
+ }
29
+
30
+ //#endregion
31
+ //#region ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/min.js
32
+ function min(values, valueof) {
33
+ let min;
34
+ if (valueof === void 0) {
35
+ for (const value of values) if (value != null && (min > value || min === void 0 && value >= value)) min = value;
36
+ } else {
37
+ let index = -1;
38
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (min > value || min === void 0 && value >= value)) min = value;
39
+ }
40
+ return min;
41
+ }
42
+
43
+ //#endregion
44
+ //#region ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/sum.js
45
+ function sum(values, valueof) {
46
+ let sum = 0;
47
+ if (valueof === void 0) {
48
+ for (let value of values) if (value = +value) sum += value;
49
+ } else {
50
+ let index = -1;
51
+ for (let value of values) if (value = +valueof(value, ++index, values)) sum += value;
52
+ }
53
+ return sum;
54
+ }
55
+
56
+ //#endregion
57
+ //#region ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/align.js
58
+ function targetDepth(d) {
59
+ return d.target.depth;
60
+ }
61
+ function left(node) {
62
+ return node.depth;
63
+ }
64
+ function right(node, n) {
65
+ return n - 1 - node.height;
66
+ }
67
+ function justify(node, n) {
68
+ return node.sourceLinks.length ? node.depth : n - 1;
69
+ }
70
+ function center(node) {
71
+ return node.targetLinks.length ? node.depth : node.sourceLinks.length ? min(node.sourceLinks, targetDepth) - 1 : 0;
72
+ }
73
+
74
+ //#endregion
75
+ //#region ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/constant.js
76
+ function constant(x) {
77
+ return function() {
78
+ return x;
79
+ };
80
+ }
81
+
82
+ //#endregion
83
+ //#region ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankey.js
84
+ function ascendingSourceBreadth(a, b) {
85
+ return ascendingBreadth(a.source, b.source) || a.index - b.index;
86
+ }
87
+ function ascendingTargetBreadth(a, b) {
88
+ return ascendingBreadth(a.target, b.target) || a.index - b.index;
89
+ }
90
+ function ascendingBreadth(a, b) {
91
+ return a.y0 - b.y0;
92
+ }
93
+ function value(d) {
94
+ return d.value;
95
+ }
96
+ function defaultId(d) {
97
+ return d.index;
98
+ }
99
+ function defaultNodes(graph) {
100
+ return graph.nodes;
101
+ }
102
+ function defaultLinks(graph) {
103
+ return graph.links;
104
+ }
105
+ function find(nodeById, id) {
106
+ const node = nodeById.get(id);
107
+ if (!node) throw new Error("missing: " + id);
108
+ return node;
109
+ }
110
+ function computeLinkBreadths({ nodes }) {
111
+ for (const node of nodes) {
112
+ let y0 = node.y0;
113
+ let y1 = y0;
114
+ for (const link of node.sourceLinks) {
115
+ link.y0 = y0 + link.width / 2;
116
+ y0 += link.width;
117
+ }
118
+ for (const link of node.targetLinks) {
119
+ link.y1 = y1 + link.width / 2;
120
+ y1 += link.width;
121
+ }
122
+ }
123
+ }
124
+ function Sankey() {
125
+ let x0 = 0, y0 = 0, x1 = 1, y1 = 1;
126
+ let dx = 24;
127
+ let dy = 8, py;
128
+ let id = defaultId;
129
+ let align = justify;
130
+ let sort;
131
+ let linkSort;
132
+ let nodes = defaultNodes;
133
+ let links = defaultLinks;
134
+ let iterations = 6;
135
+ function sankey() {
136
+ const graph = {
137
+ nodes: nodes.apply(null, arguments),
138
+ links: links.apply(null, arguments)
139
+ };
140
+ computeNodeLinks(graph);
141
+ computeNodeValues(graph);
142
+ computeNodeDepths(graph);
143
+ computeNodeHeights(graph);
144
+ computeNodeBreadths(graph);
145
+ computeLinkBreadths(graph);
146
+ return graph;
147
+ }
148
+ sankey.update = function(graph) {
149
+ computeLinkBreadths(graph);
150
+ return graph;
151
+ };
152
+ sankey.nodeId = function(_) {
153
+ return arguments.length ? (id = typeof _ === "function" ? _ : constant(_), sankey) : id;
154
+ };
155
+ sankey.nodeAlign = function(_) {
156
+ return arguments.length ? (align = typeof _ === "function" ? _ : constant(_), sankey) : align;
157
+ };
158
+ sankey.nodeSort = function(_) {
159
+ return arguments.length ? (sort = _, sankey) : sort;
160
+ };
161
+ sankey.nodeWidth = function(_) {
162
+ return arguments.length ? (dx = +_, sankey) : dx;
163
+ };
164
+ sankey.nodePadding = function(_) {
165
+ return arguments.length ? (dy = py = +_, sankey) : dy;
166
+ };
167
+ sankey.nodes = function(_) {
168
+ return arguments.length ? (nodes = typeof _ === "function" ? _ : constant(_), sankey) : nodes;
169
+ };
170
+ sankey.links = function(_) {
171
+ return arguments.length ? (links = typeof _ === "function" ? _ : constant(_), sankey) : links;
172
+ };
173
+ sankey.linkSort = function(_) {
174
+ return arguments.length ? (linkSort = _, sankey) : linkSort;
175
+ };
176
+ sankey.size = function(_) {
177
+ return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];
178
+ };
179
+ sankey.extent = function(_) {
180
+ return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];
181
+ };
182
+ sankey.iterations = function(_) {
183
+ return arguments.length ? (iterations = +_, sankey) : iterations;
184
+ };
185
+ function computeNodeLinks({ nodes, links }) {
186
+ for (const [i, node] of nodes.entries()) {
187
+ node.index = i;
188
+ node.sourceLinks = [];
189
+ node.targetLinks = [];
190
+ }
191
+ const nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d]));
192
+ for (const [i, link] of links.entries()) {
193
+ link.index = i;
194
+ let { source, target } = link;
195
+ if (typeof source !== "object") source = link.source = find(nodeById, source);
196
+ if (typeof target !== "object") target = link.target = find(nodeById, target);
197
+ source.sourceLinks.push(link);
198
+ target.targetLinks.push(link);
199
+ }
200
+ if (linkSort != null) for (const { sourceLinks, targetLinks } of nodes) {
201
+ sourceLinks.sort(linkSort);
202
+ targetLinks.sort(linkSort);
203
+ }
204
+ }
205
+ function computeNodeValues({ nodes }) {
206
+ for (const node of nodes) node.value = node.fixedValue === void 0 ? Math.max(sum(node.sourceLinks, value), sum(node.targetLinks, value)) : node.fixedValue;
207
+ }
208
+ function computeNodeDepths({ nodes }) {
209
+ const n = nodes.length;
210
+ let current = new Set(nodes);
211
+ let next = /* @__PURE__ */ new Set();
212
+ let x = 0;
213
+ while (current.size) {
214
+ for (const node of current) {
215
+ node.depth = x;
216
+ for (const { target } of node.sourceLinks) next.add(target);
217
+ }
218
+ if (++x > n) throw new Error("circular link");
219
+ current = next;
220
+ next = /* @__PURE__ */ new Set();
221
+ }
222
+ }
223
+ function computeNodeHeights({ nodes }) {
224
+ const n = nodes.length;
225
+ let current = new Set(nodes);
226
+ let next = /* @__PURE__ */ new Set();
227
+ let x = 0;
228
+ while (current.size) {
229
+ for (const node of current) {
230
+ node.height = x;
231
+ for (const { source } of node.targetLinks) next.add(source);
232
+ }
233
+ if (++x > n) throw new Error("circular link");
234
+ current = next;
235
+ next = /* @__PURE__ */ new Set();
236
+ }
237
+ }
238
+ function computeNodeLayers({ nodes }) {
239
+ const x = max(nodes, (d) => d.depth) + 1;
240
+ const kx = (x1 - x0 - dx) / (x - 1);
241
+ const columns = new Array(x);
242
+ for (const node of nodes) {
243
+ const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));
244
+ node.layer = i;
245
+ node.x0 = x0 + i * kx;
246
+ node.x1 = node.x0 + dx;
247
+ if (columns[i]) columns[i].push(node);
248
+ else columns[i] = [node];
249
+ }
250
+ if (sort) for (const column of columns) column.sort(sort);
251
+ return columns;
252
+ }
253
+ function initializeNodeBreadths(columns) {
254
+ const ky = min(columns, (c) => (y1 - y0 - (c.length - 1) * py) / sum(c, value));
255
+ for (const nodes of columns) {
256
+ let y = y0;
257
+ for (const node of nodes) {
258
+ node.y0 = y;
259
+ node.y1 = y + node.value * ky;
260
+ y = node.y1 + py;
261
+ for (const link of node.sourceLinks) link.width = link.value * ky;
262
+ }
263
+ y = (y1 - y + py) / (nodes.length + 1);
264
+ for (let i = 0; i < nodes.length; ++i) {
265
+ const node = nodes[i];
266
+ node.y0 += y * (i + 1);
267
+ node.y1 += y * (i + 1);
268
+ }
269
+ reorderLinks(nodes);
270
+ }
271
+ }
272
+ function computeNodeBreadths(graph) {
273
+ const columns = computeNodeLayers(graph);
274
+ py = Math.min(dy, (y1 - y0) / (max(columns, (c) => c.length) - 1));
275
+ initializeNodeBreadths(columns);
276
+ for (let i = 0; i < iterations; ++i) {
277
+ const alpha = Math.pow(.99, i);
278
+ const beta = Math.max(1 - alpha, (i + 1) / iterations);
279
+ relaxRightToLeft(columns, alpha, beta);
280
+ relaxLeftToRight(columns, alpha, beta);
281
+ }
282
+ }
283
+ function relaxLeftToRight(columns, alpha, beta) {
284
+ for (let i = 1, n = columns.length; i < n; ++i) {
285
+ const column = columns[i];
286
+ for (const target of column) {
287
+ let y = 0;
288
+ let w = 0;
289
+ for (const { source, value } of target.targetLinks) {
290
+ let v = value * (target.layer - source.layer);
291
+ y += targetTop(source, target) * v;
292
+ w += v;
293
+ }
294
+ if (!(w > 0)) continue;
295
+ let dy = (y / w - target.y0) * alpha;
296
+ target.y0 += dy;
297
+ target.y1 += dy;
298
+ reorderNodeLinks(target);
299
+ }
300
+ if (sort === void 0) column.sort(ascendingBreadth);
301
+ resolveCollisions(column, beta);
302
+ }
303
+ }
304
+ function relaxRightToLeft(columns, alpha, beta) {
305
+ for (let i = columns.length - 2; i >= 0; --i) {
306
+ const column = columns[i];
307
+ for (const source of column) {
308
+ let y = 0;
309
+ let w = 0;
310
+ for (const { target, value } of source.sourceLinks) {
311
+ let v = value * (target.layer - source.layer);
312
+ y += sourceTop(source, target) * v;
313
+ w += v;
314
+ }
315
+ if (!(w > 0)) continue;
316
+ let dy = (y / w - source.y0) * alpha;
317
+ source.y0 += dy;
318
+ source.y1 += dy;
319
+ reorderNodeLinks(source);
320
+ }
321
+ if (sort === void 0) column.sort(ascendingBreadth);
322
+ resolveCollisions(column, beta);
323
+ }
324
+ }
325
+ function resolveCollisions(nodes, alpha) {
326
+ const i = nodes.length >> 1;
327
+ const subject = nodes[i];
328
+ resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);
329
+ resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);
330
+ resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);
331
+ resolveCollisionsTopToBottom(nodes, y0, 0, alpha);
332
+ }
333
+ function resolveCollisionsTopToBottom(nodes, y, i, alpha) {
334
+ for (; i < nodes.length; ++i) {
335
+ const node = nodes[i];
336
+ const dy = (y - node.y0) * alpha;
337
+ if (dy > 1e-6) node.y0 += dy, node.y1 += dy;
338
+ y = node.y1 + py;
339
+ }
340
+ }
341
+ function resolveCollisionsBottomToTop(nodes, y, i, alpha) {
342
+ for (; i >= 0; --i) {
343
+ const node = nodes[i];
344
+ const dy = (node.y1 - y) * alpha;
345
+ if (dy > 1e-6) node.y0 -= dy, node.y1 -= dy;
346
+ y = node.y0 - py;
347
+ }
348
+ }
349
+ function reorderNodeLinks({ sourceLinks, targetLinks }) {
350
+ if (linkSort === void 0) {
351
+ for (const { source: { sourceLinks } } of targetLinks) sourceLinks.sort(ascendingTargetBreadth);
352
+ for (const { target: { targetLinks } } of sourceLinks) targetLinks.sort(ascendingSourceBreadth);
353
+ }
354
+ }
355
+ function reorderLinks(nodes) {
356
+ if (linkSort === void 0) for (const { sourceLinks, targetLinks } of nodes) {
357
+ sourceLinks.sort(ascendingTargetBreadth);
358
+ targetLinks.sort(ascendingSourceBreadth);
359
+ }
360
+ }
361
+ function targetTop(source, target) {
362
+ let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;
363
+ for (const { target: node, width } of source.sourceLinks) {
364
+ if (node === target) break;
365
+ y += width + py;
366
+ }
367
+ for (const { source: node, width } of target.targetLinks) {
368
+ if (node === source) break;
369
+ y -= width;
370
+ }
371
+ return y;
372
+ }
373
+ function sourceTop(source, target) {
374
+ let y = target.y0 - (target.targetLinks.length - 1) * py / 2;
375
+ for (const { source: node, width } of target.targetLinks) {
376
+ if (node === source) break;
377
+ y += width + py;
378
+ }
379
+ for (const { target: node, width } of source.sourceLinks) {
380
+ if (node === target) break;
381
+ y -= width;
382
+ }
383
+ return y;
384
+ }
385
+ return sankey;
386
+ }
387
+
388
+ //#endregion
389
+ //#region ../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/path.js
390
+ var pi = Math.PI;
391
+ var tau = 2 * pi;
392
+ var epsilon = 1e-6;
393
+ var tauEpsilon = tau - epsilon;
394
+ function Path() {
395
+ this._x0 = this._y0 = this._x1 = this._y1 = null;
396
+ this._ = "";
397
+ }
398
+ function path() {
399
+ return new Path();
400
+ }
401
+ Path.prototype = path.prototype = {
402
+ constructor: Path,
403
+ moveTo: function(x, y) {
404
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
405
+ },
406
+ closePath: function() {
407
+ if (this._x1 !== null) {
408
+ this._x1 = this._x0, this._y1 = this._y0;
409
+ this._ += "Z";
410
+ }
411
+ },
412
+ lineTo: function(x, y) {
413
+ this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
414
+ },
415
+ quadraticCurveTo: function(x1, y1, x, y) {
416
+ this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
417
+ },
418
+ bezierCurveTo: function(x1, y1, x2, y2, x, y) {
419
+ this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
420
+ },
421
+ arcTo: function(x1, y1, x2, y2, r) {
422
+ x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
423
+ var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
424
+ if (r < 0) throw new Error("negative radius: " + r);
425
+ if (this._x1 === null) this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
426
+ else if (!(l01_2 > epsilon));
427
+ else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
428
+ else {
429
+ var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
430
+ if (Math.abs(t01 - 1) > epsilon) this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
431
+ this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
432
+ }
433
+ },
434
+ arc: function(x, y, r, a0, a1, ccw) {
435
+ x = +x, y = +y, r = +r, ccw = !!ccw;
436
+ var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
437
+ if (r < 0) throw new Error("negative radius: " + r);
438
+ if (this._x1 === null) this._ += "M" + x0 + "," + y0;
439
+ else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0;
440
+ if (!r) return;
441
+ if (da < 0) da = da % tau + tau;
442
+ if (da > tauEpsilon) this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
443
+ else if (da > epsilon) this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
444
+ },
445
+ rect: function(x, y, w, h) {
446
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
447
+ },
448
+ toString: function() {
449
+ return this._;
450
+ }
451
+ };
452
+
453
+ //#endregion
454
+ //#region ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/constant.js
455
+ function constant_default(x) {
456
+ return function constant() {
457
+ return x;
458
+ };
459
+ }
460
+
461
+ //#endregion
462
+ //#region ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/point.js
463
+ function x(p) {
464
+ return p[0];
465
+ }
466
+ function y(p) {
467
+ return p[1];
468
+ }
469
+
470
+ //#endregion
471
+ //#region ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/array.js
472
+ var slice = Array.prototype.slice;
473
+
474
+ //#endregion
475
+ //#region ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/link/index.js
476
+ function linkSource(d) {
477
+ return d.source;
478
+ }
479
+ function linkTarget(d) {
480
+ return d.target;
481
+ }
482
+ function link(curve) {
483
+ var source = linkSource, target = linkTarget, x$1 = x, y$1 = y, context = null;
484
+ function link() {
485
+ var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
486
+ if (!context) context = buffer = path();
487
+ curve(context, +x$1.apply(this, (argv[0] = s, argv)), +y$1.apply(this, argv), +x$1.apply(this, (argv[0] = t, argv)), +y$1.apply(this, argv));
488
+ if (buffer) return context = null, buffer + "" || null;
489
+ }
490
+ link.source = function(_) {
491
+ return arguments.length ? (source = _, link) : source;
492
+ };
493
+ link.target = function(_) {
494
+ return arguments.length ? (target = _, link) : target;
495
+ };
496
+ link.x = function(_) {
497
+ return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant_default(+_), link) : x$1;
498
+ };
499
+ link.y = function(_) {
500
+ return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant_default(+_), link) : y$1;
501
+ };
502
+ link.context = function(_) {
503
+ return arguments.length ? (context = _ == null ? null : _, link) : context;
504
+ };
505
+ return link;
506
+ }
507
+ function curveHorizontal(context, x0, y0, x1, y1) {
508
+ context.moveTo(x0, y0);
509
+ context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
510
+ }
511
+ function linkHorizontal() {
512
+ return link(curveHorizontal);
513
+ }
514
+
515
+ //#endregion
516
+ //#region ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankeyLinkHorizontal.js
517
+ function horizontalSource(d) {
518
+ return [d.source.x1, d.y0];
519
+ }
520
+ function horizontalTarget(d) {
521
+ return [d.target.x0, d.y1];
522
+ }
523
+ function sankeyLinkHorizontal_default() {
524
+ return linkHorizontal().source(horizontalSource).target(horizontalTarget);
525
+ }
526
+
527
+ //#endregion
528
+ //#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/sankeyDiagram-P5KCCOFB.mjs
529
+ var parser = (function() {
530
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
531
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v);
532
+ return o2;
533
+ }, "o"), $V0 = [1, 9], $V1 = [1, 10], $V2 = [
534
+ 1,
535
+ 5,
536
+ 10,
537
+ 12
538
+ ];
539
+ var parser2 = {
540
+ trace: /* @__PURE__ */ __name(function trace() {}, "trace"),
541
+ yy: {},
542
+ symbols_: {
543
+ "error": 2,
544
+ "start": 3,
545
+ "SANKEY": 4,
546
+ "NEWLINE": 5,
547
+ "csv": 6,
548
+ "opt_eof": 7,
549
+ "record": 8,
550
+ "csv_tail": 9,
551
+ "EOF": 10,
552
+ "field[source]": 11,
553
+ "COMMA": 12,
554
+ "field[target]": 13,
555
+ "field[value]": 14,
556
+ "field": 15,
557
+ "escaped": 16,
558
+ "non_escaped": 17,
559
+ "DQUOTE": 18,
560
+ "ESCAPED_TEXT": 19,
561
+ "NON_ESCAPED_TEXT": 20,
562
+ "$accept": 0,
563
+ "$end": 1
564
+ },
565
+ terminals_: {
566
+ 2: "error",
567
+ 4: "SANKEY",
568
+ 5: "NEWLINE",
569
+ 10: "EOF",
570
+ 11: "field[source]",
571
+ 12: "COMMA",
572
+ 13: "field[target]",
573
+ 14: "field[value]",
574
+ 18: "DQUOTE",
575
+ 19: "ESCAPED_TEXT",
576
+ 20: "NON_ESCAPED_TEXT"
577
+ },
578
+ productions_: [
579
+ 0,
580
+ [3, 4],
581
+ [6, 2],
582
+ [9, 2],
583
+ [9, 0],
584
+ [7, 1],
585
+ [7, 0],
586
+ [8, 5],
587
+ [15, 1],
588
+ [15, 1],
589
+ [16, 3],
590
+ [17, 1]
591
+ ],
592
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
593
+ var $0 = $$.length - 1;
594
+ switch (yystate) {
595
+ case 7:
596
+ const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll("\"\"", "\""));
597
+ const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll("\"\"", "\""));
598
+ const value = parseFloat($$[$0].trim());
599
+ yy.addLink(source, target, value);
600
+ break;
601
+ case 8:
602
+ case 9:
603
+ case 11:
604
+ this.$ = $$[$0];
605
+ break;
606
+ case 10: this.$ = $$[$0 - 1];
607
+ }
608
+ }, "anonymous"),
609
+ table: [
610
+ {
611
+ 3: 1,
612
+ 4: [1, 2]
613
+ },
614
+ { 1: [3] },
615
+ { 5: [1, 3] },
616
+ {
617
+ 6: 4,
618
+ 8: 5,
619
+ 15: 6,
620
+ 16: 7,
621
+ 17: 8,
622
+ 18: $V0,
623
+ 20: $V1
624
+ },
625
+ {
626
+ 1: [2, 6],
627
+ 7: 11,
628
+ 10: [1, 12]
629
+ },
630
+ o($V1, [2, 4], {
631
+ 9: 13,
632
+ 5: [1, 14]
633
+ }),
634
+ { 12: [1, 15] },
635
+ o($V2, [2, 8]),
636
+ o($V2, [2, 9]),
637
+ { 19: [1, 16] },
638
+ o($V2, [2, 11]),
639
+ { 1: [2, 1] },
640
+ { 1: [2, 5] },
641
+ o($V1, [2, 2]),
642
+ {
643
+ 6: 17,
644
+ 8: 5,
645
+ 15: 6,
646
+ 16: 7,
647
+ 17: 8,
648
+ 18: $V0,
649
+ 20: $V1
650
+ },
651
+ {
652
+ 15: 18,
653
+ 16: 7,
654
+ 17: 8,
655
+ 18: $V0,
656
+ 20: $V1
657
+ },
658
+ { 18: [1, 19] },
659
+ o($V1, [2, 3]),
660
+ { 12: [1, 20] },
661
+ o($V2, [2, 10]),
662
+ {
663
+ 15: 21,
664
+ 16: 7,
665
+ 17: 8,
666
+ 18: $V0,
667
+ 20: $V1
668
+ },
669
+ o([
670
+ 1,
671
+ 5,
672
+ 10
673
+ ], [2, 7])
674
+ ],
675
+ defaultActions: {
676
+ 11: [2, 1],
677
+ 12: [2, 5]
678
+ },
679
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
680
+ if (hash.recoverable) this.trace(str);
681
+ else {
682
+ var error = new Error(str);
683
+ error.hash = hash;
684
+ throw error;
685
+ }
686
+ }, "parseError"),
687
+ parse: /* @__PURE__ */ __name(function parse(input) {
688
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
689
+ var args = lstack.slice.call(arguments, 1);
690
+ var lexer2 = Object.create(this.lexer);
691
+ var sharedState = { yy: {} };
692
+ for (var k in this.yy) if (Object.prototype.hasOwnProperty.call(this.yy, k)) sharedState.yy[k] = this.yy[k];
693
+ lexer2.setInput(input, sharedState.yy);
694
+ sharedState.yy.lexer = lexer2;
695
+ sharedState.yy.parser = this;
696
+ if (typeof lexer2.yylloc == "undefined") lexer2.yylloc = {};
697
+ var yyloc = lexer2.yylloc;
698
+ lstack.push(yyloc);
699
+ var ranges = lexer2.options && lexer2.options.ranges;
700
+ if (typeof sharedState.yy.parseError === "function") this.parseError = sharedState.yy.parseError;
701
+ else this.parseError = Object.getPrototypeOf(this).parseError;
702
+ function popStack(n) {
703
+ stack.length = stack.length - 2 * n;
704
+ vstack.length = vstack.length - n;
705
+ lstack.length = lstack.length - n;
706
+ }
707
+ __name(popStack, "popStack");
708
+ function lex() {
709
+ var token = tstack.pop() || lexer2.lex() || EOF;
710
+ if (typeof token !== "number") {
711
+ if (token instanceof Array) {
712
+ tstack = token;
713
+ token = tstack.pop();
714
+ }
715
+ token = self.symbols_[token] || token;
716
+ }
717
+ return token;
718
+ }
719
+ __name(lex, "lex");
720
+ var symbol, preErrorSymbol, state, action, r, yyval = {}, p, len, newState, expected;
721
+ while (true) {
722
+ state = stack[stack.length - 1];
723
+ if (this.defaultActions[state]) action = this.defaultActions[state];
724
+ else {
725
+ if (symbol === null || typeof symbol == "undefined") symbol = lex();
726
+ action = table[state] && table[state][symbol];
727
+ }
728
+ if (typeof action === "undefined" || !action.length || !action[0]) {
729
+ var errStr = "";
730
+ expected = [];
731
+ for (p in table[state]) if (this.terminals_[p] && p > TERROR) expected.push("'" + this.terminals_[p] + "'");
732
+ if (lexer2.showPosition) errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
733
+ else errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
734
+ this.parseError(errStr, {
735
+ text: lexer2.match,
736
+ token: this.terminals_[symbol] || symbol,
737
+ line: lexer2.yylineno,
738
+ loc: yyloc,
739
+ expected
740
+ });
741
+ }
742
+ if (action[0] instanceof Array && action.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
743
+ switch (action[0]) {
744
+ case 1:
745
+ stack.push(symbol);
746
+ vstack.push(lexer2.yytext);
747
+ lstack.push(lexer2.yylloc);
748
+ stack.push(action[1]);
749
+ symbol = null;
750
+ if (!preErrorSymbol) {
751
+ yyleng = lexer2.yyleng;
752
+ yytext = lexer2.yytext;
753
+ yylineno = lexer2.yylineno;
754
+ yyloc = lexer2.yylloc;
755
+ if (recovering > 0) recovering--;
756
+ } else {
757
+ symbol = preErrorSymbol;
758
+ preErrorSymbol = null;
759
+ }
760
+ break;
761
+ case 2:
762
+ len = this.productions_[action[1]][1];
763
+ yyval.$ = vstack[vstack.length - len];
764
+ yyval._$ = {
765
+ first_line: lstack[lstack.length - (len || 1)].first_line,
766
+ last_line: lstack[lstack.length - 1].last_line,
767
+ first_column: lstack[lstack.length - (len || 1)].first_column,
768
+ last_column: lstack[lstack.length - 1].last_column
769
+ };
770
+ if (ranges) yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
771
+ r = this.performAction.apply(yyval, [
772
+ yytext,
773
+ yyleng,
774
+ yylineno,
775
+ sharedState.yy,
776
+ action[1],
777
+ vstack,
778
+ lstack
779
+ ].concat(args));
780
+ if (typeof r !== "undefined") return r;
781
+ if (len) {
782
+ stack = stack.slice(0, -1 * len * 2);
783
+ vstack = vstack.slice(0, -1 * len);
784
+ lstack = lstack.slice(0, -1 * len);
785
+ }
786
+ stack.push(this.productions_[action[1]][0]);
787
+ vstack.push(yyval.$);
788
+ lstack.push(yyval._$);
789
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
790
+ stack.push(newState);
791
+ break;
792
+ case 3: return true;
793
+ }
794
+ }
795
+ return true;
796
+ }, "parse")
797
+ };
798
+ parser2.lexer = /* @__PURE__ */ (function() {
799
+ return {
800
+ EOF: 1,
801
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
802
+ if (this.yy.parser) this.yy.parser.parseError(str, hash);
803
+ else throw new Error(str);
804
+ }, "parseError"),
805
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
806
+ this.yy = yy || this.yy || {};
807
+ this._input = input;
808
+ this._more = this._backtrack = this.done = false;
809
+ this.yylineno = this.yyleng = 0;
810
+ this.yytext = this.matched = this.match = "";
811
+ this.conditionStack = ["INITIAL"];
812
+ this.yylloc = {
813
+ first_line: 1,
814
+ first_column: 0,
815
+ last_line: 1,
816
+ last_column: 0
817
+ };
818
+ if (this.options.ranges) this.yylloc.range = [0, 0];
819
+ this.offset = 0;
820
+ return this;
821
+ }, "setInput"),
822
+ input: /* @__PURE__ */ __name(function() {
823
+ var ch = this._input[0];
824
+ this.yytext += ch;
825
+ this.yyleng++;
826
+ this.offset++;
827
+ this.match += ch;
828
+ this.matched += ch;
829
+ if (ch.match(/(?:\r\n?|\n).*/g)) {
830
+ this.yylineno++;
831
+ this.yylloc.last_line++;
832
+ } else this.yylloc.last_column++;
833
+ if (this.options.ranges) this.yylloc.range[1]++;
834
+ this._input = this._input.slice(1);
835
+ return ch;
836
+ }, "input"),
837
+ unput: /* @__PURE__ */ __name(function(ch) {
838
+ var len = ch.length;
839
+ var lines = ch.split(/(?:\r\n?|\n)/g);
840
+ this._input = ch + this._input;
841
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
842
+ this.offset -= len;
843
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
844
+ this.match = this.match.substr(0, this.match.length - 1);
845
+ this.matched = this.matched.substr(0, this.matched.length - 1);
846
+ if (lines.length - 1) this.yylineno -= lines.length - 1;
847
+ var r = this.yylloc.range;
848
+ this.yylloc = {
849
+ first_line: this.yylloc.first_line,
850
+ last_line: this.yylineno + 1,
851
+ first_column: this.yylloc.first_column,
852
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
853
+ };
854
+ if (this.options.ranges) this.yylloc.range = [r[0], r[0] + this.yyleng - len];
855
+ this.yyleng = this.yytext.length;
856
+ return this;
857
+ }, "unput"),
858
+ more: /* @__PURE__ */ __name(function() {
859
+ this._more = true;
860
+ return this;
861
+ }, "more"),
862
+ reject: /* @__PURE__ */ __name(function() {
863
+ if (this.options.backtrack_lexer) this._backtrack = true;
864
+ else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
865
+ text: "",
866
+ token: null,
867
+ line: this.yylineno
868
+ });
869
+ return this;
870
+ }, "reject"),
871
+ less: /* @__PURE__ */ __name(function(n) {
872
+ this.unput(this.match.slice(n));
873
+ }, "less"),
874
+ pastInput: /* @__PURE__ */ __name(function() {
875
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
876
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
877
+ }, "pastInput"),
878
+ upcomingInput: /* @__PURE__ */ __name(function() {
879
+ var next = this.match;
880
+ if (next.length < 20) next += this._input.substr(0, 20 - next.length);
881
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
882
+ }, "upcomingInput"),
883
+ showPosition: /* @__PURE__ */ __name(function() {
884
+ var pre = this.pastInput();
885
+ var c = new Array(pre.length + 1).join("-");
886
+ return pre + this.upcomingInput() + "\n" + c + "^";
887
+ }, "showPosition"),
888
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
889
+ var token, lines, backup;
890
+ if (this.options.backtrack_lexer) {
891
+ backup = {
892
+ yylineno: this.yylineno,
893
+ yylloc: {
894
+ first_line: this.yylloc.first_line,
895
+ last_line: this.last_line,
896
+ first_column: this.yylloc.first_column,
897
+ last_column: this.yylloc.last_column
898
+ },
899
+ yytext: this.yytext,
900
+ match: this.match,
901
+ matches: this.matches,
902
+ matched: this.matched,
903
+ yyleng: this.yyleng,
904
+ offset: this.offset,
905
+ _more: this._more,
906
+ _input: this._input,
907
+ yy: this.yy,
908
+ conditionStack: this.conditionStack.slice(0),
909
+ done: this.done
910
+ };
911
+ if (this.options.ranges) backup.yylloc.range = this.yylloc.range.slice(0);
912
+ }
913
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
914
+ if (lines) this.yylineno += lines.length;
915
+ this.yylloc = {
916
+ first_line: this.yylloc.last_line,
917
+ last_line: this.yylineno + 1,
918
+ first_column: this.yylloc.last_column,
919
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
920
+ };
921
+ this.yytext += match[0];
922
+ this.match += match[0];
923
+ this.matches = match;
924
+ this.yyleng = this.yytext.length;
925
+ if (this.options.ranges) this.yylloc.range = [this.offset, this.offset += this.yyleng];
926
+ this._more = false;
927
+ this._backtrack = false;
928
+ this._input = this._input.slice(match[0].length);
929
+ this.matched += match[0];
930
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
931
+ if (this.done && this._input) this.done = false;
932
+ if (token) return token;
933
+ else if (this._backtrack) {
934
+ for (var k in backup) this[k] = backup[k];
935
+ return false;
936
+ }
937
+ return false;
938
+ }, "test_match"),
939
+ next: /* @__PURE__ */ __name(function() {
940
+ if (this.done) return this.EOF;
941
+ if (!this._input) this.done = true;
942
+ var token, match, tempMatch, index;
943
+ if (!this._more) {
944
+ this.yytext = "";
945
+ this.match = "";
946
+ }
947
+ var rules = this._currentRules();
948
+ for (var i = 0; i < rules.length; i++) {
949
+ tempMatch = this._input.match(this.rules[rules[i]]);
950
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
951
+ match = tempMatch;
952
+ index = i;
953
+ if (this.options.backtrack_lexer) {
954
+ token = this.test_match(tempMatch, rules[i]);
955
+ if (token !== false) return token;
956
+ else if (this._backtrack) {
957
+ match = false;
958
+ continue;
959
+ } else return false;
960
+ } else if (!this.options.flex) break;
961
+ }
962
+ }
963
+ if (match) {
964
+ token = this.test_match(match, rules[index]);
965
+ if (token !== false) return token;
966
+ return false;
967
+ }
968
+ if (this._input === "") return this.EOF;
969
+ else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
970
+ text: "",
971
+ token: null,
972
+ line: this.yylineno
973
+ });
974
+ }, "next"),
975
+ lex: /* @__PURE__ */ __name(function lex() {
976
+ var r = this.next();
977
+ if (r) return r;
978
+ else return this.lex();
979
+ }, "lex"),
980
+ begin: /* @__PURE__ */ __name(function begin(condition) {
981
+ this.conditionStack.push(condition);
982
+ }, "begin"),
983
+ popState: /* @__PURE__ */ __name(function popState() {
984
+ if (this.conditionStack.length - 1 > 0) return this.conditionStack.pop();
985
+ else return this.conditionStack[0];
986
+ }, "popState"),
987
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
988
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
989
+ else return this.conditions["INITIAL"].rules;
990
+ }, "_currentRules"),
991
+ topState: /* @__PURE__ */ __name(function topState(n) {
992
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
993
+ if (n >= 0) return this.conditionStack[n];
994
+ else return "INITIAL";
995
+ }, "topState"),
996
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
997
+ this.begin(condition);
998
+ }, "pushState"),
999
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
1000
+ return this.conditionStack.length;
1001
+ }, "stateStackSize"),
1002
+ options: { "case-insensitive": true },
1003
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
1004
+ switch ($avoiding_name_collisions) {
1005
+ case 0:
1006
+ this.pushState("csv");
1007
+ return 4;
1008
+ case 1:
1009
+ this.pushState("csv");
1010
+ return 4;
1011
+ case 2: return 10;
1012
+ case 3: return 5;
1013
+ case 4: return 12;
1014
+ case 5:
1015
+ this.pushState("escaped_text");
1016
+ return 18;
1017
+ case 6: return 20;
1018
+ case 7:
1019
+ this.popState("escaped_text");
1020
+ return 18;
1021
+ case 8: return 19;
1022
+ }
1023
+ }, "anonymous"),
1024
+ rules: [
1025
+ /^(?:sankey-beta\b)/i,
1026
+ /^(?:sankey\b)/i,
1027
+ /^(?:$)/i,
1028
+ /^(?:((\u000D\u000A)|(\u000A)))/i,
1029
+ /^(?:(\u002C))/i,
1030
+ /^(?:(\u0022))/i,
1031
+ /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,
1032
+ /^(?:(\u0022)(?!(\u0022)))/i,
1033
+ /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i
1034
+ ],
1035
+ conditions: {
1036
+ "csv": {
1037
+ "rules": [
1038
+ 2,
1039
+ 3,
1040
+ 4,
1041
+ 5,
1042
+ 6,
1043
+ 7,
1044
+ 8
1045
+ ],
1046
+ "inclusive": false
1047
+ },
1048
+ "escaped_text": {
1049
+ "rules": [7, 8],
1050
+ "inclusive": false
1051
+ },
1052
+ "INITIAL": {
1053
+ "rules": [
1054
+ 0,
1055
+ 1,
1056
+ 2,
1057
+ 3,
1058
+ 4,
1059
+ 5,
1060
+ 6,
1061
+ 7,
1062
+ 8
1063
+ ],
1064
+ "inclusive": true
1065
+ }
1066
+ }
1067
+ };
1068
+ })();
1069
+ function Parser() {
1070
+ this.yy = {};
1071
+ }
1072
+ __name(Parser, "Parser");
1073
+ Parser.prototype = parser2;
1074
+ parser2.Parser = Parser;
1075
+ return new Parser();
1076
+ })();
1077
+ parser.parser = parser;
1078
+ var sankey_default = parser;
1079
+ var links = [];
1080
+ var nodes = [];
1081
+ var nodesMap = /* @__PURE__ */ new Map();
1082
+ var clear2 = /* @__PURE__ */ __name(() => {
1083
+ links = [];
1084
+ nodes = [];
1085
+ nodesMap = /* @__PURE__ */ new Map();
1086
+ clear();
1087
+ }, "clear");
1088
+ var SankeyLink = class {
1089
+ constructor(source, target, value = 0) {
1090
+ this.source = source;
1091
+ this.target = target;
1092
+ this.value = value;
1093
+ }
1094
+ static {
1095
+ __name(this, "SankeyLink");
1096
+ }
1097
+ };
1098
+ var addLink = /* @__PURE__ */ __name((source, target, value) => {
1099
+ links.push(new SankeyLink(source, target, value));
1100
+ }, "addLink");
1101
+ var SankeyNode = class {
1102
+ constructor(ID) {
1103
+ this.ID = ID;
1104
+ }
1105
+ static {
1106
+ __name(this, "SankeyNode");
1107
+ }
1108
+ };
1109
+ var sankeyDB_default = {
1110
+ nodesMap,
1111
+ getConfig: /* @__PURE__ */ __name(() => getConfig2().sankey, "getConfig"),
1112
+ getNodes: /* @__PURE__ */ __name(() => nodes, "getNodes"),
1113
+ getLinks: /* @__PURE__ */ __name(() => links, "getLinks"),
1114
+ getGraph: /* @__PURE__ */ __name(() => ({
1115
+ nodes: nodes.map((node) => ({ id: node.ID })),
1116
+ links: links.map((link) => ({
1117
+ source: link.source.ID,
1118
+ target: link.target.ID,
1119
+ value: link.value
1120
+ }))
1121
+ }), "getGraph"),
1122
+ addLink,
1123
+ findOrCreateNode: /* @__PURE__ */ __name((ID) => {
1124
+ ID = common_default.sanitizeText(ID, getConfig2());
1125
+ let node = nodesMap.get(ID);
1126
+ if (node === void 0) {
1127
+ node = new SankeyNode(ID);
1128
+ nodesMap.set(ID, node);
1129
+ nodes.push(node);
1130
+ }
1131
+ return node;
1132
+ }, "findOrCreateNode"),
1133
+ getAccTitle,
1134
+ setAccTitle,
1135
+ getAccDescription,
1136
+ setAccDescription,
1137
+ getDiagramTitle,
1138
+ setDiagramTitle,
1139
+ clear: clear2
1140
+ };
1141
+ var Uid = class _Uid {
1142
+ static {
1143
+ __name(this, "Uid");
1144
+ }
1145
+ static {
1146
+ this.count = 0;
1147
+ }
1148
+ static next(name) {
1149
+ return new _Uid(name + ++_Uid.count);
1150
+ }
1151
+ constructor(id) {
1152
+ this.id = id;
1153
+ this.href = `#${id}`;
1154
+ }
1155
+ toString() {
1156
+ return "url(" + this.href + ")";
1157
+ }
1158
+ };
1159
+ var alignmentsMap = {
1160
+ left,
1161
+ right,
1162
+ center,
1163
+ justify
1164
+ };
1165
+ var findCentralNodeLayer = /* @__PURE__ */ __name((nodes2) => {
1166
+ let maxValue = 0;
1167
+ let centralLayer = 0;
1168
+ for (const node of nodes2) {
1169
+ const value = node.value ?? 0;
1170
+ if (value > maxValue) {
1171
+ maxValue = value;
1172
+ centralLayer = node.layer ?? 0;
1173
+ }
1174
+ }
1175
+ return centralLayer;
1176
+ }, "findCentralNodeLayer");
1177
+ var sankeyRenderer_default = { draw: /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
1178
+ const { securityLevel, sankey: conf } = getConfig2();
1179
+ const defaultSankeyConfig = defaultConfig2.sankey;
1180
+ let sandboxElement;
1181
+ if (securityLevel === "sandbox") sandboxElement = select_default("#i" + id);
1182
+ const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
1183
+ const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select_default(`[id="${id}"]`);
1184
+ const width = conf?.width ?? defaultSankeyConfig.width;
1185
+ const height = conf?.height ?? defaultSankeyConfig.width;
1186
+ const useMaxWidth = conf?.useMaxWidth ?? defaultSankeyConfig.useMaxWidth;
1187
+ const nodeAlignment = conf?.nodeAlignment ?? defaultSankeyConfig.nodeAlignment;
1188
+ const prefix = conf?.prefix ?? defaultSankeyConfig.prefix;
1189
+ const suffix = conf?.suffix ?? defaultSankeyConfig.suffix;
1190
+ const showValues = conf?.showValues ?? defaultSankeyConfig.showValues;
1191
+ const nodeWidth = conf?.nodeWidth ?? defaultSankeyConfig.nodeWidth ?? 10;
1192
+ const nodePadding = conf?.nodePadding ?? defaultSankeyConfig.nodePadding ?? 12;
1193
+ const labelStyle = conf?.labelStyle ?? defaultSankeyConfig.labelStyle ?? "legacy";
1194
+ const nodeColors = conf?.nodeColors ?? {};
1195
+ const graph = diagObj.db.getGraph();
1196
+ const nodeAlign = alignmentsMap[nodeAlignment];
1197
+ Sankey().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(nodePadding + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([[0, 0], [width, height]])(graph);
1198
+ const centralNodeLayer = findCentralNodeLayer(graph.nodes);
1199
+ const colorScheme = ordinal(Tableau10_default);
1200
+ const getNodeColor = /* @__PURE__ */ __name((nodeId) => {
1201
+ return nodeColors[nodeId] ?? colorScheme(nodeId);
1202
+ }, "getNodeColor");
1203
+ svg.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d) => (d.uid = Uid.next("node-")).id).attr("transform", function(d) {
1204
+ return "translate(" + d.x0 + "," + d.y0 + ")";
1205
+ }).attr("x", (d) => d.x0).attr("y", (d) => d.y0).append("rect").attr("height", (d) => {
1206
+ return d.y1 - d.y0;
1207
+ }).attr("width", (d) => d.x1 - d.x0).attr("fill", (d) => getNodeColor(d.id));
1208
+ const getText = /* @__PURE__ */ __name(({ id: id2, value }) => {
1209
+ if (!showValues) return id2;
1210
+ return `${id2}
1211
+ ${prefix}${Math.round(value * 100) / 100}${suffix}`;
1212
+ }, "getText");
1213
+ const getLabelPosition = /* @__PURE__ */ __name((d) => {
1214
+ if (labelStyle === "outlined") {
1215
+ if ((d.layer ?? 0) < centralNodeLayer) return {
1216
+ x: d.x0 - 6,
1217
+ anchor: "end"
1218
+ };
1219
+ return {
1220
+ x: d.x1 + 6,
1221
+ anchor: "start"
1222
+ };
1223
+ }
1224
+ if (d.x0 < width / 2) return {
1225
+ x: d.x1 + 6,
1226
+ anchor: "start"
1227
+ };
1228
+ return {
1229
+ x: d.x0 - 6,
1230
+ anchor: "end"
1231
+ };
1232
+ }, "getLabelPosition");
1233
+ const labelsGroup = svg.append("g").attr("class", "node-labels").attr("font-size", 14);
1234
+ const appendLabel = /* @__PURE__ */ __name((className) => labelsGroup.selectAll(className ? `.${className}` : "text").data(graph.nodes).join("text").attr("class", className ?? null).attr("x", (d) => getLabelPosition(d).x).attr("y", (d) => (d.y1 + d.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d) => getLabelPosition(d).anchor).text(getText), "appendLabel");
1235
+ if (labelStyle === "outlined") {
1236
+ appendLabel("sankey-label-bg");
1237
+ appendLabel("sankey-label-fg");
1238
+ } else appendLabel();
1239
+ const link = svg.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", .5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply");
1240
+ const linkColor = conf?.linkColor ?? "gradient";
1241
+ if (linkColor === "gradient") {
1242
+ const gradient = link.append("linearGradient").attr("id", (d) => (d.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d) => d.source.x1).attr("x2", (d) => d.target.x0);
1243
+ gradient.append("stop").attr("offset", "0%").attr("stop-color", (d) => getNodeColor(d.source.id));
1244
+ gradient.append("stop").attr("offset", "100%").attr("stop-color", (d) => getNodeColor(d.target.id));
1245
+ }
1246
+ let coloring;
1247
+ switch (linkColor) {
1248
+ case "gradient":
1249
+ coloring = /* @__PURE__ */ __name((d) => d.uid, "coloring");
1250
+ break;
1251
+ case "source":
1252
+ coloring = /* @__PURE__ */ __name((d) => getNodeColor(d.source.id), "coloring");
1253
+ break;
1254
+ case "target":
1255
+ coloring = /* @__PURE__ */ __name((d) => getNodeColor(d.target.id), "coloring");
1256
+ break;
1257
+ default: coloring = linkColor;
1258
+ }
1259
+ link.append("path").attr("d", sankeyLinkHorizontal_default()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
1260
+ setupGraphViewbox(void 0, svg, 0, useMaxWidth);
1261
+ }, "draw") };
1262
+ var prepareTextForParsing = /* @__PURE__ */ __name((text) => {
1263
+ return text.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
1264
+ }, "prepareTextForParsing");
1265
+ var styles_default = /* @__PURE__ */ __name((options) => `.label {
1266
+ font-family: ${options.fontFamily};
1267
+ }
1268
+
1269
+ .node-labels {
1270
+ font-family: ${options.fontFamily};
1271
+ }
1272
+
1273
+ /* Outlined label style - background stroke for better readability */
1274
+ .sankey-label-bg {
1275
+ stroke: ${options.mainBkg || options.background || "#fff"};
1276
+ stroke-width: 4px;
1277
+ stroke-linejoin: round;
1278
+ paint-order: stroke;
1279
+ }
1280
+
1281
+ /* Foreground label text */
1282
+ .sankey-label-fg {
1283
+ fill: ${options.textColor};
1284
+ }
1285
+
1286
+ /* Node styling */
1287
+ .node rect {
1288
+ shape-rendering: crispEdges;
1289
+ }
1290
+
1291
+ /* Link styling */
1292
+ .link {
1293
+ fill: none;
1294
+ stroke-opacity: 0.5;
1295
+ mix-blend-mode: multiply;
1296
+ }
1297
+ `, "getStyles");
1298
+ var originalParse = sankey_default.parse.bind(sankey_default);
1299
+ sankey_default.parse = (text) => originalParse(prepareTextForParsing(text));
1300
+ var diagram = {
1301
+ styles: styles_default,
1302
+ parser: sankey_default,
1303
+ db: sankeyDB_default,
1304
+ renderer: sankeyRenderer_default
1305
+ };
1306
+
1307
+ //#endregion
1308
+ export { diagram };