@object-ui/plugin-charts 17.5.0 → 17.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n, buildOptionColorMap as r, compareToTrendLabelKey as i, computeDrillFilter as a, deriveDimensionLabelMaps as o, dimensionOptionTranslator as s, extractRecords as c, isDrillEnabled as l, loadDimensionFieldMeta as u, localizeFieldOptions as d, relabelDimensions as f, resolveContextTokens as p, resolveDrillTitle as ee, resolveFilterPlaceholders as m, shiftFilterByCompareTo as te } from "@object-ui/core";
2
- import * as h from "react";
3
- import g, { Suspense as _, useCallback as ne, useContext as re, useEffect as ie, useMemo as v, useRef as y, useState as b } from "react";
4
- import { Button as x, ChartSkeleton as S, Dialog as C, DialogContent as w, DialogHeader as ae, DialogTitle as oe, RefreshIndicator as se, Sheet as ce, SheetContent as le, SheetHeader as ue, SheetTitle as de, Skeleton as fe } from "@object-ui/components";
1
+ import { ComponentRegistry as e, FilterOperatorError as t, buildCategoryRank as n, buildChartSeries as r, buildOptionColorMap as i, chartMeasureKey as a, chartRowBucketId as o, chartTypeIgnoresCompareTo as s, compareToTrendLabelKey as c, composeDrillFilter as l, computeDrillFilter as u, deriveDimensionLabelMaps as d, dimensionOptionTranslator as f, elementDataSourceBlock as p, extractRecords as m, humanizeLabel as h, isDrillEnabled as ee, isRealCalendarDate as te, isStructuredGroupBy as ne, loadDimensionFieldMeta as re, localizeFieldOptions as ie, objectAggregateSpecQuery as ae, relabelDimensions as oe, resolveContextTokens as se, resolveDrillTitle as ce, resolveFilterPlaceholders as g, shiftFilterByCompareTo as le, toDateInputValue as ue, toDisplayDate as de } from "@object-ui/core";
2
+ import * as _ from "react";
3
+ import v, { Suspense as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useState as w } from "react";
4
+ import { Button as fe, ChartSkeleton as pe, DataEmptyState as me, Dialog as he, DialogContent as ge, DialogHeader as _e, DialogTitle as ve, RefreshIndicator as ye, Sheet as be, SheetContent as xe, SheetHeader as Se, SheetTitle as Ce, Skeleton as we } from "@object-ui/components";
5
+ import { builtinAggregateLabels as Te, pickLocalized as Ee, useDisplayLocale as De, useObjectTranslation as Oe, useSafeFieldLabel as ke, useSafeTranslate as Ae } from "@object-ui/i18n";
5
6
  import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
6
- import { Area as O, AreaChart as pe, Bar as me, BarChart as k, Brush as he, CartesianGrid as ge, Cell as _e, ComposedChart as ve, Funnel as ye, FunnelChart as be, LabelList as A, Legend as j, Line as xe, LineChart as Se, Pie as Ce, PieChart as we, PolarAngleAxis as Te, PolarGrid as Ee, PolarRadiusAxis as De, Radar as Oe, RadarChart as ke, ReferenceArea as Ae, ReferenceLine as je, ResponsiveContainer as Me, Sankey as Ne, Scatter as Pe, ScatterChart as Fe, Tooltip as M, Treemap as N, XAxis as P, YAxis as F, ZAxis as Ie } from "recharts";
7
- import { ElementDataSourceGate as Le, SchemaRenderer as Re, SchemaRendererContext as ze, useDataScope as Be, useDrillNavigation as Ve, useFilterScope as I } from "@object-ui/react";
8
- import { AlertCircle as He, ArrowUpRight as L } from "lucide-react";
9
- import { useSafeFieldLabel as R, useSafeTranslate as z } from "@object-ui/i18n";
7
+ import { Area as je, AreaChart as Me, Bar as Ne, BarChart as Pe, Brush as Fe, CartesianGrid as O, Cell as Ie, ComposedChart as Le, Funnel as Re, FunnelChart as k, LabelList as ze, Legend as Be, Line as Ve, LineChart as He, Pie as Ue, PieChart as We, PolarAngleAxis as Ge, PolarGrid as Ke, PolarRadiusAxis as qe, Radar as Je, RadarChart as Ye, ReferenceArea as Xe, ReferenceLine as Ze, ResponsiveContainer as Qe, Sankey as $e, Scatter as A, ScatterChart as j, Tooltip as M, Treemap as et, XAxis as N, YAxis as P } from "recharts";
8
+ import { ElementDataSourceGate as tt, SchemaRenderer as nt, SchemaRendererContext as rt, useDataInvalidation as F, useDataScope as I, useDrillNavigation as L, useFilterScope as R } from "@object-ui/react";
9
+ import { AlertCircle as z, ArrowUpRight as it, Inbox as at } from "lucide-react";
10
10
  //#region \0rolldown/runtime.js
11
11
  var B = Object.defineProperty, V = (e, t, n) => () => {
12
12
  if (n) throw n[0];
@@ -15,7 +15,7 @@ var B = Object.defineProperty, V = (e, t, n) => () => {
15
15
  } catch (e) {
16
16
  throw n = [e], e;
17
17
  }
18
- }, H = (e, t) => {
18
+ }, ot = (e, t) => {
19
19
  let n = {};
20
20
  for (var r in e) B(n, r, {
21
21
  get: e[r],
@@ -25,136 +25,175 @@ var B = Object.defineProperty, V = (e, t, n) => () => {
25
25
  };
26
26
  //#endregion
27
27
  //#region src/normalizeChartSchema.ts
28
- function U(e) {
29
- let t = q(e);
30
- if (t) return t;
31
- if (K(e)) return Object.values(e).find((e) => typeof e == "string" && e);
32
- }
33
- function W(e) {
34
- if (!K(e)) return;
35
- let t = {}, n = q(e.field);
36
- n && (t.field = n);
37
- let r = q(e.format);
38
- r && (t.format = r);
39
- let i = J(e.min);
40
- i !== void 0 && (t.min = i);
41
- let a = J(e.max);
42
- a !== void 0 && (t.max = a);
43
- let o = J(e.stepSize);
44
- o !== void 0 && o > 0 && (t.stepSize = o), typeof e.showGridLines == "boolean" && (t.showGridLines = e.showGridLines), typeof e.logarithmic == "boolean" && (t.logarithmic = e.logarithmic);
45
- let s = q(e.position);
46
- (s === "left" || s === "right" || s === "top" || s === "bottom") && (t.position = s);
47
- let c = U(e.title);
48
- return c && (t.title = c), t;
49
- }
50
- function Ue(e) {
51
- if (!K(e)) {
52
- let t = q(e);
28
+ function H(e) {
29
+ if (!e) return;
30
+ let t = e.startsWith(K) ? e.slice(14) : e;
31
+ return vt.get(t);
32
+ }
33
+ function U(e, t) {
34
+ if (typeof e == "string" || q(e)) return Ee(e, t) || void 0;
35
+ }
36
+ function st(e, t) {
37
+ if (!q(e)) return;
38
+ let n = {}, r = J(e.field);
39
+ r && (n.field = r);
40
+ let i = J(e.format);
41
+ i && (n.format = i);
42
+ let a = Y(e.min);
43
+ a !== void 0 && (n.min = a);
44
+ let o = Y(e.max);
45
+ o !== void 0 && (n.max = o);
46
+ let s = Y(e.stepSize);
47
+ s !== void 0 && s > 0 && (n.stepSize = s), typeof e.showGridLines == "boolean" && (n.showGridLines = e.showGridLines), typeof e.logarithmic == "boolean" && (n.logarithmic = e.logarithmic);
48
+ let c = J(e.position);
49
+ (c === "left" || c === "right" || c === "top" || c === "bottom") && (n.position = c);
50
+ let l = U(e.title, t);
51
+ return l && (n.title = l), n;
52
+ }
53
+ function ct(e, t) {
54
+ if (!q(e)) {
55
+ let t = J(e);
53
56
  return t ? { dataKey: t } : void 0;
54
57
  }
55
- let t = q(e.dataKey) ?? q(e.name);
56
- if (!t) return;
57
- let n = { dataKey: t }, r = U(e.label);
58
- r && (n.label = r);
59
- let i = q(e.chartType) ?? q(e.type);
60
- (i === "bar" || i === "line" || i === "area") && (n.chartType = i);
61
- let a = q(e.variant);
62
- (a === "comparison" || a === "current" || a === "primary") && (n.variant = a);
63
- let o = J(e.opacity);
64
- o !== void 0 && (n.opacity = o);
65
- let s = q(e.dashArray);
66
- s && (n.dashArray = s);
67
- let c = q(e.stack);
68
- c && (n.stack = c);
69
- let l = q(e.yAxis);
70
- (l === "left" || l === "right") && (n.yAxis = l);
71
- let u = q(e.color);
72
- return u && (n.color = u), n;
73
- }
74
- function We(e) {
75
- if (!K(e)) return {};
76
- let t = {}, n = q(e.type), r = q(e.chartType) ?? q(e.specType) ?? (n && Qe.has(n) ? n : void 0);
77
- r && Ye.has(r) && (t.chartType = r);
78
- let i = e.xAxis, a = W(i);
79
- a && (a.format || a.title || a.showGridLines !== void 0) && (t.xAxis = a);
80
- let o = q(e.xAxisKey) ?? a?.field ?? q(i);
81
- o && (t.xAxisKey = o);
82
- let s = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => W(e) ?? (q(e) ? { field: q(e) } : void 0)).filter((e) => !!e);
83
- s.length && (t.yAxes = s);
84
- let c = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map(Ue).filter((e) => !!e);
85
- if (!c?.length) {
86
- let e = s.filter((e) => e.field).map((e, t) => ({
58
+ let n = J(e.dataKey) ?? J(e.name);
59
+ if (!n) return;
60
+ let r = { dataKey: n }, i = U(e.label, t);
61
+ i && (r.label = i);
62
+ let a = J(e.chartType) ?? J(e.type);
63
+ (a === "bar" || a === "line" || a === "area") && (r.chartType = a);
64
+ let o = J(e.variant);
65
+ (o === "comparison" || o === "current" || o === "primary") && (r.variant = o);
66
+ let s = Y(e.opacity);
67
+ s !== void 0 && (r.opacity = s);
68
+ let c = J(e.dashArray);
69
+ c && (r.dashArray = c);
70
+ let l = J(e.stack);
71
+ l && (r.stack = l);
72
+ let u = J(e.yAxis);
73
+ (u === "left" || u === "right") && (r.yAxis = u);
74
+ let d = J(e.color);
75
+ return d && (r.color = d), r;
76
+ }
77
+ function lt(e, t) {
78
+ let n = t === "horizontal-bar", r = t === "scatter" ? 1 : 2, i = (e ?? []).slice(0, r), a = [], o = (e) => n ? e === "bottom" ? "left" : e === "top" ? "right" : void 0 : e === "left" || e === "right" ? e : void 0, s = (e) => e === "left" ? "right" : "left", c = i.map((e) => o(e.position)), l = [];
79
+ if (i.length === 1) l.push(c[0] ?? "left");
80
+ else if (i.length === 2) {
81
+ let [e, t] = c;
82
+ e && t ? l.push(e, e === t ? s(e) : t) : e ? l.push(e, s(e)) : t ? l.push(s(t), t) : l.push("left", "right");
83
+ }
84
+ i.forEach((e, t) => {
85
+ e.position && (c[t] ? c[t] !== l[t] && a.push({
86
+ index: t,
87
+ position: e.position,
88
+ reason: "taken",
89
+ drawn: l[t]
90
+ }) : a.push({
91
+ index: t,
92
+ position: e.position,
93
+ reason: "side",
94
+ drawn: l[t]
95
+ }));
96
+ });
97
+ let u = r === 1 ? l[0] : "right", d = {
98
+ slotOf: l,
99
+ notes: a,
100
+ undrawn: (e ?? []).slice(i.length).map((e, t) => ({
101
+ index: i.length + t,
102
+ boundTo: u
103
+ }))
104
+ };
105
+ return l.forEach((e, t) => {
106
+ d[e] = t;
107
+ }), d;
108
+ }
109
+ function ut(e, t) {
110
+ if (!q(e)) return {};
111
+ let n = {}, r = J(e.type), i = J(e.chartType) ?? J(e.specType) ?? (r && _t.has(r) ? r : void 0) ?? H(r);
112
+ i && (n.chartType = i);
113
+ let a = e.xAxis, o = st(a, t);
114
+ o && Object.keys(o).some((e) => e !== "field") && (n.xAxis = o);
115
+ let s = J(e.xAxisKey) ?? o?.field ?? J(a);
116
+ s && (n.xAxisKey = s);
117
+ let c = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => st(e, t) ?? (J(e) ? { field: J(e) } : void 0)).filter((e) => !!e);
118
+ c.length && (n.yAxes = c);
119
+ let l = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map((e) => ct(e, t)).filter((e) => !!e);
120
+ if (!l?.length) {
121
+ let e = lt(c, i), t = [...e.slotOf, ...e.undrawn.map((e) => e.boundTo)], n = c.map((e, n) => ({
122
+ a: e,
123
+ slot: t[n],
124
+ i: n
125
+ })).filter(({ a: e }) => e.field).map(({ a: e, slot: t, i: n }) => ({
87
126
  dataKey: e.field,
88
127
  ...e.title ? { label: e.title } : {},
89
- ...t > 0 || e.position === "right" ? { yAxis: "right" } : {}
128
+ ...t === "right" || n > 0 ? { yAxis: t } : {}
90
129
  }));
91
- e.length && (c = e);
130
+ n.length && (l = n);
92
131
  }
93
- c?.length && (t.series = c), typeof e.showLegend == "boolean" && (t.showLegend = e.showLegend), typeof e.showDataLabels == "boolean" && (t.showDataLabels = e.showDataLabels);
94
- let l = U(e.title);
95
- l && (t.title = l);
96
- let u = U(e.subtitle);
97
- u && (t.subtitle = u);
98
- let d = U(e.description);
99
- d && (t.description = d);
100
- let f = J(e.height);
101
- return f !== void 0 && f > 0 && (t.height = f), Array.isArray(e.annotations) && e.annotations.length && (t.annotations = e.annotations.filter(K)), K(e.interaction) && (t.interaction = e.interaction), t;
102
- }
103
- function Ge(e) {
132
+ l?.length && (n.series = l), typeof e.showLegend == "boolean" && (n.showLegend = e.showLegend), typeof e.showDataLabels == "boolean" && (n.showDataLabels = e.showDataLabels);
133
+ let u = U(e.title, t);
134
+ u && (n.title = u);
135
+ let d = U(e.subtitle, t);
136
+ d && (n.subtitle = d);
137
+ let f = U(e.description, t);
138
+ f && (n.description = f);
139
+ let p = Y(e.height);
140
+ return p !== void 0 && p > 0 && (n.height = p), Array.isArray(e.annotations) && e.annotations.length && (n.annotations = e.annotations.filter(q)), q(e.interaction) && (n.interaction = e.interaction), n;
141
+ }
142
+ function dt(e) {
104
143
  if (e === "bar" || e === "column") return "bar";
105
144
  if (e === "line") return "line";
106
145
  if (e === "area") return "area";
107
146
  }
108
- function Ke(e, t) {
147
+ function ft(e, t) {
109
148
  if (e === "combo") return "combo";
110
- let n = Ge(e);
149
+ let n = dt(e);
111
150
  if (!n || !t || t.length < 2) return e;
112
151
  let r = t.map((e) => e.chartType ?? n);
113
152
  return new Set(r).size > 1 ? "combo" : e;
114
153
  }
115
- function G(e) {
154
+ function W(e, t) {
116
155
  if (!e) return;
117
- let t = e.includes("%"), n = /^([$£€¥₹])/.exec(e), r = e.includes(","), i = /\.(0+)/.exec(e)?.[1].length ?? 0, a = {
156
+ let n = e.includes("%"), r = /^([$£€¥₹])/.exec(e), i = e.includes(","), a = /\.(0+)/.exec(e)?.[1].length ?? 0, o = {
118
157
  $: "USD",
119
158
  "£": "GBP",
120
159
  "€": "EUR",
121
160
  "¥": "CNY",
122
161
  "₹": "INR"
123
162
  };
124
- if (!t && !n && !r && i === 0) return;
125
- let o = {
126
- minimumFractionDigits: i,
127
- maximumFractionDigits: i,
128
- useGrouping: r
163
+ if (!n && !r && !i && a === 0) return;
164
+ let s = {
165
+ minimumFractionDigits: a,
166
+ maximumFractionDigits: a,
167
+ useGrouping: i
129
168
  };
130
- return t ? o.style = "percent" : n && (o.style = "currency", o.currency = a[n[1]] ?? "USD"), (e) => {
131
- let t = typeof e == "number" ? e : Number(e);
132
- if (!Number.isFinite(t)) return e == null ? "" : String(e);
169
+ return n ? s.style = "percent" : r && (s.style = "currency", s.currency = o[r[1]] ?? "USD"), (e) => {
170
+ let n = typeof e == "number" ? e : Number(e);
171
+ if (!Number.isFinite(n)) return e == null ? "" : String(e);
133
172
  try {
134
- return new Intl.NumberFormat(void 0, o).format(t);
173
+ return new Intl.NumberFormat(t, s).format(n);
135
174
  } catch {
136
- return String(t);
175
+ return String(n);
137
176
  }
138
177
  };
139
178
  }
140
- function qe(e, t) {
179
+ function pt(e, t) {
141
180
  let n = e?.stepSize;
142
181
  if (!n || n <= 0) return;
143
182
  let r = t.filter((e) => Number.isFinite(e)), i = r.length ? Math.min(...r) : void 0, a = r.length ? Math.max(...r) : void 0, o = e.min ?? Math.min(0, i ?? 0), s = e.max ?? a;
144
183
  if (s === void 0 || !Number.isFinite(o) || !Number.isFinite(s) || s < o) return;
145
184
  let c = Math.floor(o / n) * n, l = e.max === void 0 ? Math.ceil(s / n) * n : e.max, u = Math.floor((l - c) / n + 1e-9) + 1;
146
- if (u < 1 || u > Y) return;
185
+ if (u < 1 || u > yt) return;
147
186
  let d = [];
148
187
  for (let e = 0; e < u; e++) d.push(Number((c + e * n).toPrecision(12)));
149
188
  return e.max !== void 0 && d[d.length - 1] < e.max && d.push(e.max), d;
150
189
  }
151
- function Je(e) {
190
+ function G(e) {
152
191
  if (!e) return;
153
192
  let { min: t, max: n } = e;
154
193
  if (t !== void 0 || n !== void 0) return [t ?? "auto", n ?? "auto"];
155
194
  }
156
- var Ye, Xe, Ze, Qe, K, q, J, Y, $e = V((() => {
157
- Ye = /* @__PURE__ */ new Set([
195
+ var mt, ht, gt, _t, vt, K, q, J, Y, yt, bt = V((() => {
196
+ mt = /* @__PURE__ */ new Set([
158
197
  "bar",
159
198
  "column",
160
199
  "horizontal-bar",
@@ -168,23 +207,23 @@ var Ye, Xe, Ze, Qe, K, q, J, Y, $e = V((() => {
168
207
  "treemap",
169
208
  "sankey",
170
209
  "combo"
171
- ]), Xe = /* @__PURE__ */ new Set([
210
+ ]), ht = /* @__PURE__ */ new Set([
172
211
  "gauge",
173
212
  "solid-gauge",
174
213
  "metric",
175
214
  "kpi",
176
215
  "bullet"
177
- ]), Ze = /* @__PURE__ */ new Set(["table", "pivot"]), Qe = /* @__PURE__ */ new Set([
178
- ...Ye,
179
- ...Xe,
180
- ...Ze
181
- ]), K = (e) => !!e && typeof e == "object" && !Array.isArray(e), q = (e) => typeof e == "string" && e ? e : void 0, J = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, Y = 200;
182
- })), et = /* @__PURE__ */ H({ default: () => rt });
183
- function tt(e, t = 14) {
216
+ ]), gt = /* @__PURE__ */ new Set(["table", "pivot"]), _t = /* @__PURE__ */ new Set([
217
+ ...mt,
218
+ ...ht,
219
+ ...gt
220
+ ]), vt = /* @__PURE__ */ new Map([["chart:bar", "bar"]]), K = "plugin-charts:", q = (e) => !!e && typeof e == "object" && !Array.isArray(e), J = (e) => typeof e == "string" && e ? e : void 0, Y = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, yt = 200;
221
+ })), xt = /* @__PURE__ */ ot({ default: () => wt });
222
+ function St(e, t = 14) {
184
223
  return e.length > t ? `${e.slice(0, t - 1)}…` : e;
185
224
  }
186
- function nt({ x: e, y: t, payload: n }) {
187
- let r = String(n?.value ?? ""), i = tt(r);
225
+ function Ct({ x: e, y: t, payload: n }) {
226
+ let r = String(n?.value ?? ""), i = St(r);
188
227
  return /* @__PURE__ */ E("g", {
189
228
  transform: `translate(${e},${t})`,
190
229
  children: /* @__PURE__ */ D("text", {
@@ -198,14 +237,14 @@ function nt({ x: e, y: t, payload: n }) {
198
237
  })
199
238
  });
200
239
  }
201
- function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
240
+ function wt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
202
241
  let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
203
242
  return /* @__PURE__ */ E("div", {
204
243
  className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,
205
- children: /* @__PURE__ */ E(Me, {
244
+ children: /* @__PURE__ */ E(Qe, {
206
245
  width: "100%",
207
246
  height: r,
208
- children: /* @__PURE__ */ D(k, {
247
+ children: /* @__PURE__ */ D(Pe, {
209
248
  data: e,
210
249
  margin: {
211
250
  top: 10,
@@ -266,14 +305,14 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
266
305
  /* @__PURE__ */ D("feMerge", { children: [/* @__PURE__ */ E("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ E("feMergeNode", { in: "SourceGraphic" })] })
267
306
  ]
268
307
  })] }),
269
- /* @__PURE__ */ E(ge, {
308
+ /* @__PURE__ */ E(O, {
270
309
  strokeDasharray: "3 3",
271
310
  stroke: "hsl(var(--border))",
272
311
  vertical: !1
273
312
  }),
274
- /* @__PURE__ */ E(P, {
313
+ /* @__PURE__ */ E(N, {
275
314
  dataKey: n,
276
- tick: s ? /* @__PURE__ */ E(nt, {}) : {
315
+ tick: s ? /* @__PURE__ */ E(Ct, {}) : {
277
316
  fill: "hsl(var(--muted-foreground))",
278
317
  fontSize: 12,
279
318
  fontFamily: "monospace"
@@ -284,7 +323,7 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
284
323
  height: s ? 56 : void 0,
285
324
  dy: s ? void 0 : 10
286
325
  }),
287
- /* @__PURE__ */ E(F, {
326
+ /* @__PURE__ */ E(P, {
288
327
  tick: {
289
328
  fill: "hsl(var(--muted-foreground))",
290
329
  fontSize: 12,
@@ -308,11 +347,11 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
308
347
  },
309
348
  itemStyle: { color: "hsl(var(--primary))" }
310
349
  }),
311
- /* @__PURE__ */ E(j, { wrapperStyle: {
350
+ /* @__PURE__ */ E(Be, { wrapperStyle: {
312
351
  paddingTop: "20px",
313
352
  fontFamily: "monospace"
314
353
  } }),
315
- /* @__PURE__ */ E(me, {
354
+ /* @__PURE__ */ E(Ne, {
316
355
  dataKey: t,
317
356
  fill: "url(#barGradient)",
318
357
  radius: [
@@ -329,17 +368,17 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
329
368
  })
330
369
  });
331
370
  }
332
- var it = V((() => {}));
371
+ var Tt = V((() => {}));
333
372
  //#endregion
334
373
  //#region src/ChartContainerImpl.tsx
335
- function at() {
336
- let e = h.useContext(ut);
374
+ function Et() {
375
+ let e = _.useContext(Z);
337
376
  if (!e) throw Error("useChart must be used within a <ChartContainer />");
338
377
  return e;
339
378
  }
340
- function X({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
341
- let s = h.useId(), c = `chart-${e || s.replace(/:/g, "")}`, l = h.useRef(null), [u, d] = h.useState(0);
342
- h.useEffect(() => {
379
+ function Dt({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
380
+ let s = _.useId(), c = `chart-${e || s.replace(/:/g, "")}`, l = _.useRef(null), [u, d] = _.useState(0);
381
+ _.useEffect(() => {
343
382
  if (i) return;
344
383
  let e = l.current;
345
384
  if (e == null || typeof ResizeObserver > "u") return;
@@ -354,40 +393,41 @@ function X({ id: e, className: t, children: n, config: r, disableSettleRemount:
354
393
  t = !0, n != null && clearTimeout(n), r.disconnect();
355
394
  };
356
395
  }, [i]);
357
- let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null, ee = {
358
- ...f ? {} : { minHeight: 280 },
396
+ let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null, m = {
397
+ ...f ? {} : { minHeight: Mt },
359
398
  ...p ? {} : { minWidth: 0 },
360
399
  ...a
361
400
  };
362
- return /* @__PURE__ */ E(ut.Provider, {
401
+ return /* @__PURE__ */ E(Z.Provider, {
363
402
  value: { config: r },
364
403
  children: /* @__PURE__ */ D("div", {
365
404
  ref: l,
366
405
  "data-slot": "chart",
367
406
  "data-chart": c,
368
- className: Z("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
369
- style: ee,
407
+ className: X("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
408
+ style: m,
370
409
  ...o,
371
- children: [/* @__PURE__ */ E(dt, {
410
+ children: [/* @__PURE__ */ E(Nt, {
372
411
  id: c,
373
412
  config: r
374
- }), /* @__PURE__ */ E(Me, {
413
+ }), /* @__PURE__ */ E(Qe, {
375
414
  width: "100%",
376
415
  height: "100%",
416
+ ...f ? {} : { minHeight: Mt },
377
417
  children: n
378
418
  }, u)]
379
419
  })
380
420
  });
381
421
  }
382
- function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
383
- let { config: p } = at(), ee = h.useMemo(() => {
422
+ function Ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
423
+ let { config: p } = Et(), m = De(), h = _.useMemo(() => {
384
424
  if (i || !t?.length) return null;
385
- let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = ct(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
425
+ let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = At(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
386
426
  return s ? /* @__PURE__ */ E("div", {
387
- className: Z("font-medium", c),
427
+ className: X("font-medium", c),
388
428
  children: s(a, t)
389
429
  }) : a ? /* @__PURE__ */ E("div", {
390
- className: Z("font-medium", c),
430
+ className: X("font-medium", c),
391
431
  children: a
392
432
  }) : null;
393
433
  }, [
@@ -400,32 +440,32 @@ function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
400
440
  f
401
441
  ]);
402
442
  if (!e || !t?.length) return null;
403
- let m = t.length === 1 && r !== "dot";
443
+ let ee = t.length === 1 && r !== "dot";
404
444
  return /* @__PURE__ */ D("div", {
405
- className: Z("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
406
- children: [m ? null : ee, /* @__PURE__ */ E("div", {
445
+ className: X("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
446
+ children: [ee ? null : h, /* @__PURE__ */ E("div", {
407
447
  className: "grid gap-1.5",
408
448
  children: t.filter((e) => e.type !== "none").map((e, t) => {
409
- let n = `${d || e.name || e.dataKey || "value"}`, i = ct(p, e, n), o = u || e.payload.fill || e.color;
449
+ let n = `${d || e.name || e.dataKey || "value"}`, i = At(p, e, n), o = u || e.payload.fill || e.color;
410
450
  return /* @__PURE__ */ E("div", {
411
- className: Z("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
451
+ className: X("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
412
452
  children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ D(T, { children: [i?.icon ? /* @__PURE__ */ E(i.icon, {}) : !a && /* @__PURE__ */ E("div", {
413
- className: Z("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", m && r === "dashed" ? "my-0.5" : ""),
453
+ className: X("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", ee && r === "dashed" ? "my-0.5" : ""),
414
454
  style: {
415
455
  "--color-bg": o,
416
456
  "--color-border": o
417
457
  }
418
458
  }), /* @__PURE__ */ D("div", {
419
- className: Z("flex flex-1 justify-between leading-none", m ? "items-end" : "items-center"),
459
+ className: X("flex flex-1 justify-between leading-none", ee ? "items-end" : "items-center"),
420
460
  children: [/* @__PURE__ */ D("div", {
421
461
  className: "grid gap-1.5",
422
- children: [m ? ee : null, /* @__PURE__ */ E("span", {
462
+ children: [ee ? h : null, /* @__PURE__ */ E("span", {
423
463
  className: "text-muted-foreground",
424
464
  children: i?.label || e.name
425
465
  })]
426
466
  }), e.value && /* @__PURE__ */ E("span", {
427
467
  className: "text-foreground font-mono font-medium tabular-nums",
428
- children: e.value.toLocaleString()
468
+ children: e.value.toLocaleString(m)
429
469
  })]
430
470
  })] })
431
471
  }, e.dataKey);
@@ -433,34 +473,34 @@ function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
433
473
  })]
434
474
  });
435
475
  }
436
- function st({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
437
- let { config: a } = at();
476
+ function kt({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
477
+ let { config: a } = Et();
438
478
  return n?.length ? /* @__PURE__ */ E("div", {
439
- className: Z("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
479
+ className: X("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
440
480
  children: n.filter((e) => e.type !== "none").map((e) => {
441
- let n = `${i || e.dataKey || "value"}`, r = ct(a, e, n);
481
+ let n = `${i || e.dataKey || "value"}`, r = At(a, e, n);
442
482
  return /* @__PURE__ */ D("div", {
443
- className: Z("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
483
+ className: X("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
444
484
  children: [r?.icon && !t ? /* @__PURE__ */ E(r.icon, {}) : /* @__PURE__ */ E("div", {
445
- className: "h-2 w-2 shrink-0 rounded-[2px]",
446
- style: { backgroundColor: e.color }
447
- }), r?.label]
485
+ className: "h-2 w-2 shrink-0 rounded-[2px] bg-(--color-bg)",
486
+ style: { "--color-bg": e.color }
487
+ }), r?.label ?? e.value]
448
488
  }, e.value);
449
489
  })
450
490
  }) : null;
451
491
  }
452
- function ct(e, t, n) {
492
+ function At(e, t, n) {
453
493
  if (typeof t != "object" || !t) return;
454
494
  let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
455
495
  return r && n in r && typeof r[n] == "string" ? i = r[n] : n in t && typeof t[n] == "string" && (i = t[n]), i in e ? e[i] : e[n];
456
496
  }
457
- var Z, lt, ut, dt, ft, pt, mt = V((() => {
458
- Z = (...e) => e.filter(Boolean).join(" "), lt = {
497
+ var X, jt, Z, Mt, Nt, Pt, Ft, It = V((() => {
498
+ X = (...e) => e.filter(Boolean).join(" "), jt = {
459
499
  light: "",
460
500
  dark: ".dark"
461
- }, ut = h.createContext(null), dt = ({ id: e, config: t }) => {
501
+ }, Z = _.createContext(null), Mt = 280, Nt = ({ id: e, config: t }) => {
462
502
  let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
463
- return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(lt).map(([t, r]) => `
503
+ return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(jt).map(([t, r]) => `
464
504
  ${r} [data-chart=${e}] {
465
505
  ${n.map(([e, n]) => {
466
506
  let r = n.theme?.[t] || n.color;
@@ -468,46 +508,214 @@ ${n.map(([e, n]) => {
468
508
  }).join("\n")}
469
509
  }
470
510
  `).join("\n") } }) : null;
471
- }, ft = M, pt = j;
511
+ }, Pt = M, Ft = Be;
472
512
  }));
473
513
  //#endregion
474
514
  //#region src/chartDrillEvents.ts
475
- function ht(e) {
515
+ function Lt(e) {
476
516
  return e?.[0]?.dataKey || "value";
477
517
  }
478
- function gt(e, t, n) {
518
+ function Rt(e, t, n) {
479
519
  if (!e) return null;
480
520
  let r = e.payload ?? e, i = r?.[t];
481
521
  if (i == null) return null;
482
- let a = ht(n);
522
+ let a = Lt(n);
483
523
  return {
484
524
  category: String(i),
485
525
  series: a,
486
526
  value: typeof r?.[a] == "number" ? r[a] : void 0
487
527
  };
488
528
  }
489
- function _t(e, t) {
529
+ function zt(e, t) {
490
530
  if (!e) return null;
491
531
  let n = e.name ?? e.payload?.name ?? e.root?.name;
492
532
  if (n == null) return null;
493
533
  let r = e.value ?? e.size ?? e.payload?.size;
494
534
  return {
495
535
  category: String(n),
496
- series: ht(t),
536
+ series: Lt(t),
497
537
  value: typeof r == "number" ? r : void 0
498
538
  };
499
539
  }
500
- function vt(e, t) {
540
+ function Bt(e, t) {
501
541
  if (!e) return null;
502
542
  let n = e.payload ?? e, r = n?.name;
503
543
  return r == null || n?.depth === 0 ? null : {
504
544
  category: String(r),
505
- series: ht(t),
545
+ series: Lt(t),
506
546
  value: typeof n?.value == "number" ? n.value : void 0
507
547
  };
508
548
  }
509
- var yt = V((() => {})), bt = /* @__PURE__ */ H({ default: () => Tt });
510
- function xt(e) {
549
+ var Vt = V((() => {})), Ht = /* @__PURE__ */ ot({ default: () => Tn });
550
+ function Ut(e) {
551
+ return e === "top" ? Vn : Bn;
552
+ }
553
+ function Wt(e) {
554
+ return e === "right" ? Hn : zn;
555
+ }
556
+ function Gt(e, t) {
557
+ return e ? t ? e === "left" || e === "right" ? { down: e } : { refused: e } : e === "top" || e === "bottom" ? { across: e } : { refused: e } : {};
558
+ }
559
+ function Kt(e, t) {
560
+ return e ? /* @__PURE__ */ D("p", {
561
+ role: "note",
562
+ "data-chart-note": "x-axis-position",
563
+ className: "px-1 text-xs text-muted-foreground",
564
+ children: [
565
+ /* @__PURE__ */ E("code", {
566
+ className: "font-mono",
567
+ children: "xAxis.position"
568
+ }),
569
+ " is",
570
+ " ",
571
+ /* @__PURE__ */ E("code", {
572
+ className: "font-mono",
573
+ children: e
574
+ }),
575
+ " —",
576
+ " ",
577
+ t ? /* @__PURE__ */ E(T, { children: "this chart's categories run down its side, so its x axis sits on the left or the right. It is drawn on the left." }) : /* @__PURE__ */ E(T, { children: "this chart's x axis runs across it, so it sits at the top or the bottom. It is drawn at the bottom." })
578
+ ]
579
+ }) : null;
580
+ }
581
+ function qt(e, t) {
582
+ return t ? e === "left" ? "bottom" : "top" : e;
583
+ }
584
+ function Jt(e) {
585
+ return e === "left" || e === "right" ? `on the ${e}` : `at the ${e}`;
586
+ }
587
+ function Yt(e, t) {
588
+ return e ? t ? Gn : Wn : Un;
589
+ }
590
+ function Xt(e, t) {
591
+ if (e.notes.length === 0) return null;
592
+ let n = t ? "this chart's value axes run across it, so each sits at the bottom or the top." : "this chart's value axes run up its side, so each sits on the left or the right.";
593
+ return Qt(...e.notes.map((e) => {
594
+ let r = Jt(qt(e.drawn, t));
595
+ return /* @__PURE__ */ D("p", {
596
+ role: "note",
597
+ "data-chart-note": "y-axis-position",
598
+ className: "px-1 text-xs text-muted-foreground",
599
+ children: [
600
+ /* @__PURE__ */ E("code", {
601
+ className: "font-mono",
602
+ children: `yAxis[${e.index}].position`
603
+ }),
604
+ " is",
605
+ " ",
606
+ /* @__PURE__ */ E("code", {
607
+ className: "font-mono",
608
+ children: e.position
609
+ }),
610
+ " —",
611
+ " ",
612
+ e.reason === "side" ? /* @__PURE__ */ D(T, { children: [
613
+ n,
614
+ " It is drawn ",
615
+ r,
616
+ "."
617
+ ] }) : /* @__PURE__ */ D(T, { children: [
618
+ /* @__PURE__ */ E("code", {
619
+ className: "font-mono",
620
+ children: "yAxis[0]"
621
+ }),
622
+ " already sits ",
623
+ Jt(e.position),
624
+ ", so this axis is drawn ",
625
+ r,
626
+ "."
627
+ ] })
628
+ ]
629
+ }, e.index);
630
+ }));
631
+ }
632
+ function Zt(e, t, n) {
633
+ if (e.undrawn.length === 0) return null;
634
+ let r = e.slotOf.length === 1, i = n ? "one at the bottom and one at the top" : "one on each side";
635
+ return Qt(...e.undrawn.map((a) => {
636
+ let o = e[a.boundTo];
637
+ if (r) return /* @__PURE__ */ D("p", {
638
+ role: "note",
639
+ "data-chart-note": "y-axis-undrawn",
640
+ className: "px-1 text-xs text-muted-foreground",
641
+ children: [
642
+ /* @__PURE__ */ E("code", {
643
+ className: "font-mono",
644
+ children: `yAxis[${a.index}]`
645
+ }),
646
+ " is not drawn — this chart draws one value axis",
647
+ o === void 0 ? null : /* @__PURE__ */ D(T, { children: [", ", /* @__PURE__ */ E("code", {
648
+ className: "font-mono",
649
+ children: `yAxis[${o}]`
650
+ })] }),
651
+ "."
652
+ ]
653
+ }, a.index);
654
+ let s = t?.[a.index]?.field;
655
+ return /* @__PURE__ */ D("p", {
656
+ role: "note",
657
+ "data-chart-note": "y-axis-undrawn",
658
+ className: "px-1 text-xs text-muted-foreground",
659
+ children: [
660
+ /* @__PURE__ */ E("code", {
661
+ className: "font-mono",
662
+ children: `yAxis[${a.index}]`
663
+ }),
664
+ " is not drawn — this chart draws at most two value axes, ",
665
+ i,
666
+ ".",
667
+ s ? /* @__PURE__ */ D(T, { children: [
668
+ " ",
669
+ "When the chart declares neither ",
670
+ /* @__PURE__ */ E("code", {
671
+ className: "font-mono",
672
+ children: "series"
673
+ }),
674
+ " nor",
675
+ " ",
676
+ /* @__PURE__ */ E("code", {
677
+ className: "font-mono",
678
+ children: "categories"
679
+ }),
680
+ ", its field ",
681
+ /* @__PURE__ */ E("code", {
682
+ className: "font-mono",
683
+ children: s
684
+ }),
685
+ " is plotted against the axis ",
686
+ Jt(qt(a.boundTo, n)),
687
+ o === void 0 ? null : /* @__PURE__ */ D(T, { children: [", ", /* @__PURE__ */ E("code", {
688
+ className: "font-mono",
689
+ children: `yAxis[${o}]`
690
+ })] }),
691
+ "."
692
+ ] }) : null
693
+ ]
694
+ }, a.index);
695
+ }));
696
+ }
697
+ function Qt(...e) {
698
+ let t = e.filter((e) => e != null && e !== !1);
699
+ return t.length <= 1 ? t[0] ?? null : /* @__PURE__ */ E(T, { children: t.map((e, t) => /* @__PURE__ */ E(_.Fragment, { children: e }, t)) });
700
+ }
701
+ function $t(e, t, n) {
702
+ if (!e) return {};
703
+ let r = G(e), i = pt(e, t);
704
+ return {
705
+ ...i ? { ticks: i } : {},
706
+ ...r ? { domain: r } : {},
707
+ ...r ? { allowDataOverflow: !0 } : {},
708
+ ...e.logarithmic ? {
709
+ scale: "log",
710
+ domain: r ?? [1, "auto"]
711
+ } : {},
712
+ ...e.title ? { label: {
713
+ value: e.title,
714
+ ...n
715
+ } } : {}
716
+ };
717
+ }
718
+ function en(e) {
511
719
  let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
512
720
  return r <= 0 || i <= 0 ? null : /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("rect", {
513
721
  x: t,
@@ -526,7 +734,7 @@ function xt(e) {
526
734
  children: a
527
735
  }) : null] });
528
736
  }
529
- function St({ title: e, subtitle: t, children: n }) {
737
+ function tn({ title: e, subtitle: t, children: n }) {
530
738
  return !e && !t ? /* @__PURE__ */ E(T, { children: n }) : /* @__PURE__ */ D("div", {
531
739
  className: "flex h-full w-full flex-col",
532
740
  children: [/* @__PURE__ */ D("div", {
@@ -544,243 +752,450 @@ function St({ title: e, subtitle: t, children: n }) {
544
752
  })]
545
753
  });
546
754
  }
547
- function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i = "name", series: a = [], className: o = "", colors: s, categoryColors: c, categoryOrder: l, onChartClick: u, isAnimationActive: d, xAxis: f, yAxes: p, showLegend: ee, showDataLabels: m, title: te, subtitle: g, description: _, height: ne, annotations: re, interaction: ie }) {
548
- let v = e === "column" ? "bar" : e, y = Ke(v, a), b = Ge(v), x = Array.isArray(n) ? n : [], S = d === !1 ? { isAnimationActive: !1 } : {}, C = {
549
- ...d === !1 ? { disableSettleRemount: !0 } : {},
550
- ...ne ? { style: { height: ne } } : {},
551
- ..._ ? {
755
+ function nn({ note: e, children: t }) {
756
+ return e ? /* @__PURE__ */ D("div", {
757
+ className: "flex h-full w-full flex-col",
758
+ children: [/* @__PURE__ */ E("div", {
759
+ className: "min-h-0 flex-1",
760
+ children: t
761
+ }), /* @__PURE__ */ E("div", {
762
+ className: "mt-1 shrink-0",
763
+ children: e
764
+ })]
765
+ }) : /* @__PURE__ */ E(T, { children: t });
766
+ }
767
+ function rn(e, t) {
768
+ let n = 0;
769
+ for (let r of e) {
770
+ let e = Number(r?.[t]);
771
+ Number.isFinite(e) && e > 0 && (n += 1);
772
+ }
773
+ return {
774
+ sizable: n,
775
+ total: e.length
776
+ };
777
+ }
778
+ function an({ dataKey: e, className: t }) {
779
+ return /* @__PURE__ */ D(Q, {
780
+ code: "no-positive-magnitude",
781
+ className: t,
782
+ children: [
783
+ "This chart has nothing to size: no row's",
784
+ " ",
785
+ /* @__PURE__ */ E("code", {
786
+ className: "font-mono",
787
+ children: e
788
+ }),
789
+ " is above zero."
790
+ ]
791
+ });
792
+ }
793
+ function on(e, t, n) {
794
+ let r = t - e;
795
+ return r <= 0 ? null : /* @__PURE__ */ D("p", {
796
+ role: "note",
797
+ "data-chart-note": "unsized-rows",
798
+ className: "px-1 text-xs text-muted-foreground",
799
+ children: [
800
+ r,
801
+ " of ",
802
+ t,
803
+ " rows ",
804
+ r === 1 ? "has" : "have",
805
+ " no",
806
+ " ",
807
+ /* @__PURE__ */ E("code", {
808
+ className: "font-mono",
809
+ children: n
810
+ }),
811
+ " above zero — this chart sizes by value, so",
812
+ " ",
813
+ r === 1 ? "that row is" : "those rows are",
814
+ " not drawn to scale."
815
+ ]
816
+ });
817
+ }
818
+ function sn(e) {
819
+ return e != null && Number.isFinite(Number(e));
820
+ }
821
+ function cn(e, t, n) {
822
+ let r = 0;
823
+ for (let i of e) {
824
+ let e = i;
825
+ sn(e?.[t]) && sn(e?.[n]) && (r += 1);
826
+ }
827
+ return {
828
+ plottable: r,
829
+ total: e.length
830
+ };
831
+ }
832
+ function ln({ xKey: e, yKey: t, className: n }) {
833
+ return /* @__PURE__ */ D(Q, {
834
+ code: "no-plottable-points",
835
+ className: n,
836
+ children: [
837
+ "This chart has nothing to place: no row carries a number for both",
838
+ " ",
839
+ /* @__PURE__ */ E("code", {
840
+ className: "font-mono",
841
+ children: e
842
+ }),
843
+ " and",
844
+ " ",
845
+ /* @__PURE__ */ E("code", {
846
+ className: "font-mono",
847
+ children: t
848
+ }),
849
+ "."
850
+ ]
851
+ });
852
+ }
853
+ function un(e) {
854
+ return typeof e == "boolean" ? !1 : Array.isArray(e) ? dn(e[0]) && dn(e[1]) : dn(e);
855
+ }
856
+ function dn(e) {
857
+ return typeof e == "number" || e instanceof Number || typeof e == "string" || e instanceof Date ? Number.isFinite(Number(e)) : !1;
858
+ }
859
+ function fn(e) {
860
+ let t = (e) => typeof e == "number" && Number.isFinite(e);
861
+ return t(e?.min) && t(e?.max) || t(e?.stepSize);
862
+ }
863
+ function pn(e, t) {
864
+ return e.some((e) => un(e?.[t]));
865
+ }
866
+ function mn(e, t, n) {
867
+ let r = t[n];
868
+ if (!r?.stack) return "none";
869
+ let i = ft(e, t), a = i === "combo" ? r.chartType || dt(e) || (n === 0 ? "bar" : "line") : i;
870
+ return a === "line" ? "none" : a === "area" ? "area" : "bar";
871
+ }
872
+ function hn({ keys: e, total: t, className: n }) {
873
+ return /* @__PURE__ */ D(Q, {
874
+ code: "no-numeric-value",
875
+ className: n,
876
+ children: [
877
+ "This chart has no scale to draw on:",
878
+ " ",
879
+ t === 1 ? "its only row has no" : `none of the ${t} rows has a`,
880
+ " numeric value for",
881
+ " ",
882
+ e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? " or " : "", /* @__PURE__ */ E("code", {
883
+ className: "font-mono",
884
+ children: e
885
+ })] }, `${t}-${e}`)),
886
+ "."
887
+ ]
888
+ });
889
+ }
890
+ function gn({ seriesKeys: e, className: t }) {
891
+ let n = Ae();
892
+ return /* @__PURE__ */ D(Q, {
893
+ code: "scatter-multi-series",
894
+ className: t,
895
+ children: [
896
+ n("chart.scatterOneMeasure", "A scatter plots one measure. Keep exactly one series:"),
897
+ " ",
898
+ e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? ", " : "", /* @__PURE__ */ E("code", {
899
+ className: "font-mono",
900
+ children: e
901
+ })] }, `${t}-${e}`))
902
+ ]
903
+ });
904
+ }
905
+ function _n(e, t, n, r) {
906
+ let i = t - e;
907
+ return i <= 0 ? null : /* @__PURE__ */ D("p", {
908
+ role: "note",
909
+ "data-chart-note": "unplotted-points",
910
+ className: "px-1 text-xs text-muted-foreground",
911
+ children: [
912
+ i,
913
+ " of ",
914
+ t,
915
+ " rows ",
916
+ i === 1 ? "has" : "have",
917
+ " no number for both",
918
+ " ",
919
+ /* @__PURE__ */ E("code", {
920
+ className: "font-mono",
921
+ children: n
922
+ }),
923
+ " and",
924
+ " ",
925
+ /* @__PURE__ */ E("code", {
926
+ className: "font-mono",
927
+ children: r
928
+ }),
929
+ " — this chart plots by position, so",
930
+ " ",
931
+ i === 1 ? "that point is" : "those points are",
932
+ " not drawn."
933
+ ]
934
+ });
935
+ }
936
+ function vn({ chartType: e, data: t = [], config: r = {}, xAxisKey: i = "name", series: a = [], className: s = "", colors: c, categoryColors: l, categoryOrder: u, onChartClick: d, isAnimationActive: f, xAxis: p, yAxes: m, showLegend: h, showDataLabels: ee, title: ne, subtitle: re, description: ie, height: ae, annotations: oe, interaction: se }) {
937
+ let ce = e === "column" ? "bar" : e, g = ft(ce, a), le = dt(ce), v = Array.isArray(t) ? t : [], y = De(), b = f === !1 ? { isAnimationActive: !1 } : {}, x = {
938
+ ...f === !1 ? { disableSettleRemount: !0 } : {},
939
+ ...ae ? { style: { height: ae } } : {},
940
+ ...ie ? {
552
941
  role: "img",
553
- "aria-label": _
942
+ "aria-label": ie
554
943
  } : {}
555
- }, [w, ae] = h.useState(!1), oe = h.useCallback((e) => {
556
- if (!u || !e) return;
557
- let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
558
- u({
944
+ }, [S, C] = _.useState(!1), w = _.useRef(null), fe = _.useCallback((e) => (...t) => {
945
+ let n = jn(t);
946
+ n !== void 0 && (w.current = {
947
+ gesture: n,
948
+ dataKey: String(e.dataKey)
949
+ });
950
+ }, []), pe = d ? (e) => ({ onClick: fe(e) }) : () => ({}), me = _.useCallback((e, t, n) => {
951
+ if (!d || !e) return;
952
+ let r = e.activeTooltipIndex ?? e.activeIndex, i = r == null ? NaN : Number(r), s = Number.isInteger(i) && i >= 0 ? v[i] : void 0, c = w.current;
953
+ w.current = null;
954
+ let l = An(t), u = c != null && l !== void 0 && c.gesture === l;
955
+ if (n && !u) return;
956
+ let f = u ? c.dataKey : kn(e.activeDataKey, a), p = f != null && s ? s[f] : void 0;
957
+ d({
559
958
  category: e.activeLabel == null ? void 0 : String(e.activeLabel),
560
- series: t?.dataKey ? String(t.dataKey) : void 0,
561
- value: typeof t?.value == "number" ? t.value : void 0
959
+ categoryId: o(s),
960
+ series: f,
961
+ seriesLabel: Mn(f, a),
962
+ value: typeof p == "number" ? p : void 0
562
963
  });
563
- }, [u]), se = h.useCallback((e) => {
564
- if (!u || !e) return;
964
+ }, [
965
+ d,
966
+ v,
967
+ a
968
+ ]), he = _.useCallback((e, t) => {
969
+ me(e, t, !1);
970
+ }, [me]), ge = _.useCallback((e, t) => {
971
+ me(e, t, !0);
972
+ }, [me]), _e = _.useCallback((e) => {
973
+ if (!d || !e) return;
565
974
  let t = e.payload?.[i], n = a[0]?.dataKey || "value";
566
- u({
975
+ d({
567
976
  category: t == null ? void 0 : String(t),
977
+ categoryId: o(e.payload),
568
978
  series: n,
979
+ seriesLabel: Mn(n, a),
569
980
  value: typeof e.payload?.[n] == "number" ? e.payload[n] : void 0
570
981
  });
571
982
  }, [
572
- u,
983
+ d,
573
984
  i,
574
985
  a
575
- ]), ce = u ? {
576
- onClick: oe,
986
+ ]), ve = d ? {
987
+ onClick: he,
577
988
  style: { cursor: "pointer" }
578
- } : {}, le = u ? {
579
- onClick: se,
989
+ } : {}, ye = d ? { onClick: ge } : {}, be = d ? (e) => ({
990
+ ...pe(e),
991
+ cursor: "pointer"
992
+ }) : () => ({}), xe = d ? {
993
+ onClick: _e,
580
994
  style: { cursor: "pointer" }
581
- } : {}, ue = h.useCallback((e, t, n) => c && c[e == null ? "" : String(e)] || n[t % n.length], [c]), de = h.useCallback((e) => {
582
- if (!u) return;
583
- let t = gt(e, i, a);
584
- t && u(t);
995
+ } : {}, Se = _.useCallback((e, t, n) => l && l[e == null ? "" : String(e)] || n[t % n.length], [l]), Ce = _.useCallback((e) => {
996
+ if (!d) return;
997
+ let t = Rt(e, i, a);
998
+ t && d(t);
585
999
  }, [
586
- u,
1000
+ d,
587
1001
  i,
588
1002
  a
589
- ]), fe = h.useCallback((e) => {
590
- if (!u) return;
591
- let t = _t(e, a);
592
- t && u(t);
593
- }, [u, a]), j = h.useCallback((e) => {
594
- if (!u) return;
595
- let t = vt(e, a);
596
- t && u(t);
597
- }, [u, a]), Me = u ? {
598
- onClick: de,
1003
+ ]), we = _.useCallback((e) => {
1004
+ if (!d) return;
1005
+ let t = zt(e, a);
1006
+ t && d(t);
1007
+ }, [d, a]), Te = _.useCallback((e) => {
1008
+ if (!d) return;
1009
+ let t = Bt(e, a);
1010
+ t && d(t);
1011
+ }, [d, a]), Ee = d ? {
1012
+ onClick: Ce,
599
1013
  cursor: "pointer"
600
- } : {}, Le = u ? {
601
- onClick: fe,
1014
+ } : {}, Oe = d ? {
1015
+ onClick: we,
602
1016
  style: { cursor: "pointer" }
603
- } : {}, Re = u ? {
604
- onClick: j,
1017
+ } : {}, ke = d ? {
1018
+ onClick: Te,
605
1019
  style: { cursor: "pointer" }
606
1020
  } : {};
607
- h.useEffect(() => {
608
- let e = () => ae(window.innerWidth < 640);
1021
+ _.useEffect(() => {
1022
+ let e = () => C(window.innerWidth < 640);
609
1023
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
610
1024
  }, []);
611
- let ze = {
612
- bar: k,
613
- "horizontal-bar": k,
614
- line: Se,
615
- area: pe,
616
- pie: we,
617
- donut: we,
618
- radar: ke,
619
- scatter: Fe,
620
- funnel: be,
621
- combo: ve,
622
- treemap: k,
623
- sankey: k
624
- }[y] || k, Be = h.useCallback((e) => {
1025
+ let Ae = _.useCallback((e) => {
625
1026
  if (e == null || e === "") return "";
626
1027
  let t = r?.[String(e)]?.label;
627
1028
  if (t != null) return String(t);
628
1029
  let n = typeof e == "string" ? e : String(e);
629
1030
  if (/^\d{4}-\d{2}-\d{2}/.test(n)) {
630
- let e = new Date(n);
1031
+ let e = de(n);
631
1032
  if (!Number.isNaN(e.getTime())) {
632
- let t = (x.length > 1 ? Math.abs(new Date(String(x[x.length - 1][i] ?? "")).getTime() - new Date(String(x[0][i] ?? "")).getTime()) : 0) / 864e5;
1033
+ let t = (v.length > 1 ? Math.abs(new Date(String(v[v.length - 1][i] ?? "")).getTime() - new Date(String(v[0][i] ?? "")).getTime()) : 0) / 864e5;
633
1034
  try {
634
- return t <= 62 ? e.toLocaleDateString(void 0, {
1035
+ return t <= 62 ? e.toLocaleDateString(y, {
635
1036
  month: "short",
636
1037
  day: "numeric"
637
- }) : e.toLocaleDateString(void 0, {
1038
+ }) : e.toLocaleDateString(y, {
638
1039
  month: "short",
639
1040
  year: "numeric"
640
1041
  });
641
1042
  } catch {
642
- return e.toISOString().slice(0, 10);
1043
+ return te(n) ? ue(e) : e.toISOString().slice(0, 10);
643
1044
  }
644
1045
  }
645
1046
  }
646
- return w && n.length > 8 ? n.slice(0, 8) + "…" : n;
1047
+ return S && n.length > 8 ? n.slice(0, 8) + "…" : n;
647
1048
  }, [
648
- x,
1049
+ v,
649
1050
  i,
650
- w,
651
- r
652
- ]), Ve = h.useMemo(() => x.some((e) => String(e[i] || "").length > 5), [x, i]), I = () => Array.isArray(s) && s.length > 0 ? s : [
1051
+ S,
1052
+ r,
1053
+ y
1054
+ ]), Be = _.useMemo(() => v.some((e) => String(e[i] || "").length > 5), [v, i]), Qe = v.length > 0 && v.length <= Pn, tt = (Qe || !S) && Be, nt = () => Array.isArray(c) && c.length > 0 ? c : [
653
1055
  "hsl(var(--chart-1))",
654
1056
  "hsl(var(--chart-2))",
655
1057
  "hsl(var(--chart-3))",
656
1058
  "hsl(var(--chart-4))",
657
1059
  "hsl(var(--chart-5))"
658
- ], He = h.useCallback((e) => {
1060
+ ], rt = _.useCallback((e) => {
659
1061
  if (e == null || e === "") return "";
660
1062
  let t = typeof e == "number" ? e : Number(e);
661
1063
  if (!Number.isFinite(t)) return String(e);
662
1064
  try {
663
- return new Intl.NumberFormat(void 0, {
1065
+ return new Intl.NumberFormat(y, {
664
1066
  notation: "compact",
665
1067
  maximumFractionDigits: 1
666
1068
  }).format(t);
667
1069
  } catch {
668
1070
  return String(t);
669
1071
  }
670
- }, []), L = p?.[0], R = p && p.length > 1 ? p[1] : L?.position === "right" ? L : void 0, z = !!p && p.length > 1, B = h.useMemo(() => G(f?.format) ?? Be, [f?.format, Be]), V = h.useMemo(() => G(L?.format) ?? He, [L?.format, He]), H = h.useMemo(() => G(R?.format) ?? He, [R?.format, He]), U = h.useCallback((e) => {
671
- let t = a.filter((t) => z ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
672
- for (let e of x) for (let r of t) {
1072
+ }, [y]), F = m?.[0], I = g === "horizontal-bar", L = lt(m, g), R = L.left === void 0 ? void 0 : m?.[L.left], z = L.right === void 0 ? void 0 : m?.[L.right], it = !!R && !!z, at = g === "combo" || it, B = L.slotOf[0] ?? "left", V = Qt(Xt(L, I), Zt(L, m, I)), ot = (e) => it ? e.yAxis === "right" ? z : R : F, H = _.useMemo(() => W(p?.format, y) ?? Ae, [
1073
+ p?.format,
1074
+ y,
1075
+ Ae
1076
+ ]), U = _.useMemo(() => !Qe || !tt ? H : (e) => {
1077
+ let t = String(H(e) ?? "");
1078
+ return t.length > Fn ? `${t.slice(0, 11)}…` : t;
1079
+ }, [
1080
+ Qe,
1081
+ tt,
1082
+ H
1083
+ ]), st = _.useMemo(() => W(F?.format, y) ?? rt, [
1084
+ F?.format,
1085
+ y,
1086
+ rt
1087
+ ]), ct = _.useMemo(() => W(R?.format, y) ?? rt, [
1088
+ R?.format,
1089
+ y,
1090
+ rt
1091
+ ]), ut = _.useMemo(() => W(z?.format, y) ?? rt, [
1092
+ z?.format,
1093
+ y,
1094
+ rt
1095
+ ]), pt = _.useCallback((e) => {
1096
+ let t = a.filter((t) => !it || (t.yAxis === "right" ? "right" : "left") === e).map((e) => e.dataKey), n = [];
1097
+ for (let e of v) for (let r of t) {
673
1098
  let t = Number(e?.[r]);
674
1099
  Number.isFinite(t) && n.push(t);
675
1100
  }
676
1101
  return n;
677
1102
  }, [
678
- x,
1103
+ v,
679
1104
  a,
680
- z
681
- ]), W = h.useCallback((e, t = "left") => {
682
- if (!e) return {};
683
- let n = Je(e), r = qe(e, U(t));
684
- return {
685
- ...r ? { ticks: r } : {},
686
- ...n ? { domain: n } : {},
687
- ...n ? { allowDataOverflow: !0 } : {},
688
- ...e.logarithmic ? {
689
- scale: "log",
690
- domain: n ?? [1, "auto"]
691
- } : {},
692
- ...e.title ? { label: {
693
- value: e.title,
694
- angle: -90,
695
- position: "insideLeft"
696
- } } : {}
697
- };
698
- }, [U]), Ue = L?.showGridLines !== !1, We = {
699
- vertical: f?.showGridLines === !0,
700
- horizontal: Ue
701
- }, Qe = ee !== !1, K = h.useMemo(() => {
702
- if (!Array.isArray(re) || re.length === 0) return null;
1105
+ it
1106
+ ]), G = _.useCallback((e, t = "left", n) => $t(e, pt(t), n ?? Wt(t)), [pt]), _t = F?.showGridLines !== !1, vt = {
1107
+ vertical: p?.showGridLines === !0,
1108
+ horizontal: _t
1109
+ }, { across: K, down: q, refused: J } = Gt(p?.position, I), Y = Kt(J, I), yt = h !== !1, bt = _.useMemo(() => {
1110
+ if (!Array.isArray(oe) || oe.length === 0) return null;
703
1111
  let e = {
704
1112
  solid: void 0,
705
1113
  dashed: "4 4",
706
1114
  dotted: "1 4"
707
- };
708
- return re.map((t, n) => {
709
- let r = t?.axis === "x", i = Q(String(t?.color || "hsl(var(--muted-foreground))")), a = e[String(t?.style ?? "dashed")], o = typeof t?.label == "string" ? t.label : void 0, s = o ? { label: {
710
- value: o,
1115
+ }, t = Yt(at, I);
1116
+ return oe.map((n, r) => {
1117
+ let i = n?.axis === "x", a = $(String(n?.color || "hsl(var(--muted-foreground))")), o = e[String(n?.style ?? "dashed")], s = typeof n?.label == "string" ? n.label : void 0, c = s ? { label: {
1118
+ value: s,
711
1119
  position: "insideTopRight",
712
- fill: i,
1120
+ fill: a,
713
1121
  fontSize: 11
714
1122
  } } : {};
715
- if (t?.type === "region") {
716
- let e = r ? {
717
- x1: t.value,
718
- x2: t.endValue
1123
+ if (n?.type === "region") {
1124
+ let e = i ? {
1125
+ x1: n.value,
1126
+ x2: n.endValue
719
1127
  } : {
720
- y1: t.value,
721
- y2: t.endValue
1128
+ y1: n.value,
1129
+ y2: n.endValue
722
1130
  };
723
- return /* @__PURE__ */ E(Ae, {
1131
+ return /* @__PURE__ */ E(Xe, {
724
1132
  ...e,
725
- ...z && !r ? { yAxisId: "left" } : {},
726
- fill: i,
1133
+ ...t,
1134
+ fill: a,
727
1135
  fillOpacity: .12,
728
- stroke: i,
1136
+ stroke: a,
729
1137
  strokeOpacity: .35,
730
- ...s
731
- }, `ann-${n}`);
1138
+ ...c
1139
+ }, `ann-${r}`);
732
1140
  }
733
- return /* @__PURE__ */ E(je, {
734
- ...r ? { x: t?.value } : { y: t?.value },
735
- ...z && !r ? { yAxisId: "left" } : {},
736
- stroke: i,
737
- strokeDasharray: a,
738
- ...s
739
- }, `ann-${n}`);
1141
+ return /* @__PURE__ */ E(Ze, {
1142
+ ...i ? { x: n?.value } : { y: n?.value },
1143
+ ...t,
1144
+ stroke: a,
1145
+ strokeDasharray: o,
1146
+ ...c
1147
+ }, `ann-${r}`);
740
1148
  });
741
- }, [re, z]), q = ie?.tooltips !== !1, J = ie?.brush === !0 ? /* @__PURE__ */ E(he, {
1149
+ }, [
1150
+ oe,
1151
+ at,
1152
+ I
1153
+ ]), xt = se?.tooltips !== !1, St = se?.brush === !0 ? /* @__PURE__ */ E(Fe, {
742
1154
  dataKey: i,
743
1155
  height: 24,
744
1156
  travellerWidth: 8,
745
1157
  stroke: "hsl(var(--muted-foreground))"
746
- }) : null, Y = (e) => m ? /* @__PURE__ */ E(A, {
1158
+ }) : null, Ct = (e) => ee ? /* @__PURE__ */ E(ze, {
747
1159
  position: "top",
748
1160
  className: "fill-foreground",
749
1161
  fontSize: 11,
750
1162
  ...e ? { formatter: e } : {}
751
- }) : null, $e = h.useMemo(() => ({
1163
+ }) : null, wt = _.useMemo(() => ({
752
1164
  tickLine: !1,
753
1165
  tickMargin: 10,
754
1166
  axisLine: !1,
755
- interval: "preserveStartEnd",
756
- minTickGap: w ? 32 : 48,
757
- tickFormatter: B,
758
- ...f?.title ? { label: {
759
- value: f.title,
760
- position: "insideBottom",
761
- offset: -4
1167
+ ...Qe ? { interval: 0 } : {
1168
+ interval: "preserveStartEnd",
1169
+ minTickGap: 0
1170
+ },
1171
+ tickFormatter: U,
1172
+ ...K ? { orientation: K } : {},
1173
+ ...p?.title ? { label: {
1174
+ value: p.title,
1175
+ ...Ut(K)
762
1176
  } } : {},
763
- ...!w && Ve && {
764
- angle: -35,
1177
+ ...tt && {
1178
+ angle: K === "top" ? 35 : -35,
765
1179
  textAnchor: "end",
766
1180
  height: 60
767
1181
  }
768
1182
  }), [
769
- w,
770
- Ve,
771
- B,
772
- f?.title
1183
+ Qe,
1184
+ tt,
1185
+ U,
1186
+ p?.title,
1187
+ K
773
1188
  ]);
774
- if (y && Xe.has(y)) {
775
- let e = a[0]?.dataKey || "value", t = x[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
1189
+ if (g && ht.has(g)) {
1190
+ let e = a[0]?.dataKey || "value", t = v[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
776
1191
  return /* @__PURE__ */ E("div", {
777
- className: o,
1192
+ className: s,
778
1193
  "data-testid": "advanced-chart-single-value",
779
1194
  children: /* @__PURE__ */ D("div", {
780
1195
  className: "flex flex-col gap-1 py-4",
781
1196
  children: [/* @__PURE__ */ E("span", {
782
1197
  className: "text-3xl font-semibold tabular-nums",
783
- children: Number.isFinite(n) ? new Intl.NumberFormat().format(n) : String(t ?? "—")
1198
+ children: Number.isFinite(n) ? new Intl.NumberFormat(y).format(n) : String(t ?? "—")
784
1199
  }), /* @__PURE__ */ E("span", {
785
1200
  className: "text-xs text-muted-foreground",
786
1201
  children: String(i)
@@ -788,167 +1203,246 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
788
1203
  })
789
1204
  });
790
1205
  }
791
- if (y && Ze.has(y)) return /* @__PURE__ */ D("div", {
792
- className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
1206
+ if (g && gt.has(g)) return /* @__PURE__ */ D("div", {
1207
+ className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
793
1208
  "data-testid": "advanced-chart-tabular-notice",
794
1209
  role: "note",
795
1210
  children: [
796
1211
  "Chart type “",
797
- y,
1212
+ g,
798
1213
  "” is tabular — render it with the data-table / pivot components; a chart block draws series charts."
799
1214
  ]
800
1215
  });
801
- if (y && !Ye.has(y)) return /* @__PURE__ */ D("div", {
802
- className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
1216
+ if (!g || !mt.has(g)) return /* @__PURE__ */ E("div", {
1217
+ className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
803
1218
  "data-testid": "advanced-chart-unknown-type",
804
1219
  role: "note",
805
- children: [
1220
+ children: g ? /* @__PURE__ */ D(T, { children: [
806
1221
  "Chart type “",
807
- y,
1222
+ g,
808
1223
  "” is not a spec chart type — nothing was drawn."
809
- ]
1224
+ ] }) : /* @__PURE__ */ E(T, { children: "This chart names no chart type — nothing was drawn." })
810
1225
  });
811
- if (y === "pie" || y === "donut") {
812
- let e = y === "donut" ? "52%" : 0, t = I(), n = { ...r };
813
- return x.forEach((e, r) => {
814
- let a = e?.[i];
815
- if (a == null || a === "") return;
816
- let o = String(a);
817
- n[o] || (n[o] = {
818
- label: o,
819
- color: ue(a, r, t)
1226
+ let Tt = {
1227
+ bar: Pe,
1228
+ "horizontal-bar": Pe,
1229
+ line: He,
1230
+ area: Me,
1231
+ pie: We,
1232
+ donut: We,
1233
+ radar: Ye,
1234
+ scatter: j,
1235
+ funnel: k,
1236
+ combo: Le,
1237
+ treemap: Pe,
1238
+ sankey: Pe
1239
+ }[g] || Pe;
1240
+ if (g === "pie" || g === "donut") {
1241
+ let e = g === "donut" ? "52%" : 0, t = nt(), n = a[0]?.dataKey || "value", o = rn(v, n);
1242
+ if (o.total > 0 && o.sizable === 0) return /* @__PURE__ */ E(an, {
1243
+ dataKey: n,
1244
+ className: s
1245
+ });
1246
+ let c = { ...r };
1247
+ v.forEach((e, n) => {
1248
+ let r = e?.[i];
1249
+ if (r == null || r === "") return;
1250
+ let a = String(r);
1251
+ c[a] || (c[a] = {
1252
+ label: a,
1253
+ color: Se(r, n, t)
820
1254
  });
821
- }), /* @__PURE__ */ E(X, {
822
- config: n,
823
- className: o,
824
- ...C,
825
- children: /* @__PURE__ */ D(we, { children: [
826
- /* @__PURE__ */ E(ft, {
1255
+ });
1256
+ let l = /* @__PURE__ */ E(Dt, {
1257
+ config: c,
1258
+ className: s,
1259
+ ...x,
1260
+ children: /* @__PURE__ */ D(We, { children: [
1261
+ /* @__PURE__ */ E(Pt, {
827
1262
  cursor: !1,
828
- content: /* @__PURE__ */ E(ot, { hideLabel: !0 })
1263
+ content: /* @__PURE__ */ E(Ot, { hideLabel: !0 })
829
1264
  }),
830
- /* @__PURE__ */ E(Ce, {
831
- data: x,
832
- dataKey: a[0]?.dataKey || "value",
1265
+ /* @__PURE__ */ E(Ue, {
1266
+ data: v,
1267
+ dataKey: n,
833
1268
  nameKey: i || "name",
834
1269
  innerRadius: e,
835
1270
  strokeWidth: 5,
836
1271
  paddingAngle: 2,
837
1272
  outerRadius: "85%",
838
- ...S,
839
- ...le,
840
- children: x.map((e, n) => {
841
- let r = ue(e?.[i], n, t);
842
- return /* @__PURE__ */ E(_e, { fill: Q(r) }, `cell-${n}`);
1273
+ ...b,
1274
+ ...xe,
1275
+ children: v.map((e, n) => {
1276
+ let r = Se(e?.[i], n, t);
1277
+ return /* @__PURE__ */ E(Ie, { fill: $(r) }, `cell-${n}`);
843
1278
  })
844
1279
  }),
845
- Qe ? /* @__PURE__ */ E(pt, {
1280
+ yt ? /* @__PURE__ */ E(Ft, {
846
1281
  verticalAlign: "bottom",
847
1282
  wrapperStyle: {
848
- fontSize: w ? "11px" : "12px",
1283
+ fontSize: S ? "11px" : "12px",
849
1284
  paddingTop: "8px"
850
1285
  },
851
- content: /* @__PURE__ */ E(st, {
1286
+ content: /* @__PURE__ */ E(kt, {
852
1287
  nameKey: i,
853
1288
  className: "flex-wrap"
854
1289
  })
855
1290
  }) : null
856
1291
  ] })
857
1292
  });
1293
+ return /* @__PURE__ */ E(nn, {
1294
+ note: on(o.sizable, o.total, n),
1295
+ children: l
1296
+ });
858
1297
  }
859
- if (y === "funnel") {
860
- let e = a[0]?.dataKey || "value", n = I(), s = u ? (t) => {
861
- t && u({
1298
+ if (g === "funnel") {
1299
+ let e = a[0]?.dataKey || "value", t = nt(), c = rn(v, e);
1300
+ if (c.total > 0 && c.sizable === 0) return /* @__PURE__ */ E(an, {
1301
+ dataKey: e,
1302
+ className: s
1303
+ });
1304
+ let l = d ? (t) => {
1305
+ t && d({
862
1306
  category: t?.payload?.[i] ?? t?.[i],
1307
+ categoryId: o(t?.payload) ?? o(t),
863
1308
  value: t?.payload?.[e] ?? t?.[e]
864
1309
  });
865
- } : void 0, c = s ? {
866
- onClick: s,
1310
+ } : void 0, f = l ? {
1311
+ onClick: l,
867
1312
  style: { cursor: "pointer" }
868
- } : {}, d = t(l), f = d ? [...x].sort((e, t) => (d.get(String(e?.[i] ?? "")) ?? 2 ** 53 - 1) - (d.get(String(t?.[i] ?? "")) ?? 2 ** 53 - 1)) : [...x].sort((t, n) => {
1313
+ } : {}, p = n(u), m = p ? [...v].sort((e, t) => (p.get(String(e?.[i] ?? "")) ?? 2 ** 53 - 1) - (p.get(String(t?.[i] ?? "")) ?? 2 ** 53 - 1)) : [...v].sort((t, n) => {
869
1314
  let r = Number(t?.[e] ?? 0);
870
1315
  return Number(n?.[e] ?? 0) - r;
871
- });
872
- return /* @__PURE__ */ E(X, {
1316
+ }), h = /* @__PURE__ */ E(Dt, {
873
1317
  config: r,
874
- className: o,
875
- ...C,
876
- children: /* @__PURE__ */ D(be, { children: [/* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }), /* @__PURE__ */ D(ye, {
1318
+ className: s,
1319
+ ...x,
1320
+ children: /* @__PURE__ */ D(k, { children: [/* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }), /* @__PURE__ */ D(Re, {
877
1321
  dataKey: e,
878
- data: f,
1322
+ data: m,
879
1323
  nameKey: i,
880
- ...S,
881
- ...c,
882
- children: [/* @__PURE__ */ E(A, {
1324
+ ...b,
1325
+ ...f,
1326
+ children: [/* @__PURE__ */ E(ze, {
883
1327
  position: "right",
884
1328
  fill: "hsl(var(--foreground))",
885
1329
  stroke: "none",
886
1330
  dataKey: i
887
- }), f.map((e, t) => /* @__PURE__ */ E(_e, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
1331
+ }), m.map((e, n) => /* @__PURE__ */ E(Ie, { fill: $(t[n % t.length]) }, `funnel-cell-${n}`))]
888
1332
  })] })
889
1333
  });
1334
+ return /* @__PURE__ */ E(nn, {
1335
+ note: on(c.sizable, c.total, e),
1336
+ children: h
1337
+ });
890
1338
  }
891
- if (y === "treemap") {
892
- let e = a[0]?.dataKey || "value", t = I(), n = x.map((n, r) => ({
1339
+ if (g === "treemap") {
1340
+ let e = a[0]?.dataKey || "value", t = nt(), n = rn(v, e);
1341
+ if (n.total > 0 && n.sizable === 0) return /* @__PURE__ */ E(an, {
1342
+ dataKey: e,
1343
+ className: s
1344
+ });
1345
+ let o = v.map((n, r) => ({
893
1346
  name: String(n?.[i] ?? ""),
894
1347
  size: Number(n?.[e]) || 0,
895
- fill: Q(t[r % t.length])
896
- }));
897
- return /* @__PURE__ */ E(X, {
1348
+ fill: $(t[r % t.length])
1349
+ })), c = /* @__PURE__ */ E(Dt, {
898
1350
  config: r,
899
- className: o,
900
- ...C,
901
- children: /* @__PURE__ */ E(N, {
902
- data: n,
1351
+ className: s,
1352
+ ...x,
1353
+ children: /* @__PURE__ */ E(et, {
1354
+ data: o,
903
1355
  dataKey: "size",
904
1356
  nameKey: "name",
905
- ...S,
906
- content: /* @__PURE__ */ E(xt, {}),
907
- ...Le,
1357
+ ...b,
1358
+ content: /* @__PURE__ */ E(en, {}),
1359
+ ...Oe,
908
1360
  children: /* @__PURE__ */ E(M, {})
909
1361
  })
910
1362
  });
1363
+ return /* @__PURE__ */ E(nn, {
1364
+ note: on(n.sizable, n.total, e),
1365
+ children: c
1366
+ });
911
1367
  }
912
- if (y === "sankey") {
913
- let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n = x.filter((t) => (Number(t?.[e]) || 0) > 0), s = [{ name: t }, ...n.map((e) => ({ name: String(e?.[i] ?? "") }))], c = n.map((t, n) => ({
1368
+ if (g === "sankey") {
1369
+ let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n = v.filter((t) => (Number(t?.[e]) || 0) > 0), o = [{ name: t }, ...n.map((e) => ({ name: String(e?.[i] ?? "") }))], c = n.map((t, n) => ({
914
1370
  source: 0,
915
1371
  target: n + 1,
916
1372
  value: Number(t?.[e]) || 0
917
1373
  }));
918
- return c.length === 0 ? /* @__PURE__ */ E("div", { className: o }) : /* @__PURE__ */ E(X, {
919
- config: r,
920
- className: o,
921
- ...C,
922
- children: /* @__PURE__ */ E(Ne, {
923
- data: {
924
- nodes: s,
925
- links: c
926
- },
927
- nodePadding: 24,
928
- link: {
929
- stroke: "hsl(var(--muted-foreground))",
930
- strokeOpacity: .25
931
- },
932
- node: { fill: "hsl(var(--chart-1))" },
933
- ...Re,
934
- children: /* @__PURE__ */ E(M, {})
1374
+ if (c.length === 0) return v.length === 0 ? /* @__PURE__ */ E("div", { className: s }) : /* @__PURE__ */ D(Q, {
1375
+ code: "no-positive-flow",
1376
+ className: s,
1377
+ children: [
1378
+ "This chart has no flow to draw: no row's",
1379
+ " ",
1380
+ /* @__PURE__ */ E("code", {
1381
+ className: "font-mono",
1382
+ children: e
1383
+ }),
1384
+ " is above zero."
1385
+ ]
1386
+ });
1387
+ let l = v.length - n.length;
1388
+ return /* @__PURE__ */ E(nn, {
1389
+ note: l > 0 ? /* @__PURE__ */ D("p", {
1390
+ role: "note",
1391
+ "data-chart-note": "omitted-rows",
1392
+ className: "px-1 text-xs text-muted-foreground",
1393
+ children: [
1394
+ "Showing ",
1395
+ n.length,
1396
+ " of ",
1397
+ v.length,
1398
+ " rows — ",
1399
+ l,
1400
+ " ",
1401
+ l === 1 ? "row has" : "rows have",
1402
+ " no",
1403
+ " ",
1404
+ /* @__PURE__ */ E("code", {
1405
+ className: "font-mono",
1406
+ children: e
1407
+ }),
1408
+ " above zero, which a flow cannot draw."
1409
+ ]
1410
+ }) : null,
1411
+ children: /* @__PURE__ */ E(Dt, {
1412
+ config: r,
1413
+ className: s,
1414
+ ...x,
1415
+ children: /* @__PURE__ */ E($e, {
1416
+ data: {
1417
+ nodes: o,
1418
+ links: c
1419
+ },
1420
+ nodePadding: 24,
1421
+ link: {
1422
+ stroke: "hsl(var(--muted-foreground))",
1423
+ strokeOpacity: .25
1424
+ },
1425
+ node: { fill: "hsl(var(--chart-1))" },
1426
+ ...ke,
1427
+ children: /* @__PURE__ */ E(M, {})
1428
+ })
935
1429
  })
936
1430
  });
937
1431
  }
938
- if (y === "radar") return /* @__PURE__ */ E(X, {
1432
+ if (g === "radar") return /* @__PURE__ */ E(Dt, {
939
1433
  config: r,
940
- className: o,
941
- ...C,
942
- children: /* @__PURE__ */ D(ke, {
943
- data: x,
1434
+ className: s,
1435
+ ...x,
1436
+ children: /* @__PURE__ */ D(Ye, {
1437
+ data: v,
944
1438
  children: [
945
- /* @__PURE__ */ E(Ee, {}),
946
- /* @__PURE__ */ E(Te, { dataKey: i }),
947
- /* @__PURE__ */ E(De, {}),
948
- /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }),
949
- /* @__PURE__ */ E(pt, {
950
- content: /* @__PURE__ */ E(st, {}),
951
- ...w && {
1439
+ /* @__PURE__ */ E(Ke, {}),
1440
+ /* @__PURE__ */ E(Ge, { dataKey: i }),
1441
+ /* @__PURE__ */ E(qe, {}),
1442
+ /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }),
1443
+ /* @__PURE__ */ E(Ft, {
1444
+ content: /* @__PURE__ */ E(kt, {}),
1445
+ ...S && {
952
1446
  verticalAlign: "bottom",
953
1447
  wrapperStyle: {
954
1448
  fontSize: "11px",
@@ -957,335 +1451,501 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
957
1451
  }
958
1452
  }),
959
1453
  a.map((e) => {
960
- let t = Q(r[e.dataKey]?.color || Et);
961
- return /* @__PURE__ */ E(Oe, {
1454
+ let t = $(r[e.dataKey]?.color || En), n = On(e, "radar");
1455
+ return /* @__PURE__ */ E(Je, {
962
1456
  dataKey: e.dataKey,
963
1457
  stroke: t,
964
1458
  fill: t,
965
- fillOpacity: .6,
966
- ...S
1459
+ fillOpacity: n.fillOpacity ?? .6,
1460
+ strokeOpacity: n.strokeOpacity,
1461
+ strokeDasharray: n.strokeDasharray,
1462
+ ...b
967
1463
  }, e.dataKey);
968
1464
  })
969
1465
  ]
970
1466
  })
971
1467
  });
972
- if (y === "scatter") return /* @__PURE__ */ E(X, {
973
- config: r,
974
- className: o,
975
- ...C,
976
- children: /* @__PURE__ */ D(Fe, { children: [
977
- /* @__PURE__ */ E(ge, { vertical: !1 }),
978
- /* @__PURE__ */ E(P, {
979
- type: "number",
980
- dataKey: i,
981
- name: String(r[i]?.label || i),
982
- tickLine: !1,
983
- axisLine: !1,
984
- minTickGap: w ? 32 : 48
985
- }),
986
- /* @__PURE__ */ E(F, {
987
- type: "number",
988
- dataKey: a[0]?.dataKey || "value",
989
- name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
990
- tickLine: !1,
991
- axisLine: !1,
992
- tickFormatter: He,
993
- width: 48
994
- }),
995
- /* @__PURE__ */ E(Ie, {
996
- type: "number",
997
- range: [60, 400]
998
- }),
999
- /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }),
1000
- /* @__PURE__ */ E(pt, {
1001
- content: /* @__PURE__ */ E(st, {}),
1002
- ...w && {
1003
- verticalAlign: "bottom",
1004
- wrapperStyle: {
1005
- fontSize: "11px",
1006
- paddingTop: "8px"
1007
- }
1008
- }
1009
- }),
1010
- a.map((e, t) => {
1011
- let n = I(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = Ot(e, "scatter");
1012
- return /* @__PURE__ */ E(Pe, {
1013
- name: r[e.dataKey]?.label || e.dataKey,
1014
- data: x,
1015
- fill: i,
1016
- fillOpacity: a?.fillOpacity,
1017
- ...S,
1018
- ...Me
1019
- }, e.dataKey);
1020
- })
1021
- ] })
1022
- });
1023
- if (y === "combo") return /* @__PURE__ */ E(St, {
1024
- title: te,
1025
- subtitle: g,
1026
- children: /* @__PURE__ */ E(X, {
1027
- config: r,
1028
- className: o,
1029
- ...C,
1030
- children: /* @__PURE__ */ D(ve, {
1031
- data: x,
1032
- children: [
1033
- /* @__PURE__ */ E(ge, { ...We }),
1034
- /* @__PURE__ */ E(P, {
1468
+ if (g === "scatter") {
1469
+ if (a.length > 1) return /* @__PURE__ */ E(gn, {
1470
+ seriesKeys: a.map((e) => String(e.dataKey)),
1471
+ className: s
1472
+ });
1473
+ let e = a[0]?.dataKey || "value", t = cn(v, i, e), n = v.map((e) => Number(e?.[i])).filter((e) => Number.isFinite(e)), o = W(p?.format, y);
1474
+ if (t.total > 0 && t.plottable === 0) return /* @__PURE__ */ E(ln, {
1475
+ xKey: i,
1476
+ yKey: e,
1477
+ className: s
1478
+ });
1479
+ if (t.total > 0) {
1480
+ let n = [[i, p], [e, m?.[0]]].filter(([e, t]) => !fn(t) && !pn(v, e)).map(([e]) => e).filter((e, t, n) => n.indexOf(e) === t);
1481
+ if (n.length > 0) return /* @__PURE__ */ E(hn, {
1482
+ keys: n,
1483
+ total: t.total,
1484
+ className: s
1485
+ });
1486
+ }
1487
+ return /* @__PURE__ */ E(nn, {
1488
+ note: Qt(_n(t.plottable, t.total, i, e), Y, V),
1489
+ children: /* @__PURE__ */ E(Dt, {
1490
+ config: r,
1491
+ className: s,
1492
+ ...x,
1493
+ children: /* @__PURE__ */ D(j, { children: [
1494
+ /* @__PURE__ */ E(O, { ...vt }),
1495
+ /* @__PURE__ */ E(N, {
1496
+ type: "number",
1035
1497
  dataKey: i,
1036
- ...$e
1037
- }),
1038
- /* @__PURE__ */ E(F, {
1039
- yAxisId: "left",
1498
+ name: String(r[i]?.label || i),
1040
1499
  tickLine: !1,
1041
1500
  axisLine: !1,
1042
- tickFormatter: V,
1043
- width: 48,
1044
- ...W(L)
1501
+ minTickGap: S ? 32 : 48,
1502
+ padding: Ln,
1503
+ ...o ? { tickFormatter: o } : {},
1504
+ ...K ? { orientation: K } : {},
1505
+ ...$t(p, n, Ut(K))
1045
1506
  }),
1046
- /* @__PURE__ */ E(F, {
1047
- yAxisId: "right",
1048
- orientation: "right",
1507
+ /* @__PURE__ */ E(P, {
1508
+ type: "number",
1509
+ dataKey: e,
1510
+ name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
1049
1511
  tickLine: !1,
1050
1512
  axisLine: !1,
1051
- tickFormatter: H,
1513
+ tickFormatter: st,
1052
1514
  width: 48,
1053
- ...W(R, "right")
1515
+ padding: Rn,
1516
+ ...B === "right" ? { orientation: "right" } : {},
1517
+ ...G(F, B)
1054
1518
  }),
1055
- q ? /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }) : null,
1056
- Qe ? /* @__PURE__ */ E(pt, {
1057
- content: /* @__PURE__ */ E(st, {}),
1058
- ...w && {
1519
+ /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }),
1520
+ /* @__PURE__ */ E(Ft, {
1521
+ content: /* @__PURE__ */ E(kt, { nameKey: e }),
1522
+ ...S && {
1059
1523
  verticalAlign: "bottom",
1060
1524
  wrapperStyle: {
1061
1525
  fontSize: "11px",
1062
1526
  paddingTop: "8px"
1063
1527
  }
1064
1528
  }
1065
- }) : null,
1066
- K,
1067
- J,
1529
+ }),
1068
1530
  a.map((e, t) => {
1069
- let n = Q(r[e.dataKey]?.color || Et), i = e.chartType || b || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : b || i === "bar" ? "left" : "right", o = Ot(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = G((a === "right" ? R : L)?.format);
1070
- return i === "line" ? /* @__PURE__ */ E(xe, {
1071
- yAxisId: a,
1072
- type: "monotone",
1073
- dataKey: e.dataKey,
1074
- stroke: n,
1075
- strokeWidth: 2,
1076
- dot: !1,
1077
- strokeOpacity: o?.strokeOpacity,
1078
- strokeDasharray: o?.strokeDasharray,
1079
- ...S,
1080
- children: Y(c)
1081
- }, e.dataKey) : i === "area" ? /* @__PURE__ */ E(O, {
1082
- yAxisId: a,
1083
- type: "monotone",
1084
- dataKey: e.dataKey,
1085
- fill: n,
1086
- stroke: n,
1087
- fillOpacity: o?.fillOpacity ?? .4,
1088
- strokeOpacity: o?.strokeOpacity,
1089
- strokeDasharray: o?.strokeDasharray,
1090
- ...s,
1091
- ...S,
1092
- children: Y(c)
1093
- }, e.dataKey) : /* @__PURE__ */ E(me, {
1094
- yAxisId: a,
1095
- dataKey: e.dataKey,
1096
- fill: n,
1097
- radius: 4,
1098
- fillOpacity: o?.fillOpacity,
1099
- ...s,
1100
- ...S,
1101
- children: Y(c)
1531
+ let n = nt(), i = $(r[e.dataKey]?.color || n[t % n.length]), a = On(e, "scatter");
1532
+ return /* @__PURE__ */ E(A, {
1533
+ name: r[e.dataKey]?.label || e.dataKey,
1534
+ data: v,
1535
+ fill: i,
1536
+ fillOpacity: a.fillOpacity,
1537
+ strokeOpacity: a.strokeOpacity,
1538
+ strokeDasharray: a.strokeDasharray,
1539
+ ...b,
1540
+ ...Ee
1102
1541
  }, e.dataKey);
1103
1542
  })
1104
- ]
1543
+ ] })
1105
1544
  })
1106
- })
1107
- });
1108
- let et = y === "horizontal-bar", tt = I(), nt = c ? Object.values(c).map((e) => Q(String(e))) : [], rt = Array.from(/* @__PURE__ */ new Set([
1109
- ...tt,
1110
- ...nt,
1111
- ...a.map((e, t) => Q(r[e.dataKey]?.color || tt[t % tt.length] || Et))
1112
- ])), it = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1113
- return /* @__PURE__ */ E(St, {
1114
- title: te,
1115
- subtitle: g,
1116
- children: /* @__PURE__ */ E(X, {
1117
- config: r,
1118
- className: o,
1119
- ...C,
1120
- children: /* @__PURE__ */ D(ze, {
1121
- data: x,
1122
- layout: et ? "vertical" : "horizontal",
1123
- ...ce,
1124
- children: [
1125
- /* @__PURE__ */ E("defs", { children: rt.map((e) => /* @__PURE__ */ D(h.Fragment, { children: [/* @__PURE__ */ D("linearGradient", {
1126
- id: `bg-${it(e)}`,
1127
- x1: "0",
1128
- y1: "0",
1129
- x2: "0",
1130
- y2: "1",
1131
- children: [/* @__PURE__ */ E("stop", {
1132
- offset: "0%",
1133
- style: { stopColor: e },
1134
- stopOpacity: .95
1135
- }), /* @__PURE__ */ E("stop", {
1136
- offset: "100%",
1137
- style: { stopColor: e },
1138
- stopOpacity: .5
1139
- })]
1140
- }), /* @__PURE__ */ D("linearGradient", {
1141
- id: `ag-${it(e)}`,
1142
- x1: "0",
1143
- y1: "0",
1144
- x2: "0",
1145
- y2: "1",
1146
- children: [/* @__PURE__ */ E("stop", {
1147
- offset: "0%",
1148
- style: { stopColor: e },
1149
- stopOpacity: .5
1150
- }), /* @__PURE__ */ E("stop", {
1151
- offset: "95%",
1152
- style: { stopColor: e },
1153
- stopOpacity: .05
1154
- })]
1155
- })] }, it(e))) }),
1156
- /* @__PURE__ */ E(ge, { ...We }),
1157
- et ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(P, {
1158
- type: "number",
1159
- tickLine: !1,
1160
- axisLine: !1,
1161
- tickFormatter: V,
1162
- ...W(L)
1163
- }), /* @__PURE__ */ E(F, {
1164
- type: "category",
1165
- dataKey: i,
1166
- tickLine: !1,
1167
- axisLine: !1,
1168
- width: Math.min(140, Math.max(60, Math.max(...x.map((e) => String(e[i] ?? "").length)) * 7)),
1169
- tickFormatter: B
1170
- })] }) : /* @__PURE__ */ D(T, { children: [
1171
- /* @__PURE__ */ E(P, {
1545
+ });
1546
+ }
1547
+ if (g === "combo") return /* @__PURE__ */ E(tn, {
1548
+ title: ne,
1549
+ subtitle: re,
1550
+ children: /* @__PURE__ */ E(nn, {
1551
+ note: Qt(Y, V),
1552
+ children: /* @__PURE__ */ E(Dt, {
1553
+ config: r,
1554
+ className: s,
1555
+ ...x,
1556
+ children: /* @__PURE__ */ D(Le, {
1557
+ data: v,
1558
+ ...ye,
1559
+ children: [
1560
+ /* @__PURE__ */ E(O, {
1561
+ ...vt,
1562
+ ...Yt(at, I)
1563
+ }),
1564
+ /* @__PURE__ */ E(N, {
1172
1565
  dataKey: i,
1173
- ...$e
1566
+ ...wt
1174
1567
  }),
1175
- /* @__PURE__ */ E(F, {
1176
- ...z ? { yAxisId: "left" } : {},
1568
+ /* @__PURE__ */ E(P, {
1569
+ yAxisId: "left",
1177
1570
  tickLine: !1,
1178
1571
  axisLine: !1,
1179
- tickFormatter: V,
1572
+ tickFormatter: ct,
1180
1573
  width: 48,
1181
- ...W(L)
1574
+ ...G(R, "left")
1182
1575
  }),
1183
- z ? /* @__PURE__ */ E(F, {
1576
+ /* @__PURE__ */ E(P, {
1184
1577
  yAxisId: "right",
1185
1578
  orientation: "right",
1186
1579
  tickLine: !1,
1187
1580
  axisLine: !1,
1188
- tickFormatter: H,
1581
+ tickFormatter: ut,
1189
1582
  width: 48,
1190
- ...W(R, "right")
1191
- }) : null
1192
- ] }),
1193
- q ? /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }) : null,
1194
- Qe ? /* @__PURE__ */ E(pt, {
1195
- content: /* @__PURE__ */ E(st, {}),
1196
- ...w && {
1197
- verticalAlign: "bottom",
1198
- wrapperStyle: {
1199
- fontSize: "11px",
1200
- paddingTop: "8px"
1583
+ ...G(z, "right")
1584
+ }),
1585
+ xt ? /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }) : null,
1586
+ yt ? /* @__PURE__ */ E(Ft, {
1587
+ content: /* @__PURE__ */ E(kt, {}),
1588
+ ...S && {
1589
+ verticalAlign: "bottom",
1590
+ wrapperStyle: {
1591
+ fontSize: "11px",
1592
+ paddingTop: "8px"
1593
+ }
1201
1594
  }
1202
- }
1203
- }) : null,
1204
- K,
1205
- J,
1206
- a.map((e, t) => {
1207
- let n = I(), o = e.variant === "comparison", s = o ? a.slice(0, t).find((e) => e.variant !== "comparison") || a[0] : e, c = o ? a.indexOf(s) : t, l = Q(r[s.dataKey]?.color || n[c % n.length] || Et), u = z ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = G((e.yAxis === "right" ? R : L)?.format);
1208
- if (y === "bar" || y === "horizontal-bar") {
1209
- let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && x.length > 1, r = Ot(e, "bar");
1210
- return /* @__PURE__ */ D(me, {
1211
- dataKey: e.dataKey,
1212
- fill: `url(#bg-${it(l)})`,
1213
- radius: 4,
1214
- fillOpacity: r?.fillOpacity,
1215
- ...d,
1216
- ...u,
1217
- ...S,
1218
- children: [t && x.map((e, t) => /* @__PURE__ */ E(_e, { fill: `url(#bg-${it(Q(ue(e?.[i], t, n)))})` }, `cell-${t}`)), Y(f)]
1219
- }, e.dataKey);
1220
- }
1221
- if (y === "line") {
1222
- let t = Ot(e, "line");
1223
- return /* @__PURE__ */ E(xe, {
1595
+ }) : null,
1596
+ bt,
1597
+ St,
1598
+ a.map((e, t) => {
1599
+ let n = $(r[e.dataKey]?.color || En), i = e.chartType || le || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : le || i === "bar" ? "left" : "right", o = On(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = W((a === "right" ? z : R)?.format, y);
1600
+ return i === "line" ? /* @__PURE__ */ E(Ve, {
1601
+ yAxisId: a,
1224
1602
  type: "monotone",
1225
1603
  dataKey: e.dataKey,
1226
- stroke: l,
1604
+ stroke: n,
1227
1605
  strokeWidth: 2,
1228
1606
  dot: !1,
1229
- strokeOpacity: t?.strokeOpacity,
1230
- strokeDasharray: t?.strokeDasharray,
1231
- ...u,
1232
- ...S,
1233
- children: Y(f)
1234
- }, e.dataKey);
1235
- }
1236
- if (y === "area") {
1237
- let t = Ot(e, "area");
1238
- return /* @__PURE__ */ E(O, {
1607
+ strokeOpacity: o.strokeOpacity,
1608
+ strokeDasharray: o.strokeDasharray,
1609
+ ...b,
1610
+ ...be(e),
1611
+ children: Ct(c)
1612
+ }, e.dataKey) : i === "area" ? /* @__PURE__ */ E(je, {
1613
+ yAxisId: a,
1239
1614
  type: "monotone",
1240
1615
  dataKey: e.dataKey,
1241
- fill: `url(#ag-${it(l)})`,
1242
- stroke: l,
1243
- strokeWidth: 2,
1244
- fillOpacity: t?.fillOpacity ?? 1,
1245
- strokeOpacity: t?.strokeOpacity,
1246
- strokeDasharray: t?.strokeDasharray,
1247
- ...d,
1248
- ...u,
1249
- ...S,
1250
- children: Y(f)
1616
+ fill: n,
1617
+ stroke: n,
1618
+ fillOpacity: o.fillOpacity ?? .4,
1619
+ strokeOpacity: o.strokeOpacity,
1620
+ strokeDasharray: o.strokeDasharray,
1621
+ ...s,
1622
+ ...b,
1623
+ ...be(e),
1624
+ children: Ct(c)
1625
+ }, e.dataKey) : /* @__PURE__ */ E(Ne, {
1626
+ yAxisId: a,
1627
+ dataKey: e.dataKey,
1628
+ fill: n,
1629
+ radius: 4,
1630
+ fillOpacity: o.fillOpacity,
1631
+ strokeOpacity: o.strokeOpacity,
1632
+ strokeDasharray: o.strokeDasharray,
1633
+ ...s,
1634
+ ...b,
1635
+ ...be(e),
1636
+ children: Ct(c)
1251
1637
  }, e.dataKey);
1252
- }
1253
- return null;
1254
- })
1255
- ]
1638
+ })
1639
+ ]
1640
+ })
1256
1641
  })
1257
1642
  })
1258
1643
  });
1644
+ let Et = g === "horizontal-bar", At = nt(), X = l ? Object.values(l).map((e) => $(String(e))) : [], jt = Array.from(/* @__PURE__ */ new Set([
1645
+ ...At,
1646
+ ...X,
1647
+ ...a.map((e, t) => $(r[e.dataKey]?.color || At[t % At.length] || En))
1648
+ ])), Z = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1649
+ return /* @__PURE__ */ E(tn, {
1650
+ title: ne,
1651
+ subtitle: re,
1652
+ children: /* @__PURE__ */ E(nn, {
1653
+ note: Qt(Y, V),
1654
+ children: /* @__PURE__ */ E(Dt, {
1655
+ config: r,
1656
+ className: s,
1657
+ ...x,
1658
+ children: /* @__PURE__ */ D(Tt, {
1659
+ data: v,
1660
+ layout: Et ? "vertical" : "horizontal",
1661
+ ...ve,
1662
+ children: [
1663
+ /* @__PURE__ */ E("defs", { children: jt.map((e) => /* @__PURE__ */ D(_.Fragment, { children: [/* @__PURE__ */ D("linearGradient", {
1664
+ id: `bg-${Z(e)}`,
1665
+ x1: "0",
1666
+ y1: "0",
1667
+ x2: "0",
1668
+ y2: "1",
1669
+ children: [/* @__PURE__ */ E("stop", {
1670
+ offset: "0%",
1671
+ style: { stopColor: e },
1672
+ stopOpacity: .95
1673
+ }), /* @__PURE__ */ E("stop", {
1674
+ offset: "100%",
1675
+ style: { stopColor: e },
1676
+ stopOpacity: .5
1677
+ })]
1678
+ }), /* @__PURE__ */ D("linearGradient", {
1679
+ id: `ag-${Z(e)}`,
1680
+ x1: "0",
1681
+ y1: "0",
1682
+ x2: "0",
1683
+ y2: "1",
1684
+ children: [/* @__PURE__ */ E("stop", {
1685
+ offset: "0%",
1686
+ style: { stopColor: e },
1687
+ stopOpacity: .5
1688
+ }), /* @__PURE__ */ E("stop", {
1689
+ offset: "95%",
1690
+ style: { stopColor: e },
1691
+ stopOpacity: .05
1692
+ })]
1693
+ })] }, Z(e))) }),
1694
+ /* @__PURE__ */ E(O, {
1695
+ ...vt,
1696
+ ...Yt(at, I)
1697
+ }),
1698
+ Et ? /* @__PURE__ */ D(T, { children: [it ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(N, {
1699
+ xAxisId: "left",
1700
+ type: "number",
1701
+ tickLine: !1,
1702
+ axisLine: !1,
1703
+ tickFormatter: ct,
1704
+ ...G(R, "left", Bn)
1705
+ }), /* @__PURE__ */ E(N, {
1706
+ xAxisId: "right",
1707
+ orientation: "top",
1708
+ type: "number",
1709
+ tickLine: !1,
1710
+ axisLine: !1,
1711
+ tickFormatter: ut,
1712
+ ...G(z, "right", Vn)
1713
+ })] }) : /* @__PURE__ */ E(N, {
1714
+ type: "number",
1715
+ tickLine: !1,
1716
+ axisLine: !1,
1717
+ tickFormatter: st,
1718
+ ...B === "right" ? { orientation: "top" } : {},
1719
+ ...G(F, B, Ut(B === "right" ? "top" : "bottom"))
1720
+ }), /* @__PURE__ */ E(P, {
1721
+ type: "category",
1722
+ dataKey: i,
1723
+ tickLine: !1,
1724
+ axisLine: !1,
1725
+ width: Math.min(140, Math.max(60, Math.max(...v.map((e) => String(e[i] ?? "").length)) * 7)),
1726
+ tickFormatter: H,
1727
+ ...q ? { orientation: q } : {},
1728
+ ...p?.title ? { label: {
1729
+ value: p.title,
1730
+ ...Wt(q)
1731
+ } } : {}
1732
+ })] }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(N, {
1733
+ dataKey: i,
1734
+ ...wt
1735
+ }), it ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(P, {
1736
+ yAxisId: "left",
1737
+ tickLine: !1,
1738
+ axisLine: !1,
1739
+ tickFormatter: ct,
1740
+ width: 48,
1741
+ ...G(R, "left")
1742
+ }), /* @__PURE__ */ E(P, {
1743
+ yAxisId: "right",
1744
+ orientation: "right",
1745
+ tickLine: !1,
1746
+ axisLine: !1,
1747
+ tickFormatter: ut,
1748
+ width: 48,
1749
+ ...G(z, "right")
1750
+ })] }) : /* @__PURE__ */ E(P, {
1751
+ tickLine: !1,
1752
+ axisLine: !1,
1753
+ tickFormatter: st,
1754
+ width: 48,
1755
+ ...B === "right" ? { orientation: "right" } : {},
1756
+ ...G(F, B)
1757
+ })] }),
1758
+ xt ? /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }) : null,
1759
+ yt ? /* @__PURE__ */ E(Ft, {
1760
+ content: /* @__PURE__ */ E(kt, {}),
1761
+ ...S && {
1762
+ verticalAlign: "bottom",
1763
+ wrapperStyle: {
1764
+ fontSize: "11px",
1765
+ paddingTop: "8px"
1766
+ }
1767
+ }
1768
+ }) : null,
1769
+ bt,
1770
+ St,
1771
+ a.map((e, t) => {
1772
+ let n = nt(), o = e.variant === "comparison", s = o ? a.slice(0, t).find((e) => e.variant !== "comparison") || a[0] : e, c = o ? a.indexOf(s) : t, l = $(r[s.dataKey]?.color || n[c % n.length] || En), u = e.yAxis === "right" ? "right" : "left", d = it ? Et ? { xAxisId: u } : { yAxisId: u } : {}, f = e.stack ? { stackId: String(e.stack) } : {}, p = W(ot(e)?.format, y);
1773
+ if (g === "bar" || g === "horizontal-bar") {
1774
+ let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && v.length > 1, r = On(e, "bar");
1775
+ return /* @__PURE__ */ D(Ne, {
1776
+ dataKey: e.dataKey,
1777
+ fill: `url(#bg-${Z(l)})`,
1778
+ radius: 4,
1779
+ fillOpacity: r.fillOpacity,
1780
+ strokeOpacity: r.strokeOpacity,
1781
+ strokeDasharray: r.strokeDasharray,
1782
+ ...f,
1783
+ ...d,
1784
+ ...b,
1785
+ ...pe(e),
1786
+ children: [t && v.map((e, t) => /* @__PURE__ */ E(Ie, { fill: `url(#bg-${Z($(Se(e?.[i], t, n)))})` }, `cell-${t}`)), Ct(p)]
1787
+ }, e.dataKey);
1788
+ }
1789
+ if (g === "line") {
1790
+ let t = On(e, "line");
1791
+ return /* @__PURE__ */ E(Ve, {
1792
+ type: "monotone",
1793
+ dataKey: e.dataKey,
1794
+ stroke: l,
1795
+ strokeWidth: 2,
1796
+ dot: !1,
1797
+ strokeOpacity: t.strokeOpacity,
1798
+ strokeDasharray: t.strokeDasharray,
1799
+ ...d,
1800
+ ...b,
1801
+ ...pe(e),
1802
+ children: Ct(p)
1803
+ }, e.dataKey);
1804
+ }
1805
+ if (g === "area") {
1806
+ let t = On(e, "area");
1807
+ return /* @__PURE__ */ E(je, {
1808
+ type: "monotone",
1809
+ dataKey: e.dataKey,
1810
+ fill: `url(#ag-${Z(l)})`,
1811
+ stroke: l,
1812
+ strokeWidth: 2,
1813
+ fillOpacity: t.fillOpacity ?? 1,
1814
+ strokeOpacity: t.strokeOpacity,
1815
+ strokeDasharray: t.strokeDasharray,
1816
+ ...f,
1817
+ ...d,
1818
+ ...b,
1819
+ ...pe(e),
1820
+ children: Ct(p)
1821
+ }, e.dataKey);
1822
+ }
1823
+ return null;
1824
+ })
1825
+ ]
1826
+ })
1827
+ })
1828
+ })
1829
+ });
1830
+ }
1831
+ function yn(e) {
1832
+ return e.chartType === "column" ? "bar" : e.chartType;
1259
1833
  }
1260
- function wt(e) {
1261
- let t = e.chartType === "column" ? "bar" : e.chartType ?? "bar", n = Array.isArray(e.data) ? e.data : [], r = e.xAxisKey ?? "name";
1262
- return kt.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
1834
+ function bn(e) {
1835
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = e.xAxisKey ?? "name";
1836
+ return t !== void 0 && Nn.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
1263
1837
  }
1264
- function Tt(e) {
1265
- let t = wt(e), n = e.xAxisKey ?? "name", r = h.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]);
1266
- return h.useEffect(() => {
1267
- t && console.warn(`[chart] no row has the category key "${n}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(r)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
1838
+ function xn(e) {
1839
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [];
1840
+ return t === void 0 || !Kn.has(t) || n.length === 0 ? null : e.series === void 0 ? "undeclared" : Array.isArray(e.series) && e.series.length === 0 ? "empty" : null;
1841
+ }
1842
+ function Sn(e) {
1843
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = Array.isArray(e.series) ? e.series : [];
1844
+ if (t === void 0 || !Kn.has(t) || n.length === 0 || r.length === 0) return null;
1845
+ let i = Array.from(new Set(r.map((e) => String(e.dataKey))));
1846
+ if (!i.every((e) => n.some((t) => typeof t == "object" && !!t && Object.prototype.hasOwnProperty.call(t, e)))) return null;
1847
+ let a = Array.isArray(e.yAxes) ? e.yAxes : [], o = lt(a, t), s = o.left === void 0 ? void 0 : a[o.left], c = o.right === void 0 ? void 0 : a[o.right], l = !!s && !!c, u = (e) => fn(s) || (!l || e.yAxis !== "left") && fn(c);
1848
+ return r.some((e, i) => mn(t, r, i) !== "none" || u(e) || pn(n, String(e.dataKey))) ? null : i;
1849
+ }
1850
+ function Cn(e) {
1851
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = Array.isArray(e.series) ? e.series : [];
1852
+ if (t === void 0 || !Kn.has(t) || n.length === 0 || r.length === 0) return null;
1853
+ let i = Array.from(new Set(r.map((e) => e.dataKey)));
1854
+ return i.every((e) => typeof e == "string" && /^[^.[]+$/.test(e) && !n.some((t) => typeof t == "object" && !!t && e in t)) ? i : null;
1855
+ }
1856
+ function wn({ keys: e, className: t }) {
1857
+ return /* @__PURE__ */ D(Q, {
1858
+ code: "missing-series-key",
1859
+ className: t,
1860
+ children: [
1861
+ "This chart cannot plot its series: no row has a",
1862
+ " ",
1863
+ e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? " or " : "", /* @__PURE__ */ E("code", {
1864
+ className: "font-mono",
1865
+ children: e
1866
+ })] }, `${t}-${e}`)),
1867
+ " ",
1868
+ "field."
1869
+ ]
1870
+ });
1871
+ }
1872
+ function Q({ code: e, className: t, children: n }) {
1873
+ return /* @__PURE__ */ E("div", {
1874
+ className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${t ?? ""}`,
1875
+ role: "status",
1876
+ "data-chart-error": e,
1877
+ children: /* @__PURE__ */ E("span", { children: n })
1878
+ });
1879
+ }
1880
+ function Tn(e) {
1881
+ let t = bn(e), n = t ? null : xn(e), r = t || n ? null : Cn(e), i = t || n || r ? null : Sn(e), a = e.xAxisKey ?? "name", o = _.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]), s = r ? JSON.stringify(r) : null, c = JSON.stringify(o);
1882
+ return _.useEffect(() => {
1883
+ t && console.warn(`[chart] no row has the category key "${a}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(o)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
1268
1884
  }, [
1269
1885
  t,
1886
+ a,
1887
+ o
1888
+ ]), _.useEffect(() => {
1889
+ if (n) {
1890
+ if (n === "undeclared") {
1891
+ console.warn(`[chart] no series binding was declared for the category axis "${a}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(o)}. A bar / line / area / combo chart draws only the columns its \`series\` (or \`categories\`, or a y-axis \`field\`) names (objectui#4695).`);
1892
+ return;
1893
+ }
1894
+ console.warn(`[chart] no series to plot against the category axis "${a}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(o)}. A grouped chart's SECOND dimension must be PROJECTED by the dataset query, and a chart with no measure selected has nothing to draw either (objectui#4683, framework#4033).`);
1895
+ }
1896
+ }, [
1270
1897
  n,
1271
- r
1272
- ]), t ? /* @__PURE__ */ E("div", {
1273
- className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${e.className ?? ""}`,
1274
- role: "status",
1275
- "data-chart-error": "missing-category-key",
1276
- children: /* @__PURE__ */ D("span", { children: [
1898
+ a,
1899
+ o
1900
+ ]), _.useEffect(() => {
1901
+ s && console.warn(`[chart] no row has the series key(s) ${s} — rendering an explanatory placeholder instead of an empty frame. Row keys: ${c}. A series \`dataKey\` must name a column the rows carry (objectui#10396).`);
1902
+ }, [s, c]), t ? /* @__PURE__ */ D(Q, {
1903
+ code: "missing-category-key",
1904
+ className: e.className,
1905
+ children: [
1277
1906
  "This chart cannot plot its category axis: no row has a",
1278
1907
  " ",
1279
1908
  /* @__PURE__ */ E("code", {
1280
1909
  className: "font-mono",
1281
- children: n
1910
+ children: a
1282
1911
  }),
1283
1912
  " field."
1284
- ] })
1285
- }) : /* @__PURE__ */ E(Ct, { ...e });
1913
+ ]
1914
+ }) : n === "undeclared" ? /* @__PURE__ */ D(Q, {
1915
+ code: "no-plottable-series",
1916
+ className: e.className,
1917
+ children: [
1918
+ "This chart cannot plot any series: none was declared to draw against its",
1919
+ " ",
1920
+ /* @__PURE__ */ E("code", {
1921
+ className: "font-mono",
1922
+ children: a
1923
+ }),
1924
+ " axis."
1925
+ ]
1926
+ }) : n === "empty" ? /* @__PURE__ */ D(Q, {
1927
+ code: "no-plottable-series",
1928
+ className: e.className,
1929
+ children: [
1930
+ "This chart cannot plot any series: no measure or group reached its",
1931
+ " ",
1932
+ /* @__PURE__ */ E("code", {
1933
+ className: "font-mono",
1934
+ children: a
1935
+ }),
1936
+ " axis."
1937
+ ]
1938
+ }) : r ? /* @__PURE__ */ E(wn, {
1939
+ keys: r,
1940
+ className: e.className
1941
+ }) : i ? /* @__PURE__ */ E(hn, {
1942
+ keys: i,
1943
+ total: Array.isArray(e.data) ? e.data.length : 0,
1944
+ className: e.className
1945
+ }) : /* @__PURE__ */ E(vn, { ...e });
1286
1946
  }
1287
- var Et, Dt, Q, Ot, kt, At = V((() => {
1288
- mt(), yt(), $e(), Et = "hsl(var(--primary))", Dt = {
1947
+ var En, Dn, $, On, kn, An, jn, Mn, Nn, Pn, Fn, In, Ln, Rn, zn, Bn, Vn, Hn, Un, Wn, Gn, Kn, qn = V((() => {
1948
+ It(), Vt(), bt(), En = "hsl(var(--primary))", Dn = {
1289
1949
  slate: "#64748b",
1290
1950
  gray: "#6b7280",
1291
1951
  zinc: "#71717a",
@@ -1308,11 +1968,34 @@ var Et, Dt, Q, Ot, kt, At = V((() => {
1308
1968
  fuchsia: "#d946ef",
1309
1969
  pink: "#ec4899",
1310
1970
  rose: "#f43f5e"
1311
- }, Q = (e) => Dt[e] || e, Ot = (e, t) => e?.variant === "comparison" ? {
1312
- strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
1313
- fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
1314
- strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
1315
- } : null, kt = /* @__PURE__ */ new Set([
1971
+ }, $ = (e) => Dn[e] || e, On = (e, t) => {
1972
+ let n = e?.variant === "comparison", r = t === "area" || t === "radar", i = typeof e?.opacity == "number" ? e.opacity : void 0;
1973
+ return {
1974
+ strokeOpacity: i ?? (n ? t === "line" ? .5 : r ? .6 : void 0 : void 0),
1975
+ fillOpacity: i ?? (n ? t === "bar" ? .4 : r ? .2 : .5 : void 0),
1976
+ strokeDasharray: e?.dashArray ?? (n && (t === "line" || r) ? "4 4" : void 0)
1977
+ };
1978
+ }, kn = (e, t) => {
1979
+ if (typeof e == "string" || typeof e == "number") {
1980
+ let t = String(e);
1981
+ if (t !== "") return t;
1982
+ }
1983
+ if (t.length === 1) {
1984
+ let e = t[0]?.dataKey;
1985
+ if (e != null && String(e) !== "") return String(e);
1986
+ }
1987
+ }, An = (e) => {
1988
+ if (e && typeof e == "object" && "nativeEvent" in e) return e.nativeEvent;
1989
+ }, jn = (e) => {
1990
+ for (let t = e.length - 1; t >= 0; --t) {
1991
+ let n = An(e[t]);
1992
+ if (n !== void 0) return n;
1993
+ }
1994
+ }, Mn = (e, t) => {
1995
+ if (e == null) return;
1996
+ let n = t.find((t) => String(t.dataKey) === e);
1997
+ return typeof n?.label == "string" ? n.label : void 0;
1998
+ }, Nn = /* @__PURE__ */ new Set([
1316
1999
  "bar",
1317
2000
  "horizontal-bar",
1318
2001
  "line",
@@ -1322,14 +2005,38 @@ var Et, Dt, Q, Ot, kt, At = V((() => {
1322
2005
  "radar",
1323
2006
  "funnel",
1324
2007
  "combo"
2008
+ ]), Pn = 5, Fn = 12, In = Math.ceil(Math.sqrt(400 / Math.PI)), Ln = {
2009
+ left: In,
2010
+ right: In
2011
+ }, Rn = {
2012
+ top: In,
2013
+ bottom: In
2014
+ }, zn = {
2015
+ angle: -90,
2016
+ position: "insideLeft"
2017
+ }, Bn = {
2018
+ position: "insideBottom",
2019
+ offset: -4
2020
+ }, Vn = {
2021
+ position: "insideTop",
2022
+ offset: -4
2023
+ }, Hn = {
2024
+ angle: 90,
2025
+ position: "insideRight"
2026
+ }, Un = {}, Wn = { yAxisId: "left" }, Gn = { xAxisId: "left" }, Kn = /* @__PURE__ */ new Set([
2027
+ "bar",
2028
+ "horizontal-bar",
2029
+ "line",
2030
+ "area",
2031
+ "combo"
1325
2032
  ]);
1326
2033
  }));
1327
2034
  //#endregion
1328
2035
  //#region src/ChartRenderer.tsx
1329
- $e();
1330
- var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(() => Promise.resolve().then(() => (At(), bt))), Nt = ({ schema: e }) => /* @__PURE__ */ E(_, {
1331
- fallback: /* @__PURE__ */ E(fe, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1332
- children: /* @__PURE__ */ E(jt, {
2036
+ bt();
2037
+ var Jn = v.lazy(() => Promise.resolve().then(() => (Tt(), xt))), Yn = v.lazy(() => Promise.resolve().then(() => (qn(), Ht))), Xn = ({ schema: e }) => /* @__PURE__ */ E(y, {
2038
+ fallback: /* @__PURE__ */ E(we, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
2039
+ children: /* @__PURE__ */ E(Jn, {
1333
2040
  data: e.data,
1334
2041
  dataKey: e.dataKey,
1335
2042
  xAxisKey: e.xAxisKey,
@@ -1337,70 +2044,85 @@ var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(()
1337
2044
  className: e.className,
1338
2045
  color: e.color
1339
2046
  })
1340
- }), $ = ({ schema: e, onChartClick: t }) => {
1341
- let n = g.useMemo(() => {
1342
- let t = We(e), n = Array.isArray(e.series) ? e.series : void 0, r = (n?.length && n.every((e) => !!e && typeof e == "object" && "dataKey" in e) ? n : t.series) ?? n, i = e.xAxisKey ?? t.xAxisKey, a = e.config;
1343
- if (i || (e.index ? i = e.index : e.category && (i = e.category)), r || (e.categories ? r = e.categories.map((e) => ({ dataKey: e })) : e.value && (r = [{ dataKey: e.value }])), !a && r) {
2047
+ }), Zn = ({ schema: e, onChartClick: t }) => {
2048
+ let { language: n } = Oe(), r = v.useMemo(() => {
2049
+ let t = ut(e, n), r = Array.isArray(e.series) ? e.series : void 0, i = t.series ?? r, a = e.xAxisKey ?? t.xAxisKey, o = e.config;
2050
+ if (!o && i) {
1344
2051
  let t = e.colors || [
1345
2052
  "hsl(var(--chart-1))",
1346
2053
  "hsl(var(--chart-2))",
1347
2054
  "hsl(var(--chart-3))"
1348
2055
  ], n = {};
1349
- r.forEach((e, r) => {
2056
+ i.forEach((e, r) => {
1350
2057
  n[e.dataKey] = {
1351
2058
  label: e.label || e.dataKey,
1352
2059
  color: e.color || t[r % t.length]
1353
2060
  };
1354
- }), a = n;
2061
+ }), o = n;
1355
2062
  }
1356
2063
  return {
1357
2064
  chartType: e.chartType ?? t.chartType,
1358
2065
  data: Array.isArray(e.data) ? e.data : [],
1359
- config: a,
1360
- xAxisKey: i,
1361
- series: r,
2066
+ config: o,
2067
+ xAxisKey: a,
2068
+ series: i,
1362
2069
  className: e.className,
1363
2070
  spec: t
1364
2071
  };
1365
- }, [e]);
1366
- return /* @__PURE__ */ E(_, {
1367
- fallback: /* @__PURE__ */ E(fe, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1368
- children: /* @__PURE__ */ E(Mt, {
1369
- chartType: n.chartType,
1370
- data: n.data,
1371
- config: n.config,
1372
- xAxisKey: n.xAxisKey,
1373
- series: n.series,
1374
- className: n.className,
2072
+ }, [e, n]);
2073
+ return /* @__PURE__ */ E(y, {
2074
+ fallback: /* @__PURE__ */ E(we, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
2075
+ children: /* @__PURE__ */ E(Yn, {
2076
+ chartType: r.chartType,
2077
+ data: r.data,
2078
+ config: r.config,
2079
+ xAxisKey: r.xAxisKey,
2080
+ series: r.series,
2081
+ className: r.className,
1375
2082
  colors: Array.isArray(e.colors) ? e.colors : void 0,
1376
2083
  categoryColors: e.categoryColors,
1377
2084
  categoryOrder: e.categoryOrder,
1378
2085
  isAnimationActive: e.isAnimationActive,
1379
2086
  onChartClick: t,
1380
- xAxis: n.spec.xAxis,
1381
- yAxes: n.spec.yAxes,
1382
- showLegend: n.spec.showLegend,
1383
- showDataLabels: n.spec.showDataLabels,
1384
- title: n.spec.title,
1385
- subtitle: n.spec.subtitle,
1386
- description: n.spec.description,
1387
- height: n.spec.height ?? e.height,
1388
- annotations: n.spec.annotations,
1389
- interaction: n.spec.interaction
2087
+ xAxis: r.spec.xAxis,
2088
+ yAxes: r.spec.yAxes,
2089
+ showLegend: r.spec.showLegend,
2090
+ showDataLabels: r.spec.showDataLabels,
2091
+ title: r.spec.title,
2092
+ subtitle: r.spec.subtitle,
2093
+ description: r.spec.description,
2094
+ height: r.spec.height ?? e.height,
2095
+ annotations: r.spec.annotations,
2096
+ interaction: r.spec.interaction
1390
2097
  })
1391
2098
  });
1392
2099
  };
1393
2100
  //#endregion
1394
2101
  //#region src/ObjectChart.tsx
1395
- function Pt(e) {
1396
- return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
2102
+ bt();
2103
+ function Qn(e) {
2104
+ return a(e, e.function || "count");
2105
+ }
2106
+ var $n = [
2107
+ "aggregate.groupBy",
2108
+ "xAxisKey",
2109
+ "xAxis.field"
2110
+ ];
2111
+ function er(e) {
2112
+ let t = e?.aggregate?.groupBy;
2113
+ if (t && typeof t == "object" && !Array.isArray(t)) {
2114
+ let e = t.field;
2115
+ return typeof e == "string" && e ? e : void 0;
2116
+ }
2117
+ return typeof t == "string" && t ? t : ut(e).xAxisKey;
1397
2118
  }
1398
- function Ft(e) {
1399
- return e.field || e.function || "count";
2119
+ var tr = "__comparison";
2120
+ function nr(e) {
2121
+ let t = e?.groupBy;
2122
+ return t && typeof t == "object" && !Array.isArray(t) ? t.alias || t.field : typeof t == "string" ? t : void 0;
1400
2123
  }
1401
- var It = "__comparison";
1402
- function Lt(e, t) {
1403
- let { field: n, function: r, groupBy: i } = t, a = Ft(t), o = {};
2124
+ function rr(e, t) {
2125
+ let { field: n, function: r, groupBy: i } = t, a = Qn(t), o = {};
1404
2126
  for (let t of e) {
1405
2127
  let e = String(t[i] ?? "Unknown");
1406
2128
  o[e] || (o[e] = []), o[e].push(t);
@@ -1428,13 +2150,13 @@ function Lt(e, t) {
1428
2150
  };
1429
2151
  });
1430
2152
  }
1431
- async function Rt(e, t, n, r, i) {
2153
+ async function ir(e, t, n, r, i) {
1432
2154
  if (!e.length || !t) return e;
1433
2155
  let a = i || ((e, t) => t), o = `__raw_${t}`, s = n?.fields?.[t];
1434
2156
  if (!s) {
1435
2157
  let n = /^\d{4}-\d{2}-\d{2}/;
1436
2158
  return e.map((e) => {
1437
- let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : Pt(i);
2159
+ let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : h(i);
1438
2160
  return {
1439
2161
  ...e,
1440
2162
  [t]: a(i, s),
@@ -1442,11 +2164,11 @@ async function Rt(e, t, n, r, i) {
1442
2164
  };
1443
2165
  });
1444
2166
  }
1445
- let l = s.type;
1446
- if (l === "select" || l === "picklist" || l === "dropdown") {
2167
+ let c = s.type;
2168
+ if (c === "select" || c === "picklist" || c === "dropdown") {
1447
2169
  let n = s.options || [];
1448
2170
  if (n.length === 0) return e.map((e) => {
1449
- let n = e[t], r = String(n ?? ""), i = Pt(r);
2171
+ let n = e[t], r = String(n ?? ""), i = h(r);
1450
2172
  return {
1451
2173
  ...e,
1452
2174
  [t]: a(r, i),
@@ -1456,7 +2178,7 @@ async function Rt(e, t, n, r, i) {
1456
2178
  let r = {};
1457
2179
  for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
1458
2180
  return e.map((e) => {
1459
- let n = e[t], i = String(n ?? ""), s = r[i] || Pt(i);
2181
+ let n = e[t], i = String(n ?? ""), s = r[i] || h(i);
1460
2182
  return {
1461
2183
  ...e,
1462
2184
  [t]: a(i, s),
@@ -1464,8 +2186,8 @@ async function Rt(e, t, n, r, i) {
1464
2186
  };
1465
2187
  });
1466
2188
  }
1467
- if (l === "lookup" || l === "master_detail") {
1468
- let n = s.reference_to || s.reference;
2189
+ if (c === "lookup" || c === "master_detail") {
2190
+ let n = s.reference;
1469
2191
  if (!n || !r || typeof r.find != "function") return e.map((e) => ({
1470
2192
  ...e,
1471
2193
  [o]: e[t]
@@ -1477,19 +2199,19 @@ async function Rt(e, t, n, r, i) {
1477
2199
  }));
1478
2200
  let a = s.id_field || "id";
1479
2201
  try {
1480
- let l = await r.find(n, {
2202
+ let c = await r.find(n, {
1481
2203
  $filter: { [a]: { $in: i } },
1482
2204
  $top: i.length
1483
- }), u = c(l), d = s.reference_field || s.display_field || "name", f = {};
1484
- for (let e of u) {
1485
- let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[d] || e.name || e.label || e.title || t;
1486
- t && (f[t] = String(n));
2205
+ }), l = m(c), u = s.displayField || s.reference_field || "name", d = {};
2206
+ for (let e of l) {
2207
+ let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[u] || e.name || e.label || e.title || t;
2208
+ t && (d[t] = String(n));
1487
2209
  }
1488
2210
  return e.map((e) => {
1489
2211
  let n = e[t], r = String(n ?? "");
1490
2212
  return {
1491
2213
  ...e,
1492
- [t]: f[r] || r,
2214
+ [t]: d[r] || r,
1493
2215
  [o]: n
1494
2216
  };
1495
2217
  });
@@ -1500,284 +2222,308 @@ async function Rt(e, t, n, r, i) {
1500
2222
  }));
1501
2223
  }
1502
2224
  }
1503
- if (l === "date" || l === "datetime" || l === "date_time" || l === "timestamp" || l === "time") return e.map((e) => ({
2225
+ if (c === "date" || c === "datetime" || c === "date_time" || c === "timestamp" || c === "time") return e.map((e) => ({
1504
2226
  ...e,
1505
2227
  [o]: e[t]
1506
2228
  }));
1507
- let u = /^\d{4}-\d{2}-\d{2}/;
2229
+ let l = /^\d{4}-\d{2}-\d{2}/;
1508
2230
  return e.map((e) => {
1509
2231
  let n = e[t], r = String(n ?? "");
1510
2232
  return {
1511
2233
  ...e,
1512
- [t]: u.test(r) ? r : Pt(r),
2234
+ [t]: l.test(r) ? r : h(r),
1513
2235
  [o]: n
1514
2236
  };
1515
2237
  });
1516
2238
  }
1517
- var zt = (e) => {
1518
- let { schema: t } = e, h = e.onSegmentClick, g = re(ze), _ = e.dataSource || g?.dataSource, fe = g?.apiFetch, T = Be(t.bind), { fieldOptionLabel: O } = R(), pe = y(O);
1519
- ie(() => {
1520
- pe.current = O;
1521
- }, [O]);
1522
- let [me, k] = b([]), [he, ge] = b(null), [_e, ve] = b(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [ye, be] = b(null), [A, j] = b(null), [xe, Se] = b(null), { openRecordList: Ce } = Ve(), we = z(), Te = v(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Ee = v(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), De = v(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), Oe = v(() => t.dataset ? JSON.stringify({
1523
- d: t.dataset,
1524
- dim: t.dimensions ?? [],
1525
- val: t.values ?? []
2239
+ var ar = (e) => {
2240
+ let { schema: n } = e, a = e.onSegmentClick, o = x(rt), p = e.dataSource || o?.dataSource, h = o?.apiFetch, te = I(n.bind), { fieldOptionLabel: ue } = ke(), [de, _] = w([]), [y, we] = w(null), [De, T] = w(void 0), [je, Me] = w(() => !(Array.isArray(n.data) && n.data.length > 0) && (!!n.objectName || !!n.dataset)), [Ne, Pe] = w(null), [Fe, O] = w(null), [Ie, Le] = w(null), { openRecordList: Re } = L(), k = Ae(), { t: ze, language: Be } = Oe(), Ve = C(() => ut(n, Be).chartType, [n, Be]), He = C(() => n.aggregate ? JSON.stringify(n.aggregate) : "", [n.aggregate]), Ue = C(() => n.filter ? JSON.stringify(n.filter) : "", [n.filter]), We = C(() => n.compareTo ? JSON.stringify(n.compareTo) : "", [n.compareTo]), Ge = C(() => n.dataset ? JSON.stringify({
2241
+ d: n.dataset,
2242
+ dim: n.dimensions ?? [],
2243
+ val: n.values ?? []
1526
2244
  }) : "", [
1527
- t.dataset,
1528
- t.dimensions,
1529
- t.values
1530
- ]), ke = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1531
- ie(() => {
2245
+ n.dataset,
2246
+ n.dimensions,
2247
+ n.values
2248
+ ]);
2249
+ S(() => {
1532
2250
  let e = !1;
1533
2251
  return (async () => {
1534
2252
  try {
1535
- let n = fe ?? fetch, r = {
2253
+ let t = h ?? fetch, r = {
1536
2254
  headers: { accept: "application/json" },
1537
2255
  credentials: "include"
1538
- }, i = t.objectName, a, o = null, s = t.aggregate?.groupBy;
1539
- if (i) a = s && typeof s == "object" && !Array.isArray(s) ? s.field : typeof s == "string" ? s : t.xAxisKey;
1540
- else if (t.dataset) {
1541
- let e = Array.isArray(t.dimensions) && t.dimensions.length ? t.dimensions[0] : void 0, s = await (await n(`/api/v1/meta/dataset/${encodeURIComponent(t.dataset)}`, r)).json().catch(() => null);
2256
+ }, i = n.objectName, a, o = null;
2257
+ if (i) a = er(n);
2258
+ else if (n.dataset) {
2259
+ let e = Array.isArray(n.dimensions) && n.dimensions.length ? n.dimensions[0] : void 0, s = await (await t(`/api/v1/meta/dataset/${encodeURIComponent(n.dataset)}`, r)).json().catch(() => null);
1542
2260
  o = s?.item ?? s?.data ?? s, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
1543
2261
  }
1544
2262
  if (!i || !a) {
1545
- e || Se(null);
2263
+ e || Le(null);
1546
2264
  return;
1547
2265
  }
1548
- let c = async (e) => {
1549
- let t = await (await n(`/api/v1/meta/object/${encodeURIComponent(e)}`, r)).json().catch(() => null);
1550
- return t?.item ?? t?.data ?? t;
1551
- }, l = {};
1552
- if (t.dataset && Array.isArray(t.dimensions)) for (let e of t.dimensions) l[e] = (o?.dimensions || []).find((t) => t?.name === e)?.field ?? e;
1553
- let d = await u(c, i, [a, ...Object.values(l)]);
1554
- e || Se({
1555
- metaByPath: d,
2266
+ let s = async (e) => {
2267
+ let n = await (await t(`/api/v1/meta/object/${encodeURIComponent(e)}`, r)).json().catch(() => null);
2268
+ return n?.item ?? n?.data ?? n;
2269
+ }, c = {};
2270
+ if (n.dataset && Array.isArray(n.dimensions)) for (let e of n.dimensions) c[e] = (o?.dimensions || []).find((t) => t?.name === e)?.field ?? e;
2271
+ let l = await re(s, i, [a, ...Object.values(c)]);
2272
+ e || Le({
2273
+ metaByPath: l,
1556
2274
  colorPath: a,
1557
- fieldByDim: t.dataset && Array.isArray(t.dimensions) ? l : null
2275
+ fieldByDim: n.dataset && Array.isArray(n.dimensions) ? c : null
1558
2276
  });
1559
2277
  } catch {
1560
- e || Se(null);
2278
+ e || Le(null);
1561
2279
  }
1562
2280
  })(), () => {
1563
2281
  e = !0;
1564
2282
  };
1565
2283
  }, [
1566
- t.objectName,
1567
- t.dataset,
1568
- Oe,
1569
- Te,
1570
- t.xAxisKey,
1571
- fe
2284
+ n.objectName,
2285
+ n.dataset,
2286
+ Ge,
2287
+ He,
2288
+ n.xAxisKey,
2289
+ h
1572
2290
  ]);
1573
- let { fieldOptionColors: Ae, dimensionLabels: je } = v(() => {
1574
- if (!xe) return {
2291
+ let { fieldOptionColors: Ke, dimensionLabels: qe } = C(() => {
2292
+ if (!Ie) return {
1575
2293
  fieldOptionColors: null,
1576
2294
  dimensionLabels: null
1577
2295
  };
1578
- let { metaByPath: e, colorPath: t, fieldByDim: n } = xe, i = d(e[t]?.options, s(e[t], O)), a = o(e, n ? Object.entries(n).map(([e, t]) => ({
2296
+ let { metaByPath: e, colorPath: t, fieldByDim: n } = Ie, r = ie(e[t]?.options, f(e[t], ue)), a = d(e, n ? Object.entries(n).map(([e, t]) => ({
1579
2297
  dim: e,
1580
2298
  path: t
1581
- })) : null, O);
2299
+ })) : null, ue);
1582
2300
  return {
1583
- fieldOptionColors: r(i),
2301
+ fieldOptionColors: i(r),
1584
2302
  dimensionLabels: a
1585
2303
  };
1586
- }, [xe, O]), Me = ne(async (e, n) => {
1587
- if (t.aggregate && typeof e.aggregate == "function") {
1588
- let r = t.aggregate.groupBy;
1589
- if (r && typeof r == "object" && !Array.isArray(r)) {
1590
- let i = t.aggregate.field, a = t.aggregate.function, o = {
1591
- function: a,
1592
- alias: Ft(t.aggregate)
1593
- };
1594
- a !== "count" && i && (o.field = i);
1595
- let s = await e.aggregate(t.objectName, {
1596
- groupBy: [r],
1597
- aggregations: [o],
1598
- where: n
1599
- });
1600
- return Array.isArray(s) ? s : [];
2304
+ }, [Ie, ue]), Je = b(async (e, t) => {
2305
+ if (n.aggregate && typeof e.aggregate == "function") {
2306
+ let r = n.aggregate.groupBy;
2307
+ if (ne(r)) {
2308
+ let i = await e.aggregate(n.objectName, ae(n.aggregate, r, t));
2309
+ return Array.isArray(i) ? i : [];
1601
2310
  }
1602
- let i = await e.aggregate(t.objectName, {
1603
- field: t.aggregate.field,
1604
- function: t.aggregate.function,
2311
+ let i = await e.aggregate(n.objectName, {
2312
+ field: n.aggregate.field,
2313
+ function: n.aggregate.function,
1605
2314
  groupBy: r,
1606
- filter: n
2315
+ filter: t
1607
2316
  });
1608
2317
  return Array.isArray(i) ? i : [];
1609
2318
  }
1610
2319
  if (typeof e.find == "function") {
1611
- let r = await e.find(t.objectName, { $filter: n }), i = c(r);
1612
- return t.aggregate && i.length > 0 && (i = Lt(i, t.aggregate)), i;
2320
+ let r = await e.find(n.objectName, { $filter: t }), i = m(r), a = nr(n.aggregate);
2321
+ return n.aggregate && a && i.length > 0 && (i = rr(i, {
2322
+ ...n.aggregate,
2323
+ groupBy: a
2324
+ })), i;
1613
2325
  }
1614
2326
  return [];
1615
- }, [t.objectName, Te]), Ne = I(), Pe = ne(async (e, n) => {
1616
- if (!e || !t.objectName && !t.dataset) {
1617
- n.current && ve(!1);
2327
+ }, [n.objectName, He]), Ye = R(), Xe = b(async (e, t) => {
2328
+ if (!e || !n.objectName && !n.dataset) {
2329
+ t.current && Me(!1);
1618
2330
  return;
1619
2331
  }
1620
- n.current && (ve(!0), be(null));
2332
+ t.current && (Me(!0), Pe(null));
1621
2333
  try {
1622
- if (t.dataset && typeof e.queryDataset == "function") {
1623
- let r = m(t.filter, Ne), i = await e.queryDataset(t.dataset, {
1624
- dimensions: Array.isArray(t.dimensions) ? t.dimensions : [],
1625
- measures: Array.isArray(t.values) ? t.values : [],
2334
+ if (n.dataset && typeof e.queryDataset == "function") {
2335
+ let r = g(n.filter, Ye), i = await e.queryDataset(n.dataset, {
2336
+ dimensions: Array.isArray(n.dimensions) ? n.dimensions : [],
2337
+ measures: Array.isArray(n.values) ? n.values : [],
1626
2338
  ...r ? { runtimeFilter: r } : {}
1627
2339
  });
1628
- n.current && (k(Array.isArray(i?.rows) ? i.rows : []), ge(Array.isArray(i?.fields) ? i.fields : null));
2340
+ t.current && (_(Array.isArray(i?.rows) ? i.rows : []), we(Array.isArray(i?.fields) ? i.fields : null), T(typeof i?.object == "string" && i.object ? i.object : void 0));
1629
2341
  return;
1630
2342
  }
1631
- let r = m(t.filter, Ne), i = t.compareTo, a = !!i && ke(t.chartType), o = a ? p(te(t.filter, i), Ne) : null, [s, c] = await Promise.all([Me(e, r), o ? Me(e, o) : Promise.resolve([])]), l = s, u = t.aggregate?.groupBy, d = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || t.xAxisKey;
1632
- if (a && c.length > 0 && t.aggregate) {
1633
- let e = t.aggregate.field, n = t.aggregate.function, r = Ft(t.aggregate), i = (t) => {
1634
- if (t == null) return null;
2343
+ let r = g(n.filter, Ye), i = n.compareTo, a = !!i && !s(Ve), o = a ? se(le(n.filter, i), Ye) : null, [c, l] = await Promise.all([Je(e, r), o ? Je(e, o) : Promise.resolve([])]), u = c, d = nr(n.aggregate) || n.xAxisKey;
2344
+ if (a && l.length > 0 && n.aggregate) {
2345
+ let e = n.aggregate.field, t = n.aggregate.function, r = Qn(n.aggregate), i = (n) => {
2346
+ if (n == null) return null;
1635
2347
  if (e) {
1636
- let r = `${e}_${n}`;
1637
- if (r in t) return Number(t[r]);
1638
- if (n === "count" && `${e}_count` in t) return Number(t[`${e}_count`]);
2348
+ let r = `${e}_${t}`;
2349
+ if (r in n) return Number(n[r]);
2350
+ if (t === "count" && `${e}_count` in n) return Number(n[`${e}_count`]);
1639
2351
  }
1640
- return r in t ? Number(t[r]) : "value" in t ? Number(t.value) : "count" in t ? Number(t.count) : null;
1641
- }, a = `${r}${It}`, o = d;
1642
- if (o && l.some((e) => e[o] != null) && c.some((e) => e[o] != null)) {
2352
+ return r in n ? Number(n[r]) : "value" in n ? Number(n.value) : "count" in n ? Number(n.count) : null;
2353
+ }, a = `${r}${tr}`, o = d;
2354
+ if (o && u.some((e) => e[o] != null) && l.some((e) => e[o] != null)) {
1643
2355
  let e = /* @__PURE__ */ new Map();
1644
- for (let t of c) {
2356
+ for (let t of l) {
1645
2357
  let n = String(t[o] ?? "");
1646
2358
  e.set(n, i(t));
1647
2359
  }
1648
- l = l.map((t) => {
2360
+ u = u.map((t) => {
1649
2361
  let n = String(t[o] ?? ""), r = e.get(n);
1650
2362
  return r == null ? t : {
1651
2363
  ...t,
1652
2364
  [a]: r
1653
2365
  };
1654
2366
  });
1655
- let t = new Set(l.map((e) => String(e[o] ?? "")));
1656
- for (let e of c) {
2367
+ let t = new Set(u.map((e) => String(e[o] ?? "")));
2368
+ for (let e of l) {
1657
2369
  let n = String(e[o] ?? "");
1658
- t.has(n) || l.push({
2370
+ t.has(n) || u.push({
1659
2371
  [o]: n,
1660
2372
  [a]: i(e)
1661
2373
  });
1662
2374
  }
1663
2375
  } else {
1664
- let e = Math.max(l.length, c.length), t = [];
2376
+ let e = Math.max(u.length, l.length), t = [];
1665
2377
  for (let n = 0; n < e; n++) {
1666
- let e = l[n] || {}, r = c[n];
2378
+ let e = u[n] || {}, r = l[n];
1667
2379
  t.push(r ? {
1668
2380
  ...e,
1669
2381
  [a]: i(r)
1670
2382
  } : e);
1671
2383
  }
1672
- l = t;
2384
+ u = t;
1673
2385
  }
1674
2386
  }
1675
- if (d && typeof e.getObjectSchema == "function") try {
1676
- let n = await e.getObjectSchema(t.objectName);
1677
- l = await Rt(l, d, n, e, (e, n) => pe.current(t.objectName, d, e, n));
1678
- } catch {}
1679
- n.current && k(l);
2387
+ if (d && n.objectName && typeof e.getObjectSchema == "function") {
2388
+ let t = n.objectName;
2389
+ try {
2390
+ let n = await e.getObjectSchema(t);
2391
+ u = await ir(u, d, n, e, (e, n) => ue(t, d, e, n));
2392
+ } catch {}
2393
+ }
2394
+ t.current && _(u);
1680
2395
  } catch (e) {
1681
- console.error("[ObjectChart] Fetch error:", e), n.current && be(e instanceof Error ? e.message : "Failed to load chart data");
2396
+ console.error("[ObjectChart] Fetch error:", e), t.current && Pe(e instanceof Error ? e.message : "Failed to load chart data");
1682
2397
  } finally {
1683
- n.current && ve(!1);
2398
+ t.current && Me(!1);
1684
2399
  }
1685
2400
  }, [
1686
- t.objectName,
1687
- Oe,
1688
- Te,
1689
- Ee,
1690
- De,
1691
- t.xAxisKey,
1692
- t.chartType,
1693
- Me,
1694
- Ne
1695
- ]);
1696
- ie(() => {
2401
+ n.objectName,
2402
+ Ge,
2403
+ He,
2404
+ Ue,
2405
+ We,
2406
+ n.xAxisKey,
2407
+ Ve,
2408
+ Je,
2409
+ Ye,
2410
+ ue
2411
+ ]), Ze = !!(n.objectName || n.dataset) && !te && !n.data, Qe = F(Ze ? n.dataset ? De : n.objectName : void 0);
2412
+ S(() => {
1697
2413
  let e = { current: !0 };
1698
- return (t.objectName || t.dataset) && !T && !t.data ? Pe(_, e) : e.current && ve(!1), () => {
2414
+ return Ze ? Xe(p, e) : e.current && Me(!1), () => {
1699
2415
  e.current = !1;
1700
2416
  };
1701
2417
  }, [
1702
- t.objectName,
1703
- Oe,
1704
- _,
1705
- T,
1706
- t.data,
1707
- Ee,
1708
- Te,
1709
- De,
1710
- Pe
2418
+ n.objectName,
2419
+ Ge,
2420
+ p,
2421
+ te,
2422
+ n.data,
2423
+ Ue,
2424
+ He,
2425
+ We,
2426
+ Xe,
2427
+ Qe
1711
2428
  ]);
1712
- let Fe = T || t.data || me, M = Array.isArray(Fe) ? Fe : [], N = t.drillDown, P = t.aggregate?.groupBy || t.xAxisKey, F = v(() => {
1713
- if (!P) return /* @__PURE__ */ new Map();
1714
- let e = /* @__PURE__ */ new Map(), t = `__raw_${P}`;
1715
- for (let n of M) {
1716
- let r = n?.[P];
2429
+ let $e = te || n.data || de, A = Array.isArray($e) ? $e : [], j = n.drillDown, M = nr(n.aggregate) || n.xAxisKey, et = C(() => {
2430
+ if (!M) return /* @__PURE__ */ new Map();
2431
+ let e = /* @__PURE__ */ new Map(), t = `__raw_${M}`;
2432
+ for (let n of A) {
2433
+ let r = n?.[M];
1717
2434
  if (r == null) continue;
1718
2435
  let i = t in (n || {}) ? n[t] : r;
1719
2436
  e.set(String(r), i);
1720
2437
  }
1721
2438
  return e;
1722
- }, [M, P]), Ie = v(() => {
1723
- if (A) return {
1724
- ...t.filter || {},
1725
- ...a(N, A, { groupByField: P })
1726
- };
2439
+ }, [A, M]), N = C(() => {
2440
+ if (Fe) try {
2441
+ return {
2442
+ ok: !0,
2443
+ filter: l(n.filter, u(j, Fe, { groupByField: M }))
2444
+ };
2445
+ } catch (e) {
2446
+ if (!(e instanceof t)) throw e;
2447
+ return {
2448
+ ok: !1,
2449
+ refusal: e
2450
+ };
2451
+ }
1727
2452
  }, [
1728
- A,
1729
- N,
1730
- P,
1731
- Ee
1732
- ]), Le = !h && !!A && !!t.objectName && N?.target === "navigate" && !!Ce;
1733
- ie(() => {
1734
- Le && (Ce(t.objectName, Ie), j(null));
1735
- }, [Le]);
1736
- let B = t.compareTo, V = t.aggregate ? Ft(t.aggregate) : void 0, H = V ? `${V}${It}` : void 0, U = !!B && ke(t.chartType) && !!H && M.some((e) => e[H] != null), W = v(() => {
1737
- let e = Array.isArray(t.series) ? t.series : null;
1738
- if (!U) return e;
1739
- let n = e || [{ dataKey: V }], r = {
2453
+ Fe,
2454
+ j,
2455
+ M,
2456
+ Ue
2457
+ ]), P = N?.ok ? N.filter : void 0, tt = N?.ok === !1, B = N?.ok === !1 ? N.refusal.message : void 0;
2458
+ S(() => {
2459
+ B && console.warn(`[ObjectChart] drill-down refused — the drilled list cannot be scoped: ${B}`);
2460
+ }, [B]);
2461
+ let V = !a && !!Fe && !tt && !!n.objectName && j?.target === "navigate" && !!Re;
2462
+ S(() => {
2463
+ V && (Re(n.objectName, P), O(null));
2464
+ }, [V]);
2465
+ let ot = n.compareTo, H = n.aggregate ? Qn(n.aggregate) : void 0, U = H ? `${H}${tr}` : void 0, st = !!ot && !s(Ve) && !!U && A.some((e) => e[U] != null), ct = C(() => {
2466
+ let e = Array.isArray(n.series) ? n.series : null;
2467
+ if (!st) return e;
2468
+ let t = e || [{ dataKey: H }], r = {
1740
2469
  vsLastWeek: "Previous week",
1741
2470
  vsLastMonth: "Previous month",
1742
2471
  vsLastQuarter: "Previous quarter",
1743
2472
  vsLastYear: "Previous year",
1744
2473
  vsYesterday: "Yesterday",
1745
2474
  vsPreviousPeriod: "Previous period"
1746
- }[i(B, t.filter)] || "Previous period";
1747
- return [...n.map((e) => ({
2475
+ }[c(ot, n.filter)] || "Previous period";
2476
+ return [...t.map((e) => ({
1748
2477
  ...e,
1749
2478
  variant: e.variant || "current"
1750
2479
  })), {
1751
- dataKey: H,
2480
+ dataKey: U,
1752
2481
  label: r,
1753
2482
  variant: "comparison"
1754
2483
  }];
1755
2484
  }, [
1756
- U,
1757
- t.series,
1758
- V,
2485
+ st,
2486
+ n.series,
1759
2487
  H,
1760
- t.filter,
1761
- B
1762
- ]), Ue = t.dataset ? n(f(M, je), t.dimensions, t.values, he, { nullCategoryLabel: we("chart.nullCategory", "(None)") }) : null, We = Ue ? {
1763
- ...t,
1764
- data: Ue.data,
1765
- xAxisKey: Ue.xAxisKey,
1766
- series: Ue.series
2488
+ U,
2489
+ n.filter,
2490
+ ot
2491
+ ]), lt = n.dataset ? r(oe(A, qe), n.dimensions, n.values, y, {
2492
+ nullCategoryLabel: k("chart.nullCategory", "(None)"),
2493
+ builtinAggregateLabels: Te(k)
2494
+ }) : null, dt = !!te || Array.isArray(n.data), ft = !!n.objectName && !n.dataset && !dt, W = ft && !ut(n, Be).xAxisKey ? nr(n.aggregate) : void 0, pt = lt ? {
2495
+ ...n,
2496
+ data: lt.data,
2497
+ xAxisKey: lt.xAxisKey,
2498
+ series: lt.series
1767
2499
  } : {
1768
- ...t,
1769
- data: M,
1770
- ...W ? { series: W } : {}
1771
- }, Ge = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, Ke = Array.isArray(t.colors) ? t.colors : void 0, G = Ae || Ge ? {
1772
- ...Ae || {},
1773
- ...Ge || {}
1774
- } : void 0, qe = {
1775
- ...We,
1776
- colors: Ke,
1777
- ...G ? { categoryColors: G } : {}
2500
+ ...n,
2501
+ data: A,
2502
+ ...W ? { xAxisKey: W } : {},
2503
+ ...ct ? { series: ct } : {}
2504
+ }, G = n.colors && !Array.isArray(n.colors) && typeof n.colors == "object" ? n.colors : null, mt = Array.isArray(n.colors) ? n.colors : void 0, ht = Ke || G ? {
2505
+ ...Ke || {},
2506
+ ...G || {}
2507
+ } : void 0, gt = {
2508
+ ...pt,
2509
+ colors: mt,
2510
+ ...ht ? { categoryColors: ht } : {}
1778
2511
  };
1779
- if (_e && M.length === 0) return /* @__PURE__ */ D("div", {
1780
- className: "p-2 " + (t.className || ""),
2512
+ if (ft && !er(n)) return /* @__PURE__ */ D("div", {
2513
+ className: "p-4 text-destructive " + (n.className || ""),
2514
+ "data-testid": "chart-missing-category-axis",
2515
+ role: "alert",
2516
+ children: [
2517
+ k("chart.unconfigured.noCategoryAxis", "Chart category axis required — an object-bound chart will not invent one. Declare one of:"),
2518
+ " ",
2519
+ $n.map((e, t) => /* @__PURE__ */ D(v.Fragment, { children: [t > 0 ? ", " : "", /* @__PURE__ */ E("code", {
2520
+ className: "font-mono",
2521
+ children: e
2522
+ })] }, e))
2523
+ ]
2524
+ });
2525
+ if (je && A.length === 0) return /* @__PURE__ */ D("div", {
2526
+ className: "p-2 " + (n.className || ""),
1781
2527
  "data-testid": "chart-loading",
1782
2528
  role: "status",
1783
2529
  "aria-busy": "true",
@@ -1785,49 +2531,70 @@ var zt = (e) => {
1785
2531
  children: [/* @__PURE__ */ E("span", {
1786
2532
  className: "sr-only",
1787
2533
  children: "Loading chart data…"
1788
- }), /* @__PURE__ */ E(S, { className: "h-full" })]
2534
+ }), /* @__PURE__ */ E(pe, { className: "h-full" })]
1789
2535
  });
1790
- if (ye) return /* @__PURE__ */ D("div", {
1791
- className: "flex flex-col items-center justify-center gap-2 p-4 " + (t.className || ""),
2536
+ if (Ne) return /* @__PURE__ */ D("div", {
2537
+ className: "flex flex-col items-center justify-center gap-2 p-4 " + (n.className || ""),
1792
2538
  "data-testid": "chart-error",
1793
2539
  role: "alert",
1794
2540
  children: [
1795
- /* @__PURE__ */ E(He, { className: "h-6 w-6 text-destructive opacity-60" }),
2541
+ /* @__PURE__ */ E(z, { className: "h-6 w-6 text-destructive opacity-60" }),
1796
2542
  /* @__PURE__ */ E("p", {
1797
2543
  className: "text-xs text-destructive font-medium",
1798
2544
  children: "Failed to load chart data"
1799
2545
  }),
1800
2546
  /* @__PURE__ */ E("p", {
1801
2547
  className: "text-xs text-muted-foreground max-w-xs text-center",
1802
- children: ye
2548
+ children: Ne
1803
2549
  })
1804
2550
  ]
1805
2551
  });
1806
- if (!_ && t.objectName && M.length === 0) return /* @__PURE__ */ D("div", {
1807
- className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
2552
+ if (!p && n.objectName && A.length === 0) return /* @__PURE__ */ D("div", {
2553
+ className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (n.className || ""),
1808
2554
  "data-testid": "chart-no-datasource",
1809
2555
  children: [
1810
2556
  "No data source available for “",
1811
- t.objectName,
2557
+ n.objectName,
1812
2558
  "”"
1813
2559
  ]
1814
2560
  });
1815
- let Je = l(N) ? (e) => {
1816
- let t = e.category, n = t != null && F.has(String(t)) ? F.get(String(t)) : t;
1817
- j({
2561
+ if ((n.objectName || n.dataset) && !te && !n.data && A.length === 0) return /* @__PURE__ */ E(me, {
2562
+ role: "status",
2563
+ "data-testid": "chart-empty-state",
2564
+ className: "h-full w-full gap-2 p-4 [&>h3]:text-sm [&>h3]:font-medium [&>p]:text-xs " + (n.className || ""),
2565
+ icon: /* @__PURE__ */ E(at, { className: "h-5 w-5 text-muted-foreground/70" }),
2566
+ iconWrapperClassName: "flex size-9 items-center justify-center rounded-lg bg-muted",
2567
+ title: k("dashboard.empty.title", "No data yet"),
2568
+ description: k("dashboard.empty.message", "This widget loaded successfully and its query returned no records yet."),
2569
+ children: /* @__PURE__ */ D("p", {
2570
+ className: "text-xs text-muted-foreground/80",
2571
+ "data-testid": "chart-empty-source",
2572
+ children: [
2573
+ /* @__PURE__ */ E("span", { children: k("dashboard.empty.sourceLabel", "Source:") }),
2574
+ " ",
2575
+ /* @__PURE__ */ E("span", {
2576
+ className: "font-mono",
2577
+ children: n.dataset || n.objectName
2578
+ })
2579
+ ]
2580
+ })
2581
+ });
2582
+ let _t = ee(j) ? (e) => {
2583
+ let t = e.category, n = t != null && et.has(String(t)) ? et.get(String(t)) : t;
2584
+ O({
1818
2585
  ...e,
1819
2586
  category: n,
1820
2587
  categoryLabel: t,
1821
2588
  scope: "cell"
1822
2589
  });
1823
- } : void 0, Ye = h ?? Je, Xe = !h && A && t.objectName && !Le ? (() => {
1824
- let e = Ie ?? {}, n = ee(N, A, t.title || "Details"), r = N?.target ?? "drawer", i = {
2590
+ } : void 0, vt = a ?? _t, K = !a && Fe && !tt && n.objectName && !V ? (() => {
2591
+ let e = P ?? {}, t = ce(j, Fe, Ee(n.title, Be) || "Details"), r = j?.target ?? "drawer", i = {
1825
2592
  type: "object-data-table",
1826
- objectName: t.objectName,
2593
+ objectName: n.objectName,
1827
2594
  filter: e,
1828
2595
  pagination: !0,
1829
- pageSize: N?.maxRows,
1830
- columns: N?.columns?.map((e) => ({
2596
+ pageSize: j?.maxRows,
2597
+ columns: j?.columns?.map((e) => ({
1831
2598
  accessorKey: e,
1832
2599
  header: e
1833
2600
  })),
@@ -1839,39 +2606,39 @@ var zt = (e) => {
1839
2606
  }, a = /* @__PURE__ */ E("div", {
1840
2607
  className: "overflow-auto",
1841
2608
  "data-testid": "chart-drill-body",
1842
- children: /* @__PURE__ */ E(Re, {
2609
+ children: /* @__PURE__ */ E(nt, {
1843
2610
  schema: i,
1844
- dataSource: _
2611
+ dataSource: p
1845
2612
  })
1846
- }), o = Ce && t.objectName ? /* @__PURE__ */ D(x, {
2613
+ }), o = Re && n.objectName ? /* @__PURE__ */ D(fe, {
1847
2614
  type: "button",
1848
2615
  variant: "ghost",
1849
2616
  size: "sm",
1850
2617
  "data-testid": "drill-open-in-list",
1851
2618
  onClick: () => {
1852
- Ce(t.objectName, e), j(null);
2619
+ Re(n.objectName, e), O(null);
1853
2620
  },
1854
- children: [we("dashboard.openInList", "Open in list"), /* @__PURE__ */ E(L, { className: "ml-1 h-3.5 w-3.5" })]
2621
+ children: [k("dashboard.openInList", "Open in list"), /* @__PURE__ */ E(it, { className: "ml-1 h-3.5 w-3.5" })]
1855
2622
  }) : null;
1856
- return r === "dialog" ? /* @__PURE__ */ E(C, {
2623
+ return r === "dialog" ? /* @__PURE__ */ E(he, {
1857
2624
  open: !0,
1858
- onOpenChange: (e) => !e && j(null),
1859
- children: /* @__PURE__ */ D(w, {
2625
+ onOpenChange: (e) => !e && O(null),
2626
+ children: /* @__PURE__ */ D(ge, {
1860
2627
  className: "max-w-4xl",
1861
- children: [/* @__PURE__ */ D(ae, {
2628
+ children: [/* @__PURE__ */ D(_e, {
1862
2629
  className: "flex-row items-center justify-between gap-4 pr-8",
1863
- children: [/* @__PURE__ */ E(oe, { children: n }), o]
2630
+ children: [/* @__PURE__ */ E(ve, { children: t }), o]
1864
2631
  }), a]
1865
2632
  })
1866
- }) : /* @__PURE__ */ E(ce, {
2633
+ }) : /* @__PURE__ */ E(be, {
1867
2634
  open: !0,
1868
- onOpenChange: (e) => !e && j(null),
1869
- children: /* @__PURE__ */ D(le, {
2635
+ onOpenChange: (e) => !e && O(null),
2636
+ children: /* @__PURE__ */ D(xe, {
1870
2637
  side: "right",
1871
2638
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1872
- children: [/* @__PURE__ */ D(ue, {
2639
+ children: [/* @__PURE__ */ D(Se, {
1873
2640
  className: "flex-row items-center justify-between gap-4 pr-8",
1874
- children: [/* @__PURE__ */ E(de, { children: n }), o]
2641
+ children: [/* @__PURE__ */ E(Ce, { children: t }), o]
1875
2642
  }), /* @__PURE__ */ E("div", {
1876
2643
  className: "flex-1 overflow-hidden mt-2",
1877
2644
  children: a
@@ -1880,31 +2647,34 @@ var zt = (e) => {
1880
2647
  });
1881
2648
  })() : null;
1882
2649
  return /* @__PURE__ */ D("div", {
1883
- className: "relative",
2650
+ className: "relative h-full",
1884
2651
  children: [
1885
- /* @__PURE__ */ E(se, { active: _e && M.length > 0 }),
1886
- /* @__PURE__ */ E($, {
2652
+ /* @__PURE__ */ E(ye, {
2653
+ active: je && A.length > 0,
2654
+ ariaLabel: ze("chart.refreshing")
2655
+ }),
2656
+ /* @__PURE__ */ E(Zn, {
1887
2657
  ...e,
1888
- schema: qe,
1889
- onChartClick: Ye
2658
+ schema: gt,
2659
+ onChartClick: vt
1890
2660
  }),
1891
- Xe
2661
+ K
1892
2662
  ]
1893
2663
  });
1894
- }, Bt = { filter: !0 }, Vt = (e) => /* @__PURE__ */ E(Le, {
2664
+ }, or = { filter: !0 }, sr = p((e) => /* @__PURE__ */ E(tt, {
1895
2665
  schema: e.schema,
1896
- mapping: Bt,
2666
+ mapping: or,
1897
2667
  dataSource: e.dataSource,
1898
2668
  testId: "object-chart",
1899
2669
  errorTitle: "This chart’s data source could not be resolved",
1900
- children: (t) => /* @__PURE__ */ E(zt, {
2670
+ children: (t) => /* @__PURE__ */ E(ar, {
1901
2671
  ...e,
1902
2672
  schema: t
1903
2673
  })
1904
- });
2674
+ }));
1905
2675
  //#endregion
1906
2676
  //#region src/index.tsx
1907
- e.register("object-chart", Vt, {
2677
+ e.register("object-chart", sr, {
1908
2678
  namespace: "plugin-charts",
1909
2679
  label: "Object Chart",
1910
2680
  category: "view",
@@ -1912,39 +2682,34 @@ e.register("object-chart", Vt, {
1912
2682
  {
1913
2683
  name: "objectName",
1914
2684
  type: "string",
1915
- label: "Object Name",
1916
2685
  required: !0
1917
2686
  },
1918
2687
  {
1919
2688
  name: "data",
1920
2689
  type: "array",
1921
- label: "Data",
1922
2690
  description: "Optional static data"
1923
2691
  },
1924
2692
  {
1925
2693
  name: "filter",
1926
- type: "array",
1927
- label: "Filter"
2694
+ type: "array"
1928
2695
  },
1929
2696
  {
1930
2697
  name: "aggregate",
1931
2698
  type: "object",
1932
- label: "Aggregate",
1933
2699
  description: "Aggregation config: { field, function, groupBy }"
1934
2700
  },
1935
2701
  {
1936
2702
  name: "drillDown",
1937
2703
  type: "object",
1938
- label: "Drill-down",
1939
2704
  description: "Segment drill config: { enabled?, filter?, title?, target?: 'drawer' | 'dialog', columns?, maxRows? }. Present = on; {} is enough. Clicking a segment opens the underlying records filtered by the clicked category."
1940
2705
  }
1941
2706
  ]
1942
- }), $e();
1943
- var Ht = {
1944
- "bar-chart": Nt,
1945
- chart: $
2707
+ }), bt();
2708
+ var cr = {
2709
+ "bar-chart": Xn,
2710
+ chart: Zn
1946
2711
  };
1947
- e.register("bar-chart", Nt, {
2712
+ e.register("bar-chart", Xn, {
1948
2713
  namespace: "plugin-charts",
1949
2714
  label: "Bar Chart",
1950
2715
  category: "plugin",
@@ -1952,32 +2717,23 @@ e.register("bar-chart", Nt, {
1952
2717
  {
1953
2718
  name: "data",
1954
2719
  type: "array",
1955
- label: "Data",
1956
2720
  required: !0
1957
2721
  },
1958
2722
  {
1959
2723
  name: "dataKey",
1960
- type: "string",
1961
- label: "Data Key",
1962
- defaultValue: "value"
2724
+ type: "string"
1963
2725
  },
1964
2726
  {
1965
2727
  name: "xAxisKey",
1966
- type: "string",
1967
- label: "X-Axis Key",
1968
- defaultValue: "name"
2728
+ type: "string"
1969
2729
  },
1970
2730
  {
1971
2731
  name: "height",
1972
- type: "number",
1973
- label: "Height",
1974
- defaultValue: 400
2732
+ type: "number"
1975
2733
  },
1976
2734
  {
1977
2735
  name: "color",
1978
- type: "color",
1979
- label: "Color",
1980
- defaultValue: "#8884d8"
2736
+ type: "color"
1981
2737
  }
1982
2738
  ],
1983
2739
  defaultProps: {
@@ -2008,7 +2764,7 @@ e.register("bar-chart", Nt, {
2008
2764
  height: 400,
2009
2765
  color: "#8884d8"
2010
2766
  }
2011
- }), e.register("chart", Vt, {
2767
+ }), e.register("chart", sr, {
2012
2768
  namespace: "view",
2013
2769
  category: "view",
2014
2770
  label: "Chart",
@@ -2017,26 +2773,22 @@ e.register("bar-chart", Nt, {
2017
2773
  {
2018
2774
  name: "objectName",
2019
2775
  type: "string",
2020
- label: "Object Name",
2021
2776
  required: !0
2022
2777
  },
2023
2778
  {
2024
2779
  name: "type",
2025
- type: "string",
2026
- label: "Chart Type"
2780
+ type: "string"
2027
2781
  },
2028
2782
  {
2029
2783
  name: "categoryField",
2030
- type: "string",
2031
- label: "Category Field"
2784
+ type: "string"
2032
2785
  },
2033
2786
  {
2034
2787
  name: "valueField",
2035
- type: "string",
2036
- label: "Value Field"
2788
+ type: "string"
2037
2789
  }
2038
2790
  ]
2039
- }), e.register("chart", $, {
2791
+ }), e.register("chart", Zn, {
2040
2792
  namespace: "plugin-charts",
2041
2793
  label: "Chart",
2042
2794
  category: "plugin",
@@ -2044,7 +2796,6 @@ e.register("bar-chart", Nt, {
2044
2796
  {
2045
2797
  name: "chartType",
2046
2798
  type: "enum",
2047
- label: "Chart Type",
2048
2799
  enum: [
2049
2800
  {
2050
2801
  label: "Bar",
@@ -2074,36 +2825,29 @@ e.register("bar-chart", Nt, {
2074
2825
  label: "Scatter",
2075
2826
  value: "scatter"
2076
2827
  }
2077
- ],
2078
- defaultValue: "bar"
2828
+ ]
2079
2829
  },
2080
2830
  {
2081
2831
  name: "data",
2082
2832
  type: "code",
2083
- label: "Data (JSON)",
2084
2833
  required: !0
2085
2834
  },
2086
2835
  {
2087
2836
  name: "config",
2088
- type: "code",
2089
- label: "Config (JSON)"
2837
+ type: "code"
2090
2838
  },
2091
2839
  {
2092
2840
  name: "xAxisKey",
2093
- type: "string",
2094
- label: "X Axis Key",
2095
- defaultValue: "name"
2841
+ type: "string"
2096
2842
  },
2097
2843
  {
2098
2844
  name: "series",
2099
2845
  type: "code",
2100
- label: "Series (JSON Array)",
2101
2846
  required: !0
2102
2847
  },
2103
2848
  {
2104
2849
  name: "className",
2105
- type: "string",
2106
- label: "CSS Class"
2850
+ type: "string"
2107
2851
  }
2108
2852
  ],
2109
2853
  defaultProps: {
@@ -2148,31 +2892,10 @@ e.register("bar-chart", Nt, {
2148
2892
  xAxisKey: "name",
2149
2893
  series: [{ dataKey: "sales" }, { dataKey: "revenue" }]
2150
2894
  }
2151
- }), e.register("chart:bar", $, {
2895
+ }), e.register("chart:bar", Zn, {
2152
2896
  namespace: "plugin-charts",
2153
2897
  label: "Bar Chart (Alias)",
2154
- category: "plugin",
2155
- defaultProps: { chartType: "bar" }
2156
- }), e.register("pie-chart", $, {
2157
- namespace: "plugin-charts",
2158
- label: "Pie Chart",
2159
- category: "plugin",
2160
- defaultProps: { chartType: "pie" }
2161
- }), e.register("donut-chart", $, {
2162
- namespace: "plugin-charts",
2163
- label: "Donut Chart",
2164
- category: "plugin",
2165
- defaultProps: { chartType: "donut" }
2166
- }), e.register("radar-chart", $, {
2167
- namespace: "plugin-charts",
2168
- label: "Radar Chart",
2169
- category: "plugin",
2170
- defaultProps: { chartType: "radar" }
2171
- }), e.register("scatter-chart", $, {
2172
- namespace: "plugin-charts",
2173
- label: "Scatter Chart",
2174
- category: "plugin",
2175
- defaultProps: { chartType: "scatter" }
2898
+ category: "plugin"
2176
2899
  });
2177
2900
  //#endregion
2178
- export { Nt as ChartBarRenderer, $ as ChartRenderer, zt as ObjectChart, Vt as ObjectChartBlock, Ht as chartComponents, We as normalizeChartSchema };
2901
+ export { Xn as ChartBarRenderer, Zn as ChartRenderer, ar as ObjectChart, sr as ObjectChartBlock, cr as chartComponents, ut as normalizeChartSchema };