@nivaro/react 0.3.50 → 0.3.51

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 (29) hide show
  1. package/dist/hooks/useSessionRecorder.js +1 -1
  2. package/dist/index.d.ts +13 -3
  3. package/dist/shared/components/ItemEditForm.js +4720 -4593
  4. package/dist/shared/components/QueryTable.js +337 -324
  5. package/dist/shared/components/ReportView.js +105 -99
  6. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  7. package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
  8. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  9. package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
  10. package/dist/shared/components/item-edit/FieldRow.js +287 -265
  11. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  12. package/dist/shared/components/item-edit/InlineTableField.js +491 -466
  13. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  14. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  15. package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
  16. package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
  17. package/dist/shared/components/item-edit/UserChip.js +233 -200
  18. package/dist/shared/components/item-edit/header-midair.js +51 -0
  19. package/dist/shared/components/item-edit/line-midair.js +76 -70
  20. package/dist/shared/components/panels/CommentPanel.js +290 -284
  21. package/dist/shared/components/panels/ItemLockBanner.js +30 -30
  22. package/dist/shared/components/panels/PipelinePanel.js +956 -901
  23. package/dist/shared/components/panels/TaskPanel.js +71 -61
  24. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  25. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  26. package/dist/shared/components/queue/QueueWorklist.js +141 -130
  27. package/dist/shared/lib/draft-store.js +48 -34
  28. package/dist/shared/lib/query-stats.js +60 -60
  29. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import { jsx as s, jsxs as p, Fragment as Pe } from "react/jsx-runtime";
2
- import { Search as dt, Download as it, ArrowUp as ut, ArrowDown as bt, ChevronsDownUp as mt, ChevronsUpDown as pt } from "lucide-react";
3
- import { useState as I, useEffect as ct, useMemo as ht } from "react";
1
+ import { jsx as o, jsxs as p, Fragment as Pe } from "react/jsx-runtime";
2
+ import { Search as dt, Download as it, ArrowUp as ut, ArrowDown as mt, ChevronsDownUp as bt, ChevronsUpDown as ct } from "lucide-react";
3
+ import { useState as W, useEffect as pt, useMemo as ht } from "react";
4
4
  import { evaluateNumeric as xt } from "../lib/expression.js";
5
- function ft(o) {
6
- return `color-mix(in srgb, ${o} 55%, white)`;
5
+ function ft(s) {
6
+ return `color-mix(in srgb, ${s} 55%, white)`;
7
7
  }
8
8
  const Se = {
9
9
  // Brand ink for TEXT: the raw brand (cyan on white ≈ 1.6:1) is a fill
@@ -19,12 +19,12 @@ const Se = {
19
19
  warning: ["var(--nvr-role-warning, #b45309)", "var(--nvr-role-warning-dark, #d4936a)"],
20
20
  info: ["var(--nvr-role-info, #4f46e5)", "var(--nvr-role-info-dark, #8fa6c9)"]
21
21
  };
22
- function Ce(o, t) {
23
- var h, f;
24
- const m = Se[o.trim().toLowerCase()];
25
- return m ? [m[0], t ? ((h = Se[t]) == null ? void 0 : h[1]) ?? t : m[1]] : [o, t ? ((f = Se[t]) == null ? void 0 : f[1]) ?? t : ft(o)];
22
+ function Ce(s, t) {
23
+ var c, u;
24
+ const m = Se[s.trim().toLowerCase()];
25
+ return m ? [m[0], t ? ((c = Se[t]) == null ? void 0 : c[1]) ?? t : m[1]] : [s, t ? ((u = Se[t]) == null ? void 0 : u[1]) ?? t : ft(s)];
26
26
  }
27
- const kt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (o) => o === "—" ? /* @__PURE__ */ s("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : kt.test(o) ? /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: o }) : o, Qe = [
27
+ const kt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (s) => s === "—" ? /* @__PURE__ */ o("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : kt.test(s) ? /* @__PURE__ */ o("span", { className: "text-slate-500 dark:text-slate-400", children: s }) : s, Ge = [
28
28
  "jan",
29
29
  "feb",
30
30
  "mar",
@@ -37,7 +37,7 @@ const kt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (o) => o === "—" ? /* @__PURE__ *
37
37
  "oct",
38
38
  "nov",
39
39
  "dec"
40
- ], vt = [
40
+ ], yt = [
41
41
  "Jan",
42
42
  "Feb",
43
43
  "Mar",
@@ -50,79 +50,100 @@ const kt = /^[-+−]?\$?0(?:\.0+)?%?$/, qe = (o) => o === "—" ? /* @__PURE__ *
50
50
  "Oct",
51
51
  "Nov",
52
52
  "Dec"
53
- ];
54
- function yt(o, t, m, h = "month") {
55
- const f = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Set();
56
- for (const u of o) {
57
- const K = t.key_fields.map((T) => String(u[T] ?? "")).join("|");
58
- let S = f.get(K);
59
- if (!S) {
60
- S = {};
61
- for (const T of t.key_fields) S[T] = u[T];
62
- f.set(K, S);
53
+ ], vt = "Undated";
54
+ function Nt(s, t, m, c = "month") {
55
+ const u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set();
56
+ let y = !1;
57
+ for (const h of s) {
58
+ const A = t.key_fields.map((O) => String(h[O] ?? "")).join("|");
59
+ let w = u.get(A);
60
+ if (!w) {
61
+ w = {};
62
+ for (const O of t.key_fields) w[O] = h[O];
63
+ u.set(A, w);
63
64
  }
64
- const he = String(u[t.date_field] ?? ""), L = /^(\d{4})-(\d{2})/.exec(he);
65
- if (!L) continue;
66
- const Q = Number(u[t.value_field]) || 0;
67
- if (Number(L[1]) === m) {
68
- const T = Number(L[2]) - 1, V = h === "quarter" ? `q${Math.floor(T / 3) + 1}` : Qe[T];
69
- V && (S[V] = (Number(S[V]) || 0) + Q);
65
+ const z = String(h[t.date_field] ?? ""), I = /^(\d{4})-(\d{2})/.exec(z);
66
+ if (!I) {
67
+ if (z !== vt) continue;
68
+ const O = Number(h[t.value_field]) || 0;
69
+ y = !0, w.undated = (Number(w.undated) || 0) + O, t.total !== !1 && (w.total = (Number(w.total) || 0) + O);
70
+ continue;
71
+ }
72
+ const V = Number(h[t.value_field]) || 0;
73
+ if (Number(I[1]) === m) {
74
+ const O = Number(I[2]) - 1, k = c === "quarter" ? `q${Math.floor(O / 3) + 1}` : Ge[O];
75
+ k && (w[k] = (Number(w[k]) || 0) + V);
70
76
  } else
71
- F.add(L[1]), S[`y${L[1]}`] = (Number(S[`y${L[1]}`]) || 0) + Q;
72
- t.total !== !1 && (S.total = (Number(S.total) || 0) + Q);
77
+ g.add(I[1]), w[`y${I[1]}`] = (Number(w[`y${I[1]}`]) || 0) + V;
78
+ t.total !== !1 && (w.total = (Number(w.total) || 0) + V);
73
79
  }
74
- const y = [...F].filter((u) => Number(u) < m).sort(), g = [...F].filter((u) => Number(u) > m).sort(), R = h === "quarter" ? [1, 2, 3, 4].map((u) => ({
75
- field: `q${u}`,
76
- label: `Q${u}`,
80
+ const v = [...g].filter((h) => Number(h) < m).sort(), L = [...g].filter((h) => Number(h) > m).sort(), se = c === "quarter" ? [1, 2, 3, 4].map((h) => ({
81
+ field: `q${h}`,
82
+ label: `Q${h}`,
77
83
  format: "currency",
78
84
  sum: !0
79
- })) : Qe.map((u, K) => ({
80
- field: u,
81
- label: vt[K],
85
+ })) : Ge.map((h, A) => ({
86
+ field: h,
87
+ label: yt[A],
82
88
  format: "currency",
83
89
  sum: !0
84
- })), H = t.color ? { color: t.color, color_negative: t.color_negative } : {}, ce = [
85
- ...y.map((u) => ({
86
- field: `y${u}`,
87
- label: u,
90
+ })), K = t.color ? { color: t.color, color_negative: t.color_negative } : {}, q = [
91
+ ...v.map((h) => ({
92
+ field: `y${h}`,
93
+ label: h,
88
94
  format: "currency",
89
95
  sum: !0,
90
- ...H
96
+ ...K
91
97
  })),
92
- ...R.map((u) => ({ ...u, ...H })),
93
- ...g.map((u) => ({
94
- field: `y${u}`,
95
- label: u,
98
+ ...se.map((h) => ({ ...h, ...K })),
99
+ ...L.map((h) => ({
100
+ field: `y${h}`,
101
+ label: h,
96
102
  format: "currency",
97
103
  sum: !0,
98
- ...H
104
+ ...K
99
105
  })),
106
+ ...y ? [{ field: "undated", label: "Undated", format: "currency", sum: !0, ...K }] : [],
100
107
  ...t.total !== !1 ? [
101
108
  {
102
109
  field: "total",
103
110
  label: "Total",
104
111
  format: "currency",
105
112
  sum: !0,
106
- ...t.total_color ? { color: t.total_color, color_negative: t.color_negative } : H
113
+ ...t.total_color ? { color: t.total_color, color_negative: t.color_negative } : K
107
114
  }
108
115
  ] : []
109
116
  ];
110
- return { rows: [...f.values()], columns: ce };
117
+ return { rows: [...u.values()], columns: q };
118
+ }
119
+ const gt = (s) => s != null && s !== "" && Number.isFinite(Number(s));
120
+ function wt(s, t) {
121
+ const m = {}, c = (u, g) => {
122
+ let y = !1, v = 0;
123
+ for (const L of s)
124
+ gt(L[u]) && (y = !0, v += Number(L[u]));
125
+ m[u] = y || !g || m[u] === 0 ? v : null;
126
+ };
127
+ for (const u of t) {
128
+ const g = u.null_when_empty ?? u.format === "currency";
129
+ u.field && c(u.field, g), u.stack && c(u.stack, g);
130
+ }
131
+ return m;
111
132
  }
112
- function J(o, t) {
113
- return xt(o, t);
133
+ function j(s, t) {
134
+ return xt(s, t);
114
135
  }
115
- function re(o, t) {
116
- if (o == null || o === "") return "—";
117
- const m = Number(o);
118
- if (!Number.isFinite(m)) return String(o);
136
+ function ae(s, t) {
137
+ if (s == null || s === "") return "—";
138
+ const m = Number(s);
139
+ if (!Number.isFinite(m)) return String(s);
119
140
  switch (t) {
120
141
  case "currency": {
121
- const h = Number.isInteger(m);
142
+ const c = Number.isInteger(m);
122
143
  return m.toLocaleString("en-US", {
123
144
  style: "currency",
124
145
  currency: "USD",
125
- minimumFractionDigits: h ? 0 : 2,
146
+ minimumFractionDigits: c ? 0 : 2,
126
147
  maximumFractionDigits: 2
127
148
  });
128
149
  }
@@ -131,53 +152,53 @@ function re(o, t) {
131
152
  case "number":
132
153
  return m.toLocaleString("en-US", { maximumFractionDigits: 2 });
133
154
  default:
134
- return String(o);
155
+ return String(s);
135
156
  }
136
157
  }
137
- function ae(o) {
138
- return o.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase());
158
+ function le(s) {
159
+ return s.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase());
139
160
  }
140
- function qt({
141
- rows: o,
161
+ function Lt({
162
+ rows: s,
142
163
  config: t,
143
164
  onRowClick: m,
144
- pivotYear: h,
145
- rowActions: f,
146
- emptyLabel: F,
165
+ pivotYear: c,
166
+ rowActions: u,
167
+ emptyLabel: g,
147
168
  emptyText: y
148
169
  }) {
149
- var Re, Ue, ze, Ie, He, We, Je, Ke, je, Ae;
150
- const [g, R] = I(() => /* @__PURE__ */ new Set()), [H, ce] = I("month"), [u, K] = I(null), [S, he] = I(""), [L, Q] = I(!!((Re = t == null ? void 0 : t.hide_empty) != null && Re.default_on)), [T, V] = I(
170
+ var De, Re, ze, Ie, He, We, Ke, Ae, Je, je;
171
+ const [v, L] = W(() => /* @__PURE__ */ new Set()), [se, K] = W("month"), [q, h] = W(null), [A, w] = W(""), [z, I] = W(!!((De = t == null ? void 0 : t.hide_empty) != null && De.default_on)), [V, O] = W(
151
172
  () => new Set(((t == null ? void 0 : t.toggles) ?? []).filter((e) => e.default_on === !1).map((e) => e.label))
152
- ), [v, Ye] = I(null), [le, Xe] = I({
173
+ ), [k, Ye] = W(null), [oe, Xe] = W({
153
174
  overflows: !1,
154
175
  canScrollRight: !1,
155
176
  cueInset: { right: 0, bottom: 0 }
156
177
  });
157
- if (ct(() => {
158
- if (!v) return;
178
+ if (pt(() => {
179
+ if (!k) return;
159
180
  const e = () => {
160
- const a = v.scrollWidth > v.clientWidth + 1, n = v.scrollWidth > v.clientWidth + v.scrollLeft + 1, l = v.querySelector("[data-qt-actions-head]"), d = t != null && t.sticky && l ? l.offsetWidth : 0, b = v.offsetWidth - v.clientWidth + d, C = v.offsetHeight - v.clientHeight;
181
+ const a = k.scrollWidth > k.clientWidth + 1, n = k.scrollWidth > k.clientWidth + k.scrollLeft + 1, l = k.querySelector("[data-qt-actions-head]"), d = t != null && t.sticky && l ? l.offsetWidth : 0, b = k.offsetWidth - k.clientWidth + d, F = k.offsetHeight - k.clientHeight;
161
182
  Xe(
162
- (D) => D.overflows === a && D.canScrollRight === n && D.cueInset.right === b && D.cueInset.bottom === C ? D : { overflows: a, canScrollRight: n, cueInset: { right: b, bottom: C } }
183
+ (D) => D.overflows === a && D.canScrollRight === n && D.cueInset.right === b && D.cueInset.bottom === F ? D : { overflows: a, canScrollRight: n, cueInset: { right: b, bottom: F } }
163
184
  );
164
185
  };
165
186
  e();
166
187
  const r = new ResizeObserver(e);
167
- return r.observe(v), v.firstElementChild && r.observe(v.firstElementChild), v.addEventListener("scroll", e, { passive: !0 }), () => {
168
- r.disconnect(), v.removeEventListener("scroll", e);
188
+ return r.observe(k), k.firstElementChild && r.observe(k.firstElementChild), k.addEventListener("scroll", e, { passive: !0 }), () => {
189
+ r.disconnect(), k.removeEventListener("scroll", e);
169
190
  };
170
- }, [v, t == null ? void 0 : t.sticky]), !o || o.length === 0)
171
- return /* @__PURE__ */ s("p", { className: "px-1 py-2 text-[12px] italic text-slate-400", children: y || (F ? `No ${F.toLowerCase()} yet` : "No data") });
191
+ }, [k, t == null ? void 0 : t.sticky]), !s || s.length === 0)
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") });
172
193
  let xe = null;
173
194
  if (t != null && t.pivot) {
174
- const e = h ?? t.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), r = yt(o, t.pivot, e, H);
175
- o = r.rows, xe = r.columns;
195
+ const e = c ?? t.pivot.year ?? (/* @__PURE__ */ new Date()).getFullYear(), r = Nt(s, t.pivot, e, se);
196
+ s = r.rows, xe = r.columns;
176
197
  }
177
- let $ = o;
198
+ let S = s;
178
199
  if (t != null && t.group_by) {
179
200
  const e = t.group_by, r = /* @__PURE__ */ new Map();
180
- for (const a of o) {
201
+ for (const a of s) {
181
202
  const n = String(a[e] ?? "—"), l = r.get(n);
182
203
  if (!l) {
183
204
  r.set(n, { ...a, [e]: n });
@@ -185,34 +206,34 @@ function qt({
185
206
  }
186
207
  for (const [d, b] of Object.entries(a)) {
187
208
  if (d === e) continue;
188
- const C = Number(b);
189
- Number.isFinite(C) && typeof b != "boolean" && (l[d] = (Number(l[d]) || 0) + C);
209
+ const F = Number(b);
210
+ Number.isFinite(F) && typeof b != "boolean" && (l[d] = (Number(l[d]) || 0) + F);
190
211
  }
191
212
  }
192
- $ = [...r.entries()].sort(([a], [n]) => a.localeCompare(n)).map(([, a]) => a);
213
+ S = [...r.entries()].sort(([a], [n]) => a.localeCompare(n)).map(([, a]) => a);
193
214
  }
194
215
  const Fe = xe ? [
195
216
  // Key columns first (configured, else the pivot's key fields), then
196
217
  // the generated year/month/total columns.
197
- ...(Ue = t == null ? void 0 : t.columns) != null && Ue.length ? t.columns : (((ze = t == null ? void 0 : t.pivot) == null ? void 0 : ze.key_fields) ?? []).map((e) => ({ field: e })),
218
+ ...(Re = t == null ? void 0 : t.columns) != null && Re.length ? t.columns : (((ze = t == null ? void 0 : t.pivot) == null ? void 0 : ze.key_fields) ?? []).map((e) => ({ field: e })),
198
219
  ...xe
199
- ] : t != null && t.columns && t.columns.length > 0 ? t.columns : Object.keys($[0]).map((e) => ({ field: e })), P = /* @__PURE__ */ new Set();
220
+ ] : t != null && t.columns && t.columns.length > 0 ? t.columns : Object.keys(S[0]).map((e) => ({ field: e })), Y = /* @__PURE__ */ new Set();
200
221
  {
201
222
  const e = [];
202
223
  for (const r of Fe)
203
224
  r.field && e.push(r.field), r.stack && e.push(r.stack);
204
225
  for (const r of (t == null ? void 0 : t.toggles) ?? []) {
205
- const a = !T.has(r.label);
226
+ const a = !V.has(r.label);
206
227
  if (r.hide_when_on ? a : !a)
207
228
  for (const l of e)
208
- ((Ie = r.fields) != null && Ie.includes(l) || r.suffix && l.endsWith(r.suffix)) && P.add(l);
229
+ ((Ie = r.fields) != null && Ie.includes(l) || r.suffix && l.endsWith(r.suffix)) && Y.add(l);
209
230
  }
210
231
  }
211
- const x = Fe.filter((e) => {
232
+ const f = Fe.filter((e) => {
212
233
  if (!e.field) return !0;
213
- const r = P.has(e.field), a = e.stack ? P.has(e.stack) : !0;
234
+ const r = Y.has(e.field), a = e.stack ? Y.has(e.stack) : !0;
214
235
  return !(r && a);
215
- }), fe = (e) => !!e.field && !P.has(e.field), Le = (e) => !!e.stack && !P.has(e.stack), Ze = [
236
+ }), fe = (e) => !!e.field && !Y.has(e.field), Ee = (e) => !!e.stack && !Y.has(e.stack), Ze = [
216
237
  "Jan",
217
238
  "Feb",
218
239
  "Mar",
@@ -225,95 +246,85 @@ function qt({
225
246
  "Oct",
226
247
  "Nov",
227
248
  "Dec"
228
- ], se = (t == null ? void 0 : t.highlight_group) === "$current_month" ? Ze[(/* @__PURE__ */ new Date()).getMonth()] : (t == null ? void 0 : t.highlight_group) ?? null, Ee = (e) => !!se && (e.group === se || !e.group && e.label === se), oe = (e) => Ee(e) ? "bg-[#6366f10f] dark:bg-[#a5b4fc12]" : "", Y = (e, r) => {
249
+ ], ne = (t == null ? void 0 : t.highlight_group) === "$current_month" ? Ze[(/* @__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) => {
229
250
  if (!e.color) return;
230
251
  const a = e.color_negative && typeof r == "number" && r < 0, [n, l] = a ? Ce(e.color_negative) : Ce(e.color, e.color_dark);
231
252
  return { "--qtc": n, "--qtcd": l };
232
- }, ke = (e, r) => e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : r, ve = (e) => {
253
+ }, ke = (e, r) => e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : r, ye = (e) => {
233
254
  if (!e.stack_color) return;
234
255
  const [r, a] = Ce(e.stack_color, e.stack_color_dark);
235
256
  return { "--qts": r, "--qtsd": a };
236
- }, E = (e, r) => r.formula ? J(r.formula, e) : r.field ? e[r.field] : null, et = ht(() => {
257
+ }, T = (e, r) => r.formula ? j(r.formula, e) : r.field ? e[r.field] : null, et = ht(() => {
237
258
  const e = /* @__PURE__ */ new Map();
238
259
  for (const r of (t == null ? void 0 : t.columns) ?? [])
239
260
  !r.percent_of_total || !r.field || e.set(
240
261
  r.field,
241
- o.reduce((a, n) => a + (Number(n[r.field]) || 0), 0)
262
+ s.reduce((a, n) => a + (Number(n[r.field]) || 0), 0)
242
263
  );
243
264
  return e;
244
- }, [o, t]), tt = (e, r) => {
245
- const a = Number(E(e, r)), n = r.progress_max ? r.progress_max.includes("{{") ? J(r.progress_max, e) : Number(e[r.progress_max]) : null, l = n && Number.isFinite(n) && n > 0 && Number.isFinite(a) ? a / n * 100 : null;
265
+ }, [s, t]), tt = (e, r) => {
266
+ const a = Number(T(e, r)), n = r.progress_max ? r.progress_max.includes("{{") ? j(r.progress_max, e) : Number(e[r.progress_max]) : null, l = n && Number.isFinite(n) && n > 0 && Number.isFinite(a) ? a / n * 100 : null;
246
267
  return /* @__PURE__ */ p(
247
268
  "div",
248
269
  {
249
270
  className: "flex min-w-[130px] items-center justify-end gap-1.5",
250
- title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${re(n, r.format)}`,
271
+ title: l === null ? void 0 : `${l.toLocaleString("en-US", { maximumFractionDigits: 1 })}% of ${ae(n, r.format)}`,
251
272
  children: [
252
- /* @__PURE__ */ s("span", { children: re(E(e, r), r.format) }),
253
- /* @__PURE__ */ s("div", { className: "h-1 w-10 shrink-0 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ s(
273
+ /* @__PURE__ */ o("span", { children: ae(T(e, r), r.format) }),
274
+ /* @__PURE__ */ o("div", { className: "h-1 w-10 shrink-0 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ o(
254
275
  "div",
255
276
  {
256
277
  className: `h-full rounded-full ${l !== null && l > 100 ? "bg-red-500" : "bg-nvr-cyan"}`,
257
278
  style: { width: `${l === null ? 0 : Math.min(l, 100)}%` }
258
279
  }
259
280
  ) }),
260
- /* @__PURE__ */ s("span", { className: "w-9 shrink-0 text-right text-[10px] tabular-nums text-slate-400", children: l === null ? "—" : `${l.toLocaleString("en-US", { maximumFractionDigits: 0 })}%` })
281
+ /* @__PURE__ */ o("span", { className: "w-9 shrink-0 text-right text-[10px] tabular-nums text-slate-400", children: l === null ? "—" : `${l.toLocaleString("en-US", { maximumFractionDigits: 0 })}%` })
261
282
  ]
262
283
  }
263
284
  );
264
- }, X = ((He = t == null ? void 0 : t.hide_empty) == null ? void 0 : He.fields) ?? [];
265
- X.length > 0 && L && ($ = $.filter(
266
- (e) => X.some((r) => {
285
+ }, Z = ((He = t == null ? void 0 : t.hide_empty) == null ? void 0 : He.fields) ?? [];
286
+ Z.length > 0 && z && (S = S.filter(
287
+ (e) => Z.some((r) => {
267
288
  const a = e[r];
268
289
  return a != null && a !== "" && Number(a) !== 0;
269
290
  })
270
291
  ));
271
- const ne = t != null && t.search ? S.trim().toLowerCase() : "";
272
- ne && ($ = $.filter(
273
- (e) => x.some((r) => {
274
- const a = E(e, r);
275
- return a == null || a === "" ? !1 : String(a).toLowerCase().includes(ne) || re(a, r.format).toLowerCase().includes(ne);
292
+ const ie = t != null && t.search ? A.trim().toLowerCase() : "";
293
+ ie && (S = S.filter(
294
+ (e) => f.some((r) => {
295
+ const a = T(e, r);
296
+ return a == null || a === "" ? !1 : String(a).toLowerCase().includes(ie) || ae(a, r.format).toLowerCase().includes(ie);
276
297
  })
277
298
  ));
278
- const ye = !!(t != null && t.sortable) && !(t != null && t.tree_group_by), Z = (e, r) => e.field ?? e.label ?? String(r);
279
- if (ye && u) {
280
- const e = x.findIndex((a, n) => Z(a, n) === u.key), r = e >= 0 ? x[e] : null;
281
- r && ($ = [...$].sort(
282
- (a, n) => gt(E(a, r), E(n, r), u.dir)
299
+ const ve = !!(t != null && t.sortable) && !(t != null && t.tree_group_by), ee = (e, r) => e.field ?? e.label ?? String(r);
300
+ if (ve && q) {
301
+ const e = f.findIndex((a, n) => ee(a, n) === q.key), r = e >= 0 ? f[e] : null;
302
+ r && (S = [...S].sort(
303
+ (a, n) => $t(T(a, r), T(n, r), q.dir)
283
304
  ));
284
305
  }
285
- const rt = (e) => K(
306
+ const rt = (e) => h(
286
307
  (r) => !r || r.key !== e ? { key: e, dir: 1 } : r.dir === 1 ? { key: e, dir: -1 } : null
287
308
  );
288
- let j = null;
289
- if (t != null && t.totals) {
290
- const e = {}, r = (a) => {
291
- e[a] = $.reduce((n, l) => {
292
- const d = Number(l[a]);
293
- return Number.isFinite(d) ? n + d : n;
294
- }, 0);
295
- };
296
- for (const a of x)
297
- a.field && r(a.field), a.stack && r(a.stack);
298
- j = e;
299
- }
300
- const O = (e) => e.format && e.format !== "text", ge = (e, r) => {
301
- if (!(t != null && t.row_format_field) || !O(r)) return r.format;
309
+ let B = null;
310
+ t != null && t.totals && (B = wt(S, f));
311
+ const M = (e) => e.format && e.format !== "text", Ne = (e, r) => {
312
+ if (!(t != null && t.row_format_field) || !M(r)) return r.format;
302
313
  const a = e[t.row_format_field];
303
314
  return a === "currency" || a === "number" ? a : r.format;
304
- }, W = (e, r) => t != null && t.zero_dash && Number(e) === 0 ? "—" : re(e, r), de = (e, r) => {
315
+ }, J = (e, r) => t != null && t.zero_dash && Number(e) === 0 ? "—" : ae(e, r), ue = (e, r) => {
305
316
  var n;
306
317
  if ((n = r.sparkline_fields) != null && n.length) {
307
- const l = r.sparkline_fields.map((i) => Number(e[i]) || 0), d = Math.max(...l, 1), b = Math.min(...l, 0), C = Math.max(d - b, 1), D = l.map(
308
- (i, k) => `${k / Math.max(l.length - 1, 1) * 60},${17 - (i - b) / C * 15}`
318
+ const l = r.sparkline_fields.map((i) => Number(e[i]) || 0), d = Math.max(...l, 1), b = Math.min(...l, 0), F = Math.max(d - b, 1), D = l.map(
319
+ (i, N) => `${N / Math.max(l.length - 1, 1) * 60},${17 - (i - b) / F * 15}`
309
320
  ).join(" ");
310
- return /* @__PURE__ */ s(
321
+ return /* @__PURE__ */ o(
311
322
  "svg",
312
323
  {
313
324
  viewBox: "0 0 60 18",
314
325
  className: "inline-block h-[18px] w-[60px]",
315
- "data-tip": l.map((i) => re(i, r.format)).join(" · "),
316
- children: /* @__PURE__ */ s(
326
+ "data-tip": l.map((i) => ae(i, r.format)).join(" · "),
327
+ children: /* @__PURE__ */ o(
317
328
  "polyline",
318
329
  {
319
330
  points: D,
@@ -327,9 +338,9 @@ function qt({
327
338
  );
328
339
  }
329
340
  if (r.percent_of_total && r.field) {
330
- const l = Number(E(e, r)), d = et.get(r.field) ?? 0, b = d > 0 && Number.isFinite(l) ? l / d * 100 : null;
341
+ const l = Number(T(e, r)), d = et.get(r.field) ?? 0, b = d > 0 && Number.isFinite(l) ? l / d * 100 : null;
331
342
  return /* @__PURE__ */ p("span", { className: "inline-flex items-baseline gap-1", children: [
332
- W(E(e, r), r.format),
343
+ J(T(e, r), r.format),
333
344
  b != null && /* @__PURE__ */ p("span", { className: "text-[9.5px] text-slate-400", children: [
334
345
  b.toLocaleString("en-US", { maximumFractionDigits: 1 }),
335
346
  "%"
@@ -338,25 +349,25 @@ function qt({
338
349
  }
339
350
  if (r.display === "progress") return tt(e, r);
340
351
  if (r.stack)
341
- return /* @__PURE__ */ p("span", { className: "inline-flex flex-col items-end leading-[15px]", style: ve(r), children: [
342
- fe(r) && /* @__PURE__ */ s("span", { children: qe(W(E(e, r), ge(e, r))) }),
343
- Le(r) && /* @__PURE__ */ s(
352
+ return /* @__PURE__ */ p("span", { className: "inline-flex flex-col items-end leading-[15px]", style: ye(r), children: [
353
+ fe(r) && /* @__PURE__ */ o("span", { children: qe(J(T(e, r), Ne(e, r))) }),
354
+ Ee(r) && /* @__PURE__ */ o(
344
355
  "span",
345
356
  {
346
357
  className: `text-[10.5px] ${r.stack_color ? "text-[color:var(--qts)] dark:text-[color:var(--qtsd)]" : "text-slate-400"}`,
347
- children: qe(W(e[r.stack], ge(e, r)))
358
+ children: qe(J(e[r.stack], Ne(e, r)))
348
359
  }
349
360
  )
350
361
  ] });
351
- const a = E(e, r);
352
- return r.empty_label !== void 0 && (a == null || a === "") ? r.empty_label ? /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: r.empty_label }) : null : qe(W(a, ge(e, r)));
353
- }, Oe = x.some((e) => e.group), Ne = [];
362
+ const a = T(e, r);
363
+ 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)));
364
+ }, Oe = f.some((e) => e.group), ge = [];
354
365
  {
355
366
  let e = -1, r;
356
- for (const a of x)
357
- a.group && a.group !== r && e++, Ne.push(a.group ? e : -1), r = a.group;
367
+ for (const a of f)
368
+ a.group && a.group !== r && e++, ge.push(a.group ? e : -1), r = a.group;
358
369
  }
359
- const we = (e) => Oe && Ne[e] >= 0 && Ne[e] % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/20" : "", N = !!(t != null && t.sticky), ee = "border-r border-slate-200 dark:border-border", at = (e, r) => N && e === 0 ? `sticky left-0 z-[1] ${ee} ${r}` : "", Me = (e) => N ? e === 0 ? `sticky left-0 top-0 z-[3] ${ee} bg-slate-50 dark:bg-muted` : "sticky top-0 z-[2] bg-white dark:bg-card" : "", A = (e) => N && (e === 0 || e === 1) ? "pl-3" : "", ie = le.overflows ? "border-l border-slate-200 dark:border-border" : "", $e = (e) => N ? `sticky right-0 z-[2] ${ie} ${e}` : "", te = (e, r, a = 0, n) => {
370
+ const we = (e) => Oe && 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}` : "", Te = (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" : "", me = oe.overflows ? "border-l border-slate-200 dark:border-border" : "", $e = (e) => $ ? `sticky right-0 z-[2] ${me} ${e}` : "", re = (e, r, a = 0, n) => {
360
371
  const l = a === !0 ? 1 : a === !1 ? 0 : a;
361
372
  return /* @__PURE__ */ p(
362
373
  "tr",
@@ -364,27 +375,27 @@ function qt({
364
375
  onClick: m ? () => m(e) : void 0,
365
376
  className: `group/qtr border-b border-slate-100 dark:border-border/50 ${m ? "cursor-pointer" : ""} ${l >= 2 ? "bg-sky-50/70 hover:bg-sky-100/60 dark:bg-sky-500/10 dark:hover:bg-sky-500/15" : "hover:bg-slate-50 dark:hover:bg-muted/40"}`,
366
377
  children: [
367
- x.map((d, b) => /* @__PURE__ */ s(
378
+ f.map((d, b) => /* @__PURE__ */ o(
368
379
  "td",
369
380
  {
370
- className: `whitespace-nowrap py-1.5 pr-3 ${d.max_width ? "overflow-hidden text-ellipsis" : ""} ${A(b)} ${ke(d, "text-slate-700 dark:text-slate-200")} ${O(d) ? "text-right tabular-nums" : ""} ${d.group ? "min-w-[58px]" : ""} ${oe(d) || we(b)} ${at(b, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
381
+ className: `whitespace-nowrap py-1.5 pr-3 ${d.max_width ? "overflow-hidden text-ellipsis" : ""} ${G(b)} ${ke(d, "text-slate-700 dark:text-slate-200")} ${M(d) ? "text-right tabular-nums" : ""} ${d.group ? "min-w-[58px]" : ""} ${de(d) || we(b)} ${at(b, "bg-slate-50 group-hover/qtr:bg-slate-100 dark:bg-muted dark:group-hover/qtr:bg-muted")}`,
371
382
  style: {
372
383
  ...l > 0 && b === 0 ? { paddingLeft: 2 + l * 16 } : {},
373
384
  ...d.max_width ? { maxWidth: d.max_width } : {},
374
- ...Y(d, Number(E(e, d))) ?? {}
385
+ ...X(d, Number(T(e, d))) ?? {}
375
386
  },
376
- title: d.max_width ? String(E(e, d) ?? "") : void 0,
377
- children: b === 0 && n !== void 0 ? n : de(e, d)
387
+ title: d.max_width ? String(T(e, d) ?? "") : void 0,
388
+ children: b === 0 && n !== void 0 ? n : ue(e, d)
378
389
  },
379
390
  d.field ?? d.label ?? b
380
391
  )),
381
- f && /* @__PURE__ */ s(
392
+ u && /* @__PURE__ */ o(
382
393
  "td",
383
394
  {
384
395
  className: `py-1 pl-2 pr-3 text-right ${$e(
385
396
  l >= 2 ? "bg-[#f3f9fe] group-hover/qtr:bg-[#e7f3fd] dark:bg-card dark:group-hover/qtr:bg-muted" : "bg-white group-hover/qtr:bg-slate-50 dark:bg-card dark:group-hover/qtr:bg-muted"
386
397
  )}`,
387
- children: /* @__PURE__ */ s("span", { className: "inline-flex flex-nowrap gap-1", children: f.map((d) => /* @__PURE__ */ s(
398
+ children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1", children: u.map((d) => /* @__PURE__ */ o(
388
399
  "button",
389
400
  {
390
401
  type: "button",
@@ -404,124 +415,124 @@ function qt({
404
415
  );
405
416
  };
406
417
  let _e;
407
- const B = [];
418
+ const Q = [];
408
419
  if (t != null && t.tree_group_by) {
409
- const e = t.tree_group_by, r = $.filter((l) => !String(l[e] ?? "").trim()), a = /* @__PURE__ */ new Map();
410
- for (const l of $) {
420
+ const e = t.tree_group_by, r = S.filter((l) => !String(l[e] ?? "").trim()), a = /* @__PURE__ */ new Map();
421
+ for (const l of S) {
411
422
  const d = String(l[e] ?? "").trim();
412
423
  if (!d) continue;
413
424
  const b = a.get(d) ?? [];
414
425
  b.push(l), a.set(d, b);
415
426
  }
416
427
  const n = [...a.entries()].sort(([l], [d]) => l.localeCompare(d)).map(([l, d]) => {
417
- const b = t.tree_collapsed ? !g.has(l) : g.has(l);
418
- B.push({ key: l, startsCollapsed: !!t.tree_collapsed });
419
- const C = { [e]: l }, D = (i) => {
420
- C[i] = d.reduce((k, be) => {
421
- const G = Number(be[i]);
422
- return Number.isFinite(G) ? k + G : k;
428
+ const b = t.tree_collapsed ? !v.has(l) : v.has(l);
429
+ Q.push({ key: l, startsCollapsed: !!t.tree_collapsed });
430
+ const F = { [e]: l }, D = (i) => {
431
+ F[i] = d.reduce((N, ce) => {
432
+ const P = Number(ce[i]);
433
+ return Number.isFinite(P) ? N + P : N;
423
434
  }, 0);
424
435
  };
425
- for (const i of x)
436
+ for (const i of f)
426
437
  i.field && i.field !== e && D(i.field), i.stack && D(i.stack);
427
- return /* @__PURE__ */ s(
428
- Ve,
438
+ return /* @__PURE__ */ o(
439
+ Qe,
429
440
  {
430
441
  header: /* @__PURE__ */ p(
431
442
  "tr",
432
443
  {
433
444
  className: "cursor-pointer border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted",
434
- onClick: () => R((i) => {
435
- const k = new Set(i);
436
- return k.has(l) ? k.delete(l) : k.add(l), k;
445
+ onClick: () => L((i) => {
446
+ const N = new Set(i);
447
+ return N.has(l) ? N.delete(l) : N.add(l), N;
437
448
  }),
438
449
  children: [
439
- x.map((i, k) => /* @__PURE__ */ s(
450
+ f.map((i, N) => /* @__PURE__ */ o(
440
451
  "td",
441
452
  {
442
- className: `whitespace-nowrap py-1.5 pr-3 ${A(k)} text-[11.5px] font-semibold ${ke(i, "text-slate-600 dark:text-slate-300")} ${O(i) ? "text-right tabular-nums" : ""} ${oe(i)} ${N && k === 0 ? `sticky left-0 z-[1] ${ee} bg-slate-100 dark:bg-muted` : ""}`,
443
- style: Y(
453
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(N)} text-[11.5px] font-semibold ${ke(i, "text-slate-600 dark:text-slate-300")} ${M(i) ? "text-right tabular-nums" : ""} ${de(i)} ${$ && N === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100 dark:bg-muted` : ""}`,
454
+ style: X(
444
455
  i,
445
- Number(i.formula ? J(i.formula, C) : C[i.field ?? ""])
456
+ Number(i.formula ? j(i.formula, F) : F[i.field ?? ""])
446
457
  ),
447
- children: k === 0 ? `${b ? "▸" : "▾"} ${l}` : i.formula ? W(J(i.formula, C), i.format) : i.field && i.field !== e && O(i) ? de(C, i) : ""
458
+ children: N === 0 ? `${b ? "▸" : "▾"} ${l}` : i.formula ? J(j(i.formula, F), i.format) : i.field && i.field !== e && M(i) ? ue(F, i) : ""
448
459
  },
449
- i.field ?? i.label ?? k
460
+ i.field ?? i.label ?? N
450
461
  )),
451
- f && /* @__PURE__ */ s("td", { className: $e("bg-slate-100 dark:bg-muted") })
462
+ u && /* @__PURE__ */ o("td", { className: $e("bg-slate-100 dark:bg-muted") })
452
463
  ]
453
464
  }
454
465
  ),
455
466
  children: !b && (() => {
456
467
  const i = t.tree_sub_split;
457
468
  if (!i)
458
- return d.map((q, M) => {
459
- var z;
460
- let _;
461
- if (t.tree_strip_section_prefix && ((z = x[0]) != null && z.field)) {
462
- const U = String(q[x[0].field] ?? "");
463
- U.startsWith(`${l} - `) && (_ = U.slice(l.length + 3));
469
+ return d.map((E, U) => {
470
+ var H;
471
+ let C;
472
+ if (t.tree_strip_section_prefix && ((H = f[0]) != null && H.field)) {
473
+ const R = String(E[f[0].field] ?? "");
474
+ R.startsWith(`${l} - `) && (C = R.slice(l.length + 3));
464
475
  }
465
- return te(q, `${l}-${M}`, 1, _);
476
+ return re(E, `${l}-${U}`, 1, C);
466
477
  });
467
- const k = i.separator ?? " - ", be = [], G = /* @__PURE__ */ new Map();
468
- for (const q of d) {
469
- const M = String(q[i.field] ?? ""), _ = M.lastIndexOf(k);
470
- if (_ <= 0) {
471
- be.push(q);
478
+ const N = i.separator ?? " - ", ce = [], P = /* @__PURE__ */ new Map();
479
+ for (const E of d) {
480
+ const U = String(E[i.field] ?? ""), C = U.lastIndexOf(N);
481
+ if (C <= 0) {
482
+ ce.push(E);
472
483
  continue;
473
484
  }
474
- const z = M.slice(0, _), U = G.get(z) ?? [];
475
- U.push(q), G.set(z, U);
485
+ const H = U.slice(0, C), R = P.get(H) ?? [];
486
+ R.push(E), P.set(H, R);
476
487
  }
477
488
  return [
478
- ...be.map((q, M) => te(q, `${l}-flat-${M}`, 1)),
479
- ...[...G.entries()].sort(([q], [M]) => q.localeCompare(M)).map(([q, M]) => {
480
- const _ = `s:${l}|${q}`;
481
- B.push({
482
- key: _,
489
+ ...ce.map((E, U) => re(E, `${l}-flat-${U}`, 1)),
490
+ ...[...P.entries()].sort(([E], [U]) => E.localeCompare(U)).map(([E, U]) => {
491
+ const C = `s:${l}|${E}`;
492
+ Q.push({
493
+ key: C,
483
494
  startsCollapsed: t.tree_sub_collapsed ?? !0
484
495
  });
485
- const z = t.tree_sub_collapsed ?? !0 ? !g.has(_) : g.has(_), U = {}, Be = (c) => {
486
- U[c] = M.reduce((w, me) => {
487
- const pe = Number(me[c]);
488
- return Number.isFinite(pe) ? w + pe : w;
496
+ const H = t.tree_sub_collapsed ?? !0 ? !v.has(C) : v.has(C), R = {}, Ve = (x) => {
497
+ R[x] = U.reduce((_, pe) => {
498
+ const he = Number(pe[x]);
499
+ return Number.isFinite(he) ? _ + he : _;
489
500
  }, 0);
490
501
  };
491
- for (const c of x)
492
- c.field && c.field !== e && Be(c.field), c.stack && Be(c.stack);
493
- return /* @__PURE__ */ s(
494
- Ve,
502
+ for (const x of f)
503
+ x.field && x.field !== e && Ve(x.field), x.stack && Ve(x.stack);
504
+ return /* @__PURE__ */ o(
505
+ Qe,
495
506
  {
496
507
  header: /* @__PURE__ */ p(
497
508
  "tr",
498
509
  {
499
510
  className: "cursor-pointer border-b border-slate-200/80 bg-slate-100/70 dark:border-border/60 dark:bg-muted/50",
500
- onClick: () => R((c) => {
501
- const w = new Set(c);
502
- return w.has(_) ? w.delete(_) : w.add(_), w;
511
+ onClick: () => L((x) => {
512
+ const _ = new Set(x);
513
+ return _.has(C) ? _.delete(C) : _.add(C), _;
503
514
  }),
504
515
  children: [
505
- x.map((c, w) => /* @__PURE__ */ s(
516
+ f.map((x, _) => /* @__PURE__ */ o(
506
517
  "td",
507
518
  {
508
- className: `whitespace-nowrap py-1.5 pr-3 ${A(w)} text-[11.5px] font-medium text-slate-600 dark:text-slate-300 ${O(c) ? "text-right tabular-nums" : ""} ${N && w === 0 ? `sticky left-0 z-[1] ${ee} bg-slate-100/80 dark:bg-muted` : ""}`,
509
- style: w === 0 ? { paddingLeft: 18 } : void 0,
510
- children: w === 0 ? `${z ? "▸" : "▾"} ${q}` : c.formula ? W(J(c.formula, U), c.format) : c.field && c.field !== e && O(c) ? de(U, c) : ""
519
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(_)} text-[11.5px] font-medium text-slate-600 dark:text-slate-300 ${M(x) ? "text-right tabular-nums" : ""} ${$ && _ === 0 ? `sticky left-0 z-[1] ${te} bg-slate-100/80 dark:bg-muted` : ""}`,
520
+ style: _ === 0 ? { paddingLeft: 18 } : void 0,
521
+ children: _ === 0 ? `${H ? "▸" : "▾"} ${E}` : x.formula ? J(j(x.formula, R), x.format) : x.field && x.field !== e && M(x) ? ue(R, x) : ""
511
522
  },
512
- c.field ?? c.label ?? w
523
+ x.field ?? x.label ?? _
513
524
  )),
514
- f && /* @__PURE__ */ s("td", { className: $e("bg-slate-100 dark:bg-muted") })
525
+ u && /* @__PURE__ */ o("td", { className: $e("bg-slate-100 dark:bg-muted") })
515
526
  ]
516
527
  }
517
528
  ),
518
- children: !z && M.map((c, w) => {
519
- var Ge;
520
- const me = String(c[i.field] ?? ""), pe = me.slice(me.lastIndexOf(k) + k.length), nt = ((Ge = x[0]) == null ? void 0 : Ge.field) === i.field ? pe : void 0;
521
- return te(c, `${_}-${w}`, 2, nt);
529
+ children: !H && U.map((x, _) => {
530
+ var Be;
531
+ const pe = String(x[i.field] ?? ""), he = pe.slice(pe.lastIndexOf(N) + N.length), nt = ((Be = f[0]) == null ? void 0 : Be.field) === i.field ? he : void 0;
532
+ return re(x, `${C}-${_}`, 2, nt);
522
533
  })
523
534
  },
524
- _
535
+ C
525
536
  );
526
537
  })
527
538
  ];
@@ -530,40 +541,40 @@ function qt({
530
541
  l
531
542
  );
532
543
  });
533
- _e = [...r.map((l, d) => te(l, `flat-${d}`)), ...n];
544
+ _e = [...r.map((l, d) => re(l, `flat-${d}`)), ...n];
534
545
  } else
535
- _e = $.map((e, r) => te(e, String(r)));
536
- const lt = (e) => e.startsCollapsed ? g.has(e.key) : !g.has(e.key), ue = B.length > 0 && B.every(lt), st = (e) => R(
546
+ _e = S.map((e, r) => re(e, String(r)));
547
+ const lt = (e) => e.startsCollapsed ? v.has(e.key) : !v.has(e.key), be = Q.length > 0 && Q.every(lt), st = (e) => L(
537
548
  new Set(
538
- B.filter((r) => e ? r.startsCollapsed : !r.startsCollapsed).map((r) => r.key)
549
+ Q.filter((r) => e ? r.startsCollapsed : !r.startsCollapsed).map((r) => r.key)
539
550
  )
540
- ), Te = B.length > 0 ? /* @__PURE__ */ p(
551
+ ), Me = Q.length > 0 ? /* @__PURE__ */ p(
541
552
  "button",
542
553
  {
543
554
  type: "button",
544
- "data-query-tree-toggle": ue ? "collapse" : "expand",
545
- onClick: () => st(!ue),
555
+ "data-query-tree-toggle": be ? "collapse" : "expand",
556
+ onClick: () => st(!be),
546
557
  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",
547
558
  children: [
548
- ue ? /* @__PURE__ */ s(mt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ s(pt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
549
- ue ? "Collapse all" : "Expand all"
559
+ be ? /* @__PURE__ */ o(bt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ o(ct, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
560
+ be ? "Collapse all" : "Expand all"
550
561
  ]
551
562
  }
552
- ) : null, ot = typeof (t == null ? void 0 : t.export_csv) == "object" && t.export_csv.filename ? t.export_csv.filename : "export.csv", De = t != null && t.search || t != null && t.export_csv || X.length > 0 ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-2", children: [
563
+ ) : null, ot = typeof (t == null ? void 0 : t.export_csv) == "object" && t.export_csv.filename ? t.export_csv.filename : "export.csv", Ue = t != null && t.search || t != null && t.export_csv || Z.length > 0 ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-2", children: [
553
564
  (t == null ? void 0 : t.search) && /* @__PURE__ */ p("label", { className: "relative inline-flex items-center", children: [
554
- /* @__PURE__ */ s(
565
+ /* @__PURE__ */ o(
555
566
  dt,
556
567
  {
557
568
  className: "pointer-events-none absolute left-2 h-3.5 w-3.5 text-slate-400",
558
569
  "aria-hidden": !0
559
570
  }
560
571
  ),
561
- /* @__PURE__ */ s(
572
+ /* @__PURE__ */ o(
562
573
  "input",
563
574
  {
564
575
  type: "search",
565
- value: S,
566
- onChange: (e) => he(e.target.value),
576
+ value: A,
577
+ onChange: (e) => w(e.target.value),
567
578
  placeholder: "Search rows",
568
579
  "aria-label": "Search rows",
569
580
  "data-qt-search": "",
@@ -571,26 +582,26 @@ function qt({
571
582
  }
572
583
  )
573
584
  ] }),
574
- X.length > 0 && /* @__PURE__ */ s(
585
+ Z.length > 0 && /* @__PURE__ */ o(
575
586
  "button",
576
587
  {
577
588
  type: "button",
578
- "aria-pressed": L,
579
- "data-qt-hide-empty": L ? "on" : "off",
580
- onClick: () => Q((e) => !e),
581
- className: `h-7 whitespace-nowrap rounded-md border px-2.5 text-[11.5px] font-medium transition-colors ${L ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted"}`,
589
+ "aria-pressed": z,
590
+ "data-qt-hide-empty": z ? "on" : "off",
591
+ onClick: () => I((e) => !e),
592
+ className: `h-7 whitespace-nowrap rounded-md border px-2.5 text-[11.5px] font-medium transition-colors ${z ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted"}`,
582
593
  children: ((We = t == null ? void 0 : t.hide_empty) == null ? void 0 : We.label) ?? "Hide empty rows"
583
594
  }
584
595
  ),
585
- (ne || L && X.length > 0) && /* @__PURE__ */ p(
596
+ (ie || z && Z.length > 0) && /* @__PURE__ */ p(
586
597
  "span",
587
598
  {
588
599
  className: "text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400",
589
600
  "data-qt-shown": "",
590
601
  children: [
591
- $.length.toLocaleString("en-US"),
602
+ S.length.toLocaleString("en-US"),
592
603
  " of ",
593
- o.length.toLocaleString("en-US"),
604
+ s.length.toLocaleString("en-US"),
594
605
  " rows"
595
606
  ]
596
607
  }
@@ -600,34 +611,34 @@ function qt({
600
611
  {
601
612
  type: "button",
602
613
  "data-qt-csv": "",
603
- onClick: () => wt(
614
+ onClick: () => St(
604
615
  ot,
605
- Nt(
606
- x.filter((e) => fe(e) || !e.field),
607
- $,
608
- E,
609
- (e) => e.label ?? ae(e.field ?? "")
616
+ _t(
617
+ f.filter((e) => fe(e) || !e.field),
618
+ S,
619
+ T,
620
+ (e) => e.label ?? le(e.field ?? "")
610
621
  )
611
622
  ),
612
623
  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",
613
624
  children: [
614
- /* @__PURE__ */ s(it, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
625
+ /* @__PURE__ */ o(it, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
615
626
  "CSV"
616
627
  ]
617
628
  }
618
629
  )
619
630
  ] }) : null;
620
- return /* @__PURE__ */ p("div", { className: N ? "flex min-h-0 flex-1 flex-col" : void 0, children: [
621
- De && /* @__PURE__ */ s("div", { className: "shrink-0 pb-2", children: De }),
622
- (((Je = t == null ? void 0 : t.pivot) == null ? void 0 : Je.quarter_toggle) || (((Ke = t == null ? void 0 : t.toggles) == null ? void 0 : Ke.length) ?? 0) > 0 || Te) && /* @__PURE__ */ p("div", { className: "flex shrink-0 flex-wrap items-center justify-between gap-2 pb-2", children: [
623
- (((je = t == null ? void 0 : t.toggles) == null ? void 0 : je.length) ?? 0) > 0 ? /* @__PURE__ */ s("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 bg-slate-50 p-0.5 dark:border-border dark:bg-muted/40", children: t.toggles.map((e) => {
624
- const r = !T.has(e.label);
625
- return /* @__PURE__ */ s(
631
+ return /* @__PURE__ */ p("div", { className: $ ? "flex min-h-0 flex-1 flex-col" : void 0, children: [
632
+ Ue && /* @__PURE__ */ o("div", { className: "shrink-0 pb-2", children: Ue }),
633
+ (((Ke = t == null ? void 0 : t.pivot) == null ? void 0 : Ke.quarter_toggle) || (((Ae = t == null ? void 0 : t.toggles) == null ? void 0 : Ae.length) ?? 0) > 0 || Me) && /* @__PURE__ */ p("div", { className: "flex shrink-0 flex-wrap items-center justify-between gap-2 pb-2", children: [
634
+ (((Je = t == null ? void 0 : t.toggles) == null ? void 0 : Je.length) ?? 0) > 0 ? /* @__PURE__ */ o("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 bg-slate-50 p-0.5 dark:border-border dark:bg-muted/40", children: t.toggles.map((e) => {
635
+ const r = !V.has(e.label);
636
+ return /* @__PURE__ */ o(
626
637
  "button",
627
638
  {
628
639
  type: "button",
629
640
  "aria-pressed": r,
630
- onClick: () => V((a) => {
641
+ onClick: () => O((a) => {
631
642
  const n = new Set(a);
632
643
  return n.has(e.label) ? n.delete(e.label) : n.add(e.label), n;
633
644
  }),
@@ -636,43 +647,43 @@ function qt({
636
647
  },
637
648
  e.label
638
649
  );
639
- }) }) : /* @__PURE__ */ s("span", {}),
650
+ }) }) : /* @__PURE__ */ o("span", {}),
640
651
  /* @__PURE__ */ p("div", { className: "ml-auto flex items-center gap-2", children: [
641
- Te,
642
- ((Ae = t == null ? void 0 : t.pivot) == null ? void 0 : Ae.quarter_toggle) && /* @__PURE__ */ s("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 p-0.5 dark:border-border", children: ["month", "quarter"].map((e) => /* @__PURE__ */ s(
652
+ Me,
653
+ ((je = t == null ? void 0 : t.pivot) == null ? void 0 : je.quarter_toggle) && /* @__PURE__ */ o("div", { className: "inline-flex gap-0.5 rounded-md border border-slate-200 p-0.5 dark:border-border", children: ["month", "quarter"].map((e) => /* @__PURE__ */ o(
643
654
  "button",
644
655
  {
645
656
  type: "button",
646
- onClick: () => ce(e),
647
- className: `rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${H === 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
+ onClick: () => K(e),
658
+ 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"}`,
648
659
  children: e === "month" ? "Monthly" : "Quarterly"
649
660
  },
650
661
  e
651
662
  )) })
652
663
  ] })
653
664
  ] }),
654
- /* @__PURE__ */ p("div", { className: N ? "relative flex min-h-0 flex-1 flex-col" : "relative", children: [
655
- /* @__PURE__ */ s(
665
+ /* @__PURE__ */ p("div", { className: $ ? "relative flex min-h-0 flex-1 flex-col" : "relative", children: [
666
+ /* @__PURE__ */ o(
656
667
  "div",
657
668
  {
658
669
  ref: Ye,
659
- className: N ? "min-h-0 flex-1 overflow-auto" : "overflow-x-auto",
670
+ className: $ ? "min-h-0 flex-1 overflow-auto" : "overflow-x-auto",
660
671
  children: /* @__PURE__ */ p("table", { className: "w-full border-separate border-spacing-0 text-[12px] [&>tbody>tr.border-b>td]:border-b [&>tbody>tr.border-b>td]:[border-bottom-color:inherit] [&>tbody:has(+tfoot)>tr:last-child>td]:border-b-0 [&>tfoot>tr.border-t>td]:border-t [&>tfoot>tr.border-t>td]:[border-top-color:inherit]", children: [
661
- /* @__PURE__ */ s("thead", { children: Oe ? /* @__PURE__ */ p(Pe, { children: [
672
+ /* @__PURE__ */ o("thead", { children: Oe ? /* @__PURE__ */ p(Pe, { children: [
662
673
  /* @__PURE__ */ p("tr", { children: [
663
674
  (() => {
664
675
  const e = [];
665
676
  let r = 0;
666
- for (; r < x.length; ) {
667
- const a = x[r];
677
+ for (; r < f.length; ) {
678
+ const a = f[r];
668
679
  if (!a.group) {
669
680
  e.push(
670
- /* @__PURE__ */ s(
681
+ /* @__PURE__ */ o(
671
682
  "th",
672
683
  {
673
684
  rowSpan: 2,
674
- 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 ${O(a) ? "text-right" : "text-left"} ${Me(r)}`,
675
- children: a.label ?? ae(a.field ?? "")
685
+ 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 ${M(a) ? "text-right" : "text-left"} ${Te(r)}`,
686
+ children: a.label ?? le(a.field ?? "")
676
687
  },
677
688
  `u-${a.field ?? r}`
678
689
  )
@@ -680,14 +691,14 @@ function qt({
680
691
  continue;
681
692
  }
682
693
  let n = 1;
683
- for (; r + n < x.length && x[r + n].group === a.group; )
694
+ for (; r + n < f.length && f[r + n].group === a.group; )
684
695
  n++;
685
696
  e.push(
686
- /* @__PURE__ */ s(
697
+ /* @__PURE__ */ o(
687
698
  "th",
688
699
  {
689
700
  colSpan: n,
690
- className: `whitespace-nowrap border-b border-slate-100 py-1 pr-3 text-center text-[11px] font-semibold dark:border-border/60 ${a.group === se ? "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)}`} ${N ? "sticky top-0 z-[2] bg-white dark:bg-card" : ""}`.trim(),
701
+ 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(),
691
702
  children: a.group
692
703
  },
693
704
  `g-${a.group}-${r}`
@@ -696,60 +707,60 @@ function qt({
696
707
  }
697
708
  return e;
698
709
  })(),
699
- f && /* @__PURE__ */ s(
710
+ u && /* @__PURE__ */ o(
700
711
  "th",
701
712
  {
702
713
  rowSpan: 2,
703
714
  "aria-label": "Actions",
704
715
  "data-qt-actions-head": "",
705
- className: `border-b border-slate-200 dark:border-border ${N ? `sticky right-0 top-0 z-[3] ${ie} bg-white dark:bg-card` : ""}`
716
+ className: `border-b border-slate-200 dark:border-border ${$ ? `sticky right-0 top-0 z-[3] ${me} bg-white dark:bg-card` : ""}`
706
717
  }
707
718
  )
708
719
  ] }),
709
- /* @__PURE__ */ s("tr", { children: x.map(
710
- (e, r) => e.group ? /* @__PURE__ */ s(
720
+ /* @__PURE__ */ o("tr", { children: f.map(
721
+ (e, r) => e.group ? /* @__PURE__ */ o(
711
722
  "th",
712
723
  {
713
- className: `min-w-[58px] whitespace-nowrap border-b border-slate-200 py-1 pr-3 ${A(r)} text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400 ${O(e) ? "text-right" : "text-left"} ${oe(e) || we(r)} ${N ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
714
- children: e.label ?? ae(e.field ?? "")
724
+ 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 ${M(e) ? "text-right" : "text-left"} ${de(e) || we(r)} ${$ ? "sticky top-[26px] z-[2] bg-white dark:bg-card" : ""}`,
725
+ children: e.label ?? le(e.field ?? "")
715
726
  },
716
727
  e.field ?? e.label ?? r
717
728
  ) : null
718
729
  ) })
719
730
  ] }) : /* @__PURE__ */ p("tr", { className: "border-b border-slate-200 dark:border-border", children: [
720
- x.map((e, r) => /* @__PURE__ */ p(
731
+ f.map((e, r) => /* @__PURE__ */ p(
721
732
  "th",
722
733
  {
723
- className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 ${A(r)} text-[10.5px] font-semibold uppercase tracking-wider dark:border-border ${Ee(e) ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : "text-slate-500 dark:text-slate-400"} ${e.stack ? "min-w-[64px]" : ""} ${O(e) ? "text-right" : "text-left"} ${Me(r)}`,
724
- "aria-sort": ye && (u == null ? void 0 : u.key) === Z(e, r) ? u.dir === 1 ? "ascending" : "descending" : void 0,
734
+ className: `whitespace-nowrap border-b border-slate-200 py-1.5 pr-3 ${G(r)} text-[10.5px] font-semibold uppercase tracking-wider dark:border-border ${Le(e) ? "border-t-2 border-t-[#6366f1] bg-[#6366f10f] text-[#4f46e5] dark:border-t-[#a5b4fc] dark:bg-[#a5b4fc12] dark:text-[#a5b4fc]" : "text-slate-500 dark:text-slate-400"} ${e.stack ? "min-w-[64px]" : ""} ${M(e) ? "text-right" : "text-left"} ${Te(r)}`,
735
+ "aria-sort": ve && (q == null ? void 0 : q.key) === ee(e, r) ? q.dir === 1 ? "ascending" : "descending" : void 0,
725
736
  children: [
726
- ye ? /* @__PURE__ */ p(
737
+ ve ? /* @__PURE__ */ p(
727
738
  "button",
728
739
  {
729
740
  type: "button",
730
- "data-qt-sort": Z(e, r),
731
- onClick: () => rt(Z(e, r)),
732
- className: `inline-flex items-center gap-0.5 font-semibold uppercase tracking-wider hover:text-slate-800 dark:hover:text-slate-100 ${O(e) ? "flex-row-reverse" : ""}`,
741
+ "data-qt-sort": ee(e, r),
742
+ onClick: () => rt(ee(e, r)),
743
+ className: `inline-flex items-center gap-0.5 font-semibold uppercase tracking-wider hover:text-slate-800 dark:hover:text-slate-100 ${M(e) ? "flex-row-reverse" : ""}`,
733
744
  children: [
734
- e.label ?? ae(e.field ?? ""),
735
- (u == null ? void 0 : u.key) === Z(e, r) && (u.dir === 1 ? /* @__PURE__ */ s(ut, { className: "h-3 w-3", "aria-hidden": !0 }) : /* @__PURE__ */ s(bt, { className: "h-3 w-3", "aria-hidden": !0 }))
745
+ e.label ?? le(e.field ?? ""),
746
+ (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(mt, { className: "h-3 w-3", "aria-hidden": !0 }))
736
747
  ]
737
748
  }
738
- ) : e.label ?? ae(e.field ?? ""),
749
+ ) : e.label ?? le(e.field ?? ""),
739
750
  e.stack && (t == null ? void 0 : t.stack_legend) && /* @__PURE__ */ p(
740
751
  "span",
741
752
  {
742
753
  className: "flex justify-end gap-1.5 text-[9px] font-medium normal-case tracking-normal",
743
- style: ve(e) ? { ...ve(e), ...Y(e) ?? {} } : Y(e),
754
+ style: ye(e) ? { ...ye(e), ...X(e) ?? {} } : X(e),
744
755
  children: [
745
- fe(e) && /* @__PURE__ */ s(
756
+ fe(e) && /* @__PURE__ */ o(
746
757
  "span",
747
758
  {
748
759
  className: e.color ? "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]" : "",
749
760
  children: t.stack_legend[0]
750
761
  }
751
762
  ),
752
- Le(e) && /* @__PURE__ */ s(
763
+ Ee(e) && /* @__PURE__ */ o(
753
764
  "span",
754
765
  {
755
766
  className: e.stack_color ? "text-[color:var(--qts)] dark:text-[color:var(--qtsd)]" : "",
@@ -763,36 +774,36 @@ function qt({
763
774
  },
764
775
  e.field ?? e.label ?? r
765
776
  )),
766
- f && /* @__PURE__ */ s(
777
+ u && /* @__PURE__ */ o(
767
778
  "th",
768
779
  {
769
780
  "aria-label": "Actions",
770
781
  "data-qt-actions-head": "",
771
- className: N ? `sticky right-0 top-0 z-[3] ${ie} bg-white dark:bg-card` : void 0
782
+ className: $ ? `sticky right-0 top-0 z-[3] ${me} bg-white dark:bg-card` : void 0
772
783
  }
773
784
  )
774
785
  ] }) }),
775
- /* @__PURE__ */ s("tbody", { children: _e }),
776
- j && /* @__PURE__ */ s("tfoot", { children: /* @__PURE__ */ p("tr", { className: "border-t border-slate-300 font-semibold dark:border-border", children: [
777
- x.map((e, r) => /* @__PURE__ */ s(
786
+ /* @__PURE__ */ o("tbody", { children: _e }),
787
+ B && /* @__PURE__ */ o("tfoot", { children: /* @__PURE__ */ p("tr", { className: "border-t border-slate-300 font-semibold dark:border-border", children: [
788
+ f.map((e, r) => /* @__PURE__ */ o(
778
789
  "td",
779
790
  {
780
- className: `whitespace-nowrap py-1.5 pr-3 ${A(r)} ${ke(e, "")} ${O(e) ? "text-right tabular-nums" : ""} ${oe(e)} ${N ? `sticky bottom-0 border-t border-slate-300 dark:border-border ${r === 0 ? `left-0 z-[3] ${ee} bg-slate-50 dark:bg-muted` : "z-[2] bg-white dark:bg-card"}` : ""}`,
781
- style: Y(
791
+ className: `whitespace-nowrap py-1.5 pr-3 ${G(r)} ${ke(e, "")} ${M(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"}` : ""}`,
792
+ style: X(
782
793
  e,
783
794
  Number(
784
- e.formula ? J(e.formula, j) : j[e.field ?? ""]
795
+ e.formula ? j(e.formula, B) : B[e.field ?? ""]
785
796
  )
786
797
  ),
787
- children: r === 0 && !e.sum && !e.formula ? "Total" : e.sum || e.formula ? e.formula ? W(J(e.formula, j), e.format) : de(j, e) : ""
798
+ children: r === 0 && !e.sum && !e.formula ? "Total" : e.sum || e.formula ? e.formula ? J(j(e.formula, B), e.format) : ue(B, e) : ""
788
799
  },
789
800
  e.field ?? e.label ?? r
790
801
  )),
791
- f && /* @__PURE__ */ s(
802
+ u && /* @__PURE__ */ o(
792
803
  "td",
793
804
  {
794
- className: `py-1.5 pr-3 text-right ${N ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${ie} bg-white dark:border-border dark:bg-card` : ""}`,
795
- children: /* @__PURE__ */ s("span", { className: "inline-flex flex-nowrap gap-1.5", children: f.map((e) => /* @__PURE__ */ s(
805
+ className: `py-1.5 pr-3 text-right ${$ ? `sticky bottom-0 right-0 z-[3] border-t border-slate-300 ${me} bg-white dark:border-border dark:bg-card` : ""}`,
806
+ children: /* @__PURE__ */ o("span", { className: "inline-flex flex-nowrap gap-1.5", children: u.map((e) => /* @__PURE__ */ o(
796
807
  "button",
797
808
  {
798
809
  type: "button",
@@ -808,55 +819,57 @@ function qt({
808
819
  ] })
809
820
  }
810
821
  ),
811
- le.canScrollRight && // More columns to the right: fade the edge so readers know the
822
+ oe.canScrollRight && // More columns to the right: fade the edge so readers know the
812
823
  // table scrolls sideways (the native scrollbar is often invisible).
813
- /* @__PURE__ */ s(
824
+ /* @__PURE__ */ o(
814
825
  "div",
815
826
  {
816
827
  "aria-hidden": !0,
817
828
  "data-qt-scroll-cue": "",
818
829
  className: "pointer-events-none absolute top-0 w-10 bg-gradient-to-r from-transparent to-white dark:to-card",
819
- style: { right: le.cueInset.right, bottom: le.cueInset.bottom }
830
+ style: { right: oe.cueInset.right, bottom: oe.cueInset.bottom }
820
831
  }
821
832
  )
822
833
  ] })
823
834
  ] });
824
835
  }
825
- function gt(o, t, m = 1) {
826
- const h = (y) => y == null || y === "";
827
- if (h(o) && h(t)) return 0;
828
- if (h(o)) return 1;
829
- if (h(t)) return -1;
830
- const f = typeof o == "number" ? o : Number(o), F = typeof t == "number" ? t : Number(t);
831
- return Number.isFinite(f) && Number.isFinite(F) ? (f - F) * m : String(o).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" }) * m;
836
+ function $t(s, t, m = 1) {
837
+ const c = (y) => y == null || y === "";
838
+ if (c(s) && c(t)) return 0;
839
+ if (c(s)) return 1;
840
+ if (c(t)) return -1;
841
+ const u = typeof s == "number" ? s : Number(s), g = typeof t == "number" ? t : Number(t);
842
+ return Number.isFinite(u) && Number.isFinite(g) ? (u - g) * m : String(s).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" }) * m;
832
843
  }
833
- function Nt(o, t, m, h) {
834
- const f = (y) => {
844
+ function _t(s, t, m, c) {
845
+ const u = (y) => {
835
846
  if (y == null) return "";
836
- const g = typeof y == "object" ? JSON.stringify(y) : String(y), R = /^[=+\-@]/.test(g) && !/^-?\d/.test(g) ? `'${g}` : g;
837
- return /[",\r\n]/.test(R) ? `"${R.replace(/"/g, '""')}"` : R;
838
- }, F = [o.map((y) => f(h(y))).join(",")];
839
- for (const y of t) F.push(o.map((g) => f(m(y, g))).join(","));
840
- return `${F.join(`\r
847
+ const v = typeof y == "object" ? JSON.stringify(y) : String(y), L = /^[=+\-@]/.test(v) && !/^-?\d/.test(v) ? `'${v}` : v;
848
+ return /[",\r\n]/.test(L) ? `"${L.replace(/"/g, '""')}"` : L;
849
+ }, g = [s.map((y) => u(c(y))).join(",")];
850
+ for (const y of t) g.push(s.map((v) => u(m(y, v))).join(","));
851
+ return `${g.join(`\r
841
852
  `)}\r
842
853
  `;
843
854
  }
844
- function wt(o, t) {
845
- const m = URL.createObjectURL(new Blob([`\uFEFF${t}`], { type: "text/csv;charset=utf-8" })), h = document.createElement("a");
846
- h.href = m, h.download = o, document.body.appendChild(h), h.click(), h.remove(), setTimeout(() => URL.revokeObjectURL(m), 0);
855
+ function St(s, t) {
856
+ const m = URL.createObjectURL(new Blob([`\uFEFF${t}`], { type: "text/csv;charset=utf-8" })), c = document.createElement("a");
857
+ c.href = m, c.download = s, document.body.appendChild(c), c.click(), c.remove(), setTimeout(() => URL.revokeObjectURL(m), 0);
847
858
  }
848
- function Ve({ header: o, children: t }) {
859
+ function Qe({ header: s, children: t }) {
849
860
  return /* @__PURE__ */ p(Pe, { children: [
850
- o,
861
+ s,
851
862
  t
852
863
  ] });
853
864
  }
854
865
  export {
855
866
  Se as COLOR_ROLES,
856
- qt as QueryTable,
867
+ Lt as QueryTable,
868
+ vt as UNDATED_KEY,
857
869
  Ce as colorPair,
858
870
  ft as darkVariant,
859
- yt as pivotQueryRows,
860
- Nt as queryTableCsv,
861
- gt as sortCompare
871
+ Nt as pivotQueryRows,
872
+ _t as queryTableCsv,
873
+ wt as queryTableTotals,
874
+ $t as sortCompare
862
875
  };