serverside_pivot 0.0.95 → 0.0.98

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 (63) hide show
  1. package/README.md +5 -4
  2. package/dist/react/chunks/ContextMenu-DQGCdUhU.mjs +211 -0
  3. package/dist/react/chunks/{DetailDrawer-DCKIxSpW.mjs → DetailDrawer-yMFRd6Td.mjs} +1 -1
  4. package/dist/react/chunks/{DetailSidePanel-DgUWPBQk.mjs → DetailSidePanel-B6fYMnn7.mjs} +1 -1
  5. package/dist/react/chunks/{DetailSurfaceContent-BEL6xuaZ.mjs → DetailSurfaceContent-B9cfLYti.mjs} +52 -53
  6. package/dist/react/chunks/{ECharts2dRenderer-Dgkp9_1P.mjs → ECharts2dRenderer-ER6rHtch.mjs} +1 -1
  7. package/dist/react/chunks/{ECharts3dRenderer-70VOp8V0.mjs → ECharts3dRenderer-BMVfbpXH.mjs} +1 -1
  8. package/dist/react/chunks/{EditSidePanel-CygqVXLX.mjs → EditSidePanel-BjJd5BaX.mjs} +1 -1
  9. package/dist/react/chunks/{InlineDetailPanel-BUBRWdFW.mjs → InlineDetailPanel-Bbkpv9jz.mjs} +1 -1
  10. package/dist/react/chunks/{PivotCharts-VX5-mEEp.mjs → PivotCharts-P5cBJcwu.mjs} +1209 -1193
  11. package/dist/react/chunks/{ReportEditor-B5j-CU9-.mjs → ReportEditor-P4UZ97Ik.mjs} +493 -468
  12. package/dist/react/chunks/SidebarPanel-DRoxHRhK.mjs +3959 -0
  13. package/dist/react/chunks/{SparklineDetailGraph-Cfe2KcOp.mjs → SparklineDetailGraph-C9UX-feP.mjs} +22 -22
  14. package/dist/react/chunks/clientCoreRuntime-n2guUxhp.mjs +790 -0
  15. package/dist/react/chunks/{installCanvasRenderer-C4h5pc1p.mjs → installCanvasRenderer-BR0XmdVX.mjs} +1 -1
  16. package/dist/react/chunks/react-B5JcZShu.mjs +36775 -0
  17. package/dist/react/chunks/{xlsx.mini.min-CzdkdH3N.mjs → xlsx.mini.min-YUTWASKG.mjs} +1 -1
  18. package/dist/react/components/DashTanstackPivot.react.d.ts +10 -0
  19. package/dist/react/components/GlobalSearchInput.d.ts +17 -0
  20. package/dist/react/components/LiveCellDisplay.d.ts +25 -0
  21. package/dist/react/components/LiveExplainSidePanel.d.ts +15 -0
  22. package/dist/react/components/LiveStreamDiffBar.d.ts +15 -0
  23. package/dist/react/components/ShimmerFallback.d.ts +11 -0
  24. package/dist/react/components/ThemedSelect.d.ts +8 -0
  25. package/dist/react/contexts/PivotThemeContext.d.ts +1 -0
  26. package/dist/react/hooks/useColumnDefs.d.ts +1 -1
  27. package/dist/react/hooks/useDismiss.d.ts +43 -0
  28. package/dist/react/hooks/usePivotNormalization.d.ts +4 -0
  29. package/dist/react/hooks/usePrefersReducedMotion.d.ts +8 -0
  30. package/dist/react/hooks/useRenderHelpers.d.ts +1 -1
  31. package/dist/react/hooks/useRowCache.d.ts +2 -0
  32. package/dist/react/hooks/useServerSideRowModel.d.ts +1 -1
  33. package/dist/react/index.mjs +28 -19
  34. package/dist/react/react.d.ts +7 -2
  35. package/dist/react/runtime/client/clientPivotTransport.d.ts +17 -0
  36. package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +8 -1
  37. package/dist/react/runtime/client/clientSubscriptionEngine.d.ts +88 -0
  38. package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +25 -0
  39. package/dist/react/runtime/client/index.d.ts +1 -0
  40. package/dist/react/runtime/client/types.d.ts +18 -0
  41. package/dist/react/runtime/core/clientCoreRuntime.d.ts +46 -0
  42. package/dist/react/runtime/core/duckdbSqlEmitter.d.ts +37 -0
  43. package/dist/react/runtime/core/semanticIr.generated.d.ts +196 -0
  44. package/dist/react/runtime/responseQueue.d.ts +21 -0
  45. package/dist/react/runtime/rowIdentity.d.ts +20 -0
  46. package/dist/react/runtime/runtimeDomains.d.ts +101 -2
  47. package/dist/react/runtime/streamingTypes.d.ts +182 -0
  48. package/dist/react/runtime/useRuntimeColumnAutoSizing.d.ts +1 -1
  49. package/dist/react/runtime/useRuntimeViewSnapshot.d.ts +1 -1
  50. package/dist/react/runtime/useRuntimeViewportTableData.d.ts +1 -1
  51. package/dist/react/runtime/useViewportSubscriptionStore.d.ts +112 -0
  52. package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +1 -1
  53. package/dist/react/utils/dataBars.d.ts +1 -0
  54. package/dist/react/utils/domEvents.d.ts +1 -0
  55. package/dist/react/utils/helpers.d.ts +6 -1
  56. package/dist/react/utils/pivotLayoutUtils.d.ts +5 -1
  57. package/dist/react/utils/rowMotion.d.ts +108 -0
  58. package/dist/react/utils/sorting.d.ts +1 -1
  59. package/dist/react/utils/styles.d.ts +1 -0
  60. package/package.json +6 -8
  61. package/dist/react/chunks/ContextMenu-1G-o1ms9.mjs +0 -195
  62. package/dist/react/chunks/SidebarPanel-LXUE6nPd.mjs +0 -3742
  63. package/dist/react/chunks/react-CDa-ADnG.mjs +0 -31199
@@ -1,6 +1,6 @@
1
- import t, { useState as H, useRef as ke, useMemo as z, useCallback as B, useEffect as $e } from "react";
2
- import { aa as Et, am as St, z as v, an as Ct, ac as wt, Z as M, ao as At } from "./react-CDa-ADnG.mjs";
3
- const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`, Xe = [
1
+ import t, { useState as H, useRef as Be, useMemo as W, useCallback as F, useEffect as Ee } from "react";
2
+ import { ad as St, ap as wt, I as m, aq as Ct, T as U, af as At, a0 as M, ar as kt } from "./react-B5JcZShu.mjs";
3
+ const oe = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`, Qe = [
4
4
  { value: "eq", label: "Equals" },
5
5
  { value: "not_eq", label: "Not equals" },
6
6
  { value: "in", label: "In list" },
@@ -11,7 +11,7 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
11
11
  { value: "gte", label: "Greater or equal" },
12
12
  { value: "lt", label: "Less than" },
13
13
  { value: "lte", label: "Less or equal" }
14
- ], de = /* @__PURE__ */ new Set(["in", "not_in"]), kt = {
14
+ ], pe = /* @__PURE__ */ new Set(["in", "not_in"]), $t = {
15
15
  eq: "=",
16
16
  not_eq: "!=",
17
17
  in: "in",
@@ -22,7 +22,7 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
22
22
  gte: ">=",
23
23
  lt: "<",
24
24
  lte: "<="
25
- }, $t = /* @__PURE__ */ new Set([
25
+ }, Bt = /* @__PURE__ */ new Set([
26
26
  "depth",
27
27
  "_id",
28
28
  "_path",
@@ -32,8 +32,8 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
32
32
  "_has_children",
33
33
  "_is_expanded",
34
34
  "__col_schema"
35
- ]), T = "default", Be = "branch:", Qe = ["", "solid", "dashed", "dotted", "double"], Ue = (e = "") => ({ _id: ae(), field: e, operator: "eq", value: "", values: [] }), Pe = () => ({ op: "AND", clauses: [] }), Ft = () => ({ _id: ae(), label: "", condition: Pe(), child: null }), me = (e = {}) => {
36
- const l = e && typeof e == "object" ? e : {}, n = Number(l.indent), a = Number(l.borderWidth), r = typeof l.borderStyle == "string" && Qe.includes(l.borderStyle) ? l.borderStyle : "";
35
+ ]), T = "default", De = "branch:", Ue = ["", "solid", "dashed", "dotted", "double"], et = (e = "") => ({ _id: oe(), field: e, operator: "eq", value: "", values: [] }), Le = () => ({ op: "AND", clauses: [] }), Ft = () => ({ _id: oe(), label: "", condition: Le(), child: null }), Se = (e = {}) => {
36
+ const l = e && typeof e == "object" ? e : {}, n = Number(l.indent), a = Number(l.borderWidth), r = typeof l.borderStyle == "string" && Ue.includes(l.borderStyle) ? l.borderStyle : "";
37
37
  return {
38
38
  indent: Number.isFinite(n) && n >= 0 ? Math.floor(n) : "",
39
39
  bold: l.bold === !0,
@@ -47,7 +47,7 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
47
47
  borderWidth: Number.isFinite(a) && a > 0 ? Math.floor(a) : ""
48
48
  };
49
49
  }, Y = (e = "") => ({
50
- _id: ae(),
50
+ _id: oe(),
51
51
  field: e,
52
52
  label: "",
53
53
  topN: null,
@@ -55,37 +55,37 @@ const ae = () => `r${Date.now().toString(36)}${Math.random().toString(36).slice(
55
55
  sortDir: "desc",
56
56
  sortAbs: !1,
57
57
  filters: null,
58
- format: me(),
58
+ format: Se(),
59
59
  defaultChild: null,
60
60
  branches: []
61
- }), Bt = (e) => !e || typeof e.field != "string" || !e.field ? null : {
62
- _id: typeof e._id == "string" ? e._id : ae(),
61
+ }), Dt = (e) => !e || typeof e.field != "string" || !e.field ? null : {
62
+ _id: typeof e._id == "string" ? e._id : oe(),
63
63
  field: e.field,
64
- operator: Xe.some((l) => l.value === e.operator) ? e.operator : "eq",
64
+ operator: Qe.some((l) => l.value === e.operator) ? e.operator : "eq",
65
65
  value: e.value !== void 0 && e.value !== null ? String(e.value) : "",
66
66
  values: Array.isArray(e.values) ? e.values.map(String).filter(Boolean) : []
67
- }, Le = (e) => ({
67
+ }, ze = (e) => ({
68
68
  op: e && e.op === "OR" ? "OR" : "AND",
69
- clauses: Array.isArray(e && e.clauses) ? e.clauses.map(Bt).filter(Boolean) : []
70
- }), De = (e) => !e || typeof e != "object" ? null : {
71
- _id: typeof e._id == "string" ? e._id : ae(),
69
+ clauses: Array.isArray(e && e.clauses) ? e.clauses.map(Dt).filter(Boolean) : []
70
+ }), Re = (e) => !e || typeof e != "object" ? null : {
71
+ _id: typeof e._id == "string" ? e._id : oe(),
72
72
  label: typeof e.label == "string" ? e.label : "",
73
- condition: Le(e.condition),
73
+ condition: ze(e.condition),
74
74
  sourceRowPath: Array.isArray(e.sourceRowPath) ? e.sourceRowPath.map(String).filter(Boolean) : [],
75
75
  sourcePathFields: Array.isArray(e.sourcePathFields) ? e.sourcePathFields.map(String).filter(Boolean) : [],
76
76
  child: e.child ? V(e.child) : null
77
77
  };
78
78
  function V(e) {
79
79
  if (!e || typeof e != "object") return null;
80
- let l = Array.isArray(e.branches) ? e.branches.map(De).filter(Boolean) : [];
81
- l.length === 0 && e.childrenByValue && typeof e.childrenByValue == "object" && (l = Object.entries(e.childrenByValue).filter(([a]) => a).map(([a, r]) => De({
80
+ let l = Array.isArray(e.branches) ? e.branches.map(Re).filter(Boolean) : [];
81
+ l.length === 0 && e.childrenByValue && typeof e.childrenByValue == "object" && (l = Object.entries(e.childrenByValue).filter(([a]) => a).map(([a, r]) => Re({
82
82
  label: a,
83
83
  condition: { op: "AND", clauses: [{ field: e.field || "", operator: "eq", value: a, values: [] }] },
84
84
  child: r
85
85
  })).filter(Boolean));
86
- const n = e.filters && typeof e.filters == "object" ? Le(e.filters) : null;
86
+ const n = e.filters && typeof e.filters == "object" ? ze(e.filters) : null;
87
87
  return {
88
- _id: typeof e._id == "string" ? e._id : ae(),
88
+ _id: typeof e._id == "string" ? e._id : oe(),
89
89
  field: typeof e.field == "string" ? e.field : "",
90
90
  label: typeof e.label == "string" ? e.label : "",
91
91
  topN: Number.isFinite(Number(e.topN)) && Number(e.topN) > 0 ? Math.floor(Number(e.topN)) : null,
@@ -93,16 +93,16 @@ function V(e) {
93
93
  sortDir: e.sortDir === "asc" ? "asc" : "desc",
94
94
  sortAbs: e.sortAbs === !0,
95
95
  filters: n && n.clauses.length > 0 ? n : null,
96
- format: me(e.format),
96
+ format: Se(e.format),
97
97
  defaultChild: e.defaultChild ? V(e.defaultChild) : null,
98
98
  branches: l
99
99
  };
100
100
  }
101
- const _e = (e) => `${Be}${e}`, Se = (e) => {
102
- if (typeof e != "string" || !e.startsWith(Be)) return -1;
103
- const l = parseInt(e.slice(Be.length), 10);
101
+ const _e = (e) => `${De}${e}`, Ce = (e) => {
102
+ if (typeof e != "string" || !e.startsWith(De)) return -1;
103
+ const l = parseInt(e.slice(De.length), 10);
104
104
  return Number.isFinite(l) ? l : -1;
105
- }, Dt = (e, l) => {
105
+ }, Rt = (e, l) => {
106
106
  const n = new Set(
107
107
  (l || []).filter(
108
108
  /** @param {any} [config] @returns {any} */
@@ -114,9 +114,9 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
114
114
  );
115
115
  return (e || []).filter(
116
116
  /** @param {any} [field] @returns {any} */
117
- (a) => a && typeof a == "string" && !$t.has(a) && (!a.startsWith("_") || wt(a)) && !n.has(a)
117
+ (a) => a && typeof a == "string" && !Bt.has(a) && (!a.startsWith("_") || At(a)) && !n.has(a)
118
118
  );
119
- }, Rt = (e) => {
119
+ }, Nt = (e) => {
120
120
  const l = [
121
121
  { value: "", label: "(default)" },
122
122
  { value: "__field__", label: "Field value (A→Z / Z→A)" }
@@ -125,28 +125,28 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
125
125
  /** @param {any} [config] @returns {any} */
126
126
  (n) => {
127
127
  if (!n || !n.field || !n.agg) return;
128
- const a = n.agg === "formula" ? n.field : `${n.field}_${n.agg}`, r = n.agg === "formula" ? n.label || M(n.field) : `${M(n.field)} (${At(n.agg, n.weightField)})`;
128
+ const a = n.agg === "formula" ? n.field : `${n.field}_${n.agg}`, r = n.agg === "formula" ? n.label || M(n.field) : `${M(n.field)} (${kt(n.agg, n.weightField)})`;
129
129
  l.push({ value: a, label: r });
130
130
  }
131
131
  ), l;
132
- }, Ce = (e) => !e || !e.clauses || e.clauses.length === 0 ? "No filter" : e.clauses.map(
132
+ }, Ae = (e) => !e || !e.clauses || e.clauses.length === 0 ? "No filter" : e.clauses.map(
133
133
  /** @param {any} [clause] @returns {any} */
134
134
  (l) => {
135
- const n = M(l.field), a = kt[l.operator] || l.operator;
136
- if (de.has(l.operator)) {
135
+ const n = M(l.field), a = $t[l.operator] || l.operator;
136
+ if (pe.has(l.operator)) {
137
137
  const r = l.values.slice(0, 3), i = l.values.length > 3 ? ` +${l.values.length - 3}` : "";
138
138
  return `${n} ${a} [${r.join(", ")}${i}]`;
139
139
  }
140
140
  return `${n} ${a} ${l.value || "..."}`;
141
141
  }
142
- ).join(` ${e.op} `), et = (e, l) => {
142
+ ).join(` ${e.op} `), tt = (e, l) => {
143
143
  if (!e) return "";
144
144
  const n = (l || []).find(
145
145
  /** @param {any} [item] @returns {any} */
146
146
  (a) => a.value === e
147
147
  );
148
148
  return n ? n.label : M(e);
149
- }, tt = (e) => e ? e.label && e.label.trim() ? e.label.trim() : e.field ? M(e.field) : "Select field" : "Select field", Nt = (e) => !e || !e.field ? !1 : de.has(e.operator) ? Array.isArray(e.values) && e.values.length > 0 : e.value !== void 0 && e.value !== null && String(e.value).trim() !== "", Re = (e) => !!(e && Array.isArray(e.clauses) && e.clauses.length > 0) && e.clauses.every(Nt), Ke = (e, l) => {
149
+ }, lt = (e) => e ? e.label && e.label.trim() ? e.label.trim() : e.field ? M(e.field) : "Select field" : "Select field", It = (e) => !e || !e.field ? !1 : pe.has(e.operator) ? Array.isArray(e.values) && e.values.length > 0 : e.value !== void 0 && e.value !== null && String(e.value).trim() !== "", Ne = (e) => !!(e && Array.isArray(e.clauses) && e.clauses.length > 0) && e.clauses.every(It), Ge = (e, l) => {
150
150
  if (!e || !l || typeof l != "object") return !1;
151
151
  const n = l[e.field], a = n == null ? "" : String(n), r = e.value === void 0 || e.value === null ? "" : String(e.value), i = Array.isArray(e.values) ? e.values.map(String) : [], s = Number(a), f = Number(r);
152
152
  switch (e.operator) {
@@ -172,8 +172,8 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
172
172
  default:
173
173
  return a === r;
174
174
  }
175
- }, Ge = (e, l) => {
176
- if (!Re(e) || !Array.isArray(l) || l.length === 0) return !0;
175
+ }, Ye = (e, l) => {
176
+ if (!Ne(e) || !Array.isArray(l) || l.length === 0) return !0;
177
177
  const n = l.filter((r) => r && typeof r == "object" && !r._isTotal && !r._isOther);
178
178
  return n.some(
179
179
  /** @param {any} [row] @returns {any} */
@@ -185,17 +185,17 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
185
185
  /** @param {any} [row] @returns {any} */
186
186
  (r) => e.op === "OR" ? e.clauses.some(
187
187
  /** @param {any} [clause] @returns {any} */
188
- (i) => Ke(i, r)
188
+ (i) => Ge(i, r)
189
189
  ) : e.clauses.every(
190
190
  /** @param {any} [clause] @returns {any} */
191
- (i) => Ke(i, r)
191
+ (i) => Ge(i, r)
192
192
  )
193
193
  ) : !0;
194
- }, It = (e, l) => {
194
+ }, Pt = (e, l) => {
195
195
  if (!Array.isArray(e) || e.length === 0 || !Array.isArray(l) || l.length === 0) return !0;
196
196
  const n = e.map(String).join("|||");
197
197
  return l.some((a) => a && typeof a == "object" && a._path === n);
198
- }, Ye = (e, {
198
+ }, Ze = (e, {
199
199
  allFields: l = [],
200
200
  valConfigs: n = [],
201
201
  data: a = []
@@ -203,48 +203,48 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
203
203
  const r = [], i = [], s = (n || []).some(
204
204
  /** @param {any} [config] @returns {any} */
205
205
  (y) => y && y.field && y.agg
206
- ), f = new Set(Array.isArray(l) ? l : []), m = /* @__PURE__ */ new Map(), g = Array.isArray(a) ? a : [], F = (y, w) => {
206
+ ), f = new Set(Array.isArray(l) ? l : []), E = /* @__PURE__ */ new Map(), b = Array.isArray(a) ? a : [], B = (y, C) => {
207
207
  const c = y.trim().toLowerCase();
208
208
  if (c) {
209
- if (m.has(c)) {
210
- r.push(`Duplicate header "${y}" at ${w}; already used at ${m.get(c)}.`);
209
+ if (E.has(c)) {
210
+ r.push(`Duplicate header "${y}" at ${C}; already used at ${E.get(c)}.`);
211
211
  return;
212
212
  }
213
- m.set(c, w);
213
+ E.set(c, C);
214
214
  }
215
- }, N = (y, w, c = /* @__PURE__ */ new Set()) => {
215
+ }, N = (y, C, c = /* @__PURE__ */ new Set()) => {
216
216
  if (!y) return;
217
- const E = y._id || `${w}:${y.field || ""}`;
218
- if (c.has(E)) {
219
- r.push(`Circular row override detected at ${w}.`);
217
+ const g = y._id || `${C}:${y.field || ""}`;
218
+ if (c.has(g)) {
219
+ r.push(`Circular row override detected at ${C}.`);
220
220
  return;
221
221
  }
222
- const h = new Set(c);
223
- h.add(E), y.field ? f.size > 0 && !f.has(y.field) && r.push(`Field "${M(y.field)}" at ${w} is no longer available.`) : r.push(`Missing field at ${w}.`), F(tt(y), w), y.topN && !s && r.push(`Top-N at ${w} needs at least one measure selected.`), y.filters && !Re(y.filters) ? r.push(`Level filter at ${w} has incomplete rules.`) : y.filters && !Ge(y.filters, g) && r.push(`Level filter at ${w} does not match any loaded rows.`), y.defaultChild && N(y.defaultChild, `${w} > Default children`, h), (y.branches || []).forEach(
222
+ const v = new Set(c);
223
+ v.add(g), y.field ? f.size > 0 && !f.has(y.field) && r.push(`Field "${M(y.field)}" at ${C} is no longer available.`) : r.push(`Missing field at ${C}.`), B(lt(y), C), y.topN && !s && r.push(`Top-N at ${C} needs at least one measure selected.`), y.filters && !Ne(y.filters) ? r.push(`Level filter at ${C} has incomplete rules.`) : y.filters && !Ye(y.filters, b) && r.push(`Level filter at ${C} does not match any loaded rows.`), y.defaultChild && N(y.defaultChild, `${C} > Default children`, v), (y.branches || []).forEach(
224
224
  /** @param {any} [branch] @param {any} [index] @returns {any} */
225
225
  (u, D) => {
226
- const R = u.label && u.label.trim() ? u.label.trim() : `Row override ${D + 1}`, x = `${w} > ${R}`;
227
- Re(u.condition) ? Ge(u.condition, g) || r.push(`Row override "${R}" does not match any loaded rows.`) : r.push(`Row override "${R}" needs a complete row rule.`), Array.isArray(u.sourcePathFields) && u.sourcePathFields.length > 0 && u.sourcePathFields[u.sourcePathFields.length - 1] !== y.field && r.push(`Row override "${R}" was created for another level and no longer points to this row path.`), It(u.sourceRowPath, g) || i.push(`Row override "${R}" points to a row path that is not in the current loaded rows.`), u.child && N(u.child, `${x} > Custom children`, h), u.child || i.push(`Row override "${R}" has no Custom children; it only renames the matching row.`);
226
+ const R = u.label && u.label.trim() ? u.label.trim() : `Row override ${D + 1}`, x = `${C} > ${R}`;
227
+ Ne(u.condition) ? Ye(u.condition, b) || r.push(`Row override "${R}" does not match any loaded rows.`) : r.push(`Row override "${R}" needs a complete row rule.`), Array.isArray(u.sourcePathFields) && u.sourcePathFields.length > 0 && u.sourcePathFields[u.sourcePathFields.length - 1] !== y.field && r.push(`Row override "${R}" was created for another level and no longer points to this row path.`), Pt(u.sourceRowPath, b) || i.push(`Row override "${R}" points to a row path that is not in the current loaded rows.`), u.child && N(u.child, `${x} > Custom children`, v), u.child || i.push(`Row override "${R}" has no Custom children; it only renames the matching row.`);
228
228
  }
229
229
  );
230
230
  };
231
231
  return e ? N(e, "Level 1") : r.push("Report needs at least Level 1."), { errors: r, warnings: i, valid: r.length === 0 };
232
- }, Pt = (e) => !e || !e.branchBadge ? `Level ${e ? e.levelNumber : 1}` : e.branchDepth === 0 ? `Override children ${e.branchBadge}` : `Override child level ${e.branchBadge}.${e.branchDepth + 1}`, ne = (e, l) => {
232
+ }, Lt = (e) => !e || !e.branchBadge ? `Level ${e ? e.levelNumber : 1}` : e.branchDepth === 0 ? `Override children ${e.branchBadge}` : `Override child level ${e.branchBadge}.${e.branchDepth + 1}`, ae = (e, l) => {
233
233
  let n = e;
234
234
  for (let a = 0; n && a < l.length; a += 1) {
235
235
  const r = l[a];
236
236
  if (r === T)
237
237
  n = n.defaultChild || null;
238
238
  else {
239
- const i = Se(r);
239
+ const i = Ce(r);
240
240
  n = i >= 0 && n.branches[i] ? n.branches[i].child : null;
241
241
  }
242
242
  }
243
243
  return n || null;
244
244
  }, Fe = (e, l, n) => {
245
- const a = ne(e, l);
245
+ const a = ae(e, l);
246
246
  return a && a.branches[n] ? a.branches[n] : null;
247
- }, O = (e, l, n) => {
247
+ }, _ = (e, l, n) => {
248
248
  if (!e) return e;
249
249
  const a = (r, i) => {
250
250
  if (!r) return r;
@@ -255,17 +255,17 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
255
255
  ...r,
256
256
  defaultChild: a(r.defaultChild, i + 1)
257
257
  });
258
- const f = Se(s);
258
+ const f = Ce(s);
259
259
  return f < 0 || f >= r.branches.length ? r : V({
260
260
  ...r,
261
261
  branches: r.branches.map(
262
262
  /** @param {any} [branch] @param {any} [index] @returns {any} */
263
- (m, g) => g === f ? { ...m, child: a(m.child, i + 1) } : m
263
+ (E, b) => b === f ? { ...E, child: a(E.child, i + 1) } : E
264
264
  )
265
265
  });
266
266
  };
267
267
  return a(e, 0);
268
- }, ve = (e, l, n, a) => e && O(
268
+ }, me = (e, l, n, a) => e && _(
269
269
  e,
270
270
  l,
271
271
  /** @param {any} [node] @returns {any} */
@@ -273,10 +273,10 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
273
273
  ...r,
274
274
  branches: r.branches.map(
275
275
  /** @param {any} [branch] @param {any} [index] @returns {any} */
276
- (i, s) => s === n ? De(a(i)) : i
276
+ (i, s) => s === n ? Re(a(i)) : i
277
277
  )
278
278
  }
279
- ), Lt = (e) => {
279
+ ), zt = (e) => {
280
280
  if (!e) return [];
281
281
  const l = [], n = (a, r) => {
282
282
  a && (l.push({
@@ -321,13 +321,13 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
321
321
  branchBadge: null,
322
322
  branchDepth: 0
323
323
  }), l;
324
- }, le = (e = []) => e.join(">"), we = (e = [], l = []) => le(e) === le(l), Q = (e) => e == null ? "" : String(e), Z = (e) => e ? e.type === "node" ? `node:${le(e.path)}` : e.type === "branch" ? `branch:${le(e.nodePath)}:${e.branchIndex}` : e.type === "rowPath" ? `rowPath:${le(e.nodePath)}:${e.field}:${Q(e.value)}` : "" : "", Ee = (e, l) => (e || []).find(
324
+ }, re = (e = []) => e.join(">"), ke = (e = [], l = []) => re(e) === re(l), Q = (e) => e == null ? "" : String(e), Z = (e) => e ? e.type === "node" ? `node:${re(e.path)}` : e.type === "branch" ? `branch:${re(e.nodePath)}:${e.branchIndex}` : e.type === "rowPath" ? `rowPath:${re(e.nodePath)}:${e.field}:${Q(e.value)}` : "" : "", we = (e, l) => (e || []).find(
325
325
  /** @param {any} [item] @returns {any} */
326
- (n) => n.kind === "node" && we(n.nodePath, l)
327
- ) || null, lt = (e, l, n) => (e || []).find(
326
+ (n) => n.kind === "node" && ke(n.nodePath, l)
327
+ ) || null, rt = (e, l, n) => (e || []).find(
328
328
  /** @param {any} [item] @returns {any} */
329
- (a) => a.kind === "branch" && we(a.nodePath, l) && a.branchIndex === n
330
- ) || null, Ze = (e, l, n) => {
329
+ (a) => a.kind === "branch" && ke(a.nodePath, l) && a.branchIndex === n
330
+ ) || null, Xe = (e, l, n) => {
331
331
  if (!e || !l) return !1;
332
332
  const a = Q(n);
333
333
  return (e.condition && Array.isArray(e.condition.clauses) ? e.condition.clauses : []).some(
@@ -340,7 +340,7 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
340
340
  condition: {
341
341
  op: "AND",
342
342
  clauses: [{
343
- ...Ue(e),
343
+ ...et(e),
344
344
  operator: "eq",
345
345
  value: Q(l),
346
346
  values: []
@@ -354,7 +354,7 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
354
354
  } catch {
355
355
  return V(e);
356
356
  }
357
- }, Ne = (e) => Array.from({ length: Math.max(0, e) }, () => T), We = (e, l = 1, n = []) => {
357
+ }, Ie = (e) => Array.from({ length: Math.max(0, e) }, () => T), We = (e, l = 1, n = []) => {
358
358
  const a = [];
359
359
  let r = e, i = 0, s = Array.isArray(n) ? [...n] : [];
360
360
  for (; r; )
@@ -374,7 +374,7 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
374
374
  defaultChild: l
375
375
  });
376
376
  return l;
377
- }, rt = (e, l, n) => {
377
+ }, nt = (e, l, n) => {
378
378
  const a = We(e).map(
379
379
  /** @param {any} [item] @returns {any} */
380
380
  (s) => s.node
@@ -383,45 +383,45 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
383
383
  return e;
384
384
  const r = [...a], [i] = r.splice(l, 1);
385
385
  return r.splice(n, 0, i), Wt(r);
386
- }, zt = (e) => {
386
+ }, Tt = (e) => {
387
387
  const l = Oe(e);
388
388
  return !l || !l.field ? null : l;
389
- }, Tt = (e, l) => l ? l.type === "node" ? Ee(e, l.path) : l.type === "branch" ? lt(e, l.nodePath, l.branchIndex) : null : null, jt = (e, l) => {
389
+ }, jt = (e, l) => l ? l.type === "node" ? we(e, l.path) : l.type === "branch" ? rt(e, l.nodePath, l.branchIndex) : null : null, Mt = (e, l) => {
390
390
  if (!l) return [];
391
391
  const n = [], a = (s) => {
392
- const f = Ee(e, s);
392
+ const f = we(e, s);
393
393
  f && n.push(f);
394
394
  }, r = (s, f) => {
395
- const m = lt(e, s, f);
396
- m && n.push(m);
395
+ const E = rt(e, s, f);
396
+ E && n.push(E);
397
397
  }, i = (s) => {
398
398
  if (a([]), !Array.isArray(s) || s.length === 0) return;
399
399
  let f = [];
400
- s.forEach((m) => {
401
- if (m === T) {
402
- f = [...f, m], a(f);
400
+ s.forEach((E) => {
401
+ if (E === T) {
402
+ f = [...f, E], a(f);
403
403
  return;
404
404
  }
405
- const g = Se(m);
406
- g >= 0 && (r(f, g), f = [...f, m], a(f));
405
+ const b = Ce(E);
406
+ b >= 0 && (r(f, b), f = [...f, E], a(f));
407
407
  });
408
408
  };
409
409
  return l.type === "node" ? (i(l.path), n) : (i(l.nodePath), r(l.nodePath, l.branchIndex), n);
410
- }, Mt = (e, l) => {
410
+ }, Ht = (e, l) => {
411
411
  if (!l) return [];
412
412
  if (l.type === "node") {
413
- const a = [], r = Ee(e, [...l.path, T]);
413
+ const a = [], r = we(e, [...l.path, T]);
414
414
  r && a.push(r);
415
415
  const i = (e || []).filter(
416
416
  /** @param {any} [item] @returns {any} */
417
- (s) => s.kind === "branch" && we(s.nodePath, l.path)
417
+ (s) => s.kind === "branch" && ke(s.nodePath, l.path)
418
418
  ).sort(
419
419
  /** @param {any} [left] @param {any} [right] @returns {any} */
420
420
  (s, f) => s.branchIndex - f.branchIndex
421
421
  );
422
422
  return [...a, ...i];
423
423
  }
424
- const n = Ee(e, [...l.nodePath, _e(l.branchIndex)]);
424
+ const n = we(e, [...l.nodePath, _e(l.branchIndex)]);
425
425
  return n ? [n] : [];
426
426
  }, q = (e, l = {}) => ({
427
427
  border: `1px solid ${e.border}`,
@@ -457,7 +457,7 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
457
457
  alignItems: "center",
458
458
  gap: "6px",
459
459
  marginBottom: "10px"
460
- }), pe = (e) => ({
460
+ }), ue = (e) => ({
461
461
  border: `1px solid ${e.border}`,
462
462
  borderRadius: "14px",
463
463
  background: e.surfaceBg || e.background || "#fff",
@@ -465,13 +465,13 @@ const _e = (e) => `${Be}${e}`, Se = (e) => {
465
465
  display: "flex",
466
466
  flexDirection: "column",
467
467
  gap: "12px"
468
- }), Ht = (e) => ({
468
+ }), Vt = (e) => ({
469
469
  borderTop: `2px solid ${e.textSec || "#334155"}`,
470
470
  paddingTop: "14px",
471
471
  display: "flex",
472
472
  flexDirection: "column",
473
473
  gap: "12px"
474
- }), nt = (e, l, n) => ({
474
+ }), at = (e, l, n) => ({
475
475
  width: `calc(100% - ${n * 14}px)`,
476
476
  marginLeft: `${n * 14}px`,
477
477
  border: `1px solid ${l ? e.primary || "#2563EB" : e.border}`,
@@ -505,7 +505,7 @@ function X({ children: e, theme: l, tone: n = "neutral" }) {
505
505
  e
506
506
  );
507
507
  }
508
- function re({
508
+ function ne({
509
509
  theme: e,
510
510
  title: l,
511
511
  description: n,
@@ -514,45 +514,52 @@ function re({
514
514
  sectionId: i,
515
515
  children: s
516
516
  }) {
517
- return /* @__PURE__ */ t.createElement("section", { "data-report-section": i || l, style: Ht(e) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", gap: "8px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { color: e.textSec, display: "flex", alignItems: "center", paddingTop: "1px", flexShrink: 0 } }, a), /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "13px", fontWeight: 900, color: e.text } }, l), n && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: e.textSec, lineHeight: 1.45, marginTop: "2px" } }, n))), r && /* @__PURE__ */ t.createElement("div", { style: { flexShrink: 0 } }, r)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, s));
517
+ return /* @__PURE__ */ t.createElement("section", { "data-report-section": i || l, style: Vt(e) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", gap: "8px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { color: e.textSec, display: "flex", alignItems: "center", paddingTop: "1px", flexShrink: 0 } }, a), /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "13px", fontWeight: 900, color: e.text } }, l), n && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: e.textSec, lineHeight: 1.45, marginTop: "2px" } }, n))), r && /* @__PURE__ */ t.createElement("div", { style: { flexShrink: 0 } }, r)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, s));
518
518
  }
519
- function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClose: r, theme: i, title: s, description: f }) {
520
- const [m, g] = H(() => Le(e)), F = q(i), N = B(() => {
521
- g(
519
+ function Pe({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClose: r, theme: i, title: s, description: f }) {
520
+ const [E, b] = H(() => ze(e)), B = q(i), N = F(() => {
521
+ b(
522
522
  /** @param {any} [prev] @returns {any} */
523
- (c) => ({ ...c, clauses: [...c.clauses, Ue(l[0] || "")] })
523
+ (c) => ({ ...c, clauses: [...c.clauses, et(l[0] || "")] })
524
524
  );
525
- }, [l]), y = B((c, E) => {
526
- g(
525
+ }, [l]), y = F((c, g) => {
526
+ b(
527
527
  /** @param {any} [prev] @returns {any} */
528
- (h) => ({
529
- ...h,
530
- clauses: h.clauses.map(
528
+ (v) => ({
529
+ ...v,
530
+ clauses: v.clauses.map(
531
531
  /** @param {any} [clause] @param {any} [clauseIndex] @returns {any} */
532
- (u, D) => D === c ? { ...u, ...E } : u
532
+ (u, D) => D === c ? { ...u, ...g } : u
533
533
  )
534
534
  })
535
535
  );
536
- }, []), w = B((c) => {
537
- g(
536
+ }, []), C = F((c) => {
537
+ b(
538
538
  /** @param {any} [prev] @returns {any} */
539
- (E) => ({
540
- ...E,
541
- clauses: E.clauses.filter(
539
+ (g) => ({
540
+ ...g,
541
+ clauses: g.clauses.filter(
542
542
  /** @param {any} [_] @param {any} [clauseIndex] @returns {any} */
543
- (h, u) => u !== c
543
+ (v, u) => u !== c
544
544
  )
545
545
  })
546
546
  );
547
547
  }, []);
548
- return /* @__PURE__ */ t.createElement(
548
+ return Ee(() => {
549
+ if (typeof r != "function") return;
550
+ const c = (g) => {
551
+ g.key === "Escape" && !g.defaultPrevented && (g.preventDefault(), r());
552
+ };
553
+ return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
554
+ }, [r]), /* @__PURE__ */ t.createElement(
549
555
  "div",
550
556
  {
557
+ className: "sp-dialog-backdrop",
551
558
  style: {
552
559
  position: "fixed",
553
560
  inset: 0,
554
561
  zIndex: 9999,
555
- background: "rgba(15, 23, 42, 0.45)",
562
+ background: "rgba(15, 23, 42, 0.38)",
556
563
  display: "flex",
557
564
  alignItems: "center",
558
565
  justifyContent: "center"
@@ -562,25 +569,28 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
562
569
  /* @__PURE__ */ t.createElement(
563
570
  "div",
564
571
  {
572
+ className: "sp-dialog-surface",
573
+ role: "dialog",
574
+ "aria-modal": "true",
565
575
  style: {
566
- ...pe(i),
576
+ ...ue(i),
567
577
  width: "520px",
568
578
  maxWidth: "95vw",
569
579
  maxHeight: "85vh",
570
580
  overflowY: "auto",
571
- boxShadow: "0 24px 64px rgba(15, 23, 42, 0.22)"
581
+ boxShadow: i.shadow || "0 24px 64px rgba(15, 23, 42, 0.26)"
572
582
  },
573
583
  onClick: (c) => c.stopPropagation()
574
584
  },
575
- /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: i.text } }, s || "Edit row override rule"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, marginTop: "2px" } }, f || "Add one or more clauses to decide when this row override should be used.")), /* @__PURE__ */ t.createElement("button", { type: "button", onClick: r, style: { background: "none", border: "none", cursor: "pointer", color: i.textSec } }, /* @__PURE__ */ t.createElement(v.Close, null))),
576
- m.clauses.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", alignItems: "center", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", color: i.textSec, fontWeight: 700 } }, "Match:"), ["AND", "OR"].map((c) => /* @__PURE__ */ t.createElement(
585
+ /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, letterSpacing: "-0.01em", color: i.text } }, s || "Edit row override rule"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, marginTop: "2px" } }, f || "Add one or more clauses to decide when this row override should be used.")), /* @__PURE__ */ t.createElement("button", { type: "button", className: "sp-btn sp-btn-ghost", onClick: r, style: { background: "transparent", border: "none", borderRadius: "6px", cursor: "pointer", color: i.textSec, padding: "4px", display: "inline-flex", alignItems: "center" } }, /* @__PURE__ */ t.createElement(m.Close, null))),
586
+ E.clauses.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", alignItems: "center", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", color: i.textSec, fontWeight: 700 } }, "Match:"), ["AND", "OR"].map((c) => /* @__PURE__ */ t.createElement(
577
587
  "button",
578
588
  {
579
589
  key: c,
580
590
  type: "button",
581
- onClick: () => g(
591
+ onClick: () => b(
582
592
  /** @param {any} [prev] @returns {any} */
583
- (E) => ({ ...E, op: c })
593
+ (g) => ({ ...g, op: c })
584
594
  ),
585
595
  style: {
586
596
  padding: "5px 12px",
@@ -589,15 +599,15 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
589
599
  fontWeight: 800,
590
600
  border: "none",
591
601
  cursor: "pointer",
592
- background: m.op === c ? i.primary || "#2563EB" : i.hover || "#F3F4F6",
593
- color: m.op === c ? "#fff" : i.textSec
602
+ background: E.op === c ? i.primary || "#2563EB" : i.hover || "#F3F4F6",
603
+ color: E.op === c ? "#fff" : i.textSec
594
604
  }
595
605
  },
596
606
  c
597
607
  ))),
598
- /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, m.clauses.length === 0 && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, fontStyle: "italic" } }, "No clauses means this row override matches every row at this level."), m.clauses.map(
608
+ /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, E.clauses.length === 0 && /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: i.textSec, fontStyle: "italic" } }, "No clauses means this row override matches every row at this level."), E.clauses.map(
599
609
  /** @param {any} [clause] @param {any} [index] @returns {any} */
600
- (c, E) => /* @__PURE__ */ t.createElement(
610
+ (c, g) => /* @__PURE__ */ t.createElement(
601
611
  "div",
602
612
  {
603
613
  key: c._id,
@@ -611,40 +621,44 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
611
621
  alignItems: "flex-start"
612
622
  }
613
623
  },
614
- /* @__PURE__ */ t.createElement("div", { style: { width: "32px", paddingTop: "6px", textAlign: "center", fontSize: "10px", fontWeight: 800, color: i.textSec } }, E > 0 ? m.op : ""),
624
+ /* @__PURE__ */ t.createElement("div", { style: { width: "32px", paddingTop: "6px", textAlign: "center", fontSize: "10px", fontWeight: 800, color: i.textSec } }, g > 0 ? E.op : ""),
615
625
  /* @__PURE__ */ t.createElement("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "8px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(
616
- "select",
626
+ U,
617
627
  {
628
+ size: "sm",
629
+ "aria-label": "Filter field",
618
630
  value: c.field,
619
- onChange: (h) => y(E, { field: h.target.value }),
620
- style: { ...F, flex: 1, minWidth: "140px" }
631
+ onChange: (v) => y(g, { field: v.target.value }),
632
+ style: { ...B, flex: 1, minWidth: "140px" }
621
633
  },
622
634
  l.map(
623
635
  /** @param {any} [field] @returns {any} */
624
- (h) => /* @__PURE__ */ t.createElement("option", { key: h, value: h }, n(h))
636
+ (v) => /* @__PURE__ */ t.createElement("option", { key: v, value: v }, n(v))
625
637
  )
626
638
  ), /* @__PURE__ */ t.createElement(
627
- "select",
639
+ U,
628
640
  {
641
+ size: "sm",
642
+ "aria-label": "Filter operator",
629
643
  value: c.operator,
630
- onChange: (h) => {
631
- const u = h.target.value, D = de.has(u), R = de.has(c.operator);
632
- y(E, {
644
+ onChange: (v) => {
645
+ const u = v.target.value, D = pe.has(u), R = pe.has(c.operator);
646
+ y(g, {
633
647
  operator: u,
634
648
  values: D ? R ? c.values : c.value ? [c.value] : [] : c.values,
635
649
  value: D ? c.value : c.values[0] || c.value || ""
636
650
  });
637
651
  },
638
- style: { ...F, width: "160px", flexShrink: 0 }
652
+ style: { ...B, width: "160px", flexShrink: 0 }
639
653
  },
640
- Xe.map((h) => /* @__PURE__ */ t.createElement("option", { key: h.value, value: h.value }, h.label))
641
- )), de.has(c.operator) ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, c.values.length > 0 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" } }, c.values.map(
654
+ Qe.map((v) => /* @__PURE__ */ t.createElement("option", { key: v.value, value: v.value }, v.label))
655
+ )), pe.has(c.operator) ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, c.values.length > 0 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" } }, c.values.map(
642
656
  /** @param {any} [value] @param {any} [valueIndex] @returns {any} */
643
- (h, u) => /* @__PURE__ */ t.createElement(X, { key: `${c._id}-${u}`, theme: i, tone: "primary" }, /* @__PURE__ */ t.createElement("span", null, h), /* @__PURE__ */ t.createElement(
657
+ (v, u) => /* @__PURE__ */ t.createElement(X, { key: `${c._id}-${u}`, theme: i, tone: "primary" }, /* @__PURE__ */ t.createElement("span", null, v), /* @__PURE__ */ t.createElement(
644
658
  "button",
645
659
  {
646
660
  type: "button",
647
- onClick: () => y(E, {
661
+ onClick: () => y(g, {
648
662
  values: c.values.filter(
649
663
  /** @param {any} [_] @param {any} [currentIndex] @returns {any} */
650
664
  (D, R) => R !== u
@@ -658,12 +672,12 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
658
672
  "input",
659
673
  {
660
674
  placeholder: "Type a value and press Enter",
661
- style: F,
675
+ style: B,
662
676
  onKeyDown: (
663
677
  /** @param {any} event */
664
- ((h) => {
665
- const u = h.target.value.trim();
666
- h.key === "Enter" && u && (c.values.includes(u) || y(E, { values: [...c.values, u] }), h.target.value = "", h.preventDefault());
678
+ ((v) => {
679
+ const u = v.target.value.trim();
680
+ v.key === "Enter" && u && (c.values.includes(u) || y(g, { values: [...c.values, u] }), v.target.value = "", v.preventDefault());
667
681
  })
668
682
  )
669
683
  }
@@ -671,19 +685,19 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
671
685
  "input",
672
686
  {
673
687
  value: c.value,
674
- onChange: (h) => y(E, { value: h.target.value }),
688
+ onChange: (v) => y(g, { value: v.target.value }),
675
689
  placeholder: "Value",
676
- style: F
690
+ style: B
677
691
  }
678
692
  )),
679
693
  /* @__PURE__ */ t.createElement(
680
694
  "button",
681
695
  {
682
696
  type: "button",
683
- onClick: () => w(E),
697
+ onClick: () => C(g),
684
698
  style: { background: "none", border: "none", cursor: "pointer", color: "#B91C1C", padding: "6px" }
685
699
  },
686
- /* @__PURE__ */ t.createElement(v.Delete, null)
700
+ /* @__PURE__ */ t.createElement(m.Delete, null)
687
701
  )
688
702
  )
689
703
  )),
@@ -698,7 +712,7 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
698
712
  borderStyle: "dashed"
699
713
  }
700
714
  },
701
- /* @__PURE__ */ t.createElement(v.Add, null),
715
+ /* @__PURE__ */ t.createElement(m.Add, null),
702
716
  " Add clause"
703
717
  ),
704
718
  /* @__PURE__ */ t.createElement("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px", borderTop: `1px solid ${i.border}`, paddingTop: "12px" } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: r, style: j(i) }, "Cancel"), /* @__PURE__ */ t.createElement(
@@ -706,7 +720,7 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
706
720
  {
707
721
  type: "button",
708
722
  onClick: () => {
709
- a(m), r();
723
+ a(E), r();
710
724
  },
711
725
  style: {
712
726
  background: i.primary || "#2563EB",
@@ -724,11 +738,11 @@ function Ie({ condition: e, allFields: l, getFieldLabel: n = M, onSave: a, onClo
724
738
  )
725
739
  );
726
740
  }
727
- function at({ value: e, onChange: l, theme: n }) {
728
- const a = me(e), r = q(n), i = (s) => l(me({ ...a, ...s }));
729
- return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Presentation"), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Indent px", /* @__PURE__ */ t.createElement("input", { type: "number", min: "0", value: a.indent, onChange: (s) => i({ indent: s.target.value }), placeholder: "Auto", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Row color", /* @__PURE__ */ t.createElement("input", { value: a.rowColor, onChange: (s) => i({ rowColor: s.target.value }), placeholder: "#F8FAFC", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label prefix", /* @__PURE__ */ t.createElement("input", { value: a.labelPrefix, onChange: (s) => i({ labelPrefix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label suffix", /* @__PURE__ */ t.createElement("input", { value: a.labelSuffix, onChange: (s) => i({ labelSuffix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec, gridColumn: "1 / -1" } }, "Number format override", /* @__PURE__ */ t.createElement("input", { value: a.numberFormat, onChange: (s) => i({ numberFormat: s.target.value }), placeholder: "fixed:2, percent, currency:$", style: r }))), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Border", /* @__PURE__ */ t.createElement("select", { value: a.borderStyle, onChange: (s) => i({ borderStyle: s.target.value }), style: r }, Qe.map((s) => /* @__PURE__ */ t.createElement("option", { key: s || "none", value: s }, s || "None")))), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Border color", /* @__PURE__ */ t.createElement("input", { value: a.borderColor, onChange: (s) => i({ borderColor: s.target.value }), placeholder: "#CBD5E1", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Width", /* @__PURE__ */ t.createElement("input", { type: "number", min: "1", value: a.borderWidth, onChange: (s) => i({ borderWidth: s.target.value }), placeholder: "1", style: r }))), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "14px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "inline-flex", alignItems: "center", gap: "7px", fontSize: "12px", color: n.text, fontWeight: 700 } }, /* @__PURE__ */ t.createElement("input", { type: "checkbox", checked: a.bold, onChange: (s) => i({ bold: s.target.checked }) }), "Bold row"), /* @__PURE__ */ t.createElement("label", { style: { display: "inline-flex", alignItems: "center", gap: "7px", fontSize: "12px", color: n.text, fontWeight: 700 } }, /* @__PURE__ */ t.createElement("input", { type: "checkbox", checked: a.showSubtotal, onChange: (s) => i({ showSubtotal: s.target.checked }) }), "Show subtotal/other rows")));
741
+ function ot({ value: e, onChange: l, theme: n }) {
742
+ const a = Se(e), r = q(n), i = (s) => l(Se({ ...a, ...s }));
743
+ return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Presentation"), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Indent px", /* @__PURE__ */ t.createElement("input", { type: "number", min: "0", value: a.indent, onChange: (s) => i({ indent: s.target.value }), placeholder: "Auto", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Row color", /* @__PURE__ */ t.createElement("input", { value: a.rowColor, onChange: (s) => i({ rowColor: s.target.value }), placeholder: "#F8FAFC", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label prefix", /* @__PURE__ */ t.createElement("input", { value: a.labelPrefix, onChange: (s) => i({ labelPrefix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Label suffix", /* @__PURE__ */ t.createElement("input", { value: a.labelSuffix, onChange: (s) => i({ labelSuffix: s.target.value }), placeholder: "Optional", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec, gridColumn: "1 / -1" } }, "Number format override", /* @__PURE__ */ t.createElement("input", { value: a.numberFormat, onChange: (s) => i({ numberFormat: s.target.value }), placeholder: "fixed:2, percent, currency:$", style: r }))), /* @__PURE__ */ t.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: "8px" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Border", /* @__PURE__ */ t.createElement(U, { size: "sm", "aria-label": "Border", value: a.borderStyle, onChange: (s) => i({ borderStyle: s.target.value }), style: { ...r, width: "100%" } }, Ue.map((s) => /* @__PURE__ */ t.createElement("option", { key: s || "none", value: s }, s || "None")))), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Border color", /* @__PURE__ */ t.createElement("input", { value: a.borderColor, onChange: (s) => i({ borderColor: s.target.value }), placeholder: "#CBD5E1", style: r })), /* @__PURE__ */ t.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "5px", fontSize: "11px", color: n.textSec } }, "Width", /* @__PURE__ */ t.createElement("input", { type: "number", min: "1", value: a.borderWidth, onChange: (s) => i({ borderWidth: s.target.value }), placeholder: "1", style: r }))), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "14px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement("label", { style: { display: "inline-flex", alignItems: "center", gap: "7px", fontSize: "12px", color: n.text, fontWeight: 700 } }, /* @__PURE__ */ t.createElement("input", { type: "checkbox", checked: a.bold, onChange: (s) => i({ bold: s.target.checked }) }), "Bold row"), /* @__PURE__ */ t.createElement("label", { style: { display: "inline-flex", alignItems: "center", gap: "7px", fontSize: "12px", color: n.text, fontWeight: 700 } }, /* @__PURE__ */ t.createElement("input", { type: "checkbox", checked: a.showSubtotal, onChange: (s) => i({ showSubtotal: s.target.checked }) }), "Show subtotal/other rows")));
730
744
  }
731
- function Vt({ validation: e, theme: l }) {
745
+ function qt({ validation: e, theme: l }) {
732
746
  const n = e && Array.isArray(e.errors) ? e.errors : [], a = e && Array.isArray(e.warnings) ? e.warnings : [];
733
747
  return n.length === 0 && a.length === 0 ? null : /* @__PURE__ */ t.createElement("div", { "data-report-validation": "true", style: { border: `1px solid ${n.length > 0 ? "#FCA5A5" : "#FDE68A"}`, borderRadius: "12px", padding: "10px 12px", background: n.length > 0 ? "#FEF2F2" : "#FFFBEB", color: n.length > 0 ? "#991B1B" : "#92400E", fontSize: "11px", lineHeight: 1.45, display: "flex", flexDirection: "column", gap: "6px" } }, n.length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontWeight: 900, marginBottom: "4px" } }, "Fix before applying or saving"), n.map(
734
748
  /** @param {any} [message] @returns {any} */
@@ -738,7 +752,7 @@ function Vt({ validation: e, theme: l }) {
738
752
  (r) => /* @__PURE__ */ t.createElement("div", { key: `warn:${r}` }, r)
739
753
  )));
740
754
  }
741
- function qt({ debug: e, theme: l }) {
755
+ function Kt({ debug: e, theme: l }) {
742
756
  if (!e || typeof e != "object") return null;
743
757
  const n = [
744
758
  ["Matched level", e.matchedLevel || e.levelLabel || ""],
@@ -752,7 +766,7 @@ function qt({ debug: e, theme: l }) {
752
766
  ([a, r]) => /* @__PURE__ */ t.createElement("div", { key: a, style: { display: "flex", justifyContent: "space-between", gap: "10px", fontSize: "11px" } }, /* @__PURE__ */ t.createElement("span", { style: { color: l.textSec, fontWeight: 800 } }, a), /* @__PURE__ */ t.createElement("span", { style: { color: l.text, textAlign: "right", overflowWrap: "anywhere" } }, r))
753
767
  ));
754
768
  }
755
- function ot({
769
+ function it({
756
770
  title: e,
757
771
  summary: l,
758
772
  theme: n,
@@ -794,21 +808,21 @@ function ot({
794
808
  },
795
809
  "aria-expanded": i
796
810
  },
797
- /* @__PURE__ */ t.createElement("span", { style: { display: "inline-flex", color: n.textSec, flexShrink: 0 } }, i ? /* @__PURE__ */ t.createElement(v.ChevronDown, null) : /* @__PURE__ */ t.createElement(v.ChevronRight, null)),
811
+ /* @__PURE__ */ t.createElement("span", { style: { display: "inline-flex", color: n.textSec, flexShrink: 0 } }, i ? /* @__PURE__ */ t.createElement(m.ChevronDown, null) : /* @__PURE__ */ t.createElement(m.ChevronRight, null)),
798
812
  /* @__PURE__ */ t.createElement("span", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { display: "block", fontSize: "12px", fontWeight: 900, color: n.text } }, e), l && /* @__PURE__ */ t.createElement("span", { style: { display: "block", fontSize: "11px", color: n.textSec, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", marginTop: "2px" } }, l))
799
813
  ),
800
814
  i && /* @__PURE__ */ t.createElement("div", { style: { borderTop: `1px solid ${n.border}`, padding: "12px", display: "flex", flexDirection: "column", gap: "12px" } }, r)
801
815
  );
802
816
  }
803
817
  function Jt({ item: e, selected: l, theme: n, sortByOptions: a, getFieldLabel: r = M, onSelect: i }) {
804
- const s = e.node, f = Pt(e), m = s.field ? r(s.field) : "Select field", g = tt(s), F = et(s.sortBy, a);
805
- return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: nt(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: e.branchBadge ? "primary" : "neutral" }, f), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, m)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec } }, "Header: ", g), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, s.topN ? `Top ${s.topN}` : "All rows"), /* @__PURE__ */ t.createElement(X, { theme: n }, F ? `Sort ${s.sortDir}${s.sortAbs ? " |abs|" : ""} by ${F}` : "Default sort"), s.defaultChild && /* @__PURE__ */ t.createElement(X, { theme: n }, "Has next level"), s.branches.length > 0 && /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, s.branches.length, " row override", s.branches.length === 1 ? "" : "s"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(v.ChevronRight, null))));
818
+ const s = e.node, f = Lt(e), E = s.field ? r(s.field) : "Select field", b = lt(s), B = tt(s.sortBy, a);
819
+ return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: e.branchBadge ? "primary" : "neutral" }, f), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, E)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec } }, "Header: ", b), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, s.topN ? `Top ${s.topN}` : "All rows"), /* @__PURE__ */ t.createElement(X, { theme: n }, B ? `Sort ${s.sortDir}${s.sortAbs ? " |abs|" : ""} by ${B}` : "Default sort"), s.defaultChild && /* @__PURE__ */ t.createElement(X, { theme: n }, "Has next level"), s.branches.length > 0 && /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, s.branches.length, " row override", s.branches.length === 1 ? "" : "s"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
806
820
  }
807
- function Kt({ item: e, selected: l, theme: n, onSelect: a }) {
821
+ function Gt({ item: e, selected: l, theme: n, onSelect: a }) {
808
822
  const r = e.branch, i = r.label && r.label.trim() ? r.label.trim() : "Display original label";
809
- return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: a, style: nt(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, i)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, Ce(r.condition)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, r.child ? "Custom children" : "Default children"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(v.ChevronRight, null))));
823
+ return /* @__PURE__ */ t.createElement("button", { type: "button", onClick: a, style: at(n, l, e.depth) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "10px" } }, /* @__PURE__ */ t.createElement("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: "7px" } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n, tone: "primary" }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text } }, i)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, Ae(r.condition)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ t.createElement(X, { theme: n }, r.child ? "Custom children" : "Default children"))), /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))));
810
824
  }
811
- function it({
825
+ function st({
812
826
  item: e,
813
827
  selected: l,
814
828
  theme: n,
@@ -817,9 +831,9 @@ function it({
817
831
  onSelect: i,
818
832
  onDragStart: s,
819
833
  onDragOver: f,
820
- onDrop: m
834
+ onDrop: E
821
835
  }) {
822
- const g = e.node, F = g.field ? r(g.field) : "Select field", N = g.label && g.label.trim() ? g.label.trim() : F, y = et(g.sortBy, a);
836
+ const b = e.node, B = b.field ? r(b.field) : "Select field", N = b.label && b.label.trim() ? b.label.trim() : B, y = tt(b.sortBy, a);
823
837
  return /* @__PURE__ */ t.createElement(
824
838
  "button",
825
839
  {
@@ -827,7 +841,7 @@ function it({
827
841
  draggable: !0,
828
842
  onDragStart: s,
829
843
  onDragOver: f,
830
- onDrop: m,
844
+ onDrop: E,
831
845
  onClick: i,
832
846
  style: {
833
847
  width: "100%",
@@ -842,12 +856,12 @@ function it({
842
856
  gap: "10px"
843
857
  }
844
858
  },
845
- /* @__PURE__ */ t.createElement("span", { style: { cursor: "grab", display: "inline-flex" } }, /* @__PURE__ */ t.createElement(v.DragIndicator, null)),
846
- /* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "7px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", fontWeight: 800, color: n.textSec, flexShrink: 0 } }, "Level ", e.levelNumber), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, N)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, marginTop: "3px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, F, y ? ` · ${g.sortDir === "asc" ? "Asc" : "Desc"}${g.sortAbs ? " |abs|" : ""} by ${y}` : "", g.topN ? ` · Top ${g.topN}` : "", g.filters && g.filters.clauses && g.filters.clauses.length > 0 ? ` · ${g.filters.clauses.length} filter${g.filters.clauses.length === 1 ? "" : "s"}` : "")),
847
- /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(v.ChevronRight, null))
859
+ /* @__PURE__ */ t.createElement("span", { style: { cursor: "grab", display: "inline-flex" } }, /* @__PURE__ */ t.createElement(m.DragIndicator, null)),
860
+ /* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "center", gap: "7px", minWidth: 0 } }, /* @__PURE__ */ t.createElement("span", { style: { fontSize: "11px", fontWeight: 800, color: n.textSec, flexShrink: 0 } }, "Level ", e.levelNumber), /* @__PURE__ */ t.createElement("span", { style: { fontSize: "12px", fontWeight: 800, color: n.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, N)), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: n.textSec, marginTop: "3px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, B, y ? ` · ${b.sortDir === "asc" ? "Asc" : "Desc"}${b.sortAbs ? " |abs|" : ""} by ${y}` : "", b.topN ? ` · Top ${b.topN}` : "", b.filters && b.filters.clauses && b.filters.clauses.length > 0 ? ` · ${b.filters.clauses.length} filter${b.filters.clauses.length === 1 ? "" : "s"}` : "")),
861
+ /* @__PURE__ */ t.createElement("span", { style: { color: l ? n.primary || "#2563EB" : n.textSec, flexShrink: 0 } }, /* @__PURE__ */ t.createElement(m.ChevronRight, null))
848
862
  );
849
863
  }
850
- function Gt({
864
+ function Yt({
851
865
  item: e,
852
866
  node: l,
853
867
  allFields: n,
@@ -856,18 +870,18 @@ function Gt({
856
870
  theme: i,
857
871
  onUpdate: s,
858
872
  onApply: f,
859
- onRemove: m,
860
- onEditFilter: g,
861
- titleLabel: F = "Title",
873
+ onRemove: E,
874
+ onEditFilter: b,
875
+ titleLabel: B = "Title",
862
876
  canRemove: N = !0
863
877
  }) {
864
- const y = q(i), w = e && e.levelNumber ? `Level ${e.levelNumber}` : "Level", c = !!(l.filters && l.filters.clauses && l.filters.clauses.length > 0), h = [
878
+ const y = q(i), C = e && e.levelNumber ? `Level ${e.levelNumber}` : "Level", c = !!(l.filters && l.filters.clauses && l.filters.clauses.length > 0), v = [
865
879
  l.field ? a(l.field) : "Select field",
866
880
  l.label && l.label.trim() ? `Title: ${l.label.trim()}` : null,
867
881
  l.topN ? `Top ${l.topN}` : null,
868
882
  c ? `${l.filters.clauses.length} filter${l.filters.clauses.length === 1 ? "" : "s"}` : null
869
883
  ].filter(Boolean);
870
- return /* @__PURE__ */ t.createElement("div", { style: pe(i) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: i.text } }, w)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexShrink: 0 } }, /* @__PURE__ */ t.createElement(
884
+ return /* @__PURE__ */ t.createElement("div", { style: ue(i) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: i.text } }, C)), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexShrink: 0 } }, /* @__PURE__ */ t.createElement(
871
885
  "button",
872
886
  {
873
887
  type: "button",
@@ -884,20 +898,22 @@ function Gt({
884
898
  }
885
899
  },
886
900
  "Apply"
887
- ), N && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: m, style: j(i, !1, !0) }, /* @__PURE__ */ t.createElement(v.Delete, null), " ", e && e.path && e.path.length === 0 ? "Clear report" : "Remove level"))), /* @__PURE__ */ t.createElement(
888
- ot,
901
+ ), N && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: E, style: j(i, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " ", e && e.path && e.path.length === 0 ? "Clear report" : "Remove level"))), /* @__PURE__ */ t.createElement(
902
+ it,
889
903
  {
890
- title: `${w} settings`,
891
- summary: h.join(" · "),
904
+ title: `${C} settings`,
905
+ summary: v.join(" · "),
892
906
  theme: i,
893
907
  defaultOpen: !1
894
908
  },
895
909
  /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, "Break Down By"), /* @__PURE__ */ t.createElement(
896
- "select",
910
+ U,
897
911
  {
912
+ size: "sm",
913
+ "aria-label": "Break down by",
898
914
  value: l.field,
899
915
  onChange: (u) => s({ ...l, field: u.target.value }),
900
- style: y
916
+ style: { ...y, width: "100%" }
901
917
  },
902
918
  /* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
903
919
  n.map(
@@ -905,7 +921,7 @@ function Gt({
905
921
  (u) => /* @__PURE__ */ t.createElement("option", { key: u, value: u }, a(u))
906
922
  )
907
923
  )),
908
- /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, F), /* @__PURE__ */ t.createElement(
924
+ /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, B), /* @__PURE__ */ t.createElement(
909
925
  "input",
910
926
  {
911
927
  value: l.label,
@@ -928,11 +944,13 @@ function Gt({
928
944
  style: { ...y, textAlign: "center" }
929
945
  }
930
946
  ), /* @__PURE__ */ t.createElement(
931
- "select",
947
+ U,
932
948
  {
949
+ size: "sm",
950
+ "aria-label": "Sort by",
933
951
  value: l.sortBy || "",
934
952
  onChange: (u) => s({ ...l, sortBy: u.target.value || null }),
935
- style: y
953
+ style: { ...y, width: "100%" }
936
954
  },
937
955
  r.map(
938
956
  /** @param {any} [option] @returns {any} */
@@ -975,13 +993,13 @@ function Gt({
975
993
  },
976
994
  title: l.sortDir === "asc" ? "Ascending" : "Descending"
977
995
  },
978
- l.sortDir === "asc" ? /* @__PURE__ */ t.createElement(v.SortAsc, null) : /* @__PURE__ */ t.createElement(v.SortDesc, null)
996
+ l.sortDir === "asc" ? /* @__PURE__ */ t.createElement(m.SortAsc, null) : /* @__PURE__ */ t.createElement(m.SortDesc, null)
979
997
  ))),
980
998
  /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(i) }, "Level Filter"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", alignItems: "stretch" } }, /* @__PURE__ */ t.createElement(
981
999
  "button",
982
1000
  {
983
1001
  type: "button",
984
- onClick: g,
1002
+ onClick: b,
985
1003
  style: q(i, {
986
1004
  flex: 1,
987
1005
  display: "flex",
@@ -993,8 +1011,8 @@ function Gt({
993
1011
  borderColor: c ? `${i.primary || "#2563EB"}45` : void 0
994
1012
  })
995
1013
  },
996
- /* @__PURE__ */ t.createElement(v.Filter, null),
997
- /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, c ? Ce(l.filters) : "No filter (show all rows)")
1014
+ /* @__PURE__ */ t.createElement(m.Filter, null),
1015
+ /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, c ? Ae(l.filters) : "No filter (show all rows)")
998
1016
  ), c && /* @__PURE__ */ t.createElement(
999
1017
  "button",
1000
1018
  {
@@ -1014,10 +1032,10 @@ function Gt({
1014
1032
  },
1015
1033
  title: "Clear filter"
1016
1034
  },
1017
- /* @__PURE__ */ t.createElement(v.Close, null)
1035
+ /* @__PURE__ */ t.createElement(m.Close, null)
1018
1036
  )), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: i.textSec, marginTop: "6px", lineHeight: 1.4 } }, `Rows that don't match the filter are grouped into "Others" to keep totals intact.`)),
1019
1037
  /* @__PURE__ */ t.createElement(
1020
- at,
1038
+ ot,
1021
1039
  {
1022
1040
  value: l.format,
1023
1041
  theme: i,
@@ -1029,7 +1047,7 @@ function Gt({
1029
1047
  )
1030
1048
  ));
1031
1049
  }
1032
- function Yt({
1050
+ function Zt({
1033
1051
  draft: e,
1034
1052
  allFields: l,
1035
1053
  getFieldLabel: n = M,
@@ -1039,28 +1057,28 @@ function Yt({
1039
1057
  onApply: s,
1040
1058
  onCancel: f
1041
1059
  }) {
1042
- const [m, g] = H(null), [F, N] = H(!1), y = e && e.child ? e.child : Y(""), w = Array.isArray(e && e.selectedPath) ? e.selectedPath : [], c = ne(y, w) || y, E = !!(c.filters && c.filters.clauses && c.filters.clauses.length > 0), h = We(y, e.childLevelNumber || 2), u = Math.max(0, w.length), D = (e && Number.isFinite(Number(e.childLevelNumber)) ? Number(e.childLevelNumber) : 2) + w.length, R = q(r), x = [
1060
+ const [E, b] = H(null), [B, N] = H(!1), y = e && e.child ? e.child : Y(""), C = Array.isArray(e && e.selectedPath) ? e.selectedPath : [], c = ae(y, C) || y, g = !!(c.filters && c.filters.clauses && c.filters.clauses.length > 0), v = We(y, e.childLevelNumber || 2), u = Math.max(0, C.length), D = (e && Number.isFinite(Number(e.childLevelNumber)) ? Number(e.childLevelNumber) : 2) + C.length, R = q(r), x = [
1043
1061
  c.field ? n(c.field) : "Select field",
1044
1062
  e.title && e.title.trim() ? `Title: ${e.title.trim()}` : null,
1045
1063
  c.topN ? `Top ${c.topN}` : null,
1046
- E ? `${c.filters.clauses.length} filter${c.filters.clauses.length === 1 ? "" : "s"}` : null
1047
- ].filter(Boolean), C = (d) => {
1064
+ g ? `${c.filters.clauses.length} filter${c.filters.clauses.length === 1 ? "" : "s"}` : null
1065
+ ].filter(Boolean), w = (d) => {
1048
1066
  i({
1049
1067
  ...e,
1050
- child: O(y, w, () => d)
1068
+ child: _(y, C, () => d)
1051
1069
  });
1052
- }, J = (d) => {
1070
+ }, K = (d) => {
1053
1071
  i({
1054
1072
  ...e,
1055
- selectedPath: Ne(d)
1073
+ selectedPath: Ie(d)
1056
1074
  });
1057
- }, ue = () => {
1058
- const d = [...w, T];
1075
+ }, fe = () => {
1076
+ const d = [...C, T];
1059
1077
  i({
1060
1078
  ...e,
1061
- child: O(
1079
+ child: _(
1062
1080
  y,
1063
- w,
1081
+ C,
1064
1082
  /** @param {any} [node] @returns {any} */
1065
1083
  (k) => ({
1066
1084
  ...k,
@@ -1069,12 +1087,12 @@ function Yt({
1069
1087
  ),
1070
1088
  selectedPath: d
1071
1089
  });
1072
- }, oe = () => {
1090
+ }, ie = () => {
1073
1091
  i({
1074
1092
  ...e,
1075
- child: O(
1093
+ child: _(
1076
1094
  y,
1077
- w,
1095
+ C,
1078
1096
  /** @param {any} [node] @returns {any} */
1079
1097
  (d) => ({
1080
1098
  ...d,
@@ -1082,14 +1100,14 @@ function Yt({
1082
1100
  })
1083
1101
  )
1084
1102
  });
1085
- }, fe = (d, k) => {
1103
+ }, ye = (d, k) => {
1086
1104
  d === null || d === k || (i({
1087
1105
  ...e,
1088
- child: rt(y, d, k),
1089
- selectedPath: Ne(k)
1090
- }), g(null));
1106
+ child: nt(y, d, k),
1107
+ selectedPath: Ie(k)
1108
+ }), b(null));
1091
1109
  };
1092
- return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", { style: pe(r) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: r.text } }, e.rowLabel || "Selected row"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: r.textSec, marginTop: "2px" } }, "Override applies to this row only.")), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexShrink: 0 } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(r) }, /* @__PURE__ */ t.createElement(v.Close, null), " Close"), /* @__PURE__ */ t.createElement(
1110
+ return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", { style: ue(r) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: r.text } }, e.rowLabel || "Selected row"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: r.textSec, marginTop: "2px" } }, "Override applies to this row only.")), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexShrink: 0 } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(r) }, /* @__PURE__ */ t.createElement(m.Close, null), " Close"), /* @__PURE__ */ t.createElement(
1093
1111
  "button",
1094
1112
  {
1095
1113
  type: "button",
@@ -1106,10 +1124,10 @@ function Yt({
1106
1124
  }
1107
1125
  },
1108
1126
  "Apply"
1109
- ))), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Level"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", fontWeight: 800, color: r.text } }, `Level ${D}`)), /* @__PURE__ */ t.createElement(qt, { debug: e.request && e.request.debug, theme: r }), h.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, h.map(
1127
+ ))), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Level"), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", fontWeight: 800, color: r.text } }, `Level ${D}`)), /* @__PURE__ */ t.createElement(Kt, { debug: e.request && e.request.debug, theme: r }), v.length > 1 && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, v.map(
1110
1128
  /** @param {any} [item] @returns {any} */
1111
1129
  (d) => /* @__PURE__ */ t.createElement(
1112
- it,
1130
+ st,
1113
1131
  {
1114
1132
  key: `draft-level:${d.index}:${d.node._id}`,
1115
1133
  item: d,
@@ -1117,11 +1135,11 @@ function Yt({
1117
1135
  theme: r,
1118
1136
  sortByOptions: a,
1119
1137
  getFieldLabel: n,
1120
- onSelect: () => J(d.index),
1138
+ onSelect: () => K(d.index),
1121
1139
  onDragStart: (
1122
1140
  /** @param {any} [event] @returns {any} */
1123
1141
  ((k) => {
1124
- g(d.index), k.dataTransfer.effectAllowed = "move";
1142
+ b(d.index), k.dataTransfer.effectAllowed = "move";
1125
1143
  })
1126
1144
  ),
1127
1145
  onDragOver: (
@@ -1131,13 +1149,13 @@ function Yt({
1131
1149
  onDrop: (
1132
1150
  /** @param {any} [event] @returns {any} */
1133
1151
  ((k) => {
1134
- k.preventDefault(), fe(m, d.index);
1152
+ k.preventDefault(), ye(E, d.index);
1135
1153
  })
1136
1154
  )
1137
1155
  }
1138
1156
  )
1139
1157
  )), /* @__PURE__ */ t.createElement(
1140
- ot,
1158
+ it,
1141
1159
  {
1142
1160
  title: `Level ${D} settings`,
1143
1161
  summary: x.join(" · "),
@@ -1154,11 +1172,13 @@ function Yt({
1154
1172
  }
1155
1173
  )),
1156
1174
  /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Break Down By"), /* @__PURE__ */ t.createElement(
1157
- "select",
1175
+ U,
1158
1176
  {
1177
+ size: "sm",
1178
+ "aria-label": "Break down by",
1159
1179
  value: c.field,
1160
- onChange: (d) => C({ ...c, field: d.target.value }),
1161
- style: R
1180
+ onChange: (d) => w({ ...c, field: d.target.value }),
1181
+ style: { ...R, width: "100%" }
1162
1182
  },
1163
1183
  /* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
1164
1184
  l.map(
@@ -1174,17 +1194,19 @@ function Yt({
1174
1194
  value: c.topN || "",
1175
1195
  onChange: (d) => {
1176
1196
  const k = d.target.value === "" ? null : parseInt(d.target.value, 10);
1177
- C({ ...c, topN: k && k > 0 ? k : null });
1197
+ w({ ...c, topN: k && k > 0 ? k : null });
1178
1198
  },
1179
1199
  placeholder: "All",
1180
1200
  style: { ...R, textAlign: "center" }
1181
1201
  }
1182
1202
  ), /* @__PURE__ */ t.createElement(
1183
- "select",
1203
+ U,
1184
1204
  {
1205
+ size: "sm",
1206
+ "aria-label": "Sort by",
1185
1207
  value: c.sortBy || "",
1186
- onChange: (d) => C({ ...c, sortBy: d.target.value || null }),
1187
- style: R
1208
+ onChange: (d) => w({ ...c, sortBy: d.target.value || null }),
1209
+ style: { ...R, width: "100%" }
1188
1210
  },
1189
1211
  a.map(
1190
1212
  /** @param {any} [option] @returns {any} */
@@ -1194,7 +1216,7 @@ function Yt({
1194
1216
  "button",
1195
1217
  {
1196
1218
  type: "button",
1197
- onClick: () => C({ ...c, sortAbs: !c.sortAbs }),
1219
+ onClick: () => w({ ...c, sortAbs: !c.sortAbs }),
1198
1220
  style: {
1199
1221
  border: `1px solid ${c.sortAbs ? r.primary || "#2563EB" : r.border}`,
1200
1222
  borderRadius: "10px",
@@ -1214,7 +1236,7 @@ function Yt({
1214
1236
  "button",
1215
1237
  {
1216
1238
  type: "button",
1217
- onClick: () => C({ ...c, sortDir: c.sortDir === "asc" ? "desc" : "asc" }),
1239
+ onClick: () => w({ ...c, sortDir: c.sortDir === "asc" ? "desc" : "asc" }),
1218
1240
  style: {
1219
1241
  border: `1px solid ${r.border}`,
1220
1242
  borderRadius: "10px",
@@ -1227,7 +1249,7 @@ function Yt({
1227
1249
  },
1228
1250
  title: c.sortDir === "asc" ? "Ascending" : "Descending"
1229
1251
  },
1230
- c.sortDir === "asc" ? /* @__PURE__ */ t.createElement(v.SortAsc, null) : /* @__PURE__ */ t.createElement(v.SortDesc, null)
1252
+ c.sortDir === "asc" ? /* @__PURE__ */ t.createElement(m.SortAsc, null) : /* @__PURE__ */ t.createElement(m.SortDesc, null)
1231
1253
  ))),
1232
1254
  /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Filter (this row's children only)"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", alignItems: "stretch" } }, /* @__PURE__ */ t.createElement(
1233
1255
  "button",
@@ -1241,17 +1263,17 @@ function Yt({
1241
1263
  gap: "8px",
1242
1264
  textAlign: "left",
1243
1265
  cursor: "pointer",
1244
- background: E ? `${r.primary || "#2563EB"}08` : r.hover || "#F8FAFC",
1245
- borderColor: E ? `${r.primary || "#2563EB"}45` : void 0
1266
+ background: g ? `${r.primary || "#2563EB"}08` : r.hover || "#F8FAFC",
1267
+ borderColor: g ? `${r.primary || "#2563EB"}45` : void 0
1246
1268
  })
1247
1269
  },
1248
- /* @__PURE__ */ t.createElement(v.Filter, null),
1249
- /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, E ? Ce(c.filters) : "No filter (show all children)")
1250
- ), E && /* @__PURE__ */ t.createElement(
1270
+ /* @__PURE__ */ t.createElement(m.Filter, null),
1271
+ /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 } }, g ? Ae(c.filters) : "No filter (show all children)")
1272
+ ), g && /* @__PURE__ */ t.createElement(
1251
1273
  "button",
1252
1274
  {
1253
1275
  type: "button",
1254
- onClick: () => C({ ...c, filters: null }),
1276
+ onClick: () => w({ ...c, filters: null }),
1255
1277
  style: {
1256
1278
  border: `1px solid ${r.border}`,
1257
1279
  borderRadius: "10px",
@@ -1266,16 +1288,16 @@ function Yt({
1266
1288
  },
1267
1289
  title: "Clear filter"
1268
1290
  },
1269
- /* @__PURE__ */ t.createElement(v.Close, null)
1291
+ /* @__PURE__ */ t.createElement(m.Close, null)
1270
1292
  )), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "11px", color: r.textSec, marginTop: "6px", lineHeight: 1.4 } }, 'Filtered-out children are grouped into "Others" to keep totals intact.')),
1271
1293
  /* @__PURE__ */ t.createElement(
1272
- at,
1294
+ ot,
1273
1295
  {
1274
1296
  value: c.format,
1275
1297
  theme: r,
1276
1298
  onChange: (
1277
1299
  /** @param {any} [format] @returns {any} */
1278
- ((d) => C({ ...c, format: d }))
1300
+ ((d) => w({ ...c, format: d }))
1279
1301
  )
1280
1302
  }
1281
1303
  ),
@@ -1283,27 +1305,27 @@ function Yt({
1283
1305
  "button",
1284
1306
  {
1285
1307
  type: "button",
1286
- onClick: ue,
1308
+ onClick: fe,
1287
1309
  disabled: !c.field,
1288
1310
  style: { ...j(r, !!c.defaultChild), opacity: c.field ? 1 : 0.5 }
1289
1311
  },
1290
- /* @__PURE__ */ t.createElement(v.Add, null),
1312
+ /* @__PURE__ */ t.createElement(m.Add, null),
1291
1313
  " ",
1292
1314
  c.defaultChild ? "Open next level" : "Add next level"
1293
- ), c.defaultChild && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: oe, style: j(r, !1, !0) }, /* @__PURE__ */ t.createElement(v.Delete, null), " Remove next level"))
1294
- )), F && /* @__PURE__ */ t.createElement(
1295
- Ie,
1315
+ ), c.defaultChild && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: ie, style: j(r, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove next level"))
1316
+ )), B && /* @__PURE__ */ t.createElement(
1317
+ Pe,
1296
1318
  {
1297
1319
  title: `Filter children of "${e.rowLabel || "this row"}"`,
1298
1320
  description: "Only children matching this filter are shown. Filtered-out rows are grouped into 'Others' to keep totals intact.",
1299
- condition: c.filters || Pe(),
1321
+ condition: c.filters || Le(),
1300
1322
  allFields: l,
1301
1323
  getFieldLabel: n,
1302
1324
  theme: r,
1303
1325
  onSave: (
1304
1326
  /** @param {any} [nextCondition] @returns {any} */
1305
1327
  ((d) => {
1306
- C({
1328
+ w({
1307
1329
  ...c,
1308
1330
  filters: d.clauses.length > 0 ? d : null
1309
1331
  });
@@ -1313,7 +1335,7 @@ function Yt({
1313
1335
  }
1314
1336
  ));
1315
1337
  }
1316
- function Zt({
1338
+ function Xt({
1317
1339
  item: e,
1318
1340
  branch: l,
1319
1341
  theme: n,
@@ -1323,21 +1345,21 @@ function Zt({
1323
1345
  onRemoveCustomChildren: s,
1324
1346
  onRemove: f
1325
1347
  }) {
1326
- const m = q(n), g = Ce(l.condition);
1327
- return /* @__PURE__ */ t.createElement("div", { style: pe(n) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: n.text } }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: n.textSec, marginTop: "2px" } }, "Use a row override when matching rows need a different label or child breakdown.")), /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(n, !1, !0) }, /* @__PURE__ */ t.createElement(v.Delete, null), " Remove override")), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Display As"), /* @__PURE__ */ t.createElement(
1348
+ const E = q(n), b = Ae(l.condition);
1349
+ return /* @__PURE__ */ t.createElement("div", { style: ue(n) }, /* @__PURE__ */ t.createElement("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: "12px" } }, /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: n.text } }, `Row override ${e.badge}`), /* @__PURE__ */ t.createElement("div", { style: { fontSize: "12px", color: n.textSec, marginTop: "2px" } }, "Use a row override when matching rows need a different label or child breakdown.")), /* @__PURE__ */ t.createElement("button", { type: "button", onClick: f, style: j(n, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove override")), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Display As"), /* @__PURE__ */ t.createElement(
1328
1350
  "input",
1329
1351
  {
1330
1352
  value: l.label,
1331
- onChange: (F) => a({ ...l, label: F.target.value }),
1353
+ onChange: (B) => a({ ...l, label: B.target.value }),
1332
1354
  placeholder: "Label to show for matching rows",
1333
- style: m
1355
+ style: E
1334
1356
  }
1335
1357
  )), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(n) }, "Rule"), /* @__PURE__ */ t.createElement(
1336
1358
  "button",
1337
1359
  {
1338
1360
  type: "button",
1339
1361
  onClick: r,
1340
- title: g,
1362
+ title: b,
1341
1363
  style: {
1342
1364
  ...q(n),
1343
1365
  display: "flex",
@@ -1348,9 +1370,9 @@ function Zt({
1348
1370
  background: n.hover || "#F8FAFC"
1349
1371
  }
1350
1372
  },
1351
- /* @__PURE__ */ t.createElement(v.Filter, null),
1352
- /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, g)
1353
- )), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: j(n, !!l.child) }, /* @__PURE__ */ t.createElement(v.Add, null), " ", l.child ? "Open Custom children" : "Add Custom children"), l.child && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: s, style: j(n, !1, !0) }, /* @__PURE__ */ t.createElement(v.Delete, null), " Remove Custom children")), /* @__PURE__ */ t.createElement(
1373
+ /* @__PURE__ */ t.createElement(m.Filter, null),
1374
+ /* @__PURE__ */ t.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, b)
1375
+ )), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" } }, /* @__PURE__ */ t.createElement("button", { type: "button", onClick: i, style: j(n, !!l.child) }, /* @__PURE__ */ t.createElement(m.Add, null), " ", l.child ? "Open Custom children" : "Add Custom children"), l.child && /* @__PURE__ */ t.createElement("button", { type: "button", onClick: s, style: j(n, !1, !0) }, /* @__PURE__ */ t.createElement(m.Delete, null), " Remove Custom children")), /* @__PURE__ */ t.createElement(
1354
1376
  "div",
1355
1377
  {
1356
1378
  style: {
@@ -1365,7 +1387,7 @@ function Zt({
1365
1387
  "Override applies to this row only. Rows without this override continue with Default children."
1366
1388
  ));
1367
1389
  }
1368
- function Ut({
1390
+ function el({
1369
1391
  reportDef: e,
1370
1392
  setReportDef: l,
1371
1393
  availableFields: n,
@@ -1374,33 +1396,33 @@ function Ut({
1374
1396
  data: i = [],
1375
1397
  valConfigs: s,
1376
1398
  colFields: f,
1377
- setColFields: m,
1378
- setValConfigs: g,
1379
- savedReports: F,
1399
+ setColFields: E,
1400
+ setValConfigs: b,
1401
+ savedReports: B,
1380
1402
  setSavedReports: N,
1381
1403
  activeReportId: y,
1382
- setActiveReportId: w,
1404
+ setActiveReportId: C,
1383
1405
  showNotification: c,
1384
- requestedSelection: E = null,
1385
- showReportConfigColumn: h = !0,
1406
+ requestedSelection: g = null,
1407
+ showReportConfigColumn: v = !0,
1386
1408
  setShowReportConfigColumn: u
1387
1409
  }) {
1388
- const [D, R] = H(""), [x, C] = H(null), [J, ue] = H(null), [oe, fe] = H(null), [d, k] = H(null), [st, ze] = H(null), ye = ke(null), ie = ke(!1), Te = ke(null), b = z(
1410
+ const [D, R] = H(""), [x, w] = H(null), [K, fe] = H(null), [ie, ye] = H(null), [d, k] = H(null), [ct, Te] = H(null), xe = Be(null), se = Be(!1), je = Be(null), h = W(
1389
1411
  () => e && e.root ? V(e.root) : null,
1390
1412
  [e]
1391
- ), W = z(
1392
- () => Dt(n, s),
1413
+ ), O = W(
1414
+ () => Rt(n, s),
1393
1415
  [n, s]
1394
- ), U = B(
1395
- (o) => Et(o, a),
1416
+ ), ee = F(
1417
+ (o) => St(o, a),
1396
1418
  [a]
1397
- ), xe = z(
1398
- () => Rt(s),
1419
+ ), be = W(
1420
+ () => Nt(s),
1399
1421
  [s]
1400
- ), K = z(
1401
- () => Ye(b, { allFields: W, valConfigs: s, data: i }),
1402
- [b, W, s, i]
1403
- ), $ = B((o) => {
1422
+ ), J = W(
1423
+ () => Ze(h, { allFields: O, valConfigs: s, data: i }),
1424
+ [h, O, s, i]
1425
+ ), $ = F((o) => {
1404
1426
  l(
1405
1427
  /** @param {any} [prev] @returns {any} */
1406
1428
  (p) => {
@@ -1408,99 +1430,100 @@ function Ut({
1408
1430
  return { ...S, root: P };
1409
1431
  }
1410
1432
  );
1411
- }, [l]), ee = z(() => Lt(b), [b]), I = z(() => We(b), [b]), se = z(
1412
- () => Tt(ee, x),
1413
- [ee, x]
1433
+ }, [l]), te = W(() => zt(h), [h]), I = W(() => We(h), [h]), ce = W(
1434
+ () => jt(te, x),
1435
+ [te, x]
1414
1436
  );
1415
- z(
1416
- () => jt(ee, x),
1417
- [ee, x]
1418
- ), z(
1419
- () => Mt(ee, x),
1420
- [ee, x]
1437
+ W(
1438
+ () => Mt(te, x),
1439
+ [te, x]
1440
+ ), W(
1441
+ () => Ht(te, x),
1442
+ [te, x]
1421
1443
  );
1422
- const te = z(() => {
1423
- if (!b || !x) return null;
1444
+ const le = W(() => {
1445
+ if (!h || !x) return null;
1424
1446
  if (x.type === "node") {
1425
- const o = ne(b, x.path);
1447
+ const o = ae(h, x.path);
1426
1448
  return o ? { type: "node", node: o } : null;
1427
1449
  }
1428
1450
  if (x.type === "branch") {
1429
- const o = Fe(b, x.nodePath, x.branchIndex);
1451
+ const o = Fe(h, x.nodePath, x.branchIndex);
1430
1452
  return o ? { type: "branch", branch: o } : null;
1431
1453
  }
1432
1454
  return null;
1433
- }, [b, x]), Ae = z(() => !J || !b ? null : Fe(b, J.nodePath, J.branchIndex), [J, b]), je = B((o) => {
1434
- if (!o || o.type !== "rowPath" || !b) return !1;
1435
- const p = Array.isArray(o.nodePath) ? o.nodePath : [], S = ne(b, p);
1455
+ }, [h, x]), $e = W(() => !K || !h ? null : Fe(h, K.nodePath, K.branchIndex), [K, h]), Me = F((o) => {
1456
+ if (!o || o.type !== "rowPath" || !h) return !1;
1457
+ const p = Array.isArray(o.nodePath) ? o.nodePath : [], S = ae(h, p);
1436
1458
  if (!S) return !1;
1437
1459
  const A = Array.isArray(S.branches) ? S.branches : [], P = A.findIndex(
1438
1460
  /** @param {any} [branch] @returns {any} */
1439
- (ce) => Ze(ce, o.field, o.value)
1440
- ), _ = P >= 0 ? A[P] : null, be = _ && _.child ? _.child : S.defaultChild || Y(""), G = Q(o.label || o.value);
1461
+ (de) => Xe(de, o.field, o.value)
1462
+ ), z = P >= 0 ? A[P] : null, ge = z && z.child ? z.child : S.defaultChild || Y(""), G = Q(o.label || o.value);
1441
1463
  return k({
1442
1464
  request: o,
1443
1465
  nodePath: p,
1444
1466
  branchIndex: P,
1445
1467
  rowLabel: G,
1446
- title: _ && _.label ? _.label : G,
1447
- child: Oe(be) || Y(""),
1468
+ title: z && z.label ? z.label : G,
1469
+ child: Oe(ge) || Y(""),
1448
1470
  selectedPath: [],
1449
1471
  childLevelNumber: Number.isFinite(Number(o.levelNumber)) ? Number(o.levelNumber) + 1 : 2
1450
- }), C({ type: "node", path: p }), !0;
1451
- }, [b]);
1452
- $e(() => {
1453
- if (!b) {
1454
- x !== null && C(null);
1472
+ }), w({ type: "node", path: p }), !0;
1473
+ }, [h]);
1474
+ Ee(() => {
1475
+ if (!h) {
1476
+ x !== null && w(null);
1455
1477
  return;
1456
1478
  }
1457
1479
  if (x) {
1458
1480
  if (x.type === "node") {
1459
- ne(b, x.path) || C({ type: "node", path: [] });
1481
+ ae(h, x.path) || w({ type: "node", path: [] });
1460
1482
  return;
1461
1483
  }
1462
- Fe(b, x.nodePath, x.branchIndex) || C({ type: "node", path: x.nodePath });
1484
+ Fe(h, x.nodePath, x.branchIndex) || w({ type: "node", path: x.nodePath });
1463
1485
  }
1464
- }, [b, x]);
1465
- const ge = B(() => {
1466
- const o = ye.current;
1486
+ }, [h, x]);
1487
+ const he = F(() => {
1488
+ const o = xe.current;
1467
1489
  !o || typeof o.scrollIntoView != "function" || window.requestAnimationFrame(() => {
1468
- o.scrollIntoView({ block: "start", behavior: "smooth" });
1490
+ const p = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1491
+ o.scrollIntoView({ block: "start", behavior: p ? "auto" : "smooth" });
1469
1492
  });
1470
1493
  }, []);
1471
- $e(() => {
1472
- if (E && Te.current !== E) {
1473
- if (Te.current = E, ie.current = !0, E.type === "rowPath") {
1474
- je(E) || (ie.current = !1);
1494
+ Ee(() => {
1495
+ if (g && je.current !== g) {
1496
+ if (je.current = g, se.current = !0, g.type === "rowPath") {
1497
+ Me(g) || (se.current = !1);
1475
1498
  return;
1476
1499
  }
1477
- if (Z(E) === Z(x)) {
1478
- ie.current = !1, ge();
1500
+ if (Z(g) === Z(x)) {
1501
+ se.current = !1, he();
1479
1502
  return;
1480
1503
  }
1481
- C(E);
1504
+ w(g);
1482
1505
  }
1483
- }, [je, E, ge, x]), $e(() => {
1484
- ie.current && (ie.current = !1, ge());
1485
- }, [ge, x]);
1486
- const Me = B((o, p) => {
1506
+ }, [Me, g, he, x]), Ee(() => {
1507
+ se.current && (se.current = !1, he());
1508
+ }, [he, x]);
1509
+ const He = F((o, p) => {
1487
1510
  $(
1488
1511
  /** @param {any} [prevRoot] @returns {any} */
1489
- (S) => O(S, o, () => p)
1512
+ (S) => _(S, o, () => p)
1490
1513
  );
1491
- }, [$]), He = B((o, p, S) => {
1514
+ }, [$]), Ve = F((o, p, S) => {
1492
1515
  $(
1493
1516
  /** @param {any} [prevRoot] @returns {any} */
1494
- (A) => ve(A, o, p, () => S)
1517
+ (A) => me(A, o, p, () => S)
1495
1518
  );
1496
- }, [$]), ct = B((o) => {
1519
+ }, [$]), dt = F((o) => {
1497
1520
  const p = Y(o);
1498
- $(p), k(null), C({ type: "node", path: [] });
1521
+ $(p), k(null), w({ type: "node", path: [] });
1499
1522
  }, [$]);
1500
- B((o, p) => {
1523
+ F((o, p) => {
1501
1524
  p || $(
1502
1525
  /** @param {any} [prevRoot] @returns {any} */
1503
- (S) => O(
1526
+ (S) => _(
1504
1527
  S,
1505
1528
  o,
1506
1529
  /** @param {any} [node] @returns {any} */
@@ -1509,11 +1532,11 @@ function Ut({
1509
1532
  defaultChild: Y("")
1510
1533
  })
1511
1534
  )
1512
- ), C({ type: "node", path: [...o, T] });
1513
- }, [$]), B((o) => {
1535
+ ), w({ type: "node", path: [...o, T] });
1536
+ }, [$]), F((o) => {
1514
1537
  $(
1515
1538
  /** @param {any} [prevRoot] @returns {any} */
1516
- (p) => O(
1539
+ (p) => _(
1517
1540
  p,
1518
1541
  o,
1519
1542
  /** @param {any} [node] @returns {any} */
@@ -1522,26 +1545,26 @@ function Ut({
1522
1545
  defaultChild: null
1523
1546
  })
1524
1547
  )
1525
- ), C({ type: "node", path: o });
1548
+ ), w({ type: "node", path: o });
1526
1549
  }, [$]);
1527
- const dt = B((o, p, S) => {
1550
+ const pt = F((o, p, S) => {
1528
1551
  S || $(
1529
1552
  /** @param {any} [prevRoot] @returns {any} */
1530
- (A) => ve(
1553
+ (A) => me(
1531
1554
  A,
1532
1555
  o,
1533
1556
  p,
1534
1557
  /** @param {any} [branch] @returns {any} */
1535
1558
  (P) => ({
1536
1559
  ...P,
1537
- child: Y(W[0] || "")
1560
+ child: Y(O[0] || "")
1538
1561
  })
1539
1562
  )
1540
- ), C({ type: "node", path: [...o, _e(p)] });
1541
- }, [W, $]), pt = B((o, p) => {
1563
+ ), w({ type: "node", path: [...o, _e(p)] });
1564
+ }, [O, $]), ut = F((o, p) => {
1542
1565
  $(
1543
1566
  /** @param {any} [prevRoot] @returns {any} */
1544
- (S) => ve(
1567
+ (S) => me(
1545
1568
  S,
1546
1569
  o,
1547
1570
  p,
@@ -1551,46 +1574,46 @@ function Ut({
1551
1574
  child: null
1552
1575
  })
1553
1576
  )
1554
- ), C({ type: "branch", nodePath: o, branchIndex: p });
1555
- }, [$]), ut = B((o) => {
1577
+ ), w({ type: "branch", nodePath: o, branchIndex: p });
1578
+ }, [$]), ft = F((o) => {
1556
1579
  if (o.length === 0) {
1557
- $(null), k(null), C(null);
1580
+ $(null), k(null), w(null);
1558
1581
  return;
1559
1582
  }
1560
1583
  const p = o.slice(0, -1), S = o[o.length - 1];
1561
1584
  if (S === T) {
1562
1585
  $(
1563
1586
  /** @param {any} [prevRoot] @returns {any} */
1564
- (P) => O(
1587
+ (P) => _(
1565
1588
  P,
1566
1589
  p,
1567
1590
  /** @param {any} [node] @returns {any} */
1568
- (_) => ({
1569
- ..._,
1591
+ (z) => ({
1592
+ ...z,
1570
1593
  defaultChild: null
1571
1594
  })
1572
1595
  )
1573
- ), C({ type: "node", path: p });
1596
+ ), w({ type: "node", path: p });
1574
1597
  return;
1575
1598
  }
1576
- const A = Se(S);
1599
+ const A = Ce(S);
1577
1600
  A >= 0 && ($(
1578
1601
  /** @param {any} [prevRoot] @returns {any} */
1579
- (P) => ve(
1602
+ (P) => me(
1580
1603
  P,
1581
1604
  p,
1582
1605
  A,
1583
1606
  /** @param {any} [branch] @returns {any} */
1584
- (_) => ({
1585
- ..._,
1607
+ (z) => ({
1608
+ ...z,
1586
1609
  child: null
1587
1610
  })
1588
1611
  )
1589
- ), C({ type: "branch", nodePath: p, branchIndex: A }));
1590
- }, [$]), ft = B((o, p) => {
1612
+ ), w({ type: "branch", nodePath: p, branchIndex: A }));
1613
+ }, [$]), yt = F((o, p) => {
1591
1614
  $(
1592
1615
  /** @param {any} [prevRoot] @returns {any} */
1593
- (S) => O(
1616
+ (S) => _(
1594
1617
  S,
1595
1618
  o,
1596
1619
  /** @param {any} [node] @returns {any} */
@@ -1598,29 +1621,29 @@ function Ut({
1598
1621
  ...A,
1599
1622
  branches: A.branches.filter(
1600
1623
  /** @param {any} [_] @param {any} [index] @returns {any} */
1601
- (P, _) => _ !== p
1624
+ (P, z) => z !== p
1602
1625
  )
1603
1626
  })
1604
1627
  )
1605
- ), C({ type: "node", path: o });
1606
- }, [$]), yt = B((o) => {
1607
- k(null), C({ type: "node", path: o });
1608
- }, []), Ve = B((o) => {
1628
+ ), w({ type: "node", path: o });
1629
+ }, [$]), xt = F((o) => {
1630
+ k(null), w({ type: "node", path: o });
1631
+ }, []), qe = F((o) => {
1609
1632
  if (o) {
1610
1633
  if (k(null), o.kind === "branch") {
1611
- C({ type: "branch", nodePath: o.nodePath, branchIndex: o.branchIndex });
1634
+ w({ type: "branch", nodePath: o.nodePath, branchIndex: o.branchIndex });
1612
1635
  return;
1613
1636
  }
1614
- C({ type: "node", path: o.nodePath });
1637
+ w({ type: "node", path: o.nodePath });
1615
1638
  }
1616
- }, []), xt = B(() => {
1617
- if (!b || !I.length) return;
1639
+ }, []), bt = F(() => {
1640
+ if (!h || !I.length) return;
1618
1641
  const o = I[I.length - 1];
1619
1642
  if (!o || !o.node || !o.node.field) return;
1620
1643
  const p = [...o.path, T];
1621
1644
  k(null), $(
1622
1645
  /** @param {any} [prevRoot] @returns {any} */
1623
- (S) => O(
1646
+ (S) => _(
1624
1647
  S,
1625
1648
  o.path,
1626
1649
  /** @param {any} [node] @returns {any} */
@@ -1629,78 +1652,78 @@ function Ut({
1629
1652
  defaultChild: A.defaultChild || Y("")
1630
1653
  })
1631
1654
  )
1632
- ), C({ type: "node", path: p });
1633
- }, [I, b, $]), gt = B((o, p) => {
1655
+ ), w({ type: "node", path: p });
1656
+ }, [I, h, $]), ht = F((o, p) => {
1634
1657
  o === null || o === p || ($(
1635
1658
  /** @param {any} [prevRoot] @returns {any} */
1636
- (S) => rt(S, o, p)
1637
- ), C({ type: "node", path: Ne(p) }), ze(null));
1638
- }, [$]), bt = B(() => {
1639
- k(null), C(null);
1640
- }, []), ht = B(() => {
1641
- if (!K.valid) {
1642
- c && c(K.errors[0] || "Fix report validation errors before applying.", "error");
1659
+ (S) => nt(S, o, p)
1660
+ ), w({ type: "node", path: Ie(p) }), Te(null));
1661
+ }, [$]), gt = F(() => {
1662
+ k(null), w(null);
1663
+ }, []), vt = F(() => {
1664
+ if (!J.valid) {
1665
+ c && c(J.errors[0] || "Fix report validation errors before applying.", "error");
1643
1666
  return;
1644
1667
  }
1645
- C(null);
1646
- }, [K, c]), vt = B(() => {
1668
+ w(null);
1669
+ }, [J, c]), mt = F(() => {
1647
1670
  if (!d || !d.request) return;
1648
- const o = d.request, p = Array.isArray(d.nodePath) ? d.nodePath : [], S = zt(d.child), A = {
1671
+ const o = d.request, p = Array.isArray(d.nodePath) ? d.nodePath : [], S = Tt(d.child), A = {
1649
1672
  ..._t(o.field, o.value, d.title || d.rowLabel, ""),
1650
1673
  label: Q(d.title || d.rowLabel || o.value),
1651
1674
  sourceRowPath: Array.isArray(o.pathValues) ? o.pathValues.map(String).filter(Boolean) : [],
1652
1675
  sourcePathFields: Array.isArray(o.pathFields) ? o.pathFields.map(String).filter(Boolean) : [],
1653
1676
  child: S
1654
1677
  }, P = (G) => {
1655
- const ce = Array.isArray(G.branches) ? G.branches : [], Je = ce.findIndex(
1678
+ const de = Array.isArray(G.branches) ? G.branches : [], Je = de.findIndex(
1656
1679
  /** @param {any} [branch] @returns {any} */
1657
- (he) => Ze(he, o.field, o.value)
1680
+ (ve) => Xe(ve, o.field, o.value)
1658
1681
  );
1659
1682
  return Je >= 0 ? {
1660
1683
  ...G,
1661
- branches: ce.map(
1684
+ branches: de.map(
1662
1685
  /** @param {any} [branch] @param {any} [index] @returns {any} */
1663
- (he, mt) => mt === Je ? { ...A, _id: he._id || A._id } : he
1686
+ (ve, Et) => Et === Je ? { ...A, _id: ve._id || A._id } : ve
1664
1687
  )
1665
1688
  } : {
1666
1689
  ...G,
1667
- branches: [...ce, A]
1690
+ branches: [...de, A]
1668
1691
  };
1669
- }, _ = O(b, p, P), be = Ye(_, { allFields: W, valConfigs: s, data: i });
1670
- if (!be.valid) {
1671
- c && c(be.errors[0] || "Fix report validation errors before applying.", "error");
1692
+ }, z = _(h, p, P), ge = Ze(z, { allFields: O, valConfigs: s, data: i });
1693
+ if (!ge.valid) {
1694
+ c && c(ge.errors[0] || "Fix report validation errors before applying.", "error");
1672
1695
  return;
1673
1696
  }
1674
1697
  $(
1675
1698
  /** @param {any} [prevRoot] @returns {any} */
1676
- (G) => O(G, p, P)
1677
- ), k(null), C(null), c && c(`Applied settings for ${d.rowLabel || "row"}`, "info");
1678
- }, [W, i, b, d, $, c, s]), qe = B(() => {
1679
- if (!b || !b.field) return;
1680
- if (!K.valid) {
1681
- c && c(K.errors[0] || "Fix report validation errors before saving.", "error");
1699
+ (G) => _(G, p, P)
1700
+ ), k(null), w(null), c && c(`Applied settings for ${d.rowLabel || "row"}`, "info");
1701
+ }, [O, i, h, d, $, c, s]), Ke = F(() => {
1702
+ if (!h || !h.field) return;
1703
+ if (!J.valid) {
1704
+ c && c(J.errors[0] || "Fix report validation errors before saving.", "error");
1682
1705
  return;
1683
1706
  }
1684
- const o = `report-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`, p = D.trim() || `Report ${(F || []).length + 1}`;
1707
+ const o = `report-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`, p = D.trim() || `Report ${(B || []).length + 1}`;
1685
1708
  N([
1686
- ...F || [],
1709
+ ...B || [],
1687
1710
  {
1688
1711
  id: o,
1689
1712
  name: p,
1690
1713
  reportDef: JSON.parse(JSON.stringify(e)),
1691
- layout: St(f, s),
1714
+ layout: wt(f, s),
1692
1715
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
1693
1716
  }
1694
- ]), w(o), R(""), c && c(`Report "${p}" saved`, "info");
1695
- }, [f, s, e, D, K, b, F, w, N, c]);
1696
- return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "18px", padding: "2px 0 8px" } }, (F || []).length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, /* @__PURE__ */ t.createElement(v.Save, null), " Saved Reports"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, (F || []).map(
1717
+ ]), C(o), R(""), c && c(`Report "${p}" saved`, "info");
1718
+ }, [f, s, e, D, J, h, B, C, N, c]);
1719
+ return /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "18px", padding: "2px 0 8px" } }, (B || []).length > 0 && /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, /* @__PURE__ */ t.createElement(m.Save, null), " Saved Reports"), /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, (B || []).map(
1697
1720
  /** @param {any} [report] @returns {any} */
1698
1721
  (o) => /* @__PURE__ */ t.createElement(
1699
1722
  "div",
1700
1723
  {
1701
1724
  key: o.id,
1702
1725
  onClick: () => {
1703
- Ct(o, { setReportDef: l, setActiveReportId: w, setColFields: m, setValConfigs: g }), k(null), C({ type: "node", path: [] });
1726
+ Ct(o, { setReportDef: l, setActiveReportId: C, setColFields: E, setValConfigs: b }), k(null), w({ type: "node", path: [] });
1704
1727
  },
1705
1728
  style: {
1706
1729
  display: "flex",
@@ -1713,7 +1736,7 @@ function Ut({
1713
1736
  border: `1px solid ${o.id === y ? r.primary || "#2563EB" : r.border}`
1714
1737
  }
1715
1738
  },
1716
- /* @__PURE__ */ t.createElement(v.Report, null),
1739
+ /* @__PURE__ */ t.createElement(m.Report, null),
1717
1740
  /* @__PURE__ */ t.createElement("div", { style: { flex: 1, minWidth: 0, fontSize: "12px", fontWeight: 700, color: r.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, o.name),
1718
1741
  /* @__PURE__ */ t.createElement(
1719
1742
  "button",
@@ -1726,37 +1749,37 @@ function Ut({
1726
1749
  /** @param {any} [current] @returns {any} */
1727
1750
  (A) => A.id !== o.id
1728
1751
  )
1729
- ), y === o.id && w(null);
1752
+ ), y === o.id && C(null);
1730
1753
  },
1731
1754
  style: { background: "none", border: "none", cursor: "pointer", color: "#B91C1C", padding: "2px", flexShrink: 0 }
1732
1755
  },
1733
- /* @__PURE__ */ t.createElement(v.Delete, null)
1756
+ /* @__PURE__ */ t.createElement(m.Delete, null)
1734
1757
  )
1735
1758
  )
1736
1759
  ))), /* @__PURE__ */ t.createElement(
1737
- re,
1760
+ ne,
1738
1761
  {
1739
1762
  theme: r,
1740
1763
  sectionId: "report-levels",
1741
1764
  title: "Report Levels",
1742
1765
  description: "Default hierarchy applied to every row unless a row override changes its children.",
1743
- icon: /* @__PURE__ */ t.createElement(v.ReportLevel, null),
1744
- action: b && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "flex-end" } }, typeof u == "function" && /* @__PURE__ */ t.createElement(
1766
+ icon: /* @__PURE__ */ t.createElement(m.ReportLevel, null),
1767
+ action: h && /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "flex-end" } }, typeof u == "function" && /* @__PURE__ */ t.createElement(
1745
1768
  "button",
1746
1769
  {
1747
1770
  type: "button",
1748
1771
  onClick: () => u((o) => o === !1),
1749
- style: j(r, h !== !1, !1),
1750
- title: h !== !1 ? "Hide row gear column" : "Show row gear column"
1772
+ style: j(r, v !== !1, !1),
1773
+ title: v !== !1 ? "Hide row gear column" : "Show row gear column"
1751
1774
  },
1752
- /* @__PURE__ */ t.createElement(v.Settings, null),
1775
+ /* @__PURE__ */ t.createElement(m.Settings, null),
1753
1776
  " ",
1754
- h !== !1 ? "Hide row gears" : "Show row gears"
1777
+ v !== !1 ? "Hide row gears" : "Show row gears"
1755
1778
  ), /* @__PURE__ */ t.createElement(
1756
1779
  "button",
1757
1780
  {
1758
1781
  type: "button",
1759
- onClick: xt,
1782
+ onClick: bt,
1760
1783
  disabled: !I.length || !I[I.length - 1].node.field,
1761
1784
  style: {
1762
1785
  ...j(r, !1, !1),
@@ -1764,26 +1787,26 @@ function Ut({
1764
1787
  pointerEvents: !I.length || !I[I.length - 1].node.field ? "none" : "auto"
1765
1788
  }
1766
1789
  },
1767
- /* @__PURE__ */ t.createElement(v.Add, null),
1790
+ /* @__PURE__ */ t.createElement(m.Add, null),
1768
1791
  " Add next level"
1769
1792
  ))
1770
1793
  },
1771
- b ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, I.map(
1794
+ h ? /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, I.map(
1772
1795
  /** @param {any} [item] @returns {any} */
1773
1796
  (o) => /* @__PURE__ */ t.createElement(
1774
- it,
1797
+ st,
1775
1798
  {
1776
1799
  key: `default-level:${o.index}:${o.node._id}`,
1777
1800
  item: o,
1778
1801
  selected: !d && Z(x) === Z({ type: "node", path: o.path }),
1779
1802
  theme: r,
1780
- sortByOptions: xe,
1781
- getFieldLabel: U,
1782
- onSelect: () => yt(o.path),
1803
+ sortByOptions: be,
1804
+ getFieldLabel: ee,
1805
+ onSelect: () => xt(o.path),
1783
1806
  onDragStart: (
1784
1807
  /** @param {any} [event] @returns {any} */
1785
1808
  ((p) => {
1786
- ze(o.index), p.dataTransfer.effectAllowed = "move";
1809
+ Te(o.index), p.dataTransfer.effectAllowed = "move";
1787
1810
  })
1788
1811
  ),
1789
1812
  onDragOver: (
@@ -1793,41 +1816,43 @@ function Ut({
1793
1816
  onDrop: (
1794
1817
  /** @param {any} [event] @returns {any} */
1795
1818
  ((p) => {
1796
- p.preventDefault(), gt(st, o.index);
1819
+ p.preventDefault(), ht(ct, o.index);
1797
1820
  })
1798
1821
  )
1799
1822
  }
1800
1823
  )
1801
- )) : /* @__PURE__ */ t.createElement("div", { style: pe(r) }, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: r.text } }, "Level 1"), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Break Down By"), /* @__PURE__ */ t.createElement(
1802
- "select",
1824
+ )) : /* @__PURE__ */ t.createElement("div", { style: ue(r) }, /* @__PURE__ */ t.createElement("div", { style: { fontSize: "14px", fontWeight: 800, color: r.text } }, "Level 1"), /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement("div", { style: L(r) }, "Break Down By"), /* @__PURE__ */ t.createElement(
1825
+ U,
1803
1826
  {
1827
+ size: "sm",
1828
+ "aria-label": "Level 1 field",
1804
1829
  value: "",
1805
1830
  onChange: (o) => {
1806
- o.target.value && ct(o.target.value);
1831
+ o.target.value && dt(o.target.value);
1807
1832
  },
1808
- style: q(r)
1833
+ style: { ...q(r), width: "100%" }
1809
1834
  },
1810
1835
  /* @__PURE__ */ t.createElement("option", { value: "" }, "Select field..."),
1811
- W.map(
1836
+ O.map(
1812
1837
  /** @param {any} [field] @returns {any} */
1813
- (o) => /* @__PURE__ */ t.createElement("option", { key: o, value: o }, U(o))
1838
+ (o) => /* @__PURE__ */ t.createElement("option", { key: o, value: o }, ee(o))
1814
1839
  )
1815
1840
  )))
1816
- ), b && /* @__PURE__ */ t.createElement(
1817
- re,
1841
+ ), h && /* @__PURE__ */ t.createElement(
1842
+ ne,
1818
1843
  {
1819
1844
  theme: r,
1820
1845
  sectionId: "report-outline",
1821
1846
  title: "Report Outline",
1822
1847
  description: "Default levels plus every row override, shown as a separate map of Default children.",
1823
- icon: /* @__PURE__ */ t.createElement(v.Report, null)
1848
+ icon: /* @__PURE__ */ t.createElement(m.Report, null)
1824
1849
  },
1825
- /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, ee.map(
1850
+ /* @__PURE__ */ t.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } }, te.map(
1826
1851
  /** @param {any} [item] @returns {any} */
1827
1852
  (o) => o.kind === "branch" ? /* @__PURE__ */ t.createElement(
1828
- Kt,
1853
+ Gt,
1829
1854
  {
1830
- key: `outline-branch:${le(o.nodePath)}:${o.branchIndex}:${o.branch._id}`,
1855
+ key: `outline-branch:${re(o.nodePath)}:${o.branchIndex}:${o.branch._id}`,
1831
1856
  item: o,
1832
1857
  selected: !d && Z(x) === Z({
1833
1858
  type: "branch",
@@ -1835,116 +1860,116 @@ function Ut({
1835
1860
  branchIndex: o.branchIndex
1836
1861
  }),
1837
1862
  theme: r,
1838
- onSelect: () => Ve(o)
1863
+ onSelect: () => qe(o)
1839
1864
  }
1840
1865
  ) : /* @__PURE__ */ t.createElement(
1841
1866
  Jt,
1842
1867
  {
1843
- key: `outline-node:${le(o.nodePath)}:${o.node._id}`,
1868
+ key: `outline-node:${re(o.nodePath)}:${o.node._id}`,
1844
1869
  item: o,
1845
1870
  selected: !d && Z(x) === Z({ type: "node", path: o.nodePath }),
1846
1871
  theme: r,
1847
- sortByOptions: xe,
1848
- getFieldLabel: U,
1849
- onSelect: () => Ve(o)
1872
+ sortByOptions: be,
1873
+ getFieldLabel: ee,
1874
+ onSelect: () => qe(o)
1850
1875
  }
1851
1876
  )
1852
1877
  ))
1853
- ), b && d && /* @__PURE__ */ t.createElement("div", { ref: ye }, /* @__PURE__ */ t.createElement(
1854
- re,
1878
+ ), h && d && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1879
+ ne,
1855
1880
  {
1856
1881
  theme: r,
1857
1882
  sectionId: "selected-row",
1858
1883
  title: "Selected Row",
1859
1884
  description: "Configure Custom children for the row gear you clicked.",
1860
- icon: /* @__PURE__ */ t.createElement(v.Settings, null)
1885
+ icon: /* @__PURE__ */ t.createElement(m.Settings, null)
1861
1886
  },
1862
1887
  /* @__PURE__ */ t.createElement(
1863
- Yt,
1888
+ Zt,
1864
1889
  {
1865
1890
  draft: d,
1866
- allFields: W,
1867
- getFieldLabel: U,
1868
- sortByOptions: xe,
1891
+ allFields: O,
1892
+ getFieldLabel: ee,
1893
+ sortByOptions: be,
1869
1894
  theme: r,
1870
1895
  onChange: k,
1871
- onApply: vt,
1872
- onCancel: bt
1896
+ onApply: mt,
1897
+ onCancel: gt
1873
1898
  }
1874
1899
  )
1875
- )), b && !d && x && te && te.type === "node" && /* @__PURE__ */ t.createElement("div", { ref: ye }, /* @__PURE__ */ t.createElement(
1876
- re,
1900
+ )), h && !d && x && le && le.type === "node" && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1901
+ ne,
1877
1902
  {
1878
1903
  theme: r,
1879
1904
  sectionId: "selected-level",
1880
1905
  title: "Selected Level",
1881
1906
  description: "Edit the selected default level or override child level.",
1882
- icon: /* @__PURE__ */ t.createElement(v.Edit, null)
1907
+ icon: /* @__PURE__ */ t.createElement(m.Edit, null)
1883
1908
  },
1884
1909
  /* @__PURE__ */ t.createElement(
1885
- Gt,
1910
+ Yt,
1886
1911
  {
1887
1912
  item: I.find(
1888
1913
  /** @param {any} [item] @returns {any} */
1889
- (o) => we(o.path, x.path)
1890
- ) || (se ? { ...se, path: se.nodePath } : { path: x.path, levelNumber: x.path.length + 1 }),
1891
- node: te.node,
1892
- allFields: W,
1893
- getFieldLabel: U,
1894
- sortByOptions: xe,
1914
+ (o) => ke(o.path, x.path)
1915
+ ) || (ce ? { ...ce, path: ce.nodePath } : { path: x.path, levelNumber: x.path.length + 1 }),
1916
+ node: le.node,
1917
+ allFields: O,
1918
+ getFieldLabel: ee,
1919
+ sortByOptions: be,
1895
1920
  theme: r,
1896
1921
  onUpdate: (
1897
1922
  /** @param {any} [nextNode] @returns {any} */
1898
- ((o) => Me(x.path, o))
1923
+ ((o) => He(x.path, o))
1899
1924
  ),
1900
- onApply: ht,
1901
- onRemove: () => ut(x.path),
1902
- onEditFilter: () => fe(x.path),
1925
+ onApply: vt,
1926
+ onRemove: () => ft(x.path),
1927
+ onEditFilter: () => ye(x.path),
1903
1928
  titleLabel: "Title"
1904
1929
  }
1905
1930
  )
1906
- )), b && !d && x && te && te.type === "branch" && se && /* @__PURE__ */ t.createElement("div", { ref: ye }, /* @__PURE__ */ t.createElement(
1907
- re,
1931
+ )), h && !d && x && le && le.type === "branch" && ce && /* @__PURE__ */ t.createElement("div", { ref: xe }, /* @__PURE__ */ t.createElement(
1932
+ ne,
1908
1933
  {
1909
1934
  theme: r,
1910
1935
  sectionId: "row-override",
1911
1936
  title: "Row Override",
1912
1937
  description: "Override applies to this row only. Configure its rule and Custom children.",
1913
- icon: /* @__PURE__ */ t.createElement(v.Settings, null)
1938
+ icon: /* @__PURE__ */ t.createElement(m.Settings, null)
1914
1939
  },
1915
1940
  /* @__PURE__ */ t.createElement(
1916
- Zt,
1941
+ Xt,
1917
1942
  {
1918
- item: se,
1919
- branch: te.branch,
1943
+ item: ce,
1944
+ branch: le.branch,
1920
1945
  theme: r,
1921
1946
  onUpdate: (
1922
1947
  /** @param {any} [nextBranch] @returns {any} */
1923
- ((o) => He(x.nodePath, x.branchIndex, o))
1948
+ ((o) => Ve(x.nodePath, x.branchIndex, o))
1924
1949
  ),
1925
- onEditCondition: () => ue({ nodePath: x.nodePath, branchIndex: x.branchIndex }),
1926
- onOpenCustomChildren: () => dt(x.nodePath, x.branchIndex, !!te.branch.child),
1927
- onRemoveCustomChildren: () => pt(x.nodePath, x.branchIndex),
1928
- onRemove: () => ft(x.nodePath, x.branchIndex)
1950
+ onEditCondition: () => fe({ nodePath: x.nodePath, branchIndex: x.branchIndex }),
1951
+ onOpenCustomChildren: () => pt(x.nodePath, x.branchIndex, !!le.branch.child),
1952
+ onRemoveCustomChildren: () => ut(x.nodePath, x.branchIndex),
1953
+ onRemove: () => yt(x.nodePath, x.branchIndex)
1929
1954
  }
1930
1955
  )
1931
1956
  )), /* @__PURE__ */ t.createElement(
1932
- re,
1957
+ ne,
1933
1958
  {
1934
1959
  theme: r,
1935
1960
  sectionId: "save-report",
1936
1961
  title: "Save Report",
1937
1962
  description: "Store the current report levels and row overrides.",
1938
- icon: /* @__PURE__ */ t.createElement(v.Save, null)
1963
+ icon: /* @__PURE__ */ t.createElement(m.Save, null)
1939
1964
  },
1940
- /* @__PURE__ */ t.createElement(Vt, { validation: K, theme: r }),
1965
+ /* @__PURE__ */ t.createElement(qt, { validation: J, theme: r }),
1941
1966
  /* @__PURE__ */ t.createElement("div", { style: { display: "flex", gap: "8px" } }, /* @__PURE__ */ t.createElement(
1942
1967
  "input",
1943
1968
  {
1944
1969
  value: D,
1945
1970
  onChange: (o) => R(o.target.value),
1946
1971
  onKeyDown: (o) => {
1947
- o.key === "Enter" && qe();
1972
+ o.key === "Enter" && Ke();
1948
1973
  },
1949
1974
  placeholder: "Report name...",
1950
1975
  style: { ...q(r), flex: 1 }
@@ -1953,8 +1978,8 @@ function Ut({
1953
1978
  "button",
1954
1979
  {
1955
1980
  type: "button",
1956
- onClick: qe,
1957
- disabled: !b || !b.field || !K.valid,
1981
+ onClick: Ke,
1982
+ disabled: !h || !h.field || !J.valid,
1958
1983
  style: {
1959
1984
  display: "inline-flex",
1960
1985
  alignItems: "center",
@@ -1967,55 +1992,55 @@ function Ut({
1967
1992
  fontWeight: 800,
1968
1993
  color: "#fff",
1969
1994
  cursor: "pointer",
1970
- opacity: !b || !b.field || !K.valid ? 0.5 : 1
1995
+ opacity: !h || !h.field || !J.valid ? 0.5 : 1
1971
1996
  }
1972
1997
  },
1973
- /* @__PURE__ */ t.createElement(v.Save, null),
1998
+ /* @__PURE__ */ t.createElement(m.Save, null),
1974
1999
  " Save"
1975
2000
  ))
1976
- ), J && Ae && /* @__PURE__ */ t.createElement(
1977
- Ie,
2001
+ ), K && $e && /* @__PURE__ */ t.createElement(
2002
+ Pe,
1978
2003
  {
1979
- condition: Ae.condition,
1980
- allFields: W,
1981
- getFieldLabel: U,
2004
+ condition: $e.condition,
2005
+ allFields: O,
2006
+ getFieldLabel: ee,
1982
2007
  theme: r,
1983
2008
  onSave: (
1984
2009
  /** @param {any} [nextCondition] @returns {any} */
1985
2010
  ((o) => {
1986
- He(J.nodePath, J.branchIndex, {
1987
- ...Ae,
2011
+ Ve(K.nodePath, K.branchIndex, {
2012
+ ...$e,
1988
2013
  condition: o
1989
2014
  });
1990
2015
  })
1991
2016
  ),
1992
- onClose: () => ue(null)
2017
+ onClose: () => fe(null)
1993
2018
  }
1994
- ), oe && (() => {
1995
- const o = ne(b, oe);
2019
+ ), ie && (() => {
2020
+ const o = ae(h, ie);
1996
2021
  return o ? /* @__PURE__ */ t.createElement(
1997
- Ie,
2022
+ Pe,
1998
2023
  {
1999
2024
  title: "Edit level filter",
2000
2025
  description: "Rows that don't match are grouped into 'Others' to keep totals intact. Applies to this level and all its children.",
2001
- condition: o.filters || Pe(),
2002
- allFields: W,
2003
- getFieldLabel: U,
2026
+ condition: o.filters || Le(),
2027
+ allFields: O,
2028
+ getFieldLabel: ee,
2004
2029
  theme: r,
2005
2030
  onSave: (
2006
2031
  /** @param {any} [nextCondition] @returns {any} */
2007
2032
  ((p) => {
2008
- Me(oe, {
2033
+ He(ie, {
2009
2034
  ...o,
2010
2035
  filters: p.clauses.length > 0 ? p : null
2011
2036
  });
2012
2037
  })
2013
2038
  ),
2014
- onClose: () => fe(null)
2039
+ onClose: () => ye(null)
2015
2040
  }
2016
2041
  ) : null;
2017
2042
  })());
2018
2043
  }
2019
2044
  export {
2020
- Ut as ReportEditor
2045
+ el as ReportEditor
2021
2046
  };