@nivaro/react 0.3.57 → 0.3.59

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.
Files changed (69) hide show
  1. package/dist/components/fields/RelationField.js +110 -80
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useRelationOptions.js +1 -0
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +37 -2
  6. package/dist/index.js +523 -520
  7. package/dist/shared/components/CollectionBrowserView.js +2693 -2619
  8. package/dist/shared/components/DataTable.js +538 -495
  9. package/dist/shared/components/ItemEditForm.js +4559 -4386
  10. package/dist/shared/components/PageRenderer.js +537 -508
  11. package/dist/shared/components/ProfileView.js +716 -715
  12. package/dist/shared/components/QueryTable.js +74 -74
  13. package/dist/shared/components/RecordReadView.js +367 -364
  14. package/dist/shared/components/ReportView.js +64 -39
  15. package/dist/shared/components/WidgetSlot.js +543 -520
  16. package/dist/shared/components/alerts/AlertManagerView.js +324 -317
  17. package/dist/shared/components/alerts/types.js +37 -14
  18. package/dist/shared/components/cbv/row-focus.js +19 -0
  19. package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
  20. package/dist/shared/components/integrations/console/SignalCard.js +59 -59
  21. package/dist/shared/components/integrations/console/tone.js +52 -30
  22. package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
  23. package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
  24. package/dist/shared/components/item-edit/FieldRow.js +175 -173
  25. package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
  26. package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
  27. package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
  28. package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
  29. package/dist/shared/components/item-edit/PlanGrid.js +973 -894
  30. package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
  31. package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
  32. package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
  33. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
  34. package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
  35. package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
  36. package/dist/shared/components/item-edit/line-midair.js +82 -75
  37. package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
  38. package/dist/shared/components/item-edit/related-missing.js +45 -0
  39. package/dist/shared/components/item-edit/save-outcome.js +9 -7
  40. package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
  41. package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
  42. package/dist/shared/components/panels/ItemLockBanner.js +213 -211
  43. package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
  44. package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
  45. package/dist/shared/components/panels/RevisionsPanel.js +316 -299
  46. package/dist/shared/components/panels/TaskPanel.js +265 -249
  47. package/dist/shared/components/panels/landing-state.js +27 -0
  48. package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
  49. package/dist/shared/components/profile/AiMemoryCard.js +12 -10
  50. package/dist/shared/components/queue/OwnerAvatars.js +80 -41
  51. package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
  52. package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
  53. package/dist/shared/components/queue/group-sums.js +27 -0
  54. package/dist/shared/components/queue/live-state-aspect.js +9 -5
  55. package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
  56. package/dist/shared/lib/back-closes.js +25 -0
  57. package/dist/shared/lib/display-prefs.js +60 -52
  58. package/dist/shared/lib/draft-store.js +71 -48
  59. package/dist/shared/lib/expression.js +53 -53
  60. package/dist/shared/lib/form-usage-beacon.js +7 -7
  61. package/dist/shared/lib/list-page-memory.js +63 -0
  62. package/dist/shared/lib/live.js +44 -44
  63. package/dist/shared/lib/money-input.js +45 -0
  64. package/dist/shared/lib/own-writes.js +76 -28
  65. package/dist/shared/lib/request-gate.js +110 -109
  66. package/dist/shared/lib/sanitize-html.js +10 -6
  67. package/dist/shared/lib/staged-row-labels.js +18 -0
  68. package/dist/shared/lib/validation-rules.js +34 -19
  69. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { jsx as o, jsxs as p, Fragment as Ye } from "react/jsx-runtime";
2
2
  import { Search as dt, Download as it, ArrowUp as ut, ArrowDown as bt, ChevronsDownUp as mt, ChevronsUpDown as ct } from "lucide-react";
3
- import { useState as W, useEffect as pt } from "react";
3
+ import { useState as K, useEffect as pt } from "react";
4
4
  import { evaluateNumeric as ht } from "../lib/expression.js";
5
5
  function ft(s) {
6
6
  return `color-mix(in srgb, ${s} 55%, white)`;
@@ -55,12 +55,12 @@ function vt(s, t, b, c = "month") {
55
55
  const u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set();
56
56
  let y = !1;
57
57
  for (const h of s) {
58
- const A = t.key_fields.map((O) => String(h[O] ?? "")).join("|");
59
- let w = u.get(A);
58
+ const J = t.key_fields.map((O) => String(h[O] ?? "")).join("|");
59
+ let w = u.get(J);
60
60
  if (!w) {
61
61
  w = {};
62
62
  for (const O of t.key_fields) w[O] = h[O];
63
- u.set(A, w);
63
+ u.set(J, w);
64
64
  }
65
65
  const z = String(h[t.date_field] ?? ""), I = /^(\d{4})-(\d{2})/.exec(z);
66
66
  if (!I) {
@@ -77,40 +77,40 @@ function vt(s, t, b, c = "month") {
77
77
  g.add(I[1]), w[`y${I[1]}`] = (Number(w[`y${I[1]}`]) || 0) + V;
78
78
  t.total !== !1 && (w.total = (Number(w.total) || 0) + V);
79
79
  }
80
- const v = [...g].filter((h) => Number(h) < b).sort(), L = [...g].filter((h) => Number(h) > b).sort(), se = c === "quarter" ? [1, 2, 3, 4].map((h) => ({
80
+ const v = [...g].filter((h) => Number(h) < b).sort(), L = [...g].filter((h) => Number(h) > b).sort(), le = c === "quarter" ? [1, 2, 3, 4].map((h) => ({
81
81
  field: `q${h}`,
82
82
  label: `Q${h}`,
83
83
  format: "currency",
84
84
  sum: !0
85
- })) : Qe.map((h, A) => ({
85
+ })) : Qe.map((h, J) => ({
86
86
  field: h,
87
- label: kt[A],
87
+ label: kt[J],
88
88
  format: "currency",
89
89
  sum: !0
90
- })), K = t.color ? { color: t.color, color_negative: t.color_negative } : {}, q = [
90
+ })), A = t.color ? { color: t.color, color_negative: t.color_negative } : {}, q = [
91
91
  ...v.map((h) => ({
92
92
  field: `y${h}`,
93
93
  label: h,
94
94
  format: "currency",
95
95
  sum: !0,
96
- ...K
96
+ ...A
97
97
  })),
98
- ...se.map((h) => ({ ...h, ...K })),
98
+ ...le.map((h) => ({ ...h, ...A })),
99
99
  ...L.map((h) => ({
100
100
  field: `y${h}`,
101
101
  label: h,
102
102
  format: "currency",
103
103
  sum: !0,
104
- ...K
104
+ ...A
105
105
  })),
106
- ...y ? [{ field: "undated", label: "Undated", format: "currency", sum: !0, ...K }] : [],
106
+ ...y ? [{ field: "undated", label: "Undated", format: "currency", sum: !0, ...A }] : [],
107
107
  ...t.total !== !1 ? [
108
108
  {
109
109
  field: "total",
110
110
  label: "Total",
111
111
  format: "currency",
112
112
  sum: !0,
113
- ...t.total_color ? { color: t.total_color, color_negative: t.color_negative } : K
113
+ ...t.total_color ? { color: t.total_color, color_negative: t.color_negative } : A
114
114
  }
115
115
  ] : []
116
116
  ];
@@ -133,7 +133,7 @@ function gt(s, t) {
133
133
  function j(s, t) {
134
134
  return ht(s, t);
135
135
  }
136
- function ae(s, t) {
136
+ function he(s, t) {
137
137
  if (s == null || s === "") return "—";
138
138
  const b = Number(s);
139
139
  if (!Number.isFinite(b)) return String(s);
@@ -155,7 +155,7 @@ function ae(s, t) {
155
155
  return String(s);
156
156
  }
157
157
  }
158
- function le(s) {
158
+ function ae(s) {
159
159
  return s.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase());
160
160
  }
161
161
  function Et({
@@ -168,9 +168,9 @@ function Et({
168
168
  emptyText: y
169
169
  }) {
170
170
  var Re, ze, Ie, He, We, Ke, Ae, Je, je, Ve;
171
- const [v, L] = W(() => /* @__PURE__ */ new Set()), [se, K] = W("month"), [q, h] = W(null), [A, w] = W(""), [z, I] = W(!!((Re = t == null ? void 0 : t.hide_empty) != null && Re.default_on)), [V, O] = W(
171
+ const [v, L] = K(() => /* @__PURE__ */ new Set()), [le, A] = K("month"), [q, h] = K(null), [J, w] = K(""), [z, I] = K(!!((Re = t == null ? void 0 : t.hide_empty) != null && Re.default_on)), [V, O] = K(
172
172
  () => new Set(((t == null ? void 0 : t.toggles) ?? []).filter((e) => e.default_on === !1).map((e) => e.label))
173
- ), [k, Xe] = W(null), [oe, Ze] = W({
173
+ ), [k, Xe] = K(null), [se, Ze] = K({
174
174
  overflows: !1,
175
175
  canScrollRight: !1,
176
176
  cueInset: { right: 0, bottom: 0 }
@@ -192,7 +192,7 @@ function Et({
192
192
  return /* @__PURE__ */ o("p", { className: "px-1 py-2 text-[12px] italic text-slate-400", children: y || (g ? `No ${g.toLowerCase()} yet` : "No data") });
193
193
  let fe = null;
194
194
  if (t != null && t.pivot) {
195
- const e = c ?? t.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), r = vt(s, t.pivot, e, se);
195
+ const e = c ?? t.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), r = vt(s, t.pivot, e, le);
196
196
  s = r.rows, fe = r.columns;
197
197
  }
198
198
  let $ = s;
@@ -246,7 +246,7 @@ function Et({
246
246
  "Oct",
247
247
  "Nov",
248
248
  "Dec"
249
- ], ne = (t == null ? void 0 : t.highlight_group) === "$current_month" ? et[(/* @__PURE__ */ new Date()).getMonth()] : (t == null ? void 0 : t.highlight_group) ?? null, Le = (e) => !!ne && (e.group === ne || !e.group && e.label === ne), de = (e) => Le(e) ? "bg-[#6366f10f] dark:bg-[#a5b4fc12]" : "", X = (e, r) => {
249
+ ], oe = (t == null ? void 0 : t.highlight_group) === "$current_month" ? et[(/* @__PURE__ */ new Date()).getMonth()] : (t == null ? void 0 : t.highlight_group) ?? null, Le = (e) => !!oe && (e.group === oe || !e.group && e.label === oe), ne = (e) => Le(e) ? "bg-[#6366f10f] dark:bg-[#a5b4fc12]" : "", X = (e, r) => {
250
250
  if (!e.color) return;
251
251
  const a = e.color_negative && typeof r == "number" && r < 0, [d, l] = a ? Ce(e.color_negative) : Ce(e.color, e.color_dark);
252
252
  return { "--qtc": d, "--qtcd": l };
@@ -266,9 +266,9 @@ function Et({
266
266
  "div",
267
267
  {
268
268
  className: "flex min-w-[130px] items-center justify-end gap-1.5",
269
- title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${ae(d, r.format)}`,
269
+ title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${he(d, r.format)}`,
270
270
  children: [
271
- /* @__PURE__ */ o("span", { children: ae(T(e, r), r.format) }),
271
+ /* @__PURE__ */ o("span", { children: H(T(e, r), r.format) }),
272
272
  /* @__PURE__ */ o("div", { className: "h-1 w-10 shrink-0 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ o(
273
273
  "div",
274
274
  {
@@ -287,11 +287,11 @@ function Et({
287
287
  return a != null && a !== "" && Number(a) !== 0;
288
288
  })
289
289
  ));
290
- const ie = t != null && t.search ? A.trim().toLowerCase() : "";
291
- ie && ($ = $.filter(
290
+ const de = t != null && t.search ? J.trim().toLowerCase() : "";
291
+ de && ($ = $.filter(
292
292
  (e) => x.some((r) => {
293
293
  const a = T(e, r);
294
- return a == null || a === "" ? !1 : String(a).toLowerCase().includes(ie) || ae(a, r.format).toLowerCase().includes(ie);
294
+ return a == null || a === "" ? !1 : String(a).toLowerCase().includes(de) || he(a, r.format).toLowerCase().includes(de);
295
295
  })
296
296
  ));
297
297
  const ve = !!(t != null && t.sortable) && !(t != null && t.tree_group_by), ee = (e, r) => e.field ?? e.label ?? String(r);
@@ -310,7 +310,7 @@ function Et({
310
310
  if (!(t != null && t.row_format_field) || !U(r)) return r.format;
311
311
  const a = e[t.row_format_field];
312
312
  return a === "currency" || a === "number" ? a : r.format;
313
- }, J = (e, r) => t != null && t.zero_dash && Number(e) === 0 ? "—" : ae(e, r), ue = (e, r) => {
313
+ }, H = (e, r) => t != null && t.zero_dash && Number(e) === 0 ? "—" : he(e, r), ie = (e, r) => {
314
314
  var d;
315
315
  if ((d = r.sparkline_fields) != null && d.length) {
316
316
  const l = r.sparkline_fields.map((i) => Number(e[i]) || 0), n = Math.max(...l, 1), m = Math.min(...l, 0), F = Math.max(n - m, 1), M = l.map(
@@ -321,7 +321,7 @@ function Et({
321
321
  {
322
322
  viewBox: "0 0 60 18",
323
323
  className: "inline-block h-[18px] w-[60px]",
324
- "data-tip": l.map((i) => ae(i, r.format)).join(" · "),
324
+ "data-tip": l.map((i) => he(i, r.format)).join(" · "),
325
325
  children: /* @__PURE__ */ o(
326
326
  "polyline",
327
327
  {
@@ -338,7 +338,7 @@ function Et({
338
338
  if (r.percent_of_total && r.field) {
339
339
  const l = Number(T(e, r)), n = Oe.get(r.field) ?? 0, m = n > 0 && Number.isFinite(l) ? l / n * 100 : null;
340
340
  return /* @__PURE__ */ p("span", { className: "inline-flex items-baseline gap-1", children: [
341
- J(T(e, r), r.format),
341
+ H(T(e, r), r.format),
342
342
  m != null && /* @__PURE__ */ p("span", { className: "text-[9.5px] text-slate-400", children: [
343
343
  m.toLocaleString("en-US", { maximumFractionDigits: 1 }),
344
344
  "%"
@@ -348,24 +348,24 @@ function Et({
348
348
  if (r.display === "progress") return tt(e, r);
349
349
  if (r.stack)
350
350
  return /* @__PURE__ */ p("span", { className: "inline-flex flex-col items-end leading-[15px]", style: ye(r), children: [
351
- xe(r) && /* @__PURE__ */ o("span", { children: qe(J(T(e, r), Ne(e, r))) }),
351
+ xe(r) && /* @__PURE__ */ o("span", { children: qe(H(T(e, r), Ne(e, r))) }),
352
352
  Ee(r) && /* @__PURE__ */ o(
353
353
  "span",
354
354
  {
355
355
  className: `text-[10.5px] ${r.stack_color ? "text-[color:var(--qts)] dark:text-[color:var(--qtsd)]" : "text-slate-400"}`,
356
- children: qe(J(e[r.stack], Ne(e, r)))
356
+ children: qe(H(e[r.stack], Ne(e, r)))
357
357
  }
358
358
  )
359
359
  ] });
360
360
  const a = T(e, r);
361
- return r.empty_label !== void 0 && (a == null || a === "") ? r.empty_label ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: r.empty_label }) : null : qe(J(a, Ne(e, r)));
361
+ return r.empty_label !== void 0 && (a == null || a === "") ? r.empty_label ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: r.empty_label }) : null : qe(H(a, Ne(e, r)));
362
362
  }, Te = x.some((e) => e.group), ge = [];
363
363
  {
364
364
  let e = -1, r;
365
365
  for (const a of x)
366
366
  a.group && a.group !== r && e++, ge.push(a.group ? e : -1), r = a.group;
367
367
  }
368
- const we = (e) => Te && ge[e] >= 0 && ge[e] % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/20" : "", _ = !!(t != null && t.sticky), te = "border-r border-slate-200 dark:border-border", at = (e, r) => _ && e === 0 ? `sticky left-0 z-[1] ${te} ${r}` : "", Ue = (e) => _ ? e === 0 ? `sticky left-0 top-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "sticky top-0 z-[2] bg-white dark:bg-card" : "", G = (e) => _ && (e === 0 || e === 1) ? "pl-3" : "", be = oe.overflows ? "border-l border-slate-200 dark:border-border" : "", $e = (e) => _ ? `sticky right-0 z-[2] ${be} ${e}` : "", re = (e, r, a = 0, d) => {
368
+ const we = (e) => Te && ge[e] >= 0 && ge[e] % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/20" : "", _ = !!(t != null && t.sticky), te = "border-r border-slate-200 dark:border-border", at = (e, r) => _ && e === 0 ? `sticky left-0 z-[1] ${te} ${r}` : "", Ue = (e) => _ ? e === 0 ? `sticky left-0 top-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "sticky top-0 z-[2] bg-white dark:bg-card" : "", G = (e) => _ && (e === 0 || e === 1) ? "pl-3" : "", ue = se.overflows ? "border-l border-slate-200 dark:border-border" : "", $e = (e) => _ ? `sticky right-0 z-[2] ${ue} ${e}` : "", re = (e, r, a = 0, d) => {
369
369
  const l = a === !0 ? 1 : a === !1 ? 0 : a;
370
370
  return /* @__PURE__ */ p(
371
371
  "tr",
@@ -376,14 +376,14 @@ function Et({
376
376
  x.map((n, m) => /* @__PURE__ */ o(
377
377
  "td",
378
378
  {
379
- className: `whitespace-nowrap py-1.5 pr-3 ${n.max_width ? "overflow-hidden text-ellipsis" : ""} ${G(m)} ${ke(n, "text-slate-700 dark:text-slate-200")} ${U(n) ? "text-right tabular-nums" : ""} ${n.group ? "min-w-[58px]" : ""} ${de(n) || we(m)} ${at(m, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
379
+ className: `whitespace-nowrap py-1.5 pr-3 ${n.max_width ? "overflow-hidden text-ellipsis" : ""} ${G(m)} ${ke(n, "text-slate-700 dark:text-slate-200")} ${U(n) ? "text-right tabular-nums" : ""} ${n.group ? "min-w-[58px]" : ""} ${ne(n) || we(m)} ${at(m, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
380
380
  style: {
381
381
  ...l > 0 && m === 0 ? { paddingLeft: 2 + l * 16 } : {},
382
382
  ...n.max_width ? { maxWidth: n.max_width } : {},
383
383
  ...X(n, Number(T(e, n))) ?? {}
384
384
  },
385
385
  title: n.max_width ? String(T(e, n) ?? "") : void 0,
386
- children: m === 0 && d !== void 0 ? d : ue(e, n)
386
+ children: m === 0 && d !== void 0 ? d : ie(e, n)
387
387
  },
388
388
  n.field ?? n.label ?? m
389
389
  )),
@@ -426,8 +426,8 @@ function Et({
426
426
  const m = t.tree_collapsed ? !v.has(l) : v.has(l);
427
427
  Q.push({ key: l, startsCollapsed: !!t.tree_collapsed });
428
428
  const F = { [e]: l }, M = (i) => {
429
- F[i] = n.reduce((N, ce) => {
430
- const P = Number(ce[i]);
429
+ F[i] = n.reduce((N, me) => {
430
+ const P = Number(me[i]);
431
431
  return Number.isFinite(P) ? N + P : N;
432
432
  }, 0);
433
433
  };
@@ -448,12 +448,12 @@ function Et({
448
448
  x.map((i, N) => /* @__PURE__ */ o(
449
449
  "td",
450
450
  {
451
- className: `whitespace-nowrap py-1.5 pr-3 ${G(N)} text-[11.5px] font-semibold ${ke(i, "text-slate-600 dark:text-slate-300")} ${U(i) ? "text-right tabular-nums" : ""} ${de(i)} ${_ && N === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100 dark:bg-muted` : ""}`,
451
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(N)} text-[11.5px] font-semibold ${ke(i, "text-slate-600 dark:text-slate-300")} ${U(i) ? "text-right tabular-nums" : ""} ${ne(i)} ${_ && N === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100 dark:bg-muted` : ""}`,
452
452
  style: X(
453
453
  i,
454
454
  Number(i.formula ? j(i.formula, F) : F[i.field ?? ""])
455
455
  ),
456
- children: N === 0 ? `${m ? "▸" : "▾"} ${l}` : i.formula ? J(j(i.formula, F), i.format) : i.field && i.field !== e && U(i) ? ue(F, i) : ""
456
+ children: N === 0 ? `${m ? "▸" : "▾"} ${l}` : i.formula ? H(j(i.formula, F), i.format) : i.field && i.field !== e && U(i) ? ie(F, i) : ""
457
457
  },
458
458
  i.field ?? i.label ?? N
459
459
  )),
@@ -465,36 +465,36 @@ function Et({
465
465
  const i = t.tree_sub_split;
466
466
  if (!i)
467
467
  return n.map((E, D) => {
468
- var H;
468
+ var W;
469
469
  let C;
470
- if (t.tree_strip_section_prefix && ((H = x[0]) != null && H.field)) {
470
+ if (t.tree_strip_section_prefix && ((W = x[0]) != null && W.field)) {
471
471
  const R = String(E[x[0].field] ?? "");
472
472
  R.startsWith(`${l} - `) && (C = R.slice(l.length + 3));
473
473
  }
474
474
  return re(E, `${l}-${D}`, 1, C);
475
475
  });
476
- const N = i.separator ?? " - ", ce = [], P = /* @__PURE__ */ new Map();
476
+ const N = i.separator ?? " - ", me = [], P = /* @__PURE__ */ new Map();
477
477
  for (const E of n) {
478
478
  const D = String(E[i.field] ?? ""), C = D.lastIndexOf(N);
479
479
  if (C <= 0) {
480
- ce.push(E);
480
+ me.push(E);
481
481
  continue;
482
482
  }
483
- const H = D.slice(0, C), R = P.get(H) ?? [];
484
- R.push(E), P.set(H, R);
483
+ const W = D.slice(0, C), R = P.get(W) ?? [];
484
+ R.push(E), P.set(W, R);
485
485
  }
486
486
  return [
487
- ...ce.map((E, D) => re(E, `${l}-flat-${D}`, 1)),
487
+ ...me.map((E, D) => re(E, `${l}-flat-${D}`, 1)),
488
488
  ...[...P.entries()].sort(([E], [D]) => E.localeCompare(D)).map(([E, D]) => {
489
489
  const C = `s:${l}|${E}`;
490
490
  Q.push({
491
491
  key: C,
492
492
  startsCollapsed: t.tree_sub_collapsed ?? !0
493
493
  });
494
- const H = t.tree_sub_collapsed ?? !0 ? !v.has(C) : v.has(C), R = {}, Be = (f) => {
495
- R[f] = D.reduce((S, pe) => {
496
- const he = Number(pe[f]);
497
- return Number.isFinite(he) ? S + he : S;
494
+ const W = t.tree_sub_collapsed ?? !0 ? !v.has(C) : v.has(C), R = {}, Be = (f) => {
495
+ R[f] = D.reduce((S, ce) => {
496
+ const pe = Number(ce[f]);
497
+ return Number.isFinite(pe) ? S + pe : S;
498
498
  }, 0);
499
499
  };
500
500
  for (const f of x)
@@ -516,7 +516,7 @@ function Et({
516
516
  {
517
517
  className: `whitespace-nowrap py-1.5 pr-3 ${G(S)} text-[11.5px] font-medium text-slate-600 dark:text-slate-300 ${U(f) ? "text-right tabular-nums" : ""} ${_ && S === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100/80 dark:bg-muted` : ""}`,
518
518
  style: S === 0 ? { paddingLeft: 18 } : void 0,
519
- children: S === 0 ? `${H ? "▸" : "▾"} ${E}` : f.formula ? J(j(f.formula, R), f.format) : f.field && f.field !== e && U(f) ? ue(R, f) : ""
519
+ children: S === 0 ? `${W ? "▸" : "▾"} ${E}` : f.formula ? H(j(f.formula, R), f.format) : f.field && f.field !== e && U(f) ? ie(R, f) : ""
520
520
  },
521
521
  f.field ?? f.label ?? S
522
522
  )),
@@ -524,9 +524,9 @@ function Et({
524
524
  ]
525
525
  }
526
526
  ),
527
- children: !H && D.map((f, S) => {
527
+ children: !W && D.map((f, S) => {
528
528
  var Ge;
529
- const pe = String(f[i.field] ?? ""), he = pe.slice(pe.lastIndexOf(N) + N.length), nt = ((Ge = x[0]) == null ? void 0 : Ge.field) === i.field ? he : void 0;
529
+ const ce = String(f[i.field] ?? ""), pe = ce.slice(ce.lastIndexOf(N) + N.length), nt = ((Ge = x[0]) == null ? void 0 : Ge.field) === i.field ? pe : void 0;
530
530
  return re(f, `${C}-${S}`, 2, nt);
531
531
  })
532
532
  },
@@ -542,7 +542,7 @@ function Et({
542
542
  _e = [...r.map((l, n) => re(l, `flat-${n}`)), ...d];
543
543
  } else
544
544
  _e = $.map((e, r) => re(e, String(r)));
545
- const lt = (e) => e.startsCollapsed ? v.has(e.key) : !v.has(e.key), me = Q.length > 0 && Q.every(lt), st = (e) => L(
545
+ const lt = (e) => e.startsCollapsed ? v.has(e.key) : !v.has(e.key), be = Q.length > 0 && Q.every(lt), st = (e) => L(
546
546
  new Set(
547
547
  Q.filter((r) => e ? r.startsCollapsed : !r.startsCollapsed).map((r) => r.key)
548
548
  )
@@ -550,12 +550,12 @@ function Et({
550
550
  "button",
551
551
  {
552
552
  type: "button",
553
- "data-query-tree-toggle": me ? "collapse" : "expand",
554
- onClick: () => st(!me),
553
+ "data-query-tree-toggle": be ? "collapse" : "expand",
554
+ onClick: () => st(!be),
555
555
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-2 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 hover:text-slate-800 dark:border-border dark:text-slate-300 dark:hover:bg-muted dark:hover:text-slate-100",
556
556
  children: [
557
- me ? /* @__PURE__ */ o(mt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ o(ct, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
558
- me ? "Collapse all" : "Expand all"
557
+ be ? /* @__PURE__ */ o(mt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ o(ct, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
558
+ be ? "Collapse all" : "Expand all"
559
559
  ]
560
560
  }
561
561
  ) : null, ot = typeof (t == null ? void 0 : t.export_csv) == "object" && t.export_csv.filename ? t.export_csv.filename : "export.csv", Me = t != null && t.search || t != null && t.export_csv || Z.length > 0 ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-2", children: [
@@ -571,7 +571,7 @@ function Et({
571
571
  "input",
572
572
  {
573
573
  type: "search",
574
- value: A,
574
+ value: J,
575
575
  onChange: (e) => w(e.target.value),
576
576
  placeholder: "Search rows",
577
577
  "aria-label": "Search rows",
@@ -591,7 +591,7 @@ function Et({
591
591
  children: ((Ke = t == null ? void 0 : t.hide_empty) == null ? void 0 : Ke.label) ?? "Hide empty rows"
592
592
  }
593
593
  ),
594
- (ie || z && Z.length > 0) && /* @__PURE__ */ p(
594
+ (de || z && Z.length > 0) && /* @__PURE__ */ p(
595
595
  "span",
596
596
  {
597
597
  className: "text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400",
@@ -615,7 +615,7 @@ function Et({
615
615
  x.filter((e) => xe(e) || !e.field),
616
616
  $,
617
617
  T,
618
- (e) => e.label ?? le(e.field ?? "")
618
+ (e) => e.label ?? ae(e.field ?? "")
619
619
  )
620
620
  ),
621
621
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-2 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 hover:text-slate-800 dark:border-border dark:text-slate-300 dark:hover:bg-muted dark:hover:text-slate-100",
@@ -652,8 +652,8 @@ function Et({
652
652
  "button",
653
653
  {
654
654
  type: "button",
655
- onClick: () => K(e),
656
- className: `rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${se === e ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
655
+ onClick: () => A(e),
656
+ className: `rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${le === e ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
657
657
  children: e === "month" ? "Monthly" : "Quarterly"
658
658
  },
659
659
  e
@@ -681,7 +681,7 @@ function Et({
681
681
  {
682
682
  rowSpan: 2,
683
683
  className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 align-bottom text-[10.5px] font-semibold uppercase tracking-wider text-slate-500 dark:border-border dark:text-slate-400 ${U(a) ? "text-right" : "text-left"} ${Ue(r)}`,
684
- children: a.label ?? le(a.field ?? "")
684
+ children: a.label ?? ae(a.field ?? "")
685
685
  },
686
686
  `u-${a.field ?? r}`
687
687
  )
@@ -696,7 +696,7 @@ function Et({
696
696
  "th",
697
697
  {
698
698
  colSpan: d,
699
- className: `whitespace-nowrap border-b border-slate-100 py-1 pr-3 text-center text-[11px] font-semibold dark:border-border/60 ${a.group === ne ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : `text-slate-600 dark:text-slate-300 ${we(r)}`} ${_ ? "sticky top-0 z-[2] bg-white dark:bg-card" : ""}`.trim(),
699
+ className: `whitespace-nowrap border-b border-slate-100 py-1 pr-3 text-center text-[11px] font-semibold dark:border-border/60 ${a.group === oe ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : `text-slate-600 dark:text-slate-300 ${we(r)}`} ${_ ? "sticky top-0 z-[2] bg-white dark:bg-card" : ""}`.trim(),
700
700
  children: a.group
701
701
  },
702
702
  `g-${a.group}-${r}`
@@ -711,7 +711,7 @@ function Et({
711
711
  rowSpan: 2,
712
712
  "aria-label": "Actions",
713
713
  "data-qt-actions-head": "",
714
- className: `border-b border-slate-200 dark:border-border ${_ ? `sticky right-0 top-0 z-[3] ${be} bg-white dark:bg-card` : ""}`
714
+ className: `border-b border-slate-200 dark:border-border ${_ ? `sticky right-0 top-0 z-[3] ${ue} bg-white dark:bg-card` : ""}`
715
715
  }
716
716
  )
717
717
  ] }),
@@ -719,8 +719,8 @@ function Et({
719
719
  (e, r) => e.group ? /* @__PURE__ */ o(
720
720
  "th",
721
721
  {
722
- className: `min-w-[58px] whitespace-nowrap border-b border-slate-200 py-1 pr-3 ${G(r)} text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400 ${U(e) ? "text-right" : "text-left"} ${de(e) || we(r)} ${_ ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
723
- children: e.label ?? le(e.field ?? "")
722
+ className: `min-w-[58px] whitespace-nowrap border-b border-slate-200 py-1 pr-3 ${G(r)} text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400 ${U(e) ? "text-right" : "text-left"} ${ne(e) || we(r)} ${_ ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
723
+ children: e.label ?? ae(e.field ?? "")
724
724
  },
725
725
  e.field ?? e.label ?? r
726
726
  ) : null
@@ -740,11 +740,11 @@ function Et({
740
740
  onClick: () => rt(ee(e, r)),
741
741
  className: `inline-flex items-center gap-0.5 font-semibold uppercase tracking-wider hover:text-slate-800 dark:hover:text-slate-100 ${U(e) ? "flex-row-reverse" : ""}`,
742
742
  children: [
743
- e.label ?? le(e.field ?? ""),
743
+ e.label ?? ae(e.field ?? ""),
744
744
  (q == null ? void 0 : q.key) === ee(e, r) && (q.dir === 1 ? /* @__PURE__ */ o(ut, { className: "h-3 w-3", "aria-hidden": !0 }) : /* @__PURE__ */ o(bt, { className: "h-3 w-3", "aria-hidden": !0 }))
745
745
  ]
746
746
  }
747
- ) : e.label ?? le(e.field ?? ""),
747
+ ) : e.label ?? ae(e.field ?? ""),
748
748
  e.stack && (t == null ? void 0 : t.stack_legend) && /* @__PURE__ */ p(
749
749
  "span",
750
750
  {
@@ -777,7 +777,7 @@ function Et({
777
777
  {
778
778
  "aria-label": "Actions",
779
779
  "data-qt-actions-head": "",
780
- className: _ ? `sticky right-0 top-0 z-[3] ${be} bg-white dark:bg-card` : void 0
780
+ className: _ ? `sticky right-0 top-0 z-[3] ${ue} bg-white dark:bg-card` : void 0
781
781
  }
782
782
  )
783
783
  ] }) }),
@@ -786,21 +786,21 @@ function Et({
786
786
  x.map((e, r) => /* @__PURE__ */ o(
787
787
  "td",
788
788
  {
789
- className: `whitespace-nowrap py-1.5 pr-3 ${G(r)} ${ke(e, "")} ${U(e) ? "text-right tabular-nums" : ""} ${de(e)} ${_ ? `sticky bottom-0 border-t border-slate-300 dark:border-border ${r === 0 ? `left-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "z-[2] bg-white dark:bg-card"}` : ""}`,
789
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(r)} ${ke(e, "")} ${U(e) ? "text-right tabular-nums" : ""} ${ne(e)} ${_ ? `sticky bottom-0 border-t border-slate-300 dark:border-border ${r === 0 ? `left-0 z-[3] ${te} bg-slate-50 dark:bg-muted` : "z-[2] bg-white dark:bg-card"}` : ""}`,
790
790
  style: X(
791
791
  e,
792
792
  Number(
793
793
  e.formula ? j(e.formula, B) : B[e.field ?? ""]
794
794
  )
795
795
  ),
796
- children: r === 0 && !e.sum && !e.formula ? "Total" : e.sum || e.formula ? e.formula ? J(j(e.formula, B), e.format) : ue(B, e) : ""
796
+ children: r === 0 && !e.sum && !e.formula ? "Total" : e.sum || e.formula ? e.formula ? H(j(e.formula, B), e.format) : ie(B, e) : ""
797
797
  },
798
798
  e.field ?? e.label ?? r
799
799
  )),
800
800
  u && /* @__PURE__ */ o(
801
801
  "td",
802
802
  {
803
- className: `py-1.5 pr-3 text-right ${_ ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${be} bg-white dark:border-border dark:bg-card` : ""}`,
803
+ className: `py-1.5 pr-3 text-right ${_ ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${ue} bg-white dark:border-border dark:bg-card` : ""}`,
804
804
  children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1.5", children: u.map((e) => /* @__PURE__ */ o(
805
805
  "button",
806
806
  {
@@ -818,7 +818,7 @@ function Et({
818
818
  ] })
819
819
  }
820
820
  ),
821
- oe.canScrollRight && // More columns to the right: fade the edge so readers know the
821
+ se.canScrollRight && // More columns to the right: fade the edge so readers know the
822
822
  // table scrolls sideways (the native scrollbar is often invisible).
823
823
  /* @__PURE__ */ o(
824
824
  "div",
@@ -826,7 +826,7 @@ function Et({
826
826
  "aria-hidden": !0,
827
827
  "data-qt-scroll-cue": "",
828
828
  className: "pointer-events-none absolute top-0 w-10 bg-gradient-to-r from-transparent to-white dark:to-card",
829
- style: { right: oe.cueInset.right, bottom: oe.cueInset.bottom }
829
+ style: { right: se.cueInset.right, bottom: se.cueInset.bottom }
830
830
  }
831
831
  )
832
832
  ] })