@object-ui/plugin-dashboard 17.2.0 → 17.3.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, DATE_RANGE_PRESETS as t, buildCategoryOrder as n, buildChartSeries as r, buildDatasetDrillFilter as i, buildDatasetFieldHelpers as a, buildDimensionLabelMap as o, buildOptionColorMap as s, buildWidgetScopedFilter as c, compareToTrendLabelKey as l, computeDrillFilter as u, dashboardFilterVariableDefs as d, extractRecords as f, findChartSeriesRow as p, formatDimensionValue as m, formatMeasure as h, isDrillEnabled as g, mergeFilters as _, relabelDimensions as v, resolveDashboardFilterDefs as y, resolveDrillTitle as b, resolveFilterPlaceholders as x, shiftFilterByCompareTo as S } from "@object-ui/core";
2
- import { PageVariablesProvider as C, SchemaRenderer as w, SchemaRendererContext as T, useActionEngine as E, useDataScope as ee, useDnd as D, useDrillNavigation as O, useFilterScope as te, useHasDndProvider as k, useObjectLabel as ne, usePageVariables as re } from "@object-ui/react";
3
- import { createSafeTranslation as A, resolveFieldCurrency as ie, useLocalization as j, useObjectTranslation as M, useSafeFieldLabel as ae, useSafeTranslate as N } from "@object-ui/i18n";
4
- import { Button as P, Calendar as oe, Card as se, CardContent as F, CardHeader as ce, CardTitle as I, ChartSkeleton as le, Combobox as ue, ConfigPanelRenderer as de, ConfigRow as L, DataEmptyState as R, Dialog as z, DialogContent as fe, DialogHeader as pe, DialogTitle as me, GridSkeleton as B, Input as he, Popover as ge, PopoverContent as V, PopoverTrigger as H, RefreshIndicator as U, Select as _e, SelectContent as ve, SelectItem as W, SelectTrigger as ye, SelectValue as be, Sheet as xe, SheetContent as Se, SheetHeader as Ce, SheetTitle as we, Skeleton as G, cn as K, getLazyIcon as Te, useConfigDraft as Ee } from "@object-ui/components";
1
+ import { ComponentRegistry as e, DATE_RANGE_PRESETS as t, buildCategoryOrder as n, buildChartSeries as r, buildDatasetDrillFilter as i, buildDatasetFieldHelpers as a, buildDimensionLabelMap as o, buildOptionColorMap as s, buildWidgetScopedFilter as c, compareToTrendLabelKey as l, computeDrillFilter as u, dashboardFilterVariableDefs as d, extractRecords as f, findChartSeriesRow as p, formatDimensionValue as m, formatMeasure as h, isDrillEnabled as g, mergeFilters as _, pivotBucketId as v, pivotCellKey as y, relabelDimensions as b, resolveDashboardFilterDefs as x, resolveDrillTitle as S, resolveFilterPlaceholders as C, shiftFilterByCompareTo as w } from "@object-ui/core";
2
+ import { PageVariablesProvider as T, SchemaRenderer as E, SchemaRendererContext as D, useActionEngine as O, useDataScope as k, useDnd as A, useDrillNavigation as j, useFilterScope as ee, useHasDndProvider as M, useObjectLabel as te, usePageVariables as ne } from "@object-ui/react";
3
+ import { createSafeTranslation as N, resolveFieldCurrency as P, useLocalization as F, useObjectTranslation as re, useSafeFieldLabel as ie, useSafeTranslate as I } from "@object-ui/i18n";
4
+ import { Button as L, Calendar as ae, Card as oe, CardContent as R, CardHeader as se, CardTitle as z, ChartSkeleton as ce, Combobox as le, ConfigPanelRenderer as ue, ConfigRow as B, DataEmptyState as V, Dialog as H, DialogContent as de, DialogHeader as fe, DialogTitle as pe, GridSkeleton as me, Input as he, Popover as U, PopoverContent as W, PopoverTrigger as ge, RefreshIndicator as _e, Select as ve, SelectContent as ye, SelectItem as be, SelectTrigger as xe, SelectValue as Se, Sheet as Ce, SheetContent as we, SheetHeader as Te, SheetTitle as Ee, Skeleton as G, cn as K, getLazyIcon as De, useConfigDraft as Oe } from "@object-ui/components";
5
5
  import * as q from "react";
6
- import De, { Fragment as Oe, forwardRef as ke, useCallback as J, useContext as Ae, useEffect as Y, useMemo as X, useRef as je, useState as Z } from "react";
7
- import { AlertCircle as Me, AlertTriangle as Ne, ArrowDownIcon as Pe, ArrowUpIcon as Fe, ArrowUpRight as Ie, BarChart3 as Le, CalendarIcon as Re, Download as ze, Edit as Be, GripVertical as Ve, Loader2 as He, MinusIcon as Ue, RefreshCw as We, RotateCcw as Ge, Save as Ke, Settings as qe, X as Je } from "lucide-react";
8
- import { DndContext as Ye, PointerSensor as Xe, closestCenter as Ze, useSensor as Qe, useSensors as $e } from "@dnd-kit/core";
9
- import { SortableContext as et, arrayMove as tt, rectSortingStrategy as nt, useSortable as rt, verticalListSortingStrategy as it } from "@dnd-kit/sortable";
10
- import { CSS as at } from "@dnd-kit/utilities";
11
- import { formatCurrency as ot, formatDate as st, formatPercent as ct, getCellRenderer as lt, resolveCellRendererType as ut } from "@object-ui/fields";
12
- import { Fragment as dt, jsx as Q, jsxs as $ } from "react/jsx-runtime";
13
- import { ResponsiveGridLayout as ft, useContainerWidth as pt } from "react-grid-layout";
6
+ import ke, { Fragment as Ae, forwardRef as je, useCallback as J, useContext as Me, useEffect as Y, useMemo as X, useRef as Ne, useState as Z } from "react";
7
+ import { AlertCircle as Pe, AlertTriangle as Fe, ArrowDownIcon as Ie, ArrowUpIcon as Le, ArrowUpRight as Re, BarChart3 as ze, CalendarIcon as Be, Download as Ve, Edit as He, GripVertical as Ue, Loader2 as We, MinusIcon as Ge, RefreshCw as Ke, RotateCcw as qe, Save as Je, Settings as Ye, X as Xe } from "lucide-react";
8
+ import { DndContext as Ze, PointerSensor as Qe, closestCenter as $e, useSensor as et, useSensors as tt } from "@dnd-kit/core";
9
+ import { SortableContext as nt, arrayMove as rt, rectSortingStrategy as it, useSortable as at, verticalListSortingStrategy as ot } from "@dnd-kit/sortable";
10
+ import { CSS as st } from "@dnd-kit/utilities";
11
+ import { formatCurrency as ct, formatDate as lt, formatPercent as ut, getCellRenderer as dt, resolveCellRendererType as ft } from "@object-ui/fields";
12
+ import { Fragment as pt, jsx as Q, jsxs as $ } from "react/jsx-runtime";
13
+ import { ResponsiveGridLayout as mt, useContainerWidth as ht } from "react-grid-layout";
14
14
  import "react-grid-layout/css/styles.css";
15
15
  //#region src/utils.ts
16
- function mt(e) {
16
+ function gt(e) {
17
17
  return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
18
18
  }
19
- function ht(e, t) {
19
+ function _t(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 ht(e, t) {
38
38
  }
39
39
  //#endregion
40
40
  //#region src/widgetDispatch.ts
41
- var gt = {
41
+ var vt = {
42
42
  column: "bar",
43
43
  "stacked-bar": "bar",
44
44
  "grouped-bar": "bar",
@@ -48,7 +48,7 @@ var gt = {
48
48
  "stacked-area": "area",
49
49
  pyramid: "funnel",
50
50
  bubble: "scatter"
51
- }, _t = /* @__PURE__ */ new Set([
51
+ }, yt = /* @__PURE__ */ new Set([
52
52
  "bar",
53
53
  "horizontal-bar",
54
54
  "line",
@@ -61,13 +61,13 @@ var gt = {
61
61
  "treemap",
62
62
  "sankey",
63
63
  "combo"
64
- ]), vt = /* @__PURE__ */ new Set([
64
+ ]), bt = /* @__PURE__ */ new Set([
65
65
  "metric",
66
66
  "gauge",
67
67
  "solid-gauge",
68
68
  "kpi",
69
69
  "bullet"
70
- ]), yt = /* @__PURE__ */ new Set(["table", "list"]), bt = /* @__PURE__ */ new Set([
70
+ ]), xt = /* @__PURE__ */ new Set(["table", "list"]), St = /* @__PURE__ */ new Set([
71
71
  "sunburst",
72
72
  "word-cloud",
73
73
  "choropleth",
@@ -80,17 +80,17 @@ var gt = {
80
80
  "candlestick",
81
81
  "stock"
82
82
  ]);
83
- function xt(e) {
83
+ function Ct(e) {
84
84
  if (!e) return { family: "passthrough" };
85
- let t = gt[e] ?? e;
86
- return _t.has(t) ? {
85
+ let t = vt[e] ?? e;
86
+ return yt.has(t) ? {
87
87
  family: "series",
88
88
  chartType: t
89
- } : vt.has(e) ? { family: "metric" } : yt.has(e) ? { family: "table" } : e === "pivot" ? { family: "pivot" } : e === "custom" ? { family: "custom" } : bt.has(e) ? { family: "unsupported" } : { family: "passthrough" };
89
+ } : bt.has(e) ? { family: "metric" } : xt.has(e) ? { family: "table" } : e === "pivot" ? { family: "pivot" } : e === "custom" ? { family: "custom" } : St.has(e) ? { family: "unsupported" } : { family: "passthrough" };
90
90
  }
91
91
  //#endregion
92
92
  //#region src/recordFields.tsx
93
- var St = /* @__PURE__ */ new Set([
93
+ var wt = /* @__PURE__ */ new Set([
94
94
  "id",
95
95
  "organization_id",
96
96
  "tenant_id",
@@ -104,15 +104,15 @@ var St = /* @__PURE__ */ new Set([
104
104
  "_id",
105
105
  "__typename"
106
106
  ]);
107
- function Ct(e, t) {
108
- return t && (t.isSystem === !0 || t.system === !0) ? !0 : St.has(e);
107
+ function Tt(e, t) {
108
+ return t && (t.isSystem === !0 || t.system === !0) ? !0 : wt.has(e);
109
109
  }
110
- var wt = /* @__PURE__ */ new Set([
110
+ var Et = /* @__PURE__ */ new Set([
111
111
  "select",
112
112
  "picklist",
113
113
  "dropdown",
114
114
  "status"
115
- ]), Tt = /* @__PURE__ */ new Set([
115
+ ]), Dt = /* @__PURE__ */ new Set([
116
116
  "currency",
117
117
  "money",
118
118
  "number",
@@ -122,7 +122,7 @@ var wt = /* @__PURE__ */ new Set([
122
122
  "percent",
123
123
  "percentage"
124
124
  ]);
125
- function Et(e) {
125
+ function Ot(e) {
126
126
  let t = {}, n = e?.fields;
127
127
  if (!n) return t;
128
128
  if (Array.isArray(n)) for (let e of n) e?.name && (t[e.name] = e);
@@ -132,9 +132,9 @@ function Et(e) {
132
132
  };
133
133
  return t;
134
134
  }
135
- function Dt(e) {
135
+ function kt(e) {
136
136
  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;
137
- return i && c && a && wt.has(r?.type) && (c = c.map((e) => {
137
+ return i && c && a && Et.has(r?.type) && (c = c.map((e) => {
138
138
  if (e == null) return e;
139
139
  let n = typeof e == "object" ? e.value : e, r = typeof e == "object" && e.label || String(n);
140
140
  return {
@@ -153,10 +153,10 @@ function Dt(e) {
153
153
  decimals: o.decimals ?? r?.decimals ?? r?.scale
154
154
  };
155
155
  }
156
- function Ot(e) {
157
- return Tt.has(e.type) || typeof e.format == "string" && /^[$¥€£]|%$|0/.test(e.format);
156
+ function At(e) {
157
+ return Dt.has(e.type) || typeof e.format == "string" && /^[$¥€£]|%$|0/.test(e.format);
158
158
  }
159
- function kt(e, t, n) {
159
+ function jt(e, t, n) {
160
160
  if (e == null || e === "") return "";
161
161
  let r = t.format;
162
162
  if (typeof r == "string" && /^\$|¥|€|£/.test(r) && typeof e == "number") {
@@ -166,20 +166,22 @@ function kt(e, t, n) {
166
166
  "€": "EUR",
167
167
  "£": "GBP"
168
168
  }[r[0]];
169
- return ot(e, t.currency || i || n);
169
+ return ct(e, t.currency || i || n);
170
170
  }
171
171
  if (typeof r == "string" && /%/.test(r) && typeof e == "number") {
172
- let t = (r.match(/0\.(0+)%/) || [void 0, ""])[1].length;
173
- return ct((e > 1 ? e / 100 : e) * 100, t);
172
+ let t = (r.match(/0\.(0+)%/) || [void 0, ""])[1].length, n = e > 1 ? e / 100 : e;
173
+ return ut(n * 100, t);
174
174
  }
175
- return typeof r == "string" && /[YMDHms]/.test(r) ? st(e, r) : /* @__PURE__ */ Q(lt(ut(t)), {
175
+ if (typeof r == "string" && /[YMDHms]/.test(r)) return lt(e, r);
176
+ let i = dt(ft(t));
177
+ return /* @__PURE__ */ Q(i, {
176
178
  value: e,
177
179
  field: t
178
180
  });
179
181
  }
180
182
  //#endregion
181
183
  //#region src/RecordDetailDrawer.tsx
182
- var At = [
184
+ var Mt = [
183
185
  "name",
184
186
  "title",
185
187
  "label",
@@ -187,21 +189,21 @@ var At = [
187
189
  "display_name",
188
190
  "full_name"
189
191
  ];
190
- function jt(e, t) {
192
+ function Nt(e, t) {
191
193
  if (t && t.trim()) return t;
192
- for (let t of At) {
194
+ for (let t of Mt) {
193
195
  let n = e[t];
194
196
  if (typeof n == "string" && n.trim()) return n;
195
197
  }
196
198
  let n = e.id ?? e._id;
197
199
  return n == null ? "Record" : String(n);
198
200
  }
199
- var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
200
- let { fieldLabel: s, fieldOptionLabel: c } = ae(), { currency: l } = j(), u = X(() => {
201
+ var Pt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
202
+ let { fieldLabel: s, fieldOptionLabel: c } = ie(), { currency: l } = F(), u = X(() => {
201
203
  if (!e) return [];
202
- let i = Et(n), a;
203
- return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Ct(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Ct(e)), a.map((n) => {
204
- 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 = Dt({
204
+ let i = Ot(n), a;
205
+ return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Tt(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Tt(e)), a.map((n) => {
206
+ 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 = kt({
205
207
  accessorKey: n,
206
208
  label: o,
207
209
  def: r,
@@ -211,8 +213,8 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
211
213
  return {
212
214
  key: n,
213
215
  label: o,
214
- node: kt(e[n], u, l),
215
- numeric: Ot(u)
216
+ node: jt(e[n], u, l),
217
+ numeric: At(u)
216
218
  };
217
219
  });
218
220
  }, [
@@ -225,7 +227,7 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
225
227
  l
226
228
  ]);
227
229
  if (!e) return null;
228
- let d = jt(e, i), f = /* @__PURE__ */ Q("dl", {
230
+ let d = Nt(e, i), f = /* @__PURE__ */ Q("dl", {
229
231
  className: "divide-y divide-border/60",
230
232
  "data-testid": "record-detail-body",
231
233
  children: u.map((e) => /* @__PURE__ */ $("div", {
@@ -242,23 +244,23 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
242
244
  })]
243
245
  }, e.key))
244
246
  });
245
- return a === "dialog" ? /* @__PURE__ */ Q(z, {
247
+ return a === "dialog" ? /* @__PURE__ */ Q(H, {
246
248
  open: !0,
247
249
  onOpenChange: (e) => !e && o(),
248
- children: /* @__PURE__ */ $(fe, {
250
+ children: /* @__PURE__ */ $(de, {
249
251
  className: "max-w-2xl",
250
- children: [/* @__PURE__ */ Q(pe, { children: /* @__PURE__ */ Q(me, { children: d }) }), /* @__PURE__ */ Q("div", {
252
+ children: [/* @__PURE__ */ Q(fe, { children: /* @__PURE__ */ Q(pe, { children: d }) }), /* @__PURE__ */ Q("div", {
251
253
  className: "max-h-[70vh] overflow-auto",
252
254
  children: f
253
255
  })]
254
256
  })
255
- }) : /* @__PURE__ */ Q(xe, {
257
+ }) : /* @__PURE__ */ Q(Ce, {
256
258
  open: !0,
257
259
  onOpenChange: (e) => !e && o(),
258
- children: /* @__PURE__ */ $(Se, {
260
+ children: /* @__PURE__ */ $(we, {
259
261
  side: "right",
260
262
  className: "w-full sm:max-w-md md:max-w-lg flex flex-col",
261
- children: [/* @__PURE__ */ Q(Ce, { children: /* @__PURE__ */ Q(we, { children: d }) }), /* @__PURE__ */ Q("div", {
263
+ children: [/* @__PURE__ */ Q(Te, { children: /* @__PURE__ */ Q(Ee, { children: d }) }), /* @__PURE__ */ Q("div", {
262
264
  className: "flex-1 overflow-auto mt-2 pr-1",
263
265
  children: f
264
266
  })]
@@ -267,13 +269,13 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
267
269
  };
268
270
  //#endregion
269
271
  //#region src/ObjectDataTable.tsx
270
- function Nt(e) {
272
+ function Ft(e) {
271
273
  return e.map((e) => typeof e == "string" ? {
272
274
  header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
273
275
  accessorKey: e
274
276
  } : e);
275
277
  }
276
- function Pt(e, t) {
278
+ function It(e, t) {
277
279
  if (!t?.fields) return [];
278
280
  let n = {};
279
281
  if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
@@ -291,35 +293,37 @@ function Pt(e, t) {
291
293
  } else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
292
294
  return Array.from(a);
293
295
  }
294
- var Ft = ({ schema: e, dataSource: t, className: n }) => {
295
- let { currency: r } = j(), i = Ae(T), a = t || i?.dataSource, o = ee(e.bind), { fieldLabel: s, fieldOptionLabel: c } = ae(), l = "No data available", u = "No data source available for", { t: d } = M(), p = d("dashboard.noDataAvailable");
296
+ var Lt = ({ schema: e, dataSource: t, className: n }) => {
297
+ let { currency: r } = F(), i = Me(D), a = t || i?.dataSource, o = k(e.bind), { fieldLabel: s, fieldOptionLabel: c } = ie(), l = "No data available", u = "No data source available for", { t: d } = re(), p = d("dashboard.noDataAvailable");
296
298
  p && p !== "dashboard.noDataAvailable" && (l = p);
297
299
  let m = d("dashboard.noDataSourceFor");
298
300
  m && m !== "dashboard.noDataSourceFor" && (u = m);
299
- let [h, _] = Z([]), [v, y] = Z(null), [b, S] = Z(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, E] = Z(null), D = e.drillDown, O = g(D) && (D?.mode ?? "record") === "record", [k, ne] = Z(null), re = J((e) => {
300
- ne(e ?? null);
301
- }, []), A = te();
301
+ let [h, _] = Z([]), [v, y] = Z(null), [b, x] = Z(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [S, w] = Z(null), T = e.drillDown, O = g(T) && (T?.mode ?? "record") === "record", [A, j] = Z(null), M = J((e) => {
302
+ j(e ?? null);
303
+ }, []), te = ee();
302
304
  Y(() => {
303
305
  let t = !0;
304
306
  return e.objectName && !o && (!e.data || e.data.length === 0) ? (async () => {
305
307
  if (!a || !e.objectName) {
306
- t && S(!1);
308
+ t && x(!1);
307
309
  return;
308
310
  }
309
- t && (S(!0), E(null));
311
+ t && (x(!0), w(null));
310
312
  try {
311
313
  let n;
312
314
  if (typeof a.find == "function") {
313
- let t = Pt(e, v), r = { $filter: x(e.filter, A) };
314
- t.length && (r.$expand = t), n = f(await a.find(e.objectName, r));
315
+ let t = It(e, v), r = { $filter: C(e.filter, te) };
316
+ t.length && (r.$expand = t);
317
+ let i = await a.find(e.objectName, r);
318
+ n = f(i);
315
319
  } else return;
316
320
  t && _(n);
317
321
  } catch (e) {
318
- console.error("[ObjectDataTable] Fetch error:", e), t && E(e instanceof Error ? e.message : "Failed to load data");
322
+ console.error("[ObjectDataTable] Fetch error:", e), t && w(e instanceof Error ? e.message : "Failed to load data");
319
323
  } finally {
320
- t && S(!1);
324
+ t && x(!1);
321
325
  }
322
- })() : t && S(!1), () => {
326
+ })() : t && x(!1), () => {
323
327
  t = !1;
324
328
  };
325
329
  }, [
@@ -329,7 +333,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
329
333
  e.data,
330
334
  e.filter,
331
335
  v,
332
- A
336
+ te
333
337
  ]), Y(() => {
334
338
  let t = !0;
335
339
  if (!(!a || !e.objectName || typeof a.getObjectSchema != "function")) return a.getObjectSchema(e.objectName).then((e) => {
@@ -338,7 +342,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
338
342
  t = !1;
339
343
  };
340
344
  }, [e.objectName, a]);
341
- let ie = o || e.data || h, N = Array.isArray(ie) ? ie : [], P = X(() => {
345
+ let ne = o || e.data || h, N = Array.isArray(ne) ? ne : [], P = X(() => {
342
346
  let t = e.objectName, n = {};
343
347
  if (v?.fields) {
344
348
  let e = v.fields;
@@ -352,7 +356,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
352
356
  let n = e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1");
353
357
  return t ? s(t, e, n) : n;
354
358
  }, a = (e) => {
355
- let i = Dt({
359
+ let i = kt({
356
360
  accessorKey: e.accessorKey,
357
361
  label: e.header,
358
362
  def: n[e.accessorKey],
@@ -366,13 +370,13 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
366
370
  currency: e.currency,
367
371
  decimals: e.decimals
368
372
  }
369
- }), a = e.align ?? (Ot(i) ? "right" : void 0);
373
+ }), a = e.align ?? (At(i) ? "right" : void 0);
370
374
  if (typeof e.cell == "function") return {
371
375
  ...e,
372
376
  ...i,
373
377
  align: a
374
378
  };
375
- let o = (e) => kt(e, i, r);
379
+ let o = (e) => jt(e, i, r);
376
380
  return {
377
381
  ...e,
378
382
  ...i,
@@ -381,13 +385,13 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
381
385
  };
382
386
  };
383
387
  if (e.columns && e.columns.length > 0) {
384
- let n = Nt(e.columns);
388
+ let n = Ft(e.columns);
385
389
  return (t ? n.map((e) => ({
386
390
  ...e,
387
391
  header: s(t, e.accessorKey, e.header)
388
392
  })) : n).map(a);
389
393
  }
390
- return N.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Ct(e, n[e])) : Object.keys(N[0]).filter((e) => !e.startsWith("_") && !Ct(e))).map((e) => a({
394
+ return N.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Tt(e, n[e])) : Object.keys(N[0]).filter((e) => !e.startsWith("_") && !Tt(e))).map((e) => a({
391
395
  header: i(e),
392
396
  accessorKey: e
393
397
  }));
@@ -429,7 +433,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
429
433
  }, e))]
430
434
  })
431
435
  });
432
- if (C) return /* @__PURE__ */ Q("div", {
436
+ if (S) return /* @__PURE__ */ Q("div", {
433
437
  className: K("overflow-auto", n),
434
438
  "data-testid": "table-error",
435
439
  children: /* @__PURE__ */ $("div", {
@@ -465,7 +469,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
465
469
  ]
466
470
  }), /* @__PURE__ */ Q("p", {
467
471
  className: "text-xs",
468
- children: C
472
+ children: S
469
473
  })]
470
474
  })
471
475
  });
@@ -526,35 +530,35 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
526
530
  })]
527
531
  })
528
532
  });
529
- let oe = {
533
+ let I = {
530
534
  ...e,
531
535
  type: "data-table",
532
536
  data: N,
533
537
  columns: P,
534
- onRowClick: e.onRowClick ?? (O ? re : void 0)
535
- }, se = D?.title && !D.title.includes("${") ? D.title : void 0;
538
+ onRowClick: e.onRowClick ?? (O ? M : void 0)
539
+ }, L = T?.title && !T.title.includes("${") ? T.title : void 0;
536
540
  return /* @__PURE__ */ $("div", {
537
541
  className: K("relative", n),
538
542
  children: [
539
- /* @__PURE__ */ Q(U, { active: b && N.length > 0 }),
540
- /* @__PURE__ */ Q(w, {
541
- schema: oe,
543
+ /* @__PURE__ */ Q(_e, { active: b && N.length > 0 }),
544
+ /* @__PURE__ */ Q(E, {
545
+ schema: I,
542
546
  className: n
543
547
  }),
544
- O && /* @__PURE__ */ Q(Mt, {
545
- record: k,
548
+ O && /* @__PURE__ */ Q(Pt, {
549
+ record: A,
546
550
  objectName: e.objectName,
547
551
  objectSchema: v,
548
- fields: D?.columns,
549
- title: se,
550
- target: D?.target === "dialog" ? "dialog" : "drawer",
551
- onClose: () => ne(null)
552
+ fields: T?.columns,
553
+ title: L,
554
+ target: T?.target === "dialog" ? "dialog" : "drawer",
555
+ onClose: () => j(null)
552
556
  })
553
557
  ]
554
558
  });
555
- }, It = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
556
- let { openRecordList: i } = O(), a = N();
557
- return !i || !e ? null : /* @__PURE__ */ $(P, {
559
+ }, Rt = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
560
+ let { openRecordList: i } = j(), a = I();
561
+ return !i || !e ? null : /* @__PURE__ */ $(L, {
558
562
  type: "button",
559
563
  variant: "ghost",
560
564
  size: "sm",
@@ -563,14 +567,14 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
563
567
  onClick: () => {
564
568
  i(e, t), n?.();
565
569
  },
566
- children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Q(Ie, { className: "ml-1 h-3.5 w-3.5" })]
570
+ children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Q(Re, { className: "ml-1 h-3.5 w-3.5" })]
567
571
  });
568
- }, Lt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
569
- let { openRecordList: d } = O(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
570
- if (De.useEffect(() => {
572
+ }, zt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
573
+ let { openRecordList: d } = j(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
574
+ if (ke.useEffect(() => {
571
575
  e && p && (d(i, a), t());
572
576
  }, [e, p]), p) return null;
573
- let m = f ? null : /* @__PURE__ */ Q(It, {
577
+ let m = f ? null : /* @__PURE__ */ Q(Rt, {
574
578
  objectName: i,
575
579
  filter: a,
576
580
  onNavigate: t
@@ -578,8 +582,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
578
582
  className: K("overflow-auto", l),
579
583
  "data-testid": "drill-down-body",
580
584
  children: f ? (() => {
581
- let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a;
582
- return /* @__PURE__ */ Q(w, { schema: {
585
+ let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a, n = {
583
586
  ...u,
584
587
  type: "spec-report",
585
588
  report: {
@@ -587,8 +590,9 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
587
590
  filter: t
588
591
  },
589
592
  filter: t
590
- } });
591
- })() : /* @__PURE__ */ Q(Ft, {
593
+ };
594
+ return /* @__PURE__ */ Q(E, { schema: n });
595
+ })() : /* @__PURE__ */ Q(Lt, {
592
596
  schema: {
593
597
  type: "object-data-table",
594
598
  objectName: i,
@@ -609,69 +613,69 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
609
613
  dataSource: o
610
614
  })
611
615
  });
612
- return r === "dialog" ? /* @__PURE__ */ Q(z, {
616
+ return r === "dialog" ? /* @__PURE__ */ Q(H, {
613
617
  open: e,
614
618
  onOpenChange: (e) => !e && t(),
615
- children: /* @__PURE__ */ $(fe, {
619
+ children: /* @__PURE__ */ $(de, {
616
620
  className: "max-w-5xl",
617
- children: [/* @__PURE__ */ $(pe, {
621
+ children: [/* @__PURE__ */ $(fe, {
618
622
  className: "flex-row items-center justify-between gap-4 pr-8",
619
- children: [/* @__PURE__ */ Q(me, { children: n }), m]
623
+ children: [/* @__PURE__ */ Q(pe, { children: n }), m]
620
624
  }), h]
621
625
  })
622
- }) : /* @__PURE__ */ Q(xe, {
626
+ }) : /* @__PURE__ */ Q(Ce, {
623
627
  open: e,
624
628
  onOpenChange: (e) => !e && t(),
625
- children: /* @__PURE__ */ $(Se, {
629
+ children: /* @__PURE__ */ $(we, {
626
630
  side: "right",
627
631
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
628
- children: [/* @__PURE__ */ $(Ce, {
632
+ children: [/* @__PURE__ */ $(Te, {
629
633
  className: "flex-row items-center justify-between gap-4 pr-8",
630
- children: [/* @__PURE__ */ Q(we, { children: n }), m]
634
+ children: [/* @__PURE__ */ Q(Ee, { children: n }), m]
631
635
  }), /* @__PURE__ */ Q("div", {
632
636
  className: "flex-1 overflow-hidden mt-2",
633
637
  children: h
634
638
  })]
635
639
  })
636
640
  });
637
- }, Rt = i;
638
- function zt(e, t, n) {
641
+ }, Bt = i;
642
+ function Vt(e, t, n) {
639
643
  let r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
640
644
  return e.forEach((e, c) => {
641
- let l = t.map((t) => String(e[t] ?? "∅")).join(""), u = String(e[n] ?? "∅");
645
+ let l = v(t.map((t) => String(e[t] ?? "∅"))), u = String(e[n] ?? "∅");
642
646
  a.has(l) || (a.add(l), r.push({
643
647
  id: l,
644
648
  labels: t.map((t) => m(e[t]))
645
649
  })), o.has(u) || (o.add(u), i.push({
646
650
  id: u,
647
651
  label: m(e[n])
648
- })), s.set(`${l} ${u}`, c);
652
+ })), s.set(y(l, u), c);
649
653
  }), {
650
654
  rowHeaders: r,
651
655
  colHeaders: i,
652
656
  cellIndex: s
653
657
  };
654
658
  }
655
- function Bt(e) {
659
+ function Ht(e) {
656
660
  if (e == null) return "";
657
661
  let t = String(e);
658
662
  return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
659
663
  }
660
- function Vt(e) {
661
- return e.map((e) => e.map(Bt).join(",")).join("\r\n");
664
+ function Ut(e) {
665
+ return e.map((e) => e.map(Ht).join(",")).join("\r\n");
662
666
  }
663
- function Ht(e, t) {
667
+ function Wt(e, t) {
664
668
  if (typeof document > "u") return;
665
- let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${Vt(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
669
+ let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${Ut(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
666
670
  a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
667
671
  }
668
- var Ut = /* @__PURE__ */ new Set([
672
+ var Gt = /* @__PURE__ */ new Set([
669
673
  "metric",
670
674
  "kpi",
671
675
  "gauge",
672
676
  "solid-gauge",
673
677
  "bullet"
674
- ]), Wt = {
678
+ ]), Kt = {
675
679
  bar: "bar",
676
680
  column: "column",
677
681
  "horizontal-bar": "horizontal-bar",
@@ -693,47 +697,47 @@ var Ut = /* @__PURE__ */ new Set([
693
697
  treemap: "treemap",
694
698
  sankey: "sankey"
695
699
  };
696
- function Gt({ widget: e, dataSource: t }) {
697
- let i = String(e?.dataset ?? ""), c = X(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), l = X(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), u = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, d = String(e?.type ?? ""), f = Ut.has(d) || c.length === 0, g = d === "table" || d === "pivot", _ = d === "pivot" && c.length >= 2, y = _ ? c.slice(0, -1) : [], b = _ ? c[c.length - 1] : "", S = _ ? [
698
- y,
699
- [b],
700
+ function qt({ widget: e, dataSource: t }) {
701
+ let i = String(e?.dataset ?? ""), c = X(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), l = X(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), u = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, d = String(e?.type ?? ""), f = Gt.has(d) || c.length === 0, g = d === "table" || d === "pivot", _ = d === "pivot" && c.length >= 2, x = _ ? c.slice(0, -1) : [], S = _ ? c[c.length - 1] : "", w = _ ? [
702
+ x,
703
+ [S],
700
704
  []
701
- ] : void 0, C = e?.options && typeof e.options == "object" && !Array.isArray(e.options) ? e.options : {}, T = typeof C.dateGranularity == "string" ? C.dateGranularity : void 0, E = typeof C.sortBy == "string" && C.sortBy ? C.sortBy : void 0, ee = E && (c.includes(E) || l.includes(E)) ? E : void 0, D = ee ? { [ee]: C.sortOrder === "desc" ? "desc" : "asc" } : void 0, O = typeof C.limit == "number" && Number.isFinite(C.limit) && C.limit > 0 ? Math.floor(C.limit) : void 0, k = N(), { fieldLabel: ne } = ae(), re = te(), A = e?.filter, ie = X(() => A && typeof A == "object" && Object.keys(A).length > 0 ? x(A, re) : void 0, [A, re]), [j, M] = Z({
705
+ ] : void 0, T = e?.options && typeof e.options == "object" && !Array.isArray(e.options) ? e.options : {}, D = typeof T.dateGranularity == "string" ? T.dateGranularity : void 0, O = typeof T.sortBy == "string" && T.sortBy ? T.sortBy : void 0, k = O && (c.includes(O) || l.includes(O)) ? O : void 0, A = k ? { [k]: T.sortOrder === "desc" ? "desc" : "asc" } : void 0, j = typeof T.limit == "number" && Number.isFinite(T.limit) && T.limit > 0 ? Math.floor(T.limit) : void 0, M = I(), { fieldLabel: te } = ie(), ne = ee(), N = e?.filter, P = X(() => N && typeof N == "object" && Object.keys(N).length > 0 ? C(N, ne) : void 0, [N, ne]), [F, re] = Z({
702
706
  status: "idle",
703
707
  rows: []
704
- }), [P, oe] = Z(null), [se, F] = Z(null), [ce, I] = Z(null), [ue, de] = Z(null);
708
+ }), [L, ae] = Z(null), [oe, R] = Z(null), [se, z] = Z(null), [le, ue] = Z(null), B = `${d}|${i}|${c.join(",")}|${l.join(",")}|${JSON.stringify(N ?? null)}|${JSON.stringify(u ?? null)}|${D ?? ""}|${JSON.stringify(A ?? null)}|${j ?? ""}`;
705
709
  if (Y(() => {
706
710
  let e = t;
707
711
  if (!e || typeof e.queryDataset != "function") {
708
- M({
712
+ re({
709
713
  status: "error",
710
714
  rows: [],
711
- error: k("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
715
+ error: M("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
712
716
  });
713
717
  return;
714
718
  }
715
719
  if (l.length === 0) {
716
- M({
720
+ re({
717
721
  status: "idle",
718
722
  rows: []
719
723
  });
720
724
  return;
721
725
  }
722
726
  let n = !1;
723
- return M({
727
+ return re({
724
728
  status: "loading",
725
729
  rows: []
726
730
  }), e.queryDataset(i, {
727
731
  dimensions: c,
728
732
  measures: l,
729
- ...ie ? { runtimeFilter: ie } : {},
733
+ ...P ? { runtimeFilter: P } : {},
730
734
  ...u ? { compareTo: u } : {},
731
- ...S ? { totals: { groupings: S } } : {},
732
- ...T ? { dateGranularity: T } : {},
733
- ...D ? { order: D } : {},
734
- ...O == null ? {} : { limit: O }
735
+ ...w ? { totals: { groupings: w } } : {},
736
+ ...D ? { dateGranularity: D } : {},
737
+ ...A ? { order: A } : {},
738
+ ...j == null ? {} : { limit: j }
735
739
  }).then((e) => {
736
- n || M({
740
+ n || re({
737
741
  status: "ok",
738
742
  rows: Array.isArray(e?.rows) ? e.rows : [],
739
743
  fields: Array.isArray(e?.fields) ? e.fields : [],
@@ -744,7 +748,7 @@ function Gt({ widget: e, dataSource: t }) {
744
748
  totals: Array.isArray(e?.totals) ? e.totals : void 0
745
749
  });
746
750
  }).catch((e) => {
747
- n || M({
751
+ n || re({
748
752
  status: "error",
749
753
  rows: [],
750
754
  error: String(e?.message ?? e)
@@ -752,17 +756,17 @@ function Gt({ widget: e, dataSource: t }) {
752
756
  }), () => {
753
757
  n = !0;
754
758
  };
755
- }, [`${d}|${i}|${c.join(",")}|${l.join(",")}|${JSON.stringify(A ?? null)}|${JSON.stringify(u ?? null)}|${T ?? ""}|${JSON.stringify(D ?? null)}|${O ?? ""}`]), Y(() => {
759
+ }, [B]), Y(() => {
756
760
  if (f || g) {
757
- F(null), I(null), de(null);
761
+ R(null), z(null), ue(null);
758
762
  return;
759
763
  }
760
- let e = j.object;
764
+ let e = F.object;
761
765
  if (!e || c.length === 0) {
762
- F(null), I(null), de(null);
766
+ R(null), z(null), ue(null);
763
767
  return;
764
768
  }
765
- let t = (e) => j.dimensionFields && j.dimensionFields[e] || e, r = !1;
769
+ let t = (e) => F.dimensionFields && F.dimensionFields[e] || e, r = !1;
766
770
  return (async () => {
767
771
  try {
768
772
  let i = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(e)}`, {
@@ -773,24 +777,24 @@ function Gt({ widget: e, dataSource: t }) {
773
777
  let n = o(a?.fields?.[t(e)]?.options);
774
778
  n && (d[e] = n);
775
779
  }
776
- r || (F(u), I(Object.keys(d).length > 0 ? d : null), de(n(l)));
780
+ r || (R(u), z(Object.keys(d).length > 0 ? d : null), ue(n(l)));
777
781
  } catch {
778
- r || (F(null), I(null), de(null));
782
+ r || (R(null), z(null), ue(null));
779
783
  }
780
784
  })(), () => {
781
785
  r = !0;
782
786
  };
783
787
  }, [
784
- j.object,
785
- j.dimensionFields,
788
+ F.object,
789
+ F.dimensionFields,
786
790
  c,
787
791
  f,
788
792
  g
789
793
  ]), l.length === 0) return /* @__PURE__ */ Q("div", {
790
794
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
791
- children: k("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
795
+ children: M("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
792
796
  });
793
- if (j.status === "loading" || j.status === "idle") return /* @__PURE__ */ $("div", {
797
+ if (F.status === "loading" || F.status === "idle") return /* @__PURE__ */ $("div", {
794
798
  className: "h-full w-full p-2",
795
799
  "data-testid": "dataset-loading",
796
800
  role: "status",
@@ -798,79 +802,79 @@ function Gt({ widget: e, dataSource: t }) {
798
802
  "aria-live": "polite",
799
803
  children: [/* @__PURE__ */ Q("span", {
800
804
  className: "sr-only",
801
- children: k("dashboard.loading", "Loading…")
805
+ children: M("dashboard.loading", "Loading…")
802
806
  }), f ? /* @__PURE__ */ $("div", {
803
807
  className: "flex h-full w-full flex-col items-start justify-center gap-2 p-2",
804
808
  children: [/* @__PURE__ */ Q(G, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Q(G, { className: "h-3 w-20 rounded" })]
805
- }) : g ? /* @__PURE__ */ Q(B, {
809
+ }) : g ? /* @__PURE__ */ Q(me, {
806
810
  className: "h-full",
807
811
  rows: 5,
808
812
  columns: Math.max(2, c.length + l.length)
809
- }) : /* @__PURE__ */ Q(le, { className: "h-full" })]
813
+ }) : /* @__PURE__ */ Q(ce, { className: "h-full" })]
810
814
  });
811
- if (j.status === "error") return /* @__PURE__ */ $("div", {
815
+ if (F.status === "error") return /* @__PURE__ */ $("div", {
812
816
  role: "alert",
813
817
  className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
814
- children: [/* @__PURE__ */ Q(Ne, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Q("span", {
818
+ children: [/* @__PURE__ */ Q(Fe, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Q("span", {
815
819
  className: "break-words",
816
- children: j.error
820
+ children: F.error
817
821
  })]
818
822
  });
819
- if (j.rows.length === 0 && !f) return /* @__PURE__ */ $("div", {
823
+ if (F.rows.length === 0 && !f) return /* @__PURE__ */ $("div", {
820
824
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
821
- children: [/* @__PURE__ */ Q(Le, { className: "mr-2 h-4 w-4" }), k("dashboard.noRows", "No rows")]
825
+ children: [/* @__PURE__ */ Q(ze, { className: "mr-2 h-4 w-4" }), M("dashboard.noRows", "No rows")]
822
826
  });
823
- let { measureField: L, headerLabel: R } = a(j.fields, j.object, ne), { object: z, dimensionFields: fe, drillRawRows: pe, drillRanges: me } = j, he = fe ? c.filter((e) => e in fe) : [], ge = !!z && (he.length > 0 || !!me?.length), V = (t, n) => {
824
- if (!z) return;
825
- let r = Rt(pe?.[t], he, fe ?? {}, ie, me?.[t]);
826
- oe({
827
+ let { measureField: V, headerLabel: H } = a(F.fields, F.object, te), { object: de, dimensionFields: fe, drillRawRows: pe, drillRanges: he } = F, U = fe ? c.filter((e) => e in fe) : [], W = !!de && (U.length > 0 || !!he?.length), ge = (t, n) => {
828
+ if (!de) return;
829
+ let r = Bt(pe?.[t], U, fe ?? {}, P, he?.[t]);
830
+ ae({
827
831
  filter: r,
828
832
  title: n || String(e?.title ?? "")
829
833
  });
830
- }, H = P && z ? /* @__PURE__ */ Q(Lt, {
834
+ }, _e = L && de ? /* @__PURE__ */ Q(zt, {
831
835
  open: !0,
832
- onClose: () => oe(null),
833
- title: P.title || String(e?.title ?? k("dashboard.details", "Details")),
834
- objectName: z,
835
- filter: P.filter,
836
+ onClose: () => ae(null),
837
+ title: L.title || String(e?.title ?? M("dashboard.details", "Details")),
838
+ objectName: de,
839
+ filter: L.filter,
836
840
  dataSource: t
837
841
  }) : null;
838
842
  if (f) {
839
- let e = L(l[0]);
843
+ let e = V(l[0]), t = F.rows[0]?.[l[0]] ?? 0;
840
844
  return /* @__PURE__ */ $("div", {
841
845
  className: "flex h-full w-full flex-col items-start justify-center gap-1 p-2",
842
846
  children: [/* @__PURE__ */ Q("span", {
843
847
  className: "text-2xl font-semibold tabular-nums",
844
- children: h(j.rows[0]?.[l[0]] ?? 0, e?.format, e?.currency, e?.percentScale)
848
+ children: h(t, e?.format, e?.currency, e?.percentScale)
845
849
  }), /* @__PURE__ */ Q("span", {
846
850
  className: "text-xs text-muted-foreground",
847
- children: R(l[0])
851
+ children: H(l[0])
848
852
  })]
849
853
  });
850
854
  }
851
855
  if (g) {
852
856
  let t = [...c, ...l], n = /* @__PURE__ */ Q("button", {
853
857
  type: "button",
854
- onClick: () => Ht(String(e?.title ?? i ?? "export"), [t.map((e) => R(e)), ...j.rows.map((e) => t.map((t) => {
858
+ onClick: () => Wt(String(e?.title ?? i ?? "export"), [t.map((e) => H(e)), ...F.rows.map((e) => t.map((t) => {
855
859
  let n = e[t];
856
860
  return n == null ? "" : typeof n == "number" ? n : String(n);
857
861
  }))]),
858
862
  "data-testid": "dataset-export",
859
- title: k("dashboard.exportCsv", "Export CSV"),
860
- "aria-label": k("dashboard.exportCsv", "Export CSV"),
863
+ title: M("dashboard.exportCsv", "Export CSV"),
864
+ "aria-label": M("dashboard.exportCsv", "Export CSV"),
861
865
  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",
862
- children: /* @__PURE__ */ Q(ze, { className: "h-3.5 w-3.5" })
866
+ children: /* @__PURE__ */ Q(Ve, { className: "h-3.5 w-3.5" })
863
867
  });
864
868
  if (_) {
865
- let e = zt(j.rows, y, b), t = e.colHeaders.flatMap((e) => l.map((t) => ({
869
+ let e = Vt(F.rows, x, S), t = e.colHeaders.flatMap((e) => l.map((t) => ({
866
870
  col: e,
867
871
  measure: t,
868
- header: l.length === 1 ? e.label : `${e.label} · ${R(t)}`
869
- }))), r = (e, t) => h(e, L(t)?.format, L(t)?.currency, L(t)?.percentScale), i = (e) => j.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
870
- for (let e of i(y) ?? []) a.set(y.map((t) => String(e[t] ?? "∅")).join(""), e);
872
+ header: l.length === 1 ? e.label : `${e.label} · ${H(t)}`
873
+ }))), r = (e, t) => h(e, V(t)?.format, V(t)?.currency, V(t)?.percentScale), i = (e) => F.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
874
+ for (let e of i(x) ?? []) a.set(v(x.map((t) => String(e[t] ?? "∅"))), e);
871
875
  let o = /* @__PURE__ */ new Map();
872
- for (let e of i([b]) ?? []) o.set(String(e[b] ?? "∅"), e);
873
- let s = i([])?.[0], c = a.size > 0, u = o.size > 0, d = k("dashboard.total", "Total");
876
+ for (let e of i([S]) ?? []) o.set(String(e[S] ?? "∅"), e);
877
+ let s = i([])?.[0], c = a.size > 0, u = o.size > 0, d = M("dashboard.total", "Total");
874
878
  return /* @__PURE__ */ $("div", {
875
879
  className: "relative h-full w-full overflow-auto p-1",
876
880
  "data-testid": "dataset-matrix",
@@ -881,9 +885,9 @@ function Gt({ widget: e, dataSource: t }) {
881
885
  children: [/* @__PURE__ */ Q("thead", {
882
886
  className: "bg-muted/40",
883
887
  children: /* @__PURE__ */ $("tr", { children: [
884
- y.map((e) => /* @__PURE__ */ Q("th", {
888
+ x.map((e) => /* @__PURE__ */ Q("th", {
885
889
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
886
- children: R(e)
890
+ children: H(e)
887
891
  }, e)),
888
892
  t.map((e) => /* @__PURE__ */ Q("th", {
889
893
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
@@ -892,7 +896,7 @@ function Gt({ widget: e, dataSource: t }) {
892
896
  c && l.map((e) => /* @__PURE__ */ Q("th", {
893
897
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
894
898
  "data-testid": "matrix-total-col-header",
895
- children: l.length === 1 ? d : `${d} · ${R(e)}`
899
+ children: l.length === 1 ? d : `${d} · ${H(e)}`
896
900
  }, `total-${e}`))
897
901
  ] })
898
902
  }), /* @__PURE__ */ $("tbody", { children: [e.rowHeaders.map((n) => /* @__PURE__ */ $("tr", {
@@ -903,11 +907,11 @@ function Gt({ widget: e, dataSource: t }) {
903
907
  children: e
904
908
  }, t)),
905
909
  t.map((t) => {
906
- let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : j.rows[i], o = ge && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
910
+ let i = e.cellIndex.get(y(n.id, t.col.id)), a = i == null ? void 0 : F.rows[i], o = W && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
907
911
  return /* @__PURE__ */ Q("td", {
908
912
  className: K("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
909
913
  "data-testid": o ? "dataset-drill-cell" : void 0,
910
- onClick: o ? () => V(i, s) : void 0,
914
+ onClick: o ? () => ge(i, s) : void 0,
911
915
  children: a ? r(a[t.measure], t.measure) : "—"
912
916
  }, `${t.col.id}-${t.measure}`);
913
917
  }),
@@ -921,8 +925,8 @@ function Gt({ widget: e, dataSource: t }) {
921
925
  className: "border-t bg-muted/30 font-medium",
922
926
  "data-testid": "matrix-total-row",
923
927
  children: [
924
- y.length > 0 && /* @__PURE__ */ Q("td", {
925
- colSpan: y.length,
928
+ x.length > 0 && /* @__PURE__ */ Q("td", {
929
+ colSpan: x.length,
926
930
  className: "px-2 py-1 whitespace-nowrap",
927
931
  children: d
928
932
  }),
@@ -938,7 +942,7 @@ function Gt({ widget: e, dataSource: t }) {
938
942
  ]
939
943
  })] })]
940
944
  }),
941
- H
945
+ _e
942
946
  ]
943
947
  });
944
948
  }
@@ -953,106 +957,106 @@ function Gt({ widget: e, dataSource: t }) {
953
957
  className: "bg-muted/40",
954
958
  children: /* @__PURE__ */ Q("tr", { children: r.map((e) => /* @__PURE__ */ Q("th", {
955
959
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
956
- children: R(e)
960
+ children: H(e)
957
961
  }, e)) })
958
- }), /* @__PURE__ */ Q("tbody", { children: j.rows.map((e, t) => /* @__PURE__ */ Q("tr", {
959
- className: K("border-t", ge && "cursor-pointer hover:bg-accent/40"),
960
- "data-testid": ge ? "dataset-drill-row" : void 0,
961
- onClick: ge ? () => V(t, he.map((t) => m(e[t])).filter(Boolean).join(" / ")) : void 0,
962
+ }), /* @__PURE__ */ Q("tbody", { children: F.rows.map((e, t) => /* @__PURE__ */ Q("tr", {
963
+ className: K("border-t", W && "cursor-pointer hover:bg-accent/40"),
964
+ "data-testid": W ? "dataset-drill-row" : void 0,
965
+ onClick: W ? () => ge(t, U.map((t) => m(e[t])).filter(Boolean).join(" / ")) : void 0,
962
966
  children: r.map((t) => /* @__PURE__ */ Q("td", {
963
967
  className: "px-2 py-1 whitespace-nowrap tabular-nums",
964
- children: l.includes(t) ? h(e[t], L(t)?.format, L(t)?.currency, L(t)?.percentScale) : m(e[t])
968
+ children: l.includes(t) ? h(e[t], V(t)?.format, V(t)?.currency, V(t)?.percentScale) : m(e[t])
965
969
  }, t))
966
970
  }, t)) })]
967
971
  }),
968
- H
972
+ _e
969
973
  ]
970
974
  });
971
975
  }
972
- let U = Wt[d] ?? "bar", _e = v(j.rows, ce), { data: ve, xAxisKey: W, series: ye } = r(_e, c, l, j.fields), be = (Array.isArray(C.stageOrder) ? C.stageOrder : void 0)?.flatMap((e) => {
973
- let t = String(e), n = ce?.[c[0]]?.[t];
976
+ let ve = Kt[d] ?? "bar", ye = b(F.rows, se), { data: be, xAxisKey: xe, series: Se } = r(ye, c, l, F.fields), Ce = (Array.isArray(T.stageOrder) ? T.stageOrder : void 0)?.flatMap((e) => {
977
+ let t = String(e), n = se?.[c[0]]?.[t];
974
978
  return n && n !== t ? [t, n] : [t];
975
- }), xe = be?.length ? be : ue, Se = e?.chartConfig && typeof e.chartConfig == "object" && !Array.isArray(e.chartConfig) ? e.chartConfig : {}, Ce = typeof Se.showLegend == "boolean" ? Se.showLegend : void 0, we = ge ? (e) => {
976
- let t = p(_e, c, l, e?.category, e?.series);
979
+ }), we = Ce?.length ? Ce : le, Te = e?.chartConfig && typeof e.chartConfig == "object" && !Array.isArray(e.chartConfig) ? e.chartConfig : {}, Ee = typeof Te.showLegend == "boolean" ? Te.showLegend : void 0, De = W ? (e) => {
980
+ let t = p(ye, c, l, e?.category, e?.series);
977
981
  if (t < 0) return;
978
982
  let n = c.length >= 2 && l.length === 1, r = [e?.category, n ? e?.series : void 0].filter(Boolean).map(String).join(" / ");
979
- V(t, r);
983
+ ge(t, r);
980
984
  } : void 0;
981
985
  return /* @__PURE__ */ $("div", {
982
986
  className: K("relative h-full w-full min-h-[220px]"),
983
- children: [/* @__PURE__ */ Q(w, {
987
+ children: [/* @__PURE__ */ Q(E, {
984
988
  schema: {
985
989
  type: "chart",
986
- chartType: U,
987
- data: ve,
988
- xAxisKey: W,
989
- series: ye,
990
+ chartType: ve,
991
+ data: be,
992
+ xAxisKey: xe,
993
+ series: Se,
990
994
  isAnimationActive: !1,
991
- ...Ce == null ? {} : { showLegend: Ce },
992
- ...se ? { categoryColors: se } : {},
993
- ...xe ? { categoryOrder: xe } : {}
995
+ ...Ee == null ? {} : { showLegend: Ee },
996
+ ...oe ? { categoryColors: oe } : {},
997
+ ...we ? { categoryOrder: we } : {}
994
998
  },
995
- onChartClick: we,
996
- onSegmentClick: we
997
- }), H]
999
+ onChartClick: De,
1000
+ onSegmentClick: De
1001
+ }), _e]
998
1002
  });
999
1003
  }
1000
1004
  //#endregion
1001
1005
  //#region src/DashboardFilterBar.tsx
1002
- var Kt = "__all__", qt = "__custom__";
1003
- function Jt(e, t) {
1006
+ var Jt = "__all__", Yt = "__custom__";
1007
+ function Xt(e, t) {
1004
1008
  if (e) {
1005
1009
  if (e.preset) return t(e.preset);
1006
1010
  if (e.from || e.to) return `${e.from ?? "…"} – ${e.to ?? "…"}`;
1007
1011
  }
1008
1012
  }
1009
- function Yt(e) {
1013
+ function Zt(e) {
1010
1014
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
1011
1015
  }
1012
- function Xt({ def: e, value: n, onChange: r }) {
1013
- let i = N(), [a, o] = Z(!1), s = e.allowCustomRange !== !1, c = (e) => i(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), l = n?.preset ?? (n?.from || n?.to ? qt : Kt);
1016
+ function Qt({ def: e, value: n, onChange: r }) {
1017
+ let i = I(), [a, o] = Z(!1), s = e.allowCustomRange !== !1, c = (e) => i(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), l = n?.preset ?? (n?.from || n?.to ? Yt : Jt);
1014
1018
  return /* @__PURE__ */ $("div", {
1015
1019
  className: "flex items-center gap-1",
1016
1020
  "data-testid": `dashboard-filter-${e.name}`,
1017
- children: [/* @__PURE__ */ $(_e, {
1021
+ children: [/* @__PURE__ */ $(ve, {
1018
1022
  value: l,
1019
1023
  onValueChange: (e) => {
1020
- e === Kt ? r(void 0) : e === qt ? o(!0) : r({ preset: e });
1024
+ e === Jt ? r(void 0) : e === Yt ? o(!0) : r({ preset: e });
1021
1025
  },
1022
- children: [/* @__PURE__ */ $(ye, {
1026
+ children: [/* @__PURE__ */ $(xe, {
1023
1027
  className: "h-8 w-auto min-w-36 gap-1",
1024
1028
  "aria-label": e.label || i("dashboard.filters.dateRange", "Date range"),
1025
- children: [/* @__PURE__ */ Q(Re, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Q(be, {
1029
+ children: [/* @__PURE__ */ Q(Be, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Q(Se, {
1026
1030
  placeholder: i("dashboard.filters.dateRange", "Date range"),
1027
- children: Jt(n, c) ?? i("dashboard.filters.allTime", "All time")
1031
+ children: Xt(n, c) ?? i("dashboard.filters.allTime", "All time")
1028
1032
  })]
1029
- }), /* @__PURE__ */ $(ve, { children: [
1030
- /* @__PURE__ */ Q(W, {
1031
- value: Kt,
1033
+ }), /* @__PURE__ */ $(ye, { children: [
1034
+ /* @__PURE__ */ Q(be, {
1035
+ value: Jt,
1032
1036
  children: i("dashboard.filters.allTime", "All time")
1033
1037
  }),
1034
- t.map((e) => /* @__PURE__ */ Q(W, {
1038
+ t.map((e) => /* @__PURE__ */ Q(be, {
1035
1039
  value: e,
1036
1040
  children: c(e)
1037
1041
  }, e)),
1038
- s && /* @__PURE__ */ Q(W, {
1039
- value: qt,
1042
+ s && /* @__PURE__ */ Q(be, {
1043
+ value: Yt,
1040
1044
  children: i("dashboard.filters.custom", "Custom…")
1041
1045
  })
1042
1046
  ] })]
1043
- }), s && /* @__PURE__ */ $(ge, {
1047
+ }), s && /* @__PURE__ */ $(U, {
1044
1048
  open: a,
1045
1049
  onOpenChange: o,
1046
- children: [/* @__PURE__ */ Q(H, {
1050
+ children: [/* @__PURE__ */ Q(ge, {
1047
1051
  asChild: !0,
1048
1052
  children: /* @__PURE__ */ Q("span", {
1049
1053
  "aria-hidden": !0,
1050
1054
  className: "size-0"
1051
1055
  })
1052
- }), /* @__PURE__ */ Q(V, {
1056
+ }), /* @__PURE__ */ Q(W, {
1053
1057
  className: "w-auto p-0",
1054
1058
  align: "start",
1055
- children: /* @__PURE__ */ Q(oe, {
1059
+ children: /* @__PURE__ */ Q(ae, {
1056
1060
  mode: "range",
1057
1061
  numberOfMonths: 2,
1058
1062
  selected: {
@@ -1065,8 +1069,8 @@ function Xt({ def: e, value: n, onChange: r }) {
1065
1069
  return;
1066
1070
  }
1067
1071
  r({
1068
- ...e?.from ? { from: Yt(e.from) } : {},
1069
- ...e?.to ? { to: Yt(e.to) } : {}
1072
+ ...e?.from ? { from: Zt(e.from) } : {},
1073
+ ...e?.to ? { to: Zt(e.to) } : {}
1070
1074
  });
1071
1075
  }
1072
1076
  })
@@ -1074,8 +1078,8 @@ function Xt({ def: e, value: n, onChange: r }) {
1074
1078
  })]
1075
1079
  });
1076
1080
  }
1077
- function Zt({ def: e, value: t, onChange: n, dataSource: r }) {
1078
- let i = N(), [a, o] = Z(null), s = e.optionsFrom;
1081
+ function $t({ def: e, value: t, onChange: n, dataSource: r }) {
1082
+ let i = I(), [a, o] = Z(null), s = e.optionsFrom;
1079
1083
  Y(() => {
1080
1084
  if (!s || !r) return;
1081
1085
  let e = !1, t = () => {
@@ -1154,24 +1158,24 @@ function Zt({ def: e, value: t, onChange: n, dataSource: r }) {
1154
1158
  r
1155
1159
  ]);
1156
1160
  let c = X(() => 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;
1157
- return /* @__PURE__ */ $(_e, {
1158
- value: t ? String(t) : Kt,
1159
- onValueChange: (e) => n(e === Kt ? void 0 : e),
1160
- children: [/* @__PURE__ */ Q(ye, {
1161
+ return /* @__PURE__ */ $(ve, {
1162
+ value: t ? String(t) : Jt,
1163
+ onValueChange: (e) => n(e === Jt ? void 0 : e),
1164
+ children: [/* @__PURE__ */ Q(xe, {
1161
1165
  className: "h-8 w-auto min-w-32",
1162
1166
  "aria-label": l,
1163
1167
  "data-testid": `dashboard-filter-${e.name}`,
1164
- children: /* @__PURE__ */ Q(be, { children: u ?? `${l}: ${i("dashboard.filters.all", "All")}` })
1165
- }), /* @__PURE__ */ $(ve, { children: [/* @__PURE__ */ Q(W, {
1166
- value: Kt,
1168
+ children: /* @__PURE__ */ Q(Se, { children: u ?? `${l}: ${i("dashboard.filters.all", "All")}` })
1169
+ }), /* @__PURE__ */ $(ye, { children: [/* @__PURE__ */ Q(be, {
1170
+ value: Jt,
1167
1171
  children: i("dashboard.filters.all", "All")
1168
- }), c.map((e) => /* @__PURE__ */ Q(W, {
1172
+ }), c.map((e) => /* @__PURE__ */ Q(be, {
1169
1173
  value: e.value,
1170
1174
  children: e.label
1171
1175
  }, e.value))] })]
1172
1176
  });
1173
1177
  }
1174
- function Qt({ def: e, value: t, onChange: n }) {
1178
+ function en({ def: e, value: t, onChange: n }) {
1175
1179
  let [r, i] = Z(t == null ? "" : String(t));
1176
1180
  Y(() => {
1177
1181
  i(t == null ? "" : String(t));
@@ -1198,8 +1202,8 @@ function Qt({ def: e, value: t, onChange: n }) {
1198
1202
  "data-testid": `dashboard-filter-${e.name}`
1199
1203
  });
1200
1204
  }
1201
- function $t({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, className: a }) {
1202
- let o = N();
1205
+ function tn({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, className: a }) {
1206
+ let o = I();
1203
1207
  if (e.length === 0) return null;
1204
1208
  let s = (e) => e == null || e === "" || typeof e == "object" && Object.keys(e).length === 0, c = e.some((e) => {
1205
1209
  let n = t[e.name], r = e.defaultValue;
@@ -1212,47 +1216,47 @@ function $t({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, classN
1212
1216
  "aria-label": o("dashboard.filters.label", "Dashboard filters"),
1213
1217
  children: [e.map((e) => {
1214
1218
  let r = t[e.name], a = (t) => n(e.name, t);
1215
- return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(Xt, {
1219
+ return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(Qt, {
1216
1220
  def: e,
1217
1221
  value: r,
1218
1222
  onChange: a
1219
- }, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q(Zt, {
1223
+ }, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q($t, {
1220
1224
  def: e,
1221
1225
  value: r,
1222
1226
  onChange: a,
1223
1227
  dataSource: i
1224
- }, e.name) : /* @__PURE__ */ Q(Qt, {
1228
+ }, e.name) : /* @__PURE__ */ Q(en, {
1225
1229
  def: e,
1226
1230
  value: r,
1227
1231
  onChange: a
1228
1232
  }, e.name);
1229
- }), r && c && /* @__PURE__ */ $(P, {
1233
+ }), r && c && /* @__PURE__ */ $(L, {
1230
1234
  variant: "ghost",
1231
1235
  size: "sm",
1232
1236
  onClick: r,
1233
1237
  className: "text-muted-foreground",
1234
- children: [/* @__PURE__ */ Q(Ge, { className: "size-3.5" }), o("dashboard.filters.reset", "Reset")]
1238
+ children: [/* @__PURE__ */ Q(qe, { className: "size-3.5" }), o("dashboard.filters.reset", "Reset")]
1235
1239
  })]
1236
1240
  });
1237
1241
  }
1238
1242
  //#endregion
1239
1243
  //#region src/DashboardRenderer.tsx
1240
- function en({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
1241
- let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = rt({
1244
+ function nn({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
1245
+ let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = at({
1242
1246
  id: e,
1243
1247
  disabled: t
1244
- });
1248
+ }), f = {
1249
+ transform: st.Transform.toString(c),
1250
+ transition: l,
1251
+ opacity: u ? .4 : 1,
1252
+ ...n ? {
1253
+ gridColumn: `span ${n.w}`,
1254
+ gridRow: `span ${n.h}`
1255
+ } : {}
1256
+ };
1245
1257
  return /* @__PURE__ */ Q("div", {
1246
1258
  ref: s,
1247
- style: {
1248
- transform: at.Transform.toString(c),
1249
- transition: l,
1250
- opacity: u ? .4 : 1,
1251
- ...n ? {
1252
- gridColumn: `span ${n.w}`,
1253
- gridRow: `span ${n.h}`
1254
- } : {}
1255
- },
1259
+ style: f,
1256
1260
  className: K("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
1257
1261
  "data-sortable-widget-id": e,
1258
1262
  ...a,
@@ -1260,19 +1264,19 @@ function en({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
1260
1264
  children: i
1261
1265
  });
1262
1266
  }
1263
- function tn(e) {
1264
- return e ? Te(e) : null;
1267
+ function rn(e) {
1268
+ return e ? De(e) : null;
1265
1269
  }
1266
- function nn(e) {
1270
+ function an(e) {
1267
1271
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
1268
1272
  }
1269
- var rn = [
1273
+ var on = [
1270
1274
  "hsl(var(--chart-1))",
1271
1275
  "hsl(var(--chart-2))",
1272
1276
  "hsl(var(--chart-3))",
1273
1277
  "hsl(var(--chart-4))",
1274
1278
  "hsl(var(--chart-5))"
1275
- ], an = /* @__PURE__ */ new Set([
1279
+ ], sn = /* @__PURE__ */ new Set([
1276
1280
  "bar",
1277
1281
  "horizontal-bar",
1278
1282
  "line",
@@ -1284,20 +1288,20 @@ var rn = [
1284
1288
  "treemap",
1285
1289
  "sankey"
1286
1290
  ]);
1287
- function on(e) {
1288
- return an.has(e) ? { enabled: !0 } : void 0;
1291
+ function cn(e) {
1292
+ return sn.has(e) ? { enabled: !0 } : void 0;
1289
1293
  }
1290
- var sn = /* @__PURE__ */ new Set([
1294
+ var ln = /* @__PURE__ */ new Set([
1291
1295
  "object-chart",
1292
1296
  "object-metric",
1293
1297
  "object-data-table"
1294
- ]), cn = {
1298
+ ]), un = {
1295
1299
  type: "text",
1296
1300
  value: "This widget uses a retired data format. Edit it to bind a dataset.",
1297
1301
  variant: "caption",
1298
1302
  align: "center",
1299
1303
  className: "flex h-full w-full items-center justify-center rounded border border-dashed border-destructive/40 bg-destructive/5 p-4 text-center text-destructive"
1300
- }, ln = ke(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: l, onWidgetsReorder: u, modalHandler: d, scriptHandlers: f, hideHeaderText: p, ...m }, h) => {
1304
+ }, dn = je(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: l, onWidgetsReorder: u, modalHandler: d, scriptHandlers: f, hideHeaderText: p, ...m }, h) => {
1301
1305
  let g = (() => {
1302
1306
  if (e.columns != null) return e.columns;
1303
1307
  let t = e.widgets ?? [], n = 0;
@@ -1306,48 +1310,48 @@ var sn = /* @__PURE__ */ new Set([
1306
1310
  t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
1307
1311
  }
1308
1312
  return n > 4 ? 12 : 4;
1309
- })(), v = g, b = e.gap || 4, x = e.columns != null || g !== 4, [S, C] = Z(!1), [T, ee] = Z(!1), D = je(null), O = X(() => y(e), [e.globalFilters, e.dateRange]), { variables: te, setVariable: k, resetVariables: A } = re(), { executeAction: ie, engine: j } = E({ actions: X(() => (e.header?.actions ?? []).map((e) => ({
1313
+ })(), v = g, y = e.gap || 4, b = e.columns != null || g !== 4, [S, C] = Z(!1), [w, T] = Z(!1), D = Ne(null), k = X(() => x(e), [e.globalFilters, e.dateRange]), { variables: A, setVariable: j, resetVariables: ee } = ne(), M = X(() => (e.header?.actions ?? []).map((e) => ({
1310
1314
  name: e.actionUrl || e.label,
1311
1315
  type: e.actionType || "url",
1312
1316
  target: e.actionUrl,
1313
1317
  label: e.label
1314
- })), [e.header?.actions]) }), { dashboardLabel: ae, dashboardDescription: N, dashboardActionLabel: oe, widgetTitle: le, widgetDescription: ue, fieldLabel: de } = ne(), { t: L } = M(), R = J((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? L(`report.aggregate.${n}`, { defaultValue: n }) : e ? de(e, t, t) : t, [L, de]), z = e.name, fe = J((e) => {
1315
- if (!z) return e.label;
1318
+ })), [e.header?.actions]), { executeAction: N, engine: P } = O({ actions: M }), { dashboardLabel: F, dashboardDescription: ie, dashboardActionLabel: I, widgetTitle: ae, widgetDescription: ce, fieldLabel: le } = te(), { t: ue } = re(), B = J((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? ue(`report.aggregate.${n}`, { defaultValue: n }) : e ? le(e, t, t) : t, [ue, le]), V = e.name, H = J((e) => {
1319
+ if (!V) return e.label;
1316
1320
  let t = e.actionUrl || e.label;
1317
- return oe(z, t, e.label);
1318
- }, [z, oe]), pe = J((e) => {
1319
- let t = nn(e.title);
1320
- return !z || !e.id || t === void 0 ? t : le(z, e.id, t);
1321
- }, [z, le]), me = J((e) => {
1322
- let t = nn(e.description);
1323
- return !z || !e.id ? t : ue(z, e.id, t);
1324
- }, [z, ue]);
1321
+ return I(V, t, e.label);
1322
+ }, [V, I]), de = J((e) => {
1323
+ let t = an(e.title);
1324
+ return !V || !e.id || t === void 0 ? t : ae(V, e.id, t);
1325
+ }, [V, ae]), fe = J((e) => {
1326
+ let t = an(e.description);
1327
+ return !V || !e.id ? t : ce(V, e.id, t);
1328
+ }, [V, ce]);
1325
1329
  Y(() => {
1326
- let e = j.getRunner();
1330
+ let e = P.getRunner();
1327
1331
  if (d && e.setModalHandler(d), f) for (let [t, n] of Object.entries(f)) e.registerScript(t, n);
1328
1332
  }, [
1329
- j,
1333
+ P,
1330
1334
  d,
1331
1335
  f
1332
1336
  ]), Y(() => {
1333
- let e = () => ee(window.innerWidth < 768);
1337
+ let e = () => T(window.innerWidth < 768);
1334
1338
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1335
1339
  }, []);
1336
- let B = J(() => {
1340
+ let pe = J(() => {
1337
1341
  r && (C(!0), r(), setTimeout(() => C(!1), 600));
1338
1342
  }, [r]);
1339
1343
  Y(() => {
1340
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return D.current = setInterval(B, e.refreshInterval * 1e3), () => {
1344
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return D.current = setInterval(pe, e.refreshInterval * 1e3), () => {
1341
1345
  D.current && clearInterval(D.current);
1342
1346
  };
1343
1347
  }, [
1344
1348
  e.refreshInterval,
1345
1349
  r,
1346
- B
1350
+ pe
1347
1351
  ]);
1348
- let he = J((e, t) => {
1352
+ let me = J((e, t) => {
1349
1353
  !o || !l || !t || (e.stopPropagation(), l(t));
1350
- }, [o, l]), ge = J((t, n, r) => {
1354
+ }, [o, l]), he = J((t, n, r) => {
1351
1355
  if (!o || !l) return;
1352
1356
  let i = e.widgets || [];
1353
1357
  if (t.key === "Enter" || t.key === " ") t.preventDefault(), l(n ?? null);
@@ -1364,20 +1368,20 @@ var sn = /* @__PURE__ */ new Set([
1364
1368
  o,
1365
1369
  l,
1366
1370
  e.widgets
1367
- ]), V = J((e) => {
1371
+ ]), U = J((e) => {
1368
1372
  !o || !l || e.target === e.currentTarget && l(null);
1369
- }, [o, l]), H = !!(o && u), U = $e(Qe(Xe, { activationConstraint: { distance: 5 } })), _e = J((t) => {
1370
- if (!H) return;
1373
+ }, [o, l]), W = !!(o && u), ge = tt(et(Qe, { activationConstraint: { distance: 5 } })), _e = J((t) => {
1374
+ if (!W) return;
1371
1375
  let { active: n, over: r } = t;
1372
1376
  if (!r || n.id === r.id) return;
1373
1377
  let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
1374
- a < 0 || o < 0 || u?.(tt(i, a, o));
1378
+ a < 0 || o < 0 || u?.(rt(i, a, o));
1375
1379
  }, [
1376
- H,
1380
+ W,
1377
1381
  e.widgets,
1378
1382
  u
1379
1383
  ]), ve = (e, t, r) => {
1380
- let i = e.type === "metric" || vt.has(e.type || ""), a = x ? {
1384
+ let i = e.type === "metric" || bt.has(e.type || ""), a = b ? {
1381
1385
  w: Math.min(i ? 3 : 6, v),
1382
1386
  h: i ? 2 : 4
1383
1387
  } : void 0, l = e.layout ?? a, u = l ? {
@@ -1386,11 +1390,11 @@ var sn = /* @__PURE__ */ new Set([
1386
1390
  } : void 0, d = !!e.dataset, f = () => {
1387
1391
  if (e.component) return e.component;
1388
1392
  let t = e.type, n = e.options || {}, r = e.data || n.data;
1389
- if (!r && e.object) return cn;
1390
- let i = xt(t), a = i.chartType ?? t;
1393
+ if (!r && e.object) return un;
1394
+ let i = Ct(t), a = i.chartType ?? t;
1391
1395
  if (i.family === "series" && i.chartType) {
1392
1396
  let t = n.xField || "name", o = n.yField || "value";
1393
- if (mt(r)) {
1397
+ if (gt(r)) {
1394
1398
  let s = r.aggregate, c = s ? {
1395
1399
  field: s.field,
1396
1400
  function: s.function,
@@ -1405,11 +1409,11 @@ var sn = /* @__PURE__ */ new Set([
1405
1409
  xAxisKey: t,
1406
1410
  series: [{
1407
1411
  dataKey: l,
1408
- label: R(r.object, l, c?.function)
1412
+ label: B(r.object, l, c?.function)
1409
1413
  }],
1410
- colors: rn,
1414
+ colors: on,
1411
1415
  isAnimationActive: !1,
1412
- drillDown: n.drillDown ?? on(i.chartType),
1416
+ drillDown: n.drillDown ?? cn(i.chartType),
1413
1417
  compareTo: e.compareTo,
1414
1418
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1415
1419
  };
@@ -1421,16 +1425,16 @@ var sn = /* @__PURE__ */ new Set([
1421
1425
  xAxisKey: t,
1422
1426
  series: [{
1423
1427
  dataKey: o,
1424
- label: R(void 0, o, void 0)
1428
+ label: B(void 0, o, void 0)
1425
1429
  }],
1426
- colors: rn,
1430
+ colors: on,
1427
1431
  isAnimationActive: !1,
1428
1432
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1429
1433
  };
1430
1434
  }
1431
1435
  if (i.family === "metric") {
1432
- let i = nn(e.title) || t;
1433
- if (mt(r)) {
1436
+ let i = an(e.title) || t;
1437
+ if (gt(r)) {
1434
1438
  let t = r.aggregate;
1435
1439
  return {
1436
1440
  type: "object-metric",
@@ -1455,7 +1459,7 @@ var sn = /* @__PURE__ */ new Set([
1455
1459
  }
1456
1460
  if (i.family === "table") {
1457
1461
  let i = t === "list";
1458
- if (mt(r)) {
1462
+ if (gt(r)) {
1459
1463
  let { data: t, ...a } = n;
1460
1464
  return {
1461
1465
  type: "object-data-table",
@@ -1481,7 +1485,7 @@ var sn = /* @__PURE__ */ new Set([
1481
1485
  className: "border-0"
1482
1486
  };
1483
1487
  }
1484
- return i.family === "pivot" ? cn : i.family === "custom" ? {
1488
+ return i.family === "pivot" ? un : i.family === "custom" ? {
1485
1489
  type: "text",
1486
1490
  value: "Custom widget — set `component` to a UIComponent schema.",
1487
1491
  variant: "caption",
@@ -1497,38 +1501,38 @@ var sn = /* @__PURE__ */ new Set([
1497
1501
  ...e,
1498
1502
  ...n
1499
1503
  };
1500
- }, p = O.length > 0 ? c(e, O, te) : void 0, m = (() => {
1504
+ }, p = k.length > 0 ? c(e, k, A) : void 0, m = (() => {
1501
1505
  let e = f();
1502
- return p && e && sn.has(e.type) ? {
1506
+ return p && e && ln.has(e.type) ? {
1503
1507
  ...e,
1504
1508
  filter: _(e.filter, p)
1505
1509
  } : e;
1506
1510
  })(), h = p && d ? {
1507
1511
  ...e,
1508
1512
  filter: _(e.filter, p)
1509
- } : e, g = e.type === "metric" && !d, y = pe(e), b = me(e), S = e.id || y || `widget-${t}`, C = o && s === e.id, E = o ? {
1513
+ } : e, g = e.type === "metric" && !d, y = de(e), x = fe(e), S = e.id || y || `widget-${t}`, C = o && s === e.id, T = o ? {
1510
1514
  "data-testid": `dashboard-preview-widget-${e.id}`,
1511
1515
  "data-widget-id": e.id,
1512
1516
  role: "button",
1513
1517
  tabIndex: 0,
1514
1518
  "aria-selected": C,
1515
1519
  "aria-label": `Widget: ${y || `Widget ${t + 1}`}`,
1516
- onClick: (t) => he(t, e.id),
1517
- onKeyDown: (n) => ge(n, e.id, t)
1518
- } : {}, ee = o ? K("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", C ? "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, D = !T && u && !H ? {
1520
+ onClick: (t) => me(t, e.id),
1521
+ onKeyDown: (n) => he(n, e.id, t)
1522
+ } : {}, D = o ? K("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", C ? "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 = !w && u && !W ? {
1519
1523
  gridColumn: `span ${u.w}`,
1520
1524
  gridRow: `span ${u.h}`
1521
- } : void 0, k = g ? /* @__PURE__ */ $("div", {
1522
- className: K("h-full w-full", o && "relative", ee),
1523
- style: D,
1524
- ...E,
1525
+ } : void 0, j = g ? /* @__PURE__ */ $("div", {
1526
+ className: K("h-full w-full", o && "relative", D),
1527
+ style: O,
1528
+ ...T,
1525
1529
  children: [d ? /* @__PURE__ */ Q("div", {
1526
1530
  className: K("h-full w-full", o && "pointer-events-none"),
1527
- children: /* @__PURE__ */ Q(Gt, {
1531
+ children: /* @__PURE__ */ Q(qt, {
1528
1532
  widget: h,
1529
1533
  dataSource: n
1530
1534
  })
1531
- }) : /* @__PURE__ */ Q(w, {
1535
+ }) : /* @__PURE__ */ Q(E, {
1532
1536
  schema: m,
1533
1537
  className: K("h-full w-full", o && "pointer-events-none"),
1534
1538
  dataSource: n
@@ -1537,30 +1541,30 @@ var sn = /* @__PURE__ */ new Set([
1537
1541
  "aria-hidden": "true",
1538
1542
  "data-testid": "widget-click-overlay"
1539
1543
  })]
1540
- }) : /* @__PURE__ */ $(se, {
1541
- className: K("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", ee),
1542
- style: D,
1543
- ...E,
1544
+ }) : /* @__PURE__ */ $(oe, {
1545
+ className: K("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", D),
1546
+ style: O,
1547
+ ...T,
1544
1548
  children: [
1545
- y && /* @__PURE__ */ $(ce, {
1549
+ y && /* @__PURE__ */ $(se, {
1546
1550
  className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
1547
- children: [/* @__PURE__ */ Q(I, {
1551
+ children: [/* @__PURE__ */ Q(z, {
1548
1552
  className: "text-sm sm:text-base font-medium tracking-tight truncate",
1549
1553
  title: y,
1550
1554
  children: y
1551
- }), b && /* @__PURE__ */ Q("p", {
1555
+ }), x && /* @__PURE__ */ Q("p", {
1552
1556
  className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
1553
- children: b
1557
+ children: x
1554
1558
  })]
1555
1559
  }),
1556
- /* @__PURE__ */ Q(F, {
1560
+ /* @__PURE__ */ Q(R, {
1557
1561
  className: "p-0",
1558
1562
  children: /* @__PURE__ */ Q("div", {
1559
1563
  className: K("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
1560
- children: d ? /* @__PURE__ */ Q(Gt, {
1564
+ children: d ? /* @__PURE__ */ Q(qt, {
1561
1565
  widget: h,
1562
1566
  dataSource: n
1563
- }) : /* @__PURE__ */ Q(w, {
1567
+ }) : /* @__PURE__ */ Q(E, {
1564
1568
  schema: m,
1565
1569
  dataSource: n
1566
1570
  })
@@ -1573,36 +1577,36 @@ var sn = /* @__PURE__ */ new Set([
1573
1577
  })
1574
1578
  ]
1575
1579
  });
1576
- return H && e.id ? /* @__PURE__ */ Q(en, {
1580
+ return W && e.id ? /* @__PURE__ */ Q(nn, {
1577
1581
  id: e.id,
1578
- gridSpan: !T && u ? {
1582
+ gridSpan: !w && u ? {
1579
1583
  w: u.w,
1580
1584
  h: u.h
1581
1585
  } : void 0,
1582
- children: k
1583
- }, S) : /* @__PURE__ */ Q(Oe, { children: k }, S);
1584
- }, W = e.title || e.label, ye = e.header && /* @__PURE__ */ $("div", {
1586
+ children: j
1587
+ }, S) : /* @__PURE__ */ Q(Ae, { children: j }, S);
1588
+ }, ye = e.title || e.label, be = e.header && /* @__PURE__ */ $("div", {
1585
1589
  className: "col-span-full mb-4",
1586
1590
  children: [
1587
- !p && e.header.showTitle !== !1 && W && /* @__PURE__ */ Q("h2", {
1591
+ !p && e.header.showTitle !== !1 && ye && /* @__PURE__ */ Q("h2", {
1588
1592
  className: "text-lg font-semibold tracking-tight",
1589
- children: z ? ae({
1590
- name: z,
1591
- label: nn(W)
1592
- }) : nn(W)
1593
+ children: V ? F({
1594
+ name: V,
1595
+ label: an(ye)
1596
+ }) : an(ye)
1593
1597
  }),
1594
1598
  !p && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Q("p", {
1595
1599
  className: "text-sm text-muted-foreground mt-1",
1596
- children: z ? N({
1597
- name: z,
1598
- description: nn(e.description)
1599
- }) : nn(e.description)
1600
+ children: V ? ie({
1601
+ name: V,
1602
+ description: an(e.description)
1603
+ }) : an(e.description)
1600
1604
  }),
1601
1605
  e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Q("div", {
1602
1606
  className: "flex gap-2 mt-3",
1603
1607
  children: e.header.actions.map((e, t) => {
1604
- let n = tn(e.icon);
1605
- return /* @__PURE__ */ $(P, {
1608
+ let n = rn(e.icon);
1609
+ return /* @__PURE__ */ $(L, {
1606
1610
  variant: "outline",
1607
1611
  size: "sm",
1608
1612
  onClick: async () => {
@@ -1615,126 +1619,126 @@ var sn = /* @__PURE__ */ new Set([
1615
1619
  /^https?:\/\//.test(n) || n.startsWith("//") ? window.location.assign(n) : (window.history.pushState({}, "", n), window.dispatchEvent(new PopStateEvent("popstate")));
1616
1620
  return;
1617
1621
  }
1618
- let i = await ie(n || r);
1622
+ let i = await N(n || r);
1619
1623
  i?.success || console.warn("[DashboardRenderer] action failed", i?.error);
1620
1624
  },
1621
- children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), fe(e)]
1625
+ children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), H(e)]
1622
1626
  }, t);
1623
1627
  })
1624
1628
  })
1625
1629
  ]
1626
- }), be = O.length > 0 && /* @__PURE__ */ Q($t, {
1627
- defs: O,
1628
- values: te,
1629
- onChange: k,
1630
- onReset: A,
1630
+ }), xe = k.length > 0 && /* @__PURE__ */ Q(tn, {
1631
+ defs: k,
1632
+ values: A,
1633
+ onChange: j,
1634
+ onReset: ee,
1631
1635
  dataSource: n,
1632
1636
  className: "mb-2"
1633
- }), xe = i !== void 0 && /* @__PURE__ */ $("span", {
1637
+ }), Se = i !== void 0 && /* @__PURE__ */ $("span", {
1634
1638
  className: "text-xs text-muted-foreground",
1635
1639
  children: [i.toLocaleString(), " records"]
1636
- }), Se = a ? JSON.stringify(a) : void 0, Ce = r && /* @__PURE__ */ $("div", {
1637
- className: K("flex items-center justify-end gap-3 mb-2", !T && "col-span-full"),
1638
- children: [xe, /* @__PURE__ */ $(P, {
1640
+ }), Ce = a ? JSON.stringify(a) : void 0, we = r && /* @__PURE__ */ $("div", {
1641
+ className: K("flex items-center justify-end gap-3 mb-2", !w && "col-span-full"),
1642
+ children: [Se, /* @__PURE__ */ $(L, {
1639
1643
  variant: "outline",
1640
1644
  size: "sm",
1641
- onClick: B,
1645
+ onClick: pe,
1642
1646
  disabled: S,
1643
1647
  "aria-label": "Refresh dashboard",
1644
- children: [/* @__PURE__ */ Q(We, { className: K("h-4 w-4 mr-2", S && "animate-spin") }), S ? "Refreshing…" : "Refresh All"]
1648
+ children: [/* @__PURE__ */ Q(Ke, { className: K("h-4 w-4 mr-2", S && "animate-spin") }), S ? "Refreshing…" : "Refresh All"]
1645
1649
  })]
1646
- }), we = X(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), G = X(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Te = X(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1647
- if (T) {
1650
+ }), Te = X(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Ee = X(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), G = X(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1651
+ if (w) {
1648
1652
  let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ $("div", {
1649
1653
  ref: h,
1650
1654
  className: K("flex flex-col gap-4 px-4", t),
1651
- "data-user-actions": Se,
1652
- onClick: V,
1655
+ "data-user-actions": Ce,
1656
+ onClick: U,
1653
1657
  ...m,
1654
1658
  children: [
1655
- ye,
1656
1659
  be,
1657
- Ce,
1660
+ xe,
1661
+ we,
1658
1662
  n.length > 0 && /* @__PURE__ */ Q("div", {
1659
1663
  className: "grid grid-cols-2 gap-3",
1660
- onClick: V,
1661
- children: /* @__PURE__ */ Q(et, {
1662
- items: G,
1663
- strategy: nt,
1664
- disabled: !H,
1664
+ onClick: U,
1665
+ children: /* @__PURE__ */ Q(nt, {
1666
+ items: Ee,
1667
+ strategy: it,
1668
+ disabled: !W,
1665
1669
  children: n.map((e, t) => ve(e, t))
1666
1670
  })
1667
1671
  }),
1668
1672
  r.length > 0 && /* @__PURE__ */ Q("div", {
1669
1673
  className: "flex flex-col gap-4",
1670
- onClick: V,
1671
- children: /* @__PURE__ */ Q(et, {
1672
- items: Te,
1673
- strategy: it,
1674
- disabled: !H,
1674
+ onClick: U,
1675
+ children: /* @__PURE__ */ Q(nt, {
1676
+ items: G,
1677
+ strategy: ot,
1678
+ disabled: !W,
1675
1679
  children: r.map((e, t) => ve(e, t, !0))
1676
1680
  })
1677
1681
  })
1678
1682
  ]
1679
1683
  });
1680
- return H ? /* @__PURE__ */ Q(Ye, {
1681
- sensors: U,
1682
- collisionDetection: Ze,
1684
+ return W ? /* @__PURE__ */ Q(Ze, {
1685
+ sensors: ge,
1686
+ collisionDetection: $e,
1683
1687
  onDragEnd: _e,
1684
1688
  children: i
1685
1689
  }) : i;
1686
1690
  }
1687
- let Ee = /* @__PURE__ */ $("div", {
1691
+ let De = /* @__PURE__ */ $("div", {
1688
1692
  ref: h,
1689
- className: K("grid", !x && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1693
+ className: K("grid", !b && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1690
1694
  style: {
1691
- ...x && {
1695
+ ...b && {
1692
1696
  gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))`,
1693
1697
  gridAutoRows: "minmax(5rem, auto)"
1694
1698
  },
1695
- gap: `${b * .25}rem`
1699
+ gap: `${y * .25}rem`
1696
1700
  },
1697
- "data-user-actions": Se,
1698
- onClick: V,
1701
+ "data-user-actions": Ce,
1702
+ onClick: U,
1699
1703
  ...m,
1700
1704
  children: [
1701
- ye,
1702
1705
  be,
1703
- Ce,
1704
- /* @__PURE__ */ Q(et, {
1705
- items: we,
1706
- strategy: nt,
1707
- disabled: !H,
1706
+ xe,
1707
+ we,
1708
+ /* @__PURE__ */ Q(nt, {
1709
+ items: Te,
1710
+ strategy: it,
1711
+ disabled: !W,
1708
1712
  children: e.widgets?.map((e, t) => ve(e, t))
1709
1713
  })
1710
1714
  ]
1711
1715
  });
1712
- return H ? /* @__PURE__ */ Q(Ye, {
1713
- sensors: U,
1714
- collisionDetection: Ze,
1716
+ return W ? /* @__PURE__ */ Q(Ze, {
1717
+ sensors: ge,
1718
+ collisionDetection: $e,
1715
1719
  onDragEnd: _e,
1716
- children: Ee
1717
- }) : Ee;
1720
+ children: De
1721
+ }) : De;
1718
1722
  });
1719
- ln.displayName = "DashboardRendererInner";
1720
- var un = ke((e, t) => {
1721
- let { schema: n } = e, r = X(() => y(n), [n.globalFilters, n.dateRange]);
1722
- return r.length === 0 ? /* @__PURE__ */ Q(ln, {
1723
+ dn.displayName = "DashboardRendererInner";
1724
+ var fn = je((e, t) => {
1725
+ let { schema: n } = e, r = X(() => x(n), [n.globalFilters, n.dateRange]);
1726
+ return r.length === 0 ? /* @__PURE__ */ Q(dn, {
1723
1727
  ref: t,
1724
1728
  ...e
1725
- }) : /* @__PURE__ */ Q(C, {
1729
+ }) : /* @__PURE__ */ Q(T, {
1726
1730
  definitions: d(r),
1727
- children: /* @__PURE__ */ Q(ln, {
1731
+ children: /* @__PURE__ */ Q(dn, {
1728
1732
  ref: t,
1729
1733
  ...e
1730
1734
  })
1731
1735
  });
1732
1736
  });
1733
- un.displayName = "DashboardRenderer";
1737
+ fn.displayName = "DashboardRenderer";
1734
1738
  //#endregion
1735
1739
  //#region src/DashboardGridLayout.tsx
1736
- function dn({ editMode: e }) {
1737
- let t = D();
1740
+ function pn({ editMode: e }) {
1741
+ let t = A();
1738
1742
  return q.useEffect(() => {
1739
1743
  if (e) return t.startDrag({
1740
1744
  id: "dashboard-layout",
@@ -1746,14 +1750,14 @@ function dn({ editMode: e }) {
1746
1750
  t.endDrag("dashboard");
1747
1751
  }, [e, t]), null;
1748
1752
  }
1749
- var fn = [
1753
+ var mn = [
1750
1754
  "hsl(var(--chart-1))",
1751
1755
  "hsl(var(--chart-2))",
1752
1756
  "hsl(var(--chart-3))",
1753
1757
  "hsl(var(--chart-4))",
1754
1758
  "hsl(var(--chart-5))"
1755
1759
  ];
1756
- function pn(e, t) {
1760
+ function hn(e, t) {
1757
1761
  if (!e.widgets?.length) return e;
1758
1762
  let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
1759
1763
  let r = e.id || `widget-${t}`, i = n.get(r);
@@ -1772,7 +1776,7 @@ function pn(e, t) {
1772
1776
  widgets: r
1773
1777
  };
1774
1778
  }
1775
- function mn(e) {
1779
+ function gn(e) {
1776
1780
  return { lg: e.widgets?.map((e, t) => ({
1777
1781
  i: e.id || `widget-${t}`,
1778
1782
  x: e.layout?.x ?? t % 4 * 3,
@@ -1781,8 +1785,8 @@ function mn(e) {
1781
1785
  h: e.layout?.h ?? 4
1782
1786
  })) || [] };
1783
1787
  }
1784
- var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1785
- let { width: a, containerRef: o, mounted: s } = pt(), [c, l] = q.useState(!1), [u, d] = q.useState(!1), f = k(), p = q.useRef(null), m = q.useCallback(() => {
1788
+ var _n = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1789
+ let { width: a, containerRef: o, mounted: s } = ht(), [c, l] = q.useState(!1), [u, d] = q.useState(!1), f = M(), p = q.useRef(null), m = q.useCallback(() => {
1786
1790
  i && (d(!0), i(), setTimeout(() => d(!1), 600));
1787
1791
  }, [i]);
1788
1792
  q.useEffect(() => {
@@ -1794,7 +1798,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1794
1798
  i,
1795
1799
  m
1796
1800
  ]);
1797
- let [h, g] = q.useState(() => mn(e)), _ = q.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1801
+ let [h, g] = q.useState(() => gn(e)), _ = q.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1798
1802
  i: e.id || `widget-${t}`,
1799
1803
  x: e.layout?.x,
1800
1804
  y: e.layout?.y,
@@ -1802,24 +1806,24 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1802
1806
  h: e.layout?.h
1803
1807
  })) ?? []), [e.widgets]);
1804
1808
  q.useEffect(() => {
1805
- g(mn(e));
1809
+ g(gn(e));
1806
1810
  }, [_]);
1807
1811
  let v = q.useCallback((e, t) => {
1808
1812
  g(t), n?.(e);
1809
1813
  }, [n]), y = q.useCallback(() => {
1810
- r ? r(pn(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);
1814
+ r ? r(hn(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);
1811
1815
  }, [
1812
1816
  r,
1813
1817
  e,
1814
1818
  h
1815
1819
  ]), b = q.useCallback(() => {
1816
- g(mn(e));
1820
+ g(gn(e));
1817
1821
  }, [e]), x = q.useCallback((e) => {
1818
1822
  if (e.component) return e.component;
1819
- let t = e.type, n = e.options || {}, r = xt(t);
1823
+ let t = e.type, n = e.options || {}, r = Ct(t);
1820
1824
  if (r.family === "series" && r.chartType) {
1821
1825
  let t = e.data || n.data, i = n.xField || "name", a = n.yField || "value";
1822
- if (mt(t)) {
1826
+ if (gt(t)) {
1823
1827
  let e = t.aggregate, n = e ? {
1824
1828
  field: e.field,
1825
1829
  function: e.function,
@@ -1832,7 +1836,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1832
1836
  aggregate: n,
1833
1837
  xAxisKey: i,
1834
1838
  series: [{ dataKey: o }],
1835
- colors: fn,
1839
+ colors: mn,
1836
1840
  isAnimationActive: !1,
1837
1841
  className: "h-full"
1838
1842
  };
@@ -1844,14 +1848,14 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1844
1848
  data: o,
1845
1849
  xAxisKey: i,
1846
1850
  series: [{ dataKey: a }],
1847
- colors: fn,
1851
+ colors: mn,
1848
1852
  isAnimationActive: !1,
1849
1853
  className: "h-full"
1850
1854
  };
1851
1855
  }
1852
1856
  if (r.family === "metric") {
1853
1857
  let r = e.data || n.data, i = e.title || t;
1854
- if (mt(r)) {
1858
+ if (gt(r)) {
1855
1859
  let t = r.aggregate;
1856
1860
  return {
1857
1861
  type: "object-metric",
@@ -1876,7 +1880,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1876
1880
  }
1877
1881
  if (r.family === "table") {
1878
1882
  let t = e.data || n.data;
1879
- if (mt(t)) {
1883
+ if (gt(t)) {
1880
1884
  let { data: e, ...r } = n;
1881
1885
  return {
1882
1886
  type: "data-table",
@@ -1900,7 +1904,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1900
1904
  }
1901
1905
  if (r.family === "pivot") {
1902
1906
  let t = e.data || n.data;
1903
- if (mt(t)) {
1907
+ if (gt(t)) {
1904
1908
  let { data: e, ...r } = n;
1905
1909
  return {
1906
1910
  type: "pivot",
@@ -1932,7 +1936,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1932
1936
  className: K("w-full", t),
1933
1937
  "data-testid": "grid-layout",
1934
1938
  children: [
1935
- f && /* @__PURE__ */ Q(dn, { editMode: c }),
1939
+ f && /* @__PURE__ */ Q(pn, { editMode: c }),
1936
1940
  /* @__PURE__ */ $("div", {
1937
1941
  className: "mb-4 flex items-center justify-between",
1938
1942
  children: [/* @__PURE__ */ Q("h2", {
@@ -1940,41 +1944,41 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1940
1944
  children: e.title || e.label || "Dashboard"
1941
1945
  }), /* @__PURE__ */ Q("div", {
1942
1946
  className: "flex gap-2",
1943
- children: c ? /* @__PURE__ */ $(dt, { children: [
1944
- /* @__PURE__ */ $(P, {
1947
+ children: c ? /* @__PURE__ */ $(pt, { children: [
1948
+ /* @__PURE__ */ $(L, {
1945
1949
  onClick: y,
1946
1950
  size: "sm",
1947
1951
  variant: "default",
1948
- children: [/* @__PURE__ */ Q(Ke, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1952
+ children: [/* @__PURE__ */ Q(Je, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1949
1953
  }),
1950
- /* @__PURE__ */ $(P, {
1954
+ /* @__PURE__ */ $(L, {
1951
1955
  onClick: b,
1952
1956
  size: "sm",
1953
1957
  variant: "outline",
1954
- children: [/* @__PURE__ */ Q(Je, { className: "h-4 w-4 mr-2" }), "Reset"]
1958
+ children: [/* @__PURE__ */ Q(Xe, { className: "h-4 w-4 mr-2" }), "Reset"]
1955
1959
  }),
1956
- /* @__PURE__ */ Q(P, {
1960
+ /* @__PURE__ */ Q(L, {
1957
1961
  onClick: () => l(!1),
1958
1962
  size: "sm",
1959
1963
  variant: "ghost",
1960
1964
  children: "Cancel"
1961
1965
  })
1962
- ] }) : /* @__PURE__ */ $(dt, { children: [i && /* @__PURE__ */ $(P, {
1966
+ ] }) : /* @__PURE__ */ $(pt, { children: [i && /* @__PURE__ */ $(L, {
1963
1967
  onClick: m,
1964
1968
  size: "sm",
1965
1969
  variant: "outline",
1966
1970
  disabled: u,
1967
1971
  "aria-label": "Refresh dashboard",
1968
- children: [/* @__PURE__ */ Q(We, { className: K("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1969
- }), /* @__PURE__ */ $(P, {
1972
+ children: [/* @__PURE__ */ Q(Ke, { className: K("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1973
+ }), /* @__PURE__ */ $(L, {
1970
1974
  onClick: () => l(!0),
1971
1975
  size: "sm",
1972
1976
  variant: "outline",
1973
- children: [/* @__PURE__ */ Q(Be, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1977
+ children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1974
1978
  })] })
1975
1979
  })]
1976
1980
  }),
1977
- s && /* @__PURE__ */ Q(ft, {
1981
+ s && /* @__PURE__ */ Q(mt, {
1978
1982
  className: "layout",
1979
1983
  width: a,
1980
1984
  layouts: h,
@@ -2000,35 +2004,35 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
2000
2004
  resizeConfig: { enabled: c },
2001
2005
  onLayoutChange: v,
2002
2006
  children: e.widgets?.map((e, t) => {
2003
- let n = e.id || `widget-${t}`, r = x(e);
2007
+ let n = e.id || `widget-${t}`, r = x(e), i = e.type === "metric";
2004
2008
  return /* @__PURE__ */ Q("div", {
2005
2009
  className: "h-full",
2006
- children: e.type === "metric" ? /* @__PURE__ */ $("div", {
2010
+ children: i ? /* @__PURE__ */ $("div", {
2007
2011
  className: "h-full w-full relative",
2008
2012
  children: [c && /* @__PURE__ */ Q("div", {
2009
2013
  className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
2010
- children: /* @__PURE__ */ Q(Ve, { className: "h-4 w-4" })
2011
- }), /* @__PURE__ */ Q(w, {
2014
+ children: /* @__PURE__ */ Q(Ue, { className: "h-4 w-4" })
2015
+ }), /* @__PURE__ */ Q(E, {
2012
2016
  schema: r,
2013
2017
  className: "h-full w-full"
2014
2018
  })]
2015
- }) : /* @__PURE__ */ $(se, {
2019
+ }) : /* @__PURE__ */ $(oe, {
2016
2020
  className: K("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
2017
- children: [e.title && /* @__PURE__ */ $(ce, {
2021
+ children: [e.title && /* @__PURE__ */ $(se, {
2018
2022
  className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
2019
- children: [/* @__PURE__ */ Q(I, {
2023
+ children: [/* @__PURE__ */ Q(z, {
2020
2024
  className: "text-base font-medium tracking-tight truncate",
2021
2025
  title: e.title,
2022
2026
  children: e.title
2023
2027
  }), c && /* @__PURE__ */ Q("div", {
2024
2028
  className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
2025
- children: /* @__PURE__ */ Q(Ve, { className: "h-4 w-4" })
2029
+ children: /* @__PURE__ */ Q(Ue, { className: "h-4 w-4" })
2026
2030
  })]
2027
- }), /* @__PURE__ */ Q(F, {
2031
+ }), /* @__PURE__ */ Q(R, {
2028
2032
  className: "p-0 h-full",
2029
2033
  children: /* @__PURE__ */ Q("div", {
2030
2034
  className: K("h-full w-full overflow-auto p-4"),
2031
- children: /* @__PURE__ */ Q(w, { schema: r })
2035
+ children: /* @__PURE__ */ Q(E, { schema: r })
2032
2036
  })
2033
2037
  })]
2034
2038
  })
@@ -2037,7 +2041,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
2037
2041
  })
2038
2042
  ]
2039
2043
  });
2040
- }, gn = A({
2044
+ }, vn = N({
2041
2045
  "dashboard.trend.vsLastQuarter": "vs last quarter",
2042
2046
  "dashboard.trend.vsLastMonth": "vs last month",
2043
2047
  "dashboard.trend.vsLastWeek": "vs last week",
@@ -2045,7 +2049,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
2045
2049
  "dashboard.trend.vsYesterday": "vs yesterday",
2046
2050
  "dashboard.trend.vsPreviousPeriod": "vs previous period"
2047
2051
  }, "dashboard.trend.vsLastQuarter");
2048
- function _n(e) {
2052
+ function yn(e) {
2049
2053
  switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
2050
2054
  case "vs last quarter":
2051
2055
  case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
@@ -2061,11 +2065,11 @@ function _n(e) {
2061
2065
  default: return;
2062
2066
  }
2063
2067
  }
2064
- function vn(e, t, n) {
2068
+ function bn(e, t, n) {
2065
2069
  if (e == null) return "";
2066
2070
  if (typeof e == "string") {
2067
2071
  let r = Number(e);
2068
- return !isFinite(r) || e.trim() === "" ? e : vn(r, t, n);
2072
+ return !isFinite(r) || e.trim() === "" ? e : bn(r, t, n);
2069
2073
  }
2070
2074
  if (!isFinite(e)) return String(e);
2071
2075
  let r = {
@@ -2102,10 +2106,10 @@ function vn(e, t, n) {
2102
2106
  maximumFractionDigits: c
2103
2107
  }).format(e);
2104
2108
  }
2105
- function yn(e) {
2109
+ function xn(e) {
2106
2110
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
2107
2111
  }
2108
- var bn = {
2112
+ var Sn = {
2109
2113
  default: "bg-muted text-muted-foreground",
2110
2114
  blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
2111
2115
  teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
@@ -2114,7 +2118,7 @@ var bn = {
2114
2118
  success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
2115
2119
  warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
2116
2120
  danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
2117
- }, xn = {
2121
+ }, Cn = {
2118
2122
  default: "text-foreground",
2119
2123
  blue: "text-blue-600 dark:text-blue-400",
2120
2124
  teal: "text-teal-600 dark:text-teal-400",
@@ -2123,18 +2127,18 @@ var bn = {
2123
2127
  success: "text-emerald-600 dark:text-emerald-400",
2124
2128
  warning: "text-amber-600 dark:text-amber-400",
2125
2129
  danger: "text-rose-600 dark:text-rose-400"
2126
- }, Sn = ({ 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 }) => {
2127
- let g = bn[c] || bn.default, { t: _ } = gn(), v = X(() => {
2128
- let e = yn(a) || yn(n?.label);
2130
+ }, wn = ({ 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 }) => {
2131
+ let g = Sn[c] || Sn.default, { t: _ } = vn(), v = X(() => {
2132
+ let e = xn(a) || xn(n?.label);
2129
2133
  if (!e) return e;
2130
- let t = _n(e);
2134
+ let t = yn(e);
2131
2135
  return t ? _(t) : e;
2132
2136
  }, [
2133
2137
  a,
2134
2138
  n?.label,
2135
2139
  _
2136
2140
  ]), y = X(() => {
2137
- let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? vn(t, l, u) : t ?? "", n = String(e);
2141
+ let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? bn(t, l, u) : t ?? "", n = String(e);
2138
2142
  return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
2139
2143
  }, [
2140
2144
  t,
@@ -2144,13 +2148,13 @@ var bn = {
2144
2148
  f
2145
2149
  ]), b = X(() => {
2146
2150
  if (typeof r == "string") {
2147
- let e = Te(r);
2151
+ let e = De(r);
2148
2152
  return e ? /* @__PURE__ */ Q(e, { className: "h-4 w-4" }) : null;
2149
2153
  }
2150
2154
  return r;
2151
2155
  }, [r]);
2152
2156
  if (m === "bare") {
2153
- let t = xn[c] || xn.default;
2157
+ let t = Cn[c] || Cn.default;
2154
2158
  return /* @__PURE__ */ Q("div", {
2155
2159
  className: K("flex flex-col gap-1 min-w-0", p && "cursor-pointer", i),
2156
2160
  onClick: p,
@@ -2162,7 +2166,7 @@ var bn = {
2162
2166
  children: o ? /* @__PURE__ */ $("div", {
2163
2167
  className: "flex items-center gap-2 text-muted-foreground",
2164
2168
  "data-testid": "metric-loading",
2165
- children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2169
+ children: [/* @__PURE__ */ Q(We, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2166
2170
  className: "text-sm",
2167
2171
  children: "Loading…"
2168
2172
  })]
@@ -2170,20 +2174,20 @@ var bn = {
2170
2174
  className: "flex items-center gap-2",
2171
2175
  "data-testid": "metric-error",
2172
2176
  role: "alert",
2173
- children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2177
+ children: [/* @__PURE__ */ Q(Pe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2174
2178
  className: "text-xs text-destructive truncate",
2175
2179
  children: s
2176
2180
  })]
2177
- }) : /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q("div", {
2181
+ }) : /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q("div", {
2178
2182
  className: K("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", t),
2179
2183
  children: y
2180
2184
  }), /* @__PURE__ */ Q("div", {
2181
2185
  className: "text-xs font-medium text-muted-foreground truncate",
2182
- children: yn(e)
2186
+ children: xn(e)
2183
2187
  })] })
2184
2188
  });
2185
2189
  }
2186
- return /* @__PURE__ */ $(se, {
2190
+ return /* @__PURE__ */ $(oe, {
2187
2191
  className: K("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),
2188
2192
  onClick: p,
2189
2193
  role: p ? "button" : void 0,
@@ -2192,19 +2196,19 @@ var bn = {
2192
2196
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
2193
2197
  } : void 0,
2194
2198
  ...h,
2195
- children: [/* @__PURE__ */ $(ce, {
2199
+ children: [/* @__PURE__ */ $(se, {
2196
2200
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2197
- children: [/* @__PURE__ */ Q(I, {
2201
+ children: [/* @__PURE__ */ Q(z, {
2198
2202
  className: "text-sm font-medium truncate",
2199
- children: yn(e)
2203
+ children: xn(e)
2200
2204
  }), b && /* @__PURE__ */ Q("div", {
2201
2205
  className: K("flex h-8 w-8 items-center justify-center rounded-md shrink-0", g),
2202
2206
  children: b
2203
2207
  })]
2204
- }), /* @__PURE__ */ Q(F, { children: o ? /* @__PURE__ */ $("div", {
2208
+ }), /* @__PURE__ */ Q(R, { children: o ? /* @__PURE__ */ $("div", {
2205
2209
  className: "flex items-center gap-2 text-muted-foreground",
2206
2210
  "data-testid": "metric-loading",
2207
- children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2211
+ children: [/* @__PURE__ */ Q(We, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2208
2212
  className: "text-sm",
2209
2213
  children: "Loading…"
2210
2214
  })]
@@ -2212,11 +2216,11 @@ var bn = {
2212
2216
  className: "flex items-center gap-2",
2213
2217
  "data-testid": "metric-error",
2214
2218
  role: "alert",
2215
- children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2219
+ children: [/* @__PURE__ */ Q(Pe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2216
2220
  className: "text-xs text-destructive truncate",
2217
2221
  children: s
2218
2222
  })]
2219
- }) : /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q("div", {
2223
+ }) : /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q("div", {
2220
2224
  className: "text-2xl font-bold tabular-nums tracking-tight truncate",
2221
2225
  children: y
2222
2226
  }), (n || a) && /* @__PURE__ */ $("div", {
@@ -2224,9 +2228,9 @@ var bn = {
2224
2228
  children: [n && /* @__PURE__ */ $("span", {
2225
2229
  className: K("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"),
2226
2230
  children: [
2227
- n.direction === "up" && /* @__PURE__ */ Q(Fe, { className: "h-3 w-3 mr-1" }),
2228
- n.direction === "down" && /* @__PURE__ */ Q(Pe, { className: "h-3 w-3 mr-1" }),
2229
- n.direction === "neutral" && /* @__PURE__ */ Q(Ue, { className: "h-3 w-3 mr-1" }),
2231
+ n.direction === "up" && /* @__PURE__ */ Q(Le, { className: "h-3 w-3 mr-1" }),
2232
+ n.direction === "down" && /* @__PURE__ */ Q(Ie, { className: "h-3 w-3 mr-1" }),
2233
+ n.direction === "neutral" && /* @__PURE__ */ Q(Ge, { className: "h-3 w-3 mr-1" }),
2230
2234
  n.value,
2231
2235
  "%"
2232
2236
  ]
@@ -2239,24 +2243,24 @@ var bn = {
2239
2243
  };
2240
2244
  //#endregion
2241
2245
  //#region src/MetricCard.tsx
2242
- function Cn(e) {
2246
+ function Tn(e) {
2243
2247
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
2244
2248
  }
2245
- var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2246
- let u = n ? Te(n) : null;
2247
- return /* @__PURE__ */ $(se, {
2249
+ var En = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2250
+ let u = n ? De(n) : null;
2251
+ return /* @__PURE__ */ $(oe, {
2248
2252
  className: K("h-full", o),
2249
2253
  ...l,
2250
- children: [/* @__PURE__ */ $(ce, {
2254
+ children: [/* @__PURE__ */ $(se, {
2251
2255
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2252
- children: [/* @__PURE__ */ Q(I, {
2256
+ children: [/* @__PURE__ */ Q(z, {
2253
2257
  className: "text-sm font-medium",
2254
- children: Cn(e)
2258
+ children: Tn(e)
2255
2259
  }), u && /* @__PURE__ */ Q(u, { className: "h-4 w-4 text-muted-foreground" })]
2256
- }), /* @__PURE__ */ Q(F, { children: s ? /* @__PURE__ */ $("div", {
2260
+ }), /* @__PURE__ */ Q(R, { children: s ? /* @__PURE__ */ $("div", {
2257
2261
  className: "flex items-center gap-2 text-muted-foreground",
2258
2262
  "data-testid": "metric-card-loading",
2259
- children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2263
+ children: [/* @__PURE__ */ Q(We, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2260
2264
  className: "text-sm",
2261
2265
  children: "Loading…"
2262
2266
  })]
@@ -2264,11 +2268,11 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2264
2268
  className: "flex items-center gap-2",
2265
2269
  "data-testid": "metric-card-error",
2266
2270
  role: "alert",
2267
- children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2271
+ children: [/* @__PURE__ */ Q(Pe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2268
2272
  className: "text-xs text-destructive truncate",
2269
2273
  children: c
2270
2274
  })]
2271
- }) : /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q("div", {
2275
+ }) : /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q("div", {
2272
2276
  className: "text-2xl font-bold",
2273
2277
  children: t
2274
2278
  }), (r || i || a) && /* @__PURE__ */ $("p", {
@@ -2276,47 +2280,47 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2276
2280
  children: [r && i && /* @__PURE__ */ $("span", {
2277
2281
  className: K("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
2278
2282
  children: [
2279
- r === "up" && /* @__PURE__ */ Q(Fe, { className: "h-3 w-3 mr-1" }),
2280
- r === "down" && /* @__PURE__ */ Q(Pe, { className: "h-3 w-3 mr-1" }),
2281
- r === "neutral" && /* @__PURE__ */ Q(Ue, { className: "h-3 w-3 mr-1" }),
2283
+ r === "up" && /* @__PURE__ */ Q(Le, { className: "h-3 w-3 mr-1" }),
2284
+ r === "down" && /* @__PURE__ */ Q(Ie, { className: "h-3 w-3 mr-1" }),
2285
+ r === "neutral" && /* @__PURE__ */ Q(Ge, { className: "h-3 w-3 mr-1" }),
2282
2286
  i
2283
2287
  ]
2284
- }), Cn(a)]
2288
+ }), Tn(a)]
2285
2289
  })] }) })]
2286
2290
  });
2287
- }, Tn = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: o, className: s, description: c, dataSource: u, colorVariant: d, format: f, currency: p, prefix: m, suffix: h, invert: _, drillDown: v, title: y, compareTo: C, t: E, variant: ee }) => {
2288
- let D = Ae(T), O = u || D?.dataSource, [k, ne] = Z(!1), [re, A] = Z(null), [M, ae] = Z(null), [N, P] = Z(!1), [oe, se] = Z(null), [F, ce] = Z(null);
2291
+ }, Dn = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: o, className: s, description: c, dataSource: u, colorVariant: d, format: f, currency: p, prefix: m, suffix: h, invert: _, drillDown: v, title: y, compareTo: b, t: x, variant: T }) => {
2292
+ let O = Me(D), k = u || O?.dataSource, [A, j] = Z(!1), [M, te] = Z(null), [ne, N] = Z(null), [re, ie] = Z(!1), [I, L] = Z(null), [ae, oe] = Z(null);
2289
2293
  Y(() => {
2290
2294
  let t = !0;
2291
- if (!(!O || !e || typeof O.getObjectSchema != "function")) return O.getObjectSchema(e).then((e) => {
2292
- t && ce(e);
2295
+ if (!(!k || !e || typeof k.getObjectSchema != "function")) return k.getObjectSchema(e).then((e) => {
2296
+ t && oe(e);
2293
2297
  }).catch(() => {}), () => {
2294
2298
  t = !1;
2295
2299
  };
2296
- }, [O, e]);
2297
- let I = X(() => {
2300
+ }, [k, e]);
2301
+ let R = X(() => {
2298
2302
  let e = t?.field;
2299
- if (!e || !F?.fields) return null;
2300
- let n = F.fields;
2303
+ if (!e || !ae?.fields) return null;
2304
+ let n = ae.fields;
2301
2305
  return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
2302
- }, [F, t?.field]), le = X(() => {
2306
+ }, [ae, t?.field]), se = X(() => {
2303
2307
  if (f) return f;
2304
- if (I) {
2305
- if (I.type === "currency") {
2306
- let e = I.scale ?? 0;
2308
+ if (R) {
2309
+ if (R.type === "currency") {
2310
+ let e = R.scale ?? 0;
2307
2311
  return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
2308
2312
  }
2309
- if (I.type === "percent") return "0,0%";
2310
- if (I.type === "number" || I.type === "integer") return "0,0";
2313
+ if (R.type === "percent") return "0,0%";
2314
+ if (R.type === "number" || R.type === "integer") return "0,0";
2311
2315
  }
2312
- }, [f, I]), { currency: ue } = j(), de = X(() => {
2316
+ }, [f, R]), { currency: z } = F(), ce = X(() => {
2313
2317
  if (p) return p;
2314
- if (I?.type === "currency") return ie(I, ue);
2318
+ if (R?.type === "currency") return P(R, z);
2315
2319
  }, [
2316
2320
  p,
2317
- I,
2318
- ue
2319
- ]), L = X(() => t ? JSON.stringify(t) : "", [t]), R = te(), B = X(() => x(n, R), [n, R]), he = X(() => B ? JSON.stringify(B) : "", [B]), ge = X(() => C ? JSON.stringify(C) : "", [C]), V = J(async (n, r) => {
2321
+ R,
2322
+ z
2323
+ ]), le = X(() => t ? JSON.stringify(t) : "", [t]), ue = ee(), B = X(() => C(n, ue), [n, ue]), V = X(() => B ? JSON.stringify(B) : "", [B]), me = X(() => b ? JSON.stringify(b) : "", [b]), he = J(async (n, r) => {
2320
2324
  if (t && typeof n.aggregate == "function") {
2321
2325
  let i = await n.aggregate(e, {
2322
2326
  field: t.field,
@@ -2337,88 +2341,88 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2337
2341
  return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
2338
2342
  }
2339
2343
  return null;
2340
- }, [e, L]), H = J(async (t, r) => {
2344
+ }, [e, le]), U = J(async (t, r) => {
2341
2345
  if (!(!t || !e)) {
2342
- r.current && (P(!0), se(null));
2346
+ r.current && (ie(!0), L(null));
2343
2347
  try {
2344
- let e = C ? S(n, C) : null, [i, a] = await Promise.all([V(t, B), e ? V(t, e) : Promise.resolve(null)]);
2348
+ let e = b ? w(n, b) : null, [i, a] = await Promise.all([he(t, B), e ? he(t, e) : Promise.resolve(null)]);
2345
2349
  if (i === null) return;
2346
- r.current && (A(i), ae(typeof a == "number" && Number.isFinite(a) ? a : null));
2350
+ r.current && (te(i), N(typeof a == "number" && Number.isFinite(a) ? a : null));
2347
2351
  } catch (e) {
2348
- console.error("[ObjectMetricWidget] Fetch error:", e), r.current && se(e instanceof Error ? e.message : "Failed to load metric");
2352
+ console.error("[ObjectMetricWidget] Fetch error:", e), r.current && L(e instanceof Error ? e.message : "Failed to load metric");
2349
2353
  } finally {
2350
- r.current && P(!1);
2354
+ r.current && ie(!1);
2351
2355
  }
2352
2356
  }
2353
2357
  }, [
2354
2358
  e,
2355
- L,
2356
- he,
2357
- ge,
2358
- V
2359
+ le,
2360
+ V,
2361
+ me,
2362
+ he
2359
2363
  ]);
2360
2364
  Y(() => {
2361
2365
  let t = { current: !0 };
2362
- return O && e ? H(O, t) : (A(null), se(null)), () => {
2366
+ return k && e ? U(k, t) : (te(null), L(null)), () => {
2363
2367
  t.current = !1;
2364
2368
  };
2365
2369
  }, [
2366
- O,
2370
+ k,
2367
2371
  e,
2368
- H
2372
+ U
2369
2373
  ]);
2370
- let U = re === null ? O ? "—" : i ?? "—" : re;
2371
- _ && typeof U == "number" && isFinite(U) && U >= 0 && U <= 1 && (U = 1 - U);
2372
- let _e = X(() => {
2373
- if (!C || typeof re != "number" || !Number.isFinite(re) || M === null) return;
2374
- let e = ht(re, M);
2374
+ let W = M === null ? k ? "—" : i ?? "—" : M;
2375
+ _ && typeof W == "number" && isFinite(W) && W >= 0 && W <= 1 && (W = 1 - W);
2376
+ let ge = X(() => {
2377
+ if (!b || typeof M != "number" || !Number.isFinite(M) || ne === null) return;
2378
+ let e = _t(M, ne);
2375
2379
  if (!e) return;
2376
- let t = l(C, n), r = `dashboard.trend.${t}`, i = {
2380
+ let t = l(b, n), r = `dashboard.trend.${t}`, i = {
2377
2381
  vsPreviousPeriod: "vs previous period",
2378
2382
  vsLastWeek: "vs last week",
2379
2383
  vsLastMonth: "vs last month",
2380
2384
  vsLastQuarter: "vs last quarter",
2381
2385
  vsLastYear: "vs last year",
2382
2386
  vsYesterday: "vs yesterday"
2383
- }, a = E ? E(r, i[t] || t) : i[t] || t;
2387
+ }, a = x ? x(r, i[t] || t) : i[t] || t;
2384
2388
  return {
2385
2389
  value: e.value,
2386
2390
  direction: e.direction,
2387
2391
  label: a
2388
2392
  };
2389
2393
  }, [
2390
- C,
2391
- re,
2394
+ b,
2392
2395
  M,
2396
+ ne,
2393
2397
  n,
2394
- E
2395
- ]) ?? a, ve = g(v) && !!e && !!O, W = X(() => {
2396
- let e = typeof r == "string" ? r : r?.defaultValue || "";
2397
- return b(v, {}, (typeof y == "string" ? y : y?.defaultValue || "") || e || "Details");
2398
+ x
2399
+ ]) ?? a, _e = g(v) && !!e && !!k, ve = X(() => {
2400
+ let e = typeof r == "string" ? r : r?.defaultValue || "", t = typeof y == "string" ? y : y?.defaultValue || "";
2401
+ return S(v, {}, t || e || "Details");
2398
2402
  }, [
2399
2403
  v,
2400
2404
  r,
2401
2405
  y
2402
2406
  ]), ye = X(() => {
2403
- if (!ve) return null;
2404
- let t = v?.target ?? "drawer", n = v?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Q(It, {
2407
+ if (!_e) return null;
2408
+ let t = v?.target ?? "drawer", n = v?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Q(Rt, {
2405
2409
  objectName: e,
2406
2410
  filter: B,
2407
- onNavigate: () => ne(!1)
2411
+ onNavigate: () => j(!1)
2408
2412
  }), a;
2409
2413
  if (r) {
2410
- let e = n.filter, t = e ? B ? { $and: [e, B] } : e : B;
2414
+ let e = n.filter, t = e ? B ? { $and: [e, B] } : e : B, r = {
2415
+ type: "spec-report",
2416
+ ...n,
2417
+ filter: t
2418
+ };
2411
2419
  a = /* @__PURE__ */ Q("div", {
2412
2420
  className: "h-full overflow-auto",
2413
- children: /* @__PURE__ */ Q(w, { schema: {
2414
- type: "spec-report",
2415
- ...n,
2416
- filter: t
2417
- } })
2421
+ children: /* @__PURE__ */ Q(E, { schema: r })
2418
2422
  });
2419
2423
  } else a = /* @__PURE__ */ Q("div", {
2420
2424
  className: "h-full overflow-auto",
2421
- children: /* @__PURE__ */ Q(w, { schema: {
2425
+ children: /* @__PURE__ */ Q(E, { schema: {
2422
2426
  type: "object-data-table",
2423
2427
  objectName: e,
2424
2428
  filter: B,
@@ -2430,25 +2434,25 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2430
2434
  }
2431
2435
  } })
2432
2436
  });
2433
- return t === "dialog" ? /* @__PURE__ */ Q(z, {
2437
+ return t === "dialog" ? /* @__PURE__ */ Q(H, {
2434
2438
  open: !0,
2435
- onOpenChange: (e) => !e && ne(!1),
2436
- children: /* @__PURE__ */ $(fe, {
2439
+ onOpenChange: (e) => !e && j(!1),
2440
+ children: /* @__PURE__ */ $(de, {
2437
2441
  className: "max-w-5xl",
2438
- children: [/* @__PURE__ */ $(pe, {
2442
+ children: [/* @__PURE__ */ $(fe, {
2439
2443
  className: "flex-row items-center justify-between gap-4 pr-8",
2440
- children: [/* @__PURE__ */ Q(me, { children: W }), i]
2444
+ children: [/* @__PURE__ */ Q(pe, { children: ve }), i]
2441
2445
  }), a]
2442
2446
  })
2443
- }) : /* @__PURE__ */ Q(xe, {
2447
+ }) : /* @__PURE__ */ Q(Ce, {
2444
2448
  open: !0,
2445
- onOpenChange: (e) => !e && ne(!1),
2446
- children: /* @__PURE__ */ $(Se, {
2449
+ onOpenChange: (e) => !e && j(!1),
2450
+ children: /* @__PURE__ */ $(we, {
2447
2451
  side: "right",
2448
2452
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
2449
- children: [/* @__PURE__ */ $(Ce, {
2453
+ children: [/* @__PURE__ */ $(Te, {
2450
2454
  className: "flex-row items-center justify-between gap-4 pr-8",
2451
- children: [/* @__PURE__ */ Q(we, { children: W }), i]
2455
+ children: [/* @__PURE__ */ Q(Ee, { children: ve }), i]
2452
2456
  }), /* @__PURE__ */ Q("div", {
2453
2457
  className: "flex-1 overflow-hidden mt-2",
2454
2458
  children: a
@@ -2456,39 +2460,39 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2456
2460
  })
2457
2461
  });
2458
2462
  }, [
2459
- ve,
2463
+ _e,
2460
2464
  v,
2461
2465
  e,
2462
2466
  B,
2463
- W
2467
+ ve
2464
2468
  ]);
2465
- return /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q(Sn, {
2469
+ return /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q(wn, {
2466
2470
  label: r,
2467
- value: U,
2468
- trend: _e,
2471
+ value: W,
2472
+ trend: ge,
2469
2473
  icon: o,
2470
2474
  className: s,
2471
2475
  description: c,
2472
- loading: N,
2473
- error: oe,
2476
+ loading: re,
2477
+ error: I,
2474
2478
  colorVariant: d,
2475
- format: le,
2476
- currency: de,
2479
+ format: se,
2480
+ currency: ce,
2477
2481
  prefix: m,
2478
2482
  suffix: h,
2479
- variant: ee,
2480
- onClick: ve ? () => ne(!0) : void 0
2481
- }), k && ye] });
2483
+ variant: T,
2484
+ onClick: _e ? () => j(!0) : void 0
2485
+ }), A && ye] });
2482
2486
  };
2483
2487
  //#endregion
2484
2488
  //#region src/PivotTable.tsx
2485
- function En() {
2486
- return N()("dashboard.total", "Total");
2489
+ function On() {
2490
+ return I()("dashboard.total", "Total");
2487
2491
  }
2488
- function Dn() {
2489
- return N()("dashboard.noDataAvailable", "No data available");
2492
+ function kn() {
2493
+ return I()("dashboard.noDataAvailable", "No data available");
2490
2494
  }
2491
- function On(e, t) {
2495
+ function An(e, t) {
2492
2496
  if (!t) return String(e);
2493
2497
  let n = "", r = !1, i, a = t, o = a.match(/^([^0-9.,#]*)/);
2494
2498
  if (o && o[1]) {
@@ -2505,18 +2509,18 @@ function On(e, t) {
2505
2509
  }
2506
2510
  return n + l + c;
2507
2511
  }
2508
- var kn = "—";
2509
- function An(e, t) {
2510
- return e === "" ? kn : t?.[e] ?? e;
2512
+ var jn = "—";
2513
+ function Mn(e, t) {
2514
+ return e === "" ? jn : t?.[e] ?? e;
2511
2515
  }
2512
- var jn = /* @__PURE__ */ new Set([
2516
+ var Nn = /* @__PURE__ */ new Set([
2513
2517
  "sum",
2514
2518
  "count",
2515
2519
  "avg",
2516
2520
  "min",
2517
2521
  "max"
2518
2522
  ]);
2519
- function Mn(e, t) {
2523
+ function Pn(e, t) {
2520
2524
  if (e.length === 0) return 0;
2521
2525
  switch (t) {
2522
2526
  case "sum": return e.reduce((e, t) => e + t, 0);
@@ -2527,8 +2531,8 @@ function Mn(e, t) {
2527
2531
  default: return NaN;
2528
2532
  }
2529
2533
  }
2530
- var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2531
- let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: f = !1, showColumnTotals: p = !1, format: m, columnColors: h, drillDown: _ } = e, v = En(), y = Dn(), b = g(_) && typeof a == "function", x = (e) => {
2534
+ var Fn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2535
+ let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: f = !1, showColumnTotals: p = !1, format: m, columnColors: h, drillDown: _ } = e, v = On(), y = kn(), b = g(_) && typeof a == "function", x = (e) => {
2532
2536
  b && a({
2533
2537
  ...e,
2534
2538
  rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
@@ -2536,7 +2540,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2536
2540
  });
2537
2541
  }, S = (e) => (t) => {
2538
2542
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
2539
- }, 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: ee, rowTotals: D, colTotals: O, grandTotal: te } = X(() => {
2543
+ }, 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 } = X(() => {
2540
2544
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
2541
2545
  for (let r of w) {
2542
2546
  let i = String(r[s] ?? ""), a = String(r[c] ?? ""), o = Number(r[l]) || 0;
@@ -2547,10 +2551,10 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2547
2551
  a[e] = {};
2548
2552
  let t = [];
2549
2553
  for (let r of i) {
2550
- let i = n[e]?.[r] ?? [], o = Mn(i, u);
2554
+ let i = n[e]?.[r] ?? [], o = Pn(i, u);
2551
2555
  a[e][r] = o, t.push(...i), !d[r] && d[r];
2552
2556
  }
2553
- o[e] = Mn(t, u);
2557
+ o[e] = Pn(t, u);
2554
2558
  }
2555
2559
  for (let e of i) {
2556
2560
  let t = [];
@@ -2558,7 +2562,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2558
2562
  let r = n[i]?.[e] ?? [];
2559
2563
  t.push(...r);
2560
2564
  }
2561
- d[e] = Mn(t, u);
2565
+ d[e] = Pn(t, u);
2562
2566
  }
2563
2567
  let f = [];
2564
2568
  for (let e of w) f.push(Number(e[l]) || 0);
@@ -2568,7 +2572,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2568
2572
  matrix: a,
2569
2573
  rowTotals: o,
2570
2574
  colTotals: d,
2571
- grandTotal: Mn(f, u)
2575
+ grandTotal: Pn(f, u)
2572
2576
  };
2573
2577
  }, [
2574
2578
  w,
@@ -2576,13 +2580,13 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2576
2580
  c,
2577
2581
  l,
2578
2582
  u
2579
- ]), k = (e) => On(e, m);
2580
- return jn.has(u) ? w.length === 0 ? /* @__PURE__ */ $("div", {
2583
+ ]), j = (e) => An(e, m);
2584
+ return Nn.has(u) ? w.length === 0 ? /* @__PURE__ */ $("div", {
2581
2585
  className: K("overflow-auto", t),
2582
2586
  children: [o && /* @__PURE__ */ Q("h3", {
2583
2587
  className: "text-sm font-semibold mb-2",
2584
2588
  children: o
2585
- }), /* @__PURE__ */ Q(R, {
2589
+ }), /* @__PURE__ */ Q(V, {
2586
2590
  "data-testid": "pivot-empty-state",
2587
2591
  className: "py-8 gap-2 [&>h3]:hidden",
2588
2592
  icon: /* @__PURE__ */ $("svg", {
@@ -2654,7 +2658,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2654
2658
  onClick: b ? t : void 0,
2655
2659
  onKeyDown: b ? S(t) : void 0,
2656
2660
  "aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
2657
- children: An(e, r)
2661
+ children: Mn(e, r)
2658
2662
  }, e);
2659
2663
  }),
2660
2664
  f && /* @__PURE__ */ Q("th", {
@@ -2679,10 +2683,10 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2679
2683
  rowKey: e
2680
2684
  })) : void 0,
2681
2685
  "aria-label": b ? `Drill into ${s}: ${e || "(empty)"}` : void 0,
2682
- children: An(e, n)
2686
+ children: Mn(e, n)
2683
2687
  }),
2684
2688
  E.map((t) => {
2685
- let n = ee[e]?.[t] ?? 0, r = () => x({
2689
+ let n = D[e]?.[t] ?? 0, r = () => x({
2686
2690
  scope: "cell",
2687
2691
  rowKey: e,
2688
2692
  colKey: t,
@@ -2695,7 +2699,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2695
2699
  onClick: b ? r : void 0,
2696
2700
  onKeyDown: b ? S(r) : void 0,
2697
2701
  "aria-label": b ? `Drill into ${s}=${e || "(empty)"}, ${c}=${t || "(empty)"}` : void 0,
2698
- children: k(n)
2702
+ children: j(n)
2699
2703
  }, t);
2700
2704
  }),
2701
2705
  f && /* @__PURE__ */ Q("td", {
@@ -2705,14 +2709,14 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2705
2709
  onClick: b ? () => x({
2706
2710
  scope: "row",
2707
2711
  rowKey: e,
2708
- value: D[e] ?? 0
2712
+ value: O[e] ?? 0
2709
2713
  }) : void 0,
2710
2714
  onKeyDown: b ? S(() => x({
2711
2715
  scope: "row",
2712
2716
  rowKey: e,
2713
- value: D[e] ?? 0
2717
+ value: O[e] ?? 0
2714
2718
  })) : void 0,
2715
- children: k(D[e] ?? 0)
2719
+ children: j(O[e] ?? 0)
2716
2720
  })
2717
2721
  ]
2718
2722
  }, e)) }),
@@ -2730,14 +2734,14 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2730
2734
  onClick: b ? () => x({
2731
2735
  scope: "column",
2732
2736
  colKey: e,
2733
- value: O[e] ?? 0
2737
+ value: k[e] ?? 0
2734
2738
  }) : void 0,
2735
2739
  onKeyDown: b ? S(() => x({
2736
2740
  scope: "column",
2737
2741
  colKey: e,
2738
- value: O[e] ?? 0
2742
+ value: k[e] ?? 0
2739
2743
  })) : void 0,
2740
- children: k(O[e] ?? 0)
2744
+ children: j(k[e] ?? 0)
2741
2745
  }, e)),
2742
2746
  f && /* @__PURE__ */ Q("td", {
2743
2747
  className: K("text-right p-2 tabular-nums font-bold", C),
@@ -2745,13 +2749,13 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2745
2749
  tabIndex: b ? 0 : void 0,
2746
2750
  onClick: b ? () => x({
2747
2751
  scope: "total",
2748
- value: te
2752
+ value: A
2749
2753
  }) : void 0,
2750
2754
  onKeyDown: b ? S(() => x({
2751
2755
  scope: "total",
2752
- value: te
2756
+ value: A
2753
2757
  })) : void 0,
2754
- children: k(te)
2758
+ children: j(A)
2755
2759
  })
2756
2760
  ]
2757
2761
  }) })
@@ -2773,17 +2777,17 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2773
2777
  String(u),
2774
2778
  "” — this pivot table renders",
2775
2779
  " ",
2776
- [...jn].join(", "),
2780
+ [...Nn].join(", "),
2777
2781
  "."
2778
2782
  ]
2779
2783
  })
2780
2784
  })]
2781
2785
  });
2782
- }, Pn = ({ schema: e, dataSource: t, className: n }) => {
2783
- let r = Ae(T), i = t || r?.dataSource, a = ee(e.bind), [o, s] = Z([]), [c, l] = Z(!1), [d, p] = Z(null), [m, h] = Z({}), [_, v] = Z({}), [y, S] = Z(null), { fieldLabel: C, fieldOptionLabel: w } = ae(), E = je(C), D = je(w);
2786
+ }, In = ({ schema: e, dataSource: t, className: n }) => {
2787
+ let r = Me(D), i = t || r?.dataSource, a = k(e.bind), [o, s] = Z([]), [c, l] = Z(!1), [d, p] = Z(null), [m, h] = Z({}), [_, v] = Z({}), [y, b] = Z(null), { fieldLabel: x, fieldOptionLabel: w } = ie(), T = Ne(x), E = Ne(w);
2784
2788
  Y(() => {
2785
- E.current = C, D.current = w;
2786
- }, [C, w]), Y(() => {
2789
+ T.current = x, E.current = w;
2790
+ }, [x, w]), Y(() => {
2787
2791
  if (!i || !e.objectName) return;
2788
2792
  let t = i.getObjectSchema;
2789
2793
  if (typeof t != "function") return;
@@ -2793,13 +2797,13 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2793
2797
  let r = e.objectName, i = {}, a = {};
2794
2798
  for (let [e, n] of Object.entries(t.fields)) {
2795
2799
  let t = n?.label ? String(n.label) : e;
2796
- a[e] = E.current(r, e, t);
2800
+ a[e] = T.current(r, e, t);
2797
2801
  let o = n?.options;
2798
2802
  if (Array.isArray(o) && o.length > 0) {
2799
2803
  let t = {};
2800
2804
  for (let n of o) if (n && n.value !== void 0 && n.label !== void 0) {
2801
2805
  let i = String(n.value), a = String(n.label);
2802
- t[i] = D.current(r, e, i, a);
2806
+ t[i] = E.current(r, e, i, a);
2803
2807
  }
2804
2808
  Object.keys(t).length > 0 && (i[e] = t);
2805
2809
  }
@@ -2809,7 +2813,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2809
2813
  n = !1;
2810
2814
  };
2811
2815
  }, [i, e.objectName]);
2812
- let O = te();
2816
+ let O = ee();
2813
2817
  Y(() => {
2814
2818
  let t = !0;
2815
2819
  return e.objectName && !a && (!e.data || e.data.length === 0) && (async () => {
@@ -2817,8 +2821,10 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2817
2821
  t && (l(!0), p(null));
2818
2822
  try {
2819
2823
  let n;
2820
- if (typeof i.find == "function") n = f(await i.find(e.objectName, { $filter: x(e.filter, O) }));
2821
- else return;
2824
+ if (typeof i.find == "function") {
2825
+ let t = await i.find(e.objectName, { $filter: C(e.filter, O) });
2826
+ n = f(t);
2827
+ } else return;
2822
2828
  t && s(n);
2823
2829
  } catch (e) {
2824
2830
  console.error("[ObjectPivotTable] Fetch error:", e), t && p(e instanceof Error ? e.message : "Failed to load data");
@@ -2837,8 +2843,8 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2837
2843
  e.filter,
2838
2844
  O
2839
2845
  ]);
2840
- let k = a || e.data || o, ne = Array.isArray(k) ? k : [];
2841
- if (c && ne.length === 0) return /* @__PURE__ */ $("div", {
2846
+ let A = a || e.data || o, j = Array.isArray(A) ? A : [];
2847
+ if (c && j.length === 0) return /* @__PURE__ */ $("div", {
2842
2848
  className: K("overflow-auto", n),
2843
2849
  "data-testid": "pivot-loading",
2844
2850
  children: [e.title && /* @__PURE__ */ Q("h3", {
@@ -2912,7 +2918,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2912
2918
  })]
2913
2919
  })]
2914
2920
  });
2915
- if (!i && e.objectName && ne.length === 0) return /* @__PURE__ */ $("div", {
2921
+ if (!i && e.objectName && j.length === 0) return /* @__PURE__ */ $("div", {
2916
2922
  className: K("overflow-auto", n),
2917
2923
  children: [e.title && /* @__PURE__ */ Q("h3", {
2918
2924
  className: "text-sm font-semibold mb-2",
@@ -2929,40 +2935,40 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2929
2935
  })
2930
2936
  })]
2931
2937
  });
2932
- let re = {
2938
+ let M = {
2933
2939
  ...e,
2934
- data: ne
2935
- }, A = e.rowField ? m[e.rowField] : void 0, ie = e.columnField ? m[e.columnField] : void 0, j = e.rowField ? _[e.rowField] : void 0, M = e.drillDown;
2936
- return /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q(Nn, {
2937
- schema: re,
2940
+ data: j
2941
+ }, te = e.rowField ? m[e.rowField] : void 0, ne = e.columnField ? m[e.columnField] : void 0, N = e.rowField ? _[e.rowField] : void 0, P = e.drillDown, F = g(P) ? (e) => b(e) : void 0;
2942
+ return /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q(Fn, {
2943
+ schema: M,
2938
2944
  className: n,
2939
- rowLabels: A,
2940
- columnLabels: ie,
2941
- rowFieldLabel: j,
2942
- onDrillDown: g(M) ? (e) => S(e) : void 0
2945
+ rowLabels: te,
2946
+ columnLabels: ne,
2947
+ rowFieldLabel: N,
2948
+ onDrillDown: F
2943
2949
  }), (() => {
2944
2950
  if (!y || !e.objectName) return null;
2945
- let t = u(M, y, {
2951
+ let t = u(P, y, {
2946
2952
  rowField: e.rowField,
2947
2953
  columnField: e.columnField
2948
2954
  }), n = {
2949
2955
  ...e.filter || {},
2950
2956
  ...t
2951
- };
2952
- return /* @__PURE__ */ Q(Lt, {
2957
+ }, r = S(P, y, e.title || "Details");
2958
+ return /* @__PURE__ */ Q(zt, {
2953
2959
  open: !0,
2954
- onClose: () => S(null),
2955
- title: b(M, y, e.title || "Details"),
2956
- target: M?.target ?? "drawer",
2960
+ onClose: () => b(null),
2961
+ title: r,
2962
+ target: P?.target ?? "drawer",
2957
2963
  objectName: e.objectName,
2958
2964
  filter: n,
2959
2965
  dataSource: i,
2960
- columns: M?.columns,
2961
- maxRows: M?.maxRows,
2962
- report: M?.report
2966
+ columns: P?.columns,
2967
+ maxRows: P?.maxRows,
2968
+ report: P?.report
2963
2969
  });
2964
2970
  })()] });
2965
- }, Fn = {
2971
+ }, Ln = {
2966
2972
  breadcrumb: ["Dashboard", "Configuration"],
2967
2973
  sections: [
2968
2974
  {
@@ -3088,12 +3094,12 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
3088
3094
  }
3089
3095
  ]
3090
3096
  };
3091
- function In({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
3092
- let { draft: a, isDirty: o, updateField: s, discard: c } = Ee(n, { onUpdate: i });
3093
- return /* @__PURE__ */ Q(de, {
3097
+ function Rn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
3098
+ let { draft: a, isDirty: o, updateField: s, discard: c } = Oe(n, { onUpdate: i });
3099
+ return /* @__PURE__ */ Q(ue, {
3094
3100
  open: e,
3095
3101
  onClose: t,
3096
- schema: Fn,
3102
+ schema: Ln,
3097
3103
  draft: a,
3098
3104
  isDirty: o,
3099
3105
  onFieldChange: s,
@@ -3103,7 +3109,7 @@ function In({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
3103
3109
  }
3104
3110
  //#endregion
3105
3111
  //#region src/WidgetConfigPanel.tsx
3106
- var Ln = [
3112
+ var zn = [
3107
3113
  {
3108
3114
  value: "metric",
3109
3115
  label: "Metric"
@@ -3148,7 +3154,7 @@ var Ln = [
3148
3154
  value: "pivot",
3149
3155
  label: "Pivot Table"
3150
3156
  }
3151
- ], Rn = [
3157
+ ], Bn = [
3152
3158
  {
3153
3159
  value: "default",
3154
3160
  label: "Default"
@@ -3181,7 +3187,7 @@ var Ln = [
3181
3187
  value: "danger",
3182
3188
  label: "Danger"
3183
3189
  }
3184
- ], zn = [
3190
+ ], Vn = [
3185
3191
  "bar",
3186
3192
  "horizontal-bar",
3187
3193
  "line",
@@ -3190,20 +3196,20 @@ var Ln = [
3190
3196
  "donut",
3191
3197
  "scatter",
3192
3198
  "funnel"
3193
- ], Bn = [
3199
+ ], Hn = [
3194
3200
  "metric",
3195
3201
  "gauge",
3196
3202
  "solid-gauge",
3197
3203
  "kpi",
3198
3204
  "bullet"
3199
3205
  ];
3200
- function Vn(e) {
3201
- return !!e && zn.includes(e);
3206
+ function Un(e) {
3207
+ return !!e && Vn.includes(e);
3202
3208
  }
3203
- function Hn(e) {
3204
- return !!e && !Bn.includes(e);
3209
+ function Wn(e) {
3210
+ return !!e && !Hn.includes(e);
3205
3211
  }
3206
- function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i }) {
3212
+ function Gn({ names: e, options: t, placeholder: n, emptyText: r, onChange: i }) {
3207
3213
  let [a, o] = q.useState(""), s = q.useMemo(() => new Set(e), [e]), c = q.useMemo(() => t.filter((e) => !s.has(e.value)), [t, s]), l = (t) => {
3208
3214
  let n = t.trim();
3209
3215
  !n || s.has(n) || (i([...e, n]), o(""));
@@ -3223,10 +3229,10 @@ function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i })
3223
3229
  "aria-label": `Remove ${e}`,
3224
3230
  className: "text-muted-foreground hover:text-foreground",
3225
3231
  onClick: () => u(e),
3226
- children: /* @__PURE__ */ Q(Je, { className: "h-3 w-3" })
3232
+ children: /* @__PURE__ */ Q(Xe, { className: "h-3 w-3" })
3227
3233
  })]
3228
3234
  }, e))
3229
- }), c.length > 0 ? /* @__PURE__ */ Q(ue, {
3235
+ }), c.length > 0 ? /* @__PURE__ */ Q(le, {
3230
3236
  options: c,
3231
3237
  value: "",
3232
3238
  onValueChange: l,
@@ -3244,7 +3250,7 @@ function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i })
3244
3250
  },
3245
3251
  placeholder: n,
3246
3252
  className: "h-7 flex-1 text-xs"
3247
- }), /* @__PURE__ */ Q(P, {
3253
+ }), /* @__PURE__ */ Q(L, {
3248
3254
  type: "button",
3249
3255
  size: "sm",
3250
3256
  variant: "outline",
@@ -3256,7 +3262,7 @@ function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i })
3256
3262
  })]
3257
3263
  });
3258
3264
  }
3259
- function Wn(e, t) {
3265
+ function Kn(e, t) {
3260
3266
  let n = e ?? [], r = n.length > 0, i = n.map((e) => ({
3261
3267
  value: e.name,
3262
3268
  label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
@@ -3265,11 +3271,11 @@ function Wn(e, t) {
3265
3271
  label: "Dataset",
3266
3272
  type: "custom",
3267
3273
  helpText: "The semantic-layer dataset this widget binds to (ADR-0021).",
3268
- render: (e, t) => /* @__PURE__ */ Q(L, {
3274
+ render: (e, t) => /* @__PURE__ */ Q(B, {
3269
3275
  label: "Dataset",
3270
3276
  children: /* @__PURE__ */ Q("div", {
3271
3277
  "data-testid": "config-field-dataset",
3272
- children: /* @__PURE__ */ Q(ue, {
3278
+ children: /* @__PURE__ */ Q(le, {
3273
3279
  options: i,
3274
3280
  value: e ?? "",
3275
3281
  onValueChange: t,
@@ -3290,19 +3296,19 @@ function Wn(e, t) {
3290
3296
  key: "dimensions",
3291
3297
  label: "Dimensions",
3292
3298
  type: "custom",
3293
- visibleWhen: (e) => Hn(e.type),
3299
+ visibleWhen: (e) => Wn(e.type),
3294
3300
  helpText: t === "pivot" ? "Group/split fields. The last dimension spreads across as columns." : "Group/split the values by these dataset dimensions.",
3295
3301
  render: (e, t, n) => {
3296
3302
  let r = (a(n.dataset)?.dimensions ?? []).map((e) => ({
3297
3303
  value: e.name,
3298
3304
  label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
3299
3305
  }));
3300
- return /* @__PURE__ */ Q(L, {
3306
+ return /* @__PURE__ */ Q(B, {
3301
3307
  label: "Dimensions",
3302
3308
  children: /* @__PURE__ */ Q("div", {
3303
3309
  "data-testid": "config-field-dimensions",
3304
3310
  className: "w-40",
3305
- children: /* @__PURE__ */ Q(Un, {
3311
+ children: /* @__PURE__ */ Q(Gn, {
3306
3312
  names: Array.isArray(e) ? e : [],
3307
3313
  options: r,
3308
3314
  placeholder: "Add dimension…",
@@ -3317,7 +3323,7 @@ function Wn(e, t) {
3317
3323
  breadcrumb: ["Dashboard", {
3318
3324
  pivot: "Pivot table",
3319
3325
  table: "Table"
3320
- }[t ?? ""] ?? (Vn(t) ? "Chart" : "Widget")],
3326
+ }[t ?? ""] ?? (Un(t) ? "Chart" : "Widget")],
3321
3327
  sections: [
3322
3328
  {
3323
3329
  key: "general",
@@ -3339,7 +3345,7 @@ function Wn(e, t) {
3339
3345
  key: "type",
3340
3346
  label: "Widget type",
3341
3347
  type: "select",
3342
- options: Ln,
3348
+ options: zn,
3343
3349
  defaultValue: "metric"
3344
3350
  }
3345
3351
  ]
@@ -3361,12 +3367,12 @@ function Wn(e, t) {
3361
3367
  value: e.name,
3362
3368
  label: e.aggregate ? `${e.label ?? e.name} · ${e.aggregate}` : e.label ?? e.name
3363
3369
  }));
3364
- return /* @__PURE__ */ Q(L, {
3370
+ return /* @__PURE__ */ Q(B, {
3365
3371
  label: "Values",
3366
3372
  children: /* @__PURE__ */ Q("div", {
3367
3373
  "data-testid": "config-field-values",
3368
3374
  className: "w-40",
3369
- children: /* @__PURE__ */ Q(Un, {
3375
+ children: /* @__PURE__ */ Q(Gn, {
3370
3376
  names: Array.isArray(e) ? e : [],
3371
3377
  options: r,
3372
3378
  placeholder: "Add measure…",
@@ -3422,14 +3428,14 @@ function Wn(e, t) {
3422
3428
  key: "colorVariant",
3423
3429
  label: "Color variant",
3424
3430
  type: "select",
3425
- options: Rn,
3431
+ options: Bn,
3426
3432
  defaultValue: "default"
3427
3433
  }]
3428
3434
  }
3429
3435
  ]
3430
3436
  };
3431
3437
  }
3432
- function Gn(e) {
3438
+ function qn(e) {
3433
3439
  if (e == null) return "";
3434
3440
  if (typeof e == "string") return e;
3435
3441
  if (typeof e == "object") {
@@ -3438,7 +3444,7 @@ function Gn(e) {
3438
3444
  }
3439
3445
  return String(e);
3440
3446
  }
3441
- var Kn = [
3447
+ var Jn = [
3442
3448
  "object",
3443
3449
  "categoryField",
3444
3450
  "categoryGranularity",
@@ -3465,32 +3471,32 @@ var Kn = [
3465
3471
  "searchable",
3466
3472
  "pagination"
3467
3473
  ];
3468
- function qn(e) {
3474
+ function Yn(e) {
3469
3475
  let t = e.type, n = { ...e };
3470
- for (let e of Kn) delete n[e];
3471
- return Hn(t) || delete n.dimensions, n;
3476
+ for (let e of Jn) delete n[e];
3477
+ return Wn(t) || delete n.dimensions, n;
3472
3478
  }
3473
- function Jn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, datasets: o, datasetsLoading: s }) {
3474
- let { draft: c, isDirty: l, updateField: u, discard: d } = Ee(q.useMemo(() => ({
3479
+ function Xn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, datasets: o, datasetsLoading: s }) {
3480
+ let c = q.useMemo(() => ({
3475
3481
  ...n,
3476
- title: typeof n.title == "object" ? Gn(n.title) : n.title,
3477
- description: typeof n.description == "object" ? Gn(n.description) : n.description
3478
- }), [n]), { onUpdate: i });
3479
- return /* @__PURE__ */ Q(de, {
3482
+ title: typeof n.title == "object" ? qn(n.title) : n.title,
3483
+ description: typeof n.description == "object" ? qn(n.description) : n.description
3484
+ }), [n]), { draft: l, isDirty: u, updateField: d, discard: f } = Oe(c, { onUpdate: i }), p = q.useMemo(() => Kn(o, l.type), [o, l.type]);
3485
+ return /* @__PURE__ */ Q(ue, {
3480
3486
  open: e,
3481
3487
  onClose: t,
3482
- schema: q.useMemo(() => Wn(o, c.type), [o, c.type]),
3483
- draft: c,
3484
- isDirty: l,
3485
- onFieldChange: u,
3486
- onSave: () => r(qn(c)),
3487
- onDiscard: d,
3488
+ schema: p,
3489
+ draft: l,
3490
+ isDirty: u,
3491
+ onFieldChange: d,
3492
+ onSave: () => r(Yn(l)),
3493
+ onDiscard: f,
3488
3494
  headerExtra: a
3489
3495
  });
3490
3496
  }
3491
3497
  //#endregion
3492
3498
  //#region src/DashboardWithConfig.tsx
3493
- function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s, datasets: c, datasetsLoading: l }) {
3499
+ function Zn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s, datasets: c, datasetsLoading: l }) {
3494
3500
  let [u, d] = Z(o), [f, p] = Z(null), [m, h] = Z(e), [g, _] = Z(0);
3495
3501
  Y(() => {
3496
3502
  h(e), _((e) => e + 1);
@@ -3549,14 +3555,14 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3549
3555
  className: "flex-1 min-w-0 overflow-auto relative",
3550
3556
  children: [/* @__PURE__ */ Q("div", {
3551
3557
  className: "absolute top-2 right-2 z-10",
3552
- children: /* @__PURE__ */ $(P, {
3558
+ children: /* @__PURE__ */ $(L, {
3553
3559
  size: "sm",
3554
3560
  variant: u ? "default" : "outline",
3555
3561
  onClick: C,
3556
3562
  "data-testid": "dashboard-config-toggle",
3557
- children: [/* @__PURE__ */ Q(qe, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3563
+ children: [/* @__PURE__ */ Q(Ye, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3558
3564
  })
3559
- }), /* @__PURE__ */ Q(un, {
3565
+ }), /* @__PURE__ */ Q(fn, {
3560
3566
  schema: m,
3561
3567
  onRefresh: i,
3562
3568
  recordCount: a,
@@ -3566,7 +3572,7 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3566
3572
  })]
3567
3573
  }), u && /* @__PURE__ */ Q("div", {
3568
3574
  className: "relative shrink-0",
3569
- children: f && v ? /* @__PURE__ */ Q(Jn, {
3575
+ children: f && v ? /* @__PURE__ */ Q(Xn, {
3570
3576
  open: !0,
3571
3577
  onClose: b,
3572
3578
  config: v,
@@ -3574,7 +3580,7 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3574
3580
  onFieldChange: x,
3575
3581
  datasets: c,
3576
3582
  datasetsLoading: l
3577
- }) : /* @__PURE__ */ Q(In, {
3583
+ }) : /* @__PURE__ */ Q(Rn, {
3578
3584
  open: !0,
3579
3585
  onClose: () => d(!1),
3580
3586
  config: t,
@@ -3583,7 +3589,7 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3583
3589
  })]
3584
3590
  });
3585
3591
  }
3586
- e.register("dashboard", un, {
3592
+ e.register("dashboard", fn, {
3587
3593
  namespace: "view",
3588
3594
  label: "Dashboard",
3589
3595
  category: "Complex",
@@ -3611,7 +3617,7 @@ e.register("dashboard", un, {
3611
3617
  columns: 3,
3612
3618
  widgets: []
3613
3619
  }
3614
- }), e.register("metric", Sn, {
3620
+ }), e.register("metric", wn, {
3615
3621
  namespace: "plugin-dashboard",
3616
3622
  label: "Metric Widget",
3617
3623
  category: "Dashboard",
@@ -3624,7 +3630,7 @@ e.register("dashboard", un, {
3624
3630
  type: "string",
3625
3631
  label: "Value"
3626
3632
  }]
3627
- }), e.register("metric-card", wn, {
3633
+ }), e.register("metric-card", En, {
3628
3634
  namespace: "plugin-dashboard",
3629
3635
  label: "Metric Card",
3630
3636
  category: "Dashboard",
@@ -3679,7 +3685,7 @@ e.register("dashboard", un, {
3679
3685
  title: "Metric",
3680
3686
  value: "0"
3681
3687
  }
3682
- }), e.register("object-metric", Tn, {
3688
+ }), e.register("object-metric", Dn, {
3683
3689
  namespace: "plugin-dashboard",
3684
3690
  label: "Object Metric",
3685
3691
  category: "Dashboard",
@@ -3708,7 +3714,7 @@ e.register("dashboard", un, {
3708
3714
  }
3709
3715
  ],
3710
3716
  defaultProps: { label: "Metric" }
3711
- }), e.register("pivot", Nn, {
3717
+ }), e.register("pivot", Fn, {
3712
3718
  namespace: "plugin-dashboard",
3713
3719
  label: "Pivot Table",
3714
3720
  category: "Dashboard",
@@ -3787,7 +3793,7 @@ e.register("dashboard", un, {
3787
3793
  aggregation: "sum",
3788
3794
  data: []
3789
3795
  }
3790
- }), e.register("object-pivot", Pn, {
3796
+ }), e.register("object-pivot", In, {
3791
3797
  namespace: "plugin-dashboard",
3792
3798
  label: "Object Pivot Table",
3793
3799
  category: "Dashboard",
@@ -3876,7 +3882,7 @@ e.register("dashboard", un, {
3876
3882
  valueField: "",
3877
3883
  aggregation: "sum"
3878
3884
  }
3879
- }), e.register("dashboard-grid", hn, {
3885
+ }), e.register("dashboard-grid", _n, {
3880
3886
  namespace: "plugin-dashboard",
3881
3887
  label: "Dashboard Grid (Editable)",
3882
3888
  category: "Complex",
@@ -3894,7 +3900,7 @@ e.register("dashboard", un, {
3894
3900
  title: "Dashboard",
3895
3901
  widgets: []
3896
3902
  }
3897
- }), e.register("object-data-table", Ft, {
3903
+ }), e.register("object-data-table", Lt, {
3898
3904
  namespace: "plugin-dashboard",
3899
3905
  label: "Object Data Table",
3900
3906
  category: "Dashboard",
@@ -3932,18 +3938,18 @@ e.register("dashboard", un, {
3932
3938
  pagination: !1
3933
3939
  }
3934
3940
  });
3935
- var Xn = {
3936
- DashboardRenderer: un,
3937
- DashboardGridLayout: hn,
3938
- MetricWidget: Sn,
3939
- MetricCard: wn,
3940
- ObjectMetricWidget: Tn,
3941
- PivotTable: Nn,
3942
- ObjectPivotTable: Pn,
3943
- ObjectDataTable: Ft,
3944
- DashboardConfigPanel: In,
3945
- WidgetConfigPanel: Jn,
3946
- DashboardWithConfig: Yn
3941
+ var Qn = {
3942
+ DashboardRenderer: fn,
3943
+ DashboardGridLayout: _n,
3944
+ MetricWidget: wn,
3945
+ MetricCard: En,
3946
+ ObjectMetricWidget: Dn,
3947
+ PivotTable: Fn,
3948
+ ObjectPivotTable: In,
3949
+ ObjectDataTable: Lt,
3950
+ DashboardConfigPanel: Rn,
3951
+ WidgetConfigPanel: Xn,
3952
+ DashboardWithConfig: Zn
3947
3953
  };
3948
3954
  //#endregion
3949
- export { In as DashboardConfigPanel, hn as DashboardGridLayout, un as DashboardRenderer, Yn as DashboardWithConfig, Lt as DrillDownDrawer, wn as MetricCard, Sn as MetricWidget, Ft as ObjectDataTable, Tn as ObjectMetricWidget, Pn as ObjectPivotTable, Nn as PivotTable, Jn as WidgetConfigPanel, Xn as dashboardComponents };
3955
+ export { Rn as DashboardConfigPanel, _n as DashboardGridLayout, fn as DashboardRenderer, Zn as DashboardWithConfig, zt as DrillDownDrawer, En as MetricCard, wn as MetricWidget, Lt as ObjectDataTable, Dn as ObjectMetricWidget, In as ObjectPivotTable, Fn as PivotTable, Xn as WidgetConfigPanel, Qn as dashboardComponents };