@cascivo/charts 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,98 +78,140 @@ function b(e, t) {
78
78
  }
79
79
  //#endregion
80
80
  //#region src/engine/scale-time.ts
81
- var x = [
81
+ var x = {
82
+ minute: 6e4,
83
+ hour: 36e5,
84
+ day: 864e5,
85
+ week: 6048e5,
86
+ month: 26298e5,
87
+ quarter: 78894e5,
88
+ year: 315576e5
89
+ }, S = [
82
90
  {
83
91
  unit: "minute",
84
- ms: 6e4
92
+ step: 1
93
+ },
94
+ {
95
+ unit: "minute",
96
+ step: 5
97
+ },
98
+ {
99
+ unit: "minute",
100
+ step: 15
101
+ },
102
+ {
103
+ unit: "minute",
104
+ step: 30
105
+ },
106
+ {
107
+ unit: "hour",
108
+ step: 1
85
109
  },
86
110
  {
87
111
  unit: "hour",
88
- ms: 36e5
112
+ step: 2
113
+ },
114
+ {
115
+ unit: "hour",
116
+ step: 3
117
+ },
118
+ {
119
+ unit: "hour",
120
+ step: 6
121
+ },
122
+ {
123
+ unit: "hour",
124
+ step: 12
125
+ },
126
+ {
127
+ unit: "day",
128
+ step: 1
89
129
  },
90
130
  {
91
131
  unit: "day",
92
- ms: 864e5
132
+ step: 2
93
133
  },
94
134
  {
95
135
  unit: "week",
96
- ms: 6048e5
136
+ step: 1
97
137
  },
98
138
  {
99
139
  unit: "month",
100
- ms: 26298e5
140
+ step: 1
101
141
  },
102
142
  {
103
- unit: "quarter",
104
- ms: 78894e5
143
+ unit: "month",
144
+ step: 3
105
145
  },
106
146
  {
107
147
  unit: "year",
108
- ms: 315576e5
148
+ step: 1
149
+ },
150
+ {
151
+ unit: "year",
152
+ step: 2
153
+ },
154
+ {
155
+ unit: "year",
156
+ step: 5
157
+ },
158
+ {
159
+ unit: "year",
160
+ step: 10
109
161
  }
110
162
  ];
111
- function S(e, t) {
112
- let n = e.getUTCFullYear(), r = e.getUTCMonth();
113
- if (t === "year") return new Date(Date.UTC(n, 0, 1));
114
- if (t === "quarter") return new Date(Date.UTC(n, Math.floor(r / 3) * 3, 1));
115
- if (t === "month") return new Date(Date.UTC(n, r, 1));
116
- if (t === "week") {
117
- let t = e.getUTCDate() - e.getUTCDay();
118
- return new Date(Date.UTC(n, r, t));
119
- }
120
- return t === "day" ? new Date(Date.UTC(n, r, e.getUTCDate())) : t === "hour" ? new Date(Date.UTC(n, r, e.getUTCDate(), e.getUTCHours())) : new Date(Date.UTC(n, r, e.getUTCDate(), e.getUTCHours(), e.getUTCMinutes()));
163
+ function C(e, t, n) {
164
+ let r = e.getUTCFullYear(), i = e.getUTCMonth(), a = e.getUTCDate();
165
+ return t === "year" ? new Date(Date.UTC(Math.floor(r / n) * n, 0, 1)) : t === "quarter" ? new Date(Date.UTC(r, Math.floor(i / 3) * 3, 1)) : t === "month" ? new Date(Date.UTC(r, Math.floor(i / n) * n, 1)) : t === "week" ? new Date(Date.UTC(r, i, a - e.getUTCDay())) : t === "day" ? new Date(Date.UTC(r, i, a)) : t === "hour" ? new Date(Date.UTC(r, i, a, Math.floor(e.getUTCHours() / n) * n)) : new Date(Date.UTC(r, i, a, e.getUTCHours(), Math.floor(e.getUTCMinutes() / n) * n));
121
166
  }
122
- function C(e, t, n = 1) {
167
+ function w(e, t, n) {
123
168
  let r = e.getUTCFullYear(), i = e.getUTCMonth();
124
- if (t === "year") return new Date(Date.UTC(r + n, i, 1));
125
- if (t === "quarter") return new Date(Date.UTC(r, i + 3 * n, 1));
126
- if (t === "month") return new Date(Date.UTC(r, i + n, 1));
127
- let a = {
128
- week: 6048e5,
129
- day: 864e5,
130
- hour: 36e5,
131
- minute: 6e4
132
- }[t];
133
- return new Date(e.getTime() + a * n);
134
- }
135
- function w(e, t) {
169
+ return t === "year" ? new Date(Date.UTC(r + n, i, 1)) : t === "quarter" ? new Date(Date.UTC(r, i + 3 * n, 1)) : t === "month" ? new Date(Date.UTC(r, i + n, 1)) : new Date(e.getTime() + x[t] * n);
170
+ }
171
+ function T(e) {
172
+ return e === "minute" ? {
173
+ hour: "numeric",
174
+ minute: "2-digit"
175
+ } : e === "hour" ? { hour: "numeric" } : e === "day" || e === "week" ? {
176
+ month: "short",
177
+ day: "numeric"
178
+ } : e === "month" || e === "quarter" ? {
179
+ month: "short",
180
+ year: "numeric"
181
+ } : { year: "numeric" };
182
+ }
183
+ function E(e, t) {
136
184
  let [n, r] = e, [i, a] = t, o = r.getTime() - n.getTime();
137
185
  function s(e) {
138
- for (let t of x) if (o / t.ms <= e * 1.5) return t.unit;
139
- return "year";
140
- }
141
- function c(e) {
142
- return e === "minute" ? {
143
- hour: "numeric",
144
- minute: "2-digit"
145
- } : e === "hour" ? { hour: "numeric" } : e === "day" || e === "week" ? {
146
- month: "short",
147
- day: "numeric"
148
- } : e === "month" || e === "quarter" ? {
149
- month: "short",
150
- year: "numeric"
151
- } : { year: "numeric" };
186
+ let t = Math.max(2, e), n = S[S.length - 1], r = Infinity;
187
+ for (let e of S) {
188
+ let i = o / (x[e.unit] * e.step);
189
+ if (i < 1.5) continue;
190
+ let a = Math.abs(Math.log(i / t));
191
+ a < r && (r = a, n = e);
192
+ }
193
+ return n;
152
194
  }
153
195
  return {
154
196
  domain: e,
155
197
  range: t,
156
198
  map: (e) => o === 0 ? i : i + (e.getTime() - n.getTime()) / o * (a - i),
157
199
  invert: (e) => new Date(n.getTime() + (e - i) / (a - i) * o),
158
- tickInterval: () => s(5),
159
- tickFormat: () => c(s(5)),
200
+ tickInterval: (e = 5) => s(e).unit,
201
+ tickFormat: (e = 5) => T(s(e).unit),
160
202
  ticks: (e = 5) => {
161
- let t = s(e), i = S(n, t), a = [], o = i.getTime() >= n.getTime() ? i : C(i, t), c = 0;
162
- for (; o.getTime() <= r.getTime() && c++ < 100;) a.push(o), o = C(o, t);
163
- return a;
203
+ let { unit: t, step: i } = s(e), a = C(n, t, i), o = [], c = a.getTime() >= n.getTime() ? a : w(a, t, i), l = 0;
204
+ for (; c.getTime() <= r.getTime() && l++ < 500;) o.push(c), c = w(c, t, i);
205
+ return o;
164
206
  }
165
207
  };
166
208
  }
167
209
  //#endregion
168
210
  //#region src/engine/shape.ts
169
- function T(e) {
211
+ function D(e) {
170
212
  return Math.round(e * 100) / 100;
171
213
  }
172
- function E(e, t = !1) {
214
+ function O(e, t = !1) {
173
215
  if (t) {
174
216
  let t = e.filter((e) => e !== null);
175
217
  return t.length > 0 ? [t] : [];
@@ -178,22 +220,22 @@ function E(e, t = !1) {
178
220
  for (let t of e) t === null ? (r.length > 0 && n.push(r), r = []) : r.push(t);
179
221
  return r.length > 0 && n.push(r), n;
180
222
  }
181
- function D(e, t = "linear") {
223
+ function k(e, t = "linear") {
182
224
  if (e.length === 0) return "";
183
225
  if (e.length === 1 || t === "linear") return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
184
226
  switch (t) {
185
- case "monotone": return M(e);
227
+ case "monotone": return P(e);
186
228
  case "step":
187
229
  case "stepBefore":
188
- case "stepAfter": return O(e, t);
189
- case "natural": return k(e);
190
- case "basis": return A(e);
191
- case "cardinal": return j(e, 0);
230
+ case "stepAfter": return A(e, t);
231
+ case "natural": return M(e);
232
+ case "basis": return ee(e);
233
+ case "cardinal": return N(e, 0);
192
234
  case "catmullRom": return te(e, .5);
193
- default: return M(e);
235
+ default: return P(e);
194
236
  }
195
237
  }
196
- function O(e, t) {
238
+ function A(e, t) {
197
239
  let n = `M${e[0][0]},${e[0][1]}`;
198
240
  for (let r = 0; r < e.length - 1; r++) {
199
241
  let [i, a] = e[r], [o, s] = e[r + 1];
@@ -206,7 +248,7 @@ function O(e, t) {
206
248
  }
207
249
  return n;
208
250
  }
209
- function ee(e) {
251
+ function j(e) {
210
252
  let t = e.length - 1;
211
253
  if (t < 1) return [[], []];
212
254
  let n = Array(t), r = Array(t), i = Array(t);
@@ -223,14 +265,14 @@ function ee(e) {
223
265
  for (let n = 0; n < t - 1; n++) o[n] = 2 * e[n + 1] - a[n + 1];
224
266
  return o[t - 1] = (e[t] + a[t - 1]) / 2, [a, o];
225
267
  }
226
- function k(e) {
268
+ function M(e) {
227
269
  let t = e.length;
228
270
  if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
229
- let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] = ee(n), [o, s] = ee(r), c = `M${n[0]},${r[0]}`;
271
+ let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] = j(n), [o, s] = j(r), c = `M${n[0]},${r[0]}`;
230
272
  for (let e = 0; e < t - 1; e++) c += `C${i[e]},${o[e]} ${a[e]},${s[e]} ${n[e + 1]},${r[e + 1]}`;
231
273
  return c;
232
274
  }
233
- function A(e) {
275
+ function ee(e) {
234
276
  let t = e.length;
235
277
  if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
236
278
  let n = (n) => e[Math.max(0, Math.min(t - 1, n))][0], r = (n) => e[Math.max(0, Math.min(t - 1, n))][1], i = `M${n(0)},${r(0)}`;
@@ -241,7 +283,7 @@ function A(e) {
241
283
  let a = e[t - 1];
242
284
  return i += `L${a[0]},${a[1]}`, i;
243
285
  }
244
- function j(e, t) {
286
+ function N(e, t) {
245
287
  let n = e.length;
246
288
  if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
247
289
  let r = (1 - t) / 6, i = (t) => e[Math.max(0, Math.min(n - 1, t))], a = `M${e[0][0]},${e[0][1]}`;
@@ -261,7 +303,7 @@ function te(e, t) {
261
303
  }
262
304
  return a;
263
305
  }
264
- function M(e) {
306
+ function P(e) {
265
307
  let t = e.length, n = [], r = [], i = [];
266
308
  for (let a = 0; a < t - 1; a++) n[a] = e[a + 1][0] - e[a][0], r[a] = e[a + 1][1] - e[a][1], i[a] = n[a] === 0 ? 0 : r[a] / n[a];
267
309
  let a = [i[0] ?? 0];
@@ -277,23 +319,23 @@ function M(e) {
277
319
  }
278
320
  return o;
279
321
  }
280
- function ne(e, t, n = "linear") {
322
+ function F(e, t, n = "linear") {
281
323
  if (e.length === 0) return "";
282
- let r = D(e, n), i = e[e.length - 1], a = e[0];
324
+ let r = k(e, n), i = e[e.length - 1], a = e[0];
283
325
  return `${r}L${i[0]},${t}L${a[0]},${t}Z`;
284
326
  }
285
- function N(e, t, n, r, i, a) {
327
+ function I(e, t, n, r, i, a) {
286
328
  let o = 2 * Math.PI;
287
329
  if (Math.abs(a - i) >= o - 1e-9) {
288
330
  let a = i + Math.PI;
289
- return N(e, t, n, r, i, a) + N(e, t, n, r, a, i + o - 1e-9);
331
+ return I(e, t, n, r, i, a) + I(e, t, n, r, a, i + o - 1e-9);
290
332
  }
291
- let s = (n, r) => [T(e + n * Math.sin(r)), T(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = T(n), u = T(r), [d, f] = s(n, i), [p, m] = s(n, a);
292
- if (r <= 0) return `M${T(e)},${T(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
333
+ let s = (n, r) => [D(e + n * Math.sin(r)), D(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = D(n), u = D(r), [d, f] = s(n, i), [p, m] = s(n, a);
334
+ if (r <= 0) return `M${D(e)},${D(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
293
335
  let [h, g] = s(r, a), [_, v] = s(r, i);
294
336
  return `M${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}L${h},${g}A${u},${u} 0 ${c} 0 ${_},${v}Z`;
295
337
  }
296
- function P(e) {
338
+ function ne(e) {
297
339
  let t = e[0]?.length ?? 0, n = Array.from({ length: t }, () => 0);
298
340
  return e.map((e) => e.map((e, t) => {
299
341
  let r = n[t];
@@ -302,7 +344,7 @@ function P(e) {
302
344
  }
303
345
  //#endregion
304
346
  //#region src/engine/stacked.ts
305
- function F(e) {
347
+ function L(e) {
306
348
  let t = [], n = /* @__PURE__ */ new Map();
307
349
  for (let r of e) for (let e of r.segments) n.has(e.key) ? n.get(e.key) == null && e.color != null && n.set(e.key, e.color) : (t.push(e.key), n.set(e.key, e.color));
308
350
  return {
@@ -324,7 +366,7 @@ function F(e) {
324
366
  }
325
367
  //#endregion
326
368
  //#region src/engine/nearest.ts
327
- function re(e, t) {
369
+ function R(e, t) {
328
370
  if (e.length === 0) return -1;
329
371
  if (e.length === 1) return 0;
330
372
  let n = 0, r = e.length - 1;
@@ -336,7 +378,7 @@ function re(e, t) {
336
378
  }
337
379
  //#endregion
338
380
  //#region src/engine/voronoi.ts
339
- function ie(e, t, n) {
381
+ function re(e, t, n) {
340
382
  let r = -1, i = Infinity;
341
383
  for (let a = 0; a < e.length; a++) {
342
384
  let o = e[a][0] - t, s = e[a][1] - n, c = o * o + s * s;
@@ -344,7 +386,7 @@ function ie(e, t, n) {
344
386
  }
345
387
  return r;
346
388
  }
347
- function ae(e, t, n, r, i) {
389
+ function ie(e, t, n, r, i) {
348
390
  if (e.length === 0) return e;
349
391
  let a = [], o = (e) => (e[0] - r) * t + (e[1] - i) * n;
350
392
  for (let t = 0; t < e.length; t++) {
@@ -356,7 +398,7 @@ function ae(e, t, n, r, i) {
356
398
  }
357
399
  return a;
358
400
  }
359
- function I(e, t) {
401
+ function z(e, t) {
360
402
  let n = [
361
403
  [t.x0, t.y0],
362
404
  [t.x1, t.y0],
@@ -368,21 +410,21 @@ function I(e, t) {
368
410
  for (let n = 0; n < e.length && i.length > 0; n++) {
369
411
  if (n === r) continue;
370
412
  let a = e[n];
371
- i = ae(i, a[0] - t[0], a[1] - t[1], (t[0] + a[0]) / 2, (t[1] + a[1]) / 2);
413
+ i = ie(i, a[0] - t[0], a[1] - t[1], (t[0] + a[0]) / 2, (t[1] + a[1]) / 2);
372
414
  }
373
415
  return i;
374
416
  });
375
417
  }
376
- function oe(e) {
418
+ function B(e) {
377
419
  return e.length === 0 ? "" : `M${e.map((e) => `${e[0]},${e[1]}`).join("L")}Z`;
378
420
  }
379
421
  //#endregion
380
422
  //#region src/engine/stats.ts
381
- function L(e) {
423
+ function V(e) {
382
424
  let t = e.length, n = e[Math.floor(t * .25)] ?? 0;
383
425
  return (e[Math.floor(t * .75)] ?? 0) - n;
384
426
  }
385
- function R(e, t) {
427
+ function H(e, t) {
386
428
  if (e.length === 0) return [];
387
429
  let n = [...e].sort((e, t) => e - t), r = n.length, i = n[0] ?? 0, a = n[r - 1] ?? 0;
388
430
  if (i === a) return [{
@@ -393,7 +435,7 @@ function R(e, t) {
393
435
  let o;
394
436
  if (t !== void 0 && t > 0) o = t;
395
437
  else {
396
- let e = 2 * L(n) * r ** (-1 / 3);
438
+ let e = 2 * V(n) * r ** (-1 / 3);
397
439
  o = Math.ceil(e > 0 ? (a - i) / e : Math.sqrt(r)), o = Math.max(1, Math.min(o, 200));
398
440
  }
399
441
  let s = (a - i) / o;
@@ -413,7 +455,7 @@ function R(e, t) {
413
455
  }
414
456
  return c;
415
457
  }
416
- function z(e) {
458
+ function U(e) {
417
459
  if (e.length === 0) return {
418
460
  min: 0,
419
461
  q1: 0,
@@ -435,7 +477,7 @@ function z(e) {
435
477
  outliers: d
436
478
  };
437
479
  }
438
- function B(e) {
480
+ function W(e) {
439
481
  if (e.length === 0) return [0, 1];
440
482
  let t = e[0] ?? 0, n = e[0] ?? 0;
441
483
  for (let r of e) r < t && (t = r), r > n && (n = r);
@@ -443,11 +485,11 @@ function B(e) {
443
485
  }
444
486
  //#endregion
445
487
  //#region src/engine/treemap.ts
446
- function V(e, t, n) {
488
+ function G(e, t, n) {
447
489
  let r = Math.max(...e), i = Math.min(...e);
448
490
  return Math.max(t * t * r / (n * n), n * n / (t * t * i));
449
491
  }
450
- function H(e, t, n, r, i, a, o) {
492
+ function K(e, t, n, r, i, a, o) {
451
493
  let s = e.reduce((e, t) => e + t, 0), c = t, l = n;
452
494
  for (let t = 0; t < e.length; t++) {
453
495
  let n = e[t] ?? 0, u = a[t] ?? "";
@@ -472,40 +514,40 @@ function H(e, t, n, r, i, a, o) {
472
514
  }
473
515
  }
474
516
  }
475
- function U(e, t, n, r, i, a) {
517
+ function q(e, t, n, r, i, a) {
476
518
  if (e.length === 0 || r <= 0 || i <= 0) return;
477
519
  let o = e.reduce((e, t) => e + t.value, 0);
478
520
  if (o === 0) return;
479
521
  let s = r * i, c = e.map((e) => e.value / o * s), l = e.map((e) => e.id), u = [], d = [], f = Math.min(r, i), p = 0, m = 0;
480
522
  for (; m < c.length;) {
481
523
  let o = c[m] ?? 0, h = l[m] ?? "", g = [...u, o], _ = p + o;
482
- if (u.length === 0 || V(g, f, _) <= V(u, f, p)) u = g, d = [...d, h], p = _, m++;
524
+ if (u.length === 0 || G(g, f, _) <= G(u, f, p)) u = g, d = [...d, h], p = _, m++;
483
525
  else {
484
526
  let o = p / s;
485
527
  if (r >= i) {
486
528
  let s = o * r;
487
- H(u, t, n, s, i, d, a), U(e.slice(m), t + s, n, r - s, i, a);
529
+ K(u, t, n, s, i, d, a), q(e.slice(m), t + s, n, r - s, i, a);
488
530
  } else {
489
531
  let s = o * i;
490
- H(u, t, n, r, s, d, a), U(e.slice(m), t, n + s, r, i - s, a);
532
+ K(u, t, n, r, s, d, a), q(e.slice(m), t, n + s, r, i - s, a);
491
533
  }
492
534
  return;
493
535
  }
494
536
  }
495
537
  if (u.length > 0) {
496
538
  let e = p / s;
497
- r >= i ? H(u, t, n, e * r, i, d, a) : H(u, t, n, r, e * i, d, a);
539
+ r >= i ? K(u, t, n, e * r, i, d, a) : K(u, t, n, r, e * i, d, a);
498
540
  }
499
541
  }
500
- function W(e, t, n) {
542
+ function ae(e, t, n) {
501
543
  if (e.length === 0 || t <= 0 || n <= 0) return [];
502
544
  let r = [...e].sort((e, t) => t.value - e.value), i = [];
503
- return U(r, 0, 0, t, n, i), i;
545
+ return q(r, 0, 0, t, n, i), i;
504
546
  }
505
547
  //#endregion
506
548
  //#region src/engine/stream.ts
507
- function G(e, t = "silhouette") {
508
- let n = P(e);
549
+ function J(e, t = "silhouette") {
550
+ let n = ne(e);
509
551
  if (t === "zero") return n;
510
552
  let r = e[0]?.length ?? 0, i = Array.from({ length: r }, (t, n) => e.reduce((e, t) => e + (t[n] ?? 0), 0));
511
553
  return n.map((e) => e.map(([e, t], n) => {
@@ -513,28 +555,28 @@ function G(e, t = "silhouette") {
513
555
  return [e - r, t - r];
514
556
  }));
515
557
  }
516
- function K(e) {
558
+ function Y(e) {
517
559
  let t = 0, n = 0;
518
560
  for (let r of e) for (let [e, i] of r) t = Math.min(t, e, i), n = Math.max(n, e, i);
519
561
  return [t, n];
520
562
  }
521
563
  //#endregion
522
564
  //#region src/engine/hierarchy.ts
523
- function q(e) {
524
- return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + q(t), 0) : e.value ?? 0;
565
+ function oe(e) {
566
+ return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + oe(t), 0) : e.value ?? 0;
525
567
  }
526
- function J(e, t = 2 * Math.PI) {
568
+ function X(e, t = 2 * Math.PI) {
527
569
  let n = [], r = (e, t, i, a) => {
528
570
  if (n.push({
529
571
  node: e,
530
572
  depth: t,
531
573
  a0: i,
532
574
  a1: a,
533
- value: q(e)
575
+ value: oe(e)
534
576
  }), !e.children) return;
535
- let o = a - i, s = q(e) || 1, c = i;
577
+ let o = a - i, s = oe(e) || 1, c = i;
536
578
  for (let n of e.children) {
537
- let e = c + o * q(n) / s;
579
+ let e = c + o * oe(n) / s;
538
580
  r(n, t + 1, c, e), c = e;
539
581
  }
540
582
  };
@@ -545,7 +587,7 @@ function se(e) {
545
587
  }
546
588
  //#endregion
547
589
  //#region src/engine/sankey.ts
548
- function Y(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }) {
590
+ function ce(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }) {
549
591
  let o = /* @__PURE__ */ new Map();
550
592
  for (let t of e) o.set(t.id, {
551
593
  ...t,
@@ -599,17 +641,17 @@ function Y(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }
599
641
  links: v
600
642
  };
601
643
  }
602
- function ce(e) {
644
+ function le(e) {
603
645
  let t = e.source.x1, n = e.target.x0, r = (t + n) / 2, i = e.sy, a = e.sy + e.width, o = e.ty, s = e.ty + e.width;
604
646
  return `M${t},${i}C${r},${i} ${r},${o} ${n},${o}L${n},${s}C${r},${s} ${r},${a} ${t},${a}Z`;
605
647
  }
606
648
  //#endregion
607
649
  //#region src/engine/ramp.ts
608
- var le = (e) => e < 0 ? 0 : e > 1 ? 1 : e, ue = (e, t, n) => e + (t - e) * n, de = (e, t, n) => ({
609
- l: ue(e.l, t.l, n),
610
- c: ue(e.c, t.c, n),
611
- h: ue(e.h, t.h, n)
612
- }), fe = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, pe = {
650
+ var ue = (e) => e < 0 ? 0 : e > 1 ? 1 : e, de = (e, t, n) => e + (t - e) * n, fe = (e, t, n) => ({
651
+ l: de(e.l, t.l, n),
652
+ c: de(e.c, t.c, n),
653
+ h: de(e.h, t.h, n)
654
+ }), pe = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, Z = {
613
655
  l: .95,
614
656
  c: .04,
615
657
  h: 232
@@ -617,43 +659,43 @@ var le = (e) => e < 0 ? 0 : e > 1 ? 1 : e, ue = (e, t, n) => e + (t - e) * n, de
617
659
  l: .34,
618
660
  c: .15,
619
661
  h: 274
620
- }, X = {
662
+ }, he = {
621
663
  l: .48,
622
664
  c: .14,
623
665
  h: 248
624
- }, he = {
666
+ }, ge = {
625
667
  l: .96,
626
668
  c: .02,
627
669
  h: 110
628
- }, ge = {
670
+ }, _e = {
629
671
  l: .52,
630
672
  c: .15,
631
673
  h: 42
632
674
  };
633
- function _e(e) {
634
- return fe(de(pe, me, le(e)));
635
- }
636
675
  function ve(e) {
637
- let t = le(e);
638
- return fe(t < .5 ? de(X, he, t * 2) : de(he, ge, (t - .5) * 2));
676
+ return pe(fe(Z, me, ue(e)));
639
677
  }
640
678
  function ye(e) {
641
- return e === "diverging" ? ve : _e;
679
+ let t = ue(e);
680
+ return pe(t < .5 ? fe(he, ge, t * 2) : fe(ge, _e, (t - .5) * 2));
681
+ }
682
+ function be(e) {
683
+ return e === "diverging" ? ye : ve;
642
684
  }
643
- function be(e, t = "sequential") {
644
- let n = ye(t);
685
+ function xe(e, t = "sequential") {
686
+ let n = be(t);
645
687
  return e <= 1 ? [n(0)] : Array.from({ length: e }, (t, r) => n(r / (e - 1)));
646
688
  }
647
- function xe(e) {
689
+ function Se(e) {
648
690
  let t = /oklch\(([\d.]+)/.exec(e);
649
691
  return t ? Number(t[1]) : NaN;
650
692
  }
651
693
  //#endregion
652
694
  //#region src/engine/polar.ts
653
- function Se(e, t, n, r) {
654
- return [T(e + n * Math.sin(r)), T(t - n * Math.cos(r))];
695
+ function Ce(e, t, n, r) {
696
+ return [D(e + n * Math.sin(r)), D(t - n * Math.cos(r))];
655
697
  }
656
- function Z(e, t = [0, 2 * Math.PI]) {
698
+ function we(e, t = [0, 2 * Math.PI]) {
657
699
  let n = Math.max(1, e.length), r = (t[1] - t[0]) / n, i = new Map(e.map((e, t) => [e, t])), a = (e) => {
658
700
  let n = i.get(e);
659
701
  return n === void 0 ? void 0 : t[0] + n * r;
@@ -668,25 +710,25 @@ function Z(e, t = [0, 2 * Math.PI]) {
668
710
  step: r
669
711
  };
670
712
  }
671
- function Ce(e, t) {
713
+ function Te(e, t) {
672
714
  return g(e, t);
673
715
  }
674
716
  //#endregion
675
717
  //#region src/engine/transform.ts
676
- function we(e, t) {
718
+ function Ee(e, t) {
677
719
  return e.filter((e, n) => t(e, n));
678
720
  }
679
- function Te(e, t) {
721
+ function De(e, t) {
680
722
  return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
681
723
  }
682
- function Ee(e, t, n = "asc") {
724
+ function Oe(e, t, n = "asc") {
683
725
  let r = typeof t == "function" ? t : (e) => e[t], i = n === "desc" ? -1 : 1;
684
726
  return e.map((e, t) => ({
685
727
  row: e,
686
728
  i: t
687
- })).sort((e, t) => Te(r(e.row), r(t.row)) * i || e.i - t.i).map((e) => e.row);
729
+ })).sort((e, t) => De(r(e.row), r(t.row)) * i || e.i - t.i).map((e) => e.row);
688
730
  }
689
- function De(e, t) {
731
+ function ke(e, t) {
690
732
  if (e === "count") return t.length;
691
733
  if (t.length === 0) return 0;
692
734
  switch (e) {
@@ -700,7 +742,7 @@ function De(e, t) {
700
742
  }
701
743
  }
702
744
  }
703
- function Oe(e, t) {
745
+ function Ae(e, t) {
704
746
  let n = typeof t.groupBy == "string" ? [t.groupBy] : t.groupBy, r = /* @__PURE__ */ new Map(), i = [];
705
747
  for (let t of e) {
706
748
  let e = n.map((e) => String(t[e])).join("\0"), a = r.get(e);
@@ -709,11 +751,11 @@ function Oe(e, t) {
709
751
  return i.map((e) => {
710
752
  let i = r.get(e), a = {};
711
753
  for (let e of n) a[e] = i[0][e];
712
- for (let [e, n] of Object.entries(t.ops)) a[e] = De(n, i.map((t) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)));
754
+ for (let [e, n] of Object.entries(t.ops)) a[e] = ke(n, i.map((t) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)));
713
755
  return a;
714
756
  });
715
757
  }
716
- function ke(e, t = {}) {
758
+ function je(e, t = {}) {
717
759
  let n = e.filter((e) => Number.isFinite(e)), [r, i] = t.range ?? [Math.min(...n), Math.max(...n)], a = Math.max(1, t.bins ?? (Math.ceil(Math.sqrt(n.length)) || 1)), o = (i - r) / a || 1, s = Array.from({ length: a }, (e, t) => ({
718
760
  x0: r + t * o,
719
761
  x1: r + (t + 1) * o,
@@ -727,7 +769,7 @@ function ke(e, t = {}) {
727
769
  }
728
770
  return s;
729
771
  }
730
- function Ae(e, t) {
772
+ function Me(e, t) {
731
773
  let n = t.length, r = e.map((e, n) => [...e, t[n]]);
732
774
  for (let e = 0; e < n; e++) {
733
775
  let t = e;
@@ -745,12 +787,12 @@ function Ae(e, t) {
745
787
  return Math.abs(i) < 1e-12 ? 0 : r[t][n] / i;
746
788
  });
747
789
  }
748
- function je(e, t) {
790
+ function Ne(e, t) {
749
791
  let n = e.map((e) => e[1]), r = n.reduce((e, t) => e + t, 0) / n.length, i = 0, a = 0;
750
792
  for (let [n, o] of e) i += (o - t(n)) ** 2, a += (o - r) ** 2;
751
793
  return a === 0 ? 1 : 1 - i / a;
752
794
  }
753
- function Me(e, t = {}) {
795
+ function Pe(e, t = {}) {
754
796
  let n = t.type ?? "linear", r = [...e].sort((e, t) => e[0] - t[0]), i = r.map((e) => e[0]), a = () => {
755
797
  let e = r.length ? r.reduce((e, t) => e + t[1], 0) / r.length : 0;
756
798
  return {
@@ -764,11 +806,11 @@ function Me(e, t = {}) {
764
806
  if (n === "exponential") {
765
807
  let e = r.filter((e) => e[1] > 0);
766
808
  if (e.length < 2) return a();
767
- let t = Me(e.map((e) => [e[0], Math.log(e[1])]), { type: "linear" }), n = Math.exp(t.coefficients[0]), o = t.coefficients[1], s = (e) => n * Math.exp(o * e);
809
+ let t = Pe(e.map((e) => [e[0], Math.log(e[1])]), { type: "linear" }), n = Math.exp(t.coefficients[0]), o = t.coefficients[1], s = (e) => n * Math.exp(o * e);
768
810
  return {
769
811
  predict: s,
770
812
  points: i.map((e) => [e, s(e)]),
771
- r2: je(r, s),
813
+ r2: Ne(r, s),
772
814
  coefficients: [n, o]
773
815
  };
774
816
  }
@@ -780,18 +822,18 @@ function Me(e, t = {}) {
780
822
  for (let t = 0; t < o; t++) s[e][t] += n[e] * n[t];
781
823
  }
782
824
  }
783
- let l = Ae(s, c), u = (e) => l.reduce((t, n, r) => t + n * e ** r, 0);
825
+ let l = Me(s, c), u = (e) => l.reduce((t, n, r) => t + n * e ** r, 0);
784
826
  return {
785
827
  predict: u,
786
828
  points: i.map((e) => [e, u(e)]),
787
- r2: je(r, u),
829
+ r2: Ne(r, u),
788
830
  coefficients: l
789
831
  };
790
832
  }
791
833
  //#endregion
792
834
  //#region src/engine/dataset.ts
793
- var Ne = (e) => typeof e == "number" ? e : Number(e);
794
- function Pe(e, t) {
835
+ var Fe = (e) => typeof e == "number" ? e : Number(e);
836
+ function Ie(e, t) {
795
837
  let n = (e) => e.x, r = (e) => e.y;
796
838
  if (!t.series) return {
797
839
  series: [{
@@ -799,7 +841,7 @@ function Pe(e, t) {
799
841
  label: t.label ?? t.y,
800
842
  data: e.map((e) => ({
801
843
  x: e[t.x],
802
- y: Ne(e[t.y])
844
+ y: Fe(e[t.y])
803
845
  }))
804
846
  }],
805
847
  x: n,
@@ -814,7 +856,7 @@ function Pe(e, t) {
814
856
  data: []
815
857
  }, i.set(e, r), a.push(e)), r.data.push({
816
858
  x: n[t.x],
817
- y: Ne(n[t.y])
859
+ y: Fe(n[t.y])
818
860
  });
819
861
  }
820
862
  return {
@@ -823,15 +865,15 @@ function Pe(e, t) {
823
865
  y: r
824
866
  };
825
867
  }
826
- function Fe(e, t) {
868
+ function Le(e, t) {
827
869
  return e.map((e) => ({
828
870
  label: String(e[t.category]),
829
- value: Ne(e[t.value])
871
+ value: Fe(e[t.value])
830
872
  }));
831
873
  }
832
874
  //#endregion
833
875
  //#region src/engine/decimate.ts
834
- function Ie(e, t) {
876
+ function Re(e, t) {
835
877
  let n = e.length;
836
878
  if (t >= n || t < 3) return e.slice();
837
879
  let r = [e[0]], i = (n - 2) / (t - 2), a = 0;
@@ -848,7 +890,7 @@ function Ie(e, t) {
848
890
  }
849
891
  return r.push(e[n - 1]), r;
850
892
  }
851
- function Le(e, t) {
893
+ function ze(e, t) {
852
894
  let n = e.length;
853
895
  if (t >= n || t < 4) return e.slice();
854
896
  let r = Math.max(1, Math.floor(t / 2)), i = n / r, a = [e[0]];
@@ -861,27 +903,27 @@ function Le(e, t) {
861
903
  }
862
904
  return a.push(e[n - 1]), a;
863
905
  }
864
- function Re(e, t, n = "lttb") {
865
- return n === "minmax" ? Le(e, t) : Ie(e, t);
906
+ function Be(e, t, n = "lttb") {
907
+ return n === "minmax" ? ze(e, t) : Re(e, t);
866
908
  }
867
909
  //#endregion
868
910
  //#region src/stream/use-stream-series.ts
869
- function ze(e, t) {
870
- return e.length <= t.to ? e : Re(e.map((e, n) => [n, t.y(e)]), t.to, t.method).map(([t]) => e[t]);
911
+ function Ve(e, t) {
912
+ return e.length <= t.to ? e : Be(e.map((e, n) => [n, t.y(e)]), t.to, t.method).map(([t]) => e[t]);
871
913
  }
872
- function Be(e) {
914
+ function He(e) {
873
915
  let { capacity: n, source: r, decimate: a } = e, s = l(t({ capacity: n })).current, c = l(r);
874
916
  return c.current = r, o(() => {
875
917
  let e = c.current((e) => s.append(e));
876
918
  return () => {
877
919
  e(), s.dispose();
878
920
  };
879
- }), i(() => a ? ze(s.signal.value, a) : s.signal.value);
921
+ }), i(() => a ? Ve(s.signal.value, a) : s.signal.value);
880
922
  }
881
- function Ve(n) {
923
+ function Ue(n) {
882
924
  let { capacity: r, source: i, decimate: a } = n, o = t({ capacity: r }), s = i((e) => o.append(e));
883
925
  return {
884
- signal: a ? e(() => ze(o.signal.value, a)) : o.signal,
926
+ signal: a ? e(() => Ve(o.signal.value, a)) : o.signal,
885
927
  stop: () => {
886
928
  s(), o.dispose();
887
929
  }
@@ -889,7 +931,7 @@ function Ve(n) {
889
931
  }
890
932
  //#endregion
891
933
  //#region src/core/use-chart.ts
892
- function He(e = 400, t = 300) {
934
+ function We(e = 400, t = 300) {
893
935
  let n = l(null), r = a(e), i = a(t);
894
936
  return o(() => {
895
937
  let e = n.current;
@@ -917,48 +959,48 @@ function He(e = 400, t = 300) {
917
959
  height: i
918
960
  };
919
961
  }
920
- var Ue = {
962
+ var Ge = {
921
963
  top: 8,
922
964
  right: 8,
923
965
  bottom: 24,
924
966
  left: 36
925
- }, We = {
967
+ }, Ke = {
926
968
  top: 2,
927
969
  right: 2,
928
970
  bottom: 2,
929
971
  left: 2
930
- }, Ge = 6.5;
931
- function Ke(e, t) {
932
- if (t) return We.left;
972
+ }, qe = 6.5;
973
+ function Je(e, t) {
974
+ if (t) return Ke.left;
933
975
  let n = e.reduce((e, t) => Math.max(e, t.length), 0);
934
- return Math.max(Ue.left, Math.ceil(n * Ge + 12));
976
+ return Math.max(Ge.left, Math.ceil(n * qe + 12));
935
977
  }
936
- function qe(e = {}) {
978
+ function Ye(e = {}) {
937
979
  let { rightAxisLabels: t = [], bottomAxisLabels: n = [], rightAxisTitle: r = !1, plain: i } = e;
938
- if (i) return We.right;
939
- let a = t.reduce((e, t) => Math.max(e, t.length), 0), o = r ? 20 : 0, s = a > 0 ? Math.ceil(a * Ge + 12 + o) : 0, c = n[n.length - 1] ?? "", l = c ? Math.ceil(c.length * Ge / 2 + 2) : 0;
940
- return Math.max(Ue.right, s, l);
980
+ if (i) return Ke.right;
981
+ let a = t.reduce((e, t) => Math.max(e, t.length), 0), o = r ? 20 : 0, s = a > 0 ? Math.ceil(a * qe + 12 + o) : 0, c = n[n.length - 1] ?? "", l = c ? Math.ceil(c.length * qe / 2 + 2) : 0;
982
+ return Math.max(Ge.right, s, l);
941
983
  }
942
- var Je = 14;
943
- function Ye(e, t, n = "horizontal") {
984
+ var Xe = 14;
985
+ function Ze(e, t, n = "horizontal") {
944
986
  if (e.length <= 1 || t <= 0) return;
945
- let r = t / e.length, i = n === "vertical" ? 14 : e.reduce((e, t) => Math.max(e, t.length), 0) * Ge + 6;
987
+ let r = t / e.length, i = n === "vertical" ? 14 : e.reduce((e, t) => Math.max(e, t.length), 0) * qe + 6;
946
988
  if (!(r >= i)) return Math.ceil(i / r);
947
989
  }
948
- var Xe = {
990
+ var Qe = {
949
991
  frame: "_frame_1gm0a_2",
950
992
  "cascivo-chart-in": "_cascivo-chart-in_1gm0a_1",
951
993
  fallback: "_fallback_1gm0a_78"
952
994
  };
953
995
  //#endregion
954
996
  //#region src/core/data-point.ts
955
- function Ze(e) {
997
+ function $e(e) {
956
998
  return `${e.label}: ${e.value}`;
957
999
  }
958
1000
  //#endregion
959
1001
  //#region src/core/chart-tooltip.tsx
960
- function Qe({ point: e, model: t }) {
961
- let n = t.format ? t.format(e) : Ze(e), r = e.segments?.filter((e) => e.value !== 0);
1002
+ function et({ point: e, model: t }) {
1003
+ let n = t.format ? t.format(e) : $e(e), r = e.segments?.filter((e) => e.value !== 0);
962
1004
  return /* @__PURE__ */ m("div", {
963
1005
  role: "tooltip",
964
1006
  style: {
@@ -1006,7 +1048,7 @@ function Qe({ point: e, model: t }) {
1006
1048
  }
1007
1049
  //#endregion
1008
1050
  //#region src/core/nearest.ts
1009
- function $e(e, t, n, r = "xy") {
1051
+ function tt(e, t, n, r = "xy") {
1010
1052
  if (e.length === 0) return -1;
1011
1053
  let i = 0, a = Infinity;
1012
1054
  for (let o = 0; o < e.length; o++) {
@@ -1017,7 +1059,7 @@ function $e(e, t, n, r = "xy") {
1017
1059
  }
1018
1060
  //#endregion
1019
1061
  //#region src/core/canvas-layer.tsx
1020
- function et({ size: e, paint: t }) {
1062
+ function nt({ size: e, paint: t }) {
1021
1063
  let n = l(null);
1022
1064
  return o(() => {
1023
1065
  let { width: r, height: i } = e(), a = n.current;
@@ -1042,28 +1084,28 @@ function et({ size: e, paint: t }) {
1042
1084
  }
1043
1085
  });
1044
1086
  }
1045
- function tt(e, t) {
1087
+ function rt(e, t) {
1046
1088
  let n = /var\((--[^,)]+)/.exec(t);
1047
1089
  return !n || typeof getComputedStyle != "function" ? t : getComputedStyle(e.canvas).getPropertyValue(n[1]).trim() || t;
1048
1090
  }
1049
1091
  //#endregion
1050
1092
  //#region src/core/zoom.ts
1051
- var nt = 1;
1052
- function rt(e, t, n, r) {
1093
+ var it = 1;
1094
+ function at(e, t, n, r) {
1053
1095
  if (t <= 1) return [0, Math.max(0, t - 1)];
1054
1096
  let [i, a] = e, o = i + r * (a - i), s = Math.round(o - (o - i) * n), c = Math.round(o + (a - o) * n);
1055
- return s = Math.max(0, s), c = Math.min(t - 1, c), c - s < nt && (s = Math.max(0, Math.min(Math.round(o) - 1, t - 1 - nt)), c = Math.min(t - 1, s + nt)), [s, c];
1097
+ return s = Math.max(0, s), c = Math.min(t - 1, c), c - s < it && (s = Math.max(0, Math.min(Math.round(o) - 1, t - 1 - it)), c = Math.min(t - 1, s + it)), [s, c];
1056
1098
  }
1057
- function it(e, t, n) {
1099
+ function ot(e, t, n) {
1058
1100
  let [r, i] = e, a = i - r, o = Math.max(0, Math.min(t - 1 - a, Math.round(r + n)));
1059
1101
  return [o, o + a];
1060
1102
  }
1061
- function at(e, t) {
1103
+ function st(e, t) {
1062
1104
  return e[0] > 0 || e[1] < t - 1;
1063
1105
  }
1064
1106
  //#endregion
1065
1107
  //#region src/chrome/toolbox.tsx
1066
- var ot = {
1108
+ var ct = {
1067
1109
  display: "inline-flex",
1068
1110
  alignItems: "center",
1069
1111
  justifyContent: "center",
@@ -1078,7 +1120,7 @@ var ot = {
1078
1120
  color: "var(--cascivo-color-foreground, inherit)",
1079
1121
  cursor: "pointer"
1080
1122
  };
1081
- function st({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, showData: a }) {
1123
+ function lt({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, showData: a }) {
1082
1124
  let o = e;
1083
1125
  return /* @__PURE__ */ h("div", {
1084
1126
  role: "group",
@@ -1090,26 +1132,26 @@ function st({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
1090
1132
  children: [
1091
1133
  o.png !== !1 && /* @__PURE__ */ m("button", {
1092
1134
  type: "button",
1093
- style: ot,
1135
+ style: ct,
1094
1136
  onClick: t,
1095
1137
  children: f(u.charts.exportPng)
1096
1138
  }),
1097
1139
  o.svg !== !1 && /* @__PURE__ */ m("button", {
1098
1140
  type: "button",
1099
- style: ot,
1141
+ style: ct,
1100
1142
  onClick: n,
1101
1143
  children: f(u.charts.exportSvg)
1102
1144
  }),
1103
1145
  o.dataView !== !1 && /* @__PURE__ */ m("button", {
1104
1146
  type: "button",
1105
- style: ot,
1147
+ style: ct,
1106
1148
  "aria-pressed": a,
1107
1149
  onClick: r,
1108
1150
  children: f(u.charts.dataView)
1109
1151
  }),
1110
1152
  o.restore !== !1 && /* @__PURE__ */ m("button", {
1111
1153
  type: "button",
1112
- style: ot,
1154
+ style: ct,
1113
1155
  onClick: i,
1114
1156
  children: f(u.charts.restore)
1115
1157
  })
@@ -1118,19 +1160,19 @@ function st({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
1118
1160
  }
1119
1161
  //#endregion
1120
1162
  //#region src/core/export.ts
1121
- var ct = [
1163
+ var ut = [
1122
1164
  "fill",
1123
1165
  "stroke",
1124
1166
  "stop-color",
1125
1167
  "color"
1126
1168
  ];
1127
- function lt(e) {
1169
+ function dt(e) {
1128
1170
  let t = e.cloneNode(!0);
1129
1171
  if (typeof getComputedStyle == "function") {
1130
1172
  let n = e.querySelectorAll("*"), r = t.querySelectorAll("*");
1131
1173
  for (let e = 0; e < n.length; e++) {
1132
1174
  let t = getComputedStyle(n[e]), i = r[e];
1133
- if (i) for (let e of ct) {
1175
+ if (i) for (let e of ut) {
1134
1176
  let n = t.getPropertyValue(e);
1135
1177
  n && n !== "none" && !n.includes("var(") && i.setAttribute(e, n);
1136
1178
  }
@@ -1138,7 +1180,7 @@ function lt(e) {
1138
1180
  }
1139
1181
  return t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), new XMLSerializer().serializeToString(t);
1140
1182
  }
1141
- function ut(e, t) {
1183
+ function ft(e, t) {
1142
1184
  if (typeof document > "u" || typeof Image > "u") return Promise.resolve(null);
1143
1185
  let n = t.dpr ?? 1, r = document.createElement("canvas");
1144
1186
  r.width = Math.max(1, Math.round(t.width * n)), r.height = Math.max(1, Math.round(t.height * n));
@@ -1154,14 +1196,14 @@ function ut(e, t) {
1154
1196
  }), n.addEventListener("error", () => t(null)), n.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
1155
1197
  }) : Promise.resolve(null);
1156
1198
  }
1157
- function dt(e, t) {
1199
+ function pt(e, t) {
1158
1200
  if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
1159
1201
  let n = typeof e == "string" ? new Blob([e], { type: "image/svg+xml" }) : e, r = URL.createObjectURL(n), i = document.createElement("a");
1160
1202
  i.href = r, i.download = t, i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
1161
1203
  }
1162
1204
  //#endregion
1163
1205
  //#region src/core/chart-frame.tsx
1164
- var ft = {
1206
+ var mt = {
1165
1207
  position: "absolute",
1166
1208
  insetInlineStart: "-9999px",
1167
1209
  inlineSize: "1px",
@@ -1170,121 +1212,121 @@ var ft = {
1170
1212
  clipPath: "inset(50%)",
1171
1213
  whiteSpace: "nowrap"
1172
1214
  };
1173
- function Q({ title: e, description: t, width: n, height: r, fallback: i, children: d, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: ee, onAfterDraw: k }) {
1215
+ function Q({ title: e, description: t, width: n, height: r, fallback: i, children: d, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: k, onAfterDraw: A }) {
1174
1216
  s();
1175
- let A = c(), j = `${A}-desc`, te = `${A}-live`, { ref: M, width: ne, height: N } = He(n ?? 400, 300), P = a(null), F = a(!1), re = l(null), ae = l(null), I = l(null), oe = l(null);
1217
+ let j = c(), M = `${j}-desc`, ee = `${j}-live`, { ref: N, width: te, height: P } = We(n ?? 400, 300), F = a(null), I = a(!1), ne = l(null), L = l(null), R = l(null), ie = l(null);
1176
1218
  o(() => {
1177
- let e = oe.current;
1219
+ let e = ie.current;
1178
1220
  if (!e || !T) return;
1179
1221
  let t = (t) => {
1180
1222
  t.preventDefault();
1181
1223
  let n = e.getBoundingClientRect(), r = n.width ? (t.clientX - n.left) / n.width : .5, i = t.deltaY > 0 ? 1.25 : 1 / 1.25;
1182
- T.window.value = rt(T.window.value, T.count, i, r);
1224
+ T.window.value = at(T.window.value, T.count, i, r);
1183
1225
  };
1184
1226
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
1185
1227
  });
1186
- let L = () => {
1228
+ let z = () => {
1187
1229
  T && (T.window.value = [0, Math.max(0, T.count - 1)]);
1188
- }, R = n ?? ne.value, z = r ?? N.value, B = E === !0 ? {} : E || null, V = () => ae.current ? lt(ae.current) : null, H = () => {
1189
- let t = V();
1190
- t && dt(t, `${e || "chart"}.svg`);
1191
- }, U = () => {
1192
- let t = V();
1193
- t && ut(t, {
1194
- width: R,
1195
- height: z,
1230
+ }, B = n ?? te.value, V = r ?? P.value, H = E === !0 ? {} : E || null, U = () => L.current ? dt(L.current) : null, W = () => {
1231
+ let t = U();
1232
+ t && pt(t, `${e || "chart"}.svg`);
1233
+ }, G = () => {
1234
+ let t = U();
1235
+ t && ft(t, {
1236
+ width: B,
1237
+ height: V,
1196
1238
  dpr: 2
1197
1239
  }).then((t) => {
1198
- t && dt(t, `${e || "chart"}.png`);
1240
+ t && pt(t, `${e || "chart"}.png`);
1199
1241
  });
1200
- }, W = () => {
1201
- L(), D?.();
1202
- }, G = typeof b == "function" ? b({
1203
- width: R,
1204
- height: z
1242
+ }, K = () => {
1243
+ z(), D?.();
1244
+ }, q = typeof b == "function" ? b({
1245
+ width: B,
1246
+ height: V
1205
1247
  }) : b;
1206
1248
  o(() => {
1207
- let e = P.value;
1208
- if (!G || !re.current) return;
1209
- let t = e === null ? void 0 : G.points[e];
1210
- re.current.textContent = t ? (G.format ?? Ze)(t) : "";
1249
+ let e = F.value;
1250
+ if (!q || !ne.current) return;
1251
+ let t = e === null ? void 0 : q.points[e];
1252
+ ne.current.textContent = t ? (q.format ?? $e)(t) : "";
1211
1253
  });
1212
- let K = {
1254
+ let ae = {
1213
1255
  position: "absolute",
1214
1256
  inset: 0,
1215
1257
  cursor: T ? "grab" : x ? "pointer" : "crosshair",
1216
1258
  background: "transparent",
1217
1259
  touchAction: T ? "none" : void 0
1218
- }, q = C === "canvas" && w !== void 0, J = G !== void 0 || T !== void 0, se = {};
1260
+ }, J = C === "canvas" && w !== void 0, Y = q !== void 0 || T !== void 0, oe = {};
1219
1261
  if (O && typeof O == "object") {
1220
- let e = se;
1262
+ let e = oe;
1221
1263
  O.duration !== void 0 && (e["--cascivo-chart-anim-dur"] = `${O.duration}ms`), O.easing && (e["--cascivo-chart-anim-ease"] = O.easing), O.properties && (e["--cascivo-chart-anim-props"] = O.properties.join(", "));
1222
1264
  }
1223
- let Y = J || q || B || Object.keys(se).length > 0 ? {
1224
- ...se,
1225
- ...J || q || B ? { position: "relative" } : {}
1265
+ let X = Y || J || H || Object.keys(oe).length > 0 ? {
1266
+ ...oe,
1267
+ ...Y || J || H ? { position: "relative" } : {}
1226
1268
  } : void 0;
1227
1269
  return /* @__PURE__ */ h("div", {
1228
- ref: M,
1229
- className: [Xe.frame, g].filter(Boolean).join(" "),
1230
- style: Y,
1270
+ ref: N,
1271
+ className: [Qe.frame, g].filter(Boolean).join(" "),
1272
+ style: X,
1231
1273
  ..._ !== void 0 && { "data-state": _ },
1232
1274
  ...y === !0 && { "data-plain": "" },
1233
1275
  ...O === !1 && { "data-no-anim": "" },
1234
1276
  children: [
1235
- B && /* @__PURE__ */ m("div", {
1277
+ H && /* @__PURE__ */ m("div", {
1236
1278
  style: {
1237
1279
  position: "absolute",
1238
1280
  top: 4,
1239
1281
  right: 4,
1240
1282
  zIndex: 12
1241
1283
  },
1242
- children: /* @__PURE__ */ m(st, {
1243
- options: B,
1244
- onPng: U,
1245
- onSvg: H,
1284
+ children: /* @__PURE__ */ m(lt, {
1285
+ options: H,
1286
+ onPng: G,
1287
+ onSvg: W,
1246
1288
  onToggleData: () => {
1247
- F.value = !F.value;
1289
+ I.value = !I.value;
1248
1290
  },
1249
- onRestore: W,
1250
- showData: F.value
1291
+ onRestore: K,
1292
+ showData: I.value
1251
1293
  })
1252
1294
  }),
1253
- q && /* @__PURE__ */ m(et, {
1295
+ J && /* @__PURE__ */ m(nt, {
1254
1296
  size: () => ({
1255
- width: n ?? ne.value,
1256
- height: r ?? N.value
1297
+ width: n ?? te.value,
1298
+ height: r ?? P.value
1257
1299
  }),
1258
1300
  paint: w
1259
1301
  }),
1260
1302
  /* @__PURE__ */ h("svg", {
1261
- ref: ae,
1303
+ ref: L,
1262
1304
  role: "img",
1263
1305
  "aria-label": e,
1264
- "aria-describedby": t ? j : void 0,
1265
- width: R,
1266
- height: z,
1267
- viewBox: `0 0 ${R} ${z}`,
1306
+ "aria-describedby": t ? M : void 0,
1307
+ width: B,
1308
+ height: V,
1309
+ viewBox: `0 0 ${B} ${V}`,
1268
1310
  children: [
1269
1311
  t && /* @__PURE__ */ m("desc", {
1270
- id: j,
1312
+ id: M,
1271
1313
  children: t
1272
1314
  }),
1273
- ee?.({
1274
- width: R,
1275
- height: z
1315
+ k?.({
1316
+ width: B,
1317
+ height: V
1276
1318
  }),
1277
1319
  d({
1278
- width: R,
1279
- height: z
1320
+ width: B,
1321
+ height: V
1280
1322
  }),
1281
- k?.({
1282
- width: R,
1283
- height: z
1323
+ A?.({
1324
+ width: B,
1325
+ height: V
1284
1326
  }),
1285
1327
  _ === "empty" && /* @__PURE__ */ m("text", {
1286
- x: R / 2,
1287
- y: z / 2,
1328
+ x: B / 2,
1329
+ y: V / 2,
1288
1330
  textAnchor: "middle",
1289
1331
  dominantBaseline: "central",
1290
1332
  fill: "var(--cascivo-color-foreground-muted)",
@@ -1295,20 +1337,20 @@ function Q({ title: e, description: t, width: n, height: r, fallback: i, childre
1295
1337
  ]
1296
1338
  }),
1297
1339
  i && /* @__PURE__ */ m("div", {
1298
- className: Xe.fallback,
1299
- style: ft,
1340
+ className: Qe.fallback,
1341
+ style: mt,
1300
1342
  children: i
1301
1343
  }),
1302
- B && F.value && i && /* @__PURE__ */ m("div", {
1344
+ H && I.value && i && /* @__PURE__ */ m("div", {
1303
1345
  "data-data-view": "",
1304
1346
  style: { overflowX: "auto" },
1305
1347
  children: i
1306
1348
  }),
1307
- J && /* @__PURE__ */ h(p, { children: [
1308
- G !== void 0 && /* @__PURE__ */ h(p, { children: [
1349
+ Y && /* @__PURE__ */ h(p, { children: [
1350
+ q !== void 0 && /* @__PURE__ */ h(p, { children: [
1309
1351
  /* @__PURE__ */ m("span", {
1310
- id: te,
1311
- ref: re,
1352
+ id: ee,
1353
+ ref: ne,
1312
1354
  "aria-live": "polite",
1313
1355
  style: {
1314
1356
  position: "absolute",
@@ -1322,21 +1364,21 @@ function Q({ title: e, description: t, width: n, height: r, fallback: i, childre
1322
1364
  border: 0
1323
1365
  }
1324
1366
  }),
1325
- G.mode === "axis" && P.value !== null && G.points[P.value] !== void 0 && /* @__PURE__ */ m("div", {
1367
+ q.mode === "axis" && F.value !== null && q.points[F.value] !== void 0 && /* @__PURE__ */ m("div", {
1326
1368
  "aria-hidden": "true",
1327
1369
  style: {
1328
1370
  position: "absolute",
1329
- left: G.points[P.value].cx,
1371
+ left: q.points[F.value].cx,
1330
1372
  top: 0,
1331
1373
  width: 1,
1332
- height: z,
1374
+ height: V,
1333
1375
  background: "var(--cascivo-chart-grid, currentColor)",
1334
1376
  pointerEvents: "none",
1335
1377
  zIndex: 9
1336
1378
  }
1337
1379
  }),
1338
- P.value !== null && G.points[P.value] !== void 0 && (() => {
1339
- let e = G.points[P.value];
1380
+ F.value !== null && q.points[F.value] !== void 0 && (() => {
1381
+ let e = q.points[F.value];
1340
1382
  return /* @__PURE__ */ m("div", {
1341
1383
  "aria-hidden": "true",
1342
1384
  style: {
@@ -1353,14 +1395,14 @@ function Q({ title: e, description: t, width: n, height: r, fallback: i, childre
1353
1395
  }
1354
1396
  });
1355
1397
  })(),
1356
- P.value !== null && G.points[P.value] !== void 0 && /* @__PURE__ */ m(Qe, {
1357
- point: G.points[P.value],
1358
- model: G
1398
+ F.value !== null && q.points[F.value] !== void 0 && /* @__PURE__ */ m(et, {
1399
+ point: q.points[F.value],
1400
+ model: q
1359
1401
  })
1360
1402
  ] }),
1361
- T && !B && at(T.window.value, T.count) && /* @__PURE__ */ m("button", {
1403
+ T && !H && st(T.window.value, T.count) && /* @__PURE__ */ m("button", {
1362
1404
  type: "button",
1363
- onClick: L,
1405
+ onClick: z,
1364
1406
  style: {
1365
1407
  position: "absolute",
1366
1408
  top: 4,
@@ -1378,71 +1420,71 @@ function Q({ title: e, description: t, width: n, height: r, fallback: i, childre
1378
1420
  children: f(u.charts.resetZoom)
1379
1421
  }),
1380
1422
  /* @__PURE__ */ m("div", {
1381
- ref: oe,
1423
+ ref: ie,
1382
1424
  role: "application",
1383
1425
  "aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
1384
1426
  tabIndex: 0,
1385
- style: K,
1427
+ style: ae,
1386
1428
  onPointerDown: (e) => {
1387
- T && (I.current = {
1429
+ T && (R.current = {
1388
1430
  x: e.clientX,
1389
1431
  win: [...T.window.value]
1390
1432
  }, e.currentTarget.setPointerCapture(e.pointerId));
1391
1433
  },
1392
1434
  onPointerMove: (e) => {
1393
- if (T && I.current && e.buttons === 1) {
1394
- let t = e.currentTarget.getBoundingClientRect(), n = I.current.win[1] - I.current.win[0] + 1, r = e.clientX - I.current.x, i = t.width ? -(r / t.width) * n : 0;
1395
- T.window.value = it(I.current.win, T.count, i);
1435
+ if (T && R.current && e.buttons === 1) {
1436
+ let t = e.currentTarget.getBoundingClientRect(), n = R.current.win[1] - R.current.win[0] + 1, r = e.clientX - R.current.x, i = t.width ? -(r / t.width) * n : 0;
1437
+ T.window.value = ot(R.current.win, T.count, i);
1396
1438
  return;
1397
1439
  }
1398
- if (!G || !G.points.length) return;
1440
+ if (!q || !q.points.length) return;
1399
1441
  let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
1400
- P.value = G.mode === "axis" ? $e(G.points, n, r, "x") : S === "voronoi" ? ie(G.points.map((e) => [e.cx, e.cy]), n, r) : $e(G.points, n, r, "xy");
1442
+ F.value = q.mode === "axis" ? tt(q.points, n, r, "x") : S === "voronoi" ? re(q.points.map((e) => [e.cx, e.cy]), n, r) : tt(q.points, n, r, "xy");
1401
1443
  },
1402
1444
  onPointerUp: () => {
1403
- I.current = null;
1445
+ R.current = null;
1404
1446
  },
1405
1447
  onPointerLeave: () => {
1406
- I.current = null, G && (P.value = null);
1448
+ R.current = null, q && (F.value = null);
1407
1449
  },
1408
1450
  onKeyDown: (e) => {
1409
1451
  if (T) {
1410
1452
  if (e.key === "+" || e.key === "=") {
1411
- e.preventDefault(), T.window.value = rt(T.window.value, T.count, 1 / 1.25, .5);
1453
+ e.preventDefault(), T.window.value = at(T.window.value, T.count, 1 / 1.25, .5);
1412
1454
  return;
1413
1455
  }
1414
1456
  if (e.key === "-" || e.key === "_") {
1415
- e.preventDefault(), T.window.value = rt(T.window.value, T.count, 1.25, .5);
1457
+ e.preventDefault(), T.window.value = at(T.window.value, T.count, 1.25, .5);
1416
1458
  return;
1417
1459
  }
1418
1460
  if (e.key === "0") {
1419
- e.preventDefault(), L();
1461
+ e.preventDefault(), z();
1420
1462
  return;
1421
1463
  }
1422
1464
  }
1423
- if (!G || !G.points.length) return;
1424
- let t = P.value;
1425
- if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), P.value = t === null ? 0 : Math.min(t + 1, G.points.length - 1);
1426
- else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), P.value = t === null ? G.points.length - 1 : Math.max(t - 1, 0);
1427
- else if (e.key === "Home") e.preventDefault(), P.value = 0;
1428
- else if (e.key === "End") e.preventDefault(), P.value = G.points.length - 1;
1429
- else if (e.key === "Escape") P.value = null;
1465
+ if (!q || !q.points.length) return;
1466
+ let t = F.value;
1467
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), F.value = t === null ? 0 : Math.min(t + 1, q.points.length - 1);
1468
+ else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), F.value = t === null ? q.points.length - 1 : Math.max(t - 1, 0);
1469
+ else if (e.key === "Home") e.preventDefault(), F.value = 0;
1470
+ else if (e.key === "End") e.preventDefault(), F.value = q.points.length - 1;
1471
+ else if (e.key === "Escape") F.value = null;
1430
1472
  else if (x && (e.key === "Enter" || e.key === " ")) {
1431
1473
  e.preventDefault();
1432
- let t = P.value, n = t === null ? void 0 : G.points[t];
1474
+ let t = F.value, n = t === null ? void 0 : q.points[t];
1433
1475
  n && x(n);
1434
1476
  }
1435
1477
  },
1436
1478
  onClick: () => {
1437
- if (!G) return;
1438
- let e = P.value, t = e === null ? void 0 : G.points[e];
1479
+ if (!q) return;
1480
+ let e = F.value, t = e === null ? void 0 : q.points[e];
1439
1481
  x && t && x(t);
1440
1482
  },
1441
1483
  onFocus: () => {
1442
- G && G.points.length > 0 && P.value === null && (P.value = 0);
1484
+ q && q.points.length > 0 && F.value === null && (F.value = 0);
1443
1485
  },
1444
1486
  onBlur: () => {
1445
- G && (P.value = null);
1487
+ q && (F.value = null);
1446
1488
  }
1447
1489
  })
1448
1490
  ] })
@@ -1451,57 +1493,63 @@ function Q({ title: e, description: t, width: n, height: r, fallback: i, childre
1451
1493
  }
1452
1494
  //#endregion
1453
1495
  //#region src/core/sync.ts
1454
- var pt = /* @__PURE__ */ new Map();
1455
- function mt(e) {
1456
- let t = pt.get(e);
1496
+ var ht = /* @__PURE__ */ new Map();
1497
+ function gt(e) {
1498
+ let t = ht.get(e);
1457
1499
  return t || (t = {
1458
1500
  group: {
1459
1501
  window: r(null),
1460
1502
  hoverX: r(null)
1461
1503
  },
1462
1504
  refs: 0
1463
- }, pt.set(e, t)), t.refs++, t.group;
1505
+ }, ht.set(e, t)), t.refs++, t.group;
1464
1506
  }
1465
- function ht(e) {
1466
- let t = pt.get(e);
1467
- t && (t.refs--, t.refs <= 0 && pt.delete(e));
1507
+ function _t(e) {
1508
+ let t = ht.get(e);
1509
+ t && (t.refs--, t.refs <= 0 && ht.delete(e));
1468
1510
  }
1469
- function gt() {
1470
- return pt.size;
1511
+ function vt() {
1512
+ return ht.size;
1471
1513
  }
1472
1514
  //#endregion
1473
1515
  //#region src/chrome/axis.tsx
1474
- function _t(e) {
1516
+ function yt(e) {
1475
1517
  return "bandwidth" in e;
1476
1518
  }
1477
- function vt(e) {
1519
+ function bt(e) {
1478
1520
  return "tickInterval" in e;
1479
1521
  }
1480
- function yt(e) {
1522
+ function xt(e) {
1481
1523
  return e instanceof Date ? e.toLocaleDateString() : typeof e == "number" ? e.toLocaleString() : String(e);
1482
1524
  }
1483
- function $({ scale: e, orientation: t, length: n, format: r = yt, tickCount: i = 5, labelEvery: a, title: o, titleOffset: s = 36, transform: c }) {
1525
+ function St(e, t) {
1526
+ let n = new Intl.DateTimeFormat(void 0, e.tickFormat(t));
1527
+ return (e) => n.format(e);
1528
+ }
1529
+ function $({ scale: e, orientation: t, length: n, format: r, tickCount: i = 5, labelEvery: a, title: o, titleOffset: s = 36, transform: c }) {
1484
1530
  let l;
1485
- if (_t(e)) {
1486
- let t = e.domain.length - 1, n = a != null && a > 1, i = n ? Math.floor(t / a) * a : -1, o = !1;
1487
- if (n && i !== t && i >= 0) {
1488
- let n = (t) => (e.map(e.domain[t]) ?? 0) + e.bandwidth / 2, a = e.domain.reduce((e, t) => Math.max(e, r(t).length), 0) * Ge;
1489
- o = n(t) - n(i) < a;
1531
+ if (yt(e)) {
1532
+ let t = r ?? xt, n = e.domain.length - 1, i = a != null && a > 1, o = i ? Math.floor(n / a) * a : -1, s = !1;
1533
+ if (i && o !== n && o >= 0) {
1534
+ let r = (t) => (e.map(e.domain[t]) ?? 0) + e.bandwidth / 2, i = e.domain.reduce((e, n) => Math.max(e, t(n).length), 0) * qe;
1535
+ s = r(n) - r(o) < i;
1490
1536
  }
1491
- l = e.domain.map((t, n) => ({
1492
- position: (e.map(t) ?? 0) + e.bandwidth / 2,
1493
- label: r(t),
1494
- i: n
1495
- })).filter(({ i: e }) => !n || e === t ? !0 : o && e === i ? !1 : e % a === 0);
1496
- } else if (vt(e)) l = e.ticks(i).map((t) => ({
1497
- position: e.map(t),
1498
- label: r(t)
1499
- }));
1500
- else {
1537
+ l = e.domain.map((n, r) => ({
1538
+ position: (e.map(n) ?? 0) + e.bandwidth / 2,
1539
+ label: t(n),
1540
+ i: r
1541
+ })).filter(({ i: e }) => !i || e === n ? !0 : s && e === o ? !1 : e % a === 0);
1542
+ } else if (bt(e)) {
1543
+ let t = r ?? St(e, i);
1544
+ l = e.ticks(i).map((n) => ({
1545
+ position: e.map(n),
1546
+ label: t(n)
1547
+ }));
1548
+ } else {
1501
1549
  let t = e;
1502
1550
  l = t.ticks(i).map((e) => ({
1503
1551
  position: t.map(e),
1504
- label: r(e)
1552
+ label: (r ?? xt)(e)
1505
1553
  }));
1506
1554
  }
1507
1555
  let u = t === "x", d = t === "y-right", f = u ? 0 : d ? 4 : -4, p = u ? 0 : d ? 8 : -8, g = u ? "middle" : d ? "start" : "end";
@@ -1548,7 +1596,7 @@ function $({ scale: e, orientation: t, length: n, format: r = yt, tickCount: i =
1548
1596
  }
1549
1597
  //#endregion
1550
1598
  //#region src/chrome/grid-lines.tsx
1551
- function bt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform: i }) {
1599
+ function Ct({ scale: e, orientation: t, length: n, tickCount: r = 5, transform: i }) {
1552
1600
  let a = e.ticks(r), o = t === "x";
1553
1601
  return /* @__PURE__ */ m("g", {
1554
1602
  transform: i,
@@ -1569,17 +1617,17 @@ function bt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform:
1569
1617
  }
1570
1618
  //#endregion
1571
1619
  //#region src/chrome/reference.tsx
1572
- var xt = "var(--cascivo-color-foreground-muted)", St = "var(--cascivo-color-accent)";
1573
- function Ct(e, t) {
1620
+ var wt = "var(--cascivo-color-foreground-muted)", Tt = "var(--cascivo-color-accent)";
1621
+ function Et(e, t) {
1574
1622
  let n = e.map(t);
1575
1623
  if (!(n == null || Number.isNaN(n))) return e.bandwidth ? n + e.bandwidth / 2 : n;
1576
1624
  }
1577
- function wt(e, t, n) {
1625
+ function Dt(e, t, n) {
1578
1626
  let { xScale: r, yScale: i, innerW: a, innerH: o } = t;
1579
1627
  if (e.kind === "line") {
1580
- let t = Ct(e.axis === "x" ? r : i, e.value);
1628
+ let t = Et(e.axis === "x" ? r : i, e.value);
1581
1629
  if (t == null) return null;
1582
- let s = e.color ?? xt, c = e.dash !== !1, l = e.axis === "x";
1630
+ let s = e.color ?? wt, c = e.dash !== !1, l = e.axis === "x";
1583
1631
  return /* @__PURE__ */ h("g", {
1584
1632
  "data-annotation": "line",
1585
1633
  "aria-hidden": "true",
@@ -1610,9 +1658,9 @@ function wt(e, t, n) {
1610
1658
  }, n);
1611
1659
  }
1612
1660
  if (e.kind === "area") {
1613
- let t = e.axis === "x" ? r : i, s = Ct(t, e.from), c = Ct(t, e.to);
1661
+ let t = e.axis === "x" ? r : i, s = Et(t, e.from), c = Et(t, e.to);
1614
1662
  if (s == null || c == null) return null;
1615
- let l = e.color ?? St, u = e.axis === "x", d = Math.min(s, c), f = Math.abs(c - s);
1663
+ let l = e.color ?? Tt, u = e.axis === "x", d = Math.min(s, c), f = Math.abs(c - s);
1616
1664
  return /* @__PURE__ */ m("g", {
1617
1665
  "data-annotation": "area",
1618
1666
  "aria-hidden": "true",
@@ -1628,9 +1676,9 @@ function wt(e, t, n) {
1628
1676
  }, n);
1629
1677
  }
1630
1678
  if (e.kind === "note") {
1631
- let t = Ct(r, e.x), s = Ct(i, e.y);
1679
+ let t = Et(r, e.x), s = Et(i, e.y);
1632
1680
  if (t == null || s == null) return null;
1633
- let c = e.color ?? St, l = e.dx ?? 24, u = e.dy ?? -24, d = Math.max(2, Math.min(a - 2, t + l)), f = Math.max(8, Math.min(o - 2, s + u));
1681
+ let c = e.color ?? Tt, l = e.dx ?? 24, u = e.dy ?? -24, d = Math.max(2, Math.min(a - 2, t + l)), f = Math.max(8, Math.min(o - 2, s + u));
1634
1682
  return /* @__PURE__ */ h("g", {
1635
1683
  "data-annotation": "note",
1636
1684
  children: [
@@ -1666,7 +1714,7 @@ function wt(e, t, n) {
1666
1714
  if (e.kind === "threshold") {
1667
1715
  let t = i.map(e.value);
1668
1716
  if (t == null || Number.isNaN(t)) return null;
1669
- let r = e.color ?? St, s = e.side === "above" ? 0 : t, c = e.side === "above" ? t : o - t;
1717
+ let r = e.color ?? Tt, s = e.side === "above" ? 0 : t, c = e.side === "above" ? t : o - t;
1670
1718
  return /* @__PURE__ */ m("g", {
1671
1719
  "data-annotation": "threshold",
1672
1720
  "aria-hidden": "true",
@@ -1681,9 +1729,9 @@ function wt(e, t, n) {
1681
1729
  })
1682
1730
  }, n);
1683
1731
  }
1684
- let s = Ct(r, e.x), c = Ct(i, e.y);
1732
+ let s = Et(r, e.x), c = Et(i, e.y);
1685
1733
  if (s == null || c == null) return null;
1686
- let l = e.color ?? St;
1734
+ let l = e.color ?? Tt;
1687
1735
  return /* @__PURE__ */ h("g", {
1688
1736
  "data-annotation": "dot",
1689
1737
  "aria-hidden": "true",
@@ -1705,28 +1753,28 @@ function wt(e, t, n) {
1705
1753
  })]
1706
1754
  }, n);
1707
1755
  }
1708
- function Tt(e, t) {
1756
+ function Ot(e, t) {
1709
1757
  return !e || e.length === 0 ? null : /* @__PURE__ */ m("g", {
1710
1758
  "data-annotations": "",
1711
- children: e.map((e, n) => wt(e, t, n))
1759
+ children: e.map((e, n) => Dt(e, t, n))
1712
1760
  });
1713
1761
  }
1714
- function Et(e) {
1762
+ function kt(e) {
1715
1763
  return e.kind === "line" ? e.label ?? `${e.axis}=${String(e.value)}` : e.kind === "area" ? e.label ?? `${e.axis} ${String(e.from)}–${String(e.to)}` : e.kind === "threshold" ? e.label ?? `${e.side} ${e.value}` : e.kind === "note" ? e.label : e.label ?? `(${String(e.x)}, ${e.y})`;
1716
1764
  }
1717
1765
  //#endregion
1718
1766
  //#region src/chrome/data-label.tsx
1719
- var Dt = (e) => e.toLocaleString();
1720
- function Ot(e) {
1767
+ var At = (e) => e.toLocaleString();
1768
+ function jt(e) {
1721
1769
  return e ? e === !0 ? {
1722
- format: Dt,
1770
+ format: At,
1723
1771
  position: "auto"
1724
1772
  } : {
1725
- format: e.format ?? Dt,
1773
+ format: e.format ?? At,
1726
1774
  position: e.position ?? "auto"
1727
1775
  } : null;
1728
1776
  }
1729
- function kt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" }) {
1777
+ function Mt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" }) {
1730
1778
  return /* @__PURE__ */ m("text", {
1731
1779
  x: e,
1732
1780
  y: t,
@@ -1742,21 +1790,21 @@ function kt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" })
1742
1790
  }
1743
1791
  //#endregion
1744
1792
  //#region src/chrome/defs.tsx
1745
- function At(e) {
1793
+ function Nt(e) {
1746
1794
  return e.replace(/[^a-zA-Z0-9_-]/g, "");
1747
1795
  }
1748
- function jt(e, t) {
1749
- return `${At(e)}-grad-${At(t)}`;
1796
+ function Pt(e, t) {
1797
+ return `${Nt(e)}-grad-${Nt(t)}`;
1750
1798
  }
1751
- function Mt(e, t) {
1752
- return `${At(e)}-pat-${At(t)}`;
1799
+ function Ft(e, t) {
1800
+ return `${Nt(e)}-pat-${Nt(t)}`;
1753
1801
  }
1754
- function Nt(e, t, n, r) {
1755
- return n === "gradient" ? `url(#${jt(e, t)})` : n === "pattern" ? `url(#${Mt(e, t)})` : r;
1802
+ function It(e, t, n, r) {
1803
+ return n === "gradient" ? `url(#${Pt(e, t)})` : n === "pattern" ? `url(#${Ft(e, t)})` : r;
1756
1804
  }
1757
- function Pt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
1805
+ function Lt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
1758
1806
  return n === "solid" ? null : /* @__PURE__ */ m("defs", { children: t.map((t) => n === "gradient" ? /* @__PURE__ */ h("linearGradient", {
1759
- id: jt(e, t.id),
1807
+ id: Pt(e, t.id),
1760
1808
  x1: "0",
1761
1809
  y1: "0",
1762
1810
  x2: "0",
@@ -1771,7 +1819,7 @@ function Pt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
1771
1819
  stopOpacity: .1
1772
1820
  })]
1773
1821
  }, t.id) : /* @__PURE__ */ h("pattern", {
1774
- id: Mt(e, t.id),
1822
+ id: Ft(e, t.id),
1775
1823
  patternUnits: "userSpaceOnUse",
1776
1824
  width: 6,
1777
1825
  height: 6,
@@ -1817,7 +1865,7 @@ function Pt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
1817
1865
  }
1818
1866
  //#endregion
1819
1867
  //#region src/chrome/glyph.tsx
1820
- function Ft(e, t) {
1868
+ function Rt(e, t) {
1821
1869
  let n = t / 2;
1822
1870
  switch (e) {
1823
1871
  case "square": return `M${-n},${-n}h${t}v${t}h${-t}Z`;
@@ -1838,7 +1886,7 @@ function Ft(e, t) {
1838
1886
  default: return "";
1839
1887
  }
1840
1888
  }
1841
- function It({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke: o, strokeWidth: s }) {
1889
+ function zt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke: o, strokeWidth: s }) {
1842
1890
  let c = {
1843
1891
  fill: i,
1844
1892
  fillOpacity: a,
@@ -1853,33 +1901,33 @@ function It({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke:
1853
1901
  r: r / 2,
1854
1902
  ...c
1855
1903
  }) : /* @__PURE__ */ m("path", {
1856
- d: Ft(e, r),
1904
+ d: Rt(e, r),
1857
1905
  transform: `translate(${t},${n})`,
1858
1906
  ...c
1859
1907
  });
1860
1908
  }
1861
1909
  //#endregion
1862
1910
  //#region src/chrome/text.tsx
1863
- var Lt;
1864
- function Rt(e, t) {
1865
- if (Lt === void 0 && (Lt = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), Lt) {
1866
- Lt.font = `${t}px sans-serif`;
1867
- let n = Lt.measureText(e).width;
1911
+ var Bt;
1912
+ function Vt(e, t) {
1913
+ if (Bt === void 0 && (Bt = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), Bt) {
1914
+ Bt.font = `${t}px sans-serif`;
1915
+ let n = Bt.measureText(e).width;
1868
1916
  if (n > 0) return n;
1869
1917
  }
1870
1918
  return e.length * t * .55;
1871
1919
  }
1872
- function zt(e, t, n) {
1920
+ function Ht(e, t, n) {
1873
1921
  if (!t || t <= 0) return [e];
1874
1922
  let r = e.split(/\s+/).filter(Boolean), i = [], a = "";
1875
1923
  for (let e of r) {
1876
1924
  let r = a ? `${a} ${e}` : e;
1877
- a && Rt(r, n) > t ? (i.push(a), a = e) : a = r;
1925
+ a && Vt(r, n) > t ? (i.push(a), a = e) : a = r;
1878
1926
  }
1879
1927
  return a && i.push(a), i.length ? i : [e];
1880
1928
  }
1881
- function Bt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "start", fill: o, lineHeight: s = 1.2, className: c }) {
1882
- let l = r ? zt(n, r, i) : [n];
1929
+ function Ut({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "start", fill: o, lineHeight: s = 1.2, className: c }) {
1930
+ let l = r ? Ht(n, r, i) : [n];
1883
1931
  return /* @__PURE__ */ m("text", {
1884
1932
  x: e,
1885
1933
  y: t,
@@ -1896,7 +1944,7 @@ function Bt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "
1896
1944
  }
1897
1945
  //#endregion
1898
1946
  //#region src/chrome/brush.tsx
1899
- function Vt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
1947
+ function Wt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
1900
1948
  s();
1901
1949
  let i = Math.max(1, e - 1), a = (e) => e / i * 100, [o, c] = n.value, l = t - 8, u = (t, r) => {
1902
1950
  let i = Math.max(0, Math.min(e - 1, r)), [a, o] = n.value;
@@ -1967,7 +2015,7 @@ function Vt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
1967
2015
  }
1968
2016
  //#endregion
1969
2017
  //#region src/chrome/data-zoom.tsx
1970
- function Ht({ count: e, height: t = 28, window: n, label: r = "Range" }) {
2018
+ function Gt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
1971
2019
  s();
1972
2020
  let i = Math.max(1, e - 1), o = (e) => e / i * 100, [c, l] = n.value, u = t - 8, d = a(0), f = (e, t) => {
1973
2021
  let n = t.getBoundingClientRect();
@@ -2062,27 +2110,27 @@ function Ht({ count: e, height: t = 28, window: n, label: r = "Range" }) {
2062
2110
  }
2063
2111
  //#endregion
2064
2112
  //#region src/chrome/visual-map.tsx
2065
- var Ut = 5, Wt = [3, 14], Gt = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Kt = (e, t, n) => e + (t - e) * n, qt = (e, t) => Gt((e - t.min) / (t.max - t.min || 1));
2066
- function Jt(e, t) {
2067
- let n = t.pieces ?? Ut;
2068
- return Math.min(n - 1, Math.max(0, Math.floor(qt(e, t) * n)));
2069
- }
2070
- function Yt(e, t) {
2071
- let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = qt(e, t), a = {};
2072
- if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? be(t.pieces ?? Ut, r)[Jt(e, t)] : ye(r)(i)), n === "size" || n === "both") {
2073
- let [e, n] = t.sizeRange ?? Wt;
2074
- a.size = Kt(e, n, i);
2113
+ var Kt = 5, qt = [3, 14], Jt = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Yt = (e, t, n) => e + (t - e) * n, Xt = (e, t) => Jt((e - t.min) / (t.max - t.min || 1));
2114
+ function Zt(e, t) {
2115
+ let n = t.pieces ?? Kt;
2116
+ return Math.min(n - 1, Math.max(0, Math.floor(Xt(e, t) * n)));
2117
+ }
2118
+ function Qt(e, t) {
2119
+ let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = Xt(e, t), a = {};
2120
+ if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? xe(t.pieces ?? Kt, r)[Zt(e, t)] : be(r)(i)), n === "size" || n === "both") {
2121
+ let [e, n] = t.sizeRange ?? qt;
2122
+ a.size = Yt(e, n, i);
2075
2123
  }
2076
2124
  return a;
2077
2125
  }
2078
- function Xt(e, t, n, r) {
2079
- return (t.mode ?? "continuous") === "piecewise" ? !r?.has(Jt(e, t)) : n ? e >= n[0] && e <= n[1] : !0;
2126
+ function $t(e, t, n, r) {
2127
+ return (t.mode ?? "continuous") === "piecewise" ? !r?.has(Zt(e, t)) : n ? e >= n[0] && e <= n[1] : !0;
2080
2128
  }
2081
- function Zt({ options: e, range: t, hidden: n, label: r = "Value", format: i }) {
2129
+ function en({ options: e, range: t, hidden: n, label: r = "Value", format: i }) {
2082
2130
  s();
2083
2131
  let a = i ?? ((e) => String(Math.round(e)));
2084
2132
  if ((e.mode ?? "continuous") === "piecewise") {
2085
- let t = e.pieces ?? Ut, i = be(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
2133
+ let t = e.pieces ?? Kt, i = xe(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
2086
2134
  if (!n) return;
2087
2135
  let t = new Set(n.value);
2088
2136
  t.has(e) ? t.delete(e) : t.add(e), n.value = t;
@@ -2130,9 +2178,9 @@ function Zt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
2130
2178
  })
2131
2179
  });
2132
2180
  }
2133
- let { min: o, max: c } = e, l = c - o || 1, u = be(8, e.ramp ?? "sequential"), d = (e) => (e - o) / l * 100, f = t?.value[0] ?? o, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
2181
+ let { min: o, max: c } = e, l = c - o || 1, u = xe(8, e.ramp ?? "sequential"), d = (e) => (e - o) / l * 100, f = t?.value[0] ?? o, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
2134
2182
  let n = t.getBoundingClientRect();
2135
- return n.width === 0 ? o : o + Gt((e - n.left) / n.width) * l;
2183
+ return n.width === 0 ? o : o + Jt((e - n.left) / n.width) * l;
2136
2184
  }, y = (e, n) => {
2137
2185
  if (!t) return;
2138
2186
  let r = Math.max(o, Math.min(c, n)), [i, a] = t.value;
@@ -2217,23 +2265,23 @@ function Zt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
2217
2265
  ]
2218
2266
  });
2219
2267
  }
2220
- var Qt = {
2268
+ var tn = {
2221
2269
  legend: "_legend_1pign_2",
2222
2270
  item: "_item_1pign_9",
2223
2271
  swatch: "_swatch_1pign_27"
2224
2272
  };
2225
2273
  //#endregion
2226
2274
  //#region src/chrome/legend.tsx
2227
- function $t({ series: e, hidden: t }) {
2275
+ function nn({ series: e, hidden: t }) {
2228
2276
  return s(), /* @__PURE__ */ m("div", {
2229
- className: Qt.legend,
2277
+ className: tn.legend,
2230
2278
  role: "group",
2231
2279
  "aria-label": "Chart legend",
2232
2280
  children: e.map((e, n) => {
2233
2281
  let r = t.value.has(e.id);
2234
2282
  return /* @__PURE__ */ h("button", {
2235
2283
  type: "button",
2236
- className: Qt.item,
2284
+ className: tn.item,
2237
2285
  "data-state": r ? "off" : "on",
2238
2286
  "aria-pressed": !r,
2239
2287
  "aria-label": f(u.charts.legendToggle, { name: e.label }),
@@ -2242,7 +2290,7 @@ function $t({ series: e, hidden: t }) {
2242
2290
  r ? n.delete(e.id) : n.add(e.id), t.value = n;
2243
2291
  },
2244
2292
  children: [/* @__PURE__ */ m("span", {
2245
- className: Qt.swatch,
2293
+ className: tn.swatch,
2246
2294
  style: { background: e.color || `var(--cascivo-chart-${n + 1})` },
2247
2295
  "aria-hidden": "true"
2248
2296
  }), e.label]
@@ -2252,66 +2300,66 @@ function $t({ series: e, hidden: t }) {
2252
2300
  }
2253
2301
  //#endregion
2254
2302
  //#region src/core/dev-warn.ts
2255
- function en() {
2303
+ function rn() {
2256
2304
  return typeof process < "u" && process.env.NODE_ENV === "production";
2257
2305
  }
2258
- var tn = /* @__PURE__ */ new Set();
2259
- function nn(e, t) {
2260
- if (en() || tn.has(e)) return;
2306
+ var an = /* @__PURE__ */ new Set();
2307
+ function on(e, t) {
2308
+ if (rn() || an.has(e)) return;
2261
2309
  let n = 0;
2262
2310
  for (let e of t()) Number.isFinite(e) || n++;
2263
- n !== 0 && (tn.add(e), console.warn(`[cascivo charts] ${e}: ${n} non-finite value(s) (NaN/Infinity/null) in series data. These are dropped from the chart, which can make it look wrong — check your data source.`));
2311
+ n !== 0 && (an.add(e), console.warn(`[cascivo charts] ${e}: ${n} non-finite value(s) (NaN/Infinity/null) in series data. These are dropped from the chart, which can make it look wrong — check your data source.`));
2264
2312
  }
2265
- function rn(e, t) {
2266
- en() || tn.has(e) || (tn.add(e), console.warn(`[cascivo charts] ${t}`));
2313
+ function sn(e, t) {
2314
+ rn() || an.has(e) || (an.add(e), console.warn(`[cascivo charts] ${t}`));
2267
2315
  }
2268
- function an(e, t) {
2269
- if (en()) return;
2316
+ function cn(e, t) {
2317
+ if (rn()) return;
2270
2318
  let n = t.filter((e) => Number.isFinite(e.max) && e.max > 0);
2271
2319
  if (n.length < 2) return;
2272
2320
  let r = [...n].sort((e, t) => t.max - e.max), i = r[0], a = r[r.length - 1];
2273
- i.max / a.max < 20 || rn(`${e}:scale-mismatch`, `${e}: "${a.label}" (max ${a.max.toLocaleString()}) is more than 20× smaller than "${i.label}" (max ${i.max.toLocaleString()}) on the same axis, so it renders as a flat line at the baseline while the legend still names both. Put the smaller series on its own scale with \`axis: 'right'\` + \`secondAxis\`, or split it into a second chart.`);
2321
+ i.max / a.max < 20 || sn(`${e}:scale-mismatch`, `${e}: "${a.label}" (max ${a.max.toLocaleString()}) is more than 20× smaller than "${i.label}" (max ${i.max.toLocaleString()}) on the same axis, so it renders as a flat line at the baseline while the legend still names both. Put the smaller series on its own scale with \`axis: 'right'\` + \`secondAxis\`, or split it into a second chart.`);
2274
2322
  }
2275
2323
  //#endregion
2276
2324
  //#region src/charts/line-chart/line-chart.tsx
2277
- var on = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
2278
- function sn(e) {
2325
+ var ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
2326
+ function un(e) {
2279
2327
  return [Math.min(0, ...e), Math.max(...e)];
2280
2328
  }
2281
- function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monotone", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, format: v, legend: y, tooltip: b, formatTooltip: x, className: S, plain: C, annotations: T, labels: O, connectNulls: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode: ne, secondAxis: N, decimate: P, toolbox: F, transition: re, onBeforeDraw: ie, onAfterDraw: ae }) {
2329
+ function dn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monotone", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, format: v, legend: y, tooltip: b, formatTooltip: x, className: S, plain: C, annotations: w, labels: T, connectNulls: D, onSelect: A, brush: j, dataZoom: M, zoom: ee, syncId: N, tooltipMode: te, secondAxis: P, decimate: F, toolbox: I, transition: ne, onBeforeDraw: L, onAfterDraw: R }) {
2282
2330
  s();
2283
- let I = a(/* @__PURE__ */ new Set()), oe = C ? null : Ot(O), L = P === !0 ? {
2331
+ let re = a(/* @__PURE__ */ new Set()), ie = C ? null : jt(T), z = F === !0 ? {
2284
2332
  method: "lttb",
2285
2333
  threshold: 1e3
2286
- } : P ? {
2287
- method: P.method ?? "lttb",
2288
- threshold: P.threshold ?? 1e3
2289
- } : null, R = e.reduce((e, t) => Math.max(e, t.data.length), 0), z = (A || j || te || M !== void 0) && R > 0, B = a([0, Math.max(0, R - 1)]), V = l(null);
2290
- M && !V.current && (V.current = mt(M)), o(() => () => {
2291
- M && ht(M);
2334
+ } : F ? {
2335
+ method: F.method ?? "lttb",
2336
+ threshold: F.threshold ?? 1e3
2337
+ } : null, B = e.reduce((e, t) => Math.max(e, t.data.length), 0), V = (j || M || ee || N !== void 0) && B > 0, H = a([0, Math.max(0, B - 1)]), U = l(null);
2338
+ N && !U.current && (U.current = gt(N)), o(() => () => {
2339
+ N && _t(N);
2292
2340
  }), o(() => {
2293
- let e = V.current;
2341
+ let e = U.current;
2294
2342
  if (!e) return;
2295
- let t = e.window.value, n = B.peek();
2296
- t && (t[0] !== n[0] || t[1] !== n[1]) && (B.value = t);
2343
+ let t = e.window.value, n = H.peek();
2344
+ t && (t[0] !== n[0] || t[1] !== n[1]) && (H.value = t);
2297
2345
  }), o(() => {
2298
- let e = V.current;
2346
+ let e = U.current;
2299
2347
  if (!e) return;
2300
- let t = B.value, n = e.window.peek();
2348
+ let t = H.value, n = e.window.peek();
2301
2349
  (!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
2302
2350
  });
2303
- let H = z ? e.map((e) => ({
2351
+ let W = V ? e.map((e) => ({
2304
2352
  ...e,
2305
- data: e.data.slice(B.value[0], B.value[1] + 1)
2306
- })) : e, U = !C && H.some((e) => e.axis === "right"), W = d ?? (C ? 48 : 300), G = C ? !1 : y ?? H.length > 1, K = (e) => e.y ?? n, q = H.flatMap((e) => e.data.map((e) => t(e))), J = (e) => e.flatMap((e) => e.data.map((t) => K(e)(t))).filter((e) => Number.isFinite(e)), se = J(U ? H.filter((e) => e.axis !== "right") : H), Y = U ? J(H.filter((e) => e.axis === "right")) : [];
2307
- nn("LineChart", () => H.flatMap((e) => e.data.map((t) => K(e)(t))));
2308
- let ce = q.length > 0, le = g(sn(se), [0, 1]).ticks(_).map((e) => e.toLocaleString()), ue = ce && q[0] instanceof Date, de = U ? g(sn(Y), [0, 1]).ticks(_).map((e) => N?.format ? N.format(e) : e.toLocaleString()) : [], fe = q.filter((e) => typeof e == "number"), pe = q.filter((e) => e instanceof Date), me = ce ? ue ? w([new Date(Math.min(...pe.map((e) => e.getTime()))), new Date(Math.max(...pe.map((e) => e.getTime())))], [0, 1]).ticks(f).map((e) => e.toLocaleDateString()) : g([Math.min(...fe), Math.max(...fe)], [0, 1]).ticks(f).map((e) => e.toLocaleString()) : [], X = C ? We : {
2309
- ...Ue,
2310
- left: Ke(le, C),
2311
- right: qe({
2312
- rightAxisLabels: de,
2313
- bottomAxisLabels: me,
2314
- rightAxisTitle: N?.label !== void 0 && N.label !== "",
2353
+ data: e.data.slice(H.value[0], H.value[1] + 1)
2354
+ })) : e, G = !C && W.some((e) => e.axis === "right"), K = d ?? (C ? 48 : 300), q = C ? !1 : y ?? W.length > 1, ae = (e) => e.y ?? n, J = W.flatMap((e) => e.data.map((e) => t(e))), Y = (e) => e.flatMap((e) => e.data.map((t) => ae(e)(t))).filter((e) => Number.isFinite(e)), oe = Y(G ? W.filter((e) => e.axis !== "right") : W), X = G ? Y(W.filter((e) => e.axis === "right")) : [];
2355
+ on("LineChart", () => W.flatMap((e) => e.data.map((t) => ae(e)(t))));
2356
+ let se = J.length > 0, ce = g(un(oe), [0, 1]).ticks(_).map((e) => e.toLocaleString()), le = se && J[0] instanceof Date, ue = G ? g(un(X), [0, 1]).ticks(_).map((e) => P?.format ? P.format(e) : e.toLocaleString()) : [], de = J.filter((e) => typeof e == "number"), fe = J.filter((e) => e instanceof Date), pe = se ? le ? E([new Date(Math.min(...fe.map((e) => e.getTime()))), new Date(Math.max(...fe.map((e) => e.getTime())))], [0, 1]).ticks(f).map((e) => e.toLocaleDateString()) : g([Math.min(...de), Math.max(...de)], [0, 1]).ticks(f).map((e) => e.toLocaleString()) : [], Z = C ? Ke : {
2357
+ ...Ge,
2358
+ left: Je(ce, C),
2359
+ right: Ye({
2360
+ rightAxisLabels: ue,
2361
+ bottomAxisLabels: pe,
2362
+ rightAxisTitle: P?.label !== void 0 && P.label !== "",
2315
2363
  plain: C
2316
2364
  })
2317
2365
  };
@@ -2326,38 +2374,38 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
2326
2374
  title: r,
2327
2375
  description: i,
2328
2376
  width: u,
2329
- height: W,
2377
+ height: K,
2330
2378
  fallback: /* @__PURE__ */ h("table", { children: [
2331
2379
  /* @__PURE__ */ m("caption", { children: r }),
2332
- /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), H.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
2333
- /* @__PURE__ */ m("tbody", { children: (H[0]?.data ?? []).map((e, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: String(H[0] ? t(H[0].data[n]) : "") }), H.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : K(e)(e.data[n]) }, e.id))] }, n)) })
2380
+ /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), W.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
2381
+ /* @__PURE__ */ m("tbody", { children: (W[0]?.data ?? []).map((e, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: String(W[0] ? t(W[0].data[n]) : "") }), W.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : ae(e)(e.data[n]) }, e.id))] }, n)) })
2334
2382
  ] }),
2335
2383
  className: S,
2336
- "data-state": ce ? void 0 : "empty",
2384
+ "data-state": se ? void 0 : "empty",
2337
2385
  plain: C,
2338
- tooltip: b !== !1 && ce ? ({ width: e, height: n }) => {
2339
- if (b === !1 || !ce) return;
2340
- let r = e - X.left - X.right, i = n - X.top - X.bottom, a = Math.min(...ue ? q.map((e) => e.getTime()) : q), o = Math.max(...ue ? q.map((e) => e.getTime()) : q), s = ue ? w([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), c = g(sn(se), [i, 0]), l = U ? g(sn(Y), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
2341
- if (ne === "axis") {
2342
- let e = H.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
2386
+ tooltip: b !== !1 && se ? ({ width: e, height: n }) => {
2387
+ if (b === !1 || !se) return;
2388
+ let r = e - Z.left - Z.right, i = n - Z.top - Z.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? E([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), c = g(un(oe), [i, 0]), l = G ? g(un(X), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
2389
+ if (te === "axis") {
2390
+ let e = W.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
2343
2391
  for (let r = 0; r < e; r++) {
2344
2392
  let e = [], i = 0, a = 0, o = Infinity, s = "";
2345
- H.forEach((n, c) => {
2346
- if (I.value.has(n.id)) return;
2393
+ W.forEach((n, c) => {
2394
+ if (re.value.has(n.id)) return;
2347
2395
  let l = n.data[r];
2348
2396
  if (l === void 0) return;
2349
- let f = K(n)(l);
2397
+ let f = ae(n)(l);
2350
2398
  if (!Number.isFinite(f)) return;
2351
2399
  let p = t(l);
2352
2400
  i += d(p), a++, o = Math.min(o, u(n).map(f)), s = p instanceof Date ? p.toLocaleDateString() : String(p), e.push({
2353
2401
  label: n.label,
2354
2402
  value: f,
2355
- color: n.color ?? on[c % on.length]
2403
+ color: n.color ?? ln[c % ln.length]
2356
2404
  });
2357
2405
  }), a !== 0 && n.push({
2358
2406
  id: `x-${r}`,
2359
- cx: X.left + i / a,
2360
- cy: X.top + (o === Infinity ? 0 : o),
2407
+ cx: Z.left + i / a,
2408
+ cy: Z.top + (o === Infinity ? 0 : o),
2361
2409
  label: s,
2362
2410
  value: s,
2363
2411
  segments: e
@@ -2369,67 +2417,67 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
2369
2417
  format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
2370
2418
  };
2371
2419
  }
2372
- let f = H.flatMap((e) => I.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
2373
- let i = K(e)(n);
2420
+ let f = W.flatMap((e) => re.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
2421
+ let i = ae(e)(n);
2374
2422
  if (!Number.isFinite(i)) return [];
2375
2423
  let a = t(n), o = s.map(a), c = u(e).map(i), l = a instanceof Date ? a.toLocaleDateString() : String(a);
2376
2424
  return {
2377
2425
  id: `${e.id}-${r}`,
2378
- cx: X.left + o,
2379
- cy: X.top + c,
2426
+ cx: Z.left + o,
2427
+ cy: Z.top + c,
2380
2428
  label: l,
2381
- value: K(e)(n),
2429
+ value: ae(e)(n),
2382
2430
  seriesId: e.id
2383
2431
  };
2384
2432
  }));
2385
2433
  return x ? {
2386
2434
  points: f,
2387
2435
  format: (e) => {
2388
- let t = H.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
2436
+ let t = W.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
2389
2437
  return t && t.data[n] !== void 0 ? x(t.data[n], t) : `${e.label}: ${e.value}`;
2390
2438
  }
2391
2439
  } : { points: f };
2392
2440
  } : void 0,
2393
- onSelect: k,
2394
- zoom: te && R > 1 ? {
2395
- window: B,
2396
- count: R
2441
+ onSelect: A,
2442
+ zoom: ee && B > 1 ? {
2443
+ window: H,
2444
+ count: B
2397
2445
  } : void 0,
2398
- toolbox: F,
2399
- onRestore: z ? () => {
2400
- B.value = [0, Math.max(0, R - 1)];
2446
+ toolbox: I,
2447
+ onRestore: V ? () => {
2448
+ H.value = [0, Math.max(0, B - 1)];
2401
2449
  } : void 0,
2402
- transition: re,
2403
- onBeforeDraw: ie,
2404
- onAfterDraw: ae,
2450
+ transition: ne,
2451
+ onBeforeDraw: L,
2452
+ onAfterDraw: R,
2405
2453
  children: ({ width: e, height: n }) => {
2406
- let r = e - X.left - X.right, i = n - X.top - X.bottom, a = Math.min(...ue ? q.map((e) => e.getTime()) : q), o = Math.max(...ue ? q.map((e) => e.getTime()) : q), s = ue ? w([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), l = g(sn(se), [i, 0]), u = U ? g(sn(Y), [i, 0]) : l;
2454
+ let r = e - Z.left - Z.right, i = n - Z.top - Z.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? E([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), l = g(un(oe), [i, 0]), u = G ? g(un(X), [i, 0]) : l;
2407
2455
  return /* @__PURE__ */ m("g", { children: /* @__PURE__ */ h("g", {
2408
- transform: `translate(${X.left},${X.top})`,
2456
+ transform: `translate(${Z.left},${Z.top})`,
2409
2457
  children: [
2410
- !C && /* @__PURE__ */ m(bt, {
2458
+ !C && /* @__PURE__ */ m(Ct, {
2411
2459
  scale: l,
2412
2460
  orientation: "y",
2413
2461
  length: r,
2414
2462
  tickCount: _
2415
2463
  }),
2416
- !C && Tt(T, {
2464
+ !C && Ot(w, {
2417
2465
  xScale: s,
2418
2466
  yScale: l,
2419
2467
  innerW: r,
2420
2468
  innerH: i
2421
2469
  }),
2422
- H.map((e, n) => {
2423
- if (I.value.has(e.id)) return null;
2424
- let r = e.color ?? on[n % on.length], i = e.axis === "right" ? u : l, a = (e) => s.map(e);
2425
- if (L && e.data.length > L.threshold) {
2470
+ W.map((e, n) => {
2471
+ if (re.value.has(e.id)) return null;
2472
+ let r = e.color ?? ln[n % ln.length], i = e.axis === "right" ? u : l, a = (e) => s.map(e);
2473
+ if (z && e.data.length > z.threshold) {
2426
2474
  let n = [];
2427
2475
  for (let r of e.data) {
2428
- let o = K(e)(r);
2476
+ let o = ae(e)(r);
2429
2477
  Number.isFinite(o) && n.push([a(t(r)), i.map(o)]);
2430
2478
  }
2431
2479
  return /* @__PURE__ */ m("path", {
2432
- d: D(Re(n, L.threshold, L.method).map((e) => [e[0], e[1]]), c),
2480
+ d: k(Be(n, z.threshold, z.method).map((e) => [e[0], e[1]]), c),
2433
2481
  fill: "none",
2434
2482
  stroke: r,
2435
2483
  strokeWidth: 2,
@@ -2439,23 +2487,23 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
2439
2487
  }, e.id);
2440
2488
  }
2441
2489
  let o = e.data.map((n) => {
2442
- let r = K(e)(n);
2490
+ let r = ae(e)(n);
2443
2491
  return Number.isFinite(r) ? [a(t(n)), i.map(r)] : null;
2444
2492
  });
2445
- return /* @__PURE__ */ h("g", { children: [E(o, ee).map((t, n) => /* @__PURE__ */ m("path", {
2446
- d: D(t, c),
2493
+ return /* @__PURE__ */ h("g", { children: [O(o, D).map((t, n) => /* @__PURE__ */ m("path", {
2494
+ d: k(t, c),
2447
2495
  fill: "none",
2448
2496
  stroke: r,
2449
2497
  strokeWidth: 2,
2450
2498
  strokeLinecap: "round",
2451
2499
  strokeLinejoin: "round",
2452
2500
  "data-series": e.id
2453
- }, n)), oe && e.data.map((t, n) => {
2501
+ }, n)), ie && e.data.map((t, n) => {
2454
2502
  let r = o[n];
2455
- return r ? /* @__PURE__ */ m(kt, {
2503
+ return r ? /* @__PURE__ */ m(Mt, {
2456
2504
  x: r[0],
2457
2505
  y: r[1] - 8,
2458
- text: oe.format(K(e)(t))
2506
+ text: ie.format(ae(e)(t))
2459
2507
  }, n) : null;
2460
2508
  })] }, e.id);
2461
2509
  }),
@@ -2474,16 +2522,16 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
2474
2522
  length: i,
2475
2523
  tickCount: _
2476
2524
  }),
2477
- U && /* @__PURE__ */ m($, {
2525
+ G && /* @__PURE__ */ m($, {
2478
2526
  scale: u,
2479
2527
  orientation: "y-right",
2480
2528
  length: i,
2481
2529
  tickCount: _,
2482
2530
  transform: `translate(${r},0)`,
2483
- ...N?.format ? { format: (e) => N.format(Number(e)) } : {},
2484
- ...N?.label !== void 0 && N.label !== "" ? {
2485
- title: N.label,
2486
- titleOffset: 8 + Math.ceil(de.reduce((e, t) => Math.max(e, t.length), 0) * 6.5) + 10
2531
+ ...P?.format ? { format: (e) => P.format(Number(e)) } : {},
2532
+ ...P?.label !== void 0 && P.label !== "" ? {
2533
+ title: P.label,
2534
+ titleOffset: 8 + Math.ceil(ue.reduce((e, t) => Math.max(e, t.length), 0) * 6.5) + 10
2487
2535
  } : {}
2488
2536
  })
2489
2537
  ] })
@@ -2491,75 +2539,75 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
2491
2539
  }) });
2492
2540
  }
2493
2541
  }),
2494
- A && !j && R > 1 && /* @__PURE__ */ m(Vt, {
2495
- count: R,
2496
- window: B,
2542
+ j && !M && B > 1 && /* @__PURE__ */ m(Wt, {
2543
+ count: B,
2544
+ window: H,
2497
2545
  label: "Time range"
2498
2546
  }),
2499
- j && R > 1 && /* @__PURE__ */ m(Ht, {
2500
- count: R,
2501
- window: B,
2547
+ M && B > 1 && /* @__PURE__ */ m(Gt, {
2548
+ count: B,
2549
+ window: H,
2502
2550
  label: "Time range"
2503
2551
  }),
2504
- G && /* @__PURE__ */ m($t, {
2505
- series: H.map((e, t) => ({
2552
+ q && /* @__PURE__ */ m(nn, {
2553
+ series: W.map((e, t) => ({
2506
2554
  id: e.id,
2507
2555
  label: e.label,
2508
- color: e.color ?? on[t % on.length]
2556
+ color: e.color ?? ln[t % ln.length]
2509
2557
  })),
2510
- hidden: I
2558
+ hidden: re
2511
2559
  })
2512
2560
  ]
2513
2561
  });
2514
2562
  }
2515
2563
  //#endregion
2516
2564
  //#region src/charts/area-chart/area-chart.tsx
2517
- var ln = { fillOpacity: "var(--cascivo-chart-fill-opacity, 0.25)" };
2518
- function un(e, t) {
2519
- return t || e <= 1 ? ln : { fillOpacity: "var(--cascivo-chart-fill-opacity-overlap, 0.12)" };
2565
+ var fn = { fillOpacity: "var(--cascivo-chart-fill-opacity, 0.25)" };
2566
+ function pn(e, t) {
2567
+ return t || e <= 1 ? fn : { fillOpacity: "var(--cascivo-chart-fill-opacity-overlap, 0.12)" };
2520
2568
  }
2521
- var dn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
2522
- function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1, curve: d = "monotone", fill: f = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: C, className: T, plain: E, annotations: O, labels: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode: N, secondAxis: F, decimate: re, toolbox: ie, format: ae }) {
2569
+ var mn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
2570
+ function hn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1, curve: d = "monotone", fill: f = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: C, className: w, plain: T, annotations: D, labels: O, onSelect: A, brush: j, dataZoom: M, zoom: ee, syncId: N, tooltipMode: te, secondAxis: P, decimate: I, toolbox: L, format: R }) {
2523
2571
  s();
2524
- let I = c(), oe = a(/* @__PURE__ */ new Set()), L = E ? null : Ot(ee), R = re === !0 ? {
2572
+ let re = c(), ie = a(/* @__PURE__ */ new Set()), z = T ? null : jt(O), B = I === !0 ? {
2525
2573
  method: "lttb",
2526
2574
  threshold: 1e3
2527
- } : re ? {
2528
- method: re.method ?? "lttb",
2529
- threshold: re.threshold ?? 1e3
2530
- } : null, z = e.reduce((e, t) => Math.max(e, t.data.length), 0), B = (A || j || te || M !== void 0) && z > 0, V = a([0, Math.max(0, z - 1)]), H = l(null);
2531
- M && !H.current && (H.current = mt(M)), o(() => () => {
2532
- M && ht(M);
2575
+ } : I ? {
2576
+ method: I.method ?? "lttb",
2577
+ threshold: I.threshold ?? 1e3
2578
+ } : null, V = e.reduce((e, t) => Math.max(e, t.data.length), 0), H = (j || M || ee || N !== void 0) && V > 0, U = a([0, Math.max(0, V - 1)]), W = l(null);
2579
+ N && !W.current && (W.current = gt(N)), o(() => () => {
2580
+ N && _t(N);
2533
2581
  }), o(() => {
2534
- let e = H.current;
2582
+ let e = W.current;
2535
2583
  if (!e) return;
2536
- let t = e.window.value, n = V.peek();
2537
- t && (t[0] !== n[0] || t[1] !== n[1]) && (V.value = t);
2584
+ let t = e.window.value, n = U.peek();
2585
+ t && (t[0] !== n[0] || t[1] !== n[1]) && (U.value = t);
2538
2586
  }), o(() => {
2539
- let e = H.current;
2587
+ let e = W.current;
2540
2588
  if (!e) return;
2541
- let t = V.value, n = e.window.peek();
2589
+ let t = U.value, n = e.window.peek();
2542
2590
  (!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
2543
2591
  });
2544
- let U = B ? e.map((e) => ({
2592
+ let G = H ? e.map((e) => ({
2545
2593
  ...e,
2546
- data: e.data.slice(V.value[0], V.value[1] + 1)
2547
- })) : e, W = !E && !u && U.some((e) => e.axis === "right"), G = y ?? (E ? 48 : 300), K = E ? !1 : S ?? U.length > 1, q = un(U.length, u), J = (e) => e.y ?? n, se = (U[0]?.data ?? []).map((e) => t(e)), Y = (W ? U.filter((e) => e.axis !== "right") : U).flatMap((e) => e.data.map((t) => J(e)(t))), ce = W ? U.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => J(e)(t))) : [];
2548
- !W && !u && U.length > 1 && an("AreaChart", U.map((e) => ({
2594
+ data: e.data.slice(U.value[0], U.value[1] + 1)
2595
+ })) : e, K = !T && !u && G.some((e) => e.axis === "right"), q = y ?? (T ? 48 : 300), ae = T ? !1 : S ?? G.length > 1, J = pn(G.filter((e) => e.type !== "line").length, u), Y = (e) => e.y ?? n, oe = (G[0]?.data ?? []).map((e) => t(e)), X = (K ? G.filter((e) => e.axis !== "right") : G).flatMap((e) => e.data.map((t) => Y(e)(t))), se = K ? G.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => Y(e)(t))) : [];
2596
+ !K && !u && G.length > 1 && cn("AreaChart", G.map((e) => ({
2549
2597
  label: e.label,
2550
- max: Math.max(0, ...e.data.map((t) => J(e)(t)).filter((e) => Number.isFinite(e)))
2551
- }))), nn("AreaChart", () => [...Y, ...ce]);
2552
- let le = se.length > 0, ue = le && se[0] instanceof Date, de = se.map((e) => e instanceof Date ? e.getTime() : e), fe = le ? Math.min(...de) : 0, pe = le ? Math.max(...de) : 1, me = (e) => ue ? w([new Date(fe), new Date(pe)], [0, e]) : g([fe, pe], [0, e]), X = (e, n) => e.map(t(n)), he = (e) => {
2598
+ max: Math.max(0, ...e.data.map((t) => Y(e)(t)).filter((e) => Number.isFinite(e)))
2599
+ }))), on("AreaChart", () => [...X, ...se]);
2600
+ let ce = oe.length > 0, le = ce && oe[0] instanceof Date, ue = oe.map((e) => e instanceof Date ? e.getTime() : e), de = ce ? Math.min(...ue) : 0, fe = ce ? Math.max(...ue) : 1, pe = (e) => le ? E([new Date(de), new Date(fe)], [0, e]) : g([de, fe], [0, e]), Z = (e, n) => e.map(t(n)), me = (e) => {
2553
2601
  let n = t(e);
2554
2602
  return n instanceof Date ? n.toLocaleDateString() : String(n);
2555
- }, ge = u ? 0 : Math.min(0, ...Y), _e = Math.max(...u ? (U[0]?.data ?? []).map((e, t) => U.reduce((e, n) => e + J(n)(n.data[t]), 0)) : Y), ve = W ? Math.min(0, ...ce) : ge, ye = W ? Math.max(...ce) : _e, be = g([ge, _e], [0, 1]).ticks(x).map((e) => e.toLocaleString()), xe = W ? g([ve, ye], [0, 1]).ticks(x).map((e) => F?.format ? F.format(e) : e.toLocaleString()) : [], Se = ue ? w([new Date(fe), new Date(pe)], [0, 1]).ticks(b).map((e) => e.toLocaleDateString()) : g([fe, pe], [0, 1]).ticks(b).map((e) => e.toLocaleString()), Z = E ? We : {
2556
- ...Ue,
2557
- left: Ke(be, E),
2558
- right: qe({
2559
- rightAxisLabels: xe,
2560
- bottomAxisLabels: Se,
2561
- rightAxisTitle: F?.label !== void 0 && F.label !== "",
2562
- plain: E
2603
+ }, he = u ? 0 : Math.min(0, ...X), ge = Math.max(...u ? (G[0]?.data ?? []).map((e, t) => G.reduce((e, n) => e + Y(n)(n.data[t]), 0)) : X), _e = K ? Math.min(0, ...se) : he, ve = K ? Math.max(...se) : ge, ye = g([he, ge], [0, 1]).ticks(x).map((e) => e.toLocaleString()), be = K ? g([_e, ve], [0, 1]).ticks(x).map((e) => P?.format ? P.format(e) : e.toLocaleString()) : [], xe = le ? E([new Date(de), new Date(fe)], [0, 1]).ticks(b).map((e) => e.toLocaleDateString()) : g([de, fe], [0, 1]).ticks(b).map((e) => e.toLocaleString()), Se = T ? Ke : {
2604
+ ...Ge,
2605
+ left: Je(ye, T),
2606
+ right: Ye({
2607
+ rightAxisLabels: be,
2608
+ bottomAxisLabels: xe,
2609
+ rightAxisTitle: P?.label !== void 0 && P.label !== "",
2610
+ plain: T
2563
2611
  })
2564
2612
  };
2565
2613
  return /* @__PURE__ */ h("div", {
@@ -2573,36 +2621,36 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
2573
2621
  title: r,
2574
2622
  description: i,
2575
2623
  width: v,
2576
- height: G,
2624
+ height: q,
2577
2625
  fallback: /* @__PURE__ */ h("table", { children: [
2578
2626
  /* @__PURE__ */ m("caption", { children: r }),
2579
- /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), U.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
2580
- /* @__PURE__ */ m("tbody", { children: (U[0]?.data ?? []).map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: U[0] ? he(U[0].data[t]) : "" }), U.map((e) => /* @__PURE__ */ m("td", { children: e.data[t] == null ? "" : J(e)(e.data[t]) }, e.id))] }, t)) })
2627
+ /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), G.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
2628
+ /* @__PURE__ */ m("tbody", { children: (G[0]?.data ?? []).map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: G[0] ? me(G[0].data[t]) : "" }), G.map((e) => /* @__PURE__ */ m("td", { children: e.data[t] == null ? "" : Y(e)(e.data[t]) }, e.id))] }, t)) })
2581
2629
  ] }),
2582
- className: T,
2583
- "data-state": le ? void 0 : "empty",
2584
- plain: E,
2585
- tooltip: C !== !1 && le ? ({ width: e, height: t }) => {
2586
- if (C === !1 || !le) return;
2587
- let n = e - Z.left - Z.right, r = t - Z.top - Z.bottom, i = me(n), a = g([ge, _e], [r, 0]), o = W ? g([ve, ye], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
2588
- if (N === "axis") {
2589
- let e = U.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
2630
+ className: w,
2631
+ "data-state": ce ? void 0 : "empty",
2632
+ plain: T,
2633
+ tooltip: C !== !1 && ce ? ({ width: e, height: t }) => {
2634
+ if (C === !1 || !ce) return;
2635
+ let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = g([he, ge], [r, 0]), o = K ? g([_e, ve], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
2636
+ if (te === "axis") {
2637
+ let e = G.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
2590
2638
  for (let n = 0; n < e; n++) {
2591
- let e = [], r = Infinity, a = "", o = Z.left;
2592
- U.forEach((t, c) => {
2593
- if (oe.value.has(t.id)) return;
2639
+ let e = [], r = Infinity, a = "", o = Se.left;
2640
+ G.forEach((t, c) => {
2641
+ if (ie.value.has(t.id)) return;
2594
2642
  let l = t.data[n];
2595
2643
  if (l === void 0) return;
2596
- let u = J(t)(l);
2597
- Number.isFinite(u) && (o = Z.left + X(i, l), r = Math.min(r, s(t).map(u)), a = he(l), e.push({
2644
+ let u = Y(t)(l);
2645
+ Number.isFinite(u) && (o = Se.left + Z(i, l), r = Math.min(r, s(t).map(u)), a = me(l), e.push({
2598
2646
  label: t.label,
2599
2647
  value: u,
2600
- color: t.color ?? dn[c % dn.length]
2648
+ color: t.color ?? mn[c % mn.length]
2601
2649
  }));
2602
2650
  }), e.length !== 0 && t.push({
2603
2651
  id: `x-${n}`,
2604
2652
  cx: o,
2605
- cy: Z.top + (r === Infinity ? 0 : r),
2653
+ cy: Se.top + (r === Infinity ? 0 : r),
2606
2654
  label: a,
2607
2655
  value: a,
2608
2656
  segments: e
@@ -2614,93 +2662,93 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
2614
2662
  format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
2615
2663
  };
2616
2664
  }
2617
- return { points: U.flatMap((e) => oe.value.has(e.id) ? [] : e.data.map((t, n) => ({
2665
+ return { points: G.flatMap((e) => ie.value.has(e.id) ? [] : e.data.map((t, n) => ({
2618
2666
  id: `${e.id}-${n}`,
2619
- cx: Z.left + X(i, t),
2620
- cy: Z.top + s(e).map(J(e)(t)),
2621
- label: he(t),
2622
- value: J(e)(t),
2667
+ cx: Se.left + Z(i, t),
2668
+ cy: Se.top + s(e).map(Y(e)(t)),
2669
+ label: me(t),
2670
+ value: Y(e)(t),
2623
2671
  seriesId: e.id
2624
2672
  }))) };
2625
2673
  } : void 0,
2626
- onSelect: k,
2627
- zoom: te && z > 1 ? {
2628
- window: V,
2629
- count: z
2674
+ onSelect: A,
2675
+ zoom: ee && V > 1 ? {
2676
+ window: U,
2677
+ count: V
2630
2678
  } : void 0,
2631
- toolbox: ie,
2632
- onRestore: B ? () => {
2633
- V.value = [0, Math.max(0, z - 1)];
2679
+ toolbox: L,
2680
+ onRestore: H ? () => {
2681
+ U.value = [0, Math.max(0, V - 1)];
2634
2682
  } : void 0,
2635
2683
  children: ({ width: e, height: t }) => {
2636
- let n = e - Z.left - Z.right, r = t - Z.top - Z.bottom, i = me(n), a = g([ge, _e], [r, 0]), o = W ? g([ve, ye], [r, 0]) : a, s = [];
2637
- return u && (s = P(U.map((e) => e.data.map((t) => J(e)(t))))), /* @__PURE__ */ h("g", { children: [f !== "solid" && /* @__PURE__ */ m(Pt, {
2638
- prefix: I,
2684
+ let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = g([he, ge], [r, 0]), o = K ? g([_e, ve], [r, 0]) : a, s = [];
2685
+ return u && (s = ne(G.map((e) => e.data.map((t) => Y(e)(t))))), /* @__PURE__ */ h("g", { children: [f !== "solid" && /* @__PURE__ */ m(Lt, {
2686
+ prefix: re,
2639
2687
  fill: f,
2640
2688
  patternKind: _,
2641
- series: U.map((e, t) => ({
2689
+ series: G.map((e, t) => ({
2642
2690
  id: e.id,
2643
- color: e.color ?? dn[t % dn.length]
2691
+ color: e.color ?? mn[t % mn.length]
2644
2692
  }))
2645
2693
  }), /* @__PURE__ */ h("g", {
2646
- transform: `translate(${Z.left},${Z.top})`,
2694
+ transform: `translate(${Se.left},${Se.top})`,
2647
2695
  children: [
2648
- !E && /* @__PURE__ */ m(bt, {
2696
+ !T && /* @__PURE__ */ m(Ct, {
2649
2697
  scale: a,
2650
2698
  orientation: "y",
2651
2699
  length: n,
2652
2700
  tickCount: x
2653
2701
  }),
2654
- !E && Tt(O, {
2702
+ !T && Ot(D, {
2655
2703
  xScale: i,
2656
2704
  yScale: a,
2657
2705
  innerW: n,
2658
2706
  innerH: r
2659
2707
  }),
2660
- U.map((e, t) => {
2661
- if (oe.value.has(e.id)) return null;
2662
- let n = e.color ?? dn[t % dn.length], r, c;
2708
+ G.map((e, t) => {
2709
+ if (ie.value.has(e.id)) return null;
2710
+ let n = e.color ?? mn[t % mn.length], r, c;
2663
2711
  if (u && s[t]) {
2664
2712
  let o = s[t];
2665
- r = e.data.map((e, t) => [X(i, e), a.map(o[t][1])]);
2666
- let l = e.data.map((e, t) => [X(i, e), a.map(o[t][0])]);
2713
+ r = e.data.map((e, t) => [Z(i, e), a.map(o[t][1])]);
2714
+ let l = e.data.map((e, t) => [Z(i, e), a.map(o[t][0])]);
2667
2715
  c = a.map(0);
2668
- let u = D(r, d), p = l[l.length - 1], g = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${p[0]},${p[1]}${_}L${g[0]},${g[1]}Z`;
2716
+ let u = k(r, d), p = l[l.length - 1], g = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${p[0]},${p[1]}${_}L${g[0]},${g[1]}Z`;
2669
2717
  return /* @__PURE__ */ h("g", {
2670
2718
  "data-series": e.id,
2671
2719
  children: [
2672
2720
  /* @__PURE__ */ m("path", {
2673
2721
  d: v,
2674
- fill: Nt(I, e.id, f, n),
2675
- style: f === "solid" ? q : void 0,
2722
+ fill: It(re, e.id, f, n),
2723
+ style: f === "solid" ? J : void 0,
2676
2724
  stroke: "none"
2677
2725
  }),
2678
2726
  /* @__PURE__ */ m("path", {
2679
- d: D(r, d),
2727
+ d: k(r, d),
2680
2728
  fill: "none",
2681
2729
  stroke: n,
2682
2730
  strokeWidth: 2
2683
2731
  }),
2684
- L && r.map((t, n) => /* @__PURE__ */ m(kt, {
2732
+ z && r.map((t, n) => /* @__PURE__ */ m(Mt, {
2685
2733
  x: t[0],
2686
2734
  y: t[1] - 8,
2687
- text: L.format(J(e)(e.data[n]))
2735
+ text: z.format(Y(e)(e.data[n]))
2688
2736
  }, n))
2689
2737
  ]
2690
2738
  }, e.id);
2691
2739
  } else {
2692
2740
  let t = e.axis === "right" ? o : a;
2693
- if (r = e.data.map((n) => [X(i, n), t.map(J(e)(n))]), c = t.map(0), R && r.length > R.threshold) {
2694
- let t = Re(r, R.threshold, R.method).map((e) => [e[0], e[1]]);
2741
+ if (r = e.data.map((n) => [Z(i, n), t.map(Y(e)(n))]), c = t.map(0), B && r.length > B.threshold) {
2742
+ let t = Be(r, B.threshold, B.method).map((e) => [e[0], e[1]]);
2695
2743
  return /* @__PURE__ */ h("g", {
2696
2744
  "data-series": e.id,
2697
- children: [/* @__PURE__ */ m("path", {
2698
- d: ne(t, c, d),
2699
- fill: Nt(I, e.id, f, n),
2700
- style: f === "solid" ? q : void 0,
2745
+ children: [e.type !== "line" && /* @__PURE__ */ m("path", {
2746
+ d: F(t, c, d),
2747
+ fill: It(re, e.id, f, n),
2748
+ style: f === "solid" ? J : void 0,
2701
2749
  stroke: "none"
2702
2750
  }), /* @__PURE__ */ m("path", {
2703
- d: D(t, d),
2751
+ d: k(t, d),
2704
2752
  fill: "none",
2705
2753
  stroke: n,
2706
2754
  strokeWidth: 2
@@ -2710,35 +2758,35 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
2710
2758
  return /* @__PURE__ */ h("g", {
2711
2759
  "data-series": e.id,
2712
2760
  children: [
2713
- /* @__PURE__ */ m("path", {
2714
- d: ne(r, c, d),
2715
- fill: Nt(I, e.id, f, n),
2716
- style: f === "solid" ? q : void 0,
2761
+ e.type !== "line" && /* @__PURE__ */ m("path", {
2762
+ d: F(r, c, d),
2763
+ fill: It(re, e.id, f, n),
2764
+ style: f === "solid" ? J : void 0,
2717
2765
  stroke: "none"
2718
2766
  }),
2719
2767
  /* @__PURE__ */ m("path", {
2720
- d: D(r, d),
2768
+ d: k(r, d),
2721
2769
  fill: "none",
2722
2770
  stroke: n,
2723
2771
  strokeWidth: 2
2724
2772
  }),
2725
- L && r.map((t, n) => /* @__PURE__ */ m(kt, {
2773
+ z && r.map((t, n) => /* @__PURE__ */ m(Mt, {
2726
2774
  x: t[0],
2727
2775
  y: t[1] - 8,
2728
- text: L.format(J(e)(e.data[n]))
2776
+ text: z.format(Y(e)(e.data[n]))
2729
2777
  }, n))
2730
2778
  ]
2731
2779
  }, e.id);
2732
2780
  }
2733
2781
  }),
2734
- !E && /* @__PURE__ */ h(p, { children: [
2782
+ !T && /* @__PURE__ */ h(p, { children: [
2735
2783
  /* @__PURE__ */ m($, {
2736
2784
  scale: i,
2737
2785
  orientation: "x",
2738
2786
  length: n,
2739
2787
  tickCount: b,
2740
2788
  transform: `translate(0,${r})`,
2741
- ...ae ? { format: ae } : {}
2789
+ ...R ? { format: R } : {}
2742
2790
  }),
2743
2791
  /* @__PURE__ */ m($, {
2744
2792
  scale: a,
@@ -2746,16 +2794,16 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
2746
2794
  length: r,
2747
2795
  tickCount: x
2748
2796
  }),
2749
- W && /* @__PURE__ */ m($, {
2797
+ K && /* @__PURE__ */ m($, {
2750
2798
  scale: o,
2751
2799
  orientation: "y-right",
2752
2800
  length: r,
2753
2801
  tickCount: x,
2754
2802
  transform: `translate(${n},0)`,
2755
- ...F?.format ? { format: (e) => F.format(Number(e)) } : {},
2756
- ...F?.label !== void 0 && F.label !== "" ? {
2757
- title: F.label,
2758
- titleOffset: 8 + Math.ceil(xe.reduce((e, t) => Math.max(e, t.length), 0) * 6.5) + 10
2803
+ ...P?.format ? { format: (e) => P.format(Number(e)) } : {},
2804
+ ...P?.label !== void 0 && P.label !== "" ? {
2805
+ title: P.label,
2806
+ titleOffset: 8 + Math.ceil(be.reduce((e, t) => Math.max(e, t.length), 0) * 6.5) + 10
2759
2807
  } : {}
2760
2808
  })
2761
2809
  ] })
@@ -2763,50 +2811,50 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
2763
2811
  })] });
2764
2812
  }
2765
2813
  }),
2766
- A && !j && z > 1 && /* @__PURE__ */ m(Vt, {
2767
- count: z,
2768
- window: V,
2814
+ j && !M && V > 1 && /* @__PURE__ */ m(Wt, {
2815
+ count: V,
2816
+ window: U,
2769
2817
  label: "Range"
2770
2818
  }),
2771
- j && z > 1 && /* @__PURE__ */ m(Ht, {
2772
- count: z,
2773
- window: V,
2819
+ M && V > 1 && /* @__PURE__ */ m(Gt, {
2820
+ count: V,
2821
+ window: U,
2774
2822
  label: "Range"
2775
2823
  }),
2776
- K && /* @__PURE__ */ m($t, {
2777
- series: U.map((e, t) => ({
2824
+ ae && /* @__PURE__ */ m(nn, {
2825
+ series: G.map((e, t) => ({
2778
2826
  id: e.id,
2779
2827
  label: e.label,
2780
- color: e.color ?? dn[t % dn.length]
2828
+ color: e.color ?? mn[t % mn.length]
2781
2829
  })),
2782
- hidden: oe
2830
+ hidden: ie
2783
2831
  })
2784
2832
  ]
2785
2833
  });
2786
2834
  }
2787
2835
  //#endregion
2788
2836
  //#region src/charts/bar-chart/bar-chart.tsx
2789
- function pn(e, t, n, r) {
2837
+ function gn(e, t, n, r) {
2790
2838
  return typeof e == "function" ? t === void 0 ? r : e(t, n) : e ?? r;
2791
2839
  }
2792
- var mn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
2793
- function hn(e) {
2840
+ var _n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
2841
+ function vn(e) {
2794
2842
  let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
2795
2843
  return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
2796
2844
  }
2797
- function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o = "vertical", mode: l = "grouped", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, valueAxisTicks: y, categoryAxisTicks: b, xLabelEvery: x, categoryLabelEvery: S, legend: C, tooltip: w, tooltipFormat: T, className: E, plain: D, annotations: O, labels: ee, onSelect: k, fill: A = "solid", patternKind: j, format: te }) {
2845
+ function yn({ series: e, x: t, y: n, title: r, description: i, orientation: o = "vertical", mode: l = "grouped", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, valueAxisTicks: y, categoryAxisTicks: b, xLabelEvery: x, categoryLabelEvery: S, legend: C, tooltip: w, tooltipFormat: T, className: E, plain: D, annotations: O, labels: k, onSelect: A, fill: j = "solid", patternKind: M, format: ee }) {
2798
2846
  s();
2799
- let M = c(), ne = D ? null : Ot(ee), N = a(/* @__PURE__ */ new Set()), F = d ?? (D ? 48 : 300), re = D ? !1 : C ?? e.length > 1, ie = (e) => e.y ?? n, ae = (e[0]?.data ?? []).map((e) => t(e)), I = e.flatMap((e) => e.data.map((t) => ie(e)(t))), oe = ae.length > 0, L = l === "stacked" || l === "percent", R = ae.map((t, n) => e.reduce((e, t) => e + ie(t)(t.data[n]), 0)), z = () => {
2800
- let t = P(e.map((e) => e.data.map((t) => ie(e)(t))));
2847
+ let N = c(), te = D ? null : jt(k), P = a(/* @__PURE__ */ new Set()), F = d ?? (D ? 48 : 300), I = D ? !1 : C ?? e.length > 1, L = (e) => e.y ?? n, R = (e[0]?.data ?? []).map((e) => t(e)), re = e.flatMap((e) => e.data.map((t) => L(e)(t))), ie = R.length > 0, z = l === "stacked" || l === "percent", B = R.map((t, n) => e.reduce((e, t) => e + L(t)(t.data[n]), 0)), V = () => {
2848
+ let t = ne(e.map((e) => e.data.map((t) => L(e)(t))));
2801
2849
  return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
2802
- let r = R[n] || 1;
2850
+ let r = B[n] || 1;
2803
2851
  return [e / r, t / r];
2804
2852
  })) : t;
2805
- }, B = L ? 0 : Math.min(0, ...I), V = oe ? Math.max(...R) : 1, H = l === "percent" ? 1 : l === "stacked" ? V : Math.max(1, ...I), U = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, W = o === "vertical", G = (W ? y : b) ?? _, K = (W ? b : y) ?? f, q = S ?? x, J = W ? g([B, H], [0, 1]).ticks(G).map((e) => U ? U(e) : e.toLocaleString()) : ae.map((e) => String(e)), se = W ? ae.map((e) => String(e)) : g([B, H], [0, 1]).ticks(K).map((e) => U ? U(e) : e.toLocaleString()), Y = D ? We : {
2806
- ...Ue,
2807
- left: Ke(J, D),
2808
- right: qe({
2809
- bottomAxisLabels: se,
2853
+ }, H = z ? 0 : Math.min(0, ...re), U = ie ? Math.max(...B) : 1, W = l === "percent" ? 1 : l === "stacked" ? U : Math.max(1, ...re), G = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, K = o === "vertical", q = (K ? y : b) ?? _, ae = (K ? b : y) ?? f, J = S ?? x, Y = K ? g([H, W], [0, 1]).ticks(q).map((e) => G ? G(e) : e.toLocaleString()) : R.map((e) => String(e)), oe = K ? R.map((e) => String(e)) : g([H, W], [0, 1]).ticks(ae).map((e) => G ? G(e) : e.toLocaleString()), X = D ? Ke : {
2854
+ ...Ge,
2855
+ left: Je(Y, D),
2856
+ right: Ye({
2857
+ bottomAxisLabels: oe,
2810
2858
  plain: D
2811
2859
  })
2812
2860
  };
@@ -2824,20 +2872,20 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
2824
2872
  fallback: /* @__PURE__ */ h("table", { children: [
2825
2873
  /* @__PURE__ */ m("caption", { children: r }),
2826
2874
  /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
2827
- /* @__PURE__ */ m("tbody", { children: ae.map((t, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: t }), e.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : ie(e)(e.data[n]) }, e.id))] }, t)) })
2875
+ /* @__PURE__ */ m("tbody", { children: R.map((t, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: t }), e.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : L(e)(e.data[n]) }, e.id))] }, t)) })
2828
2876
  ] }),
2829
2877
  className: E,
2830
- "data-state": oe ? void 0 : "empty",
2878
+ "data-state": ie ? void 0 : "empty",
2831
2879
  plain: D,
2832
- tooltip: w && oe ? ({ width: n, height: r }) => {
2833
- if (!w || !oe) return;
2834
- let i = n - Y.left - Y.right, a = r - Y.top - Y.bottom, s = o === "vertical", c = v(ae, s ? [0, i] : [0, a], .2), u = g([B, H], s ? [a, 0] : [0, i]), d = e.filter((e) => !N.value.has(e.id)), f = [];
2835
- L && (f = z());
2836
- let p = L && !T, m = ae.map((t, n) => {
2880
+ tooltip: w && ie ? ({ width: n, height: r }) => {
2881
+ if (!w || !ie) return;
2882
+ let i = n - X.left - X.right, a = r - X.top - X.bottom, s = o === "vertical", c = v(R, s ? [0, i] : [0, a], .2), u = g([H, W], s ? [a, 0] : [0, i]), d = e.filter((e) => !P.value.has(e.id)), f = [];
2883
+ z && (f = V());
2884
+ let p = z && !T, m = R.map((t, n) => {
2837
2885
  let r = d.map((t) => ({
2838
2886
  label: t.label,
2839
- value: ie(t)(t.data[n]),
2840
- color: pn(t.color, t.data[n], n, mn[e.indexOf(t) % mn.length])
2887
+ value: L(t)(t.data[n]),
2888
+ color: gn(t.color, t.data[n], n, _n[e.indexOf(t) % _n.length])
2841
2889
  }));
2842
2890
  return {
2843
2891
  segs: r,
@@ -2847,71 +2895,71 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
2847
2895
  let r = e.indexOf(n), i = l === "grouped" ? c.bandwidth / d.length : c.bandwidth;
2848
2896
  return n.data.map((e, a) => {
2849
2897
  let o = c.map(t(e)) ?? 0, h, g;
2850
- if (L && f[r]) {
2898
+ if (z && f[r]) {
2851
2899
  let e = f[r][a];
2852
2900
  h = e[1], g = e[0];
2853
- } else h = ie(n)(e), g = B;
2901
+ } else h = L(n)(e), g = H;
2854
2902
  let _ = d.indexOf(n), v = o + (l === "grouped" ? _ * i : 0) + i / 2, y = (Math.min(u.map(h), u.map(g)) + Math.max(u.map(h), u.map(g))) / 2;
2855
2903
  return {
2856
2904
  id: `${n.id}-${a}`,
2857
- cx: Y.left + (s ? v : y),
2858
- cy: Y.top + (s ? y : v),
2905
+ cx: X.left + (s ? v : y),
2906
+ cy: X.top + (s ? y : v),
2859
2907
  label: t(e),
2860
- value: p ? m[a].total : ie(n)(e),
2908
+ value: p ? m[a].total : L(n)(e),
2861
2909
  seriesId: n.id,
2862
2910
  ...p && { segments: m[a].segs }
2863
2911
  };
2864
2912
  });
2865
- }), _ = T ?? (p ? hn : void 0);
2913
+ }), _ = T ?? (p ? vn : void 0);
2866
2914
  return _ ? {
2867
2915
  points: h,
2868
2916
  format: _
2869
2917
  } : { points: h };
2870
2918
  } : void 0,
2871
- onSelect: k,
2919
+ onSelect: A,
2872
2920
  children: ({ width: n, height: r }) => {
2873
- let i = n - Y.left - Y.right, a = r - Y.top - Y.bottom, s = o === "vertical", c = q ?? Ye(ae, s ? i : a, s ? "horizontal" : "vertical"), u = v(ae, s ? [0, i] : [0, a], .2), d = g([B, H], s ? [a, 0] : [0, i]), f = e.filter((e) => !N.value.has(e.id)), _ = [];
2874
- return L && (_ = z()), /* @__PURE__ */ h("g", { children: [A !== "solid" && /* @__PURE__ */ m(Pt, {
2875
- prefix: M,
2876
- fill: A,
2877
- patternKind: j,
2921
+ let i = n - X.left - X.right, a = r - X.top - X.bottom, s = o === "vertical", c = J ?? Ze(R, s ? i : a, s ? "horizontal" : "vertical"), u = v(R, s ? [0, i] : [0, a], .2), d = g([H, W], s ? [a, 0] : [0, i]), f = e.filter((e) => !P.value.has(e.id)), _ = [];
2922
+ return z && (_ = V()), /* @__PURE__ */ h("g", { children: [j !== "solid" && /* @__PURE__ */ m(Lt, {
2923
+ prefix: N,
2924
+ fill: j,
2925
+ patternKind: M,
2878
2926
  series: e.map((e, t) => ({
2879
2927
  id: e.id,
2880
- color: pn(e.color, e.data[0], 0, mn[t % mn.length])
2928
+ color: gn(e.color, e.data[0], 0, _n[t % _n.length])
2881
2929
  }))
2882
2930
  }), /* @__PURE__ */ h("g", {
2883
- transform: `translate(${Y.left},${Y.top})`,
2931
+ transform: `translate(${X.left},${X.top})`,
2884
2932
  children: [
2885
- !D && s && /* @__PURE__ */ m(bt, {
2933
+ !D && s && /* @__PURE__ */ m(Ct, {
2886
2934
  scale: d,
2887
2935
  orientation: "y",
2888
2936
  length: i,
2889
- tickCount: G
2937
+ tickCount: q
2890
2938
  }),
2891
- !D && !s && /* @__PURE__ */ m(bt, {
2939
+ !D && !s && /* @__PURE__ */ m(Ct, {
2892
2940
  scale: d,
2893
2941
  orientation: "x",
2894
2942
  length: a,
2895
- tickCount: K
2943
+ tickCount: ae
2896
2944
  }),
2897
- !D && Tt(O, {
2945
+ !D && Ot(O, {
2898
2946
  xScale: s ? u : d,
2899
2947
  yScale: s ? d : u,
2900
2948
  innerW: i,
2901
2949
  innerH: a
2902
2950
  }),
2903
2951
  f.map((n, r) => {
2904
- let i = mn[e.indexOf(n) % mn.length], a = e.indexOf(n), o = l === "grouped" ? u.bandwidth / f.length : u.bandwidth;
2952
+ let i = _n[e.indexOf(n) % _n.length], a = e.indexOf(n), o = l === "grouped" ? u.bandwidth / f.length : u.bandwidth;
2905
2953
  return n.data.map((e, c) => {
2906
2954
  let f = u.map(t(e)) ?? 0, p, g;
2907
- if (L && _[a]) {
2955
+ if (z && _[a]) {
2908
2956
  let e = _[a][c];
2909
2957
  p = e[1], g = e[0];
2910
- } else p = ie(n)(e), g = B;
2958
+ } else p = L(n)(e), g = H;
2911
2959
  let v = f + (l === "grouped" ? r * o : 0), y = Math.min(d.map(p), d.map(g)), b = Math.abs(d.map(p) - d.map(g)), x = null;
2912
- if (ne) {
2913
- let t = ne.format(ie(n)(e)), r = v + o / 2, i = L || b < 18 || y < 14;
2914
- if (s) x = /* @__PURE__ */ m(kt, {
2960
+ if (te) {
2961
+ let t = te.format(L(n)(e)), r = v + o / 2, i = z || b < 18 || y < 14;
2962
+ if (s) x = /* @__PURE__ */ m(Mt, {
2915
2963
  x: r,
2916
2964
  y: i ? y + 13 : y - 4,
2917
2965
  text: t,
@@ -2919,7 +2967,7 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
2919
2967
  });
2920
2968
  else {
2921
2969
  let e = y + b;
2922
- x = /* @__PURE__ */ m(kt, {
2970
+ x = /* @__PURE__ */ m(Mt, {
2923
2971
  x: i ? e - 4 : e + 4,
2924
2972
  y: r + 4,
2925
2973
  text: t,
@@ -2927,15 +2975,15 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
2927
2975
  tone: i ? "muted" : "default"
2928
2976
  });
2929
2977
  }
2930
- L && b < 14 && (x = null);
2978
+ z && b < 14 && (x = null);
2931
2979
  }
2932
- let S = pn(n.color, e, c, i);
2980
+ let S = gn(n.color, e, c, i);
2933
2981
  return /* @__PURE__ */ h("g", { children: [s ? /* @__PURE__ */ m("rect", {
2934
2982
  x: v,
2935
2983
  y,
2936
2984
  width: o,
2937
2985
  height: b,
2938
- fill: Nt(M, n.id, A, S),
2986
+ fill: It(N, n.id, j, S),
2939
2987
  rx: 2,
2940
2988
  "data-series": n.id,
2941
2989
  "data-x": String(t(e))
@@ -2944,7 +2992,7 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
2944
2992
  y: v,
2945
2993
  width: b,
2946
2994
  height: o,
2947
- fill: Nt(M, n.id, A, S),
2995
+ fill: It(N, n.id, j, S),
2948
2996
  rx: 2,
2949
2997
  "data-series": n.id,
2950
2998
  "data-x": String(t(e))
@@ -2955,55 +3003,55 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
2955
3003
  scale: u,
2956
3004
  orientation: "x",
2957
3005
  length: i,
2958
- tickCount: K,
3006
+ tickCount: ae,
2959
3007
  labelEvery: c,
2960
3008
  transform: `translate(0,${a})`,
2961
- ...te ? { format: te } : {}
3009
+ ...ee ? { format: ee } : {}
2962
3010
  }), /* @__PURE__ */ m($, {
2963
3011
  scale: d,
2964
3012
  orientation: "y",
2965
3013
  length: a,
2966
- tickCount: G,
2967
- ...U && { format: U }
3014
+ tickCount: q,
3015
+ ...G && { format: G }
2968
3016
  })] }),
2969
3017
  !D && !s && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m($, {
2970
3018
  scale: d,
2971
3019
  orientation: "x",
2972
3020
  length: i,
2973
- tickCount: K,
2974
- ...U && { format: U },
3021
+ tickCount: ae,
3022
+ ...G && { format: G },
2975
3023
  transform: `translate(0,${a})`
2976
3024
  }), /* @__PURE__ */ m($, {
2977
3025
  scale: u,
2978
3026
  orientation: "y",
2979
3027
  length: a,
2980
- tickCount: G,
3028
+ tickCount: q,
2981
3029
  labelEvery: c
2982
3030
  })] })
2983
3031
  ]
2984
3032
  })] });
2985
3033
  }
2986
- }), re && /* @__PURE__ */ m($t, {
3034
+ }), I && /* @__PURE__ */ m(nn, {
2987
3035
  series: e.map((e, t) => ({
2988
3036
  id: e.id,
2989
3037
  label: e.label,
2990
- color: pn(e.color, e.data[0], 0, mn[t % mn.length])
3038
+ color: gn(e.color, e.data[0], 0, _n[t % _n.length])
2991
3039
  })),
2992
- hidden: N
3040
+ hidden: P
2993
3041
  })]
2994
3042
  });
2995
3043
  }
2996
3044
  //#endregion
2997
3045
  //#region src/charts/pie-chart/pie-chart.tsx
2998
- function _n(e) {
3046
+ function bn(e) {
2999
3047
  let t = e.percent == null ? 0 : Math.round(e.percent);
3000
3048
  return `${e.value} (${t}%)`;
3001
3049
  }
3002
- var vn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
3003
- function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height: o, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: f, centerSlot: p, emptyLabel: g, tooltip: _, tooltipFormat: v, legend: y, className: b, plain: x, labels: S, onSelect: C }) {
3004
- let w = x ? null : Ot(S), E = typeof S == "object" && !!S && S.format != null, D = i ?? c, O = o ?? c ?? (x ? 48 : 300), ee = x ? !1 : y ?? !0;
3050
+ var xn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
3051
+ function Sn({ data: e, title: t, description: n, donut: r = !1, width: i, height: o, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: f, centerSlot: p, emptyLabel: g, tooltip: _, tooltipFormat: v, legend: y, className: b, plain: x, labels: S, onSelect: C }) {
3052
+ let w = x ? null : jt(S), T = typeof S == "object" && !!S && S.format != null, E = i ?? c, O = o ?? c ?? (x ? 48 : 300), k = x ? !1 : y ?? !0;
3005
3053
  s();
3006
- let k = a(/* @__PURE__ */ new Set()), A = e.length > 0;
3054
+ let A = a(/* @__PURE__ */ new Set()), j = e.length > 0;
3007
3055
  return /* @__PURE__ */ h("div", {
3008
3056
  style: {
3009
3057
  display: "flex",
@@ -3013,7 +3061,7 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
3013
3061
  children: [/* @__PURE__ */ m(Q, {
3014
3062
  title: t,
3015
3063
  description: n,
3016
- width: D,
3064
+ width: E,
3017
3065
  height: O,
3018
3066
  fallback: /* @__PURE__ */ h("table", { children: [
3019
3067
  /* @__PURE__ */ m("caption", { children: t }),
@@ -3032,34 +3080,34 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
3032
3080
  }) })
3033
3081
  ] }),
3034
3082
  className: b,
3035
- "data-state": A ? void 0 : "empty",
3083
+ "data-state": j ? void 0 : "empty",
3036
3084
  emptyLabel: g,
3037
3085
  plain: x,
3038
- tooltip: _ !== !1 && A ? ({ width: t, height: n }) => {
3039
- if (!A) return;
3040
- let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !k.value.has(e.id)), s = o.reduce((e, t) => e + t.value, 0), c = 0;
3086
+ tooltip: _ !== !1 && j ? ({ width: t, height: n }) => {
3087
+ if (!j) return;
3088
+ let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !A.value.has(e.id)), s = o.reduce((e, t) => e + t.value, 0), c = 0;
3041
3089
  return {
3042
3090
  points: o.map((e, t) => {
3043
3091
  let n = s > 0 ? e.value / s * 2 * Math.PI : 0, o = c + n, l = (c + o) / 2;
3044
3092
  return c = o, {
3045
3093
  id: e.id,
3046
- cx: T(r + Math.sin(l) * a * .65),
3047
- cy: T(i - Math.cos(l) * a * .65),
3094
+ cx: D(r + Math.sin(l) * a * .65),
3095
+ cy: D(i - Math.cos(l) * a * .65),
3048
3096
  label: e.label,
3049
3097
  value: e.value,
3050
3098
  seriesId: String(t),
3051
3099
  percent: s > 0 ? e.value / s * 100 : 0,
3052
- color: e.color ?? vn[t % vn.length]
3100
+ color: e.color ?? xn[t % xn.length]
3053
3101
  };
3054
3102
  }),
3055
- format: v ?? _n
3103
+ format: v ?? bn
3056
3104
  };
3057
3105
  } : void 0,
3058
3106
  onSelect: C,
3059
3107
  children: ({ width: t, height: n }) => {
3060
- let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !k.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || f != null || p != null);
3108
+ let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !A.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || f != null || p != null);
3061
3109
  return /* @__PURE__ */ h("g", { children: [g.map((e, t) => {
3062
- let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? vn[t % vn.length], u = N(i, a, o, c, v, r);
3110
+ let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? xn[t % xn.length], u = I(i, a, o, c, v, r);
3063
3111
  v = r;
3064
3112
  let d = _ > 0 ? e.value / _ * 100 : 0, f = w && d >= 4, p = c > 0 ? (c + o) / 2 : o * .6;
3065
3113
  return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("path", {
@@ -3068,10 +3116,10 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
3068
3116
  stroke: "var(--cascivo-color-surface)",
3069
3117
  strokeWidth: 1,
3070
3118
  "data-series": e.id
3071
- }), f && /* @__PURE__ */ m(kt, {
3072
- x: T(i + Math.sin(s) * p),
3073
- y: T(a - Math.cos(s) * p + 4),
3074
- text: E ? w.format(e.value) : `${Math.round(d)}%`,
3119
+ }), f && /* @__PURE__ */ m(Mt, {
3120
+ x: D(i + Math.sin(s) * p),
3121
+ y: D(a - Math.cos(s) * p + 4),
3122
+ text: T ? w.format(e.value) : `${Math.round(d)}%`,
3075
3123
  tone: "muted"
3076
3124
  })] }, e.id);
3077
3125
  }), y && (p == null ? /* @__PURE__ */ h("g", {
@@ -3114,35 +3162,35 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
3114
3162
  })
3115
3163
  }))] });
3116
3164
  }
3117
- }), ee && /* @__PURE__ */ m($t, {
3165
+ }), k && /* @__PURE__ */ m(nn, {
3118
3166
  series: e.map((e, t) => ({
3119
3167
  id: e.id,
3120
3168
  label: e.label,
3121
- color: e.color ?? vn[t % vn.length]
3169
+ color: e.color ?? xn[t % xn.length]
3122
3170
  })),
3123
- hidden: k
3171
+ hidden: A
3124
3172
  })]
3125
3173
  });
3126
3174
  }
3127
3175
  //#endregion
3128
3176
  //#region src/charts/scatter-chart/scatter-chart.tsx
3129
- var bn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
3130
- function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: d, className: f, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C, format: w }) {
3177
+ var Cn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
3178
+ function wn({ series: e, title: t, description: n, r = 4, width: i, height: o, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: d, className: f, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C, format: w }) {
3131
3179
  s();
3132
- let T = a(/* @__PURE__ */ new Set()), E = _ ? We : Ue, D = o ?? (_ ? 48 : 300), O = _ ? !1 : u ?? e.length > 1, ee = e.reduce((e, t) => e + t.data.length, 0), k = !S && (x === "canvas" || x === "auto" && ee > 2e3), A = a([S?.min ?? 0, S?.max ?? 1]), j = a(/* @__PURE__ */ new Set()), te = (t, { width: n, height: i }) => {
3180
+ let T = a(/* @__PURE__ */ new Set()), E = _ ? Ke : Ge, D = o ?? (_ ? 48 : 300), O = _ ? !1 : u ?? e.length > 1, k = e.reduce((e, t) => e + t.data.length, 0), A = !S && (x === "canvas" || x === "auto" && k > 2e3), j = a([S?.min ?? 0, S?.max ?? 1]), M = a(/* @__PURE__ */ new Set()), ee = (t, { width: n, height: i }) => {
3133
3181
  let a = n - E.left - E.right, o = i - E.top - E.bottom;
3134
3182
  if (a <= 0 || o <= 0) return;
3135
- let s = g([P, F], [0, a]), c = g([re, ie], [o, 0]);
3183
+ let s = g([F, I], [0, a]), c = g([ne, L], [o, 0]);
3136
3184
  e.forEach((e, n) => {
3137
3185
  if (!T.value.has(e.id)) {
3138
- t.fillStyle = tt(t, e.color ?? bn[n % bn.length]), t.globalAlpha = .7;
3186
+ t.fillStyle = rt(t, e.color ?? Cn[n % Cn.length]), t.globalAlpha = .7;
3139
3187
  for (let n of e.data) {
3140
3188
  let e = typeof r == "function" ? r(n) : n.r ?? r;
3141
3189
  t.beginPath(), t.arc(E.left + s.map(n.x), E.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
3142
3190
  }
3143
3191
  }
3144
3192
  }), t.globalAlpha = 1;
3145
- }, M = e.flatMap((e) => e.data.map((e) => e.x)), ne = e.flatMap((e) => e.data.map((e) => e.y)), N = M.length > 0, P = N ? Math.min(...M) : 0, F = N ? Math.max(...M) : 1, re = N ? Math.min(0, ...ne) : 0, ie = N ? Math.max(...ne) : 1;
3193
+ }, N = e.flatMap((e) => e.data.map((e) => e.x)), te = e.flatMap((e) => e.data.map((e) => e.y)), P = N.length > 0, F = P ? Math.min(...N) : 0, I = P ? Math.max(...N) : 1, ne = P ? Math.min(0, ...te) : 0, L = P ? Math.max(...te) : 1;
3146
3194
  return /* @__PURE__ */ h("div", {
3147
3195
  style: {
3148
3196
  display: "flex",
@@ -3169,11 +3217,11 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
3169
3217
  ] }, `${e.id}-${n}`))) })
3170
3218
  ] }),
3171
3219
  className: f,
3172
- "data-state": N ? void 0 : "empty",
3220
+ "data-state": P ? void 0 : "empty",
3173
3221
  plain: _,
3174
- tooltip: d !== !1 && N ? ({ width: t, height: n }) => {
3175
- if (d === !1 || !N) return;
3176
- let r = t - E.left - E.right, i = n - E.top - E.bottom, a = g([P, F], [0, r]), o = g([re, ie], [i, 0]);
3222
+ tooltip: d !== !1 && P ? ({ width: t, height: n }) => {
3223
+ if (d === !1 || !P) return;
3224
+ let r = t - E.left - E.right, i = n - E.top - E.bottom, a = g([F, I], [0, r]), o = g([ne, L], [i, 0]);
3177
3225
  return { points: e.flatMap((e) => T.value.has(e.id) ? [] : e.data.map((t, n) => ({
3178
3226
  id: `${e.id}-${n}`,
3179
3227
  cx: E.left + a.map(t.x),
@@ -3185,37 +3233,37 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
3185
3233
  } : void 0,
3186
3234
  onSelect: y,
3187
3235
  hover: "voronoi",
3188
- renderer: k ? "canvas" : "svg",
3189
- paint: k ? te : void 0,
3236
+ renderer: A ? "canvas" : "svg",
3237
+ paint: A ? ee : void 0,
3190
3238
  toolbox: C,
3191
3239
  onRestore: S ? () => {
3192
- A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
3240
+ j.value = [S.min, S.max], M.value = /* @__PURE__ */ new Set();
3193
3241
  } : void 0,
3194
3242
  children: ({ width: t, height: n }) => {
3195
- let i = t - E.left - E.right, a = n - E.top - E.bottom, o = g([P, F], [0, i]), s = g([re, ie], [a, 0]);
3243
+ let i = t - E.left - E.right, a = n - E.top - E.bottom, o = g([F, I], [0, i]), s = g([ne, L], [a, 0]);
3196
3244
  return /* @__PURE__ */ m("g", { children: /* @__PURE__ */ h("g", {
3197
3245
  transform: `translate(${E.left},${E.top})`,
3198
3246
  children: [
3199
- !_ && /* @__PURE__ */ m(bt, {
3247
+ !_ && /* @__PURE__ */ m(Ct, {
3200
3248
  scale: s,
3201
3249
  orientation: "y",
3202
3250
  length: i,
3203
3251
  tickCount: l
3204
3252
  }),
3205
- !_ && Tt(v, {
3253
+ !_ && Ot(v, {
3206
3254
  xScale: o,
3207
3255
  yScale: s,
3208
3256
  innerW: i,
3209
3257
  innerH: a
3210
3258
  }),
3211
- !k && e.map((e, t) => {
3259
+ !A && e.map((e, t) => {
3212
3260
  if (T.value.has(e.id)) return null;
3213
- let n = e.color ?? bn[t % bn.length];
3261
+ let n = e.color ?? Cn[t % Cn.length];
3214
3262
  return /* @__PURE__ */ m("g", {
3215
3263
  "data-series": e.id,
3216
3264
  children: e.data.map((t, i) => {
3217
- let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ? Yt(t.y, S) : void 0, l = c?.size ?? a, u = c?.color ?? n, d = S ? Xt(t.y, S, A.value, j.value) : !0, f = d ? .7 : .1, p = typeof b == "function" ? b(t, e.id) : b;
3218
- return p && p !== "circle" ? /* @__PURE__ */ m(It, {
3265
+ let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ? Qt(t.y, S) : void 0, l = c?.size ?? a, u = c?.color ?? n, d = S ? $t(t.y, S, j.value, M.value) : !0, f = d ? .7 : .1, p = typeof b == "function" ? b(t, e.id) : b;
3266
+ return p && p !== "circle" ? /* @__PURE__ */ m(zt, {
3219
3267
  shape: p,
3220
3268
  x: o.map(t.x),
3221
3269
  y: s.map(t.y),
@@ -3253,17 +3301,17 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
3253
3301
  }) });
3254
3302
  }
3255
3303
  }),
3256
- S && N && /* @__PURE__ */ m(Zt, {
3304
+ S && P && /* @__PURE__ */ m(en, {
3257
3305
  options: S,
3258
- range: A,
3259
- hidden: j,
3306
+ range: j,
3307
+ hidden: M,
3260
3308
  label: t
3261
3309
  }),
3262
- O && /* @__PURE__ */ m($t, {
3310
+ O && /* @__PURE__ */ m(nn, {
3263
3311
  series: e.map((e, t) => ({
3264
3312
  id: e.id,
3265
3313
  label: e.label,
3266
- color: e.color ?? bn[t % bn.length]
3314
+ color: e.color ?? Cn[t % Cn.length]
3267
3315
  })),
3268
3316
  hidden: T
3269
3317
  })
@@ -3272,7 +3320,7 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
3272
3320
  }
3273
3321
  //#endregion
3274
3322
  //#region src/charts/sparkline/sparkline.tsx
3275
- function Sn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, color: a = "var(--cascivo-chart-1)", endDot: o = !0 }) {
3323
+ function Tn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, color: a = "var(--cascivo-chart-1)", endDot: o = !0 }) {
3276
3324
  return /* @__PURE__ */ m(Q, {
3277
3325
  title: r ?? i,
3278
3326
  width: t,
@@ -3291,7 +3339,7 @@ function Sn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
3291
3339
  })() : void 0,
3292
3340
  children: () => {
3293
3341
  if (e.length === 0) return null;
3294
- let r = g([0, e.length - 1], [2, t - 2]), i = Math.min(...e), s = Math.max(...e), c = g([i === s ? i - 1 : i, s], [n - 2, 2]), l = e.map((e, t) => [r.map(t), c.map(e)]), u = D(l, "monotone"), d = l[l.length - 1];
3342
+ let r = g([0, e.length - 1], [2, t - 2]), i = Math.min(...e), s = Math.max(...e), c = g([i === s ? i - 1 : i, s], [n - 2, 2]), l = e.map((e, t) => [r.map(t), c.map(e)]), u = k(l, "monotone"), d = l[l.length - 1];
3295
3343
  return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("path", {
3296
3344
  d: u,
3297
3345
  fill: "none",
@@ -3308,7 +3356,7 @@ function Sn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
3308
3356
  }
3309
3357
  });
3310
3358
  }
3311
- var Cn = {
3359
+ var En = {
3312
3360
  meter: "_meter_cns3q_2",
3313
3361
  svg: "_svg_cns3q_9",
3314
3362
  label: "_label_cns3q_16",
@@ -3317,25 +3365,25 @@ var Cn = {
3317
3365
  };
3318
3366
  //#endregion
3319
3367
  //#region src/charts/meter/meter.tsx
3320
- function wn(e, t) {
3368
+ function Dn(e, t) {
3321
3369
  if (!t) return "var(--cascivo-chart-1)";
3322
3370
  let { warning: n, critical: r } = t;
3323
3371
  return r != null && e >= r ? "var(--cascivo-color-destructive)" : n != null && e >= n ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
3324
3372
  }
3325
- function Tn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o, height: s }) {
3326
- let { ref: c, width: l } = He(200, 100), u = o ?? l.value, d = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, f = wn(e, a);
3373
+ function On({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o, height: s }) {
3374
+ let { ref: c, width: l } = We(200, 100), u = o ?? l.value, d = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, f = Dn(e, a);
3327
3375
  if (i === "gauge") {
3328
- let i = s ?? 100, a = u, o = a / 2, l = i * .9, p = Math.min(o, l) - 4, g = p * .65, _ = Math.PI, v = N(o, l, p, g, _, 2 * Math.PI), y = _ + d * Math.PI, b = d > 0 ? N(o, l, p, g, _, y) : "";
3376
+ let i = s ?? 100, a = u, o = a / 2, l = i * .9, p = Math.min(o, l) - 4, g = p * .65, _ = Math.PI, v = I(o, l, p, g, _, 2 * Math.PI), y = _ + d * Math.PI, b = d > 0 ? I(o, l, p, g, _, y) : "";
3329
3377
  return /* @__PURE__ */ h("div", {
3330
3378
  ref: c,
3331
- className: Cn.meter,
3379
+ className: En.meter,
3332
3380
  "aria-label": r,
3333
3381
  role: "meter",
3334
3382
  "aria-valuenow": e,
3335
3383
  "aria-valuemin": t,
3336
3384
  "aria-valuemax": n,
3337
3385
  children: [/* @__PURE__ */ h("svg", {
3338
- className: Cn.svg,
3386
+ className: En.svg,
3339
3387
  width: a,
3340
3388
  height: i,
3341
3389
  viewBox: `0 0 ${a} ${i}`,
@@ -3348,7 +3396,7 @@ function Tn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
3348
3396
  fill: f
3349
3397
  })]
3350
3398
  }), /* @__PURE__ */ h("div", {
3351
- className: Cn.gaugeLabel,
3399
+ className: En.gaugeLabel,
3352
3400
  children: [
3353
3401
  r,
3354
3402
  ": ",
@@ -3360,14 +3408,14 @@ function Tn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
3360
3408
  let p = s ?? 12, g = u;
3361
3409
  return /* @__PURE__ */ h("div", {
3362
3410
  ref: c,
3363
- className: Cn.meter,
3411
+ className: En.meter,
3364
3412
  "aria-label": r,
3365
3413
  role: "meter",
3366
3414
  "aria-valuenow": e,
3367
3415
  "aria-valuemin": t,
3368
3416
  "aria-valuemax": n,
3369
3417
  children: [/* @__PURE__ */ h("svg", {
3370
- className: Cn.svg,
3418
+ className: En.svg,
3371
3419
  width: g,
3372
3420
  height: p,
3373
3421
  viewBox: `0 0 ${g} ${p}`,
@@ -3386,16 +3434,16 @@ function Tn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
3386
3434
  height: p,
3387
3435
  rx: p / 2,
3388
3436
  fill: f,
3389
- className: Cn.fill,
3437
+ className: En.fill,
3390
3438
  style: { transform: `scaleX(${d})` }
3391
3439
  })]
3392
3440
  }), /* @__PURE__ */ m("div", {
3393
- className: Cn.label,
3441
+ className: En.label,
3394
3442
  children: r
3395
3443
  })]
3396
3444
  });
3397
3445
  }
3398
- var En = {
3446
+ var kn = {
3399
3447
  kpi: "_kpi_nrb8p_7",
3400
3448
  head: "_head_nrb8p_19",
3401
3449
  label: "_label_nrb8p_27",
@@ -3405,20 +3453,20 @@ var En = {
3405
3453
  };
3406
3454
  //#endregion
3407
3455
  //#region src/charts/kpi/kpi.tsx
3408
- function Dn(e, t) {
3456
+ function An(e, t) {
3409
3457
  if (typeof t == "function") return t(e);
3410
3458
  let n = e >= 0 ? "+" : "", r = e.toLocaleString(d());
3411
3459
  return t === "percent" ? `${n}${r}%` : `${n}${r}`;
3412
3460
  }
3413
- function On({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirection: a = "up", deltaLabel: o, icon: s, sparkline: c, className: l }) {
3461
+ function jn({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirection: a = "up", deltaLabel: o, icon: s, sparkline: c, className: l }) {
3414
3462
  let u = r != null && r >= 0, f = r != null && r < 0, p = u ? "up" : f ? "down" : "flat";
3415
3463
  return /* @__PURE__ */ h("div", {
3416
- className: [En.kpi, l].filter(Boolean).join(" "),
3464
+ className: [kn.kpi, l].filter(Boolean).join(" "),
3417
3465
  children: [
3418
3466
  /* @__PURE__ */ h("div", {
3419
- className: En.head,
3467
+ className: kn.head,
3420
3468
  children: [/* @__PURE__ */ m("span", {
3421
- className: En.label,
3469
+ className: kn.label,
3422
3470
  children: t
3423
3471
  }), s && /* @__PURE__ */ m("span", {
3424
3472
  "aria-hidden": "true",
@@ -3426,25 +3474,25 @@ function On({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirec
3426
3474
  })]
3427
3475
  }),
3428
3476
  /* @__PURE__ */ h("div", {
3429
- className: En.valueRow,
3477
+ className: kn.valueRow,
3430
3478
  children: [/* @__PURE__ */ m("span", {
3431
- className: En.value,
3479
+ className: kn.value,
3432
3480
  children: typeof e == "number" ? e.toLocaleString(d()) : e
3433
3481
  }), r != null && /* @__PURE__ */ h("span", {
3434
3482
  role: "img",
3435
- className: En.delta,
3483
+ className: kn.delta,
3436
3484
  "data-trend": p,
3437
3485
  "data-sentiment": n(p, a),
3438
- "aria-label": `Trend: ${Dn(r, i)}${o ? ` ${o}` : ""}`,
3486
+ "aria-label": `Trend: ${An(r, i)}${o ? ` ${o}` : ""}`,
3439
3487
  children: [
3440
3488
  u ? "▲" : f ? "▼" : "–",
3441
3489
  " ",
3442
- Dn(r, i),
3490
+ An(r, i),
3443
3491
  o && ` ${o}`
3444
3492
  ]
3445
3493
  })]
3446
3494
  }),
3447
- c && c.length > 0 && /* @__PURE__ */ m(Sn, {
3495
+ c && c.length > 0 && /* @__PURE__ */ m(Tn, {
3448
3496
  data: c,
3449
3497
  label: `${t} trend`,
3450
3498
  height: 32
@@ -3454,9 +3502,9 @@ function On({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirec
3454
3502
  }
3455
3503
  //#endregion
3456
3504
  //#region src/charts/histogram/histogram.tsx
3457
- function kn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: o, className: c, plain: l, format: u }) {
3505
+ function Mn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: o, className: c, plain: l, format: u }) {
3458
3506
  s();
3459
- let d = l ? We : Ue, f = o ?? (l ? 48 : 300), _ = R(e, t), v = _.reduce((e, t) => Math.max(e, t.count), 0);
3507
+ let d = l ? Ke : Ge, f = o ?? (l ? 48 : 300), _ = H(e, t), v = _.reduce((e, t) => Math.max(e, t.count), 0);
3460
3508
  return /* @__PURE__ */ m(Q, {
3461
3509
  title: n,
3462
3510
  description: i,
@@ -3497,7 +3545,7 @@ function kn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
3497
3545
  return /* @__PURE__ */ h("g", {
3498
3546
  transform: `translate(${d.left},${d.top})`,
3499
3547
  children: [
3500
- !l && /* @__PURE__ */ m(bt, {
3548
+ !l && /* @__PURE__ */ m(Ct, {
3501
3549
  scale: i,
3502
3550
  orientation: "y",
3503
3551
  length: n.width
@@ -3531,13 +3579,13 @@ function kn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
3531
3579
  }
3532
3580
  //#endregion
3533
3581
  //#region src/charts/boxplot/boxplot.tsx
3534
- var An = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
3535
- function jn({ series: e, title: t, description: n, width: r, height: i, className: a, plain: o, format: c }) {
3582
+ var Nn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
3583
+ function Pn({ series: e, title: t, description: n, width: r, height: i, className: a, plain: o, format: c }) {
3536
3584
  s();
3537
- let l = o ? We : Ue, u = i ?? (o ? 48 : 320), d = e.map((e) => ({
3585
+ let l = o ? Ke : Ge, u = i ?? (o ? 48 : 320), d = e.map((e) => ({
3538
3586
  ...e,
3539
- stats: z(e.values)
3540
- })), f = e.flatMap((e) => e.values), [_, y] = f.length > 0 ? B(f) : [0, 1];
3587
+ stats: U(e.values)
3588
+ })), f = e.flatMap((e) => e.values), [_, y] = f.length > 0 ? W(f) : [0, 1];
3541
3589
  return /* @__PURE__ */ m(Q, {
3542
3590
  title: t,
3543
3591
  description: n,
@@ -3596,7 +3644,7 @@ function jn({ series: e, title: t, description: n, width: r, height: i, classNam
3596
3644
  return /* @__PURE__ */ h("g", {
3597
3645
  transform: `translate(${l.left},${l.top})`,
3598
3646
  children: [d.map((e, t) => {
3599
- let n = An[t % An.length] ?? "var(--cascivo-chart-1)", i = (r.map(e.id) ?? 0) + r.bandwidth / 2, o = r.bandwidth * .6, s = i - o / 2, c = a.map(e.stats.q1), l = a.map(e.stats.q3), u = a.map(e.stats.median), d = a.map(e.stats.min), f = a.map(e.stats.max);
3647
+ let n = Nn[t % Nn.length] ?? "var(--cascivo-chart-1)", i = (r.map(e.id) ?? 0) + r.bandwidth / 2, o = r.bandwidth * .6, s = i - o / 2, c = a.map(e.stats.q1), l = a.map(e.stats.q3), u = a.map(e.stats.median), d = a.map(e.stats.min), f = a.map(e.stats.max);
3600
3648
  return /* @__PURE__ */ h("g", { children: [
3601
3649
  /* @__PURE__ */ m("line", {
3602
3650
  x1: i,
@@ -3674,10 +3722,10 @@ function jn({ series: e, title: t, description: n, width: r, height: i, classNam
3674
3722
  }
3675
3723
  //#endregion
3676
3724
  //#region src/charts/bubble-chart/bubble-chart.tsx
3677
- var Mn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Nn = 3, Pn = 24;
3678
- function Fn({ series: e, title: t, description: n, width: r, height: i, tooltip: o, className: c, plain: l, glyph: u, format: d }) {
3725
+ var Fn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), In = 3, Ln = 24;
3726
+ function Rn({ series: e, title: t, description: n, width: r, height: i, tooltip: o, className: c, plain: l, glyph: u, format: d }) {
3679
3727
  s();
3680
- let f = a(null), _ = l ? We : Ue, v = i ?? (l ? 48 : 320), b = e.flatMap((e) => e.data), [x, S] = b.length > 0 ? B(b.map((e) => e.x)) : [0, 1], [C, w] = b.length > 0 ? B(b.map((e) => e.y)) : [0, 1], [T, E] = b.length > 0 ? B(b.map((e) => e.size)) : [0, 1], D = y([T, E], [Nn, Pn]), O = b.length > 0;
3728
+ let f = a(null), _ = l ? Ke : Ge, v = i ?? (l ? 48 : 320), b = e.flatMap((e) => e.data), [x, S] = b.length > 0 ? W(b.map((e) => e.x)) : [0, 1], [C, w] = b.length > 0 ? W(b.map((e) => e.y)) : [0, 1], [T, E] = b.length > 0 ? W(b.map((e) => e.size)) : [0, 1], D = y([T, E], [In, Ln]), O = b.length > 0;
3681
3729
  return /* @__PURE__ */ m(Q, {
3682
3730
  title: t,
3683
3731
  description: n,
@@ -3728,13 +3776,13 @@ function Fn({ series: e, title: t, description: n, width: r, height: i, tooltip:
3728
3776
  return /* @__PURE__ */ h("g", {
3729
3777
  transform: `translate(${_.left},${_.top})`,
3730
3778
  children: [
3731
- !l && /* @__PURE__ */ m(bt, {
3779
+ !l && /* @__PURE__ */ m(Ct, {
3732
3780
  scale: s,
3733
3781
  orientation: "y",
3734
3782
  length: r.width
3735
3783
  }),
3736
3784
  e.map((e, t) => {
3737
- let n = Mn[t % Mn.length] ?? "var(--cascivo-chart-1)";
3785
+ let n = Fn[t % Fn.length] ?? "var(--cascivo-chart-1)";
3738
3786
  return /* @__PURE__ */ m("g", {
3739
3787
  opacity: f.value !== null && f.value !== e.name ? .2 : 1,
3740
3788
  onMouseEnter: () => {
@@ -3745,7 +3793,7 @@ function Fn({ series: e, title: t, description: n, width: r, height: i, tooltip:
3745
3793
  },
3746
3794
  children: e.data.map((t, r) => {
3747
3795
  let i = typeof u == "function" ? u(t, e.name) : u;
3748
- return i && i !== "circle" ? /* @__PURE__ */ m("g", { children: /* @__PURE__ */ m(It, {
3796
+ return i && i !== "circle" ? /* @__PURE__ */ m("g", { children: /* @__PURE__ */ m(zt, {
3749
3797
  shape: i,
3750
3798
  x: o.map(t.x),
3751
3799
  y: s.map(t.y),
@@ -3784,22 +3832,22 @@ function Fn({ series: e, title: t, description: n, width: r, height: i, tooltip:
3784
3832
  }
3785
3833
  //#endregion
3786
3834
  //#region src/charts/combo-chart/combo-chart.tsx
3787
- var In = "var(--cascivo-chart-1)", Ln = "var(--cascivo-chart-2)";
3788
- function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, barsLabel: o = "Bars", lineLabel: c = "Line", legend: l, xLabelEvery: u, width: d, height: f, tooltip: _, className: y, plain: b, annotations: x, format: S }) {
3835
+ var zn = "var(--cascivo-chart-1)", Bn = "var(--cascivo-chart-2)";
3836
+ function Vn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, barsLabel: o = "Bars", lineLabel: c = "Line", legend: l, xLabelEvery: u, width: d, height: f, tooltip: _, className: y, plain: b, annotations: x, format: S }) {
3789
3837
  s();
3790
- let C = a(/* @__PURE__ */ new Set()), w = f ?? (b ? 48 : 320), T = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, E = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, O = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, ee = e.length > 0, k = b ? !1 : l ?? (e.length > 0 && t.length > 0);
3791
- t.length > 0 && e.length > 0 && t.length !== e.length && rn("ComboChart:length-mismatch", `ComboChart: \`line\` has ${t.length} point(s) but \`bars\` has ${e.length}. The two are correlated by array index, so the line is drawn against the wrong categories. Pass one line point per bar (use a null-valued point for a gap).`), !i && t.length > 0 && e.length > 0 && an("ComboChart", [{
3838
+ let C = a(/* @__PURE__ */ new Set()), w = f ?? (b ? 48 : 320), T = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, E = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, D = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, O = e.length > 0, A = b ? !1 : l ?? (e.length > 0 && t.length > 0);
3839
+ t.length > 0 && e.length > 0 && t.length !== e.length && sn("ComboChart:length-mismatch", `ComboChart: \`line\` has ${t.length} point(s) but \`bars\` has ${e.length}. The two are correlated by array index, so the line is drawn against the wrong categories. Pass one line point per bar (use a null-valued point for a gap).`), !i && t.length > 0 && e.length > 0 && cn("ComboChart", [{
3792
3840
  label: o,
3793
3841
  max: T
3794
3842
  }, {
3795
3843
  label: c,
3796
- max: O
3844
+ max: D
3797
3845
  }]);
3798
- let A = g([0, T], [0, 1]).ticks(5).map((e) => e.toLocaleString()), j = i ? g([E, O || E + 1], [0, 1]).ticks(5).map((e) => e.toLocaleString()) : [], te = e.map((e) => e.label), M = b ? We : {
3799
- ...Ue,
3800
- left: Ke(A, b),
3801
- right: qe({
3802
- rightAxisLabels: j,
3846
+ let j = g([0, T], [0, 1]).ticks(5).map((e) => e.toLocaleString()), M = i ? g([E, D || E + 1], [0, 1]).ticks(5).map((e) => e.toLocaleString()) : [], ee = e.map((e) => e.label), N = b ? Ke : {
3847
+ ...Ge,
3848
+ left: Je(j, b),
3849
+ right: Ye({
3850
+ rightAxisLabels: M,
3803
3851
  plain: b
3804
3852
  })
3805
3853
  };
@@ -3829,17 +3877,17 @@ function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
3829
3877
  ] }, e.label)) })
3830
3878
  ] }),
3831
3879
  plain: b,
3832
- tooltip: _ !== !1 && ee ? ({ width: n, height: r }) => {
3833
- if (_ === !1 || !ee) return;
3880
+ tooltip: _ !== !1 && O ? ({ width: n, height: r }) => {
3881
+ if (_ === !1 || !O) return;
3834
3882
  let a = {
3835
- width: n - M.left - M.right,
3836
- height: r - M.top - M.bottom
3883
+ width: n - N.left - N.right,
3884
+ height: r - N.top - N.bottom
3837
3885
  };
3838
3886
  if (a.width <= 0) return;
3839
- let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E, O || E + 1], [a.height, 0]) : s, l = e.map((e, t) => ({
3887
+ let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E, D || E + 1], [a.height, 0]) : s, l = e.map((e, t) => ({
3840
3888
  id: `bar-${t}`,
3841
- cx: M.left + (o.map(e.label) ?? 0) + o.bandwidth / 2,
3842
- cy: M.top + s.map(e.value),
3889
+ cx: N.left + (o.map(e.label) ?? 0) + o.bandwidth / 2,
3890
+ cy: N.top + s.map(e.value),
3843
3891
  label: e.label,
3844
3892
  value: e.value,
3845
3893
  seriesId: "bars"
@@ -3847,8 +3895,8 @@ function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
3847
3895
  let i = e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : a.width * n.x / Math.max(1, t.length - 1);
3848
3896
  return {
3849
3897
  id: `line-${r}`,
3850
- cx: M.left + i,
3851
- cy: M.top + c.map(n.y),
3898
+ cx: N.left + i,
3899
+ cy: N.top + c.map(n.y),
3852
3900
  label: e[r]?.label ?? String(n.x),
3853
3901
  value: n.y,
3854
3902
  seriesId: "line"
@@ -3858,20 +3906,20 @@ function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
3858
3906
  } : void 0,
3859
3907
  children: ({ width: n, height: r }) => {
3860
3908
  let a = {
3861
- width: n - M.left - M.right,
3862
- height: r - M.top - M.bottom
3909
+ width: n - N.left - N.right,
3910
+ height: r - N.top - N.bottom
3863
3911
  };
3864
3912
  if (a.width <= 0 || e.length === 0) return null;
3865
- let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E, O || E + 1], [a.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : a.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), d = l.length > 1 ? D(l, "monotone") : "", f = u ?? Ye(te, a.width), _ = C.value.has("bars"), y = C.value.has("line");
3913
+ let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E, D || E + 1], [a.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : a.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), d = l.length > 1 ? k(l, "monotone") : "", f = u ?? Ze(ee, a.width), _ = C.value.has("bars"), y = C.value.has("line");
3866
3914
  return /* @__PURE__ */ h("g", {
3867
- transform: `translate(${M.left},${M.top})`,
3915
+ transform: `translate(${N.left},${N.top})`,
3868
3916
  children: [
3869
- !b && /* @__PURE__ */ m(bt, {
3917
+ !b && /* @__PURE__ */ m(Ct, {
3870
3918
  scale: s,
3871
3919
  orientation: "y",
3872
3920
  length: a.width
3873
3921
  }),
3874
- !b && Tt(x, {
3922
+ !b && Ot(x, {
3875
3923
  xScale: o,
3876
3924
  yScale: s,
3877
3925
  innerW: a.width,
@@ -3884,14 +3932,14 @@ function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
3884
3932
  y: n,
3885
3933
  width: o.bandwidth,
3886
3934
  height: Math.max(0, a.height - n),
3887
- fill: In,
3935
+ fill: zn,
3888
3936
  opacity: .75
3889
3937
  }, e.label);
3890
3938
  }),
3891
3939
  d && !y && /* @__PURE__ */ m("path", {
3892
3940
  d,
3893
3941
  fill: "none",
3894
- stroke: Ln,
3942
+ stroke: Bn,
3895
3943
  strokeWidth: 2.5,
3896
3944
  strokeLinejoin: "round",
3897
3945
  strokeLinecap: "round"
@@ -3920,15 +3968,15 @@ function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
3920
3968
  ]
3921
3969
  });
3922
3970
  }
3923
- }), k && /* @__PURE__ */ m($t, {
3971
+ }), A && /* @__PURE__ */ m(nn, {
3924
3972
  series: [{
3925
3973
  id: "bars",
3926
3974
  label: o,
3927
- color: In
3975
+ color: zn
3928
3976
  }, ...t.length > 0 ? [{
3929
3977
  id: "line",
3930
3978
  label: c,
3931
- color: Ln
3979
+ color: Bn
3932
3980
  }] : []],
3933
3981
  hidden: C
3934
3982
  })]
@@ -3936,14 +3984,14 @@ function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
3936
3984
  }
3937
3985
  //#endregion
3938
3986
  //#region src/charts/heatmap/heatmap.tsx
3939
- function zn({ data: e, title: t, description: n, width: r, height: i, className: o, plain: c, visualMap: l, toolbox: u, format: d }) {
3987
+ function Hn({ data: e, title: t, description: n, width: r, height: i, className: o, plain: c, visualMap: l, toolbox: u, format: d }) {
3940
3988
  s();
3941
- let f = i ?? (c ? 48 : 320), g = c ? We : {
3989
+ let f = i ?? (c ? 48 : 320), g = c ? Ke : {
3942
3990
  top: 20,
3943
3991
  right: 20,
3944
3992
  bottom: 60,
3945
3993
  left: 60
3946
- }, _ = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ? B(e.map((e) => e.value)) : [0, 1], S = x - b || 1, C = (e) => Math.max(0, Math.min(1, (e - b) / S)), w = a([l?.min ?? b, l?.max ?? x]), T = a(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ m(Q, {
3994
+ }, _ = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ? W(e.map((e) => e.value)) : [0, 1], S = x - b || 1, C = (e) => Math.max(0, Math.min(1, (e - b) / S)), w = a([l?.min ?? b, l?.max ?? x]), T = a(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ m(Q, {
3947
3995
  title: t,
3948
3996
  description: n,
3949
3997
  width: r,
@@ -3993,7 +4041,7 @@ function zn({ data: e, title: t, description: n, width: r, height: i, className:
3993
4041
  return /* @__PURE__ */ h("g", {
3994
4042
  transform: `translate(${g.left},${g.top})`,
3995
4043
  children: [e.map((e, t) => {
3996
- let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(C(e.value) * 100), s = l ? Yt(e.value, l).color ?? "var(--cascivo-chart-1)" : `color-mix(in oklab, var(--cascivo-chart-1) ${o}%, var(--cascivo-gray-100))`, c = l ? Xt(e.value, l, w.value, T.value) : !0;
4044
+ let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(C(e.value) * 100), s = l ? Qt(e.value, l).color ?? "var(--cascivo-chart-1)" : `color-mix(in oklab, var(--cascivo-chart-1) ${o}%, var(--cascivo-gray-100))`, c = l ? $t(e.value, l, w.value, T.value) : !0;
3997
4045
  return /* @__PURE__ */ m("rect", {
3998
4046
  x: n,
3999
4047
  y: r,
@@ -4024,7 +4072,7 @@ function zn({ data: e, title: t, description: n, width: r, height: i, className:
4024
4072
  flexDirection: "column",
4025
4073
  gap: "0.5rem"
4026
4074
  },
4027
- children: [E, /* @__PURE__ */ m(Zt, {
4075
+ children: [E, /* @__PURE__ */ m(en, {
4028
4076
  options: l,
4029
4077
  range: w,
4030
4078
  hidden: T,
@@ -4034,8 +4082,8 @@ function zn({ data: e, title: t, description: n, width: r, height: i, className:
4034
4082
  }
4035
4083
  //#endregion
4036
4084
  //#region src/charts/treemap/treemap.tsx
4037
- var Bn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4038
- function Vn({ data: e, title: t, description: n, width: r, height: i, className: a, plain: o }) {
4085
+ var Un = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4086
+ function Wn({ data: e, title: t, description: n, width: r, height: i, className: a, plain: o }) {
4039
4087
  s();
4040
4088
  let l = c();
4041
4089
  return /* @__PURE__ */ m(Q, {
@@ -4051,7 +4099,7 @@ function Vn({ data: e, title: t, description: n, width: r, height: i, className:
4051
4099
  className: a,
4052
4100
  plain: o,
4053
4101
  tooltip: e.length > 0 ? ({ width: t, height: n }) => {
4054
- if (e.length !== 0) return { points: W(e.map((e) => ({
4102
+ if (e.length !== 0) return { points: ae(e.map((e) => ({
4055
4103
  id: e.id,
4056
4104
  value: e.value
4057
4105
  })), t, n).map((t) => {
@@ -4067,7 +4115,7 @@ function Vn({ data: e, title: t, description: n, width: r, height: i, className:
4067
4115
  } : void 0,
4068
4116
  children: ({ width: t, height: n }) => {
4069
4117
  if (e.length === 0) return null;
4070
- let r = W(e.map((e) => ({
4118
+ let r = ae(e.map((e) => ({
4071
4119
  id: e.id,
4072
4120
  value: e.value
4073
4121
  })), t, n), i = new Map(e.map((e) => [e.id, e.label]));
@@ -4080,7 +4128,7 @@ function Vn({ data: e, title: t, description: n, width: r, height: i, className:
4080
4128
  height: Math.max(0, e.h - 4)
4081
4129
  })
4082
4130
  }, e.id)) }), r.map((e, t) => {
4083
- let n = Bn[t % Bn.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
4131
+ let n = Un[t % Un.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
4084
4132
  return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("rect", {
4085
4133
  x: e.x,
4086
4134
  y: e.y,
@@ -4104,18 +4152,18 @@ function Vn({ data: e, title: t, description: n, width: r, height: i, className:
4104
4152
  }
4105
4153
  //#endregion
4106
4154
  //#region src/charts/radar/radar.tsx
4107
- var Hn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Un = 4;
4108
- function Wn(e, t, n, r, i) {
4155
+ var Gn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Kn = 4;
4156
+ function qn(e, t, n, r, i) {
4109
4157
  let a = e.length;
4110
4158
  return e.map((e, o) => {
4111
4159
  let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
4112
4160
  return {
4113
- x: T(n + Math.cos(s) * c),
4114
- y: T(r + Math.sin(s) * c)
4161
+ x: D(n + Math.cos(s) * c),
4162
+ y: D(r + Math.sin(s) * c)
4115
4163
  };
4116
4164
  });
4117
4165
  }
4118
- function Gn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: o, className: c, plain: l }) {
4166
+ function Jn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: o, className: c, plain: l }) {
4119
4167
  let u = o ?? (l ? 48 : 320);
4120
4168
  s();
4121
4169
  let d = n ?? Math.max(1, ...t.flatMap((e) => e.values)), f = e.length;
@@ -4138,8 +4186,8 @@ function Gn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
4138
4186
  let s = r / f * 2 * Math.PI - Math.PI / 2, c = n / d * o;
4139
4187
  return {
4140
4188
  id: `${t.id}-${r}`,
4141
- cx: T(i + Math.cos(s) * c),
4142
- cy: T(a + Math.sin(s) * c),
4189
+ cx: D(i + Math.cos(s) * c),
4190
+ cy: D(a + Math.sin(s) * c),
4143
4191
  label: e[r] ?? String(r),
4144
4192
  value: n,
4145
4193
  seriesId: t.id
@@ -4147,15 +4195,15 @@ function Gn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
4147
4195
  })) };
4148
4196
  } : void 0,
4149
4197
  children: ({ width: n, height: r }) => {
4150
- let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: Un }, (e, t) => (t + 1) / Un * o), c = Array.from({ length: f }, (e, t) => {
4198
+ let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: Kn }, (e, t) => (t + 1) / Kn * o), c = Array.from({ length: f }, (e, t) => {
4151
4199
  let n = t / f * 2 * Math.PI - Math.PI / 2;
4152
4200
  return {
4153
- x: T(i + Math.cos(n) * o),
4154
- y: T(a + Math.sin(n) * o)
4201
+ x: D(i + Math.cos(n) * o),
4202
+ y: D(a + Math.sin(n) * o)
4155
4203
  };
4156
4204
  }), u = s.map((e) => Array.from({ length: f }, (t, n) => {
4157
4205
  let r = n / f * 2 * Math.PI - Math.PI / 2;
4158
- return `${T(i + Math.cos(r) * e)},${T(a + Math.sin(r) * e)}`;
4206
+ return `${D(i + Math.cos(r) * e)},${D(a + Math.sin(r) * e)}`;
4159
4207
  }).join(" "));
4160
4208
  return /* @__PURE__ */ h(p, { children: [
4161
4209
  !l && u.map((e, t) => /* @__PURE__ */ m("polygon", {
@@ -4175,8 +4223,8 @@ function Gn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
4175
4223
  !l && c.map((t, n) => {
4176
4224
  let r = n / f * 2 * Math.PI - Math.PI / 2;
4177
4225
  return /* @__PURE__ */ m("text", {
4178
- x: T(i + Math.cos(r) * (o + 18)),
4179
- y: T(a + Math.sin(r) * (o + 18)),
4226
+ x: D(i + Math.cos(r) * (o + 18)),
4227
+ y: D(a + Math.sin(r) * (o + 18)),
4180
4228
  fontSize: 11,
4181
4229
  textAnchor: "middle",
4182
4230
  dominantBaseline: "middle",
@@ -4185,7 +4233,7 @@ function Gn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
4185
4233
  }, n);
4186
4234
  }),
4187
4235
  t.map((e, t) => {
4188
- let n = Wn(e.values, d, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = Hn[t % Hn.length] ?? "var(--cascivo-chart-1)";
4236
+ let n = qn(e.values, d, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = Gn[t % Gn.length] ?? "var(--cascivo-chart-1)";
4189
4237
  return /* @__PURE__ */ m("polygon", {
4190
4238
  points: n,
4191
4239
  fill: r,
@@ -4200,12 +4248,12 @@ function Gn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
4200
4248
  }
4201
4249
  //#endregion
4202
4250
  //#region src/charts/bullet/bullet.tsx
4203
- var Kn = [
4251
+ var Yn = [
4204
4252
  "var(--cascivo-gray-200)",
4205
4253
  "var(--cascivo-gray-300)",
4206
4254
  "var(--cascivo-gray-400)"
4207
4255
  ];
4208
- function qn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: o = 300, height: c = 40, className: l }) {
4256
+ function Xn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: o = 300, height: c = 40, className: l }) {
4209
4257
  s();
4210
4258
  let u = [...n].sort((e, t) => e - t), d = g([i, a ?? u[u.length - 1] ?? (Math.max(e, t) * 1.2 || 1)], [0, o]), f = c * .35, _ = (c - f) / 2, v = c * .7, y = (c - v) / 2;
4211
4259
  return /* @__PURE__ */ h("figure", {
@@ -4232,7 +4280,7 @@ function qn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
4232
4280
  y: 0,
4233
4281
  width: Math.max(0, r),
4234
4282
  height: c,
4235
- fill: Kn[t % Kn.length] ?? "var(--cascivo-gray-200)"
4283
+ fill: Yn[t % Yn.length] ?? "var(--cascivo-gray-200)"
4236
4284
  }, t);
4237
4285
  }),
4238
4286
  /* @__PURE__ */ m("rect", {
@@ -4259,10 +4307,10 @@ function qn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
4259
4307
  }
4260
4308
  //#endregion
4261
4309
  //#region src/charts/radial-bar/radial-bar.tsx
4262
- var Jn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4263
- function Yn({ data: e, title: t, description: n, size: r, width: i, height: o, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: f, tooltip: p, legend: g, className: _, plain: v }) {
4310
+ var Zn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4311
+ function Qn({ data: e, title: t, description: n, size: r, width: i, height: o, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: f, tooltip: p, legend: g, className: _, plain: v }) {
4264
4312
  s();
4265
- let y = a(/* @__PURE__ */ new Set()), b = i ?? r, x = o ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, w = c ?? Math.max(1, ...e.map((e) => e.value)), E = Math.min(360, Math.max(0, l)) * Math.PI / 180, D = -E / 2, O = (t, n) => {
4313
+ let y = a(/* @__PURE__ */ new Set()), b = i ?? r, x = o ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, w = c ?? Math.max(1, ...e.map((e) => e.value)), T = Math.min(360, Math.max(0, l)) * Math.PI / 180, E = -T / 2, O = (t, n) => {
4266
4314
  let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = a * .32, s = e.filter((e) => !y.value.has(e.id));
4267
4315
  return {
4268
4316
  cx: r,
@@ -4272,27 +4320,27 @@ function Yn({ data: e, title: t, description: n, size: r, width: i, height: o, m
4272
4320
  span: s.length > 0 ? (a - o) / s.length : 0,
4273
4321
  visible: s
4274
4322
  };
4275
- }, ee = ({ width: e, height: t }) => {
4323
+ }, k = ({ width: e, height: t }) => {
4276
4324
  if (p === !1 || !C) return;
4277
4325
  let { cx: n, cy: r, maxR: i, span: a, visible: o } = O(e, t);
4278
4326
  return { points: o.map((e, t) => {
4279
- let o = i - t * a, s = (o + (o - a * .7)) / 2, c = D + E * Math.min(1, e.value / w);
4327
+ let o = i - t * a, s = (o + (o - a * .7)) / 2, c = E + T * Math.min(1, e.value / w);
4280
4328
  return {
4281
4329
  id: e.id,
4282
- cx: T(n + Math.sin(c) * s),
4283
- cy: T(r - Math.cos(c) * s),
4330
+ cx: D(n + Math.sin(c) * s),
4331
+ cy: D(r - Math.cos(c) * s),
4284
4332
  label: e.label,
4285
4333
  value: e.value,
4286
4334
  seriesId: e.id,
4287
4335
  percent: w > 0 ? e.value / w * 100 : 0,
4288
- color: e.color ?? Jn[t % Jn.length]
4336
+ color: e.color ?? Zn[t % Zn.length]
4289
4337
  };
4290
4338
  }) };
4291
- }, k = /* @__PURE__ */ h("table", { children: [
4339
+ }, A = /* @__PURE__ */ h("table", { children: [
4292
4340
  /* @__PURE__ */ m("caption", { children: t }),
4293
4341
  /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Label" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
4294
4342
  /* @__PURE__ */ m("tbody", { children: e.map((e) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: e.label }), /* @__PURE__ */ m("td", { children: e.value })] }, e.id)) })
4295
- ] }), A = u != null || d != null || f != null;
4343
+ ] }), j = u != null || d != null || f != null;
4296
4344
  return /* @__PURE__ */ h("div", {
4297
4345
  style: {
4298
4346
  display: "flex",
@@ -4304,27 +4352,27 @@ function Yn({ data: e, title: t, description: n, size: r, width: i, height: o, m
4304
4352
  description: n,
4305
4353
  width: b,
4306
4354
  height: x,
4307
- fallback: k,
4355
+ fallback: A,
4308
4356
  className: _,
4309
4357
  "data-state": C ? void 0 : "empty",
4310
4358
  plain: v,
4311
- tooltip: p !== !1 && C ? ee : void 0,
4359
+ tooltip: p !== !1 && C ? k : void 0,
4312
4360
  children: ({ width: e, height: t }) => {
4313
4361
  let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
4314
4362
  return /* @__PURE__ */ h("g", { children: [s.map((e, t) => {
4315
- let a = i - t * o, s = a - o * .7, c = e.color ?? Jn[t % Jn.length], l = Math.max(0, Math.min(1, e.value / w)), u = D + E * l;
4363
+ let a = i - t * o, s = a - o * .7, c = e.color ?? Zn[t % Zn.length], l = Math.max(0, Math.min(1, e.value / w)), u = E + T * l;
4316
4364
  return /* @__PURE__ */ h("g", {
4317
4365
  "data-series": e.id,
4318
4366
  children: [/* @__PURE__ */ m("path", {
4319
- d: N(n, r, a, s, D, D + E),
4367
+ d: I(n, r, a, s, E, E + T),
4320
4368
  fill: "var(--cascivo-chart-grid)",
4321
4369
  fillOpacity: .35
4322
4370
  }), l > 0 && /* @__PURE__ */ m("path", {
4323
- d: N(n, r, a, s, D, u),
4371
+ d: I(n, r, a, s, E, u),
4324
4372
  fill: c
4325
4373
  })]
4326
4374
  }, e.id);
4327
- }), !v && A && (f == null ? /* @__PURE__ */ h("g", {
4375
+ }), !v && j && (f == null ? /* @__PURE__ */ h("g", {
4328
4376
  "data-center": "",
4329
4377
  children: [u != null && /* @__PURE__ */ m("text", {
4330
4378
  x: n,
@@ -4364,11 +4412,11 @@ function Yn({ data: e, title: t, description: n, size: r, width: i, height: o, m
4364
4412
  })
4365
4413
  }))] });
4366
4414
  }
4367
- }), S && /* @__PURE__ */ m($t, {
4415
+ }), S && /* @__PURE__ */ m(nn, {
4368
4416
  series: e.map((e, t) => ({
4369
4417
  id: e.id,
4370
4418
  label: e.label,
4371
- color: e.color ?? Jn[t % Jn.length]
4419
+ color: e.color ?? Zn[t % Zn.length]
4372
4420
  })),
4373
4421
  hidden: y
4374
4422
  })]
@@ -4376,10 +4424,10 @@ function Yn({ data: e, title: t, description: n, size: r, width: i, height: o, m
4376
4424
  }
4377
4425
  //#endregion
4378
4426
  //#region src/charts/funnel/funnel.tsx
4379
- var Xn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4380
- function Zn({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: o, className: c, plain: l }) {
4427
+ var $n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4428
+ function er({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: o, className: c, plain: l }) {
4381
4429
  s();
4382
- let u = l ? We : Ue, d = i ?? (l ? 48 : 320), f = e.length > 0, p = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
4430
+ let u = l ? Ke : Ge, d = i ?? (l ? 48 : 320), f = e.length > 0, p = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
4383
4431
  return /* @__PURE__ */ m(Q, {
4384
4432
  title: t,
4385
4433
  description: n,
@@ -4413,7 +4461,7 @@ function Zn({ data: e, title: t, description: n, width: r, height: i, showConver
4413
4461
  value: e.value,
4414
4462
  seriesId: e.id,
4415
4463
  percent: p > 0 ? e.value / p * 100 : 0,
4416
- color: e.color ?? Xn[t % Xn.length]
4464
+ color: e.color ?? $n[t % $n.length]
4417
4465
  })),
4418
4466
  format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
4419
4467
  };
@@ -4423,7 +4471,7 @@ function Zn({ data: e, title: t, description: n, width: r, height: i, showConver
4423
4471
  if (r <= 0 || e.length === 0) return null;
4424
4472
  let o = i / e.length, s = g([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
4425
4473
  return /* @__PURE__ */ m("g", { children: e.map((t, n) => {
4426
- let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, g = f + o * (r ? 1 : .9), _ = t.color ?? Xn[n % Xn.length], v = [
4474
+ let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, g = f + o * (r ? 1 : .9), _ = t.color ?? $n[n % $n.length], v = [
4427
4475
  [d - i, f],
4428
4476
  [d + i, f],
4429
4477
  [d + s, g],
@@ -4435,7 +4483,7 @@ function Zn({ data: e, title: t, description: n, width: r, height: i, showConver
4435
4483
  points: v,
4436
4484
  fill: _,
4437
4485
  fillOpacity: .85
4438
- }), !l && /* @__PURE__ */ m(kt, {
4486
+ }), !l && /* @__PURE__ */ m(Mt, {
4439
4487
  x: d,
4440
4488
  y: f + o / 2,
4441
4489
  text: a ? `${t.label} · ${t.value} (${y}%)` : `${t.label} · ${t.value}`,
@@ -4448,10 +4496,10 @@ function Zn({ data: e, title: t, description: n, width: r, height: i, showConver
4448
4496
  }
4449
4497
  //#endregion
4450
4498
  //#region src/charts/stream/stream.tsx
4451
- var Qn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4452
- function $n({ series: e, categories: t, title: n, description: r, offset: i = "silhouette", curve: o = "basis", width: c, height: l, legend: u, tooltip: d, className: f, plain: p, format: _ }) {
4499
+ var tr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4500
+ function nr({ series: e, categories: t, title: n, description: r, offset: i = "silhouette", curve: o = "basis", width: c, height: l, legend: u, tooltip: d, className: f, plain: p, format: _ }) {
4453
4501
  s();
4454
- let y = a(/* @__PURE__ */ new Set()), b = p ? We : Ue, x = l ?? (p ? 48 : 300), S = p ? !1 : u ?? e.length > 1, C = t.length > 0 && e.length > 0, w = G(e.map((e) => e.values), i), [T, E] = K(w);
4502
+ let y = a(/* @__PURE__ */ new Set()), b = p ? Ke : Ge, x = l ?? (p ? 48 : 300), S = p ? !1 : u ?? e.length > 1, C = t.length > 0 && e.length > 0, w = J(e.map((e) => e.values), i), [T, E] = Y(w);
4455
4503
  return /* @__PURE__ */ h("div", {
4456
4504
  style: {
4457
4505
  display: "flex",
@@ -4486,7 +4534,7 @@ function $n({ series: e, categories: t, title: n, description: r, offset: i = "s
4486
4534
  label: `${e.label} · ${String(t)}`,
4487
4535
  value: e.values[i] ?? 0,
4488
4536
  seriesId: e.id,
4489
- color: e.color ?? Qn[n % Qn.length]
4537
+ color: e.color ?? tr[n % tr.length]
4490
4538
  };
4491
4539
  });
4492
4540
  }) };
@@ -4499,9 +4547,9 @@ function $n({ series: e, categories: t, title: n, description: r, offset: i = "s
4499
4547
  transform: `translate(${b.left},${b.top})`,
4500
4548
  children: [e.map((e, n) => {
4501
4549
  if (y.value.has(e.id)) return null;
4502
- let r = w[n], i = e.color ?? Qn[n % Qn.length], a = t.map((e, t) => [l(t), c.map(r[t][1])]), s = t.map((e, t) => [l(t), c.map(r[t][0])]);
4550
+ let r = w[n], i = e.color ?? tr[n % tr.length], a = t.map((e, t) => [l(t), c.map(r[t][1])]), s = t.map((e, t) => [l(t), c.map(r[t][0])]);
4503
4551
  return /* @__PURE__ */ m("path", {
4504
- d: `${D(a, o)}${D([...s].reverse(), o).replace(/^M/, "L")}Z`,
4552
+ d: `${k(a, o)}${k([...s].reverse(), o).replace(/^M/, "L")}Z`,
4505
4553
  fill: i,
4506
4554
  fillOpacity: .85,
4507
4555
  "data-series": e.id
@@ -4515,11 +4563,11 @@ function $n({ series: e, categories: t, title: n, description: r, offset: i = "s
4515
4563
  })]
4516
4564
  });
4517
4565
  }
4518
- }), S && /* @__PURE__ */ m($t, {
4566
+ }), S && /* @__PURE__ */ m(nn, {
4519
4567
  series: e.map((e, t) => ({
4520
4568
  id: e.id,
4521
4569
  label: e.label,
4522
- color: e.color ?? Qn[t % Qn.length]
4570
+ color: e.color ?? tr[t % tr.length]
4523
4571
  })),
4524
4572
  hidden: y
4525
4573
  })]
@@ -4527,10 +4575,10 @@ function $n({ series: e, categories: t, title: n, description: r, offset: i = "s
4527
4575
  }
4528
4576
  //#endregion
4529
4577
  //#region src/charts/sunburst/sunburst.tsx
4530
- var er = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4531
- function tr({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
4578
+ var rr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4579
+ function ir({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
4532
4580
  s();
4533
- let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = q(e), p = f > 0, g = J(e), _ = Math.max(1, se(g));
4581
+ let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = oe(e), p = f > 0, g = X(e), _ = Math.max(1, se(g));
4534
4582
  return /* @__PURE__ */ m(Q, {
4535
4583
  title: t,
4536
4584
  description: n,
@@ -4552,12 +4600,12 @@ function tr({ data: e, title: t, description: n, size: r, width: i, height: a, t
4552
4600
  let a = (e.a0 + e.a1) / 2, o = (e.depth - .5) * i;
4553
4601
  return {
4554
4602
  id: `${e.node.label}-${t}`,
4555
- cx: T(n + Math.sin(a) * o),
4556
- cy: T(r - Math.cos(a) * o),
4603
+ cx: D(n + Math.sin(a) * o),
4604
+ cy: D(r - Math.cos(a) * o),
4557
4605
  label: e.node.label,
4558
4606
  value: e.value,
4559
4607
  percent: f > 0 ? e.value / f * 100 : 0,
4560
- color: e.node.color ?? er[t % er.length]
4608
+ color: e.node.color ?? rr[t % rr.length]
4561
4609
  };
4562
4610
  }),
4563
4611
  format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
@@ -4566,9 +4614,9 @@ function tr({ data: e, title: t, description: n, size: r, width: i, height: a, t
4566
4614
  children: ({ width: e, height: t }) => {
4567
4615
  let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
4568
4616
  return /* @__PURE__ */ m("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
4569
- let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? er[t % er.length];
4617
+ let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? rr[t % rr.length];
4570
4618
  return /* @__PURE__ */ m("path", {
4571
- d: N(n, r, o, a, e.a0, e.a1),
4619
+ d: I(n, r, o, a, e.a0, e.a1),
4572
4620
  fill: s,
4573
4621
  fillOpacity: 1 - (e.depth - 1) * .18,
4574
4622
  stroke: "var(--cascivo-color-surface)",
@@ -4581,10 +4629,10 @@ function tr({ data: e, title: t, description: n, size: r, width: i, height: a, t
4581
4629
  }
4582
4630
  //#endregion
4583
4631
  //#region src/charts/sankey/sankey.tsx
4584
- var nr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4585
- function rr({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
4632
+ var ar = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4633
+ function or({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
4586
4634
  s();
4587
- let u = l ? We : Ue, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, p = (t, n) => e.find((e) => e.id === t)?.color ?? nr[n % nr.length];
4635
+ let u = l ? Ke : Ge, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, p = (t, n) => e.find((e) => e.id === t)?.color ?? ar[n % ar.length];
4588
4636
  return /* @__PURE__ */ m(Q, {
4589
4637
  title: n,
4590
4638
  description: r,
@@ -4608,7 +4656,7 @@ function rr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
4608
4656
  plain: l,
4609
4657
  tooltip: o && f ? ({ width: n, height: r }) => {
4610
4658
  if (!o || !f) return;
4611
- let { nodes: i } = Y(e, t, {
4659
+ let { nodes: i } = ce(e, t, {
4612
4660
  width: n - u.left - u.right,
4613
4661
  height: r - u.top - u.bottom
4614
4662
  });
@@ -4624,14 +4672,14 @@ function rr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
4624
4672
  children: ({ width: n, height: r }) => {
4625
4673
  let i = n - u.left - u.right, a = r - u.top - u.bottom;
4626
4674
  if (i <= 0 || !f) return null;
4627
- let { nodes: o, links: s } = Y(e, t, {
4675
+ let { nodes: o, links: s } = ce(e, t, {
4628
4676
  width: i,
4629
4677
  height: a
4630
4678
  });
4631
4679
  return /* @__PURE__ */ h("g", {
4632
4680
  transform: `translate(${u.left},${u.top})`,
4633
4681
  children: [s.map((e, t) => /* @__PURE__ */ m("path", {
4634
- d: ce(e),
4682
+ d: le(e),
4635
4683
  fill: p(e.source.id, o.indexOf(e.source)),
4636
4684
  fillOpacity: .32,
4637
4685
  "data-link": ""
@@ -4660,23 +4708,23 @@ function rr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
4660
4708
  }
4661
4709
  //#endregion
4662
4710
  //#region src/charts/calendar/calendar.tsx
4663
- var ir = 864e5, ar = (e) => e instanceof Date ? e : new Date(e), or = (e) => e.toISOString().slice(0, 10);
4664
- function sr(e) {
4711
+ var sr = 864e5, cr = (e) => e instanceof Date ? e : new Date(e), lr = (e) => e.toISOString().slice(0, 10);
4712
+ function ur(e) {
4665
4713
  let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
4666
4714
  return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
4667
4715
  }
4668
- function cr({ data: e, title: t, description: n, from: r, to: i, width: o, height: c, tooltip: l, className: u, plain: d, visualMap: f }) {
4716
+ function dr({ data: e, title: t, description: n, from: r, to: i, width: o, height: c, tooltip: l, className: u, plain: d, visualMap: f }) {
4669
4717
  s();
4670
4718
  let p = e.length > 0, g = a([f?.min ?? 0, f?.max ?? 1]), _ = a(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
4671
- for (let t of e) v.set(or(ar(t.day)), t.value);
4672
- let y = e.map((e) => ar(e.day)), b = sr(r ? ar(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = i ? ar(i) : y.reduce((e, t) => t > e ? t : e, y[0] ?? /* @__PURE__ */ new Date()), S = p ? Math.max(1, Math.ceil((x.getTime() - b.getTime()) / ir / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
4719
+ for (let t of e) v.set(lr(cr(t.day)), t.value);
4720
+ let y = e.map((e) => cr(e.day)), b = ur(r ? cr(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = i ? cr(i) : y.reduce((e, t) => t > e ? t : e, y[0] ?? /* @__PURE__ */ new Date()), S = p ? Math.max(1, Math.ceil((x.getTime() - b.getTime()) / sr / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
4673
4721
  for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
4674
- let n = new Date(b.getTime() + (e * 7 + t) * ir);
4722
+ let n = new Date(b.getTime() + (e * 7 + t) * sr);
4675
4723
  n > x || T.push({
4676
4724
  col: e,
4677
4725
  row: t,
4678
4726
  date: n,
4679
- value: v.get(or(n)) ?? 0
4727
+ value: v.get(lr(n)) ?? 0
4680
4728
  });
4681
4729
  }
4682
4730
  let E = /* @__PURE__ */ m(Q, {
@@ -4687,7 +4735,7 @@ function cr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
4687
4735
  fallback: /* @__PURE__ */ h("table", { children: [
4688
4736
  /* @__PURE__ */ m("caption", { children: t }),
4689
4737
  /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Day" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
4690
- /* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: or(ar(e.day)) }), /* @__PURE__ */ m("td", { children: e.value })] }, t)) })
4738
+ /* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: lr(cr(e.day)) }), /* @__PURE__ */ m("td", { children: e.value })] }, t)) })
4691
4739
  ] }),
4692
4740
  className: u,
4693
4741
  "data-state": p ? void 0 : "empty",
@@ -4697,10 +4745,10 @@ function cr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
4697
4745
  let t = Math.max(2, (e - (S - 1) * 2) / S);
4698
4746
  return {
4699
4747
  points: T.map((e, n) => ({
4700
- id: `${or(e.date)}-${n}`,
4748
+ id: `${lr(e.date)}-${n}`,
4701
4749
  cx: e.col * (t + 2) + t / 2,
4702
4750
  cy: e.row * (t + 2) + t / 2,
4703
- label: or(e.date),
4751
+ label: lr(e.date),
4704
4752
  value: e.value
4705
4753
  })),
4706
4754
  format: (e) => `${e.label}: ${e.value}`
@@ -4709,7 +4757,7 @@ function cr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
4709
4757
  children: ({ width: e }) => {
4710
4758
  let t = Math.max(2, (e - (S - 1) * 2) / S);
4711
4759
  return /* @__PURE__ */ m("g", { children: T.map((e, n) => {
4712
- let r = f ? Yt(e.value, f).color : void 0, i = f ? Xt(e.value, f, g.value, _.value) : !0;
4760
+ let r = f ? Qt(e.value, f).color : void 0, i = f ? $t(e.value, f, g.value, _.value) : !0;
4713
4761
  return /* @__PURE__ */ m("rect", {
4714
4762
  x: e.col * (t + 2),
4715
4763
  y: e.row * (t + 2),
@@ -4718,7 +4766,7 @@ function cr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
4718
4766
  rx: 1.5,
4719
4767
  fill: r ?? "var(--cascivo-chart-2)",
4720
4768
  fillOpacity: f ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
4721
- "data-day": or(e.date)
4769
+ "data-day": lr(e.date)
4722
4770
  }, n);
4723
4771
  }) });
4724
4772
  }
@@ -4729,7 +4777,7 @@ function cr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
4729
4777
  flexDirection: "column",
4730
4778
  gap: "0.5rem"
4731
4779
  },
4732
- children: [E, /* @__PURE__ */ m(Zt, {
4780
+ children: [E, /* @__PURE__ */ m(en, {
4733
4781
  options: f,
4734
4782
  range: g,
4735
4783
  hidden: _,
@@ -4739,23 +4787,23 @@ function cr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
4739
4787
  }
4740
4788
  //#endregion
4741
4789
  //#region src/charts/candlestick/candlestick.tsx
4742
- function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c = 5, upColor: u = "var(--cascivo-chart-2)", downColor: d = "var(--cascivo-chart-4)", volume: f, tooltip: _, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E, format: D }) {
4790
+ function fr({ data: e, title: t, description: n, width: r, height: i, yTicks: c = 5, upColor: u = "var(--cascivo-chart-2)", downColor: d = "var(--cascivo-chart-4)", volume: f, tooltip: _, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E, format: D }) {
4743
4791
  s();
4744
- let O = b ? We : Ue, ee = i ?? (b ? 64 : 320), k = e.length, A = (S || C || w || T !== void 0) && k > 0, j = a([0, Math.max(0, k - 1)]), te = l(null);
4745
- T && !te.current && (te.current = mt(T)), o(() => () => {
4746
- T && ht(T);
4792
+ let O = b ? Ke : Ge, k = i ?? (b ? 64 : 320), A = e.length, j = (S || C || w || T !== void 0) && A > 0, M = a([0, Math.max(0, A - 1)]), ee = l(null);
4793
+ T && !ee.current && (ee.current = gt(T)), o(() => () => {
4794
+ T && _t(T);
4747
4795
  }), o(() => {
4748
- let e = te.current;
4796
+ let e = ee.current;
4749
4797
  if (!e) return;
4750
- let t = e.window.value, n = j.peek();
4751
- t && (t[0] !== n[0] || t[1] !== n[1]) && (j.value = t);
4798
+ let t = e.window.value, n = M.peek();
4799
+ t && (t[0] !== n[0] || t[1] !== n[1]) && (M.value = t);
4752
4800
  }), o(() => {
4753
- let e = te.current;
4801
+ let e = ee.current;
4754
4802
  if (!e) return;
4755
- let t = j.value, n = e.window.peek();
4803
+ let t = M.value, n = e.window.peek();
4756
4804
  (!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
4757
4805
  });
4758
- let M = A ? e.slice(j.value[0], j.value[1] + 1) : e, ne = M.length > 0, N = ne ? Math.min(...M.map((e) => e.low)) : 0, P = ne ? Math.max(...M.map((e) => e.high)) : 1, F = ne ? Math.max(1, ...M.map((e) => e.volume ?? 0)) : 1, re = M.map((e) => e.t);
4806
+ let N = j ? e.slice(M.value[0], M.value[1] + 1) : e, te = N.length > 0, P = te ? Math.min(...N.map((e) => e.low)) : 0, F = te ? Math.max(...N.map((e) => e.high)) : 1, I = te ? Math.max(1, ...N.map((e) => e.volume ?? 0)) : 1, ne = N.map((e) => e.t);
4759
4807
  return /* @__PURE__ */ h("div", {
4760
4808
  style: {
4761
4809
  display: "flex",
@@ -4767,7 +4815,7 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4767
4815
  title: t,
4768
4816
  description: n,
4769
4817
  width: r,
4770
- height: ee,
4818
+ height: k,
4771
4819
  fallback: /* @__PURE__ */ h("table", { children: [
4772
4820
  /* @__PURE__ */ m("caption", { children: t }),
4773
4821
  /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [
@@ -4777,7 +4825,7 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4777
4825
  /* @__PURE__ */ m("th", { children: "Low" }),
4778
4826
  /* @__PURE__ */ m("th", { children: "Close" })
4779
4827
  ] }) }),
4780
- /* @__PURE__ */ m("tbody", { children: M.map((e, t) => /* @__PURE__ */ h("tr", { children: [
4828
+ /* @__PURE__ */ m("tbody", { children: N.map((e, t) => /* @__PURE__ */ h("tr", { children: [
4781
4829
  /* @__PURE__ */ m("td", { children: e.t }),
4782
4830
  /* @__PURE__ */ m("td", { children: e.open }),
4783
4831
  /* @__PURE__ */ m("td", { children: e.high }),
@@ -4786,15 +4834,15 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4786
4834
  ] }, t)) })
4787
4835
  ] }),
4788
4836
  className: y,
4789
- "data-state": ne ? void 0 : "empty",
4837
+ "data-state": te ? void 0 : "empty",
4790
4838
  plain: b,
4791
- tooltip: _ !== !1 && ne ? ({ width: e, height: t }) => {
4792
- if (_ === !1 || !ne) return;
4839
+ tooltip: _ !== !1 && te ? ({ width: e, height: t }) => {
4840
+ if (_ === !1 || !te) return;
4793
4841
  let n = e - O.left - O.right, r = t - O.top - O.bottom;
4794
4842
  if (n <= 0) return;
4795
- let i = v(re, [0, n], .3), a = r - (f ? Math.min(r * .2, 60) : 0), o = g([N, P], [a, 0]);
4843
+ let i = v(ne, [0, n], .3), a = r - (f ? Math.min(r * .2, 60) : 0), o = g([P, F], [a, 0]);
4796
4844
  if (E === "axis") return {
4797
- points: M.map((e, t) => ({
4845
+ points: N.map((e, t) => ({
4798
4846
  id: `c-${t}`,
4799
4847
  cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
4800
4848
  cy: O.top + o.map(e.high),
@@ -4821,13 +4869,13 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4821
4869
  })),
4822
4870
  mode: "axis",
4823
4871
  format: (e) => {
4824
- let t = M[parseInt(e.id.split("-")[1] ?? "0", 10)];
4872
+ let t = N[parseInt(e.id.split("-")[1] ?? "0", 10)];
4825
4873
  return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
4826
4874
  }
4827
4875
  };
4828
- let s = g([N, P], [r, 0]);
4876
+ let s = g([P, F], [r, 0]);
4829
4877
  return {
4830
- points: M.map((e, t) => ({
4878
+ points: N.map((e, t) => ({
4831
4879
  id: `c-${t}`,
4832
4880
  cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
4833
4881
  cy: O.top + s.map(e.high),
@@ -4835,32 +4883,32 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4835
4883
  value: e.close
4836
4884
  })),
4837
4885
  format: (e) => {
4838
- let t = M[parseInt(e.id.split("-")[1] ?? "0", 10)];
4886
+ let t = N[parseInt(e.id.split("-")[1] ?? "0", 10)];
4839
4887
  return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
4840
4888
  }
4841
4889
  };
4842
4890
  } : void 0,
4843
- zoom: w && k > 1 ? {
4844
- window: j,
4845
- count: k
4891
+ zoom: w && A > 1 ? {
4892
+ window: M,
4893
+ count: A
4846
4894
  } : void 0,
4847
- onRestore: A ? () => {
4848
- j.value = [0, Math.max(0, k - 1)];
4895
+ onRestore: j ? () => {
4896
+ M.value = [0, Math.max(0, A - 1)];
4849
4897
  } : void 0,
4850
4898
  children: ({ width: e, height: t }) => {
4851
4899
  let n = e - O.left - O.right, r = t - O.top - O.bottom;
4852
- if (n <= 0 || !ne) return null;
4853
- let i = v(re, [0, n], .3), a = g([N, P], [r, 0]), o = f ? Math.min(r * .2, 60) : 0, s = r - o, l = g([N, P], [s, 0]), _ = i.bandwidth;
4900
+ if (n <= 0 || !te) return null;
4901
+ let i = v(ne, [0, n], .3), a = g([P, F], [r, 0]), o = f ? Math.min(r * .2, 60) : 0, s = r - o, l = g([P, F], [s, 0]), _ = i.bandwidth;
4854
4902
  return /* @__PURE__ */ h("g", {
4855
4903
  transform: `translate(${O.left},${O.top})`,
4856
4904
  children: [
4857
- !b && /* @__PURE__ */ m(bt, {
4905
+ !b && /* @__PURE__ */ m(Ct, {
4858
4906
  scale: a,
4859
4907
  orientation: "y",
4860
4908
  length: n,
4861
4909
  tickCount: c
4862
4910
  }),
4863
- M.map((e, t) => {
4911
+ N.map((e, t) => {
4864
4912
  let n = (i.map(e.t) ?? 0) + _ / 2, r = e.close >= e.open, a = r ? u : d, c = l.map(e.open), p = l.map(e.close), g = Math.min(c, p), v = Math.max(1, Math.abs(p - c));
4865
4913
  return /* @__PURE__ */ h("g", {
4866
4914
  "data-candle": r ? "up" : "down",
@@ -4884,9 +4932,9 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4884
4932
  }),
4885
4933
  f && e.volume !== void 0 && /* @__PURE__ */ m("rect", {
4886
4934
  x: n - _ / 2,
4887
- y: s + (o - e.volume / F * o),
4935
+ y: s + (o - e.volume / I * o),
4888
4936
  width: _,
4889
- height: e.volume / F * o,
4937
+ height: e.volume / I * o,
4890
4938
  fill: a,
4891
4939
  fillOpacity: .4,
4892
4940
  "data-volume": ""
@@ -4894,7 +4942,7 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4894
4942
  ]
4895
4943
  }, t);
4896
4944
  }),
4897
- !b && Tt(x, {
4945
+ !b && Ot(x, {
4898
4946
  xScale: i,
4899
4947
  yScale: l,
4900
4948
  innerW: n,
@@ -4916,14 +4964,14 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4916
4964
  });
4917
4965
  }
4918
4966
  }),
4919
- S && !C && k > 1 && /* @__PURE__ */ m(Vt, {
4920
- count: k,
4921
- window: j,
4967
+ S && !C && A > 1 && /* @__PURE__ */ m(Wt, {
4968
+ count: A,
4969
+ window: M,
4922
4970
  label: "Time range"
4923
4971
  }),
4924
- C && k > 1 && /* @__PURE__ */ m(Ht, {
4925
- count: k,
4926
- window: j,
4972
+ C && A > 1 && /* @__PURE__ */ m(Gt, {
4973
+ count: A,
4974
+ window: M,
4927
4975
  label: "Time range"
4928
4976
  })
4929
4977
  ]
@@ -4931,10 +4979,10 @@ function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
4931
4979
  }
4932
4980
  //#endregion
4933
4981
  //#region src/charts/polar/polar.tsx
4934
- var ur = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4935
- function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: o = 4, max: c, tooltip: l, className: u, plain: d }) {
4982
+ var pr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
4983
+ function mr({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: o = 4, max: c, tooltip: l, className: u, plain: d }) {
4936
4984
  s();
4937
- let f = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y = Z(_), b = /* @__PURE__ */ h("table", { children: [
4985
+ let f = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y = we(_), b = /* @__PURE__ */ h("table", { children: [
4938
4986
  /* @__PURE__ */ m("caption", { children: t }),
4939
4987
  /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Category" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
4940
4988
  /* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: e.label }), /* @__PURE__ */ m("td", { children: e.value })] }, t)) })
@@ -4944,7 +4992,7 @@ function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
4944
4992
  cx: n,
4945
4993
  cy: r,
4946
4994
  outerR: i,
4947
- rScale: Ce([0, v], [0, i])
4995
+ rScale: Te([0, v], [0, i])
4948
4996
  };
4949
4997
  };
4950
4998
  return /* @__PURE__ */ m(Q, {
@@ -4961,7 +5009,7 @@ function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
4961
5009
  let { cx: r, cy: i, rScale: a } = x(t, n);
4962
5010
  return {
4963
5011
  points: e.map((e, t) => {
4964
- let n = y.center(e.label) ?? 0, [o, s] = Se(r, i, a.map(e.value), n);
5012
+ let n = y.center(e.label) ?? 0, [o, s] = Ce(r, i, a.map(e.value), n);
4965
5013
  return {
4966
5014
  id: `p-${t}`,
4967
5015
  cx: o,
@@ -4977,7 +5025,7 @@ function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
4977
5025
  if (!g) return null;
4978
5026
  let { cx: i, cy: a, outerR: s, rScale: c } = x(t, n), l = Array.from({ length: o }, (e, t) => s * (t + 1) / o), u = e.map((e) => {
4979
5027
  let t = y.center(e.label) ?? 0;
4980
- return Se(i, a, c.map(e.value), t);
5028
+ return Ce(i, a, c.map(e.value), t);
4981
5029
  });
4982
5030
  return /* @__PURE__ */ h("g", { children: [
4983
5031
  !d && l.map((e, t) => /* @__PURE__ */ m("circle", {
@@ -4992,21 +5040,21 @@ function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
4992
5040
  r === "bar" ? e.map((e, t) => {
4993
5041
  let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
4994
5042
  return /* @__PURE__ */ m("path", {
4995
- d: N(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
4996
- fill: e.color ?? ur[t % ur.length],
5043
+ d: I(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
5044
+ fill: e.color ?? pr[t % pr.length],
4997
5045
  fillOpacity: .85,
4998
5046
  "data-wedge": ""
4999
5047
  }, t);
5000
5048
  }) : (() => {
5001
- let t = [...u, u[0]], n = e[0]?.color ?? ur[0];
5049
+ let t = [...u, u[0]], n = e[0]?.color ?? pr[0];
5002
5050
  return /* @__PURE__ */ h(p, { children: [r === "area" && /* @__PURE__ */ m("path", {
5003
- d: `${D(t, "linear")}Z`,
5051
+ d: `${k(t, "linear")}Z`,
5004
5052
  fill: n,
5005
5053
  fillOpacity: .25,
5006
5054
  stroke: "none",
5007
5055
  "data-area": ""
5008
5056
  }), /* @__PURE__ */ m("path", {
5009
- d: D(t, "linear"),
5057
+ d: k(t, "linear"),
5010
5058
  fill: "none",
5011
5059
  stroke: n,
5012
5060
  strokeWidth: 2,
@@ -5014,7 +5062,7 @@ function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
5014
5062
  })] });
5015
5063
  })(),
5016
5064
  !d && e.map((e, t) => {
5017
- let n = y.center(e.label) ?? 0, [r, o] = Se(i, a, s + 12, n);
5065
+ let n = y.center(e.label) ?? 0, [r, o] = Ce(i, a, s + 12, n);
5018
5066
  return /* @__PURE__ */ m("text", {
5019
5067
  x: r,
5020
5068
  y: o,
@@ -5032,10 +5080,10 @@ function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
5032
5080
  }
5033
5081
  //#endregion
5034
5082
  //#region src/charts/gauge/gauge.tsx
5035
- var fr = Math.PI / 180;
5036
- function pr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: o = 5, title: c, description: l, width: u, height: d, className: f, plain: p }) {
5083
+ var hr = Math.PI / 180;
5084
+ function gr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: o = 5, title: c, description: l, width: u, height: d, className: f, plain: p }) {
5037
5085
  s();
5038
- let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * fr, x = -b / 2, S = (e) => x + (e - t) / _ * b;
5086
+ let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * hr, x = -b / 2, S = (e) => x + (e - t) / _ * b;
5039
5087
  return /* @__PURE__ */ m(Q, {
5040
5088
  title: c,
5041
5089
  description: l,
@@ -5055,7 +5103,7 @@ function pr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
5055
5103
  }], w = t, T = Array.from({ length: o + 1 }, (e, n) => t + _ * n / o);
5056
5104
  return /* @__PURE__ */ h("g", { children: [
5057
5105
  /* @__PURE__ */ m("path", {
5058
- d: N(c, l, u, f, x, x + b),
5106
+ d: I(c, l, u, f, x, x + b),
5059
5107
  fill: "var(--cascivo-chart-grid)",
5060
5108
  fillOpacity: .25,
5061
5109
  "data-track": ""
@@ -5063,13 +5111,13 @@ function pr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
5063
5111
  C.map((e, t) => {
5064
5112
  let r = S(w), i = S(Math.min(n, e.upTo));
5065
5113
  return w = e.upTo, /* @__PURE__ */ m("path", {
5066
- d: N(c, l, u, f, r, i),
5114
+ d: I(c, l, u, f, r, i),
5067
5115
  fill: e.color,
5068
5116
  "data-zone": ""
5069
5117
  }, t);
5070
5118
  }),
5071
5119
  !p && T.map((e, t) => {
5072
- let n = S(e), [r, i] = Se(c, l, f - 2, n), [a, o] = Se(c, l, f - 8, n), [s, u] = Se(c, l, f - 18, n);
5120
+ let n = S(e), [r, i] = Ce(c, l, f - 2, n), [a, o] = Ce(c, l, f - 8, n), [s, u] = Ce(c, l, f - 18, n);
5073
5121
  return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
5074
5122
  x1: r,
5075
5123
  y1: i,
@@ -5089,7 +5137,7 @@ function pr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
5089
5137
  })] }, t);
5090
5138
  }),
5091
5139
  (() => {
5092
- let [e, t] = Se(c, l, g, S(v));
5140
+ let [e, t] = Ce(c, l, g, S(v));
5093
5141
  return /* @__PURE__ */ m("line", {
5094
5142
  x1: c,
5095
5143
  y1: l,
@@ -5123,4 +5171,4 @@ function pr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
5123
5171
  });
5124
5172
  }
5125
5173
  //#endregion
5126
- export { Ge as AXIS_CHAR_PX, Je as AXIS_LINE_PX, fn as AreaChart, $ as Axis, gn as BarChart, jn as Boxplot, Vt as Brush, Fn as BubbleChart, qn as Bullet, cr as CalendarHeatmap, lr as Candlestick, et as CanvasLayer, Pt as ChartDefs, Q as ChartFrame, Rn as ComboChart, Ue as DEFAULT_MARGINS, kt as DataLabel, Ht as DataZoom, Zn as Funnel, pr as Gauge, It as Glyph, bt as GridLines, zn as Heatmap, kn as Histogram, On as Kpi, $t as Legend, cn as LineChart, Tn as Meter, We as PLAIN_MARGINS, yn as PieChart, dr as Polar, Gn as Radar, Yn as RadialBar, rr as Sankey, xn as ScatterChart, Sn as Sparkline, $n as Stream, tr as Sunburst, Bt as Text, st as Toolbox, Vn as Treemap, Zt as VisualMap, gt as _syncGroupCount, Oe as aggregate, Z as angleBand, Et as annotationSummary, N as arcPath, ne as areaPath, Ye as autoLabelStride, v as bandScale, ke as bin, R as binValues, Ve as bindStream, z as boxStats, oe as cellPath, Re as decimate, ve as divergingRamp, dt as download, Pe as encode, Fe as encodeCategory, B as extent, Nt as fillFor, we as filter, mt as getSyncGroup, Ft as glyphPath, jt as gradientId, at as isZoomed, Ke as leftMarginForLabels, D as linePath, g as linearScale, ce as linkPath, b as logScale, Ie as lttb, Yt as mapVisual, se as maxDepth, Le as minmax, re as nearestIndex, _ as niceTicks, it as panWindow, J as partition, Mt as patternId, Jt as pieceIndex, Se as polarPoint, T as quantize, Ce as radiusScale, xe as rampLightness, ye as rampOf, be as rampStops, Me as regression, ht as releaseSyncGroup, wt as renderAnnotation, Tt as renderAnnotations, tt as resolveColor, Ot as resolveLabels, qe as rightMarginForLabels, Y as sankeyLayout, _e as sequentialRamp, lt as serializeSvg, Ee as sort, E as splitDefined, y as sqrtScale, W as squarify, P as stackSeries, K as streamExtent, G as streamLayout, q as sumValue, ut as svgToPngBlob, w as timeScale, F as toStackedSeries, He as useChartSize, Be as useStreamSeries, Xt as visualVisible, I as voronoiCells, ie as voronoiFind, zt as wrapText, rt as zoomWindow };
5174
+ export { qe as AXIS_CHAR_PX, Xe as AXIS_LINE_PX, hn as AreaChart, $ as Axis, yn as BarChart, Pn as Boxplot, Wt as Brush, Rn as BubbleChart, Xn as Bullet, dr as CalendarHeatmap, fr as Candlestick, nt as CanvasLayer, Lt as ChartDefs, Q as ChartFrame, Vn as ComboChart, Ge as DEFAULT_MARGINS, Mt as DataLabel, Gt as DataZoom, er as Funnel, gr as Gauge, zt as Glyph, Ct as GridLines, Hn as Heatmap, Mn as Histogram, jn as Kpi, nn as Legend, dn as LineChart, On as Meter, Ke as PLAIN_MARGINS, Sn as PieChart, mr as Polar, Jn as Radar, Qn as RadialBar, or as Sankey, wn as ScatterChart, Tn as Sparkline, nr as Stream, ir as Sunburst, Ut as Text, lt as Toolbox, Wn as Treemap, en as VisualMap, vt as _syncGroupCount, Ae as aggregate, we as angleBand, kt as annotationSummary, I as arcPath, F as areaPath, Ze as autoLabelStride, v as bandScale, je as bin, H as binValues, Ue as bindStream, U as boxStats, B as cellPath, Be as decimate, ye as divergingRamp, pt as download, Ie as encode, Le as encodeCategory, W as extent, It as fillFor, Ee as filter, gt as getSyncGroup, Rt as glyphPath, Pt as gradientId, st as isZoomed, Je as leftMarginForLabels, k as linePath, g as linearScale, le as linkPath, b as logScale, Re as lttb, Qt as mapVisual, se as maxDepth, ze as minmax, R as nearestIndex, _ as niceTicks, ot as panWindow, X as partition, Ft as patternId, Zt as pieceIndex, Ce as polarPoint, D as quantize, Te as radiusScale, Se as rampLightness, be as rampOf, xe as rampStops, Pe as regression, _t as releaseSyncGroup, Dt as renderAnnotation, Ot as renderAnnotations, rt as resolveColor, jt as resolveLabels, Ye as rightMarginForLabels, ce as sankeyLayout, ve as sequentialRamp, dt as serializeSvg, Oe as sort, O as splitDefined, y as sqrtScale, ae as squarify, ne as stackSeries, Y as streamExtent, J as streamLayout, oe as sumValue, ft as svgToPngBlob, E as timeScale, L as toStackedSeries, We as useChartSize, He as useStreamSeries, $t as visualVisible, z as voronoiCells, re as voronoiFind, Ht as wrapText, at as zoomWindow };