@draftably/editor 0.0.0-stage → 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 (185) hide show
  1. package/README.md +26 -2
  2. package/dist/LICENSE +21 -0
  3. package/dist/assets/engine.worker-DmHew5f6.js +6813 -0
  4. package/dist/assets/import-d2.worker-CnXfFXoa.js +5395 -0
  5. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +87 -0
  6. package/dist/chunks/arc-rJj0TtXf.js +83 -0
  7. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +4781 -0
  8. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +1440 -0
  9. package/dist/chunks/browser-iNhbPsGc.js +40 -0
  10. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +1524 -0
  11. package/dist/chunks/channel-qMvPU6eH.js +5 -0
  12. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +670 -0
  13. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +18 -0
  14. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +262 -0
  15. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +68 -0
  16. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +19 -0
  17. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +8 -0
  18. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +19 -0
  19. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +8 -0
  20. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +451 -0
  21. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +1570 -0
  22. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +2608 -0
  23. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +22361 -0
  24. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +299 -0
  25. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +18791 -0
  26. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +2157 -0
  27. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  28. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +531 -0
  29. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +153 -0
  30. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +346 -0
  31. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +480 -0
  32. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +219 -0
  33. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +2586 -0
  34. package/dist/chunks/dot-importer-B23jwEkx.js +1547 -0
  35. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +109 -0
  36. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +49229 -0
  37. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +1064 -0
  38. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +1771 -0
  39. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +2729 -0
  40. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +815 -0
  41. package/dist/chunks/graph-CKJmgLki.js +1541 -0
  42. package/dist/chunks/import-core-C-I1wGfw.js +145 -0
  43. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +24 -0
  44. package/dist/chunks/init-DjUOC4st.js +16 -0
  45. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +624 -0
  46. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +834 -0
  47. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +724 -0
  48. package/dist/chunks/katex-BsrBVQKd.js +11314 -0
  49. package/dist/chunks/linear-4t7D_ros.js +259 -0
  50. package/dist/chunks/mermaid-facade-BoLWBerE.js +289 -0
  51. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +478 -0
  52. package/dist/chunks/mermaid.core-DXv6D2Sm.js +19244 -0
  53. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +837 -0
  54. package/dist/chunks/mount-C1Xk_GQz.js +22131 -0
  55. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  56. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +95 -0
  57. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +208 -0
  58. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +1029 -0
  59. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +77 -0
  60. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +889 -0
  61. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +859 -0
  62. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +2972 -0
  63. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +46 -0
  64. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +1520 -0
  65. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +4991 -0
  66. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +13 -0
  67. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +1058 -0
  68. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +7945 -0
  69. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +1578 -0
  70. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +678 -0
  71. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +1536 -0
  72. package/dist/element.js +36 -0
  73. package/dist/index.js +4 -0
  74. package/dist/types/src/cli/links.d.ts +4 -0
  75. package/dist/types/src/cli/pdf.d.ts +29 -0
  76. package/dist/types/src/cli/png.d.ts +23 -0
  77. package/dist/types/src/cli/svg.d.ts +4 -0
  78. package/dist/types/src/components/Icon.d.ts +14 -0
  79. package/dist/types/src/components/LayoutPreviewBar.d.ts +2 -0
  80. package/dist/types/src/components/canvas/Canvas.d.ts +15 -0
  81. package/dist/types/src/components/canvas/Frame.d.ts +22 -0
  82. package/dist/types/src/components/canvas/InlineEditor.d.ts +2 -0
  83. package/dist/types/src/components/canvas/Notes.d.ts +5 -0
  84. package/dist/types/src/components/canvas/Overlay.d.ts +2 -0
  85. package/dist/types/src/components/canvas/StateBar.d.ts +5 -0
  86. package/dist/types/src/components/canvas/TextHits.d.ts +6 -0
  87. package/dist/types/src/components/canvas/ZoomControls.d.ts +1 -0
  88. package/dist/types/src/components/canvas/text-boxes.d.ts +24 -0
  89. package/dist/types/src/components/controls.d.ts +88 -0
  90. package/dist/types/src/components/scene/EdgeView.d.ts +22 -0
  91. package/dist/types/src/components/scene/GroupView.d.ts +22 -0
  92. package/dist/types/src/components/scene/Lifelines.d.ts +15 -0
  93. package/dist/types/src/components/scene/LinkMark.d.ts +11 -0
  94. package/dist/types/src/components/scene/NodeView.d.ts +18 -0
  95. package/dist/types/src/components/scene/parts.d.ts +50 -0
  96. package/dist/types/src/components/sculpt/BrushDock.d.ts +2 -0
  97. package/dist/types/src/components/sculpt/TimelineDeck.d.ts +2 -0
  98. package/dist/types/src/components/session-context.d.ts +486 -0
  99. package/dist/types/src/dsl/cells.d.ts +91 -0
  100. package/dist/types/src/dsl/channels.d.ts +53 -0
  101. package/dist/types/src/dsl/compile.d.ts +162 -0
  102. package/dist/types/src/dsl/frame.d.ts +38 -0
  103. package/dist/types/src/dsl/lanes.d.ts +23 -0
  104. package/dist/types/src/dsl/layout-edits.d.ts +58 -0
  105. package/dist/types/src/dsl/legend-notes.d.ts +3 -0
  106. package/dist/types/src/dsl/project.d.ts +39 -0
  107. package/dist/types/src/dsl/source-edits.d.ts +37 -0
  108. package/dist/types/src/dsl/syntax.d.ts +317 -0
  109. package/dist/types/src/dsl/translate.d.ts +69 -0
  110. package/dist/types/src/editor/Editor.d.ts +6 -0
  111. package/dist/types/src/editor/element.d.ts +15 -0
  112. package/dist/types/src/editor/mount.d.ts +23 -0
  113. package/dist/types/src/import/browser.d.ts +3 -0
  114. package/dist/types/src/import/detect.d.ts +31 -0
  115. package/dist/types/src/import/dot-importer.d.ts +3 -0
  116. package/dist/types/src/import/import-core.d.ts +105 -0
  117. package/dist/types/src/import/mermaid-facade.d.ts +120 -0
  118. package/dist/types/src/import/mermaid-importer.d.ts +4 -0
  119. package/dist/types/src/import/mermaid-sequence.d.ts +8 -0
  120. package/dist/types/src/import/scratch.d.ts +3 -0
  121. package/dist/types/src/lib/engine-tasks.d.ts +88 -0
  122. package/dist/types/src/lib/font-data.d.ts +9 -0
  123. package/dist/types/src/lib/saved-diagram.d.ts +4 -0
  124. package/dist/types/src/lib/scene-cache.d.ts +4 -0
  125. package/dist/types/src/lib/source-hash.d.ts +7 -0
  126. package/dist/types/src/lib/svg-export.d.ts +15 -0
  127. package/dist/types/src/model/appearance.d.ts +209 -0
  128. package/dist/types/src/model/bounds.d.ts +19 -0
  129. package/dist/types/src/model/camera.d.ts +21 -0
  130. package/dist/types/src/model/candidates.d.ts +53 -0
  131. package/dist/types/src/model/colors.d.ts +22 -0
  132. package/dist/types/src/model/document.d.ts +24 -0
  133. package/dist/types/src/model/edits.d.ts +133 -0
  134. package/dist/types/src/model/embed.d.ts +17 -0
  135. package/dist/types/src/model/examples.d.ts +15 -0
  136. package/dist/types/src/model/font-faces.d.ts +24 -0
  137. package/dist/types/src/model/fonts.d.ts +47 -0
  138. package/dist/types/src/model/footnote.d.ts +34 -0
  139. package/dist/types/src/model/frame.d.ts +71 -0
  140. package/dist/types/src/model/geometry.d.ts +29 -0
  141. package/dist/types/src/model/graph.d.ts +53 -0
  142. package/dist/types/src/model/heading.d.ts +38 -0
  143. package/dist/types/src/model/icons.d.ts +2 -0
  144. package/dist/types/src/model/label-hits.d.ts +27 -0
  145. package/dist/types/src/model/labels.d.ts +88 -0
  146. package/dist/types/src/model/legend.d.ts +25 -0
  147. package/dist/types/src/model/link.d.ts +63 -0
  148. package/dist/types/src/model/markers.d.ts +47 -0
  149. package/dist/types/src/model/note.d.ts +75 -0
  150. package/dist/types/src/model/panels.d.ts +11 -0
  151. package/dist/types/src/model/rich-text.d.ts +24 -0
  152. package/dist/types/src/model/routes.d.ts +170 -0
  153. package/dist/types/src/model/samples.d.ts +11 -0
  154. package/dist/types/src/model/stack.d.ts +8 -0
  155. package/dist/types/src/model/static-scene.d.ts +15 -0
  156. package/dist/types/src/model/status.d.ts +84 -0
  157. package/dist/types/src/model/styles.d.ts +13 -0
  158. package/dist/types/src/model/surface.d.ts +31 -0
  159. package/dist/types/src/model/types.d.ts +277 -0
  160. package/dist/types/src/runtime/svg-renderer.d.ts +38 -0
  161. package/dist/types/src/server/file-session.d.ts +19 -0
  162. package/dist/types/src/server/workspace.d.ts +21 -0
  163. package/dist/types/src/state/active-session.d.ts +479 -0
  164. package/dist/types/src/state/commands.d.ts +529 -0
  165. package/dist/types/src/state/comparison.d.ts +151 -0
  166. package/dist/types/src/state/files.d.ts +61 -0
  167. package/dist/types/src/state/keyboard.d.ts +6 -0
  168. package/dist/types/src/state/keys.d.ts +5 -0
  169. package/dist/types/src/state/launch.d.ts +61 -0
  170. package/dist/types/src/state/links.d.ts +11 -0
  171. package/dist/types/src/state/session/actions.d.ts +77 -0
  172. package/dist/types/src/state/session/canvas-text.d.ts +24 -0
  173. package/dist/types/src/state/session/document.d.ts +84 -0
  174. package/dist/types/src/state/session/editor.d.ts +81 -0
  175. package/dist/types/src/state/session/emphasis.d.ts +11 -0
  176. package/dist/types/src/state/session/file-session.d.ts +98 -0
  177. package/dist/types/src/state/session/index.d.ts +496 -0
  178. package/dist/types/src/state/session/layout.d.ts +79 -0
  179. package/dist/types/src/state/session/pointer.d.ts +19 -0
  180. package/dist/types/src/state/session/routing.d.ts +20 -0
  181. package/dist/types/src/state/session/scene.d.ts +144 -0
  182. package/dist/types/src/state/session/sculpt.d.ts +70 -0
  183. package/dist/types/src/state/toast.d.ts +14 -0
  184. package/dist/types/src/state/ui.d.ts +39 -0
  185. package/package.json +41 -3
@@ -0,0 +1,859 @@
1
+ import { q as kt, t as mt, s as xt, g as _t, b as vt, a as bt, _ as y, c as ot, B as St, k as G, a4 as wt, A as Lt, m as Et } from "./mermaid.core-DXv6D2Sm.js";
2
+ import { o as At } from "./ordinal-DfAQgscy.js";
3
+ function Tt(t) {
4
+ for (var i = t.length / 6 | 0, s = new Array(i), l = 0; l < i; ) s[l] = "#" + t.slice(l * 6, ++l * 6);
5
+ return s;
6
+ }
7
+ const Mt = Tt("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
8
+ function at(t, i) {
9
+ let s;
10
+ if (i === void 0)
11
+ for (const l of t)
12
+ l != null && (s < l || s === void 0 && l >= l) && (s = l);
13
+ else {
14
+ let l = -1;
15
+ for (let u of t)
16
+ (u = i(u, ++l, t)) != null && (s < u || s === void 0 && u >= u) && (s = u);
17
+ }
18
+ return s;
19
+ }
20
+ function dt(t, i) {
21
+ let s;
22
+ if (i === void 0)
23
+ for (const l of t)
24
+ l != null && (s > l || s === void 0 && l >= l) && (s = l);
25
+ else {
26
+ let l = -1;
27
+ for (let u of t)
28
+ (u = i(u, ++l, t)) != null && (s > u || s === void 0 && u >= u) && (s = u);
29
+ }
30
+ return s;
31
+ }
32
+ function J(t, i) {
33
+ let s = 0;
34
+ if (i === void 0)
35
+ for (let l of t)
36
+ (l = +l) && (s += l);
37
+ else {
38
+ let l = -1;
39
+ for (let u of t)
40
+ (u = +i(u, ++l, t)) && (s += u);
41
+ }
42
+ return s;
43
+ }
44
+ function Nt(t) {
45
+ return t.target.depth;
46
+ }
47
+ function Ct(t) {
48
+ return t.depth;
49
+ }
50
+ function Pt(t, i) {
51
+ return i - 1 - t.height;
52
+ }
53
+ function gt(t, i) {
54
+ return t.sourceLinks.length ? t.depth : i - 1;
55
+ }
56
+ function It(t) {
57
+ return t.targetLinks.length ? t.depth : t.sourceLinks.length ? dt(t.sourceLinks, Nt) - 1 : 0;
58
+ }
59
+ function Y(t) {
60
+ return function() {
61
+ return t;
62
+ };
63
+ }
64
+ function lt(t, i) {
65
+ return q(t.source, i.source) || t.index - i.index;
66
+ }
67
+ function ct(t, i) {
68
+ return q(t.target, i.target) || t.index - i.index;
69
+ }
70
+ function q(t, i) {
71
+ return t.y0 - i.y0;
72
+ }
73
+ function tt(t) {
74
+ return t.value;
75
+ }
76
+ function Ot(t) {
77
+ return t.index;
78
+ }
79
+ function $t(t) {
80
+ return t.nodes;
81
+ }
82
+ function Dt(t) {
83
+ return t.links;
84
+ }
85
+ function ut(t, i) {
86
+ const s = t.get(i);
87
+ if (!s) throw new Error("missing: " + i);
88
+ return s;
89
+ }
90
+ function ht({ nodes: t }) {
91
+ for (const i of t) {
92
+ let s = i.y0, l = s;
93
+ for (const u of i.sourceLinks)
94
+ u.y0 = s + u.width / 2, s += u.width;
95
+ for (const u of i.targetLinks)
96
+ u.y1 = l + u.width / 2, l += u.width;
97
+ }
98
+ }
99
+ function jt() {
100
+ let t = 0, i = 0, s = 1, l = 1, u = 24, x = 8, g, k = Ot, o = gt, a, h, m = $t, _ = Dt, d = 6;
101
+ function v() {
102
+ const n = { nodes: m.apply(null, arguments), links: _.apply(null, arguments) };
103
+ return T(n), A(n), M(n), I(n), S(n), ht(n), n;
104
+ }
105
+ v.update = function(n) {
106
+ return ht(n), n;
107
+ }, v.nodeId = function(n) {
108
+ return arguments.length ? (k = typeof n == "function" ? n : Y(n), v) : k;
109
+ }, v.nodeAlign = function(n) {
110
+ return arguments.length ? (o = typeof n == "function" ? n : Y(n), v) : o;
111
+ }, v.nodeSort = function(n) {
112
+ return arguments.length ? (a = n, v) : a;
113
+ }, v.nodeWidth = function(n) {
114
+ return arguments.length ? (u = +n, v) : u;
115
+ }, v.nodePadding = function(n) {
116
+ return arguments.length ? (x = g = +n, v) : x;
117
+ }, v.nodes = function(n) {
118
+ return arguments.length ? (m = typeof n == "function" ? n : Y(n), v) : m;
119
+ }, v.links = function(n) {
120
+ return arguments.length ? (_ = typeof n == "function" ? n : Y(n), v) : _;
121
+ }, v.linkSort = function(n) {
122
+ return arguments.length ? (h = n, v) : h;
123
+ }, v.size = function(n) {
124
+ return arguments.length ? (t = i = 0, s = +n[0], l = +n[1], v) : [s - t, l - i];
125
+ }, v.extent = function(n) {
126
+ return arguments.length ? (t = +n[0][0], s = +n[1][0], i = +n[0][1], l = +n[1][1], v) : [[t, i], [s, l]];
127
+ }, v.iterations = function(n) {
128
+ return arguments.length ? (d = +n, v) : d;
129
+ };
130
+ function T({ nodes: n, links: f }) {
131
+ for (const [e, r] of n.entries())
132
+ r.index = e, r.sourceLinks = [], r.targetLinks = [];
133
+ const c = new Map(n.map((e, r) => [k(e, r, n), e]));
134
+ for (const [e, r] of f.entries()) {
135
+ r.index = e;
136
+ let { source: p, target: b } = r;
137
+ typeof p != "object" && (p = r.source = ut(c, p)), typeof b != "object" && (b = r.target = ut(c, b)), p.sourceLinks.push(r), b.targetLinks.push(r);
138
+ }
139
+ if (h != null)
140
+ for (const { sourceLinks: e, targetLinks: r } of n)
141
+ e.sort(h), r.sort(h);
142
+ }
143
+ function A({ nodes: n }) {
144
+ for (const f of n)
145
+ f.value = f.fixedValue === void 0 ? Math.max(J(f.sourceLinks, tt), J(f.targetLinks, tt)) : f.fixedValue;
146
+ }
147
+ function M({ nodes: n }) {
148
+ const f = n.length;
149
+ let c = new Set(n), e = /* @__PURE__ */ new Set(), r = 0;
150
+ for (; c.size; ) {
151
+ for (const p of c) {
152
+ p.depth = r;
153
+ for (const { target: b } of p.sourceLinks)
154
+ e.add(b);
155
+ }
156
+ if (++r > f) throw new Error("circular link");
157
+ c = e, e = /* @__PURE__ */ new Set();
158
+ }
159
+ }
160
+ function I({ nodes: n }) {
161
+ const f = n.length;
162
+ let c = new Set(n), e = /* @__PURE__ */ new Set(), r = 0;
163
+ for (; c.size; ) {
164
+ for (const p of c) {
165
+ p.height = r;
166
+ for (const { source: b } of p.targetLinks)
167
+ e.add(b);
168
+ }
169
+ if (++r > f) throw new Error("circular link");
170
+ c = e, e = /* @__PURE__ */ new Set();
171
+ }
172
+ }
173
+ function N({ nodes: n }) {
174
+ const f = at(n, (r) => r.depth) + 1, c = (s - t - u) / (f - 1), e = new Array(f);
175
+ for (const r of n) {
176
+ const p = Math.max(0, Math.min(f - 1, Math.floor(o.call(null, r, f))));
177
+ r.layer = p, r.x0 = t + p * c, r.x1 = r.x0 + u, e[p] ? e[p].push(r) : e[p] = [r];
178
+ }
179
+ if (a) for (const r of e)
180
+ r.sort(a);
181
+ return e;
182
+ }
183
+ function $(n) {
184
+ const f = dt(n, (c) => (l - i - (c.length - 1) * g) / J(c, tt));
185
+ for (const c of n) {
186
+ let e = i;
187
+ for (const r of c) {
188
+ r.y0 = e, r.y1 = e + r.value * f, e = r.y1 + g;
189
+ for (const p of r.sourceLinks)
190
+ p.width = p.value * f;
191
+ }
192
+ e = (l - e + g) / (c.length + 1);
193
+ for (let r = 0; r < c.length; ++r) {
194
+ const p = c[r];
195
+ p.y0 += e * (r + 1), p.y1 += e * (r + 1);
196
+ }
197
+ w(c);
198
+ }
199
+ }
200
+ function S(n) {
201
+ const f = N(n);
202
+ g = Math.min(x, (l - i) / (at(f, (c) => c.length) - 1)), $(f);
203
+ for (let c = 0; c < d; ++c) {
204
+ const e = Math.pow(0.99, c), r = Math.max(1 - e, (c + 1) / d);
205
+ F(f, e, r), C(f, e, r);
206
+ }
207
+ }
208
+ function C(n, f, c) {
209
+ for (let e = 1, r = n.length; e < r; ++e) {
210
+ const p = n[e];
211
+ for (const b of p) {
212
+ let L = 0, z = 0;
213
+ for (const { source: W, value: Z } of b.targetLinks) {
214
+ let U = Z * (b.layer - W.layer);
215
+ L += P(W, b) * U, z += U;
216
+ }
217
+ if (!(z > 0)) continue;
218
+ let V = (L / z - b.y0) * f;
219
+ b.y0 += V, b.y1 += V, j(b);
220
+ }
221
+ a === void 0 && p.sort(q), D(p, c);
222
+ }
223
+ }
224
+ function F(n, f, c) {
225
+ for (let e = n.length, r = e - 2; r >= 0; --r) {
226
+ const p = n[r];
227
+ for (const b of p) {
228
+ let L = 0, z = 0;
229
+ for (const { target: W, value: Z } of b.sourceLinks) {
230
+ let U = Z * (W.layer - b.layer);
231
+ L += E(b, W) * U, z += U;
232
+ }
233
+ if (!(z > 0)) continue;
234
+ let V = (L / z - b.y0) * f;
235
+ b.y0 += V, b.y1 += V, j(b);
236
+ }
237
+ a === void 0 && p.sort(q), D(p, c);
238
+ }
239
+ }
240
+ function D(n, f) {
241
+ const c = n.length >> 1, e = n[c];
242
+ O(n, e.y0 - g, c - 1, f), R(n, e.y1 + g, c + 1, f), O(n, l, n.length - 1, f), R(n, i, 0, f);
243
+ }
244
+ function R(n, f, c, e) {
245
+ for (; c < n.length; ++c) {
246
+ const r = n[c], p = (f - r.y0) * e;
247
+ p > 1e-6 && (r.y0 += p, r.y1 += p), f = r.y1 + g;
248
+ }
249
+ }
250
+ function O(n, f, c, e) {
251
+ for (; c >= 0; --c) {
252
+ const r = n[c], p = (r.y1 - f) * e;
253
+ p > 1e-6 && (r.y0 -= p, r.y1 -= p), f = r.y0 - g;
254
+ }
255
+ }
256
+ function j({ sourceLinks: n, targetLinks: f }) {
257
+ if (h === void 0) {
258
+ for (const { source: { sourceLinks: c } } of f)
259
+ c.sort(ct);
260
+ for (const { target: { targetLinks: c } } of n)
261
+ c.sort(lt);
262
+ }
263
+ }
264
+ function w(n) {
265
+ if (h === void 0)
266
+ for (const { sourceLinks: f, targetLinks: c } of n)
267
+ f.sort(ct), c.sort(lt);
268
+ }
269
+ function P(n, f) {
270
+ let c = n.y0 - (n.sourceLinks.length - 1) * g / 2;
271
+ for (const { target: e, width: r } of n.sourceLinks) {
272
+ if (e === f) break;
273
+ c += r + g;
274
+ }
275
+ for (const { source: e, width: r } of f.targetLinks) {
276
+ if (e === n) break;
277
+ c -= r;
278
+ }
279
+ return c;
280
+ }
281
+ function E(n, f) {
282
+ let c = f.y0 - (f.targetLinks.length - 1) * g / 2;
283
+ for (const { source: e, width: r } of f.targetLinks) {
284
+ if (e === n) break;
285
+ c += r + g;
286
+ }
287
+ for (const { target: e, width: r } of n.sourceLinks) {
288
+ if (e === f) break;
289
+ c -= r;
290
+ }
291
+ return c;
292
+ }
293
+ return v;
294
+ }
295
+ var et = Math.PI, nt = 2 * et, B = 1e-6, zt = nt - B;
296
+ function it() {
297
+ this._x0 = this._y0 = // start of current subpath
298
+ this._x1 = this._y1 = null, this._ = "";
299
+ }
300
+ function pt() {
301
+ return new it();
302
+ }
303
+ it.prototype = pt.prototype = {
304
+ constructor: it,
305
+ moveTo: function(t, i) {
306
+ this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +i);
307
+ },
308
+ closePath: function() {
309
+ this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
310
+ },
311
+ lineTo: function(t, i) {
312
+ this._ += "L" + (this._x1 = +t) + "," + (this._y1 = +i);
313
+ },
314
+ quadraticCurveTo: function(t, i, s, l) {
315
+ this._ += "Q" + +t + "," + +i + "," + (this._x1 = +s) + "," + (this._y1 = +l);
316
+ },
317
+ bezierCurveTo: function(t, i, s, l, u, x) {
318
+ this._ += "C" + +t + "," + +i + "," + +s + "," + +l + "," + (this._x1 = +u) + "," + (this._y1 = +x);
319
+ },
320
+ arcTo: function(t, i, s, l, u) {
321
+ t = +t, i = +i, s = +s, l = +l, u = +u;
322
+ var x = this._x1, g = this._y1, k = s - t, o = l - i, a = x - t, h = g - i, m = a * a + h * h;
323
+ if (u < 0) throw new Error("negative radius: " + u);
324
+ if (this._x1 === null)
325
+ this._ += "M" + (this._x1 = t) + "," + (this._y1 = i);
326
+ else if (m > B) if (!(Math.abs(h * k - o * a) > B) || !u)
327
+ this._ += "L" + (this._x1 = t) + "," + (this._y1 = i);
328
+ else {
329
+ var _ = s - x, d = l - g, v = k * k + o * o, T = _ * _ + d * d, A = Math.sqrt(v), M = Math.sqrt(m), I = u * Math.tan((et - Math.acos((v + m - T) / (2 * A * M))) / 2), N = I / M, $ = I / A;
330
+ Math.abs(N - 1) > B && (this._ += "L" + (t + N * a) + "," + (i + N * h)), this._ += "A" + u + "," + u + ",0,0," + +(h * _ > a * d) + "," + (this._x1 = t + $ * k) + "," + (this._y1 = i + $ * o);
331
+ }
332
+ },
333
+ arc: function(t, i, s, l, u, x) {
334
+ t = +t, i = +i, s = +s, x = !!x;
335
+ var g = s * Math.cos(l), k = s * Math.sin(l), o = t + g, a = i + k, h = 1 ^ x, m = x ? l - u : u - l;
336
+ if (s < 0) throw new Error("negative radius: " + s);
337
+ this._x1 === null ? this._ += "M" + o + "," + a : (Math.abs(this._x1 - o) > B || Math.abs(this._y1 - a) > B) && (this._ += "L" + o + "," + a), s && (m < 0 && (m = m % nt + nt), m > zt ? this._ += "A" + s + "," + s + ",0,1," + h + "," + (t - g) + "," + (i - k) + "A" + s + "," + s + ",0,1," + h + "," + (this._x1 = o) + "," + (this._y1 = a) : m > B && (this._ += "A" + s + "," + s + ",0," + +(m >= et) + "," + h + "," + (this._x1 = t + s * Math.cos(u)) + "," + (this._y1 = i + s * Math.sin(u))));
338
+ },
339
+ rect: function(t, i, s, l) {
340
+ this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +i) + "h" + +s + "v" + +l + "h" + -s + "Z";
341
+ },
342
+ toString: function() {
343
+ return this._;
344
+ }
345
+ };
346
+ function ft(t) {
347
+ return function() {
348
+ return t;
349
+ };
350
+ }
351
+ function Bt(t) {
352
+ return t[0];
353
+ }
354
+ function Ft(t) {
355
+ return t[1];
356
+ }
357
+ var Rt = Array.prototype.slice;
358
+ function Vt(t) {
359
+ return t.source;
360
+ }
361
+ function Wt(t) {
362
+ return t.target;
363
+ }
364
+ function Ut(t) {
365
+ var i = Vt, s = Wt, l = Bt, u = Ft, x = null;
366
+ function g() {
367
+ var k, o = Rt.call(arguments), a = i.apply(this, o), h = s.apply(this, o);
368
+ if (x || (x = k = pt()), t(x, +l.apply(this, (o[0] = a, o)), +u.apply(this, o), +l.apply(this, (o[0] = h, o)), +u.apply(this, o)), k) return x = null, k + "" || null;
369
+ }
370
+ return g.source = function(k) {
371
+ return arguments.length ? (i = k, g) : i;
372
+ }, g.target = function(k) {
373
+ return arguments.length ? (s = k, g) : s;
374
+ }, g.x = function(k) {
375
+ return arguments.length ? (l = typeof k == "function" ? k : ft(+k), g) : l;
376
+ }, g.y = function(k) {
377
+ return arguments.length ? (u = typeof k == "function" ? k : ft(+k), g) : u;
378
+ }, g.context = function(k) {
379
+ return arguments.length ? (x = k ?? null, g) : x;
380
+ }, g;
381
+ }
382
+ function Gt(t, i, s, l, u) {
383
+ t.moveTo(i, s), t.bezierCurveTo(i = (i + l) / 2, s, i, u, l, u);
384
+ }
385
+ function Yt() {
386
+ return Ut(Gt);
387
+ }
388
+ function qt(t) {
389
+ return [t.source.x1, t.y0];
390
+ }
391
+ function Ht(t) {
392
+ return [t.target.x0, t.y1];
393
+ }
394
+ function Xt() {
395
+ return Yt().source(qt).target(Ht);
396
+ }
397
+ var rt = (function() {
398
+ var t = /* @__PURE__ */ y(function(k, o, a, h) {
399
+ for (a = a || {}, h = k.length; h--; a[k[h]] = o) ;
400
+ return a;
401
+ }, "o"), i = [1, 9], s = [1, 10], l = [1, 5, 10, 12], u = {
402
+ trace: /* @__PURE__ */ y(function() {
403
+ }, "trace"),
404
+ yy: {},
405
+ symbols_: { error: 2, start: 3, SANKEY: 4, NEWLINE: 5, csv: 6, opt_eof: 7, record: 8, csv_tail: 9, EOF: 10, "field[source]": 11, COMMA: 12, "field[target]": 13, "field[value]": 14, field: 15, escaped: 16, non_escaped: 17, DQUOTE: 18, ESCAPED_TEXT: 19, NON_ESCAPED_TEXT: 20, $accept: 0, $end: 1 },
406
+ terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
407
+ productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
408
+ performAction: /* @__PURE__ */ y(function(o, a, h, m, _, d, v) {
409
+ var T = d.length - 1;
410
+ switch (_) {
411
+ case 7:
412
+ const A = m.findOrCreateNode(d[T - 4].trim().replaceAll('""', '"')), M = m.findOrCreateNode(d[T - 2].trim().replaceAll('""', '"')), I = parseFloat(d[T].trim());
413
+ m.addLink(A, M, I);
414
+ break;
415
+ case 8:
416
+ case 9:
417
+ case 11:
418
+ this.$ = d[T];
419
+ break;
420
+ case 10:
421
+ this.$ = d[T - 1];
422
+ break;
423
+ }
424
+ }, "anonymous"),
425
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: i, 20: s }, { 1: [2, 6], 7: 11, 10: [1, 12] }, t(s, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, t(l, [2, 8]), t(l, [2, 9]), { 19: [1, 16] }, t(l, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, t(s, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: i, 20: s }, { 15: 18, 16: 7, 17: 8, 18: i, 20: s }, { 18: [1, 19] }, t(s, [2, 3]), { 12: [1, 20] }, t(l, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: i, 20: s }, t([1, 5, 10], [2, 7])],
426
+ defaultActions: { 11: [2, 1], 12: [2, 5] },
427
+ parseError: /* @__PURE__ */ y(function(o, a) {
428
+ if (a.recoverable)
429
+ this.trace(o);
430
+ else {
431
+ var h = new Error(o);
432
+ throw h.hash = a, h;
433
+ }
434
+ }, "parseError"),
435
+ parse: /* @__PURE__ */ y(function(o) {
436
+ var a = this, h = [0], m = [], _ = [null], d = [], v = this.table, T = "", A = 0, M = 0, I = 2, N = 1, $ = d.slice.call(arguments, 1), S = Object.create(this.lexer), C = { yy: {} };
437
+ for (var F in this.yy)
438
+ Object.prototype.hasOwnProperty.call(this.yy, F) && (C.yy[F] = this.yy[F]);
439
+ S.setInput(o, C.yy), C.yy.lexer = S, C.yy.parser = this, typeof S.yylloc > "u" && (S.yylloc = {});
440
+ var D = S.yylloc;
441
+ d.push(D);
442
+ var R = S.options && S.options.ranges;
443
+ typeof C.yy.parseError == "function" ? this.parseError = C.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
444
+ function O(L) {
445
+ h.length = h.length - 2 * L, _.length = _.length - L, d.length = d.length - L;
446
+ }
447
+ y(O, "popStack");
448
+ function j() {
449
+ var L;
450
+ return L = m.pop() || S.lex() || N, typeof L != "number" && (L instanceof Array && (m = L, L = m.pop()), L = a.symbols_[L] || L), L;
451
+ }
452
+ y(j, "lex");
453
+ for (var w, P, E, n, f = {}, c, e, r, p; ; ) {
454
+ if (P = h[h.length - 1], this.defaultActions[P] ? E = this.defaultActions[P] : ((w === null || typeof w > "u") && (w = j()), E = v[P] && v[P][w]), typeof E > "u" || !E.length || !E[0]) {
455
+ var b = "";
456
+ p = [];
457
+ for (c in v[P])
458
+ this.terminals_[c] && c > I && p.push("'" + this.terminals_[c] + "'");
459
+ S.showPosition ? b = "Parse error on line " + (A + 1) + `:
460
+ ` + S.showPosition() + `
461
+ Expecting ` + p.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : b = "Parse error on line " + (A + 1) + ": Unexpected " + (w == N ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(b, {
462
+ text: S.match,
463
+ token: this.terminals_[w] || w,
464
+ line: S.yylineno,
465
+ loc: D,
466
+ expected: p
467
+ });
468
+ }
469
+ if (E[0] instanceof Array && E.length > 1)
470
+ throw new Error("Parse Error: multiple actions possible at state: " + P + ", token: " + w);
471
+ switch (E[0]) {
472
+ case 1:
473
+ h.push(w), _.push(S.yytext), d.push(S.yylloc), h.push(E[1]), w = null, M = S.yyleng, T = S.yytext, A = S.yylineno, D = S.yylloc;
474
+ break;
475
+ case 2:
476
+ if (e = this.productions_[E[1]][1], f.$ = _[_.length - e], f._$ = {
477
+ first_line: d[d.length - (e || 1)].first_line,
478
+ last_line: d[d.length - 1].last_line,
479
+ first_column: d[d.length - (e || 1)].first_column,
480
+ last_column: d[d.length - 1].last_column
481
+ }, R && (f._$.range = [
482
+ d[d.length - (e || 1)].range[0],
483
+ d[d.length - 1].range[1]
484
+ ]), n = this.performAction.apply(f, [
485
+ T,
486
+ M,
487
+ A,
488
+ C.yy,
489
+ E[1],
490
+ _,
491
+ d
492
+ ].concat($)), typeof n < "u")
493
+ return n;
494
+ e && (h = h.slice(0, -1 * e * 2), _ = _.slice(0, -1 * e), d = d.slice(0, -1 * e)), h.push(this.productions_[E[1]][0]), _.push(f.$), d.push(f._$), r = v[h[h.length - 2]][h[h.length - 1]], h.push(r);
495
+ break;
496
+ case 3:
497
+ return !0;
498
+ }
499
+ }
500
+ return !0;
501
+ }, "parse")
502
+ }, x = /* @__PURE__ */ (function() {
503
+ var k = {
504
+ EOF: 1,
505
+ parseError: /* @__PURE__ */ y(function(a, h) {
506
+ if (this.yy.parser)
507
+ this.yy.parser.parseError(a, h);
508
+ else
509
+ throw new Error(a);
510
+ }, "parseError"),
511
+ // resets the lexer, sets new input
512
+ setInput: /* @__PURE__ */ y(function(o, a) {
513
+ return this.yy = a || this.yy || {}, this._input = o, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
514
+ first_line: 1,
515
+ first_column: 0,
516
+ last_line: 1,
517
+ last_column: 0
518
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
519
+ }, "setInput"),
520
+ // consumes and returns one char from the input
521
+ input: /* @__PURE__ */ y(function() {
522
+ var o = this._input[0];
523
+ this.yytext += o, this.yyleng++, this.offset++, this.match += o, this.matched += o;
524
+ var a = o.match(/(?:\r\n?|\n).*/g);
525
+ return a ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), o;
526
+ }, "input"),
527
+ // unshifts one char (or a string) into the input
528
+ unput: /* @__PURE__ */ y(function(o) {
529
+ var a = o.length, h = o.split(/(?:\r\n?|\n)/g);
530
+ this._input = o + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - a), this.offset -= a;
531
+ var m = this.match.split(/(?:\r\n?|\n)/g);
532
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), h.length - 1 && (this.yylineno -= h.length - 1);
533
+ var _ = this.yylloc.range;
534
+ return this.yylloc = {
535
+ first_line: this.yylloc.first_line,
536
+ last_line: this.yylineno + 1,
537
+ first_column: this.yylloc.first_column,
538
+ last_column: h ? (h.length === m.length ? this.yylloc.first_column : 0) + m[m.length - h.length].length - h[0].length : this.yylloc.first_column - a
539
+ }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - a]), this.yyleng = this.yytext.length, this;
540
+ }, "unput"),
541
+ // When called from action, caches matched text and appends it on next action
542
+ more: /* @__PURE__ */ y(function() {
543
+ return this._more = !0, this;
544
+ }, "more"),
545
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
546
+ reject: /* @__PURE__ */ y(function() {
547
+ if (this.options.backtrack_lexer)
548
+ this._backtrack = !0;
549
+ else
550
+ 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).
551
+ ` + this.showPosition(), {
552
+ text: "",
553
+ token: null,
554
+ line: this.yylineno
555
+ });
556
+ return this;
557
+ }, "reject"),
558
+ // retain first n characters of the match
559
+ less: /* @__PURE__ */ y(function(o) {
560
+ this.unput(this.match.slice(o));
561
+ }, "less"),
562
+ // displays already matched input, i.e. for error messages
563
+ pastInput: /* @__PURE__ */ y(function() {
564
+ var o = this.matched.substr(0, this.matched.length - this.match.length);
565
+ return (o.length > 20 ? "..." : "") + o.substr(-20).replace(/\n/g, "");
566
+ }, "pastInput"),
567
+ // displays upcoming input, i.e. for error messages
568
+ upcomingInput: /* @__PURE__ */ y(function() {
569
+ var o = this.match;
570
+ return o.length < 20 && (o += this._input.substr(0, 20 - o.length)), (o.substr(0, 20) + (o.length > 20 ? "..." : "")).replace(/\n/g, "");
571
+ }, "upcomingInput"),
572
+ // displays the character position where the lexing error occurred, i.e. for error messages
573
+ showPosition: /* @__PURE__ */ y(function() {
574
+ var o = this.pastInput(), a = new Array(o.length + 1).join("-");
575
+ return o + this.upcomingInput() + `
576
+ ` + a + "^";
577
+ }, "showPosition"),
578
+ // test the lexed token: return FALSE when not a match, otherwise return token
579
+ test_match: /* @__PURE__ */ y(function(o, a) {
580
+ var h, m, _;
581
+ if (this.options.backtrack_lexer && (_ = {
582
+ yylineno: this.yylineno,
583
+ yylloc: {
584
+ first_line: this.yylloc.first_line,
585
+ last_line: this.last_line,
586
+ first_column: this.yylloc.first_column,
587
+ last_column: this.yylloc.last_column
588
+ },
589
+ yytext: this.yytext,
590
+ match: this.match,
591
+ matches: this.matches,
592
+ matched: this.matched,
593
+ yyleng: this.yyleng,
594
+ offset: this.offset,
595
+ _more: this._more,
596
+ _input: this._input,
597
+ yy: this.yy,
598
+ conditionStack: this.conditionStack.slice(0),
599
+ done: this.done
600
+ }, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), m = o[0].match(/(?:\r\n?|\n).*/g), m && (this.yylineno += m.length), this.yylloc = {
601
+ first_line: this.yylloc.last_line,
602
+ last_line: this.yylineno + 1,
603
+ first_column: this.yylloc.last_column,
604
+ last_column: m ? m[m.length - 1].length - m[m.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + o[0].length
605
+ }, this.yytext += o[0], this.match += o[0], this.matches = o, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(o[0].length), this.matched += o[0], h = this.performAction.call(this, this.yy, this, a, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), h)
606
+ return h;
607
+ if (this._backtrack) {
608
+ for (var d in _)
609
+ this[d] = _[d];
610
+ return !1;
611
+ }
612
+ return !1;
613
+ }, "test_match"),
614
+ // return next match in input
615
+ next: /* @__PURE__ */ y(function() {
616
+ if (this.done)
617
+ return this.EOF;
618
+ this._input || (this.done = !0);
619
+ var o, a, h, m;
620
+ this._more || (this.yytext = "", this.match = "");
621
+ for (var _ = this._currentRules(), d = 0; d < _.length; d++)
622
+ if (h = this._input.match(this.rules[_[d]]), h && (!a || h[0].length > a[0].length)) {
623
+ if (a = h, m = d, this.options.backtrack_lexer) {
624
+ if (o = this.test_match(h, _[d]), o !== !1)
625
+ return o;
626
+ if (this._backtrack) {
627
+ a = !1;
628
+ continue;
629
+ } else
630
+ return !1;
631
+ } else if (!this.options.flex)
632
+ break;
633
+ }
634
+ return a ? (o = this.test_match(a, _[m]), o !== !1 ? o : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
635
+ ` + this.showPosition(), {
636
+ text: "",
637
+ token: null,
638
+ line: this.yylineno
639
+ });
640
+ }, "next"),
641
+ // return next match that has a token
642
+ lex: /* @__PURE__ */ y(function() {
643
+ var a = this.next();
644
+ return a || this.lex();
645
+ }, "lex"),
646
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
647
+ begin: /* @__PURE__ */ y(function(a) {
648
+ this.conditionStack.push(a);
649
+ }, "begin"),
650
+ // pop the previously active lexer condition state off the condition stack
651
+ popState: /* @__PURE__ */ y(function() {
652
+ var a = this.conditionStack.length - 1;
653
+ return a > 0 ? this.conditionStack.pop() : this.conditionStack[0];
654
+ }, "popState"),
655
+ // produce the lexer rule set which is active for the currently active lexer condition state
656
+ _currentRules: /* @__PURE__ */ y(function() {
657
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
658
+ }, "_currentRules"),
659
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
660
+ topState: /* @__PURE__ */ y(function(a) {
661
+ return a = this.conditionStack.length - 1 - Math.abs(a || 0), a >= 0 ? this.conditionStack[a] : "INITIAL";
662
+ }, "topState"),
663
+ // alias for begin(condition)
664
+ pushState: /* @__PURE__ */ y(function(a) {
665
+ this.begin(a);
666
+ }, "pushState"),
667
+ // return the number of states currently on the stack
668
+ stateStackSize: /* @__PURE__ */ y(function() {
669
+ return this.conditionStack.length;
670
+ }, "stateStackSize"),
671
+ options: { "case-insensitive": !0 },
672
+ performAction: /* @__PURE__ */ y(function(a, h, m, _) {
673
+ switch (m) {
674
+ case 0:
675
+ return this.pushState("csv"), 4;
676
+ case 1:
677
+ return this.pushState("csv"), 4;
678
+ case 2:
679
+ return 10;
680
+ case 3:
681
+ return 5;
682
+ case 4:
683
+ return 12;
684
+ case 5:
685
+ return this.pushState("escaped_text"), 18;
686
+ case 6:
687
+ return 20;
688
+ case 7:
689
+ return this.popState("escaped_text"), 18;
690
+ case 8:
691
+ return 19;
692
+ }
693
+ }, "anonymous"),
694
+ rules: [/^(?:sankey-beta\b)/i, /^(?:sankey\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
695
+ conditions: { csv: { rules: [2, 3, 4, 5, 6, 7, 8], inclusive: !1 }, escaped_text: { rules: [7, 8], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8], inclusive: !0 } }
696
+ };
697
+ return k;
698
+ })();
699
+ u.lexer = x;
700
+ function g() {
701
+ this.yy = {};
702
+ }
703
+ return y(g, "Parser"), g.prototype = u, u.Parser = g, new g();
704
+ })();
705
+ rt.parser = rt;
706
+ var H = rt, Q = [], K = [], X = /* @__PURE__ */ new Map(), Qt = /* @__PURE__ */ y(() => {
707
+ Q = [], K = [], X = /* @__PURE__ */ new Map(), Lt();
708
+ }, "clear"), Kt = class {
709
+ constructor(t, i, s = 0) {
710
+ this.source = t, this.target = i, this.value = s;
711
+ }
712
+ static {
713
+ y(this, "SankeyLink");
714
+ }
715
+ }, Zt = /* @__PURE__ */ y((t, i, s) => {
716
+ Q.push(new Kt(t, i, s));
717
+ }, "addLink"), Jt = class {
718
+ constructor(t) {
719
+ this.ID = t;
720
+ }
721
+ static {
722
+ y(this, "SankeyNode");
723
+ }
724
+ }, te = /* @__PURE__ */ y((t) => {
725
+ t = Et.sanitizeText(t, ot());
726
+ let i = X.get(t);
727
+ return i === void 0 && (i = new Jt(t), X.set(t, i), K.push(i)), i;
728
+ }, "findOrCreateNode"), ee = /* @__PURE__ */ y(() => K, "getNodes"), ne = /* @__PURE__ */ y(() => Q, "getLinks"), ie = /* @__PURE__ */ y(() => ({
729
+ nodes: K.map((t) => ({ id: t.ID })),
730
+ links: Q.map((t) => ({
731
+ source: t.source.ID,
732
+ target: t.target.ID,
733
+ value: t.value
734
+ }))
735
+ }), "getGraph"), re = {
736
+ nodesMap: X,
737
+ getConfig: /* @__PURE__ */ y(() => ot().sankey, "getConfig"),
738
+ getNodes: ee,
739
+ getLinks: ne,
740
+ getGraph: ie,
741
+ addLink: Zt,
742
+ findOrCreateNode: te,
743
+ getAccTitle: bt,
744
+ setAccTitle: vt,
745
+ getAccDescription: _t,
746
+ setAccDescription: xt,
747
+ getDiagramTitle: mt,
748
+ setDiagramTitle: kt,
749
+ clear: Qt
750
+ }, yt = class st {
751
+ static {
752
+ y(this, "Uid");
753
+ }
754
+ static {
755
+ this.count = 0;
756
+ }
757
+ static next(i) {
758
+ return new st(i + ++st.count);
759
+ }
760
+ constructor(i) {
761
+ this.id = i, this.href = `#${i}`;
762
+ }
763
+ toString() {
764
+ return "url(" + this.href + ")";
765
+ }
766
+ }, se = {
767
+ left: Ct,
768
+ right: Pt,
769
+ center: It,
770
+ justify: gt
771
+ }, oe = /* @__PURE__ */ y((t) => {
772
+ let i = 0, s = 0;
773
+ for (const l of t) {
774
+ const u = l.value ?? 0;
775
+ u > i && (i = u, s = l.layer ?? 0);
776
+ }
777
+ return s;
778
+ }, "findCentralNodeLayer"), ae = /* @__PURE__ */ y(function(t, i, s, l) {
779
+ const { securityLevel: u, sankey: x } = ot(), g = St.sankey;
780
+ let k;
781
+ u === "sandbox" && (k = G("#i" + i));
782
+ const o = u === "sandbox" ? G(k.nodes()[0].contentDocument.body) : G("body"), a = u === "sandbox" ? o.select(`[id="${i}"]`) : G(`[id="${i}"]`), h = x?.width ?? g.width, m = x?.height ?? g.width, _ = x?.useMaxWidth ?? g.useMaxWidth, d = x?.nodeAlignment ?? g.nodeAlignment, v = x?.prefix ?? g.prefix, T = x?.suffix ?? g.suffix, A = x?.showValues ?? g.showValues, M = x?.nodeWidth ?? g.nodeWidth ?? 10, I = x?.nodePadding ?? g.nodePadding ?? 12, N = x?.labelStyle ?? g.labelStyle ?? "legacy", $ = x?.nodeColors ?? {}, S = l.db.getGraph(), C = se[d];
783
+ jt().nodeId((e) => e.id).nodeWidth(M).nodePadding(I + (A ? 15 : 0)).nodeAlign(C).extent([
784
+ [0, 0],
785
+ [h, m]
786
+ ])(S);
787
+ const D = oe(S.nodes), R = At(Mt), O = /* @__PURE__ */ y((e) => $[e] ?? R(e), "getNodeColor");
788
+ a.append("g").attr("class", "nodes").selectAll(".node").data(S.nodes).join("g").attr("class", "node").attr("id", (e) => (e.uid = yt.next("node-")).id).attr("transform", function(e) {
789
+ return "translate(" + e.x0 + "," + e.y0 + ")";
790
+ }).attr("x", (e) => e.x0).attr("y", (e) => e.y0).append("rect").attr("height", (e) => e.y1 - e.y0).attr("width", (e) => e.x1 - e.x0).attr("fill", (e) => O(e.id));
791
+ const j = /* @__PURE__ */ y(({ id: e, value: r }) => A ? `${e}
792
+ ${v}${Math.round(r * 100) / 100}${T}` : e, "getText"), w = /* @__PURE__ */ y((e) => N === "outlined" ? (e.layer ?? 0) < D ? { x: e.x0 - 6, anchor: "end" } : { x: e.x1 + 6, anchor: "start" } : e.x0 < h / 2 ? { x: e.x1 + 6, anchor: "start" } : { x: e.x0 - 6, anchor: "end" }, "getLabelPosition"), P = a.append("g").attr("class", "node-labels").attr("font-size", 14), E = /* @__PURE__ */ y((e) => P.selectAll(e ? `.${e}` : "text").data(S.nodes).join("text").attr("class", e ?? null).attr("x", (r) => w(r).x).attr("y", (r) => (r.y1 + r.y0) / 2).attr("dy", `${A ? "0" : "0.35"}em`).attr("text-anchor", (r) => w(r).anchor).text(j), "appendLabel");
793
+ N === "outlined" ? (E("sankey-label-bg"), E("sankey-label-fg")) : E();
794
+ const n = a.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(S.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply"), f = x?.linkColor ?? "gradient";
795
+ if (f === "gradient") {
796
+ const e = n.append("linearGradient").attr("id", (r) => (r.uid = yt.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (r) => r.source.x1).attr("x2", (r) => r.target.x0);
797
+ e.append("stop").attr("offset", "0%").attr("stop-color", (r) => O(r.source.id)), e.append("stop").attr("offset", "100%").attr("stop-color", (r) => O(r.target.id));
798
+ }
799
+ let c;
800
+ switch (f) {
801
+ case "gradient":
802
+ c = /* @__PURE__ */ y((e) => e.uid, "coloring");
803
+ break;
804
+ case "source":
805
+ c = /* @__PURE__ */ y((e) => O(e.source.id), "coloring");
806
+ break;
807
+ case "target":
808
+ c = /* @__PURE__ */ y((e) => O(e.target.id), "coloring");
809
+ break;
810
+ default:
811
+ c = f;
812
+ }
813
+ n.append("path").attr("d", Xt()).attr("stroke", c).attr("stroke-width", (e) => Math.max(1, e.width)), wt(void 0, a, 0, _);
814
+ }, "draw"), le = {
815
+ draw: ae
816
+ }, ce = /* @__PURE__ */ y((t) => t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, `
817
+ `).trim(), "prepareTextForParsing"), ue = /* @__PURE__ */ y((t) => `.label {
818
+ font-family: ${t.fontFamily};
819
+ }
820
+
821
+ .node-labels {
822
+ font-family: ${t.fontFamily};
823
+ }
824
+
825
+ /* Outlined label style - background stroke for better readability */
826
+ .sankey-label-bg {
827
+ stroke: ${t.mainBkg || t.background || "#fff"};
828
+ stroke-width: 4px;
829
+ stroke-linejoin: round;
830
+ paint-order: stroke;
831
+ }
832
+
833
+ /* Foreground label text */
834
+ .sankey-label-fg {
835
+ fill: ${t.textColor};
836
+ }
837
+
838
+ /* Node styling */
839
+ .node rect {
840
+ shape-rendering: crispEdges;
841
+ }
842
+
843
+ /* Link styling */
844
+ .link {
845
+ fill: none;
846
+ stroke-opacity: 0.5;
847
+ mix-blend-mode: multiply;
848
+ }
849
+ `, "getStyles"), he = ue, fe = H.parse.bind(H);
850
+ H.parse = (t) => fe(ce(t));
851
+ var ge = {
852
+ styles: he,
853
+ parser: H,
854
+ db: re,
855
+ renderer: le
856
+ };
857
+ export {
858
+ ge as diagram
859
+ };