@photon-ai/pho-ui 4.7.1 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/chunks/bar-chart-ht70KKj3.js +19 -0
  2. package/dist/chunks/bar-chart-ht70KKj3.js.map +1 -0
  3. package/dist/chunks/{basic-page-BUmntB7L.js → basic-page-DzT8yecB.js} +174 -173
  4. package/dist/chunks/basic-page-DzT8yecB.js.map +1 -0
  5. package/dist/chunks/chart-B5c8gmlj.js +1338 -0
  6. package/dist/chunks/chart-B5c8gmlj.js.map +1 -0
  7. package/dist/chunks/code-block-CbcE994O.js +516 -0
  8. package/dist/chunks/code-block-CbcE994O.js.map +1 -0
  9. package/dist/chunks/{data-table-Mog6m3d9.js → data-table-B1dmrN6r.js} +89 -94
  10. package/dist/chunks/data-table-B1dmrN6r.js.map +1 -0
  11. package/dist/chunks/ghost-search-CNVs9k1o.js +34 -0
  12. package/dist/chunks/ghost-search-CNVs9k1o.js.map +1 -0
  13. package/dist/chunks/line-chart-Cm_Ac7f4.js +22 -0
  14. package/dist/chunks/line-chart-Cm_Ac7f4.js.map +1 -0
  15. package/dist/chunks/{trace-CjOi3_IP.js → trace-D1fOFzJt.js} +633 -622
  16. package/dist/chunks/trace-D1fOFzJt.js.map +1 -0
  17. package/dist/components/bar-chart.js +1 -1
  18. package/dist/components/chart.js +8 -5
  19. package/dist/components/code-block.js +12 -3
  20. package/dist/components/data-table.js +8 -8
  21. package/dist/components/line-chart.js +1 -1
  22. package/dist/components/trace.js +1 -1
  23. package/dist/index.js +175 -162
  24. package/dist/motion.js +14 -13
  25. package/dist/motion.js.map +1 -1
  26. package/dist/primitives.js +1 -1
  27. package/dist/sections/basic-page.js +2 -2
  28. package/dist/src/components/bar-chart/bar-chart.d.ts +9 -1
  29. package/dist/src/components/chart/chart.d.ts +25 -0
  30. package/dist/src/components/chart/format.d.ts +9 -5
  31. package/dist/src/components/chart/index.d.ts +7 -4
  32. package/dist/src/components/chart/scale.d.ts +2 -2
  33. package/dist/src/components/chart/shell.d.ts +20 -13
  34. package/dist/src/components/chart/skeleton.d.ts +11 -0
  35. package/dist/src/components/chart/theme.d.ts +8 -0
  36. package/dist/src/components/chart/types.d.ts +39 -2
  37. package/dist/src/components/chart/use-measure.d.ts +2 -1
  38. package/dist/src/components/code-block/code-block.d.ts +23 -11
  39. package/dist/src/components/code-block/highlight.d.ts +24 -0
  40. package/dist/src/components/code-block/index.d.ts +4 -1
  41. package/dist/src/components/code-block/languages.d.ts +64 -0
  42. package/dist/src/components/code-block/pho-theme.d.ts +18 -0
  43. package/dist/src/components/code-block/tokens.d.ts +14 -0
  44. package/dist/src/components/data-table/chrome.d.ts +25 -0
  45. package/dist/src/components/data-table/data-table.d.ts +1 -2
  46. package/dist/src/components/line-chart/line-chart.d.ts +12 -3
  47. package/dist/src/components/trace/trace.d.ts +15 -4
  48. package/dist/src/motion/index.d.ts +6 -0
  49. package/dist/src/sections/basic-page/basic-page.d.ts +2 -0
  50. package/package.json +4 -1
  51. package/src/styles/theme.css +17 -4
  52. package/dist/chunks/IconArrowsMinimize-BfPUGuCB.js +0 -75
  53. package/dist/chunks/IconArrowsMinimize-BfPUGuCB.js.map +0 -1
  54. package/dist/chunks/bar-chart-DIALC2_z.js +0 -190
  55. package/dist/chunks/bar-chart-DIALC2_z.js.map +0 -1
  56. package/dist/chunks/basic-page-BUmntB7L.js.map +0 -1
  57. package/dist/chunks/code-block-BuFfh0zH.js +0 -197
  58. package/dist/chunks/code-block-BuFfh0zH.js.map +0 -1
  59. package/dist/chunks/data-table-Mog6m3d9.js.map +0 -1
  60. package/dist/chunks/ghost-search-AmVXd0zE.js +0 -25
  61. package/dist/chunks/ghost-search-AmVXd0zE.js.map +0 -1
  62. package/dist/chunks/legend-C0mU7dqd.js +0 -60
  63. package/dist/chunks/legend-C0mU7dqd.js.map +0 -1
  64. package/dist/chunks/line-chart-VuMYKzW3.js +0 -453
  65. package/dist/chunks/line-chart-VuMYKzW3.js.map +0 -1
  66. package/dist/chunks/trace-CjOi3_IP.js.map +0 -1
  67. package/dist/chunks/use-measure-C-i54AC6.js +0 -629
  68. package/dist/chunks/use-measure-C-i54AC6.js.map +0 -1
  69. package/dist/src/components/chart/axes.d.ts +0 -22
@@ -0,0 +1,1338 @@
1
+ "use client";
2
+ import { t as ne } from "./cn-ChIgwEl3.js";
3
+ import { FADE_ENTRANCE as _t, SPAN_SCALE as Fe, SPRING_ENTRANCE as ue } from "../motion.js";
4
+ import { t as he } from "./skeleton-DwjSl4vC.js";
5
+ import { Children as wt, Fragment as kt, isValidElement as Ct, useCallback as Nt, useContext as R, useEffect as Dt, useId as je, useLayoutEffect as St, useMemo as K, useRef as Xe, useState as Ft } from "react";
6
+ import { Fragment as Ut, jsx as u, jsxs as x } from "react/jsx-runtime";
7
+ import { useAnimate as At, useReducedMotion as It } from "motion/react";
8
+ import { AreaSeries as Lt, Axis as Ve, BarGroup as Yt, BarSeries as Ht, BarStack as Kt, DataContext as G, DataProvider as Wt, Grid as $t, LineSeries as Rt, TooltipContext as Et, TooltipProvider as Pt, XYChart as Bt, buildChartTheme as zt } from "@visx/xychart";
9
+ function Ge(e) {
10
+ this._context = e;
11
+ }
12
+ Ge.prototype = {
13
+ areaStart: function() {
14
+ this._line = 0;
15
+ },
16
+ areaEnd: function() {
17
+ this._line = NaN;
18
+ },
19
+ lineStart: function() {
20
+ this._point = 0;
21
+ },
22
+ lineEnd: function() {
23
+ (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
24
+ },
25
+ point: function(e, t) {
26
+ switch (e = +e, t = +t, this._point) {
27
+ case 0:
28
+ this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
29
+ break;
30
+ case 1:
31
+ this._point = 2;
32
+ default:
33
+ this._context.lineTo(e, t);
34
+ }
35
+ }
36
+ };
37
+ function Ot(e) {
38
+ return new Ge(e);
39
+ }
40
+ function Ue(e) {
41
+ return e < 0 ? -1 : 1;
42
+ }
43
+ function Ae(e, t, n) {
44
+ var o = e._x1 - e._x0, r = t - e._x1, i = (e._y1 - e._y0) / (o || r < 0 && -0), a = (n - e._y1) / (r || o < 0 && -0), s = (i * r + a * o) / (o + r);
45
+ return (Ue(i) + Ue(a)) * Math.min(Math.abs(i), Math.abs(a), 0.5 * Math.abs(s)) || 0;
46
+ }
47
+ function Ie(e, t) {
48
+ var n = e._x1 - e._x0;
49
+ return n ? (3 * (e._y1 - e._y0) / n - t) / 2 : t;
50
+ }
51
+ function fe(e, t, n) {
52
+ var o = e._x0, r = e._y0, i = e._x1, a = e._y1, s = (i - o) / 3;
53
+ e._context.bezierCurveTo(o + s, r + s * t, i - s, a - s * n, i, a);
54
+ }
55
+ function re(e) {
56
+ this._context = e;
57
+ }
58
+ re.prototype = {
59
+ areaStart: function() {
60
+ this._line = 0;
61
+ },
62
+ areaEnd: function() {
63
+ this._line = NaN;
64
+ },
65
+ lineStart: function() {
66
+ this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
67
+ },
68
+ lineEnd: function() {
69
+ switch (this._point) {
70
+ case 2:
71
+ this._context.lineTo(this._x1, this._y1);
72
+ break;
73
+ case 3:
74
+ fe(this, this._t0, Ie(this, this._t0));
75
+ }
76
+ (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
77
+ },
78
+ point: function(e, t) {
79
+ var n = NaN;
80
+ if (e = +e, t = +t, !(e === this._x1 && t === this._y1)) {
81
+ switch (this._point) {
82
+ case 0:
83
+ this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
84
+ break;
85
+ case 1:
86
+ this._point = 2;
87
+ break;
88
+ case 2:
89
+ this._point = 3, fe(this, Ie(this, n = Ae(this, e, t)), n);
90
+ break;
91
+ default:
92
+ fe(this, this._t0, n = Ae(this, e, t));
93
+ }
94
+ this._x0 = this._x1, this._x1 = e, this._y0 = this._y1, this._y1 = t, this._t0 = n;
95
+ }
96
+ }
97
+ };
98
+ function jt(e) {
99
+ this._context = new qe(e);
100
+ }
101
+ (jt.prototype = Object.create(re.prototype)).point = function(e, t) {
102
+ re.prototype.point.call(this, t, e);
103
+ };
104
+ function qe(e) {
105
+ this._context = e;
106
+ }
107
+ qe.prototype = {
108
+ moveTo: function(e, t) {
109
+ this._context.moveTo(t, e);
110
+ },
111
+ closePath: function() {
112
+ this._context.closePath();
113
+ },
114
+ lineTo: function(e, t) {
115
+ this._context.lineTo(t, e);
116
+ },
117
+ bezierCurveTo: function(e, t, n, o, r, i) {
118
+ this._context.bezierCurveTo(t, e, o, n, i, r);
119
+ }
120
+ };
121
+ function Xt(e) {
122
+ return new re(e);
123
+ }
124
+ var Le = [
125
+ "chart-1",
126
+ "chart-2",
127
+ "chart-3",
128
+ "chart-4",
129
+ "chart-5",
130
+ "chart-6"
131
+ ];
132
+ function Vt(e, t) {
133
+ const n = e ?? Le[t % Le.length];
134
+ return `var(--color-pho-${n.startsWith("chart-") ? n : `chart-${n}`})`;
135
+ }
136
+ function Ye(e, t = !1) {
137
+ const n = new Intl.NumberFormat(e, t ? {
138
+ notation: "compact",
139
+ maximumFractionDigits: 1
140
+ } : { maximumFractionDigits: 2 });
141
+ return (o) => n.format(o);
142
+ }
143
+ function A(e, t) {
144
+ const n = e[t];
145
+ return typeof n == "number" && Number.isFinite(n) ? n : null;
146
+ }
147
+ function Gt(e) {
148
+ return e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
149
+ }
150
+ function qt({ data: e, series: t, valueFormat: n, timeFormat: o }) {
151
+ if (e.length === 0) return "No data to show.";
152
+ const r = e[0], i = e[e.length - 1], a = e.length > 1 ? `${o(new Date(r.x))} to ${o(new Date(i.x))}` : o(new Date(r.x)), s = [`${Gt(t.map((l) => l.label))}, ${a}.`];
153
+ for (const l of t) {
154
+ let c = 0, h = 1 / 0, f = -1 / 0, g = null, v = 0;
155
+ for (const B of e) {
156
+ const C = A(B, l.key);
157
+ C != null && (v++, c += C, C < h && (h = C), C > f && (f = C, g = new Date(B.x)));
158
+ }
159
+ if (v === 0) {
160
+ s.push(`${l.label}: no values.`);
161
+ continue;
162
+ }
163
+ const _ = g ? `, peak ${n(f)} at ${o(g)}` : "";
164
+ s.push(l.kind === "bar" ? `${l.label}: ${n(c)} in total${_}.` : `${l.label}: from ${n(h)} to ${n(f)}${_}.`);
165
+ }
166
+ return s.join(" ");
167
+ }
168
+ function Ze({ color: e, kind: t = "rect", dashed: n }) {
169
+ return t === "line" ? /* @__PURE__ */ u("svg", {
170
+ "aria-hidden": !0,
171
+ width: "14",
172
+ height: "6",
173
+ className: "shrink-0",
174
+ children: /* @__PURE__ */ u("line", {
175
+ x1: "1",
176
+ x2: "13",
177
+ y1: "3",
178
+ y2: "3",
179
+ stroke: e,
180
+ strokeWidth: "2",
181
+ strokeLinecap: "round",
182
+ strokeDasharray: n ? "3 3" : void 0
183
+ })
184
+ }) : /* @__PURE__ */ u("span", {
185
+ "aria-hidden": !0,
186
+ className: "inline-block size-2 shrink-0 rounded-[2px]",
187
+ style: { background: e }
188
+ });
189
+ }
190
+ function Zt({ items: e, className: t, ...n }) {
191
+ return /* @__PURE__ */ u("ul", {
192
+ className: ne("text-pho-secondary flex flex-wrap gap-x-4 gap-y-1 text-xs", t),
193
+ ...n,
194
+ children: e.map((o) => /* @__PURE__ */ x("li", {
195
+ className: "flex items-center gap-1.5",
196
+ children: [/* @__PURE__ */ u(Ze, {
197
+ color: o.color,
198
+ kind: o.kind,
199
+ dashed: o.dashed
200
+ }), o.label]
201
+ }, o.label))
202
+ });
203
+ }
204
+ function de(e, t) {
205
+ return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
206
+ }
207
+ function Jt(e, t) {
208
+ return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
209
+ }
210
+ function Qt(e) {
211
+ let t, n, o;
212
+ e.length !== 2 ? (t = de, n = (s, l) => de(e(s), l), o = (s, l) => e(s) - l) : (t = e === de || e === Jt ? e : en, n = e, o = e);
213
+ function r(s, l, c = 0, h = s.length) {
214
+ if (c < h) {
215
+ if (t(l, l) !== 0) return h;
216
+ do {
217
+ const f = c + h >>> 1;
218
+ n(s[f], l) < 0 ? c = f + 1 : h = f;
219
+ } while (c < h);
220
+ }
221
+ return c;
222
+ }
223
+ function i(s, l, c = 0, h = s.length) {
224
+ if (c < h) {
225
+ if (t(l, l) !== 0) return h;
226
+ do {
227
+ const f = c + h >>> 1;
228
+ n(s[f], l) <= 0 ? c = f + 1 : h = f;
229
+ } while (c < h);
230
+ }
231
+ return c;
232
+ }
233
+ function a(s, l, c = 0, h = s.length) {
234
+ const f = r(s, l, c, h - 1);
235
+ return f > c && o(s[f - 1], l) > -o(s[f], l) ? f - 1 : f;
236
+ }
237
+ return {
238
+ left: r,
239
+ center: a,
240
+ right: i
241
+ };
242
+ }
243
+ function en() {
244
+ return 0;
245
+ }
246
+ var tn = Math.sqrt(50), nn = Math.sqrt(10), rn = Math.sqrt(2);
247
+ function ie(e, t, n) {
248
+ const o = (t - e) / Math.max(0, n), r = Math.floor(Math.log10(o)), i = o / Math.pow(10, r), a = i >= tn ? 10 : i >= nn ? 5 : i >= rn ? 2 : 1;
249
+ let s, l, c;
250
+ return r < 0 ? (c = Math.pow(10, -r) / a, s = Math.round(e * c), l = Math.round(t * c), s / c < e && ++s, l / c > t && --l, c = -c) : (c = Math.pow(10, r) * a, s = Math.round(e / c), l = Math.round(t / c), s * c < e && ++s, l * c > t && --l), l < s && 0.5 <= n && n < 2 ? ie(e, t, n * 2) : [
251
+ s,
252
+ l,
253
+ c
254
+ ];
255
+ }
256
+ function on(e, t, n) {
257
+ if (t = +t, e = +e, n = +n, !(n > 0)) return [];
258
+ if (e === t) return [e];
259
+ const o = t < e, [r, i, a] = o ? ie(t, e, n) : ie(e, t, n);
260
+ if (!(i >= r)) return [];
261
+ const s = i - r + 1, l = new Array(s);
262
+ if (o)
263
+ if (a < 0) for (let c = 0; c < s; ++c) l[c] = (i - c) / -a;
264
+ else for (let c = 0; c < s; ++c) l[c] = (i - c) * a;
265
+ else if (a < 0) for (let c = 0; c < s; ++c) l[c] = (r + c) / -a;
266
+ else for (let c = 0; c < s; ++c) l[c] = (r + c) * a;
267
+ return l;
268
+ }
269
+ function He(e, t, n) {
270
+ return t = +t, e = +e, n = +n, ie(e, t, n)[2];
271
+ }
272
+ function oe(e, t, n) {
273
+ t = +t, e = +e, n = +n;
274
+ const o = t < e, r = o ? He(t, e, n) : He(e, t, n);
275
+ return (o ? -1 : 1) * (r < 0 ? 1 / -r : r);
276
+ }
277
+ var me = /* @__PURE__ */ new Date(), ge = /* @__PURE__ */ new Date();
278
+ function y(e, t, n, o) {
279
+ function r(i) {
280
+ return e(i = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+i)), i;
281
+ }
282
+ return r.floor = (i) => (e(i = /* @__PURE__ */ new Date(+i)), i), r.ceil = (i) => (e(i = /* @__PURE__ */ new Date(i - 1)), t(i, 1), e(i), i), r.round = (i) => {
283
+ const a = r(i), s = r.ceil(i);
284
+ return i - a < s - i ? a : s;
285
+ }, r.offset = (i, a) => (t(i = /* @__PURE__ */ new Date(+i), a == null ? 1 : Math.floor(a)), i), r.range = (i, a, s) => {
286
+ const l = [];
287
+ if (i = r.ceil(i), s = s == null ? 1 : Math.floor(s), !(i < a) || !(s > 0)) return l;
288
+ let c;
289
+ do
290
+ l.push(c = /* @__PURE__ */ new Date(+i)), t(i, s), e(i);
291
+ while (c < i && i < a);
292
+ return l;
293
+ }, r.filter = (i) => y((a) => {
294
+ if (a >= a) for (; e(a), !i(a); ) a.setTime(a - 1);
295
+ }, (a, s) => {
296
+ if (a >= a)
297
+ if (s < 0) for (; ++s <= 0; ) for (; t(a, -1), !i(a); ) ;
298
+ else for (; --s >= 0; ) for (; t(a, 1), !i(a); ) ;
299
+ }), n && (r.count = (i, a) => (me.setTime(+i), ge.setTime(+a), e(me), e(ge), Math.floor(n(me, ge))), r.every = (i) => (i = Math.floor(i), !isFinite(i) || !(i > 0) ? null : i > 1 ? r.filter(o ? (a) => o(a) % i === 0 : (a) => r.count(0, a) % i === 0) : r)), r;
300
+ }
301
+ var ae = y(() => {
302
+ }, (e, t) => {
303
+ e.setTime(+e + t);
304
+ }, (e, t) => t - e);
305
+ ae.every = (e) => (e = Math.floor(e), !isFinite(e) || !(e > 0) ? null : e > 1 ? y((t) => {
306
+ t.setTime(Math.floor(t / e) * e);
307
+ }, (t, n) => {
308
+ t.setTime(+t + n * e);
309
+ }, (t, n) => (n - t) / e) : ae);
310
+ var fr = ae.range, F = 1e3, k = F * 60, U = k * 60, I = U * 24, Te = I * 7, Ke = I * 30, pe = I * 365, Z = y((e) => {
311
+ e.setTime(e - e.getMilliseconds());
312
+ }, (e, t) => {
313
+ e.setTime(+e + t * F);
314
+ }, (e, t) => (t - e) / F, (e) => e.getUTCSeconds()), dr = Z.range, Je = y((e) => {
315
+ e.setTime(e - e.getMilliseconds() - e.getSeconds() * F);
316
+ }, (e, t) => {
317
+ e.setTime(+e + t * k);
318
+ }, (e, t) => (t - e) / k, (e) => e.getMinutes()), mr = Je.range, Qe = y((e) => {
319
+ e.setUTCSeconds(0, 0);
320
+ }, (e, t) => {
321
+ e.setTime(+e + t * k);
322
+ }, (e, t) => (t - e) / k, (e) => e.getUTCMinutes()), gr = Qe.range, et = y((e) => {
323
+ e.setTime(e - e.getMilliseconds() - e.getSeconds() * F - e.getMinutes() * k);
324
+ }, (e, t) => {
325
+ e.setTime(+e + t * U);
326
+ }, (e, t) => (t - e) / U, (e) => e.getHours()), pr = et.range, tt = y((e) => {
327
+ e.setUTCMinutes(0, 0, 0);
328
+ }, (e, t) => {
329
+ e.setTime(+e + t * U);
330
+ }, (e, t) => (t - e) / U, (e) => e.getUTCHours()), vr = tt.range, X = y((e) => e.setHours(0, 0, 0, 0), (e, t) => e.setDate(e.getDate() + t), (e, t) => (t - e - (t.getTimezoneOffset() - e.getTimezoneOffset()) * k) / I, (e) => e.getDate() - 1), yr = X.range, an = y((e) => {
331
+ e.setUTCHours(0, 0, 0, 0);
332
+ }, (e, t) => {
333
+ e.setUTCDate(e.getUTCDate() + t);
334
+ }, (e, t) => (t - e) / I, (e) => e.getUTCDate() - 1), br = an.range, nt = y((e) => {
335
+ e.setUTCHours(0, 0, 0, 0);
336
+ }, (e, t) => {
337
+ e.setUTCDate(e.getUTCDate() + t);
338
+ }, (e, t) => (t - e) / I, (e) => Math.floor(e / I)), Tr = nt.range;
339
+ function E(e) {
340
+ return y((t) => {
341
+ t.setDate(t.getDate() - (t.getDay() + 7 - e) % 7), t.setHours(0, 0, 0, 0);
342
+ }, (t, n) => {
343
+ t.setDate(t.getDate() + n * 7);
344
+ }, (t, n) => (n - t - (n.getTimezoneOffset() - t.getTimezoneOffset()) * k) / Te);
345
+ }
346
+ var rt = E(0), sn = E(1), cn = E(2), ln = E(3), un = E(4), hn = E(5), fn = E(6), xr = rt.range, Mr = sn.range, _r = cn.range, wr = ln.range, kr = un.range, Cr = hn.range, Nr = fn.range;
347
+ function P(e) {
348
+ return y((t) => {
349
+ t.setUTCDate(t.getUTCDate() - (t.getUTCDay() + 7 - e) % 7), t.setUTCHours(0, 0, 0, 0);
350
+ }, (t, n) => {
351
+ t.setUTCDate(t.getUTCDate() + n * 7);
352
+ }, (t, n) => (n - t) / Te);
353
+ }
354
+ var it = P(0), dn = P(1), mn = P(2), gn = P(3), pn = P(4), vn = P(5), yn = P(6), Dr = it.range, Sr = dn.range, Fr = mn.range, Ur = gn.range, Ar = pn.range, Ir = vn.range, Lr = yn.range, ot = y((e) => {
355
+ e.setDate(1), e.setHours(0, 0, 0, 0);
356
+ }, (e, t) => {
357
+ e.setMonth(e.getMonth() + t);
358
+ }, (e, t) => t.getMonth() - e.getMonth() + (t.getFullYear() - e.getFullYear()) * 12, (e) => e.getMonth()), Yr = ot.range, at = y((e) => {
359
+ e.setUTCDate(1), e.setUTCHours(0, 0, 0, 0);
360
+ }, (e, t) => {
361
+ e.setUTCMonth(e.getUTCMonth() + t);
362
+ }, (e, t) => t.getUTCMonth() - e.getUTCMonth() + (t.getUTCFullYear() - e.getUTCFullYear()) * 12, (e) => e.getUTCMonth()), Hr = at.range, se = y((e) => {
363
+ e.setMonth(0, 1), e.setHours(0, 0, 0, 0);
364
+ }, (e, t) => {
365
+ e.setFullYear(e.getFullYear() + t);
366
+ }, (e, t) => t.getFullYear() - e.getFullYear(), (e) => e.getFullYear());
367
+ se.every = (e) => !isFinite(e = Math.floor(e)) || !(e > 0) ? null : y((t) => {
368
+ t.setFullYear(Math.floor(t.getFullYear() / e) * e), t.setMonth(0, 1), t.setHours(0, 0, 0, 0);
369
+ }, (t, n) => {
370
+ t.setFullYear(t.getFullYear() + n * e);
371
+ });
372
+ var Kr = se.range, xe = y((e) => {
373
+ e.setUTCMonth(0, 1), e.setUTCHours(0, 0, 0, 0);
374
+ }, (e, t) => {
375
+ e.setUTCFullYear(e.getUTCFullYear() + t);
376
+ }, (e, t) => t.getUTCFullYear() - e.getUTCFullYear(), (e) => e.getUTCFullYear());
377
+ xe.every = (e) => !isFinite(e = Math.floor(e)) || !(e > 0) ? null : y((t) => {
378
+ t.setUTCFullYear(Math.floor(t.getUTCFullYear() / e) * e), t.setUTCMonth(0, 1), t.setUTCHours(0, 0, 0, 0);
379
+ }, (t, n) => {
380
+ t.setUTCFullYear(t.getUTCFullYear() + n * e);
381
+ });
382
+ var Wr = xe.range;
383
+ function st(e, t, n, o, r, i) {
384
+ const a = [
385
+ [
386
+ Z,
387
+ 1,
388
+ F
389
+ ],
390
+ [
391
+ Z,
392
+ 5,
393
+ 5 * F
394
+ ],
395
+ [
396
+ Z,
397
+ 15,
398
+ 15 * F
399
+ ],
400
+ [
401
+ Z,
402
+ 30,
403
+ 30 * F
404
+ ],
405
+ [
406
+ i,
407
+ 1,
408
+ k
409
+ ],
410
+ [
411
+ i,
412
+ 5,
413
+ 5 * k
414
+ ],
415
+ [
416
+ i,
417
+ 15,
418
+ 15 * k
419
+ ],
420
+ [
421
+ i,
422
+ 30,
423
+ 30 * k
424
+ ],
425
+ [
426
+ r,
427
+ 1,
428
+ U
429
+ ],
430
+ [
431
+ r,
432
+ 3,
433
+ 3 * U
434
+ ],
435
+ [
436
+ r,
437
+ 6,
438
+ 6 * U
439
+ ],
440
+ [
441
+ r,
442
+ 12,
443
+ 12 * U
444
+ ],
445
+ [
446
+ o,
447
+ 1,
448
+ I
449
+ ],
450
+ [
451
+ o,
452
+ 2,
453
+ 2 * I
454
+ ],
455
+ [
456
+ n,
457
+ 1,
458
+ Te
459
+ ],
460
+ [
461
+ t,
462
+ 1,
463
+ Ke
464
+ ],
465
+ [
466
+ t,
467
+ 3,
468
+ 3 * Ke
469
+ ],
470
+ [
471
+ e,
472
+ 1,
473
+ pe
474
+ ]
475
+ ];
476
+ function s(c, h, f) {
477
+ const g = h < c;
478
+ g && ([c, h] = [h, c]);
479
+ const v = f && typeof f.range == "function" ? f : l(c, h, f), _ = v ? v.range(c, +h + 1) : [];
480
+ return g ? _.reverse() : _;
481
+ }
482
+ function l(c, h, f) {
483
+ const g = Math.abs(h - c) / f, v = Qt(([, , C]) => C).right(a, g);
484
+ if (v === a.length) return e.every(oe(c / pe, h / pe, f));
485
+ if (v === 0) return ae.every(Math.max(oe(c, h, f), 1));
486
+ const [_, B] = a[g / a[v - 1][2] < a[v][2] / g ? v - 1 : v];
487
+ return _.every(B);
488
+ }
489
+ return [s, l];
490
+ }
491
+ var [$r, Rr] = st(xe, at, it, nt, tt, Qe), [bn, Er] = st(se, ot, rt, X, et, Je);
492
+ function V(e) {
493
+ return typeof e == "number" ? e : e.getTime();
494
+ }
495
+ function Tn(e, t, n) {
496
+ if (!Number.isFinite(e) || !Number.isFinite(t)) return {
497
+ domain: [0, 1],
498
+ ticks: [0, 1],
499
+ count: 1
500
+ };
501
+ e > t && ([e, t] = [t, e]);
502
+ const o = n?.integer ?? (Number.isInteger(e) && Number.isInteger(t));
503
+ if (e === t) {
504
+ if (t === 0) return o ? {
505
+ domain: [0, 1],
506
+ ticks: [0, 1],
507
+ count: 1
508
+ } : {
509
+ domain: [0, 1],
510
+ ticks: [
511
+ 0,
512
+ 0.5,
513
+ 1
514
+ ],
515
+ count: 2
516
+ };
517
+ t > 0 ? e = 0 : t = 0;
518
+ }
519
+ for (let r = 4; r >= 2; r--) {
520
+ const i = o ? xn(e, t, r) : oe(e, t, r), a = Math.floor(e / i) * i, s = Math.ceil(t / i) * i, l = o ? Mn(a, s, i) : on(a, s, r);
521
+ if (l.length <= 5 || r === 2) return {
522
+ domain: [a, s],
523
+ ticks: l,
524
+ count: o ? Math.max(1, l.length - 1) : r
525
+ };
526
+ }
527
+ return {
528
+ domain: [e, t],
529
+ ticks: [e, t],
530
+ count: 1
531
+ };
532
+ }
533
+ function xn(e, t, n) {
534
+ const o = oe(e, t, n);
535
+ if (o <= 1) return 1;
536
+ if (Number.isInteger(o)) return o;
537
+ const r = 10 ** Math.floor(Math.log10(o)), i = o / r;
538
+ return (i <= 1 ? 1 : i <= 2 ? 2 : i <= 5 ? 5 : 10) * r;
539
+ }
540
+ function Mn(e, t, n) {
541
+ const o = [];
542
+ for (let r = e; r <= t + n / 2; r += n) o.push(r);
543
+ return o;
544
+ }
545
+ function _n(e) {
546
+ if (e.length < 2) return 0;
547
+ const t = [];
548
+ for (let n = 1; n < e.length; n++) t.push(e[n] - e[n - 1]);
549
+ return t.sort((n, o) => n - o), t[Math.floor(t.length / 2)];
550
+ }
551
+ var wn = 864e5;
552
+ function kn(e, t, n) {
553
+ if (t <= e || n <= 0) return [new Date(e)];
554
+ const o = Math.max(2, Math.floor(n / 96)), r = bn(new Date(e), new Date(t), o);
555
+ if (r.length > 2 && r.every((i) => Cn(i))) {
556
+ const i = r.slice(1).map((s, l) => X.count(r[l], s)), a = Math.max(...i);
557
+ if (a > 1 && i.some((s) => s !== a)) return X.range(r[0], new Date(t + 1), a);
558
+ }
559
+ return r;
560
+ }
561
+ function Cn(e) {
562
+ return X(e).getTime() === e.getTime();
563
+ }
564
+ function Nn(e) {
565
+ const t = new Intl.DateTimeFormat(e, {
566
+ hour: "numeric",
567
+ minute: "2-digit"
568
+ }), n = new Intl.DateTimeFormat(e, {
569
+ month: "short",
570
+ day: "numeric"
571
+ }), o = new Intl.DateTimeFormat(e, {
572
+ month: "short",
573
+ year: "numeric"
574
+ });
575
+ return (r) => X(r).getTime() < r.getTime() ? t.format(r) : se(r).getTime() < r.getTime() ? n.format(r) : o.format(r);
576
+ }
577
+ function Dn(e, t) {
578
+ const n = new Intl.DateTimeFormat(e, t >= wn ? {
579
+ month: "short",
580
+ day: "numeric"
581
+ } : {
582
+ month: "short",
583
+ day: "numeric",
584
+ hour: "numeric",
585
+ minute: "2-digit"
586
+ });
587
+ return (o) => n.format(o);
588
+ }
589
+ function Sn(e) {
590
+ return e.length * 6.5 + 16;
591
+ }
592
+ function Fn(e, t, n) {
593
+ if (e.length < 2) return [...e];
594
+ const o = Math.max(...e.map((a) => Sn(t(a)))), r = Math.max(1, Math.floor(n / o)), i = Math.ceil(e.length / r);
595
+ return i <= 1 ? [...e] : e.filter((a, s) => s % i === 0);
596
+ }
597
+ function Un(e, t) {
598
+ if (e.length === 0) return -1;
599
+ let n = 0, o = e.length - 1;
600
+ for (; n < o; ) {
601
+ const r = n + o >> 1;
602
+ e[r] < t ? n = r + 1 : o = r;
603
+ }
604
+ return n > 0 && t - e[n - 1] < e[n] - t ? n - 1 : n;
605
+ }
606
+ var ve = 8, ye = 8, We = 22;
607
+ function An(e, t, n) {
608
+ const o = n.reduce((a, s) => Math.max(a, s.length), 0), r = Math.ceil(o * 6.5) + 10, i = t - We;
609
+ return {
610
+ width: e,
611
+ height: t,
612
+ left: r,
613
+ top: ve,
614
+ right: e - ye,
615
+ bottom: i,
616
+ innerWidth: Math.max(0, e - r - ye),
617
+ innerHeight: Math.max(0, i - ve),
618
+ margin: {
619
+ top: ve,
620
+ right: ye,
621
+ bottom: We,
622
+ left: r
623
+ }
624
+ };
625
+ }
626
+ var In = { "--pho-chart-surface": "var(--pho-surface, var(--background-color-pho-primary))" };
627
+ function Ln({ label: e, description: t, height: n, containerRef: o, legend: r, loading: i, empty: a, showEmpty: s, placeholder: l, className: c, children: h, ...f }) {
628
+ const g = je();
629
+ return /* @__PURE__ */ x("div", {
630
+ "data-chart": "",
631
+ className: ne("flex w-full min-w-0 flex-col gap-3", c),
632
+ ...f,
633
+ children: [/* @__PURE__ */ x("div", {
634
+ ref: o,
635
+ "aria-busy": i || void 0,
636
+ className: ne("relative w-full transition-opacity duration-150 ease-out", i && "opacity-50"),
637
+ style: { height: n },
638
+ children: [
639
+ /* @__PURE__ */ u("div", {
640
+ role: "img",
641
+ "aria-label": e,
642
+ "aria-describedby": g,
643
+ className: "animate-pho-chart-in relative size-full select-none [&_.visx-bar-stack_.visx-bar]:stroke-(--pho-chart-surface) [&_.visx-bar-stack_.visx-bar]:stroke-2 [&_svg]:block [&_svg]:overflow-visible",
644
+ style: In,
645
+ children: h
646
+ }),
647
+ /* @__PURE__ */ u("p", {
648
+ id: g,
649
+ className: "sr-only",
650
+ children: t
651
+ }),
652
+ l,
653
+ s && /* @__PURE__ */ u("div", {
654
+ className: "text-pho-description absolute inset-0 flex items-center justify-center text-xs",
655
+ children: a
656
+ })
657
+ ]
658
+ }), r]
659
+ });
660
+ }
661
+ var Yn = [
662
+ 0.42,
663
+ 0.58,
664
+ 0.5,
665
+ 0.7,
666
+ 0.62,
667
+ 0.8,
668
+ 0.66,
669
+ 0.9,
670
+ 0.72,
671
+ 0.56,
672
+ 0.76,
673
+ 0.64
674
+ ], te = [
675
+ 0,
676
+ 1 / 3,
677
+ 2 / 3,
678
+ 1
679
+ ], Hn = 5;
680
+ function Kn({ layout: e }) {
681
+ const { margin: t } = e;
682
+ return /* @__PURE__ */ x("div", {
683
+ "aria-hidden": !0,
684
+ "data-chart-skeleton": "",
685
+ className: "absolute inset-0 grid",
686
+ style: {
687
+ gridTemplateColumns: `${t.left}px 1fr ${t.right}px`,
688
+ gridTemplateRows: `${t.top}px 1fr ${t.bottom}px`
689
+ },
690
+ children: [
691
+ /* @__PURE__ */ u("div", {
692
+ className: "relative col-start-1 row-start-2",
693
+ children: te.map((n) => /* @__PURE__ */ u(he, {
694
+ "data-bone": "y",
695
+ className: "absolute right-2 h-2.5 w-4 -translate-y-1/2",
696
+ style: { top: `${n * 100}%` }
697
+ }, n))
698
+ }),
699
+ /* @__PURE__ */ x("div", {
700
+ className: "relative col-start-2 row-start-2",
701
+ children: [te.map((n, o) => /* @__PURE__ */ u("div", {
702
+ "data-bone": o === te.length - 1 ? "baseline" : "grid",
703
+ className: ne("absolute inset-x-0 border-t", o === te.length - 1 ? "border-pho-chart-crosshair" : "border-pho-chart-grid"),
704
+ style: { top: `${n * 100}%` }
705
+ }, n)), /* @__PURE__ */ u("div", {
706
+ className: "absolute inset-0 flex items-end justify-between gap-2",
707
+ children: Yn.map((n, o) => /* @__PURE__ */ u(he, {
708
+ "data-bone": "bar",
709
+ className: "w-full max-w-6 rounded-t-[4px] rounded-b-none",
710
+ style: { height: `${n * 100}%` }
711
+ }, o))
712
+ })]
713
+ }),
714
+ /* @__PURE__ */ u("div", {
715
+ className: "col-start-2 row-start-3 flex items-center justify-between px-1",
716
+ children: Array.from({ length: Hn }, (n, o) => /* @__PURE__ */ u(he, {
717
+ "data-bone": "x",
718
+ className: "h-2.5 w-8"
719
+ }, o))
720
+ })
721
+ ]
722
+ });
723
+ }
724
+ var $e = {
725
+ fontFamily: "inherit",
726
+ fontSize: 11,
727
+ fontWeight: 400,
728
+ letterSpacing: 0,
729
+ fill: "var(--text-color-pho-description)",
730
+ style: { fontVariantNumeric: "tabular-nums" }
731
+ };
732
+ function Wn(e) {
733
+ return zt({
734
+ backgroundColor: "var(--pho-surface, var(--background-color-pho-primary))",
735
+ colors: [...e],
736
+ gridColor: "var(--color-pho-chart-grid)",
737
+ gridColorDark: "var(--color-pho-chart-crosshair)",
738
+ tickLength: 4,
739
+ svgLabelSmall: $e,
740
+ svgLabelBig: $e,
741
+ htmlLabel: {
742
+ fontFamily: "inherit",
743
+ fontSize: 11,
744
+ fontWeight: 400,
745
+ letterSpacing: 0,
746
+ color: "var(--text-color-pho-description)"
747
+ }
748
+ });
749
+ }
750
+ function $n({ x: e, width: t, top: n, heading: o, rows: r, breakdown: i, breakdownTitle: a, valueFormat: s }) {
751
+ const l = e > t / 2;
752
+ return /* @__PURE__ */ x("div", {
753
+ "aria-hidden": !0,
754
+ "data-chart-tooltip": "",
755
+ className: "bg-pho-primary shadow-pho-lg ring-pho-secondary rounded-base pointer-events-none absolute z-10 max-w-72 min-w-40 px-3 py-2 text-xs ring-1 ring-inset",
756
+ style: l ? {
757
+ right: t - e + 12,
758
+ top: n
759
+ } : {
760
+ left: e + 12,
761
+ top: n
762
+ },
763
+ children: [
764
+ /* @__PURE__ */ u("div", {
765
+ className: "text-pho-primary font-medium",
766
+ children: o
767
+ }),
768
+ /* @__PURE__ */ u("ul", {
769
+ className: "mt-1 flex flex-col gap-0.5",
770
+ children: r.map((c) => /* @__PURE__ */ x("li", {
771
+ className: "flex items-center justify-between gap-4",
772
+ children: [/* @__PURE__ */ x("span", {
773
+ className: "text-pho-secondary flex min-w-0 items-center gap-1.5",
774
+ children: [/* @__PURE__ */ u(Ze, {
775
+ color: c.color,
776
+ kind: c.kind,
777
+ dashed: c.dashed
778
+ }), /* @__PURE__ */ u("span", {
779
+ className: "truncate",
780
+ children: c.label
781
+ })]
782
+ }), /* @__PURE__ */ u("span", {
783
+ className: "text-pho-primary font-medium tabular-nums",
784
+ children: c.value
785
+ })]
786
+ }, c.label))
787
+ }),
788
+ i != null && i.length > 0 && /* @__PURE__ */ x("div", {
789
+ className: "border-pho-secondary mt-2 border-t pt-2",
790
+ children: [a != null && /* @__PURE__ */ u("div", {
791
+ className: "text-pho-description mb-1",
792
+ children: a
793
+ }), /* @__PURE__ */ u("ul", {
794
+ className: "flex flex-col gap-0.5",
795
+ children: i.map((c) => /* @__PURE__ */ x("li", {
796
+ className: "flex items-center justify-between gap-4",
797
+ children: [/* @__PURE__ */ u("span", {
798
+ className: "text-pho-secondary truncate",
799
+ children: c.label
800
+ }), /* @__PURE__ */ u("span", {
801
+ className: "text-pho-primary tabular-nums",
802
+ children: s(c.value)
803
+ })]
804
+ }, c.label))
805
+ })]
806
+ })
807
+ ]
808
+ });
809
+ }
810
+ var ct = typeof window > "u" ? Dt : St;
811
+ function Rn(e) {
812
+ const t = Xe(null), [n, o] = Ft(0);
813
+ return ct(() => {
814
+ if (e != null) return;
815
+ const r = t.current;
816
+ if (r == null || (o(r.getBoundingClientRect().width), typeof ResizeObserver > "u")) return;
817
+ const i = new ResizeObserver((a) => {
818
+ const s = a[0]?.contentRect.width;
819
+ s != null && o(s);
820
+ });
821
+ return i.observe(r), () => i.disconnect();
822
+ }, [e]), [t, e ?? n];
823
+ }
824
+ var En = 24, Pn = 4, Re = 2, Bn = 4, zn = "var(--pho-chart-surface)", On = "var(--background-color-pho-ghost-hover)", lt = "var(--color-pho-chart-crosshair)";
825
+ function Me(e) {
826
+ return null;
827
+ }
828
+ Me.displayName = "Chart.Bar";
829
+ Me.chartPart = "bar";
830
+ function _e(e) {
831
+ return null;
832
+ }
833
+ _e.displayName = "Chart.Line";
834
+ _e.chartPart = "line";
835
+ function jn(e) {
836
+ return e?.chartPart;
837
+ }
838
+ function ut(e, t = []) {
839
+ return wt.forEach(e, (n) => {
840
+ if (!Ct(n)) return;
841
+ const o = jn(n.type);
842
+ if (n.type === kt) ut(n.props.children, t);
843
+ else if (o === "bar") {
844
+ const r = n.props;
845
+ t.push({
846
+ kind: "bar",
847
+ dataKey: r.dataKey,
848
+ label: r.label,
849
+ color: r.color,
850
+ curve: "linear"
851
+ });
852
+ } else if (o === "line") {
853
+ const r = n.props;
854
+ t.push({
855
+ kind: "line",
856
+ dataKey: r.dataKey,
857
+ label: r.label,
858
+ color: r.color,
859
+ dashed: r.dashed,
860
+ curve: r.curve ?? "linear",
861
+ area: r.area
862
+ });
863
+ }
864
+ }), t;
865
+ }
866
+ var be = (e) => V(e.x), Ee = /* @__PURE__ */ new Map();
867
+ function Xn(e) {
868
+ let t = Ee.get(e);
869
+ return t == null && (t = (n) => A(n, e) ?? 0, Ee.set(e, t)), t;
870
+ }
871
+ var Pe = /* @__PURE__ */ new Map();
872
+ function Be(e) {
873
+ let t = Pe.get(e);
874
+ return t == null && (t = (n) => A(n, e) ?? NaN, Pe.set(e, t)), t;
875
+ }
876
+ var ze = /* @__PURE__ */ new Map();
877
+ function Vn(e, t) {
878
+ const n = `${e} ${t}`;
879
+ let o = ze.get(n);
880
+ return o == null && (o = (r) => A(r, e) ? t : "transparent", ze.set(n, o)), o;
881
+ }
882
+ function ce(e) {
883
+ const t = e, n = typeof t.bandwidth == "function" ? t.bandwidth() / 2 : 0;
884
+ return (o) => {
885
+ const r = t(o);
886
+ return typeof r == "number" && Number.isFinite(r) ? r + n : void 0;
887
+ };
888
+ }
889
+ function ht(e) {
890
+ const t = e;
891
+ return (n) => {
892
+ const o = t(Number(n));
893
+ return typeof o == "number" && Number.isFinite(o) ? o : void 0;
894
+ };
895
+ }
896
+ function Gn(e) {
897
+ const t = e;
898
+ return typeof t.step == "function" ? t.step() : 0;
899
+ }
900
+ function qn(e, t, n, o) {
901
+ const r = t > 0 ? e / t : 0, i = r >= 6 ? 2 : r >= 3 ? 1 : 0, a = Math.max(1, Math.min(En, r - i)), s = Math.min(2, i), l = o ? a + s : n > 1 ? a + 2 * s : a, c = Math.min(r, l), h = r > 0 ? 1 - c / r : 0, f = n > 1 && c > s ? Math.min(0.5, s * n / (c - s)) : 0;
902
+ return {
903
+ paddingInner: h,
904
+ paddingOuter: h / 2,
905
+ groupPadding: f
906
+ };
907
+ }
908
+ function Oe({ children: e }) {
909
+ const { dataRegistry: t } = R(G);
910
+ return t?.entries().some((n) => n.data.length > 0) ?? !1 ? /* @__PURE__ */ u(Ut, { children: e }) : null;
911
+ }
912
+ function we(e) {
913
+ const t = R(Et), n = t?.tooltipOpen ? t.tooltipData?.nearestDatum?.index : void 0;
914
+ return n != null && n >= 0 && n < e ? n : null;
915
+ }
916
+ function Zn({ values: e, format: t, layout: n }) {
917
+ const { xScale: o } = R(G), r = Nt((i) => {
918
+ const a = i, s = ce(o)(a) ?? n.left, l = t(a).length * 6.5 / 2;
919
+ return { textAnchor: s - l < n.left ? "start" : s + l > n.right ? "end" : "middle" };
920
+ }, [
921
+ o,
922
+ t,
923
+ n.left,
924
+ n.right
925
+ ]);
926
+ return /* @__PURE__ */ u(Ve, {
927
+ orientation: "bottom",
928
+ tickValues: [...e],
929
+ tickFormat: (i) => t(i),
930
+ hideAxisLine: !0,
931
+ hideTicks: !0,
932
+ tickLabelProps: r
933
+ });
934
+ }
935
+ function Jn({ data: e, layout: t }) {
936
+ const { xScale: n } = R(G), o = we(e.length);
937
+ if (o == null || n == null) return null;
938
+ const r = ce(n)(V(e[o].x)), i = Gn(n);
939
+ return r == null ? null : /* @__PURE__ */ u("rect", {
940
+ "data-hover-wash": "",
941
+ x: r - i / 2,
942
+ y: t.top,
943
+ width: i,
944
+ height: t.innerHeight,
945
+ fill: On
946
+ });
947
+ }
948
+ function Qn({ layout: e }) {
949
+ const { yScale: t } = R(G), n = t ? ht(t)(0) : void 0;
950
+ return n == null ? null : /* @__PURE__ */ u("line", {
951
+ "data-zero": "",
952
+ x1: e.left,
953
+ x2: e.right,
954
+ y1: n,
955
+ y2: n,
956
+ stroke: lt
957
+ });
958
+ }
959
+ function er({ data: e, layout: t, lines: n, crosshair: o }) {
960
+ const { xScale: r, yScale: i } = R(G), a = we(e.length);
961
+ if (a == null || r == null || i == null) return null;
962
+ const s = e[a], l = ce(r)(V(s.x));
963
+ if (l == null) return null;
964
+ const c = ht(i);
965
+ return /* @__PURE__ */ x("g", {
966
+ "data-hover": "",
967
+ children: [o && /* @__PURE__ */ u("line", {
968
+ x1: l,
969
+ x2: l,
970
+ y1: t.top,
971
+ y2: t.bottom,
972
+ stroke: lt
973
+ }), n.length > 0 && /* @__PURE__ */ u("g", {
974
+ "data-points": "",
975
+ children: n.map((h) => {
976
+ const f = A(s, h.dataKey), g = f == null ? void 0 : c(f);
977
+ return g == null ? null : /* @__PURE__ */ u("circle", {
978
+ cx: l,
979
+ cy: g,
980
+ r: Bn,
981
+ fill: h.color,
982
+ stroke: zn,
983
+ strokeWidth: 2
984
+ }, h.dataKey);
985
+ })
986
+ })]
987
+ });
988
+ }
989
+ function tr({ data: e, range: t, layout: n, children: o }) {
990
+ const r = It(), [i, a] = At(), s = je(), l = Xe(null);
991
+ ct(() => {
992
+ const h = i.current, f = l.current;
993
+ if (l.current = t, e.length === 0 || r || h == null) return;
994
+ const g = { opacity: _t }, v = f == null ? a(h, {
995
+ scaleY: [0, 1],
996
+ scaleX: 1,
997
+ x: 0,
998
+ opacity: [0, 1],
999
+ originY: 1
1000
+ }, {
1001
+ scaleY: ue,
1002
+ ...g
1003
+ }) : f === 0 || t === f ? a(h, {
1004
+ x: [-12, 0],
1005
+ scaleX: 1,
1006
+ scaleY: 1,
1007
+ opacity: [0, 1]
1008
+ }, {
1009
+ x: ue,
1010
+ ...g
1011
+ }) : a(h, {
1012
+ scaleX: [t > f ? Fe : 1 / Fe, 1],
1013
+ scaleY: 1,
1014
+ x: 0,
1015
+ opacity: [0, 1],
1016
+ originX: 0.5
1017
+ }, {
1018
+ scaleX: ue,
1019
+ ...g
1020
+ });
1021
+ return () => v.stop();
1022
+ }, [
1023
+ e,
1024
+ t,
1025
+ r
1026
+ ]);
1027
+ const c = 4;
1028
+ return /* @__PURE__ */ x("g", {
1029
+ clipPath: `url(#${s})`,
1030
+ children: [/* @__PURE__ */ u("defs", { children: /* @__PURE__ */ u("clipPath", {
1031
+ id: s,
1032
+ children: /* @__PURE__ */ u("rect", {
1033
+ x: n.left - c,
1034
+ y: n.top - c,
1035
+ width: n.innerWidth + 8,
1036
+ height: n.innerHeight + 8
1037
+ })
1038
+ }) }), /* @__PURE__ */ u("g", {
1039
+ ref: i,
1040
+ "data-marks": "",
1041
+ children: o
1042
+ })]
1043
+ });
1044
+ }
1045
+ function nr({ data: e, layout: t, parts: n, colors: o, width: r, headingFormat: i, valueFormat: a, breakdownTitle: s }) {
1046
+ const { xScale: l } = R(G), c = we(e.length);
1047
+ if (c == null || l == null) return null;
1048
+ const h = e[c], f = ce(l)(V(h.x));
1049
+ return f == null ? null : /* @__PURE__ */ u($n, {
1050
+ x: f,
1051
+ width: r,
1052
+ top: t.top,
1053
+ heading: i(new Date(h.x)),
1054
+ rows: n.map((g, v) => {
1055
+ const _ = A(h, g.dataKey);
1056
+ return {
1057
+ label: g.label,
1058
+ value: _ == null ? "No data" : a(_),
1059
+ color: o[v],
1060
+ kind: g.kind === "bar" ? "rect" : "line",
1061
+ dashed: g.dashed
1062
+ };
1063
+ }),
1064
+ breakdown: h.breakdown,
1065
+ breakdownTitle: s,
1066
+ valueFormat: a
1067
+ });
1068
+ }
1069
+ var rr = {
1070
+ dx: "-0.35em",
1071
+ dy: "0.35em",
1072
+ width: void 0
1073
+ };
1074
+ function ke({ data: e, children: t, label: n, description: o, height: r = 200, width: i, valueFormat: a, timeFormat: s, locale: l, legend: c, baseline: h = "zero", stacked: f = !1, breakdownTitle: g, loading: v, empty: _ = "Nothing here yet.", className: B, ...C }) {
1075
+ const [ft, z] = Rn(i), D = K(() => ut(t), [t]), d = K(() => {
1076
+ const m = e.map((p) => V(p.x)), w = _n(m), M = a ?? Ye(l, !0), b = a ?? Ye(l), W = s ?? Dn(l, w), J = D.map((p, N) => Vt(p.color, N)), S = D.filter((p) => p.kind === "bar"), De = D.map((p, N) => ({
1077
+ ...p,
1078
+ color: J[N]
1079
+ })).filter((p) => p.kind === "line");
1080
+ let $ = 1 / 0, j = -1 / 0;
1081
+ const Q = (p) => {
1082
+ p < $ && ($ = p), p > j && (j = p);
1083
+ };
1084
+ if (f && S.length > 1) for (const p of e) {
1085
+ let N = 0, H = 0;
1086
+ for (const Mt of S) {
1087
+ const ee = A(p, Mt.dataKey);
1088
+ ee != null && (ee > 0 ? N += ee : H += ee);
1089
+ }
1090
+ Q(N), Q(H);
1091
+ }
1092
+ else for (const p of S) for (const N of e) {
1093
+ const H = A(N, p.dataKey);
1094
+ H != null && Q(H);
1095
+ }
1096
+ for (const p of De) for (const N of e) {
1097
+ const H = A(N, p.dataKey);
1098
+ H != null && Q(H);
1099
+ }
1100
+ $ === 1 / 0 && ($ = 0, j = 0), (h === "zero" || S.length > 0) && ($ = Math.min(0, $), j = Math.max(0, j));
1101
+ const Se = Tn($, j);
1102
+ return {
1103
+ times: m,
1104
+ span: w,
1105
+ colors: J,
1106
+ bars: S,
1107
+ lines: De,
1108
+ hasBars: S.length > 0,
1109
+ axisFormat: M,
1110
+ fullFormat: b,
1111
+ headingFormat: W,
1112
+ y: Se,
1113
+ yLabels: Se.ticks.map(M),
1114
+ described: o ?? qt({
1115
+ data: e,
1116
+ series: D.map((p) => ({
1117
+ key: p.dataKey,
1118
+ label: p.label,
1119
+ kind: p.kind
1120
+ })),
1121
+ valueFormat: b,
1122
+ timeFormat: W
1123
+ })
1124
+ };
1125
+ }, [
1126
+ e,
1127
+ D,
1128
+ f,
1129
+ h,
1130
+ a,
1131
+ s,
1132
+ l,
1133
+ o
1134
+ ]), L = e.length, Y = d.times[0] ?? 0, O = d.times[L - 1] ?? 0, dt = L > 0 ? O - Y + d.span : 0, T = K(() => An(z, r, d.yLabels), [
1135
+ z,
1136
+ r,
1137
+ d.yLabels
1138
+ ]), q = K(() => qn(T.innerWidth, L, d.bars.length, f), [
1139
+ T.innerWidth,
1140
+ L,
1141
+ d.bars.length,
1142
+ f
1143
+ ]), mt = K(() => d.hasBars ? {
1144
+ type: "band",
1145
+ domain: d.times,
1146
+ paddingInner: q.paddingInner,
1147
+ paddingOuter: q.paddingOuter
1148
+ } : {
1149
+ type: "time",
1150
+ domain: O > Y ? [Y, O] : [Y - 1, Y + 1]
1151
+ }, [
1152
+ d.hasBars,
1153
+ d.times,
1154
+ q.paddingInner,
1155
+ q.paddingOuter,
1156
+ Y,
1157
+ O
1158
+ ]), gt = K(() => ({
1159
+ type: "linear",
1160
+ domain: d.y.domain,
1161
+ zero: !1,
1162
+ nice: !1
1163
+ }), [d.y.domain]), pt = K(() => Wn(d.colors), [d.colors]), Ce = K(() => {
1164
+ const m = Nn(l);
1165
+ if (L === 0 || T.innerWidth <= 0) return {
1166
+ values: [],
1167
+ format: () => ""
1168
+ };
1169
+ const w = Fn(kn(Y, O, T.innerWidth), m, T.innerWidth);
1170
+ if (!d.hasBars) return {
1171
+ values: w,
1172
+ format: (b) => m(new Date(b))
1173
+ };
1174
+ const M = /* @__PURE__ */ new Map();
1175
+ for (const b of w) {
1176
+ const W = d.times[Un(d.times, b.getTime())];
1177
+ M.has(W) || M.set(W, m(b));
1178
+ }
1179
+ return {
1180
+ values: [...M.keys()],
1181
+ format: (b) => M.get(V(b)) ?? m(new Date(b))
1182
+ };
1183
+ }, [
1184
+ L,
1185
+ Y,
1186
+ O,
1187
+ T.innerWidth,
1188
+ l,
1189
+ d.hasBars,
1190
+ d.times
1191
+ ]), vt = c ?? D.length > 1, Ne = L === 0 && !v, yt = L === 0 && v === !0, bt = d.y.domain[0] >= 0 || d.y.domain[1] <= 0, le = e, Tt = (() => {
1192
+ const { bars: m } = d;
1193
+ if (m.length === 0) return null;
1194
+ const w = m.length - 1, M = m.map((b, W) => {
1195
+ const J = d.colors[D.indexOf(b)], S = !f || W === w;
1196
+ return /* @__PURE__ */ u(Ht, {
1197
+ dataKey: b.dataKey,
1198
+ data: le,
1199
+ xAccessor: be,
1200
+ yAccessor: Xn(b.dataKey),
1201
+ colorAccessor: Vn(b.dataKey, J),
1202
+ radius: S ? Pn : void 0,
1203
+ radiusTop: S,
1204
+ "data-series": b.dataKey
1205
+ }, b.dataKey);
1206
+ });
1207
+ return m.length === 1 ? M : f ? /* @__PURE__ */ u(Kt, { children: M }) : /* @__PURE__ */ u(Yt, {
1208
+ padding: q.groupPadding,
1209
+ children: M
1210
+ });
1211
+ })(), xt = d.lines.map((m) => {
1212
+ const w = m.curve === "monotone" ? Xt : Ot, M = m.dashed ? "4 4" : void 0;
1213
+ return m.area ? /* @__PURE__ */ u(Lt, {
1214
+ dataKey: m.dataKey,
1215
+ data: le,
1216
+ xAccessor: be,
1217
+ yAccessor: Be(m.dataKey),
1218
+ curve: w,
1219
+ fill: m.color,
1220
+ fillOpacity: 0.1,
1221
+ lineProps: {
1222
+ stroke: m.color,
1223
+ strokeWidth: Re,
1224
+ strokeLinejoin: "round",
1225
+ strokeDasharray: M
1226
+ },
1227
+ "data-series": m.dataKey
1228
+ }, m.dataKey) : /* @__PURE__ */ u(Rt, {
1229
+ dataKey: m.dataKey,
1230
+ data: le,
1231
+ xAccessor: be,
1232
+ yAccessor: Be(m.dataKey),
1233
+ curve: w,
1234
+ stroke: m.color,
1235
+ strokeWidth: Re,
1236
+ strokeLinejoin: "round",
1237
+ strokeDasharray: M,
1238
+ "data-series": m.dataKey
1239
+ }, m.dataKey);
1240
+ });
1241
+ return /* @__PURE__ */ u(Ln, {
1242
+ label: n,
1243
+ description: d.described,
1244
+ height: r,
1245
+ containerRef: ft,
1246
+ loading: v,
1247
+ empty: _,
1248
+ showEmpty: Ne,
1249
+ placeholder: yt ? /* @__PURE__ */ u(Kn, { layout: T }) : null,
1250
+ className: B,
1251
+ legend: vt ? /* @__PURE__ */ u(Zt, { items: D.map((m, w) => ({
1252
+ label: m.label,
1253
+ color: d.colors[w],
1254
+ kind: m.kind === "bar" ? "rect" : "line",
1255
+ dashed: m.dashed
1256
+ })) }) : null,
1257
+ ...C,
1258
+ children: z > 0 && !Ne && /* @__PURE__ */ u(Wt, {
1259
+ xScale: mt,
1260
+ yScale: gt,
1261
+ theme: pt,
1262
+ initialDimensions: {
1263
+ width: z,
1264
+ height: r,
1265
+ margin: T.margin
1266
+ },
1267
+ children: /* @__PURE__ */ x(Pt, {
1268
+ hideTooltipDebounceMs: 0,
1269
+ children: [/* @__PURE__ */ x(Bt, {
1270
+ width: z,
1271
+ height: r,
1272
+ margin: T.margin,
1273
+ accessibilityLabel: n,
1274
+ children: [
1275
+ /* @__PURE__ */ u(Oe, { children: /* @__PURE__ */ u($t, {
1276
+ rows: !0,
1277
+ columns: !1,
1278
+ numTicks: d.y.count
1279
+ }) }),
1280
+ /* @__PURE__ */ u(Ve, {
1281
+ orientation: "left",
1282
+ tickValues: d.y.ticks,
1283
+ tickFormat: (m) => d.axisFormat(Number(m)),
1284
+ hideAxisLine: !0,
1285
+ hideTicks: !0,
1286
+ tickLabelProps: rr
1287
+ }),
1288
+ /* @__PURE__ */ u(Zn, {
1289
+ values: Ce.values,
1290
+ format: Ce.format,
1291
+ layout: T
1292
+ }),
1293
+ d.hasBars && /* @__PURE__ */ u(Jn, {
1294
+ data: e,
1295
+ layout: T
1296
+ }),
1297
+ /* @__PURE__ */ x(tr, {
1298
+ data: e,
1299
+ range: dt,
1300
+ layout: T,
1301
+ children: [Tt, xt]
1302
+ }),
1303
+ d.hasBars && bt && /* @__PURE__ */ u(Oe, { children: /* @__PURE__ */ u(Qn, { layout: T }) }),
1304
+ /* @__PURE__ */ u(er, {
1305
+ data: e,
1306
+ layout: T,
1307
+ lines: d.lines,
1308
+ crosshair: !d.hasBars
1309
+ })
1310
+ ]
1311
+ }), /* @__PURE__ */ u(nr, {
1312
+ data: e,
1313
+ layout: T,
1314
+ parts: D,
1315
+ colors: d.colors,
1316
+ width: z,
1317
+ headingFormat: d.headingFormat,
1318
+ valueFormat: d.fullFormat,
1319
+ breakdownTitle: g
1320
+ })]
1321
+ })
1322
+ })
1323
+ });
1324
+ }
1325
+ ke.displayName = "Chart";
1326
+ ke.Bar = Me;
1327
+ ke.Line = _e;
1328
+ export {
1329
+ Ze as a,
1330
+ Zt as i,
1331
+ Me as n,
1332
+ Le as o,
1333
+ _e as r,
1334
+ Vt as s,
1335
+ ke as t
1336
+ };
1337
+
1338
+ //# sourceMappingURL=chart-B5c8gmlj.js.map