@object-ui/plugin-charts 11.4.0 → 13.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,76 @@
1
1
  # @object-ui/plugin-charts
2
2
 
3
+ ## 13.1.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/types@13.1.0
8
+ - @object-ui/core@13.1.0
9
+ - @object-ui/i18n@13.1.0
10
+ - @object-ui/react@13.1.0
11
+ - @object-ui/components@13.1.0
12
+
13
+ ## 13.0.0
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [9e38270]
18
+ - Updated dependencies [ac04b76]
19
+ - Updated dependencies [619097e]
20
+ - @object-ui/i18n@13.0.0
21
+ - @object-ui/components@13.0.0
22
+ - @object-ui/types@13.0.0
23
+ - @object-ui/react@13.0.0
24
+ - @object-ui/core@13.0.0
25
+
26
+ ## 12.1.0
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [6cbccf3]
31
+ - Updated dependencies [e1840bf]
32
+ - Updated dependencies [c31874d]
33
+ - @object-ui/components@12.1.0
34
+ - @object-ui/i18n@12.1.0
35
+ - @object-ui/types@12.1.0
36
+ - @object-ui/react@12.1.0
37
+ - @object-ui/core@12.1.0
38
+
39
+ ## 12.0.0
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [226fde9]
44
+ - Updated dependencies [e4de456]
45
+ - @object-ui/types@12.0.0
46
+ - @object-ui/core@12.0.0
47
+ - @object-ui/components@12.0.0
48
+ - @object-ui/react@12.0.0
49
+ - @object-ui/i18n@12.0.0
50
+
51
+ ## 11.5.0
52
+
53
+ ### Patch Changes
54
+
55
+ - fae75e2: Fix two bugs verified still-present after #2254 claimed to resolve them (framework#2620 / framework#2616 Showcase UX pass, tracked in #2268):
56
+
57
+ - **Wizard/form `submitBehavior: 'thank-you'` allowed duplicate resubmission.** #2254 fixed the spec-bridge dropping `submitBehavior` before it reached the renderer, so the configured toast message started appearing — but `WizardForm`'s last step and `ObjectForm`'s submit handler only ever called `toast.success(...)` for `thank-you`/`next-record`; the form stayed mounted and fully filled with its submit button re-enabled once the request settled, so a second click created a second record. Both components now track a terminal `submitted` state and, when set, replace the form with a confirmation panel (using the behavior's `title`/`message`, which were also never read before) — mirroring the pattern `apps/console/src/components/FormPage.tsx` already used for its own standalone forms.
58
+
59
+ - **Command Center-style 3-up chart bands stayed collapsed to ~100-130px, and a dataset-bound chart's measure leaked its raw field name.**
60
+ - `responsiveStyles` (and `style`) were declared on the page-spec `PageComponent` bridge input type but never copied onto the `SchemaNode` in `spec-bridge/bridges/page.ts::mapComponent()` — so a page author's ADR-0065 layout override (e.g. forcing `display: 'grid'` on a `type: 'flex'` band) never reached `SchemaRenderer`, and the node silently fell back to its default flex layout. Both fields are now mapped through.
61
+ - `ObjectChart`'s dataset-bound fetch path (`schema.dataset` + `ds.queryDataset(...)`) discarded the response's `fields` array (which carries each measure's `label`, e.g. `{ name: 'task_count', label: 'Tasks' }`) before it ever reached `buildChartSeries()` — whose `fields` param already resolves this correctly (see `chart-series.test.ts`) — so the legend/tooltip always fell back to the raw field name. The fetched `fields` are now captured and threaded through.
62
+
63
+ - Updated dependencies [544d8eb]
64
+ - Updated dependencies [6fffd3d]
65
+ - Updated dependencies [9255686]
66
+ - Updated dependencies [fae75e2]
67
+ - Updated dependencies [1072701]
68
+ - @object-ui/i18n@11.5.0
69
+ - @object-ui/react@11.5.0
70
+ - @object-ui/components@11.5.0
71
+ - @object-ui/types@11.5.0
72
+ - @object-ui/core@11.5.0
73
+
3
74
  ## 11.4.0
4
75
 
5
76
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3,31 +3,31 @@ import * as f from "react";
3
3
  import p, { Suspense as m, useCallback as h, useContext as g, useEffect as ee, useMemo as _, useRef as te, useState as v } from "react";
4
4
  import { Button as ne, ChartSkeleton as re, Dialog as ie, DialogContent as ae, DialogHeader as oe, DialogTitle as se, RefreshIndicator as ce, Sheet as le, SheetContent as ue, SheetHeader as y, SheetTitle as b, Skeleton as x } from "@object-ui/components";
5
5
  import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
6
- import { Area as T, AreaChart as de, Bar as fe, BarChart as E, CartesianGrid as D, Cell as O, Funnel as pe, FunnelChart as me, LabelList as he, Legend as k, Line as ge, LineChart as _e, Pie as ve, PieChart as A, PolarAngleAxis as ye, PolarGrid as be, PolarRadiusAxis as j, Radar as xe, RadarChart as M, ResponsiveContainer as N, Sankey as Se, Scatter as P, ScatterChart as F, Tooltip as I, Treemap as L, XAxis as R, YAxis as z, ZAxis as Ce } from "recharts";
7
- import { SchemaRenderer as we, SchemaRendererContext as Te, useDataScope as B, useDrillNavigation as Ee } from "@object-ui/react";
8
- import { AlertCircle as De, ArrowUpRight as Oe } from "lucide-react";
9
- import { useSafeFieldLabel as ke, useSafeTranslate as Ae } from "@object-ui/i18n";
6
+ import { Area as T, AreaChart as de, Bar as fe, BarChart as E, CartesianGrid as D, Cell as pe, Funnel as me, FunnelChart as O, LabelList as he, Legend as k, Line as A, LineChart as j, Pie as ge, PieChart as M, PolarAngleAxis as _e, PolarGrid as ve, PolarRadiusAxis as ye, Radar as be, RadarChart as N, ResponsiveContainer as P, Sankey as xe, Scatter as Se, ScatterChart as Ce, Tooltip as F, Treemap as we, XAxis as I, YAxis as L, ZAxis as R } from "recharts";
7
+ import { SchemaRenderer as Te, SchemaRendererContext as Ee, useDataScope as z, useDrillNavigation as De } from "@object-ui/react";
8
+ import { AlertCircle as Oe, ArrowUpRight as ke } from "lucide-react";
9
+ import { useSafeFieldLabel as Ae, useSafeTranslate as je } from "@object-ui/i18n";
10
10
  //#region \0rolldown/runtime.js
11
- var V = Object.defineProperty, H = (e, t, n) => () => {
11
+ var B = Object.defineProperty, V = (e, t, n) => () => {
12
12
  if (n) throw n[0];
13
13
  try {
14
14
  return e && (t = e(e = 0)), t;
15
15
  } catch (e) {
16
16
  throw n = [e], e;
17
17
  }
18
- }, je = (e, t) => {
18
+ }, H = (e, t) => {
19
19
  let n = {};
20
- for (var r in e) V(n, r, {
20
+ for (var r in e) B(n, r, {
21
21
  get: e[r],
22
22
  enumerable: !0
23
23
  });
24
- return t || V(n, Symbol.toStringTag, { value: "Module" }), n;
25
- }, U = /* @__PURE__ */ je({ default: () => Pe });
26
- function Me(e, t = 14) {
24
+ return t || B(n, Symbol.toStringTag, { value: "Module" }), n;
25
+ }, Me = /* @__PURE__ */ H({ default: () => Pe });
26
+ function Ne(e, t = 14) {
27
27
  return e.length > t ? `${e.slice(0, t - 1)}…` : e;
28
28
  }
29
- function Ne({ x: e, y: t, payload: n }) {
30
- let r = String(n?.value ?? ""), i = Me(r);
29
+ function U({ x: e, y: t, payload: n }) {
30
+ let r = String(n?.value ?? ""), i = Ne(r);
31
31
  return /* @__PURE__ */ C("g", {
32
32
  transform: `translate(${e},${t})`,
33
33
  children: /* @__PURE__ */ w("text", {
@@ -45,7 +45,7 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
45
45
  let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
46
46
  return /* @__PURE__ */ C("div", {
47
47
  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}`,
48
- children: /* @__PURE__ */ C(N, {
48
+ children: /* @__PURE__ */ C(P, {
49
49
  width: "100%",
50
50
  height: r,
51
51
  children: /* @__PURE__ */ w(E, {
@@ -114,9 +114,9 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
114
114
  stroke: "hsl(var(--border))",
115
115
  vertical: !1
116
116
  }),
117
- /* @__PURE__ */ C(R, {
117
+ /* @__PURE__ */ C(I, {
118
118
  dataKey: n,
119
- tick: s ? /* @__PURE__ */ C(Ne, {}) : {
119
+ tick: s ? /* @__PURE__ */ C(U, {}) : {
120
120
  fill: "hsl(var(--muted-foreground))",
121
121
  fontSize: 12,
122
122
  fontFamily: "monospace"
@@ -127,7 +127,7 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
127
127
  height: s ? 56 : void 0,
128
128
  dy: s ? void 0 : 10
129
129
  }),
130
- /* @__PURE__ */ C(z, {
130
+ /* @__PURE__ */ C(L, {
131
131
  tick: {
132
132
  fill: "hsl(var(--muted-foreground))",
133
133
  fontSize: 12,
@@ -136,7 +136,7 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
136
136
  tickLine: !1,
137
137
  axisLine: !1
138
138
  }),
139
- /* @__PURE__ */ C(I, {
139
+ /* @__PURE__ */ C(F, {
140
140
  cursor: {
141
141
  fill: "hsl(var(--muted))",
142
142
  opacity: .2
@@ -172,7 +172,7 @@ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
172
172
  })
173
173
  });
174
174
  }
175
- var Fe = H((() => {}));
175
+ var Fe = V((() => {}));
176
176
  //#endregion
177
177
  //#region src/ChartContainerImpl.tsx
178
178
  function Ie() {
@@ -197,7 +197,7 @@ function W({ id: e, className: t, children: n, config: r, ...i }) {
197
197
  children: [/* @__PURE__ */ C(Be, {
198
198
  id: o,
199
199
  config: r
200
- }), /* @__PURE__ */ C(N, {
200
+ }), /* @__PURE__ */ C(P, {
201
201
  width: "100%",
202
202
  height: "100%",
203
203
  children: n
@@ -208,13 +208,13 @@ function W({ id: e, className: t, children: n, config: r, ...i }) {
208
208
  function G({ 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: p }) {
209
209
  let { config: m } = Ie(), h = f.useMemo(() => {
210
210
  if (i || !t?.length) return null;
211
- let [e] = t, n = Le(m, e, `${p || e?.dataKey || e?.name || "value"}`), r = !p && typeof o == "string" ? m[o]?.label || o : n?.label;
211
+ let [e] = t, n = `${p || e?.dataKey || e?.name || "value"}`, r = Le(m, e, n), a = !p && typeof o == "string" ? m[o]?.label || o : r?.label;
212
212
  return s ? /* @__PURE__ */ C("div", {
213
213
  className: q("font-medium", c),
214
- children: s(r, t)
215
- }) : r ? /* @__PURE__ */ C("div", {
214
+ children: s(a, t)
215
+ }) : a ? /* @__PURE__ */ C("div", {
216
216
  className: q("font-medium", c),
217
- children: r
217
+ children: a
218
218
  }) : null;
219
219
  }, [
220
220
  o,
@@ -232,14 +232,14 @@ function G({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
232
232
  children: [g ? null : h, /* @__PURE__ */ C("div", {
233
233
  className: "grid gap-1.5",
234
234
  children: t.filter((e) => e.type !== "none").map((e, t) => {
235
- let n = Le(m, e, `${d || e.name || e.dataKey || "value"}`), i = u || e.payload.fill || e.color;
235
+ let n = `${d || e.name || e.dataKey || "value"}`, i = Le(m, e, n), o = u || e.payload.fill || e.color;
236
236
  return /* @__PURE__ */ C("div", {
237
237
  className: q("[&>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" : ""),
238
- children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ w(S, { children: [n?.icon ? /* @__PURE__ */ C(n.icon, {}) : !a && /* @__PURE__ */ C("div", {
238
+ children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ w(S, { children: [i?.icon ? /* @__PURE__ */ C(i.icon, {}) : !a && /* @__PURE__ */ C("div", {
239
239
  className: q("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" : "", g && r === "dashed" ? "my-0.5" : ""),
240
240
  style: {
241
- "--color-bg": i,
242
- "--color-border": i
241
+ "--color-bg": o,
242
+ "--color-border": o
243
243
  }
244
244
  }), /* @__PURE__ */ w("div", {
245
245
  className: q("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
@@ -247,7 +247,7 @@ function G({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
247
247
  className: "grid gap-1.5",
248
248
  children: [g ? h : null, /* @__PURE__ */ C("span", {
249
249
  className: "text-muted-foreground",
250
- children: n?.label || e.name
250
+ children: i?.label || e.name
251
251
  })]
252
252
  }), e.value && /* @__PURE__ */ C("span", {
253
253
  className: "text-foreground font-mono font-medium tabular-nums",
@@ -264,13 +264,13 @@ function K({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bot
264
264
  return n?.length ? /* @__PURE__ */ C("div", {
265
265
  className: q("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
266
266
  children: n.filter((e) => e.type !== "none").map((e) => {
267
- let n = Le(a, e, `${i || e.dataKey || "value"}`);
267
+ let n = `${i || e.dataKey || "value"}`, r = Le(a, e, n);
268
268
  return /* @__PURE__ */ w("div", {
269
269
  className: q("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
270
- children: [n?.icon && !t ? /* @__PURE__ */ C(n.icon, {}) : /* @__PURE__ */ C("div", {
270
+ children: [r?.icon && !t ? /* @__PURE__ */ C(r.icon, {}) : /* @__PURE__ */ C("div", {
271
271
  className: "h-2 w-2 shrink-0 rounded-[2px]",
272
272
  style: { backgroundColor: e.color }
273
- }), n?.label]
273
+ }), r?.label]
274
274
  }, e.value);
275
275
  })
276
276
  }) : null;
@@ -280,7 +280,7 @@ function Le(e, t, n) {
280
280
  let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
281
281
  return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
282
282
  }
283
- var q, Re, ze, Be, J, Y, Ve = H((() => {
283
+ var q, Re, ze, Be, J, Y, Ve = V((() => {
284
284
  q = (...e) => e.filter(Boolean).join(" "), Re = {
285
285
  light: "",
286
286
  dark: ".dark"
@@ -294,7 +294,7 @@ ${n.map(([e, n]) => {
294
294
  }).join("\n")}
295
295
  }
296
296
  `).join("\n") } }) : null;
297
- }, J = I, Y = k;
297
+ }, J = F, Y = k;
298
298
  }));
299
299
  //#endregion
300
300
  //#region src/chartDrillEvents.ts
@@ -332,7 +332,7 @@ function Ge(e, t) {
332
332
  value: typeof n?.value == "number" ? n.value : void 0
333
333
  };
334
334
  }
335
- var Ke = H((() => {})), qe = /* @__PURE__ */ je({ default: () => Je });
335
+ var Ke = V((() => {})), qe = /* @__PURE__ */ H({ default: () => Je });
336
336
  function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r = "name", series: i = [], className: a = "", colors: o, categoryColors: s, onChartClick: c, isAnimationActive: l }) {
337
337
  let u = e === "column" ? "bar" : e, d = Array.isArray(t) ? t : [], p = l === !1 ? { isAnimationActive: !1 } : {}, [m, h] = f.useState(!1), g = f.useCallback((e) => {
338
338
  if (!c || !e) return;
@@ -393,21 +393,23 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
393
393
  let ce = {
394
394
  bar: E,
395
395
  "horizontal-bar": E,
396
- line: _e,
396
+ line: j,
397
397
  area: de,
398
- pie: A,
399
- donut: A,
400
- radar: M,
401
- scatter: F,
402
- funnel: me,
398
+ pie: M,
399
+ donut: M,
400
+ radar: N,
401
+ scatter: Ce,
402
+ funnel: O,
403
403
  combo: E,
404
404
  treemap: E,
405
405
  sankey: E
406
406
  }[u] || E, le = f.useCallback((e) => {
407
407
  if (e == null || e === "") return "";
408
- let t = typeof e == "string" ? e : String(e);
409
- if (/^\d{4}-\d{2}-\d{2}/.test(t)) {
410
- let e = new Date(t);
408
+ let t = n?.[String(e)]?.label;
409
+ if (t != null) return String(t);
410
+ let i = typeof e == "string" ? e : String(e);
411
+ if (/^\d{4}-\d{2}-\d{2}/.test(i)) {
412
+ let e = new Date(i);
411
413
  if (!Number.isNaN(e.getTime())) {
412
414
  let t = (d.length > 1 ? Math.abs(new Date(String(d[d.length - 1][r] ?? "")).getTime() - new Date(String(d[0][r] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
413
415
  try {
@@ -423,11 +425,12 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
423
425
  }
424
426
  }
425
427
  }
426
- return m && t.length > 8 ? t.slice(0, 8) + "…" : t;
428
+ return m && i.length > 8 ? i.slice(0, 8) + "…" : i;
427
429
  }, [
428
430
  d,
429
431
  r,
430
- m
432
+ m,
433
+ n
431
434
  ]), ue = f.useMemo(() => d.some((e) => String(e[r] || "").length > 5), [d, r]), y = () => Array.isArray(o) && o.length > 0 ? o : [
432
435
  "hsl(var(--chart-1))",
433
436
  "hsl(var(--chart-2))",
@@ -476,12 +479,12 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
476
479
  }), /* @__PURE__ */ C(W, {
477
480
  config: o,
478
481
  className: a,
479
- children: /* @__PURE__ */ w(A, { children: [
482
+ children: /* @__PURE__ */ w(M, { children: [
480
483
  /* @__PURE__ */ C(J, {
481
484
  cursor: !1,
482
485
  content: /* @__PURE__ */ C(G, { hideLabel: !0 })
483
486
  }),
484
- /* @__PURE__ */ C(ve, {
487
+ /* @__PURE__ */ C(ge, {
485
488
  data: d,
486
489
  dataKey: i[0]?.dataKey || "value",
487
490
  nameKey: r || "name",
@@ -491,7 +494,10 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
491
494
  outerRadius: "85%",
492
495
  ...p,
493
496
  ...te,
494
- children: d.map((e, n) => /* @__PURE__ */ C(O, { fill: Z(v(e?.[r], n, t)) }, `cell-${n}`))
497
+ children: d.map((e, n) => {
498
+ let i = v(e?.[r], n, t);
499
+ return /* @__PURE__ */ C(pe, { fill: Z(i) }, `cell-${n}`);
500
+ })
495
501
  }),
496
502
  /* @__PURE__ */ C(Y, {
497
503
  verticalAlign: "bottom",
@@ -523,7 +529,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
523
529
  return /* @__PURE__ */ C(W, {
524
530
  config: n,
525
531
  className: a,
526
- children: /* @__PURE__ */ w(me, { children: [/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }), /* @__PURE__ */ w(pe, {
532
+ children: /* @__PURE__ */ w(O, { children: [/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }), /* @__PURE__ */ w(me, {
527
533
  dataKey: e,
528
534
  data: l,
529
535
  nameKey: r,
@@ -534,7 +540,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
534
540
  fill: "hsl(var(--foreground))",
535
541
  stroke: "none",
536
542
  dataKey: r
537
- }), l.map((e, n) => /* @__PURE__ */ C(O, { fill: Z(t[n % t.length]) }, `funnel-cell-${n}`))]
543
+ }), l.map((e, n) => /* @__PURE__ */ C(pe, { fill: Z(t[n % t.length]) }, `funnel-cell-${n}`))]
538
544
  })] })
539
545
  });
540
546
  }
@@ -543,7 +549,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
543
549
  return /* @__PURE__ */ C(W, {
544
550
  config: n,
545
551
  className: a,
546
- children: /* @__PURE__ */ C(L, {
552
+ children: /* @__PURE__ */ C(we, {
547
553
  data: d.map((n, i) => ({
548
554
  name: String(n?.[r] ?? ""),
549
555
  size: Number(n?.[e]) || 0,
@@ -572,7 +578,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
572
578
  }) : null] });
573
579
  }, {}),
574
580
  ...oe,
575
- children: /* @__PURE__ */ C(I, {})
581
+ children: /* @__PURE__ */ C(F, {})
576
582
  })
577
583
  });
578
584
  }
@@ -585,7 +591,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
585
591
  return c.length === 0 ? /* @__PURE__ */ C("div", { className: a }) : /* @__PURE__ */ C(W, {
586
592
  config: n,
587
593
  className: a,
588
- children: /* @__PURE__ */ C(Se, {
594
+ children: /* @__PURE__ */ C(xe, {
589
595
  data: {
590
596
  nodes: s,
591
597
  links: c
@@ -597,19 +603,19 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
597
603
  },
598
604
  node: { fill: "hsl(var(--chart-1))" },
599
605
  ...se,
600
- children: /* @__PURE__ */ C(I, {})
606
+ children: /* @__PURE__ */ C(F, {})
601
607
  })
602
608
  });
603
609
  }
604
610
  if (u === "radar") return /* @__PURE__ */ C(W, {
605
611
  config: n,
606
612
  className: a,
607
- children: /* @__PURE__ */ w(M, {
613
+ children: /* @__PURE__ */ w(N, {
608
614
  data: d,
609
615
  children: [
610
- /* @__PURE__ */ C(be, {}),
611
- /* @__PURE__ */ C(ye, { dataKey: r }),
612
- /* @__PURE__ */ C(j, {}),
616
+ /* @__PURE__ */ C(ve, {}),
617
+ /* @__PURE__ */ C(_e, { dataKey: r }),
618
+ /* @__PURE__ */ C(ye, {}),
613
619
  /* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
614
620
  /* @__PURE__ */ C(Y, {
615
621
  content: /* @__PURE__ */ C(K, {}),
@@ -623,7 +629,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
623
629
  }),
624
630
  i.map((e) => {
625
631
  let t = Z(n[e.dataKey]?.color || X);
626
- return /* @__PURE__ */ C(xe, {
632
+ return /* @__PURE__ */ C(be, {
627
633
  dataKey: e.dataKey,
628
634
  stroke: t,
629
635
  fill: t,
@@ -636,9 +642,9 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
636
642
  if (u === "scatter") return /* @__PURE__ */ C(W, {
637
643
  config: n,
638
644
  className: a,
639
- children: /* @__PURE__ */ w(F, { children: [
645
+ children: /* @__PURE__ */ w(Ce, { children: [
640
646
  /* @__PURE__ */ C(D, { vertical: !1 }),
641
- /* @__PURE__ */ C(R, {
647
+ /* @__PURE__ */ C(I, {
642
648
  type: "number",
643
649
  dataKey: r,
644
650
  name: String(n[r]?.label || r),
@@ -646,7 +652,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
646
652
  axisLine: !1,
647
653
  minTickGap: m ? 32 : 48
648
654
  }),
649
- /* @__PURE__ */ C(z, {
655
+ /* @__PURE__ */ C(L, {
650
656
  type: "number",
651
657
  dataKey: i[0]?.dataKey || "value",
652
658
  name: String(n[i[0]?.dataKey]?.label || i[0]?.dataKey),
@@ -655,7 +661,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
655
661
  tickFormatter: b,
656
662
  width: 48
657
663
  }),
658
- /* @__PURE__ */ C(Ce, {
664
+ /* @__PURE__ */ C(R, {
659
665
  type: "number",
660
666
  range: [60, 400]
661
667
  }),
@@ -672,7 +678,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
672
678
  }),
673
679
  i.map((e, t) => {
674
680
  let r = y(), i = Z(n[e.dataKey]?.color || r[t % r.length]), a = Q(e, "scatter");
675
- return /* @__PURE__ */ C(P, {
681
+ return /* @__PURE__ */ C(Se, {
676
682
  name: n[e.dataKey]?.label || e.dataKey,
677
683
  data: d,
678
684
  fill: i,
@@ -689,18 +695,18 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
689
695
  data: d,
690
696
  children: [
691
697
  /* @__PURE__ */ C(D, { vertical: !1 }),
692
- /* @__PURE__ */ C(R, {
698
+ /* @__PURE__ */ C(I, {
693
699
  dataKey: r,
694
700
  ...x
695
701
  }),
696
- /* @__PURE__ */ C(z, {
702
+ /* @__PURE__ */ C(L, {
697
703
  yAxisId: "left",
698
704
  tickLine: !1,
699
705
  axisLine: !1,
700
706
  tickFormatter: b,
701
707
  width: 48
702
708
  }),
703
- /* @__PURE__ */ C(z, {
709
+ /* @__PURE__ */ C(L, {
704
710
  yAxisId: "right",
705
711
  orientation: "right",
706
712
  tickLine: !1,
@@ -721,7 +727,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
721
727
  }),
722
728
  i.map((e, t) => {
723
729
  let r = Z(n[e.dataKey]?.color || X), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right", o = Q(e, i);
724
- return i === "line" ? /* @__PURE__ */ C(ge, {
730
+ return i === "line" ? /* @__PURE__ */ C(A, {
725
731
  yAxisId: a,
726
732
  type: "monotone",
727
733
  dataKey: e.dataKey,
@@ -753,11 +759,11 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
753
759
  ]
754
760
  })
755
761
  });
756
- let k = u === "horizontal-bar", N = y(), we = s ? Object.values(s).map((e) => Z(String(e))) : [], Te = Array.from(/* @__PURE__ */ new Set([
757
- ...N,
758
- ...we,
759
- ...i.map((e, t) => Z(n[e.dataKey]?.color || N[t % N.length] || X))
760
- ])), B = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
762
+ let k = u === "horizontal-bar", P = y(), Te = s ? Object.values(s).map((e) => Z(String(e))) : [], Ee = Array.from(/* @__PURE__ */ new Set([
763
+ ...P,
764
+ ...Te,
765
+ ...i.map((e, t) => Z(n[e.dataKey]?.color || P[t % P.length] || X))
766
+ ])), z = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
761
767
  return /* @__PURE__ */ C(W, {
762
768
  config: n,
763
769
  className: a,
@@ -766,8 +772,8 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
766
772
  layout: k ? "vertical" : "horizontal",
767
773
  ..._,
768
774
  children: [
769
- /* @__PURE__ */ C("defs", { children: Te.map((e) => /* @__PURE__ */ w(f.Fragment, { children: [/* @__PURE__ */ w("linearGradient", {
770
- id: `bg-${B(e)}`,
775
+ /* @__PURE__ */ C("defs", { children: Ee.map((e) => /* @__PURE__ */ w(f.Fragment, { children: [/* @__PURE__ */ w("linearGradient", {
776
+ id: `bg-${z(e)}`,
771
777
  x1: "0",
772
778
  y1: "0",
773
779
  x2: "0",
@@ -782,7 +788,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
782
788
  stopOpacity: .5
783
789
  })]
784
790
  }), /* @__PURE__ */ w("linearGradient", {
785
- id: `ag-${B(e)}`,
791
+ id: `ag-${z(e)}`,
786
792
  x1: "0",
787
793
  y1: "0",
788
794
  x2: "0",
@@ -796,24 +802,24 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
796
802
  style: { stopColor: e },
797
803
  stopOpacity: .05
798
804
  })]
799
- })] }, B(e))) }),
805
+ })] }, z(e))) }),
800
806
  /* @__PURE__ */ C(D, { vertical: !1 }),
801
- k ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(R, {
807
+ k ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(I, {
802
808
  type: "number",
803
809
  tickLine: !1,
804
810
  axisLine: !1,
805
811
  tickFormatter: b
806
- }), /* @__PURE__ */ C(z, {
812
+ }), /* @__PURE__ */ C(L, {
807
813
  type: "category",
808
814
  dataKey: r,
809
815
  tickLine: !1,
810
816
  axisLine: !1,
811
817
  width: Math.min(140, Math.max(60, Math.max(...d.map((e) => String(e[r] ?? "").length)) * 7)),
812
818
  tickFormatter: le
813
- })] }) : /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(R, {
819
+ })] }) : /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(I, {
814
820
  dataKey: r,
815
821
  ...x
816
- }), /* @__PURE__ */ C(z, {
822
+ }), /* @__PURE__ */ C(L, {
817
823
  tickLine: !1,
818
824
  axisLine: !1,
819
825
  tickFormatter: b,
@@ -836,16 +842,16 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
836
842
  let t = i.filter((e) => e.variant !== "comparison").length === 1 && !o && i.length === 1 && d.length > 1, n = Q(e, "bar");
837
843
  return /* @__PURE__ */ C(fe, {
838
844
  dataKey: e.dataKey,
839
- fill: `url(#bg-${B(l)})`,
845
+ fill: `url(#bg-${z(l)})`,
840
846
  radius: 4,
841
847
  fillOpacity: n?.fillOpacity,
842
848
  ...p,
843
- children: t && d.map((e, t) => /* @__PURE__ */ C(O, { fill: `url(#bg-${B(Z(v(e?.[r], t, a)))})` }, `cell-${t}`))
849
+ children: t && d.map((e, t) => /* @__PURE__ */ C(pe, { fill: `url(#bg-${z(Z(v(e?.[r], t, a)))})` }, `cell-${t}`))
844
850
  }, e.dataKey);
845
851
  }
846
852
  if (u === "line") {
847
853
  let t = Q(e, "line");
848
- return /* @__PURE__ */ C(ge, {
854
+ return /* @__PURE__ */ C(A, {
849
855
  type: "monotone",
850
856
  dataKey: e.dataKey,
851
857
  stroke: l,
@@ -861,7 +867,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
861
867
  return /* @__PURE__ */ C(T, {
862
868
  type: "monotone",
863
869
  dataKey: e.dataKey,
864
- fill: `url(#ag-${B(l)})`,
870
+ fill: `url(#ag-${z(l)})`,
865
871
  stroke: l,
866
872
  strokeWidth: 2,
867
873
  fillOpacity: t?.fillOpacity ?? 1,
@@ -876,7 +882,7 @@ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
876
882
  })
877
883
  });
878
884
  }
879
- var X, Ye, Z, Q, Xe = H((() => {
885
+ var X, Ye, Z, Q, Xe = V((() => {
880
886
  Ve(), Ke(), X = "hsl(var(--primary))", Ye = {
881
887
  slate: "#64748b",
882
888
  gray: "#6b7280",
@@ -905,7 +911,7 @@ var X, Ye, Z, Q, Xe = H((() => {
905
911
  fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
906
912
  strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
907
913
  } : null;
908
- })), Ze = p.lazy(() => Promise.resolve().then(() => (Fe(), U))), Qe = p.lazy(() => Promise.resolve().then(() => (Xe(), qe))), $e = ({ schema: e }) => /* @__PURE__ */ C(m, {
914
+ })), Ze = p.lazy(() => Promise.resolve().then(() => (Fe(), Me))), Qe = p.lazy(() => Promise.resolve().then(() => (Xe(), qe))), $e = ({ schema: e }) => /* @__PURE__ */ C(m, {
909
915
  fallback: /* @__PURE__ */ C(x, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
910
916
  children: /* @__PURE__ */ C(Ze, {
911
917
  data: e.data,
@@ -1079,11 +1085,11 @@ async function nt(e, t, n, r, i) {
1079
1085
  });
1080
1086
  }
1081
1087
  var rt = (e) => {
1082
- let { schema: f } = e, p = e.onSegmentClick, m = g(Te), x = e.dataSource || m?.dataSource, S = B(f.bind), { fieldOptionLabel: T } = ke(), de = te(T);
1088
+ let { schema: f } = e, p = e.onSegmentClick, m = g(Ee), x = e.dataSource || m?.dataSource, S = z(f.bind), { fieldOptionLabel: T } = Ae(), de = te(T);
1083
1089
  ee(() => {
1084
1090
  de.current = T;
1085
1091
  }, [T]);
1086
- let [fe, E] = v([]), [D, O] = v(() => !(Array.isArray(f.data) && f.data.length > 0) && (!!f.objectName || !!f.dataset)), [pe, me] = v(null), [he, k] = v(null), [ge, _e] = v(null), [ve, A] = v(null), { openRecordList: ye } = Ee(), be = Ae(), j = _(() => f.aggregate ? JSON.stringify(f.aggregate) : "", [f.aggregate]), xe = _(() => f.filter ? JSON.stringify(f.filter) : "", [f.filter]), M = _(() => f.compareTo ? JSON.stringify(f.compareTo) : "", [f.compareTo]), N = _(() => f.dataset ? JSON.stringify({
1092
+ let [fe, E] = v([]), [D, pe] = v(null), [me, O] = v(() => !(Array.isArray(f.data) && f.data.length > 0) && (!!f.objectName || !!f.dataset)), [he, k] = v(null), [A, j] = v(null), [ge, M] = v(null), [_e, ve] = v(null), { openRecordList: ye } = De(), be = je(), N = _(() => f.aggregate ? JSON.stringify(f.aggregate) : "", [f.aggregate]), P = _(() => f.filter ? JSON.stringify(f.filter) : "", [f.filter]), xe = _(() => f.compareTo ? JSON.stringify(f.compareTo) : "", [f.compareTo]), Se = _(() => f.dataset ? JSON.stringify({
1087
1093
  d: f.dataset,
1088
1094
  dim: f.dimensions ?? [],
1089
1095
  val: f.values ?? []
@@ -1091,7 +1097,7 @@ var rt = (e) => {
1091
1097
  f.dataset,
1092
1098
  f.dimensions,
1093
1099
  f.values
1094
- ]), Se = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1100
+ ]), Ce = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1095
1101
  ee(() => {
1096
1102
  let e = !1;
1097
1103
  return (async () => {
@@ -1106,7 +1112,7 @@ var rt = (e) => {
1106
1112
  o = n?.item ?? n?.data ?? n, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
1107
1113
  }
1108
1114
  if (!i || !a) {
1109
- e || (_e(null), A(null));
1115
+ e || (M(null), ve(null));
1110
1116
  return;
1111
1117
  }
1112
1118
  let c = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(i)}`, t)).json().catch(() => null), l = c?.item ?? c?.data ?? c, u = r(l?.fields?.[a]?.options), d = null;
@@ -1118,9 +1124,9 @@ var rt = (e) => {
1118
1124
  }
1119
1125
  Object.keys(e).length > 0 && (d = e);
1120
1126
  }
1121
- e || (_e(u), A(d));
1127
+ e || (M(u), ve(d));
1122
1128
  } catch {
1123
- e || (_e(null), A(null));
1129
+ e || (M(null), ve(null));
1124
1130
  }
1125
1131
  })(), () => {
1126
1132
  e = !0;
@@ -1128,11 +1134,11 @@ var rt = (e) => {
1128
1134
  }, [
1129
1135
  f.objectName,
1130
1136
  f.dataset,
1137
+ Se,
1131
1138
  N,
1132
- j,
1133
1139
  f.xAxisKey
1134
1140
  ]);
1135
- let P = h(async (e, t) => {
1141
+ let F = h(async (e, t) => {
1136
1142
  if (f.aggregate && typeof e.aggregate == "function") {
1137
1143
  let n = f.aggregate.groupBy;
1138
1144
  if (n && typeof n == "object" && !Array.isArray(n)) {
@@ -1161,12 +1167,12 @@ var rt = (e) => {
1161
1167
  return f.aggregate && n.length > 0 && (n = tt(n, f.aggregate)), n;
1162
1168
  }
1163
1169
  return [];
1164
- }, [f.objectName, j]), F = h(async (e, t) => {
1170
+ }, [f.objectName, N]), we = h(async (e, t) => {
1165
1171
  if (!e || !f.objectName && !f.dataset) {
1166
1172
  t.current && O(!1);
1167
1173
  return;
1168
1174
  }
1169
- t.current && (O(!0), me(null));
1175
+ t.current && (O(!0), k(null));
1170
1176
  try {
1171
1177
  if (f.dataset && typeof e.queryDataset == "function") {
1172
1178
  let n = l(f.filter), r = await e.queryDataset(f.dataset, {
@@ -1174,10 +1180,10 @@ var rt = (e) => {
1174
1180
  measures: Array.isArray(f.values) ? f.values : [],
1175
1181
  ...n ? { runtimeFilter: n } : {}
1176
1182
  });
1177
- t.current && E(Array.isArray(r?.rows) ? r.rows : []);
1183
+ t.current && (E(Array.isArray(r?.rows) ? r.rows : []), pe(Array.isArray(r?.fields) ? r.fields : null));
1178
1184
  return;
1179
1185
  }
1180
- let n = l(f.filter), r = f.compareTo, i = !!r && Se(f.chartType), a = i ? d(f.filter, r) : null, [o, s] = await Promise.all([P(e, n), a ? P(e, a) : Promise.resolve([])]), c = o, u = f.aggregate?.groupBy, p = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || f.xAxisKey;
1186
+ let n = l(f.filter), r = f.compareTo, i = !!r && Ce(f.chartType), a = i ? d(f.filter, r) : null, [o, s] = await Promise.all([F(e, n), a ? F(e, a) : Promise.resolve([])]), c = o, u = f.aggregate?.groupBy, p = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || f.xAxisKey;
1181
1187
  if (i && s.length > 0 && f.aggregate) {
1182
1188
  let e = f.aggregate.field, t = f.aggregate.function, n = (n) => {
1183
1189
  if (n == null) return null;
@@ -1223,49 +1229,49 @@ var rt = (e) => {
1223
1229
  } catch {}
1224
1230
  t.current && E(c);
1225
1231
  } catch (e) {
1226
- console.error("[ObjectChart] Fetch error:", e), t.current && me(e instanceof Error ? e.message : "Failed to load chart data");
1232
+ console.error("[ObjectChart] Fetch error:", e), t.current && k(e instanceof Error ? e.message : "Failed to load chart data");
1227
1233
  } finally {
1228
1234
  t.current && O(!1);
1229
1235
  }
1230
1236
  }, [
1231
1237
  f.objectName,
1238
+ Se,
1232
1239
  N,
1233
- j,
1240
+ P,
1234
1241
  xe,
1235
- M,
1236
1242
  f.xAxisKey,
1237
1243
  f.chartType,
1238
- P
1244
+ F
1239
1245
  ]);
1240
1246
  ee(() => {
1241
1247
  let e = { current: !0 };
1242
- return (f.objectName || f.dataset) && !S && !f.data ? F(x, e) : e.current && O(!1), () => {
1248
+ return (f.objectName || f.dataset) && !S && !f.data ? we(x, e) : e.current && O(!1), () => {
1243
1249
  e.current = !1;
1244
1250
  };
1245
1251
  }, [
1246
1252
  f.objectName,
1247
- N,
1253
+ Se,
1248
1254
  x,
1249
1255
  S,
1250
1256
  f.data,
1257
+ P,
1258
+ N,
1251
1259
  xe,
1252
- j,
1253
- M,
1254
- F
1260
+ we
1255
1261
  ]);
1256
- let I = S || f.data || fe, L = Array.isArray(I) ? I : [], R = f.drillDown, z = f.aggregate?.groupBy || f.xAxisKey, Ce = _(() => {
1257
- if (!z) return /* @__PURE__ */ new Map();
1258
- let e = /* @__PURE__ */ new Map(), t = `__raw_${z}`;
1262
+ let I = S || f.data || fe, L = Array.isArray(I) ? I : [], R = f.drillDown, B = f.aggregate?.groupBy || f.xAxisKey, V = _(() => {
1263
+ if (!B) return /* @__PURE__ */ new Map();
1264
+ let e = /* @__PURE__ */ new Map(), t = `__raw_${B}`;
1259
1265
  for (let n of L) {
1260
- let r = n?.[z];
1266
+ let r = n?.[B];
1261
1267
  if (r == null) continue;
1262
1268
  let i = t in (n || {}) ? n[t] : r;
1263
1269
  e.set(String(r), i);
1264
1270
  }
1265
1271
  return e;
1266
- }, [L, z]), V = f.compareTo, H = !!V && Se(f.chartType) && !!f.aggregate && L.some((e) => e[`${f.aggregate.field}__comparison`] != null), je = _(() => {
1272
+ }, [L, B]), H = f.compareTo, Me = !!H && Ce(f.chartType) && !!f.aggregate && L.some((e) => e[`${f.aggregate.field}__comparison`] != null), Ne = _(() => {
1267
1273
  let e = Array.isArray(f.series) ? f.series : null;
1268
- if (!H) return e;
1274
+ if (!Me) return e;
1269
1275
  let t = e || [{ dataKey: f.aggregate.field }], n = {
1270
1276
  vsLastWeek: "Previous week",
1271
1277
  vsLastMonth: "Previous month",
@@ -1273,7 +1279,7 @@ var rt = (e) => {
1273
1279
  vsLastYear: "Previous year",
1274
1280
  vsYesterday: "Yesterday",
1275
1281
  vsPreviousPeriod: "Previous period"
1276
- }[i(V, f.filter)] || "Previous period";
1282
+ }[i(H, f.filter)] || "Previous period";
1277
1283
  return [...t.map((e) => ({
1278
1284
  ...e,
1279
1285
  variant: e.variant || "current"
@@ -1283,12 +1289,12 @@ var rt = (e) => {
1283
1289
  variant: "comparison"
1284
1290
  }];
1285
1291
  }, [
1286
- H,
1292
+ Me,
1287
1293
  f.series,
1288
1294
  f.aggregate,
1289
1295
  f.filter,
1290
- V
1291
- ]), U = f.dataset ? t(c(L, ve), f.dimensions, f.values) : null, Me = U ? {
1296
+ H
1297
+ ]), U = f.dataset ? t(c(L, _e), f.dimensions, f.values, D) : null, Pe = U ? {
1292
1298
  ...f,
1293
1299
  data: U.data,
1294
1300
  xAxisKey: U.xAxisKey,
@@ -1296,16 +1302,16 @@ var rt = (e) => {
1296
1302
  } : {
1297
1303
  ...f,
1298
1304
  data: L,
1299
- ...je ? { series: je } : {}
1300
- }, Ne = f.colors && !Array.isArray(f.colors) && typeof f.colors == "object" ? f.colors : null, Pe = Array.isArray(f.colors) ? f.colors : void 0, Fe = ge || Ne ? {
1305
+ ...Ne ? { series: Ne } : {}
1306
+ }, Fe = f.colors && !Array.isArray(f.colors) && typeof f.colors == "object" ? f.colors : null, Ie = Array.isArray(f.colors) ? f.colors : void 0, W = ge || Fe ? {
1301
1307
  ...ge || {},
1302
- ...Ne || {}
1303
- } : void 0, Ie = {
1304
- ...Me,
1305
- colors: Pe,
1306
- ...Fe ? { categoryColors: Fe } : {}
1308
+ ...Fe || {}
1309
+ } : void 0, G = {
1310
+ ...Pe,
1311
+ colors: Ie,
1312
+ ...W ? { categoryColors: W } : {}
1307
1313
  };
1308
- if (D && L.length === 0) return /* @__PURE__ */ w("div", {
1314
+ if (me && L.length === 0) return /* @__PURE__ */ w("div", {
1309
1315
  className: "p-2 " + (f.className || ""),
1310
1316
  "data-testid": "chart-loading",
1311
1317
  role: "status",
@@ -1316,19 +1322,19 @@ var rt = (e) => {
1316
1322
  children: "Loading chart data…"
1317
1323
  }), /* @__PURE__ */ C(re, { className: "h-full" })]
1318
1324
  });
1319
- if (pe) return /* @__PURE__ */ w("div", {
1325
+ if (he) return /* @__PURE__ */ w("div", {
1320
1326
  className: "flex flex-col items-center justify-center gap-2 p-4 " + (f.className || ""),
1321
1327
  "data-testid": "chart-error",
1322
1328
  role: "alert",
1323
1329
  children: [
1324
- /* @__PURE__ */ C(De, { className: "h-6 w-6 text-destructive opacity-60" }),
1330
+ /* @__PURE__ */ C(Oe, { className: "h-6 w-6 text-destructive opacity-60" }),
1325
1331
  /* @__PURE__ */ C("p", {
1326
1332
  className: "text-xs text-destructive font-medium",
1327
1333
  children: "Failed to load chart data"
1328
1334
  }),
1329
1335
  /* @__PURE__ */ C("p", {
1330
1336
  className: "text-xs text-muted-foreground max-w-xs text-center",
1331
- children: pe
1337
+ children: he
1332
1338
  })
1333
1339
  ]
1334
1340
  });
@@ -1341,22 +1347,22 @@ var rt = (e) => {
1341
1347
  "”"
1342
1348
  ]
1343
1349
  });
1344
- let W = s(R) ? (e) => {
1345
- let t = e.category, n = t != null && Ce.has(String(t)) ? Ce.get(String(t)) : t;
1346
- k({
1350
+ let K = s(R) ? (e) => {
1351
+ let t = e.category, n = t != null && V.has(String(t)) ? V.get(String(t)) : t;
1352
+ j({
1347
1353
  ...e,
1348
1354
  category: n,
1349
1355
  categoryLabel: t,
1350
1356
  scope: "cell"
1351
1357
  });
1352
- } : void 0, G = p ?? W, K = !p && he && f.objectName ? (() => {
1353
- let e = a(R, he, { groupByField: z }), t = {
1358
+ } : void 0, Le = p ?? K, q = !p && A && f.objectName ? (() => {
1359
+ let e = a(R, A, { groupByField: B }), t = {
1354
1360
  ...f.filter || {},
1355
1361
  ...e
1356
- }, n = u(R, he, f.title || "Details"), r = R?.target ?? "drawer", i = /* @__PURE__ */ C("div", {
1362
+ }, n = u(R, A, f.title || "Details"), r = R?.target ?? "drawer", i = /* @__PURE__ */ C("div", {
1357
1363
  className: "overflow-auto",
1358
1364
  "data-testid": "chart-drill-body",
1359
- children: /* @__PURE__ */ C(we, {
1365
+ children: /* @__PURE__ */ C(Te, {
1360
1366
  schema: {
1361
1367
  type: "object-data-table",
1362
1368
  objectName: f.objectName,
@@ -1381,13 +1387,13 @@ var rt = (e) => {
1381
1387
  size: "sm",
1382
1388
  "data-testid": "drill-open-in-list",
1383
1389
  onClick: () => {
1384
- ye(f.objectName, t), k(null);
1390
+ ye(f.objectName, t), j(null);
1385
1391
  },
1386
- children: [be("dashboard.openInList", "Open in list"), /* @__PURE__ */ C(Oe, { className: "ml-1 h-3.5 w-3.5" })]
1392
+ children: [be("dashboard.openInList", "Open in list"), /* @__PURE__ */ C(ke, { className: "ml-1 h-3.5 w-3.5" })]
1387
1393
  }) : null;
1388
1394
  return r === "dialog" ? /* @__PURE__ */ C(ie, {
1389
1395
  open: !0,
1390
- onOpenChange: (e) => !e && k(null),
1396
+ onOpenChange: (e) => !e && j(null),
1391
1397
  children: /* @__PURE__ */ w(ae, {
1392
1398
  className: "max-w-4xl",
1393
1399
  children: [/* @__PURE__ */ w(oe, {
@@ -1397,7 +1403,7 @@ var rt = (e) => {
1397
1403
  })
1398
1404
  }) : /* @__PURE__ */ C(le, {
1399
1405
  open: !0,
1400
- onOpenChange: (e) => !e && k(null),
1406
+ onOpenChange: (e) => !e && j(null),
1401
1407
  children: /* @__PURE__ */ w(ue, {
1402
1408
  side: "right",
1403
1409
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
@@ -1414,13 +1420,13 @@ var rt = (e) => {
1414
1420
  return /* @__PURE__ */ w("div", {
1415
1421
  className: "relative",
1416
1422
  children: [
1417
- /* @__PURE__ */ C(ce, { active: D && L.length > 0 }),
1423
+ /* @__PURE__ */ C(ce, { active: me && L.length > 0 }),
1418
1424
  /* @__PURE__ */ C($, {
1419
1425
  ...e,
1420
- schema: Ie,
1421
- onChartClick: G
1426
+ schema: G,
1427
+ onChartClick: Le
1422
1428
  }),
1423
- K
1429
+ q
1424
1430
  ]
1425
1431
  });
1426
1432
  };
@@ -1528,6 +1534,7 @@ e.register("bar-chart", $e, {
1528
1534
  namespace: "view",
1529
1535
  category: "view",
1530
1536
  label: "Chart",
1537
+ skipFallback: !0,
1531
1538
  inputs: [
1532
1539
  {
1533
1540
  name: "objectName",
@@ -1,7 +1,7 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("react/jsx-runtime"),require("recharts"),require("@object-ui/react"),require("lucide-react"),require("@object-ui/i18n")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`recharts`,`@object-ui/react`,`lucide-react`,`@object-ui/i18n`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginCharts={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.recharts,e.ObjectUIReact,e.lucide_react,e._object_ui_i18n))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},g=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:l(p(e)),_(t||!e||!e.__esModule?u(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v=g({default:()=>x});function y(e,t=14){return e.length>t?`${e.slice(0,t-1)}…`:e}function b({x:e,y:t,payload:n}){let r=String(n?.value??``),a=y(r);return(0,i.jsx)(`g`,{transform:`translate(${e},${t})`,children:(0,i.jsxs)(`text`,{dy:10,textAnchor:`end`,transform:`rotate(-32)`,fill:`hsl(var(--muted-foreground))`,fontSize:11,fontFamily:`monospace`,children:[r!==a&&(0,i.jsx)(`title`,{children:r}),a]})})}function x({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:o=``,color:s=`hsl(var(--primary))`}){let c=e.map(e=>String(e?.[n]??``)),l=c.length>4||c.some(e=>e.length>8);return(0,i.jsx)(`div`,{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 ${o}`,children:(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:r,children:(0,i.jsxs)(a.BarChart,{data:e,margin:{top:10,right:10,left:10,bottom:l?24:5},children:[(0,i.jsxs)(`defs`,{children:[(0,i.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:1}),(0,i.jsx)(`stop`,{offset:`90%`,stopColor:s,stopOpacity:.6}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:.3})]}),(0,i.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,i.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,i.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,i.jsx)(`feFlood`,{floodColor:s,floodOpacity:`0.5`,result:`offsetColor`}),(0,i.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,i.jsxs)(`feMerge`,{children:[(0,i.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,i.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,i.jsx)(a.CartesianGrid,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:n,tick:l?(0,i.jsx)(b,{}):{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},interval:0,height:l?56:void 0,dy:l?void 0:10}),(0,i.jsx)(a.YAxis,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,i.jsx)(a.Tooltip,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,i.jsx)(a.Legend,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,i.jsx)(a.Bar,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var S=h((()=>{}));function C(){let e=n.useContext(A);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function w({id:e,className:t,children:r,config:o,...s}){let c=n.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,i.jsx)(A.Provider,{value:{config:o},children:(0,i.jsxs)(`div`,{"data-slot":`chart`,"data-chart":l,className:O(`block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),style:{minHeight:280,minWidth:0,...s.style},...s,children:[(0,i.jsx)(j,{id:l,config:o}),(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:r})]})})}function T({active:e,payload:t,className:r,indicator:a=`dot`,hideLabel:o=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m}){let{config:h}=C(),g=n.useMemo(()=>{if(o||!t?.length)return null;let[e]=t,n=D(h,e,`${m||e?.dataKey||e?.name||`value`}`),r=!m&&typeof c==`string`?h[c]?.label||c:n?.label;return l?(0,i.jsx)(`div`,{className:O(`font-medium`,u),children:l(r,t)}):r?(0,i.jsx)(`div`,{className:O(`font-medium`,u),children:r}):null},[c,l,t,o,u,h,m]);if(!e||!t?.length)return null;let _=t.length===1&&a!==`dot`;return(0,i.jsxs)(`div`,{className:O(`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`,r),children:[_?null:g,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=D(h,e,`${p||e.name||e.dataKey||`value`}`),r=f||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:O(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,a===`dot`?`items-center`:``),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[n?.icon?(0,i.jsx)(n.icon,{}):!s&&(0,i.jsx)(`div`,{className:O(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,a===`dot`?`h-2.5 w-2.5`:``,a===`line`?`w-1`:``,a===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,_&&a===`dashed`?`my-0.5`:``),style:{"--color-bg":r,"--color-border":r}}),(0,i.jsxs)(`div`,{className:O(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}function E({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:a}){let{config:o}=C();return n?.length?(0,i.jsx)(`div`,{className:O(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=D(o,e,`${a||e.dataKey||`value`}`);return(0,i.jsxs)(`div`,{className:O(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[n?.icon&&!t?(0,i.jsx)(n.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null}function D(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var O,k,A,j,M,N,P=h((()=>{O=(...e)=>e.filter(Boolean).join(` `),k={light:``,dark:`.dark`},A=n.createContext(null),j=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(k).map(([t,r])=>`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("react/jsx-runtime"),require("recharts"),require("@object-ui/react"),require("lucide-react"),require("@object-ui/i18n")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`recharts`,`@object-ui/react`,`lucide-react`,`@object-ui/i18n`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginCharts={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.recharts,e.ObjectUIReact,e.lucide_react,e._object_ui_i18n))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},g=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:l(p(e)),_(t||!e||!e.__esModule?u(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v=g({default:()=>x});function y(e,t=14){return e.length>t?`${e.slice(0,t-1)}…`:e}function b({x:e,y:t,payload:n}){let r=String(n?.value??``),a=y(r);return(0,i.jsx)(`g`,{transform:`translate(${e},${t})`,children:(0,i.jsxs)(`text`,{dy:10,textAnchor:`end`,transform:`rotate(-32)`,fill:`hsl(var(--muted-foreground))`,fontSize:11,fontFamily:`monospace`,children:[r!==a&&(0,i.jsx)(`title`,{children:r}),a]})})}function x({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:o=``,color:s=`hsl(var(--primary))`}){let c=e.map(e=>String(e?.[n]??``)),l=c.length>4||c.some(e=>e.length>8);return(0,i.jsx)(`div`,{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 ${o}`,children:(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:r,children:(0,i.jsxs)(a.BarChart,{data:e,margin:{top:10,right:10,left:10,bottom:l?24:5},children:[(0,i.jsxs)(`defs`,{children:[(0,i.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:1}),(0,i.jsx)(`stop`,{offset:`90%`,stopColor:s,stopOpacity:.6}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:.3})]}),(0,i.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,i.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,i.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,i.jsx)(`feFlood`,{floodColor:s,floodOpacity:`0.5`,result:`offsetColor`}),(0,i.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,i.jsxs)(`feMerge`,{children:[(0,i.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,i.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,i.jsx)(a.CartesianGrid,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:n,tick:l?(0,i.jsx)(b,{}):{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},interval:0,height:l?56:void 0,dy:l?void 0:10}),(0,i.jsx)(a.YAxis,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,i.jsx)(a.Tooltip,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,i.jsx)(a.Legend,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,i.jsx)(a.Bar,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var S=h((()=>{}));function C(){let e=n.useContext(A);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function w({id:e,className:t,children:r,config:o,...s}){let c=n.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,i.jsx)(A.Provider,{value:{config:o},children:(0,i.jsxs)(`div`,{"data-slot":`chart`,"data-chart":l,className:O(`block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),style:{minHeight:280,minWidth:0,...s.style},...s,children:[(0,i.jsx)(j,{id:l,config:o}),(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:r})]})})}function T({active:e,payload:t,className:r,indicator:a=`dot`,hideLabel:o=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m}){let{config:h}=C(),g=n.useMemo(()=>{if(o||!t?.length)return null;let[e]=t,n=`${m||e?.dataKey||e?.name||`value`}`,r=D(h,e,n),a=!m&&typeof c==`string`?h[c]?.label||c:r?.label;return l?(0,i.jsx)(`div`,{className:O(`font-medium`,u),children:l(a,t)}):a?(0,i.jsx)(`div`,{className:O(`font-medium`,u),children:a}):null},[c,l,t,o,u,h,m]);if(!e||!t?.length)return null;let _=t.length===1&&a!==`dot`;return(0,i.jsxs)(`div`,{className:O(`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`,r),children:[_?null:g,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=`${p||e.name||e.dataKey||`value`}`,r=D(h,e,n),o=f||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:O(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,a===`dot`?`items-center`:``),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[r?.icon?(0,i.jsx)(r.icon,{}):!s&&(0,i.jsx)(`div`,{className:O(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,a===`dot`?`h-2.5 w-2.5`:``,a===`line`?`w-1`:``,a===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,_&&a===`dashed`?`my-0.5`:``),style:{"--color-bg":o,"--color-border":o}}),(0,i.jsxs)(`div`,{className:O(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:r?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}function E({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:a}){let{config:o}=C();return n?.length?(0,i.jsx)(`div`,{className:O(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=`${a||e.dataKey||`value`}`,r=D(o,e,n);return(0,i.jsxs)(`div`,{className:O(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[r?.icon&&!t?(0,i.jsx)(r.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),r?.label]},e.value)})}):null}function D(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var O,k,A,j,M,N,P=h((()=>{O=(...e)=>e.filter(Boolean).join(` `),k={light:``,dark:`.dark`},A=n.createContext(null),j=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(k).map(([t,r])=>`
2
2
  ${r} [data-chart=${e}] {
3
3
  ${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
4
4
  `)}
5
5
  }
6
6
  `).join(`
7
- `)}}):null},M=a.Tooltip,N=a.Legend}));function F(e){return e?.[0]?.dataKey||`value`}function I(e,t,n){if(!e)return null;let r=e.payload??e,i=r?.[t];if(i==null)return null;let a=F(n);return{category:String(i),series:a,value:typeof r?.[a]==`number`?r[a]:void 0}}function L(e,t){if(!e)return null;let n=e.name??e.payload?.name??e.root?.name;if(n==null)return null;let r=e.value??e.size??e.payload?.size;return{category:String(n),series:F(t),value:typeof r==`number`?r:void 0}}function R(e,t){if(!e)return null;let n=e.payload??e,r=n?.name;return r==null||n?.depth===0?null:{category:String(r),series:F(t),value:typeof n?.value==`number`?n.value:void 0}}var z=h((()=>{})),B=g({default:()=>V});function V({chartType:e=`bar`,data:t=[],config:r={},xAxisKey:o=`name`,series:s=[],className:c=``,colors:l,categoryColors:u,onChartClick:d,isAnimationActive:f}){let p=e===`column`?`bar`:e,m=Array.isArray(t)?t:[],h=f===!1?{isAnimationActive:!1}:{},[g,_]=n.useState(!1),v=n.useCallback(e=>{if(!d||!e)return;let t=Array.isArray(e.activePayload)?e.activePayload[0]:void 0;d({category:e.activeLabel==null?void 0:String(e.activeLabel),series:t?.dataKey?String(t.dataKey):void 0,value:typeof t?.value==`number`?t.value:void 0})},[d]),y=n.useCallback(e=>{if(!d||!e)return;let t=e.payload?.[o],n=s[0]?.dataKey||`value`;d({category:t==null?void 0:String(t),series:n,value:typeof e.payload?.[n]==`number`?e.payload[n]:void 0})},[d,o,s]),b=d?{onClick:v,style:{cursor:`pointer`}}:{},x=d?{onClick:y,style:{cursor:`pointer`}}:{},S=n.useCallback((e,t,n)=>u&&u[e==null?``:String(e)]||n[t%n.length],[u]),C=n.useCallback(e=>{if(!d)return;let t=I(e,o,s);t&&d(t)},[d,o,s]),D=n.useCallback(e=>{if(!d)return;let t=L(e,s);t&&d(t)},[d,s]),O=n.useCallback(e=>{if(!d)return;let t=R(e,s);t&&d(t)},[d,s]),k=d?{onClick:C,cursor:`pointer`}:{},A=d?{onClick:D,style:{cursor:`pointer`}}:{},j=d?{onClick:O,style:{cursor:`pointer`}}:{};n.useEffect(()=>{let e=()=>_(window.innerWidth<640);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let P={bar:a.BarChart,"horizontal-bar":a.BarChart,line:a.LineChart,area:a.AreaChart,pie:a.PieChart,donut:a.PieChart,radar:a.RadarChart,scatter:a.ScatterChart,funnel:a.FunnelChart,combo:a.BarChart,treemap:a.BarChart,sankey:a.BarChart}[p]||a.BarChart,F=n.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`string`?e:String(e);if(/^\d{4}-\d{2}-\d{2}/.test(t)){let e=new Date(t);if(!Number.isNaN(e.getTime())){let t=(m.length>1?Math.abs(new Date(String(m[m.length-1][o]??``)).getTime()-new Date(String(m[0][o]??``)).getTime()):0)/(1e3*60*60*24);try{return t<=62?e.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):e.toLocaleDateString(void 0,{month:`short`,year:`numeric`})}catch{return e.toISOString().slice(0,10)}}}return g&&t.length>8?t.slice(0,8)+`…`:t},[m,o,g]),z=n.useMemo(()=>m.some(e=>String(e[o]||``).length>5),[m,o]),B=()=>Array.isArray(l)&&l.length>0?l:[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],V=n.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`number`?e:Number(e);if(!Number.isFinite(t))return String(e);try{return new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(t)}catch{return String(t)}},[]),U=n.useMemo(()=>({tickLine:!1,tickMargin:10,axisLine:!1,interval:`preserveStartEnd`,minTickGap:g?32:48,tickFormatter:F,...!g&&z&&{angle:-35,textAnchor:`end`,height:60}}),[g,z,F]);if(p===`pie`||p===`donut`){let e=p===`donut`?`52%`:0,t=B(),n={...r};return m.forEach((e,r)=>{let i=e?.[o];if(i==null||i===``)return;let a=String(i);n[a]||(n[a]={label:a,color:S(i,r,t)})}),(0,i.jsx)(w,{config:n,className:c,children:(0,i.jsxs)(a.PieChart,{children:[(0,i.jsx)(M,{cursor:!1,content:(0,i.jsx)(T,{hideLabel:!0})}),(0,i.jsx)(a.Pie,{data:m,dataKey:s[0]?.dataKey||`value`,nameKey:o||`name`,innerRadius:e,strokeWidth:5,paddingAngle:2,outerRadius:`85%`,...h,...x,children:m.map((e,n)=>(0,i.jsx)(a.Cell,{fill:W(S(e?.[o],n,t))},`cell-${n}`))}),(0,i.jsx)(N,{verticalAlign:`bottom`,wrapperStyle:{fontSize:g?`11px`:`12px`,paddingTop:`8px`},content:(0,i.jsx)(E,{nameKey:o,className:`flex-wrap`})})]})})}if(p===`funnel`){let e=s[0]?.dataKey||`value`,t=B(),n=d?t=>{t&&d({category:t?.payload?.[o]??t?.[o],value:t?.payload?.[e]??t?.[e]})}:void 0,l=n?{onClick:n,style:{cursor:`pointer`}}:{},u=[...m].sort((t,n)=>{let r=Number(t?.[e]??0);return Number(n?.[e]??0)-r});return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.FunnelChart,{children:[(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsxs)(a.Funnel,{dataKey:e,data:u,nameKey:o,isAnimationActive:!0,...l,children:[(0,i.jsx)(a.LabelList,{position:`right`,fill:`hsl(var(--foreground))`,stroke:`none`,dataKey:o}),u.map((e,n)=>(0,i.jsx)(a.Cell,{fill:W(t[n%t.length])},`funnel-cell-${n}`))]})]})})}if(p===`treemap`){let e=s[0]?.dataKey||`value`,t=B(),n=m.map((n,r)=>({name:String(n?.[o]??``),size:Number(n?.[e])||0,fill:W(t[r%t.length])}));return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsx)(a.Treemap,{data:n,dataKey:`size`,nameKey:`name`,isAnimationActive:!0,content:(0,i.jsx)(e=>{let{x:t,y:n,width:r,height:a,name:o,fill:s}=e;return r<=0||a<=0?null:(0,i.jsxs)(`g`,{children:[(0,i.jsx)(`rect`,{x:t,y:n,width:r,height:a,fill:s,stroke:`hsl(var(--background))`,strokeWidth:2}),r>48&&a>18?(0,i.jsx)(`text`,{x:t+6,y:n+18,fill:`#fff`,fontSize:12,className:`pointer-events-none`,children:o}):null]})},{}),...A,children:(0,i.jsx)(a.Tooltip,{})})})}if(p===`sankey`){let e=s[0]?.dataKey||`value`,t=s[0]?.label||e,n=m.filter(t=>(Number(t?.[e])||0)>0),l=[{name:t},...n.map(e=>({name:String(e?.[o]??``)}))],u=n.map((t,n)=>({source:0,target:n+1,value:Number(t?.[e])||0}));return u.length===0?(0,i.jsx)(`div`,{className:c}):(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsx)(a.Sankey,{data:{nodes:l,links:u},nodePadding:24,link:{stroke:`hsl(var(--muted-foreground))`,strokeOpacity:.25},node:{fill:`hsl(var(--chart-1))`},...j,children:(0,i.jsx)(a.Tooltip,{})})})}if(p===`radar`)return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.RadarChart,{data:m,children:[(0,i.jsx)(a.PolarGrid,{}),(0,i.jsx)(a.PolarAngleAxis,{dataKey:o}),(0,i.jsx)(a.PolarRadiusAxis,{}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map(e=>{let t=W(r[e.dataKey]?.color||H);return(0,i.jsx)(a.Radar,{dataKey:e.dataKey,stroke:t,fill:t,fillOpacity:.6},e.dataKey)})]})});if(p===`scatter`)return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.ScatterChart,{children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{type:`number`,dataKey:o,name:String(r[o]?.label||o),tickLine:!1,axisLine:!1,minTickGap:g?32:48}),(0,i.jsx)(a.YAxis,{type:`number`,dataKey:s[0]?.dataKey||`value`,name:String(r[s[0]?.dataKey]?.label||s[0]?.dataKey),tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,i.jsx)(a.ZAxis,{type:`number`,range:[60,400]}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=B(),o=W(r[e.dataKey]?.color||n[t%n.length]),s=G(e,`scatter`);return(0,i.jsx)(a.Scatter,{name:r[e.dataKey]?.label||e.dataKey,data:m,fill:o,fillOpacity:s?.fillOpacity,...k},e.dataKey)})]})});if(p===`combo`)return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.BarChart,{data:m,children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:o,...U}),(0,i.jsx)(a.YAxis,{yAxisId:`left`,tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,i.jsx)(a.YAxis,{yAxisId:`right`,orientation:`right`,tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=W(r[e.dataKey]?.color||H),o=e.chartType||(t===0?`bar`:`line`),s=o===`bar`?`left`:`right`,c=G(e,o);return o===`line`?(0,i.jsx)(a.Line,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,stroke:n,strokeWidth:2,dot:!1,strokeOpacity:c?.strokeOpacity,strokeDasharray:c?.strokeDasharray,...h},e.dataKey):o===`area`?(0,i.jsx)(a.Area,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,fill:n,stroke:n,fillOpacity:c?.fillOpacity??.4,strokeOpacity:c?.strokeOpacity,strokeDasharray:c?.strokeDasharray,...h},e.dataKey):(0,i.jsx)(a.Bar,{yAxisId:s,dataKey:e.dataKey,fill:n,radius:4,fillOpacity:c?.fillOpacity,...h},e.dataKey)})]})});let K=p===`horizontal-bar`,q=B(),J=u?Object.values(u).map(e=>W(String(e))):[],Y=Array.from(new Set([...q,...J,...s.map((e,t)=>W(r[e.dataKey]?.color||q[t%q.length]||H))])),X=e=>`g`+e.replace(/[^a-zA-Z0-9]/g,``);return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(P,{data:m,layout:K?`vertical`:`horizontal`,...b,children:[(0,i.jsx)(`defs`,{children:Y.map(e=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsxs)(`linearGradient`,{id:`bg-${X(e)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,style:{stopColor:e},stopOpacity:.95}),(0,i.jsx)(`stop`,{offset:`100%`,style:{stopColor:e},stopOpacity:.5})]}),(0,i.jsxs)(`linearGradient`,{id:`ag-${X(e)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,style:{stopColor:e},stopOpacity:.5}),(0,i.jsx)(`stop`,{offset:`95%`,style:{stopColor:e},stopOpacity:.05})]})]},X(e)))}),(0,i.jsx)(a.CartesianGrid,{vertical:!1}),K?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.XAxis,{type:`number`,tickLine:!1,axisLine:!1,tickFormatter:V}),(0,i.jsx)(a.YAxis,{type:`category`,dataKey:o,tickLine:!1,axisLine:!1,width:Math.min(140,Math.max(60,Math.max(...m.map(e=>String(e[o]??``).length))*7)),tickFormatter:F})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.XAxis,{dataKey:o,...U}),(0,i.jsx)(a.YAxis,{tickLine:!1,axisLine:!1,tickFormatter:V,width:48})]}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=B(),c=e.variant===`comparison`,l=c?s.slice(0,t).find(e=>e.variant!==`comparison`)||s[0]:e,u=c?s.indexOf(l):t,d=W(r[l.dataKey]?.color||n[u%n.length]||H);if(p===`bar`||p===`horizontal-bar`){let t=s.filter(e=>e.variant!==`comparison`).length===1&&!c&&s.length===1&&m.length>1,r=G(e,`bar`);return(0,i.jsx)(a.Bar,{dataKey:e.dataKey,fill:`url(#bg-${X(d)})`,radius:4,fillOpacity:r?.fillOpacity,...h,children:t&&m.map((e,t)=>(0,i.jsx)(a.Cell,{fill:`url(#bg-${X(W(S(e?.[o],t,n)))})`},`cell-${t}`))},e.dataKey)}if(p===`line`){let t=G(e,`line`);return(0,i.jsx)(a.Line,{type:`monotone`,dataKey:e.dataKey,stroke:d,strokeWidth:2,dot:!1,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray,...h},e.dataKey)}if(p===`area`){let t=G(e,`area`);return(0,i.jsx)(a.Area,{type:`monotone`,dataKey:e.dataKey,fill:`url(#ag-${X(d)})`,stroke:d,strokeWidth:2,fillOpacity:t?.fillOpacity??1,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray,...h},e.dataKey)}return null})]})})}var H,U,W,G,K=h((()=>{P(),z(),H=`hsl(var(--primary))`,U={slate:`#64748b`,gray:`#6b7280`,zinc:`#71717a`,neutral:`#737373`,stone:`#78716c`,red:`#ef4444`,orange:`#f97316`,amber:`#f59e0b`,yellow:`#eab308`,lime:`#84cc16`,green:`#22c55e`,emerald:`#10b981`,teal:`#14b8a6`,cyan:`#06b6d4`,sky:`#0ea5e9`,blue:`#3b82f6`,indigo:`#6366f1`,violet:`#8b5cf6`,purple:`#a855f7`,fuchsia:`#d946ef`,pink:`#ec4899`,rose:`#f43f5e`},W=e=>U[e]||e,G=(e,t)=>e?.variant===`comparison`?{strokeOpacity:typeof e.opacity==`number`?e.opacity:t===`line`||t===`scatter`?.5:.6,fillOpacity:typeof e.opacity==`number`?e.opacity:t===`bar`?.4:t===`area`?.2:.5,strokeDasharray:e.dashArray??(t===`line`||t===`area`?`4 4`:void 0)}:null})),q=n.default.lazy(()=>Promise.resolve().then(()=>(S(),v))),J=n.default.lazy(()=>Promise.resolve().then(()=>(K(),B))),Y=({schema:e})=>(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(q,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),X=({schema:e,onChartClick:t})=>{let a=n.default.useMemo(()=>{let t=e.series,n=e.xAxisKey,r=e.config;if(n||(e.index?n=e.index:e.category&&(n=e.category)),t||(e.categories?t=e.categories.map(e=>({dataKey:e})):e.value&&(t=[{dataKey:e.value}])),!r&&t){let n=e.colors||[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`],i={};t.forEach((e,t)=>{i[e.dataKey]={label:e.label||e.dataKey,color:n[t%n.length]}}),r=i}return{chartType:e.chartType,data:Array.isArray(e.data)?e.data:[],config:r,xAxisKey:n,series:t,className:e.className}},[e]);return(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(J,{chartType:a.chartType,data:a.data,config:a.config,xAxisKey:a.xAxisKey,series:a.series,className:a.className,colors:Array.isArray(e.colors)?e.colors:void 0,categoryColors:e.categoryColors,isAnimationActive:e.isAnimationActive,onChartClick:t})})};function Z(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ee(e,t){let{field:n,function:r,groupBy:i}=t,a={};for(let t of e){let e=String(t[i]??`Unknown`);a[e]||(a[e]=[]),a[e].push(t)}return Object.entries(a).map(([e,t])=>{let a=t.map(e=>Number(e[n])||0),o;switch(r){case`count`:o=t.length;break;case`avg`:o=a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0;break;case`min`:o=a.length>0?Math.min(...a):0;break;case`max`:o=a.length>0?Math.max(...a):0;break;default:o=a.reduce((e,t)=>e+t,0);break}return{[i]:e,[n]:o}})}async function te(e,n,r,i,a){if(!e.length||!n)return e;let o=a||((e,t)=>t),s=`__raw_${n}`,c=r?.fields?.[n];if(!c){let t=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let r=e[n],i=String(r??``),a=t.test(i)?i:Z(i);return{...e,[n]:o(i,a),[s]:r}})}let l=c.type;if(l===`select`||l===`picklist`||l===`dropdown`){let t=c.options||[];if(t.length===0)return e.map(e=>{let t=e[n],r=String(t??``),i=Z(r);return{...e,[n]:o(r,i),[s]:t}});let r={};for(let e of t)typeof e==`string`?r[e]=e:e&&typeof e==`object`&&(r[String(e.value)]=e.label||String(e.value));return e.map(e=>{let t=e[n],i=String(t??``),a=r[i]||Z(i);return{...e,[n]:o(i,a),[s]:t}})}if(l===`lookup`||l===`master_detail`){let r=c.reference_to||c.reference;if(!r||!i||typeof i.find!=`function`)return e.map(e=>({...e,[s]:e[n]}));let a=[...new Set(e.map(e=>e[n]).filter(e=>e!=null))];if(a.length===0)return e.map(e=>({...e,[s]:e[n]}));let o=c.id_field||`id`;try{let l=(0,t.extractRecords)(await i.find(r,{$filter:{[o]:{$in:a}},$top:a.length})),u=c.reference_field||c.display_field||`name`,d={};for(let e of l){let t=String(e[o]??e.id??e._id??``),n=e[u]||e.name||e.label||e.title||t;t&&(d[t]=String(n))}return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:d[r]||r,[s]:t}})}catch(t){return console.warn(`[ObjectChart] Failed to resolve lookup labels:`,t),e.map(e=>({...e,[s]:e[n]}))}}if(l===`date`||l===`datetime`||l===`date_time`||l===`timestamp`||l===`time`)return e.map(e=>({...e,[s]:e[n]}));let u=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:u.test(r)?r:Z(r),[s]:t}})}var Q=e=>{let{schema:a}=e,l=e.onSegmentClick,u=(0,n.useContext)(o.SchemaRendererContext),d=e.dataSource||u?.dataSource,f=(0,o.useDataScope)(a.bind),{fieldOptionLabel:p}=(0,c.useSafeFieldLabel)(),m=(0,n.useRef)(p);(0,n.useEffect)(()=>{m.current=p},[p]);let[h,g]=(0,n.useState)([]),[_,v]=(0,n.useState)(()=>!(Array.isArray(a.data)&&a.data.length>0)&&(!!a.objectName||!!a.dataset)),[y,b]=(0,n.useState)(null),[x,S]=(0,n.useState)(null),[C,w]=(0,n.useState)(null),[T,E]=(0,n.useState)(null),{openRecordList:D}=(0,o.useDrillNavigation)(),O=(0,c.useSafeTranslate)(),k=(0,n.useMemo)(()=>a.aggregate?JSON.stringify(a.aggregate):``,[a.aggregate]),A=(0,n.useMemo)(()=>a.filter?JSON.stringify(a.filter):``,[a.filter]),j=(0,n.useMemo)(()=>a.compareTo?JSON.stringify(a.compareTo):``,[a.compareTo]),M=(0,n.useMemo)(()=>a.dataset?JSON.stringify({d:a.dataset,dim:a.dimensions??[],val:a.values??[]}):``,[a.dataset,a.dimensions,a.values]),N=e=>e!==`pie`&&e!==`donut`&&e!==`funnel`;(0,n.useEffect)(()=>{let e=!1;return(async()=>{try{let n={headers:{accept:`application/json`},credentials:`include`},r=a.objectName,i,o=null,s=a.aggregate?.groupBy;if(r)i=s&&typeof s==`object`&&!Array.isArray(s)?s.field:typeof s==`string`?s:a.xAxisKey;else if(a.dataset){let e=Array.isArray(a.dimensions)&&a.dimensions.length?a.dimensions[0]:void 0,t=await(await fetch(`/api/v1/meta/dataset/${encodeURIComponent(a.dataset)}`,n)).json().catch(()=>null);o=t?.item??t?.data??t,r=o?.object,i=((o?.dimensions||[]).find(t=>t?.name===e)??(o?.dimensions||[])[0])?.field??e}if(!r||!i){e||(w(null),E(null));return}let c=await(await fetch(`/api/v1/meta/object/${encodeURIComponent(r)}`,n)).json().catch(()=>null),l=c?.item??c?.data??c,u=(0,t.buildOptionColorMap)(l?.fields?.[i]?.options),d=null;if(a.dataset&&Array.isArray(a.dimensions)){let e={};for(let n of a.dimensions){let r=(o?.dimensions||[]).find(e=>e?.name===n)?.field??n,i=(0,t.buildDimensionLabelMap)(l?.fields?.[r]?.options);i&&(e[n]=i)}Object.keys(e).length>0&&(d=e)}e||(w(u),E(d))}catch{e||(w(null),E(null))}})(),()=>{e=!0}},[a.objectName,a.dataset,M,k,a.xAxisKey]);let P=(0,n.useCallback)(async(e,n)=>{if(a.aggregate&&typeof e.aggregate==`function`){let t=a.aggregate.groupBy;if(t&&typeof t==`object`&&!Array.isArray(t)){let r=a.aggregate.field,i=a.aggregate.function,o={function:i,alias:r||i};i!==`count`&&r&&(o.field=r);let s=await e.aggregate(a.objectName,{groupBy:[t],aggregations:[o],where:n});return Array.isArray(s)?s:[]}let r=await e.aggregate(a.objectName,{field:a.aggregate.field,function:a.aggregate.function,groupBy:t,filter:n});return Array.isArray(r)?r:[]}if(typeof e.find==`function`){let r=(0,t.extractRecords)(await e.find(a.objectName,{$filter:n}));return a.aggregate&&r.length>0&&(r=ee(r,a.aggregate)),r}return[]},[a.objectName,k]),F=(0,n.useCallback)(async(e,n)=>{if(!e||!a.objectName&&!a.dataset){n.current&&v(!1);return}n.current&&(v(!0),b(null));try{if(a.dataset&&typeof e.queryDataset==`function`){let r=(0,t.resolveDateMacros)(a.filter),i=await e.queryDataset(a.dataset,{dimensions:Array.isArray(a.dimensions)?a.dimensions:[],measures:Array.isArray(a.values)?a.values:[],...r?{runtimeFilter:r}:{}});n.current&&g(Array.isArray(i?.rows)?i.rows:[]);return}let r=(0,t.resolveDateMacros)(a.filter),i=a.compareTo,o=!!i&&N(a.chartType),s=o?(0,t.shiftFilterByCompareTo)(a.filter,i):null,[c,l]=await Promise.all([P(e,r),s?P(e,s):Promise.resolve([])]),u=c,d=a.aggregate?.groupBy,f=d&&typeof d==`object`&&!Array.isArray(d)?d.alias||d.field:d||a.xAxisKey;if(o&&l.length>0&&a.aggregate){let e=a.aggregate.field,t=a.aggregate.function,n=n=>{if(n==null)return null;let r=`${e}_${t}`;return r in n?Number(n[r]):t===`count`&&`${e}_count`in n?Number(n[`${e}_count`]):e in n?Number(n[e]):`value`in n?Number(n.value):`count`in n?Number(n.count):null},r=`${e}__comparison`,i=f;if(i&&u.some(e=>e[i]!=null)&&l.some(e=>e[i]!=null)){let e=new Map;for(let t of l){let r=String(t[i]??``);e.set(r,n(t))}u=u.map(t=>{let n=String(t[i]??``),a=e.get(n);return a==null?t:{...t,[r]:a}});let t=new Set(u.map(e=>String(e[i]??``)));for(let e of l){let a=String(e[i]??``);t.has(a)||u.push({[i]:a,[r]:n(e)})}}else{let e=Math.max(u.length,l.length),t=[];for(let i=0;i<e;i++){let e=u[i]||{},a=l[i];t.push(a?{...e,[r]:n(a)}:e)}u=t}}if(f&&typeof e.getObjectSchema==`function`)try{let t=await e.getObjectSchema(a.objectName);u=await te(u,f,t,e,(e,t)=>m.current(a.objectName,f,e,t))}catch{}n.current&&g(u)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&b(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&v(!1)}},[a.objectName,M,k,A,j,a.xAxisKey,a.chartType,P]);(0,n.useEffect)(()=>{let e={current:!0};return(a.objectName||a.dataset)&&!f&&!a.data?F(d,e):e.current&&v(!1),()=>{e.current=!1}},[a.objectName,M,d,f,a.data,A,k,j,F]);let I=f||a.data||h,L=Array.isArray(I)?I:[],R=a.drillDown,z=a.aggregate?.groupBy||a.xAxisKey,B=(0,n.useMemo)(()=>{if(!z)return new Map;let e=new Map,t=`__raw_${z}`;for(let n of L){let r=n?.[z];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[L,z]),V=a.compareTo,H=!!V&&N(a.chartType)&&!!a.aggregate&&L.some(e=>e[`${a.aggregate.field}__comparison`]!=null),U=(0,n.useMemo)(()=>{let e=Array.isArray(a.series)?a.series:null;if(!H)return e;let n=e||[{dataKey:a.aggregate.field}],r={vsLastWeek:`Previous week`,vsLastMonth:`Previous month`,vsLastQuarter:`Previous quarter`,vsLastYear:`Previous year`,vsYesterday:`Yesterday`,vsPreviousPeriod:`Previous period`}[(0,t.compareToTrendLabelKey)(V,a.filter)]||`Previous period`;return[...n.map(e=>({...e,variant:e.variant||`current`})),{dataKey:`${a.aggregate.field}__comparison`,label:r,variant:`comparison`}]},[H,a.series,a.aggregate,a.filter,V]),W=a.dataset?(0,t.buildChartSeries)((0,t.relabelDimensions)(L,T),a.dimensions,a.values):null,G=W?{...a,data:W.data,xAxisKey:W.xAxisKey,series:W.series}:{...a,data:L,...U?{series:U}:{}},K=a.colors&&!Array.isArray(a.colors)&&typeof a.colors==`object`?a.colors:null,q=Array.isArray(a.colors)?a.colors:void 0,J=C||K?{...C||{},...K||{}}:void 0,Y={...G,colors:q,...J?{categoryColors:J}:{}};if(_&&L.length===0)return(0,i.jsxs)(`div`,{className:`p-2 `+(a.className||``),"data-testid":`chart-loading`,role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,i.jsx)(`span`,{className:`sr-only`,children:`Loading chart data…`}),(0,i.jsx)(r.ChartSkeleton,{className:`h-full`})]});if(y)return(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 p-4 `+(a.className||``),"data-testid":`chart-error`,role:`alert`,children:[(0,i.jsx)(s.AlertCircle,{className:`h-6 w-6 text-destructive opacity-60`}),(0,i.jsx)(`p`,{className:`text-xs text-destructive font-medium`,children:`Failed to load chart data`}),(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs text-center`,children:y})]});if(!d&&a.objectName&&L.length===0)return(0,i.jsxs)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(a.className||``),"data-testid":`chart-no-datasource`,children:[`No data source available for “`,a.objectName,`”`]});let Z=(0,t.isDrillEnabled)(R)?e=>{let t=e.category,n=t!=null&&B.has(String(t))?B.get(String(t)):t;S({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,Q=l??Z,$=!l&&x&&a.objectName?(()=>{let e=(0,t.computeDrillFilter)(R,x,{groupByField:z}),n={...a.filter||{},...e},c=(0,t.resolveDrillTitle)(R,x,a.title||`Details`),l=R?.target??`drawer`,u=(0,i.jsx)(`div`,{className:`overflow-auto`,"data-testid":`chart-drill-body`,children:(0,i.jsx)(o.SchemaRenderer,{schema:{type:`object-data-table`,objectName:a.objectName,filter:n,pagination:!0,pageSize:R?.maxRows,columns:R?.columns?.map(e=>({accessorKey:e,header:e})),drillDown:{enabled:!0,mode:`record`,target:`dialog`}},dataSource:d})}),f=D&&a.objectName?(0,i.jsxs)(r.Button,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`drill-open-in-list`,onClick:()=>{D(a.objectName,n),S(null)},children:[O(`dashboard.openInList`,`Open in list`),(0,i.jsx)(s.ArrowUpRight,{className:`ml-1 h-3.5 w-3.5`})]}):null;return l===`dialog`?(0,i.jsx)(r.Dialog,{open:!0,onOpenChange:e=>!e&&S(null),children:(0,i.jsxs)(r.DialogContent,{className:`max-w-4xl`,children:[(0,i.jsxs)(r.DialogHeader,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,i.jsx)(r.DialogTitle,{children:c}),f]}),u]})}):(0,i.jsx)(r.Sheet,{open:!0,onOpenChange:e=>!e&&S(null),children:(0,i.jsxs)(r.SheetContent,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,i.jsxs)(r.SheetHeader,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,i.jsx)(r.SheetTitle,{children:c}),f]}),(0,i.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:u})]})})})():null;return(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(r.RefreshIndicator,{active:_&&L.length>0}),(0,i.jsx)(X,{...e,schema:Y,onChartClick:Q}),$]})};t.ComponentRegistry.register(`object-chart`,Q,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Optional static data`},{name:`filter`,type:`array`,label:`Filter`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`}]});var $={"bar-chart":Y,chart:X};t.ComponentRegistry.register(`bar-chart`,Y,{namespace:`plugin-charts`,label:`Bar Chart`,category:`plugin`,inputs:[{name:`data`,type:`array`,label:`Data`,required:!0},{name:`dataKey`,type:`string`,label:`Data Key`,defaultValue:`value`},{name:`xAxisKey`,type:`string`,label:`X-Axis Key`,defaultValue:`name`},{name:`height`,type:`number`,label:`Height`,defaultValue:400},{name:`color`,type:`color`,label:`Color`,defaultValue:`#8884d8`}],defaultProps:{data:[{name:`Jan`,value:400},{name:`Feb`,value:300},{name:`Mar`,value:600},{name:`Apr`,value:800},{name:`May`,value:500}],dataKey:`value`,xAxisKey:`name`,height:400,color:`#8884d8`}}),t.ComponentRegistry.register(`chart`,Q,{namespace:`view`,category:`view`,label:`Chart`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`type`,type:`string`,label:`Chart Type`},{name:`categoryField`,type:`string`,label:`Category Field`},{name:`valueField`,type:`string`,label:`Value Field`}]}),t.ComponentRegistry.register(`chart`,X,{namespace:`plugin-charts`,label:`Chart`,category:`plugin`,inputs:[{name:`chartType`,type:`enum`,label:`Chart Type`,enum:[{label:`Bar`,value:`bar`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Pie`,value:`pie`},{label:`Donut`,value:`donut`},{label:`Radar`,value:`radar`},{label:`Scatter`,value:`scatter`}],defaultValue:`bar`},{name:`data`,type:`code`,label:`Data (JSON)`,required:!0},{name:`config`,type:`code`,label:`Config (JSON)`},{name:`xAxisKey`,type:`string`,label:`X Axis Key`,defaultValue:`name`},{name:`series`,type:`code`,label:`Series (JSON Array)`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{chartType:`bar`,data:[{name:`Jan`,sales:400,revenue:240},{name:`Feb`,sales:300,revenue:139},{name:`Mar`,sales:600,revenue:380},{name:`Apr`,sales:800,revenue:430},{name:`May`,sales:500,revenue:220}],config:{sales:{label:`Sales`,color:`#8884d8`},revenue:{label:`Revenue`,color:`#82ca9d`}},xAxisKey:`name`,series:[{dataKey:`sales`},{dataKey:`revenue`}]}}),t.ComponentRegistry.register(`chart:bar`,X,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`,defaultProps:{chartType:`bar`}}),t.ComponentRegistry.register(`pie-chart`,X,{namespace:`plugin-charts`,label:`Pie Chart`,category:`plugin`,defaultProps:{chartType:`pie`}}),t.ComponentRegistry.register(`donut-chart`,X,{namespace:`plugin-charts`,label:`Donut Chart`,category:`plugin`,defaultProps:{chartType:`donut`}}),t.ComponentRegistry.register(`radar-chart`,X,{namespace:`plugin-charts`,label:`Radar Chart`,category:`plugin`,defaultProps:{chartType:`radar`}}),t.ComponentRegistry.register(`scatter-chart`,X,{namespace:`plugin-charts`,label:`Scatter Chart`,category:`plugin`,defaultProps:{chartType:`scatter`}}),e.ChartBarRenderer=Y,e.ChartRenderer=X,e.ObjectChart=Q,e.chartComponents=$});
7
+ `)}}):null},M=a.Tooltip,N=a.Legend}));function F(e){return e?.[0]?.dataKey||`value`}function I(e,t,n){if(!e)return null;let r=e.payload??e,i=r?.[t];if(i==null)return null;let a=F(n);return{category:String(i),series:a,value:typeof r?.[a]==`number`?r[a]:void 0}}function L(e,t){if(!e)return null;let n=e.name??e.payload?.name??e.root?.name;if(n==null)return null;let r=e.value??e.size??e.payload?.size;return{category:String(n),series:F(t),value:typeof r==`number`?r:void 0}}function R(e,t){if(!e)return null;let n=e.payload??e,r=n?.name;return r==null||n?.depth===0?null:{category:String(r),series:F(t),value:typeof n?.value==`number`?n.value:void 0}}var z=h((()=>{})),B=g({default:()=>V});function V({chartType:e=`bar`,data:t=[],config:r={},xAxisKey:o=`name`,series:s=[],className:c=``,colors:l,categoryColors:u,onChartClick:d,isAnimationActive:f}){let p=e===`column`?`bar`:e,m=Array.isArray(t)?t:[],h=f===!1?{isAnimationActive:!1}:{},[g,_]=n.useState(!1),v=n.useCallback(e=>{if(!d||!e)return;let t=Array.isArray(e.activePayload)?e.activePayload[0]:void 0;d({category:e.activeLabel==null?void 0:String(e.activeLabel),series:t?.dataKey?String(t.dataKey):void 0,value:typeof t?.value==`number`?t.value:void 0})},[d]),y=n.useCallback(e=>{if(!d||!e)return;let t=e.payload?.[o],n=s[0]?.dataKey||`value`;d({category:t==null?void 0:String(t),series:n,value:typeof e.payload?.[n]==`number`?e.payload[n]:void 0})},[d,o,s]),b=d?{onClick:v,style:{cursor:`pointer`}}:{},x=d?{onClick:y,style:{cursor:`pointer`}}:{},S=n.useCallback((e,t,n)=>u&&u[e==null?``:String(e)]||n[t%n.length],[u]),C=n.useCallback(e=>{if(!d)return;let t=I(e,o,s);t&&d(t)},[d,o,s]),D=n.useCallback(e=>{if(!d)return;let t=L(e,s);t&&d(t)},[d,s]),O=n.useCallback(e=>{if(!d)return;let t=R(e,s);t&&d(t)},[d,s]),k=d?{onClick:C,cursor:`pointer`}:{},A=d?{onClick:D,style:{cursor:`pointer`}}:{},j=d?{onClick:O,style:{cursor:`pointer`}}:{};n.useEffect(()=>{let e=()=>_(window.innerWidth<640);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let P={bar:a.BarChart,"horizontal-bar":a.BarChart,line:a.LineChart,area:a.AreaChart,pie:a.PieChart,donut:a.PieChart,radar:a.RadarChart,scatter:a.ScatterChart,funnel:a.FunnelChart,combo:a.BarChart,treemap:a.BarChart,sankey:a.BarChart}[p]||a.BarChart,F=n.useCallback(e=>{if(e==null||e===``)return``;let t=r?.[String(e)]?.label;if(t!=null)return String(t);let n=typeof e==`string`?e:String(e);if(/^\d{4}-\d{2}-\d{2}/.test(n)){let e=new Date(n);if(!Number.isNaN(e.getTime())){let t=(m.length>1?Math.abs(new Date(String(m[m.length-1][o]??``)).getTime()-new Date(String(m[0][o]??``)).getTime()):0)/(1e3*60*60*24);try{return t<=62?e.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):e.toLocaleDateString(void 0,{month:`short`,year:`numeric`})}catch{return e.toISOString().slice(0,10)}}}return g&&n.length>8?n.slice(0,8)+`…`:n},[m,o,g,r]),z=n.useMemo(()=>m.some(e=>String(e[o]||``).length>5),[m,o]),B=()=>Array.isArray(l)&&l.length>0?l:[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],V=n.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`number`?e:Number(e);if(!Number.isFinite(t))return String(e);try{return new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(t)}catch{return String(t)}},[]),U=n.useMemo(()=>({tickLine:!1,tickMargin:10,axisLine:!1,interval:`preserveStartEnd`,minTickGap:g?32:48,tickFormatter:F,...!g&&z&&{angle:-35,textAnchor:`end`,height:60}}),[g,z,F]);if(p===`pie`||p===`donut`){let e=p===`donut`?`52%`:0,t=B(),n={...r};return m.forEach((e,r)=>{let i=e?.[o];if(i==null||i===``)return;let a=String(i);n[a]||(n[a]={label:a,color:S(i,r,t)})}),(0,i.jsx)(w,{config:n,className:c,children:(0,i.jsxs)(a.PieChart,{children:[(0,i.jsx)(M,{cursor:!1,content:(0,i.jsx)(T,{hideLabel:!0})}),(0,i.jsx)(a.Pie,{data:m,dataKey:s[0]?.dataKey||`value`,nameKey:o||`name`,innerRadius:e,strokeWidth:5,paddingAngle:2,outerRadius:`85%`,...h,...x,children:m.map((e,n)=>{let r=S(e?.[o],n,t);return(0,i.jsx)(a.Cell,{fill:W(r)},`cell-${n}`)})}),(0,i.jsx)(N,{verticalAlign:`bottom`,wrapperStyle:{fontSize:g?`11px`:`12px`,paddingTop:`8px`},content:(0,i.jsx)(E,{nameKey:o,className:`flex-wrap`})})]})})}if(p===`funnel`){let e=s[0]?.dataKey||`value`,t=B(),n=d?t=>{t&&d({category:t?.payload?.[o]??t?.[o],value:t?.payload?.[e]??t?.[e]})}:void 0,l=n?{onClick:n,style:{cursor:`pointer`}}:{},u=[...m].sort((t,n)=>{let r=Number(t?.[e]??0);return Number(n?.[e]??0)-r});return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.FunnelChart,{children:[(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsxs)(a.Funnel,{dataKey:e,data:u,nameKey:o,isAnimationActive:!0,...l,children:[(0,i.jsx)(a.LabelList,{position:`right`,fill:`hsl(var(--foreground))`,stroke:`none`,dataKey:o}),u.map((e,n)=>(0,i.jsx)(a.Cell,{fill:W(t[n%t.length])},`funnel-cell-${n}`))]})]})})}if(p===`treemap`){let e=s[0]?.dataKey||`value`,t=B(),n=m.map((n,r)=>({name:String(n?.[o]??``),size:Number(n?.[e])||0,fill:W(t[r%t.length])}));return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsx)(a.Treemap,{data:n,dataKey:`size`,nameKey:`name`,isAnimationActive:!0,content:(0,i.jsx)(e=>{let{x:t,y:n,width:r,height:a,name:o,fill:s}=e;return r<=0||a<=0?null:(0,i.jsxs)(`g`,{children:[(0,i.jsx)(`rect`,{x:t,y:n,width:r,height:a,fill:s,stroke:`hsl(var(--background))`,strokeWidth:2}),r>48&&a>18?(0,i.jsx)(`text`,{x:t+6,y:n+18,fill:`#fff`,fontSize:12,className:`pointer-events-none`,children:o}):null]})},{}),...A,children:(0,i.jsx)(a.Tooltip,{})})})}if(p===`sankey`){let e=s[0]?.dataKey||`value`,t=s[0]?.label||e,n=m.filter(t=>(Number(t?.[e])||0)>0),l=[{name:t},...n.map(e=>({name:String(e?.[o]??``)}))],u=n.map((t,n)=>({source:0,target:n+1,value:Number(t?.[e])||0}));return u.length===0?(0,i.jsx)(`div`,{className:c}):(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsx)(a.Sankey,{data:{nodes:l,links:u},nodePadding:24,link:{stroke:`hsl(var(--muted-foreground))`,strokeOpacity:.25},node:{fill:`hsl(var(--chart-1))`},...j,children:(0,i.jsx)(a.Tooltip,{})})})}if(p===`radar`)return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.RadarChart,{data:m,children:[(0,i.jsx)(a.PolarGrid,{}),(0,i.jsx)(a.PolarAngleAxis,{dataKey:o}),(0,i.jsx)(a.PolarRadiusAxis,{}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map(e=>{let t=W(r[e.dataKey]?.color||H);return(0,i.jsx)(a.Radar,{dataKey:e.dataKey,stroke:t,fill:t,fillOpacity:.6},e.dataKey)})]})});if(p===`scatter`)return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.ScatterChart,{children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{type:`number`,dataKey:o,name:String(r[o]?.label||o),tickLine:!1,axisLine:!1,minTickGap:g?32:48}),(0,i.jsx)(a.YAxis,{type:`number`,dataKey:s[0]?.dataKey||`value`,name:String(r[s[0]?.dataKey]?.label||s[0]?.dataKey),tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,i.jsx)(a.ZAxis,{type:`number`,range:[60,400]}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=B(),o=W(r[e.dataKey]?.color||n[t%n.length]),s=G(e,`scatter`);return(0,i.jsx)(a.Scatter,{name:r[e.dataKey]?.label||e.dataKey,data:m,fill:o,fillOpacity:s?.fillOpacity,...k},e.dataKey)})]})});if(p===`combo`)return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(a.BarChart,{data:m,children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:o,...U}),(0,i.jsx)(a.YAxis,{yAxisId:`left`,tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,i.jsx)(a.YAxis,{yAxisId:`right`,orientation:`right`,tickLine:!1,axisLine:!1,tickFormatter:V,width:48}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=W(r[e.dataKey]?.color||H),o=e.chartType||(t===0?`bar`:`line`),s=o===`bar`?`left`:`right`,c=G(e,o);return o===`line`?(0,i.jsx)(a.Line,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,stroke:n,strokeWidth:2,dot:!1,strokeOpacity:c?.strokeOpacity,strokeDasharray:c?.strokeDasharray,...h},e.dataKey):o===`area`?(0,i.jsx)(a.Area,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,fill:n,stroke:n,fillOpacity:c?.fillOpacity??.4,strokeOpacity:c?.strokeOpacity,strokeDasharray:c?.strokeDasharray,...h},e.dataKey):(0,i.jsx)(a.Bar,{yAxisId:s,dataKey:e.dataKey,fill:n,radius:4,fillOpacity:c?.fillOpacity,...h},e.dataKey)})]})});let K=p===`horizontal-bar`,q=B(),J=u?Object.values(u).map(e=>W(String(e))):[],Y=Array.from(new Set([...q,...J,...s.map((e,t)=>W(r[e.dataKey]?.color||q[t%q.length]||H))])),X=e=>`g`+e.replace(/[^a-zA-Z0-9]/g,``);return(0,i.jsx)(w,{config:r,className:c,children:(0,i.jsxs)(P,{data:m,layout:K?`vertical`:`horizontal`,...b,children:[(0,i.jsx)(`defs`,{children:Y.map(e=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsxs)(`linearGradient`,{id:`bg-${X(e)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,style:{stopColor:e},stopOpacity:.95}),(0,i.jsx)(`stop`,{offset:`100%`,style:{stopColor:e},stopOpacity:.5})]}),(0,i.jsxs)(`linearGradient`,{id:`ag-${X(e)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,style:{stopColor:e},stopOpacity:.5}),(0,i.jsx)(`stop`,{offset:`95%`,style:{stopColor:e},stopOpacity:.05})]})]},X(e)))}),(0,i.jsx)(a.CartesianGrid,{vertical:!1}),K?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.XAxis,{type:`number`,tickLine:!1,axisLine:!1,tickFormatter:V}),(0,i.jsx)(a.YAxis,{type:`category`,dataKey:o,tickLine:!1,axisLine:!1,width:Math.min(140,Math.max(60,Math.max(...m.map(e=>String(e[o]??``).length))*7)),tickFormatter:F})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.XAxis,{dataKey:o,...U}),(0,i.jsx)(a.YAxis,{tickLine:!1,axisLine:!1,tickFormatter:V,width:48})]}),(0,i.jsx)(M,{content:(0,i.jsx)(T,{})}),(0,i.jsx)(N,{content:(0,i.jsx)(E,{}),...g&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=B(),c=e.variant===`comparison`,l=c?s.slice(0,t).find(e=>e.variant!==`comparison`)||s[0]:e,u=c?s.indexOf(l):t,d=W(r[l.dataKey]?.color||n[u%n.length]||H);if(p===`bar`||p===`horizontal-bar`){let t=s.filter(e=>e.variant!==`comparison`).length===1&&!c&&s.length===1&&m.length>1,r=G(e,`bar`);return(0,i.jsx)(a.Bar,{dataKey:e.dataKey,fill:`url(#bg-${X(d)})`,radius:4,fillOpacity:r?.fillOpacity,...h,children:t&&m.map((e,t)=>(0,i.jsx)(a.Cell,{fill:`url(#bg-${X(W(S(e?.[o],t,n)))})`},`cell-${t}`))},e.dataKey)}if(p===`line`){let t=G(e,`line`);return(0,i.jsx)(a.Line,{type:`monotone`,dataKey:e.dataKey,stroke:d,strokeWidth:2,dot:!1,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray,...h},e.dataKey)}if(p===`area`){let t=G(e,`area`);return(0,i.jsx)(a.Area,{type:`monotone`,dataKey:e.dataKey,fill:`url(#ag-${X(d)})`,stroke:d,strokeWidth:2,fillOpacity:t?.fillOpacity??1,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray,...h},e.dataKey)}return null})]})})}var H,U,W,G,K=h((()=>{P(),z(),H=`hsl(var(--primary))`,U={slate:`#64748b`,gray:`#6b7280`,zinc:`#71717a`,neutral:`#737373`,stone:`#78716c`,red:`#ef4444`,orange:`#f97316`,amber:`#f59e0b`,yellow:`#eab308`,lime:`#84cc16`,green:`#22c55e`,emerald:`#10b981`,teal:`#14b8a6`,cyan:`#06b6d4`,sky:`#0ea5e9`,blue:`#3b82f6`,indigo:`#6366f1`,violet:`#8b5cf6`,purple:`#a855f7`,fuchsia:`#d946ef`,pink:`#ec4899`,rose:`#f43f5e`},W=e=>U[e]||e,G=(e,t)=>e?.variant===`comparison`?{strokeOpacity:typeof e.opacity==`number`?e.opacity:t===`line`||t===`scatter`?.5:.6,fillOpacity:typeof e.opacity==`number`?e.opacity:t===`bar`?.4:t===`area`?.2:.5,strokeDasharray:e.dashArray??(t===`line`||t===`area`?`4 4`:void 0)}:null})),q=n.default.lazy(()=>Promise.resolve().then(()=>(S(),v))),J=n.default.lazy(()=>Promise.resolve().then(()=>(K(),B))),Y=({schema:e})=>(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(q,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),X=({schema:e,onChartClick:t})=>{let a=n.default.useMemo(()=>{let t=e.series,n=e.xAxisKey,r=e.config;if(n||(e.index?n=e.index:e.category&&(n=e.category)),t||(e.categories?t=e.categories.map(e=>({dataKey:e})):e.value&&(t=[{dataKey:e.value}])),!r&&t){let n=e.colors||[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`],i={};t.forEach((e,t)=>{i[e.dataKey]={label:e.label||e.dataKey,color:n[t%n.length]}}),r=i}return{chartType:e.chartType,data:Array.isArray(e.data)?e.data:[],config:r,xAxisKey:n,series:t,className:e.className}},[e]);return(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(J,{chartType:a.chartType,data:a.data,config:a.config,xAxisKey:a.xAxisKey,series:a.series,className:a.className,colors:Array.isArray(e.colors)?e.colors:void 0,categoryColors:e.categoryColors,isAnimationActive:e.isAnimationActive,onChartClick:t})})};function Z(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ee(e,t){let{field:n,function:r,groupBy:i}=t,a={};for(let t of e){let e=String(t[i]??`Unknown`);a[e]||(a[e]=[]),a[e].push(t)}return Object.entries(a).map(([e,t])=>{let a=t.map(e=>Number(e[n])||0),o;switch(r){case`count`:o=t.length;break;case`avg`:o=a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0;break;case`min`:o=a.length>0?Math.min(...a):0;break;case`max`:o=a.length>0?Math.max(...a):0;break;default:o=a.reduce((e,t)=>e+t,0);break}return{[i]:e,[n]:o}})}async function te(e,n,r,i,a){if(!e.length||!n)return e;let o=a||((e,t)=>t),s=`__raw_${n}`,c=r?.fields?.[n];if(!c){let t=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let r=e[n],i=String(r??``),a=t.test(i)?i:Z(i);return{...e,[n]:o(i,a),[s]:r}})}let l=c.type;if(l===`select`||l===`picklist`||l===`dropdown`){let t=c.options||[];if(t.length===0)return e.map(e=>{let t=e[n],r=String(t??``),i=Z(r);return{...e,[n]:o(r,i),[s]:t}});let r={};for(let e of t)typeof e==`string`?r[e]=e:e&&typeof e==`object`&&(r[String(e.value)]=e.label||String(e.value));return e.map(e=>{let t=e[n],i=String(t??``),a=r[i]||Z(i);return{...e,[n]:o(i,a),[s]:t}})}if(l===`lookup`||l===`master_detail`){let r=c.reference_to||c.reference;if(!r||!i||typeof i.find!=`function`)return e.map(e=>({...e,[s]:e[n]}));let a=[...new Set(e.map(e=>e[n]).filter(e=>e!=null))];if(a.length===0)return e.map(e=>({...e,[s]:e[n]}));let o=c.id_field||`id`;try{let l=(0,t.extractRecords)(await i.find(r,{$filter:{[o]:{$in:a}},$top:a.length})),u=c.reference_field||c.display_field||`name`,d={};for(let e of l){let t=String(e[o]??e.id??e._id??``),n=e[u]||e.name||e.label||e.title||t;t&&(d[t]=String(n))}return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:d[r]||r,[s]:t}})}catch(t){return console.warn(`[ObjectChart] Failed to resolve lookup labels:`,t),e.map(e=>({...e,[s]:e[n]}))}}if(l===`date`||l===`datetime`||l===`date_time`||l===`timestamp`||l===`time`)return e.map(e=>({...e,[s]:e[n]}));let u=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:u.test(r)?r:Z(r),[s]:t}})}var Q=e=>{let{schema:a}=e,l=e.onSegmentClick,u=(0,n.useContext)(o.SchemaRendererContext),d=e.dataSource||u?.dataSource,f=(0,o.useDataScope)(a.bind),{fieldOptionLabel:p}=(0,c.useSafeFieldLabel)(),m=(0,n.useRef)(p);(0,n.useEffect)(()=>{m.current=p},[p]);let[h,g]=(0,n.useState)([]),[_,v]=(0,n.useState)(null),[y,b]=(0,n.useState)(()=>!(Array.isArray(a.data)&&a.data.length>0)&&(!!a.objectName||!!a.dataset)),[x,S]=(0,n.useState)(null),[C,w]=(0,n.useState)(null),[T,E]=(0,n.useState)(null),[D,O]=(0,n.useState)(null),{openRecordList:k}=(0,o.useDrillNavigation)(),A=(0,c.useSafeTranslate)(),j=(0,n.useMemo)(()=>a.aggregate?JSON.stringify(a.aggregate):``,[a.aggregate]),M=(0,n.useMemo)(()=>a.filter?JSON.stringify(a.filter):``,[a.filter]),N=(0,n.useMemo)(()=>a.compareTo?JSON.stringify(a.compareTo):``,[a.compareTo]),P=(0,n.useMemo)(()=>a.dataset?JSON.stringify({d:a.dataset,dim:a.dimensions??[],val:a.values??[]}):``,[a.dataset,a.dimensions,a.values]),F=e=>e!==`pie`&&e!==`donut`&&e!==`funnel`;(0,n.useEffect)(()=>{let e=!1;return(async()=>{try{let n={headers:{accept:`application/json`},credentials:`include`},r=a.objectName,i,o=null,s=a.aggregate?.groupBy;if(r)i=s&&typeof s==`object`&&!Array.isArray(s)?s.field:typeof s==`string`?s:a.xAxisKey;else if(a.dataset){let e=Array.isArray(a.dimensions)&&a.dimensions.length?a.dimensions[0]:void 0,t=await(await fetch(`/api/v1/meta/dataset/${encodeURIComponent(a.dataset)}`,n)).json().catch(()=>null);o=t?.item??t?.data??t,r=o?.object,i=((o?.dimensions||[]).find(t=>t?.name===e)??(o?.dimensions||[])[0])?.field??e}if(!r||!i){e||(E(null),O(null));return}let c=await(await fetch(`/api/v1/meta/object/${encodeURIComponent(r)}`,n)).json().catch(()=>null),l=c?.item??c?.data??c,u=(0,t.buildOptionColorMap)(l?.fields?.[i]?.options),d=null;if(a.dataset&&Array.isArray(a.dimensions)){let e={};for(let n of a.dimensions){let r=(o?.dimensions||[]).find(e=>e?.name===n)?.field??n,i=(0,t.buildDimensionLabelMap)(l?.fields?.[r]?.options);i&&(e[n]=i)}Object.keys(e).length>0&&(d=e)}e||(E(u),O(d))}catch{e||(E(null),O(null))}})(),()=>{e=!0}},[a.objectName,a.dataset,P,j,a.xAxisKey]);let I=(0,n.useCallback)(async(e,n)=>{if(a.aggregate&&typeof e.aggregate==`function`){let t=a.aggregate.groupBy;if(t&&typeof t==`object`&&!Array.isArray(t)){let r=a.aggregate.field,i=a.aggregate.function,o={function:i,alias:r||i};i!==`count`&&r&&(o.field=r);let s=await e.aggregate(a.objectName,{groupBy:[t],aggregations:[o],where:n});return Array.isArray(s)?s:[]}let r=await e.aggregate(a.objectName,{field:a.aggregate.field,function:a.aggregate.function,groupBy:t,filter:n});return Array.isArray(r)?r:[]}if(typeof e.find==`function`){let r=(0,t.extractRecords)(await e.find(a.objectName,{$filter:n}));return a.aggregate&&r.length>0&&(r=ee(r,a.aggregate)),r}return[]},[a.objectName,j]),L=(0,n.useCallback)(async(e,n)=>{if(!e||!a.objectName&&!a.dataset){n.current&&b(!1);return}n.current&&(b(!0),S(null));try{if(a.dataset&&typeof e.queryDataset==`function`){let r=(0,t.resolveDateMacros)(a.filter),i=await e.queryDataset(a.dataset,{dimensions:Array.isArray(a.dimensions)?a.dimensions:[],measures:Array.isArray(a.values)?a.values:[],...r?{runtimeFilter:r}:{}});n.current&&(g(Array.isArray(i?.rows)?i.rows:[]),v(Array.isArray(i?.fields)?i.fields:null));return}let r=(0,t.resolveDateMacros)(a.filter),i=a.compareTo,o=!!i&&F(a.chartType),s=o?(0,t.shiftFilterByCompareTo)(a.filter,i):null,[c,l]=await Promise.all([I(e,r),s?I(e,s):Promise.resolve([])]),u=c,d=a.aggregate?.groupBy,f=d&&typeof d==`object`&&!Array.isArray(d)?d.alias||d.field:d||a.xAxisKey;if(o&&l.length>0&&a.aggregate){let e=a.aggregate.field,t=a.aggregate.function,n=n=>{if(n==null)return null;let r=`${e}_${t}`;return r in n?Number(n[r]):t===`count`&&`${e}_count`in n?Number(n[`${e}_count`]):e in n?Number(n[e]):`value`in n?Number(n.value):`count`in n?Number(n.count):null},r=`${e}__comparison`,i=f;if(i&&u.some(e=>e[i]!=null)&&l.some(e=>e[i]!=null)){let e=new Map;for(let t of l){let r=String(t[i]??``);e.set(r,n(t))}u=u.map(t=>{let n=String(t[i]??``),a=e.get(n);return a==null?t:{...t,[r]:a}});let t=new Set(u.map(e=>String(e[i]??``)));for(let e of l){let a=String(e[i]??``);t.has(a)||u.push({[i]:a,[r]:n(e)})}}else{let e=Math.max(u.length,l.length),t=[];for(let i=0;i<e;i++){let e=u[i]||{},a=l[i];t.push(a?{...e,[r]:n(a)}:e)}u=t}}if(f&&typeof e.getObjectSchema==`function`)try{let t=await e.getObjectSchema(a.objectName);u=await te(u,f,t,e,(e,t)=>m.current(a.objectName,f,e,t))}catch{}n.current&&g(u)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&S(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&b(!1)}},[a.objectName,P,j,M,N,a.xAxisKey,a.chartType,I]);(0,n.useEffect)(()=>{let e={current:!0};return(a.objectName||a.dataset)&&!f&&!a.data?L(d,e):e.current&&b(!1),()=>{e.current=!1}},[a.objectName,P,d,f,a.data,M,j,N,L]);let R=f||a.data||h,z=Array.isArray(R)?R:[],B=a.drillDown,V=a.aggregate?.groupBy||a.xAxisKey,H=(0,n.useMemo)(()=>{if(!V)return new Map;let e=new Map,t=`__raw_${V}`;for(let n of z){let r=n?.[V];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[z,V]),U=a.compareTo,W=!!U&&F(a.chartType)&&!!a.aggregate&&z.some(e=>e[`${a.aggregate.field}__comparison`]!=null),G=(0,n.useMemo)(()=>{let e=Array.isArray(a.series)?a.series:null;if(!W)return e;let n=e||[{dataKey:a.aggregate.field}],r={vsLastWeek:`Previous week`,vsLastMonth:`Previous month`,vsLastQuarter:`Previous quarter`,vsLastYear:`Previous year`,vsYesterday:`Yesterday`,vsPreviousPeriod:`Previous period`}[(0,t.compareToTrendLabelKey)(U,a.filter)]||`Previous period`;return[...n.map(e=>({...e,variant:e.variant||`current`})),{dataKey:`${a.aggregate.field}__comparison`,label:r,variant:`comparison`}]},[W,a.series,a.aggregate,a.filter,U]),K=a.dataset?(0,t.buildChartSeries)((0,t.relabelDimensions)(z,D),a.dimensions,a.values,_):null,q=K?{...a,data:K.data,xAxisKey:K.xAxisKey,series:K.series}:{...a,data:z,...G?{series:G}:{}},J=a.colors&&!Array.isArray(a.colors)&&typeof a.colors==`object`?a.colors:null,Y=Array.isArray(a.colors)?a.colors:void 0,Z=T||J?{...T||{},...J||{}}:void 0,Q={...q,colors:Y,...Z?{categoryColors:Z}:{}};if(y&&z.length===0)return(0,i.jsxs)(`div`,{className:`p-2 `+(a.className||``),"data-testid":`chart-loading`,role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,i.jsx)(`span`,{className:`sr-only`,children:`Loading chart data…`}),(0,i.jsx)(r.ChartSkeleton,{className:`h-full`})]});if(x)return(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 p-4 `+(a.className||``),"data-testid":`chart-error`,role:`alert`,children:[(0,i.jsx)(s.AlertCircle,{className:`h-6 w-6 text-destructive opacity-60`}),(0,i.jsx)(`p`,{className:`text-xs text-destructive font-medium`,children:`Failed to load chart data`}),(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs text-center`,children:x})]});if(!d&&a.objectName&&z.length===0)return(0,i.jsxs)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(a.className||``),"data-testid":`chart-no-datasource`,children:[`No data source available for “`,a.objectName,`”`]});let $=(0,t.isDrillEnabled)(B)?e=>{let t=e.category,n=t!=null&&H.has(String(t))?H.get(String(t)):t;w({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,ne=l??$,re=!l&&C&&a.objectName?(()=>{let e=(0,t.computeDrillFilter)(B,C,{groupByField:V}),n={...a.filter||{},...e},c=(0,t.resolveDrillTitle)(B,C,a.title||`Details`),l=B?.target??`drawer`,u=(0,i.jsx)(`div`,{className:`overflow-auto`,"data-testid":`chart-drill-body`,children:(0,i.jsx)(o.SchemaRenderer,{schema:{type:`object-data-table`,objectName:a.objectName,filter:n,pagination:!0,pageSize:B?.maxRows,columns:B?.columns?.map(e=>({accessorKey:e,header:e})),drillDown:{enabled:!0,mode:`record`,target:`dialog`}},dataSource:d})}),f=k&&a.objectName?(0,i.jsxs)(r.Button,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`drill-open-in-list`,onClick:()=>{k(a.objectName,n),w(null)},children:[A(`dashboard.openInList`,`Open in list`),(0,i.jsx)(s.ArrowUpRight,{className:`ml-1 h-3.5 w-3.5`})]}):null;return l===`dialog`?(0,i.jsx)(r.Dialog,{open:!0,onOpenChange:e=>!e&&w(null),children:(0,i.jsxs)(r.DialogContent,{className:`max-w-4xl`,children:[(0,i.jsxs)(r.DialogHeader,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,i.jsx)(r.DialogTitle,{children:c}),f]}),u]})}):(0,i.jsx)(r.Sheet,{open:!0,onOpenChange:e=>!e&&w(null),children:(0,i.jsxs)(r.SheetContent,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,i.jsxs)(r.SheetHeader,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,i.jsx)(r.SheetTitle,{children:c}),f]}),(0,i.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:u})]})})})():null;return(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(r.RefreshIndicator,{active:y&&z.length>0}),(0,i.jsx)(X,{...e,schema:Q,onChartClick:ne}),re]})};t.ComponentRegistry.register(`object-chart`,Q,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Optional static data`},{name:`filter`,type:`array`,label:`Filter`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`}]});var $={"bar-chart":Y,chart:X};t.ComponentRegistry.register(`bar-chart`,Y,{namespace:`plugin-charts`,label:`Bar Chart`,category:`plugin`,inputs:[{name:`data`,type:`array`,label:`Data`,required:!0},{name:`dataKey`,type:`string`,label:`Data Key`,defaultValue:`value`},{name:`xAxisKey`,type:`string`,label:`X-Axis Key`,defaultValue:`name`},{name:`height`,type:`number`,label:`Height`,defaultValue:400},{name:`color`,type:`color`,label:`Color`,defaultValue:`#8884d8`}],defaultProps:{data:[{name:`Jan`,value:400},{name:`Feb`,value:300},{name:`Mar`,value:600},{name:`Apr`,value:800},{name:`May`,value:500}],dataKey:`value`,xAxisKey:`name`,height:400,color:`#8884d8`}}),t.ComponentRegistry.register(`chart`,Q,{namespace:`view`,category:`view`,label:`Chart`,skipFallback:!0,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`type`,type:`string`,label:`Chart Type`},{name:`categoryField`,type:`string`,label:`Category Field`},{name:`valueField`,type:`string`,label:`Value Field`}]}),t.ComponentRegistry.register(`chart`,X,{namespace:`plugin-charts`,label:`Chart`,category:`plugin`,inputs:[{name:`chartType`,type:`enum`,label:`Chart Type`,enum:[{label:`Bar`,value:`bar`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Pie`,value:`pie`},{label:`Donut`,value:`donut`},{label:`Radar`,value:`radar`},{label:`Scatter`,value:`scatter`}],defaultValue:`bar`},{name:`data`,type:`code`,label:`Data (JSON)`,required:!0},{name:`config`,type:`code`,label:`Config (JSON)`},{name:`xAxisKey`,type:`string`,label:`X Axis Key`,defaultValue:`name`},{name:`series`,type:`code`,label:`Series (JSON Array)`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{chartType:`bar`,data:[{name:`Jan`,sales:400,revenue:240},{name:`Feb`,sales:300,revenue:139},{name:`Mar`,sales:600,revenue:380},{name:`Apr`,sales:800,revenue:430},{name:`May`,sales:500,revenue:220}],config:{sales:{label:`Sales`,color:`#8884d8`},revenue:{label:`Revenue`,color:`#82ca9d`}},xAxisKey:`name`,series:[{dataKey:`sales`},{dataKey:`revenue`}]}}),t.ComponentRegistry.register(`chart:bar`,X,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`,defaultProps:{chartType:`bar`}}),t.ComponentRegistry.register(`pie-chart`,X,{namespace:`plugin-charts`,label:`Pie Chart`,category:`plugin`,defaultProps:{chartType:`pie`}}),t.ComponentRegistry.register(`donut-chart`,X,{namespace:`plugin-charts`,label:`Donut Chart`,category:`plugin`,defaultProps:{chartType:`donut`}}),t.ComponentRegistry.register(`radar-chart`,X,{namespace:`plugin-charts`,label:`Radar Chart`,category:`plugin`,defaultProps:{chartType:`radar`}}),t.ComponentRegistry.register(`scatter-chart`,X,{namespace:`plugin-charts`,label:`Scatter Chart`,category:`plugin`,defaultProps:{chartType:`scatter`}}),e.ChartBarRenderer=Y,e.ChartRenderer=X,e.ObjectChart=Q,e.chartComponents=$});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-charts",
3
- "version": "11.4.0",
3
+ "version": "13.1.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Chart components plugin for Object UI, powered by Recharts",
@@ -25,12 +25,12 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "lucide-react": "^1.22.0",
28
- "recharts": "^3.9.0",
29
- "@object-ui/components": "11.4.0",
30
- "@object-ui/core": "11.4.0",
31
- "@object-ui/i18n": "11.4.0",
32
- "@object-ui/react": "11.4.0",
33
- "@object-ui/types": "11.4.0"
28
+ "recharts": "^3.9.2",
29
+ "@object-ui/components": "13.1.0",
30
+ "@object-ui/core": "13.1.0",
31
+ "@object-ui/i18n": "13.1.0",
32
+ "@object-ui/react": "13.1.0",
33
+ "@object-ui/types": "13.1.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^18.0.0 || ^19.0.0",
@@ -41,7 +41,7 @@
41
41
  "@types/react-dom": "19.2.3",
42
42
  "@vitejs/plugin-react": "^6.0.3",
43
43
  "typescript": "^6.0.3",
44
- "vite": "^8.1.0",
44
+ "vite": "^8.1.3",
45
45
  "vite-plugin-dts": "^5.0.3"
46
46
  },
47
47
  "keywords": [