drizzle-cube 0.1.69 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/adapters/{compiler-CghsDLXl.cjs → compiler-DP1pPIcg.cjs} +9 -9
  2. package/dist/adapters/{compiler-BnHK-nxh.js → compiler-gcKytLwd.js} +12 -13
  3. package/dist/adapters/express/index.cjs +1 -1
  4. package/dist/adapters/express/index.js +1 -1
  5. package/dist/adapters/fastify/index.cjs +1 -1
  6. package/dist/adapters/fastify/index.js +1 -1
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.js +1 -1
  9. package/dist/adapters/nextjs/index.cjs +1 -1
  10. package/dist/adapters/nextjs/index.js +1 -1
  11. package/dist/client/charts/ChartLoader.d.ts +56 -0
  12. package/dist/client/charts/lazyChartConfigRegistry.d.ts +90 -0
  13. package/dist/client/charts.d.ts +6 -0
  14. package/dist/client/charts.js +38 -15
  15. package/dist/client/charts.js.map +1 -1
  16. package/dist/client/chunks/chart-activitygridchart-B5OqLgbD.js +3713 -0
  17. package/dist/client/chunks/chart-activitygridchart-B5OqLgbD.js.map +1 -0
  18. package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js +51 -0
  19. package/dist/client/chunks/chart-activitygridchart-config-D9CgNH02.js.map +1 -0
  20. package/dist/client/chunks/chart-areachart-CTzUpR0_.js +204 -0
  21. package/dist/client/chunks/chart-areachart-CTzUpR0_.js.map +1 -0
  22. package/dist/client/chunks/chart-areachart-config-InZgxubz.js +66 -0
  23. package/dist/client/chunks/chart-areachart-config-InZgxubz.js.map +1 -0
  24. package/dist/client/chunks/chart-barchart-CKF8FnMs.js +177 -0
  25. package/dist/client/chunks/chart-barchart-CKF8FnMs.js.map +1 -0
  26. package/dist/client/chunks/chart-barchart-config-DxatOnVV.js +59 -0
  27. package/dist/client/chunks/chart-barchart-config-DxatOnVV.js.map +1 -0
  28. package/dist/client/chunks/chart-bubblechart-5Z0hPYwn.js +210 -0
  29. package/dist/client/chunks/chart-bubblechart-5Z0hPYwn.js.map +1 -0
  30. package/dist/client/chunks/chart-bubblechart-config-CcZTMTCx.js +59 -0
  31. package/dist/client/chunks/chart-bubblechart-config-CcZTMTCx.js.map +1 -0
  32. package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js +103 -0
  33. package/dist/client/chunks/chart-chartcontainer-CdwzIKP1.js.map +1 -0
  34. package/dist/client/chunks/chart-charttooltip-CqtjUW2V.js +26 -0
  35. package/dist/client/chunks/chart-charttooltip-CqtjUW2V.js.map +1 -0
  36. package/dist/client/chunks/chart-datatable-config-D7mojhYA.js +22 -0
  37. package/dist/client/chunks/chart-datatable-config-D7mojhYA.js.map +1 -0
  38. package/dist/client/chunks/chart-datatable-uFzkh18f.js +57 -0
  39. package/dist/client/chunks/chart-datatable-uFzkh18f.js.map +1 -0
  40. package/dist/client/chunks/chart-kpidelta-B1zg2dTx.js +434 -0
  41. package/dist/client/chunks/chart-kpidelta-B1zg2dTx.js.map +1 -0
  42. package/dist/client/chunks/chart-kpidelta-config-icJXuFxe.js +99 -0
  43. package/dist/client/chunks/chart-kpidelta-config-icJXuFxe.js.map +1 -0
  44. package/dist/client/chunks/chart-kpinumber-CHcSqthc.js +398 -0
  45. package/dist/client/chunks/chart-kpinumber-CHcSqthc.js.map +1 -0
  46. package/dist/client/chunks/chart-kpinumber-config-T39g03ud.js +77 -0
  47. package/dist/client/chunks/chart-kpinumber-config-T39g03ud.js.map +1 -0
  48. package/dist/client/chunks/chart-kpitext-BrapZkRe.js +165 -0
  49. package/dist/client/chunks/chart-kpitext-BrapZkRe.js.map +1 -0
  50. package/dist/client/chunks/chart-kpitext-config-BbJGXAVk.js +49 -0
  51. package/dist/client/chunks/chart-kpitext-config-BbJGXAVk.js.map +1 -0
  52. package/dist/client/chunks/chart-linechart-DqZU4vH8.js +155 -0
  53. package/dist/client/chunks/chart-linechart-DqZU4vH8.js.map +1 -0
  54. package/dist/client/chunks/chart-linechart-config-BS1qVC8K.js +54 -0
  55. package/dist/client/chunks/chart-linechart-config-BS1qVC8K.js.map +1 -0
  56. package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js +254 -0
  57. package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js.map +1 -0
  58. package/dist/client/chunks/chart-markdownchart-config-DMCD8phf.js +62 -0
  59. package/dist/client/chunks/chart-markdownchart-config-DMCD8phf.js.map +1 -0
  60. package/dist/client/chunks/chart-piechart-Dsxs70px.js +121 -0
  61. package/dist/client/chunks/chart-piechart-Dsxs70px.js.map +1 -0
  62. package/dist/client/chunks/chart-piechart-config-6ZK8XaSX.js +32 -0
  63. package/dist/client/chunks/chart-piechart-config-6ZK8XaSX.js.map +1 -0
  64. package/dist/client/chunks/chart-radarchart-2qnrlYCv.js +124 -0
  65. package/dist/client/chunks/chart-radarchart-2qnrlYCv.js.map +1 -0
  66. package/dist/client/chunks/chart-radarchart-config-CCWOkkwO.js +38 -0
  67. package/dist/client/chunks/chart-radarchart-config-CCWOkkwO.js.map +1 -0
  68. package/dist/client/chunks/chart-radialbarchart-DPi9fYc7.js +109 -0
  69. package/dist/client/chunks/chart-radialbarchart-DPi9fYc7.js.map +1 -0
  70. package/dist/client/chunks/chart-radialbarchart-config-DicXYrMW.js +31 -0
  71. package/dist/client/chunks/chart-radialbarchart-config-DicXYrMW.js.map +1 -0
  72. package/dist/client/chunks/chart-scatterchart-DNleJCr4.js +201 -0
  73. package/dist/client/chunks/chart-scatterchart-DNleJCr4.js.map +1 -0
  74. package/dist/client/chunks/chart-scatterchart-config-DgYa-5vm.js +41 -0
  75. package/dist/client/chunks/chart-scatterchart-config-DgYa-5vm.js.map +1 -0
  76. package/dist/client/chunks/chart-treemapchart-B2-Qr28e.js +253 -0
  77. package/dist/client/chunks/chart-treemapchart-B2-Qr28e.js.map +1 -0
  78. package/dist/client/chunks/chart-treemapchart-config-DGhteyBe.js +40 -0
  79. package/dist/client/chunks/chart-treemapchart-config-DGhteyBe.js.map +1 -0
  80. package/dist/client/chunks/charts-BmpuCBGG.js +286 -0
  81. package/dist/client/chunks/charts-BmpuCBGG.js.map +1 -0
  82. package/dist/client/chunks/{icons-BWMWCuY7.js → icons-D-n_woAP.js} +614 -614
  83. package/dist/client/chunks/icons-D-n_woAP.js.map +1 -0
  84. package/dist/client/chunks/index-EfJ-vN-5.js +8707 -0
  85. package/dist/client/chunks/index-EfJ-vN-5.js.map +1 -0
  86. package/dist/client/components.js +11 -11
  87. package/dist/client/hooks.js +8 -8
  88. package/dist/client/index.d.ts +18 -1
  89. package/dist/client/index.js +9135 -39
  90. package/dist/client/index.js.map +1 -1
  91. package/dist/client/providers.d.ts +1 -0
  92. package/dist/client/providers.js +8 -4
  93. package/dist/client/providers.js.map +1 -1
  94. package/dist/client/styles.css +1 -1
  95. package/dist/client-bundle-stats.html +1 -1
  96. package/dist/server/index.cjs +16 -16
  97. package/dist/server/index.d.ts +0 -286
  98. package/dist/server/index.js +767 -881
  99. package/package.json +7 -2
  100. package/dist/client/chunks/charts-jwgcWeFt.js +0 -2580
  101. package/dist/client/chunks/charts-jwgcWeFt.js.map +0 -1
  102. package/dist/client/chunks/components-DALzorPs.js +0 -22432
  103. package/dist/client/chunks/components-DALzorPs.js.map +0 -1
  104. package/dist/client/chunks/icons-BWMWCuY7.js.map +0 -1
  105. package/dist/client/chunks/providers-D7zRgZrO.js +0 -308
  106. package/dist/client/chunks/providers-D7zRgZrO.js.map +0 -1
@@ -0,0 +1,3713 @@
1
+ import { jsx as W, jsxs as Ht } from "react/jsx-runtime";
2
+ import { useState as ht, useCallback as pe, useEffect as Gt, useContext as br, createContext as Mr, useMemo as Ze, useRef as Ke, useLayoutEffect as kr } from "react";
3
+ class Sr {
4
+ apiUrl;
5
+ headers;
6
+ credentials;
7
+ constructor(e, n = {}) {
8
+ this.apiUrl = n.apiUrl || "/cubejs-api/v1", this.headers = {
9
+ "Content-Type": "application/json",
10
+ ...n.headers
11
+ }, this.credentials = n.credentials ?? "include", e && (this.headers.Authorization = e);
12
+ }
13
+ async load(e) {
14
+ const n = JSON.stringify(e), r = encodeURIComponent(n), i = `${this.apiUrl}/load?query=${r}`, a = await fetch(i, {
15
+ method: "GET",
16
+ headers: {
17
+ // Remove Content-Type for GET request
18
+ ...Object.fromEntries(
19
+ Object.entries(this.headers).filter(([s]) => s !== "Content-Type")
20
+ )
21
+ },
22
+ credentials: this.credentials
23
+ });
24
+ if (!a.ok) {
25
+ let s = `Cube query failed: ${a.status}`;
26
+ try {
27
+ const u = await a.text();
28
+ try {
29
+ const c = JSON.parse(u);
30
+ c.error ? s = c.error : s += ` ${u}`;
31
+ } catch {
32
+ s += ` ${u}`;
33
+ }
34
+ } catch {
35
+ }
36
+ throw new Error(s);
37
+ }
38
+ const o = await a.json();
39
+ return new ye(o);
40
+ }
41
+ async meta() {
42
+ const e = `${this.apiUrl}/meta`, n = await fetch(e, {
43
+ method: "GET",
44
+ headers: this.headers,
45
+ credentials: this.credentials
46
+ });
47
+ if (!n.ok)
48
+ throw new Error(`Failed to fetch meta: ${n.status}`);
49
+ return n.json();
50
+ }
51
+ async sql(e) {
52
+ const n = encodeURIComponent(JSON.stringify(e)), r = `${this.apiUrl}/sql?query=${n}`, i = await fetch(r, {
53
+ method: "GET",
54
+ headers: {
55
+ // Remove Content-Type for GET request
56
+ ...Object.fromEntries(
57
+ Object.entries(this.headers).filter(([a]) => a !== "Content-Type")
58
+ )
59
+ },
60
+ credentials: this.credentials
61
+ });
62
+ if (!i.ok)
63
+ throw new Error(`SQL generation failed: ${i.status}`);
64
+ return i.json();
65
+ }
66
+ async dryRun(e) {
67
+ const n = `${this.apiUrl}/dry-run`, r = await fetch(n, {
68
+ method: "POST",
69
+ headers: this.headers,
70
+ credentials: this.credentials,
71
+ body: JSON.stringify({ query: e })
72
+ });
73
+ if (!r.ok) {
74
+ let i = `Dry run failed: ${r.status}`;
75
+ try {
76
+ const a = await r.text();
77
+ try {
78
+ const o = JSON.parse(a);
79
+ o.error ? i = o.error : i += ` ${a}`;
80
+ } catch {
81
+ i += ` ${a}`;
82
+ }
83
+ } catch {
84
+ }
85
+ throw new Error(i);
86
+ }
87
+ return r.json();
88
+ }
89
+ /**
90
+ * Execute multiple queries in a single batch request
91
+ * Used by BatchCoordinator to optimize network requests
92
+ */
93
+ async batchLoad(e) {
94
+ const n = `${this.apiUrl}/batch`, r = await fetch(n, {
95
+ method: "POST",
96
+ headers: this.headers,
97
+ credentials: this.credentials,
98
+ body: JSON.stringify({ queries: e })
99
+ });
100
+ if (!r.ok) {
101
+ let a = `Batch query failed: ${r.status}`;
102
+ try {
103
+ const o = await r.text();
104
+ try {
105
+ const s = JSON.parse(o);
106
+ s.error ? a = s.error : a += ` ${o}`;
107
+ } catch {
108
+ a += ` ${o}`;
109
+ }
110
+ } catch {
111
+ }
112
+ throw new Error(a);
113
+ }
114
+ return (await r.json()).results.map((a) => !a.success && a.error ? {
115
+ ...new ye({ data: [], annotation: {} }),
116
+ error: a.error
117
+ } : new ye(a));
118
+ }
119
+ }
120
+ class ye {
121
+ loadResponse;
122
+ constructor(e) {
123
+ this.loadResponse = e;
124
+ }
125
+ rawData() {
126
+ return this.loadResponse.results && this.loadResponse.results[0] ? this.loadResponse.results[0].data || [] : this.loadResponse.data || [];
127
+ }
128
+ tablePivot() {
129
+ return this.rawData();
130
+ }
131
+ series() {
132
+ return this.rawData();
133
+ }
134
+ annotation() {
135
+ return this.loadResponse.results && this.loadResponse.results[0] ? this.loadResponse.results[0].annotation || {} : this.loadResponse.annotation || {};
136
+ }
137
+ }
138
+ function Nr(t, e = {}) {
139
+ return new Sr(t, e);
140
+ }
141
+ const $r = 900 * 1e3;
142
+ let pt = null;
143
+ function Tr(t) {
144
+ const e = {};
145
+ return t.cubes.forEach((n) => {
146
+ n.measures.forEach((r) => {
147
+ e[r.name] = r.title || r.shortTitle || r.name;
148
+ }), n.dimensions.forEach((r) => {
149
+ e[r.name] = r.title || r.shortTitle || r.name;
150
+ }), n.segments.forEach((r) => {
151
+ e[r.name] = r.title || r.shortTitle || r.name;
152
+ });
153
+ }), e;
154
+ }
155
+ function Er() {
156
+ return pt ? Date.now() - pt.timestamp < $r : !1;
157
+ }
158
+ function Ar(t) {
159
+ const [e, n] = ht(null), [r, i] = ht({}), [a, o] = ht(!0), [s, u] = ht(null), c = pe(async () => {
160
+ if (Er() && pt) {
161
+ n(pt.data), i(pt.labelMap), o(!1), u(null);
162
+ return;
163
+ }
164
+ try {
165
+ o(!0), u(null);
166
+ const f = await t.meta(), m = Tr(f);
167
+ pt = {
168
+ data: f,
169
+ labelMap: m,
170
+ timestamp: Date.now()
171
+ }, n(f), i(m);
172
+ } catch (f) {
173
+ const m = f instanceof Error ? f.message : "Failed to fetch metadata";
174
+ u(m), console.error("Failed to fetch cube metadata:", f);
175
+ } finally {
176
+ o(!1);
177
+ }
178
+ }, [t]);
179
+ Gt(() => {
180
+ c();
181
+ }, [c]);
182
+ const l = pe((f) => r[f] || f, [r]), d = pe(() => {
183
+ pt = null, c();
184
+ }, [c]);
185
+ return {
186
+ meta: e,
187
+ labelMap: r,
188
+ loading: a,
189
+ error: s,
190
+ refetch: d,
191
+ getFieldLabel: l
192
+ };
193
+ }
194
+ class Cr {
195
+ queue = [];
196
+ flushScheduled = !1;
197
+ batchExecutor;
198
+ delayMs;
199
+ constructor(e, n = 100) {
200
+ this.batchExecutor = e, this.delayMs = n;
201
+ }
202
+ /**
203
+ * Register a query to be batched. Returns a promise that resolves
204
+ * when the batch is executed and this specific query's result is available.
205
+ */
206
+ register(e) {
207
+ return new Promise((n, r) => {
208
+ this.queue.push({ query: e, resolve: n, reject: r }), this.flushScheduled || this.scheduleFlush();
209
+ });
210
+ }
211
+ /**
212
+ * Schedule a flush after a short delay to collect multiple queries.
213
+ * The delay allows queries from lazy-loaded portlets that become visible
214
+ * during the same scroll action to be batched together.
215
+ */
216
+ scheduleFlush() {
217
+ this.flushScheduled = !0, setTimeout(() => {
218
+ this.flush();
219
+ }, this.delayMs);
220
+ }
221
+ /**
222
+ * Execute all queued queries as a batch and resolve individual promises
223
+ */
224
+ async flush() {
225
+ this.flushScheduled = !1;
226
+ const e = this.queue.slice();
227
+ if (this.queue = [], e.length !== 0)
228
+ try {
229
+ const n = e.map((i) => i.query), r = await this.batchExecutor(n);
230
+ e.forEach((i, a) => {
231
+ const o = r[a];
232
+ o && "error" in o && o.error ? i.reject(new Error(o.error)) : i.resolve(o);
233
+ });
234
+ } catch (n) {
235
+ e.forEach((r) => {
236
+ r.reject(n instanceof Error ? n : new Error(String(n)));
237
+ });
238
+ }
239
+ }
240
+ /**
241
+ * Get current queue size (useful for debugging)
242
+ */
243
+ getQueueSize() {
244
+ return this.queue.length;
245
+ }
246
+ /**
247
+ * Clear the queue (useful for testing/cleanup)
248
+ */
249
+ clear() {
250
+ this.queue = [], this.flushScheduled = !1;
251
+ }
252
+ }
253
+ const An = Mr(null);
254
+ function lu({
255
+ cubeApi: t,
256
+ apiOptions: e,
257
+ token: n,
258
+ options: r = {},
259
+ features: i = { enableAI: !0, aiEndpoint: "/api/ai/generate" },
260
+ // Default to AI enabled for backward compatibility
261
+ enableBatching: a = !0,
262
+ // Default to batching enabled
263
+ batchDelayMs: o = 100,
264
+ // Default 100ms batch window
265
+ children: s
266
+ }) {
267
+ const [u, c] = ht(null), l = u || {
268
+ apiOptions: e || { apiUrl: "/cubejs-api/v1" },
269
+ token: n
270
+ }, d = Ze(() => t && !e && !n ? t : Nr(l.token, l.apiOptions), [t, e, n, l.apiOptions, l.token]), f = Ze(() => {
271
+ if (!a)
272
+ return null;
273
+ const b = (k) => d.batchLoad(k);
274
+ return new Cr(b, o);
275
+ }, [a, d, o]), { meta: m, labelMap: E, loading: D, error: L, getFieldLabel: _, refetch: F } = Ar(d), y = {
276
+ cubeApi: d,
277
+ options: r,
278
+ meta: m,
279
+ labelMap: E,
280
+ metaLoading: D,
281
+ metaError: L,
282
+ getFieldLabel: _,
283
+ refetchMeta: F,
284
+ updateApiConfig: (b, k) => {
285
+ c({
286
+ apiOptions: b,
287
+ token: k
288
+ });
289
+ },
290
+ features: i,
291
+ batchCoordinator: f,
292
+ enableBatching: a
293
+ };
294
+ return /* @__PURE__ */ W(An.Provider, { value: y, children: s });
295
+ }
296
+ function Fr() {
297
+ const t = br(An);
298
+ if (!t)
299
+ throw new Error("useCubeContext must be used within a CubeProvider");
300
+ return t;
301
+ }
302
+ function fu(t) {
303
+ return t != null && !isNaN(Number(t));
304
+ }
305
+ function ke(t) {
306
+ if (t == null) return null;
307
+ const e = typeof t == "string" ? parseFloat(t) : Number(t);
308
+ return isNaN(e) ? null : e;
309
+ }
310
+ function hu(t) {
311
+ if (t == null) return "No data";
312
+ const e = typeof t == "number" ? t : parseFloat(t);
313
+ return isNaN(e) ? String(t) : Number.isInteger(e) ? e.toLocaleString() : parseFloat(e.toFixed(2)).toLocaleString();
314
+ }
315
+ function Se(t, e) {
316
+ return e[t] || t;
317
+ }
318
+ function Ie(t, e) {
319
+ if (!t) return String(t || "Unknown");
320
+ const n = String(t);
321
+ if (n.match(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}/)) {
322
+ let r = n;
323
+ n.includes(" ") && (r = n.replace(" ", "T").replace("+00", "Z").replace(/\+\d{2}:\d{2}$/, "Z")), !r.endsWith("Z") && !r.includes("+") && (r = r + "Z");
324
+ const i = new Date(r);
325
+ if (isNaN(i.getTime()))
326
+ return n;
327
+ const a = i.getUTCFullYear(), o = String(i.getUTCMonth() + 1).padStart(2, "0"), s = String(i.getUTCDate()).padStart(2, "0"), u = i.getUTCHours(), c = i.getUTCMinutes();
328
+ if (e)
329
+ switch (e.toLowerCase()) {
330
+ case "year":
331
+ return `${a}`;
332
+ case "quarter":
333
+ const f = Math.floor(i.getUTCMonth() / 3) + 1;
334
+ return `${a}-Q${f}`;
335
+ case "month":
336
+ return `${a}-${o}`;
337
+ case "week":
338
+ return `${a}-${o}-${s}`;
339
+ case "day":
340
+ return `${a}-${o}-${s}`;
341
+ case "hour":
342
+ return `${a}-${o}-${s} ${String(u).padStart(2, "0")}:00`;
343
+ case "minute":
344
+ return `${a}-${o}-${s} ${String(u).padStart(2, "0")}:${String(c).padStart(2, "0")}`;
345
+ }
346
+ const l = i.getUTCSeconds(), d = i.getUTCMilliseconds();
347
+ if (s === "01" && u === 0 && c === 0 && l === 0 && d === 0) {
348
+ if (o === "01" || o === "04" || o === "07" || o === "10") {
349
+ const f = Math.floor(i.getUTCMonth() / 3) + 1;
350
+ return `${a}-Q${f}`;
351
+ }
352
+ return `${a}-${o}`;
353
+ }
354
+ return u === 0 && c === 0 && l === 0 && d === 0 ? `${a}-${o}-${s}` : c === 0 && l === 0 && d === 0 ? `${a}-${o}-${s} ${String(u).padStart(2, "0")}:00` : `${a}-${o}-${s} ${String(u).padStart(2, "0")}:${String(c).padStart(2, "0")}`;
355
+ }
356
+ return n;
357
+ }
358
+ function Cn(t, e) {
359
+ try {
360
+ if (t?.timeDimensions) {
361
+ const r = t.timeDimensions.find((i) => e === i.dimension || e.startsWith(i.dimension.replace(".", "_")) || e === `${i.dimension}_${i.granularity}`);
362
+ if (r?.granularity)
363
+ return r.granularity;
364
+ }
365
+ const n = e.match(/_([a-z]+)$/);
366
+ if (n) {
367
+ const r = n[1];
368
+ if (["year", "quarter", "month", "week", "day", "hour", "minute", "second"].includes(r))
369
+ return r;
370
+ }
371
+ return;
372
+ } catch {
373
+ return;
374
+ }
375
+ }
376
+ function zr(t, e, n, r, i = {}) {
377
+ if (!t || t.length === 0) return [];
378
+ const a = Cn(r, e);
379
+ return t.map((o) => {
380
+ const s = {
381
+ name: Ie(o[e], a) || o[e] || "Unknown"
382
+ };
383
+ return n.forEach((u) => {
384
+ const c = Se(u, i);
385
+ s[c] = ke(o[u]);
386
+ }), s;
387
+ });
388
+ }
389
+ function du(t, e, n, r, i, a = {}) {
390
+ if (!t || t.length === 0)
391
+ return { data: [], seriesKeys: [], hasDimensions: !1 };
392
+ const o = r || {}, s = [
393
+ ...o.dimensions || [],
394
+ ...o.timeDimensions?.map((m) => m.dimension) || []
395
+ ], u = o.measures || [], c = n.filter((m) => u.includes(m)), l = (i || []).filter((m) => s.includes(m));
396
+ if (l.length > 0) {
397
+ const m = {};
398
+ t.forEach((L) => {
399
+ const _ = Cn(r, e), F = Ie(L[e], _) || L[e] || "Unknown";
400
+ m[F] || (m[F] = { name: String(F) }), c.forEach((I) => {
401
+ const y = Se(I, a), b = ke(L[I]);
402
+ if (b !== null) {
403
+ const k = m[F][y];
404
+ m[F][y] = k == null ? b : k + b;
405
+ } else y in m[F] || (m[F][y] = null);
406
+ }), l.forEach((I) => {
407
+ const y = L[I];
408
+ if (y != null) {
409
+ const b = String(y), k = c[0] || u.find(
410
+ (A) => A.includes("totalCost") || A.includes("count") || A.includes("sum")
411
+ ) || u[0];
412
+ if (k) {
413
+ const A = ke(L[k]);
414
+ if (A !== null) {
415
+ const M = m[F][b];
416
+ m[F][b] = M == null ? A : M + A;
417
+ } else b in m[F] || (m[F][b] = null);
418
+ }
419
+ }
420
+ });
421
+ });
422
+ const E = Object.values(m), D = Array.from(new Set(
423
+ t.flatMap(
424
+ (L) => l.map((_) => {
425
+ const F = L[_];
426
+ return F != null ? String(F) : null;
427
+ }).filter((_) => _ !== null)
428
+ )
429
+ ));
430
+ return {
431
+ data: E,
432
+ seriesKeys: D,
433
+ hasDimensions: !0
434
+ };
435
+ }
436
+ const d = zr(t, e, n, r, a), f = n.map((m) => Se(m, a));
437
+ return {
438
+ data: d,
439
+ seriesKeys: f,
440
+ hasDimensions: !1
441
+ };
442
+ }
443
+ const mu = [
444
+ "#3b82f6",
445
+ // blue
446
+ "#10b981",
447
+ // green
448
+ "#f59e0b",
449
+ // yellow
450
+ "#ef4444",
451
+ // red
452
+ "#8b5cf6",
453
+ // purple
454
+ "#f97316",
455
+ // orange
456
+ "#06b6d4",
457
+ // cyan
458
+ "#84cc16"
459
+ // lime
460
+ ], Dr = [
461
+ "#440154",
462
+ // dark purple
463
+ "#414487",
464
+ // purple-blue
465
+ "#2a788e",
466
+ // teal
467
+ "#22a884",
468
+ // green-teal
469
+ "#7ad151",
470
+ // green
471
+ "#fde725"
472
+ // yellow
473
+ ], gu = "#10b981", pu = "#ef4444", yu = {
474
+ top: 5,
475
+ right: 30,
476
+ left: 20,
477
+ bottom: 5
478
+ };
479
+ function wu(t) {
480
+ return typeof window > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(`--dc-${t}`).trim();
481
+ }
482
+ function Rr(t, e) {
483
+ typeof window > "u" || document.documentElement.style.setProperty(`--dc-${t}`, e);
484
+ }
485
+ function xu(t) {
486
+ typeof window > "u" || Object.entries(t.colors).forEach(([e, n]) => {
487
+ if (n) {
488
+ const r = e.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
489
+ Rr(r, n);
490
+ }
491
+ });
492
+ }
493
+ function vu() {
494
+ if (typeof window > "u") return;
495
+ const t = document.documentElement.style;
496
+ Array.from(t).forEach((n) => {
497
+ n.startsWith("--dc-") && t.removeProperty(n);
498
+ });
499
+ }
500
+ function jt() {
501
+ if (typeof window > "u") return "light";
502
+ const t = localStorage.getItem("theme");
503
+ if (t === "dark" || t === "neon" || t === "light")
504
+ return t;
505
+ const e = document.documentElement.getAttribute("data-theme");
506
+ return e === "dark" || e === "neon" ? e : document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") ? "dark" : document.documentElement.classList.contains("neon") || document.body.classList.contains("neon") ? "neon" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
507
+ }
508
+ function _u(t) {
509
+ typeof window > "u" || (document.documentElement.classList.remove("dark", "neon"), document.documentElement.setAttribute("data-theme", t), (t === "dark" || t === "neon") && document.documentElement.classList.add(t), localStorage.setItem("theme", t));
510
+ }
511
+ function bu() {
512
+ const t = jt();
513
+ return t === "dark" || t === "neon";
514
+ }
515
+ function Lr(t) {
516
+ if (typeof window > "u") return () => {
517
+ };
518
+ const e = new MutationObserver(() => {
519
+ t(jt());
520
+ });
521
+ e.observe(document.documentElement, {
522
+ attributes: !0,
523
+ attributeFilter: ["class", "data-theme"]
524
+ });
525
+ const n = window.matchMedia("(prefers-color-scheme: dark)"), r = () => t(jt());
526
+ return n.addEventListener("change", r), () => {
527
+ e.disconnect(), n.removeEventListener("change", r);
528
+ };
529
+ }
530
+ const Mu = {
531
+ light: {
532
+ name: "light",
533
+ colors: {
534
+ surface: "#ffffff",
535
+ surfaceSecondary: "#f9fafb",
536
+ text: "#111827",
537
+ textSecondary: "#374151",
538
+ textMuted: "#6b7280",
539
+ border: "#e5e7eb",
540
+ primary: "#3b82f6",
541
+ primaryHover: "#2563eb"
542
+ }
543
+ },
544
+ dark: {
545
+ name: "dark",
546
+ colors: {
547
+ surface: "#1e293b",
548
+ surfaceSecondary: "#334155",
549
+ text: "#f1f5f9",
550
+ textSecondary: "#e2e8f0",
551
+ textMuted: "#cbd5e1",
552
+ border: "#475569",
553
+ primary: "#60a5fa",
554
+ primaryHover: "#3b82f6"
555
+ }
556
+ },
557
+ neon: {
558
+ name: "neon",
559
+ colors: {
560
+ surface: "#0a0118",
561
+ surfaceSecondary: "#1a0f2e",
562
+ surfaceTertiary: "#2a1f3e",
563
+ text: "#ffffff",
564
+ textSecondary: "#e0e0ff",
565
+ textMuted: "#b0b0d0",
566
+ border: "#ff00ff",
567
+ borderSecondary: "#00ffff",
568
+ primary: "#00ffff",
569
+ primaryHover: "#00cccc",
570
+ primaryContent: "#000000",
571
+ success: "#00ff00",
572
+ warning: "#ffff00",
573
+ error: "#ff0066",
574
+ info: "#00ffff",
575
+ danger: "#ff1493"
576
+ }
577
+ }
578
+ };
579
+ function Qt(t, e) {
580
+ return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
581
+ }
582
+ function Ir(t, e) {
583
+ return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
584
+ }
585
+ function Fn(t) {
586
+ let e, n, r;
587
+ t.length !== 2 ? (e = Qt, n = (s, u) => Qt(t(s), u), r = (s, u) => t(s) - u) : (e = t === Qt || t === Ir ? t : qr, n = t, r = t);
588
+ function i(s, u, c = 0, l = s.length) {
589
+ if (c < l) {
590
+ if (e(u, u) !== 0) return l;
591
+ do {
592
+ const d = c + l >>> 1;
593
+ n(s[d], u) < 0 ? c = d + 1 : l = d;
594
+ } while (c < l);
595
+ }
596
+ return c;
597
+ }
598
+ function a(s, u, c = 0, l = s.length) {
599
+ if (c < l) {
600
+ if (e(u, u) !== 0) return l;
601
+ do {
602
+ const d = c + l >>> 1;
603
+ n(s[d], u) <= 0 ? c = d + 1 : l = d;
604
+ } while (c < l);
605
+ }
606
+ return c;
607
+ }
608
+ function o(s, u, c = 0, l = s.length) {
609
+ const d = i(s, u, c, l - 1);
610
+ return d > c && r(s[d - 1], u) > -r(s[d], u) ? d - 1 : d;
611
+ }
612
+ return { left: i, center: o, right: a };
613
+ }
614
+ function qr() {
615
+ return 0;
616
+ }
617
+ function Pr(t) {
618
+ return t === null ? NaN : +t;
619
+ }
620
+ const Hr = Fn(Qt), zn = Hr.right;
621
+ Fn(Pr).center;
622
+ function ku(t, e) {
623
+ let n, r;
624
+ if (e === void 0)
625
+ for (const i of t)
626
+ i != null && (n === void 0 ? i >= i && (n = r = i) : (n > i && (n = i), r < i && (r = i)));
627
+ else {
628
+ let i = -1;
629
+ for (let a of t)
630
+ (a = e(a, ++i, t)) != null && (n === void 0 ? a >= a && (n = r = a) : (n > a && (n = a), r < a && (r = a)));
631
+ }
632
+ return [n, r];
633
+ }
634
+ class je extends Map {
635
+ constructor(e, n = Xr) {
636
+ if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), e != null) for (const [r, i] of e) this.set(r, i);
637
+ }
638
+ get(e) {
639
+ return super.get(tn(this, e));
640
+ }
641
+ has(e) {
642
+ return super.has(tn(this, e));
643
+ }
644
+ set(e, n) {
645
+ return super.set(Or(this, e), n);
646
+ }
647
+ delete(e) {
648
+ return super.delete(Vr(this, e));
649
+ }
650
+ }
651
+ function tn({ _intern: t, _key: e }, n) {
652
+ const r = e(n);
653
+ return t.has(r) ? t.get(r) : n;
654
+ }
655
+ function Or({ _intern: t, _key: e }, n) {
656
+ const r = e(n);
657
+ return t.has(r) ? t.get(r) : (t.set(r, n), n);
658
+ }
659
+ function Vr({ _intern: t, _key: e }, n) {
660
+ const r = e(n);
661
+ return t.has(r) && (n = t.get(r), t.delete(r)), n;
662
+ }
663
+ function Xr(t) {
664
+ return t !== null && typeof t == "object" ? t.valueOf() : t;
665
+ }
666
+ const Yr = Math.sqrt(50), Ur = Math.sqrt(10), Wr = Math.sqrt(2);
667
+ function te(t, e, n) {
668
+ const r = (e - t) / Math.max(0, n), i = Math.floor(Math.log10(r)), a = r / Math.pow(10, i), o = a >= Yr ? 10 : a >= Ur ? 5 : a >= Wr ? 2 : 1;
669
+ let s, u, c;
670
+ return i < 0 ? (c = Math.pow(10, -i) / o, s = Math.round(t * c), u = Math.round(e * c), s / c < t && ++s, u / c > e && --u, c = -c) : (c = Math.pow(10, i) * o, s = Math.round(t / c), u = Math.round(e / c), s * c < t && ++s, u * c > e && --u), u < s && 0.5 <= n && n < 2 ? te(t, e, n * 2) : [s, u, c];
671
+ }
672
+ function Gr(t, e, n) {
673
+ if (e = +e, t = +t, n = +n, !(n > 0)) return [];
674
+ if (t === e) return [t];
675
+ const r = e < t, [i, a, o] = r ? te(e, t, n) : te(t, e, n);
676
+ if (!(a >= i)) return [];
677
+ const s = a - i + 1, u = new Array(s);
678
+ if (r)
679
+ if (o < 0) for (let c = 0; c < s; ++c) u[c] = (a - c) / -o;
680
+ else for (let c = 0; c < s; ++c) u[c] = (a - c) * o;
681
+ else if (o < 0) for (let c = 0; c < s; ++c) u[c] = (i + c) / -o;
682
+ else for (let c = 0; c < s; ++c) u[c] = (i + c) * o;
683
+ return u;
684
+ }
685
+ function Ne(t, e, n) {
686
+ return e = +e, t = +t, n = +n, te(t, e, n)[2];
687
+ }
688
+ function Qr(t, e, n) {
689
+ e = +e, t = +t, n = +n;
690
+ const r = e < t, i = r ? Ne(e, t, n) : Ne(t, e, n);
691
+ return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
692
+ }
693
+ function en(t, e) {
694
+ let n;
695
+ if (e === void 0)
696
+ for (const r of t)
697
+ r != null && (n < r || n === void 0 && r >= r) && (n = r);
698
+ else {
699
+ let r = -1;
700
+ for (let i of t)
701
+ (i = e(i, ++r, t)) != null && (n < i || n === void 0 && i >= i) && (n = i);
702
+ }
703
+ return n;
704
+ }
705
+ function nn(t, e) {
706
+ let n;
707
+ if (e === void 0)
708
+ for (const r of t)
709
+ r != null && (n > r || n === void 0 && r >= r) && (n = r);
710
+ else {
711
+ let r = -1;
712
+ for (let i of t)
713
+ (i = e(i, ++r, t)) != null && (n > i || n === void 0 && i >= i) && (n = i);
714
+ }
715
+ return n;
716
+ }
717
+ function Br(t) {
718
+ return t;
719
+ }
720
+ var we = 1, xe = 2, $e = 3, Et = 4, rn = 1e-6;
721
+ function Jr(t) {
722
+ return "translate(" + t + ",0)";
723
+ }
724
+ function Zr(t) {
725
+ return "translate(0," + t + ")";
726
+ }
727
+ function Kr(t) {
728
+ return (e) => +t(e);
729
+ }
730
+ function jr(t, e) {
731
+ return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (n) => +t(n) + e;
732
+ }
733
+ function ti() {
734
+ return !this.__axis;
735
+ }
736
+ function Dn(t, e) {
737
+ var n = [], r = null, i = null, a = 6, o = 6, s = 3, u = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, c = t === we || t === Et ? -1 : 1, l = t === Et || t === xe ? "x" : "y", d = t === we || t === $e ? Jr : Zr;
738
+ function f(m) {
739
+ var E = r ?? (e.ticks ? e.ticks.apply(e, n) : e.domain()), D = i ?? (e.tickFormat ? e.tickFormat.apply(e, n) : Br), L = Math.max(a, 0) + s, _ = e.range(), F = +_[0] + u, I = +_[_.length - 1] + u, y = (e.bandwidth ? jr : Kr)(e.copy(), u), b = m.selection ? m.selection() : m, k = b.selectAll(".domain").data([null]), A = b.selectAll(".tick").data(E, e).order(), M = A.exit(), p = A.enter().append("g").attr("class", "tick"), R = A.select("line"), w = A.select("text");
740
+ k = k.merge(k.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), A = A.merge(p), R = R.merge(p.append("line").attr("stroke", "currentColor").attr(l + "2", c * a)), w = w.merge(p.append("text").attr("fill", "currentColor").attr(l, c * L).attr("dy", t === we ? "0em" : t === $e ? "0.71em" : "0.32em")), m !== b && (k = k.transition(m), A = A.transition(m), R = R.transition(m), w = w.transition(m), M = M.transition(m).attr("opacity", rn).attr("transform", function(z) {
741
+ return isFinite(z = y(z)) ? d(z + u) : this.getAttribute("transform");
742
+ }), p.attr("opacity", rn).attr("transform", function(z) {
743
+ var q = this.parentNode.__axis;
744
+ return d((q && isFinite(q = q(z)) ? q : y(z)) + u);
745
+ })), M.remove(), k.attr("d", t === Et || t === xe ? o ? "M" + c * o + "," + F + "H" + u + "V" + I + "H" + c * o : "M" + u + "," + F + "V" + I : o ? "M" + F + "," + c * o + "V" + u + "H" + I + "V" + c * o : "M" + F + "," + u + "H" + I), A.attr("opacity", 1).attr("transform", function(z) {
746
+ return d(y(z) + u);
747
+ }), R.attr(l + "2", c * a), w.attr(l, c * L).text(D), b.filter(ti).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === xe ? "start" : t === Et ? "end" : "middle"), b.each(function() {
748
+ this.__axis = y;
749
+ });
750
+ }
751
+ return f.scale = function(m) {
752
+ return arguments.length ? (e = m, f) : e;
753
+ }, f.ticks = function() {
754
+ return n = Array.from(arguments), f;
755
+ }, f.tickArguments = function(m) {
756
+ return arguments.length ? (n = m == null ? [] : Array.from(m), f) : n.slice();
757
+ }, f.tickValues = function(m) {
758
+ return arguments.length ? (r = m == null ? null : Array.from(m), f) : r && r.slice();
759
+ }, f.tickFormat = function(m) {
760
+ return arguments.length ? (i = m, f) : i;
761
+ }, f.tickSize = function(m) {
762
+ return arguments.length ? (a = o = +m, f) : a;
763
+ }, f.tickSizeInner = function(m) {
764
+ return arguments.length ? (a = +m, f) : a;
765
+ }, f.tickSizeOuter = function(m) {
766
+ return arguments.length ? (o = +m, f) : o;
767
+ }, f.tickPadding = function(m) {
768
+ return arguments.length ? (s = +m, f) : s;
769
+ }, f.offset = function(m) {
770
+ return arguments.length ? (u = +m, f) : u;
771
+ }, f;
772
+ }
773
+ function Su(t) {
774
+ return Dn($e, t);
775
+ }
776
+ function Nu(t) {
777
+ return Dn(Et, t);
778
+ }
779
+ var ei = { value: () => {
780
+ } };
781
+ function le() {
782
+ for (var t = 0, e = arguments.length, n = {}, r; t < e; ++t) {
783
+ if (!(r = arguments[t] + "") || r in n || /[\s.]/.test(r)) throw new Error("illegal type: " + r);
784
+ n[r] = [];
785
+ }
786
+ return new Bt(n);
787
+ }
788
+ function Bt(t) {
789
+ this._ = t;
790
+ }
791
+ function ni(t, e) {
792
+ return t.trim().split(/^|\s+/).map(function(n) {
793
+ var r = "", i = n.indexOf(".");
794
+ if (i >= 0 && (r = n.slice(i + 1), n = n.slice(0, i)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n);
795
+ return { type: n, name: r };
796
+ });
797
+ }
798
+ Bt.prototype = le.prototype = {
799
+ constructor: Bt,
800
+ on: function(t, e) {
801
+ var n = this._, r = ni(t + "", n), i, a = -1, o = r.length;
802
+ if (arguments.length < 2) {
803
+ for (; ++a < o; ) if ((i = (t = r[a]).type) && (i = ri(n[i], t.name))) return i;
804
+ return;
805
+ }
806
+ if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
807
+ for (; ++a < o; )
808
+ if (i = (t = r[a]).type) n[i] = on(n[i], t.name, e);
809
+ else if (e == null) for (i in n) n[i] = on(n[i], t.name, null);
810
+ return this;
811
+ },
812
+ copy: function() {
813
+ var t = {}, e = this._;
814
+ for (var n in e) t[n] = e[n].slice();
815
+ return new Bt(t);
816
+ },
817
+ call: function(t, e) {
818
+ if ((i = arguments.length - 2) > 0) for (var n = new Array(i), r = 0, i, a; r < i; ++r) n[r] = arguments[r + 2];
819
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
820
+ for (a = this._[t], r = 0, i = a.length; r < i; ++r) a[r].value.apply(e, n);
821
+ },
822
+ apply: function(t, e, n) {
823
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
824
+ for (var r = this._[t], i = 0, a = r.length; i < a; ++i) r[i].value.apply(e, n);
825
+ }
826
+ };
827
+ function ri(t, e) {
828
+ for (var n = 0, r = t.length, i; n < r; ++n)
829
+ if ((i = t[n]).name === e)
830
+ return i.value;
831
+ }
832
+ function on(t, e, n) {
833
+ for (var r = 0, i = t.length; r < i; ++r)
834
+ if (t[r].name === e) {
835
+ t[r] = ei, t = t.slice(0, r).concat(t.slice(r + 1));
836
+ break;
837
+ }
838
+ return n != null && t.push({ name: e, value: n }), t;
839
+ }
840
+ var Te = "http://www.w3.org/1999/xhtml";
841
+ const an = {
842
+ svg: "http://www.w3.org/2000/svg",
843
+ xhtml: Te,
844
+ xlink: "http://www.w3.org/1999/xlink",
845
+ xml: "http://www.w3.org/XML/1998/namespace",
846
+ xmlns: "http://www.w3.org/2000/xmlns/"
847
+ };
848
+ function fe(t) {
849
+ var e = t += "", n = e.indexOf(":");
850
+ return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), an.hasOwnProperty(e) ? { space: an[e], local: t } : t;
851
+ }
852
+ function ii(t) {
853
+ return function() {
854
+ var e = this.ownerDocument, n = this.namespaceURI;
855
+ return n === Te && e.documentElement.namespaceURI === Te ? e.createElement(t) : e.createElementNS(n, t);
856
+ };
857
+ }
858
+ function oi(t) {
859
+ return function() {
860
+ return this.ownerDocument.createElementNS(t.space, t.local);
861
+ };
862
+ }
863
+ function Rn(t) {
864
+ var e = fe(t);
865
+ return (e.local ? oi : ii)(e);
866
+ }
867
+ function ai() {
868
+ }
869
+ function qe(t) {
870
+ return t == null ? ai : function() {
871
+ return this.querySelector(t);
872
+ };
873
+ }
874
+ function si(t) {
875
+ typeof t != "function" && (t = qe(t));
876
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
877
+ for (var a = e[i], o = a.length, s = r[i] = new Array(o), u, c, l = 0; l < o; ++l)
878
+ (u = a[l]) && (c = t.call(u, u.__data__, l, a)) && ("__data__" in u && (c.__data__ = u.__data__), s[l] = c);
879
+ return new Z(r, this._parents);
880
+ }
881
+ function ui(t) {
882
+ return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
883
+ }
884
+ function ci() {
885
+ return [];
886
+ }
887
+ function Ln(t) {
888
+ return t == null ? ci : function() {
889
+ return this.querySelectorAll(t);
890
+ };
891
+ }
892
+ function li(t) {
893
+ return function() {
894
+ return ui(t.apply(this, arguments));
895
+ };
896
+ }
897
+ function fi(t) {
898
+ typeof t == "function" ? t = li(t) : t = Ln(t);
899
+ for (var e = this._groups, n = e.length, r = [], i = [], a = 0; a < n; ++a)
900
+ for (var o = e[a], s = o.length, u, c = 0; c < s; ++c)
901
+ (u = o[c]) && (r.push(t.call(u, u.__data__, c, o)), i.push(u));
902
+ return new Z(r, i);
903
+ }
904
+ function In(t) {
905
+ return function() {
906
+ return this.matches(t);
907
+ };
908
+ }
909
+ function qn(t) {
910
+ return function(e) {
911
+ return e.matches(t);
912
+ };
913
+ }
914
+ var hi = Array.prototype.find;
915
+ function di(t) {
916
+ return function() {
917
+ return hi.call(this.children, t);
918
+ };
919
+ }
920
+ function mi() {
921
+ return this.firstElementChild;
922
+ }
923
+ function gi(t) {
924
+ return this.select(t == null ? mi : di(typeof t == "function" ? t : qn(t)));
925
+ }
926
+ var pi = Array.prototype.filter;
927
+ function yi() {
928
+ return Array.from(this.children);
929
+ }
930
+ function wi(t) {
931
+ return function() {
932
+ return pi.call(this.children, t);
933
+ };
934
+ }
935
+ function xi(t) {
936
+ return this.selectAll(t == null ? yi : wi(typeof t == "function" ? t : qn(t)));
937
+ }
938
+ function vi(t) {
939
+ typeof t != "function" && (t = In(t));
940
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
941
+ for (var a = e[i], o = a.length, s = r[i] = [], u, c = 0; c < o; ++c)
942
+ (u = a[c]) && t.call(u, u.__data__, c, a) && s.push(u);
943
+ return new Z(r, this._parents);
944
+ }
945
+ function Pn(t) {
946
+ return new Array(t.length);
947
+ }
948
+ function _i() {
949
+ return new Z(this._enter || this._groups.map(Pn), this._parents);
950
+ }
951
+ function ee(t, e) {
952
+ this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
953
+ }
954
+ ee.prototype = {
955
+ constructor: ee,
956
+ appendChild: function(t) {
957
+ return this._parent.insertBefore(t, this._next);
958
+ },
959
+ insertBefore: function(t, e) {
960
+ return this._parent.insertBefore(t, e);
961
+ },
962
+ querySelector: function(t) {
963
+ return this._parent.querySelector(t);
964
+ },
965
+ querySelectorAll: function(t) {
966
+ return this._parent.querySelectorAll(t);
967
+ }
968
+ };
969
+ function bi(t) {
970
+ return function() {
971
+ return t;
972
+ };
973
+ }
974
+ function Mi(t, e, n, r, i, a) {
975
+ for (var o = 0, s, u = e.length, c = a.length; o < c; ++o)
976
+ (s = e[o]) ? (s.__data__ = a[o], r[o] = s) : n[o] = new ee(t, a[o]);
977
+ for (; o < u; ++o)
978
+ (s = e[o]) && (i[o] = s);
979
+ }
980
+ function ki(t, e, n, r, i, a, o) {
981
+ var s, u, c = /* @__PURE__ */ new Map(), l = e.length, d = a.length, f = new Array(l), m;
982
+ for (s = 0; s < l; ++s)
983
+ (u = e[s]) && (f[s] = m = o.call(u, u.__data__, s, e) + "", c.has(m) ? i[s] = u : c.set(m, u));
984
+ for (s = 0; s < d; ++s)
985
+ m = o.call(t, a[s], s, a) + "", (u = c.get(m)) ? (r[s] = u, u.__data__ = a[s], c.delete(m)) : n[s] = new ee(t, a[s]);
986
+ for (s = 0; s < l; ++s)
987
+ (u = e[s]) && c.get(f[s]) === u && (i[s] = u);
988
+ }
989
+ function Si(t) {
990
+ return t.__data__;
991
+ }
992
+ function Ni(t, e) {
993
+ if (!arguments.length) return Array.from(this, Si);
994
+ var n = e ? ki : Mi, r = this._parents, i = this._groups;
995
+ typeof t != "function" && (t = bi(t));
996
+ for (var a = i.length, o = new Array(a), s = new Array(a), u = new Array(a), c = 0; c < a; ++c) {
997
+ var l = r[c], d = i[c], f = d.length, m = $i(t.call(l, l && l.__data__, c, r)), E = m.length, D = s[c] = new Array(E), L = o[c] = new Array(E), _ = u[c] = new Array(f);
998
+ n(l, d, D, L, _, m, e);
999
+ for (var F = 0, I = 0, y, b; F < E; ++F)
1000
+ if (y = D[F]) {
1001
+ for (F >= I && (I = F + 1); !(b = L[I]) && ++I < E; ) ;
1002
+ y._next = b || null;
1003
+ }
1004
+ }
1005
+ return o = new Z(o, r), o._enter = s, o._exit = u, o;
1006
+ }
1007
+ function $i(t) {
1008
+ return typeof t == "object" && "length" in t ? t : Array.from(t);
1009
+ }
1010
+ function Ti() {
1011
+ return new Z(this._exit || this._groups.map(Pn), this._parents);
1012
+ }
1013
+ function Ei(t, e, n) {
1014
+ var r = this.enter(), i = this, a = this.exit();
1015
+ return typeof t == "function" ? (r = t(r), r && (r = r.selection())) : r = r.append(t + ""), e != null && (i = e(i), i && (i = i.selection())), n == null ? a.remove() : n(a), r && i ? r.merge(i).order() : i;
1016
+ }
1017
+ function Ai(t) {
1018
+ for (var e = t.selection ? t.selection() : t, n = this._groups, r = e._groups, i = n.length, a = r.length, o = Math.min(i, a), s = new Array(i), u = 0; u < o; ++u)
1019
+ for (var c = n[u], l = r[u], d = c.length, f = s[u] = new Array(d), m, E = 0; E < d; ++E)
1020
+ (m = c[E] || l[E]) && (f[E] = m);
1021
+ for (; u < i; ++u)
1022
+ s[u] = n[u];
1023
+ return new Z(s, this._parents);
1024
+ }
1025
+ function Ci() {
1026
+ for (var t = this._groups, e = -1, n = t.length; ++e < n; )
1027
+ for (var r = t[e], i = r.length - 1, a = r[i], o; --i >= 0; )
1028
+ (o = r[i]) && (a && o.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(o, a), a = o);
1029
+ return this;
1030
+ }
1031
+ function Fi(t) {
1032
+ t || (t = zi);
1033
+ function e(d, f) {
1034
+ return d && f ? t(d.__data__, f.__data__) : !d - !f;
1035
+ }
1036
+ for (var n = this._groups, r = n.length, i = new Array(r), a = 0; a < r; ++a) {
1037
+ for (var o = n[a], s = o.length, u = i[a] = new Array(s), c, l = 0; l < s; ++l)
1038
+ (c = o[l]) && (u[l] = c);
1039
+ u.sort(e);
1040
+ }
1041
+ return new Z(i, this._parents).order();
1042
+ }
1043
+ function zi(t, e) {
1044
+ return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
1045
+ }
1046
+ function Di() {
1047
+ var t = arguments[0];
1048
+ return arguments[0] = this, t.apply(null, arguments), this;
1049
+ }
1050
+ function Ri() {
1051
+ return Array.from(this);
1052
+ }
1053
+ function Li() {
1054
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
1055
+ for (var r = t[e], i = 0, a = r.length; i < a; ++i) {
1056
+ var o = r[i];
1057
+ if (o) return o;
1058
+ }
1059
+ return null;
1060
+ }
1061
+ function Ii() {
1062
+ let t = 0;
1063
+ for (const e of this) ++t;
1064
+ return t;
1065
+ }
1066
+ function qi() {
1067
+ return !this.node();
1068
+ }
1069
+ function Pi(t) {
1070
+ for (var e = this._groups, n = 0, r = e.length; n < r; ++n)
1071
+ for (var i = e[n], a = 0, o = i.length, s; a < o; ++a)
1072
+ (s = i[a]) && t.call(s, s.__data__, a, i);
1073
+ return this;
1074
+ }
1075
+ function Hi(t) {
1076
+ return function() {
1077
+ this.removeAttribute(t);
1078
+ };
1079
+ }
1080
+ function Oi(t) {
1081
+ return function() {
1082
+ this.removeAttributeNS(t.space, t.local);
1083
+ };
1084
+ }
1085
+ function Vi(t, e) {
1086
+ return function() {
1087
+ this.setAttribute(t, e);
1088
+ };
1089
+ }
1090
+ function Xi(t, e) {
1091
+ return function() {
1092
+ this.setAttributeNS(t.space, t.local, e);
1093
+ };
1094
+ }
1095
+ function Yi(t, e) {
1096
+ return function() {
1097
+ var n = e.apply(this, arguments);
1098
+ n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
1099
+ };
1100
+ }
1101
+ function Ui(t, e) {
1102
+ return function() {
1103
+ var n = e.apply(this, arguments);
1104
+ n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
1105
+ };
1106
+ }
1107
+ function Wi(t, e) {
1108
+ var n = fe(t);
1109
+ if (arguments.length < 2) {
1110
+ var r = this.node();
1111
+ return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n);
1112
+ }
1113
+ return this.each((e == null ? n.local ? Oi : Hi : typeof e == "function" ? n.local ? Ui : Yi : n.local ? Xi : Vi)(n, e));
1114
+ }
1115
+ function Hn(t) {
1116
+ return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
1117
+ }
1118
+ function Gi(t) {
1119
+ return function() {
1120
+ this.style.removeProperty(t);
1121
+ };
1122
+ }
1123
+ function Qi(t, e, n) {
1124
+ return function() {
1125
+ this.style.setProperty(t, e, n);
1126
+ };
1127
+ }
1128
+ function Bi(t, e, n) {
1129
+ return function() {
1130
+ var r = e.apply(this, arguments);
1131
+ r == null ? this.style.removeProperty(t) : this.style.setProperty(t, r, n);
1132
+ };
1133
+ }
1134
+ function Ji(t, e, n) {
1135
+ return arguments.length > 1 ? this.each((e == null ? Gi : typeof e == "function" ? Bi : Qi)(t, e, n ?? "")) : Mt(this.node(), t);
1136
+ }
1137
+ function Mt(t, e) {
1138
+ return t.style.getPropertyValue(e) || Hn(t).getComputedStyle(t, null).getPropertyValue(e);
1139
+ }
1140
+ function Zi(t) {
1141
+ return function() {
1142
+ delete this[t];
1143
+ };
1144
+ }
1145
+ function Ki(t, e) {
1146
+ return function() {
1147
+ this[t] = e;
1148
+ };
1149
+ }
1150
+ function ji(t, e) {
1151
+ return function() {
1152
+ var n = e.apply(this, arguments);
1153
+ n == null ? delete this[t] : this[t] = n;
1154
+ };
1155
+ }
1156
+ function to(t, e) {
1157
+ return arguments.length > 1 ? this.each((e == null ? Zi : typeof e == "function" ? ji : Ki)(t, e)) : this.node()[t];
1158
+ }
1159
+ function On(t) {
1160
+ return t.trim().split(/^|\s+/);
1161
+ }
1162
+ function Pe(t) {
1163
+ return t.classList || new Vn(t);
1164
+ }
1165
+ function Vn(t) {
1166
+ this._node = t, this._names = On(t.getAttribute("class") || "");
1167
+ }
1168
+ Vn.prototype = {
1169
+ add: function(t) {
1170
+ var e = this._names.indexOf(t);
1171
+ e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
1172
+ },
1173
+ remove: function(t) {
1174
+ var e = this._names.indexOf(t);
1175
+ e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
1176
+ },
1177
+ contains: function(t) {
1178
+ return this._names.indexOf(t) >= 0;
1179
+ }
1180
+ };
1181
+ function Xn(t, e) {
1182
+ for (var n = Pe(t), r = -1, i = e.length; ++r < i; ) n.add(e[r]);
1183
+ }
1184
+ function Yn(t, e) {
1185
+ for (var n = Pe(t), r = -1, i = e.length; ++r < i; ) n.remove(e[r]);
1186
+ }
1187
+ function eo(t) {
1188
+ return function() {
1189
+ Xn(this, t);
1190
+ };
1191
+ }
1192
+ function no(t) {
1193
+ return function() {
1194
+ Yn(this, t);
1195
+ };
1196
+ }
1197
+ function ro(t, e) {
1198
+ return function() {
1199
+ (e.apply(this, arguments) ? Xn : Yn)(this, t);
1200
+ };
1201
+ }
1202
+ function io(t, e) {
1203
+ var n = On(t + "");
1204
+ if (arguments.length < 2) {
1205
+ for (var r = Pe(this.node()), i = -1, a = n.length; ++i < a; ) if (!r.contains(n[i])) return !1;
1206
+ return !0;
1207
+ }
1208
+ return this.each((typeof e == "function" ? ro : e ? eo : no)(n, e));
1209
+ }
1210
+ function oo() {
1211
+ this.textContent = "";
1212
+ }
1213
+ function ao(t) {
1214
+ return function() {
1215
+ this.textContent = t;
1216
+ };
1217
+ }
1218
+ function so(t) {
1219
+ return function() {
1220
+ var e = t.apply(this, arguments);
1221
+ this.textContent = e ?? "";
1222
+ };
1223
+ }
1224
+ function uo(t) {
1225
+ return arguments.length ? this.each(t == null ? oo : (typeof t == "function" ? so : ao)(t)) : this.node().textContent;
1226
+ }
1227
+ function co() {
1228
+ this.innerHTML = "";
1229
+ }
1230
+ function lo(t) {
1231
+ return function() {
1232
+ this.innerHTML = t;
1233
+ };
1234
+ }
1235
+ function fo(t) {
1236
+ return function() {
1237
+ var e = t.apply(this, arguments);
1238
+ this.innerHTML = e ?? "";
1239
+ };
1240
+ }
1241
+ function ho(t) {
1242
+ return arguments.length ? this.each(t == null ? co : (typeof t == "function" ? fo : lo)(t)) : this.node().innerHTML;
1243
+ }
1244
+ function mo() {
1245
+ this.nextSibling && this.parentNode.appendChild(this);
1246
+ }
1247
+ function go() {
1248
+ return this.each(mo);
1249
+ }
1250
+ function po() {
1251
+ this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
1252
+ }
1253
+ function yo() {
1254
+ return this.each(po);
1255
+ }
1256
+ function wo(t) {
1257
+ var e = typeof t == "function" ? t : Rn(t);
1258
+ return this.select(function() {
1259
+ return this.appendChild(e.apply(this, arguments));
1260
+ });
1261
+ }
1262
+ function xo() {
1263
+ return null;
1264
+ }
1265
+ function vo(t, e) {
1266
+ var n = typeof t == "function" ? t : Rn(t), r = e == null ? xo : typeof e == "function" ? e : qe(e);
1267
+ return this.select(function() {
1268
+ return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null);
1269
+ });
1270
+ }
1271
+ function _o() {
1272
+ var t = this.parentNode;
1273
+ t && t.removeChild(this);
1274
+ }
1275
+ function bo() {
1276
+ return this.each(_o);
1277
+ }
1278
+ function Mo() {
1279
+ var t = this.cloneNode(!1), e = this.parentNode;
1280
+ return e ? e.insertBefore(t, this.nextSibling) : t;
1281
+ }
1282
+ function ko() {
1283
+ var t = this.cloneNode(!0), e = this.parentNode;
1284
+ return e ? e.insertBefore(t, this.nextSibling) : t;
1285
+ }
1286
+ function So(t) {
1287
+ return this.select(t ? ko : Mo);
1288
+ }
1289
+ function No(t) {
1290
+ return arguments.length ? this.property("__data__", t) : this.node().__data__;
1291
+ }
1292
+ function $o(t) {
1293
+ return function(e) {
1294
+ t.call(this, e, this.__data__);
1295
+ };
1296
+ }
1297
+ function To(t) {
1298
+ return t.trim().split(/^|\s+/).map(function(e) {
1299
+ var n = "", r = e.indexOf(".");
1300
+ return r >= 0 && (n = e.slice(r + 1), e = e.slice(0, r)), { type: e, name: n };
1301
+ });
1302
+ }
1303
+ function Eo(t) {
1304
+ return function() {
1305
+ var e = this.__on;
1306
+ if (e) {
1307
+ for (var n = 0, r = -1, i = e.length, a; n < i; ++n)
1308
+ a = e[n], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++r] = a;
1309
+ ++r ? e.length = r : delete this.__on;
1310
+ }
1311
+ };
1312
+ }
1313
+ function Ao(t, e, n) {
1314
+ return function() {
1315
+ var r = this.__on, i, a = $o(e);
1316
+ if (r) {
1317
+ for (var o = 0, s = r.length; o < s; ++o)
1318
+ if ((i = r[o]).type === t.type && i.name === t.name) {
1319
+ this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = n), i.value = e;
1320
+ return;
1321
+ }
1322
+ }
1323
+ this.addEventListener(t.type, a, n), i = { type: t.type, name: t.name, value: e, listener: a, options: n }, r ? r.push(i) : this.__on = [i];
1324
+ };
1325
+ }
1326
+ function Co(t, e, n) {
1327
+ var r = To(t + ""), i, a = r.length, o;
1328
+ if (arguments.length < 2) {
1329
+ var s = this.node().__on;
1330
+ if (s) {
1331
+ for (var u = 0, c = s.length, l; u < c; ++u)
1332
+ for (i = 0, l = s[u]; i < a; ++i)
1333
+ if ((o = r[i]).type === l.type && o.name === l.name)
1334
+ return l.value;
1335
+ }
1336
+ return;
1337
+ }
1338
+ for (s = e ? Ao : Eo, i = 0; i < a; ++i) this.each(s(r[i], e, n));
1339
+ return this;
1340
+ }
1341
+ function Un(t, e, n) {
1342
+ var r = Hn(t), i = r.CustomEvent;
1343
+ typeof i == "function" ? i = new i(e, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(e, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(e, !1, !1)), t.dispatchEvent(i);
1344
+ }
1345
+ function Fo(t, e) {
1346
+ return function() {
1347
+ return Un(this, t, e);
1348
+ };
1349
+ }
1350
+ function zo(t, e) {
1351
+ return function() {
1352
+ return Un(this, t, e.apply(this, arguments));
1353
+ };
1354
+ }
1355
+ function Do(t, e) {
1356
+ return this.each((typeof e == "function" ? zo : Fo)(t, e));
1357
+ }
1358
+ function* Ro() {
1359
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
1360
+ for (var r = t[e], i = 0, a = r.length, o; i < a; ++i)
1361
+ (o = r[i]) && (yield o);
1362
+ }
1363
+ var Wn = [null];
1364
+ function Z(t, e) {
1365
+ this._groups = t, this._parents = e;
1366
+ }
1367
+ function Lt() {
1368
+ return new Z([[document.documentElement]], Wn);
1369
+ }
1370
+ function Lo() {
1371
+ return this;
1372
+ }
1373
+ Z.prototype = Lt.prototype = {
1374
+ constructor: Z,
1375
+ select: si,
1376
+ selectAll: fi,
1377
+ selectChild: gi,
1378
+ selectChildren: xi,
1379
+ filter: vi,
1380
+ data: Ni,
1381
+ enter: _i,
1382
+ exit: Ti,
1383
+ join: Ei,
1384
+ merge: Ai,
1385
+ selection: Lo,
1386
+ order: Ci,
1387
+ sort: Fi,
1388
+ call: Di,
1389
+ nodes: Ri,
1390
+ node: Li,
1391
+ size: Ii,
1392
+ empty: qi,
1393
+ each: Pi,
1394
+ attr: Wi,
1395
+ style: Ji,
1396
+ property: to,
1397
+ classed: io,
1398
+ text: uo,
1399
+ html: ho,
1400
+ raise: go,
1401
+ lower: yo,
1402
+ append: wo,
1403
+ insert: vo,
1404
+ remove: bo,
1405
+ clone: So,
1406
+ datum: No,
1407
+ on: Co,
1408
+ dispatch: Do,
1409
+ [Symbol.iterator]: Ro
1410
+ };
1411
+ function Q(t) {
1412
+ return typeof t == "string" ? new Z([[document.querySelector(t)]], [document.documentElement]) : new Z([[t]], Wn);
1413
+ }
1414
+ function Io(t) {
1415
+ let e;
1416
+ for (; e = t.sourceEvent; ) t = e;
1417
+ return t;
1418
+ }
1419
+ function ut(t, e) {
1420
+ if (t = Io(t), e === void 0 && (e = t.currentTarget), e) {
1421
+ var n = e.ownerSVGElement || e;
1422
+ if (n.createSVGPoint) {
1423
+ var r = n.createSVGPoint();
1424
+ return r.x = t.clientX, r.y = t.clientY, r = r.matrixTransform(e.getScreenCTM().inverse()), [r.x, r.y];
1425
+ }
1426
+ if (e.getBoundingClientRect) {
1427
+ var i = e.getBoundingClientRect();
1428
+ return [t.clientX - i.left - e.clientLeft, t.clientY - i.top - e.clientTop];
1429
+ }
1430
+ }
1431
+ return [t.pageX, t.pageY];
1432
+ }
1433
+ const qo = { passive: !1 }, Ft = { capture: !0, passive: !1 };
1434
+ function ve(t) {
1435
+ t.stopImmediatePropagation();
1436
+ }
1437
+ function _t(t) {
1438
+ t.preventDefault(), t.stopImmediatePropagation();
1439
+ }
1440
+ function Gn(t) {
1441
+ var e = t.document.documentElement, n = Q(t).on("dragstart.drag", _t, Ft);
1442
+ "onselectstart" in e ? n.on("selectstart.drag", _t, Ft) : (e.__noselect = e.style.MozUserSelect, e.style.MozUserSelect = "none");
1443
+ }
1444
+ function Qn(t, e) {
1445
+ var n = t.document.documentElement, r = Q(t).on("dragstart.drag", null);
1446
+ e && (r.on("click.drag", _t, Ft), setTimeout(function() {
1447
+ r.on("click.drag", null);
1448
+ }, 0)), "onselectstart" in n ? r.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
1449
+ }
1450
+ const Ot = (t) => () => t;
1451
+ function Ee(t, {
1452
+ sourceEvent: e,
1453
+ subject: n,
1454
+ target: r,
1455
+ identifier: i,
1456
+ active: a,
1457
+ x: o,
1458
+ y: s,
1459
+ dx: u,
1460
+ dy: c,
1461
+ dispatch: l
1462
+ }) {
1463
+ Object.defineProperties(this, {
1464
+ type: { value: t, enumerable: !0, configurable: !0 },
1465
+ sourceEvent: { value: e, enumerable: !0, configurable: !0 },
1466
+ subject: { value: n, enumerable: !0, configurable: !0 },
1467
+ target: { value: r, enumerable: !0, configurable: !0 },
1468
+ identifier: { value: i, enumerable: !0, configurable: !0 },
1469
+ active: { value: a, enumerable: !0, configurable: !0 },
1470
+ x: { value: o, enumerable: !0, configurable: !0 },
1471
+ y: { value: s, enumerable: !0, configurable: !0 },
1472
+ dx: { value: u, enumerable: !0, configurable: !0 },
1473
+ dy: { value: c, enumerable: !0, configurable: !0 },
1474
+ _: { value: l }
1475
+ });
1476
+ }
1477
+ Ee.prototype.on = function() {
1478
+ var t = this._.on.apply(this._, arguments);
1479
+ return t === this._ ? this : t;
1480
+ };
1481
+ function Po(t) {
1482
+ return !t.ctrlKey && !t.button;
1483
+ }
1484
+ function Ho() {
1485
+ return this.parentNode;
1486
+ }
1487
+ function Oo(t, e) {
1488
+ return e ?? { x: t.x, y: t.y };
1489
+ }
1490
+ function Vo() {
1491
+ return navigator.maxTouchPoints || "ontouchstart" in this;
1492
+ }
1493
+ function $u() {
1494
+ var t = Po, e = Ho, n = Oo, r = Vo, i = {}, a = le("start", "drag", "end"), o = 0, s, u, c, l, d = 0;
1495
+ function f(y) {
1496
+ y.on("mousedown.drag", m).filter(r).on("touchstart.drag", L).on("touchmove.drag", _, qo).on("touchend.drag touchcancel.drag", F).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1497
+ }
1498
+ function m(y, b) {
1499
+ if (!(l || !t.call(this, y, b))) {
1500
+ var k = I(this, e.call(this, y, b), y, b, "mouse");
1501
+ k && (Q(y.view).on("mousemove.drag", E, Ft).on("mouseup.drag", D, Ft), Gn(y.view), ve(y), c = !1, s = y.clientX, u = y.clientY, k("start", y));
1502
+ }
1503
+ }
1504
+ function E(y) {
1505
+ if (_t(y), !c) {
1506
+ var b = y.clientX - s, k = y.clientY - u;
1507
+ c = b * b + k * k > d;
1508
+ }
1509
+ i.mouse("drag", y);
1510
+ }
1511
+ function D(y) {
1512
+ Q(y.view).on("mousemove.drag mouseup.drag", null), Qn(y.view, c), _t(y), i.mouse("end", y);
1513
+ }
1514
+ function L(y, b) {
1515
+ if (t.call(this, y, b)) {
1516
+ var k = y.changedTouches, A = e.call(this, y, b), M = k.length, p, R;
1517
+ for (p = 0; p < M; ++p)
1518
+ (R = I(this, A, y, b, k[p].identifier, k[p])) && (ve(y), R("start", y, k[p]));
1519
+ }
1520
+ }
1521
+ function _(y) {
1522
+ var b = y.changedTouches, k = b.length, A, M;
1523
+ for (A = 0; A < k; ++A)
1524
+ (M = i[b[A].identifier]) && (_t(y), M("drag", y, b[A]));
1525
+ }
1526
+ function F(y) {
1527
+ var b = y.changedTouches, k = b.length, A, M;
1528
+ for (l && clearTimeout(l), l = setTimeout(function() {
1529
+ l = null;
1530
+ }, 500), A = 0; A < k; ++A)
1531
+ (M = i[b[A].identifier]) && (ve(y), M("end", y, b[A]));
1532
+ }
1533
+ function I(y, b, k, A, M, p) {
1534
+ var R = a.copy(), w = ut(p || k, b), z, q, h;
1535
+ if ((h = n.call(y, new Ee("beforestart", {
1536
+ sourceEvent: k,
1537
+ target: f,
1538
+ identifier: M,
1539
+ active: o,
1540
+ x: w[0],
1541
+ y: w[1],
1542
+ dx: 0,
1543
+ dy: 0,
1544
+ dispatch: R
1545
+ }), A)) != null)
1546
+ return z = h.x - w[0] || 0, q = h.y - w[1] || 0, function v(g, x, N) {
1547
+ var S = w, $;
1548
+ switch (g) {
1549
+ case "start":
1550
+ i[M] = v, $ = o++;
1551
+ break;
1552
+ case "end":
1553
+ delete i[M], --o;
1554
+ // falls through
1555
+ case "drag":
1556
+ w = ut(N || x, b), $ = o;
1557
+ break;
1558
+ }
1559
+ R.call(
1560
+ g,
1561
+ y,
1562
+ new Ee(g, {
1563
+ sourceEvent: x,
1564
+ subject: h,
1565
+ target: f,
1566
+ identifier: M,
1567
+ active: $,
1568
+ x: w[0] + z,
1569
+ y: w[1] + q,
1570
+ dx: w[0] - S[0],
1571
+ dy: w[1] - S[1],
1572
+ dispatch: R
1573
+ }),
1574
+ A
1575
+ );
1576
+ };
1577
+ }
1578
+ return f.filter = function(y) {
1579
+ return arguments.length ? (t = typeof y == "function" ? y : Ot(!!y), f) : t;
1580
+ }, f.container = function(y) {
1581
+ return arguments.length ? (e = typeof y == "function" ? y : Ot(y), f) : e;
1582
+ }, f.subject = function(y) {
1583
+ return arguments.length ? (n = typeof y == "function" ? y : Ot(y), f) : n;
1584
+ }, f.touchable = function(y) {
1585
+ return arguments.length ? (r = typeof y == "function" ? y : Ot(!!y), f) : r;
1586
+ }, f.on = function() {
1587
+ var y = a.on.apply(a, arguments);
1588
+ return y === a ? f : y;
1589
+ }, f.clickDistance = function(y) {
1590
+ return arguments.length ? (d = (y = +y) * y, f) : Math.sqrt(d);
1591
+ }, f;
1592
+ }
1593
+ function He(t, e, n) {
1594
+ t.prototype = e.prototype = n, n.constructor = t;
1595
+ }
1596
+ function Bn(t, e) {
1597
+ var n = Object.create(t.prototype);
1598
+ for (var r in e) n[r] = e[r];
1599
+ return n;
1600
+ }
1601
+ function It() {
1602
+ }
1603
+ var zt = 0.7, ne = 1 / zt, bt = "\\s*([+-]?\\d+)\\s*", Dt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", ot = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Xo = /^#([0-9a-f]{3,8})$/, Yo = new RegExp(`^rgb\\(${bt},${bt},${bt}\\)$`), Uo = new RegExp(`^rgb\\(${ot},${ot},${ot}\\)$`), Wo = new RegExp(`^rgba\\(${bt},${bt},${bt},${Dt}\\)$`), Go = new RegExp(`^rgba\\(${ot},${ot},${ot},${Dt}\\)$`), Qo = new RegExp(`^hsl\\(${Dt},${ot},${ot}\\)$`), Bo = new RegExp(`^hsla\\(${Dt},${ot},${ot},${Dt}\\)$`), sn = {
1604
+ aliceblue: 15792383,
1605
+ antiquewhite: 16444375,
1606
+ aqua: 65535,
1607
+ aquamarine: 8388564,
1608
+ azure: 15794175,
1609
+ beige: 16119260,
1610
+ bisque: 16770244,
1611
+ black: 0,
1612
+ blanchedalmond: 16772045,
1613
+ blue: 255,
1614
+ blueviolet: 9055202,
1615
+ brown: 10824234,
1616
+ burlywood: 14596231,
1617
+ cadetblue: 6266528,
1618
+ chartreuse: 8388352,
1619
+ chocolate: 13789470,
1620
+ coral: 16744272,
1621
+ cornflowerblue: 6591981,
1622
+ cornsilk: 16775388,
1623
+ crimson: 14423100,
1624
+ cyan: 65535,
1625
+ darkblue: 139,
1626
+ darkcyan: 35723,
1627
+ darkgoldenrod: 12092939,
1628
+ darkgray: 11119017,
1629
+ darkgreen: 25600,
1630
+ darkgrey: 11119017,
1631
+ darkkhaki: 12433259,
1632
+ darkmagenta: 9109643,
1633
+ darkolivegreen: 5597999,
1634
+ darkorange: 16747520,
1635
+ darkorchid: 10040012,
1636
+ darkred: 9109504,
1637
+ darksalmon: 15308410,
1638
+ darkseagreen: 9419919,
1639
+ darkslateblue: 4734347,
1640
+ darkslategray: 3100495,
1641
+ darkslategrey: 3100495,
1642
+ darkturquoise: 52945,
1643
+ darkviolet: 9699539,
1644
+ deeppink: 16716947,
1645
+ deepskyblue: 49151,
1646
+ dimgray: 6908265,
1647
+ dimgrey: 6908265,
1648
+ dodgerblue: 2003199,
1649
+ firebrick: 11674146,
1650
+ floralwhite: 16775920,
1651
+ forestgreen: 2263842,
1652
+ fuchsia: 16711935,
1653
+ gainsboro: 14474460,
1654
+ ghostwhite: 16316671,
1655
+ gold: 16766720,
1656
+ goldenrod: 14329120,
1657
+ gray: 8421504,
1658
+ green: 32768,
1659
+ greenyellow: 11403055,
1660
+ grey: 8421504,
1661
+ honeydew: 15794160,
1662
+ hotpink: 16738740,
1663
+ indianred: 13458524,
1664
+ indigo: 4915330,
1665
+ ivory: 16777200,
1666
+ khaki: 15787660,
1667
+ lavender: 15132410,
1668
+ lavenderblush: 16773365,
1669
+ lawngreen: 8190976,
1670
+ lemonchiffon: 16775885,
1671
+ lightblue: 11393254,
1672
+ lightcoral: 15761536,
1673
+ lightcyan: 14745599,
1674
+ lightgoldenrodyellow: 16448210,
1675
+ lightgray: 13882323,
1676
+ lightgreen: 9498256,
1677
+ lightgrey: 13882323,
1678
+ lightpink: 16758465,
1679
+ lightsalmon: 16752762,
1680
+ lightseagreen: 2142890,
1681
+ lightskyblue: 8900346,
1682
+ lightslategray: 7833753,
1683
+ lightslategrey: 7833753,
1684
+ lightsteelblue: 11584734,
1685
+ lightyellow: 16777184,
1686
+ lime: 65280,
1687
+ limegreen: 3329330,
1688
+ linen: 16445670,
1689
+ magenta: 16711935,
1690
+ maroon: 8388608,
1691
+ mediumaquamarine: 6737322,
1692
+ mediumblue: 205,
1693
+ mediumorchid: 12211667,
1694
+ mediumpurple: 9662683,
1695
+ mediumseagreen: 3978097,
1696
+ mediumslateblue: 8087790,
1697
+ mediumspringgreen: 64154,
1698
+ mediumturquoise: 4772300,
1699
+ mediumvioletred: 13047173,
1700
+ midnightblue: 1644912,
1701
+ mintcream: 16121850,
1702
+ mistyrose: 16770273,
1703
+ moccasin: 16770229,
1704
+ navajowhite: 16768685,
1705
+ navy: 128,
1706
+ oldlace: 16643558,
1707
+ olive: 8421376,
1708
+ olivedrab: 7048739,
1709
+ orange: 16753920,
1710
+ orangered: 16729344,
1711
+ orchid: 14315734,
1712
+ palegoldenrod: 15657130,
1713
+ palegreen: 10025880,
1714
+ paleturquoise: 11529966,
1715
+ palevioletred: 14381203,
1716
+ papayawhip: 16773077,
1717
+ peachpuff: 16767673,
1718
+ peru: 13468991,
1719
+ pink: 16761035,
1720
+ plum: 14524637,
1721
+ powderblue: 11591910,
1722
+ purple: 8388736,
1723
+ rebeccapurple: 6697881,
1724
+ red: 16711680,
1725
+ rosybrown: 12357519,
1726
+ royalblue: 4286945,
1727
+ saddlebrown: 9127187,
1728
+ salmon: 16416882,
1729
+ sandybrown: 16032864,
1730
+ seagreen: 3050327,
1731
+ seashell: 16774638,
1732
+ sienna: 10506797,
1733
+ silver: 12632256,
1734
+ skyblue: 8900331,
1735
+ slateblue: 6970061,
1736
+ slategray: 7372944,
1737
+ slategrey: 7372944,
1738
+ snow: 16775930,
1739
+ springgreen: 65407,
1740
+ steelblue: 4620980,
1741
+ tan: 13808780,
1742
+ teal: 32896,
1743
+ thistle: 14204888,
1744
+ tomato: 16737095,
1745
+ turquoise: 4251856,
1746
+ violet: 15631086,
1747
+ wheat: 16113331,
1748
+ white: 16777215,
1749
+ whitesmoke: 16119285,
1750
+ yellow: 16776960,
1751
+ yellowgreen: 10145074
1752
+ };
1753
+ He(It, xt, {
1754
+ copy(t) {
1755
+ return Object.assign(new this.constructor(), this, t);
1756
+ },
1757
+ displayable() {
1758
+ return this.rgb().displayable();
1759
+ },
1760
+ hex: un,
1761
+ // Deprecated! Use color.formatHex.
1762
+ formatHex: un,
1763
+ formatHex8: Jo,
1764
+ formatHsl: Zo,
1765
+ formatRgb: cn,
1766
+ toString: cn
1767
+ });
1768
+ function un() {
1769
+ return this.rgb().formatHex();
1770
+ }
1771
+ function Jo() {
1772
+ return this.rgb().formatHex8();
1773
+ }
1774
+ function Zo() {
1775
+ return Jn(this).formatHsl();
1776
+ }
1777
+ function cn() {
1778
+ return this.rgb().formatRgb();
1779
+ }
1780
+ function xt(t) {
1781
+ var e, n;
1782
+ return t = (t + "").trim().toLowerCase(), (e = Xo.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? ln(e) : n === 3 ? new B(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? Vt(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? Vt(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = Yo.exec(t)) ? new B(e[1], e[2], e[3], 1) : (e = Uo.exec(t)) ? new B(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = Wo.exec(t)) ? Vt(e[1], e[2], e[3], e[4]) : (e = Go.exec(t)) ? Vt(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = Qo.exec(t)) ? dn(e[1], e[2] / 100, e[3] / 100, 1) : (e = Bo.exec(t)) ? dn(e[1], e[2] / 100, e[3] / 100, e[4]) : sn.hasOwnProperty(t) ? ln(sn[t]) : t === "transparent" ? new B(NaN, NaN, NaN, 0) : null;
1783
+ }
1784
+ function ln(t) {
1785
+ return new B(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
1786
+ }
1787
+ function Vt(t, e, n, r) {
1788
+ return r <= 0 && (t = e = n = NaN), new B(t, e, n, r);
1789
+ }
1790
+ function Ko(t) {
1791
+ return t instanceof It || (t = xt(t)), t ? (t = t.rgb(), new B(t.r, t.g, t.b, t.opacity)) : new B();
1792
+ }
1793
+ function Ae(t, e, n, r) {
1794
+ return arguments.length === 1 ? Ko(t) : new B(t, e, n, r ?? 1);
1795
+ }
1796
+ function B(t, e, n, r) {
1797
+ this.r = +t, this.g = +e, this.b = +n, this.opacity = +r;
1798
+ }
1799
+ He(B, Ae, Bn(It, {
1800
+ brighter(t) {
1801
+ return t = t == null ? ne : Math.pow(ne, t), new B(this.r * t, this.g * t, this.b * t, this.opacity);
1802
+ },
1803
+ darker(t) {
1804
+ return t = t == null ? zt : Math.pow(zt, t), new B(this.r * t, this.g * t, this.b * t, this.opacity);
1805
+ },
1806
+ rgb() {
1807
+ return this;
1808
+ },
1809
+ clamp() {
1810
+ return new B(wt(this.r), wt(this.g), wt(this.b), re(this.opacity));
1811
+ },
1812
+ displayable() {
1813
+ return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
1814
+ },
1815
+ hex: fn,
1816
+ // Deprecated! Use color.formatHex.
1817
+ formatHex: fn,
1818
+ formatHex8: jo,
1819
+ formatRgb: hn,
1820
+ toString: hn
1821
+ }));
1822
+ function fn() {
1823
+ return `#${yt(this.r)}${yt(this.g)}${yt(this.b)}`;
1824
+ }
1825
+ function jo() {
1826
+ return `#${yt(this.r)}${yt(this.g)}${yt(this.b)}${yt((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
1827
+ }
1828
+ function hn() {
1829
+ const t = re(this.opacity);
1830
+ return `${t === 1 ? "rgb(" : "rgba("}${wt(this.r)}, ${wt(this.g)}, ${wt(this.b)}${t === 1 ? ")" : `, ${t})`}`;
1831
+ }
1832
+ function re(t) {
1833
+ return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
1834
+ }
1835
+ function wt(t) {
1836
+ return Math.max(0, Math.min(255, Math.round(t) || 0));
1837
+ }
1838
+ function yt(t) {
1839
+ return t = wt(t), (t < 16 ? "0" : "") + t.toString(16);
1840
+ }
1841
+ function dn(t, e, n, r) {
1842
+ return r <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new j(t, e, n, r);
1843
+ }
1844
+ function Jn(t) {
1845
+ if (t instanceof j) return new j(t.h, t.s, t.l, t.opacity);
1846
+ if (t instanceof It || (t = xt(t)), !t) return new j();
1847
+ if (t instanceof j) return t;
1848
+ t = t.rgb();
1849
+ var e = t.r / 255, n = t.g / 255, r = t.b / 255, i = Math.min(e, n, r), a = Math.max(e, n, r), o = NaN, s = a - i, u = (a + i) / 2;
1850
+ return s ? (e === a ? o = (n - r) / s + (n < r) * 6 : n === a ? o = (r - e) / s + 2 : o = (e - n) / s + 4, s /= u < 0.5 ? a + i : 2 - a - i, o *= 60) : s = u > 0 && u < 1 ? 0 : o, new j(o, s, u, t.opacity);
1851
+ }
1852
+ function ta(t, e, n, r) {
1853
+ return arguments.length === 1 ? Jn(t) : new j(t, e, n, r ?? 1);
1854
+ }
1855
+ function j(t, e, n, r) {
1856
+ this.h = +t, this.s = +e, this.l = +n, this.opacity = +r;
1857
+ }
1858
+ He(j, ta, Bn(It, {
1859
+ brighter(t) {
1860
+ return t = t == null ? ne : Math.pow(ne, t), new j(this.h, this.s, this.l * t, this.opacity);
1861
+ },
1862
+ darker(t) {
1863
+ return t = t == null ? zt : Math.pow(zt, t), new j(this.h, this.s, this.l * t, this.opacity);
1864
+ },
1865
+ rgb() {
1866
+ var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, n = this.l, r = n + (n < 0.5 ? n : 1 - n) * e, i = 2 * n - r;
1867
+ return new B(
1868
+ _e(t >= 240 ? t - 240 : t + 120, i, r),
1869
+ _e(t, i, r),
1870
+ _e(t < 120 ? t + 240 : t - 120, i, r),
1871
+ this.opacity
1872
+ );
1873
+ },
1874
+ clamp() {
1875
+ return new j(mn(this.h), Xt(this.s), Xt(this.l), re(this.opacity));
1876
+ },
1877
+ displayable() {
1878
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
1879
+ },
1880
+ formatHsl() {
1881
+ const t = re(this.opacity);
1882
+ return `${t === 1 ? "hsl(" : "hsla("}${mn(this.h)}, ${Xt(this.s) * 100}%, ${Xt(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
1883
+ }
1884
+ }));
1885
+ function mn(t) {
1886
+ return t = (t || 0) % 360, t < 0 ? t + 360 : t;
1887
+ }
1888
+ function Xt(t) {
1889
+ return Math.max(0, Math.min(1, t || 0));
1890
+ }
1891
+ function _e(t, e, n) {
1892
+ return (t < 60 ? e + (n - e) * t / 60 : t < 180 ? n : t < 240 ? e + (n - e) * (240 - t) / 60 : e) * 255;
1893
+ }
1894
+ const Oe = (t) => () => t;
1895
+ function ea(t, e) {
1896
+ return function(n) {
1897
+ return t + n * e;
1898
+ };
1899
+ }
1900
+ function na(t, e, n) {
1901
+ return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(r) {
1902
+ return Math.pow(t + r * e, n);
1903
+ };
1904
+ }
1905
+ function ra(t) {
1906
+ return (t = +t) == 1 ? Zn : function(e, n) {
1907
+ return n - e ? na(e, n, t) : Oe(isNaN(e) ? n : e);
1908
+ };
1909
+ }
1910
+ function Zn(t, e) {
1911
+ var n = e - t;
1912
+ return n ? ea(t, n) : Oe(isNaN(t) ? e : t);
1913
+ }
1914
+ const ie = (function t(e) {
1915
+ var n = ra(e);
1916
+ function r(i, a) {
1917
+ var o = n((i = Ae(i)).r, (a = Ae(a)).r), s = n(i.g, a.g), u = n(i.b, a.b), c = Zn(i.opacity, a.opacity);
1918
+ return function(l) {
1919
+ return i.r = o(l), i.g = s(l), i.b = u(l), i.opacity = c(l), i + "";
1920
+ };
1921
+ }
1922
+ return r.gamma = t, r;
1923
+ })(1);
1924
+ function ia(t, e) {
1925
+ e || (e = []);
1926
+ var n = t ? Math.min(e.length, t.length) : 0, r = e.slice(), i;
1927
+ return function(a) {
1928
+ for (i = 0; i < n; ++i) r[i] = t[i] * (1 - a) + e[i] * a;
1929
+ return r;
1930
+ };
1931
+ }
1932
+ function oa(t) {
1933
+ return ArrayBuffer.isView(t) && !(t instanceof DataView);
1934
+ }
1935
+ function aa(t, e) {
1936
+ var n = e ? e.length : 0, r = t ? Math.min(n, t.length) : 0, i = new Array(r), a = new Array(n), o;
1937
+ for (o = 0; o < r; ++o) i[o] = Ve(t[o], e[o]);
1938
+ for (; o < n; ++o) a[o] = e[o];
1939
+ return function(s) {
1940
+ for (o = 0; o < r; ++o) a[o] = i[o](s);
1941
+ return a;
1942
+ };
1943
+ }
1944
+ function sa(t, e) {
1945
+ var n = /* @__PURE__ */ new Date();
1946
+ return t = +t, e = +e, function(r) {
1947
+ return n.setTime(t * (1 - r) + e * r), n;
1948
+ };
1949
+ }
1950
+ function K(t, e) {
1951
+ return t = +t, e = +e, function(n) {
1952
+ return t * (1 - n) + e * n;
1953
+ };
1954
+ }
1955
+ function ua(t, e) {
1956
+ var n = {}, r = {}, i;
1957
+ (t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {});
1958
+ for (i in e)
1959
+ i in t ? n[i] = Ve(t[i], e[i]) : r[i] = e[i];
1960
+ return function(a) {
1961
+ for (i in n) r[i] = n[i](a);
1962
+ return r;
1963
+ };
1964
+ }
1965
+ var Ce = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, be = new RegExp(Ce.source, "g");
1966
+ function ca(t) {
1967
+ return function() {
1968
+ return t;
1969
+ };
1970
+ }
1971
+ function la(t) {
1972
+ return function(e) {
1973
+ return t(e) + "";
1974
+ };
1975
+ }
1976
+ function Kn(t, e) {
1977
+ var n = Ce.lastIndex = be.lastIndex = 0, r, i, a, o = -1, s = [], u = [];
1978
+ for (t = t + "", e = e + ""; (r = Ce.exec(t)) && (i = be.exec(e)); )
1979
+ (a = i.index) > n && (a = e.slice(n, a), s[o] ? s[o] += a : s[++o] = a), (r = r[0]) === (i = i[0]) ? s[o] ? s[o] += i : s[++o] = i : (s[++o] = null, u.push({ i: o, x: K(r, i) })), n = be.lastIndex;
1980
+ return n < e.length && (a = e.slice(n), s[o] ? s[o] += a : s[++o] = a), s.length < 2 ? u[0] ? la(u[0].x) : ca(e) : (e = u.length, function(c) {
1981
+ for (var l = 0, d; l < e; ++l) s[(d = u[l]).i] = d.x(c);
1982
+ return s.join("");
1983
+ });
1984
+ }
1985
+ function Ve(t, e) {
1986
+ var n = typeof e, r;
1987
+ return e == null || n === "boolean" ? Oe(e) : (n === "number" ? K : n === "string" ? (r = xt(e)) ? (e = r, ie) : Kn : e instanceof xt ? ie : e instanceof Date ? sa : oa(e) ? ia : Array.isArray(e) ? aa : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? ua : K)(t, e);
1988
+ }
1989
+ function fa(t, e) {
1990
+ return t = +t, e = +e, function(n) {
1991
+ return Math.round(t * (1 - n) + e * n);
1992
+ };
1993
+ }
1994
+ var gn = 180 / Math.PI, Fe = {
1995
+ translateX: 0,
1996
+ translateY: 0,
1997
+ rotate: 0,
1998
+ skewX: 0,
1999
+ scaleX: 1,
2000
+ scaleY: 1
2001
+ };
2002
+ function jn(t, e, n, r, i, a) {
2003
+ var o, s, u;
2004
+ return (o = Math.sqrt(t * t + e * e)) && (t /= o, e /= o), (u = t * n + e * r) && (n -= t * u, r -= e * u), (s = Math.sqrt(n * n + r * r)) && (n /= s, r /= s, u /= s), t * r < e * n && (t = -t, e = -e, u = -u, o = -o), {
2005
+ translateX: i,
2006
+ translateY: a,
2007
+ rotate: Math.atan2(e, t) * gn,
2008
+ skewX: Math.atan(u) * gn,
2009
+ scaleX: o,
2010
+ scaleY: s
2011
+ };
2012
+ }
2013
+ var Yt;
2014
+ function ha(t) {
2015
+ const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
2016
+ return e.isIdentity ? Fe : jn(e.a, e.b, e.c, e.d, e.e, e.f);
2017
+ }
2018
+ function da(t) {
2019
+ return t == null || (Yt || (Yt = document.createElementNS("http://www.w3.org/2000/svg", "g")), Yt.setAttribute("transform", t), !(t = Yt.transform.baseVal.consolidate())) ? Fe : (t = t.matrix, jn(t.a, t.b, t.c, t.d, t.e, t.f));
2020
+ }
2021
+ function tr(t, e, n, r) {
2022
+ function i(c) {
2023
+ return c.length ? c.pop() + " " : "";
2024
+ }
2025
+ function a(c, l, d, f, m, E) {
2026
+ if (c !== d || l !== f) {
2027
+ var D = m.push("translate(", null, e, null, n);
2028
+ E.push({ i: D - 4, x: K(c, d) }, { i: D - 2, x: K(l, f) });
2029
+ } else (d || f) && m.push("translate(" + d + e + f + n);
2030
+ }
2031
+ function o(c, l, d, f) {
2032
+ c !== l ? (c - l > 180 ? l += 360 : l - c > 180 && (c += 360), f.push({ i: d.push(i(d) + "rotate(", null, r) - 2, x: K(c, l) })) : l && d.push(i(d) + "rotate(" + l + r);
2033
+ }
2034
+ function s(c, l, d, f) {
2035
+ c !== l ? f.push({ i: d.push(i(d) + "skewX(", null, r) - 2, x: K(c, l) }) : l && d.push(i(d) + "skewX(" + l + r);
2036
+ }
2037
+ function u(c, l, d, f, m, E) {
2038
+ if (c !== d || l !== f) {
2039
+ var D = m.push(i(m) + "scale(", null, ",", null, ")");
2040
+ E.push({ i: D - 4, x: K(c, d) }, { i: D - 2, x: K(l, f) });
2041
+ } else (d !== 1 || f !== 1) && m.push(i(m) + "scale(" + d + "," + f + ")");
2042
+ }
2043
+ return function(c, l) {
2044
+ var d = [], f = [];
2045
+ return c = t(c), l = t(l), a(c.translateX, c.translateY, l.translateX, l.translateY, d, f), o(c.rotate, l.rotate, d, f), s(c.skewX, l.skewX, d, f), u(c.scaleX, c.scaleY, l.scaleX, l.scaleY, d, f), c = l = null, function(m) {
2046
+ for (var E = -1, D = f.length, L; ++E < D; ) d[(L = f[E]).i] = L.x(m);
2047
+ return d.join("");
2048
+ };
2049
+ };
2050
+ }
2051
+ var ma = tr(ha, "px, ", "px)", "deg)"), ga = tr(da, ", ", ")", ")"), pa = 1e-12;
2052
+ function pn(t) {
2053
+ return ((t = Math.exp(t)) + 1 / t) / 2;
2054
+ }
2055
+ function ya(t) {
2056
+ return ((t = Math.exp(t)) - 1 / t) / 2;
2057
+ }
2058
+ function wa(t) {
2059
+ return ((t = Math.exp(2 * t)) - 1) / (t + 1);
2060
+ }
2061
+ const xa = (function t(e, n, r) {
2062
+ function i(a, o) {
2063
+ var s = a[0], u = a[1], c = a[2], l = o[0], d = o[1], f = o[2], m = l - s, E = d - u, D = m * m + E * E, L, _;
2064
+ if (D < pa)
2065
+ _ = Math.log(f / c) / e, L = function(A) {
2066
+ return [
2067
+ s + A * m,
2068
+ u + A * E,
2069
+ c * Math.exp(e * A * _)
2070
+ ];
2071
+ };
2072
+ else {
2073
+ var F = Math.sqrt(D), I = (f * f - c * c + r * D) / (2 * c * n * F), y = (f * f - c * c - r * D) / (2 * f * n * F), b = Math.log(Math.sqrt(I * I + 1) - I), k = Math.log(Math.sqrt(y * y + 1) - y);
2074
+ _ = (k - b) / e, L = function(A) {
2075
+ var M = A * _, p = pn(b), R = c / (n * F) * (p * wa(e * M + b) - ya(b));
2076
+ return [
2077
+ s + R * m,
2078
+ u + R * E,
2079
+ c * p / pn(e * M + b)
2080
+ ];
2081
+ };
2082
+ }
2083
+ return L.duration = _ * 1e3 * e / Math.SQRT2, L;
2084
+ }
2085
+ return i.rho = function(a) {
2086
+ var o = Math.max(1e-3, +a), s = o * o, u = s * s;
2087
+ return t(o, s, u);
2088
+ }, i;
2089
+ })(Math.SQRT2, 2, 4);
2090
+ var kt = 0, At = 0, $t = 0, er = 1e3, oe, Ct, ae = 0, vt = 0, he = 0, Rt = typeof performance == "object" && performance.now ? performance : Date, nr = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
2091
+ setTimeout(t, 17);
2092
+ };
2093
+ function Xe() {
2094
+ return vt || (nr(va), vt = Rt.now() + he);
2095
+ }
2096
+ function va() {
2097
+ vt = 0;
2098
+ }
2099
+ function se() {
2100
+ this._call = this._time = this._next = null;
2101
+ }
2102
+ se.prototype = rr.prototype = {
2103
+ constructor: se,
2104
+ restart: function(t, e, n) {
2105
+ if (typeof t != "function") throw new TypeError("callback is not a function");
2106
+ n = (n == null ? Xe() : +n) + (e == null ? 0 : +e), !this._next && Ct !== this && (Ct ? Ct._next = this : oe = this, Ct = this), this._call = t, this._time = n, ze();
2107
+ },
2108
+ stop: function() {
2109
+ this._call && (this._call = null, this._time = 1 / 0, ze());
2110
+ }
2111
+ };
2112
+ function rr(t, e, n) {
2113
+ var r = new se();
2114
+ return r.restart(t, e, n), r;
2115
+ }
2116
+ function _a() {
2117
+ Xe(), ++kt;
2118
+ for (var t = oe, e; t; )
2119
+ (e = vt - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
2120
+ --kt;
2121
+ }
2122
+ function yn() {
2123
+ vt = (ae = Rt.now()) + he, kt = At = 0;
2124
+ try {
2125
+ _a();
2126
+ } finally {
2127
+ kt = 0, Ma(), vt = 0;
2128
+ }
2129
+ }
2130
+ function ba() {
2131
+ var t = Rt.now(), e = t - ae;
2132
+ e > er && (he -= e, ae = t);
2133
+ }
2134
+ function Ma() {
2135
+ for (var t, e = oe, n, r = 1 / 0; e; )
2136
+ e._call ? (r > e._time && (r = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : oe = n);
2137
+ Ct = t, ze(r);
2138
+ }
2139
+ function ze(t) {
2140
+ if (!kt) {
2141
+ At && (At = clearTimeout(At));
2142
+ var e = t - vt;
2143
+ e > 24 ? (t < 1 / 0 && (At = setTimeout(yn, t - Rt.now() - he)), $t && ($t = clearInterval($t))) : ($t || (ae = Rt.now(), $t = setInterval(ba, er)), kt = 1, nr(yn));
2144
+ }
2145
+ }
2146
+ function wn(t, e, n) {
2147
+ var r = new se();
2148
+ return e = e == null ? 0 : +e, r.restart((i) => {
2149
+ r.stop(), t(i + e);
2150
+ }, e, n), r;
2151
+ }
2152
+ var ka = le("start", "end", "cancel", "interrupt"), Sa = [], ir = 0, xn = 1, De = 2, Jt = 3, vn = 4, Re = 5, Zt = 6;
2153
+ function de(t, e, n, r, i, a) {
2154
+ var o = t.__transition;
2155
+ if (!o) t.__transition = {};
2156
+ else if (n in o) return;
2157
+ Na(t, n, {
2158
+ name: e,
2159
+ index: r,
2160
+ // For context during callback.
2161
+ group: i,
2162
+ // For context during callback.
2163
+ on: ka,
2164
+ tween: Sa,
2165
+ time: a.time,
2166
+ delay: a.delay,
2167
+ duration: a.duration,
2168
+ ease: a.ease,
2169
+ timer: null,
2170
+ state: ir
2171
+ });
2172
+ }
2173
+ function Ye(t, e) {
2174
+ var n = tt(t, e);
2175
+ if (n.state > ir) throw new Error("too late; already scheduled");
2176
+ return n;
2177
+ }
2178
+ function at(t, e) {
2179
+ var n = tt(t, e);
2180
+ if (n.state > Jt) throw new Error("too late; already running");
2181
+ return n;
2182
+ }
2183
+ function tt(t, e) {
2184
+ var n = t.__transition;
2185
+ if (!n || !(n = n[e])) throw new Error("transition not found");
2186
+ return n;
2187
+ }
2188
+ function Na(t, e, n) {
2189
+ var r = t.__transition, i;
2190
+ r[e] = n, n.timer = rr(a, 0, n.time);
2191
+ function a(c) {
2192
+ n.state = xn, n.timer.restart(o, n.delay, n.time), n.delay <= c && o(c - n.delay);
2193
+ }
2194
+ function o(c) {
2195
+ var l, d, f, m;
2196
+ if (n.state !== xn) return u();
2197
+ for (l in r)
2198
+ if (m = r[l], m.name === n.name) {
2199
+ if (m.state === Jt) return wn(o);
2200
+ m.state === vn ? (m.state = Zt, m.timer.stop(), m.on.call("interrupt", t, t.__data__, m.index, m.group), delete r[l]) : +l < e && (m.state = Zt, m.timer.stop(), m.on.call("cancel", t, t.__data__, m.index, m.group), delete r[l]);
2201
+ }
2202
+ if (wn(function() {
2203
+ n.state === Jt && (n.state = vn, n.timer.restart(s, n.delay, n.time), s(c));
2204
+ }), n.state = De, n.on.call("start", t, t.__data__, n.index, n.group), n.state === De) {
2205
+ for (n.state = Jt, i = new Array(f = n.tween.length), l = 0, d = -1; l < f; ++l)
2206
+ (m = n.tween[l].value.call(t, t.__data__, n.index, n.group)) && (i[++d] = m);
2207
+ i.length = d + 1;
2208
+ }
2209
+ }
2210
+ function s(c) {
2211
+ for (var l = c < n.duration ? n.ease.call(null, c / n.duration) : (n.timer.restart(u), n.state = Re, 1), d = -1, f = i.length; ++d < f; )
2212
+ i[d].call(t, l);
2213
+ n.state === Re && (n.on.call("end", t, t.__data__, n.index, n.group), u());
2214
+ }
2215
+ function u() {
2216
+ n.state = Zt, n.timer.stop(), delete r[e];
2217
+ for (var c in r) return;
2218
+ delete t.__transition;
2219
+ }
2220
+ }
2221
+ function Kt(t, e) {
2222
+ var n = t.__transition, r, i, a = !0, o;
2223
+ if (n) {
2224
+ e = e == null ? null : e + "";
2225
+ for (o in n) {
2226
+ if ((r = n[o]).name !== e) {
2227
+ a = !1;
2228
+ continue;
2229
+ }
2230
+ i = r.state > De && r.state < Re, r.state = Zt, r.timer.stop(), r.on.call(i ? "interrupt" : "cancel", t, t.__data__, r.index, r.group), delete n[o];
2231
+ }
2232
+ a && delete t.__transition;
2233
+ }
2234
+ }
2235
+ function $a(t) {
2236
+ return this.each(function() {
2237
+ Kt(this, t);
2238
+ });
2239
+ }
2240
+ function Ta(t, e) {
2241
+ var n, r;
2242
+ return function() {
2243
+ var i = at(this, t), a = i.tween;
2244
+ if (a !== n) {
2245
+ r = n = a;
2246
+ for (var o = 0, s = r.length; o < s; ++o)
2247
+ if (r[o].name === e) {
2248
+ r = r.slice(), r.splice(o, 1);
2249
+ break;
2250
+ }
2251
+ }
2252
+ i.tween = r;
2253
+ };
2254
+ }
2255
+ function Ea(t, e, n) {
2256
+ var r, i;
2257
+ if (typeof n != "function") throw new Error();
2258
+ return function() {
2259
+ var a = at(this, t), o = a.tween;
2260
+ if (o !== r) {
2261
+ i = (r = o).slice();
2262
+ for (var s = { name: e, value: n }, u = 0, c = i.length; u < c; ++u)
2263
+ if (i[u].name === e) {
2264
+ i[u] = s;
2265
+ break;
2266
+ }
2267
+ u === c && i.push(s);
2268
+ }
2269
+ a.tween = i;
2270
+ };
2271
+ }
2272
+ function Aa(t, e) {
2273
+ var n = this._id;
2274
+ if (t += "", arguments.length < 2) {
2275
+ for (var r = tt(this.node(), n).tween, i = 0, a = r.length, o; i < a; ++i)
2276
+ if ((o = r[i]).name === t)
2277
+ return o.value;
2278
+ return null;
2279
+ }
2280
+ return this.each((e == null ? Ta : Ea)(n, t, e));
2281
+ }
2282
+ function Ue(t, e, n) {
2283
+ var r = t._id;
2284
+ return t.each(function() {
2285
+ var i = at(this, r);
2286
+ (i.value || (i.value = {}))[e] = n.apply(this, arguments);
2287
+ }), function(i) {
2288
+ return tt(i, r).value[e];
2289
+ };
2290
+ }
2291
+ function or(t, e) {
2292
+ var n;
2293
+ return (typeof e == "number" ? K : e instanceof xt ? ie : (n = xt(e)) ? (e = n, ie) : Kn)(t, e);
2294
+ }
2295
+ function Ca(t) {
2296
+ return function() {
2297
+ this.removeAttribute(t);
2298
+ };
2299
+ }
2300
+ function Fa(t) {
2301
+ return function() {
2302
+ this.removeAttributeNS(t.space, t.local);
2303
+ };
2304
+ }
2305
+ function za(t, e, n) {
2306
+ var r, i = n + "", a;
2307
+ return function() {
2308
+ var o = this.getAttribute(t);
2309
+ return o === i ? null : o === r ? a : a = e(r = o, n);
2310
+ };
2311
+ }
2312
+ function Da(t, e, n) {
2313
+ var r, i = n + "", a;
2314
+ return function() {
2315
+ var o = this.getAttributeNS(t.space, t.local);
2316
+ return o === i ? null : o === r ? a : a = e(r = o, n);
2317
+ };
2318
+ }
2319
+ function Ra(t, e, n) {
2320
+ var r, i, a;
2321
+ return function() {
2322
+ var o, s = n(this), u;
2323
+ return s == null ? void this.removeAttribute(t) : (o = this.getAttribute(t), u = s + "", o === u ? null : o === r && u === i ? a : (i = u, a = e(r = o, s)));
2324
+ };
2325
+ }
2326
+ function La(t, e, n) {
2327
+ var r, i, a;
2328
+ return function() {
2329
+ var o, s = n(this), u;
2330
+ return s == null ? void this.removeAttributeNS(t.space, t.local) : (o = this.getAttributeNS(t.space, t.local), u = s + "", o === u ? null : o === r && u === i ? a : (i = u, a = e(r = o, s)));
2331
+ };
2332
+ }
2333
+ function Ia(t, e) {
2334
+ var n = fe(t), r = n === "transform" ? ga : or;
2335
+ return this.attrTween(t, typeof e == "function" ? (n.local ? La : Ra)(n, r, Ue(this, "attr." + t, e)) : e == null ? (n.local ? Fa : Ca)(n) : (n.local ? Da : za)(n, r, e));
2336
+ }
2337
+ function qa(t, e) {
2338
+ return function(n) {
2339
+ this.setAttribute(t, e.call(this, n));
2340
+ };
2341
+ }
2342
+ function Pa(t, e) {
2343
+ return function(n) {
2344
+ this.setAttributeNS(t.space, t.local, e.call(this, n));
2345
+ };
2346
+ }
2347
+ function Ha(t, e) {
2348
+ var n, r;
2349
+ function i() {
2350
+ var a = e.apply(this, arguments);
2351
+ return a !== r && (n = (r = a) && Pa(t, a)), n;
2352
+ }
2353
+ return i._value = e, i;
2354
+ }
2355
+ function Oa(t, e) {
2356
+ var n, r;
2357
+ function i() {
2358
+ var a = e.apply(this, arguments);
2359
+ return a !== r && (n = (r = a) && qa(t, a)), n;
2360
+ }
2361
+ return i._value = e, i;
2362
+ }
2363
+ function Va(t, e) {
2364
+ var n = "attr." + t;
2365
+ if (arguments.length < 2) return (n = this.tween(n)) && n._value;
2366
+ if (e == null) return this.tween(n, null);
2367
+ if (typeof e != "function") throw new Error();
2368
+ var r = fe(t);
2369
+ return this.tween(n, (r.local ? Ha : Oa)(r, e));
2370
+ }
2371
+ function Xa(t, e) {
2372
+ return function() {
2373
+ Ye(this, t).delay = +e.apply(this, arguments);
2374
+ };
2375
+ }
2376
+ function Ya(t, e) {
2377
+ return e = +e, function() {
2378
+ Ye(this, t).delay = e;
2379
+ };
2380
+ }
2381
+ function Ua(t) {
2382
+ var e = this._id;
2383
+ return arguments.length ? this.each((typeof t == "function" ? Xa : Ya)(e, t)) : tt(this.node(), e).delay;
2384
+ }
2385
+ function Wa(t, e) {
2386
+ return function() {
2387
+ at(this, t).duration = +e.apply(this, arguments);
2388
+ };
2389
+ }
2390
+ function Ga(t, e) {
2391
+ return e = +e, function() {
2392
+ at(this, t).duration = e;
2393
+ };
2394
+ }
2395
+ function Qa(t) {
2396
+ var e = this._id;
2397
+ return arguments.length ? this.each((typeof t == "function" ? Wa : Ga)(e, t)) : tt(this.node(), e).duration;
2398
+ }
2399
+ function Ba(t, e) {
2400
+ if (typeof e != "function") throw new Error();
2401
+ return function() {
2402
+ at(this, t).ease = e;
2403
+ };
2404
+ }
2405
+ function Ja(t) {
2406
+ var e = this._id;
2407
+ return arguments.length ? this.each(Ba(e, t)) : tt(this.node(), e).ease;
2408
+ }
2409
+ function Za(t, e) {
2410
+ return function() {
2411
+ var n = e.apply(this, arguments);
2412
+ if (typeof n != "function") throw new Error();
2413
+ at(this, t).ease = n;
2414
+ };
2415
+ }
2416
+ function Ka(t) {
2417
+ if (typeof t != "function") throw new Error();
2418
+ return this.each(Za(this._id, t));
2419
+ }
2420
+ function ja(t) {
2421
+ typeof t != "function" && (t = In(t));
2422
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
2423
+ for (var a = e[i], o = a.length, s = r[i] = [], u, c = 0; c < o; ++c)
2424
+ (u = a[c]) && t.call(u, u.__data__, c, a) && s.push(u);
2425
+ return new ct(r, this._parents, this._name, this._id);
2426
+ }
2427
+ function ts(t) {
2428
+ if (t._id !== this._id) throw new Error();
2429
+ for (var e = this._groups, n = t._groups, r = e.length, i = n.length, a = Math.min(r, i), o = new Array(r), s = 0; s < a; ++s)
2430
+ for (var u = e[s], c = n[s], l = u.length, d = o[s] = new Array(l), f, m = 0; m < l; ++m)
2431
+ (f = u[m] || c[m]) && (d[m] = f);
2432
+ for (; s < r; ++s)
2433
+ o[s] = e[s];
2434
+ return new ct(o, this._parents, this._name, this._id);
2435
+ }
2436
+ function es(t) {
2437
+ return (t + "").trim().split(/^|\s+/).every(function(e) {
2438
+ var n = e.indexOf(".");
2439
+ return n >= 0 && (e = e.slice(0, n)), !e || e === "start";
2440
+ });
2441
+ }
2442
+ function ns(t, e, n) {
2443
+ var r, i, a = es(e) ? Ye : at;
2444
+ return function() {
2445
+ var o = a(this, t), s = o.on;
2446
+ s !== r && (i = (r = s).copy()).on(e, n), o.on = i;
2447
+ };
2448
+ }
2449
+ function rs(t, e) {
2450
+ var n = this._id;
2451
+ return arguments.length < 2 ? tt(this.node(), n).on.on(t) : this.each(ns(n, t, e));
2452
+ }
2453
+ function is(t) {
2454
+ return function() {
2455
+ var e = this.parentNode;
2456
+ for (var n in this.__transition) if (+n !== t) return;
2457
+ e && e.removeChild(this);
2458
+ };
2459
+ }
2460
+ function os() {
2461
+ return this.on("end.remove", is(this._id));
2462
+ }
2463
+ function as(t) {
2464
+ var e = this._name, n = this._id;
2465
+ typeof t != "function" && (t = qe(t));
2466
+ for (var r = this._groups, i = r.length, a = new Array(i), o = 0; o < i; ++o)
2467
+ for (var s = r[o], u = s.length, c = a[o] = new Array(u), l, d, f = 0; f < u; ++f)
2468
+ (l = s[f]) && (d = t.call(l, l.__data__, f, s)) && ("__data__" in l && (d.__data__ = l.__data__), c[f] = d, de(c[f], e, n, f, c, tt(l, n)));
2469
+ return new ct(a, this._parents, e, n);
2470
+ }
2471
+ function ss(t) {
2472
+ var e = this._name, n = this._id;
2473
+ typeof t != "function" && (t = Ln(t));
2474
+ for (var r = this._groups, i = r.length, a = [], o = [], s = 0; s < i; ++s)
2475
+ for (var u = r[s], c = u.length, l, d = 0; d < c; ++d)
2476
+ if (l = u[d]) {
2477
+ for (var f = t.call(l, l.__data__, d, u), m, E = tt(l, n), D = 0, L = f.length; D < L; ++D)
2478
+ (m = f[D]) && de(m, e, n, D, f, E);
2479
+ a.push(f), o.push(l);
2480
+ }
2481
+ return new ct(a, o, e, n);
2482
+ }
2483
+ var us = Lt.prototype.constructor;
2484
+ function cs() {
2485
+ return new us(this._groups, this._parents);
2486
+ }
2487
+ function ls(t, e) {
2488
+ var n, r, i;
2489
+ return function() {
2490
+ var a = Mt(this, t), o = (this.style.removeProperty(t), Mt(this, t));
2491
+ return a === o ? null : a === n && o === r ? i : i = e(n = a, r = o);
2492
+ };
2493
+ }
2494
+ function ar(t) {
2495
+ return function() {
2496
+ this.style.removeProperty(t);
2497
+ };
2498
+ }
2499
+ function fs(t, e, n) {
2500
+ var r, i = n + "", a;
2501
+ return function() {
2502
+ var o = Mt(this, t);
2503
+ return o === i ? null : o === r ? a : a = e(r = o, n);
2504
+ };
2505
+ }
2506
+ function hs(t, e, n) {
2507
+ var r, i, a;
2508
+ return function() {
2509
+ var o = Mt(this, t), s = n(this), u = s + "";
2510
+ return s == null && (u = s = (this.style.removeProperty(t), Mt(this, t))), o === u ? null : o === r && u === i ? a : (i = u, a = e(r = o, s));
2511
+ };
2512
+ }
2513
+ function ds(t, e) {
2514
+ var n, r, i, a = "style." + e, o = "end." + a, s;
2515
+ return function() {
2516
+ var u = at(this, t), c = u.on, l = u.value[a] == null ? s || (s = ar(e)) : void 0;
2517
+ (c !== n || i !== l) && (r = (n = c).copy()).on(o, i = l), u.on = r;
2518
+ };
2519
+ }
2520
+ function ms(t, e, n) {
2521
+ var r = (t += "") == "transform" ? ma : or;
2522
+ return e == null ? this.styleTween(t, ls(t, r)).on("end.style." + t, ar(t)) : typeof e == "function" ? this.styleTween(t, hs(t, r, Ue(this, "style." + t, e))).each(ds(this._id, t)) : this.styleTween(t, fs(t, r, e), n).on("end.style." + t, null);
2523
+ }
2524
+ function gs(t, e, n) {
2525
+ return function(r) {
2526
+ this.style.setProperty(t, e.call(this, r), n);
2527
+ };
2528
+ }
2529
+ function ps(t, e, n) {
2530
+ var r, i;
2531
+ function a() {
2532
+ var o = e.apply(this, arguments);
2533
+ return o !== i && (r = (i = o) && gs(t, o, n)), r;
2534
+ }
2535
+ return a._value = e, a;
2536
+ }
2537
+ function ys(t, e, n) {
2538
+ var r = "style." + (t += "");
2539
+ if (arguments.length < 2) return (r = this.tween(r)) && r._value;
2540
+ if (e == null) return this.tween(r, null);
2541
+ if (typeof e != "function") throw new Error();
2542
+ return this.tween(r, ps(t, e, n ?? ""));
2543
+ }
2544
+ function ws(t) {
2545
+ return function() {
2546
+ this.textContent = t;
2547
+ };
2548
+ }
2549
+ function xs(t) {
2550
+ return function() {
2551
+ var e = t(this);
2552
+ this.textContent = e ?? "";
2553
+ };
2554
+ }
2555
+ function vs(t) {
2556
+ return this.tween("text", typeof t == "function" ? xs(Ue(this, "text", t)) : ws(t == null ? "" : t + ""));
2557
+ }
2558
+ function _s(t) {
2559
+ return function(e) {
2560
+ this.textContent = t.call(this, e);
2561
+ };
2562
+ }
2563
+ function bs(t) {
2564
+ var e, n;
2565
+ function r() {
2566
+ var i = t.apply(this, arguments);
2567
+ return i !== n && (e = (n = i) && _s(i)), e;
2568
+ }
2569
+ return r._value = t, r;
2570
+ }
2571
+ function Ms(t) {
2572
+ var e = "text";
2573
+ if (arguments.length < 1) return (e = this.tween(e)) && e._value;
2574
+ if (t == null) return this.tween(e, null);
2575
+ if (typeof t != "function") throw new Error();
2576
+ return this.tween(e, bs(t));
2577
+ }
2578
+ function ks() {
2579
+ for (var t = this._name, e = this._id, n = sr(), r = this._groups, i = r.length, a = 0; a < i; ++a)
2580
+ for (var o = r[a], s = o.length, u, c = 0; c < s; ++c)
2581
+ if (u = o[c]) {
2582
+ var l = tt(u, e);
2583
+ de(u, t, n, c, o, {
2584
+ time: l.time + l.delay + l.duration,
2585
+ delay: 0,
2586
+ duration: l.duration,
2587
+ ease: l.ease
2588
+ });
2589
+ }
2590
+ return new ct(r, this._parents, t, n);
2591
+ }
2592
+ function Ss() {
2593
+ var t, e, n = this, r = n._id, i = n.size();
2594
+ return new Promise(function(a, o) {
2595
+ var s = { value: o }, u = { value: function() {
2596
+ --i === 0 && a();
2597
+ } };
2598
+ n.each(function() {
2599
+ var c = at(this, r), l = c.on;
2600
+ l !== t && (e = (t = l).copy(), e._.cancel.push(s), e._.interrupt.push(s), e._.end.push(u)), c.on = e;
2601
+ }), i === 0 && a();
2602
+ });
2603
+ }
2604
+ var Ns = 0;
2605
+ function ct(t, e, n, r) {
2606
+ this._groups = t, this._parents = e, this._name = n, this._id = r;
2607
+ }
2608
+ function sr() {
2609
+ return ++Ns;
2610
+ }
2611
+ var st = Lt.prototype;
2612
+ ct.prototype = {
2613
+ constructor: ct,
2614
+ select: as,
2615
+ selectAll: ss,
2616
+ selectChild: st.selectChild,
2617
+ selectChildren: st.selectChildren,
2618
+ filter: ja,
2619
+ merge: ts,
2620
+ selection: cs,
2621
+ transition: ks,
2622
+ call: st.call,
2623
+ nodes: st.nodes,
2624
+ node: st.node,
2625
+ size: st.size,
2626
+ empty: st.empty,
2627
+ each: st.each,
2628
+ on: rs,
2629
+ attr: Ia,
2630
+ attrTween: Va,
2631
+ style: ms,
2632
+ styleTween: ys,
2633
+ text: vs,
2634
+ textTween: Ms,
2635
+ remove: os,
2636
+ tween: Aa,
2637
+ delay: Ua,
2638
+ duration: Qa,
2639
+ ease: Ja,
2640
+ easeVarying: Ka,
2641
+ end: Ss,
2642
+ [Symbol.iterator]: st[Symbol.iterator]
2643
+ };
2644
+ function $s(t) {
2645
+ return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
2646
+ }
2647
+ var Ts = {
2648
+ time: null,
2649
+ // Set on use.
2650
+ delay: 0,
2651
+ duration: 250,
2652
+ ease: $s
2653
+ };
2654
+ function Es(t, e) {
2655
+ for (var n; !(n = t.__transition) || !(n = n[e]); )
2656
+ if (!(t = t.parentNode))
2657
+ throw new Error(`transition ${e} not found`);
2658
+ return n;
2659
+ }
2660
+ function As(t) {
2661
+ var e, n;
2662
+ t instanceof ct ? (e = t._id, t = t._name) : (e = sr(), (n = Ts).time = Xe(), t = t == null ? null : t + "");
2663
+ for (var r = this._groups, i = r.length, a = 0; a < i; ++a)
2664
+ for (var o = r[a], s = o.length, u, c = 0; c < s; ++c)
2665
+ (u = o[c]) && de(u, t, e, c, o, n || Es(u, e));
2666
+ return new ct(r, this._parents, t, e);
2667
+ }
2668
+ Lt.prototype.interrupt = $a;
2669
+ Lt.prototype.transition = As;
2670
+ function Cs(t) {
2671
+ return Math.abs(t = Math.round(t)) >= 1e21 ? t.toLocaleString("en").replace(/,/g, "") : t.toString(10);
2672
+ }
2673
+ function ue(t, e) {
2674
+ if ((n = (t = e ? t.toExponential(e - 1) : t.toExponential()).indexOf("e")) < 0) return null;
2675
+ var n, r = t.slice(0, n);
2676
+ return [
2677
+ r.length > 1 ? r[0] + r.slice(2) : r,
2678
+ +t.slice(n + 1)
2679
+ ];
2680
+ }
2681
+ function St(t) {
2682
+ return t = ue(Math.abs(t)), t ? t[1] : NaN;
2683
+ }
2684
+ function Fs(t, e) {
2685
+ return function(n, r) {
2686
+ for (var i = n.length, a = [], o = 0, s = t[0], u = 0; i > 0 && s > 0 && (u + s + 1 > r && (s = Math.max(1, r - u)), a.push(n.substring(i -= s, i + s)), !((u += s + 1) > r)); )
2687
+ s = t[o = (o + 1) % t.length];
2688
+ return a.reverse().join(e);
2689
+ };
2690
+ }
2691
+ function zs(t) {
2692
+ return function(e) {
2693
+ return e.replace(/[0-9]/g, function(n) {
2694
+ return t[+n];
2695
+ });
2696
+ };
2697
+ }
2698
+ var Ds = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
2699
+ function ce(t) {
2700
+ if (!(e = Ds.exec(t))) throw new Error("invalid format: " + t);
2701
+ var e;
2702
+ return new We({
2703
+ fill: e[1],
2704
+ align: e[2],
2705
+ sign: e[3],
2706
+ symbol: e[4],
2707
+ zero: e[5],
2708
+ width: e[6],
2709
+ comma: e[7],
2710
+ precision: e[8] && e[8].slice(1),
2711
+ trim: e[9],
2712
+ type: e[10]
2713
+ });
2714
+ }
2715
+ ce.prototype = We.prototype;
2716
+ function We(t) {
2717
+ this.fill = t.fill === void 0 ? " " : t.fill + "", this.align = t.align === void 0 ? ">" : t.align + "", this.sign = t.sign === void 0 ? "-" : t.sign + "", this.symbol = t.symbol === void 0 ? "" : t.symbol + "", this.zero = !!t.zero, this.width = t.width === void 0 ? void 0 : +t.width, this.comma = !!t.comma, this.precision = t.precision === void 0 ? void 0 : +t.precision, this.trim = !!t.trim, this.type = t.type === void 0 ? "" : t.type + "";
2718
+ }
2719
+ We.prototype.toString = function() {
2720
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
2721
+ };
2722
+ function Rs(t) {
2723
+ t: for (var e = t.length, n = 1, r = -1, i; n < e; ++n)
2724
+ switch (t[n]) {
2725
+ case ".":
2726
+ r = i = n;
2727
+ break;
2728
+ case "0":
2729
+ r === 0 && (r = n), i = n;
2730
+ break;
2731
+ default:
2732
+ if (!+t[n]) break t;
2733
+ r > 0 && (r = 0);
2734
+ break;
2735
+ }
2736
+ return r > 0 ? t.slice(0, r) + t.slice(i + 1) : t;
2737
+ }
2738
+ var ur;
2739
+ function Ls(t, e) {
2740
+ var n = ue(t, e);
2741
+ if (!n) return t + "";
2742
+ var r = n[0], i = n[1], a = i - (ur = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, o = r.length;
2743
+ return a === o ? r : a > o ? r + new Array(a - o + 1).join("0") : a > 0 ? r.slice(0, a) + "." + r.slice(a) : "0." + new Array(1 - a).join("0") + ue(t, Math.max(0, e + a - 1))[0];
2744
+ }
2745
+ function _n(t, e) {
2746
+ var n = ue(t, e);
2747
+ if (!n) return t + "";
2748
+ var r = n[0], i = n[1];
2749
+ return i < 0 ? "0." + new Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + new Array(i - r.length + 2).join("0");
2750
+ }
2751
+ const bn = {
2752
+ "%": (t, e) => (t * 100).toFixed(e),
2753
+ b: (t) => Math.round(t).toString(2),
2754
+ c: (t) => t + "",
2755
+ d: Cs,
2756
+ e: (t, e) => t.toExponential(e),
2757
+ f: (t, e) => t.toFixed(e),
2758
+ g: (t, e) => t.toPrecision(e),
2759
+ o: (t) => Math.round(t).toString(8),
2760
+ p: (t, e) => _n(t * 100, e),
2761
+ r: _n,
2762
+ s: Ls,
2763
+ X: (t) => Math.round(t).toString(16).toUpperCase(),
2764
+ x: (t) => Math.round(t).toString(16)
2765
+ };
2766
+ function Mn(t) {
2767
+ return t;
2768
+ }
2769
+ var kn = Array.prototype.map, Sn = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
2770
+ function Is(t) {
2771
+ var e = t.grouping === void 0 || t.thousands === void 0 ? Mn : Fs(kn.call(t.grouping, Number), t.thousands + ""), n = t.currency === void 0 ? "" : t.currency[0] + "", r = t.currency === void 0 ? "" : t.currency[1] + "", i = t.decimal === void 0 ? "." : t.decimal + "", a = t.numerals === void 0 ? Mn : zs(kn.call(t.numerals, String)), o = t.percent === void 0 ? "%" : t.percent + "", s = t.minus === void 0 ? "−" : t.minus + "", u = t.nan === void 0 ? "NaN" : t.nan + "";
2772
+ function c(d) {
2773
+ d = ce(d);
2774
+ var f = d.fill, m = d.align, E = d.sign, D = d.symbol, L = d.zero, _ = d.width, F = d.comma, I = d.precision, y = d.trim, b = d.type;
2775
+ b === "n" ? (F = !0, b = "g") : bn[b] || (I === void 0 && (I = 12), y = !0, b = "g"), (L || f === "0" && m === "=") && (L = !0, f = "0", m = "=");
2776
+ var k = D === "$" ? n : D === "#" && /[boxX]/.test(b) ? "0" + b.toLowerCase() : "", A = D === "$" ? r : /[%p]/.test(b) ? o : "", M = bn[b], p = /[defgprs%]/.test(b);
2777
+ I = I === void 0 ? 6 : /[gprs]/.test(b) ? Math.max(1, Math.min(21, I)) : Math.max(0, Math.min(20, I));
2778
+ function R(w) {
2779
+ var z = k, q = A, h, v, g;
2780
+ if (b === "c")
2781
+ q = M(w) + q, w = "";
2782
+ else {
2783
+ w = +w;
2784
+ var x = w < 0 || 1 / w < 0;
2785
+ if (w = isNaN(w) ? u : M(Math.abs(w), I), y && (w = Rs(w)), x && +w == 0 && E !== "+" && (x = !1), z = (x ? E === "(" ? E : s : E === "-" || E === "(" ? "" : E) + z, q = (b === "s" ? Sn[8 + ur / 3] : "") + q + (x && E === "(" ? ")" : ""), p) {
2786
+ for (h = -1, v = w.length; ++h < v; )
2787
+ if (g = w.charCodeAt(h), 48 > g || g > 57) {
2788
+ q = (g === 46 ? i + w.slice(h + 1) : w.slice(h)) + q, w = w.slice(0, h);
2789
+ break;
2790
+ }
2791
+ }
2792
+ }
2793
+ F && !L && (w = e(w, 1 / 0));
2794
+ var N = z.length + w.length + q.length, S = N < _ ? new Array(_ - N + 1).join(f) : "";
2795
+ switch (F && L && (w = e(S + w, S.length ? _ - q.length : 1 / 0), S = ""), m) {
2796
+ case "<":
2797
+ w = z + w + q + S;
2798
+ break;
2799
+ case "=":
2800
+ w = z + S + w + q;
2801
+ break;
2802
+ case "^":
2803
+ w = S.slice(0, N = S.length >> 1) + z + w + q + S.slice(N);
2804
+ break;
2805
+ default:
2806
+ w = S + z + w + q;
2807
+ break;
2808
+ }
2809
+ return a(w);
2810
+ }
2811
+ return R.toString = function() {
2812
+ return d + "";
2813
+ }, R;
2814
+ }
2815
+ function l(d, f) {
2816
+ var m = c((d = ce(d), d.type = "f", d)), E = Math.max(-8, Math.min(8, Math.floor(St(f) / 3))) * 3, D = Math.pow(10, -E), L = Sn[8 + E / 3];
2817
+ return function(_) {
2818
+ return m(D * _) + L;
2819
+ };
2820
+ }
2821
+ return {
2822
+ format: c,
2823
+ formatPrefix: l
2824
+ };
2825
+ }
2826
+ var Ut, cr, lr;
2827
+ qs({
2828
+ thousands: ",",
2829
+ grouping: [3],
2830
+ currency: ["$", ""]
2831
+ });
2832
+ function qs(t) {
2833
+ return Ut = Is(t), cr = Ut.format, lr = Ut.formatPrefix, Ut;
2834
+ }
2835
+ function Ps(t) {
2836
+ return Math.max(0, -St(Math.abs(t)));
2837
+ }
2838
+ function Hs(t, e) {
2839
+ return Math.max(0, Math.max(-8, Math.min(8, Math.floor(St(e) / 3))) * 3 - St(Math.abs(t)));
2840
+ }
2841
+ function Os(t, e) {
2842
+ return t = Math.abs(t), e = Math.abs(e) - t, Math.max(0, St(e) - St(t)) + 1;
2843
+ }
2844
+ function me(t, e) {
2845
+ switch (arguments.length) {
2846
+ case 0:
2847
+ break;
2848
+ case 1:
2849
+ this.range(t);
2850
+ break;
2851
+ default:
2852
+ this.range(e).domain(t);
2853
+ break;
2854
+ }
2855
+ return this;
2856
+ }
2857
+ const Nn = /* @__PURE__ */ Symbol("implicit");
2858
+ function Vs() {
2859
+ var t = new je(), e = [], n = [], r = Nn;
2860
+ function i(a) {
2861
+ let o = t.get(a);
2862
+ if (o === void 0) {
2863
+ if (r !== Nn) return r;
2864
+ t.set(a, o = e.push(a) - 1);
2865
+ }
2866
+ return n[o % n.length];
2867
+ }
2868
+ return i.domain = function(a) {
2869
+ if (!arguments.length) return e.slice();
2870
+ e = [], t = new je();
2871
+ for (const o of a)
2872
+ t.has(o) || t.set(o, e.push(o) - 1);
2873
+ return i;
2874
+ }, i.range = function(a) {
2875
+ return arguments.length ? (n = Array.from(a), i) : n.slice();
2876
+ }, i.unknown = function(a) {
2877
+ return arguments.length ? (r = a, i) : r;
2878
+ }, i.copy = function() {
2879
+ return Vs(e, n).unknown(r);
2880
+ }, me.apply(i, arguments), i;
2881
+ }
2882
+ function Xs(t) {
2883
+ return function() {
2884
+ return t;
2885
+ };
2886
+ }
2887
+ function Ys(t) {
2888
+ return +t;
2889
+ }
2890
+ var $n = [0, 1];
2891
+ function it(t) {
2892
+ return t;
2893
+ }
2894
+ function Le(t, e) {
2895
+ return (e -= t = +t) ? function(n) {
2896
+ return (n - t) / e;
2897
+ } : Xs(isNaN(e) ? NaN : 0.5);
2898
+ }
2899
+ function Us(t, e) {
2900
+ var n;
2901
+ return t > e && (n = t, t = e, e = n), function(r) {
2902
+ return Math.max(t, Math.min(e, r));
2903
+ };
2904
+ }
2905
+ function Ws(t, e, n) {
2906
+ var r = t[0], i = t[1], a = e[0], o = e[1];
2907
+ return i < r ? (r = Le(i, r), a = n(o, a)) : (r = Le(r, i), a = n(a, o)), function(s) {
2908
+ return a(r(s));
2909
+ };
2910
+ }
2911
+ function Gs(t, e, n) {
2912
+ var r = Math.min(t.length, e.length) - 1, i = new Array(r), a = new Array(r), o = -1;
2913
+ for (t[r] < t[0] && (t = t.slice().reverse(), e = e.slice().reverse()); ++o < r; )
2914
+ i[o] = Le(t[o], t[o + 1]), a[o] = n(e[o], e[o + 1]);
2915
+ return function(s) {
2916
+ var u = zn(t, s, 1, r) - 1;
2917
+ return a[u](i[u](s));
2918
+ };
2919
+ }
2920
+ function fr(t, e) {
2921
+ return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());
2922
+ }
2923
+ function hr() {
2924
+ var t = $n, e = $n, n = Ve, r, i, a, o = it, s, u, c;
2925
+ function l() {
2926
+ var f = Math.min(t.length, e.length);
2927
+ return o !== it && (o = Us(t[0], t[f - 1])), s = f > 2 ? Gs : Ws, u = c = null, d;
2928
+ }
2929
+ function d(f) {
2930
+ return f == null || isNaN(f = +f) ? a : (u || (u = s(t.map(r), e, n)))(r(o(f)));
2931
+ }
2932
+ return d.invert = function(f) {
2933
+ return o(i((c || (c = s(e, t.map(r), K)))(f)));
2934
+ }, d.domain = function(f) {
2935
+ return arguments.length ? (t = Array.from(f, Ys), l()) : t.slice();
2936
+ }, d.range = function(f) {
2937
+ return arguments.length ? (e = Array.from(f), l()) : e.slice();
2938
+ }, d.rangeRound = function(f) {
2939
+ return e = Array.from(f), n = fa, l();
2940
+ }, d.clamp = function(f) {
2941
+ return arguments.length ? (o = f ? !0 : it, l()) : o !== it;
2942
+ }, d.interpolate = function(f) {
2943
+ return arguments.length ? (n = f, l()) : n;
2944
+ }, d.unknown = function(f) {
2945
+ return arguments.length ? (a = f, d) : a;
2946
+ }, function(f, m) {
2947
+ return r = f, i = m, l();
2948
+ };
2949
+ }
2950
+ function Qs() {
2951
+ return hr()(it, it);
2952
+ }
2953
+ function Bs(t, e, n, r) {
2954
+ var i = Qr(t, e, n), a;
2955
+ switch (r = ce(r ?? ",f"), r.type) {
2956
+ case "s": {
2957
+ var o = Math.max(Math.abs(t), Math.abs(e));
2958
+ return r.precision == null && !isNaN(a = Hs(i, o)) && (r.precision = a), lr(r, o);
2959
+ }
2960
+ case "":
2961
+ case "e":
2962
+ case "g":
2963
+ case "p":
2964
+ case "r": {
2965
+ r.precision == null && !isNaN(a = Os(i, Math.max(Math.abs(t), Math.abs(e)))) && (r.precision = a - (r.type === "e"));
2966
+ break;
2967
+ }
2968
+ case "f":
2969
+ case "%": {
2970
+ r.precision == null && !isNaN(a = Ps(i)) && (r.precision = a - (r.type === "%") * 2);
2971
+ break;
2972
+ }
2973
+ }
2974
+ return cr(r);
2975
+ }
2976
+ function Ge(t) {
2977
+ var e = t.domain;
2978
+ return t.ticks = function(n) {
2979
+ var r = e();
2980
+ return Gr(r[0], r[r.length - 1], n ?? 10);
2981
+ }, t.tickFormat = function(n, r) {
2982
+ var i = e();
2983
+ return Bs(i[0], i[i.length - 1], n ?? 10, r);
2984
+ }, t.nice = function(n) {
2985
+ n == null && (n = 10);
2986
+ var r = e(), i = 0, a = r.length - 1, o = r[i], s = r[a], u, c, l = 10;
2987
+ for (s < o && (c = o, o = s, s = c, c = i, i = a, a = c); l-- > 0; ) {
2988
+ if (c = Ne(o, s, n), c === u)
2989
+ return r[i] = o, r[a] = s, e(r);
2990
+ if (c > 0)
2991
+ o = Math.floor(o / c) * c, s = Math.ceil(s / c) * c;
2992
+ else if (c < 0)
2993
+ o = Math.ceil(o * c) / c, s = Math.floor(s * c) / c;
2994
+ else
2995
+ break;
2996
+ u = c;
2997
+ }
2998
+ return t;
2999
+ }, t;
3000
+ }
3001
+ function Js() {
3002
+ var t = Qs();
3003
+ return t.copy = function() {
3004
+ return fr(t, Js());
3005
+ }, me.apply(t, arguments), Ge(t);
3006
+ }
3007
+ function Tn(t) {
3008
+ return function(e) {
3009
+ return e < 0 ? -Math.pow(-e, t) : Math.pow(e, t);
3010
+ };
3011
+ }
3012
+ function Zs(t) {
3013
+ return t < 0 ? -Math.sqrt(-t) : Math.sqrt(t);
3014
+ }
3015
+ function Ks(t) {
3016
+ return t < 0 ? -t * t : t * t;
3017
+ }
3018
+ function js(t) {
3019
+ var e = t(it, it), n = 1;
3020
+ function r() {
3021
+ return n === 1 ? t(it, it) : n === 0.5 ? t(Zs, Ks) : t(Tn(n), Tn(1 / n));
3022
+ }
3023
+ return e.exponent = function(i) {
3024
+ return arguments.length ? (n = +i, r()) : n;
3025
+ }, Ge(e);
3026
+ }
3027
+ function dr() {
3028
+ var t = js(hr());
3029
+ return t.copy = function() {
3030
+ return fr(t, dr()).exponent(t.exponent());
3031
+ }, me.apply(t, arguments), t;
3032
+ }
3033
+ function Tu() {
3034
+ return dr.apply(null, arguments).exponent(0.5);
3035
+ }
3036
+ function mr() {
3037
+ var t = 0, e = 1, n = 1, r = [0.5], i = [0, 1], a;
3038
+ function o(u) {
3039
+ return u != null && u <= u ? i[zn(r, u, 0, n)] : a;
3040
+ }
3041
+ function s() {
3042
+ var u = -1;
3043
+ for (r = new Array(n); ++u < n; ) r[u] = ((u + 1) * e - (u - n) * t) / (n + 1);
3044
+ return o;
3045
+ }
3046
+ return o.domain = function(u) {
3047
+ return arguments.length ? ([t, e] = u, t = +t, e = +e, s()) : [t, e];
3048
+ }, o.range = function(u) {
3049
+ return arguments.length ? (n = (i = Array.from(u)).length - 1, s()) : i.slice();
3050
+ }, o.invertExtent = function(u) {
3051
+ var c = i.indexOf(u);
3052
+ return c < 0 ? [NaN, NaN] : c < 1 ? [t, r[0]] : c >= n ? [r[n - 1], e] : [r[c - 1], r[c]];
3053
+ }, o.unknown = function(u) {
3054
+ return arguments.length && (a = u), o;
3055
+ }, o.thresholds = function() {
3056
+ return r.slice();
3057
+ }, o.copy = function() {
3058
+ return mr().domain([t, e]).range(i).unknown(a);
3059
+ }, me.apply(Ge(o), arguments);
3060
+ }
3061
+ const Wt = (t) => () => t;
3062
+ function tu(t, {
3063
+ sourceEvent: e,
3064
+ target: n,
3065
+ transform: r,
3066
+ dispatch: i
3067
+ }) {
3068
+ Object.defineProperties(this, {
3069
+ type: { value: t, enumerable: !0, configurable: !0 },
3070
+ sourceEvent: { value: e, enumerable: !0, configurable: !0 },
3071
+ target: { value: n, enumerable: !0, configurable: !0 },
3072
+ transform: { value: r, enumerable: !0, configurable: !0 },
3073
+ _: { value: i }
3074
+ });
3075
+ }
3076
+ function dt(t, e, n) {
3077
+ this.k = t, this.x = e, this.y = n;
3078
+ }
3079
+ dt.prototype = {
3080
+ constructor: dt,
3081
+ scale: function(t) {
3082
+ return t === 1 ? this : new dt(this.k * t, this.x, this.y);
3083
+ },
3084
+ translate: function(t, e) {
3085
+ return t === 0 & e === 0 ? this : new dt(this.k, this.x + this.k * t, this.y + this.k * e);
3086
+ },
3087
+ apply: function(t) {
3088
+ return [t[0] * this.k + this.x, t[1] * this.k + this.y];
3089
+ },
3090
+ applyX: function(t) {
3091
+ return t * this.k + this.x;
3092
+ },
3093
+ applyY: function(t) {
3094
+ return t * this.k + this.y;
3095
+ },
3096
+ invert: function(t) {
3097
+ return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k];
3098
+ },
3099
+ invertX: function(t) {
3100
+ return (t - this.x) / this.k;
3101
+ },
3102
+ invertY: function(t) {
3103
+ return (t - this.y) / this.k;
3104
+ },
3105
+ rescaleX: function(t) {
3106
+ return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t));
3107
+ },
3108
+ rescaleY: function(t) {
3109
+ return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t));
3110
+ },
3111
+ toString: function() {
3112
+ return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
3113
+ }
3114
+ };
3115
+ var gr = new dt(1, 0, 0);
3116
+ function Me(t) {
3117
+ t.stopImmediatePropagation();
3118
+ }
3119
+ function Tt(t) {
3120
+ t.preventDefault(), t.stopImmediatePropagation();
3121
+ }
3122
+ function eu(t) {
3123
+ return (!t.ctrlKey || t.type === "wheel") && !t.button;
3124
+ }
3125
+ function nu() {
3126
+ var t = this;
3127
+ return t instanceof SVGElement ? (t = t.ownerSVGElement || t, t.hasAttribute("viewBox") ? (t = t.viewBox.baseVal, [[t.x, t.y], [t.x + t.width, t.y + t.height]]) : [[0, 0], [t.width.baseVal.value, t.height.baseVal.value]]) : [[0, 0], [t.clientWidth, t.clientHeight]];
3128
+ }
3129
+ function En() {
3130
+ return this.__zoom || gr;
3131
+ }
3132
+ function ru(t) {
3133
+ return -t.deltaY * (t.deltaMode === 1 ? 0.05 : t.deltaMode ? 1 : 2e-3) * (t.ctrlKey ? 10 : 1);
3134
+ }
3135
+ function iu() {
3136
+ return navigator.maxTouchPoints || "ontouchstart" in this;
3137
+ }
3138
+ function ou(t, e, n) {
3139
+ var r = t.invertX(e[0][0]) - n[0][0], i = t.invertX(e[1][0]) - n[1][0], a = t.invertY(e[0][1]) - n[0][1], o = t.invertY(e[1][1]) - n[1][1];
3140
+ return t.translate(
3141
+ i > r ? (r + i) / 2 : Math.min(0, r) || Math.max(0, i),
3142
+ o > a ? (a + o) / 2 : Math.min(0, a) || Math.max(0, o)
3143
+ );
3144
+ }
3145
+ function Eu() {
3146
+ var t = eu, e = nu, n = ou, r = ru, i = iu, a = [0, 1 / 0], o = [[-1 / 0, -1 / 0], [1 / 0, 1 / 0]], s = 250, u = xa, c = le("start", "zoom", "end"), l, d, f, m = 500, E = 150, D = 0, L = 10;
3147
+ function _(h) {
3148
+ h.property("__zoom", En).on("wheel.zoom", M, { passive: !1 }).on("mousedown.zoom", p).on("dblclick.zoom", R).filter(i).on("touchstart.zoom", w).on("touchmove.zoom", z).on("touchend.zoom touchcancel.zoom", q).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
3149
+ }
3150
+ _.transform = function(h, v, g, x) {
3151
+ var N = h.selection ? h.selection() : h;
3152
+ N.property("__zoom", En), h !== N ? b(h, v, g, x) : N.interrupt().each(function() {
3153
+ k(this, arguments).event(x).start().zoom(null, typeof v == "function" ? v.apply(this, arguments) : v).end();
3154
+ });
3155
+ }, _.scaleBy = function(h, v, g, x) {
3156
+ _.scaleTo(h, function() {
3157
+ var N = this.__zoom.k, S = typeof v == "function" ? v.apply(this, arguments) : v;
3158
+ return N * S;
3159
+ }, g, x);
3160
+ }, _.scaleTo = function(h, v, g, x) {
3161
+ _.transform(h, function() {
3162
+ var N = e.apply(this, arguments), S = this.__zoom, $ = g == null ? y(N) : typeof g == "function" ? g.apply(this, arguments) : g, P = S.invert($), V = typeof v == "function" ? v.apply(this, arguments) : v;
3163
+ return n(I(F(S, V), $, P), N, o);
3164
+ }, g, x);
3165
+ }, _.translateBy = function(h, v, g, x) {
3166
+ _.transform(h, function() {
3167
+ return n(this.__zoom.translate(
3168
+ typeof v == "function" ? v.apply(this, arguments) : v,
3169
+ typeof g == "function" ? g.apply(this, arguments) : g
3170
+ ), e.apply(this, arguments), o);
3171
+ }, null, x);
3172
+ }, _.translateTo = function(h, v, g, x, N) {
3173
+ _.transform(h, function() {
3174
+ var S = e.apply(this, arguments), $ = this.__zoom, P = x == null ? y(S) : typeof x == "function" ? x.apply(this, arguments) : x;
3175
+ return n(gr.translate(P[0], P[1]).scale($.k).translate(
3176
+ typeof v == "function" ? -v.apply(this, arguments) : -v,
3177
+ typeof g == "function" ? -g.apply(this, arguments) : -g
3178
+ ), S, o);
3179
+ }, x, N);
3180
+ };
3181
+ function F(h, v) {
3182
+ return v = Math.max(a[0], Math.min(a[1], v)), v === h.k ? h : new dt(v, h.x, h.y);
3183
+ }
3184
+ function I(h, v, g) {
3185
+ var x = v[0] - g[0] * h.k, N = v[1] - g[1] * h.k;
3186
+ return x === h.x && N === h.y ? h : new dt(h.k, x, N);
3187
+ }
3188
+ function y(h) {
3189
+ return [(+h[0][0] + +h[1][0]) / 2, (+h[0][1] + +h[1][1]) / 2];
3190
+ }
3191
+ function b(h, v, g, x) {
3192
+ h.on("start.zoom", function() {
3193
+ k(this, arguments).event(x).start();
3194
+ }).on("interrupt.zoom end.zoom", function() {
3195
+ k(this, arguments).event(x).end();
3196
+ }).tween("zoom", function() {
3197
+ var N = this, S = arguments, $ = k(N, S).event(x), P = e.apply(N, S), V = g == null ? y(P) : typeof g == "function" ? g.apply(N, S) : g, H = Math.max(P[1][0] - P[0][0], P[1][1] - P[0][1]), X = N.__zoom, G = typeof v == "function" ? v.apply(N, S) : v, et = u(X.invert(V).concat(H / X.k), G.invert(V).concat(H / G.k));
3198
+ return function(J) {
3199
+ if (J === 1) J = G;
3200
+ else {
3201
+ var nt = et(J), rt = H / nt[2];
3202
+ J = new dt(rt, V[0] - nt[0] * rt, V[1] - nt[1] * rt);
3203
+ }
3204
+ $.zoom(null, J);
3205
+ };
3206
+ });
3207
+ }
3208
+ function k(h, v, g) {
3209
+ return !g && h.__zooming || new A(h, v);
3210
+ }
3211
+ function A(h, v) {
3212
+ this.that = h, this.args = v, this.active = 0, this.sourceEvent = null, this.extent = e.apply(h, v), this.taps = 0;
3213
+ }
3214
+ A.prototype = {
3215
+ event: function(h) {
3216
+ return h && (this.sourceEvent = h), this;
3217
+ },
3218
+ start: function() {
3219
+ return ++this.active === 1 && (this.that.__zooming = this, this.emit("start")), this;
3220
+ },
3221
+ zoom: function(h, v) {
3222
+ return this.mouse && h !== "mouse" && (this.mouse[1] = v.invert(this.mouse[0])), this.touch0 && h !== "touch" && (this.touch0[1] = v.invert(this.touch0[0])), this.touch1 && h !== "touch" && (this.touch1[1] = v.invert(this.touch1[0])), this.that.__zoom = v, this.emit("zoom"), this;
3223
+ },
3224
+ end: function() {
3225
+ return --this.active === 0 && (delete this.that.__zooming, this.emit("end")), this;
3226
+ },
3227
+ emit: function(h) {
3228
+ var v = Q(this.that).datum();
3229
+ c.call(
3230
+ h,
3231
+ this.that,
3232
+ new tu(h, {
3233
+ sourceEvent: this.sourceEvent,
3234
+ target: _,
3235
+ transform: this.that.__zoom,
3236
+ dispatch: c
3237
+ }),
3238
+ v
3239
+ );
3240
+ }
3241
+ };
3242
+ function M(h, ...v) {
3243
+ if (!t.apply(this, arguments)) return;
3244
+ var g = k(this, v).event(h), x = this.__zoom, N = Math.max(a[0], Math.min(a[1], x.k * Math.pow(2, r.apply(this, arguments)))), S = ut(h);
3245
+ if (g.wheel)
3246
+ (g.mouse[0][0] !== S[0] || g.mouse[0][1] !== S[1]) && (g.mouse[1] = x.invert(g.mouse[0] = S)), clearTimeout(g.wheel);
3247
+ else {
3248
+ if (x.k === N) return;
3249
+ g.mouse = [S, x.invert(S)], Kt(this), g.start();
3250
+ }
3251
+ Tt(h), g.wheel = setTimeout($, E), g.zoom("mouse", n(I(F(x, N), g.mouse[0], g.mouse[1]), g.extent, o));
3252
+ function $() {
3253
+ g.wheel = null, g.end();
3254
+ }
3255
+ }
3256
+ function p(h, ...v) {
3257
+ if (f || !t.apply(this, arguments)) return;
3258
+ var g = h.currentTarget, x = k(this, v, !0).event(h), N = Q(h.view).on("mousemove.zoom", V, !0).on("mouseup.zoom", H, !0), S = ut(h, g), $ = h.clientX, P = h.clientY;
3259
+ Gn(h.view), Me(h), x.mouse = [S, this.__zoom.invert(S)], Kt(this), x.start();
3260
+ function V(X) {
3261
+ if (Tt(X), !x.moved) {
3262
+ var G = X.clientX - $, et = X.clientY - P;
3263
+ x.moved = G * G + et * et > D;
3264
+ }
3265
+ x.event(X).zoom("mouse", n(I(x.that.__zoom, x.mouse[0] = ut(X, g), x.mouse[1]), x.extent, o));
3266
+ }
3267
+ function H(X) {
3268
+ N.on("mousemove.zoom mouseup.zoom", null), Qn(X.view, x.moved), Tt(X), x.event(X).end();
3269
+ }
3270
+ }
3271
+ function R(h, ...v) {
3272
+ if (t.apply(this, arguments)) {
3273
+ var g = this.__zoom, x = ut(h.changedTouches ? h.changedTouches[0] : h, this), N = g.invert(x), S = g.k * (h.shiftKey ? 0.5 : 2), $ = n(I(F(g, S), x, N), e.apply(this, v), o);
3274
+ Tt(h), s > 0 ? Q(this).transition().duration(s).call(b, $, x, h) : Q(this).call(_.transform, $, x, h);
3275
+ }
3276
+ }
3277
+ function w(h, ...v) {
3278
+ if (t.apply(this, arguments)) {
3279
+ var g = h.touches, x = g.length, N = k(this, v, h.changedTouches.length === x).event(h), S, $, P, V;
3280
+ for (Me(h), $ = 0; $ < x; ++$)
3281
+ P = g[$], V = ut(P, this), V = [V, this.__zoom.invert(V), P.identifier], N.touch0 ? !N.touch1 && N.touch0[2] !== V[2] && (N.touch1 = V, N.taps = 0) : (N.touch0 = V, S = !0, N.taps = 1 + !!l);
3282
+ l && (l = clearTimeout(l)), S && (N.taps < 2 && (d = V[0], l = setTimeout(function() {
3283
+ l = null;
3284
+ }, m)), Kt(this), N.start());
3285
+ }
3286
+ }
3287
+ function z(h, ...v) {
3288
+ if (this.__zooming) {
3289
+ var g = k(this, v).event(h), x = h.changedTouches, N = x.length, S, $, P, V;
3290
+ for (Tt(h), S = 0; S < N; ++S)
3291
+ $ = x[S], P = ut($, this), g.touch0 && g.touch0[2] === $.identifier ? g.touch0[0] = P : g.touch1 && g.touch1[2] === $.identifier && (g.touch1[0] = P);
3292
+ if ($ = g.that.__zoom, g.touch1) {
3293
+ var H = g.touch0[0], X = g.touch0[1], G = g.touch1[0], et = g.touch1[1], J = (J = G[0] - H[0]) * J + (J = G[1] - H[1]) * J, nt = (nt = et[0] - X[0]) * nt + (nt = et[1] - X[1]) * nt;
3294
+ $ = F($, Math.sqrt(J / nt)), P = [(H[0] + G[0]) / 2, (H[1] + G[1]) / 2], V = [(X[0] + et[0]) / 2, (X[1] + et[1]) / 2];
3295
+ } else if (g.touch0) P = g.touch0[0], V = g.touch0[1];
3296
+ else return;
3297
+ g.zoom("touch", n(I($, P, V), g.extent, o));
3298
+ }
3299
+ }
3300
+ function q(h, ...v) {
3301
+ if (this.__zooming) {
3302
+ var g = k(this, v).event(h), x = h.changedTouches, N = x.length, S, $;
3303
+ for (Me(h), f && clearTimeout(f), f = setTimeout(function() {
3304
+ f = null;
3305
+ }, m), S = 0; S < N; ++S)
3306
+ $ = x[S], g.touch0 && g.touch0[2] === $.identifier ? delete g.touch0 : g.touch1 && g.touch1[2] === $.identifier && delete g.touch1;
3307
+ if (g.touch1 && !g.touch0 && (g.touch0 = g.touch1, delete g.touch1), g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);
3308
+ else if (g.end(), g.taps === 2 && ($ = ut($, this), Math.hypot(d[0] - $[0], d[1] - $[1]) < L)) {
3309
+ var P = Q(this).on("dblclick.zoom");
3310
+ P && P.apply(this, arguments);
3311
+ }
3312
+ }
3313
+ }
3314
+ return _.wheelDelta = function(h) {
3315
+ return arguments.length ? (r = typeof h == "function" ? h : Wt(+h), _) : r;
3316
+ }, _.filter = function(h) {
3317
+ return arguments.length ? (t = typeof h == "function" ? h : Wt(!!h), _) : t;
3318
+ }, _.touchable = function(h) {
3319
+ return arguments.length ? (i = typeof h == "function" ? h : Wt(!!h), _) : i;
3320
+ }, _.extent = function(h) {
3321
+ return arguments.length ? (e = typeof h == "function" ? h : Wt([[+h[0][0], +h[0][1]], [+h[1][0], +h[1][1]]]), _) : e;
3322
+ }, _.scaleExtent = function(h) {
3323
+ return arguments.length ? (a[0] = +h[0], a[1] = +h[1], _) : [a[0], a[1]];
3324
+ }, _.translateExtent = function(h) {
3325
+ return arguments.length ? (o[0][0] = +h[0][0], o[1][0] = +h[1][0], o[0][1] = +h[0][1], o[1][1] = +h[1][1], _) : [[o[0][0], o[0][1]], [o[1][0], o[1][1]]];
3326
+ }, _.constrain = function(h) {
3327
+ return arguments.length ? (n = h, _) : n;
3328
+ }, _.duration = function(h) {
3329
+ return arguments.length ? (s = +h, _) : s;
3330
+ }, _.interpolate = function(h) {
3331
+ return arguments.length ? (u = h, _) : u;
3332
+ }, _.on = function() {
3333
+ var h = c.on.apply(c, arguments);
3334
+ return h === c ? _ : h;
3335
+ }, _.clickDistance = function(h) {
3336
+ return arguments.length ? (D = (h = +h) * h, _) : Math.sqrt(D);
3337
+ }, _.tapDistance = function(h) {
3338
+ return arguments.length ? (L = +h, _) : L;
3339
+ }, _;
3340
+ }
3341
+ function au({
3342
+ data: t,
3343
+ chartConfig: e,
3344
+ displayConfig: n = {},
3345
+ queryObject: r,
3346
+ height: i = "100%",
3347
+ colorPalette: a
3348
+ }) {
3349
+ const o = Ke(null), s = Ke(null), [u, c] = ht({ width: 0, height: 0 }), [l, d] = ht(!1), [f, m] = ht("light"), { getFieldLabel: E } = Fr();
3350
+ Gt(() => (m(jt()), Lr((p) => {
3351
+ m(p);
3352
+ })), []);
3353
+ const D = {
3354
+ showTooltip: n?.showTooltip ?? !0,
3355
+ showLabels: n?.showLabels ?? !0,
3356
+ fitToWidth: n?.fitToWidth ?? !1
3357
+ };
3358
+ kr(() => {
3359
+ let M = 0;
3360
+ const p = 10;
3361
+ let R, w;
3362
+ const z = () => {
3363
+ if (s.current) {
3364
+ const { width: h, height: v } = s.current.getBoundingClientRect();
3365
+ if (h > 0 && v > 0)
3366
+ return c({ width: h, height: v }), d(!0), !0;
3367
+ }
3368
+ return !1;
3369
+ };
3370
+ if (!z() && M < p) {
3371
+ const h = () => {
3372
+ !z() && M < p && (M++, w = setTimeout(() => {
3373
+ R = requestAnimationFrame(h);
3374
+ }, 50 * M));
3375
+ };
3376
+ R = requestAnimationFrame(h);
3377
+ }
3378
+ return () => {
3379
+ R && cancelAnimationFrame(R), w && clearTimeout(w);
3380
+ };
3381
+ }, []), Gt(() => {
3382
+ let M = null;
3383
+ const p = () => {
3384
+ if (s.current) {
3385
+ const { width: R, height: w } = s.current.getBoundingClientRect();
3386
+ R > 0 && w > 0 && (c({ width: R, height: w }), l || d(!0));
3387
+ }
3388
+ };
3389
+ return s.current && (M = new ResizeObserver(() => p()), M.observe(s.current), p()), window.addEventListener("resize", p), () => {
3390
+ M && M.disconnect(), window.removeEventListener("resize", p);
3391
+ };
3392
+ }, [l]);
3393
+ const L = (M) => Math.floor(M.getMonth() / 3) + 1, _ = (M) => M.getMonth() % 3 + 1, F = (M) => {
3394
+ const p = M.getDate();
3395
+ return Math.floor((p - 1) / 7) + 1;
3396
+ }, I = (M) => {
3397
+ switch (M?.toLowerCase()) {
3398
+ case "year":
3399
+ return null;
3400
+ case "quarter":
3401
+ return {
3402
+ extractX: (p) => p.getFullYear(),
3403
+ extractY: (p) => L(p) - 1,
3404
+ // 0-3 for indexing
3405
+ xLabels: [],
3406
+ // Will be determined from data
3407
+ yLabels: ["Q1", "Q2", "Q3", "Q4"],
3408
+ xFormat: (p) => `'${p.toString().slice(-2)}`,
3409
+ // '24 instead of 2024
3410
+ yFormat: (p) => ["Q1", "Q2", "Q3", "Q4"][p] || "",
3411
+ cellWidth: 16,
3412
+ cellHeight: 16
3413
+ };
3414
+ case "month":
3415
+ return {
3416
+ extractX: (p) => {
3417
+ const R = p.getFullYear(), w = L(p);
3418
+ return R * 10 + w;
3419
+ },
3420
+ extractY: (p) => _(p) - 1,
3421
+ // 0-2 for indexing
3422
+ xLabels: [],
3423
+ // Will be determined from data
3424
+ yLabels: ["Month 1", "Month 2", "Month 3"],
3425
+ xFormat: (p) => `Q${p % 10}`,
3426
+ yFormat: (p) => ["Month 1", "Month 2", "Month 3"][p] || "",
3427
+ cellWidth: 16,
3428
+ cellHeight: 16,
3429
+ hasHierarchicalLabels: !0,
3430
+ // Flag to indicate we need special handling
3431
+ getYearFromX: (p) => Math.floor(p / 10)
3432
+ // Helper to get year for grouping
3433
+ };
3434
+ case "week":
3435
+ return {
3436
+ extractX: (p) => {
3437
+ const R = p.getFullYear(), w = p.getMonth() + 1;
3438
+ return R * 100 + w;
3439
+ },
3440
+ extractY: (p) => F(p) - 1,
3441
+ // 0-5 for indexing
3442
+ xLabels: [],
3443
+ // Will be determined from data
3444
+ yLabels: ["Week 1", "Week 2", "Week 3", "Week 4", "Week 5"],
3445
+ xFormat: (p) => {
3446
+ const R = p % 100;
3447
+ return ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"][R - 1] || "";
3448
+ },
3449
+ yFormat: (p) => ["Week 1", "Week 2", "Week 3", "Week 4", "Week 5"][p] || "",
3450
+ cellWidth: 16,
3451
+ cellHeight: 16,
3452
+ hasHierarchicalLabels: !0,
3453
+ // Add hierarchical labels like month view
3454
+ getYearFromX: (p) => Math.floor(p / 100)
3455
+ // Helper to get year for grouping
3456
+ };
3457
+ case "day":
3458
+ return {
3459
+ extractX: (p) => {
3460
+ const { year: R, week: w } = y(p);
3461
+ return R * 100 + w;
3462
+ },
3463
+ extractY: (p) => p.getDay(),
3464
+ // 0-6 (Sun-Sat)
3465
+ xLabels: [],
3466
+ // Will be determined from data
3467
+ yLabels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
3468
+ xFormat: (p) => `${p % 100}`,
3469
+ yFormat: (p) => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][p] || "",
3470
+ cellWidth: 16,
3471
+ cellHeight: 16,
3472
+ hasHierarchicalLabels: !0,
3473
+ // Add hierarchical labels
3474
+ getYearFromX: (p) => Math.floor(p / 100)
3475
+ // Helper to get year for grouping
3476
+ };
3477
+ case "hour":
3478
+ return {
3479
+ extractX: (p) => {
3480
+ const R = p.getFullYear(), w = p.getMonth() + 1, z = p.getDate();
3481
+ return R * 1e4 + w * 100 + z;
3482
+ },
3483
+ extractY: (p) => Math.floor(p.getHours() / 3),
3484
+ // 0-7 for 8 three-hour blocks
3485
+ xLabels: [],
3486
+ // Will be determined from data
3487
+ yLabels: ["00-03", "03-06", "06-09", "09-12", "12-15", "15-18", "18-21", "21-00"],
3488
+ xFormat: (p) => `${p % 100}`,
3489
+ yFormat: (p) => ["00-03", "03-06", "06-09", "09-12", "12-15", "15-18", "18-21", "21-00"][p] || "",
3490
+ cellWidth: 16,
3491
+ cellHeight: 16,
3492
+ hasHierarchicalLabels: !0,
3493
+ // Show year/month grouping above
3494
+ getYearFromX: (p) => Math.floor(p / 100)
3495
+ // Extract YYYYMM for month grouping
3496
+ };
3497
+ default:
3498
+ return null;
3499
+ }
3500
+ }, y = (M) => {
3501
+ const p = new Date(Date.UTC(M.getFullYear(), M.getMonth(), M.getDate())), R = p.getUTCDay() || 7;
3502
+ p.setUTCDate(p.getUTCDate() + 4 - R);
3503
+ const w = p.getUTCFullYear(), z = new Date(Date.UTC(w, 0, 1)), q = Math.ceil(((p.getTime() - z.getTime()) / 864e5 + 1) / 7);
3504
+ return { year: w, week: q };
3505
+ };
3506
+ if (Gt(() => {
3507
+ if (!t || t.length === 0 || !o.current || !l || u.width === 0 || (Q(o.current).selectAll("*").remove(), !e?.dateField || !e?.valueField))
3508
+ return;
3509
+ const M = Array.isArray(e.dateField) ? e.dateField[0] : e.dateField, p = Array.isArray(e.valueField) ? e.valueField[0] : e.valueField;
3510
+ if (!M || !p)
3511
+ return;
3512
+ const w = (() => {
3513
+ if (!r?.timeDimensions || r.timeDimensions.length === 0)
3514
+ return "day";
3515
+ const T = r.timeDimensions.find(
3516
+ (O) => O.dimension === M || O.dimension.includes(M)
3517
+ );
3518
+ if (T && T.granularity)
3519
+ return T.granularity;
3520
+ const C = r.timeDimensions[0];
3521
+ return C && C.granularity ? C.granularity : "day";
3522
+ })(), z = I(w);
3523
+ if (!z)
3524
+ return;
3525
+ const q = t.map((T) => {
3526
+ const C = T[M], O = typeof T[p] == "string" ? parseFloat(T[p]) : T[p] || 0;
3527
+ let Y;
3528
+ if (typeof C == "string") {
3529
+ let U = C;
3530
+ C.includes(" ") && (U = C.replace(" ", "T").replace("+00", "Z").replace(/\+\d{2}:\d{2}$/, "Z")), !U.endsWith("Z") && !U.includes("+") && (U = U + "Z"), Y = new Date(U);
3531
+ } else
3532
+ Y = new Date(C);
3533
+ if (isNaN(Y.getTime()))
3534
+ return null;
3535
+ const lt = z.extractX(Y), ft = z.extractY(Y);
3536
+ return {
3537
+ x: lt,
3538
+ y: ft,
3539
+ value: O,
3540
+ date: Y,
3541
+ label: Ie(C, w)
3542
+ };
3543
+ }).filter((T) => T !== null);
3544
+ if (q.length === 0) return;
3545
+ const h = en(q, (T) => T.y) || 0, v = nn(q, (T) => T.y) || 0, x = (() => {
3546
+ const T = [...new Set(q.map((C) => C.x))].sort();
3547
+ return T;
3548
+ })(), N = x.length * z.cellWidth + (x.length - 1) * 4, S = (h - v + 1) * z.cellHeight + (h - v) * 4, $ = {
3549
+ left: 60,
3550
+ // Space for Y-axis labels
3551
+ bottom: 10,
3552
+ // Reduced since labels are at top
3553
+ top: z.hasHierarchicalLabels ? 40 : 25,
3554
+ // Extra space for hierarchical labels
3555
+ right: 10
3556
+ }, P = u.width - $.left - $.right, V = u.height - $.top - $.bottom;
3557
+ let H, X;
3558
+ if (D.fitToWidth) {
3559
+ const T = P / N, C = V / S, O = Math.min(T, C);
3560
+ H = z.cellWidth * O, X = z.cellHeight * O;
3561
+ } else {
3562
+ const C = { width: 16, height: 16 }, O = 24, Y = P / N, lt = V / S, ft = Math.min(Y, lt);
3563
+ H = Math.max(C.width, Math.min(O, z.cellWidth * ft)), X = Math.max(C.height, Math.min(O, z.cellHeight * ft)), w === "week" && H < C.width && (H = C.width);
3564
+ }
3565
+ const G = x.length * H + (x.length - 1) * 4, J = G > P ? G + $.left + $.right : u.width, rt = Q(o.current).attr("width", J).attr("height", u.height).append("g").attr("transform", `translate(${$.left},${$.top})`), Qe = q.map((T) => T.value), pr = nn(Qe) || 0, yr = en(Qe) || 1, wr = mr().domain([pr, yr]).range(a?.gradient || Dr), Be = /* @__PURE__ */ new Map();
3566
+ q.forEach((T) => {
3567
+ const C = `${T.x}-${T.y}`;
3568
+ Be.set(C, T);
3569
+ });
3570
+ const mt = (T, C) => getComputedStyle(document.documentElement).getPropertyValue(T).trim() || C, ge = f !== "light", qt = ge ? mt("--dc-text-muted", "#cbd5e1") : mt("--dc-text-secondary", "#374151"), xr = mt("--dc-border", "#e5e7eb"), vr = ge ? mt("--dc-bg-secondary", "#1e293b") : mt("--dc-bg-secondary", "#f3f4f6"), Je = ge ? mt("--dc-border", "#334155") : mt("--dc-bg", "#ffffff"), Pt = Q("body").append("div").attr("class", "activity-grid-tooltip").style("position", "absolute").style("padding", "8px").style("background", "rgba(0, 0, 0, 0.8)").style("color", "white").style("border-radius", "4px").style("font-size", "12px").style("pointer-events", "none").style("opacity", 0).style("z-index", 1e3), Nt = /* @__PURE__ */ new Map();
3571
+ x.forEach((T, C) => {
3572
+ Nt.set(T, C);
3573
+ });
3574
+ for (const T of x)
3575
+ for (let C = v; C <= h; C++) {
3576
+ const O = `${T}-${C}`, Y = Be.get(O), lt = Nt.get(T) || 0, ft = rt.append("rect").attr("x", lt * (H + 4)).attr("y", (C - v) * (X + 4)).attr("width", H).attr("height", X).attr("rx", 2).attr("ry", 2).style("fill", Y ? wr(Y.value) : vr).style("stroke", Je).style("stroke-width", 1);
3577
+ D.showTooltip && ft.style("cursor", "pointer").on("mouseover", function(U) {
3578
+ if (Q(this).style("stroke", "#000").style("stroke-width", 2), Y) {
3579
+ const gt = [
3580
+ `<strong>${Y.label}</strong>`,
3581
+ `${E(p)}: ${Y.value}`
3582
+ ].join("<br>");
3583
+ Pt.html(gt).style("left", U.pageX + 10 + "px").style("top", U.pageY - 10 + "px").transition().duration(200).style("opacity", 1);
3584
+ }
3585
+ }).on("mousemove", function(U) {
3586
+ Pt.style("left", U.pageX + 10 + "px").style("top", U.pageY - 10 + "px");
3587
+ }).on("mouseout", function() {
3588
+ Q(this).style("stroke", Je).style("stroke-width", 1), Pt.transition().duration(200).style("opacity", 0);
3589
+ });
3590
+ }
3591
+ if (D.showLabels) {
3592
+ if (z.hasHierarchicalLabels && z.getYearFromX) {
3593
+ const T = /* @__PURE__ */ new Map();
3594
+ for (const C of x) {
3595
+ const O = z.getYearFromX(C);
3596
+ T.has(O) || T.set(O, []), T.get(O).push(C);
3597
+ }
3598
+ for (const C of x) {
3599
+ const O = Nt.get(C) || 0;
3600
+ rt.append("text").attr("x", O * (H + 4) + H / 2).attr("y", -8).attr("text-anchor", "middle").style("font-size", "10px").style("fill", qt).text(z.xFormat(C));
3601
+ }
3602
+ for (const [C, O] of T)
3603
+ if (O.length > 0) {
3604
+ const Y = Math.min(...O.map((gt) => Nt.get(gt) || 0)), lt = Math.max(...O.map((gt) => Nt.get(gt) || 0)), ft = (Y + lt) / 2;
3605
+ let U = "";
3606
+ if (C > 9999) {
3607
+ const gt = Math.floor(C / 100), _r = C % 100;
3608
+ U = `${["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][_r - 1]} '${gt.toString().slice(-2)}`;
3609
+ } else
3610
+ U = `'${C.toString().slice(-2)}`;
3611
+ rt.append("text").attr("x", ft * (H + 4) + H / 2).attr("y", -25).attr("text-anchor", "middle").style("font-size", "12px").style("font-weight", "bold").style("fill", qt).text(U), O.length > 1 && rt.append("line").attr("x1", Y * (H + 4)).attr("x2", lt * (H + 4) + H).attr("y1", -20).attr("y2", -20).style("stroke", xr).style("stroke-width", 1).style("opacity", 0.3);
3612
+ }
3613
+ } else {
3614
+ const T = Math.max(1, Math.floor(x.length / 10));
3615
+ for (let C = 0; C < x.length; C += T) {
3616
+ const O = x[C];
3617
+ rt.append("text").attr("x", C * (H + 4) + H / 2).attr("y", -8).attr("text-anchor", "middle").style("font-size", "10px").style("fill", qt).text(z.xFormat(O));
3618
+ }
3619
+ }
3620
+ for (let T = v; T <= h; T++)
3621
+ rt.append("text").attr("x", -8).attr("y", (T - v) * (X + 4) + X / 2).attr("text-anchor", "end").attr("dy", ".35em").style("font-size", "10px").style("fill", qt).text(z.yFormat(T));
3622
+ }
3623
+ return () => {
3624
+ Pt.remove();
3625
+ };
3626
+ }, [t, e, n, r, u, l, D.showTooltip, D.showLabels, a, f]), !t || t.length === 0)
3627
+ return /* @__PURE__ */ W(
3628
+ "div",
3629
+ {
3630
+ className: "flex items-center justify-center w-full",
3631
+ style: { height: i },
3632
+ children: /* @__PURE__ */ Ht("div", { className: "text-center text-dc-text-muted", children: [
3633
+ /* @__PURE__ */ W("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
3634
+ /* @__PURE__ */ W("div", { className: "text-xs text-dc-text-secondary", children: "No data points to display in activity grid" })
3635
+ ] })
3636
+ }
3637
+ );
3638
+ if (!(e?.dateField && e?.valueField))
3639
+ return /* @__PURE__ */ W(
3640
+ "div",
3641
+ {
3642
+ className: "flex items-center justify-center w-full",
3643
+ style: { height: i },
3644
+ children: /* @__PURE__ */ Ht("div", { className: "text-center text-dc-text-muted", children: [
3645
+ /* @__PURE__ */ W("div", { className: "text-sm font-semibold mb-1", children: "Configuration Required" }),
3646
+ /* @__PURE__ */ W("div", { className: "text-xs text-dc-text-secondary", children: "Activity grid requires a time dimension and a measure" })
3647
+ ] })
3648
+ }
3649
+ );
3650
+ const k = Array.isArray(e.dateField) ? e.dateField[0] : e.dateField;
3651
+ return (r?.timeDimensions?.find(
3652
+ (M) => M.dimension === k || M.dimension.includes(k)
3653
+ )?.granularity || "day")?.toLowerCase() === "year" ? /* @__PURE__ */ W(
3654
+ "div",
3655
+ {
3656
+ className: "flex items-center justify-center w-full",
3657
+ style: { height: i },
3658
+ children: /* @__PURE__ */ Ht("div", { className: "text-center text-dc-text-muted", children: [
3659
+ /* @__PURE__ */ W("div", { className: "text-sm font-semibold mb-1", children: "Granularity Too High" }),
3660
+ /* @__PURE__ */ W("div", { className: "text-xs text-dc-text-secondary", children: "Activity grids work best with hour, day, week, month, or quarter granularity" }),
3661
+ /* @__PURE__ */ W("div", { className: "text-xs text-dc-text-secondary mt-1", children: "Please choose a lower granularity for your time dimension" })
3662
+ ] })
3663
+ }
3664
+ ) : /* @__PURE__ */ W("div", { className: "w-full flex flex-col relative", style: { height: i, minHeight: "250px", overflow: "hidden", width: "100%" }, children: /* @__PURE__ */ Ht("div", { ref: s, className: "w-full h-full relative overflow-x-auto", style: { width: "100%" }, children: [
3665
+ /* @__PURE__ */ W("svg", { ref: o, className: "h-full" }),
3666
+ !l && /* @__PURE__ */ W("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ W("div", { className: "text-dc-text-muted text-sm", children: "Measuring chart dimensions..." }) })
3667
+ ] }) });
3668
+ }
3669
+ const Au = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3670
+ __proto__: null,
3671
+ default: au
3672
+ }, Symbol.toStringTag, { value: "Module" }));
3673
+ export {
3674
+ Nr as A,
3675
+ wu as B,
3676
+ yu as C,
3677
+ Rr as D,
3678
+ xu as E,
3679
+ vu as F,
3680
+ _u as G,
3681
+ bu as H,
3682
+ Au as I,
3683
+ pu as N,
3684
+ gu as P,
3685
+ Mu as T,
3686
+ mu as a,
3687
+ Cn as b,
3688
+ Ie as c,
3689
+ Tu as d,
3690
+ ku as e,
3691
+ hu as f,
3692
+ jt as g,
3693
+ Dr as h,
3694
+ fu as i,
3695
+ Su as j,
3696
+ Nu as k,
3697
+ Js as l,
3698
+ en as m,
3699
+ gr as n,
3700
+ Vs as o,
3701
+ ke as p,
3702
+ mr as q,
3703
+ ut as r,
3704
+ Q as s,
3705
+ du as t,
3706
+ Fr as u,
3707
+ $u as v,
3708
+ Lr as w,
3709
+ Ar as x,
3710
+ lu as y,
3711
+ Eu as z
3712
+ };
3713
+ //# sourceMappingURL=chart-activitygridchart-B5OqLgbD.js.map