@actioneer/ads 0.5.1 → 0.5.3

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