@webskill/sdk 0.21.0 → 0.22.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 (132) hide show
  1. package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +1012 -130
  4. package/dist/{approval-DwN2o2QG.js → approval-DWQlDPbY.js} +102 -16
  5. package/dist/arc-8U_6NQWm.js +130 -0
  6. package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
  7. package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
  8. package/dist/array-DQfpQNY8.js +8 -0
  9. package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
  10. package/dist/browser.d.ts +444 -48
  11. package/dist/browser.js +1771 -91
  12. package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
  13. package/dist/channel-CZxxLrG7.js +9 -0
  14. package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
  15. package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
  16. package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
  17. package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
  18. package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
  19. package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
  20. package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
  21. package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
  22. package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
  23. package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
  24. package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
  25. package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
  26. package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
  27. package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
  28. package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
  29. package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
  30. package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
  31. package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
  32. package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
  33. package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
  34. package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
  35. package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
  36. package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
  37. package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
  38. package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
  39. package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
  40. package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
  41. package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
  42. package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
  43. package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
  44. package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
  45. package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
  46. package/dist/defaultLocale-B_EoOkSF.js +249 -0
  47. package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
  48. package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
  49. package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
  50. package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
  51. package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
  52. package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
  53. package/dist/dist-UajCDt3n.js +92 -0
  54. package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
  55. package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
  56. package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
  57. package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
  58. package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
  59. package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
  60. package/dist/{toolSource-C9oNuKmr.js → geometry-wx5ZTYzi.js} +162 -12
  61. package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
  62. package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
  63. package/dist/governance.d.ts +3 -3
  64. package/dist/graphlib-tk9gQYuN.js +4194 -0
  65. package/dist/{index-B8Tgmpwh.d.ts → index-BiO9_XRk.d.ts} +2 -2
  66. package/dist/{index-CYLt5u4L.d.ts → index-CjwdZQOS.d.ts} +700 -12
  67. package/dist/{index-DHopiH_m.d.ts → index-YPd8ZSEa.d.ts} +156 -9
  68. package/dist/index.d.ts +4 -4
  69. package/dist/index.js +6 -6
  70. package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
  71. package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
  72. package/dist/init-CMOIWdg-.js +16 -0
  73. package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
  74. package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
  75. package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
  76. package/dist/katex-BcRRvyh_.js +26465 -0
  77. package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
  78. package/dist/line-LgV8iVMV.js +48 -0
  79. package/dist/linear-BWKR0Tqd.js +393 -0
  80. package/dist/linkedDocument-CIuh_Yp0.js +416 -0
  81. package/dist/mcp.d.ts +2 -2
  82. package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
  83. package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
  84. package/dist/mermaid.core-DMtwGCHy.js +1756 -0
  85. package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
  86. package/dist/node.d.ts +3 -3
  87. package/dist/node.js +2 -2
  88. package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
  89. package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
  90. package/dist/ordinal-CxA6GHQS.js +84 -0
  91. package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
  92. package/dist/path-C27Z2Bjv.js +106 -0
  93. package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
  94. package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
  95. package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
  96. package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
  97. package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
  98. package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
  99. package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
  100. package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
  101. package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
  102. package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
  103. package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
  104. package/dist/rough.cjs-AmDd_NQk.js +1395 -0
  105. package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
  106. package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
  107. package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
  108. package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
  109. package/dist/src-NkhI3UMl.js +2653 -0
  110. package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
  111. package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
  112. package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
  113. package/dist/testing.d.ts +2 -1
  114. package/dist/testing.js +1 -1
  115. package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
  116. package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
  117. package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
  118. package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +59 -8
  119. package/dist/ui-react.d.ts +3 -3
  120. package/dist/ui-react.js +3718 -77
  121. package/dist/ui-vue.d.ts +1 -1
  122. package/dist/ui.d.ts +3 -3
  123. package/dist/ui.js +2 -2
  124. package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
  125. package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
  126. package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
  127. package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
  128. package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-Dy-Zjv0y.js} +1 -1
  129. package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
  130. package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
  131. package/package.json +1 -1
  132. package/dist/linkedDocument-C0gj1sMq.js +0 -245
@@ -0,0 +1,3578 @@
1
+ import { t as __commonJSMin } from "./rolldown-runtime-BHkdefai.js";
2
+ import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
3
+ import { p as select_default } from "./src-NkhI3UMl.js";
4
+ import { H as setAccDescription, U as setAccTitle, Y as setupGraphViewbox, a as clear, d as defaultConfig2, q as setDiagramTitle, s as common_default, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
5
+ import { t as ordinal } from "./ordinal-CxA6GHQS.js";
6
+
7
+ //#region ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js
8
+ function colors_default(specifier) {
9
+ var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
10
+ while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
11
+ return colors;
12
+ }
13
+
14
+ //#endregion
15
+ //#region ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Tableau10.js
16
+ var Tableau10_default = colors_default("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
17
+
18
+ //#endregion
19
+ //#region ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/dist/d3-array.js
20
+ var require_d3_array = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21
+ (function(global, factory) {
22
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.d3 = global.d3 || {}));
23
+ })(exports, (function(exports$4) {
24
+ "use strict";
25
+ function ascending(a, b) {
26
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
27
+ }
28
+ function bisector(f) {
29
+ let delta = f;
30
+ let compare = f;
31
+ if (f.length === 1) {
32
+ delta = (d, x) => f(d) - x;
33
+ compare = ascendingComparator(f);
34
+ }
35
+ function left(a, x, lo, hi) {
36
+ if (lo == null) lo = 0;
37
+ if (hi == null) hi = a.length;
38
+ while (lo < hi) {
39
+ const mid = lo + hi >>> 1;
40
+ if (compare(a[mid], x) < 0) lo = mid + 1;
41
+ else hi = mid;
42
+ }
43
+ return lo;
44
+ }
45
+ function right(a, x, lo, hi) {
46
+ if (lo == null) lo = 0;
47
+ if (hi == null) hi = a.length;
48
+ while (lo < hi) {
49
+ const mid = lo + hi >>> 1;
50
+ if (compare(a[mid], x) > 0) hi = mid;
51
+ else lo = mid + 1;
52
+ }
53
+ return lo;
54
+ }
55
+ function center(a, x, lo, hi) {
56
+ if (lo == null) lo = 0;
57
+ if (hi == null) hi = a.length;
58
+ const i = left(a, x, lo, hi - 1);
59
+ return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
60
+ }
61
+ return {
62
+ left,
63
+ center,
64
+ right
65
+ };
66
+ }
67
+ function ascendingComparator(f) {
68
+ return (d, x) => ascending(f(d), x);
69
+ }
70
+ function number(x) {
71
+ return x === null ? NaN : +x;
72
+ }
73
+ function* numbers(values, valueof) {
74
+ if (valueof === void 0) {
75
+ for (let value of values) if (value != null && (value = +value) >= value) yield value;
76
+ } else {
77
+ let index = -1;
78
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) yield value;
79
+ }
80
+ }
81
+ const ascendingBisect = bisector(ascending);
82
+ const bisectRight = ascendingBisect.right;
83
+ const bisectLeft = ascendingBisect.left;
84
+ const bisectCenter = bisector(number).center;
85
+ function count(values, valueof) {
86
+ let count = 0;
87
+ if (valueof === void 0) {
88
+ for (let value of values) if (value != null && (value = +value) >= value) ++count;
89
+ } else {
90
+ let index = -1;
91
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count;
92
+ }
93
+ return count;
94
+ }
95
+ function length$1(array) {
96
+ return array.length | 0;
97
+ }
98
+ function empty(length) {
99
+ return !(length > 0);
100
+ }
101
+ function arrayify(values) {
102
+ return typeof values !== "object" || "length" in values ? values : Array.from(values);
103
+ }
104
+ function reducer(reduce) {
105
+ return (values) => reduce(...values);
106
+ }
107
+ function cross(...values) {
108
+ const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop());
109
+ values = values.map(arrayify);
110
+ const lengths = values.map(length$1);
111
+ const j = values.length - 1;
112
+ const index = new Array(j + 1).fill(0);
113
+ const product = [];
114
+ if (j < 0 || lengths.some(empty)) return product;
115
+ while (true) {
116
+ product.push(index.map((j, i) => values[i][j]));
117
+ let i = j;
118
+ while (++index[i] === lengths[i]) {
119
+ if (i === 0) return reduce ? product.map(reduce) : product;
120
+ index[i--] = 0;
121
+ }
122
+ }
123
+ }
124
+ function cumsum(values, valueof) {
125
+ var sum = 0, index = 0;
126
+ return Float64Array.from(values, valueof === void 0 ? (v) => sum += +v || 0 : (v) => sum += +valueof(v, index++, values) || 0);
127
+ }
128
+ function descending(a, b) {
129
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
130
+ }
131
+ function variance(values, valueof) {
132
+ let count = 0;
133
+ let delta;
134
+ let mean = 0;
135
+ let sum = 0;
136
+ if (valueof === void 0) {
137
+ for (let value of values) if (value != null && (value = +value) >= value) {
138
+ delta = value - mean;
139
+ mean += delta / ++count;
140
+ sum += delta * (value - mean);
141
+ }
142
+ } else {
143
+ let index = -1;
144
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
145
+ delta = value - mean;
146
+ mean += delta / ++count;
147
+ sum += delta * (value - mean);
148
+ }
149
+ }
150
+ if (count > 1) return sum / (count - 1);
151
+ }
152
+ function deviation(values, valueof) {
153
+ const v = variance(values, valueof);
154
+ return v ? Math.sqrt(v) : v;
155
+ }
156
+ function extent(values, valueof) {
157
+ let min;
158
+ let max;
159
+ if (valueof === void 0) {
160
+ for (const value of values) if (value != null) if (min === void 0) {
161
+ if (value >= value) min = max = value;
162
+ } else {
163
+ if (min > value) min = value;
164
+ if (max < value) max = value;
165
+ }
166
+ } else {
167
+ let index = -1;
168
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null) if (min === void 0) {
169
+ if (value >= value) min = max = value;
170
+ } else {
171
+ if (min > value) min = value;
172
+ if (max < value) max = value;
173
+ }
174
+ }
175
+ return [min, max];
176
+ }
177
+ class Adder {
178
+ constructor() {
179
+ this._partials = /* @__PURE__ */ new Float64Array(32);
180
+ this._n = 0;
181
+ }
182
+ add(x) {
183
+ const p = this._partials;
184
+ let i = 0;
185
+ for (let j = 0; j < this._n && j < 32; j++) {
186
+ const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
187
+ if (lo) p[i++] = lo;
188
+ x = hi;
189
+ }
190
+ p[i] = x;
191
+ this._n = i + 1;
192
+ return this;
193
+ }
194
+ valueOf() {
195
+ const p = this._partials;
196
+ let n = this._n, x, y, lo, hi = 0;
197
+ if (n > 0) {
198
+ hi = p[--n];
199
+ while (n > 0) {
200
+ x = hi;
201
+ y = p[--n];
202
+ hi = x + y;
203
+ lo = y - (hi - x);
204
+ if (lo) break;
205
+ }
206
+ if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) {
207
+ y = lo * 2;
208
+ x = hi + y;
209
+ if (y == x - hi) hi = x;
210
+ }
211
+ }
212
+ return hi;
213
+ }
214
+ }
215
+ function fsum(values, valueof) {
216
+ const adder = new Adder();
217
+ if (valueof === void 0) {
218
+ for (let value of values) if (value = +value) adder.add(value);
219
+ } else {
220
+ let index = -1;
221
+ for (let value of values) if (value = +valueof(value, ++index, values)) adder.add(value);
222
+ }
223
+ return +adder;
224
+ }
225
+ function fcumsum(values, valueof) {
226
+ const adder = new Adder();
227
+ let index = -1;
228
+ return Float64Array.from(values, valueof === void 0 ? (v) => adder.add(+v || 0) : (v) => adder.add(+valueof(v, ++index, values) || 0));
229
+ }
230
+ class InternMap extends Map {
231
+ constructor(entries, key = keyof) {
232
+ super();
233
+ Object.defineProperties(this, {
234
+ _intern: { value: /* @__PURE__ */ new Map() },
235
+ _key: { value: key }
236
+ });
237
+ if (entries != null) for (const [key, value] of entries) this.set(key, value);
238
+ }
239
+ get(key) {
240
+ return super.get(intern_get(this, key));
241
+ }
242
+ has(key) {
243
+ return super.has(intern_get(this, key));
244
+ }
245
+ set(key, value) {
246
+ return super.set(intern_set(this, key), value);
247
+ }
248
+ delete(key) {
249
+ return super.delete(intern_delete(this, key));
250
+ }
251
+ }
252
+ class InternSet extends Set {
253
+ constructor(values, key = keyof) {
254
+ super();
255
+ Object.defineProperties(this, {
256
+ _intern: { value: /* @__PURE__ */ new Map() },
257
+ _key: { value: key }
258
+ });
259
+ if (values != null) for (const value of values) this.add(value);
260
+ }
261
+ has(value) {
262
+ return super.has(intern_get(this, value));
263
+ }
264
+ add(value) {
265
+ return super.add(intern_set(this, value));
266
+ }
267
+ delete(value) {
268
+ return super.delete(intern_delete(this, value));
269
+ }
270
+ }
271
+ function intern_get({ _intern, _key }, value) {
272
+ const key = _key(value);
273
+ return _intern.has(key) ? _intern.get(key) : value;
274
+ }
275
+ function intern_set({ _intern, _key }, value) {
276
+ const key = _key(value);
277
+ if (_intern.has(key)) return _intern.get(key);
278
+ _intern.set(key, value);
279
+ return value;
280
+ }
281
+ function intern_delete({ _intern, _key }, value) {
282
+ const key = _key(value);
283
+ if (_intern.has(key)) {
284
+ value = _intern.get(value);
285
+ _intern.delete(key);
286
+ }
287
+ return value;
288
+ }
289
+ function keyof(value) {
290
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
291
+ }
292
+ function identity(x) {
293
+ return x;
294
+ }
295
+ function group(values, ...keys) {
296
+ return nest(values, identity, identity, keys);
297
+ }
298
+ function groups(values, ...keys) {
299
+ return nest(values, Array.from, identity, keys);
300
+ }
301
+ function rollup(values, reduce, ...keys) {
302
+ return nest(values, identity, reduce, keys);
303
+ }
304
+ function rollups(values, reduce, ...keys) {
305
+ return nest(values, Array.from, reduce, keys);
306
+ }
307
+ function index(values, ...keys) {
308
+ return nest(values, identity, unique, keys);
309
+ }
310
+ function indexes(values, ...keys) {
311
+ return nest(values, Array.from, unique, keys);
312
+ }
313
+ function unique(values) {
314
+ if (values.length !== 1) throw new Error("duplicate key");
315
+ return values[0];
316
+ }
317
+ function nest(values, map, reduce, keys) {
318
+ return (function regroup(values, i) {
319
+ if (i >= keys.length) return reduce(values);
320
+ const groups = new InternMap();
321
+ const keyof = keys[i++];
322
+ let index = -1;
323
+ for (const value of values) {
324
+ const key = keyof(value, ++index, values);
325
+ const group = groups.get(key);
326
+ if (group) group.push(value);
327
+ else groups.set(key, [value]);
328
+ }
329
+ for (const [key, values] of groups) groups.set(key, regroup(values, i));
330
+ return map(groups);
331
+ })(values, 0);
332
+ }
333
+ function permute(source, keys) {
334
+ return Array.from(keys, (key) => source[key]);
335
+ }
336
+ function sort(values, ...F) {
337
+ if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
338
+ values = Array.from(values);
339
+ let [f = ascending] = F;
340
+ if (f.length === 1 || F.length > 1) {
341
+ const index = Uint32Array.from(values, (d, i) => i);
342
+ if (F.length > 1) {
343
+ F = F.map((f) => values.map(f));
344
+ index.sort((i, j) => {
345
+ for (const f of F) {
346
+ const c = ascending(f[i], f[j]);
347
+ if (c) return c;
348
+ }
349
+ });
350
+ } else {
351
+ f = values.map(f);
352
+ index.sort((i, j) => ascending(f[i], f[j]));
353
+ }
354
+ return permute(values, index);
355
+ }
356
+ return values.sort(f);
357
+ }
358
+ function groupSort(values, reduce, key) {
359
+ return (reduce.length === 1 ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk))) : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk)))).map(([key]) => key);
360
+ }
361
+ var slice = Array.prototype.slice;
362
+ function constant(x) {
363
+ return function() {
364
+ return x;
365
+ };
366
+ }
367
+ var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);
368
+ function ticks(start, stop, count) {
369
+ var reverse, i = -1, n, ticks, step;
370
+ stop = +stop, start = +start, count = +count;
371
+ if (start === stop && count > 0) return [start];
372
+ if (reverse = stop < start) n = start, start = stop, stop = n;
373
+ if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
374
+ if (step > 0) {
375
+ let r0 = Math.round(start / step), r1 = Math.round(stop / step);
376
+ if (r0 * step < start) ++r0;
377
+ if (r1 * step > stop) --r1;
378
+ ticks = new Array(n = r1 - r0 + 1);
379
+ while (++i < n) ticks[i] = (r0 + i) * step;
380
+ } else {
381
+ step = -step;
382
+ let r0 = Math.round(start * step), r1 = Math.round(stop * step);
383
+ if (r0 / step < start) ++r0;
384
+ if (r1 / step > stop) --r1;
385
+ ticks = new Array(n = r1 - r0 + 1);
386
+ while (++i < n) ticks[i] = (r0 + i) / step;
387
+ }
388
+ if (reverse) ticks.reverse();
389
+ return ticks;
390
+ }
391
+ function tickIncrement(start, stop, count) {
392
+ var step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
393
+ return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
394
+ }
395
+ function tickStep(start, stop, count) {
396
+ var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
397
+ if (error >= e10) step1 *= 10;
398
+ else if (error >= e5) step1 *= 5;
399
+ else if (error >= e2) step1 *= 2;
400
+ return stop < start ? -step1 : step1;
401
+ }
402
+ function nice(start, stop, count) {
403
+ let prestep;
404
+ while (true) {
405
+ const step = tickIncrement(start, stop, count);
406
+ if (step === prestep || step === 0 || !isFinite(step)) return [start, stop];
407
+ else if (step > 0) {
408
+ start = Math.floor(start / step) * step;
409
+ stop = Math.ceil(stop / step) * step;
410
+ } else if (step < 0) {
411
+ start = Math.ceil(start * step) / step;
412
+ stop = Math.floor(stop * step) / step;
413
+ }
414
+ prestep = step;
415
+ }
416
+ }
417
+ function sturges(values) {
418
+ return Math.ceil(Math.log(count(values)) / Math.LN2) + 1;
419
+ }
420
+ function bin() {
421
+ var value = identity, domain = extent, threshold = sturges;
422
+ function histogram(data) {
423
+ if (!Array.isArray(data)) data = Array.from(data);
424
+ var i, n = data.length, x, values = new Array(n);
425
+ for (i = 0; i < n; ++i) values[i] = value(data[i], i, data);
426
+ var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1);
427
+ if (!Array.isArray(tz)) {
428
+ const max = x1, tn = +tz;
429
+ if (domain === extent) [x0, x1] = nice(x0, x1, tn);
430
+ tz = ticks(x0, x1, tn);
431
+ if (tz[tz.length - 1] >= x1) if (max >= x1 && domain === extent) {
432
+ const step = tickIncrement(x0, x1, tn);
433
+ if (isFinite(step)) {
434
+ if (step > 0) x1 = (Math.floor(x1 / step) + 1) * step;
435
+ else if (step < 0) x1 = (Math.ceil(x1 * -step) + 1) / -step;
436
+ }
437
+ } else tz.pop();
438
+ }
439
+ var m = tz.length;
440
+ while (tz[0] <= x0) tz.shift(), --m;
441
+ while (tz[m - 1] > x1) tz.pop(), --m;
442
+ var bins = new Array(m + 1), bin;
443
+ for (i = 0; i <= m; ++i) {
444
+ bin = bins[i] = [];
445
+ bin.x0 = i > 0 ? tz[i - 1] : x0;
446
+ bin.x1 = i < m ? tz[i] : x1;
447
+ }
448
+ for (i = 0; i < n; ++i) {
449
+ x = values[i];
450
+ if (x0 <= x && x <= x1) bins[bisectRight(tz, x, 0, m)].push(data[i]);
451
+ }
452
+ return bins;
453
+ }
454
+ histogram.value = function(_) {
455
+ return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value;
456
+ };
457
+ histogram.domain = function(_) {
458
+ return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain;
459
+ };
460
+ histogram.thresholds = function(_) {
461
+ return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;
462
+ };
463
+ return histogram;
464
+ }
465
+ function max(values, valueof) {
466
+ let max;
467
+ if (valueof === void 0) {
468
+ for (const value of values) if (value != null && (max < value || max === void 0 && value >= value)) max = value;
469
+ } else {
470
+ let index = -1;
471
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (max < value || max === void 0 && value >= value)) max = value;
472
+ }
473
+ return max;
474
+ }
475
+ function min(values, valueof) {
476
+ let min;
477
+ if (valueof === void 0) {
478
+ for (const value of values) if (value != null && (min > value || min === void 0 && value >= value)) min = value;
479
+ } else {
480
+ let index = -1;
481
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (min > value || min === void 0 && value >= value)) min = value;
482
+ }
483
+ return min;
484
+ }
485
+ function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending) {
486
+ while (right > left) {
487
+ if (right - left > 600) {
488
+ const n = right - left + 1;
489
+ const m = k - left + 1;
490
+ const z = Math.log(n);
491
+ const s = .5 * Math.exp(2 * z / 3);
492
+ const sd = .5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
493
+ quickselect(array, k, Math.max(left, Math.floor(k - m * s / n + sd)), Math.min(right, Math.floor(k + (n - m) * s / n + sd)), compare);
494
+ }
495
+ const t = array[k];
496
+ let i = left;
497
+ let j = right;
498
+ swap(array, left, k);
499
+ if (compare(array[right], t) > 0) swap(array, left, right);
500
+ while (i < j) {
501
+ swap(array, i, j), ++i, --j;
502
+ while (compare(array[i], t) < 0) ++i;
503
+ while (compare(array[j], t) > 0) --j;
504
+ }
505
+ if (compare(array[left], t) === 0) swap(array, left, j);
506
+ else ++j, swap(array, j, right);
507
+ if (j <= k) left = j + 1;
508
+ if (k <= j) right = j - 1;
509
+ }
510
+ return array;
511
+ }
512
+ function swap(array, i, j) {
513
+ const t = array[i];
514
+ array[i] = array[j];
515
+ array[j] = t;
516
+ }
517
+ function quantile(values, p, valueof) {
518
+ values = Float64Array.from(numbers(values, valueof));
519
+ if (!(n = values.length)) return;
520
+ if ((p = +p) <= 0 || n < 2) return min(values);
521
+ if (p >= 1) return max(values);
522
+ var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max(quickselect(values, i0).subarray(0, i0 + 1));
523
+ return value0 + (min(values.subarray(i0 + 1)) - value0) * (i - i0);
524
+ }
525
+ function quantileSorted(values, p, valueof = number) {
526
+ if (!(n = values.length)) return;
527
+ if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
528
+ if (p >= 1) return +valueof(values[n - 1], n - 1, values);
529
+ var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values);
530
+ return value0 + (+valueof(values[i0 + 1], i0 + 1, values) - value0) * (i - i0);
531
+ }
532
+ function freedmanDiaconis(values, min, max) {
533
+ return Math.ceil((max - min) / (2 * (quantile(values, .75) - quantile(values, .25)) * Math.pow(count(values), -1 / 3)));
534
+ }
535
+ function scott(values, min, max) {
536
+ return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(count(values), -1 / 3)));
537
+ }
538
+ function maxIndex(values, valueof) {
539
+ let max;
540
+ let maxIndex = -1;
541
+ let index = -1;
542
+ if (valueof === void 0) for (const value of values) {
543
+ ++index;
544
+ if (value != null && (max < value || max === void 0 && value >= value)) max = value, maxIndex = index;
545
+ }
546
+ else for (let value of values) if ((value = valueof(value, ++index, values)) != null && (max < value || max === void 0 && value >= value)) max = value, maxIndex = index;
547
+ return maxIndex;
548
+ }
549
+ function mean(values, valueof) {
550
+ let count = 0;
551
+ let sum = 0;
552
+ if (valueof === void 0) {
553
+ for (let value of values) if (value != null && (value = +value) >= value) ++count, sum += value;
554
+ } else {
555
+ let index = -1;
556
+ for (let value of values) if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count, sum += value;
557
+ }
558
+ if (count) return sum / count;
559
+ }
560
+ function median(values, valueof) {
561
+ return quantile(values, .5, valueof);
562
+ }
563
+ function* flatten(arrays) {
564
+ for (const array of arrays) yield* array;
565
+ }
566
+ function merge(arrays) {
567
+ return Array.from(flatten(arrays));
568
+ }
569
+ function minIndex(values, valueof) {
570
+ let min;
571
+ let minIndex = -1;
572
+ let index = -1;
573
+ if (valueof === void 0) for (const value of values) {
574
+ ++index;
575
+ if (value != null && (min > value || min === void 0 && value >= value)) min = value, minIndex = index;
576
+ }
577
+ else for (let value of values) if ((value = valueof(value, ++index, values)) != null && (min > value || min === void 0 && value >= value)) min = value, minIndex = index;
578
+ return minIndex;
579
+ }
580
+ function pairs(values, pairof = pair) {
581
+ const pairs = [];
582
+ let previous;
583
+ let first = false;
584
+ for (const value of values) {
585
+ if (first) pairs.push(pairof(previous, value));
586
+ previous = value;
587
+ first = true;
588
+ }
589
+ return pairs;
590
+ }
591
+ function pair(a, b) {
592
+ return [a, b];
593
+ }
594
+ function range(start, stop, step) {
595
+ start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
596
+ var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n);
597
+ while (++i < n) range[i] = start + i * step;
598
+ return range;
599
+ }
600
+ function least(values, compare = ascending) {
601
+ let min;
602
+ let defined = false;
603
+ if (compare.length === 1) {
604
+ let minValue;
605
+ for (const element of values) {
606
+ const value = compare(element);
607
+ if (defined ? ascending(value, minValue) < 0 : ascending(value, value) === 0) {
608
+ min = element;
609
+ minValue = value;
610
+ defined = true;
611
+ }
612
+ }
613
+ } else for (const value of values) if (defined ? compare(value, min) < 0 : compare(value, value) === 0) {
614
+ min = value;
615
+ defined = true;
616
+ }
617
+ return min;
618
+ }
619
+ function leastIndex(values, compare = ascending) {
620
+ if (compare.length === 1) return minIndex(values, compare);
621
+ let minValue;
622
+ let min = -1;
623
+ let index = -1;
624
+ for (const value of values) {
625
+ ++index;
626
+ if (min < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) {
627
+ minValue = value;
628
+ min = index;
629
+ }
630
+ }
631
+ return min;
632
+ }
633
+ function greatest(values, compare = ascending) {
634
+ let max;
635
+ let defined = false;
636
+ if (compare.length === 1) {
637
+ let maxValue;
638
+ for (const element of values) {
639
+ const value = compare(element);
640
+ if (defined ? ascending(value, maxValue) > 0 : ascending(value, value) === 0) {
641
+ max = element;
642
+ maxValue = value;
643
+ defined = true;
644
+ }
645
+ }
646
+ } else for (const value of values) if (defined ? compare(value, max) > 0 : compare(value, value) === 0) {
647
+ max = value;
648
+ defined = true;
649
+ }
650
+ return max;
651
+ }
652
+ function greatestIndex(values, compare = ascending) {
653
+ if (compare.length === 1) return maxIndex(values, compare);
654
+ let maxValue;
655
+ let max = -1;
656
+ let index = -1;
657
+ for (const value of values) {
658
+ ++index;
659
+ if (max < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) {
660
+ maxValue = value;
661
+ max = index;
662
+ }
663
+ }
664
+ return max;
665
+ }
666
+ function scan(values, compare) {
667
+ const index = leastIndex(values, compare);
668
+ return index < 0 ? void 0 : index;
669
+ }
670
+ var shuffle = shuffler(Math.random);
671
+ function shuffler(random) {
672
+ return function shuffle(array, i0 = 0, i1 = array.length) {
673
+ let m = i1 - (i0 = +i0);
674
+ while (m) {
675
+ const i = random() * m-- | 0, t = array[m + i0];
676
+ array[m + i0] = array[i + i0];
677
+ array[i + i0] = t;
678
+ }
679
+ return array;
680
+ };
681
+ }
682
+ function sum(values, valueof) {
683
+ let sum = 0;
684
+ if (valueof === void 0) {
685
+ for (let value of values) if (value = +value) sum += value;
686
+ } else {
687
+ let index = -1;
688
+ for (let value of values) if (value = +valueof(value, ++index, values)) sum += value;
689
+ }
690
+ return sum;
691
+ }
692
+ function transpose(matrix) {
693
+ if (!(n = matrix.length)) return [];
694
+ for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) row[j] = matrix[j][i];
695
+ return transpose;
696
+ }
697
+ function length(d) {
698
+ return d.length;
699
+ }
700
+ function zip() {
701
+ return transpose(arguments);
702
+ }
703
+ function every(values, test) {
704
+ if (typeof test !== "function") throw new TypeError("test is not a function");
705
+ let index = -1;
706
+ for (const value of values) if (!test(value, ++index, values)) return false;
707
+ return true;
708
+ }
709
+ function some(values, test) {
710
+ if (typeof test !== "function") throw new TypeError("test is not a function");
711
+ let index = -1;
712
+ for (const value of values) if (test(value, ++index, values)) return true;
713
+ return false;
714
+ }
715
+ function filter(values, test) {
716
+ if (typeof test !== "function") throw new TypeError("test is not a function");
717
+ const array = [];
718
+ let index = -1;
719
+ for (const value of values) if (test(value, ++index, values)) array.push(value);
720
+ return array;
721
+ }
722
+ function map(values, mapper) {
723
+ if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
724
+ if (typeof mapper !== "function") throw new TypeError("mapper is not a function");
725
+ return Array.from(values, (value, index) => mapper(value, index, values));
726
+ }
727
+ function reduce(values, reducer, value) {
728
+ if (typeof reducer !== "function") throw new TypeError("reducer is not a function");
729
+ const iterator = values[Symbol.iterator]();
730
+ let done, next, index = -1;
731
+ if (arguments.length < 3) {
732
+ ({done, value} = iterator.next());
733
+ if (done) return;
734
+ ++index;
735
+ }
736
+ while ({done, value: next} = iterator.next(), !done) value = reducer(value, next, ++index, values);
737
+ return value;
738
+ }
739
+ function reverse(values) {
740
+ if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
741
+ return Array.from(values).reverse();
742
+ }
743
+ function difference(values, ...others) {
744
+ values = new Set(values);
745
+ for (const other of others) for (const value of other) values.delete(value);
746
+ return values;
747
+ }
748
+ function disjoint(values, other) {
749
+ const iterator = other[Symbol.iterator](), set = /* @__PURE__ */ new Set();
750
+ for (const v of values) {
751
+ if (set.has(v)) return false;
752
+ let value, done;
753
+ while ({value, done} = iterator.next()) {
754
+ if (done) break;
755
+ if (Object.is(v, value)) return false;
756
+ set.add(value);
757
+ }
758
+ }
759
+ return true;
760
+ }
761
+ function set(values) {
762
+ return values instanceof Set ? values : new Set(values);
763
+ }
764
+ function intersection(values, ...others) {
765
+ values = new Set(values);
766
+ others = others.map(set);
767
+ out: for (const value of values) for (const other of others) if (!other.has(value)) {
768
+ values.delete(value);
769
+ continue out;
770
+ }
771
+ return values;
772
+ }
773
+ function superset(values, other) {
774
+ const iterator = values[Symbol.iterator](), set = /* @__PURE__ */ new Set();
775
+ for (const o of other) {
776
+ if (set.has(o)) continue;
777
+ let value, done;
778
+ while ({value, done} = iterator.next()) {
779
+ if (done) return false;
780
+ set.add(value);
781
+ if (Object.is(o, value)) break;
782
+ }
783
+ }
784
+ return true;
785
+ }
786
+ function subset(values, other) {
787
+ return superset(other, values);
788
+ }
789
+ function union(...others) {
790
+ const set = /* @__PURE__ */ new Set();
791
+ for (const other of others) for (const o of other) set.add(o);
792
+ return set;
793
+ }
794
+ exports$4.Adder = Adder;
795
+ exports$4.InternMap = InternMap;
796
+ exports$4.InternSet = InternSet;
797
+ exports$4.ascending = ascending;
798
+ exports$4.bin = bin;
799
+ exports$4.bisect = bisectRight;
800
+ exports$4.bisectCenter = bisectCenter;
801
+ exports$4.bisectLeft = bisectLeft;
802
+ exports$4.bisectRight = bisectRight;
803
+ exports$4.bisector = bisector;
804
+ exports$4.count = count;
805
+ exports$4.cross = cross;
806
+ exports$4.cumsum = cumsum;
807
+ exports$4.descending = descending;
808
+ exports$4.deviation = deviation;
809
+ exports$4.difference = difference;
810
+ exports$4.disjoint = disjoint;
811
+ exports$4.every = every;
812
+ exports$4.extent = extent;
813
+ exports$4.fcumsum = fcumsum;
814
+ exports$4.filter = filter;
815
+ exports$4.fsum = fsum;
816
+ exports$4.greatest = greatest;
817
+ exports$4.greatestIndex = greatestIndex;
818
+ exports$4.group = group;
819
+ exports$4.groupSort = groupSort;
820
+ exports$4.groups = groups;
821
+ exports$4.histogram = bin;
822
+ exports$4.index = index;
823
+ exports$4.indexes = indexes;
824
+ exports$4.intersection = intersection;
825
+ exports$4.least = least;
826
+ exports$4.leastIndex = leastIndex;
827
+ exports$4.map = map;
828
+ exports$4.max = max;
829
+ exports$4.maxIndex = maxIndex;
830
+ exports$4.mean = mean;
831
+ exports$4.median = median;
832
+ exports$4.merge = merge;
833
+ exports$4.min = min;
834
+ exports$4.minIndex = minIndex;
835
+ exports$4.nice = nice;
836
+ exports$4.pairs = pairs;
837
+ exports$4.permute = permute;
838
+ exports$4.quantile = quantile;
839
+ exports$4.quantileSorted = quantileSorted;
840
+ exports$4.quickselect = quickselect;
841
+ exports$4.range = range;
842
+ exports$4.reduce = reduce;
843
+ exports$4.reverse = reverse;
844
+ exports$4.rollup = rollup;
845
+ exports$4.rollups = rollups;
846
+ exports$4.scan = scan;
847
+ exports$4.shuffle = shuffle;
848
+ exports$4.shuffler = shuffler;
849
+ exports$4.some = some;
850
+ exports$4.sort = sort;
851
+ exports$4.subset = subset;
852
+ exports$4.sum = sum;
853
+ exports$4.superset = superset;
854
+ exports$4.thresholdFreedmanDiaconis = freedmanDiaconis;
855
+ exports$4.thresholdScott = scott;
856
+ exports$4.thresholdSturges = sturges;
857
+ exports$4.tickIncrement = tickIncrement;
858
+ exports$4.tickStep = tickStep;
859
+ exports$4.ticks = ticks;
860
+ exports$4.transpose = transpose;
861
+ exports$4.union = union;
862
+ exports$4.variance = variance;
863
+ exports$4.zip = zip;
864
+ Object.defineProperty(exports$4, "__esModule", { value: true });
865
+ }));
866
+ }));
867
+
868
+ //#endregion
869
+ //#region ../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/dist/d3-path.js
870
+ var require_d3_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
871
+ (function(global, factory) {
872
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = global || self, factory(global.d3 = global.d3 || {}));
873
+ })(exports, function(exports$3) {
874
+ "use strict";
875
+ var pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;
876
+ function Path() {
877
+ this._x0 = this._y0 = this._x1 = this._y1 = null;
878
+ this._ = "";
879
+ }
880
+ function path() {
881
+ return new Path();
882
+ }
883
+ Path.prototype = path.prototype = {
884
+ constructor: Path,
885
+ moveTo: function(x, y) {
886
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
887
+ },
888
+ closePath: function() {
889
+ if (this._x1 !== null) {
890
+ this._x1 = this._x0, this._y1 = this._y0;
891
+ this._ += "Z";
892
+ }
893
+ },
894
+ lineTo: function(x, y) {
895
+ this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
896
+ },
897
+ quadraticCurveTo: function(x1, y1, x, y) {
898
+ this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
899
+ },
900
+ bezierCurveTo: function(x1, y1, x2, y2, x, y) {
901
+ this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
902
+ },
903
+ arcTo: function(x1, y1, x2, y2, r) {
904
+ x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
905
+ 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;
906
+ if (r < 0) throw new Error("negative radius: " + r);
907
+ if (this._x1 === null) this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
908
+ else if (!(l01_2 > epsilon));
909
+ else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
910
+ else {
911
+ 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;
912
+ if (Math.abs(t01 - 1) > epsilon) this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
913
+ this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
914
+ }
915
+ },
916
+ arc: function(x, y, r, a0, a1, ccw) {
917
+ x = +x, y = +y, r = +r, ccw = !!ccw;
918
+ 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;
919
+ if (r < 0) throw new Error("negative radius: " + r);
920
+ if (this._x1 === null) this._ += "M" + x0 + "," + y0;
921
+ else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0;
922
+ if (!r) return;
923
+ if (da < 0) da = da % tau + tau;
924
+ 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);
925
+ 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));
926
+ },
927
+ rect: function(x, y, w, h) {
928
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
929
+ },
930
+ toString: function() {
931
+ return this._;
932
+ }
933
+ };
934
+ exports$3.path = path;
935
+ Object.defineProperty(exports$3, "__esModule", { value: true });
936
+ });
937
+ }));
938
+
939
+ //#endregion
940
+ //#region ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/dist/d3-shape.js
941
+ var require_d3_shape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
942
+ (function(global, factory) {
943
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require_d3_path()) : typeof define === "function" && define.amd ? define(["exports", "d3-path"], factory) : (global = global || self, factory(global.d3 = global.d3 || {}, global.d3));
944
+ })(exports, function(exports$2, d3Path) {
945
+ "use strict";
946
+ function constant(x) {
947
+ return function constant() {
948
+ return x;
949
+ };
950
+ }
951
+ var abs = Math.abs;
952
+ var atan2 = Math.atan2;
953
+ var cos = Math.cos;
954
+ var max = Math.max;
955
+ var min = Math.min;
956
+ var sin = Math.sin;
957
+ var sqrt = Math.sqrt;
958
+ var epsilon = 1e-12;
959
+ var pi = Math.PI;
960
+ var halfPi = pi / 2;
961
+ var tau = 2 * pi;
962
+ function acos(x) {
963
+ return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
964
+ }
965
+ function asin(x) {
966
+ return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
967
+ }
968
+ function arcInnerRadius(d) {
969
+ return d.innerRadius;
970
+ }
971
+ function arcOuterRadius(d) {
972
+ return d.outerRadius;
973
+ }
974
+ function arcStartAngle(d) {
975
+ return d.startAngle;
976
+ }
977
+ function arcEndAngle(d) {
978
+ return d.endAngle;
979
+ }
980
+ function arcPadAngle(d) {
981
+ return d && d.padAngle;
982
+ }
983
+ function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
984
+ var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
985
+ if (t * t < epsilon) return;
986
+ t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
987
+ return [x0 + t * x10, y0 + t * y10];
988
+ }
989
+ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
990
+ var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
991
+ if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
992
+ return {
993
+ cx: cx0,
994
+ cy: cy0,
995
+ x01: -ox,
996
+ y01: -oy,
997
+ x11: cx0 * (r1 / r - 1),
998
+ y11: cy0 * (r1 / r - 1)
999
+ };
1000
+ }
1001
+ function arc() {
1002
+ var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null;
1003
+ function arc() {
1004
+ var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
1005
+ if (!context) context = buffer = d3Path.path();
1006
+ if (r1 < r0) r = r1, r1 = r0, r0 = r;
1007
+ if (!(r1 > epsilon)) context.moveTo(0, 0);
1008
+ else if (da > tau - epsilon) {
1009
+ context.moveTo(r1 * cos(a0), r1 * sin(a0));
1010
+ context.arc(0, 0, r1, a0, a1, !cw);
1011
+ if (r0 > epsilon) {
1012
+ context.moveTo(r0 * cos(a1), r0 * sin(a1));
1013
+ context.arc(0, 0, r0, a1, a0, cw);
1014
+ }
1015
+ } else {
1016
+ var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
1017
+ if (rp > epsilon) {
1018
+ var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
1019
+ if ((da0 -= p0 * 2) > epsilon) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
1020
+ else da0 = 0, a00 = a10 = (a0 + a1) / 2;
1021
+ if ((da1 -= p1 * 2) > epsilon) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
1022
+ else da1 = 0, a01 = a11 = (a0 + a1) / 2;
1023
+ }
1024
+ var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
1025
+ if (rc > epsilon) {
1026
+ var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
1027
+ if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
1028
+ var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
1029
+ rc0 = min(rc, (r0 - lc) / (kc - 1));
1030
+ rc1 = min(rc, (r1 - lc) / (kc + 1));
1031
+ }
1032
+ }
1033
+ if (!(da1 > epsilon)) context.moveTo(x01, y01);
1034
+ else if (rc1 > epsilon) {
1035
+ t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
1036
+ t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
1037
+ context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
1038
+ if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
1039
+ else {
1040
+ context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
1041
+ context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
1042
+ context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
1043
+ }
1044
+ } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
1045
+ if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);
1046
+ else if (rc0 > epsilon) {
1047
+ t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
1048
+ t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
1049
+ context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
1050
+ if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
1051
+ else {
1052
+ context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
1053
+ context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
1054
+ context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
1055
+ }
1056
+ } else context.arc(0, 0, r0, a10, a00, cw);
1057
+ }
1058
+ context.closePath();
1059
+ if (buffer) return context = null, buffer + "" || null;
1060
+ }
1061
+ arc.centroid = function() {
1062
+ var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
1063
+ return [cos(a) * r, sin(a) * r];
1064
+ };
1065
+ arc.innerRadius = function(_) {
1066
+ return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
1067
+ };
1068
+ arc.outerRadius = function(_) {
1069
+ return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
1070
+ };
1071
+ arc.cornerRadius = function(_) {
1072
+ return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
1073
+ };
1074
+ arc.padRadius = function(_) {
1075
+ return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
1076
+ };
1077
+ arc.startAngle = function(_) {
1078
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
1079
+ };
1080
+ arc.endAngle = function(_) {
1081
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
1082
+ };
1083
+ arc.padAngle = function(_) {
1084
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
1085
+ };
1086
+ arc.context = function(_) {
1087
+ return arguments.length ? (context = _ == null ? null : _, arc) : context;
1088
+ };
1089
+ return arc;
1090
+ }
1091
+ function Linear(context) {
1092
+ this._context = context;
1093
+ }
1094
+ Linear.prototype = {
1095
+ areaStart: function() {
1096
+ this._line = 0;
1097
+ },
1098
+ areaEnd: function() {
1099
+ this._line = NaN;
1100
+ },
1101
+ lineStart: function() {
1102
+ this._point = 0;
1103
+ },
1104
+ lineEnd: function() {
1105
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
1106
+ this._line = 1 - this._line;
1107
+ },
1108
+ point: function(x, y) {
1109
+ x = +x, y = +y;
1110
+ switch (this._point) {
1111
+ case 0:
1112
+ this._point = 1;
1113
+ this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
1114
+ break;
1115
+ case 1: this._point = 2;
1116
+ default:
1117
+ this._context.lineTo(x, y);
1118
+ break;
1119
+ }
1120
+ }
1121
+ };
1122
+ function curveLinear(context) {
1123
+ return new Linear(context);
1124
+ }
1125
+ function x(p) {
1126
+ return p[0];
1127
+ }
1128
+ function y(p) {
1129
+ return p[1];
1130
+ }
1131
+ function line() {
1132
+ var x$1 = x, y$1 = y, defined = constant(true), context = null, curve = curveLinear, output = null;
1133
+ function line(data) {
1134
+ var i, n = data.length, d, defined0 = false, buffer;
1135
+ if (context == null) output = curve(buffer = d3Path.path());
1136
+ for (i = 0; i <= n; ++i) {
1137
+ if (!(i < n && defined(d = data[i], i, data)) === defined0) if (defined0 = !defined0) output.lineStart();
1138
+ else output.lineEnd();
1139
+ if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data));
1140
+ }
1141
+ if (buffer) return output = null, buffer + "" || null;
1142
+ }
1143
+ line.x = function(_) {
1144
+ return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), line) : x$1;
1145
+ };
1146
+ line.y = function(_) {
1147
+ return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line) : y$1;
1148
+ };
1149
+ line.defined = function(_) {
1150
+ return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined;
1151
+ };
1152
+ line.curve = function(_) {
1153
+ return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
1154
+ };
1155
+ line.context = function(_) {
1156
+ return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
1157
+ };
1158
+ return line;
1159
+ }
1160
+ function area() {
1161
+ var x0 = x, x1 = null, y0 = constant(0), y1 = y, defined = constant(true), context = null, curve = curveLinear, output = null;
1162
+ function area(data) {
1163
+ var i, j, k, n = data.length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n);
1164
+ if (context == null) output = curve(buffer = d3Path.path());
1165
+ for (i = 0; i <= n; ++i) {
1166
+ if (!(i < n && defined(d = data[i], i, data)) === defined0) if (defined0 = !defined0) {
1167
+ j = i;
1168
+ output.areaStart();
1169
+ output.lineStart();
1170
+ } else {
1171
+ output.lineEnd();
1172
+ output.lineStart();
1173
+ for (k = i - 1; k >= j; --k) output.point(x0z[k], y0z[k]);
1174
+ output.lineEnd();
1175
+ output.areaEnd();
1176
+ }
1177
+ if (defined0) {
1178
+ x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);
1179
+ output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);
1180
+ }
1181
+ }
1182
+ if (buffer) return output = null, buffer + "" || null;
1183
+ }
1184
+ function arealine() {
1185
+ return line().defined(defined).curve(curve).context(context);
1186
+ }
1187
+ area.x = function(_) {
1188
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0;
1189
+ };
1190
+ area.x0 = function(_) {
1191
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area) : x0;
1192
+ };
1193
+ area.x1 = function(_) {
1194
+ return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : x1;
1195
+ };
1196
+ area.y = function(_) {
1197
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0;
1198
+ };
1199
+ area.y0 = function(_) {
1200
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area) : y0;
1201
+ };
1202
+ area.y1 = function(_) {
1203
+ return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : y1;
1204
+ };
1205
+ area.lineX0 = area.lineY0 = function() {
1206
+ return arealine().x(x0).y(y0);
1207
+ };
1208
+ area.lineY1 = function() {
1209
+ return arealine().x(x0).y(y1);
1210
+ };
1211
+ area.lineX1 = function() {
1212
+ return arealine().x(x1).y(y0);
1213
+ };
1214
+ area.defined = function(_) {
1215
+ return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area) : defined;
1216
+ };
1217
+ area.curve = function(_) {
1218
+ return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
1219
+ };
1220
+ area.context = function(_) {
1221
+ return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
1222
+ };
1223
+ return area;
1224
+ }
1225
+ function descending(a, b) {
1226
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
1227
+ }
1228
+ function identity(d) {
1229
+ return d;
1230
+ }
1231
+ function pie() {
1232
+ var value = identity, sortValues = descending, sort = null, startAngle = constant(0), endAngle = constant(tau), padAngle = constant(0);
1233
+ function pie(data) {
1234
+ var i, n = data.length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
1235
+ for (i = 0; i < n; ++i) if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) sum += v;
1236
+ if (sortValues != null) index.sort(function(i, j) {
1237
+ return sortValues(arcs[i], arcs[j]);
1238
+ });
1239
+ else if (sort != null) index.sort(function(i, j) {
1240
+ return sort(data[i], data[j]);
1241
+ });
1242
+ for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
1243
+ data: data[j],
1244
+ index: i,
1245
+ value: v,
1246
+ startAngle: a0,
1247
+ endAngle: a1,
1248
+ padAngle: p
1249
+ };
1250
+ return arcs;
1251
+ }
1252
+ pie.value = function(_) {
1253
+ return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
1254
+ };
1255
+ pie.sortValues = function(_) {
1256
+ return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
1257
+ };
1258
+ pie.sort = function(_) {
1259
+ return arguments.length ? (sort = _, sortValues = null, pie) : sort;
1260
+ };
1261
+ pie.startAngle = function(_) {
1262
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
1263
+ };
1264
+ pie.endAngle = function(_) {
1265
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
1266
+ };
1267
+ pie.padAngle = function(_) {
1268
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
1269
+ };
1270
+ return pie;
1271
+ }
1272
+ var curveRadialLinear = curveRadial(curveLinear);
1273
+ function Radial(curve) {
1274
+ this._curve = curve;
1275
+ }
1276
+ Radial.prototype = {
1277
+ areaStart: function() {
1278
+ this._curve.areaStart();
1279
+ },
1280
+ areaEnd: function() {
1281
+ this._curve.areaEnd();
1282
+ },
1283
+ lineStart: function() {
1284
+ this._curve.lineStart();
1285
+ },
1286
+ lineEnd: function() {
1287
+ this._curve.lineEnd();
1288
+ },
1289
+ point: function(a, r) {
1290
+ this._curve.point(r * Math.sin(a), r * -Math.cos(a));
1291
+ }
1292
+ };
1293
+ function curveRadial(curve) {
1294
+ function radial(context) {
1295
+ return new Radial(curve(context));
1296
+ }
1297
+ radial._curve = curve;
1298
+ return radial;
1299
+ }
1300
+ function lineRadial(l) {
1301
+ var c = l.curve;
1302
+ l.angle = l.x, delete l.x;
1303
+ l.radius = l.y, delete l.y;
1304
+ l.curve = function(_) {
1305
+ return arguments.length ? c(curveRadial(_)) : c()._curve;
1306
+ };
1307
+ return l;
1308
+ }
1309
+ function lineRadial$1() {
1310
+ return lineRadial(line().curve(curveRadialLinear));
1311
+ }
1312
+ function areaRadial() {
1313
+ var a = area().curve(curveRadialLinear), c = a.curve, x0 = a.lineX0, x1 = a.lineX1, y0 = a.lineY0, y1 = a.lineY1;
1314
+ a.angle = a.x, delete a.x;
1315
+ a.startAngle = a.x0, delete a.x0;
1316
+ a.endAngle = a.x1, delete a.x1;
1317
+ a.radius = a.y, delete a.y;
1318
+ a.innerRadius = a.y0, delete a.y0;
1319
+ a.outerRadius = a.y1, delete a.y1;
1320
+ a.lineStartAngle = function() {
1321
+ return lineRadial(x0());
1322
+ }, delete a.lineX0;
1323
+ a.lineEndAngle = function() {
1324
+ return lineRadial(x1());
1325
+ }, delete a.lineX1;
1326
+ a.lineInnerRadius = function() {
1327
+ return lineRadial(y0());
1328
+ }, delete a.lineY0;
1329
+ a.lineOuterRadius = function() {
1330
+ return lineRadial(y1());
1331
+ }, delete a.lineY1;
1332
+ a.curve = function(_) {
1333
+ return arguments.length ? c(curveRadial(_)) : c()._curve;
1334
+ };
1335
+ return a;
1336
+ }
1337
+ function pointRadial(x, y) {
1338
+ return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
1339
+ }
1340
+ var slice = Array.prototype.slice;
1341
+ function linkSource(d) {
1342
+ return d.source;
1343
+ }
1344
+ function linkTarget(d) {
1345
+ return d.target;
1346
+ }
1347
+ function link(curve) {
1348
+ var source = linkSource, target = linkTarget, x$1 = x, y$1 = y, context = null;
1349
+ function link() {
1350
+ var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
1351
+ if (!context) context = buffer = d3Path.path();
1352
+ 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));
1353
+ if (buffer) return context = null, buffer + "" || null;
1354
+ }
1355
+ link.source = function(_) {
1356
+ return arguments.length ? (source = _, link) : source;
1357
+ };
1358
+ link.target = function(_) {
1359
+ return arguments.length ? (target = _, link) : target;
1360
+ };
1361
+ link.x = function(_) {
1362
+ return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), link) : x$1;
1363
+ };
1364
+ link.y = function(_) {
1365
+ return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), link) : y$1;
1366
+ };
1367
+ link.context = function(_) {
1368
+ return arguments.length ? (context = _ == null ? null : _, link) : context;
1369
+ };
1370
+ return link;
1371
+ }
1372
+ function curveHorizontal(context, x0, y0, x1, y1) {
1373
+ context.moveTo(x0, y0);
1374
+ context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
1375
+ }
1376
+ function curveVertical(context, x0, y0, x1, y1) {
1377
+ context.moveTo(x0, y0);
1378
+ context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
1379
+ }
1380
+ function curveRadial$1(context, x0, y0, x1, y1) {
1381
+ var p0 = pointRadial(x0, y0), p1 = pointRadial(x0, y0 = (y0 + y1) / 2), p2 = pointRadial(x1, y0), p3 = pointRadial(x1, y1);
1382
+ context.moveTo(p0[0], p0[1]);
1383
+ context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
1384
+ }
1385
+ function linkHorizontal() {
1386
+ return link(curveHorizontal);
1387
+ }
1388
+ function linkVertical() {
1389
+ return link(curveVertical);
1390
+ }
1391
+ function linkRadial() {
1392
+ var l = link(curveRadial$1);
1393
+ l.angle = l.x, delete l.x;
1394
+ l.radius = l.y, delete l.y;
1395
+ return l;
1396
+ }
1397
+ var circle = { draw: function(context, size) {
1398
+ var r = Math.sqrt(size / pi);
1399
+ context.moveTo(r, 0);
1400
+ context.arc(0, 0, r, 0, tau);
1401
+ } };
1402
+ var cross = { draw: function(context, size) {
1403
+ var r = Math.sqrt(size / 5) / 2;
1404
+ context.moveTo(-3 * r, -r);
1405
+ context.lineTo(-r, -r);
1406
+ context.lineTo(-r, -3 * r);
1407
+ context.lineTo(r, -3 * r);
1408
+ context.lineTo(r, -r);
1409
+ context.lineTo(3 * r, -r);
1410
+ context.lineTo(3 * r, r);
1411
+ context.lineTo(r, r);
1412
+ context.lineTo(r, 3 * r);
1413
+ context.lineTo(-r, 3 * r);
1414
+ context.lineTo(-r, r);
1415
+ context.lineTo(-3 * r, r);
1416
+ context.closePath();
1417
+ } };
1418
+ var tan30 = Math.sqrt(1 / 3), tan30_2 = tan30 * 2;
1419
+ var diamond = { draw: function(context, size) {
1420
+ var y = Math.sqrt(size / tan30_2), x = y * tan30;
1421
+ context.moveTo(0, -y);
1422
+ context.lineTo(x, 0);
1423
+ context.lineTo(0, y);
1424
+ context.lineTo(-x, 0);
1425
+ context.closePath();
1426
+ } };
1427
+ var ka = .8908130915292852, kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10), kx = Math.sin(tau / 10) * kr, ky = -Math.cos(tau / 10) * kr;
1428
+ var star = { draw: function(context, size) {
1429
+ var r = Math.sqrt(size * ka), x = kx * r, y = ky * r;
1430
+ context.moveTo(0, -r);
1431
+ context.lineTo(x, y);
1432
+ for (var i = 1; i < 5; ++i) {
1433
+ var a = tau * i / 5, c = Math.cos(a), s = Math.sin(a);
1434
+ context.lineTo(s * r, -c * r);
1435
+ context.lineTo(c * x - s * y, s * x + c * y);
1436
+ }
1437
+ context.closePath();
1438
+ } };
1439
+ var square = { draw: function(context, size) {
1440
+ var w = Math.sqrt(size), x = -w / 2;
1441
+ context.rect(x, x, w, w);
1442
+ } };
1443
+ var sqrt3 = Math.sqrt(3);
1444
+ var triangle = { draw: function(context, size) {
1445
+ var y = -Math.sqrt(size / (sqrt3 * 3));
1446
+ context.moveTo(0, y * 2);
1447
+ context.lineTo(-sqrt3 * y, -y);
1448
+ context.lineTo(sqrt3 * y, -y);
1449
+ context.closePath();
1450
+ } };
1451
+ var c = -.5, s = Math.sqrt(3) / 2, k = 1 / Math.sqrt(12), a = (k / 2 + 1) * 3;
1452
+ var wye = { draw: function(context, size) {
1453
+ var r = Math.sqrt(size / a), x0 = r / 2, y0 = r * k, x1 = x0, y1 = r * k + r, x2 = -x1, y2 = y1;
1454
+ context.moveTo(x0, y0);
1455
+ context.lineTo(x1, y1);
1456
+ context.lineTo(x2, y2);
1457
+ context.lineTo(c * x0 - s * y0, s * x0 + c * y0);
1458
+ context.lineTo(c * x1 - s * y1, s * x1 + c * y1);
1459
+ context.lineTo(c * x2 - s * y2, s * x2 + c * y2);
1460
+ context.lineTo(c * x0 + s * y0, c * y0 - s * x0);
1461
+ context.lineTo(c * x1 + s * y1, c * y1 - s * x1);
1462
+ context.lineTo(c * x2 + s * y2, c * y2 - s * x2);
1463
+ context.closePath();
1464
+ } };
1465
+ var symbols = [
1466
+ circle,
1467
+ cross,
1468
+ diamond,
1469
+ square,
1470
+ star,
1471
+ triangle,
1472
+ wye
1473
+ ];
1474
+ function symbol() {
1475
+ var type = constant(circle), size = constant(64), context = null;
1476
+ function symbol() {
1477
+ var buffer;
1478
+ if (!context) context = buffer = d3Path.path();
1479
+ type.apply(this, arguments).draw(context, +size.apply(this, arguments));
1480
+ if (buffer) return context = null, buffer + "" || null;
1481
+ }
1482
+ symbol.type = function(_) {
1483
+ return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type;
1484
+ };
1485
+ symbol.size = function(_) {
1486
+ return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size;
1487
+ };
1488
+ symbol.context = function(_) {
1489
+ return arguments.length ? (context = _ == null ? null : _, symbol) : context;
1490
+ };
1491
+ return symbol;
1492
+ }
1493
+ function noop() {}
1494
+ function point(that, x, y) {
1495
+ that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6);
1496
+ }
1497
+ function Basis(context) {
1498
+ this._context = context;
1499
+ }
1500
+ Basis.prototype = {
1501
+ areaStart: function() {
1502
+ this._line = 0;
1503
+ },
1504
+ areaEnd: function() {
1505
+ this._line = NaN;
1506
+ },
1507
+ lineStart: function() {
1508
+ this._x0 = this._x1 = this._y0 = this._y1 = NaN;
1509
+ this._point = 0;
1510
+ },
1511
+ lineEnd: function() {
1512
+ switch (this._point) {
1513
+ case 3: point(this, this._x1, this._y1);
1514
+ case 2:
1515
+ this._context.lineTo(this._x1, this._y1);
1516
+ break;
1517
+ }
1518
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
1519
+ this._line = 1 - this._line;
1520
+ },
1521
+ point: function(x, y) {
1522
+ x = +x, y = +y;
1523
+ switch (this._point) {
1524
+ case 0:
1525
+ this._point = 1;
1526
+ this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
1527
+ break;
1528
+ case 1:
1529
+ this._point = 2;
1530
+ break;
1531
+ case 2:
1532
+ this._point = 3;
1533
+ this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
1534
+ default:
1535
+ point(this, x, y);
1536
+ break;
1537
+ }
1538
+ this._x0 = this._x1, this._x1 = x;
1539
+ this._y0 = this._y1, this._y1 = y;
1540
+ }
1541
+ };
1542
+ function basis(context) {
1543
+ return new Basis(context);
1544
+ }
1545
+ function BasisClosed(context) {
1546
+ this._context = context;
1547
+ }
1548
+ BasisClosed.prototype = {
1549
+ areaStart: noop,
1550
+ areaEnd: noop,
1551
+ lineStart: function() {
1552
+ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
1553
+ this._point = 0;
1554
+ },
1555
+ lineEnd: function() {
1556
+ switch (this._point) {
1557
+ case 1:
1558
+ this._context.moveTo(this._x2, this._y2);
1559
+ this._context.closePath();
1560
+ break;
1561
+ case 2:
1562
+ this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
1563
+ this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
1564
+ this._context.closePath();
1565
+ break;
1566
+ case 3:
1567
+ this.point(this._x2, this._y2);
1568
+ this.point(this._x3, this._y3);
1569
+ this.point(this._x4, this._y4);
1570
+ break;
1571
+ }
1572
+ },
1573
+ point: function(x, y) {
1574
+ x = +x, y = +y;
1575
+ switch (this._point) {
1576
+ case 0:
1577
+ this._point = 1;
1578
+ this._x2 = x, this._y2 = y;
1579
+ break;
1580
+ case 1:
1581
+ this._point = 2;
1582
+ this._x3 = x, this._y3 = y;
1583
+ break;
1584
+ case 2:
1585
+ this._point = 3;
1586
+ this._x4 = x, this._y4 = y;
1587
+ this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6);
1588
+ break;
1589
+ default:
1590
+ point(this, x, y);
1591
+ break;
1592
+ }
1593
+ this._x0 = this._x1, this._x1 = x;
1594
+ this._y0 = this._y1, this._y1 = y;
1595
+ }
1596
+ };
1597
+ function basisClosed(context) {
1598
+ return new BasisClosed(context);
1599
+ }
1600
+ function BasisOpen(context) {
1601
+ this._context = context;
1602
+ }
1603
+ BasisOpen.prototype = {
1604
+ areaStart: function() {
1605
+ this._line = 0;
1606
+ },
1607
+ areaEnd: function() {
1608
+ this._line = NaN;
1609
+ },
1610
+ lineStart: function() {
1611
+ this._x0 = this._x1 = this._y0 = this._y1 = NaN;
1612
+ this._point = 0;
1613
+ },
1614
+ lineEnd: function() {
1615
+ if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
1616
+ this._line = 1 - this._line;
1617
+ },
1618
+ point: function(x, y) {
1619
+ x = +x, y = +y;
1620
+ switch (this._point) {
1621
+ case 0:
1622
+ this._point = 1;
1623
+ break;
1624
+ case 1:
1625
+ this._point = 2;
1626
+ break;
1627
+ case 2:
1628
+ this._point = 3;
1629
+ var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6;
1630
+ this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0);
1631
+ break;
1632
+ case 3: this._point = 4;
1633
+ default:
1634
+ point(this, x, y);
1635
+ break;
1636
+ }
1637
+ this._x0 = this._x1, this._x1 = x;
1638
+ this._y0 = this._y1, this._y1 = y;
1639
+ }
1640
+ };
1641
+ function basisOpen(context) {
1642
+ return new BasisOpen(context);
1643
+ }
1644
+ function Bundle(context, beta) {
1645
+ this._basis = new Basis(context);
1646
+ this._beta = beta;
1647
+ }
1648
+ Bundle.prototype = {
1649
+ lineStart: function() {
1650
+ this._x = [];
1651
+ this._y = [];
1652
+ this._basis.lineStart();
1653
+ },
1654
+ lineEnd: function() {
1655
+ var x = this._x, y = this._y, j = x.length - 1;
1656
+ if (j > 0) {
1657
+ var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t;
1658
+ while (++i <= j) {
1659
+ t = i / j;
1660
+ this._basis.point(this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy));
1661
+ }
1662
+ }
1663
+ this._x = this._y = null;
1664
+ this._basis.lineEnd();
1665
+ },
1666
+ point: function(x, y) {
1667
+ this._x.push(+x);
1668
+ this._y.push(+y);
1669
+ }
1670
+ };
1671
+ var bundle = (function custom(beta) {
1672
+ function bundle(context) {
1673
+ return beta === 1 ? new Basis(context) : new Bundle(context, beta);
1674
+ }
1675
+ bundle.beta = function(beta) {
1676
+ return custom(+beta);
1677
+ };
1678
+ return bundle;
1679
+ })(.85);
1680
+ function point$1(that, x, y) {
1681
+ that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2);
1682
+ }
1683
+ function Cardinal(context, tension) {
1684
+ this._context = context;
1685
+ this._k = (1 - tension) / 6;
1686
+ }
1687
+ Cardinal.prototype = {
1688
+ areaStart: function() {
1689
+ this._line = 0;
1690
+ },
1691
+ areaEnd: function() {
1692
+ this._line = NaN;
1693
+ },
1694
+ lineStart: function() {
1695
+ this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
1696
+ this._point = 0;
1697
+ },
1698
+ lineEnd: function() {
1699
+ switch (this._point) {
1700
+ case 2:
1701
+ this._context.lineTo(this._x2, this._y2);
1702
+ break;
1703
+ case 3:
1704
+ point$1(this, this._x1, this._y1);
1705
+ break;
1706
+ }
1707
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
1708
+ this._line = 1 - this._line;
1709
+ },
1710
+ point: function(x, y) {
1711
+ x = +x, y = +y;
1712
+ switch (this._point) {
1713
+ case 0:
1714
+ this._point = 1;
1715
+ this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
1716
+ break;
1717
+ case 1:
1718
+ this._point = 2;
1719
+ this._x1 = x, this._y1 = y;
1720
+ break;
1721
+ case 2: this._point = 3;
1722
+ default:
1723
+ point$1(this, x, y);
1724
+ break;
1725
+ }
1726
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
1727
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
1728
+ }
1729
+ };
1730
+ var cardinal = (function custom(tension) {
1731
+ function cardinal(context) {
1732
+ return new Cardinal(context, tension);
1733
+ }
1734
+ cardinal.tension = function(tension) {
1735
+ return custom(+tension);
1736
+ };
1737
+ return cardinal;
1738
+ })(0);
1739
+ function CardinalClosed(context, tension) {
1740
+ this._context = context;
1741
+ this._k = (1 - tension) / 6;
1742
+ }
1743
+ CardinalClosed.prototype = {
1744
+ areaStart: noop,
1745
+ areaEnd: noop,
1746
+ lineStart: function() {
1747
+ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
1748
+ this._point = 0;
1749
+ },
1750
+ lineEnd: function() {
1751
+ switch (this._point) {
1752
+ case 1:
1753
+ this._context.moveTo(this._x3, this._y3);
1754
+ this._context.closePath();
1755
+ break;
1756
+ case 2:
1757
+ this._context.lineTo(this._x3, this._y3);
1758
+ this._context.closePath();
1759
+ break;
1760
+ case 3:
1761
+ this.point(this._x3, this._y3);
1762
+ this.point(this._x4, this._y4);
1763
+ this.point(this._x5, this._y5);
1764
+ break;
1765
+ }
1766
+ },
1767
+ point: function(x, y) {
1768
+ x = +x, y = +y;
1769
+ switch (this._point) {
1770
+ case 0:
1771
+ this._point = 1;
1772
+ this._x3 = x, this._y3 = y;
1773
+ break;
1774
+ case 1:
1775
+ this._point = 2;
1776
+ this._context.moveTo(this._x4 = x, this._y4 = y);
1777
+ break;
1778
+ case 2:
1779
+ this._point = 3;
1780
+ this._x5 = x, this._y5 = y;
1781
+ break;
1782
+ default:
1783
+ point$1(this, x, y);
1784
+ break;
1785
+ }
1786
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
1787
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
1788
+ }
1789
+ };
1790
+ var cardinalClosed = (function custom(tension) {
1791
+ function cardinal(context) {
1792
+ return new CardinalClosed(context, tension);
1793
+ }
1794
+ cardinal.tension = function(tension) {
1795
+ return custom(+tension);
1796
+ };
1797
+ return cardinal;
1798
+ })(0);
1799
+ function CardinalOpen(context, tension) {
1800
+ this._context = context;
1801
+ this._k = (1 - tension) / 6;
1802
+ }
1803
+ CardinalOpen.prototype = {
1804
+ areaStart: function() {
1805
+ this._line = 0;
1806
+ },
1807
+ areaEnd: function() {
1808
+ this._line = NaN;
1809
+ },
1810
+ lineStart: function() {
1811
+ this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
1812
+ this._point = 0;
1813
+ },
1814
+ lineEnd: function() {
1815
+ if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
1816
+ this._line = 1 - this._line;
1817
+ },
1818
+ point: function(x, y) {
1819
+ x = +x, y = +y;
1820
+ switch (this._point) {
1821
+ case 0:
1822
+ this._point = 1;
1823
+ break;
1824
+ case 1:
1825
+ this._point = 2;
1826
+ break;
1827
+ case 2:
1828
+ this._point = 3;
1829
+ this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
1830
+ break;
1831
+ case 3: this._point = 4;
1832
+ default:
1833
+ point$1(this, x, y);
1834
+ break;
1835
+ }
1836
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
1837
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
1838
+ }
1839
+ };
1840
+ var cardinalOpen = (function custom(tension) {
1841
+ function cardinal(context) {
1842
+ return new CardinalOpen(context, tension);
1843
+ }
1844
+ cardinal.tension = function(tension) {
1845
+ return custom(+tension);
1846
+ };
1847
+ return cardinal;
1848
+ })(0);
1849
+ function point$2(that, x, y) {
1850
+ var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2;
1851
+ if (that._l01_a > epsilon) {
1852
+ var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a);
1853
+ x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
1854
+ y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
1855
+ }
1856
+ if (that._l23_a > epsilon) {
1857
+ var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a);
1858
+ x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
1859
+ y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
1860
+ }
1861
+ that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
1862
+ }
1863
+ function CatmullRom(context, alpha) {
1864
+ this._context = context;
1865
+ this._alpha = alpha;
1866
+ }
1867
+ CatmullRom.prototype = {
1868
+ areaStart: function() {
1869
+ this._line = 0;
1870
+ },
1871
+ areaEnd: function() {
1872
+ this._line = NaN;
1873
+ },
1874
+ lineStart: function() {
1875
+ this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
1876
+ this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
1877
+ },
1878
+ lineEnd: function() {
1879
+ switch (this._point) {
1880
+ case 2:
1881
+ this._context.lineTo(this._x2, this._y2);
1882
+ break;
1883
+ case 3:
1884
+ this.point(this._x2, this._y2);
1885
+ break;
1886
+ }
1887
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
1888
+ this._line = 1 - this._line;
1889
+ },
1890
+ point: function(x, y) {
1891
+ x = +x, y = +y;
1892
+ if (this._point) {
1893
+ var x23 = this._x2 - x, y23 = this._y2 - y;
1894
+ this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
1895
+ }
1896
+ switch (this._point) {
1897
+ case 0:
1898
+ this._point = 1;
1899
+ this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
1900
+ break;
1901
+ case 1:
1902
+ this._point = 2;
1903
+ break;
1904
+ case 2: this._point = 3;
1905
+ default:
1906
+ point$2(this, x, y);
1907
+ break;
1908
+ }
1909
+ this._l01_a = this._l12_a, this._l12_a = this._l23_a;
1910
+ this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
1911
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
1912
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
1913
+ }
1914
+ };
1915
+ var catmullRom = (function custom(alpha) {
1916
+ function catmullRom(context) {
1917
+ return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
1918
+ }
1919
+ catmullRom.alpha = function(alpha) {
1920
+ return custom(+alpha);
1921
+ };
1922
+ return catmullRom;
1923
+ })(.5);
1924
+ function CatmullRomClosed(context, alpha) {
1925
+ this._context = context;
1926
+ this._alpha = alpha;
1927
+ }
1928
+ CatmullRomClosed.prototype = {
1929
+ areaStart: noop,
1930
+ areaEnd: noop,
1931
+ lineStart: function() {
1932
+ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
1933
+ this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
1934
+ },
1935
+ lineEnd: function() {
1936
+ switch (this._point) {
1937
+ case 1:
1938
+ this._context.moveTo(this._x3, this._y3);
1939
+ this._context.closePath();
1940
+ break;
1941
+ case 2:
1942
+ this._context.lineTo(this._x3, this._y3);
1943
+ this._context.closePath();
1944
+ break;
1945
+ case 3:
1946
+ this.point(this._x3, this._y3);
1947
+ this.point(this._x4, this._y4);
1948
+ this.point(this._x5, this._y5);
1949
+ break;
1950
+ }
1951
+ },
1952
+ point: function(x, y) {
1953
+ x = +x, y = +y;
1954
+ if (this._point) {
1955
+ var x23 = this._x2 - x, y23 = this._y2 - y;
1956
+ this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
1957
+ }
1958
+ switch (this._point) {
1959
+ case 0:
1960
+ this._point = 1;
1961
+ this._x3 = x, this._y3 = y;
1962
+ break;
1963
+ case 1:
1964
+ this._point = 2;
1965
+ this._context.moveTo(this._x4 = x, this._y4 = y);
1966
+ break;
1967
+ case 2:
1968
+ this._point = 3;
1969
+ this._x5 = x, this._y5 = y;
1970
+ break;
1971
+ default:
1972
+ point$2(this, x, y);
1973
+ break;
1974
+ }
1975
+ this._l01_a = this._l12_a, this._l12_a = this._l23_a;
1976
+ this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
1977
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
1978
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
1979
+ }
1980
+ };
1981
+ var catmullRomClosed = (function custom(alpha) {
1982
+ function catmullRom(context) {
1983
+ return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
1984
+ }
1985
+ catmullRom.alpha = function(alpha) {
1986
+ return custom(+alpha);
1987
+ };
1988
+ return catmullRom;
1989
+ })(.5);
1990
+ function CatmullRomOpen(context, alpha) {
1991
+ this._context = context;
1992
+ this._alpha = alpha;
1993
+ }
1994
+ CatmullRomOpen.prototype = {
1995
+ areaStart: function() {
1996
+ this._line = 0;
1997
+ },
1998
+ areaEnd: function() {
1999
+ this._line = NaN;
2000
+ },
2001
+ lineStart: function() {
2002
+ this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
2003
+ this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
2004
+ },
2005
+ lineEnd: function() {
2006
+ if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
2007
+ this._line = 1 - this._line;
2008
+ },
2009
+ point: function(x, y) {
2010
+ x = +x, y = +y;
2011
+ if (this._point) {
2012
+ var x23 = this._x2 - x, y23 = this._y2 - y;
2013
+ this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
2014
+ }
2015
+ switch (this._point) {
2016
+ case 0:
2017
+ this._point = 1;
2018
+ break;
2019
+ case 1:
2020
+ this._point = 2;
2021
+ break;
2022
+ case 2:
2023
+ this._point = 3;
2024
+ this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
2025
+ break;
2026
+ case 3: this._point = 4;
2027
+ default:
2028
+ point$2(this, x, y);
2029
+ break;
2030
+ }
2031
+ this._l01_a = this._l12_a, this._l12_a = this._l23_a;
2032
+ this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
2033
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
2034
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
2035
+ }
2036
+ };
2037
+ var catmullRomOpen = (function custom(alpha) {
2038
+ function catmullRom(context) {
2039
+ return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
2040
+ }
2041
+ catmullRom.alpha = function(alpha) {
2042
+ return custom(+alpha);
2043
+ };
2044
+ return catmullRom;
2045
+ })(.5);
2046
+ function LinearClosed(context) {
2047
+ this._context = context;
2048
+ }
2049
+ LinearClosed.prototype = {
2050
+ areaStart: noop,
2051
+ areaEnd: noop,
2052
+ lineStart: function() {
2053
+ this._point = 0;
2054
+ },
2055
+ lineEnd: function() {
2056
+ if (this._point) this._context.closePath();
2057
+ },
2058
+ point: function(x, y) {
2059
+ x = +x, y = +y;
2060
+ if (this._point) this._context.lineTo(x, y);
2061
+ else this._point = 1, this._context.moveTo(x, y);
2062
+ }
2063
+ };
2064
+ function linearClosed(context) {
2065
+ return new LinearClosed(context);
2066
+ }
2067
+ function sign(x) {
2068
+ return x < 0 ? -1 : 1;
2069
+ }
2070
+ function slope3(that, x2, y2) {
2071
+ var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1);
2072
+ return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), .5 * Math.abs(p)) || 0;
2073
+ }
2074
+ function slope2(that, t) {
2075
+ var h = that._x1 - that._x0;
2076
+ return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
2077
+ }
2078
+ function point$3(that, t0, t1) {
2079
+ var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3;
2080
+ that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
2081
+ }
2082
+ function MonotoneX(context) {
2083
+ this._context = context;
2084
+ }
2085
+ MonotoneX.prototype = {
2086
+ areaStart: function() {
2087
+ this._line = 0;
2088
+ },
2089
+ areaEnd: function() {
2090
+ this._line = NaN;
2091
+ },
2092
+ lineStart: function() {
2093
+ this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;
2094
+ this._point = 0;
2095
+ },
2096
+ lineEnd: function() {
2097
+ switch (this._point) {
2098
+ case 2:
2099
+ this._context.lineTo(this._x1, this._y1);
2100
+ break;
2101
+ case 3:
2102
+ point$3(this, this._t0, slope2(this, this._t0));
2103
+ break;
2104
+ }
2105
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
2106
+ this._line = 1 - this._line;
2107
+ },
2108
+ point: function(x, y) {
2109
+ var t1 = NaN;
2110
+ x = +x, y = +y;
2111
+ if (x === this._x1 && y === this._y1) return;
2112
+ switch (this._point) {
2113
+ case 0:
2114
+ this._point = 1;
2115
+ this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
2116
+ break;
2117
+ case 1:
2118
+ this._point = 2;
2119
+ break;
2120
+ case 2:
2121
+ this._point = 3;
2122
+ point$3(this, slope2(this, t1 = slope3(this, x, y)), t1);
2123
+ break;
2124
+ default:
2125
+ point$3(this, this._t0, t1 = slope3(this, x, y));
2126
+ break;
2127
+ }
2128
+ this._x0 = this._x1, this._x1 = x;
2129
+ this._y0 = this._y1, this._y1 = y;
2130
+ this._t0 = t1;
2131
+ }
2132
+ };
2133
+ function MonotoneY(context) {
2134
+ this._context = new ReflectContext(context);
2135
+ }
2136
+ (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
2137
+ MonotoneX.prototype.point.call(this, y, x);
2138
+ };
2139
+ function ReflectContext(context) {
2140
+ this._context = context;
2141
+ }
2142
+ ReflectContext.prototype = {
2143
+ moveTo: function(x, y) {
2144
+ this._context.moveTo(y, x);
2145
+ },
2146
+ closePath: function() {
2147
+ this._context.closePath();
2148
+ },
2149
+ lineTo: function(x, y) {
2150
+ this._context.lineTo(y, x);
2151
+ },
2152
+ bezierCurveTo: function(x1, y1, x2, y2, x, y) {
2153
+ this._context.bezierCurveTo(y1, x1, y2, x2, y, x);
2154
+ }
2155
+ };
2156
+ function monotoneX(context) {
2157
+ return new MonotoneX(context);
2158
+ }
2159
+ function monotoneY(context) {
2160
+ return new MonotoneY(context);
2161
+ }
2162
+ function Natural(context) {
2163
+ this._context = context;
2164
+ }
2165
+ Natural.prototype = {
2166
+ areaStart: function() {
2167
+ this._line = 0;
2168
+ },
2169
+ areaEnd: function() {
2170
+ this._line = NaN;
2171
+ },
2172
+ lineStart: function() {
2173
+ this._x = [];
2174
+ this._y = [];
2175
+ },
2176
+ lineEnd: function() {
2177
+ var x = this._x, y = this._y, n = x.length;
2178
+ if (n) {
2179
+ this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
2180
+ if (n === 2) this._context.lineTo(x[1], y[1]);
2181
+ else {
2182
+ var px = controlPoints(x), py = controlPoints(y);
2183
+ for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
2184
+ }
2185
+ }
2186
+ if (this._line || this._line !== 0 && n === 1) this._context.closePath();
2187
+ this._line = 1 - this._line;
2188
+ this._x = this._y = null;
2189
+ },
2190
+ point: function(x, y) {
2191
+ this._x.push(+x);
2192
+ this._y.push(+y);
2193
+ }
2194
+ };
2195
+ function controlPoints(x) {
2196
+ var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n);
2197
+ a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
2198
+ for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
2199
+ a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
2200
+ for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
2201
+ a[n - 1] = r[n - 1] / b[n - 1];
2202
+ for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];
2203
+ b[n - 1] = (x[n] + a[n - 1]) / 2;
2204
+ for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
2205
+ return [a, b];
2206
+ }
2207
+ function natural(context) {
2208
+ return new Natural(context);
2209
+ }
2210
+ function Step(context, t) {
2211
+ this._context = context;
2212
+ this._t = t;
2213
+ }
2214
+ Step.prototype = {
2215
+ areaStart: function() {
2216
+ this._line = 0;
2217
+ },
2218
+ areaEnd: function() {
2219
+ this._line = NaN;
2220
+ },
2221
+ lineStart: function() {
2222
+ this._x = this._y = NaN;
2223
+ this._point = 0;
2224
+ },
2225
+ lineEnd: function() {
2226
+ if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
2227
+ if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
2228
+ if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
2229
+ },
2230
+ point: function(x, y) {
2231
+ x = +x, y = +y;
2232
+ switch (this._point) {
2233
+ case 0:
2234
+ this._point = 1;
2235
+ this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
2236
+ break;
2237
+ case 1: this._point = 2;
2238
+ default:
2239
+ if (this._t <= 0) {
2240
+ this._context.lineTo(this._x, y);
2241
+ this._context.lineTo(x, y);
2242
+ } else {
2243
+ var x1 = this._x * (1 - this._t) + x * this._t;
2244
+ this._context.lineTo(x1, this._y);
2245
+ this._context.lineTo(x1, y);
2246
+ }
2247
+ break;
2248
+ }
2249
+ this._x = x, this._y = y;
2250
+ }
2251
+ };
2252
+ function step(context) {
2253
+ return new Step(context, .5);
2254
+ }
2255
+ function stepBefore(context) {
2256
+ return new Step(context, 0);
2257
+ }
2258
+ function stepAfter(context) {
2259
+ return new Step(context, 1);
2260
+ }
2261
+ function none(series, order) {
2262
+ if (!((n = series.length) > 1)) return;
2263
+ for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
2264
+ s0 = s1, s1 = series[order[i]];
2265
+ for (j = 0; j < m; ++j) s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
2266
+ }
2267
+ }
2268
+ function none$1(series) {
2269
+ var n = series.length, o = new Array(n);
2270
+ while (--n >= 0) o[n] = n;
2271
+ return o;
2272
+ }
2273
+ function stackValue(d, key) {
2274
+ return d[key];
2275
+ }
2276
+ function stack() {
2277
+ var keys = constant([]), order = none$1, offset = none, value = stackValue;
2278
+ function stack(data) {
2279
+ var kz = keys.apply(this, arguments), i, m = data.length, n = kz.length, sz = new Array(n), oz;
2280
+ for (i = 0; i < n; ++i) {
2281
+ for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {
2282
+ si[j] = sij = [0, +value(data[j], ki, j, data)];
2283
+ sij.data = data[j];
2284
+ }
2285
+ si.key = ki;
2286
+ }
2287
+ for (i = 0, oz = order(sz); i < n; ++i) sz[oz[i]].index = i;
2288
+ offset(sz, oz);
2289
+ return sz;
2290
+ }
2291
+ stack.keys = function(_) {
2292
+ return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice.call(_)), stack) : keys;
2293
+ };
2294
+ stack.value = function(_) {
2295
+ return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value;
2296
+ };
2297
+ stack.order = function(_) {
2298
+ return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant(slice.call(_)), stack) : order;
2299
+ };
2300
+ stack.offset = function(_) {
2301
+ return arguments.length ? (offset = _ == null ? none : _, stack) : offset;
2302
+ };
2303
+ return stack;
2304
+ }
2305
+ function expand(series, order) {
2306
+ if (!((n = series.length) > 0)) return;
2307
+ for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {
2308
+ for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;
2309
+ if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
2310
+ }
2311
+ none(series, order);
2312
+ }
2313
+ function diverging(series, order) {
2314
+ if (!((n = series.length) > 0)) return;
2315
+ for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) for (yp = yn = 0, i = 0; i < n; ++i) if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) d[0] = yp, d[1] = yp += dy;
2316
+ else if (dy < 0) d[1] = yn, d[0] = yn += dy;
2317
+ else d[0] = 0, d[1] = dy;
2318
+ }
2319
+ function silhouette(series, order) {
2320
+ if (!((n = series.length) > 0)) return;
2321
+ for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {
2322
+ for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;
2323
+ s0[j][1] += s0[j][0] = -y / 2;
2324
+ }
2325
+ none(series, order);
2326
+ }
2327
+ function wiggle(series, order) {
2328
+ if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;
2329
+ for (var y = 0, j = 1, s0, m, n; j < m; ++j) {
2330
+ for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
2331
+ var si = series[order[i]], sij0 = si[j][1] || 0, s3 = (sij0 - (si[j - 1][1] || 0)) / 2;
2332
+ for (var k = 0; k < i; ++k) {
2333
+ var sk = series[order[k]], skj0 = sk[j][1] || 0, skj1 = sk[j - 1][1] || 0;
2334
+ s3 += skj0 - skj1;
2335
+ }
2336
+ s1 += sij0, s2 += s3 * sij0;
2337
+ }
2338
+ s0[j - 1][1] += s0[j - 1][0] = y;
2339
+ if (s1) y -= s2 / s1;
2340
+ }
2341
+ s0[j - 1][1] += s0[j - 1][0] = y;
2342
+ none(series, order);
2343
+ }
2344
+ function appearance(series) {
2345
+ var peaks = series.map(peak);
2346
+ return none$1(series).sort(function(a, b) {
2347
+ return peaks[a] - peaks[b];
2348
+ });
2349
+ }
2350
+ function peak(series) {
2351
+ var i = -1, j = 0, n = series.length, vi, vj = -Infinity;
2352
+ while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;
2353
+ return j;
2354
+ }
2355
+ function ascending(series) {
2356
+ var sums = series.map(sum);
2357
+ return none$1(series).sort(function(a, b) {
2358
+ return sums[a] - sums[b];
2359
+ });
2360
+ }
2361
+ function sum(series) {
2362
+ var s = 0, i = -1, n = series.length, v;
2363
+ while (++i < n) if (v = +series[i][1]) s += v;
2364
+ return s;
2365
+ }
2366
+ function descending$1(series) {
2367
+ return ascending(series).reverse();
2368
+ }
2369
+ function insideOut(series) {
2370
+ var n = series.length, i, j, sums = series.map(sum), order = appearance(series), top = 0, bottom = 0, tops = [], bottoms = [];
2371
+ for (i = 0; i < n; ++i) {
2372
+ j = order[i];
2373
+ if (top < bottom) {
2374
+ top += sums[j];
2375
+ tops.push(j);
2376
+ } else {
2377
+ bottom += sums[j];
2378
+ bottoms.push(j);
2379
+ }
2380
+ }
2381
+ return bottoms.reverse().concat(tops);
2382
+ }
2383
+ function reverse(series) {
2384
+ return none$1(series).reverse();
2385
+ }
2386
+ exports$2.arc = arc;
2387
+ exports$2.area = area;
2388
+ exports$2.areaRadial = areaRadial;
2389
+ exports$2.curveBasis = basis;
2390
+ exports$2.curveBasisClosed = basisClosed;
2391
+ exports$2.curveBasisOpen = basisOpen;
2392
+ exports$2.curveBundle = bundle;
2393
+ exports$2.curveCardinal = cardinal;
2394
+ exports$2.curveCardinalClosed = cardinalClosed;
2395
+ exports$2.curveCardinalOpen = cardinalOpen;
2396
+ exports$2.curveCatmullRom = catmullRom;
2397
+ exports$2.curveCatmullRomClosed = catmullRomClosed;
2398
+ exports$2.curveCatmullRomOpen = catmullRomOpen;
2399
+ exports$2.curveLinear = curveLinear;
2400
+ exports$2.curveLinearClosed = linearClosed;
2401
+ exports$2.curveMonotoneX = monotoneX;
2402
+ exports$2.curveMonotoneY = monotoneY;
2403
+ exports$2.curveNatural = natural;
2404
+ exports$2.curveStep = step;
2405
+ exports$2.curveStepAfter = stepAfter;
2406
+ exports$2.curveStepBefore = stepBefore;
2407
+ exports$2.line = line;
2408
+ exports$2.lineRadial = lineRadial$1;
2409
+ exports$2.linkHorizontal = linkHorizontal;
2410
+ exports$2.linkRadial = linkRadial;
2411
+ exports$2.linkVertical = linkVertical;
2412
+ exports$2.pie = pie;
2413
+ exports$2.pointRadial = pointRadial;
2414
+ exports$2.radialArea = areaRadial;
2415
+ exports$2.radialLine = lineRadial$1;
2416
+ exports$2.stack = stack;
2417
+ exports$2.stackOffsetDiverging = diverging;
2418
+ exports$2.stackOffsetExpand = expand;
2419
+ exports$2.stackOffsetNone = none;
2420
+ exports$2.stackOffsetSilhouette = silhouette;
2421
+ exports$2.stackOffsetWiggle = wiggle;
2422
+ exports$2.stackOrderAppearance = appearance;
2423
+ exports$2.stackOrderAscending = ascending;
2424
+ exports$2.stackOrderDescending = descending$1;
2425
+ exports$2.stackOrderInsideOut = insideOut;
2426
+ exports$2.stackOrderNone = none$1;
2427
+ exports$2.stackOrderReverse = reverse;
2428
+ exports$2.symbol = symbol;
2429
+ exports$2.symbolCircle = circle;
2430
+ exports$2.symbolCross = cross;
2431
+ exports$2.symbolDiamond = diamond;
2432
+ exports$2.symbolSquare = square;
2433
+ exports$2.symbolStar = star;
2434
+ exports$2.symbolTriangle = triangle;
2435
+ exports$2.symbolWye = wye;
2436
+ exports$2.symbols = symbols;
2437
+ Object.defineProperty(exports$2, "__esModule", { value: true });
2438
+ });
2439
+ }));
2440
+
2441
+ //#endregion
2442
+ //#region ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/dist/d3-sankey.js
2443
+ var require_d3_sankey = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2444
+ (function(global, factory) {
2445
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require_d3_array(), require_d3_shape()) : typeof define === "function" && define.amd ? define([
2446
+ "exports",
2447
+ "d3-array",
2448
+ "d3-shape"
2449
+ ], factory) : (global = global || self, factory(global.d3 = global.d3 || {}, global.d3, global.d3));
2450
+ })(exports, function(exports$1, d3Array, d3Shape) {
2451
+ "use strict";
2452
+ function targetDepth(d) {
2453
+ return d.target.depth;
2454
+ }
2455
+ function left(node) {
2456
+ return node.depth;
2457
+ }
2458
+ function right(node, n) {
2459
+ return n - 1 - node.height;
2460
+ }
2461
+ function justify(node, n) {
2462
+ return node.sourceLinks.length ? node.depth : n - 1;
2463
+ }
2464
+ function center(node) {
2465
+ return node.targetLinks.length ? node.depth : node.sourceLinks.length ? d3Array.min(node.sourceLinks, targetDepth) - 1 : 0;
2466
+ }
2467
+ function constant(x) {
2468
+ return function() {
2469
+ return x;
2470
+ };
2471
+ }
2472
+ function ascendingSourceBreadth(a, b) {
2473
+ return ascendingBreadth(a.source, b.source) || a.index - b.index;
2474
+ }
2475
+ function ascendingTargetBreadth(a, b) {
2476
+ return ascendingBreadth(a.target, b.target) || a.index - b.index;
2477
+ }
2478
+ function ascendingBreadth(a, b) {
2479
+ return a.y0 - b.y0;
2480
+ }
2481
+ function value(d) {
2482
+ return d.value;
2483
+ }
2484
+ function defaultId(d) {
2485
+ return d.index;
2486
+ }
2487
+ function defaultNodes(graph) {
2488
+ return graph.nodes;
2489
+ }
2490
+ function defaultLinks(graph) {
2491
+ return graph.links;
2492
+ }
2493
+ function find(nodeById, id) {
2494
+ const node = nodeById.get(id);
2495
+ if (!node) throw new Error("missing: " + id);
2496
+ return node;
2497
+ }
2498
+ function computeLinkBreadths({ nodes }) {
2499
+ for (const node of nodes) {
2500
+ let y0 = node.y0;
2501
+ let y1 = y0;
2502
+ for (const link of node.sourceLinks) {
2503
+ link.y0 = y0 + link.width / 2;
2504
+ y0 += link.width;
2505
+ }
2506
+ for (const link of node.targetLinks) {
2507
+ link.y1 = y1 + link.width / 2;
2508
+ y1 += link.width;
2509
+ }
2510
+ }
2511
+ }
2512
+ function Sankey() {
2513
+ let x0 = 0, y0 = 0, x1 = 1, y1 = 1;
2514
+ let dx = 24;
2515
+ let dy = 8, py;
2516
+ let id = defaultId;
2517
+ let align = justify;
2518
+ let sort;
2519
+ let linkSort;
2520
+ let nodes = defaultNodes;
2521
+ let links = defaultLinks;
2522
+ let iterations = 6;
2523
+ function sankey() {
2524
+ const graph = {
2525
+ nodes: nodes.apply(null, arguments),
2526
+ links: links.apply(null, arguments)
2527
+ };
2528
+ computeNodeLinks(graph);
2529
+ computeNodeValues(graph);
2530
+ computeNodeDepths(graph);
2531
+ computeNodeHeights(graph);
2532
+ computeNodeBreadths(graph);
2533
+ computeLinkBreadths(graph);
2534
+ return graph;
2535
+ }
2536
+ sankey.update = function(graph) {
2537
+ computeLinkBreadths(graph);
2538
+ return graph;
2539
+ };
2540
+ sankey.nodeId = function(_) {
2541
+ return arguments.length ? (id = typeof _ === "function" ? _ : constant(_), sankey) : id;
2542
+ };
2543
+ sankey.nodeAlign = function(_) {
2544
+ return arguments.length ? (align = typeof _ === "function" ? _ : constant(_), sankey) : align;
2545
+ };
2546
+ sankey.nodeSort = function(_) {
2547
+ return arguments.length ? (sort = _, sankey) : sort;
2548
+ };
2549
+ sankey.nodeWidth = function(_) {
2550
+ return arguments.length ? (dx = +_, sankey) : dx;
2551
+ };
2552
+ sankey.nodePadding = function(_) {
2553
+ return arguments.length ? (dy = py = +_, sankey) : dy;
2554
+ };
2555
+ sankey.nodes = function(_) {
2556
+ return arguments.length ? (nodes = typeof _ === "function" ? _ : constant(_), sankey) : nodes;
2557
+ };
2558
+ sankey.links = function(_) {
2559
+ return arguments.length ? (links = typeof _ === "function" ? _ : constant(_), sankey) : links;
2560
+ };
2561
+ sankey.linkSort = function(_) {
2562
+ return arguments.length ? (linkSort = _, sankey) : linkSort;
2563
+ };
2564
+ sankey.size = function(_) {
2565
+ return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];
2566
+ };
2567
+ sankey.extent = function(_) {
2568
+ return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];
2569
+ };
2570
+ sankey.iterations = function(_) {
2571
+ return arguments.length ? (iterations = +_, sankey) : iterations;
2572
+ };
2573
+ function computeNodeLinks({ nodes, links }) {
2574
+ for (const [i, node] of nodes.entries()) {
2575
+ node.index = i;
2576
+ node.sourceLinks = [];
2577
+ node.targetLinks = [];
2578
+ }
2579
+ const nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d]));
2580
+ for (const [i, link] of links.entries()) {
2581
+ link.index = i;
2582
+ let { source, target } = link;
2583
+ if (typeof source !== "object") source = link.source = find(nodeById, source);
2584
+ if (typeof target !== "object") target = link.target = find(nodeById, target);
2585
+ source.sourceLinks.push(link);
2586
+ target.targetLinks.push(link);
2587
+ }
2588
+ if (linkSort != null) for (const { sourceLinks, targetLinks } of nodes) {
2589
+ sourceLinks.sort(linkSort);
2590
+ targetLinks.sort(linkSort);
2591
+ }
2592
+ }
2593
+ function computeNodeValues({ nodes }) {
2594
+ for (const node of nodes) node.value = node.fixedValue === void 0 ? Math.max(d3Array.sum(node.sourceLinks, value), d3Array.sum(node.targetLinks, value)) : node.fixedValue;
2595
+ }
2596
+ function computeNodeDepths({ nodes }) {
2597
+ const n = nodes.length;
2598
+ let current = new Set(nodes);
2599
+ let next = /* @__PURE__ */ new Set();
2600
+ let x = 0;
2601
+ while (current.size) {
2602
+ for (const node of current) {
2603
+ node.depth = x;
2604
+ for (const { target } of node.sourceLinks) next.add(target);
2605
+ }
2606
+ if (++x > n) throw new Error("circular link");
2607
+ current = next;
2608
+ next = /* @__PURE__ */ new Set();
2609
+ }
2610
+ }
2611
+ function computeNodeHeights({ nodes }) {
2612
+ const n = nodes.length;
2613
+ let current = new Set(nodes);
2614
+ let next = /* @__PURE__ */ new Set();
2615
+ let x = 0;
2616
+ while (current.size) {
2617
+ for (const node of current) {
2618
+ node.height = x;
2619
+ for (const { source } of node.targetLinks) next.add(source);
2620
+ }
2621
+ if (++x > n) throw new Error("circular link");
2622
+ current = next;
2623
+ next = /* @__PURE__ */ new Set();
2624
+ }
2625
+ }
2626
+ function computeNodeLayers({ nodes }) {
2627
+ const x = d3Array.max(nodes, (d) => d.depth) + 1;
2628
+ const kx = (x1 - x0 - dx) / (x - 1);
2629
+ const columns = new Array(x);
2630
+ for (const node of nodes) {
2631
+ const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));
2632
+ node.layer = i;
2633
+ node.x0 = x0 + i * kx;
2634
+ node.x1 = node.x0 + dx;
2635
+ if (columns[i]) columns[i].push(node);
2636
+ else columns[i] = [node];
2637
+ }
2638
+ if (sort) for (const column of columns) column.sort(sort);
2639
+ return columns;
2640
+ }
2641
+ function initializeNodeBreadths(columns) {
2642
+ const ky = d3Array.min(columns, (c) => (y1 - y0 - (c.length - 1) * py) / d3Array.sum(c, value));
2643
+ for (const nodes of columns) {
2644
+ let y = y0;
2645
+ for (const node of nodes) {
2646
+ node.y0 = y;
2647
+ node.y1 = y + node.value * ky;
2648
+ y = node.y1 + py;
2649
+ for (const link of node.sourceLinks) link.width = link.value * ky;
2650
+ }
2651
+ y = (y1 - y + py) / (nodes.length + 1);
2652
+ for (let i = 0; i < nodes.length; ++i) {
2653
+ const node = nodes[i];
2654
+ node.y0 += y * (i + 1);
2655
+ node.y1 += y * (i + 1);
2656
+ }
2657
+ reorderLinks(nodes);
2658
+ }
2659
+ }
2660
+ function computeNodeBreadths(graph) {
2661
+ const columns = computeNodeLayers(graph);
2662
+ py = Math.min(dy, (y1 - y0) / (d3Array.max(columns, (c) => c.length) - 1));
2663
+ initializeNodeBreadths(columns);
2664
+ for (let i = 0; i < iterations; ++i) {
2665
+ const alpha = Math.pow(.99, i);
2666
+ const beta = Math.max(1 - alpha, (i + 1) / iterations);
2667
+ relaxRightToLeft(columns, alpha, beta);
2668
+ relaxLeftToRight(columns, alpha, beta);
2669
+ }
2670
+ }
2671
+ function relaxLeftToRight(columns, alpha, beta) {
2672
+ for (let i = 1, n = columns.length; i < n; ++i) {
2673
+ const column = columns[i];
2674
+ for (const target of column) {
2675
+ let y = 0;
2676
+ let w = 0;
2677
+ for (const { source, value } of target.targetLinks) {
2678
+ let v = value * (target.layer - source.layer);
2679
+ y += targetTop(source, target) * v;
2680
+ w += v;
2681
+ }
2682
+ if (!(w > 0)) continue;
2683
+ let dy = (y / w - target.y0) * alpha;
2684
+ target.y0 += dy;
2685
+ target.y1 += dy;
2686
+ reorderNodeLinks(target);
2687
+ }
2688
+ if (sort === void 0) column.sort(ascendingBreadth);
2689
+ resolveCollisions(column, beta);
2690
+ }
2691
+ }
2692
+ function relaxRightToLeft(columns, alpha, beta) {
2693
+ for (let i = columns.length - 2; i >= 0; --i) {
2694
+ const column = columns[i];
2695
+ for (const source of column) {
2696
+ let y = 0;
2697
+ let w = 0;
2698
+ for (const { target, value } of source.sourceLinks) {
2699
+ let v = value * (target.layer - source.layer);
2700
+ y += sourceTop(source, target) * v;
2701
+ w += v;
2702
+ }
2703
+ if (!(w > 0)) continue;
2704
+ let dy = (y / w - source.y0) * alpha;
2705
+ source.y0 += dy;
2706
+ source.y1 += dy;
2707
+ reorderNodeLinks(source);
2708
+ }
2709
+ if (sort === void 0) column.sort(ascendingBreadth);
2710
+ resolveCollisions(column, beta);
2711
+ }
2712
+ }
2713
+ function resolveCollisions(nodes, alpha) {
2714
+ const i = nodes.length >> 1;
2715
+ const subject = nodes[i];
2716
+ resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);
2717
+ resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);
2718
+ resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);
2719
+ resolveCollisionsTopToBottom(nodes, y0, 0, alpha);
2720
+ }
2721
+ function resolveCollisionsTopToBottom(nodes, y, i, alpha) {
2722
+ for (; i < nodes.length; ++i) {
2723
+ const node = nodes[i];
2724
+ const dy = (y - node.y0) * alpha;
2725
+ if (dy > 1e-6) node.y0 += dy, node.y1 += dy;
2726
+ y = node.y1 + py;
2727
+ }
2728
+ }
2729
+ function resolveCollisionsBottomToTop(nodes, y, i, alpha) {
2730
+ for (; i >= 0; --i) {
2731
+ const node = nodes[i];
2732
+ const dy = (node.y1 - y) * alpha;
2733
+ if (dy > 1e-6) node.y0 -= dy, node.y1 -= dy;
2734
+ y = node.y0 - py;
2735
+ }
2736
+ }
2737
+ function reorderNodeLinks({ sourceLinks, targetLinks }) {
2738
+ if (linkSort === void 0) {
2739
+ for (const { source: { sourceLinks } } of targetLinks) sourceLinks.sort(ascendingTargetBreadth);
2740
+ for (const { target: { targetLinks } } of sourceLinks) targetLinks.sort(ascendingSourceBreadth);
2741
+ }
2742
+ }
2743
+ function reorderLinks(nodes) {
2744
+ if (linkSort === void 0) for (const { sourceLinks, targetLinks } of nodes) {
2745
+ sourceLinks.sort(ascendingTargetBreadth);
2746
+ targetLinks.sort(ascendingSourceBreadth);
2747
+ }
2748
+ }
2749
+ function targetTop(source, target) {
2750
+ let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;
2751
+ for (const { target: node, width } of source.sourceLinks) {
2752
+ if (node === target) break;
2753
+ y += width + py;
2754
+ }
2755
+ for (const { source: node, width } of target.targetLinks) {
2756
+ if (node === source) break;
2757
+ y -= width;
2758
+ }
2759
+ return y;
2760
+ }
2761
+ function sourceTop(source, target) {
2762
+ let y = target.y0 - (target.targetLinks.length - 1) * py / 2;
2763
+ for (const { source: node, width } of target.targetLinks) {
2764
+ if (node === source) break;
2765
+ y += width + py;
2766
+ }
2767
+ for (const { target: node, width } of source.sourceLinks) {
2768
+ if (node === target) break;
2769
+ y -= width;
2770
+ }
2771
+ return y;
2772
+ }
2773
+ return sankey;
2774
+ }
2775
+ function horizontalSource(d) {
2776
+ return [d.source.x1, d.y0];
2777
+ }
2778
+ function horizontalTarget(d) {
2779
+ return [d.target.x0, d.y1];
2780
+ }
2781
+ function sankeyLinkHorizontal() {
2782
+ return d3Shape.linkHorizontal().source(horizontalSource).target(horizontalTarget);
2783
+ }
2784
+ exports$1.sankey = Sankey;
2785
+ exports$1.sankeyCenter = center;
2786
+ exports$1.sankeyJustify = justify;
2787
+ exports$1.sankeyLeft = left;
2788
+ exports$1.sankeyLinkHorizontal = sankeyLinkHorizontal;
2789
+ exports$1.sankeyRight = right;
2790
+ Object.defineProperty(exports$1, "__esModule", { value: true });
2791
+ });
2792
+ }));
2793
+
2794
+ //#endregion
2795
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/sankeyDiagram-IPEJSGJF.mjs
2796
+ var import_d3_sankey = require_d3_sankey();
2797
+ var parser = (function() {
2798
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
2799
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v);
2800
+ return o2;
2801
+ }, "o"), $V0 = [1, 9], $V1 = [1, 10], $V2 = [
2802
+ 1,
2803
+ 5,
2804
+ 10,
2805
+ 12
2806
+ ];
2807
+ var parser2 = {
2808
+ trace: /* @__PURE__ */ __name(function trace() {}, "trace"),
2809
+ yy: {},
2810
+ symbols_: {
2811
+ "error": 2,
2812
+ "start": 3,
2813
+ "SANKEY": 4,
2814
+ "NEWLINE": 5,
2815
+ "csv": 6,
2816
+ "opt_eof": 7,
2817
+ "record": 8,
2818
+ "csv_tail": 9,
2819
+ "EOF": 10,
2820
+ "field[source]": 11,
2821
+ "COMMA": 12,
2822
+ "field[target]": 13,
2823
+ "field[value]": 14,
2824
+ "field": 15,
2825
+ "escaped": 16,
2826
+ "non_escaped": 17,
2827
+ "DQUOTE": 18,
2828
+ "ESCAPED_TEXT": 19,
2829
+ "NON_ESCAPED_TEXT": 20,
2830
+ "$accept": 0,
2831
+ "$end": 1
2832
+ },
2833
+ terminals_: {
2834
+ 2: "error",
2835
+ 4: "SANKEY",
2836
+ 5: "NEWLINE",
2837
+ 10: "EOF",
2838
+ 11: "field[source]",
2839
+ 12: "COMMA",
2840
+ 13: "field[target]",
2841
+ 14: "field[value]",
2842
+ 18: "DQUOTE",
2843
+ 19: "ESCAPED_TEXT",
2844
+ 20: "NON_ESCAPED_TEXT"
2845
+ },
2846
+ productions_: [
2847
+ 0,
2848
+ [3, 4],
2849
+ [6, 2],
2850
+ [9, 2],
2851
+ [9, 0],
2852
+ [7, 1],
2853
+ [7, 0],
2854
+ [8, 5],
2855
+ [15, 1],
2856
+ [15, 1],
2857
+ [16, 3],
2858
+ [17, 1]
2859
+ ],
2860
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
2861
+ var $0 = $$.length - 1;
2862
+ switch (yystate) {
2863
+ case 7:
2864
+ const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll("\"\"", "\""));
2865
+ const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll("\"\"", "\""));
2866
+ const value = parseFloat($$[$0].trim());
2867
+ yy.addLink(source, target, value);
2868
+ break;
2869
+ case 8:
2870
+ case 9:
2871
+ case 11:
2872
+ this.$ = $$[$0];
2873
+ break;
2874
+ case 10:
2875
+ this.$ = $$[$0 - 1];
2876
+ break;
2877
+ }
2878
+ }, "anonymous"),
2879
+ table: [
2880
+ {
2881
+ 3: 1,
2882
+ 4: [1, 2]
2883
+ },
2884
+ { 1: [3] },
2885
+ { 5: [1, 3] },
2886
+ {
2887
+ 6: 4,
2888
+ 8: 5,
2889
+ 15: 6,
2890
+ 16: 7,
2891
+ 17: 8,
2892
+ 18: $V0,
2893
+ 20: $V1
2894
+ },
2895
+ {
2896
+ 1: [2, 6],
2897
+ 7: 11,
2898
+ 10: [1, 12]
2899
+ },
2900
+ o($V1, [2, 4], {
2901
+ 9: 13,
2902
+ 5: [1, 14]
2903
+ }),
2904
+ { 12: [1, 15] },
2905
+ o($V2, [2, 8]),
2906
+ o($V2, [2, 9]),
2907
+ { 19: [1, 16] },
2908
+ o($V2, [2, 11]),
2909
+ { 1: [2, 1] },
2910
+ { 1: [2, 5] },
2911
+ o($V1, [2, 2]),
2912
+ {
2913
+ 6: 17,
2914
+ 8: 5,
2915
+ 15: 6,
2916
+ 16: 7,
2917
+ 17: 8,
2918
+ 18: $V0,
2919
+ 20: $V1
2920
+ },
2921
+ {
2922
+ 15: 18,
2923
+ 16: 7,
2924
+ 17: 8,
2925
+ 18: $V0,
2926
+ 20: $V1
2927
+ },
2928
+ { 18: [1, 19] },
2929
+ o($V1, [2, 3]),
2930
+ { 12: [1, 20] },
2931
+ o($V2, [2, 10]),
2932
+ {
2933
+ 15: 21,
2934
+ 16: 7,
2935
+ 17: 8,
2936
+ 18: $V0,
2937
+ 20: $V1
2938
+ },
2939
+ o([
2940
+ 1,
2941
+ 5,
2942
+ 10
2943
+ ], [2, 7])
2944
+ ],
2945
+ defaultActions: {
2946
+ 11: [2, 1],
2947
+ 12: [2, 5]
2948
+ },
2949
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
2950
+ if (hash.recoverable) this.trace(str);
2951
+ else {
2952
+ var error = new Error(str);
2953
+ error.hash = hash;
2954
+ throw error;
2955
+ }
2956
+ }, "parseError"),
2957
+ parse: /* @__PURE__ */ __name(function parse(input) {
2958
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
2959
+ var args = lstack.slice.call(arguments, 1);
2960
+ var lexer2 = Object.create(this.lexer);
2961
+ var sharedState = { yy: {} };
2962
+ for (var k in this.yy) if (Object.prototype.hasOwnProperty.call(this.yy, k)) sharedState.yy[k] = this.yy[k];
2963
+ lexer2.setInput(input, sharedState.yy);
2964
+ sharedState.yy.lexer = lexer2;
2965
+ sharedState.yy.parser = this;
2966
+ if (typeof lexer2.yylloc == "undefined") lexer2.yylloc = {};
2967
+ var yyloc = lexer2.yylloc;
2968
+ lstack.push(yyloc);
2969
+ var ranges = lexer2.options && lexer2.options.ranges;
2970
+ if (typeof sharedState.yy.parseError === "function") this.parseError = sharedState.yy.parseError;
2971
+ else this.parseError = Object.getPrototypeOf(this).parseError;
2972
+ function popStack(n) {
2973
+ stack.length = stack.length - 2 * n;
2974
+ vstack.length = vstack.length - n;
2975
+ lstack.length = lstack.length - n;
2976
+ }
2977
+ __name(popStack, "popStack");
2978
+ function lex() {
2979
+ var token = tstack.pop() || lexer2.lex() || EOF;
2980
+ if (typeof token !== "number") {
2981
+ if (token instanceof Array) {
2982
+ tstack = token;
2983
+ token = tstack.pop();
2984
+ }
2985
+ token = self.symbols_[token] || token;
2986
+ }
2987
+ return token;
2988
+ }
2989
+ __name(lex, "lex");
2990
+ var symbol, preErrorSymbol, state, action, r, yyval = {}, p, len, newState, expected;
2991
+ while (true) {
2992
+ state = stack[stack.length - 1];
2993
+ if (this.defaultActions[state]) action = this.defaultActions[state];
2994
+ else {
2995
+ if (symbol === null || typeof symbol == "undefined") symbol = lex();
2996
+ action = table[state] && table[state][symbol];
2997
+ }
2998
+ if (typeof action === "undefined" || !action.length || !action[0]) {
2999
+ var errStr = "";
3000
+ expected = [];
3001
+ for (p in table[state]) if (this.terminals_[p] && p > TERROR) expected.push("'" + this.terminals_[p] + "'");
3002
+ if (lexer2.showPosition) errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
3003
+ else errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
3004
+ this.parseError(errStr, {
3005
+ text: lexer2.match,
3006
+ token: this.terminals_[symbol] || symbol,
3007
+ line: lexer2.yylineno,
3008
+ loc: yyloc,
3009
+ expected
3010
+ });
3011
+ }
3012
+ if (action[0] instanceof Array && action.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
3013
+ switch (action[0]) {
3014
+ case 1:
3015
+ stack.push(symbol);
3016
+ vstack.push(lexer2.yytext);
3017
+ lstack.push(lexer2.yylloc);
3018
+ stack.push(action[1]);
3019
+ symbol = null;
3020
+ if (!preErrorSymbol) {
3021
+ yyleng = lexer2.yyleng;
3022
+ yytext = lexer2.yytext;
3023
+ yylineno = lexer2.yylineno;
3024
+ yyloc = lexer2.yylloc;
3025
+ if (recovering > 0) recovering--;
3026
+ } else {
3027
+ symbol = preErrorSymbol;
3028
+ preErrorSymbol = null;
3029
+ }
3030
+ break;
3031
+ case 2:
3032
+ len = this.productions_[action[1]][1];
3033
+ yyval.$ = vstack[vstack.length - len];
3034
+ yyval._$ = {
3035
+ first_line: lstack[lstack.length - (len || 1)].first_line,
3036
+ last_line: lstack[lstack.length - 1].last_line,
3037
+ first_column: lstack[lstack.length - (len || 1)].first_column,
3038
+ last_column: lstack[lstack.length - 1].last_column
3039
+ };
3040
+ if (ranges) yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
3041
+ r = this.performAction.apply(yyval, [
3042
+ yytext,
3043
+ yyleng,
3044
+ yylineno,
3045
+ sharedState.yy,
3046
+ action[1],
3047
+ vstack,
3048
+ lstack
3049
+ ].concat(args));
3050
+ if (typeof r !== "undefined") return r;
3051
+ if (len) {
3052
+ stack = stack.slice(0, -1 * len * 2);
3053
+ vstack = vstack.slice(0, -1 * len);
3054
+ lstack = lstack.slice(0, -1 * len);
3055
+ }
3056
+ stack.push(this.productions_[action[1]][0]);
3057
+ vstack.push(yyval.$);
3058
+ lstack.push(yyval._$);
3059
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
3060
+ stack.push(newState);
3061
+ break;
3062
+ case 3: return true;
3063
+ }
3064
+ }
3065
+ return true;
3066
+ }, "parse")
3067
+ };
3068
+ parser2.lexer = /* @__PURE__ */ (function() {
3069
+ return {
3070
+ EOF: 1,
3071
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
3072
+ if (this.yy.parser) this.yy.parser.parseError(str, hash);
3073
+ else throw new Error(str);
3074
+ }, "parseError"),
3075
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
3076
+ this.yy = yy || this.yy || {};
3077
+ this._input = input;
3078
+ this._more = this._backtrack = this.done = false;
3079
+ this.yylineno = this.yyleng = 0;
3080
+ this.yytext = this.matched = this.match = "";
3081
+ this.conditionStack = ["INITIAL"];
3082
+ this.yylloc = {
3083
+ first_line: 1,
3084
+ first_column: 0,
3085
+ last_line: 1,
3086
+ last_column: 0
3087
+ };
3088
+ if (this.options.ranges) this.yylloc.range = [0, 0];
3089
+ this.offset = 0;
3090
+ return this;
3091
+ }, "setInput"),
3092
+ input: /* @__PURE__ */ __name(function() {
3093
+ var ch = this._input[0];
3094
+ this.yytext += ch;
3095
+ this.yyleng++;
3096
+ this.offset++;
3097
+ this.match += ch;
3098
+ this.matched += ch;
3099
+ if (ch.match(/(?:\r\n?|\n).*/g)) {
3100
+ this.yylineno++;
3101
+ this.yylloc.last_line++;
3102
+ } else this.yylloc.last_column++;
3103
+ if (this.options.ranges) this.yylloc.range[1]++;
3104
+ this._input = this._input.slice(1);
3105
+ return ch;
3106
+ }, "input"),
3107
+ unput: /* @__PURE__ */ __name(function(ch) {
3108
+ var len = ch.length;
3109
+ var lines = ch.split(/(?:\r\n?|\n)/g);
3110
+ this._input = ch + this._input;
3111
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
3112
+ this.offset -= len;
3113
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
3114
+ this.match = this.match.substr(0, this.match.length - 1);
3115
+ this.matched = this.matched.substr(0, this.matched.length - 1);
3116
+ if (lines.length - 1) this.yylineno -= lines.length - 1;
3117
+ var r = this.yylloc.range;
3118
+ this.yylloc = {
3119
+ first_line: this.yylloc.first_line,
3120
+ last_line: this.yylineno + 1,
3121
+ first_column: this.yylloc.first_column,
3122
+ 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
3123
+ };
3124
+ if (this.options.ranges) this.yylloc.range = [r[0], r[0] + this.yyleng - len];
3125
+ this.yyleng = this.yytext.length;
3126
+ return this;
3127
+ }, "unput"),
3128
+ more: /* @__PURE__ */ __name(function() {
3129
+ this._more = true;
3130
+ return this;
3131
+ }, "more"),
3132
+ reject: /* @__PURE__ */ __name(function() {
3133
+ if (this.options.backtrack_lexer) this._backtrack = true;
3134
+ 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(), {
3135
+ text: "",
3136
+ token: null,
3137
+ line: this.yylineno
3138
+ });
3139
+ return this;
3140
+ }, "reject"),
3141
+ less: /* @__PURE__ */ __name(function(n) {
3142
+ this.unput(this.match.slice(n));
3143
+ }, "less"),
3144
+ pastInput: /* @__PURE__ */ __name(function() {
3145
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
3146
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
3147
+ }, "pastInput"),
3148
+ upcomingInput: /* @__PURE__ */ __name(function() {
3149
+ var next = this.match;
3150
+ if (next.length < 20) next += this._input.substr(0, 20 - next.length);
3151
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
3152
+ }, "upcomingInput"),
3153
+ showPosition: /* @__PURE__ */ __name(function() {
3154
+ var pre = this.pastInput();
3155
+ var c = new Array(pre.length + 1).join("-");
3156
+ return pre + this.upcomingInput() + "\n" + c + "^";
3157
+ }, "showPosition"),
3158
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
3159
+ var token, lines, backup;
3160
+ if (this.options.backtrack_lexer) {
3161
+ backup = {
3162
+ yylineno: this.yylineno,
3163
+ yylloc: {
3164
+ first_line: this.yylloc.first_line,
3165
+ last_line: this.last_line,
3166
+ first_column: this.yylloc.first_column,
3167
+ last_column: this.yylloc.last_column
3168
+ },
3169
+ yytext: this.yytext,
3170
+ match: this.match,
3171
+ matches: this.matches,
3172
+ matched: this.matched,
3173
+ yyleng: this.yyleng,
3174
+ offset: this.offset,
3175
+ _more: this._more,
3176
+ _input: this._input,
3177
+ yy: this.yy,
3178
+ conditionStack: this.conditionStack.slice(0),
3179
+ done: this.done
3180
+ };
3181
+ if (this.options.ranges) backup.yylloc.range = this.yylloc.range.slice(0);
3182
+ }
3183
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
3184
+ if (lines) this.yylineno += lines.length;
3185
+ this.yylloc = {
3186
+ first_line: this.yylloc.last_line,
3187
+ last_line: this.yylineno + 1,
3188
+ first_column: this.yylloc.last_column,
3189
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
3190
+ };
3191
+ this.yytext += match[0];
3192
+ this.match += match[0];
3193
+ this.matches = match;
3194
+ this.yyleng = this.yytext.length;
3195
+ if (this.options.ranges) this.yylloc.range = [this.offset, this.offset += this.yyleng];
3196
+ this._more = false;
3197
+ this._backtrack = false;
3198
+ this._input = this._input.slice(match[0].length);
3199
+ this.matched += match[0];
3200
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
3201
+ if (this.done && this._input) this.done = false;
3202
+ if (token) return token;
3203
+ else if (this._backtrack) {
3204
+ for (var k in backup) this[k] = backup[k];
3205
+ return false;
3206
+ }
3207
+ return false;
3208
+ }, "test_match"),
3209
+ next: /* @__PURE__ */ __name(function() {
3210
+ if (this.done) return this.EOF;
3211
+ if (!this._input) this.done = true;
3212
+ var token, match, tempMatch, index;
3213
+ if (!this._more) {
3214
+ this.yytext = "";
3215
+ this.match = "";
3216
+ }
3217
+ var rules = this._currentRules();
3218
+ for (var i = 0; i < rules.length; i++) {
3219
+ tempMatch = this._input.match(this.rules[rules[i]]);
3220
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
3221
+ match = tempMatch;
3222
+ index = i;
3223
+ if (this.options.backtrack_lexer) {
3224
+ token = this.test_match(tempMatch, rules[i]);
3225
+ if (token !== false) return token;
3226
+ else if (this._backtrack) {
3227
+ match = false;
3228
+ continue;
3229
+ } else return false;
3230
+ } else if (!this.options.flex) break;
3231
+ }
3232
+ }
3233
+ if (match) {
3234
+ token = this.test_match(match, rules[index]);
3235
+ if (token !== false) return token;
3236
+ return false;
3237
+ }
3238
+ if (this._input === "") return this.EOF;
3239
+ else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
3240
+ text: "",
3241
+ token: null,
3242
+ line: this.yylineno
3243
+ });
3244
+ }, "next"),
3245
+ lex: /* @__PURE__ */ __name(function lex() {
3246
+ var r = this.next();
3247
+ if (r) return r;
3248
+ else return this.lex();
3249
+ }, "lex"),
3250
+ begin: /* @__PURE__ */ __name(function begin(condition) {
3251
+ this.conditionStack.push(condition);
3252
+ }, "begin"),
3253
+ popState: /* @__PURE__ */ __name(function popState() {
3254
+ if (this.conditionStack.length - 1 > 0) return this.conditionStack.pop();
3255
+ else return this.conditionStack[0];
3256
+ }, "popState"),
3257
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
3258
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
3259
+ else return this.conditions["INITIAL"].rules;
3260
+ }, "_currentRules"),
3261
+ topState: /* @__PURE__ */ __name(function topState(n) {
3262
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
3263
+ if (n >= 0) return this.conditionStack[n];
3264
+ else return "INITIAL";
3265
+ }, "topState"),
3266
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
3267
+ this.begin(condition);
3268
+ }, "pushState"),
3269
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
3270
+ return this.conditionStack.length;
3271
+ }, "stateStackSize"),
3272
+ options: { "case-insensitive": true },
3273
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
3274
+ switch ($avoiding_name_collisions) {
3275
+ case 0:
3276
+ this.pushState("csv");
3277
+ return 4;
3278
+ case 1:
3279
+ this.pushState("csv");
3280
+ return 4;
3281
+ case 2: return 10;
3282
+ case 3: return 5;
3283
+ case 4: return 12;
3284
+ case 5:
3285
+ this.pushState("escaped_text");
3286
+ return 18;
3287
+ case 6: return 20;
3288
+ case 7:
3289
+ this.popState("escaped_text");
3290
+ return 18;
3291
+ case 8: return 19;
3292
+ }
3293
+ }, "anonymous"),
3294
+ rules: [
3295
+ /^(?:sankey-beta\b)/i,
3296
+ /^(?:sankey\b)/i,
3297
+ /^(?:$)/i,
3298
+ /^(?:((\u000D\u000A)|(\u000A)))/i,
3299
+ /^(?:(\u002C))/i,
3300
+ /^(?:(\u0022))/i,
3301
+ /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,
3302
+ /^(?:(\u0022)(?!(\u0022)))/i,
3303
+ /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i
3304
+ ],
3305
+ conditions: {
3306
+ "csv": {
3307
+ "rules": [
3308
+ 2,
3309
+ 3,
3310
+ 4,
3311
+ 5,
3312
+ 6,
3313
+ 7,
3314
+ 8
3315
+ ],
3316
+ "inclusive": false
3317
+ },
3318
+ "escaped_text": {
3319
+ "rules": [7, 8],
3320
+ "inclusive": false
3321
+ },
3322
+ "INITIAL": {
3323
+ "rules": [
3324
+ 0,
3325
+ 1,
3326
+ 2,
3327
+ 3,
3328
+ 4,
3329
+ 5,
3330
+ 6,
3331
+ 7,
3332
+ 8
3333
+ ],
3334
+ "inclusive": true
3335
+ }
3336
+ }
3337
+ };
3338
+ })();
3339
+ function Parser() {
3340
+ this.yy = {};
3341
+ }
3342
+ __name(Parser, "Parser");
3343
+ Parser.prototype = parser2;
3344
+ parser2.Parser = Parser;
3345
+ return new Parser();
3346
+ })();
3347
+ parser.parser = parser;
3348
+ var sankey_default = parser;
3349
+ var links = [];
3350
+ var nodes = [];
3351
+ var nodesMap = /* @__PURE__ */ new Map();
3352
+ var clear2 = /* @__PURE__ */ __name(() => {
3353
+ links = [];
3354
+ nodes = [];
3355
+ nodesMap = /* @__PURE__ */ new Map();
3356
+ clear();
3357
+ }, "clear");
3358
+ var SankeyLink = class {
3359
+ constructor(source, target, value = 0) {
3360
+ this.source = source;
3361
+ this.target = target;
3362
+ this.value = value;
3363
+ }
3364
+ static {
3365
+ __name(this, "SankeyLink");
3366
+ }
3367
+ };
3368
+ var addLink = /* @__PURE__ */ __name((source, target, value) => {
3369
+ links.push(new SankeyLink(source, target, value));
3370
+ }, "addLink");
3371
+ var SankeyNode = class {
3372
+ constructor(ID) {
3373
+ this.ID = ID;
3374
+ }
3375
+ static {
3376
+ __name(this, "SankeyNode");
3377
+ }
3378
+ };
3379
+ var sankeyDB_default = {
3380
+ nodesMap,
3381
+ getConfig: /* @__PURE__ */ __name(() => getConfig2().sankey, "getConfig"),
3382
+ getNodes: /* @__PURE__ */ __name(() => nodes, "getNodes"),
3383
+ getLinks: /* @__PURE__ */ __name(() => links, "getLinks"),
3384
+ getGraph: /* @__PURE__ */ __name(() => ({
3385
+ nodes: nodes.map((node) => ({ id: node.ID })),
3386
+ links: links.map((link) => ({
3387
+ source: link.source.ID,
3388
+ target: link.target.ID,
3389
+ value: link.value
3390
+ }))
3391
+ }), "getGraph"),
3392
+ addLink,
3393
+ findOrCreateNode: /* @__PURE__ */ __name((ID) => {
3394
+ ID = common_default.sanitizeText(ID, getConfig2());
3395
+ let node = nodesMap.get(ID);
3396
+ if (node === void 0) {
3397
+ node = new SankeyNode(ID);
3398
+ nodesMap.set(ID, node);
3399
+ nodes.push(node);
3400
+ }
3401
+ return node;
3402
+ }, "findOrCreateNode"),
3403
+ getAccTitle,
3404
+ setAccTitle,
3405
+ getAccDescription,
3406
+ setAccDescription,
3407
+ getDiagramTitle,
3408
+ setDiagramTitle,
3409
+ clear: clear2
3410
+ };
3411
+ var Uid = class _Uid {
3412
+ static {
3413
+ __name(this, "Uid");
3414
+ }
3415
+ static {
3416
+ this.count = 0;
3417
+ }
3418
+ static next(name) {
3419
+ return new _Uid(name + ++_Uid.count);
3420
+ }
3421
+ constructor(id) {
3422
+ this.id = id;
3423
+ this.href = `#${id}`;
3424
+ }
3425
+ toString() {
3426
+ return "url(" + this.href + ")";
3427
+ }
3428
+ };
3429
+ var alignmentsMap = {
3430
+ left: import_d3_sankey.sankeyLeft,
3431
+ right: import_d3_sankey.sankeyRight,
3432
+ center: import_d3_sankey.sankeyCenter,
3433
+ justify: import_d3_sankey.sankeyJustify
3434
+ };
3435
+ var findCentralNodeLayer = /* @__PURE__ */ __name((nodes2) => {
3436
+ let maxValue = 0;
3437
+ let centralLayer = 0;
3438
+ for (const node of nodes2) {
3439
+ const value = node.value ?? 0;
3440
+ if (value > maxValue) {
3441
+ maxValue = value;
3442
+ centralLayer = node.layer ?? 0;
3443
+ }
3444
+ }
3445
+ return centralLayer;
3446
+ }, "findCentralNodeLayer");
3447
+ var sankeyRenderer_default = { draw: /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
3448
+ const { securityLevel, sankey: conf } = getConfig2();
3449
+ const defaultSankeyConfig = defaultConfig2.sankey;
3450
+ let sandboxElement;
3451
+ if (securityLevel === "sandbox") sandboxElement = select_default("#i" + id);
3452
+ const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
3453
+ const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select_default(`[id="${id}"]`);
3454
+ const width = conf?.width ?? defaultSankeyConfig.width;
3455
+ const height = conf?.height ?? defaultSankeyConfig.width;
3456
+ const useMaxWidth = conf?.useMaxWidth ?? defaultSankeyConfig.useMaxWidth;
3457
+ const nodeAlignment = conf?.nodeAlignment ?? defaultSankeyConfig.nodeAlignment;
3458
+ const prefix = conf?.prefix ?? defaultSankeyConfig.prefix;
3459
+ const suffix = conf?.suffix ?? defaultSankeyConfig.suffix;
3460
+ const showValues = conf?.showValues ?? defaultSankeyConfig.showValues;
3461
+ const nodeWidth = conf?.nodeWidth ?? defaultSankeyConfig.nodeWidth ?? 10;
3462
+ const nodePadding = conf?.nodePadding ?? defaultSankeyConfig.nodePadding ?? 12;
3463
+ const labelStyle = conf?.labelStyle ?? defaultSankeyConfig.labelStyle ?? "legacy";
3464
+ const nodeColors = conf?.nodeColors ?? {};
3465
+ const graph = diagObj.db.getGraph();
3466
+ const nodeAlign = alignmentsMap[nodeAlignment];
3467
+ (0, import_d3_sankey.sankey)().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(nodePadding + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([[0, 0], [width, height]])(graph);
3468
+ const centralNodeLayer = findCentralNodeLayer(graph.nodes);
3469
+ const colorScheme = ordinal(Tableau10_default);
3470
+ const getNodeColor = /* @__PURE__ */ __name((nodeId) => {
3471
+ return nodeColors[nodeId] ?? colorScheme(nodeId);
3472
+ }, "getNodeColor");
3473
+ 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) {
3474
+ return "translate(" + d.x0 + "," + d.y0 + ")";
3475
+ }).attr("x", (d) => d.x0).attr("y", (d) => d.y0).append("rect").attr("height", (d) => {
3476
+ return d.y1 - d.y0;
3477
+ }).attr("width", (d) => d.x1 - d.x0).attr("fill", (d) => getNodeColor(d.id));
3478
+ const getText = /* @__PURE__ */ __name(({ id: id2, value }) => {
3479
+ if (!showValues) return id2;
3480
+ return `${id2}
3481
+ ${prefix}${Math.round(value * 100) / 100}${suffix}`;
3482
+ }, "getText");
3483
+ const getLabelPosition = /* @__PURE__ */ __name((d) => {
3484
+ if (labelStyle === "outlined") {
3485
+ if ((d.layer ?? 0) < centralNodeLayer) return {
3486
+ x: d.x0 - 6,
3487
+ anchor: "end"
3488
+ };
3489
+ return {
3490
+ x: d.x1 + 6,
3491
+ anchor: "start"
3492
+ };
3493
+ }
3494
+ if (d.x0 < width / 2) return {
3495
+ x: d.x1 + 6,
3496
+ anchor: "start"
3497
+ };
3498
+ return {
3499
+ x: d.x0 - 6,
3500
+ anchor: "end"
3501
+ };
3502
+ }, "getLabelPosition");
3503
+ const labelsGroup = svg.append("g").attr("class", "node-labels").attr("font-size", 14);
3504
+ 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");
3505
+ if (labelStyle === "outlined") {
3506
+ appendLabel("sankey-label-bg");
3507
+ appendLabel("sankey-label-fg");
3508
+ } else appendLabel();
3509
+ 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");
3510
+ const linkColor = conf?.linkColor ?? "gradient";
3511
+ if (linkColor === "gradient") {
3512
+ 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);
3513
+ gradient.append("stop").attr("offset", "0%").attr("stop-color", (d) => getNodeColor(d.source.id));
3514
+ gradient.append("stop").attr("offset", "100%").attr("stop-color", (d) => getNodeColor(d.target.id));
3515
+ }
3516
+ let coloring;
3517
+ switch (linkColor) {
3518
+ case "gradient":
3519
+ coloring = /* @__PURE__ */ __name((d) => d.uid, "coloring");
3520
+ break;
3521
+ case "source":
3522
+ coloring = /* @__PURE__ */ __name((d) => getNodeColor(d.source.id), "coloring");
3523
+ break;
3524
+ case "target":
3525
+ coloring = /* @__PURE__ */ __name((d) => getNodeColor(d.target.id), "coloring");
3526
+ break;
3527
+ default: coloring = linkColor;
3528
+ }
3529
+ link.append("path").attr("d", (0, import_d3_sankey.sankeyLinkHorizontal)()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
3530
+ setupGraphViewbox(void 0, svg, 0, useMaxWidth);
3531
+ }, "draw") };
3532
+ var prepareTextForParsing = /* @__PURE__ */ __name((text) => {
3533
+ return text.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
3534
+ }, "prepareTextForParsing");
3535
+ var styles_default = /* @__PURE__ */ __name((options) => `.label {
3536
+ font-family: ${options.fontFamily};
3537
+ }
3538
+
3539
+ .node-labels {
3540
+ font-family: ${options.fontFamily};
3541
+ }
3542
+
3543
+ /* Outlined label style - background stroke for better readability */
3544
+ .sankey-label-bg {
3545
+ stroke: ${options.mainBkg || options.background || "#fff"};
3546
+ stroke-width: 4px;
3547
+ stroke-linejoin: round;
3548
+ paint-order: stroke;
3549
+ }
3550
+
3551
+ /* Foreground label text */
3552
+ .sankey-label-fg {
3553
+ fill: ${options.textColor};
3554
+ }
3555
+
3556
+ /* Node styling */
3557
+ .node rect {
3558
+ shape-rendering: crispEdges;
3559
+ }
3560
+
3561
+ /* Link styling */
3562
+ .link {
3563
+ fill: none;
3564
+ stroke-opacity: 0.5;
3565
+ mix-blend-mode: multiply;
3566
+ }
3567
+ `, "getStyles");
3568
+ var originalParse = sankey_default.parse.bind(sankey_default);
3569
+ sankey_default.parse = (text) => originalParse(prepareTextForParsing(text));
3570
+ var diagram = {
3571
+ styles: styles_default,
3572
+ parser: sankey_default,
3573
+ db: sankeyDB_default,
3574
+ renderer: sankeyRenderer_default
3575
+ };
3576
+
3577
+ //#endregion
3578
+ export { diagram };