@object-ui/plugin-dashboard 14.0.0 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import { ComponentRegistry as e, buildChartSeries as t, buildDatasetDrillFilter as n, buildDatasetFieldHelpers as r, buildDimensionLabelMap as i, buildOptionColorMap as a, compareToTrendLabelKey as o, computeDrillFilter as s, extractRecords as c, findChartSeriesRow as l, formatDimensionValue as u, formatMeasure as d, isDrillEnabled as f, relabelDimensions as p, resolveDateMacros as m, resolveDrillTitle as h, shiftFilterByCompareTo as g } from "@object-ui/core";
2
- import { SchemaRenderer as _, SchemaRendererContext as v, useActionEngine as y, useDataScope as b, useDnd as x, useDrillNavigation as S, useHasDndProvider as C, useObjectLabel as w } from "@object-ui/react";
3
- import { createSafeTranslation as T, resolveFieldCurrency as E, useLocalization as D, useObjectTranslation as O, useSafeFieldLabel as k, useSafeTranslate as A } from "@object-ui/i18n";
4
- import { Button as j, Card as ee, CardContent as M, CardHeader as N, CardTitle as P, ChartSkeleton as F, Combobox as I, ConfigPanelRenderer as L, ConfigRow as R, DataEmptyState as te, Dialog as z, DialogContent as ne, DialogHeader as B, DialogTitle as V, GridSkeleton as re, RefreshIndicator as ie, Sheet as ae, SheetContent as oe, SheetHeader as se, SheetTitle as ce, Skeleton as H, cn as U, getLazyIcon as le, useConfigDraft as ue } from "@object-ui/components";
5
- import * as W from "react";
6
- import de, { Fragment as G, forwardRef as fe, useCallback as K, useContext as pe, useEffect as q, useMemo as J, useRef as me, useState as Y } from "react";
7
- import { AlertCircle as he, AlertTriangle as ge, ArrowDownIcon as X, ArrowUpIcon as _e, ArrowUpRight as ve, BarChart3 as ye, Download as be, Edit as xe, GripVertical as Se, Loader2 as Ce, MinusIcon as we, RefreshCw as Te, Save as Ee, Settings as De, X as Oe } from "lucide-react";
8
- import { DndContext as ke, PointerSensor as Ae, closestCenter as je, useSensor as Me, useSensors as Ne } from "@dnd-kit/core";
9
- import { SortableContext as Pe, arrayMove as Fe, rectSortingStrategy as Ie, useSortable as Le, verticalListSortingStrategy as Re } from "@dnd-kit/sortable";
10
- import { CSS as ze } from "@dnd-kit/utilities";
11
- import { formatCurrency as Be, formatDate as Ve, formatPercent as He, getCellRenderer as Ue, resolveCellRendererType as We } from "@object-ui/fields";
12
- import { Fragment as Ge, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
- import { ResponsiveGridLayout as Ke, useContainerWidth as qe } from "react-grid-layout";
1
+ import { ComponentRegistry as e, DATE_RANGE_PRESETS as t, buildChartSeries as n, buildDatasetDrillFilter as r, buildDatasetFieldHelpers as i, buildDimensionLabelMap as a, buildOptionColorMap as o, buildWidgetScopedFilter as s, compareToTrendLabelKey as c, computeDrillFilter as l, dashboardFilterVariableDefs as u, extractRecords as d, findChartSeriesRow as f, formatDimensionValue as p, formatMeasure as m, isDrillEnabled as h, mergeFilters as g, relabelDimensions as _, resolveDashboardFilterDefs as v, resolveDateMacros as y, resolveDrillTitle as b, shiftFilterByCompareTo as x } from "@object-ui/core";
2
+ import { PageVariablesProvider as S, SchemaRenderer as C, SchemaRendererContext as w, useActionEngine as T, useDataScope as E, useDnd as D, useDrillNavigation as O, useHasDndProvider as k, useObjectLabel as A, usePageVariables as j } from "@object-ui/react";
3
+ import { createSafeTranslation as M, resolveFieldCurrency as ee, useLocalization as te, useObjectTranslation as N, useSafeFieldLabel as ne, useSafeTranslate as P } from "@object-ui/i18n";
4
+ import { Button as F, Calendar as re, Card as I, CardContent as ie, CardHeader as L, CardTitle as R, ChartSkeleton as z, Combobox as ae, ConfigPanelRenderer as oe, ConfigRow as se, DataEmptyState as ce, Dialog as le, DialogContent as ue, DialogHeader as de, DialogTitle as fe, GridSkeleton as B, Input as pe, Popover as me, PopoverContent as he, PopoverTrigger as ge, RefreshIndicator as V, Select as _e, SelectContent as H, SelectItem as U, SelectTrigger as ve, SelectValue as ye, Sheet as be, SheetContent as xe, SheetHeader as Se, SheetTitle as Ce, Skeleton as W, cn as G, getLazyIcon as we, useConfigDraft as Te } from "@object-ui/components";
5
+ import * as K from "react";
6
+ import Ee, { Fragment as De, forwardRef as Oe, useCallback as q, useContext as ke, useEffect as J, useMemo as Y, useRef as Ae, useState as X } from "react";
7
+ import { AlertCircle as je, AlertTriangle as Me, ArrowDownIcon as Ne, ArrowUpIcon as Pe, ArrowUpRight as Fe, BarChart3 as Ie, CalendarIcon as Le, Download as Re, Edit as ze, GripVertical as Be, Loader2 as Ve, MinusIcon as He, RefreshCw as Ue, RotateCcw as We, Save as Ge, Settings as Ke, X as qe } from "lucide-react";
8
+ import { DndContext as Je, PointerSensor as Ye, closestCenter as Xe, useSensor as Ze, useSensors as Qe } from "@dnd-kit/core";
9
+ import { SortableContext as $e, arrayMove as et, rectSortingStrategy as tt, useSortable as nt, verticalListSortingStrategy as rt } from "@dnd-kit/sortable";
10
+ import { CSS as it } from "@dnd-kit/utilities";
11
+ import { formatCurrency as at, formatDate as ot, formatPercent as st, getCellRenderer as ct, resolveCellRendererType as lt } from "@object-ui/fields";
12
+ import { Fragment as ut, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
+ import { ResponsiveGridLayout as dt, useContainerWidth as ft } from "react-grid-layout";
14
14
  import "react-grid-layout/css/styles.css";
15
15
  //#region src/utils.ts
16
16
  function $(e) {
17
17
  return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
18
18
  }
19
- function Je(e, t) {
19
+ function pt(e, t) {
20
20
  if (t == null || e == null || typeof e != "number" || !Number.isFinite(e) || typeof t != "number" || !Number.isFinite(t)) return null;
21
21
  if (t === 0) return e === 0 ? {
22
22
  value: 0,
@@ -38,7 +38,7 @@ function Je(e, t) {
38
38
  }
39
39
  //#endregion
40
40
  //#region src/recordFields.tsx
41
- var Ye = /* @__PURE__ */ new Set([
41
+ var mt = /* @__PURE__ */ new Set([
42
42
  "id",
43
43
  "organization_id",
44
44
  "tenant_id",
@@ -52,15 +52,15 @@ var Ye = /* @__PURE__ */ new Set([
52
52
  "_id",
53
53
  "__typename"
54
54
  ]);
55
- function Xe(e, t) {
56
- return t && (t.isSystem === !0 || t.system === !0) ? !0 : Ye.has(e);
55
+ function ht(e, t) {
56
+ return t && (t.isSystem === !0 || t.system === !0) ? !0 : mt.has(e);
57
57
  }
58
- var Ze = /* @__PURE__ */ new Set([
58
+ var gt = /* @__PURE__ */ new Set([
59
59
  "select",
60
60
  "picklist",
61
61
  "dropdown",
62
62
  "status"
63
- ]), Qe = /* @__PURE__ */ new Set([
63
+ ]), _t = /* @__PURE__ */ new Set([
64
64
  "currency",
65
65
  "money",
66
66
  "number",
@@ -70,7 +70,7 @@ var Ze = /* @__PURE__ */ new Set([
70
70
  "percent",
71
71
  "percentage"
72
72
  ]);
73
- function $e(e) {
73
+ function vt(e) {
74
74
  let t = {}, n = e?.fields;
75
75
  if (!n) return t;
76
76
  if (Array.isArray(n)) for (let e of n) e?.name && (t[e.name] = e);
@@ -80,9 +80,9 @@ function $e(e) {
80
80
  };
81
81
  return t;
82
82
  }
83
- function et(e) {
83
+ function yt(e) {
84
84
  let { accessorKey: t, label: n, def: r, objectName: i, fieldOptionLabel: a, overrides: o = {} } = e, s = o.referenceTo ?? r?.referenceTo ?? (typeof r?.reference == "string" ? r.reference : r?.reference?.to) ?? r?.target, c = o.options ?? r?.options;
85
- return i && c && a && Ze.has(r?.type) && (c = c.map((e) => {
85
+ return i && c && a && gt.has(r?.type) && (c = c.map((e) => {
86
86
  if (e == null) return e;
87
87
  let n = typeof e == "object" ? e.value : e, r = typeof e == "object" && e.label || String(n);
88
88
  return {
@@ -101,10 +101,10 @@ function et(e) {
101
101
  decimals: o.decimals ?? r?.decimals ?? r?.scale
102
102
  };
103
103
  }
104
- function tt(e) {
105
- return Qe.has(e.type) || typeof e.format == "string" && /^[\$¥€£]|%$|0/.test(e.format);
104
+ function bt(e) {
105
+ return _t.has(e.type) || typeof e.format == "string" && /^[\$¥€£]|%$|0/.test(e.format);
106
106
  }
107
- function nt(e, t, n) {
107
+ function xt(e, t, n) {
108
108
  if (e == null || e === "") return "";
109
109
  let r = t.format;
110
110
  if (typeof r == "string" && /^\$|¥|€|£/.test(r) && typeof e == "number") {
@@ -114,20 +114,20 @@ function nt(e, t, n) {
114
114
  "€": "EUR",
115
115
  "£": "GBP"
116
116
  }[r[0]];
117
- return Be(e, t.currency || i || n);
117
+ return at(e, t.currency || i || n);
118
118
  }
119
119
  if (typeof r == "string" && /%/.test(r) && typeof e == "number") {
120
120
  let t = (r.match(/0\.(0+)%/) || [, ""])[1].length;
121
- return He((e > 1 ? e / 100 : e) * 100, t);
121
+ return st((e > 1 ? e / 100 : e) * 100, t);
122
122
  }
123
- return typeof r == "string" && /[YMDHms]/.test(r) ? Ve(e, r) : /* @__PURE__ */ Z(Ue(We(t)), {
123
+ return typeof r == "string" && /[YMDHms]/.test(r) ? ot(e, r) : /* @__PURE__ */ Z(ct(lt(t)), {
124
124
  value: e,
125
125
  field: t
126
126
  });
127
127
  }
128
128
  //#endregion
129
129
  //#region src/RecordDetailDrawer.tsx
130
- var rt = [
130
+ var St = [
131
131
  "name",
132
132
  "title",
133
133
  "label",
@@ -135,21 +135,21 @@ var rt = [
135
135
  "display_name",
136
136
  "full_name"
137
137
  ];
138
- function it(e, t) {
138
+ function Ct(e, t) {
139
139
  if (t && t.trim()) return t;
140
- for (let t of rt) {
140
+ for (let t of St) {
141
141
  let n = e[t];
142
142
  if (typeof n == "string" && n.trim()) return n;
143
143
  }
144
144
  let n = e.id ?? e._id;
145
145
  return n == null ? "Record" : String(n);
146
146
  }
147
- var at = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
148
- let { fieldLabel: s, fieldOptionLabel: c } = k(), { currency: l } = D(), u = J(() => {
147
+ var wt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
148
+ let { fieldLabel: s, fieldOptionLabel: c } = ne(), { currency: l } = te(), u = Y(() => {
149
149
  if (!e) return [];
150
- let i = $e(n), a;
151
- return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Xe(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Xe(e)), a.map((n) => {
152
- let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? s(t, n, a) : a, u = et({
150
+ let i = vt(n), a;
151
+ return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !ht(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !ht(e)), a.map((n) => {
152
+ let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? s(t, n, a) : a, u = yt({
153
153
  accessorKey: n,
154
154
  label: o,
155
155
  def: r,
@@ -159,8 +159,8 @@ var at = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
159
159
  return {
160
160
  key: n,
161
161
  label: o,
162
- node: nt(e[n], u, l),
163
- numeric: tt(u)
162
+ node: xt(e[n], u, l),
163
+ numeric: bt(u)
164
164
  };
165
165
  });
166
166
  }, [
@@ -173,7 +173,7 @@ var at = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
173
173
  l
174
174
  ]);
175
175
  if (!e) return null;
176
- let d = it(e, i), f = /* @__PURE__ */ Z("dl", {
176
+ let d = Ct(e, i), f = /* @__PURE__ */ Z("dl", {
177
177
  className: "divide-y divide-border/60",
178
178
  "data-testid": "record-detail-body",
179
179
  children: u.map((e) => /* @__PURE__ */ Q("div", {
@@ -190,23 +190,23 @@ var at = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
190
190
  })]
191
191
  }, e.key))
192
192
  });
193
- return a === "dialog" ? /* @__PURE__ */ Z(z, {
193
+ return a === "dialog" ? /* @__PURE__ */ Z(le, {
194
194
  open: !0,
195
195
  onOpenChange: (e) => !e && o(),
196
- children: /* @__PURE__ */ Q(ne, {
196
+ children: /* @__PURE__ */ Q(ue, {
197
197
  className: "max-w-2xl",
198
- children: [/* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Z(V, { children: d }) }), /* @__PURE__ */ Z("div", {
198
+ children: [/* @__PURE__ */ Z(de, { children: /* @__PURE__ */ Z(fe, { children: d }) }), /* @__PURE__ */ Z("div", {
199
199
  className: "max-h-[70vh] overflow-auto",
200
200
  children: f
201
201
  })]
202
202
  })
203
- }) : /* @__PURE__ */ Z(ae, {
203
+ }) : /* @__PURE__ */ Z(be, {
204
204
  open: !0,
205
205
  onOpenChange: (e) => !e && o(),
206
- children: /* @__PURE__ */ Q(oe, {
206
+ children: /* @__PURE__ */ Q(xe, {
207
207
  side: "right",
208
208
  className: "w-full sm:max-w-md md:max-w-lg flex flex-col",
209
- children: [/* @__PURE__ */ Z(se, { children: /* @__PURE__ */ Z(ce, { children: d }) }), /* @__PURE__ */ Z("div", {
209
+ children: [/* @__PURE__ */ Z(Se, { children: /* @__PURE__ */ Z(Ce, { children: d }) }), /* @__PURE__ */ Z("div", {
210
210
  className: "flex-1 overflow-auto mt-2 pr-1",
211
211
  children: f
212
212
  })]
@@ -215,13 +215,13 @@ var at = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
215
215
  };
216
216
  //#endregion
217
217
  //#region src/ObjectDataTable.tsx
218
- function ot(e) {
218
+ function Tt(e) {
219
219
  return e.map((e) => typeof e == "string" ? {
220
220
  header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
221
221
  accessorKey: e
222
222
  } : e);
223
223
  }
224
- function st(e, t) {
224
+ function Et(e, t) {
225
225
  if (!t?.fields) return [];
226
226
  let n = {};
227
227
  if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
@@ -239,38 +239,38 @@ function st(e, t) {
239
239
  } else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
240
240
  return Array.from(a);
241
241
  }
242
- var ct = ({ schema: e, dataSource: t, className: n }) => {
243
- let { currency: r } = D(), i = pe(v), a = t || i?.dataSource, o = b(e.bind), { fieldLabel: s, fieldOptionLabel: l } = k(), u = "No data available", d = "No data source available for";
242
+ var Dt = ({ schema: e, dataSource: t, className: n }) => {
243
+ let { currency: r } = te(), i = ke(w), a = t || i?.dataSource, o = E(e.bind), { fieldLabel: s, fieldOptionLabel: c } = ne(), l = "No data available", u = "No data source available for";
244
244
  try {
245
- let { t: e } = O(), t = e("dashboard.noDataAvailable");
246
- t && t !== "dashboard.noDataAvailable" && (u = t);
245
+ let { t: e } = N(), t = e("dashboard.noDataAvailable");
246
+ t && t !== "dashboard.noDataAvailable" && (l = t);
247
247
  let n = e("dashboard.noDataSourceFor");
248
- n && n !== "dashboard.noDataSourceFor" && (d = n);
248
+ n && n !== "dashboard.noDataSourceFor" && (u = n);
249
249
  } catch {}
250
- let [p, h] = Y([]), [g, y] = Y(null), [x, S] = Y(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, w] = Y(null), T = e.drillDown, E = f(T) && (T?.mode ?? "record") === "record", [A, j] = Y(null), ee = K((e) => {
251
- j(e ?? null);
250
+ let [f, p] = X([]), [m, g] = X(null), [_, v] = X(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [b, x] = X(null), S = e.drillDown, T = h(S) && (S?.mode ?? "record") === "record", [D, O] = X(null), k = q((e) => {
251
+ O(e ?? null);
252
252
  }, []);
253
- q(() => {
253
+ J(() => {
254
254
  let t = !0;
255
255
  return e.objectName && !o && (!e.data || e.data.length === 0) ? (async () => {
256
256
  if (!a || !e.objectName) {
257
- t && S(!1);
257
+ t && v(!1);
258
258
  return;
259
259
  }
260
- t && (S(!0), w(null));
260
+ t && (v(!0), x(null));
261
261
  try {
262
262
  let n;
263
263
  if (typeof a.find == "function") {
264
- let t = st(e, g), r = { $filter: m(e.filter) };
265
- t.length && (r.$expand = t), n = c(await a.find(e.objectName, r));
264
+ let t = Et(e, m), r = { $filter: y(e.filter) };
265
+ t.length && (r.$expand = t), n = d(await a.find(e.objectName, r));
266
266
  } else return;
267
- t && h(n);
267
+ t && p(n);
268
268
  } catch (e) {
269
- console.error("[ObjectDataTable] Fetch error:", e), t && w(e instanceof Error ? e.message : "Failed to load data");
269
+ console.error("[ObjectDataTable] Fetch error:", e), t && x(e instanceof Error ? e.message : "Failed to load data");
270
270
  } finally {
271
- t && S(!1);
271
+ t && v(!1);
272
272
  }
273
- })() : t && S(!1), () => {
273
+ })() : t && v(!1), () => {
274
274
  t = !1;
275
275
  };
276
276
  }, [
@@ -279,19 +279,19 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
279
279
  o,
280
280
  e.data,
281
281
  e.filter,
282
- g
283
- ]), q(() => {
282
+ m
283
+ ]), J(() => {
284
284
  let t = !0;
285
285
  if (!(!a || !e.objectName || typeof a.getObjectSchema != "function")) return a.getObjectSchema(e.objectName).then((e) => {
286
- t && y(e);
286
+ t && g(e);
287
287
  }).catch(() => {}), () => {
288
288
  t = !1;
289
289
  };
290
290
  }, [e.objectName, a]);
291
- let M = o || e.data || p, N = Array.isArray(M) ? M : [], P = J(() => {
291
+ let A = o || e.data || f, j = Array.isArray(A) ? A : [], M = Y(() => {
292
292
  let t = e.objectName, n = {};
293
- if (g?.fields) {
294
- let e = g.fields;
293
+ if (m?.fields) {
294
+ let e = m.fields;
295
295
  if (Array.isArray(e)) for (let t of e) t?.name && (n[t.name] = t);
296
296
  else for (let [t, r] of Object.entries(e)) n[t] = {
297
297
  name: t,
@@ -302,12 +302,12 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
302
302
  let n = e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1");
303
303
  return t ? s(t, e, n) : n;
304
304
  }, a = (e) => {
305
- let i = et({
305
+ let i = yt({
306
306
  accessorKey: e.accessorKey,
307
307
  label: e.header,
308
308
  def: n[e.accessorKey],
309
309
  objectName: t,
310
- fieldOptionLabel: l,
310
+ fieldOptionLabel: c,
311
311
  overrides: {
312
312
  type: e.type,
313
313
  format: e.format,
@@ -316,13 +316,13 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
316
316
  currency: e.currency,
317
317
  decimals: e.decimals
318
318
  }
319
- }), a = e.align ?? (tt(i) ? "right" : void 0);
319
+ }), a = e.align ?? (bt(i) ? "right" : void 0);
320
320
  if (typeof e.cell == "function") return {
321
321
  ...e,
322
322
  ...i,
323
323
  align: a
324
324
  };
325
- let o = (e) => nt(e, i, r);
325
+ let o = (e) => xt(e, i, r);
326
326
  return {
327
327
  ...e,
328
328
  ...i,
@@ -331,37 +331,37 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
331
331
  };
332
332
  };
333
333
  if (e.columns && e.columns.length > 0) {
334
- let n = ot(e.columns);
334
+ let n = Tt(e.columns);
335
335
  return (t ? n.map((e) => ({
336
336
  ...e,
337
337
  header: s(t, e.accessorKey, e.header)
338
338
  })) : n).map(a);
339
339
  }
340
- return N.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Xe(e, n[e])) : Object.keys(N[0]).filter((e) => !e.startsWith("_") && !Xe(e))).map((e) => a({
340
+ return j.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !ht(e, n[e])) : Object.keys(j[0]).filter((e) => !e.startsWith("_") && !ht(e))).map((e) => a({
341
341
  header: i(e),
342
342
  accessorKey: e
343
343
  }));
344
344
  }, [
345
345
  e.columns,
346
346
  e.objectName,
347
- N,
348
- g,
347
+ j,
348
+ m,
349
349
  s,
350
- l,
350
+ c,
351
351
  r
352
352
  ]);
353
- if (x && N.length === 0) return /* @__PURE__ */ Z("div", {
354
- className: U("overflow-auto", n),
353
+ if (_ && j.length === 0) return /* @__PURE__ */ Z("div", {
354
+ className: G("overflow-auto", n),
355
355
  "data-testid": "table-loading",
356
356
  children: /* @__PURE__ */ Q("div", {
357
357
  className: "space-y-2 p-2",
358
358
  children: [/* @__PURE__ */ Q("div", {
359
359
  className: "flex gap-2",
360
360
  children: [
361
- /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" }),
362
- /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" }),
363
- /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" }),
364
- /* @__PURE__ */ Z(H, { className: "h-6 w-1/4" })
361
+ /* @__PURE__ */ Z(W, { className: "h-6 w-1/4" }),
362
+ /* @__PURE__ */ Z(W, { className: "h-6 w-1/4" }),
363
+ /* @__PURE__ */ Z(W, { className: "h-6 w-1/4" }),
364
+ /* @__PURE__ */ Z(W, { className: "h-6 w-1/4" })
365
365
  ]
366
366
  }), [
367
367
  1,
@@ -371,16 +371,16 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
371
371
  ].map((e) => /* @__PURE__ */ Q("div", {
372
372
  className: "flex gap-2",
373
373
  children: [
374
- /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" }),
375
- /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" }),
376
- /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" }),
377
- /* @__PURE__ */ Z(H, { className: "h-5 w-1/4" })
374
+ /* @__PURE__ */ Z(W, { className: "h-5 w-1/4" }),
375
+ /* @__PURE__ */ Z(W, { className: "h-5 w-1/4" }),
376
+ /* @__PURE__ */ Z(W, { className: "h-5 w-1/4" }),
377
+ /* @__PURE__ */ Z(W, { className: "h-5 w-1/4" })
378
378
  ]
379
379
  }, e))]
380
380
  })
381
381
  });
382
- if (C) return /* @__PURE__ */ Z("div", {
383
- className: U("overflow-auto", n),
382
+ if (b) return /* @__PURE__ */ Z("div", {
383
+ className: G("overflow-auto", n),
384
384
  "data-testid": "table-error",
385
385
  children: /* @__PURE__ */ Q("div", {
386
386
  className: "flex flex-col items-center justify-center py-8 text-destructive",
@@ -415,18 +415,18 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
415
415
  ]
416
416
  }), /* @__PURE__ */ Z("p", {
417
417
  className: "text-xs",
418
- children: C
418
+ children: b
419
419
  })]
420
420
  })
421
421
  });
422
- if (!a && e.objectName && N.length === 0) return /* @__PURE__ */ Z("div", {
423
- className: U("overflow-auto", n),
422
+ if (!a && e.objectName && j.length === 0) return /* @__PURE__ */ Z("div", {
423
+ className: G("overflow-auto", n),
424
424
  children: /* @__PURE__ */ Z("div", {
425
425
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
426
426
  children: /* @__PURE__ */ Q("p", {
427
427
  className: "text-xs",
428
428
  children: [
429
- d,
429
+ u,
430
430
  " “",
431
431
  e.objectName,
432
432
  "”"
@@ -434,8 +434,8 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
434
434
  })
435
435
  })
436
436
  });
437
- if (N.length === 0) return /* @__PURE__ */ Z("div", {
438
- className: U("overflow-auto", n),
437
+ if (j.length === 0) return /* @__PURE__ */ Z("div", {
438
+ className: G("overflow-auto", n),
439
439
  "data-testid": "table-empty-state",
440
440
  children: /* @__PURE__ */ Q("div", {
441
441
  className: "flex flex-col items-center justify-center py-8 text-muted-foreground",
@@ -472,39 +472,39 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
472
472
  ]
473
473
  }), /* @__PURE__ */ Z("p", {
474
474
  className: "text-xs",
475
- children: u
475
+ children: l
476
476
  })]
477
477
  })
478
478
  });
479
- let F = {
479
+ let ee = {
480
480
  ...e,
481
481
  type: "data-table",
482
- data: N,
483
- columns: P,
484
- onRowClick: e.onRowClick ?? (E ? ee : void 0)
485
- }, I = T?.title && !T.title.includes("${") ? T.title : void 0;
482
+ data: j,
483
+ columns: M,
484
+ onRowClick: e.onRowClick ?? (T ? k : void 0)
485
+ }, P = S?.title && !S.title.includes("${") ? S.title : void 0;
486
486
  return /* @__PURE__ */ Q("div", {
487
- className: U("relative", n),
487
+ className: G("relative", n),
488
488
  children: [
489
- /* @__PURE__ */ Z(ie, { active: x && N.length > 0 }),
490
- /* @__PURE__ */ Z(_, {
491
- schema: F,
489
+ /* @__PURE__ */ Z(V, { active: _ && j.length > 0 }),
490
+ /* @__PURE__ */ Z(C, {
491
+ schema: ee,
492
492
  className: n
493
493
  }),
494
- E && /* @__PURE__ */ Z(at, {
495
- record: A,
494
+ T && /* @__PURE__ */ Z(wt, {
495
+ record: D,
496
496
  objectName: e.objectName,
497
- objectSchema: g,
498
- fields: T?.columns,
499
- title: I,
500
- target: T?.target === "dialog" ? "dialog" : "drawer",
501
- onClose: () => j(null)
497
+ objectSchema: m,
498
+ fields: S?.columns,
499
+ title: P,
500
+ target: S?.target === "dialog" ? "dialog" : "drawer",
501
+ onClose: () => O(null)
502
502
  })
503
503
  ]
504
504
  });
505
- }, lt = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
506
- let { openRecordList: i } = S(), a = A();
507
- return !i || !e ? null : /* @__PURE__ */ Q(j, {
505
+ }, Ot = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
506
+ let { openRecordList: i } = O(), a = P();
507
+ return !i || !e ? null : /* @__PURE__ */ Q(F, {
508
508
  type: "button",
509
509
  variant: "ghost",
510
510
  size: "sm",
@@ -513,23 +513,23 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
513
513
  onClick: () => {
514
514
  i(e, t), n?.();
515
515
  },
516
- children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Z(ve, { className: "ml-1 h-3.5 w-3.5" })]
516
+ children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Z(Fe, { className: "ml-1 h-3.5 w-3.5" })]
517
517
  });
518
- }, ut = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
519
- let { openRecordList: d } = S(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
520
- if (de.useEffect(() => {
518
+ }, kt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
519
+ let { openRecordList: d } = O(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
520
+ if (Ee.useEffect(() => {
521
521
  e && p && (d(i, a), t());
522
522
  }, [e, p]), p) return null;
523
- let m = f ? null : /* @__PURE__ */ Z(lt, {
523
+ let m = f ? null : /* @__PURE__ */ Z(Ot, {
524
524
  objectName: i,
525
525
  filter: a,
526
526
  onNavigate: t
527
527
  }), h = /* @__PURE__ */ Z("div", {
528
- className: U("overflow-auto", l),
528
+ className: G("overflow-auto", l),
529
529
  "data-testid": "drill-down-body",
530
530
  children: f ? (() => {
531
531
  let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a;
532
- return /* @__PURE__ */ Z(_, { schema: {
532
+ return /* @__PURE__ */ Z(C, { schema: {
533
533
  ...u,
534
534
  type: "spec-report",
535
535
  report: {
@@ -538,7 +538,7 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
538
538
  },
539
539
  filter: t
540
540
  } });
541
- })() : /* @__PURE__ */ Z(ct, {
541
+ })() : /* @__PURE__ */ Z(Dt, {
542
542
  schema: {
543
543
  type: "object-data-table",
544
544
  objectName: i,
@@ -559,69 +559,69 @@ var ct = ({ schema: e, dataSource: t, className: n }) => {
559
559
  dataSource: o
560
560
  })
561
561
  });
562
- return r === "dialog" ? /* @__PURE__ */ Z(z, {
562
+ return r === "dialog" ? /* @__PURE__ */ Z(le, {
563
563
  open: e,
564
564
  onOpenChange: (e) => !e && t(),
565
- children: /* @__PURE__ */ Q(ne, {
565
+ children: /* @__PURE__ */ Q(ue, {
566
566
  className: "max-w-5xl",
567
- children: [/* @__PURE__ */ Q(B, {
567
+ children: [/* @__PURE__ */ Q(de, {
568
568
  className: "flex-row items-center justify-between gap-4 pr-8",
569
- children: [/* @__PURE__ */ Z(V, { children: n }), m]
569
+ children: [/* @__PURE__ */ Z(fe, { children: n }), m]
570
570
  }), h]
571
571
  })
572
- }) : /* @__PURE__ */ Z(ae, {
572
+ }) : /* @__PURE__ */ Z(be, {
573
573
  open: e,
574
574
  onOpenChange: (e) => !e && t(),
575
- children: /* @__PURE__ */ Q(oe, {
575
+ children: /* @__PURE__ */ Q(xe, {
576
576
  side: "right",
577
577
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
578
- children: [/* @__PURE__ */ Q(se, {
578
+ children: [/* @__PURE__ */ Q(Se, {
579
579
  className: "flex-row items-center justify-between gap-4 pr-8",
580
- children: [/* @__PURE__ */ Z(ce, { children: n }), m]
580
+ children: [/* @__PURE__ */ Z(Ce, { children: n }), m]
581
581
  }), /* @__PURE__ */ Z("div", {
582
582
  className: "flex-1 overflow-hidden mt-2",
583
583
  children: h
584
584
  })]
585
585
  })
586
586
  });
587
- }, dt = n;
588
- function ft(e, t, n) {
587
+ }, At = r;
588
+ function jt(e, t, n) {
589
589
  let r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
590
590
  return e.forEach((e, c) => {
591
- let l = t.map((t) => String(e[t] ?? "∅")).join(""), d = String(e[n] ?? "∅");
591
+ let l = t.map((t) => String(e[t] ?? "∅")).join(""), u = String(e[n] ?? "∅");
592
592
  a.has(l) || (a.add(l), r.push({
593
593
  id: l,
594
- labels: t.map((t) => u(e[t]))
595
- })), o.has(d) || (o.add(d), i.push({
596
- id: d,
597
- label: u(e[n])
598
- })), s.set(`${l} ${d}`, c);
594
+ labels: t.map((t) => p(e[t]))
595
+ })), o.has(u) || (o.add(u), i.push({
596
+ id: u,
597
+ label: p(e[n])
598
+ })), s.set(`${l} ${u}`, c);
599
599
  }), {
600
600
  rowHeaders: r,
601
601
  colHeaders: i,
602
602
  cellIndex: s
603
603
  };
604
604
  }
605
- function pt(e) {
605
+ function Mt(e) {
606
606
  if (e == null) return "";
607
607
  let t = String(e);
608
608
  return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
609
609
  }
610
- function mt(e) {
611
- return e.map((e) => e.map(pt).join(",")).join("\r\n");
610
+ function Nt(e) {
611
+ return e.map((e) => e.map(Mt).join(",")).join("\r\n");
612
612
  }
613
- function ht(e, t) {
613
+ function Pt(e, t) {
614
614
  if (typeof document > "u") return;
615
- let n = e && e.trim() ? e.trim() : "export", r = new Blob([`${mt(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
615
+ let n = e && e.trim() ? e.trim() : "export", r = new Blob([`${Nt(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
616
616
  a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
617
617
  }
618
- var gt = /* @__PURE__ */ new Set([
618
+ var Ft = /* @__PURE__ */ new Set([
619
619
  "metric",
620
620
  "kpi",
621
621
  "gauge",
622
622
  "solid-gauge",
623
623
  "bullet"
624
- ]), _t = {
624
+ ]), It = {
625
625
  bar: "bar",
626
626
  column: "column",
627
627
  "horizontal-bar": "horizontal-bar",
@@ -643,22 +643,22 @@ var gt = /* @__PURE__ */ new Set([
643
643
  treemap: "treemap",
644
644
  sankey: "sankey"
645
645
  };
646
- function vt({ widget: e, dataSource: n }) {
647
- let o = String(e?.dataset ?? ""), s = J(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), c = J(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), f = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, h = String(e?.type ?? ""), g = gt.has(h) || s.length === 0, v = h === "table" || h === "pivot", y = h === "pivot" && s.length >= 2, b = y ? s.slice(0, -1) : [], x = y ? s[s.length - 1] : "", S = y ? [
648
- b,
649
- [x],
646
+ function Lt({ widget: e, dataSource: t }) {
647
+ let r = String(e?.dataset ?? ""), s = Y(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), c = Y(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), l = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, u = String(e?.type ?? ""), d = Ft.has(u) || s.length === 0, h = u === "table" || u === "pivot", g = u === "pivot" && s.length >= 2, v = g ? s.slice(0, -1) : [], b = g ? s[s.length - 1] : "", x = g ? [
648
+ v,
649
+ [b],
650
650
  []
651
- ] : void 0, C = A(), { fieldLabel: w } = k(), T = e?.filter, E = J(() => T && typeof T == "object" && Object.keys(T).length > 0 ? m(T) : void 0, [T]), [D, O] = Y({
651
+ ] : void 0, S = P(), { fieldLabel: w } = ne(), T = e?.filter, E = Y(() => T && typeof T == "object" && Object.keys(T).length > 0 ? y(T) : void 0, [T]), [D, O] = X({
652
652
  status: "idle",
653
653
  rows: []
654
- }), [j, ee] = Y(null), [M, N] = Y(null), [P, I] = Y(null);
655
- if (q(() => {
656
- let e = n;
654
+ }), [k, A] = X(null), [j, M] = X(null), [ee, te] = X(null);
655
+ if (J(() => {
656
+ let e = t;
657
657
  if (!e || typeof e.queryDataset != "function") {
658
658
  O({
659
659
  status: "error",
660
660
  rows: [],
661
- error: C("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
661
+ error: S("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
662
662
  });
663
663
  return;
664
664
  }
@@ -669,18 +669,18 @@ function vt({ widget: e, dataSource: n }) {
669
669
  });
670
670
  return;
671
671
  }
672
- let t = !1;
672
+ let n = !1;
673
673
  return O({
674
674
  status: "loading",
675
675
  rows: []
676
- }), e.queryDataset(o, {
676
+ }), e.queryDataset(r, {
677
677
  dimensions: s,
678
678
  measures: c,
679
679
  ...E ? { runtimeFilter: E } : {},
680
- ...f ? { compareTo: f } : {},
681
- ...S ? { totals: { groupings: S } } : {}
680
+ ...l ? { compareTo: l } : {},
681
+ ...x ? { totals: { groupings: x } } : {}
682
682
  }).then((e) => {
683
- t || O({
683
+ n || O({
684
684
  status: "ok",
685
685
  rows: Array.isArray(e?.rows) ? e.rows : [],
686
686
  fields: Array.isArray(e?.fields) ? e.fields : [],
@@ -690,22 +690,22 @@ function vt({ widget: e, dataSource: n }) {
690
690
  totals: Array.isArray(e?.totals) ? e.totals : void 0
691
691
  });
692
692
  }).catch((e) => {
693
- t || O({
693
+ n || O({
694
694
  status: "error",
695
695
  rows: [],
696
696
  error: String(e?.message ?? e)
697
697
  });
698
698
  }), () => {
699
- t = !0;
699
+ n = !0;
700
700
  };
701
- }, [`${h}|${o}|${s.join(",")}|${c.join(",")}|${JSON.stringify(T ?? null)}|${JSON.stringify(f ?? null)}`]), q(() => {
702
- if (g || v) {
703
- N(null), I(null);
701
+ }, [`${u}|${r}|${s.join(",")}|${c.join(",")}|${JSON.stringify(T ?? null)}|${JSON.stringify(l ?? null)}`]), J(() => {
702
+ if (d || h) {
703
+ M(null), te(null);
704
704
  return;
705
705
  }
706
706
  let e = D.object;
707
707
  if (!e || s.length === 0) {
708
- N(null), I(null);
708
+ M(null), te(null);
709
709
  return;
710
710
  }
711
711
  let t = (e) => D.dimensionFields && D.dimensionFields[e] || e, n = !1;
@@ -714,14 +714,14 @@ function vt({ widget: e, dataSource: n }) {
714
714
  let r = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(e)}`, {
715
715
  headers: { accept: "application/json" },
716
716
  credentials: "include"
717
- })).json().catch(() => null), o = r?.item ?? r?.data ?? r, c = a(o?.fields?.[t(s[0])]?.options), l = {};
717
+ })).json().catch(() => null), i = r?.item ?? r?.data ?? r, c = o(i?.fields?.[t(s[0])]?.options), l = {};
718
718
  for (let e of s) {
719
- let n = i(o?.fields?.[t(e)]?.options);
719
+ let n = a(i?.fields?.[t(e)]?.options);
720
720
  n && (l[e] = n);
721
721
  }
722
- n || (N(c), I(Object.keys(l).length > 0 ? l : null));
722
+ n || (M(c), te(Object.keys(l).length > 0 ? l : null));
723
723
  } catch {
724
- n || (N(null), I(null));
724
+ n || (M(null), te(null));
725
725
  }
726
726
  })(), () => {
727
727
  n = !0;
@@ -730,11 +730,11 @@ function vt({ widget: e, dataSource: n }) {
730
730
  D.object,
731
731
  D.dimensionFields,
732
732
  s,
733
- g,
734
- v
733
+ d,
734
+ h
735
735
  ]), c.length === 0) return /* @__PURE__ */ Z("div", {
736
736
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
737
- children: C("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
737
+ children: S("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
738
738
  });
739
739
  if (D.status === "loading" || D.status === "idle") return /* @__PURE__ */ Q("div", {
740
740
  className: "h-full w-full p-2",
@@ -744,79 +744,79 @@ function vt({ widget: e, dataSource: n }) {
744
744
  "aria-live": "polite",
745
745
  children: [/* @__PURE__ */ Z("span", {
746
746
  className: "sr-only",
747
- children: C("dashboard.loading", "Loading…")
748
- }), g ? /* @__PURE__ */ Q("div", {
747
+ children: S("dashboard.loading", "Loading…")
748
+ }), d ? /* @__PURE__ */ Q("div", {
749
749
  className: "flex h-full w-full flex-col items-start justify-center gap-2 p-2",
750
- children: [/* @__PURE__ */ Z(H, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Z(H, { className: "h-3 w-20 rounded" })]
751
- }) : v ? /* @__PURE__ */ Z(re, {
750
+ children: [/* @__PURE__ */ Z(W, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Z(W, { className: "h-3 w-20 rounded" })]
751
+ }) : h ? /* @__PURE__ */ Z(B, {
752
752
  className: "h-full",
753
753
  rows: 5,
754
754
  columns: Math.max(2, s.length + c.length)
755
- }) : /* @__PURE__ */ Z(F, { className: "h-full" })]
755
+ }) : /* @__PURE__ */ Z(z, { className: "h-full" })]
756
756
  });
757
757
  if (D.status === "error") return /* @__PURE__ */ Q("div", {
758
758
  role: "alert",
759
759
  className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
760
- children: [/* @__PURE__ */ Z(ge, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Z("span", {
760
+ children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Z("span", {
761
761
  className: "break-words",
762
762
  children: D.error
763
763
  })]
764
764
  });
765
- if (D.rows.length === 0 && !g) return /* @__PURE__ */ Q("div", {
765
+ if (D.rows.length === 0 && !d) return /* @__PURE__ */ Q("div", {
766
766
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
767
- children: [/* @__PURE__ */ Z(ye, { className: "mr-2 h-4 w-4" }), C("dashboard.noRows", "No rows")]
767
+ children: [/* @__PURE__ */ Z(Ie, { className: "mr-2 h-4 w-4" }), S("dashboard.noRows", "No rows")]
768
768
  });
769
- let { measureField: L, headerLabel: R } = r(D.fields, D.object, w), { object: te, dimensionFields: z, drillRawRows: ne } = D, B = z ? s.filter((e) => e in z) : [], V = !!te && B.length > 0, ie = (t, n) => {
770
- if (!te || !z) return;
771
- let r = dt(ne?.[t], B, z, E);
772
- ee({
769
+ let { measureField: N, headerLabel: F } = i(D.fields, D.object, w), { object: re, dimensionFields: I, drillRawRows: ie } = D, L = I ? s.filter((e) => e in I) : [], R = !!re && L.length > 0, ae = (t, n) => {
770
+ if (!re || !I) return;
771
+ let r = At(ie?.[t], L, I, E);
772
+ A({
773
773
  filter: r,
774
774
  title: n || String(e?.title ?? "")
775
775
  });
776
- }, ae = j && te ? /* @__PURE__ */ Z(ut, {
776
+ }, oe = k && re ? /* @__PURE__ */ Z(kt, {
777
777
  open: !0,
778
- onClose: () => ee(null),
779
- title: j.title || String(e?.title ?? C("dashboard.details", "Details")),
780
- objectName: te,
781
- filter: j.filter,
782
- dataSource: n
778
+ onClose: () => A(null),
779
+ title: k.title || String(e?.title ?? S("dashboard.details", "Details")),
780
+ objectName: re,
781
+ filter: k.filter,
782
+ dataSource: t
783
783
  }) : null;
784
- if (g) {
785
- let e = L(c[0]);
784
+ if (d) {
785
+ let e = N(c[0]);
786
786
  return /* @__PURE__ */ Q("div", {
787
787
  className: "flex h-full w-full flex-col items-start justify-center gap-1 p-2",
788
788
  children: [/* @__PURE__ */ Z("span", {
789
789
  className: "text-2xl font-semibold tabular-nums",
790
- children: d(D.rows[0]?.[c[0]] ?? 0, e?.format, e?.currency)
790
+ children: m(D.rows[0]?.[c[0]] ?? 0, e?.format, e?.currency)
791
791
  }), /* @__PURE__ */ Z("span", {
792
792
  className: "text-xs text-muted-foreground",
793
- children: R(c[0])
793
+ children: F(c[0])
794
794
  })]
795
795
  });
796
796
  }
797
- if (v) {
797
+ if (h) {
798
798
  let t = [...s, ...c], n = /* @__PURE__ */ Z("button", {
799
799
  type: "button",
800
- onClick: () => ht(String(e?.title ?? o ?? "export"), [t.map((e) => R(e)), ...D.rows.map((e) => t.map((t) => {
800
+ onClick: () => Pt(String(e?.title ?? r ?? "export"), [t.map((e) => F(e)), ...D.rows.map((e) => t.map((t) => {
801
801
  let n = e[t];
802
802
  return n == null ? "" : typeof n == "number" ? n : String(n);
803
803
  }))]),
804
804
  "data-testid": "dataset-export",
805
- title: C("dashboard.exportCsv", "Export CSV"),
806
- "aria-label": C("dashboard.exportCsv", "Export CSV"),
805
+ title: S("dashboard.exportCsv", "Export CSV"),
806
+ "aria-label": S("dashboard.exportCsv", "Export CSV"),
807
807
  className: "absolute right-1 top-1 z-10 rounded p-1 text-muted-foreground opacity-70 hover:bg-accent/50 hover:text-foreground hover:opacity-100",
808
- children: /* @__PURE__ */ Z(be, { className: "h-3.5 w-3.5" })
808
+ children: /* @__PURE__ */ Z(Re, { className: "h-3.5 w-3.5" })
809
809
  });
810
- if (y) {
811
- let e = ft(D.rows, b, x), t = e.colHeaders.flatMap((e) => c.map((t) => ({
810
+ if (g) {
811
+ let e = jt(D.rows, v, b), t = e.colHeaders.flatMap((e) => c.map((t) => ({
812
812
  col: e,
813
813
  measure: t,
814
- header: c.length === 1 ? e.label : `${e.label} · ${R(t)}`
815
- }))), r = (e, t) => d(e, L(t)?.format, L(t)?.currency), i = (e) => D.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
816
- for (let e of i(b) ?? []) a.set(b.map((t) => String(e[t] ?? "∅")).join(""), e);
814
+ header: c.length === 1 ? e.label : `${e.label} · ${F(t)}`
815
+ }))), r = (e, t) => m(e, N(t)?.format, N(t)?.currency), i = (e) => D.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
816
+ for (let e of i(v) ?? []) a.set(v.map((t) => String(e[t] ?? "∅")).join(""), e);
817
817
  let o = /* @__PURE__ */ new Map();
818
- for (let e of i([x]) ?? []) o.set(String(e[x] ?? "∅"), e);
819
- let s = i([])?.[0], l = a.size > 0, u = o.size > 0, f = C("dashboard.total", "Total");
818
+ for (let e of i([b]) ?? []) o.set(String(e[b] ?? "∅"), e);
819
+ let s = i([])?.[0], l = a.size > 0, u = o.size > 0, d = S("dashboard.total", "Total");
820
820
  return /* @__PURE__ */ Q("div", {
821
821
  className: "relative h-full w-full overflow-auto p-1",
822
822
  "data-testid": "dataset-matrix",
@@ -827,9 +827,9 @@ function vt({ widget: e, dataSource: n }) {
827
827
  children: [/* @__PURE__ */ Z("thead", {
828
828
  className: "bg-muted/40",
829
829
  children: /* @__PURE__ */ Q("tr", { children: [
830
- b.map((e) => /* @__PURE__ */ Z("th", {
830
+ v.map((e) => /* @__PURE__ */ Z("th", {
831
831
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
832
- children: R(e)
832
+ children: F(e)
833
833
  }, e)),
834
834
  t.map((e) => /* @__PURE__ */ Z("th", {
835
835
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
@@ -838,7 +838,7 @@ function vt({ widget: e, dataSource: n }) {
838
838
  l && c.map((e) => /* @__PURE__ */ Z("th", {
839
839
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
840
840
  "data-testid": "matrix-total-col-header",
841
- children: c.length === 1 ? f : `${f} · ${R(e)}`
841
+ children: c.length === 1 ? d : `${d} · ${F(e)}`
842
842
  }, `total-${e}`))
843
843
  ] })
844
844
  }), /* @__PURE__ */ Q("tbody", { children: [e.rowHeaders.map((n) => /* @__PURE__ */ Q("tr", {
@@ -849,11 +849,11 @@ function vt({ widget: e, dataSource: n }) {
849
849
  children: e
850
850
  }, t)),
851
851
  t.map((t) => {
852
- let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : D.rows[i], o = V && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
852
+ let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : D.rows[i], o = R && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
853
853
  return /* @__PURE__ */ Z("td", {
854
- className: U("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
854
+ className: G("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
855
855
  "data-testid": o ? "dataset-drill-cell" : void 0,
856
- onClick: o ? () => ie(i, s) : void 0,
856
+ onClick: o ? () => ae(i, s) : void 0,
857
857
  children: a ? r(a[t.measure], t.measure) : "—"
858
858
  }, `${t.col.id}-${t.measure}`);
859
859
  }),
@@ -867,10 +867,10 @@ function vt({ widget: e, dataSource: n }) {
867
867
  className: "border-t bg-muted/30 font-medium",
868
868
  "data-testid": "matrix-total-row",
869
869
  children: [
870
- b.length > 0 && /* @__PURE__ */ Z("td", {
871
- colSpan: b.length,
870
+ v.length > 0 && /* @__PURE__ */ Z("td", {
871
+ colSpan: v.length,
872
872
  className: "px-2 py-1 whitespace-nowrap",
873
- children: f
873
+ children: d
874
874
  }),
875
875
  t.map((e) => /* @__PURE__ */ Z("td", {
876
876
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
@@ -884,11 +884,11 @@ function vt({ widget: e, dataSource: n }) {
884
884
  ]
885
885
  })] })]
886
886
  }),
887
- ae
887
+ oe
888
888
  ]
889
889
  });
890
890
  }
891
- let r = [...s, ...c];
891
+ let i = [...s, ...c];
892
892
  return /* @__PURE__ */ Q("div", {
893
893
  className: "relative h-full w-full overflow-auto p-1",
894
894
  children: [
@@ -897,57 +897,295 @@ function vt({ widget: e, dataSource: n }) {
897
897
  className: "w-full text-xs",
898
898
  children: [/* @__PURE__ */ Z("thead", {
899
899
  className: "bg-muted/40",
900
- children: /* @__PURE__ */ Z("tr", { children: r.map((e) => /* @__PURE__ */ Z("th", {
900
+ children: /* @__PURE__ */ Z("tr", { children: i.map((e) => /* @__PURE__ */ Z("th", {
901
901
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
902
- children: R(e)
902
+ children: F(e)
903
903
  }, e)) })
904
904
  }), /* @__PURE__ */ Z("tbody", { children: D.rows.map((e, t) => /* @__PURE__ */ Z("tr", {
905
- className: U("border-t", V && "cursor-pointer hover:bg-accent/40"),
906
- "data-testid": V ? "dataset-drill-row" : void 0,
907
- onClick: V ? () => ie(t, B.map((t) => u(e[t])).filter(Boolean).join(" / ")) : void 0,
908
- children: r.map((t) => /* @__PURE__ */ Z("td", {
905
+ className: G("border-t", R && "cursor-pointer hover:bg-accent/40"),
906
+ "data-testid": R ? "dataset-drill-row" : void 0,
907
+ onClick: R ? () => ae(t, L.map((t) => p(e[t])).filter(Boolean).join(" / ")) : void 0,
908
+ children: i.map((t) => /* @__PURE__ */ Z("td", {
909
909
  className: "px-2 py-1 whitespace-nowrap tabular-nums",
910
- children: c.includes(t) ? d(e[t], L(t)?.format, L(t)?.currency) : u(e[t])
910
+ children: c.includes(t) ? m(e[t], N(t)?.format, N(t)?.currency) : p(e[t])
911
911
  }, t))
912
912
  }, t)) })]
913
913
  }),
914
- ae
914
+ oe
915
915
  ]
916
916
  });
917
917
  }
918
- let oe = _t[h] ?? "bar", se = p(D.rows, P), { data: ce, xAxisKey: le, series: ue } = t(se, s, c, D.fields), W = V ? (e) => {
919
- let t = l(se, s, c, e?.category, e?.series);
918
+ let se = It[u] ?? "bar", ce = _(D.rows, ee), { data: le, xAxisKey: ue, series: de } = n(ce, s, c, D.fields), fe = R ? (e) => {
919
+ let t = f(ce, s, c, e?.category, e?.series);
920
920
  if (t < 0) return;
921
921
  let n = s.length >= 2 && c.length === 1, r = [e?.category, n ? e?.series : void 0].filter(Boolean).map(String).join(" / ");
922
- ie(t, r);
922
+ ae(t, r);
923
923
  } : void 0;
924
924
  return /* @__PURE__ */ Q("div", {
925
- className: U("relative h-full w-full min-h-[220px]"),
926
- children: [/* @__PURE__ */ Z(_, {
925
+ className: G("relative h-full w-full min-h-[220px]"),
926
+ children: [/* @__PURE__ */ Z(C, {
927
927
  schema: {
928
928
  type: "chart",
929
- chartType: oe,
930
- data: ce,
931
- xAxisKey: le,
932
- series: ue,
933
- ...M ? { categoryColors: M } : {}
929
+ chartType: se,
930
+ data: le,
931
+ xAxisKey: ue,
932
+ series: de,
933
+ ...j ? { categoryColors: j } : {}
934
934
  },
935
- onChartClick: W,
936
- onSegmentClick: W
937
- }), ae]
935
+ onChartClick: fe,
936
+ onSegmentClick: fe
937
+ }), oe]
938
+ });
939
+ }
940
+ //#endregion
941
+ //#region src/DashboardFilterBar.tsx
942
+ var Rt = "__all__", zt = "__custom__";
943
+ function Bt(e, t) {
944
+ if (e) {
945
+ if (e.preset) return t(e.preset);
946
+ if (e.from || e.to) return `${e.from ?? "…"} – ${e.to ?? "…"}`;
947
+ }
948
+ }
949
+ function Vt(e) {
950
+ return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
951
+ }
952
+ function Ht({ def: e, value: n, onChange: r }) {
953
+ let i = P(), [a, o] = X(!1), s = e.allowCustomRange !== !1, c = (e) => i(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), l = n?.preset ?? (n?.from || n?.to ? zt : Rt);
954
+ return /* @__PURE__ */ Q("div", {
955
+ className: "flex items-center gap-1",
956
+ "data-testid": `dashboard-filter-${e.name}`,
957
+ children: [/* @__PURE__ */ Q(_e, {
958
+ value: l,
959
+ onValueChange: (e) => {
960
+ e === Rt ? r(void 0) : e === zt ? o(!0) : r({ preset: e });
961
+ },
962
+ children: [/* @__PURE__ */ Q(ve, {
963
+ className: "h-8 w-auto min-w-36 gap-1",
964
+ "aria-label": e.label || i("dashboard.filters.dateRange", "Date range"),
965
+ children: [/* @__PURE__ */ Z(Le, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Z(ye, {
966
+ placeholder: i("dashboard.filters.dateRange", "Date range"),
967
+ children: Bt(n, c) ?? i("dashboard.filters.allTime", "All time")
968
+ })]
969
+ }), /* @__PURE__ */ Q(H, { children: [
970
+ /* @__PURE__ */ Z(U, {
971
+ value: Rt,
972
+ children: i("dashboard.filters.allTime", "All time")
973
+ }),
974
+ t.map((e) => /* @__PURE__ */ Z(U, {
975
+ value: e,
976
+ children: c(e)
977
+ }, e)),
978
+ s && /* @__PURE__ */ Z(U, {
979
+ value: zt,
980
+ children: i("dashboard.filters.custom", "Custom…")
981
+ })
982
+ ] })]
983
+ }), s && /* @__PURE__ */ Q(me, {
984
+ open: a,
985
+ onOpenChange: o,
986
+ children: [/* @__PURE__ */ Z(ge, {
987
+ asChild: !0,
988
+ children: /* @__PURE__ */ Z("span", {
989
+ "aria-hidden": !0,
990
+ className: "size-0"
991
+ })
992
+ }), /* @__PURE__ */ Z(he, {
993
+ className: "w-auto p-0",
994
+ align: "start",
995
+ children: /* @__PURE__ */ Z(re, {
996
+ mode: "range",
997
+ numberOfMonths: 2,
998
+ selected: {
999
+ from: n?.from && !n.from.startsWith("{") ? new Date(n.from) : void 0,
1000
+ to: n?.to && !n.to.startsWith("{") ? new Date(n.to) : void 0
1001
+ },
1002
+ onSelect: (e) => {
1003
+ if (!e?.from && !e?.to) {
1004
+ r(void 0);
1005
+ return;
1006
+ }
1007
+ r({
1008
+ ...e?.from ? { from: Vt(e.from) } : {},
1009
+ ...e?.to ? { to: Vt(e.to) } : {}
1010
+ });
1011
+ }
1012
+ })
1013
+ })]
1014
+ })]
1015
+ });
1016
+ }
1017
+ function Ut({ def: e, value: t, onChange: n, dataSource: r }) {
1018
+ let i = P(), [a, o] = X(null), s = e.optionsFrom;
1019
+ J(() => {
1020
+ if (!s || !r) return;
1021
+ let e = !1, t = () => {
1022
+ if (typeof r.find != "function") {
1023
+ e || o([]);
1024
+ return;
1025
+ }
1026
+ r.find(s.object, {
1027
+ fields: [s.valueField, ...s.labelField ? [s.labelField] : []],
1028
+ ...s.filter ? { $filter: s.filter } : {},
1029
+ top: 200
1030
+ }).then((t) => {
1031
+ if (e) return;
1032
+ let n = Array.isArray(t) ? t : t?.items ?? [], r = /* @__PURE__ */ new Map();
1033
+ for (let e of n) {
1034
+ let t = e?.[s.valueField];
1035
+ if (t == null || t === "") continue;
1036
+ let n = String(t);
1037
+ r.has(n) || r.set(n, String(s.labelField ? e?.[s.labelField] ?? n : n));
1038
+ }
1039
+ o(Array.from(r, ([e, t]) => ({
1040
+ value: e,
1041
+ label: t
1042
+ })));
1043
+ }).catch(() => {
1044
+ e || o([]);
1045
+ });
1046
+ };
1047
+ if (typeof r.queryDataset == "function") {
1048
+ let n = [{
1049
+ name: s.valueField,
1050
+ field: s.valueField
1051
+ }];
1052
+ s.labelField && s.labelField !== s.valueField && n.push({
1053
+ name: s.labelField,
1054
+ field: s.labelField
1055
+ }), r.queryDataset({
1056
+ name: "dashboard_filter_options",
1057
+ label: "Dashboard filter options",
1058
+ object: s.object,
1059
+ dimensions: n,
1060
+ measures: [{
1061
+ name: "option_count",
1062
+ aggregate: "count"
1063
+ }]
1064
+ }, {
1065
+ dimensions: n.map((e) => e.name),
1066
+ measures: ["option_count"],
1067
+ ...s.filter ? { runtimeFilter: s.filter } : {},
1068
+ order: { [s.valueField]: "asc" },
1069
+ limit: 1e3
1070
+ }).then((t) => {
1071
+ if (e) return;
1072
+ let n = Array.isArray(t?.rows) ? t.rows : [], r = /* @__PURE__ */ new Map();
1073
+ for (let e of n) {
1074
+ let t = e?.[s.valueField];
1075
+ if (t == null || t === "") continue;
1076
+ let n = String(t);
1077
+ r.has(n) || r.set(n, String(s.labelField ? e?.[s.labelField] ?? n : n));
1078
+ }
1079
+ o(Array.from(r, ([e, t]) => ({
1080
+ value: e,
1081
+ label: t
1082
+ })));
1083
+ }).catch(() => {
1084
+ e || t();
1085
+ });
1086
+ } else t();
1087
+ return () => {
1088
+ e = !0;
1089
+ };
1090
+ }, [
1091
+ s?.object,
1092
+ s?.valueField,
1093
+ s?.labelField,
1094
+ r
1095
+ ]);
1096
+ let c = Y(() => e.options?.length ? e.options : a ?? [], [e.options, a]), l = e.label || e.name, u = t ? c.find((e) => e.value === String(t))?.label ?? String(t) : void 0;
1097
+ return /* @__PURE__ */ Q(_e, {
1098
+ value: t ? String(t) : Rt,
1099
+ onValueChange: (e) => n(e === Rt ? void 0 : e),
1100
+ children: [/* @__PURE__ */ Z(ve, {
1101
+ className: "h-8 w-auto min-w-32",
1102
+ "aria-label": l,
1103
+ "data-testid": `dashboard-filter-${e.name}`,
1104
+ children: /* @__PURE__ */ Z(ye, { children: u ?? `${l}: ${i("dashboard.filters.all", "All")}` })
1105
+ }), /* @__PURE__ */ Q(H, { children: [/* @__PURE__ */ Z(U, {
1106
+ value: Rt,
1107
+ children: i("dashboard.filters.all", "All")
1108
+ }), c.map((e) => /* @__PURE__ */ Z(U, {
1109
+ value: e.value,
1110
+ children: e.label
1111
+ }, e.value))] })]
1112
+ });
1113
+ }
1114
+ function Wt({ def: e, value: t, onChange: n }) {
1115
+ let [r, i] = X(t == null ? "" : String(t));
1116
+ J(() => {
1117
+ i(t == null ? "" : String(t));
1118
+ }, [t]);
1119
+ let a = () => {
1120
+ let t = r.trim();
1121
+ if (t === "") {
1122
+ n(void 0);
1123
+ return;
1124
+ }
1125
+ n(e.type === "number" ? Number(t) : t);
1126
+ };
1127
+ return /* @__PURE__ */ Z(pe, {
1128
+ className: "h-8 w-36",
1129
+ type: e.type === "number" ? "number" : "text",
1130
+ placeholder: e.label || e.name,
1131
+ value: r,
1132
+ onChange: (e) => i(e.target.value),
1133
+ onBlur: a,
1134
+ onKeyDown: (e) => {
1135
+ e.key === "Enter" && a();
1136
+ },
1137
+ "aria-label": e.label || e.name,
1138
+ "data-testid": `dashboard-filter-${e.name}`
1139
+ });
1140
+ }
1141
+ function Gt({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, className: a }) {
1142
+ let o = P();
1143
+ if (e.length === 0) return null;
1144
+ let s = (e) => e == null || e === "" || typeof e == "object" && Object.keys(e).length === 0, c = e.some((e) => {
1145
+ let n = t[e.name], r = e.defaultValue;
1146
+ return s(n) && s(r) ? !1 : JSON.stringify(n ?? null) !== JSON.stringify(r ?? null);
1147
+ });
1148
+ return /* @__PURE__ */ Q("div", {
1149
+ className: G("col-span-full flex flex-wrap items-center gap-2", a),
1150
+ "data-testid": "dashboard-filter-bar",
1151
+ role: "group",
1152
+ "aria-label": o("dashboard.filters.label", "Dashboard filters"),
1153
+ children: [e.map((e) => {
1154
+ let r = t[e.name], a = (t) => n(e.name, t);
1155
+ return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Z(Ht, {
1156
+ def: e,
1157
+ value: r,
1158
+ onChange: a
1159
+ }, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Z(Ut, {
1160
+ def: e,
1161
+ value: r,
1162
+ onChange: a,
1163
+ dataSource: i
1164
+ }, e.name) : /* @__PURE__ */ Z(Wt, {
1165
+ def: e,
1166
+ value: r,
1167
+ onChange: a
1168
+ }, e.name);
1169
+ }), r && c && /* @__PURE__ */ Q(F, {
1170
+ variant: "ghost",
1171
+ size: "sm",
1172
+ onClick: r,
1173
+ className: "text-muted-foreground",
1174
+ children: [/* @__PURE__ */ Z(We, { className: "size-3.5" }), o("dashboard.filters.reset", "Reset")]
1175
+ })]
938
1176
  });
939
1177
  }
940
1178
  //#endregion
941
1179
  //#region src/DashboardRenderer.tsx
942
- function yt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
943
- let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = Le({
1180
+ function Kt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
1181
+ let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = nt({
944
1182
  id: e,
945
1183
  disabled: t
946
1184
  });
947
1185
  return /* @__PURE__ */ Z("div", {
948
1186
  ref: s,
949
1187
  style: {
950
- transform: ze.Transform.toString(c),
1188
+ transform: it.Transform.toString(c),
951
1189
  transition: l,
952
1190
  opacity: u ? .4 : 1,
953
1191
  ...n ? {
@@ -955,26 +1193,26 @@ function yt({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
955
1193
  gridRow: `span ${n.h}`
956
1194
  } : {}
957
1195
  },
958
- className: U("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
1196
+ className: G("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
959
1197
  "data-sortable-widget-id": e,
960
1198
  ...a,
961
1199
  ...o,
962
1200
  children: i
963
1201
  });
964
1202
  }
965
- function bt(e) {
966
- return e ? le(e) : null;
1203
+ function qt(e) {
1204
+ return e ? we(e) : null;
967
1205
  }
968
- function xt(e) {
1206
+ function Jt(e) {
969
1207
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
970
1208
  }
971
- var St = [
1209
+ var Yt = [
972
1210
  "hsl(var(--chart-1))",
973
1211
  "hsl(var(--chart-2))",
974
1212
  "hsl(var(--chart-3))",
975
1213
  "hsl(var(--chart-4))",
976
1214
  "hsl(var(--chart-5))"
977
- ], Ct = {
1215
+ ], Xt = {
978
1216
  column: "bar",
979
1217
  "stacked-bar": "bar",
980
1218
  "grouped-bar": "bar",
@@ -984,7 +1222,7 @@ var St = [
984
1222
  "stacked-area": "area",
985
1223
  pyramid: "funnel",
986
1224
  bubble: "scatter"
987
- }, wt = /* @__PURE__ */ new Set([
1225
+ }, Zt = /* @__PURE__ */ new Set([
988
1226
  "bar",
989
1227
  "horizontal-bar",
990
1228
  "line",
@@ -996,12 +1234,12 @@ var St = [
996
1234
  "radar",
997
1235
  "treemap",
998
1236
  "sankey"
999
- ]), Tt = /* @__PURE__ */ new Set([
1237
+ ]), Qt = /* @__PURE__ */ new Set([
1000
1238
  "gauge",
1001
1239
  "solid-gauge",
1002
1240
  "kpi",
1003
1241
  "bullet"
1004
- ]), Et = /* @__PURE__ */ new Set([
1242
+ ]), $t = /* @__PURE__ */ new Set([
1005
1243
  "sunburst",
1006
1244
  "word-cloud",
1007
1245
  "choropleth",
@@ -1013,7 +1251,7 @@ var St = [
1013
1251
  "violin",
1014
1252
  "candlestick",
1015
1253
  "stock"
1016
- ]), Dt = /* @__PURE__ */ new Set([
1254
+ ]), en = /* @__PURE__ */ new Set([
1017
1255
  "bar",
1018
1256
  "horizontal-bar",
1019
1257
  "line",
@@ -1025,11 +1263,16 @@ var St = [
1025
1263
  "treemap",
1026
1264
  "sankey"
1027
1265
  ]);
1028
- function Ot(e) {
1029
- return Dt.has(e) ? { enabled: !0 } : void 0;
1266
+ function tn(e) {
1267
+ return en.has(e) ? { enabled: !0 } : void 0;
1030
1268
  }
1031
- var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: c, onWidgetsReorder: l, modalHandler: u, scriptHandlers: d, hideHeaderText: f, ...p }, m) => {
1032
- let h = (() => {
1269
+ var nn = /* @__PURE__ */ new Set([
1270
+ "object-chart",
1271
+ "object-metric",
1272
+ "object-data-table",
1273
+ "object-pivot"
1274
+ ]), rn = Oe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: c, onWidgetClick: l, onWidgetsReorder: u, modalHandler: d, scriptHandlers: f, hideHeaderText: p, ...m }, h) => {
1275
+ let _ = (() => {
1033
1276
  if (e.columns != null) return e.columns;
1034
1277
  let t = e.widgets ?? [], n = 0;
1035
1278
  for (let e of t) {
@@ -1037,84 +1280,104 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1037
1280
  t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
1038
1281
  }
1039
1282
  return n > 4 ? 12 : 4;
1040
- })(), g = h, v = e.gap || 4, b = e.columns != null || h !== 4, [x, S] = Y(!1), [C, T] = Y(!1), E = me(null), { executeAction: D, engine: k } = y({ actions: J(() => (e.header?.actions ?? []).map((e) => ({
1283
+ })(), y = _, b = e.gap || 4, x = e.columns != null || _ !== 4, [S, w] = X(!1), [E, D] = X(!1), O = Ae(null), k = Y(() => v(e), [e.globalFilters, e.dateRange]), { variables: M, setVariable: ee, resetVariables: te } = j(), [ne, P] = X({});
1284
+ J(() => {
1285
+ if (k.length === 0 || !n || typeof n.getObjectSchema != "function") return;
1286
+ let t = Array.from(new Set((e.widgets ?? []).map((e) => e.object).filter((e) => typeof e == "string" && e.length > 0))), r = !1;
1287
+ for (let e of t) n.getObjectSchema(e).then((t) => {
1288
+ if (r) return;
1289
+ let n = t?.fields;
1290
+ !n || typeof n != "object" || P((t) => ({
1291
+ ...t,
1292
+ [e]: new Set(Object.keys(n))
1293
+ }));
1294
+ }).catch(() => {});
1295
+ return () => {
1296
+ r = !0;
1297
+ };
1298
+ }, [
1299
+ k.length,
1300
+ n,
1301
+ e.widgets
1302
+ ]);
1303
+ let { executeAction: re, engine: z } = T({ actions: Y(() => (e.header?.actions ?? []).map((e) => ({
1041
1304
  name: e.actionUrl || e.label,
1042
1305
  type: e.actionType || "url",
1043
1306
  target: e.actionUrl,
1044
1307
  label: e.label
1045
- })), [e.header?.actions]) }), { dashboardLabel: A, dashboardDescription: F, dashboardActionLabel: I, widgetTitle: L, widgetDescription: R, fieldLabel: te } = w(), { t: z } = O(), ne = K((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? z(`report.aggregate.${n}`, { defaultValue: n }) : e ? te(e, t, t) : t, [z, te]), B = e.name, V = K((e) => {
1308
+ })), [e.header?.actions]) }), { dashboardLabel: ae, dashboardDescription: oe, dashboardActionLabel: se, widgetTitle: ce, widgetDescription: le, fieldLabel: ue } = A(), { t: de } = N(), fe = q((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? de(`report.aggregate.${n}`, { defaultValue: n }) : e ? ue(e, t, t) : t, [de, ue]), B = e.name, pe = q((e) => {
1046
1309
  if (!B) return e.label;
1047
1310
  let t = e.actionUrl || e.label;
1048
- return I(B, t, e.label);
1049
- }, [B, I]), re = K((e) => {
1050
- let t = xt(e.title);
1051
- return !B || !e.id || t === void 0 ? t : L(B, e.id, t);
1052
- }, [B, L]), ie = K((e) => {
1053
- let t = xt(e.description);
1054
- return !B || !e.id ? t : R(B, e.id, t);
1055
- }, [B, R]);
1056
- q(() => {
1057
- let e = k.getRunner();
1058
- if (u && e.setModalHandler(u), d) for (let [t, n] of Object.entries(d)) e.registerScript(t, n);
1311
+ return se(B, t, e.label);
1312
+ }, [B, se]), me = q((e) => {
1313
+ let t = Jt(e.title);
1314
+ return !B || !e.id || t === void 0 ? t : ce(B, e.id, t);
1315
+ }, [B, ce]), he = q((e) => {
1316
+ let t = Jt(e.description);
1317
+ return !B || !e.id ? t : le(B, e.id, t);
1318
+ }, [B, le]);
1319
+ J(() => {
1320
+ let e = z.getRunner();
1321
+ if (d && e.setModalHandler(d), f) for (let [t, n] of Object.entries(f)) e.registerScript(t, n);
1059
1322
  }, [
1060
- k,
1061
- u,
1062
- d
1063
- ]), q(() => {
1064
- let e = () => T(window.innerWidth < 768);
1323
+ z,
1324
+ d,
1325
+ f
1326
+ ]), J(() => {
1327
+ let e = () => D(window.innerWidth < 768);
1065
1328
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1066
1329
  }, []);
1067
- let ae = K(() => {
1068
- r && (S(!0), r(), setTimeout(() => S(!1), 600));
1330
+ let ge = q(() => {
1331
+ r && (w(!0), r(), setTimeout(() => w(!1), 600));
1069
1332
  }, [r]);
1070
- q(() => {
1071
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return E.current = setInterval(ae, e.refreshInterval * 1e3), () => {
1072
- E.current && clearInterval(E.current);
1333
+ J(() => {
1334
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return O.current = setInterval(ge, e.refreshInterval * 1e3), () => {
1335
+ O.current && clearInterval(O.current);
1073
1336
  };
1074
1337
  }, [
1075
1338
  e.refreshInterval,
1076
1339
  r,
1077
- ae
1340
+ ge
1078
1341
  ]);
1079
- let oe = K((e, t) => {
1080
- !o || !c || !t || (e.stopPropagation(), c(t));
1081
- }, [o, c]), se = K((t, n, r) => {
1082
- if (!o || !c) return;
1342
+ let V = q((e, t) => {
1343
+ !o || !l || !t || (e.stopPropagation(), l(t));
1344
+ }, [o, l]), _e = q((t, n, r) => {
1345
+ if (!o || !l) return;
1083
1346
  let i = e.widgets || [];
1084
- if (t.key === "Enter" || t.key === " ") t.preventDefault(), c(n ?? null);
1347
+ if (t.key === "Enter" || t.key === " ") t.preventDefault(), l(n ?? null);
1085
1348
  else if (t.key === "ArrowRight" || t.key === "ArrowDown") {
1086
1349
  t.preventDefault();
1087
1350
  let e = r + 1 < i.length ? i[r + 1] : null;
1088
- e?.id && c(e.id);
1351
+ e?.id && l(e.id);
1089
1352
  } else if (t.key === "ArrowLeft" || t.key === "ArrowUp") {
1090
1353
  t.preventDefault();
1091
1354
  let e = r - 1 >= 0 ? i[r - 1] : null;
1092
- e?.id && c(e.id);
1093
- } else t.key === "Escape" && (t.preventDefault(), c(null));
1355
+ e?.id && l(e.id);
1356
+ } else t.key === "Escape" && (t.preventDefault(), l(null));
1094
1357
  }, [
1095
1358
  o,
1096
- c,
1359
+ l,
1097
1360
  e.widgets
1098
- ]), ce = K((e) => {
1099
- !o || !c || e.target === e.currentTarget && c(null);
1100
- }, [o, c]), H = !!(o && l), le = Ne(Me(Ae, { activationConstraint: { distance: 5 } })), ue = K((t) => {
1101
- if (!H) return;
1361
+ ]), H = q((e) => {
1362
+ !o || !l || e.target === e.currentTarget && l(null);
1363
+ }, [o, l]), U = !!(o && u), ve = Qe(Ze(Ye, { activationConstraint: { distance: 5 } })), ye = q((t) => {
1364
+ if (!U) return;
1102
1365
  let { active: n, over: r } = t;
1103
1366
  if (!r || n.id === r.id) return;
1104
1367
  let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
1105
- a < 0 || o < 0 || l?.(Fe(i, a, o));
1368
+ a < 0 || o < 0 || u?.(et(i, a, o));
1106
1369
  }, [
1107
- H,
1370
+ U,
1108
1371
  e.widgets,
1109
- l
1110
- ]), W = (e, t, r) => {
1111
- let i = e.type === "metric" || Tt.has(e.type || ""), a = b ? {
1112
- w: Math.min(i ? 3 : 6, g),
1372
+ u
1373
+ ]), be = (e, t, r) => {
1374
+ let i = e.type === "metric" || Qt.has(e.type || ""), a = x ? {
1375
+ w: Math.min(i ? 3 : 6, y),
1113
1376
  h: i ? 2 : 4
1114
- } : void 0, c = e.layout ?? a, l = c ? {
1115
- ...c,
1116
- w: Math.min(c.w, g)
1117
- } : void 0, u = !!e.dataset, d = (() => {
1377
+ } : void 0, l = e.layout ?? a, u = l ? {
1378
+ ...l,
1379
+ w: Math.min(l.w, y)
1380
+ } : void 0, d = !!e.dataset, f = () => {
1118
1381
  if (e.component) return e.component;
1119
1382
  let t = e.type, n = e.options || {};
1120
1383
  if (t === "metric" && e.object) {
@@ -1132,7 +1395,7 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1132
1395
  objectName: e.object || ($(t) ? t.object : void 0),
1133
1396
  aggregate: r,
1134
1397
  filter: ($(t) ? t.filter : void 0) || e.filter,
1135
- label: n.label || re(e) || "",
1398
+ label: n.label || me(e) || "",
1136
1399
  fallbackValue: n.value,
1137
1400
  trend: n.trend,
1138
1401
  icon: n.icon,
@@ -1143,11 +1406,11 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1143
1406
  prefix: n.prefix,
1144
1407
  suffix: n.suffix,
1145
1408
  drillDown: n.drillDown ?? { enabled: !0 },
1146
- title: n.label || re(e) || "",
1409
+ title: n.label || me(e) || "",
1147
1410
  compareTo: e.compareTo
1148
1411
  };
1149
1412
  }
1150
- if (Tt.has(t || "") && e.object) {
1413
+ if (Qt.has(t || "") && e.object) {
1151
1414
  let t = e.aggregate ? {
1152
1415
  field: e.valueField || "value",
1153
1416
  function: e.aggregate,
@@ -1158,7 +1421,7 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1158
1421
  objectName: e.object,
1159
1422
  aggregate: t,
1160
1423
  filter: e.filter,
1161
- label: n.label || re(e) || "",
1424
+ label: n.label || me(e) || "",
1162
1425
  fallbackValue: n.fallbackValue ?? n.value,
1163
1426
  icon: n.icon,
1164
1427
  description: n.description,
@@ -1171,8 +1434,8 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1171
1434
  compareTo: e.compareTo
1172
1435
  };
1173
1436
  }
1174
- let r = t && Ct[t] || t;
1175
- if (r && wt.has(r)) {
1437
+ let r = t && Xt[t] || t;
1438
+ if (r && Zt.has(r)) {
1176
1439
  let t = e.data || n.data, i = e.categoryField || n.xField || "name", a = e.valueField || n.yField || "value";
1177
1440
  if ($(t)) {
1178
1441
  let o = t.aggregate, s = (() => {
@@ -1195,10 +1458,10 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1195
1458
  xAxisKey: i,
1196
1459
  series: [{
1197
1460
  dataKey: l,
1198
- label: ne(u, l, c?.function)
1461
+ label: fe(u, l, c?.function)
1199
1462
  }],
1200
- colors: St,
1201
- drillDown: n.drillDown ?? Ot(r),
1463
+ colors: Yt,
1464
+ drillDown: n.drillDown ?? tn(r),
1202
1465
  compareTo: e.compareTo,
1203
1466
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1204
1467
  };
@@ -1221,10 +1484,10 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1221
1484
  xAxisKey: i,
1222
1485
  series: [{
1223
1486
  dataKey: s,
1224
- label: ne(e.object, s, e.aggregate)
1487
+ label: fe(e.object, s, e.aggregate)
1225
1488
  }],
1226
- colors: St,
1227
- drillDown: n.drillDown ?? Ot(r),
1489
+ colors: Yt,
1490
+ drillDown: n.drillDown ?? tn(r),
1228
1491
  compareTo: e.compareTo,
1229
1492
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1230
1493
  };
@@ -1236,9 +1499,9 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1236
1499
  xAxisKey: i,
1237
1500
  series: [{
1238
1501
  dataKey: a,
1239
- label: ne(e.object, a, e.aggregate)
1502
+ label: fe(e.object, a, e.aggregate)
1240
1503
  }],
1241
- colors: St,
1504
+ colors: Yt,
1242
1505
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1243
1506
  };
1244
1507
  }
@@ -1359,7 +1622,7 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1359
1622
  variant: "caption",
1360
1623
  align: "center",
1361
1624
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground"
1362
- } : t && Et.has(t) ? {
1625
+ } : t && $t.has(t) ? {
1363
1626
  type: "text",
1364
1627
  value: `「${t}」chart type is not supported yet`,
1365
1628
  variant: "caption",
@@ -1369,62 +1632,71 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1369
1632
  ...e,
1370
1633
  ...n
1371
1634
  };
1372
- })(), f = e.type === "metric" && !u, p = re(e), m = ie(e), h = e.id || p || `widget-${t}`, v = o && s === e.id, y = o ? {
1635
+ }, p = k.length > 0 ? s(e, k, M, typeof e.object == "string" ? ne[e.object] : void 0) : void 0, m = (() => {
1636
+ let e = f();
1637
+ return p && e && nn.has(e.type) ? {
1638
+ ...e,
1639
+ filter: g(e.filter, p)
1640
+ } : e;
1641
+ })(), h = p && d ? {
1642
+ ...e,
1643
+ filter: g(e.filter, p)
1644
+ } : e, _ = e.type === "metric" && !d, v = me(e), b = he(e), S = e.id || v || `widget-${t}`, w = o && c === e.id, T = o ? {
1373
1645
  "data-testid": `dashboard-preview-widget-${e.id}`,
1374
1646
  "data-widget-id": e.id,
1375
1647
  role: "button",
1376
1648
  tabIndex: 0,
1377
- "aria-selected": v,
1378
- "aria-label": `Widget: ${p || `Widget ${t + 1}`}`,
1379
- onClick: (t) => oe(t, e.id),
1380
- onKeyDown: (n) => se(n, e.id, t)
1381
- } : {}, x = o ? U("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", v ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, S = !C && l && !H ? {
1382
- gridColumn: `span ${l.w}`,
1383
- gridRow: `span ${l.h}`
1384
- } : void 0, w = f ? /* @__PURE__ */ Q("div", {
1385
- className: U("h-full w-full", o && "relative", x),
1386
- style: S,
1387
- ...y,
1388
- children: [u ? /* @__PURE__ */ Z("div", {
1389
- className: U("h-full w-full", o && "pointer-events-none"),
1390
- children: /* @__PURE__ */ Z(vt, {
1391
- widget: e,
1649
+ "aria-selected": w,
1650
+ "aria-label": `Widget: ${v || `Widget ${t + 1}`}`,
1651
+ onClick: (t) => V(t, e.id),
1652
+ onKeyDown: (n) => _e(n, e.id, t)
1653
+ } : {}, D = o ? G("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", w ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, O = !E && u && !U ? {
1654
+ gridColumn: `span ${u.w}`,
1655
+ gridRow: `span ${u.h}`
1656
+ } : void 0, A = _ ? /* @__PURE__ */ Q("div", {
1657
+ className: G("h-full w-full", o && "relative", D),
1658
+ style: O,
1659
+ ...T,
1660
+ children: [d ? /* @__PURE__ */ Z("div", {
1661
+ className: G("h-full w-full", o && "pointer-events-none"),
1662
+ children: /* @__PURE__ */ Z(Lt, {
1663
+ widget: h,
1392
1664
  dataSource: n
1393
1665
  })
1394
- }) : /* @__PURE__ */ Z(_, {
1395
- schema: d,
1396
- className: U("h-full w-full", o && "pointer-events-none"),
1666
+ }) : /* @__PURE__ */ Z(C, {
1667
+ schema: m,
1668
+ className: G("h-full w-full", o && "pointer-events-none"),
1397
1669
  dataSource: n
1398
1670
  }), o && /* @__PURE__ */ Z("div", {
1399
1671
  className: "absolute inset-0 z-10",
1400
1672
  "aria-hidden": "true",
1401
1673
  "data-testid": "widget-click-overlay"
1402
1674
  })]
1403
- }) : /* @__PURE__ */ Q(ee, {
1404
- className: U("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", x),
1405
- style: S,
1406
- ...y,
1675
+ }) : /* @__PURE__ */ Q(I, {
1676
+ className: G("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", D),
1677
+ style: O,
1678
+ ...T,
1407
1679
  children: [
1408
- p && /* @__PURE__ */ Q(N, {
1680
+ v && /* @__PURE__ */ Q(L, {
1409
1681
  className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
1410
- children: [/* @__PURE__ */ Z(P, {
1682
+ children: [/* @__PURE__ */ Z(R, {
1411
1683
  className: "text-sm sm:text-base font-medium tracking-tight truncate",
1412
- title: p,
1413
- children: p
1414
- }), m && /* @__PURE__ */ Z("p", {
1684
+ title: v,
1685
+ children: v
1686
+ }), b && /* @__PURE__ */ Z("p", {
1415
1687
  className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
1416
- children: m
1688
+ children: b
1417
1689
  })]
1418
1690
  }),
1419
- /* @__PURE__ */ Z(M, {
1691
+ /* @__PURE__ */ Z(ie, {
1420
1692
  className: "p-0",
1421
1693
  children: /* @__PURE__ */ Z("div", {
1422
- className: U("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
1423
- children: u ? /* @__PURE__ */ Z(vt, {
1424
- widget: e,
1694
+ className: G("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
1695
+ children: d ? /* @__PURE__ */ Z(Lt, {
1696
+ widget: h,
1425
1697
  dataSource: n
1426
- }) : /* @__PURE__ */ Z(_, {
1427
- schema: d,
1698
+ }) : /* @__PURE__ */ Z(C, {
1699
+ schema: m,
1428
1700
  dataSource: n
1429
1701
  })
1430
1702
  })
@@ -1436,36 +1708,36 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1436
1708
  })
1437
1709
  ]
1438
1710
  });
1439
- return H && e.id ? /* @__PURE__ */ Z(yt, {
1711
+ return U && e.id ? /* @__PURE__ */ Z(Kt, {
1440
1712
  id: e.id,
1441
- gridSpan: !C && l ? {
1442
- w: l.w,
1443
- h: l.h
1713
+ gridSpan: !E && u ? {
1714
+ w: u.w,
1715
+ h: u.h
1444
1716
  } : void 0,
1445
- children: w
1446
- }, h) : /* @__PURE__ */ Z(G, { children: w }, h);
1447
- }, de = e.header && /* @__PURE__ */ Q("div", {
1717
+ children: A
1718
+ }, S) : /* @__PURE__ */ Z(De, { children: A }, S);
1719
+ }, xe = e.header && /* @__PURE__ */ Q("div", {
1448
1720
  className: "col-span-full mb-4",
1449
1721
  children: [
1450
- !f && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Z("h2", {
1722
+ !p && e.header.showTitle !== !1 && e.title && /* @__PURE__ */ Z("h2", {
1451
1723
  className: "text-lg font-semibold tracking-tight",
1452
- children: B ? A({
1724
+ children: B ? ae({
1453
1725
  name: B,
1454
- label: xt(e.title)
1455
- }) : xt(e.title)
1726
+ label: Jt(e.title)
1727
+ }) : Jt(e.title)
1456
1728
  }),
1457
- !f && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Z("p", {
1729
+ !p && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Z("p", {
1458
1730
  className: "text-sm text-muted-foreground mt-1",
1459
- children: B ? F({
1731
+ children: B ? oe({
1460
1732
  name: B,
1461
- description: xt(e.description)
1462
- }) : xt(e.description)
1733
+ description: Jt(e.description)
1734
+ }) : Jt(e.description)
1463
1735
  }),
1464
1736
  e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Z("div", {
1465
1737
  className: "flex gap-2 mt-3",
1466
1738
  children: e.header.actions.map((e, t) => {
1467
- let n = bt(e.icon);
1468
- return /* @__PURE__ */ Q(j, {
1739
+ let n = qt(e.icon);
1740
+ return /* @__PURE__ */ Q(F, {
1469
1741
  variant: "outline",
1470
1742
  size: "sm",
1471
1743
  onClick: async () => {
@@ -1479,106 +1751,130 @@ var kt = fe(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount
1479
1751
  return;
1480
1752
  }
1481
1753
  if (t === "modal" || t === "script") {
1482
- let e = await D(n || r);
1754
+ let e = await re(n || r);
1483
1755
  e?.success || console.warn("[DashboardRenderer] action failed", e?.error);
1484
1756
  return;
1485
1757
  }
1486
1758
  console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`);
1487
1759
  },
1488
- children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), V(e)]
1760
+ children: [n && /* @__PURE__ */ Z(n, { className: "w-4 h-4 mr-1.5" }), pe(e)]
1489
1761
  }, t);
1490
1762
  })
1491
1763
  })
1492
1764
  ]
1493
- }), fe = i !== void 0 && /* @__PURE__ */ Q("span", {
1765
+ }), Se = k.length > 0 && /* @__PURE__ */ Z(Gt, {
1766
+ defs: k,
1767
+ values: M,
1768
+ onChange: ee,
1769
+ onReset: te,
1770
+ dataSource: n,
1771
+ className: "mb-2"
1772
+ }), Ce = i !== void 0 && /* @__PURE__ */ Q("span", {
1494
1773
  className: "text-xs text-muted-foreground",
1495
1774
  children: [i.toLocaleString(), " records"]
1496
- }), pe = a ? JSON.stringify(a) : void 0, he = r && /* @__PURE__ */ Q("div", {
1497
- className: U("flex items-center justify-end gap-3 mb-2", !C && "col-span-full"),
1498
- children: [fe, /* @__PURE__ */ Q(j, {
1775
+ }), W = a ? JSON.stringify(a) : void 0, we = r && /* @__PURE__ */ Q("div", {
1776
+ className: G("flex items-center justify-end gap-3 mb-2", !E && "col-span-full"),
1777
+ children: [Ce, /* @__PURE__ */ Q(F, {
1499
1778
  variant: "outline",
1500
1779
  size: "sm",
1501
- onClick: ae,
1502
- disabled: x,
1780
+ onClick: ge,
1781
+ disabled: S,
1503
1782
  "aria-label": "Refresh dashboard",
1504
- children: [/* @__PURE__ */ Z(Te, { className: U("h-4 w-4 mr-2", x && "animate-spin") }), x ? "Refreshing…" : "Refresh All"]
1783
+ children: [/* @__PURE__ */ Z(Ue, { className: G("h-4 w-4 mr-2", S && "animate-spin") }), S ? "Refreshing…" : "Refresh All"]
1505
1784
  })]
1506
- }), ge = J(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), X = J(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), _e = J(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1507
- if (C) {
1785
+ }), Te = Y(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), K = Y(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Ee = Y(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1786
+ if (E) {
1508
1787
  let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ Q("div", {
1509
- ref: m,
1510
- className: U("flex flex-col gap-4 px-4", t),
1511
- "data-user-actions": pe,
1512
- onClick: ce,
1513
- ...p,
1788
+ ref: h,
1789
+ className: G("flex flex-col gap-4 px-4", t),
1790
+ "data-user-actions": W,
1791
+ onClick: H,
1792
+ ...m,
1514
1793
  children: [
1515
- de,
1516
- he,
1794
+ xe,
1795
+ Se,
1796
+ we,
1517
1797
  n.length > 0 && /* @__PURE__ */ Z("div", {
1518
1798
  className: "grid grid-cols-2 gap-3",
1519
- onClick: ce,
1520
- children: /* @__PURE__ */ Z(Pe, {
1521
- items: X,
1522
- strategy: Ie,
1523
- disabled: !H,
1524
- children: n.map((e, t) => W(e, t))
1799
+ onClick: H,
1800
+ children: /* @__PURE__ */ Z($e, {
1801
+ items: K,
1802
+ strategy: tt,
1803
+ disabled: !U,
1804
+ children: n.map((e, t) => be(e, t))
1525
1805
  })
1526
1806
  }),
1527
1807
  r.length > 0 && /* @__PURE__ */ Z("div", {
1528
1808
  className: "flex flex-col gap-4",
1529
- onClick: ce,
1530
- children: /* @__PURE__ */ Z(Pe, {
1531
- items: _e,
1532
- strategy: Re,
1533
- disabled: !H,
1534
- children: r.map((e, t) => W(e, t, !0))
1809
+ onClick: H,
1810
+ children: /* @__PURE__ */ Z($e, {
1811
+ items: Ee,
1812
+ strategy: rt,
1813
+ disabled: !U,
1814
+ children: r.map((e, t) => be(e, t, !0))
1535
1815
  })
1536
1816
  })
1537
1817
  ]
1538
1818
  });
1539
- return H ? /* @__PURE__ */ Z(ke, {
1540
- sensors: le,
1541
- collisionDetection: je,
1542
- onDragEnd: ue,
1819
+ return U ? /* @__PURE__ */ Z(Je, {
1820
+ sensors: ve,
1821
+ collisionDetection: Xe,
1822
+ onDragEnd: ye,
1543
1823
  children: i
1544
1824
  }) : i;
1545
1825
  }
1546
- let ve = /* @__PURE__ */ Q("div", {
1547
- ref: m,
1548
- className: U("grid", !b && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1826
+ let Oe = /* @__PURE__ */ Q("div", {
1827
+ ref: h,
1828
+ className: G("grid", !x && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1549
1829
  style: {
1550
- ...b && {
1551
- gridTemplateColumns: `repeat(${g}, minmax(0, 1fr))`,
1830
+ ...x && {
1831
+ gridTemplateColumns: `repeat(${y}, minmax(0, 1fr))`,
1552
1832
  gridAutoRows: "minmax(5rem, auto)"
1553
1833
  },
1554
- gap: `${v * .25}rem`
1834
+ gap: `${b * .25}rem`
1555
1835
  },
1556
- "data-user-actions": pe,
1557
- onClick: ce,
1558
- ...p,
1836
+ "data-user-actions": W,
1837
+ onClick: H,
1838
+ ...m,
1559
1839
  children: [
1560
- de,
1561
- he,
1562
- /* @__PURE__ */ Z(Pe, {
1563
- items: ge,
1564
- strategy: Ie,
1565
- disabled: !H,
1566
- children: e.widgets?.map((e, t) => W(e, t))
1840
+ xe,
1841
+ Se,
1842
+ we,
1843
+ /* @__PURE__ */ Z($e, {
1844
+ items: Te,
1845
+ strategy: tt,
1846
+ disabled: !U,
1847
+ children: e.widgets?.map((e, t) => be(e, t))
1567
1848
  })
1568
1849
  ]
1569
1850
  });
1570
- return H ? /* @__PURE__ */ Z(ke, {
1571
- sensors: le,
1572
- collisionDetection: je,
1573
- onDragEnd: ue,
1574
- children: ve
1575
- }) : ve;
1851
+ return U ? /* @__PURE__ */ Z(Je, {
1852
+ sensors: ve,
1853
+ collisionDetection: Xe,
1854
+ onDragEnd: ye,
1855
+ children: Oe
1856
+ }) : Oe;
1576
1857
  });
1858
+ rn.displayName = "DashboardRendererInner";
1859
+ var an = Oe((e, t) => {
1860
+ let { schema: n } = e, r = Y(() => v(n), [n.globalFilters, n.dateRange]);
1861
+ return r.length === 0 ? /* @__PURE__ */ Z(rn, {
1862
+ ref: t,
1863
+ ...e
1864
+ }) : /* @__PURE__ */ Z(S, {
1865
+ definitions: u(r),
1866
+ children: /* @__PURE__ */ Z(rn, {
1867
+ ref: t,
1868
+ ...e
1869
+ })
1870
+ });
1871
+ });
1872
+ an.displayName = "DashboardRenderer";
1577
1873
  //#endregion
1578
1874
  //#region src/DashboardGridLayout.tsx
1579
- function At({ editMode: e }) {
1580
- let t = x();
1581
- return W.useEffect(() => {
1875
+ function on({ editMode: e }) {
1876
+ let t = D();
1877
+ return K.useEffect(() => {
1582
1878
  if (e) return t.startDrag({
1583
1879
  id: "dashboard-layout",
1584
1880
  type: "dashboard-widget",
@@ -1589,14 +1885,14 @@ function At({ editMode: e }) {
1589
1885
  t.endDrag("dashboard");
1590
1886
  }, [e, t]), null;
1591
1887
  }
1592
- var jt = [
1888
+ var sn = [
1593
1889
  "hsl(var(--chart-1))",
1594
1890
  "hsl(var(--chart-2))",
1595
1891
  "hsl(var(--chart-3))",
1596
1892
  "hsl(var(--chart-4))",
1597
1893
  "hsl(var(--chart-5))"
1598
1894
  ];
1599
- function Mt(e, t) {
1895
+ function cn(e, t) {
1600
1896
  if (!e.widgets?.length) return e;
1601
1897
  let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
1602
1898
  let r = e.id || `widget-${t}`, i = n.get(r);
@@ -1615,7 +1911,7 @@ function Mt(e, t) {
1615
1911
  widgets: r
1616
1912
  };
1617
1913
  }
1618
- function Nt(e) {
1914
+ function ln(e) {
1619
1915
  return { lg: e.widgets?.map((e, t) => ({
1620
1916
  i: e.id || `widget-${t}`,
1621
1917
  x: e.layout?.x ?? t % 4 * 3,
@@ -1624,11 +1920,11 @@ function Nt(e) {
1624
1920
  h: e.layout?.h ?? 4
1625
1921
  })) || [] };
1626
1922
  }
1627
- var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1628
- let { width: a, containerRef: o, mounted: s } = qe(), [c, l] = W.useState(!1), [u, d] = W.useState(!1), f = C(), p = W.useRef(null), m = W.useCallback(() => {
1923
+ var un = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1924
+ let { width: a, containerRef: o, mounted: s } = ft(), [c, l] = K.useState(!1), [u, d] = K.useState(!1), f = k(), p = K.useRef(null), m = K.useCallback(() => {
1629
1925
  i && (d(!0), i(), setTimeout(() => d(!1), 600));
1630
1926
  }, [i]);
1631
- W.useEffect(() => {
1927
+ K.useEffect(() => {
1632
1928
  if (!(!e.refreshInterval || e.refreshInterval <= 0 || !i)) return p.current = setInterval(m, e.refreshInterval * 1e3), () => {
1633
1929
  p.current && clearInterval(p.current);
1634
1930
  };
@@ -1637,27 +1933,27 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1637
1933
  i,
1638
1934
  m
1639
1935
  ]);
1640
- let [h, g] = W.useState(() => Nt(e)), v = W.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1936
+ let [h, g] = K.useState(() => ln(e)), _ = K.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1641
1937
  i: e.id || `widget-${t}`,
1642
1938
  x: e.layout?.x,
1643
1939
  y: e.layout?.y,
1644
1940
  w: e.layout?.w,
1645
1941
  h: e.layout?.h
1646
1942
  })) ?? []), [e.widgets]);
1647
- W.useEffect(() => {
1648
- g(Nt(e));
1649
- }, [v]);
1650
- let y = W.useCallback((e, t) => {
1943
+ K.useEffect(() => {
1944
+ g(ln(e));
1945
+ }, [_]);
1946
+ let v = K.useCallback((e, t) => {
1651
1947
  g(t), n?.(e);
1652
- }, [n]), b = W.useCallback(() => {
1653
- r ? r(Mt(e, h.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), l(!1);
1948
+ }, [n]), y = K.useCallback(() => {
1949
+ r ? r(cn(e, h.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), l(!1);
1654
1950
  }, [
1655
1951
  r,
1656
1952
  e,
1657
1953
  h
1658
- ]), x = W.useCallback(() => {
1659
- g(Nt(e));
1660
- }, [e]), S = W.useCallback((e) => {
1954
+ ]), b = K.useCallback(() => {
1955
+ g(ln(e));
1956
+ }, [e]), x = K.useCallback((e) => {
1661
1957
  if (e.component) return e.component;
1662
1958
  let t = e.type, n = e.options || {};
1663
1959
  if (t === "bar" || t === "horizontal-bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter" || t === "funnel") {
@@ -1675,7 +1971,7 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1675
1971
  aggregate: o,
1676
1972
  xAxisKey: i,
1677
1973
  series: [{ dataKey: s }],
1678
- colors: jt,
1974
+ colors: sn,
1679
1975
  className: "h-full"
1680
1976
  };
1681
1977
  }
@@ -1692,7 +1988,7 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1692
1988
  aggregate: n,
1693
1989
  xAxisKey: i,
1694
1990
  series: [{ dataKey: e.valueField || "value" }],
1695
- colors: jt,
1991
+ colors: sn,
1696
1992
  className: "h-full"
1697
1993
  };
1698
1994
  }
@@ -1702,7 +1998,7 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1702
1998
  data: Array.isArray(r) ? r : r?.items || [],
1703
1999
  xAxisKey: i,
1704
2000
  series: [{ dataKey: a }],
1705
- colors: jt,
2001
+ colors: sn,
1706
2002
  className: "h-full"
1707
2003
  };
1708
2004
  }
@@ -1763,10 +2059,10 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1763
2059
  }, []);
1764
2060
  return /* @__PURE__ */ Q("div", {
1765
2061
  ref: o,
1766
- className: U("w-full", t),
2062
+ className: G("w-full", t),
1767
2063
  "data-testid": "grid-layout",
1768
2064
  children: [
1769
- f && /* @__PURE__ */ Z(At, { editMode: c }),
2065
+ f && /* @__PURE__ */ Z(on, { editMode: c }),
1770
2066
  /* @__PURE__ */ Q("div", {
1771
2067
  className: "mb-4 flex items-center justify-between",
1772
2068
  children: [/* @__PURE__ */ Z("h2", {
@@ -1774,41 +2070,41 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1774
2070
  children: e.title || "Dashboard"
1775
2071
  }), /* @__PURE__ */ Z("div", {
1776
2072
  className: "flex gap-2",
1777
- children: c ? /* @__PURE__ */ Q(Ge, { children: [
1778
- /* @__PURE__ */ Q(j, {
1779
- onClick: b,
2073
+ children: c ? /* @__PURE__ */ Q(ut, { children: [
2074
+ /* @__PURE__ */ Q(F, {
2075
+ onClick: y,
1780
2076
  size: "sm",
1781
2077
  variant: "default",
1782
- children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4 mr-2" }), "Save Layout"]
2078
+ children: [/* @__PURE__ */ Z(Ge, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1783
2079
  }),
1784
- /* @__PURE__ */ Q(j, {
1785
- onClick: x,
2080
+ /* @__PURE__ */ Q(F, {
2081
+ onClick: b,
1786
2082
  size: "sm",
1787
2083
  variant: "outline",
1788
- children: [/* @__PURE__ */ Z(Oe, { className: "h-4 w-4 mr-2" }), "Reset"]
2084
+ children: [/* @__PURE__ */ Z(qe, { className: "h-4 w-4 mr-2" }), "Reset"]
1789
2085
  }),
1790
- /* @__PURE__ */ Z(j, {
2086
+ /* @__PURE__ */ Z(F, {
1791
2087
  onClick: () => l(!1),
1792
2088
  size: "sm",
1793
2089
  variant: "ghost",
1794
2090
  children: "Cancel"
1795
2091
  })
1796
- ] }) : /* @__PURE__ */ Q(Ge, { children: [i && /* @__PURE__ */ Q(j, {
2092
+ ] }) : /* @__PURE__ */ Q(ut, { children: [i && /* @__PURE__ */ Q(F, {
1797
2093
  onClick: m,
1798
2094
  size: "sm",
1799
2095
  variant: "outline",
1800
2096
  disabled: u,
1801
2097
  "aria-label": "Refresh dashboard",
1802
- children: [/* @__PURE__ */ Z(Te, { className: U("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1803
- }), /* @__PURE__ */ Q(j, {
2098
+ children: [/* @__PURE__ */ Z(Ue, { className: G("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
2099
+ }), /* @__PURE__ */ Q(F, {
1804
2100
  onClick: () => l(!0),
1805
2101
  size: "sm",
1806
2102
  variant: "outline",
1807
- children: [/* @__PURE__ */ Z(xe, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
2103
+ children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1808
2104
  })] })
1809
2105
  })]
1810
2106
  }),
1811
- s && /* @__PURE__ */ Z(Ke, {
2107
+ s && /* @__PURE__ */ Z(dt, {
1812
2108
  className: "layout",
1813
2109
  width: a,
1814
2110
  layouts: h,
@@ -1832,37 +2128,37 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1832
2128
  handle: ".drag-handle"
1833
2129
  },
1834
2130
  resizeConfig: { enabled: c },
1835
- onLayoutChange: y,
2131
+ onLayoutChange: v,
1836
2132
  children: e.widgets?.map((e, t) => {
1837
- let n = e.id || `widget-${t}`, r = S(e);
2133
+ let n = e.id || `widget-${t}`, r = x(e);
1838
2134
  return /* @__PURE__ */ Z("div", {
1839
2135
  className: "h-full",
1840
2136
  children: e.type === "metric" ? /* @__PURE__ */ Q("div", {
1841
2137
  className: "h-full w-full relative",
1842
2138
  children: [c && /* @__PURE__ */ Z("div", {
1843
2139
  className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
1844
- children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
1845
- }), /* @__PURE__ */ Z(_, {
2140
+ children: /* @__PURE__ */ Z(Be, { className: "h-4 w-4" })
2141
+ }), /* @__PURE__ */ Z(C, {
1846
2142
  schema: r,
1847
2143
  className: "h-full w-full"
1848
2144
  })]
1849
- }) : /* @__PURE__ */ Q(ee, {
1850
- className: U("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
1851
- children: [e.title && /* @__PURE__ */ Q(N, {
2145
+ }) : /* @__PURE__ */ Q(I, {
2146
+ className: G("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
2147
+ children: [e.title && /* @__PURE__ */ Q(L, {
1852
2148
  className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
1853
- children: [/* @__PURE__ */ Z(P, {
2149
+ children: [/* @__PURE__ */ Z(R, {
1854
2150
  className: "text-base font-medium tracking-tight truncate",
1855
2151
  title: e.title,
1856
2152
  children: e.title
1857
2153
  }), c && /* @__PURE__ */ Z("div", {
1858
2154
  className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
1859
- children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
2155
+ children: /* @__PURE__ */ Z(Be, { className: "h-4 w-4" })
1860
2156
  })]
1861
- }), /* @__PURE__ */ Z(M, {
2157
+ }), /* @__PURE__ */ Z(ie, {
1862
2158
  className: "p-0 h-full",
1863
2159
  children: /* @__PURE__ */ Z("div", {
1864
- className: U("h-full w-full overflow-auto p-4"),
1865
- children: /* @__PURE__ */ Z(_, { schema: r })
2160
+ className: G("h-full w-full overflow-auto p-4"),
2161
+ children: /* @__PURE__ */ Z(C, { schema: r })
1866
2162
  })
1867
2163
  })]
1868
2164
  })
@@ -1871,7 +2167,7 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1871
2167
  })
1872
2168
  ]
1873
2169
  });
1874
- }, Ft = T({
2170
+ }, dn = M({
1875
2171
  "dashboard.trend.vsLastQuarter": "vs last quarter",
1876
2172
  "dashboard.trend.vsLastMonth": "vs last month",
1877
2173
  "dashboard.trend.vsLastWeek": "vs last week",
@@ -1879,7 +2175,7 @@ var Pt = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1879
2175
  "dashboard.trend.vsYesterday": "vs yesterday",
1880
2176
  "dashboard.trend.vsPreviousPeriod": "vs previous period"
1881
2177
  }, "dashboard.trend.vsLastQuarter");
1882
- function It(e) {
2178
+ function fn(e) {
1883
2179
  switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
1884
2180
  case "vs last quarter":
1885
2181
  case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
@@ -1895,11 +2191,11 @@ function It(e) {
1895
2191
  default: return;
1896
2192
  }
1897
2193
  }
1898
- function Lt(e, t, n) {
2194
+ function pn(e, t, n) {
1899
2195
  if (e == null) return "";
1900
2196
  if (typeof e == "string") {
1901
2197
  let r = Number(e);
1902
- return !isFinite(r) || e.trim() === "" ? e : Lt(r, t, n);
2198
+ return !isFinite(r) || e.trim() === "" ? e : pn(r, t, n);
1903
2199
  }
1904
2200
  if (!isFinite(e)) return String(e);
1905
2201
  let r = {
@@ -1936,10 +2232,10 @@ function Lt(e, t, n) {
1936
2232
  maximumFractionDigits: c
1937
2233
  }).format(e);
1938
2234
  }
1939
- function Rt(e) {
2235
+ function mn(e) {
1940
2236
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
1941
2237
  }
1942
- var zt = {
2238
+ var hn = {
1943
2239
  default: "bg-muted text-muted-foreground",
1944
2240
  blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
1945
2241
  teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
@@ -1948,7 +2244,7 @@ var zt = {
1948
2244
  success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
1949
2245
  warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
1950
2246
  danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
1951
- }, Bt = {
2247
+ }, gn = {
1952
2248
  default: "text-foreground",
1953
2249
  blue: "text-blue-600 dark:text-blue-400",
1954
2250
  teal: "text-teal-600 dark:text-teal-400",
@@ -1957,18 +2253,18 @@ var zt = {
1957
2253
  success: "text-emerald-600 dark:text-emerald-400",
1958
2254
  warning: "text-amber-600 dark:text-amber-400",
1959
2255
  danger: "text-rose-600 dark:text-rose-400"
1960
- }, Vt = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, variant: m = "card", ...h }) => {
1961
- let g = zt[c] || zt.default, { t: _ } = Ft(), v = J(() => {
1962
- let e = Rt(a) || Rt(n?.label);
2256
+ }, _n = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, variant: m = "card", ...h }) => {
2257
+ let g = hn[c] || hn.default, { t: _ } = dn(), v = Y(() => {
2258
+ let e = mn(a) || mn(n?.label);
1963
2259
  if (!e) return e;
1964
- let t = It(e);
2260
+ let t = fn(e);
1965
2261
  return t ? _(t) : e;
1966
2262
  }, [
1967
2263
  a,
1968
2264
  n?.label,
1969
2265
  _
1970
- ]), y = J(() => {
1971
- let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? Lt(t, l, u) : t ?? "", n = String(e);
2266
+ ]), y = Y(() => {
2267
+ let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? pn(t, l, u) : t ?? "", n = String(e);
1972
2268
  return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
1973
2269
  }, [
1974
2270
  t,
@@ -1976,17 +2272,17 @@ var zt = {
1976
2272
  u,
1977
2273
  d,
1978
2274
  f
1979
- ]), b = J(() => {
2275
+ ]), b = Y(() => {
1980
2276
  if (typeof r == "string") {
1981
- let e = le(r);
2277
+ let e = we(r);
1982
2278
  return e ? /* @__PURE__ */ Z(e, { className: "h-4 w-4" }) : null;
1983
2279
  }
1984
2280
  return r;
1985
2281
  }, [r]);
1986
2282
  if (m === "bare") {
1987
- let t = Bt[c] || Bt.default;
2283
+ let t = gn[c] || gn.default;
1988
2284
  return /* @__PURE__ */ Z("div", {
1989
- className: U("flex flex-col gap-1 min-w-0", p && "cursor-pointer", i),
2285
+ className: G("flex flex-col gap-1 min-w-0", p && "cursor-pointer", i),
1990
2286
  onClick: p,
1991
2287
  role: p ? "button" : void 0,
1992
2288
  tabIndex: p ? 0 : void 0,
@@ -1996,7 +2292,7 @@ var zt = {
1996
2292
  children: o ? /* @__PURE__ */ Q("div", {
1997
2293
  className: "flex items-center gap-2 text-muted-foreground",
1998
2294
  "data-testid": "metric-loading",
1999
- children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2295
+ children: [/* @__PURE__ */ Z(Ve, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2000
2296
  className: "text-sm",
2001
2297
  children: "Loading…"
2002
2298
  })]
@@ -2004,21 +2300,21 @@ var zt = {
2004
2300
  className: "flex items-center gap-2",
2005
2301
  "data-testid": "metric-error",
2006
2302
  role: "alert",
2007
- children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2303
+ children: [/* @__PURE__ */ Z(je, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2008
2304
  className: "text-xs text-destructive truncate",
2009
2305
  children: s
2010
2306
  })]
2011
- }) : /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z("div", {
2012
- className: U("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", t),
2307
+ }) : /* @__PURE__ */ Q(ut, { children: [/* @__PURE__ */ Z("div", {
2308
+ className: G("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", t),
2013
2309
  children: y
2014
2310
  }), /* @__PURE__ */ Z("div", {
2015
2311
  className: "text-xs font-medium text-muted-foreground truncate",
2016
- children: Rt(e)
2312
+ children: mn(e)
2017
2313
  })] })
2018
2314
  });
2019
2315
  }
2020
- return /* @__PURE__ */ Q(ee, {
2021
- className: U("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
2316
+ return /* @__PURE__ */ Q(I, {
2317
+ className: G("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
2022
2318
  onClick: p,
2023
2319
  role: p ? "button" : void 0,
2024
2320
  tabIndex: p ? 0 : void 0,
@@ -2026,19 +2322,19 @@ var zt = {
2026
2322
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
2027
2323
  } : void 0,
2028
2324
  ...h,
2029
- children: [/* @__PURE__ */ Q(N, {
2325
+ children: [/* @__PURE__ */ Q(L, {
2030
2326
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2031
- children: [/* @__PURE__ */ Z(P, {
2327
+ children: [/* @__PURE__ */ Z(R, {
2032
2328
  className: "text-sm font-medium truncate",
2033
- children: Rt(e)
2329
+ children: mn(e)
2034
2330
  }), b && /* @__PURE__ */ Z("div", {
2035
- className: U("flex h-8 w-8 items-center justify-center rounded-md shrink-0", g),
2331
+ className: G("flex h-8 w-8 items-center justify-center rounded-md shrink-0", g),
2036
2332
  children: b
2037
2333
  })]
2038
- }), /* @__PURE__ */ Z(M, { children: o ? /* @__PURE__ */ Q("div", {
2334
+ }), /* @__PURE__ */ Z(ie, { children: o ? /* @__PURE__ */ Q("div", {
2039
2335
  className: "flex items-center gap-2 text-muted-foreground",
2040
2336
  "data-testid": "metric-loading",
2041
- children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2337
+ children: [/* @__PURE__ */ Z(Ve, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2042
2338
  className: "text-sm",
2043
2339
  children: "Loading…"
2044
2340
  })]
@@ -2046,21 +2342,21 @@ var zt = {
2046
2342
  className: "flex items-center gap-2",
2047
2343
  "data-testid": "metric-error",
2048
2344
  role: "alert",
2049
- children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2345
+ children: [/* @__PURE__ */ Z(je, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2050
2346
  className: "text-xs text-destructive truncate",
2051
2347
  children: s
2052
2348
  })]
2053
- }) : /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z("div", {
2349
+ }) : /* @__PURE__ */ Q(ut, { children: [/* @__PURE__ */ Z("div", {
2054
2350
  className: "text-2xl font-bold tabular-nums tracking-tight truncate",
2055
2351
  children: y
2056
2352
  }), (n || a) && /* @__PURE__ */ Q("div", {
2057
2353
  className: "text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0",
2058
2354
  children: [n && /* @__PURE__ */ Q("span", {
2059
- className: U("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
2355
+ className: G("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
2060
2356
  children: [
2061
- n.direction === "up" && /* @__PURE__ */ Z(_e, { className: "h-3 w-3 mr-1" }),
2062
- n.direction === "down" && /* @__PURE__ */ Z(X, { className: "h-3 w-3 mr-1" }),
2063
- n.direction === "neutral" && /* @__PURE__ */ Z(we, { className: "h-3 w-3 mr-1" }),
2357
+ n.direction === "up" && /* @__PURE__ */ Z(Pe, { className: "h-3 w-3 mr-1" }),
2358
+ n.direction === "down" && /* @__PURE__ */ Z(Ne, { className: "h-3 w-3 mr-1" }),
2359
+ n.direction === "neutral" && /* @__PURE__ */ Z(He, { className: "h-3 w-3 mr-1" }),
2064
2360
  n.value,
2065
2361
  "%"
2066
2362
  ]
@@ -2073,24 +2369,24 @@ var zt = {
2073
2369
  };
2074
2370
  //#endregion
2075
2371
  //#region src/MetricCard.tsx
2076
- function Ht(e) {
2372
+ function vn(e) {
2077
2373
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
2078
2374
  }
2079
- var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2080
- let u = n ? le(n) : null;
2081
- return /* @__PURE__ */ Q(ee, {
2082
- className: U("h-full", o),
2375
+ var yn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2376
+ let u = n ? we(n) : null;
2377
+ return /* @__PURE__ */ Q(I, {
2378
+ className: G("h-full", o),
2083
2379
  ...l,
2084
- children: [/* @__PURE__ */ Q(N, {
2380
+ children: [/* @__PURE__ */ Q(L, {
2085
2381
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2086
- children: [/* @__PURE__ */ Z(P, {
2382
+ children: [/* @__PURE__ */ Z(R, {
2087
2383
  className: "text-sm font-medium",
2088
- children: Ht(e)
2384
+ children: vn(e)
2089
2385
  }), u && /* @__PURE__ */ Z(u, { className: "h-4 w-4 text-muted-foreground" })]
2090
- }), /* @__PURE__ */ Z(M, { children: s ? /* @__PURE__ */ Q("div", {
2386
+ }), /* @__PURE__ */ Z(ie, { children: s ? /* @__PURE__ */ Q("div", {
2091
2387
  className: "flex items-center gap-2 text-muted-foreground",
2092
2388
  "data-testid": "metric-card-loading",
2093
- children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2389
+ children: [/* @__PURE__ */ Z(Ve, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", {
2094
2390
  className: "text-sm",
2095
2391
  children: "Loading…"
2096
2392
  })]
@@ -2098,59 +2394,59 @@ var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2098
2394
  className: "flex items-center gap-2",
2099
2395
  "data-testid": "metric-card-error",
2100
2396
  role: "alert",
2101
- children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2397
+ children: [/* @__PURE__ */ Z(je, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Z("span", {
2102
2398
  className: "text-xs text-destructive truncate",
2103
2399
  children: c
2104
2400
  })]
2105
- }) : /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z("div", {
2401
+ }) : /* @__PURE__ */ Q(ut, { children: [/* @__PURE__ */ Z("div", {
2106
2402
  className: "text-2xl font-bold",
2107
2403
  children: t
2108
2404
  }), (r || i || a) && /* @__PURE__ */ Q("p", {
2109
2405
  className: "text-xs text-muted-foreground flex items-center mt-1",
2110
2406
  children: [r && i && /* @__PURE__ */ Q("span", {
2111
- className: U("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
2407
+ className: G("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
2112
2408
  children: [
2113
- r === "up" && /* @__PURE__ */ Z(_e, { className: "h-3 w-3 mr-1" }),
2114
- r === "down" && /* @__PURE__ */ Z(X, { className: "h-3 w-3 mr-1" }),
2115
- r === "neutral" && /* @__PURE__ */ Z(we, { className: "h-3 w-3 mr-1" }),
2409
+ r === "up" && /* @__PURE__ */ Z(Pe, { className: "h-3 w-3 mr-1" }),
2410
+ r === "down" && /* @__PURE__ */ Z(Ne, { className: "h-3 w-3 mr-1" }),
2411
+ r === "neutral" && /* @__PURE__ */ Z(He, { className: "h-3 w-3 mr-1" }),
2116
2412
  i
2117
2413
  ]
2118
- }), Ht(a)]
2414
+ }), vn(a)]
2119
2415
  })] }) })]
2120
2416
  });
2121
- }, Wt = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: s, className: c, description: l, dataSource: u, colorVariant: d, format: p, currency: y, prefix: b, suffix: x, invert: S, drillDown: C, title: w, compareTo: T, t: O, variant: k }) => {
2122
- let A = pe(v), j = u || A?.dataSource, [ee, M] = Y(!1), [N, P] = Y(null), [F, I] = Y(null), [L, R] = Y(!1), [te, re] = Y(null), [ie, H] = Y(null);
2123
- q(() => {
2417
+ }, bn = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: o, className: s, description: l, dataSource: u, colorVariant: d, format: f, currency: p, prefix: m, suffix: g, invert: _, drillDown: v, title: S, compareTo: T, t: E, variant: D }) => {
2418
+ let O = ke(w), k = u || O?.dataSource, [A, j] = X(!1), [M, N] = X(null), [ne, P] = X(null), [F, re] = X(!1), [I, ie] = X(null), [L, R] = X(null);
2419
+ J(() => {
2124
2420
  let t = !0;
2125
- if (!(!j || !e || typeof j.getObjectSchema != "function")) return j.getObjectSchema(e).then((e) => {
2126
- t && H(e);
2421
+ if (!(!k || !e || typeof k.getObjectSchema != "function")) return k.getObjectSchema(e).then((e) => {
2422
+ t && R(e);
2127
2423
  }).catch(() => {}), () => {
2128
2424
  t = !1;
2129
2425
  };
2130
- }, [j, e]);
2131
- let U = J(() => {
2426
+ }, [k, e]);
2427
+ let z = Y(() => {
2132
2428
  let e = t?.field;
2133
- if (!e || !ie?.fields) return null;
2134
- let n = ie.fields;
2429
+ if (!e || !L?.fields) return null;
2430
+ let n = L.fields;
2135
2431
  return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
2136
- }, [ie, t?.field]), le = J(() => {
2137
- if (p) return p;
2138
- if (U) {
2139
- if (U.type === "currency") {
2140
- let e = U.scale ?? 0;
2432
+ }, [L, t?.field]), ae = Y(() => {
2433
+ if (f) return f;
2434
+ if (z) {
2435
+ if (z.type === "currency") {
2436
+ let e = z.scale ?? 0;
2141
2437
  return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
2142
2438
  }
2143
- if (U.type === "percent") return "0,0%";
2144
- if (U.type === "number" || U.type === "integer") return "0,0";
2439
+ if (z.type === "percent") return "0,0%";
2440
+ if (z.type === "number" || z.type === "integer") return "0,0";
2145
2441
  }
2146
- }, [p, U]), { currency: ue } = D(), W = J(() => {
2147
- if (y) return y;
2148
- if (U?.type === "currency") return E(U, ue);
2442
+ }, [f, z]), { currency: oe } = te(), se = Y(() => {
2443
+ if (p) return p;
2444
+ if (z?.type === "currency") return ee(z, oe);
2149
2445
  }, [
2150
- y,
2151
- U,
2152
- ue
2153
- ]), de = J(() => t ? JSON.stringify(t) : "", [t]), G = J(() => m(n), [n]), fe = J(() => G ? JSON.stringify(G) : "", [G]), me = J(() => T ? JSON.stringify(T) : "", [T]), he = K(async (n, r) => {
2446
+ p,
2447
+ z,
2448
+ oe
2449
+ ]), ce = Y(() => t ? JSON.stringify(t) : "", [t]), B = Y(() => y(n), [n]), pe = Y(() => B ? JSON.stringify(B) : "", [B]), me = Y(() => T ? JSON.stringify(T) : "", [T]), he = q(async (n, r) => {
2154
2450
  if (t && typeof n.aggregate == "function") {
2155
2451
  let i = await n.aggregate(e, {
2156
2452
  field: t.field,
@@ -2171,50 +2467,50 @@ var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2171
2467
  return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
2172
2468
  }
2173
2469
  return null;
2174
- }, [e, de]), ge = K(async (t, r) => {
2470
+ }, [e, ce]), ge = q(async (t, r) => {
2175
2471
  if (!(!t || !e)) {
2176
- r.current && (R(!0), re(null));
2472
+ r.current && (re(!0), ie(null));
2177
2473
  try {
2178
- let e = T ? g(n, T) : null, [i, a] = await Promise.all([he(t, G), e ? he(t, e) : Promise.resolve(null)]);
2474
+ let e = T ? x(n, T) : null, [i, a] = await Promise.all([he(t, B), e ? he(t, e) : Promise.resolve(null)]);
2179
2475
  if (i === null) return;
2180
- r.current && (P(i), I(typeof a == "number" && Number.isFinite(a) ? a : null));
2476
+ r.current && (N(i), P(typeof a == "number" && Number.isFinite(a) ? a : null));
2181
2477
  } catch (e) {
2182
- console.error("[ObjectMetricWidget] Fetch error:", e), r.current && re(e instanceof Error ? e.message : "Failed to load metric");
2478
+ console.error("[ObjectMetricWidget] Fetch error:", e), r.current && ie(e instanceof Error ? e.message : "Failed to load metric");
2183
2479
  } finally {
2184
- r.current && R(!1);
2480
+ r.current && re(!1);
2185
2481
  }
2186
2482
  }
2187
2483
  }, [
2188
2484
  e,
2189
- de,
2190
- fe,
2485
+ ce,
2486
+ pe,
2191
2487
  me,
2192
2488
  he
2193
2489
  ]);
2194
- q(() => {
2490
+ J(() => {
2195
2491
  let t = { current: !0 };
2196
- return j && e ? ge(j, t) : (P(null), re(null)), () => {
2492
+ return k && e ? ge(k, t) : (N(null), ie(null)), () => {
2197
2493
  t.current = !1;
2198
2494
  };
2199
2495
  }, [
2200
- j,
2496
+ k,
2201
2497
  e,
2202
2498
  ge
2203
2499
  ]);
2204
- let X = N === null ? j ? "—" : i ?? "—" : N;
2205
- S && typeof X == "number" && isFinite(X) && X >= 0 && X <= 1 && (X = 1 - X);
2206
- let _e = J(() => {
2207
- if (!T || typeof N != "number" || !Number.isFinite(N) || F === null) return;
2208
- let e = Je(N, F);
2500
+ let V = M === null ? k ? "—" : i ?? "—" : M;
2501
+ _ && typeof V == "number" && isFinite(V) && V >= 0 && V <= 1 && (V = 1 - V);
2502
+ let _e = Y(() => {
2503
+ if (!T || typeof M != "number" || !Number.isFinite(M) || ne === null) return;
2504
+ let e = pt(M, ne);
2209
2505
  if (!e) return;
2210
- let t = o(T, n), r = `dashboard.trend.${t}`, i = {
2506
+ let t = c(T, n), r = `dashboard.trend.${t}`, i = {
2211
2507
  vsPreviousPeriod: "vs previous period",
2212
2508
  vsLastWeek: "vs last week",
2213
2509
  vsLastMonth: "vs last month",
2214
2510
  vsLastQuarter: "vs last quarter",
2215
2511
  vsLastYear: "vs last year",
2216
2512
  vsYesterday: "vs yesterday"
2217
- }, a = O ? O(r, i[t] || t) : i[t] || t;
2513
+ }, a = E ? E(r, i[t] || t) : i[t] || t;
2218
2514
  return {
2219
2515
  value: e.value,
2220
2516
  direction: e.direction,
@@ -2222,29 +2518,29 @@ var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2222
2518
  };
2223
2519
  }, [
2224
2520
  T,
2225
- N,
2226
- F,
2521
+ M,
2522
+ ne,
2227
2523
  n,
2228
- O
2229
- ]) ?? a, ve = f(C) && !!e && !!j, ye = J(() => {
2524
+ E
2525
+ ]) ?? a, H = h(v) && !!e && !!k, U = Y(() => {
2230
2526
  let e = typeof r == "string" ? r : r?.defaultValue || "";
2231
- return h(C, {}, (typeof w == "string" ? w : w?.defaultValue || "") || e || "Details");
2527
+ return b(v, {}, (typeof S == "string" ? S : S?.defaultValue || "") || e || "Details");
2232
2528
  }, [
2233
- C,
2529
+ v,
2234
2530
  r,
2235
- w
2236
- ]), be = J(() => {
2237
- if (!ve) return null;
2238
- let t = C?.target ?? "drawer", n = C?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Z(lt, {
2531
+ S
2532
+ ]), ve = Y(() => {
2533
+ if (!H) return null;
2534
+ let t = v?.target ?? "drawer", n = v?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Z(Ot, {
2239
2535
  objectName: e,
2240
- filter: G,
2241
- onNavigate: () => M(!1)
2536
+ filter: B,
2537
+ onNavigate: () => j(!1)
2242
2538
  }), a;
2243
2539
  if (r) {
2244
- let e = n.filter, t = e ? G ? { $and: [e, G] } : e : G;
2540
+ let e = n.filter, t = e ? B ? { $and: [e, B] } : e : B;
2245
2541
  a = /* @__PURE__ */ Z("div", {
2246
2542
  className: "h-full overflow-auto",
2247
- children: /* @__PURE__ */ Z(_, { schema: {
2543
+ children: /* @__PURE__ */ Z(C, { schema: {
2248
2544
  type: "spec-report",
2249
2545
  ...n,
2250
2546
  filter: t
@@ -2252,10 +2548,10 @@ var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2252
2548
  });
2253
2549
  } else a = /* @__PURE__ */ Z("div", {
2254
2550
  className: "h-full overflow-auto",
2255
- children: /* @__PURE__ */ Z(_, { schema: {
2551
+ children: /* @__PURE__ */ Z(C, { schema: {
2256
2552
  type: "object-data-table",
2257
2553
  objectName: e,
2258
- filter: G,
2554
+ filter: B,
2259
2555
  pageSize: 25,
2260
2556
  drillDown: {
2261
2557
  enabled: !0,
@@ -2264,25 +2560,25 @@ var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2264
2560
  }
2265
2561
  } })
2266
2562
  });
2267
- return t === "dialog" ? /* @__PURE__ */ Z(z, {
2563
+ return t === "dialog" ? /* @__PURE__ */ Z(le, {
2268
2564
  open: !0,
2269
- onOpenChange: (e) => !e && M(!1),
2270
- children: /* @__PURE__ */ Q(ne, {
2565
+ onOpenChange: (e) => !e && j(!1),
2566
+ children: /* @__PURE__ */ Q(ue, {
2271
2567
  className: "max-w-5xl",
2272
- children: [/* @__PURE__ */ Q(B, {
2568
+ children: [/* @__PURE__ */ Q(de, {
2273
2569
  className: "flex-row items-center justify-between gap-4 pr-8",
2274
- children: [/* @__PURE__ */ Z(V, { children: ye }), i]
2570
+ children: [/* @__PURE__ */ Z(fe, { children: U }), i]
2275
2571
  }), a]
2276
2572
  })
2277
- }) : /* @__PURE__ */ Z(ae, {
2573
+ }) : /* @__PURE__ */ Z(be, {
2278
2574
  open: !0,
2279
- onOpenChange: (e) => !e && M(!1),
2280
- children: /* @__PURE__ */ Q(oe, {
2575
+ onOpenChange: (e) => !e && j(!1),
2576
+ children: /* @__PURE__ */ Q(xe, {
2281
2577
  side: "right",
2282
2578
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
2283
- children: [/* @__PURE__ */ Q(se, {
2579
+ children: [/* @__PURE__ */ Q(Se, {
2284
2580
  className: "flex-row items-center justify-between gap-4 pr-8",
2285
- children: [/* @__PURE__ */ Z(ce, { children: ye }), i]
2581
+ children: [/* @__PURE__ */ Z(Ce, { children: U }), i]
2286
2582
  }), /* @__PURE__ */ Z("div", {
2287
2583
  className: "flex-1 overflow-hidden mt-2",
2288
2584
  children: a
@@ -2290,39 +2586,39 @@ var Ut = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2290
2586
  })
2291
2587
  });
2292
2588
  }, [
2293
- ve,
2294
- C,
2589
+ H,
2590
+ v,
2295
2591
  e,
2296
- G,
2297
- ye
2592
+ B,
2593
+ U
2298
2594
  ]);
2299
- return /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z(Vt, {
2595
+ return /* @__PURE__ */ Q(ut, { children: [/* @__PURE__ */ Z(_n, {
2300
2596
  label: r,
2301
- value: X,
2597
+ value: V,
2302
2598
  trend: _e,
2303
- icon: s,
2304
- className: c,
2599
+ icon: o,
2600
+ className: s,
2305
2601
  description: l,
2306
- loading: L,
2307
- error: te,
2602
+ loading: F,
2603
+ error: I,
2308
2604
  colorVariant: d,
2309
- format: le,
2310
- currency: W,
2311
- prefix: b,
2312
- suffix: x,
2313
- variant: k,
2314
- onClick: ve ? () => M(!0) : void 0
2315
- }), ee && be] });
2605
+ format: ae,
2606
+ currency: se,
2607
+ prefix: m,
2608
+ suffix: g,
2609
+ variant: D,
2610
+ onClick: H ? () => j(!0) : void 0
2611
+ }), A && ve] });
2316
2612
  };
2317
2613
  //#endregion
2318
2614
  //#region src/PivotTable.tsx
2319
- function Gt() {
2320
- return A()("dashboard.total", "Total");
2615
+ function xn() {
2616
+ return P()("dashboard.total", "Total");
2321
2617
  }
2322
- function Kt() {
2323
- return A()("dashboard.noDataAvailable", "No data available");
2618
+ function Sn() {
2619
+ return P()("dashboard.noDataAvailable", "No data available");
2324
2620
  }
2325
- function qt(e, t) {
2621
+ function Cn(e, t) {
2326
2622
  if (!t) return String(e);
2327
2623
  let n = "", r = "", i = !1, a, o = t, s = o.match(/^([^0-9.,#]*)/);
2328
2624
  if (s && s[1]) {
@@ -2339,11 +2635,11 @@ function qt(e, t) {
2339
2635
  }
2340
2636
  return n + l + r;
2341
2637
  }
2342
- var Jt = "—";
2343
- function Yt(e, t) {
2344
- return e === "" ? Jt : t?.[e] ?? e;
2638
+ var wn = "—";
2639
+ function Tn(e, t) {
2640
+ return e === "" ? wn : t?.[e] ?? e;
2345
2641
  }
2346
- function Xt(e, t) {
2642
+ function En(e, t) {
2347
2643
  if (e.length === 0) return 0;
2348
2644
  switch (t) {
2349
2645
  case "sum": return e.reduce((e, t) => e + t, 0);
@@ -2354,8 +2650,8 @@ function Xt(e, t) {
2354
2650
  default: return e.reduce((e, t) => e + t, 0);
2355
2651
  }
2356
2652
  }
2357
- var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2358
- let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: p = !1, showColumnTotals: m = !1, format: h, columnColors: g, drillDown: _ } = e, v = Gt(), y = Kt(), b = f(_) && typeof a == "function", x = (e) => {
2653
+ var Dn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2654
+ let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: f = !1, showColumnTotals: p = !1, format: m, columnColors: g, drillDown: _ } = e, v = xn(), y = Sn(), b = h(_) && typeof a == "function", x = (e) => {
2359
2655
  b && a({
2360
2656
  ...e,
2361
2657
  rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
@@ -2363,7 +2659,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2363
2659
  });
2364
2660
  }, S = (e) => (t) => {
2365
2661
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
2366
- }, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(d) ? d : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = J(() => {
2662
+ }, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(d) ? d : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = Y(() => {
2367
2663
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
2368
2664
  for (let r of w) {
2369
2665
  let i = String(r[s] ?? ""), a = String(r[c] ?? ""), o = Number(r[l]) || 0;
@@ -2374,10 +2670,10 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2374
2670
  a[e] = {};
2375
2671
  let t = [];
2376
2672
  for (let r of i) {
2377
- let i = n[e]?.[r] ?? [], o = Xt(i, u);
2673
+ let i = n[e]?.[r] ?? [], o = En(i, u);
2378
2674
  a[e][r] = o, t.push(...i), !d[r] && d[r];
2379
2675
  }
2380
- o[e] = Xt(t, u);
2676
+ o[e] = En(t, u);
2381
2677
  }
2382
2678
  for (let e of i) {
2383
2679
  let t = [];
@@ -2385,7 +2681,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2385
2681
  let r = n[i]?.[e] ?? [];
2386
2682
  t.push(...r);
2387
2683
  }
2388
- d[e] = Xt(t, u);
2684
+ d[e] = En(t, u);
2389
2685
  }
2390
2686
  let f = [];
2391
2687
  for (let e of w) f.push(Number(e[l]) || 0);
@@ -2395,7 +2691,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2395
2691
  matrix: a,
2396
2692
  rowTotals: o,
2397
2693
  colTotals: d,
2398
- grandTotal: Xt(f, u)
2694
+ grandTotal: En(f, u)
2399
2695
  };
2400
2696
  }, [
2401
2697
  w,
@@ -2403,13 +2699,13 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2403
2699
  c,
2404
2700
  l,
2405
2701
  u
2406
- ]), j = (e) => qt(e, h);
2702
+ ]), j = (e) => Cn(e, m);
2407
2703
  return w.length === 0 ? /* @__PURE__ */ Q("div", {
2408
- className: U("overflow-auto", t),
2704
+ className: G("overflow-auto", t),
2409
2705
  children: [o && /* @__PURE__ */ Z("h3", {
2410
2706
  className: "text-sm font-semibold mb-2",
2411
2707
  children: o
2412
- }), /* @__PURE__ */ Z(te, {
2708
+ }), /* @__PURE__ */ Z(ce, {
2413
2709
  "data-testid": "pivot-empty-state",
2414
2710
  className: "py-8 gap-2 [&>h3]:hidden",
2415
2711
  icon: /* @__PURE__ */ Q("svg", {
@@ -2453,7 +2749,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2453
2749
  description: y
2454
2750
  })]
2455
2751
  }) : /* @__PURE__ */ Q("div", {
2456
- className: U("overflow-auto", t),
2752
+ className: G("overflow-auto", t),
2457
2753
  children: [o && /* @__PURE__ */ Z("h3", {
2458
2754
  className: "text-sm font-semibold mb-2",
2459
2755
  children: o
@@ -2474,17 +2770,17 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2474
2770
  colKey: e
2475
2771
  });
2476
2772
  return /* @__PURE__ */ Z("th", {
2477
- className: U("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
2773
+ className: G("text-right p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", g?.[e] ?? "text-muted-foreground", C),
2478
2774
  title: e === "" ? `${c}: (empty)` : `${c}: ${e}`,
2479
2775
  role: b ? "button" : void 0,
2480
2776
  tabIndex: b ? 0 : void 0,
2481
2777
  onClick: b ? t : void 0,
2482
2778
  onKeyDown: b ? S(t) : void 0,
2483
2779
  "aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
2484
- children: Yt(e, r)
2780
+ children: Tn(e, r)
2485
2781
  }, e);
2486
2782
  }),
2487
- p && /* @__PURE__ */ Z("th", {
2783
+ f && /* @__PURE__ */ Z("th", {
2488
2784
  className: "text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap",
2489
2785
  children: v
2490
2786
  })
@@ -2494,7 +2790,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2494
2790
  className: "border-b border-border/50 hover:bg-muted/30",
2495
2791
  children: [
2496
2792
  /* @__PURE__ */ Z("td", {
2497
- className: U("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
2793
+ className: G("p-2 font-medium whitespace-nowrap", e === "" && "italic text-muted-foreground/70", C),
2498
2794
  role: b ? "button" : void 0,
2499
2795
  tabIndex: b ? 0 : void 0,
2500
2796
  onClick: b ? () => x({
@@ -2506,7 +2802,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2506
2802
  rowKey: e
2507
2803
  })) : void 0,
2508
2804
  "aria-label": b ? `Drill into ${s}: ${e || "(empty)"}` : void 0,
2509
- children: Yt(e, n)
2805
+ children: Tn(e, n)
2510
2806
  }),
2511
2807
  E.map((t) => {
2512
2808
  let n = D[e]?.[t] ?? 0, r = () => x({
@@ -2516,7 +2812,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2516
2812
  value: n
2517
2813
  });
2518
2814
  return /* @__PURE__ */ Z("td", {
2519
- className: U("text-right p-2 tabular-nums", g?.[t], C),
2815
+ className: G("text-right p-2 tabular-nums", g?.[t], C),
2520
2816
  role: b ? "button" : void 0,
2521
2817
  tabIndex: b ? 0 : void 0,
2522
2818
  onClick: b ? r : void 0,
@@ -2525,8 +2821,8 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2525
2821
  children: j(n)
2526
2822
  }, t);
2527
2823
  }),
2528
- p && /* @__PURE__ */ Z("td", {
2529
- className: U("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
2824
+ f && /* @__PURE__ */ Z("td", {
2825
+ className: G("text-right p-2 font-semibold tabular-nums bg-muted/20", C),
2530
2826
  role: b ? "button" : void 0,
2531
2827
  tabIndex: b ? 0 : void 0,
2532
2828
  onClick: b ? () => x({
@@ -2543,7 +2839,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2543
2839
  })
2544
2840
  ]
2545
2841
  }, e)) }),
2546
- m && /* @__PURE__ */ Z("tfoot", { children: /* @__PURE__ */ Q("tr", {
2842
+ p && /* @__PURE__ */ Z("tfoot", { children: /* @__PURE__ */ Q("tr", {
2547
2843
  className: "border-t-2 border-border font-semibold bg-muted/40",
2548
2844
  children: [
2549
2845
  /* @__PURE__ */ Z("td", {
@@ -2551,7 +2847,7 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2551
2847
  children: v
2552
2848
  }),
2553
2849
  E.map((e) => /* @__PURE__ */ Z("td", {
2554
- className: U("text-right p-2 tabular-nums", C),
2850
+ className: G("text-right p-2 tabular-nums", C),
2555
2851
  role: b ? "button" : void 0,
2556
2852
  tabIndex: b ? 0 : void 0,
2557
2853
  onClick: b ? () => x({
@@ -2566,8 +2862,8 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2566
2862
  })) : void 0,
2567
2863
  children: j(k[e] ?? 0)
2568
2864
  }, e)),
2569
- p && /* @__PURE__ */ Z("td", {
2570
- className: U("text-right p-2 tabular-nums font-bold", C),
2865
+ f && /* @__PURE__ */ Z("td", {
2866
+ className: G("text-right p-2 tabular-nums font-bold", C),
2571
2867
  role: b ? "button" : void 0,
2572
2868
  tabIndex: b ? 0 : void 0,
2573
2869
  onClick: b ? () => x({
@@ -2585,11 +2881,11 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2585
2881
  ]
2586
2882
  })]
2587
2883
  });
2588
- }, Qt = ({ schema: e, dataSource: t, className: n }) => {
2589
- let r = pe(v), i = t || r?.dataSource, a = b(e.bind), [o, l] = Y([]), [u, d] = Y(!1), [p, g] = Y(null), [_, y] = Y({}), [x, S] = Y({}), [C, w] = Y(null), { fieldLabel: T, fieldOptionLabel: E } = k(), D = me(T), O = me(E);
2590
- q(() => {
2591
- D.current = T, O.current = E;
2592
- }, [T, E]), q(() => {
2884
+ }, On = ({ schema: e, dataSource: t, className: n }) => {
2885
+ let r = ke(w), i = t || r?.dataSource, a = E(e.bind), [o, s] = X([]), [c, u] = X(!1), [f, p] = X(null), [m, g] = X({}), [_, v] = X({}), [x, S] = X(null), { fieldLabel: C, fieldOptionLabel: T } = ne(), D = Ae(C), O = Ae(T);
2886
+ J(() => {
2887
+ D.current = C, O.current = T;
2888
+ }, [C, T]), J(() => {
2593
2889
  if (!i || !e.objectName) return;
2594
2890
  let t = i.getObjectSchema;
2595
2891
  if (typeof t != "function") return;
@@ -2610,24 +2906,24 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2610
2906
  Object.keys(t).length > 0 && (i[e] = t);
2611
2907
  }
2612
2908
  }
2613
- y(i), S(a);
2909
+ g(i), v(a);
2614
2910
  }).catch(() => {}), () => {
2615
2911
  n = !1;
2616
2912
  };
2617
- }, [i, e.objectName]), q(() => {
2913
+ }, [i, e.objectName]), J(() => {
2618
2914
  let t = !0;
2619
2915
  return e.objectName && !a && (!e.data || e.data.length === 0) && (async () => {
2620
2916
  if (!(!i || !e.objectName)) {
2621
- t && (d(!0), g(null));
2917
+ t && (u(!0), p(null));
2622
2918
  try {
2623
2919
  let n;
2624
- if (typeof i.find == "function") n = c(await i.find(e.objectName, { $filter: m(e.filter) }));
2920
+ if (typeof i.find == "function") n = d(await i.find(e.objectName, { $filter: y(e.filter) }));
2625
2921
  else return;
2626
- t && l(n);
2922
+ t && s(n);
2627
2923
  } catch (e) {
2628
- console.error("[ObjectPivotTable] Fetch error:", e), t && g(e instanceof Error ? e.message : "Failed to load data");
2924
+ console.error("[ObjectPivotTable] Fetch error:", e), t && p(e instanceof Error ? e.message : "Failed to load data");
2629
2925
  } finally {
2630
- t && d(!1);
2926
+ t && u(!1);
2631
2927
  }
2632
2928
  }
2633
2929
  })(), () => {
@@ -2640,9 +2936,9 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2640
2936
  e.data,
2641
2937
  e.filter
2642
2938
  ]);
2643
- let A = a || e.data || o, j = Array.isArray(A) ? A : [];
2644
- if (u && j.length === 0) return /* @__PURE__ */ Q("div", {
2645
- className: U("overflow-auto", n),
2939
+ let k = a || e.data || o, A = Array.isArray(k) ? k : [];
2940
+ if (c && A.length === 0) return /* @__PURE__ */ Q("div", {
2941
+ className: G("overflow-auto", n),
2646
2942
  "data-testid": "pivot-loading",
2647
2943
  children: [e.title && /* @__PURE__ */ Z("h3", {
2648
2944
  className: "text-sm font-semibold mb-2",
@@ -2652,10 +2948,10 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2652
2948
  children: [/* @__PURE__ */ Q("div", {
2653
2949
  className: "flex gap-2",
2654
2950
  children: [
2655
- /* @__PURE__ */ Z(H, { className: "h-6 w-24" }),
2656
- /* @__PURE__ */ Z(H, { className: "h-6 w-20" }),
2657
- /* @__PURE__ */ Z(H, { className: "h-6 w-20" }),
2658
- /* @__PURE__ */ Z(H, { className: "h-6 w-20" })
2951
+ /* @__PURE__ */ Z(W, { className: "h-6 w-24" }),
2952
+ /* @__PURE__ */ Z(W, { className: "h-6 w-20" }),
2953
+ /* @__PURE__ */ Z(W, { className: "h-6 w-20" }),
2954
+ /* @__PURE__ */ Z(W, { className: "h-6 w-20" })
2659
2955
  ]
2660
2956
  }), [
2661
2957
  1,
@@ -2664,16 +2960,16 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2664
2960
  ].map((e) => /* @__PURE__ */ Q("div", {
2665
2961
  className: "flex gap-2",
2666
2962
  children: [
2667
- /* @__PURE__ */ Z(H, { className: "h-5 w-24" }),
2668
- /* @__PURE__ */ Z(H, { className: "h-5 w-20" }),
2669
- /* @__PURE__ */ Z(H, { className: "h-5 w-20" }),
2670
- /* @__PURE__ */ Z(H, { className: "h-5 w-20" })
2963
+ /* @__PURE__ */ Z(W, { className: "h-5 w-24" }),
2964
+ /* @__PURE__ */ Z(W, { className: "h-5 w-20" }),
2965
+ /* @__PURE__ */ Z(W, { className: "h-5 w-20" }),
2966
+ /* @__PURE__ */ Z(W, { className: "h-5 w-20" })
2671
2967
  ]
2672
2968
  }, e))]
2673
2969
  })]
2674
2970
  });
2675
- if (p) return /* @__PURE__ */ Q("div", {
2676
- className: U("overflow-auto", n),
2971
+ if (f) return /* @__PURE__ */ Q("div", {
2972
+ className: G("overflow-auto", n),
2677
2973
  "data-testid": "pivot-error",
2678
2974
  children: [e.title && /* @__PURE__ */ Z("h3", {
2679
2975
  className: "text-sm font-semibold mb-2",
@@ -2711,12 +3007,12 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2711
3007
  ]
2712
3008
  }), /* @__PURE__ */ Z("p", {
2713
3009
  className: "text-xs",
2714
- children: p
3010
+ children: f
2715
3011
  })]
2716
3012
  })]
2717
3013
  });
2718
- if (!i && e.objectName && j.length === 0) return /* @__PURE__ */ Q("div", {
2719
- className: U("overflow-auto", n),
3014
+ if (!i && e.objectName && A.length === 0) return /* @__PURE__ */ Q("div", {
3015
+ className: G("overflow-auto", n),
2720
3016
  children: [e.title && /* @__PURE__ */ Z("h3", {
2721
3017
  className: "text-sm font-semibold mb-2",
2722
3018
  children: e.title
@@ -2732,40 +3028,40 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2732
3028
  })
2733
3029
  })]
2734
3030
  });
2735
- let ee = {
3031
+ let j = {
2736
3032
  ...e,
2737
- data: j
2738
- }, M = e.rowField ? _[e.rowField] : void 0, N = e.columnField ? _[e.columnField] : void 0, P = e.rowField ? x[e.rowField] : void 0, F = e.drillDown;
2739
- return /* @__PURE__ */ Q(Ge, { children: [/* @__PURE__ */ Z(Zt, {
2740
- schema: ee,
3033
+ data: A
3034
+ }, M = e.rowField ? m[e.rowField] : void 0, ee = e.columnField ? m[e.columnField] : void 0, te = e.rowField ? _[e.rowField] : void 0, N = e.drillDown;
3035
+ return /* @__PURE__ */ Q(ut, { children: [/* @__PURE__ */ Z(Dn, {
3036
+ schema: j,
2741
3037
  className: n,
2742
3038
  rowLabels: M,
2743
- columnLabels: N,
2744
- rowFieldLabel: P,
2745
- onDrillDown: f(F) ? (e) => w(e) : void 0
3039
+ columnLabels: ee,
3040
+ rowFieldLabel: te,
3041
+ onDrillDown: h(N) ? (e) => S(e) : void 0
2746
3042
  }), (() => {
2747
- if (!C || !e.objectName) return null;
2748
- let t = s(F, C, {
3043
+ if (!x || !e.objectName) return null;
3044
+ let t = l(N, x, {
2749
3045
  rowField: e.rowField,
2750
3046
  columnField: e.columnField
2751
3047
  }), n = {
2752
3048
  ...e.filter || {},
2753
3049
  ...t
2754
3050
  };
2755
- return /* @__PURE__ */ Z(ut, {
3051
+ return /* @__PURE__ */ Z(kt, {
2756
3052
  open: !0,
2757
- onClose: () => w(null),
2758
- title: h(F, C, e.title || "Details"),
2759
- target: F?.target ?? "drawer",
3053
+ onClose: () => S(null),
3054
+ title: b(N, x, e.title || "Details"),
3055
+ target: N?.target ?? "drawer",
2760
3056
  objectName: e.objectName,
2761
3057
  filter: n,
2762
3058
  dataSource: i,
2763
- columns: F?.columns,
2764
- maxRows: F?.maxRows,
2765
- report: F?.report
3059
+ columns: N?.columns,
3060
+ maxRows: N?.maxRows,
3061
+ report: N?.report
2766
3062
  });
2767
3063
  })()] });
2768
- }, $t = {
3064
+ }, kn = {
2769
3065
  breadcrumb: ["Dashboard", "Configuration"],
2770
3066
  sections: [
2771
3067
  {
@@ -2891,12 +3187,12 @@ var Zt = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2891
3187
  }
2892
3188
  ]
2893
3189
  };
2894
- function en({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2895
- let { draft: a, isDirty: o, updateField: s, discard: c } = ue(n, { onUpdate: i });
2896
- return /* @__PURE__ */ Z(L, {
3190
+ function An({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
3191
+ let { draft: a, isDirty: o, updateField: s, discard: c } = Te(n, { onUpdate: i });
3192
+ return /* @__PURE__ */ Z(oe, {
2897
3193
  open: e,
2898
3194
  onClose: t,
2899
- schema: $t,
3195
+ schema: kn,
2900
3196
  draft: a,
2901
3197
  isDirty: o,
2902
3198
  onFieldChange: s,
@@ -2906,7 +3202,7 @@ function en({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
2906
3202
  }
2907
3203
  //#endregion
2908
3204
  //#region src/WidgetConfigPanel.tsx
2909
- var tn = [
3205
+ var jn = [
2910
3206
  {
2911
3207
  value: "metric",
2912
3208
  label: "Metric"
@@ -2951,7 +3247,7 @@ var tn = [
2951
3247
  value: "pivot",
2952
3248
  label: "Pivot Table"
2953
3249
  }
2954
- ], nn = [
3250
+ ], Mn = [
2955
3251
  {
2956
3252
  value: "default",
2957
3253
  label: "Default"
@@ -2984,7 +3280,7 @@ var tn = [
2984
3280
  value: "danger",
2985
3281
  label: "Danger"
2986
3282
  }
2987
- ], rn = [
3283
+ ], Nn = [
2988
3284
  {
2989
3285
  value: "count",
2990
3286
  label: "Count"
@@ -3005,7 +3301,7 @@ var tn = [
3005
3301
  value: "max",
3006
3302
  label: "Max"
3007
3303
  }
3008
- ], an = [
3304
+ ], Pn = [
3009
3305
  "bar",
3010
3306
  "horizontal-bar",
3011
3307
  "line",
@@ -3014,17 +3310,17 @@ var tn = [
3014
3310
  "donut",
3015
3311
  "scatter",
3016
3312
  "funnel"
3017
- ], on = [
3313
+ ], Fn = [
3018
3314
  "bar",
3019
3315
  "horizontal-bar",
3020
3316
  "line",
3021
3317
  "area",
3022
3318
  "scatter"
3023
- ], sn = [
3319
+ ], In = [
3024
3320
  "pie",
3025
3321
  "donut",
3026
3322
  "funnel"
3027
- ], cn = ["metric", ...an], ln = [...an], un = [
3323
+ ], Ln = ["metric", ...Pn], Rn = [...Pn], zn = [
3028
3324
  "pivot",
3029
3325
  "metric",
3030
3326
  "bar",
@@ -3040,50 +3336,50 @@ var tn = [
3040
3336
  "table",
3041
3337
  "list"
3042
3338
  ];
3043
- function dn(e) {
3044
- return !!e && an.includes(e);
3339
+ function Bn(e) {
3340
+ return !!e && Pn.includes(e);
3045
3341
  }
3046
- function fn(e) {
3047
- return !!e && on.includes(e);
3342
+ function Vn(e) {
3343
+ return !!e && Fn.includes(e);
3048
3344
  }
3049
- function pn(e) {
3050
- return !!e && ln.includes(e);
3345
+ function Hn(e) {
3346
+ return !!e && Rn.includes(e);
3051
3347
  }
3052
- function mn(e) {
3053
- return !!e && cn.includes(e);
3348
+ function Un(e) {
3349
+ return !!e && Ln.includes(e);
3054
3350
  }
3055
- function hn(e) {
3056
- return !!e && un.includes(e);
3351
+ function Wn(e) {
3352
+ return !!e && zn.includes(e);
3057
3353
  }
3058
- var gn = [{
3354
+ var Gn = [{
3059
3355
  value: "drawer",
3060
3356
  label: "Side drawer"
3061
3357
  }, {
3062
3358
  value: "dialog",
3063
3359
  label: "Center dialog"
3064
- }], _n = [{
3360
+ }], Kn = [{
3065
3361
  value: "group",
3066
3362
  label: "Group"
3067
3363
  }, {
3068
3364
  value: "value",
3069
3365
  label: "Value"
3070
- }], vn = [{
3366
+ }], qn = [{
3071
3367
  value: "asc",
3072
3368
  label: "↑"
3073
3369
  }, {
3074
3370
  value: "desc",
3075
3371
  label: "↓"
3076
3372
  }];
3077
- function yn(e, t, n, r) {
3373
+ function Jn(e, t, n, r) {
3078
3374
  return {
3079
3375
  key: e,
3080
3376
  label: t,
3081
3377
  type: "custom",
3082
- render: (i, a, o) => /* @__PURE__ */ Z(R, {
3378
+ render: (i, a, o) => /* @__PURE__ */ Z(se, {
3083
3379
  label: t,
3084
3380
  children: /* @__PURE__ */ Z("div", {
3085
3381
  "data-testid": `config-field-${e}`,
3086
- children: /* @__PURE__ */ Z(I, {
3382
+ children: /* @__PURE__ */ Z(ae, {
3087
3383
  options: r ?? [],
3088
3384
  value: i ?? "",
3089
3385
  onValueChange: a,
@@ -3097,16 +3393,16 @@ function yn(e, t, n, r) {
3097
3393
  })
3098
3394
  };
3099
3395
  }
3100
- function bn(e, t, n) {
3396
+ function Yn(e, t, n) {
3101
3397
  let r = e && e.length > 0, i = r ? {
3102
3398
  key: "object",
3103
3399
  label: "Data source",
3104
3400
  type: "custom",
3105
- render: (t, n) => /* @__PURE__ */ Z(R, {
3401
+ render: (t, n) => /* @__PURE__ */ Z(se, {
3106
3402
  label: "Data source",
3107
3403
  children: /* @__PURE__ */ Z("div", {
3108
3404
  "data-testid": "config-field-object",
3109
- children: /* @__PURE__ */ Z(I, {
3405
+ children: /* @__PURE__ */ Z(ae, {
3110
3406
  options: e,
3111
3407
  value: t ?? "",
3112
3408
  onValueChange: n,
@@ -3123,38 +3419,38 @@ function bn(e, t, n) {
3123
3419
  type: "input",
3124
3420
  placeholder: "Object name"
3125
3421
  }, a = r ? {
3126
- ...yn("categoryField", "Category field", "Select field…", t),
3422
+ ...Jn("categoryField", "Category field", "Select field…", t),
3127
3423
  helpText: "Group records by this field (one bar/slice/segment per value).",
3128
- visibleWhen: (e) => pn(e.type)
3424
+ visibleWhen: (e) => Hn(e.type)
3129
3425
  } : {
3130
3426
  key: "categoryField",
3131
3427
  label: "Category field",
3132
3428
  type: "input",
3133
3429
  placeholder: "e.g. status",
3134
3430
  helpText: "Group records by this field (one bar/slice/segment per value).",
3135
- visibleWhen: (e) => pn(e.type)
3431
+ visibleWhen: (e) => Hn(e.type)
3136
3432
  }, o = r ? {
3137
- ...yn("valueField", "Value field", "Select field…", t),
3433
+ ...Jn("valueField", "Value field", "Select field…", t),
3138
3434
  helpText: "Field to aggregate (sum / average / min / max).",
3139
- visibleWhen: (e) => mn(e.type) && (e.aggregate ?? "count") !== "count"
3435
+ visibleWhen: (e) => Un(e.type) && (e.aggregate ?? "count") !== "count"
3140
3436
  } : {
3141
3437
  key: "valueField",
3142
3438
  label: "Value field",
3143
3439
  type: "input",
3144
3440
  placeholder: "e.g. amount",
3145
3441
  helpText: "Field to aggregate (sum / average / min / max).",
3146
- visibleWhen: (e) => mn(e.type) && (e.aggregate ?? "count") !== "count"
3147
- }, s = r ? yn("rowField", "Field", "Select row field…", t) : {
3442
+ visibleWhen: (e) => Un(e.type) && (e.aggregate ?? "count") !== "count"
3443
+ }, s = r ? Jn("rowField", "Field", "Select row field…", t) : {
3148
3444
  key: "rowField",
3149
3445
  label: "Field",
3150
3446
  type: "input",
3151
3447
  placeholder: "e.g. owner"
3152
- }, c = r ? yn("columnField", "Field", "Select column field…", t) : {
3448
+ }, c = r ? Jn("columnField", "Field", "Select column field…", t) : {
3153
3449
  key: "columnField",
3154
3450
  label: "Field",
3155
3451
  type: "input",
3156
3452
  placeholder: "e.g. stage"
3157
- }, l = r ? yn("valueField", "Field", "Select value field…", t) : {
3453
+ }, l = r ? Jn("valueField", "Field", "Select value field…", t) : {
3158
3454
  key: "valueField",
3159
3455
  label: "Field",
3160
3456
  type: "input",
@@ -3164,7 +3460,7 @@ function bn(e, t, n) {
3164
3460
  breadcrumb: ["Dashboard", {
3165
3461
  pivot: "Pivot table",
3166
3462
  table: "Table"
3167
- }[n ?? ""] ?? (dn(n) ? "Chart" : "Widget")],
3463
+ }[n ?? ""] ?? (Bn(n) ? "Chart" : "Widget")],
3168
3464
  sections: [
3169
3465
  {
3170
3466
  key: "general",
@@ -3186,7 +3482,7 @@ function bn(e, t, n) {
3186
3482
  key: "type",
3187
3483
  label: "Widget type",
3188
3484
  type: "select",
3189
- options: tn,
3485
+ options: jn,
3190
3486
  defaultValue: "metric"
3191
3487
  }
3192
3488
  ]
@@ -3204,10 +3500,10 @@ function bn(e, t, n) {
3204
3500
  key: "aggregate",
3205
3501
  label: "Aggregation",
3206
3502
  type: "select",
3207
- options: rn,
3503
+ options: Nn,
3208
3504
  defaultValue: "count",
3209
3505
  helpText: "Count ignores Value field; Sum / Avg / Min / Max require it.",
3210
- visibleWhen: (e) => mn(e.type)
3506
+ visibleWhen: (e) => Un(e.type)
3211
3507
  }
3212
3508
  ]
3213
3509
  },
@@ -3229,14 +3525,14 @@ function bn(e, t, n) {
3229
3525
  key: "rowSortBy",
3230
3526
  label: "Sort by",
3231
3527
  type: "icon-group",
3232
- options: _n,
3528
+ options: Kn,
3233
3529
  defaultValue: "group"
3234
3530
  },
3235
3531
  {
3236
3532
  key: "rowSortOrder",
3237
3533
  label: "Sort order",
3238
3534
  type: "icon-group",
3239
- options: vn,
3535
+ options: qn,
3240
3536
  defaultValue: "asc"
3241
3537
  },
3242
3538
  {
@@ -3264,14 +3560,14 @@ function bn(e, t, n) {
3264
3560
  key: "columnSortBy",
3265
3561
  label: "Sort by",
3266
3562
  type: "icon-group",
3267
- options: _n,
3563
+ options: Kn,
3268
3564
  defaultValue: "group"
3269
3565
  },
3270
3566
  {
3271
3567
  key: "columnSortOrder",
3272
3568
  label: "Sort order",
3273
3569
  type: "icon-group",
3274
- options: vn,
3570
+ options: qn,
3275
3571
  defaultValue: "asc"
3276
3572
  },
3277
3573
  {
@@ -3299,7 +3595,7 @@ function bn(e, t, n) {
3299
3595
  key: "aggregation",
3300
3596
  label: "Aggregation",
3301
3597
  type: "select",
3302
- options: rn,
3598
+ options: Nn,
3303
3599
  defaultValue: "sum"
3304
3600
  },
3305
3601
  {
@@ -3314,7 +3610,7 @@ function bn(e, t, n) {
3314
3610
  key: "chart-axis",
3315
3611
  title: "Axis & Series",
3316
3612
  collapsible: !0,
3317
- visibleWhen: (e) => fn(e.type),
3613
+ visibleWhen: (e) => Vn(e.type),
3318
3614
  fields: [
3319
3615
  {
3320
3616
  key: "xAxisLabel",
@@ -3340,7 +3636,7 @@ function bn(e, t, n) {
3340
3636
  key: "chart-legend",
3341
3637
  title: "Display",
3342
3638
  collapsible: !0,
3343
- visibleWhen: (e) => !!e.type && sn.includes(e.type),
3639
+ visibleWhen: (e) => !!e.type && In.includes(e.type),
3344
3640
  fields: [{
3345
3641
  key: "showLegend",
3346
3642
  label: "Show legend",
@@ -3392,7 +3688,7 @@ function bn(e, t, n) {
3392
3688
  title: "Drill-down",
3393
3689
  collapsible: !0,
3394
3690
  defaultCollapsed: !0,
3395
- visibleWhen: (e) => hn(e.type),
3691
+ visibleWhen: (e) => Wn(e.type),
3396
3692
  fields: [{
3397
3693
  key: "drillDownEnabled",
3398
3694
  label: "Enable drill-down",
@@ -3403,7 +3699,7 @@ function bn(e, t, n) {
3403
3699
  key: "drillDownTarget",
3404
3700
  label: "Open in",
3405
3701
  type: "select",
3406
- options: gn,
3702
+ options: Gn,
3407
3703
  defaultValue: "drawer",
3408
3704
  visibleWhen: (e) => !!e.drillDownEnabled
3409
3705
  }]
@@ -3429,14 +3725,14 @@ function bn(e, t, n) {
3429
3725
  key: "colorVariant",
3430
3726
  label: "Color variant",
3431
3727
  type: "select",
3432
- options: nn,
3728
+ options: Mn,
3433
3729
  defaultValue: "default"
3434
3730
  }]
3435
3731
  }
3436
3732
  ]
3437
3733
  };
3438
3734
  }
3439
- function xn(e) {
3735
+ function Xn(e) {
3440
3736
  if (e == null) return "";
3441
3737
  if (typeof e == "string") return e;
3442
3738
  if (typeof e == "object") {
@@ -3445,20 +3741,20 @@ function xn(e) {
3445
3741
  }
3446
3742
  return String(e);
3447
3743
  }
3448
- function Sn(e) {
3744
+ function Zn(e) {
3449
3745
  let t = e.type, n = { ...e };
3450
- return pn(t) || delete n.categoryField, mn(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), fn(t) || (delete n.xAxisLabel, delete n.yAxisLabel), t === "pivot" ? (delete n.aggregate, delete n.categoryField) : (delete n.rowField, delete n.columnField, delete n.aggregation, delete n.rowSortBy, delete n.rowSortOrder, delete n.columnSortBy, delete n.columnSortOrder, delete n.showRowLabels, delete n.showRowTotals, delete n.showColumnLabels, delete n.showColumnTotals, delete n.format), t !== "table" && (delete n.searchable, delete n.pagination), hn(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
3746
+ return Hn(t) || delete n.categoryField, Un(t) ? (n.aggregate ?? "count") === "count" && delete n.valueField : (delete n.valueField, delete n.aggregate), Vn(t) || (delete n.xAxisLabel, delete n.yAxisLabel), t === "pivot" ? (delete n.aggregate, delete n.categoryField) : (delete n.rowField, delete n.columnField, delete n.aggregation, delete n.rowSortBy, delete n.rowSortOrder, delete n.columnSortBy, delete n.columnSortOrder, delete n.showRowLabels, delete n.showRowTotals, delete n.showColumnLabels, delete n.showColumnTotals, delete n.format), t !== "table" && (delete n.searchable, delete n.pagination), Wn(t) || (delete n.drillDownEnabled, delete n.drillDownTarget), n;
3451
3747
  }
3452
- function Cn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
3453
- let { draft: c, isDirty: l, updateField: u, discard: d } = ue(W.useMemo(() => ({
3748
+ function Qn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
3749
+ let { draft: c, isDirty: l, updateField: u, discard: d } = Te(K.useMemo(() => ({
3454
3750
  ...n,
3455
- title: typeof n.title == "object" ? xn(n.title) : n.title,
3456
- description: typeof n.description == "object" ? xn(n.description) : n.description
3751
+ title: typeof n.title == "object" ? Xn(n.title) : n.title,
3752
+ description: typeof n.description == "object" ? Xn(n.description) : n.description
3457
3753
  }), [n]), { onUpdate: i });
3458
- return /* @__PURE__ */ Z(L, {
3754
+ return /* @__PURE__ */ Z(oe, {
3459
3755
  open: e,
3460
3756
  onClose: t,
3461
- schema: W.useMemo(() => bn(o, s, c.type), [
3757
+ schema: K.useMemo(() => Yn(o, s, c.type), [
3462
3758
  o,
3463
3759
  s,
3464
3760
  c.type
@@ -3466,19 +3762,19 @@ function Cn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
3466
3762
  draft: c,
3467
3763
  isDirty: l,
3468
3764
  onFieldChange: u,
3469
- onSave: () => r(Sn(c)),
3765
+ onSave: () => r(Zn(c)),
3470
3766
  onDiscard: d,
3471
3767
  headerExtra: a
3472
3768
  });
3473
3769
  }
3474
3770
  //#endregion
3475
3771
  //#region src/DashboardWithConfig.tsx
3476
- function wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
3477
- let [c, l] = Y(o), [u, d] = Y(null), [f, p] = Y(e), [m, h] = Y(0);
3478
- q(() => {
3772
+ function $n({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
3773
+ let [c, l] = X(o), [u, d] = X(null), [f, p] = X(e), [m, h] = X(0);
3774
+ J(() => {
3479
3775
  p(e), h((e) => e + 1);
3480
3776
  }, [e]);
3481
- let g = W.useMemo(() => {
3777
+ let g = K.useMemo(() => {
3482
3778
  if (!u || !f.widgets) return null;
3483
3779
  let e = f.widgets.find((e) => (e.id || e.title) === u);
3484
3780
  if (!e) return null;
@@ -3500,11 +3796,11 @@ function wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3500
3796
  layoutW: e.layout?.w ?? 1,
3501
3797
  layoutH: e.layout?.h ?? 1
3502
3798
  };
3503
- }, [u, m]), _ = K((e) => {
3799
+ }, [u, m]), _ = q((e) => {
3504
3800
  d(e), l(!0);
3505
- }, []), v = K(() => {
3801
+ }, []), v = q(() => {
3506
3802
  d(null);
3507
- }, []), y = K((e, t) => {
3803
+ }, []), y = q((e, t) => {
3508
3804
  u && p((n) => n.widgets ? {
3509
3805
  ...n,
3510
3806
  widgets: n.widgets.map((n) => {
@@ -3545,7 +3841,7 @@ function wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3545
3841
  };
3546
3842
  })
3547
3843
  } : n);
3548
- }, [u]), b = K((e) => {
3844
+ }, [u]), b = q((e) => {
3549
3845
  if (u && r) {
3550
3846
  let { drillDownEnabled: t, drillDownTarget: n, ...i } = e, a = { ...i };
3551
3847
  (t || n) && (a.options = {
@@ -3558,24 +3854,24 @@ function wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3558
3854
  }), r(u, a);
3559
3855
  }
3560
3856
  d(null), h((e) => e + 1);
3561
- }, [u, r]), x = K(() => {
3857
+ }, [u, r]), x = q(() => {
3562
3858
  l((e) => !e), d(null);
3563
3859
  }, []);
3564
3860
  return /* @__PURE__ */ Q("div", {
3565
- className: U("flex h-full w-full", s),
3861
+ className: G("flex h-full w-full", s),
3566
3862
  "data-testid": "dashboard-with-config",
3567
3863
  children: [/* @__PURE__ */ Q("div", {
3568
3864
  className: "flex-1 min-w-0 overflow-auto relative",
3569
3865
  children: [/* @__PURE__ */ Z("div", {
3570
3866
  className: "absolute top-2 right-2 z-10",
3571
- children: /* @__PURE__ */ Q(j, {
3867
+ children: /* @__PURE__ */ Q(F, {
3572
3868
  size: "sm",
3573
3869
  variant: c ? "default" : "outline",
3574
3870
  onClick: x,
3575
3871
  "data-testid": "dashboard-config-toggle",
3576
- children: [/* @__PURE__ */ Z(De, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3872
+ children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3577
3873
  })
3578
- }), /* @__PURE__ */ Z(kt, {
3874
+ }), /* @__PURE__ */ Z(an, {
3579
3875
  schema: f,
3580
3876
  onRefresh: i,
3581
3877
  recordCount: a,
@@ -3585,13 +3881,13 @@ function wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3585
3881
  })]
3586
3882
  }), c && /* @__PURE__ */ Z("div", {
3587
3883
  className: "relative shrink-0",
3588
- children: u && g ? /* @__PURE__ */ Z(Cn, {
3884
+ children: u && g ? /* @__PURE__ */ Z(Qn, {
3589
3885
  open: !0,
3590
3886
  onClose: v,
3591
3887
  config: g,
3592
3888
  onSave: b,
3593
3889
  onFieldChange: y
3594
- }) : /* @__PURE__ */ Z(en, {
3890
+ }) : /* @__PURE__ */ Z(An, {
3595
3891
  open: !0,
3596
3892
  onClose: () => l(!1),
3597
3893
  config: t,
@@ -3600,7 +3896,7 @@ function wn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3600
3896
  })]
3601
3897
  });
3602
3898
  }
3603
- e.register("dashboard", kt, {
3899
+ e.register("dashboard", an, {
3604
3900
  namespace: "view",
3605
3901
  label: "Dashboard",
3606
3902
  category: "Complex",
@@ -3628,7 +3924,7 @@ e.register("dashboard", kt, {
3628
3924
  columns: 3,
3629
3925
  widgets: []
3630
3926
  }
3631
- }), e.register("metric", Vt, {
3927
+ }), e.register("metric", _n, {
3632
3928
  namespace: "plugin-dashboard",
3633
3929
  label: "Metric Widget",
3634
3930
  category: "Dashboard",
@@ -3641,7 +3937,7 @@ e.register("dashboard", kt, {
3641
3937
  type: "string",
3642
3938
  label: "Value"
3643
3939
  }]
3644
- }), e.register("metric-card", Ut, {
3940
+ }), e.register("metric-card", yn, {
3645
3941
  namespace: "plugin-dashboard",
3646
3942
  label: "Metric Card",
3647
3943
  category: "Dashboard",
@@ -3696,7 +3992,7 @@ e.register("dashboard", kt, {
3696
3992
  title: "Metric",
3697
3993
  value: "0"
3698
3994
  }
3699
- }), e.register("object-metric", Wt, {
3995
+ }), e.register("object-metric", bn, {
3700
3996
  namespace: "plugin-dashboard",
3701
3997
  label: "Object Metric",
3702
3998
  category: "Dashboard",
@@ -3725,7 +4021,7 @@ e.register("dashboard", kt, {
3725
4021
  }
3726
4022
  ],
3727
4023
  defaultProps: { label: "Metric" }
3728
- }), e.register("pivot", Zt, {
4024
+ }), e.register("pivot", Dn, {
3729
4025
  namespace: "plugin-dashboard",
3730
4026
  label: "Pivot Table",
3731
4027
  category: "Dashboard",
@@ -3804,7 +4100,7 @@ e.register("dashboard", kt, {
3804
4100
  aggregation: "sum",
3805
4101
  data: []
3806
4102
  }
3807
- }), e.register("object-pivot", Qt, {
4103
+ }), e.register("object-pivot", On, {
3808
4104
  namespace: "plugin-dashboard",
3809
4105
  label: "Object Pivot Table",
3810
4106
  category: "Dashboard",
@@ -3893,7 +4189,7 @@ e.register("dashboard", kt, {
3893
4189
  valueField: "",
3894
4190
  aggregation: "sum"
3895
4191
  }
3896
- }), e.register("dashboard-grid", Pt, {
4192
+ }), e.register("dashboard-grid", un, {
3897
4193
  namespace: "plugin-dashboard",
3898
4194
  label: "Dashboard Grid (Editable)",
3899
4195
  category: "Complex",
@@ -3911,7 +4207,7 @@ e.register("dashboard", kt, {
3911
4207
  title: "Dashboard",
3912
4208
  widgets: []
3913
4209
  }
3914
- }), e.register("object-data-table", ct, {
4210
+ }), e.register("object-data-table", Dt, {
3915
4211
  namespace: "plugin-dashboard",
3916
4212
  label: "Object Data Table",
3917
4213
  category: "Dashboard",
@@ -3949,18 +4245,18 @@ e.register("dashboard", kt, {
3949
4245
  pagination: !1
3950
4246
  }
3951
4247
  });
3952
- var Tn = {
3953
- DashboardRenderer: kt,
3954
- DashboardGridLayout: Pt,
3955
- MetricWidget: Vt,
3956
- MetricCard: Ut,
3957
- ObjectMetricWidget: Wt,
3958
- PivotTable: Zt,
3959
- ObjectPivotTable: Qt,
3960
- ObjectDataTable: ct,
3961
- DashboardConfigPanel: en,
3962
- WidgetConfigPanel: Cn,
3963
- DashboardWithConfig: wn
4248
+ var er = {
4249
+ DashboardRenderer: an,
4250
+ DashboardGridLayout: un,
4251
+ MetricWidget: _n,
4252
+ MetricCard: yn,
4253
+ ObjectMetricWidget: bn,
4254
+ PivotTable: Dn,
4255
+ ObjectPivotTable: On,
4256
+ ObjectDataTable: Dt,
4257
+ DashboardConfigPanel: An,
4258
+ WidgetConfigPanel: Qn,
4259
+ DashboardWithConfig: $n
3964
4260
  };
3965
4261
  //#endregion
3966
- export { en as DashboardConfigPanel, Pt as DashboardGridLayout, kt as DashboardRenderer, wn as DashboardWithConfig, ut as DrillDownDrawer, Ut as MetricCard, Vt as MetricWidget, ct as ObjectDataTable, Wt as ObjectMetricWidget, Qt as ObjectPivotTable, Zt as PivotTable, Cn as WidgetConfigPanel, Tn as dashboardComponents };
4262
+ export { An as DashboardConfigPanel, un as DashboardGridLayout, an as DashboardRenderer, $n as DashboardWithConfig, kt as DrillDownDrawer, yn as MetricCard, _n as MetricWidget, Dt as ObjectDataTable, bn as ObjectMetricWidget, On as ObjectPivotTable, Dn as PivotTable, Qn as WidgetConfigPanel, er as dashboardComponents };