@actioneer/ads 0.5.8 → 0.5.9

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.
@@ -1,174 +1,174 @@
1
1
  "use client";
2
- import { jsxs as N, jsx as e, Fragment as V } from "react/jsx-runtime";
2
+ import { jsxs as A, jsx as e, Fragment as q } from "react/jsx-runtime";
3
3
  import * as k from "react";
4
- import { ResponsiveContainer as j, LineChart as ve, Tooltip as S, Line as ie, AreaChart as be, Area as ge, CartesianGrid as X, XAxis as Z, YAxis as E, BarChart as pe, Bar as le, Cell as oe, ComposedChart as Ne, ScatterChart as we, Scatter as Ae, PieChart as ye, Pie as Ce, RadarChart as ke, PolarGrid as Re, PolarAngleAxis as se, PolarRadiusAxis as Me, Radar as $e, RadialBarChart as Le, RadialBar as Fe, Treemap as Se, ReferenceArea as Oe, ReferenceLine as Te, ReferenceDot as Ie } from "recharts";
5
- import { MotionConfig as Be, AnimatePresence as De, motion as We } from "motion/react";
6
- import { cn as $ } from "../lib/cn.js";
4
+ import { ResponsiveContainer as j, LineChart as ve, Tooltip as O, Line as oe, AreaChart as be, Area as pe, CartesianGrid as K, XAxis as ee, YAxis as G, BarChart as Ne, Bar as se, Cell as ce, ComposedChart as we, ScatterChart as Ae, Scatter as Ce, PieChart as ye, Pie as ke, RadarChart as Re, PolarGrid as Me, PolarAngleAxis as de, PolarRadiusAxis as $e, Radar as Le, RadialBarChart as Se, RadialBar as Fe, Treemap as Oe, ReferenceArea as Te, ReferenceLine as Ie, ReferenceDot as Be } from "recharts";
5
+ import { MotionConfig as De, AnimatePresence as We, motion as ze } from "motion/react";
6
+ import { cn as L } from "../lib/cn.js";
7
7
  import { floatVariants as je } from "../lib/motion.js";
8
- const _ = (t) => `var(--color-chart-${t % 6 + 1})`, Y = (t) => _(t), Q = "var(--chart-context)", D = {
8
+ const U = (t) => `var(--color-chart-${t % 6 + 1})`, J = (t) => U(t), te = "var(--chart-context)", W = {
9
9
  primary: { ref: "var(--brand)", pill: "bg-fill text-fill-foreground" },
10
10
  success: { ref: "var(--color-success-600)", pill: "bg-success-50 text-success-700" },
11
11
  warning: { ref: "var(--color-warning-500)", pill: "bg-warning-50 text-warning-700" },
12
12
  danger: { ref: "var(--color-danger-500)", pill: "bg-danger-50 text-danger-700" },
13
13
  info: { ref: "var(--color-info-500)", pill: "bg-info-50 text-info-700" }
14
- }, F = (t) => new Intl.NumberFormat("en-US", { notation: "compact", maximumFractionDigits: 1 }).format(t), ce = (t, r) => {
15
- const n = [];
16
- for (const l of t)
17
- for (const o of Object.keys(l))
18
- o !== r && typeof l[o] == "number" && !n.includes(o) && n.push(o);
19
- return n;
14
+ }, F = (t) => new Intl.NumberFormat("en-US", { notation: "compact", maximumFractionDigits: 1 }).format(t), ue = (t, r) => {
15
+ const a = [];
16
+ for (const i of t)
17
+ for (const l of Object.keys(i))
18
+ l !== r && typeof i[l] == "number" && !a.includes(l) && a.push(l);
19
+ return a;
20
20
  };
21
- function I({ x: t, y: r, payload: n, anchor: l, dy: o, format: a }) {
22
- const s = (n == null ? void 0 : n.value) ?? "", u = a ? a(s) : s;
23
- return /* @__PURE__ */ e("text", { x: t, y: r, dy: o, textAnchor: l, className: "fill-tertiary text-xs tabular-nums", children: u });
21
+ function D({ x: t, y: r, payload: a, anchor: i, dy: l, format: n }) {
22
+ const o = (a == null ? void 0 : a.value) ?? "", x = n ? n(o) : o;
23
+ return /* @__PURE__ */ e("text", { x: t, y: r, dy: l, textAnchor: i, className: "fill-tertiary text-xs tabular-nums", children: x });
24
24
  }
25
- function de({
25
+ function me({
26
26
  x: t,
27
27
  y: r,
28
- value: n,
29
- hidden: l,
30
- format: o
28
+ value: a,
29
+ hidden: i,
30
+ format: l
31
31
  }) {
32
- if (l || t == null || r == null || n == null || n === "") return null;
33
- const a = Number(n);
34
- return Number.isNaN(a) ? null : /* @__PURE__ */ e(
32
+ if (i || t == null || r == null || a == null || a === "") return null;
33
+ const n = Number(a);
34
+ return Number.isNaN(n) ? null : /* @__PURE__ */ e(
35
35
  "text",
36
36
  {
37
37
  x: Number(t),
38
38
  y: Number(r) - 10,
39
39
  textAnchor: "middle",
40
40
  className: "fill-secondary text-xs tabular-nums",
41
- children: o(a)
41
+ children: l(n)
42
42
  }
43
43
  );
44
44
  }
45
- function ze({
45
+ function Pe({
46
46
  x: t,
47
47
  y: r,
48
- width: n,
49
- height: l,
50
- value: o,
51
- format: a,
52
- horizontal: s
48
+ width: a,
49
+ height: i,
50
+ value: l,
51
+ format: n,
52
+ horizontal: o
53
53
  }) {
54
- if (t == null || r == null || o == null || o === "") return null;
55
- const u = Number(o);
56
- if (Number.isNaN(u)) return null;
57
- const c = Number(t), f = Number(r), d = Number(n ?? 0), x = Number(l ?? 0);
58
- return s ? /* @__PURE__ */ e(
54
+ if (t == null || r == null || l == null || l === "") return null;
55
+ const x = Number(l);
56
+ if (Number.isNaN(x)) return null;
57
+ const s = Number(t), m = Number(r), u = Number(a ?? 0), N = Number(i ?? 0);
58
+ return o ? /* @__PURE__ */ e(
59
59
  "text",
60
60
  {
61
- x: c + d + 8,
62
- y: f + x / 2,
61
+ x: s + u + 8,
62
+ y: m + N / 2,
63
63
  dy: "0.32em",
64
64
  textAnchor: "start",
65
65
  className: "fill-secondary text-xs tabular-nums",
66
- children: a(u)
66
+ children: n(x)
67
67
  }
68
68
  ) : /* @__PURE__ */ e(
69
69
  "text",
70
70
  {
71
- x: c + d / 2,
72
- y: f - 8,
71
+ x: s + u / 2,
72
+ y: m - 8,
73
73
  textAnchor: "middle",
74
74
  className: "fill-secondary text-xs tabular-nums",
75
- children: a(u)
75
+ children: n(x)
76
76
  }
77
77
  );
78
78
  }
79
- function q({
79
+ function ne({
80
80
  cx: t,
81
81
  cy: r,
82
- fill: n
82
+ fill: a
83
83
  }) {
84
- return t == null || r == null ? null : /* @__PURE__ */ e("circle", { cx: t, cy: r, r: 4.5, fill: n, stroke: "var(--background)", strokeWidth: 2 });
84
+ return t == null || r == null ? null : /* @__PURE__ */ e("circle", { cx: t, cy: r, r: 4.5, fill: a, stroke: "var(--background)", strokeWidth: 2 });
85
85
  }
86
- function O({
86
+ function T({
87
87
  active: t,
88
88
  payload: r,
89
- label: n,
90
- format: l,
91
- labelKey: o,
92
- renderer: a
89
+ label: a,
90
+ format: i,
91
+ labelKey: l,
92
+ renderer: n
93
93
  }) {
94
- var x, v;
95
- const s = (r ?? []).map((m, b) => {
96
- const w = m.payload && typeof m.payload == "object" ? m.payload : void 0;
94
+ var N, v;
95
+ const o = (r ?? []).map((f, y) => {
96
+ const C = f.payload && typeof f.payload == "object" ? f.payload : void 0;
97
97
  return {
98
- key: m.dataKey ?? b,
99
- name: m.name ?? m.dataKey ?? b,
100
- value: m.value,
101
- color: m.color,
102
- datum: w
98
+ key: f.dataKey ?? y,
99
+ name: f.name ?? f.dataKey ?? y,
100
+ value: f.value,
101
+ color: f.color,
102
+ datum: C
103
103
  };
104
- }), u = o ? (v = (x = s[0]) == null ? void 0 : x.datum) == null ? void 0 : v[o] : void 0, c = {
104
+ }), x = l ? (v = (N = o[0]) == null ? void 0 : N.datum) == null ? void 0 : v[l] : void 0, s = {
105
105
  active: !!t,
106
- label: typeof u == "string" || typeof u == "number" ? u : n,
107
- items: s,
108
- formatValue: l
106
+ label: typeof x == "string" || typeof x == "number" ? x : a,
107
+ items: o,
108
+ formatValue: i
109
109
  };
110
- if (a) return /* @__PURE__ */ e(V, { children: a(c) });
111
- if (!c.active || !s.length) return null;
112
- const f = s.length === 1, d = c.label ?? (f ? s[0].name : void 0);
113
- return /* @__PURE__ */ N("div", { className: "rounded-md bg-foreground px-2.5 py-1.5 text-xs text-background", children: [
114
- /* @__PURE__ */ e("div", { className: $("text-xs font-normal tracking-wide uppercase text-background/60", !f && "mb-1"), children: d }),
115
- s.map((m) => /* @__PURE__ */ N("div", { className: "flex items-center gap-1.5", children: [
116
- !f && /* @__PURE__ */ N(V, { children: [
117
- /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "size-1.5 rounded-dot", style: { background: m.color } }),
118
- /* @__PURE__ */ e("span", { className: "text-background/70", children: m.name })
110
+ if (n) return /* @__PURE__ */ e(q, { children: n(s) });
111
+ if (!s.active || !o.length) return null;
112
+ const m = o.length === 1, u = s.label ?? (m ? o[0].name : void 0);
113
+ return /* @__PURE__ */ A("div", { className: "rounded-md bg-foreground px-2.5 py-1.5 text-xs text-background", children: [
114
+ /* @__PURE__ */ e("div", { className: L("text-xs font-normal tracking-wide uppercase text-background/60", !m && "mb-1"), children: u }),
115
+ o.map((f) => /* @__PURE__ */ A("div", { className: "flex items-center gap-1.5", children: [
116
+ !m && /* @__PURE__ */ A(q, { children: [
117
+ /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "size-1.5 rounded-dot", style: { background: f.color } }),
118
+ /* @__PURE__ */ e("span", { className: "text-background/70", children: f.name })
119
119
  ] }),
120
- /* @__PURE__ */ e("span", { className: "ml-auto pl-3 font-normal tabular-nums", children: typeof m.value == "number" ? l(m.value) : String(m.value ?? "") })
121
- ] }, m.key))
120
+ /* @__PURE__ */ e("span", { className: "ml-auto pl-3 font-normal tabular-nums", children: typeof f.value == "number" ? i(f.value) : String(f.value ?? "") })
121
+ ] }, f.key))
122
122
  ] });
123
123
  }
124
- const ue = "pointer-events-none inline-flex min-h-4 items-center rounded-full px-2 py-0.5 text-xs font-normal whitespace-nowrap";
125
- function Pe({
124
+ const fe = "pointer-events-none inline-flex min-h-4 items-center rounded-full px-2 py-0.5 text-xs font-normal whitespace-nowrap";
125
+ function Ee({
126
126
  viewBox: t,
127
127
  label: r,
128
- value: n,
129
- color: l,
130
- axis: o
128
+ value: a,
129
+ color: i,
130
+ axis: l
131
131
  }) {
132
- const a = t ?? {}, s = /* @__PURE__ */ N("span", { className: $(ue, D[l].pill), children: [
132
+ const n = t ?? {}, o = /* @__PURE__ */ A("span", { className: L(fe, W[i].pill), children: [
133
133
  r,
134
- n != null && /* @__PURE__ */ e("span", { className: "ml-1 tabular-nums", children: n })
134
+ a != null && /* @__PURE__ */ e("span", { className: "ml-1 tabular-nums", children: a })
135
135
  ] });
136
- return o === "y" ? /* @__PURE__ */ e("foreignObject", { x: a.x ?? 0, y: (a.y ?? 0) - 12, width: a.width ?? 0, height: 24, className: "overflow-visible", children: /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-end pr-1", children: s }) }) : /* @__PURE__ */ e("foreignObject", { x: (a.x ?? 0) - 90, y: (a.y ?? 0) - 12, width: 180, height: 24, className: "overflow-visible", children: /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: s }) });
136
+ return l === "y" ? /* @__PURE__ */ e("foreignObject", { x: n.x ?? 0, y: (n.y ?? 0) - 12, width: n.width ?? 0, height: 24, className: "overflow-visible", children: /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-end pr-1", children: o }) }) : /* @__PURE__ */ e("foreignObject", { x: (n.x ?? 0) - 90, y: (n.y ?? 0) - 12, width: 180, height: 24, className: "overflow-visible", children: /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: o }) });
137
137
  }
138
- function Ee({ viewBox: t, label: r, color: n }) {
139
- const l = t ?? {};
140
- return /* @__PURE__ */ e("foreignObject", { x: l.x ?? 0, y: l.y ?? 0, width: l.width ?? 0, height: 28, className: "overflow-visible", children: /* @__PURE__ */ e("div", { className: "flex h-full items-center pl-1.5", children: /* @__PURE__ */ e("span", { className: $(ue, D[n].pill), children: r }) }) });
138
+ function He({ viewBox: t, label: r, color: a }) {
139
+ const i = t ?? {};
140
+ return /* @__PURE__ */ e("foreignObject", { x: i.x ?? 0, y: i.y ?? 0, width: i.width ?? 0, height: 28, className: "overflow-visible", children: /* @__PURE__ */ e("div", { className: "flex h-full items-center pl-1.5", children: /* @__PURE__ */ e("span", { className: L(fe, W[a].pill), children: r }) }) });
141
141
  }
142
142
  function _e({
143
143
  cx: t,
144
144
  cy: r,
145
- n,
146
- ann: l,
147
- onEnter: o,
148
- onLeave: a
145
+ n: a,
146
+ ann: i,
147
+ onEnter: l,
148
+ onLeave: n
149
149
  }) {
150
- const [s, u] = k.useState(!1);
150
+ const [o, x] = k.useState(!1);
151
151
  if (t == null || r == null || !Number.isFinite(t) || !Number.isFinite(r)) return /* @__PURE__ */ e("g", {});
152
- const c = () => o({ ann: l, n, cx: t, cy: r }), f = () => a();
153
- return /* @__PURE__ */ N(
152
+ const s = () => l({ ann: i, n: a, cx: t, cy: r }), m = () => n();
153
+ return /* @__PURE__ */ A(
154
154
  "g",
155
155
  {
156
156
  tabIndex: 0,
157
157
  role: "img",
158
- "aria-label": `Annotation ${n}: ${l.label}`,
158
+ "aria-label": `Annotation ${a}: ${i.label}`,
159
159
  className: "cursor-default outline-none [transform-box:fill-box] origin-center transition-transform ease-out [transition-duration:150ms] hover:scale-110 focus-visible:scale-110 motion-reduce:transition-none motion-reduce:hover:scale-100 motion-reduce:focus-visible:scale-100",
160
- onMouseEnter: c,
161
- onMouseLeave: f,
160
+ onMouseEnter: s,
161
+ onMouseLeave: m,
162
162
  onFocus: () => {
163
- u(!0), c();
163
+ x(!0), s();
164
164
  },
165
165
  onBlur: () => {
166
- u(!1), f();
166
+ x(!1), m();
167
167
  },
168
168
  children: [
169
- s && /* @__PURE__ */ e("circle", { cx: t, cy: r, r: 12, fill: "none", stroke: "var(--ring)", strokeWidth: 2 }),
169
+ o && /* @__PURE__ */ e("circle", { cx: t, cy: r, r: 12, fill: "none", stroke: "var(--ring)", strokeWidth: 2 }),
170
170
  /* @__PURE__ */ e("circle", { cx: t, cy: r, r: 10, fill: "var(--background)" }),
171
- /* @__PURE__ */ e("circle", { cx: t, cy: r, r: 8, fill: D[l.color ?? "primary"].ref }),
171
+ /* @__PURE__ */ e("circle", { cx: t, cy: r, r: 8, fill: W[i.color ?? "primary"].ref }),
172
172
  /* @__PURE__ */ e(
173
173
  "text",
174
174
  {
@@ -177,15 +177,15 @@ function _e({
177
177
  dy: "0.35em",
178
178
  textAnchor: "middle",
179
179
  className: "pointer-events-none fill-brand-foreground text-xs font-medium select-none",
180
- children: n
180
+ children: a
181
181
  }
182
182
  )
183
183
  ]
184
184
  }
185
185
  );
186
186
  }
187
- function Ge({ hovered: t, frameWidth: r, format: n }) {
188
- return /* @__PURE__ */ e(Be, { reducedMotion: "user", children: /* @__PURE__ */ e(De, { children: t && /* @__PURE__ */ e(
187
+ function Ge({ hovered: t, frameWidth: r, format: a }) {
188
+ return /* @__PURE__ */ e(De, { reducedMotion: "user", children: /* @__PURE__ */ e(We, { children: t && /* @__PURE__ */ e(
189
189
  "div",
190
190
  {
191
191
  className: "pointer-events-none absolute z-10",
@@ -193,8 +193,8 @@ function Ge({ hovered: t, frameWidth: r, format: n }) {
193
193
  left: Math.max(96, Math.min(t.cx, Math.max(r - 96, 96))),
194
194
  top: t.cy - 16
195
195
  },
196
- children: /* @__PURE__ */ N(
197
- We.div,
196
+ children: /* @__PURE__ */ A(
197
+ ze.div,
198
198
  {
199
199
  variants: je,
200
200
  initial: "hidden",
@@ -202,23 +202,23 @@ function Ge({ hovered: t, frameWidth: r, format: n }) {
202
202
  exit: "hidden",
203
203
  className: "w-max max-w-60 -translate-x-1/2 -translate-y-full origin-bottom rounded-lg bg-elevated p-3 shadow-elevation",
204
204
  children: [
205
- /* @__PURE__ */ N("div", { className: "flex items-center gap-2", children: [
205
+ /* @__PURE__ */ A("div", { className: "flex items-center gap-2", children: [
206
206
  /* @__PURE__ */ e(
207
207
  "span",
208
208
  {
209
209
  "aria-hidden": !0,
210
210
  className: "flex size-4.5 shrink-0 items-center justify-center rounded-full text-xs font-medium text-brand-foreground",
211
- style: { background: D[t.ann.color ?? "primary"].ref },
211
+ style: { background: W[t.ann.color ?? "primary"].ref },
212
212
  children: t.n
213
213
  }
214
214
  ),
215
215
  /* @__PURE__ */ e("span", { className: "text-xs font-normal text-foreground", children: t.ann.label })
216
216
  ] }),
217
217
  t.ann.description && /* @__PURE__ */ e("p", { className: "mt-1.5 text-xs leading-relaxed text-secondary", children: t.ann.description }),
218
- /* @__PURE__ */ N("div", { className: "mt-1.5 text-xs font-normal tracking-wide uppercase text-tertiary tabular-nums", children: [
218
+ /* @__PURE__ */ A("div", { className: "mt-1.5 text-xs font-normal tracking-wide uppercase text-tertiary tabular-nums", children: [
219
219
  t.ann.x,
220
220
  " · ",
221
- n(t.ann.y)
221
+ a(t.ann.y)
222
222
  ] })
223
223
  ]
224
224
  }
@@ -226,299 +226,355 @@ function Ge({ hovered: t, frameWidth: r, format: n }) {
226
226
  }
227
227
  ) }) });
228
228
  }
229
- function me(t, r) {
230
- const [n, l] = k.useState(null), o = k.useCallback(() => l(null), []), { back: a, front: s } = k.useMemo(() => {
231
- const u = [], c = [];
232
- let f = 0;
233
- return (t ?? []).forEach((d, x) => {
234
- const v = d.color ?? "primary";
235
- if (d.kind === "band") {
236
- const m = d.axis ?? "y";
237
- u.push(
229
+ function he(t, r) {
230
+ const [a, i] = k.useState(null), l = k.useCallback(() => i(null), []), { back: n, front: o } = k.useMemo(() => {
231
+ const x = [], s = [];
232
+ let m = 0;
233
+ return (t ?? []).forEach((u, N) => {
234
+ const v = u.color ?? "primary";
235
+ if (u.kind === "band") {
236
+ const f = u.axis ?? "y";
237
+ x.push(
238
238
  /* @__PURE__ */ e(
239
- Oe,
239
+ Te,
240
240
  {
241
- ...m === "y" ? { y1: d.from, y2: d.to } : { x1: d.from, x2: d.to },
242
- fill: D[v].ref,
241
+ ...f === "y" ? { y1: u.from, y2: u.to } : { x1: u.from, x2: u.to },
242
+ fill: W[v].ref,
243
243
  fillOpacity: 0.06,
244
244
  stroke: "none",
245
- ifOverflow: m === "y" ? "extendDomain" : "visible",
246
- label: d.label ? /* @__PURE__ */ e(Ee, { label: d.label, color: v }) : void 0
245
+ ifOverflow: f === "y" ? "extendDomain" : "visible",
246
+ label: u.label ? /* @__PURE__ */ e(He, { label: u.label, color: v }) : void 0
247
247
  },
248
- `ann-${x}`
248
+ `ann-${N}`
249
249
  )
250
250
  );
251
- } else if (d.kind === "line") {
252
- const m = d.axis ?? "y";
253
- c.push(
251
+ } else if (u.kind === "line") {
252
+ const f = u.axis ?? "y";
253
+ s.push(
254
254
  /* @__PURE__ */ e(
255
- Te,
255
+ Ie,
256
256
  {
257
- ...m === "y" ? { y: d.value } : { x: d.value },
258
- stroke: D[v].ref,
257
+ ...f === "y" ? { y: u.value } : { x: u.value },
258
+ stroke: W[v].ref,
259
259
  strokeWidth: 1,
260
260
  strokeDasharray: "4 4",
261
- ifOverflow: m === "y" ? "extendDomain" : "visible",
262
- label: d.label ? /* @__PURE__ */ e(
263
- Pe,
261
+ ifOverflow: f === "y" ? "extendDomain" : "visible",
262
+ label: u.label ? /* @__PURE__ */ e(
263
+ Ee,
264
264
  {
265
- label: d.label,
266
- value: typeof d.value == "number" ? r(d.value) : String(d.value),
265
+ label: u.label,
266
+ value: typeof u.value == "number" ? r(u.value) : String(u.value),
267
267
  color: v,
268
- axis: m
268
+ axis: f
269
269
  }
270
270
  ) : void 0
271
271
  },
272
- `ann-${x}`
272
+ `ann-${N}`
273
273
  )
274
274
  );
275
275
  } else {
276
- f += 1;
277
- const m = f;
278
- c.push(
276
+ m += 1;
277
+ const f = m;
278
+ s.push(
279
279
  /* @__PURE__ */ e(
280
- Ie,
280
+ Be,
281
281
  {
282
- x: d.x,
283
- y: d.y,
282
+ x: u.x,
283
+ y: u.y,
284
284
  ifOverflow: "visible",
285
- shape: (b) => /* @__PURE__ */ e(_e, { cx: b.cx, cy: b.cy, n: m, ann: d, onEnter: l, onLeave: o })
285
+ shape: (y) => /* @__PURE__ */ e(_e, { cx: y.cx, cy: y.cy, n: f, ann: u, onEnter: i, onLeave: l })
286
286
  },
287
- `ann-${x}`
287
+ `ann-${N}`
288
288
  )
289
289
  );
290
290
  }
291
- }), { back: u, front: c };
292
- }, [t, r, o]);
293
- return { back: a, front: s, hovered: n };
291
+ }), { back: x, front: s };
292
+ }, [t, r, l]);
293
+ return { back: n, front: o, hovered: a };
294
294
  }
295
- function G({
295
+ function V({
296
296
  items: t,
297
297
  align: r = "end",
298
- className: n
298
+ className: a,
299
+ onToggle: i
299
300
  }) {
300
301
  const l = {
301
302
  start: "justify-start",
302
303
  center: "justify-center",
303
304
  end: "justify-end"
304
305
  }[r];
305
- return /* @__PURE__ */ e("div", { className: $("mb-3 flex flex-wrap items-center gap-x-4 gap-y-1", l, n), children: t.map((o) => /* @__PURE__ */ N("span", { className: "inline-flex items-center gap-1.5 text-xs text-secondary", children: [
306
- /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "size-2 rounded-dot", style: { background: o.color } }),
307
- o.label
308
- ] }, o.label)) });
306
+ return /* @__PURE__ */ e("div", { className: L("mb-3 flex flex-wrap items-center gap-x-4 gap-y-1", l, a), children: t.map(
307
+ (n) => i && n.key !== void 0 ? /* @__PURE__ */ A(
308
+ "button",
309
+ {
310
+ type: "button",
311
+ "aria-pressed": !n.hidden,
312
+ "aria-label": `Toggle ${n.label} series`,
313
+ onClick: () => i(n.key),
314
+ className: L(
315
+ "inline-flex cursor-pointer items-center gap-1.5 rounded-sm text-xs outline-none",
316
+ "transition-colors duration-150 ease-out motion-reduce:transition-none",
317
+ "focus-visible:ring-2 focus-visible:ring-ring",
318
+ n.hidden ? "text-tertiary" : "text-secondary hover:text-foreground"
319
+ ),
320
+ children: [
321
+ /* @__PURE__ */ e(
322
+ "span",
323
+ {
324
+ "aria-hidden": !0,
325
+ className: L(
326
+ "size-2 rounded-dot transition-opacity duration-150 ease-out motion-reduce:transition-none",
327
+ n.hidden && "opacity-25"
328
+ ),
329
+ style: { background: n.color }
330
+ }
331
+ ),
332
+ n.label
333
+ ]
334
+ },
335
+ n.label
336
+ ) : /* @__PURE__ */ A("span", { className: "inline-flex items-center gap-1.5 text-xs text-secondary", children: [
337
+ /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "size-2 rounded-dot", style: { background: n.color } }),
338
+ n.label
339
+ ] }, n.label)
340
+ ) });
309
341
  }
310
- const W = k.forwardRef(
311
- ({ className: t, height: r, legendItems: n, hovered: l, format: o, children: a, ...s }, u) => {
312
- var d;
313
- const c = k.useRef(null);
314
- return /* @__PURE__ */ N("div", { ref: (x) => {
315
- c.current = x, typeof u == "function" ? u(x) : u && (u.current = x);
316
- }, className: $("relative w-full font-sans", t), ...s, children: [
317
- n && /* @__PURE__ */ e(G, { items: n }),
318
- /* @__PURE__ */ e(j, { width: "100%", height: Math.max(r, T), children: a }),
319
- /* @__PURE__ */ e(Ge, { hovered: l, frameWidth: ((d = c.current) == null ? void 0 : d.clientWidth) ?? 0, format: o })
342
+ const z = k.forwardRef(
343
+ ({ className: t, height: r, legendItems: a, hovered: i, format: l, onLegendToggle: n, children: o, ...x }, s) => {
344
+ var N;
345
+ const m = k.useRef(null);
346
+ return /* @__PURE__ */ A("div", { ref: (v) => {
347
+ m.current = v, typeof s == "function" ? s(v) : s && (s.current = v);
348
+ }, className: L("relative w-full font-sans", t), ...x, children: [
349
+ a && /* @__PURE__ */ e(V, { items: a, onToggle: n }),
350
+ /* @__PURE__ */ e(j, { width: "100%", height: Math.max(r, I), children: o }),
351
+ /* @__PURE__ */ e(Ge, { hovered: i, frameWidth: ((N = m.current) == null ? void 0 : N.clientWidth) ?? 0, format: l })
320
352
  ] });
321
353
  }
322
354
  );
323
- W.displayName = "ChartFrame";
324
- function H(t) {
355
+ z.displayName = "ChartFrame";
356
+ function Y(t) {
325
357
  const {
326
358
  data: r,
327
- categoryKey: n,
328
- series: l,
329
- seriesLabels: o,
330
- highlight: a,
331
- annotations: s,
332
- grid: u = !1,
333
- legend: c,
334
- showYAxis: f = !0,
335
- formatValue: d,
336
- xScale: x = "category",
359
+ categoryKey: a,
360
+ series: i,
361
+ seriesLabels: l,
362
+ highlight: n,
363
+ annotations: o,
364
+ grid: x = !1,
365
+ legend: s,
366
+ showYAxis: m = !0,
367
+ formatValue: u,
368
+ xScale: N = "category",
337
369
  xDomain: v,
338
- yDomain: m,
339
- xTickFormatter: b,
340
- yTickFormatter: w,
341
- yAxisWidth: A = 44
342
- } = t, p = k.useMemo(() => l ?? ce(r, n), [l, r, n]), i = d ?? F, h = w ?? ((M) => typeof M == "number" ? i(M) : M), y = me(s, i), C = (M, B) => a && p.includes(a) ? M === a ? "var(--color-chart-1)" : Q : _(B), R = (M) => (o == null ? void 0 : o[M]) ?? M, g = c ?? p.length > 1 ? p.map((M, B) => ({ label: R(M), color: C(M, B) })) : null;
343
- return { names: p, format: i, layers: y, legendItems: g, furniture: [
344
- /* Gridlines one step below the border token — guides, not content. */
345
- u ? /* @__PURE__ */ e(X, { vertical: !1, stroke: "var(--chart-grid)" }, "grid") : null,
346
- /* @__PURE__ */ e(
347
- Z,
348
- {
349
- dataKey: n,
350
- type: x === "time" ? "number" : "category",
351
- scale: x === "time" ? "time" : "auto",
352
- domain: x === "time" ? v ?? ["dataMin", "dataMax"] : v,
353
- allowDataOverflow: !!v,
354
- axisLine: { stroke: "var(--chart-axis)" },
355
- tickLine: !1,
356
- minTickGap: 28,
357
- tickMargin: 24,
358
- padding: { left: 16, right: 16 },
359
- height: 40,
360
- tick: /* @__PURE__ */ e(I, { anchor: "middle", dy: 0, format: b })
361
- },
362
- "x"
363
- ),
364
- f ? /* @__PURE__ */ e(
365
- E,
366
- {
367
- width: A,
368
- domain: m,
369
- allowDataOverflow: !!m,
370
- axisLine: { stroke: "var(--chart-axis)" },
371
- tickLine: !1,
372
- tickMargin: 12,
373
- tick: /* @__PURE__ */ e(I, { anchor: "end", dy: "0.32em", format: h })
374
- },
375
- "y"
376
- ) : null
377
- ], colorFor: C, labelFor: R };
370
+ yDomain: f,
371
+ xTickFormatter: y,
372
+ yTickFormatter: C,
373
+ yAxisWidth: w = 44
374
+ } = t, p = k.useMemo(() => i ?? ue(r, a), [i, r, a]), h = u ?? F, R = C ?? ((M) => typeof M == "number" ? h(M) : M), d = he(o, h), c = (M, B) => n && p.includes(n) ? M === n ? "var(--color-chart-1)" : te : U(B), b = (M) => (l == null ? void 0 : l[M]) ?? M, [g, $] = k.useState(
375
+ () => /* @__PURE__ */ new Set()
376
+ ), S = k.useCallback((M) => {
377
+ $((B) => {
378
+ const H = new Set(B);
379
+ return H.has(M) ? H.delete(M) : H.add(M), H;
380
+ });
381
+ }, []), E = (M) => g.has(M), X = s ?? p.length > 1 ? p.map((M, B) => ({
382
+ key: M,
383
+ label: b(M),
384
+ color: c(M, B),
385
+ hidden: g.has(M)
386
+ })) : null;
387
+ return {
388
+ names: p,
389
+ format: h,
390
+ layers: d,
391
+ legendItems: X,
392
+ furniture: [
393
+ /* Gridlines one step below the border token — guides, not content. */
394
+ x ? /* @__PURE__ */ e(K, { vertical: !1, stroke: "var(--chart-grid)" }, "grid") : null,
395
+ /* @__PURE__ */ e(
396
+ ee,
397
+ {
398
+ dataKey: a,
399
+ type: N === "time" ? "number" : "category",
400
+ scale: N === "time" ? "time" : "auto",
401
+ domain: N === "time" ? v ?? ["dataMin", "dataMax"] : v,
402
+ allowDataOverflow: !!v,
403
+ axisLine: { stroke: "var(--chart-axis)" },
404
+ tickLine: !1,
405
+ minTickGap: 28,
406
+ tickMargin: 24,
407
+ padding: { left: 16, right: 16 },
408
+ height: 40,
409
+ tick: /* @__PURE__ */ e(D, { anchor: "middle", dy: 0, format: y })
410
+ },
411
+ "x"
412
+ ),
413
+ m ? /* @__PURE__ */ e(
414
+ G,
415
+ {
416
+ width: w,
417
+ domain: f,
418
+ allowDataOverflow: !!f,
419
+ axisLine: { stroke: "var(--chart-axis)" },
420
+ tickLine: !1,
421
+ tickMargin: 12,
422
+ tick: /* @__PURE__ */ e(D, { anchor: "end", dy: "0.32em", format: R })
423
+ },
424
+ "y"
425
+ ) : null
426
+ ],
427
+ colorFor: c,
428
+ labelFor: b,
429
+ toggleSeries: S,
430
+ isHidden: E
431
+ };
378
432
  }
379
- const T = 300, z = { top: 24, right: 12, bottom: 8, left: 0 };
380
- function J(t, r, n, l) {
381
- if (l === !0) return new Set(t);
382
- if (l === !1) return /* @__PURE__ */ new Set();
383
- if (n && t.includes(n)) {
384
- const a = (r ?? []).filter((s) => s !== n);
385
- return /* @__PURE__ */ new Set([n, ...a]);
433
+ const I = 300, P = { top: 24, right: 12, bottom: 8, left: 0 };
434
+ function re(t, r, a, i) {
435
+ if (i === !0) return new Set(t);
436
+ if (i === !1) return /* @__PURE__ */ new Set();
437
+ if (a && t.includes(a)) {
438
+ const n = (r ?? []).filter((o) => o !== a);
439
+ return /* @__PURE__ */ new Set([a, ...n]);
386
440
  }
387
- return t.filter((a) => !(r != null && r.includes(a))).length === 1 ? new Set(t) : /* @__PURE__ */ new Set();
441
+ return t.filter((n) => !(r != null && r.includes(n))).length === 1 ? new Set(t) : /* @__PURE__ */ new Set();
388
442
  }
389
- function fe(t, r, n) {
443
+ function xe(t, r, a) {
390
444
  return k.useCallback(
391
- (l, o) => {
392
- if (!(r != null && r.includes(l))) return n(l, o);
393
- const a = t.filter((u) => !r.includes(u)), s = a[r.indexOf(l)] ?? a[0];
394
- return s ? n(s, t.indexOf(s)) : n(l, o);
445
+ (i, l) => {
446
+ if (!(r != null && r.includes(i))) return a(i, l);
447
+ const n = t.filter((x) => !r.includes(x)), o = n[r.indexOf(i)] ?? n[0];
448
+ return o ? a(o, t.indexOf(o)) : a(i, l);
395
449
  },
396
- [t, r, n]
450
+ [t, r, a]
397
451
  );
398
452
  }
399
- const He = k.forwardRef(
453
+ const Ue = k.forwardRef(
400
454
  // Straight segments by default: the house line is a solid stroke with a DOT
401
455
  // at every observation — the data points are visible, the path connects them
402
456
  // without inventing values between them.
403
457
  // A smooth curve invents values between observations; opt back in with
404
458
  // `curve="natural"` when the interpolation is the point.
405
- ({ height: t = T, curve: r = "linear", forecastKeys: n, showValues: l, className: o, ...a }, s) => {
406
- const { names: u, format: c, layers: f, legendItems: d, furniture: x, colorFor: v, labelFor: m } = H(a), b = fe(u, n, v), w = J(u, n, a.highlight, l), [A, p] = k.useState(null);
407
- return /* @__PURE__ */ e(W, { ref: s, className: o, height: t, legendItems: d, hovered: f.hovered, format: c, children: /* @__PURE__ */ N(
459
+ ({ height: t = I, curve: r = "linear", forecastKeys: a, animatedSeriesKeys: i, showValues: l, className: n, ...o }, x) => {
460
+ const { names: s, format: m, layers: u, legendItems: N, furniture: v, colorFor: f, labelFor: y, toggleSeries: C, isHidden: w } = Y(o), p = xe(s, a, f), h = re(s, a, o.highlight, l), [R, d] = k.useState(null);
461
+ return /* @__PURE__ */ e(z, { ref: x, className: n, height: t, legendItems: N, hovered: u.hovered, format: m, onLegendToggle: C, children: /* @__PURE__ */ A(
408
462
  ve,
409
463
  {
410
- data: a.data,
411
- margin: z,
412
- onMouseMove: (i) => p((i == null ? void 0 : i.activeTooltipIndex) ?? null),
413
- onMouseLeave: () => p(null),
464
+ data: o.data,
465
+ margin: P,
466
+ onMouseMove: (c) => d((c == null ? void 0 : c.activeTooltipIndex) ?? null),
467
+ onMouseLeave: () => d(null),
414
468
  children: [
415
- x,
416
- a.tooltip !== !1 && /* @__PURE__ */ e(
417
- S,
469
+ v,
470
+ o.tooltip !== !1 && /* @__PURE__ */ e(
471
+ O,
418
472
  {
419
473
  content: /* @__PURE__ */ e(
420
- O,
474
+ T,
421
475
  {
422
- format: c,
423
- renderer: a.tooltip
476
+ format: m,
477
+ renderer: o.tooltip
424
478
  }
425
479
  ),
426
480
  cursor: { stroke: "var(--border-strong)" },
427
481
  isAnimationActive: !1
428
482
  }
429
483
  ),
430
- f.back,
431
- u.map((i, h) => /* @__PURE__ */ e(
432
- ie,
484
+ u.back,
485
+ s.map((c, b) => /* @__PURE__ */ e(
486
+ oe,
433
487
  {
434
- dataKey: i,
435
- name: m(i),
488
+ dataKey: c,
489
+ name: y(c),
436
490
  type: r,
437
- stroke: b(i, h),
491
+ stroke: p(c, b),
438
492
  strokeWidth: 1.5,
439
- strokeDasharray: n != null && n.includes(i) ? "6 4" : void 0,
440
- dot: { r: 3, fill: b(i, h), strokeWidth: 0 },
441
- activeDot: /* @__PURE__ */ e(q, { fill: b(i, h) }),
442
- label: w.has(i) ? /* @__PURE__ */ e(de, { format: c, hidden: A != null }) : void 0,
443
- isAnimationActive: !1
493
+ strokeDasharray: a != null && a.includes(c) ? "6 4" : void 0,
494
+ dot: { r: 3, fill: p(c, b), strokeWidth: 0 },
495
+ activeDot: /* @__PURE__ */ e(ne, { fill: p(c, b) }),
496
+ label: h.has(c) ? /* @__PURE__ */ e(me, { format: m, hidden: R != null }) : void 0,
497
+ hide: w(c),
498
+ isAnimationActive: (i == null ? void 0 : i.includes(c)) ?? !1
444
499
  },
445
- i
500
+ c
446
501
  )),
447
- f.front
502
+ u.front
448
503
  ]
449
504
  }
450
505
  ) });
451
506
  }
452
507
  );
453
- He.displayName = "LineChart";
454
- const Ue = k.forwardRef(
455
- ({ height: t = T, curve: r = "linear", stacked: n = !1, forecastKeys: l, showValues: o, className: a, ...s }, u) => {
456
- const { names: c, format: f, layers: d, legendItems: x, furniture: v, colorFor: m, labelFor: b } = H(s), w = fe(c, l, m), A = n ? /* @__PURE__ */ new Set() : J(c, l, s.highlight, o), [p, i] = k.useState(null), h = k.useId().replace(/[^a-zA-Z0-9]/g, "");
457
- return /* @__PURE__ */ e(W, { ref: u, className: a, height: t, legendItems: x, hovered: d.hovered, format: f, children: /* @__PURE__ */ N(
508
+ Ue.displayName = "LineChart";
509
+ const Ve = k.forwardRef(
510
+ ({ height: t = I, curve: r = "linear", stacked: a = !1, forecastKeys: i, showValues: l, className: n, ...o }, x) => {
511
+ const { names: s, format: m, layers: u, legendItems: N, furniture: v, colorFor: f, labelFor: y, toggleSeries: C, isHidden: w } = Y(o), p = xe(s, i, f), h = a ? /* @__PURE__ */ new Set() : re(s, i, o.highlight, l), [R, d] = k.useState(null), c = k.useId().replace(/[^a-zA-Z0-9]/g, "");
512
+ return /* @__PURE__ */ e(z, { ref: x, className: n, height: t, legendItems: N, hovered: u.hovered, format: m, onLegendToggle: C, children: /* @__PURE__ */ A(
458
513
  be,
459
514
  {
460
- data: s.data,
461
- margin: z,
462
- onMouseMove: (y) => i((y == null ? void 0 : y.activeTooltipIndex) ?? null),
463
- onMouseLeave: () => i(null),
515
+ data: o.data,
516
+ margin: P,
517
+ onMouseMove: (b) => d((b == null ? void 0 : b.activeTooltipIndex) ?? null),
518
+ onMouseLeave: () => d(null),
464
519
  children: [
465
- /* @__PURE__ */ e("defs", { children: c.map((y, C) => /* @__PURE__ */ N("linearGradient", { id: `${h}-${C}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
466
- /* @__PURE__ */ e("stop", { offset: "0%", stopColor: m(y, C), stopOpacity: 0.18 }),
467
- /* @__PURE__ */ e("stop", { offset: "100%", stopColor: m(y, C), stopOpacity: 0.02 })
468
- ] }, y)) }),
520
+ /* @__PURE__ */ e("defs", { children: s.map((b, g) => /* @__PURE__ */ A("linearGradient", { id: `${c}-${g}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
521
+ /* @__PURE__ */ e("stop", { offset: "0%", stopColor: f(b, g), stopOpacity: 0.18 }),
522
+ /* @__PURE__ */ e("stop", { offset: "100%", stopColor: f(b, g), stopOpacity: 0.02 })
523
+ ] }, b)) }),
469
524
  v,
470
- s.tooltip !== !1 && /* @__PURE__ */ e(
471
- S,
525
+ o.tooltip !== !1 && /* @__PURE__ */ e(
526
+ O,
472
527
  {
473
528
  content: /* @__PURE__ */ e(
474
- O,
529
+ T,
475
530
  {
476
- format: f,
477
- renderer: s.tooltip
531
+ format: m,
532
+ renderer: o.tooltip
478
533
  }
479
534
  ),
480
535
  cursor: { stroke: "var(--border-strong)" },
481
536
  isAnimationActive: !1
482
537
  }
483
538
  ),
484
- d.back,
485
- c.map((y, C) => /* @__PURE__ */ e(
486
- ge,
539
+ u.back,
540
+ s.map((b, g) => /* @__PURE__ */ e(
541
+ pe,
487
542
  {
488
- dataKey: y,
489
- name: b(y),
543
+ dataKey: b,
544
+ name: y(b),
490
545
  type: r,
491
- stackId: n ? "stack" : void 0,
492
- stroke: w(y, C),
546
+ stackId: a ? "stack" : void 0,
547
+ stroke: p(b, g),
493
548
  strokeWidth: 1.5,
494
- strokeDasharray: l != null && l.includes(y) ? "6 4" : void 0,
495
- fill: `url(#${h}-${C})`,
496
- dot: { r: 3, fill: m(y, C), strokeWidth: 0 },
497
- activeDot: /* @__PURE__ */ e(q, { fill: w(y, C) }),
498
- label: A.has(y) ? /* @__PURE__ */ e(de, { format: f, hidden: p != null }) : void 0,
549
+ strokeDasharray: i != null && i.includes(b) ? "6 4" : void 0,
550
+ fill: `url(#${c}-${g})`,
551
+ dot: { r: 3, fill: f(b, g), strokeWidth: 0 },
552
+ activeDot: /* @__PURE__ */ e(ne, { fill: p(b, g) }),
553
+ label: h.has(b) ? /* @__PURE__ */ e(me, { format: m, hidden: R != null }) : void 0,
554
+ hide: w(b),
499
555
  isAnimationActive: !1
500
556
  },
501
- y
557
+ b
502
558
  )),
503
- d.front
559
+ u.front
504
560
  ]
505
561
  }
506
562
  ) });
507
563
  }
508
564
  );
509
- Ue.displayName = "AreaChart";
510
- const Ve = k.forwardRef(
565
+ Ve.displayName = "AreaChart";
566
+ const Ye = k.forwardRef(
511
567
  ({
512
- height: t = T,
568
+ height: t = I,
513
569
  stacked: r = !1,
514
- layout: n = "vertical",
515
- showValues: l,
516
- className: o,
517
- ...a
518
- }, s) => {
519
- const { names: u, format: c, layers: f, legendItems: d, furniture: x, colorFor: v, labelFor: m } = H(a), b = n === "horizontal", w = r ? /* @__PURE__ */ new Set() : J(u, void 0, a.highlight, l), A = a.xTickFormatter ?? ((h) => typeof h == "number" ? c(h) : h), p = [
520
- a.grid !== !1 ? /* @__PURE__ */ e(
521
- X,
570
+ layout: a = "vertical",
571
+ showValues: i,
572
+ className: l,
573
+ ...n
574
+ }, o) => {
575
+ const { names: x, format: s, layers: m, legendItems: u, furniture: N, colorFor: v, labelFor: f, toggleSeries: y, isHidden: C } = Y(n), w = a === "horizontal", p = r ? /* @__PURE__ */ new Set() : re(x, void 0, n.highlight, i), h = n.xTickFormatter ?? ((c) => typeof c == "number" ? s(c) : c), R = [
576
+ n.grid !== !1 ? /* @__PURE__ */ e(
577
+ K,
522
578
  {
523
579
  horizontal: !1,
524
580
  vertical: !0,
@@ -527,105 +583,116 @@ const Ve = k.forwardRef(
527
583
  "grid"
528
584
  ) : null,
529
585
  /* @__PURE__ */ e(
530
- Z,
586
+ ee,
531
587
  {
532
588
  type: "number",
533
- domain: a.xDomain,
534
- allowDataOverflow: !!a.xDomain,
589
+ domain: n.xDomain,
590
+ allowDataOverflow: !!n.xDomain,
535
591
  axisLine: !1,
536
592
  tickLine: !1,
537
593
  minTickGap: 28,
538
594
  tickMargin: 10,
539
- tick: /* @__PURE__ */ e(I, { anchor: "middle", dy: 0, format: A })
595
+ tick: /* @__PURE__ */ e(D, { anchor: "middle", dy: 0, format: h })
540
596
  },
541
597
  "x"
542
598
  ),
543
- a.showYAxis !== !1 ? /* @__PURE__ */ e(
544
- E,
599
+ n.showYAxis !== !1 ? /* @__PURE__ */ e(
600
+ G,
545
601
  {
546
602
  type: "category",
547
- dataKey: a.categoryKey,
548
- width: a.yAxisWidth ?? 144,
603
+ dataKey: n.categoryKey,
604
+ width: n.yAxisWidth ?? 144,
549
605
  axisLine: !1,
550
606
  tickLine: !1,
551
607
  tickMargin: 6,
552
608
  tick: /* @__PURE__ */ e(
553
- I,
609
+ D,
554
610
  {
555
611
  anchor: "end",
556
612
  dy: "0.32em",
557
- format: a.yTickFormatter
613
+ format: n.yTickFormatter
558
614
  }
559
615
  )
560
616
  },
561
617
  "y"
562
618
  ) : null
563
- ], i = a.highlight && u.length === 1 && !u.includes(a.highlight) ? a.highlight : null;
564
- return /* @__PURE__ */ e(W, { ref: s, className: o, height: t, legendItems: d, hovered: f.hovered, format: c, children: /* @__PURE__ */ N(
565
- pe,
619
+ ], d = n.highlight && x.length === 1 && !x.includes(n.highlight) ? n.highlight : null;
620
+ return /* @__PURE__ */ e(z, { ref: o, className: l, height: t, legendItems: u, hovered: m.hovered, format: s, onLegendToggle: y, children: /* @__PURE__ */ A(
621
+ Ne,
566
622
  {
567
- data: a.data,
568
- layout: b ? "vertical" : "horizontal",
569
- margin: z,
623
+ data: n.data,
624
+ layout: w ? "vertical" : "horizontal",
625
+ margin: P,
570
626
  barCategoryGap: "24%",
571
627
  children: [
572
- b ? p : x,
573
- a.tooltip !== !1 && /* @__PURE__ */ e(
574
- S,
628
+ w ? R : N,
629
+ n.tooltip !== !1 && /* @__PURE__ */ e(
630
+ O,
575
631
  {
576
632
  content: /* @__PURE__ */ e(
577
- O,
633
+ T,
578
634
  {
579
- format: c,
580
- renderer: a.tooltip
635
+ format: s,
636
+ renderer: n.tooltip
581
637
  }
582
638
  ),
583
639
  cursor: { fill: "var(--muted)" },
584
640
  isAnimationActive: !1
585
641
  }
586
642
  ),
587
- f.back,
588
- u.map((h, y) => {
589
- const C = r ? y === u.length - 1 : !0, R = b ? [0, 4, 4, 0] : [4, 4, 0, 0];
643
+ m.back,
644
+ x.map((c, b) => {
645
+ const g = r ? b === x.length - 1 : !0, $ = w ? [0, 4, 4, 0] : [4, 4, 0, 0];
590
646
  return /* @__PURE__ */ e(
591
- le,
647
+ se,
592
648
  {
593
- dataKey: h,
594
- name: m(h),
649
+ dataKey: c,
650
+ name: f(c),
595
651
  stackId: r ? "stack" : void 0,
596
- fill: v(h, y),
597
- radius: C ? R : 0,
652
+ fill: v(c, b),
653
+ radius: g ? $ : 0,
598
654
  maxBarSize: 48,
599
- label: w.has(h) ? /* @__PURE__ */ e(ze, { format: c, horizontal: b }) : void 0,
655
+ label: p.has(c) ? /* @__PURE__ */ e(Pe, { format: s, horizontal: w }) : void 0,
656
+ hide: C(c),
600
657
  isAnimationActive: !1,
601
- children: i && a.data.map((g) => /* @__PURE__ */ e(
602
- oe,
658
+ children: d && n.data.map((S) => /* @__PURE__ */ e(
659
+ ce,
603
660
  {
604
- fill: g[a.categoryKey] === i ? "var(--color-chart-1)" : Q
661
+ fill: S[n.categoryKey] === d ? "var(--color-chart-1)" : te
605
662
  },
606
- String(g[a.categoryKey])
663
+ String(S[n.categoryKey])
607
664
  ))
608
665
  },
609
- h
666
+ c
610
667
  );
611
668
  }),
612
- f.front
669
+ m.front
613
670
  ]
614
671
  }
615
672
  ) });
616
673
  }
617
674
  );
618
- Ve.displayName = "BarChart";
619
- const he = k.forwardRef(
620
- ({ height: t = T, lineKeys: r, dualAxis: n = !1, stacked: l = !1, forecastKeys: o, className: a, ...s }, u) => {
621
- const { names: c, format: f, layers: d, furniture: x, colorFor: v, labelFor: m } = H(s), b = c.filter((i) => !r.includes(i)), w = (i, h) => r.length ? "var(--chart-axis)" : v(i, h), A = (i, h) => r.length ? "var(--color-chart-1)" : v(i, h), p = c.length > 1 ? [
622
- ...b.map((i) => ({ label: m(i), color: w(i, c.indexOf(i)) })),
623
- ...r.map((i) => ({ label: m(i), color: A(i, c.indexOf(i)) }))
675
+ Ye.displayName = "BarChart";
676
+ const ge = k.forwardRef(
677
+ ({ height: t = I, lineKeys: r, dualAxis: a = !1, stacked: i = !1, forecastKeys: l, className: n, ...o }, x) => {
678
+ const { names: s, format: m, layers: u, furniture: N, colorFor: v, labelFor: f, toggleSeries: y, isHidden: C } = Y(o), w = s.filter((d) => !r.includes(d)), p = (d, c) => r.length ? "var(--chart-axis)" : v(d, c), h = (d, c) => r.length ? "var(--color-chart-1)" : v(d, c), R = s.length > 1 ? [
679
+ ...w.map((d) => ({
680
+ key: d,
681
+ label: f(d),
682
+ color: p(d, s.indexOf(d)),
683
+ hidden: C(d)
684
+ })),
685
+ ...r.map((d) => ({
686
+ key: d,
687
+ label: f(d),
688
+ color: h(d, s.indexOf(d)),
689
+ hidden: C(d)
690
+ }))
624
691
  ] : null;
625
- return /* @__PURE__ */ e(W, { ref: u, className: a, height: t, legendItems: p, hovered: d.hovered, format: f, children: /* @__PURE__ */ N(Ne, { data: s.data, margin: z, barCategoryGap: "24%", children: [
626
- x,
627
- n && /* @__PURE__ */ e(
628
- E,
692
+ return /* @__PURE__ */ e(z, { ref: x, className: n, height: t, legendItems: R, hovered: u.hovered, format: m, onLegendToggle: y, children: /* @__PURE__ */ A(we, { data: o.data, margin: P, barCategoryGap: "24%", children: [
693
+ N,
694
+ a && /* @__PURE__ */ e(
695
+ G,
629
696
  {
630
697
  yAxisId: "right",
631
698
  orientation: "right",
@@ -634,254 +701,256 @@ const he = k.forwardRef(
634
701
  tickLine: !1,
635
702
  tickMargin: 6,
636
703
  tick: /* @__PURE__ */ e(
637
- I,
704
+ D,
638
705
  {
639
706
  anchor: "start",
640
707
  dy: "0.32em",
641
- format: (i) => typeof i == "number" ? f(i) : i
708
+ format: (d) => typeof d == "number" ? m(d) : d
642
709
  }
643
710
  )
644
711
  }
645
712
  ),
646
- s.tooltip !== !1 && /* @__PURE__ */ e(
647
- S,
713
+ o.tooltip !== !1 && /* @__PURE__ */ e(
714
+ O,
648
715
  {
649
716
  content: /* @__PURE__ */ e(
650
- O,
717
+ T,
651
718
  {
652
- format: f,
653
- renderer: s.tooltip
719
+ format: m,
720
+ renderer: o.tooltip
654
721
  }
655
722
  ),
656
723
  cursor: { fill: "var(--muted)" },
657
724
  isAnimationActive: !1
658
725
  }
659
726
  ),
660
- d.back,
661
- b.map((i) => {
662
- const h = c.indexOf(i), y = l ? i === b[b.length - 1] : !0;
727
+ u.back,
728
+ w.map((d) => {
729
+ const c = s.indexOf(d), b = i ? d === w[w.length - 1] : !0;
663
730
  return /* @__PURE__ */ e(
664
- le,
731
+ se,
665
732
  {
666
- dataKey: i,
667
- name: m(i),
668
- stackId: l ? "stack" : void 0,
669
- fill: w(i, h),
670
- radius: y ? [4, 4, 0, 0] : 0,
733
+ dataKey: d,
734
+ name: f(d),
735
+ stackId: i ? "stack" : void 0,
736
+ fill: p(d, c),
737
+ radius: b ? [4, 4, 0, 0] : 0,
671
738
  maxBarSize: 48,
739
+ hide: C(d),
672
740
  isAnimationActive: !1
673
741
  },
674
- i
742
+ d
675
743
  );
676
744
  }),
677
- r.map((i) => {
678
- const h = c.indexOf(i);
745
+ r.map((d) => {
746
+ const c = s.indexOf(d);
679
747
  return /* @__PURE__ */ e(
680
- ie,
748
+ oe,
681
749
  {
682
- dataKey: i,
683
- name: m(i),
684
- yAxisId: n ? "right" : void 0,
750
+ dataKey: d,
751
+ name: f(d),
752
+ yAxisId: a ? "right" : void 0,
685
753
  type: "linear",
686
- stroke: A(i, h),
754
+ stroke: h(d, c),
687
755
  strokeWidth: 2,
688
- strokeDasharray: o != null && o.includes(i) ? "6 4" : void 0,
689
- dot: { r: 3, fill: A(i, h), strokeWidth: 0 },
690
- activeDot: /* @__PURE__ */ e(q, { fill: A(i, h) }),
756
+ strokeDasharray: l != null && l.includes(d) ? "6 4" : void 0,
757
+ dot: { r: 3, fill: h(d, c), strokeWidth: 0 },
758
+ activeDot: /* @__PURE__ */ e(ne, { fill: h(d, c) }),
759
+ hide: C(d),
691
760
  isAnimationActive: !1
692
761
  },
693
- i
762
+ d
694
763
  );
695
764
  }),
696
- d.front
765
+ u.front
697
766
  ] }) });
698
767
  }
699
768
  );
700
- he.displayName = "ComboChart";
701
- const Ye = k.forwardRef(
702
- (t, r) => /* @__PURE__ */ e(he, { ref: r, ...t })
703
- );
704
- Ye.displayName = "ComposedChart";
769
+ ge.displayName = "ComboChart";
705
770
  const Xe = k.forwardRef(
771
+ (t, r) => /* @__PURE__ */ e(ge, { ref: r, ...t })
772
+ );
773
+ Xe.displayName = "ComposedChart";
774
+ const Ze = k.forwardRef(
706
775
  ({
707
776
  data: t,
708
777
  xKey: r,
709
- yKey: n,
710
- labelKey: l,
711
- annotations: o,
712
- height: a = T,
713
- grid: s = !1,
714
- showYAxis: u = !0,
715
- formatValue: c,
716
- xScale: f = "number",
717
- xDomain: d,
718
- yDomain: x,
778
+ yKey: a,
779
+ labelKey: i,
780
+ annotations: l,
781
+ height: n = I,
782
+ grid: o = !1,
783
+ showYAxis: x = !0,
784
+ formatValue: s,
785
+ xScale: m = "number",
786
+ xDomain: u,
787
+ yDomain: N,
719
788
  xTickFormatter: v,
720
- yTickFormatter: m,
721
- yAxisWidth: b = 44,
722
- tooltip: w,
723
- className: A
789
+ yTickFormatter: f,
790
+ yAxisWidth: y = 44,
791
+ tooltip: C,
792
+ className: w
724
793
  }, p) => {
725
- const i = c ?? F, h = v ?? ((R) => typeof R == "number" ? F(R) : R), y = m ?? ((R) => typeof R == "number" ? i(R) : R), C = me(o, i);
726
- return /* @__PURE__ */ e(W, { ref: p, className: A, height: a, legendItems: null, hovered: C.hovered, format: i, children: /* @__PURE__ */ N(we, { margin: z, children: [
727
- s && /* @__PURE__ */ e(X, { vertical: !1, stroke: "var(--chart-grid)" }),
794
+ const h = s ?? F, R = v ?? ((b) => typeof b == "number" ? F(b) : b), d = f ?? ((b) => typeof b == "number" ? h(b) : b), c = he(l, h);
795
+ return /* @__PURE__ */ e(z, { ref: p, className: w, height: n, legendItems: null, hovered: c.hovered, format: h, children: /* @__PURE__ */ A(Ae, { margin: P, children: [
796
+ o && /* @__PURE__ */ e(K, { vertical: !1, stroke: "var(--chart-grid)" }),
728
797
  /* @__PURE__ */ e(
729
- Z,
798
+ ee,
730
799
  {
731
800
  type: "number",
732
801
  dataKey: r,
733
- scale: f === "time" ? "time" : "auto",
734
- domain: d ?? (f === "time" ? ["dataMin", "dataMax"] : ["auto", "auto"]),
735
- allowDataOverflow: !!d,
802
+ scale: m === "time" ? "time" : "auto",
803
+ domain: u ?? (m === "time" ? ["dataMin", "dataMax"] : ["auto", "auto"]),
804
+ allowDataOverflow: !!u,
736
805
  axisLine: !1,
737
806
  tickLine: !1,
738
807
  minTickGap: 28,
739
808
  tickMargin: 10,
740
- tick: /* @__PURE__ */ e(I, { anchor: "middle", dy: 0, format: h })
809
+ tick: /* @__PURE__ */ e(D, { anchor: "middle", dy: 0, format: R })
741
810
  }
742
811
  ),
743
- u && /* @__PURE__ */ e(
744
- E,
812
+ x && /* @__PURE__ */ e(
813
+ G,
745
814
  {
746
815
  type: "number",
747
- dataKey: n,
748
- width: b,
749
- domain: x,
750
- allowDataOverflow: !!x,
816
+ dataKey: a,
817
+ width: y,
818
+ domain: N,
819
+ allowDataOverflow: !!N,
751
820
  axisLine: !1,
752
821
  tickLine: !1,
753
822
  tickMargin: 6,
754
- tick: /* @__PURE__ */ e(I, { anchor: "end", dy: "0.32em", format: y })
823
+ tick: /* @__PURE__ */ e(D, { anchor: "end", dy: "0.32em", format: d })
755
824
  }
756
825
  ),
757
- w !== !1 && /* @__PURE__ */ e(
758
- S,
826
+ C !== !1 && /* @__PURE__ */ e(
827
+ O,
759
828
  {
760
829
  content: /* @__PURE__ */ e(
761
- O,
830
+ T,
762
831
  {
763
- format: i,
764
- labelKey: l,
765
- renderer: w
832
+ format: h,
833
+ labelKey: i,
834
+ renderer: C
766
835
  }
767
836
  ),
768
837
  cursor: { stroke: "var(--border-strong)", strokeDasharray: "4 4" },
769
838
  isAnimationActive: !1
770
839
  }
771
840
  ),
772
- C.back,
841
+ c.back,
773
842
  /* @__PURE__ */ e(
774
- Ae,
843
+ Ce,
775
844
  {
776
845
  data: t,
777
846
  fill: "var(--color-chart-1)",
778
- shape: (R) => /* @__PURE__ */ e("circle", { cx: R.cx, cy: R.cy, r: 4.5, fill: "var(--color-chart-1)", fillOpacity: 0.75 }),
847
+ shape: (b) => /* @__PURE__ */ e("circle", { cx: b.cx, cy: b.cy, r: 4.5, fill: "var(--color-chart-1)", fillOpacity: 0.75 }),
779
848
  isAnimationActive: !1
780
849
  }
781
850
  ),
782
- C.front
851
+ c.front
783
852
  ] }) });
784
853
  }
785
854
  );
786
- Xe.displayName = "ScatterChart";
787
- const Ze = k.forwardRef(
855
+ Ze.displayName = "ScatterChart";
856
+ const Qe = k.forwardRef(
788
857
  ({
789
858
  data: t,
790
859
  nameKey: r,
791
- valueKey: n,
792
- donut: l = !0,
793
- centerLabel: o,
794
- highlight: a,
795
- height: s = 260,
796
- legend: u = !0,
797
- formatValue: c,
798
- tooltip: f,
799
- className: d
800
- }, x) => {
801
- const v = c ?? F, m = t.reduce((p, i) => p + (typeof i[n] == "number" ? i[n] : 0), 0), b = (p, i) => _(i), w = (p) => a && p !== a ? 0.3 : 1, A = u ? t.map((p, i) => ({
802
- label: `${p[r]} · ${m ? Math.round(Number(p[n]) / m * 100) : 0}%`,
803
- color: b(String(p[r]), i)
860
+ valueKey: a,
861
+ donut: i = !0,
862
+ centerLabel: l,
863
+ highlight: n,
864
+ height: o = 260,
865
+ legend: x = !0,
866
+ formatValue: s,
867
+ tooltip: m,
868
+ className: u
869
+ }, N) => {
870
+ const v = s ?? F, f = t.reduce((p, h) => p + (typeof h[a] == "number" ? h[a] : 0), 0), y = (p, h) => U(h), C = (p) => n && p !== n ? 0.3 : 1, w = x ? t.map((p, h) => ({
871
+ label: `${p[r]} · ${f ? Math.round(Number(p[a]) / f * 100) : 0}%`,
872
+ color: y(String(p[r]), h)
804
873
  })) : null;
805
- return /* @__PURE__ */ N("div", { ref: x, className: $("relative w-full font-sans", d), children: [
806
- A && /* @__PURE__ */ e(G, { items: A }),
807
- /* @__PURE__ */ N("div", { className: "relative", children: [
808
- /* @__PURE__ */ e(j, { width: "100%", height: s, children: /* @__PURE__ */ N(ye, { margin: { top: 8, right: 8, bottom: 8, left: 8 }, children: [
809
- f !== !1 && /* @__PURE__ */ e(
810
- S,
874
+ return /* @__PURE__ */ A("div", { ref: N, className: L("relative w-full font-sans", u), children: [
875
+ w && /* @__PURE__ */ e(V, { items: w }),
876
+ /* @__PURE__ */ A("div", { className: "relative", children: [
877
+ /* @__PURE__ */ e(j, { width: "100%", height: o, children: /* @__PURE__ */ A(ye, { margin: { top: 8, right: 8, bottom: 8, left: 8 }, children: [
878
+ m !== !1 && /* @__PURE__ */ e(
879
+ O,
811
880
  {
812
881
  content: /* @__PURE__ */ e(
813
- O,
882
+ T,
814
883
  {
815
884
  format: v,
816
- renderer: f
885
+ renderer: m
817
886
  }
818
887
  ),
819
888
  isAnimationActive: !1
820
889
  }
821
890
  ),
822
891
  /* @__PURE__ */ e(
823
- Ce,
892
+ ke,
824
893
  {
825
894
  data: t,
826
- dataKey: n,
895
+ dataKey: a,
827
896
  nameKey: r,
828
- innerRadius: l ? "62%" : 0,
897
+ innerRadius: i ? "62%" : 0,
829
898
  outerRadius: "88%",
830
- paddingAngle: l ? 2 : 1,
831
- cornerRadius: l ? 4 : 2,
899
+ paddingAngle: i ? 2 : 1,
900
+ cornerRadius: i ? 4 : 2,
832
901
  stroke: "none",
833
902
  isAnimationActive: !1,
834
- children: t.map((p, i) => /* @__PURE__ */ e(
835
- oe,
903
+ children: t.map((p, h) => /* @__PURE__ */ e(
904
+ ce,
836
905
  {
837
906
  role: "presentation",
838
907
  "aria-hidden": "true",
839
- fill: b(String(p[r]), i),
840
- fillOpacity: w(String(p[r]))
908
+ fill: y(String(p[r]), h),
909
+ fillOpacity: C(String(p[r]))
841
910
  },
842
911
  String(p[r])
843
912
  ))
844
913
  }
845
914
  )
846
915
  ] }) }),
847
- l && /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
848
- /* @__PURE__ */ e("div", { className: "text-xl font-medium text-foreground tabular-nums", children: v(m) }),
849
- o && /* @__PURE__ */ e("div", { className: "mt-0.5 text-xs font-normal tracking-wide uppercase text-tertiary", children: o })
916
+ i && /* @__PURE__ */ A("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
917
+ /* @__PURE__ */ e("div", { className: "text-xl font-medium text-foreground tabular-nums", children: v(f) }),
918
+ l && /* @__PURE__ */ e("div", { className: "mt-0.5 text-xs font-normal tracking-wide uppercase text-tertiary", children: l })
850
919
  ] })
851
920
  ] })
852
921
  ] });
853
922
  }
854
923
  );
855
- Ze.displayName = "PieChart";
856
- const Qe = k.forwardRef(
924
+ Qe.displayName = "PieChart";
925
+ const qe = k.forwardRef(
857
926
  ({
858
927
  data: t,
859
928
  categoryKey: r,
860
- series: n,
861
- seriesLabels: l,
862
- highlight: o,
863
- maxValue: a,
864
- height: s = 300,
865
- legend: u,
866
- formatValue: c,
867
- tooltip: f,
868
- className: d
869
- }, x) => {
929
+ series: a,
930
+ seriesLabels: i,
931
+ highlight: l,
932
+ maxValue: n,
933
+ height: o = 300,
934
+ legend: x,
935
+ formatValue: s,
936
+ tooltip: m,
937
+ className: u
938
+ }, N) => {
870
939
  const v = k.useMemo(
871
- () => n ?? ce(t, r),
872
- [r, t, n]
873
- ), m = c ?? F, b = a ?? Math.max(
940
+ () => a ?? ue(t, r),
941
+ [r, t, a]
942
+ ), f = s ?? F, y = n ?? Math.max(
874
943
  1,
875
944
  ...t.flatMap(
876
- (i) => v.map(
877
- (h) => typeof i[h] == "number" ? i[h] : 0
945
+ (h) => v.map(
946
+ (R) => typeof h[R] == "number" ? h[R] : 0
878
947
  )
879
948
  )
880
- ), w = (i) => (l == null ? void 0 : l[i]) ?? i, A = (i, h) => o && v.includes(o) ? i === o ? "var(--color-chart-1)" : Q : _(h), p = u ?? v.length > 1 ? v.map((i, h) => ({ label: w(i), color: A(i, h) })) : null;
881
- return /* @__PURE__ */ N("div", { ref: x, className: $("relative w-full font-sans", d), children: [
882
- p && /* @__PURE__ */ e(G, { items: p, align: "center" }),
883
- /* @__PURE__ */ e("div", { className: "mx-auto w-full max-w-[520px]", children: /* @__PURE__ */ e(j, { width: "100%", height: s, children: /* @__PURE__ */ N(
884
- ke,
949
+ ), C = (h) => (i == null ? void 0 : i[h]) ?? h, w = (h, R) => l && v.includes(l) ? h === l ? "var(--color-chart-1)" : te : U(R), p = x ?? v.length > 1 ? v.map((h, R) => ({ label: C(h), color: w(h, R) })) : null;
950
+ return /* @__PURE__ */ A("div", { ref: N, className: L("relative w-full font-sans", u), children: [
951
+ p && /* @__PURE__ */ e(V, { items: p, align: "center" }),
952
+ /* @__PURE__ */ e("div", { className: "mx-auto w-full max-w-[520px]", children: /* @__PURE__ */ e(j, { width: "100%", height: o, children: /* @__PURE__ */ A(
953
+ Re,
885
954
  {
886
955
  data: t,
887
956
  cx: "50%",
@@ -889,50 +958,50 @@ const Qe = k.forwardRef(
889
958
  outerRadius: "68%",
890
959
  margin: { top: 10, right: 56, bottom: 16, left: 56 },
891
960
  children: [
892
- /* @__PURE__ */ e(Re, { stroke: "var(--border)", radialLines: !0 }),
961
+ /* @__PURE__ */ e(Me, { stroke: "var(--border)", radialLines: !0 }),
893
962
  /* @__PURE__ */ e(
894
- se,
963
+ de,
895
964
  {
896
965
  dataKey: r,
897
966
  tick: { fill: "var(--text-secondary)", fontSize: 11, fontWeight: 500 }
898
967
  }
899
968
  ),
900
969
  /* @__PURE__ */ e(
901
- Me,
970
+ $e,
902
971
  {
903
972
  angle: 90,
904
- domain: [0, b],
973
+ domain: [0, y],
905
974
  tick: !1,
906
975
  axisLine: !1,
907
976
  tickLine: !1
908
977
  }
909
978
  ),
910
- f !== !1 && /* @__PURE__ */ e(
911
- S,
979
+ m !== !1 && /* @__PURE__ */ e(
980
+ O,
912
981
  {
913
982
  content: /* @__PURE__ */ e(
914
- O,
983
+ T,
915
984
  {
916
- format: m,
917
- renderer: f
985
+ format: f,
986
+ renderer: m
918
987
  }
919
988
  ),
920
989
  isAnimationActive: !1
921
990
  }
922
991
  ),
923
- v.map((i, h) => /* @__PURE__ */ e(
924
- $e,
992
+ v.map((h, R) => /* @__PURE__ */ e(
993
+ Le,
925
994
  {
926
- dataKey: i,
927
- name: w(i),
928
- stroke: A(i, h),
929
- fill: A(i, h),
930
- fillOpacity: o ? i === o ? 0.16 : 0.05 : 0.1,
995
+ dataKey: h,
996
+ name: C(h),
997
+ stroke: w(h, R),
998
+ fill: w(h, R),
999
+ fillOpacity: l ? h === l ? 0.16 : 0.05 : 0.1,
931
1000
  strokeWidth: 2,
932
- dot: { r: 2.5, fill: A(i, h), strokeWidth: 0 },
1001
+ dot: { r: 2.5, fill: w(h, R), strokeWidth: 0 },
933
1002
  isAnimationActive: !1
934
1003
  },
935
- i
1004
+ h
936
1005
  ))
937
1006
  ]
938
1007
  }
@@ -940,35 +1009,35 @@ const Qe = k.forwardRef(
940
1009
  ] });
941
1010
  }
942
1011
  );
943
- Qe.displayName = "RadarChart";
944
- const qe = k.forwardRef(
1012
+ qe.displayName = "RadarChart";
1013
+ const Je = k.forwardRef(
945
1014
  ({
946
1015
  data: t,
947
1016
  nameKey: r,
948
- valueKey: n,
949
- maxValue: l = 100,
950
- centerLabel: o,
951
- height: a = T,
952
- legend: s = !0,
953
- formatValue: u,
954
- tooltip: c,
955
- className: f
956
- }, d) => {
957
- const x = u ?? F, v = t.map((w, A) => ({
958
- ...w,
959
- name: String(w[r]),
960
- fill: Y(A)
961
- })), m = v.length ? v.reduce(
962
- (w, A) => w + (typeof A[n] == "number" ? A[n] : 0),
1017
+ valueKey: a,
1018
+ maxValue: i = 100,
1019
+ centerLabel: l,
1020
+ height: n = I,
1021
+ legend: o = !0,
1022
+ formatValue: x,
1023
+ tooltip: s,
1024
+ className: m
1025
+ }, u) => {
1026
+ const N = x ?? F, v = t.map((C, w) => ({
1027
+ ...C,
1028
+ name: String(C[r]),
1029
+ fill: J(w)
1030
+ })), f = v.length ? v.reduce(
1031
+ (C, w) => C + (typeof w[a] == "number" ? w[a] : 0),
963
1032
  0
964
- ) / v.length : 0, b = s ? v.map((w, A) => ({
965
- label: String(w[r]),
966
- color: Y(A)
1033
+ ) / v.length : 0, y = o ? v.map((C, w) => ({
1034
+ label: String(C[r]),
1035
+ color: J(w)
967
1036
  })) : null;
968
- return /* @__PURE__ */ N("div", { ref: d, className: $("relative w-full font-sans", f), children: [
969
- /* @__PURE__ */ N("div", { className: "relative mx-auto w-full max-w-[420px]", children: [
970
- /* @__PURE__ */ e(j, { width: "100%", height: a, children: /* @__PURE__ */ N(
971
- Le,
1037
+ return /* @__PURE__ */ A("div", { ref: u, className: L("relative w-full font-sans", m), children: [
1038
+ /* @__PURE__ */ A("div", { className: "relative mx-auto w-full max-w-[420px]", children: [
1039
+ /* @__PURE__ */ e(j, { width: "100%", height: n, children: /* @__PURE__ */ A(
1040
+ Se,
972
1041
  {
973
1042
  data: v,
974
1043
  innerRadius: "48%",
@@ -977,15 +1046,15 @@ const qe = k.forwardRef(
977
1046
  endAngle: -270,
978
1047
  margin: { top: 6, right: 6, bottom: 6, left: 6 },
979
1048
  children: [
980
- /* @__PURE__ */ e(se, { type: "number", domain: [0, l], tick: !1 }),
981
- c !== !1 && /* @__PURE__ */ e(
982
- S,
1049
+ /* @__PURE__ */ e(de, { type: "number", domain: [0, i], tick: !1 }),
1050
+ s !== !1 && /* @__PURE__ */ e(
1051
+ O,
983
1052
  {
984
1053
  content: /* @__PURE__ */ e(
985
- O,
1054
+ T,
986
1055
  {
987
- format: x,
988
- renderer: c
1056
+ format: N,
1057
+ renderer: s
989
1058
  }
990
1059
  ),
991
1060
  isAnimationActive: !1
@@ -994,7 +1063,7 @@ const qe = k.forwardRef(
994
1063
  /* @__PURE__ */ e(
995
1064
  Fe,
996
1065
  {
997
- dataKey: n,
1066
+ dataKey: a,
998
1067
  background: { fill: "var(--muted)" },
999
1068
  cornerRadius: 999,
1000
1069
  maxBarSize: 18,
@@ -1004,71 +1073,71 @@ const qe = k.forwardRef(
1004
1073
  ]
1005
1074
  }
1006
1075
  ) }),
1007
- /* @__PURE__ */ N("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
1008
- /* @__PURE__ */ e("div", { className: "text-xl font-medium text-foreground tabular-nums", children: x(Math.round(m)) }),
1009
- o && /* @__PURE__ */ e("div", { className: "mt-0.5 text-xs font-normal tracking-wide uppercase text-tertiary", children: o })
1076
+ /* @__PURE__ */ A("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
1077
+ /* @__PURE__ */ e("div", { className: "text-xl font-medium text-foreground tabular-nums", children: N(Math.round(f)) }),
1078
+ l && /* @__PURE__ */ e("div", { className: "mt-0.5 text-xs font-normal tracking-wide uppercase text-tertiary", children: l })
1010
1079
  ] })
1011
1080
  ] }),
1012
- b && /* @__PURE__ */ e(G, { items: b, align: "center", className: "mb-0 mt-3" })
1081
+ y && /* @__PURE__ */ e(V, { items: y, align: "center", className: "mb-0 mt-3" })
1013
1082
  ] });
1014
1083
  }
1015
1084
  );
1016
- qe.displayName = "RadialBarChart";
1017
- function Je({
1085
+ Je.displayName = "RadialBarChart";
1086
+ function Ke({
1018
1087
  x: t = 0,
1019
1088
  y: r = 0,
1020
- width: n = 0,
1021
- height: l = 0,
1022
- depth: o = 0,
1023
- index: a = 0,
1024
- name: s,
1025
- value: u,
1026
- format: c = F
1089
+ width: a = 0,
1090
+ height: i = 0,
1091
+ depth: l = 0,
1092
+ index: n = 0,
1093
+ name: o,
1094
+ value: x,
1095
+ format: s = F
1027
1096
  }) {
1028
- if (o === 0) return /* @__PURE__ */ e("g", {});
1029
- const f = o === 0 ? "transparent" : Y(a), d = o > 0 && a < 4, x = n > 72 && l > 38;
1030
- return /* @__PURE__ */ N("g", { children: [
1097
+ if (l === 0) return /* @__PURE__ */ e("g", {});
1098
+ const m = l === 0 ? "transparent" : J(n), u = l > 0 && n < 4, N = a > 72 && i > 38;
1099
+ return /* @__PURE__ */ A("g", { children: [
1031
1100
  /* @__PURE__ */ e(
1032
1101
  "rect",
1033
1102
  {
1034
1103
  x: t,
1035
1104
  y: r,
1036
- width: n,
1037
- height: l,
1105
+ width: a,
1106
+ height: i,
1038
1107
  rx: 6,
1039
1108
  ry: 6,
1040
- fill: f,
1109
+ fill: m,
1041
1110
  stroke: "var(--background)",
1042
1111
  strokeWidth: 4
1043
1112
  }
1044
1113
  ),
1045
- x && /* @__PURE__ */ e(
1114
+ N && /* @__PURE__ */ e(
1046
1115
  "foreignObject",
1047
1116
  {
1048
1117
  x: t + 8,
1049
1118
  y: r + 8,
1050
- width: Math.max(0, n - 16),
1051
- height: Math.max(0, l - 16),
1119
+ width: Math.max(0, a - 16),
1120
+ height: Math.max(0, i - 16),
1052
1121
  className: "pointer-events-none overflow-hidden",
1053
- children: /* @__PURE__ */ N("div", { className: "flex h-full flex-col justify-between", children: [
1122
+ children: /* @__PURE__ */ A("div", { className: "flex h-full flex-col justify-between", children: [
1054
1123
  /* @__PURE__ */ e(
1055
1124
  "p",
1056
1125
  {
1057
- className: $(
1126
+ className: L(
1058
1127
  "truncate text-xs font-medium",
1059
- d ? "text-background" : "text-foreground"
1128
+ u ? "text-background" : "text-foreground"
1060
1129
  ),
1061
- children: s
1130
+ children: o
1062
1131
  }
1063
1132
  ),
1064
- typeof u == "number" && l > 58 && /* @__PURE__ */ e(
1133
+ typeof x == "number" && i > 58 && /* @__PURE__ */ e(
1065
1134
  "p",
1066
1135
  {
1067
- className: $(
1136
+ className: L(
1068
1137
  "text-xs tabular-nums",
1069
- d ? "text-background/70" : "text-tertiary"
1138
+ u ? "text-background/70" : "text-tertiary"
1070
1139
  ),
1071
- children: c(u)
1140
+ children: s(x)
1072
1141
  }
1073
1142
  )
1074
1143
  ] })
@@ -1076,53 +1145,53 @@ function Je({
1076
1145
  )
1077
1146
  ] });
1078
1147
  }
1079
- function Ke(t, r, n) {
1080
- const l = [], o = (a) => {
1081
- const s = Array.isArray(a.children) ? a.children : void 0;
1082
- if (s != null && s.length) {
1083
- s.forEach(o);
1148
+ function et(t, r, a) {
1149
+ const i = [], l = (n) => {
1150
+ const o = Array.isArray(n.children) ? n.children : void 0;
1151
+ if (o != null && o.length) {
1152
+ o.forEach(l);
1084
1153
  return;
1085
1154
  }
1086
- typeof a[n] == "number" && l.push({
1087
- ...a,
1088
- name: String(a[r] ?? ""),
1089
- value: a[n]
1155
+ typeof n[a] == "number" && i.push({
1156
+ ...n,
1157
+ name: String(n[r] ?? ""),
1158
+ value: n[a]
1090
1159
  });
1091
1160
  };
1092
- return t.forEach(o), l.length ? l : t;
1161
+ return t.forEach(l), i.length ? i : t;
1093
1162
  }
1094
- const et = k.forwardRef(
1163
+ const tt = k.forwardRef(
1095
1164
  ({
1096
1165
  data: t,
1097
1166
  nameKey: r,
1098
- valueKey: n,
1099
- height: l = T,
1100
- formatValue: o,
1101
- tooltip: a,
1102
- className: s
1103
- }, u) => {
1104
- const c = o ?? F, f = k.useMemo(
1105
- () => Ke(t, r, n),
1106
- [t, r, n]
1167
+ valueKey: a,
1168
+ height: i = I,
1169
+ formatValue: l,
1170
+ tooltip: n,
1171
+ className: o
1172
+ }, x) => {
1173
+ const s = l ?? F, m = k.useMemo(
1174
+ () => et(t, r, a),
1175
+ [t, r, a]
1107
1176
  );
1108
- return /* @__PURE__ */ e("div", { ref: u, className: $("relative w-full font-sans", s), children: /* @__PURE__ */ e(j, { width: "100%", height: l, children: /* @__PURE__ */ e(
1109
- Se,
1177
+ return /* @__PURE__ */ e("div", { ref: x, className: L("relative w-full font-sans", o), children: /* @__PURE__ */ e(j, { width: "100%", height: i, children: /* @__PURE__ */ e(
1178
+ Oe,
1110
1179
  {
1111
- data: f,
1180
+ data: m,
1112
1181
  nameKey: r,
1113
- dataKey: n,
1182
+ dataKey: a,
1114
1183
  type: "flat",
1115
1184
  aspectRatio: 1.6,
1116
- content: /* @__PURE__ */ e(Je, { format: c }),
1185
+ content: /* @__PURE__ */ e(Ke, { format: s }),
1117
1186
  isAnimationActive: !1,
1118
- children: a !== !1 && /* @__PURE__ */ e(
1119
- S,
1187
+ children: n !== !1 && /* @__PURE__ */ e(
1188
+ O,
1120
1189
  {
1121
1190
  content: /* @__PURE__ */ e(
1122
- O,
1191
+ T,
1123
1192
  {
1124
- format: c,
1125
- renderer: a
1193
+ format: s,
1194
+ renderer: n
1126
1195
  }
1127
1196
  ),
1128
1197
  isAnimationActive: !1
@@ -1132,90 +1201,90 @@ const et = k.forwardRef(
1132
1201
  ) }) });
1133
1202
  }
1134
1203
  );
1135
- et.displayName = "TreemapChart";
1136
- const U = "var(--color-chart-1)", tt = "var(--chart-track)", P = 24, rt = 44, re = 0.55, ne = 4, ae = (t, r, n, l, o) => {
1137
- const a = Math.min(o, n / 2, l);
1138
- return `M ${t},${r + l} L ${t},${r + a} Q ${t},${r} ${t + a},${r} L ${t + n - a},${r} Q ${t + n},${r} ${t + n},${r + a} L ${t + n},${r + l} Z`;
1204
+ tt.displayName = "TreemapChart";
1205
+ const Q = "var(--color-chart-1)", nt = "var(--chart-track)", _ = 24, rt = 44, ae = 0.55, ie = 4, le = (t, r, a, i, l) => {
1206
+ const n = Math.min(l, a / 2, i);
1207
+ return `M ${t},${r + i} L ${t},${r + n} Q ${t},${r} ${t + n},${r} L ${t + a - n},${r} Q ${t + a},${r} ${t + a},${r + n} L ${t + a},${r + i} Z`;
1139
1208
  };
1140
- function nt() {
1141
- const t = k.useRef(null), [r, n] = k.useState(0);
1209
+ function at() {
1210
+ const t = k.useRef(null), [r, a] = k.useState(0);
1142
1211
  return k.useLayoutEffect(() => {
1143
- const l = t.current;
1144
- if (!l) return;
1145
- n(l.getBoundingClientRect().width);
1146
- const o = new ResizeObserver((a) => {
1147
- var u;
1148
- const s = ((u = a[0]) == null ? void 0 : u.contentRect.width) ?? 0;
1149
- n((c) => Math.abs(c - s) > 0.5 ? s : c);
1212
+ const i = t.current;
1213
+ if (!i) return;
1214
+ a(i.getBoundingClientRect().width);
1215
+ const l = new ResizeObserver((n) => {
1216
+ var x;
1217
+ const o = ((x = n[0]) == null ? void 0 : x.contentRect.width) ?? 0;
1218
+ a((s) => Math.abs(s - o) > 0.5 ? o : s);
1150
1219
  });
1151
- return o.observe(l), () => o.disconnect();
1220
+ return l.observe(i), () => l.disconnect();
1152
1221
  }, []), { ref: t, width: r };
1153
1222
  }
1154
- const at = k.forwardRef(
1223
+ const it = k.forwardRef(
1155
1224
  ({
1156
1225
  data: t,
1157
1226
  nameKey: r,
1158
- valueKey: n,
1159
- height: l = T,
1160
- formatValue: o,
1161
- label: a,
1162
- tooltip: s,
1163
- className: u
1164
- }, c) => {
1165
- var R;
1166
- const f = o ?? F, { ref: d, width: x } = nt(), [v, m] = k.useState(null), b = Number(((R = t[0]) == null ? void 0 : R[n]) ?? 0), w = t.length, A = Math.max(0, l - P - rt), p = P + A, i = w > 0 ? x / (w + (w - 1) * re) : 0, h = i * re, y = t.map((g, L) => {
1167
- var te;
1168
- const M = Number(g[n]), B = Number(((te = t[L - 1]) == null ? void 0 : te[n]) ?? M), xe = b ? M / b * 100 : 0, K = B ? M / B * 100 : 0, ee = b && M > 0 ? Math.max(2, M / b * A) : 0;
1227
+ valueKey: a,
1228
+ height: i = I,
1229
+ formatValue: l,
1230
+ label: n,
1231
+ tooltip: o,
1232
+ className: x
1233
+ }, s) => {
1234
+ var b;
1235
+ const m = l ?? F, { ref: u, width: N } = at(), [v, f] = k.useState(null), y = Number(((b = t[0]) == null ? void 0 : b[a]) ?? 0), C = t.length, w = Math.max(0, i - _ - rt), p = _ + w, h = C > 0 ? N / (C + (C - 1) * ae) : 0, R = h * ae, d = t.map((g, $) => {
1236
+ var B;
1237
+ const S = Number(g[a]), E = Number(((B = t[$ - 1]) == null ? void 0 : B[a]) ?? S), X = y ? S / y * 100 : 0, Z = E ? S / E * 100 : 0, M = y && S > 0 ? Math.max(2, S / y * w) : 0;
1169
1238
  return {
1170
1239
  datum: g,
1171
- index: L,
1240
+ index: $,
1172
1241
  name: String(g[r]),
1173
- value: M,
1174
- conversionFromFirst: xe,
1175
- conversionFromPrevious: K,
1176
- dropOffFromPrevious: L === 0 ? 0 : 100 - K,
1177
- x: L * (i + h),
1178
- y: p - ee,
1179
- width: i,
1180
- height: ee,
1181
- formatValue: f
1242
+ value: S,
1243
+ conversionFromFirst: X,
1244
+ conversionFromPrevious: Z,
1245
+ dropOffFromPrevious: $ === 0 ? 0 : 100 - Z,
1246
+ x: $ * (h + R),
1247
+ y: p - M,
1248
+ width: h,
1249
+ height: M,
1250
+ formatValue: m
1182
1251
  };
1183
- }), C = v != null ? y[v] : void 0;
1184
- return /* @__PURE__ */ e("div", { ref: c, className: $("relative w-full font-sans", u), children: /* @__PURE__ */ N("div", { ref: d, className: "relative w-full", style: { height: l }, children: [
1185
- x > 0 && w > 0 && /* @__PURE__ */ N("svg", { width: x, height: l, className: "block", children: [
1186
- y.slice(1).map((g) => {
1187
- const L = y[g.index - 1];
1252
+ }), c = v != null ? d[v] : void 0;
1253
+ return /* @__PURE__ */ e("div", { ref: s, className: L("relative w-full font-sans", x), children: /* @__PURE__ */ A("div", { ref: u, className: "relative w-full", style: { height: i }, children: [
1254
+ N > 0 && C > 0 && /* @__PURE__ */ A("svg", { width: N, height: i, className: "block", children: [
1255
+ d.slice(1).map((g) => {
1256
+ const $ = d[g.index - 1];
1188
1257
  return /* @__PURE__ */ e(
1189
1258
  "path",
1190
1259
  {
1191
- d: `M ${L.x + L.width},${L.y} L ${g.x},${g.y} L ${g.x},${p} L ${L.x + L.width},${p} Z`,
1192
- fill: U,
1260
+ d: `M ${$.x + $.width},${$.y} L ${g.x},${g.y} L ${g.x},${p} L ${$.x + $.width},${p} Z`,
1261
+ fill: Q,
1193
1262
  opacity: 0.14
1194
1263
  },
1195
1264
  `connector-${g.index}`
1196
1265
  );
1197
1266
  }),
1198
- y.map((g) => /* @__PURE__ */ N(
1267
+ d.map((g) => /* @__PURE__ */ A(
1199
1268
  "g",
1200
1269
  {
1201
1270
  role: "img",
1202
- "aria-label": `${g.name}: ${f(g.value)} (${Math.round(g.conversionFromFirst)}% of ${y[0].name})`,
1271
+ "aria-label": `${g.name}: ${m(g.value)} (${Math.round(g.conversionFromFirst)}% of ${d[0].name})`,
1203
1272
  children: [
1204
1273
  /* @__PURE__ */ e(
1205
1274
  "path",
1206
1275
  {
1207
- d: ae(g.x, P, g.width, A, ne),
1208
- fill: tt
1276
+ d: le(g.x, _, g.width, w, ie),
1277
+ fill: nt
1209
1278
  }
1210
1279
  ),
1211
1280
  g.height > 0 && /* @__PURE__ */ e(
1212
1281
  "path",
1213
1282
  {
1214
- d: ae(g.x, g.y, g.width, g.height, ne),
1215
- fill: U
1283
+ d: le(g.x, g.y, g.width, g.height, ie),
1284
+ fill: Q
1216
1285
  }
1217
1286
  ),
1218
- a !== !1 && (a ? a(g) : /* @__PURE__ */ N(
1287
+ n !== !1 && (n ? n(g) : /* @__PURE__ */ A(
1219
1288
  "text",
1220
1289
  {
1221
1290
  x: g.x,
@@ -1245,19 +1314,19 @@ const at = k.forwardRef(
1245
1314
  y: p + 34,
1246
1315
  textAnchor: "start",
1247
1316
  className: "fill-tertiary text-xs tabular-nums",
1248
- children: f(g.value)
1317
+ children: m(g.value)
1249
1318
  }
1250
1319
  ),
1251
1320
  /* @__PURE__ */ e(
1252
1321
  "rect",
1253
1322
  {
1254
1323
  x: g.x,
1255
- y: P,
1256
- width: g.index === w - 1 ? i : i + h,
1257
- height: A,
1324
+ y: _,
1325
+ width: g.index === C - 1 ? h : h + R,
1326
+ height: w,
1258
1327
  fill: "transparent",
1259
- onMouseEnter: () => m(g.index),
1260
- onMouseLeave: () => m(null)
1328
+ onMouseEnter: () => f(g.index),
1329
+ onMouseLeave: () => f(null)
1261
1330
  }
1262
1331
  )
1263
1332
  ]
@@ -1265,34 +1334,34 @@ const at = k.forwardRef(
1265
1334
  `${g.name}-${g.index}`
1266
1335
  ))
1267
1336
  ] }),
1268
- s !== !1 && C && /* @__PURE__ */ e(
1337
+ o !== !1 && c && /* @__PURE__ */ e(
1269
1338
  "div",
1270
1339
  {
1271
1340
  className: "pointer-events-none absolute z-10 -translate-x-1/2 -translate-y-full",
1272
- style: { left: C.x + C.width / 2, top: C.y - 10 },
1273
- children: s ? s({
1341
+ style: { left: c.x + c.width / 2, top: c.y - 10 },
1342
+ children: o ? o({
1274
1343
  active: !0,
1275
- label: C.name,
1344
+ label: c.name,
1276
1345
  items: [
1277
1346
  {
1278
- key: C.name,
1279
- name: C.name,
1280
- value: C.value,
1281
- color: U,
1282
- datum: C.datum
1347
+ key: c.name,
1348
+ name: c.name,
1349
+ value: c.value,
1350
+ color: Q,
1351
+ datum: c.datum
1283
1352
  }
1284
1353
  ],
1285
- formatValue: f
1286
- }) : /* @__PURE__ */ N("div", { className: "rounded-md bg-foreground px-2.5 py-1.5 text-xs whitespace-nowrap text-background", children: [
1287
- /* @__PURE__ */ e("div", { className: "text-xs font-normal tracking-wide uppercase text-background/60", children: C.name }),
1288
- /* @__PURE__ */ e("div", { className: "font-normal tabular-nums", children: f(C.value) }),
1289
- /* @__PURE__ */ N("div", { className: "text-background/70 tabular-nums", children: [
1290
- Math.round(C.conversionFromFirst),
1354
+ formatValue: m
1355
+ }) : /* @__PURE__ */ A("div", { className: "rounded-md bg-foreground px-2.5 py-1.5 text-xs whitespace-nowrap text-background", children: [
1356
+ /* @__PURE__ */ e("div", { className: "text-xs font-normal tracking-wide uppercase text-background/60", children: c.name }),
1357
+ /* @__PURE__ */ e("div", { className: "font-normal tabular-nums", children: m(c.value) }),
1358
+ /* @__PURE__ */ A("div", { className: "text-background/70 tabular-nums", children: [
1359
+ Math.round(c.conversionFromFirst),
1291
1360
  "% of ",
1292
- y[0].name,
1293
- C.index > 0 && /* @__PURE__ */ N(V, { children: [
1361
+ d[0].name,
1362
+ c.index > 0 && /* @__PURE__ */ A(q, { children: [
1294
1363
  " · −",
1295
- Math.round(C.dropOffFromPrevious),
1364
+ Math.round(c.dropOffFromPrevious),
1296
1365
  "% step"
1297
1366
  ] })
1298
1367
  ] })
@@ -1302,18 +1371,18 @@ const at = k.forwardRef(
1302
1371
  ] }) });
1303
1372
  }
1304
1373
  );
1305
- at.displayName = "FunnelChart";
1374
+ it.displayName = "FunnelChart";
1306
1375
  export {
1307
- Ue as AreaChart,
1308
- Ve as BarChart,
1309
- he as ComboChart,
1310
- Ye as ComposedChart,
1311
- at as FunnelChart,
1312
- He as LineChart,
1313
- T as MIN_HEIGHT,
1314
- Ze as PieChart,
1315
- Qe as RadarChart,
1316
- qe as RadialBarChart,
1317
- Xe as ScatterChart,
1318
- et as TreemapChart
1376
+ Ve as AreaChart,
1377
+ Ye as BarChart,
1378
+ ge as ComboChart,
1379
+ Xe as ComposedChart,
1380
+ it as FunnelChart,
1381
+ Ue as LineChart,
1382
+ I as MIN_HEIGHT,
1383
+ Qe as PieChart,
1384
+ qe as RadarChart,
1385
+ Je as RadialBarChart,
1386
+ Ze as ScatterChart,
1387
+ tt as TreemapChart
1319
1388
  };