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