serverside_pivot 0.0.96 → 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 (52) hide show
  1. package/README.md +5 -4
  2. package/dist/react/chunks/ContextMenu-DQGCdUhU.mjs +211 -0
  3. package/dist/react/chunks/{DetailDrawer-DgKSC5Vu.mjs → DetailDrawer-yMFRd6Td.mjs} +1 -1
  4. package/dist/react/chunks/{DetailSidePanel-CC5Dugyl.mjs → DetailSidePanel-B6fYMnn7.mjs} +1 -1
  5. package/dist/react/chunks/{DetailSurfaceContent-CrQVHlcU.mjs → DetailSurfaceContent-B9cfLYti.mjs} +1 -1
  6. package/dist/react/chunks/{ECharts2dRenderer-46gLrUdf.mjs → ECharts2dRenderer-ER6rHtch.mjs} +1 -1
  7. package/dist/react/chunks/{ECharts3dRenderer-Dg4ta5Bl.mjs → ECharts3dRenderer-BMVfbpXH.mjs} +1 -1
  8. package/dist/react/chunks/{EditSidePanel-CkShaByb.mjs → EditSidePanel-BjJd5BaX.mjs} +1 -1
  9. package/dist/react/chunks/{InlineDetailPanel-mnwjoD0I.mjs → InlineDetailPanel-Bbkpv9jz.mjs} +1 -1
  10. package/dist/react/chunks/{PivotCharts-MX-Z7DlR.mjs → PivotCharts-P5cBJcwu.mjs} +5 -3
  11. package/dist/react/chunks/{ReportEditor-U0E42xKL.mjs → ReportEditor-P4UZ97Ik.mjs} +174 -175
  12. package/dist/react/chunks/{SidebarPanel-BzRW1Kgq.mjs → SidebarPanel-DRoxHRhK.mjs} +1039 -1024
  13. package/dist/react/chunks/{SparklineDetailGraph-35Tim_8B.mjs → SparklineDetailGraph-C9UX-feP.mjs} +22 -22
  14. package/dist/react/chunks/clientCoreRuntime-n2guUxhp.mjs +790 -0
  15. package/dist/react/chunks/{installCanvasRenderer-DRq0xpXO.mjs → installCanvasRenderer-BR0XmdVX.mjs} +1 -1
  16. package/dist/react/chunks/{react-CL4GbEOd.mjs → react-B5JcZShu.mjs} +17394 -13825
  17. package/dist/react/chunks/{xlsx.mini.min-kfIgXMVB.mjs → xlsx.mini.min-YUTWASKG.mjs} +1 -1
  18. package/dist/react/components/DashTanstackPivot.react.d.ts +6 -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/hooks/useDismiss.d.ts +43 -0
  24. package/dist/react/hooks/usePivotNormalization.d.ts +4 -0
  25. package/dist/react/hooks/usePrefersReducedMotion.d.ts +8 -0
  26. package/dist/react/hooks/useRenderHelpers.d.ts +1 -1
  27. package/dist/react/hooks/useRowCache.d.ts +2 -0
  28. package/dist/react/hooks/useServerSideRowModel.d.ts +1 -1
  29. package/dist/react/index.mjs +28 -19
  30. package/dist/react/react.d.ts +6 -1
  31. package/dist/react/runtime/client/clientPivotTransport.d.ts +16 -0
  32. package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +8 -1
  33. package/dist/react/runtime/client/clientSubscriptionEngine.d.ts +88 -0
  34. package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +22 -0
  35. package/dist/react/runtime/client/index.d.ts +1 -0
  36. package/dist/react/runtime/client/types.d.ts +6 -0
  37. package/dist/react/runtime/core/clientCoreRuntime.d.ts +46 -0
  38. package/dist/react/runtime/core/duckdbSqlEmitter.d.ts +37 -0
  39. package/dist/react/runtime/core/semanticIr.generated.d.ts +196 -0
  40. package/dist/react/runtime/responseQueue.d.ts +21 -0
  41. package/dist/react/runtime/rowIdentity.d.ts +20 -0
  42. package/dist/react/runtime/runtimeDomains.d.ts +8 -1
  43. package/dist/react/runtime/streamingTypes.d.ts +182 -0
  44. package/dist/react/runtime/useRuntimeViewportTableData.d.ts +1 -1
  45. package/dist/react/runtime/useViewportSubscriptionStore.d.ts +112 -0
  46. package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +1 -1
  47. package/dist/react/utils/helpers.d.ts +1 -1
  48. package/dist/react/utils/pivotLayoutUtils.d.ts +3 -3
  49. package/dist/react/utils/rowMotion.d.ts +108 -0
  50. package/dist/react/utils/styles.d.ts +1 -0
  51. package/package.json +6 -8
  52. package/dist/react/chunks/ContextMenu-DJuS4qTZ.mjs +0 -198
@@ -1,9 +1,9 @@
1
- import e, { useState as ve, useRef as ur, useEffect as dr } from "react";
2
- import { I as F, _ as Se, $ as Nr, a0 as Ur, a1 as kt, a2 as at, a3 as jr, a4 as Vr, a5 as Kr, a6 as He, a7 as it, a8 as st, F as Yr, a9 as Zr, aa as Gr, ab as Xr, ac as qe, ad as pr, ae as qr, af as Xt, T as re, ag as Jr, ah as Qr, ai as en, aj as qt, ak as tn, al as rn } from "./react-CL4GbEOd.mjs";
3
- const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, options: p, optionMeta: f, onSearchOptions: S, onLoadMoreOptions: g, onOpen: z }) => {
4
- const [s, x] = ve(!1), W = l && (l.conditions || l.value), P = () => x(!1), M = () => {
1
+ import e, { useState as Ee, useRef as ur, useEffect as pr } from "react";
2
+ import { I as F, a0 as Se, a1 as Hr, a2 as Ur, a3 as kt, a4 as at, a5 as jr, a6 as Vr, a7 as Kr, a8 as Ne, a9 as it, aa as st, F as Yr, ab as Zr, ac as Gr, ad as Xr, ae as qe, af as dr, ag as qr, ah as Xt, T as re, ai as Jr, aj as Qr, ak as en, al as qt, am as tn, an as rn } from "./react-B5JcZShu.mjs";
3
+ const nn = ({ column: t, theme: n, styles: o, onFilter: a, currentFilter: l, options: d, optionMeta: f, onSearchOptions: E, onLoadMoreOptions: g, onOpen: z }) => {
4
+ const [s, x] = Ee(!1), W = l && (l.conditions || l.value), P = () => x(!1), M = () => {
5
5
  const A = !s;
6
- x(A), A && typeof z == "function" && z(r.id);
6
+ x(A), A && typeof z == "function" && z(t.id);
7
7
  };
8
8
  return /* @__PURE__ */ e.createElement("div", { style: { display: "flex", flexDirection: "column" } }, /* @__PURE__ */ e.createElement(
9
9
  "div",
@@ -17,51 +17,51 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
17
17
  onClick: M
18
18
  },
19
19
  /* @__PURE__ */ e.createElement("span", { style: { marginRight: "8px", opacity: 0.7, display: "flex" } }, s ? /* @__PURE__ */ e.createElement(F.ChevronDown, null) : /* @__PURE__ */ e.createElement(F.ChevronRight, null)),
20
- /* @__PURE__ */ e.createElement("span", { style: { flex: 1, fontWeight: 500, display: "flex", alignItems: "center", gap: "6px" } }, W && /* @__PURE__ */ e.createElement(F.Filter, { style: { fontSize: "12px", color: n.primary } }), Se(typeof r.header == "string" ? r.header : r.columnDef && typeof r.columnDef.header == "string" ? r.columnDef.header : r.id))
20
+ /* @__PURE__ */ e.createElement("span", { style: { flex: 1, fontWeight: 500, display: "flex", alignItems: "center", gap: "6px" } }, W && /* @__PURE__ */ e.createElement(F.Filter, { style: { fontSize: "12px", color: n.primary } }), Se(typeof t.header == "string" ? t.header : t.columnDef && typeof t.columnDef.header == "string" ? t.columnDef.header : t.id))
21
21
  ), s && /* @__PURE__ */ e.createElement("div", { style: { padding: "8px", borderBottom: `1px solid ${n.border}44` } }, /* @__PURE__ */ e.createElement(
22
- Nr,
22
+ Hr,
23
23
  {
24
- column: r,
24
+ column: t,
25
25
  onFilter: a,
26
26
  currentFilter: l,
27
- options: p,
27
+ options: d,
28
28
  optionMeta: f,
29
- onSearchOptions: S,
29
+ onSearchOptions: E,
30
30
  onLoadMoreOptions: g,
31
31
  theme: n,
32
32
  onClose: P
33
33
  }
34
34
  )));
35
- }, St = ({ title: r, children: n, items: o, renderItem: a, theme: l, styles: p, initialExpanded: f = !0, count: S, onDrop: g, sectionId: z }) => {
36
- const [s, x] = ve(f), [W, P] = ve(f), [M, A] = ve(f), [y, C] = ve(!1), D = ur(null);
37
- dr(() => {
35
+ }, St = ({ title: t, children: n, items: o, renderItem: a, theme: l, styles: d, initialExpanded: f = !0, count: E, onDrop: g, sectionId: z }) => {
36
+ const [s, x] = Ee(f), [W, P] = Ee(f), [M, A] = Ee(f), [y, w] = Ee(!1), R = ur(null);
37
+ pr(() => {
38
38
  if (s) {
39
39
  P(!0);
40
- const w = setTimeout(() => A(!0), 220);
41
- return () => clearTimeout(w);
40
+ const k = setTimeout(() => A(!0), 220);
41
+ return () => clearTimeout(k);
42
42
  }
43
43
  A(!1);
44
- const k = setTimeout(() => P(!1), 220);
45
- return () => clearTimeout(k);
44
+ const S = setTimeout(() => P(!1), 220);
45
+ return () => clearTimeout(S);
46
46
  }, [s]);
47
- const T = Ur({
47
+ const I = Ur({
48
48
  count: o ? o.length : 0,
49
- getScrollElement: () => D.current,
49
+ getScrollElement: () => R.current,
50
50
  estimateSize: () => 32,
51
51
  overscan: 10,
52
52
  enabled: !!o && (s || W)
53
- }), U = (k) => {
54
- k.preventDefault(), C(!0);
55
- }, R = () => {
56
- C(!1);
57
- }, O = (k) => {
58
- k.preventDefault(), C(!1);
59
- const w = k.dataTransfer.getData("text/plain");
60
- g && w && g(w, z);
61
- }, i = (k) => {
62
- (k.key === "Enter" || k.key === " ") && (k.preventDefault(), x(
53
+ }), N = (S) => {
54
+ S.preventDefault(), w(!0);
55
+ }, C = () => {
56
+ w(!1);
57
+ }, O = (S) => {
58
+ S.preventDefault(), w(!1);
59
+ const k = S.dataTransfer.getData("text/plain");
60
+ g && k && g(k, z);
61
+ }, i = (S) => {
62
+ (S.key === "Enter" || S.key === " ") && (S.preventDefault(), x(
63
63
  /** @param {any} [prev] @returns {any} */
64
- (w) => !w
64
+ (k) => !k
65
65
  ));
66
66
  };
67
67
  return /* @__PURE__ */ e.createElement(
@@ -69,7 +69,7 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
69
69
  {
70
70
  "data-is-over": y ? "true" : void 0,
71
71
  style: {
72
- ...p.toolPanelSection,
72
+ ...d.toolPanelSection,
73
73
  flex: s ? "0 1 auto" : "0 0 auto",
74
74
  minHeight: s ? "40px" : "32px",
75
75
  overflow: "hidden",
@@ -79,8 +79,8 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
79
79
  boxShadow: y ? `inset 0 0 0 1.5px ${l.primary}` : void 0,
80
80
  transition: "background-color 140ms ease, box-shadow 140ms ease"
81
81
  },
82
- onDragOver: U,
83
- onDragLeave: R,
82
+ onDragOver: N,
83
+ onDragLeave: C,
84
84
  onDrop: O
85
85
  },
86
86
  /* @__PURE__ */ e.createElement(
@@ -90,7 +90,7 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
90
90
  tabIndex: 0,
91
91
  "aria-expanded": s,
92
92
  className: "sp-btn sp-btn-ghost",
93
- style: { ...p.toolPanelSectionHeader, borderRadius: "6px" },
93
+ style: { ...d.toolPanelSectionHeader, borderRadius: "6px" },
94
94
  onClick: () => x(!s),
95
95
  onKeyDown: i
96
96
  },
@@ -102,8 +102,8 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
102
102
  transform: s ? "rotate(90deg)" : "rotate(0deg)",
103
103
  transition: "transform 160ms var(--sp-ease-apple, cubic-bezier(0.22, 1, 0.36, 1))"
104
104
  } }, /* @__PURE__ */ e.createElement(F.ChevronRight, null)),
105
- /* @__PURE__ */ e.createElement("span", { style: { flex: 1 } }, r),
106
- S !== void 0 && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", opacity: 0.7, background: l.hover, padding: "2px 7px", borderRadius: "10px", fontVariantNumeric: "tabular-nums" } }, S)
105
+ /* @__PURE__ */ e.createElement("span", { style: { flex: 1 } }, t),
106
+ E !== void 0 && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", opacity: 0.7, background: l.hover, padding: "2px 7px", borderRadius: "10px", fontVariantNumeric: "tabular-nums" } }, E)
107
107
  ),
108
108
  /* @__PURE__ */ e.createElement(
109
109
  "div",
@@ -115,118 +115,135 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
115
115
  /* @__PURE__ */ e.createElement(
116
116
  "div",
117
117
  {
118
- ref: D,
118
+ ref: R,
119
119
  className: "sp-disclosure-inner",
120
120
  style: {
121
- ...p.toolPanelList,
121
+ ...d.toolPanelList,
122
122
  maxHeight: "300px",
123
123
  overflowY: s && M ? "auto" : "hidden"
124
124
  }
125
125
  },
126
126
  o ? /* @__PURE__ */ e.createElement("div", { style: {
127
- height: `${T.getTotalSize()}px`,
127
+ height: `${I.getTotalSize()}px`,
128
128
  width: "100%",
129
129
  position: "relative"
130
- } }, T.getVirtualItems().map(
130
+ } }, I.getVirtualItems().map(
131
131
  /** @param {any} [virtualRow] @returns {any} */
132
- (k) => /* @__PURE__ */ e.createElement(
132
+ (S) => /* @__PURE__ */ e.createElement(
133
133
  "div",
134
134
  {
135
- key: k.index,
135
+ key: S.index,
136
136
  style: {
137
137
  position: "absolute",
138
138
  top: 0,
139
139
  left: 0,
140
140
  width: "100%",
141
- height: `${k.size}px`,
142
- transform: `translateY(${k.start}px)`
141
+ height: `${S.size}px`,
142
+ transform: `translateY(${S.start}px)`
143
143
  }
144
144
  },
145
- a(o[k.index], k.index)
145
+ a(o[S.index], S.index)
146
146
  )
147
147
  )) : n
148
148
  )
149
149
  )
150
150
  );
151
- }, fr = ({ column: r, level: n, theme: o, styles: a, handlePinColumn: l, colSearch: p, selectedCols: f, setSelectedCols: S, onDrop: g, sectionId: z }) => {
152
- const [s, x] = ve(n < 1), [W, P] = ve(!1), [M, A] = ve(!1), y = ur(null), C = r.columns && r.columns.length > 0, D = r.columnDef.header;
153
- let T = typeof D == "string" ? D : r.id;
154
- typeof T == "string" && T.startsWith("group_") && (T = r.id.replace("group_", "").split("|||").pop() || T), r.headerVal && (T = r.headerVal), T = Se(T);
155
- const U = r.getIsPinned(), R = r.getIsVisible(), O = C ? kt(r) : [r.id], i = O.length > 0 && O.every((E) => f.has(E)), k = !i && O.some((E) => f.has(E));
156
- if (dr(() => {
157
- y.current && (y.current.indeterminate = k);
158
- }, [k]), p && !T.toLowerCase().includes(p.toLowerCase()))
159
- if (C) {
160
- const E = (j) => {
161
- const Z = j.columnDef.header;
162
- return (typeof Z == "string" ? Z : j.id).toLowerCase().includes(p.toLowerCase()) ? !0 : j.columns ? j.columns.some(E) : !1;
151
+ }, fr = ({ column: t, level: n, theme: o, styles: a, handlePinColumn: l, colSearch: d, selectedCols: f, setSelectedCols: E, onDrop: g, sectionId: z }) => {
152
+ const [s, x] = Ee(n < 1), [W, P] = Ee(!1), [M, A] = Ee(!1), y = ur(null), w = t.columns && t.columns.length > 0, R = t.columnDef.header;
153
+ let I = typeof R == "string" ? R : t.id;
154
+ typeof I == "string" && I.startsWith("group_") && (I = t.id.replace("group_", "").split("|||").pop() || I), t.headerVal && (I = t.headerVal), I = Se(I);
155
+ const N = t.getIsPinned(), C = t.getIsVisible(), O = w ? kt(t) : [t.id], i = O.length > 0 && O.every((D) => f.has(D)), S = !i && O.some((D) => f.has(D));
156
+ if (pr(() => {
157
+ y.current && (y.current.indeterminate = S);
158
+ }, [S]), d && !I.toLowerCase().includes(d.toLowerCase()))
159
+ if (w) {
160
+ const D = (H) => {
161
+ const Y = H.columnDef.header;
162
+ return (typeof Y == "string" ? Y : H.id).toLowerCase().includes(d.toLowerCase()) ? !0 : H.columns ? H.columns.some(D) : !1;
163
163
  };
164
- if (!E(r)) return null;
164
+ if (!D(t)) return null;
165
165
  } else
166
166
  return null;
167
- const w = (E) => {
168
- E.stopPropagation();
169
- const j = new Set(f), Z = C ? kt(r) : [r.id];
170
- Z.every(
167
+ const k = (D) => {
168
+ D.stopPropagation();
169
+ const H = new Set(f), Y = w ? kt(t) : [t.id];
170
+ Y.every(
171
171
  /** @param {any} [id] @returns {any} */
172
- (J) => j.has(J)
173
- ) ? Z.forEach(
172
+ (U) => H.has(U)
173
+ ) ? Y.forEach(
174
174
  /** @param {any} [id] @returns {any} */
175
- (J) => j.delete(J)
176
- ) : Z.forEach(
175
+ (U) => H.delete(U)
176
+ ) : Y.forEach(
177
177
  /** @param {any} [id] @returns {any} */
178
- (J) => j.add(J)
179
- ), S(j);
180
- }, B = (E) => {
181
- if (E.stopPropagation(), C) {
182
- const j = jr(r), Z = j.some(
178
+ (U) => H.add(U)
179
+ ), E(H);
180
+ }, B = (D) => {
181
+ if (D.stopPropagation(), w) {
182
+ const H = jr(t), Y = H.some(
183
183
  /** @param {any} [c] @returns {any} */
184
- (V) => !V.getIsVisible()
184
+ (J) => !J.getIsVisible()
185
185
  );
186
- j.forEach(
186
+ H.forEach(
187
187
  /** @param {any} [c] @returns {any} */
188
- (V) => V.toggleVisibility(Z)
188
+ (J) => J.toggleVisibility(Y)
189
189
  );
190
190
  } else
191
- r.toggleVisibility();
192
- }, _ = (E, j) => {
193
- E.stopPropagation(), l(r.id, j);
194
- }, N = (E) => {
195
- A(!0), E.dataTransfer.setData("text/plain", r.id), E.dataTransfer.effectAllowed = "move";
191
+ t.toggleVisibility();
192
+ }, _ = (D, H) => {
193
+ D.stopPropagation(), l(t.id, H);
194
+ }, K = (D) => {
195
+ A(!0), D.dataTransfer.setData("text/plain", t.id), D.dataTransfer.effectAllowed = "move";
196
196
  }, L = () => {
197
197
  A(!1);
198
- }, m = (E) => {
199
- E.preventDefault(), E.stopPropagation();
200
- const j = E.dataTransfer.getData("text/plain");
201
- j && g && j !== r.id && g(j, z, r.id);
202
- }, $ = (E) => {
203
- E.key === "Enter" ? B(E) : E.key === " " ? (E.preventDefault(), w(E)) : E.altKey && E.key === "ArrowLeft" ? (E.preventDefault(), l(r.id, "left")) : E.altKey && E.key === "ArrowRight" ? (E.preventDefault(), l(r.id, "right")) : E.altKey && E.key === "ArrowDown" && (E.preventDefault(), l(r.id, !1));
204
- };
198
+ }, m = (D) => {
199
+ D.preventDefault(), D.stopPropagation();
200
+ const H = D.dataTransfer.getData("text/plain");
201
+ H && g && H !== t.id && g(H, z, t.id);
202
+ }, $ = (D) => {
203
+ D.key === "Enter" ? B(D) : D.key === " " ? (D.preventDefault(), k(D)) : D.altKey && D.key === "ArrowLeft" ? (D.preventDefault(), l(t.id, "left")) : D.altKey && D.key === "ArrowRight" ? (D.preventDefault(), l(t.id, "right")) : D.altKey && D.key === "ArrowDown" && (D.preventDefault(), l(t.id, !1));
204
+ }, j = (D) => ({
205
+ width: "20px",
206
+ height: "20px",
207
+ padding: "2px",
208
+ background: D ? o.primary : "transparent",
209
+ border: "none",
210
+ cursor: "pointer",
211
+ borderRadius: "4px",
212
+ color: D ? "#fff" : o.textSec,
213
+ display: "inline-flex",
214
+ alignItems: "center",
215
+ justifyContent: "center",
216
+ opacity: D ? 1 : 0.72,
217
+ transition: "background-color var(--sp-dur-fast, 140ms) ease, color var(--sp-dur-fast, 140ms) ease, opacity var(--sp-dur-fast, 140ms) ease"
218
+ });
205
219
  return /* @__PURE__ */ e.createElement(
206
220
  "div",
207
221
  {
208
222
  style: { display: "flex", flexDirection: "column", opacity: M ? 0.5 : 1 },
209
- draggable: !C,
210
- onDragStart: N,
223
+ draggable: !w,
224
+ onDragStart: K,
211
225
  onDragEnd: L,
212
- onDragOver: (E) => E.preventDefault(),
226
+ onDragOver: (D) => D.preventDefault(),
213
227
  onDrop: m,
214
228
  role: "treeitem",
215
- "aria-selected": i || k,
229
+ "aria-selected": i || S,
216
230
  "aria-expanded": s
217
231
  },
218
232
  /* @__PURE__ */ e.createElement(
219
233
  "div",
220
234
  {
235
+ className: "sp-col-tree-row",
221
236
  style: {
222
237
  ...a.columnItem,
223
- paddingLeft: `${n * 12 + 8}px`,
224
- // Reduced indentation step
225
- background: i || k ? o.select : W ? o.hover : "transparent",
226
- borderLeft: U ? `3px solid ${o.primary}` : "3px solid transparent"
238
+ gap: "5px",
239
+ paddingRight: "6px",
240
+ paddingLeft: `${n * 12 + 6}px`,
241
+ minWidth: 0,
242
+ background: i || S ? o.select : W ? o.hover : "transparent",
243
+ borderLeft: N ? `3px solid ${o.primary}` : "3px solid transparent"
227
244
  },
228
- onMouseEnter: (E) => !(i || k) && P(!0),
229
- onMouseLeave: (E) => !(i || k) && P(!1),
245
+ onMouseEnter: () => !(i || S) && P(!0),
246
+ onMouseLeave: () => !(i || S) && P(!1),
230
247
  tabIndex: 0,
231
248
  onKeyDown: $
232
249
  },
@@ -236,84 +253,84 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
236
253
  ref: y,
237
254
  type: "checkbox",
238
255
  checked: i,
239
- onChange: w,
240
- onClick: (E) => E.stopPropagation(),
241
- style: { margin: 0, cursor: "pointer", pointerEvents: "auto" },
256
+ onChange: k,
257
+ onClick: (D) => D.stopPropagation(),
258
+ style: { margin: 0, cursor: "pointer", pointerEvents: "auto", flexShrink: 0 },
242
259
  tabIndex: -1
243
260
  }
244
261
  ),
245
- !C && /* @__PURE__ */ e.createElement("span", { style: { cursor: "grab", display: "flex", opacity: 0.7, marginRight: "4px" } }, /* @__PURE__ */ e.createElement(F.DragIndicator, null)),
246
- C ? /* @__PURE__ */ e.createElement(
262
+ !w && /* @__PURE__ */ e.createElement("span", { style: { cursor: "grab", display: "inline-flex", opacity: 0.55, flexShrink: 0 } }, /* @__PURE__ */ e.createElement(F.DragIndicator, null)),
263
+ w && /* @__PURE__ */ e.createElement(
247
264
  "span",
248
265
  {
249
266
  role: "button",
250
267
  tabIndex: 0,
251
268
  "aria-expanded": s,
252
- "aria-label": s ? `Collapse ${T}` : `Expand ${T}`,
269
+ "aria-label": s ? `Collapse ${I}` : `Expand ${I}`,
253
270
  onClick: () => x(!s),
254
- onKeyDown: (E) => {
255
- (E.key === "Enter" || E.key === " ") && (E.preventDefault(), x(!s));
271
+ onKeyDown: (D) => {
272
+ (D.key === "Enter" || D.key === " ") && (D.preventDefault(), x(!s));
256
273
  },
257
- style: { cursor: "pointer", display: "flex", opacity: 0.7, marginRight: "4px" }
274
+ style: { cursor: "pointer", display: "inline-flex", opacity: 0.75, flexShrink: 0 }
258
275
  },
259
276
  s ? /* @__PURE__ */ e.createElement(F.ChevronDown, null) : /* @__PURE__ */ e.createElement(F.ChevronRight, null)
260
- ) : /* @__PURE__ */ e.createElement("span", { style: { width: "20px" } }),
277
+ ),
261
278
  /* @__PURE__ */ e.createElement(
262
279
  "span",
263
280
  {
264
281
  onClick: B,
265
282
  style: {
266
283
  cursor: "pointer",
267
- display: "flex",
268
- color: R ? o.primary : o.textSec,
269
- opacity: R ? 1 : 0.5,
270
- marginRight: "4px"
284
+ display: "inline-flex",
285
+ color: C ? o.primary : o.textSec,
286
+ opacity: C ? 1 : 0.5,
287
+ flexShrink: 0
271
288
  },
272
- title: R ? "Hide Column" : "Show Column",
273
- "aria-label": R ? "Hide Column" : "Show Column"
289
+ title: C ? "Hide Column" : "Show Column",
290
+ "aria-label": C ? "Hide Column" : "Show Column"
274
291
  },
275
- R ? /* @__PURE__ */ e.createElement(F.Visibility, null) : /* @__PURE__ */ e.createElement(F.VisibilityOff, null)
292
+ C ? /* @__PURE__ */ e.createElement(F.Visibility, null) : /* @__PURE__ */ e.createElement(F.VisibilityOff, null)
276
293
  ),
277
294
  /* @__PURE__ */ e.createElement(
278
295
  "span",
279
296
  {
280
297
  style: {
281
- flex: 1,
298
+ flex: "1 1 0%",
299
+ minWidth: 0,
282
300
  overflow: "hidden",
283
- textOverflow: "ellipsis",
284
- whiteSpace: "nowrap",
285
- fontWeight: C ? 600 : 400,
286
- cursor: C ? "pointer" : "default",
287
- color: R ? o.text : o.textSec,
288
- opacity: R ? 1 : 0.6,
301
+ fontWeight: w ? 600 : 400,
302
+ cursor: w ? "pointer" : "default",
303
+ color: C ? o.text : o.textSec,
304
+ opacity: C ? 1 : 0.6,
289
305
  display: "flex",
290
- alignItems: "center"
306
+ alignItems: "center",
307
+ gap: "4px"
291
308
  },
292
- onClick: () => C && x(!s),
293
- title: T
309
+ onClick: () => w && x(!s),
310
+ title: I
294
311
  },
295
- C && /* @__PURE__ */ e.createElement(F.Group, { style: { marginRight: "6px", fontSize: "14px", opacity: 0.8 } }),
296
- T
312
+ w && /* @__PURE__ */ e.createElement(F.Group, { style: { fontSize: "13px", opacity: 0.8, flexShrink: 0 } }),
313
+ /* @__PURE__ */ e.createElement("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, I)
297
314
  ),
298
- !C && /* @__PURE__ */ e.createElement("div", { className: "pin-controls" }, /* @__PURE__ */ e.createElement("button", { onClick: (E) => _(E, "left"), title: "Pin Column Left", "aria-label": "Pin Column Left" }, /* @__PURE__ */ e.createElement(F.PinLeft, null)), /* @__PURE__ */ e.createElement("button", { onClick: (E) => _(E, !1), title: "Unpin Column", "aria-label": "Unpin Column" }, /* @__PURE__ */ e.createElement(F.Unpin, null)), /* @__PURE__ */ e.createElement("button", { onClick: (E) => _(E, "right"), title: "Pin Column Right", "aria-label": "Pin Column Right" }, /* @__PURE__ */ e.createElement(F.PinRight, null)))
315
+ !w && /* @__PURE__ */ e.createElement("div", { className: "pin-controls sp-col-pin-controls", "data-pinned": N || void 0 }, /* @__PURE__ */ e.createElement("button", { type: "button", style: j(N === "left"), onClick: (D) => _(D, "left"), title: "Pin Column Left", "aria-label": "Pin Column Left" }, /* @__PURE__ */ e.createElement(F.PinLeft, null)), /* @__PURE__ */ e.createElement("button", { type: "button", style: j(!N), onClick: (D) => _(D, !1), title: "Unpin Column", "aria-label": "Unpin Column" }, /* @__PURE__ */ e.createElement(F.Unpin, null)), /* @__PURE__ */ e.createElement("button", { type: "button", style: j(N === "right"), onClick: (D) => _(D, "right"), title: "Pin Column Right", "aria-label": "Pin Column Right" }, /* @__PURE__ */ e.createElement(F.PinRight, null)))
299
316
  ),
300
- C && s && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", flexDirection: "column" } }, r.columns.filter(
317
+ w && s && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", flexDirection: "column" } }, t.columns.filter(
301
318
  /** @param {any} [child] @returns {any} */
302
- (E) => at(E, z)
319
+ (D) => at(D, z)
303
320
  ).map(
304
321
  /** @param {any} [child] @returns {any} */
305
- (E) => /* @__PURE__ */ e.createElement(
322
+ (D) => /* @__PURE__ */ e.createElement(
306
323
  fr,
307
324
  {
308
- key: E.id,
309
- column: E,
325
+ key: D.id,
326
+ column: D,
310
327
  level: n + 1,
311
328
  theme: o,
312
329
  styles: a,
313
330
  handlePinColumn: l,
314
- colSearch: p,
331
+ colSearch: d,
315
332
  selectedCols: f,
316
- setSelectedCols: S,
333
+ setSelectedCols: E,
317
334
  onDrop: g,
318
335
  sectionId: z
319
336
  }
@@ -331,24 +348,24 @@ const nn = ({ column: r, theme: n, styles: o, onFilter: a, currentFilter: l, opt
331
348
  source: "pivot",
332
349
  displayMode: "trend"
333
350
  };
334
- function xr(r) {
335
- return String(r || "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
351
+ function xr(t) {
352
+ return String(t || "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
336
353
  }
337
- function Me(r, n = "formula") {
338
- const a = String(r || "").trim().toLowerCase().replace(/\s+/g, "").replace(/[^a-z0-9_]/g, "") || String(n || "formula").toLowerCase().replace(/[^a-z0-9_]/g, "") || "formula";
354
+ function Me(t, n = "formula") {
355
+ const a = String(t || "").trim().toLowerCase().replace(/\s+/g, "").replace(/[^a-z0-9_]/g, "") || String(n || "formula").toLowerCase().replace(/[^a-z0-9_]/g, "") || "formula";
339
356
  return /^[a-z_]/.test(a) ? a : `f_${a}`;
340
357
  }
341
- function q(r) {
342
- return !r || typeof r != "object" ? "" : String(
343
- r.formulaRef || Me(r.label || "", r.field || "formula") || r.field || ""
358
+ function q(t) {
359
+ return !t || typeof t != "object" ? "" : String(
360
+ t.formulaRef || Me(t.label || "", t.field || "formula") || t.field || ""
344
361
  ).trim();
345
362
  }
346
- function Ne(r) {
347
- const n = String(r || "").trim().toLowerCase();
363
+ function He(t) {
364
+ const n = String(t || "").trim().toLowerCase();
348
365
  return ["columns", "display", "displayed", "displayed_columns", "rendered", "rendered_columns"].includes(n) ? "columns" : "measures";
349
366
  }
350
- function $e(r) {
351
- return Ne(r) === "columns";
367
+ function $e(t) {
368
+ return He(t) === "columns";
352
369
  }
353
370
  const on = [
354
371
  { value: "eq", label: "Equals" },
@@ -365,19 +382,19 @@ const on = [
365
382
  { value: "is_null", label: "Is empty" },
366
383
  { value: "is_not_null", label: "Is not empty" }
367
384
  ], Jt = /* @__PURE__ */ new Set(["in", "not_in"]), sn = /* @__PURE__ */ new Set(["is_null", "is_not_null"]);
368
- function yr(r) {
369
- return { field: r && r[0] || "", operator: "eq", value: "", values: [], caseSensitive: !1 };
385
+ function yr(t) {
386
+ return { field: t && t[0] || "", operator: "eq", value: "", values: [], caseSensitive: !1 };
370
387
  }
371
- function br(r, n = 0) {
388
+ function br(t, n = 0) {
372
389
  return {
373
390
  id: `rule-${Date.now().toString(36)}-${n}`,
374
391
  label: n === 0 ? "Group A" : `Group ${n + 1}`,
375
- condition: { op: "AND", clauses: [yr(r)] }
392
+ condition: { op: "AND", clauses: [yr(t)] }
376
393
  };
377
394
  }
378
- function Qt(r, n = null) {
395
+ function Qt(t, n = null) {
379
396
  if (n) {
380
- const a = He([n])[0] || n;
397
+ const a = Ne([n])[0] || n;
381
398
  return { ...JSON.parse(JSON.stringify(a)), __editingField: a.field, __editingId: a.id };
382
399
  }
383
400
  const o = it(`category_${Date.now().toString(36)}`);
@@ -387,34 +404,34 @@ function Qt(r, n = null) {
387
404
  name: "New Category",
388
405
  fallbackLabel: "Other",
389
406
  order: "creation",
390
- rules: [br(r, 0)],
407
+ rules: [br(t, 0)],
391
408
  __isNew: !0
392
409
  };
393
410
  }
394
- function cn(r, n) {
411
+ function cn(t, n) {
395
412
  if (!n) return "string";
396
- const o = Array.isArray(r) ? r.slice(0, 250) : [];
413
+ const o = Array.isArray(t) ? t.slice(0, 250) : [];
397
414
  for (let a = 0; a < o.length; a += 1) {
398
415
  const l = o[a];
399
416
  if (!l || typeof l != "object") continue;
400
- const p = l[n];
401
- if (!(p == null || p === "")) {
402
- if (typeof p == "number" && Number.isFinite(p)) return "number";
403
- if (p instanceof Date && !Number.isNaN(p.getTime())) return "date";
404
- if (typeof p == "string") {
405
- const f = p.trim();
417
+ const d = l[n];
418
+ if (!(d == null || d === "")) {
419
+ if (typeof d == "number" && Number.isFinite(d)) return "number";
420
+ if (d instanceof Date && !Number.isNaN(d.getTime())) return "date";
421
+ if (typeof d == "string") {
422
+ const f = d.trim();
406
423
  if (!f) continue;
407
424
  if (Number.isFinite(Number(f))) return "number";
408
- const S = Date.parse(f);
409
- return !Number.isNaN(S) && /[-/T:]/.test(f) ? "date" : "string";
425
+ const E = Date.parse(f);
426
+ return !Number.isNaN(E) && /[-/T:]/.test(f) ? "date" : "string";
410
427
  }
411
428
  }
412
429
  }
413
430
  return "string";
414
431
  }
415
- const ot = (r, n, o) => (Array.isArray(n) ? n : []).filter((a) => cn(r, a) === o);
416
- function un(r, n) {
417
- const a = ot(n, r, "date")[0] || r[0] || "", l = it(`${a || "date"}_month`);
432
+ const ot = (t, n, o) => (Array.isArray(n) ? n : []).filter((a) => cn(t, a) === o);
433
+ function un(t, n) {
434
+ const a = ot(n, t, "date")[0] || t[0] || "", l = it(`${a || "date"}_month`);
418
435
  return {
419
436
  id: l,
420
437
  field: st(l),
@@ -427,8 +444,8 @@ function un(r, n) {
427
444
  __isNew: !0
428
445
  };
429
446
  }
430
- function dn(r, n) {
431
- const a = ot(n, r, "number")[0] || r[0] || "", l = it(`${a || "number"}_bins`);
447
+ function pn(t, n) {
448
+ const a = ot(n, t, "number")[0] || t[0] || "", l = it(`${a || "number"}_bins`);
432
449
  return {
433
450
  id: l,
434
451
  field: st(l),
@@ -443,19 +460,19 @@ function dn(r, n) {
443
460
  __isNew: !0
444
461
  };
445
462
  }
446
- const er = (r) => String(r || "").split(",").map((n) => n.trim()).filter(Boolean), tr = (r) => String(r || "").trim().replace(/\s+/g, " ").toLowerCase(), Er = (r) => r && (r.__editingField || r.field) ? r.__editingField || r.field : "";
447
- function pn(r, n) {
448
- const o = Array.isArray(r) ? r : [], a = Er(n);
463
+ const er = (t) => String(t || "").split(",").map((n) => n.trim()).filter(Boolean), tr = (t) => String(t || "").trim().replace(/\s+/g, " ").toLowerCase(), hr = (t) => t && (t.__editingField || t.field) ? t.__editingField || t.field : "";
464
+ function dn(t, n) {
465
+ const o = Array.isArray(t) ? t : [], a = hr(n);
449
466
  if (!a) return o;
450
467
  const l = o.findIndex(
451
468
  /** @param {any} [dimension] @returns {any} */
452
- (p) => p && p.field === a
469
+ (d) => d && d.field === a
453
470
  );
454
471
  return l >= 0 ? o.slice(0, l) : o;
455
472
  }
456
- function rr(r) {
473
+ function rr(t) {
457
474
  const n = [];
458
- return (r && Array.isArray(r.rules) ? r.rules : []).forEach(
475
+ return (t && Array.isArray(t.rules) ? t.rules : []).forEach(
459
476
  /** @param {any} [rule] @returns {any} */
460
477
  (o) => {
461
478
  (o && o.condition && Array.isArray(o.condition.clauses) ? o.condition.clauses : []).forEach(
@@ -467,18 +484,18 @@ function rr(r) {
467
484
  }
468
485
  ), Array.from(new Set(n));
469
486
  }
470
- function fn(r, n) {
471
- const o = (Array.isArray(r) ? r : []).filter((a) => a && typeof a == "object").filter((a) => !a._isTotal && a._path !== "__grand_total__" && a._path !== "__color_scale_stats__");
487
+ function fn(t, n) {
488
+ const o = (Array.isArray(t) ? t : []).filter((a) => a && typeof a == "object").filter((a) => !a._isTotal && a._path !== "__grand_total__" && a._path !== "__color_scale_stats__");
472
489
  return Vr(o, n || []);
473
490
  }
474
- function mn(r, n) {
475
- return !Array.isArray(r) || r.length === 0 || !Array.isArray(n) || n.length === 0 ? !1 : n.every((o) => r.some((a) => a && Object.prototype.hasOwnProperty.call(a, o)));
491
+ function mn(t, n) {
492
+ return !Array.isArray(t) || t.length === 0 || !Array.isArray(n) || n.length === 0 ? !1 : n.every((o) => t.some((a) => a && Object.prototype.hasOwnProperty.call(a, o)));
476
493
  }
477
- const gn = (r, n) => (n && Array.isArray(n.rules) ? n.rules : []).map(
494
+ const gn = (t, n) => (n && Array.isArray(n.rules) ? n.rules : []).map(
478
495
  /** @param {any} [rule] @returns {any} */
479
496
  (o) => ({
480
497
  label: o && o.label ? o.label : "Rule",
481
- count: r.reduce(
498
+ count: t.reduce(
482
499
  /** @param {any} [matches] @param {any} [row] @returns {any} */
483
500
  (a, l) => Kr(l, o.condition) ? a + 1 : a,
484
501
  0
@@ -486,45 +503,45 @@ const gn = (r, n) => (n && Array.isArray(n.rules) ? n.rules : []).map(
486
503
  })
487
504
  ), xn = e.lazy(() => import(
488
505
  /* webpackChunkName: "pivot-report-editor" */
489
- "./ReportEditor-U0E42xKL.mjs"
490
- ).then((r) => ({
491
- default: r.ReportEditor
492
- }))), yn = (r) => /* @__PURE__ */ e.createElement(e.Suspense, { fallback: /* @__PURE__ */ e.createElement("div", { role: "status", style: { padding: "16px" } }, "Loading report builder…") }, /* @__PURE__ */ e.createElement(xn, { ...r }));
506
+ "./ReportEditor-P4UZ97Ik.mjs"
507
+ ).then((t) => ({
508
+ default: t.ReportEditor
509
+ }))), yn = (t) => /* @__PURE__ */ e.createElement(e.Suspense, { fallback: /* @__PURE__ */ e.createElement("div", { role: "status", style: { padding: "16px" } }, "Loading report builder…") }, /* @__PURE__ */ e.createElement(xn, { ...t }));
493
510
  function nr({
494
- availableFields: r,
511
+ availableFields: t,
495
512
  customDimensions: n,
496
513
  setCustomDimensions: o,
497
514
  data: a,
498
515
  theme: l,
499
- showNotification: p,
516
+ showNotification: d,
500
517
  getFieldLabel: f,
501
- onDeleteField: S
518
+ onDeleteField: E
502
519
  }) {
503
520
  const g = e.useMemo(
504
- () => (r || []).filter(
521
+ () => (t || []).filter(
505
522
  /** @param {any} [field] @returns {any} */
506
- (i) => i && !pr(i)
523
+ (i) => i && !dr(i)
507
524
  ),
508
- [r]
525
+ [t]
509
526
  ), z = e.useMemo(
510
- () => He(n || []),
527
+ () => Ne(n || []),
511
528
  [n]
512
529
  ), [s, x] = e.useState(null), W = e.useMemo(
513
- () => pn(z, s),
530
+ () => dn(z, s),
514
531
  [s, z]
515
532
  ), P = e.useMemo(() => {
516
- const i = /* @__PURE__ */ new Set(), k = [];
533
+ const i = /* @__PURE__ */ new Set(), S = [];
517
534
  return g.forEach(
518
535
  /** @param {any} [field] @returns {any} */
519
- (w) => {
520
- w && !i.has(w) && (i.add(w), k.push(w));
536
+ (k) => {
537
+ k && !i.has(k) && (i.add(k), S.push(k));
521
538
  }
522
539
  ), W.forEach(
523
540
  /** @param {any} [dimension] @returns {any} */
524
- (w) => {
525
- w && w.field && !i.has(w.field) && (i.add(w.field), k.push(w.field));
541
+ (k) => {
542
+ k && k.field && !i.has(k.field) && (i.add(k.field), S.push(k.field));
526
543
  }
527
- ), k;
544
+ ), S;
528
545
  }, [W, g]), M = e.useMemo(
529
546
  () => {
530
547
  const i = ot(a, g, "date");
@@ -540,7 +557,7 @@ function nr({
540
557
  ), y = e.useMemo(
541
558
  () => fn(a, W),
542
559
  [W, a]
543
- ), C = e.useMemo(() => ({
560
+ ), w = e.useMemo(() => ({
544
561
  border: `1px solid ${l.border}`,
545
562
  background: l.background,
546
563
  color: l.text,
@@ -549,7 +566,7 @@ function nr({
549
566
  padding: "7px 8px",
550
567
  outline: "none",
551
568
  minWidth: 0
552
- }), [l.background, l.border, l.text]), D = e.useCallback((i = "default") => ({
569
+ }), [l.background, l.border, l.text]), R = e.useCallback((i = "default") => ({
553
570
  border: i === "primary" ? `1px solid ${l.primary}` : `1px solid ${l.border}`,
554
571
  background: i === "primary" ? l.primary || "#2563EB" : l.hover || "#F8FAFC",
555
572
  color: i === "primary" ? "#fff" : l.text,
@@ -564,49 +581,49 @@ function nr({
564
581
  }), [l.border, l.hover, l.primary, l.text]);
565
582
  e.useEffect(() => {
566
583
  if (!s) return;
567
- const i = (k) => {
568
- k.key === "Escape" && (k.preventDefault(), x(null));
584
+ const i = (S) => {
585
+ S.key === "Escape" && (S.preventDefault(), x(null));
569
586
  };
570
587
  return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
571
588
  }, [s]);
572
- const T = e.useCallback((i, k) => {
589
+ const I = e.useCallback((i, S) => {
573
590
  x(
574
591
  /** @param {any} [current] @returns {any} */
575
- (w) => {
576
- if (!w) return w;
577
- const B = [...w.rules || []];
578
- return B[i] = typeof k == "function" ? k(B[i]) : k, { ...w, rules: B };
592
+ (k) => {
593
+ if (!k) return k;
594
+ const B = [...k.rules || []];
595
+ return B[i] = typeof S == "function" ? S(B[i]) : S, { ...k, rules: B };
579
596
  }
580
597
  );
581
- }, []), U = e.useCallback((i, k, w) => {
582
- T(
598
+ }, []), N = e.useCallback((i, S, k) => {
599
+ I(
583
600
  i,
584
601
  /** @param {any} [rule] @returns {any} */
585
602
  (B) => {
586
- const _ = B.condition || { op: "AND", clauses: [] }, N = [..._.clauses || []];
587
- return N[k] = { ...N[k], ...w }, { ...B, condition: { ..._, clauses: N } };
603
+ const _ = B.condition || { op: "AND", clauses: [] }, K = [..._.clauses || []];
604
+ return K[S] = { ...K[S], ...k }, { ...B, condition: { ..._, clauses: K } };
588
605
  }
589
606
  );
590
- }, [T]), R = e.useCallback(() => {
591
- const i = He([s])[0];
607
+ }, [I]), C = e.useCallback(() => {
608
+ const i = Ne([s])[0];
592
609
  if (!i || !i.name) {
593
- p && p("A grouped field needs a name.", "warning");
610
+ d && d("A grouped field needs a name.", "warning");
594
611
  return;
595
612
  }
596
613
  if (i.kind === "category" && (!i.rules || i.rules.length === 0)) {
597
- p && p("A category needs at least one valid rule.", "warning");
614
+ d && d("A category needs at least one valid rule.", "warning");
598
615
  return;
599
616
  }
600
617
  if ((i.kind === "date_group" || i.kind === "number_group") && !i.sourceField) {
601
- p && p("Choose the source field to group.", "warning");
618
+ d && d("Choose the source field to group.", "warning");
602
619
  return;
603
620
  }
604
- const k = Er(s), w = tr(i.name);
621
+ const S = hr(s), k = tr(i.name);
605
622
  if (z.some(
606
623
  /** @param {any} [dimension] @returns {any} */
607
- (_) => _ && _.field !== k && tr(_.name) === w
624
+ (_) => _ && _.field !== S && tr(_.name) === k
608
625
  )) {
609
- p && p(`A category named "${i.name}" already exists.`, "warning");
626
+ d && d(`A category named "${i.name}" already exists.`, "warning");
610
627
  return;
611
628
  }
612
629
  if (i.kind === "category") {
@@ -615,7 +632,7 @@ function nr({
615
632
  /** @param {any} [field] @returns {any} */
616
633
  (m) => !_.has(m)
617
634
  )) {
618
- p && p("A category can only use base fields or categories defined before it.", "warning");
635
+ d && d("A category can only use base fields or categories defined before it.", "warning");
619
636
  return;
620
637
  }
621
638
  const L = rr(i);
@@ -625,42 +642,42 @@ function nr({
625
642
  ($) => $.count === 0
626
643
  );
627
644
  if (m) {
628
- p && p(`"${m.label}" does not match any current row. Adjust the condition before applying.`, "warning");
645
+ d && d(`"${m.label}" does not match any current row. Adjust the condition before applying.`, "warning");
629
646
  return;
630
647
  }
631
648
  }
632
649
  }
633
650
  if (i.kind === "date_group" && !M.includes(i.sourceField)) {
634
- p && p("Choose a date field for date grouping.", "warning");
651
+ d && d("Choose a date field for date grouping.", "warning");
635
652
  return;
636
653
  }
637
654
  if (i.kind === "number_group") {
638
655
  if (!A.includes(i.sourceField)) {
639
- p && p("Choose a numeric field for number grouping.", "warning");
656
+ d && d("Choose a numeric field for number grouping.", "warning");
640
657
  return;
641
658
  }
642
659
  if (!Number.isFinite(Number(i.binSize)) || Number(i.binSize) <= 0) {
643
- p && p("Number bins need a positive bin size.", "warning");
660
+ d && d("Number bins need a positive bin size.", "warning");
644
661
  return;
645
662
  }
646
663
  }
647
664
  o(
648
665
  /** @param {any} [previous] @returns {any} */
649
- (_) => [...He(_ || []).filter(
666
+ (_) => [...Ne(_ || []).filter(
650
667
  /** @param {any} [dimension] @returns {any} */
651
- (m) => m.id !== i.id && m.field !== i.field && m.field !== k
668
+ (m) => m.id !== i.id && m.field !== i.field && m.field !== S
652
669
  ), i]
653
- ), x(null), p && p(`Applied ${i.name}.`, "success");
654
- }, [P, M, s, z, A, o, p, y]), O = e.useCallback((i) => {
655
- const k = He([i])[0];
656
- k && (o(
670
+ ), x(null), d && d(`Applied ${i.name}.`, "success");
671
+ }, [P, M, s, z, A, o, d, y]), O = e.useCallback((i) => {
672
+ const S = Ne([i])[0];
673
+ S && (o(
657
674
  /** @param {any} [previous] @returns {any} */
658
- (w) => He(w || []).filter(
675
+ (k) => Ne(k || []).filter(
659
676
  /** @param {any} [item] @returns {any} */
660
- (B) => B.field !== k.field
677
+ (B) => B.field !== S.field
661
678
  )
662
- ), typeof S == "function" && S(k.field), s && s.field === k.field && x(null), p && p(`Removed ${k.name}.`, "success"));
663
- }, [s, S, o, p]);
679
+ ), typeof E == "function" && E(S.field), s && s.field === S.field && x(null), d && d(`Removed ${S.name}.`, "success"));
680
+ }, [s, E, o, d]);
664
681
  return /* @__PURE__ */ e.createElement("div", { style: {
665
682
  border: `1px solid ${l.border}`,
666
683
  background: l.headerBg || l.surfaceInset || l.background,
@@ -675,7 +692,7 @@ function nr({
675
692
  {
676
693
  type: "button",
677
694
  onClick: () => x(Qt(P)),
678
- style: { ...D("primary"), whiteSpace: "nowrap", flexShrink: 0 }
695
+ style: { ...R("primary"), whiteSpace: "nowrap", flexShrink: 0 }
679
696
  },
680
697
  "+ Category"
681
698
  )), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ e.createElement(
@@ -684,7 +701,7 @@ function nr({
684
701
  type: "button",
685
702
  onClick: () => x(un(g, a)),
686
703
  disabled: M.length === 0,
687
- style: { ...D(), opacity: M.length === 0 ? 0.5 : 1, cursor: M.length === 0 ? "not-allowed" : "pointer" },
704
+ style: { ...R(), opacity: M.length === 0 ? 0.5 : 1, cursor: M.length === 0 ? "not-allowed" : "pointer" },
688
705
  title: M.length === 0 ? "No date fields detected" : "Create date buckets"
689
706
  },
690
707
  /* @__PURE__ */ e.createElement(F.Group, null),
@@ -693,9 +710,9 @@ function nr({
693
710
  "button",
694
711
  {
695
712
  type: "button",
696
- onClick: () => x(dn(g, a)),
713
+ onClick: () => x(pn(g, a)),
697
714
  disabled: A.length === 0,
698
- style: { ...D(), opacity: A.length === 0 ? 0.5 : 1, cursor: A.length === 0 ? "not-allowed" : "pointer" },
715
+ style: { ...R(), opacity: A.length === 0 ? 0.5 : 1, cursor: A.length === 0 ? "not-allowed" : "pointer" },
699
716
  title: A.length === 0 ? "No numeric fields detected" : "Create numeric bins"
700
717
  },
701
718
  /* @__PURE__ */ e.createElement(F.NumberFormat, null),
@@ -703,7 +720,7 @@ function nr({
703
720
  )), z.length > 0 && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, z.map(
704
721
  /** @param {any} [dimension] @returns {any} */
705
722
  (i) => {
706
- const k = i.kind || "category", w = k === "date_group" ? `${f(i.sourceField)} by ${i.granularity}` : k === "number_group" ? `${f(i.sourceField)} every ${i.binSize}` : `${i.rules.length} rule${i.rules.length === 1 ? "" : "s"} | fallback: ${i.fallbackLabel}`;
723
+ const S = i.kind || "category", k = S === "date_group" ? `${f(i.sourceField)} by ${i.granularity}` : S === "number_group" ? `${f(i.sourceField)} every ${i.binSize}` : `${i.rules.length} rule${i.rules.length === 1 ? "" : "s"} | fallback: ${i.fallbackLabel}`;
707
724
  return /* @__PURE__ */ e.createElement(
708
725
  "div",
709
726
  {
@@ -718,10 +735,10 @@ function nr({
718
735
  gap: "8px"
719
736
  }
720
737
  },
721
- k === "number_group" ? /* @__PURE__ */ e.createElement(F.NumberFormat, null) : /* @__PURE__ */ e.createElement(F.Branch, null),
722
- /* @__PURE__ */ e.createElement("div", { style: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "12px", fontWeight: 800, color: l.text, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, i.name), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec } }, w)),
723
- /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => x(Qt(g, i)), style: D() }, /* @__PURE__ */ e.createElement(F.Edit, null), " Edit"),
724
- /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => O(i), style: { ...D(), color: "#B91C1C" } }, /* @__PURE__ */ e.createElement(F.Delete, null))
738
+ S === "number_group" ? /* @__PURE__ */ e.createElement(F.NumberFormat, null) : /* @__PURE__ */ e.createElement(F.Branch, null),
739
+ /* @__PURE__ */ e.createElement("div", { style: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "12px", fontWeight: 800, color: l.text, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, i.name), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec } }, k)),
740
+ /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => x(Qt(g, i)), style: R() }, /* @__PURE__ */ e.createElement(F.Edit, null), " Edit"),
741
+ /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => O(i), style: { ...R(), color: "#B91C1C" } }, /* @__PURE__ */ e.createElement(F.Delete, null))
725
742
  );
726
743
  }
727
744
  )), s && /* @__PURE__ */ e.createElement(
@@ -736,7 +753,6 @@ function nr({
736
753
  inset: 0,
737
754
  zIndex: 1e4,
738
755
  background: "rgba(15, 23, 42, 0.38)",
739
- backdropFilter: "blur(4px)",
740
756
  display: "flex",
741
757
  alignItems: "center",
742
758
  justifyContent: "center",
@@ -768,7 +784,7 @@ function nr({
768
784
  alignItems: "center",
769
785
  justifyContent: "space-between",
770
786
  gap: "12px"
771
- } }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "13px", fontWeight: 900, color: l.text } }, s.kind === "date_group" || s.kind === "number_group" ? s.__editingField ? "Edit Grouped Field" : "Add Grouped Field" : s.__editingField ? "Edit Custom Category" : "Add Custom Category"), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "11px", color: l.textSec, marginTop: "2px" } }, s.kind === "date_group" ? "Create calendar buckets from a date field." : s.kind === "number_group" ? "Create fixed-width numeric bins from a number field." : "Rules can use base fields and categories defined before this one.")), /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => x(null), style: { ...D(), padding: "6px 8px" }, "aria-label": "Close category editor" }, /* @__PURE__ */ e.createElement(F.Close, null))),
787
+ } }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "13px", fontWeight: 900, color: l.text } }, s.kind === "date_group" || s.kind === "number_group" ? s.__editingField ? "Edit Grouped Field" : "Add Grouped Field" : s.__editingField ? "Edit Custom Category" : "Add Custom Category"), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "11px", color: l.textSec, marginTop: "2px" } }, s.kind === "date_group" ? "Create calendar buckets from a date field." : s.kind === "number_group" ? "Create fixed-width numeric bins from a number field." : "Rules can use base fields and categories defined before this one.")), /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => x(null), style: { ...R(), padding: "6px 8px" }, "aria-label": "Close category editor" }, /* @__PURE__ */ e.createElement(F.Close, null))),
772
788
  /* @__PURE__ */ e.createElement("div", { style: {
773
789
  padding: "14px",
774
790
  overflowY: "auto",
@@ -781,10 +797,10 @@ function nr({
781
797
  {
782
798
  value: s.name || "",
783
799
  onChange: (i) => {
784
- const k = i.target.value, w = s.id || it(k);
785
- x({ ...s, name: k, id: w, field: s.field || st(w) });
800
+ const S = i.target.value, k = s.id || it(S);
801
+ x({ ...s, name: S, id: k, field: s.field || st(k) });
786
802
  },
787
- style: C,
803
+ style: w,
788
804
  placeholder: "Example: Priority Segment"
789
805
  }
790
806
  )), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "4px", fontSize: "10px", fontWeight: 800, color: l.textSec, textTransform: "uppercase", letterSpacing: "0.4px" } }, "Else", /* @__PURE__ */ e.createElement(
@@ -792,7 +808,7 @@ function nr({
792
808
  {
793
809
  value: s.fallbackLabel || "",
794
810
  onChange: (i) => x({ ...s, fallbackLabel: i.target.value }),
795
- style: C,
811
+ style: w,
796
812
  placeholder: "Other"
797
813
  }
798
814
  )), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "4px", fontSize: "10px", fontWeight: 800, color: l.textSec, textTransform: "uppercase", letterSpacing: "0.4px" } }, "Member Order", /* @__PURE__ */ e.createElement(
@@ -802,7 +818,7 @@ function nr({
802
818
  "aria-label": "Member Order",
803
819
  value: s.order || "creation",
804
820
  onChange: (i) => x({ ...s, order: i.target.value }),
805
- style: { ...C, width: "100%" }
821
+ style: { ...w, width: "100%" }
806
822
  },
807
823
  /* @__PURE__ */ e.createElement("option", { value: "creation" }, "Creation Order"),
808
824
  /* @__PURE__ */ e.createElement("option", { value: "alpha" }, "Alphabetical (A→Z)"),
@@ -828,7 +844,7 @@ function nr({
828
844
  sourceField: i.target.value,
829
845
  name: s.__isNew ? `${f(i.target.value)} ${Se(s.granularity || "month")}` : s.name
830
846
  }),
831
- style: { ...C, width: "100%" }
847
+ style: { ...w, width: "100%" }
832
848
  },
833
849
  M.map(
834
850
  /** @param {any} [field] @returns {any} */
@@ -841,7 +857,7 @@ function nr({
841
857
  "aria-label": "Date Part",
842
858
  value: s.granularity || "month",
843
859
  onChange: (i) => x({ ...s, granularity: i.target.value }),
844
- style: { ...C, width: "100%" }
860
+ style: { ...w, width: "100%" }
845
861
  },
846
862
  Array.from(Qr).map((i) => /* @__PURE__ */ e.createElement("option", { key: i, value: i }, Se(i)))
847
863
  )), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "4px", fontSize: "10px", fontWeight: 800, color: l.textSec, textTransform: "uppercase", letterSpacing: "0.4px" } }, "Fiscal Start", /* @__PURE__ */ e.createElement(
@@ -851,9 +867,9 @@ function nr({
851
867
  "aria-label": "Fiscal Start",
852
868
  value: s.fiscalYearStartMonth || 1,
853
869
  onChange: (i) => x({ ...s, fiscalYearStartMonth: Number(i.target.value) }),
854
- style: { ...C, width: "100%" }
870
+ style: { ...w, width: "100%" }
855
871
  },
856
- ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].map((i, k) => /* @__PURE__ */ e.createElement("option", { key: i, value: k + 1 }, i))
872
+ ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].map((i, S) => /* @__PURE__ */ e.createElement("option", { key: i, value: S + 1 }, i))
857
873
  ))), s.kind === "number_group" && /* @__PURE__ */ e.createElement("div", { style: {
858
874
  border: `1px solid ${l.border}`,
859
875
  borderRadius: "10px",
@@ -873,7 +889,7 @@ function nr({
873
889
  sourceField: i.target.value,
874
890
  name: s.__isNew ? `${f(i.target.value)} Bins` : s.name
875
891
  }),
876
- style: { ...C, width: "100%" }
892
+ style: { ...w, width: "100%" }
877
893
  },
878
894
  A.map(
879
895
  /** @param {any} [field] @returns {any} */
@@ -885,7 +901,7 @@ function nr({
885
901
  type: "number",
886
902
  value: s.binSize === void 0 ? "" : s.binSize,
887
903
  onChange: (i) => x({ ...s, binSize: i.target.value }),
888
- style: C
904
+ style: w
889
905
  }
890
906
  )), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "4px", fontSize: "10px", fontWeight: 800, color: l.textSec, textTransform: "uppercase", letterSpacing: "0.4px" } }, "Min", /* @__PURE__ */ e.createElement(
891
907
  "input",
@@ -893,7 +909,7 @@ function nr({
893
909
  type: "number",
894
910
  value: s.minValue === null || s.minValue === void 0 ? "" : s.minValue,
895
911
  onChange: (i) => x({ ...s, minValue: i.target.value }),
896
- style: C
912
+ style: w
897
913
  }
898
914
  )), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "4px", fontSize: "10px", fontWeight: 800, color: l.textSec, textTransform: "uppercase", letterSpacing: "0.4px" } }, "Max", /* @__PURE__ */ e.createElement(
899
915
  "input",
@@ -901,7 +917,7 @@ function nr({
901
917
  type: "number",
902
918
  value: s.maxValue === null || s.maxValue === void 0 ? "" : s.maxValue,
903
919
  onChange: (i) => x({ ...s, maxValue: i.target.value }),
904
- style: C
920
+ style: w
905
921
  }
906
922
  )), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", flexDirection: "column", gap: "4px", fontSize: "10px", fontWeight: 800, color: l.textSec, textTransform: "uppercase", letterSpacing: "0.4px" } }, "Decimals", /* @__PURE__ */ e.createElement(
907
923
  "input",
@@ -911,13 +927,13 @@ function nr({
911
927
  max: "8",
912
928
  value: s.precision === null || s.precision === void 0 ? "" : s.precision,
913
929
  onChange: (i) => x({ ...s, precision: i.target.value }),
914
- style: C
930
+ style: w
915
931
  }
916
932
  ))), (!s.kind || s.kind === "category") && (s.rules || []).map(
917
933
  /** @param {any} [rule] @param {any} [ruleIndex] @returns {any} */
918
- (i, k) => {
919
- const w = i.condition || { op: "AND", clauses: [] }, B = w.clauses || [];
920
- return /* @__PURE__ */ e.createElement("div", { key: i.id || k, style: {
934
+ (i, S) => {
935
+ const k = i.condition || { op: "AND", clauses: [] }, B = k.clauses || [];
936
+ return /* @__PURE__ */ e.createElement("div", { key: i.id || S, style: {
921
937
  border: `1px solid ${l.border}`,
922
938
  borderRadius: "10px",
923
939
  padding: "8px",
@@ -929,8 +945,8 @@ function nr({
929
945
  "input",
930
946
  {
931
947
  value: i.label || "",
932
- onChange: (_) => T(k, { ...i, label: _.target.value }),
933
- style: C,
948
+ onChange: (_) => I(S, { ...i, label: _.target.value }),
949
+ style: w,
934
950
  placeholder: "Category value"
935
951
  }
936
952
  ), /* @__PURE__ */ e.createElement(
@@ -938,9 +954,9 @@ function nr({
938
954
  {
939
955
  size: "sm",
940
956
  "aria-label": "Rule condition combiner",
941
- value: w.op || "AND",
942
- onChange: (_) => T(k, { ...i, condition: { ...w, op: _.target.value } }),
943
- style: C
957
+ value: k.op || "AND",
958
+ onChange: (_) => I(S, { ...i, condition: { ...k, op: _.target.value } }),
959
+ style: w
944
960
  },
945
961
  /* @__PURE__ */ e.createElement("option", { value: "AND" }, "AND"),
946
962
  /* @__PURE__ */ e.createElement("option", { value: "OR" }, "OR")
@@ -950,24 +966,24 @@ function nr({
950
966
  type: "button",
951
967
  onClick: () => x({ ...s, rules: (s.rules || []).filter(
952
968
  /** @param {any} [_] @param {any} [index] @returns {any} */
953
- (_, N) => N !== k
969
+ (_, K) => K !== S
954
970
  ) }),
955
- style: { ...D(), padding: "6px", justifyContent: "center", color: "#B91C1C" },
971
+ style: { ...R(), padding: "6px", justifyContent: "center", color: "#B91C1C" },
956
972
  title: "Remove rule"
957
973
  },
958
974
  /* @__PURE__ */ e.createElement(F.Close, null)
959
975
  )), B.map(
960
976
  /** @param {any} [clause] @param {any} [clauseIndex] @returns {any} */
961
- (_, N) => {
977
+ (_, K) => {
962
978
  const L = sn.has(_.operator), m = Jt.has(_.operator);
963
- return /* @__PURE__ */ e.createElement("div", { key: `${i.id || k}:${N}`, style: { display: "grid", gridTemplateColumns: L ? "1fr 130px 28px" : "1fr 130px 1fr 28px", gap: "6px", alignItems: "center" } }, /* @__PURE__ */ e.createElement(
979
+ return /* @__PURE__ */ e.createElement("div", { key: `${i.id || S}:${K}`, style: { display: "grid", gridTemplateColumns: L ? "1fr 130px 28px" : "1fr 130px 1fr 28px", gap: "6px", alignItems: "center" } }, /* @__PURE__ */ e.createElement(
964
980
  re,
965
981
  {
966
982
  size: "sm",
967
983
  "aria-label": "Clause field",
968
984
  value: _.field || "",
969
- onChange: ($) => U(k, N, { field: $.target.value }),
970
- style: { ...C, width: "100%" }
985
+ onChange: ($) => N(S, K, { field: $.target.value }),
986
+ style: { ...w, width: "100%" }
971
987
  },
972
988
  P.map(
973
989
  /** @param {any} [field] @returns {any} */
@@ -980,38 +996,38 @@ function nr({
980
996
  "aria-label": "Clause operator",
981
997
  value: _.operator || "eq",
982
998
  onChange: ($) => {
983
- const E = $.target.value;
984
- U(k, N, {
985
- operator: E,
986
- values: Jt.has(E) ? _.values && _.values.length ? _.values : er(_.value) : _.values
999
+ const j = $.target.value;
1000
+ N(S, K, {
1001
+ operator: j,
1002
+ values: Jt.has(j) ? _.values && _.values.length ? _.values : er(_.value) : _.values
987
1003
  });
988
1004
  },
989
- style: { ...C, width: "100%" }
1005
+ style: { ...w, width: "100%" }
990
1006
  },
991
1007
  on.map(($) => /* @__PURE__ */ e.createElement("option", { key: $.value, value: $.value }, $.label))
992
1008
  ), !L && /* @__PURE__ */ e.createElement(
993
1009
  "input",
994
1010
  {
995
1011
  value: m ? (_.values || []).join(", ") : _.value || "",
996
- onChange: ($) => U(k, N, m ? { values: er($.target.value), value: $.target.value } : { value: $.target.value }),
997
- style: C,
1012
+ onChange: ($) => N(S, K, m ? { values: er($.target.value), value: $.target.value } : { value: $.target.value }),
1013
+ style: w,
998
1014
  placeholder: m ? "A, B, C" : "Value"
999
1015
  }
1000
1016
  ), /* @__PURE__ */ e.createElement(
1001
1017
  "button",
1002
1018
  {
1003
1019
  type: "button",
1004
- onClick: () => T(k, {
1020
+ onClick: () => I(S, {
1005
1021
  ...i,
1006
1022
  condition: {
1007
- ...w,
1023
+ ...k,
1008
1024
  clauses: B.filter(
1009
1025
  /** @param {any} [_] @param {any} [index] @returns {any} */
1010
- ($, E) => E !== N
1026
+ ($, j) => j !== K
1011
1027
  )
1012
1028
  }
1013
1029
  }),
1014
- style: { ...D(), padding: "6px", justifyContent: "center", color: "#B91C1C" },
1030
+ style: { ...R(), padding: "6px", justifyContent: "center", color: "#B91C1C" },
1015
1031
  title: "Remove condition"
1016
1032
  },
1017
1033
  /* @__PURE__ */ e.createElement(F.Close, null)
@@ -1021,14 +1037,14 @@ function nr({
1021
1037
  "button",
1022
1038
  {
1023
1039
  type: "button",
1024
- onClick: () => T(k, {
1040
+ onClick: () => I(S, {
1025
1041
  ...i,
1026
1042
  condition: {
1027
- ...w,
1043
+ ...k,
1028
1044
  clauses: [...B, yr(P)]
1029
1045
  }
1030
1046
  }),
1031
- style: { ...D(), alignSelf: "flex-start" }
1047
+ style: { ...R(), alignSelf: "flex-start" }
1032
1048
  },
1033
1049
  "+ Condition"
1034
1050
  ));
@@ -1041,26 +1057,26 @@ function nr({
1041
1057
  ...s,
1042
1058
  rules: [...s.rules || [], br(P, (s.rules || []).length)]
1043
1059
  }),
1044
- style: { ...D(), alignSelf: "flex-start" }
1060
+ style: { ...R(), alignSelf: "flex-start" }
1045
1061
  },
1046
1062
  "+ Rule"
1047
- ), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px" } }, /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => x(null), style: D() }, "Cancel"), /* @__PURE__ */ e.createElement("button", { type: "button", onClick: R, style: D("primary") }, s.kind === "date_group" || s.kind === "number_group" ? "Apply Group" : "Apply Category")))
1063
+ ), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px" } }, /* @__PURE__ */ e.createElement("button", { type: "button", onClick: () => x(null), style: R() }, "Cancel"), /* @__PURE__ */ e.createElement("button", { type: "button", onClick: C, style: R("primary") }, s.kind === "date_group" || s.kind === "number_group" ? "Apply Group" : "Apply Category")))
1048
1064
  )
1049
1065
  ));
1050
1066
  }
1051
- function hr(r) {
1067
+ function vr(t) {
1052
1068
  const n = [], o = /* @__PURE__ */ new Set();
1053
- return String(r || "").replace(ct, (a, l) => {
1054
- const p = String(l || "").trim();
1055
- return p && !o.has(p) && (n.push(p), o.add(p)), "";
1069
+ return String(t || "").replace(ct, (a, l) => {
1070
+ const d = String(l || "").trim();
1071
+ return d && !o.has(d) && (n.push(d), o.add(d)), "";
1056
1072
  }), n;
1057
1073
  }
1058
- function lr(r, n = []) {
1059
- const o = String(r || ""), a = [], l = /* @__PURE__ */ new Set(), p = (g) => {
1074
+ function lr(t, n = []) {
1075
+ const o = String(t || ""), a = [], l = /* @__PURE__ */ new Set(), d = (g) => {
1060
1076
  const z = String(g || "").trim();
1061
1077
  !z || l.has(z) || (a.push(z), l.add(z));
1062
1078
  };
1063
- hr(o).forEach(p);
1079
+ vr(o).forEach(d);
1064
1080
  let f = o.replace(ct, " ");
1065
1081
  return (Array.isArray(n) ? n : Array.from(n || [])).map((g) => String(g || "").trim()).filter((g) => g && !gr.test(g)).sort((g, z) => z.length - g.length).forEach(
1066
1082
  /** @param {any} [reference] @returns {any} */
@@ -1069,7 +1085,7 @@ function lr(r, n = []) {
1069
1085
  f = f.replace(
1070
1086
  z,
1071
1087
  /** @param {any} [match] @param {any} [prefix] @returns {any} */
1072
- (s, x) => (p(g), `${x} `)
1088
+ (s, x) => (d(g), `${x} `)
1073
1089
  );
1074
1090
  }
1075
1091
  ), f.replace(
@@ -1077,38 +1093,38 @@ function lr(r, n = []) {
1077
1093
  /** @param {any} [token] @param {any} [offset] @returns {any} */
1078
1094
  (g, z) => {
1079
1095
  const s = f.slice(z + g.length).trimStart();
1080
- return an.has(g) || ln.has(g) && s.startsWith("(") || p(g), g;
1096
+ return an.has(g) || ln.has(g) && s.startsWith("(") || d(g), g;
1081
1097
  }
1082
1098
  ), a;
1083
1099
  }
1084
- function ie(r) {
1085
- const n = String(r || "").trim();
1100
+ function ie(t) {
1101
+ const n = String(t || "").trim();
1086
1102
  return n ? `[${n}]` : "";
1087
1103
  }
1088
- function ze(r) {
1089
- const n = String(r || "").trim();
1104
+ function ze(t) {
1105
+ const n = String(t || "").trim();
1090
1106
  return n ? gr.test(n) ? n : `[${n}]` : "";
1091
1107
  }
1092
- function bn(r, n, o = "formula") {
1093
- const a = Me(r, o), l = new Set(
1094
- (Array.isArray(n) ? n : []).map((S) => S ? S.agg === "formula" ? q(S) : S.field : null).filter(Boolean).map((S) => String(S).toLowerCase())
1108
+ function bn(t, n, o = "formula") {
1109
+ const a = Me(t, o), l = new Set(
1110
+ (Array.isArray(n) ? n : []).map((E) => E ? E.agg === "formula" ? q(E) : E.field : null).filter(Boolean).map((E) => String(E).toLowerCase())
1095
1111
  );
1096
1112
  if (!l.has(a)) return a;
1097
- let p = 2, f = `${a}${p}`;
1113
+ let d = 2, f = `${a}${d}`;
1098
1114
  for (; l.has(f); )
1099
- p += 1, f = `${a}${p}`;
1115
+ d += 1, f = `${a}${d}`;
1100
1116
  return f;
1101
1117
  }
1102
- function En(r, n, o) {
1103
- if (!r || !n || n === o) return r;
1118
+ function hn(t, n, o) {
1119
+ if (!t || !n || n === o) return t;
1104
1120
  const a = ze(o), l = [];
1105
- let f = String(r).replace(ct, (S, g) => String(g || "").trim() === n ? a : (l.push(S), `@@${l.length - 1}@@`)).replace(new RegExp(`\\b${xr(n)}\\b`, "g"), a);
1106
- return l.forEach((S, g) => {
1107
- f = f.replace(`@@${g}@@`, S);
1121
+ let f = String(t).replace(ct, (E, g) => String(g || "").trim() === n ? a : (l.push(E), `@@${l.length - 1}@@`)).replace(new RegExp(`\\b${xr(n)}\\b`, "g"), a);
1122
+ return l.forEach((E, g) => {
1123
+ f = f.replace(`@@${g}@@`, E);
1108
1124
  }), f;
1109
1125
  }
1110
- function wt(r, n, o) {
1111
- r(
1126
+ function wt(t, n, o) {
1127
+ t(
1112
1128
  /** @param {any} [prev] @returns {any} */
1113
1129
  (a) => {
1114
1130
  const l = [...a];
@@ -1116,16 +1132,16 @@ function wt(r, n, o) {
1116
1132
  }
1117
1133
  );
1118
1134
  }
1119
- function ar(r) {
1120
- return !r || typeof r.closest != "function" ? !1 : !!r.closest('button, input, select, textarea, [contenteditable="true"]');
1135
+ function ar(t) {
1136
+ return !t || typeof t.closest != "function" ? !1 : !!t.closest('button, input, select, textarea, [contenteditable="true"]');
1121
1137
  }
1122
- function hn(r) {
1123
- if (!r || typeof r != "object") return "";
1124
- const n = r.field === void 0 || r.field === null ? "" : String(r.field), o = r.agg === void 0 || r.agg === null ? "" : String(r.agg);
1138
+ function vn(t) {
1139
+ if (!t || typeof t != "object") return "";
1140
+ const n = t.field === void 0 || t.field === null ? "" : String(t.field), o = t.agg === void 0 || t.agg === null ? "" : String(t.agg);
1125
1141
  return `${n}::${o}`;
1126
1142
  }
1127
- function Ct(r) {
1128
- const n = rn(r);
1143
+ function Ct(t) {
1144
+ const n = rn(t);
1129
1145
  return n ? {
1130
1146
  ...Fe,
1131
1147
  ...n,
@@ -1135,10 +1151,10 @@ function Ct(r) {
1135
1151
  negativeColor: n.negativeColor || ""
1136
1152
  } : null;
1137
1153
  }
1138
- function vn(r) {
1154
+ function En(t) {
1139
1155
  const n = {
1140
1156
  ...Fe,
1141
- ...r || {}
1157
+ ...t || {}
1142
1158
  }, o = {
1143
1159
  type: n.type || Fe.type,
1144
1160
  metric: n.metric || Fe.metric,
@@ -1155,72 +1171,72 @@ function vn(r) {
1155
1171
  l && (o[a] = l);
1156
1172
  }), Number.isFinite(Number(n.areaOpacity)) && (o.areaOpacity = Math.max(0.02, Math.min(0.45, Number(n.areaOpacity)))), o;
1157
1173
  }
1158
- function vr(r, n = []) {
1159
- const o = String(r && r.agg || "").trim().toLowerCase(), a = Array.isArray(n) && n.length > 0, l = o === "array_agg", p = o !== "array_agg" && a;
1174
+ function Er(t, n = []) {
1175
+ const o = String(t && t.agg || "").trim().toLowerCase(), a = Array.isArray(n) && n.length > 0, l = o === "array_agg", d = o !== "array_agg" && a;
1160
1176
  return {
1161
1177
  canUseFieldSeries: l,
1162
- canUsePivotSeries: p,
1163
- canUseAny: l || p,
1164
- defaultSource: l ? "field" : p ? "pivot" : null
1178
+ canUsePivotSeries: d,
1179
+ canUseAny: l || d,
1180
+ defaultSource: l ? "field" : d ? "pivot" : null
1165
1181
  };
1166
1182
  }
1167
- function Dt(r, n) {
1168
- return !n || !n.canUseAny ? !1 : r === "field" ? n.canUseFieldSeries : n.canUsePivotSeries;
1183
+ function Dt(t, n) {
1184
+ return !n || !n.canUseAny ? !1 : t === "field" ? n.canUseFieldSeries : n.canUsePivotSeries;
1169
1185
  }
1170
- function Sr(r, n) {
1171
- const o = vn(r);
1186
+ function Sr(t, n) {
1187
+ const o = En(t);
1172
1188
  return !n || !n.canUseAny ? null : Dt(o.source, n) ? o : {
1173
1189
  ...o,
1174
1190
  source: n.defaultSource
1175
1191
  };
1176
1192
  }
1177
- function Rt(r) {
1178
- if (!Array.isArray(r) || r.length === 0) return "";
1179
- const n = r.map((o) => o && ze(o.field)).filter(Boolean);
1193
+ function Rt(t) {
1194
+ if (!Array.isArray(t) || t.length === 0) return "";
1195
+ const n = t.map((o) => o && ze(o.field)).filter(Boolean);
1180
1196
  return n.length === 0 ? "" : n.length === 1 ? `${n[0]} * 100` : `${n[0]} - ${n[1]}`;
1181
1197
  }
1182
- function or(r) {
1183
- const n = (Array.isArray(r) ? r : []).map((o) => o && o.id).filter(Boolean);
1198
+ function or(t) {
1199
+ const n = (Array.isArray(t) ? t : []).map((o) => o && o.id).filter(Boolean);
1184
1200
  return n.length === 0 ? "" : n.length === 1 ? `${ie(n[0])} * 100` : `${ie(n[0])} - ${ie(n[1])}`;
1185
1201
  }
1186
- function Sn(r) {
1202
+ function Sn(t) {
1187
1203
  const n = new Set(
1188
- (Array.isArray(r) ? r : []).map((a) => a && a.field).filter(Boolean)
1204
+ (Array.isArray(t) ? t : []).map((a) => a && a.field).filter(Boolean)
1189
1205
  );
1190
1206
  let o = 1;
1191
1207
  for (; n.has(`formula_${o}`); ) o += 1;
1192
1208
  return `formula_${o}`;
1193
1209
  }
1194
- function kn(r, n, o = null, a = null, l = "measures", p = [], f = []) {
1195
- const S = String(r || "").trim(), g = $e(l);
1196
- if (!S)
1210
+ function kn(t, n, o = null, a = null, l = "measures", d = [], f = []) {
1211
+ const E = String(t || "").trim(), g = $e(l);
1212
+ if (!E)
1197
1213
  return {
1198
1214
  tone: "warning",
1199
1215
  text: g ? "Enter a formula using bracketed rendered columns. Example: [Cash Equity_day_pnl_sum] - [ETF_day_pnl_sum]" : "Enter a formula using value fields. Example: sales - [day pnl]"
1200
1216
  };
1201
1217
  let z = 0;
1202
- for (const R of S)
1203
- if (R === "(" && (z += 1), R === ")" && (z -= 1), z < 0)
1218
+ for (const C of E)
1219
+ if (C === "(" && (z += 1), C === ")" && (z -= 1), z < 0)
1204
1220
  return { tone: "warning", text: "Parentheses are unbalanced." };
1205
1221
  if (z !== 0)
1206
1222
  return { tone: "warning", text: "Parentheses are unbalanced." };
1207
1223
  if (g) {
1208
- const R = Array.isArray(p) ? p : [], O = new Set(
1209
- R.map(
1224
+ const C = Array.isArray(d) ? d : [], O = new Set(
1225
+ C.map(
1210
1226
  /** @param {any} [option] @returns {any} */
1211
1227
  (B) => B && B.id
1212
1228
  ).filter(Boolean)
1213
- ), i = hr(S);
1229
+ ), i = vr(E);
1214
1230
  if (i.length === 0)
1215
1231
  return {
1216
1232
  tone: "warning",
1217
1233
  text: "Insert at least one rendered column reference like [column_id]."
1218
1234
  };
1219
- const k = S.replace(ct, ""), w = Array.from(new Set(k.match(mr) || []));
1220
- if (w.length > 0)
1235
+ const S = E.replace(ct, ""), k = Array.from(new Set(S.match(mr) || []));
1236
+ if (k.length > 0)
1221
1237
  return {
1222
1238
  tone: "warning",
1223
- text: `Rendered columns must use brackets: ${w.join(", ")}`
1239
+ text: `Rendered columns must use brackets: ${k.join(", ")}`
1224
1240
  };
1225
1241
  if (O.size > 0) {
1226
1242
  const B = i.filter(
@@ -1241,7 +1257,7 @@ function kn(r, n, o = null, a = null, l = "measures", p = [], f = []) {
1241
1257
  text: `Using rendered columns: ${i.join(", ")}`
1242
1258
  };
1243
1259
  }
1244
- const s = Array.isArray(n) ? n.filter((R) => R && R.field) : [];
1260
+ const s = Array.isArray(n) ? n.filter((C) => C && C.field) : [];
1245
1261
  if (s.length === 0)
1246
1262
  return {
1247
1263
  tone: "warning",
@@ -1249,123 +1265,123 @@ function kn(r, n, o = null, a = null, l = "measures", p = [], f = []) {
1249
1265
  };
1250
1266
  const x = s.filter(
1251
1267
  /** @param {any} [config] @returns {any} */
1252
- (R) => R.agg === "formula"
1268
+ (C) => C.agg === "formula"
1253
1269
  ), W = /* @__PURE__ */ new Map();
1254
1270
  x.forEach(
1255
1271
  /** @param {any} [config] @returns {any} */
1256
- (R) => {
1257
- const O = R.field === o ? Me(a || q(R), R.field) : q(R);
1272
+ (C) => {
1273
+ const O = C.field === o ? Me(a || q(C), C.field) : q(C);
1258
1274
  O && (W.set(O, O), W.set(O.toLowerCase(), O));
1259
1275
  }
1260
1276
  );
1261
1277
  const P = s.filter(
1262
1278
  /** @param {any} [config] @returns {any} */
1263
- (R) => R.agg !== "formula"
1279
+ (C) => C.agg !== "formula"
1264
1280
  ).map(
1265
1281
  /** @param {any} [config] @returns {any} */
1266
- (R) => R.field
1282
+ (C) => C.field
1267
1283
  ).filter(Boolean), M = new Set(P), A = /* @__PURE__ */ new Set([...P, ...x.map(
1268
1284
  /** @param {any} [config] @returns {any} */
1269
- (R) => R.field === o ? Me(a || q(R), R.field) : q(R)
1270
- ).filter(Boolean), ...Array.isArray(f) ? f : []]), y = Array.from(A), C = lr(S, y), D = C.map(
1285
+ (C) => C.field === o ? Me(a || q(C), C.field) : q(C)
1286
+ ).filter(Boolean), ...Array.isArray(f) ? f : []]), y = Array.from(A), w = lr(E, y), R = w.map(
1271
1287
  /** @param {any} [token] @returns {any} */
1272
- (R) => W.get(R) || W.get(R.toLowerCase()) || R
1273
- ), T = D.filter(
1288
+ (C) => W.get(C) || W.get(C.toLowerCase()) || C
1289
+ ), I = R.filter(
1274
1290
  /** @param {any} [token] @returns {any} */
1275
- (R) => !A.has(R) && !M.has(R)
1291
+ (C) => !A.has(C) && !M.has(C)
1276
1292
  );
1277
- if (T.length > 0)
1293
+ if (I.length > 0)
1278
1294
  return {
1279
1295
  tone: "warning",
1280
- text: `Unknown fields: ${T.join(", ")}`
1296
+ text: `Unknown fields: ${I.join(", ")}`
1281
1297
  };
1282
- const U = o ? Me(a || o, o) : null;
1283
- if (o && U && s.some(
1298
+ const N = o ? Me(a || o, o) : null;
1299
+ if (o && N && s.some(
1284
1300
  /** @param {any} [config] @returns {any} */
1285
1301
  (O) => {
1286
1302
  if (!O || O.field === o) return !1;
1287
1303
  const i = O.agg === "formula" ? q(O) : O.field;
1288
- return String(i || "").toLowerCase() === U.toLowerCase();
1304
+ return String(i || "").toLowerCase() === N.toLowerCase();
1289
1305
  }
1290
1306
  ))
1291
1307
  return {
1292
1308
  tone: "warning",
1293
- text: `Reference key "${U}" is already in use.`
1309
+ text: `Reference key "${N}" is already in use.`
1294
1310
  };
1295
- if (U && D.includes(U))
1311
+ if (N && R.includes(N))
1296
1312
  return {
1297
1313
  tone: "warning",
1298
1314
  text: "A formula cannot reference itself."
1299
1315
  };
1300
- if (o && U) {
1301
- const R = {};
1316
+ if (o && N) {
1317
+ const C = {};
1302
1318
  x.forEach(
1303
1319
  /** @param {any} [config] @returns {any} */
1304
- (w) => {
1305
- const B = w.field === o ? U : q(w), _ = w.field === o ? S : String(w.formula || ""), N = lr(_, y).map(
1320
+ (k) => {
1321
+ const B = k.field === o ? N : q(k), _ = k.field === o ? E : String(k.formula || ""), K = lr(_, y).map(
1306
1322
  /** @param {any} [token] @returns {any} */
1307
1323
  (L) => W.get(L) || W.get(L.toLowerCase()) || L
1308
1324
  ).filter(
1309
1325
  /** @param {any} [token] @returns {any} */
1310
1326
  (L) => L !== B && x.some(
1311
1327
  /** @param {any} [candidate] @returns {any} */
1312
- (m) => q(m) === L || m.field === o && U === L
1328
+ (m) => q(m) === L || m.field === o && N === L
1313
1329
  )
1314
1330
  );
1315
- R[B] = N;
1331
+ C[B] = K;
1316
1332
  }
1317
1333
  );
1318
- const O = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), k = (w) => {
1319
- if (O.has(w)) return !0;
1320
- if (i.has(w)) return !1;
1321
- O.add(w);
1322
- const B = R[w] || [];
1334
+ const O = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), S = (k) => {
1335
+ if (O.has(k)) return !0;
1336
+ if (i.has(k)) return !1;
1337
+ O.add(k);
1338
+ const B = C[k] || [];
1323
1339
  for (const _ of B)
1324
- if (k(_)) return !0;
1325
- return O.delete(w), i.add(w), !1;
1340
+ if (S(_)) return !0;
1341
+ return O.delete(k), i.add(k), !1;
1326
1342
  };
1327
- if (k(U))
1343
+ if (S(N))
1328
1344
  return {
1329
1345
  tone: "warning",
1330
1346
  text: "Circular formula reference detected."
1331
1347
  };
1332
1348
  }
1333
- return C.length === 0 ? {
1349
+ return w.length === 0 ? {
1334
1350
  tone: "warning",
1335
1351
  text: "Insert at least one measure or formula reference."
1336
1352
  } : {
1337
1353
  tone: "success",
1338
- text: `Using ${D.join(", ")}`
1354
+ text: `Using ${R.join(", ")}`
1339
1355
  };
1340
1356
  }
1341
- function wn(r) {
1342
- if (!Array.isArray(r) || r.length === 0) return [];
1343
- const n = r.map((o) => o && ze(o.field)).filter(Boolean);
1357
+ function wn(t) {
1358
+ if (!Array.isArray(t) || t.length === 0) return [];
1359
+ const n = t.map((o) => o && ze(o.field)).filter(Boolean);
1344
1360
  return n.length === 0 ? [] : n.length === 1 ? [{ label: "Scale x100", value: `${n[0]} * 100` }] : [
1345
1361
  { label: "Difference", value: `${n[0]} - ${n[1]}` },
1346
1362
  { label: "Ratio %", value: `(${n[0]} / ${n[1]}) * 100` },
1347
1363
  { label: "Margin %", value: `((${n[0]} - ${n[1]}) / ${n[0]}) * 100` }
1348
1364
  ];
1349
1365
  }
1350
- function Cn(r) {
1351
- const n = (Array.isArray(r) ? r : []).map((o) => o && o.id).filter(Boolean);
1366
+ function Cn(t) {
1367
+ const n = (Array.isArray(t) ? t : []).map((o) => o && o.id).filter(Boolean);
1352
1368
  return n.length === 0 ? [] : n.length === 1 ? [{ label: "Scale x100", value: `${ie(n[0])} * 100` }] : [
1353
1369
  { label: "Difference", value: `${ie(n[0])} - ${ie(n[1])}` },
1354
1370
  { label: "Ratio %", value: `(${ie(n[0])} / ${ie(n[1])}) * 100` },
1355
1371
  { label: "Spread %", value: `((${ie(n[0])} - ${ie(n[1])}) / ${ie(n[0])}) * 100` }
1356
1372
  ];
1357
1373
  }
1358
- function Rn(r, n) {
1374
+ function Rn(t, n) {
1359
1375
  const o = {
1360
1376
  muted: {
1361
- text: r.textSec,
1362
- border: r.border,
1363
- background: r.headerSubtleBg || r.background
1377
+ text: t.textSec,
1378
+ border: t.border,
1379
+ background: t.headerSubtleBg || t.background
1364
1380
  },
1365
1381
  success: {
1366
- text: r.primary,
1367
- border: `${r.primary}33`,
1368
- background: `${r.primary}10`
1382
+ text: t.primary,
1383
+ border: `${t.primary}33`,
1384
+ background: `${t.primary}10`
1369
1385
  },
1370
1386
  warning: {
1371
1387
  text: "#B45309",
@@ -1375,31 +1391,31 @@ function Rn(r, n) {
1375
1391
  };
1376
1392
  return o[n] || o.muted;
1377
1393
  }
1378
- function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], onClose: p }) {
1394
+ function Dn({ item: t, idx: n, setValConfigs: o, theme: a, colFields: l = [], onClose: d }) {
1379
1395
  const f = e.useMemo(
1380
- () => Ct(r && r.sparkline) || { ...Fe },
1396
+ () => Ct(t && t.sparkline) || { ...Fe },
1381
1397
  // eslint-disable-next-line react-hooks/exhaustive-deps
1382
- [r && r.sparkline]
1383
- ), S = e.useMemo(
1384
- () => vr(r, l),
1385
- [l, r]
1398
+ [t && t.sparkline]
1399
+ ), E = e.useMemo(
1400
+ () => Er(t, l),
1401
+ [l, t]
1386
1402
  ), g = e.useMemo(() => {
1387
1403
  const y = [];
1388
- return S.canUsePivotSeries && y.push({ value: "pivot", label: "Linked pivot" }), S.canUseFieldSeries && y.push({ value: "field", label: "Series field" }), y;
1389
- }, [S]), z = Dt(f.source || "pivot", S) ? f.source || "pivot" : S.defaultSource, s = e.useCallback((y) => {
1404
+ return E.canUsePivotSeries && y.push({ value: "pivot", label: "Linked pivot" }), E.canUseFieldSeries && y.push({ value: "field", label: "Series field" }), y;
1405
+ }, [E]), z = Dt(f.source || "pivot", E) ? f.source || "pivot" : E.defaultSource, s = e.useCallback((y) => {
1390
1406
  wt(
1391
1407
  o,
1392
1408
  n,
1393
1409
  /** @param {any} [current] @returns {any} */
1394
- (C) => {
1395
- const D = Ct(C.sparkline) || { ...Fe }, T = Sr({ ...D, ...y }, S);
1396
- return T ? {
1397
- ...C,
1398
- sparkline: T
1399
- } : C;
1410
+ (w) => {
1411
+ const R = Ct(w.sparkline) || { ...Fe }, I = Sr({ ...R, ...y }, E);
1412
+ return I ? {
1413
+ ...w,
1414
+ sparkline: I
1415
+ } : w;
1400
1416
  }
1401
1417
  );
1402
- }, [S, n, o]), x = e.useCallback((y) => y.stopPropagation(), []), W = [
1418
+ }, [E, n, o]), x = e.useCallback((y) => y.stopPropagation(), []), W = [
1403
1419
  { value: "line", label: "Line" },
1404
1420
  { value: "area", label: "Area" },
1405
1421
  { value: "column", label: "Column" },
@@ -1430,7 +1446,7 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1430
1446
  {
1431
1447
  style: { position: "fixed", inset: 0, background: "rgba(0,0,0,0.45)", zIndex: 9999, display: "flex", alignItems: "center", justifyContent: "center" },
1432
1448
  onMouseDown: x,
1433
- onClick: p
1449
+ onClick: d
1434
1450
  },
1435
1451
  /* @__PURE__ */ e.createElement(
1436
1452
  "div",
@@ -1452,14 +1468,14 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1452
1468
  "button",
1453
1469
  {
1454
1470
  type: "button",
1455
- onClick: p,
1471
+ onClick: d,
1456
1472
  style: { background: "none", border: "none", cursor: "pointer", color: a.textSec, fontSize: "18px", lineHeight: 1, padding: "2px 4px" }
1457
1473
  },
1458
1474
  "×"
1459
1475
  )),
1460
1476
  /* @__PURE__ */ e.createElement("div", { style: A }, /* @__PURE__ */ e.createElement("span", { style: M }, "Data source"), g.length > 0 ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px" } }, g.map(
1461
1477
  /** @param {any} p0 @returns {any} */
1462
- ({ value: y, label: C }) => /* @__PURE__ */ e.createElement(
1478
+ ({ value: y, label: w }) => /* @__PURE__ */ e.createElement(
1463
1479
  "button",
1464
1480
  {
1465
1481
  key: y,
@@ -1477,7 +1493,7 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1477
1493
  color: z === y ? a.primary : a.textSec
1478
1494
  }
1479
1495
  },
1480
- C
1496
+ w
1481
1497
  )
1482
1498
  )), /* @__PURE__ */ e.createElement("div", { style: { marginTop: "5px", fontSize: "10px", color: a.textSec, lineHeight: 1.4 } }, z === "pivot" ? "Trend values are collected across the pivot columns. Source value cells stay numeric unless hidden." : "Each cell already contains the full data series for its row.")) : /* @__PURE__ */ e.createElement(
1483
1499
  "div",
@@ -1498,7 +1514,7 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1498
1514
  z === "field" && /* @__PURE__ */ e.createElement("div", { style: A }, /* @__PURE__ */ e.createElement("span", { style: M }, "Cell display"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px" } }, [
1499
1515
  { value: "trend", label: "Trendline" },
1500
1516
  { value: "value", label: "Value" }
1501
- ].map(({ value: y, label: C }) => /* @__PURE__ */ e.createElement(
1517
+ ].map(({ value: y, label: w }) => /* @__PURE__ */ e.createElement(
1502
1518
  "button",
1503
1519
  {
1504
1520
  key: y,
@@ -1516,9 +1532,9 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1516
1532
  color: (f.displayMode || "trend") === y ? a.primary : a.textSec
1517
1533
  }
1518
1534
  },
1519
- C
1535
+ w
1520
1536
  ))), /* @__PURE__ */ e.createElement("div", { style: { marginTop: "5px", fontSize: "10px", color: a.textSec, lineHeight: 1.4 } }, (f.displayMode || "trend") === "value" ? "Show the selected summary metric from the series." : "Draw the series in the cell.")),
1521
- /* @__PURE__ */ e.createElement("div", { style: A }, /* @__PURE__ */ e.createElement("span", { style: M }, "Chart type"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px" } }, W.map(({ value: y, label: C }) => /* @__PURE__ */ e.createElement(
1537
+ /* @__PURE__ */ e.createElement("div", { style: A }, /* @__PURE__ */ e.createElement("span", { style: M }, "Chart type"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px" } }, W.map(({ value: y, label: w }) => /* @__PURE__ */ e.createElement(
1522
1538
  "button",
1523
1539
  {
1524
1540
  key: y,
@@ -1536,7 +1552,7 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1536
1552
  color: f.type === y ? a.primary : a.textSec
1537
1553
  }
1538
1554
  },
1539
- C
1555
+ w
1540
1556
  )))),
1541
1557
  /* @__PURE__ */ e.createElement("div", { style: A }, /* @__PURE__ */ e.createElement("span", { style: M }, "Summary metric"), /* @__PURE__ */ e.createElement(
1542
1558
  re,
@@ -1560,26 +1576,26 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1560
1576
  { key: "showDelta", label: "Delta label" },
1561
1577
  { key: "compact", label: "Compact cell" },
1562
1578
  { key: "hideColumns", label: "Hide source values" }
1563
- ].map(({ key: y, label: C }) => /* @__PURE__ */ e.createElement("label", { key: y, style: { display: "flex", alignItems: "center", gap: "5px", fontSize: "11px", color: a.text, cursor: "pointer", userSelect: "none" } }, /* @__PURE__ */ e.createElement(
1579
+ ].map(({ key: y, label: w }) => /* @__PURE__ */ e.createElement("label", { key: y, style: { display: "flex", alignItems: "center", gap: "5px", fontSize: "11px", color: a.text, cursor: "pointer", userSelect: "none" } }, /* @__PURE__ */ e.createElement(
1564
1580
  "input",
1565
1581
  {
1566
1582
  type: "checkbox",
1567
1583
  checked: !!f[y],
1568
- onChange: (D) => s({ [y]: D.target.checked }),
1584
+ onChange: (R) => s({ [y]: R.target.checked }),
1569
1585
  style: { accentColor: a.primary, width: "13px", height: "13px", cursor: "pointer" }
1570
1586
  }
1571
- ), C))), f.hideColumns && /* @__PURE__ */ e.createElement("div", { style: { marginTop: "6px", fontSize: "10px", color: a.textSec, background: `${a.primary}10`, border: `1px solid ${a.primary}30`, borderRadius: "6px", padding: "5px 8px", lineHeight: 1.4 } }, "Source value columns are hidden; the trend column remains."), !f.hideColumns && z === "pivot" && /* @__PURE__ */ e.createElement("div", { style: { marginTop: "6px", fontSize: "10px", color: a.textSec, background: a.headerSubtleBg || a.background, border: `1px solid ${a.border}`, borderRadius: "6px", padding: "5px 8px", lineHeight: 1.4 } }, "Source value columns stay numeric; the trend column is added beside them.")),
1587
+ ), w))), f.hideColumns && /* @__PURE__ */ e.createElement("div", { style: { marginTop: "6px", fontSize: "10px", color: a.textSec, background: `${a.primary}10`, border: `1px solid ${a.primary}30`, borderRadius: "6px", padding: "5px 8px", lineHeight: 1.4 } }, "Source value columns are hidden; the trend column remains."), !f.hideColumns && z === "pivot" && /* @__PURE__ */ e.createElement("div", { style: { marginTop: "6px", fontSize: "10px", color: a.textSec, background: a.headerSubtleBg || a.background, border: `1px solid ${a.border}`, borderRadius: "6px", padding: "5px 8px", lineHeight: 1.4 } }, "Source value columns stay numeric; the trend column is added beside them.")),
1572
1588
  z === "pivot" && /* @__PURE__ */ e.createElement("div", { style: A }, /* @__PURE__ */ e.createElement("span", { style: M }, "Position"), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: a.textSec, lineHeight: 1.4, background: a.headerSubtleBg || a.background, border: `1px solid ${a.border}`, borderRadius: "6px", padding: "6px 8px" } }, "Trend columns are placed before the matching value columns.")),
1573
1589
  /* @__PURE__ */ e.createElement("div", { style: A }, /* @__PURE__ */ e.createElement("span", { style: M }, "Colors"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "6px" } }, [
1574
1590
  { key: "color", label: "Line / fill color", always: !0 },
1575
1591
  { key: "positiveColor", label: "Positive bar color", always: !1 },
1576
1592
  { key: "negativeColor", label: "Negative bar color", always: !1 }
1577
- ].filter(({ always: y }) => y || f.type === "column" || f.type === "bar").map(({ key: y, label: C }) => /* @__PURE__ */ e.createElement("div", { key: y }, /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: a.textSec, marginBottom: "3px", display: "block" } }, C), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "5px", alignItems: "center" } }, /* @__PURE__ */ e.createElement(
1593
+ ].filter(({ always: y }) => y || f.type === "column" || f.type === "bar").map(({ key: y, label: w }) => /* @__PURE__ */ e.createElement("div", { key: y }, /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: a.textSec, marginBottom: "3px", display: "block" } }, w), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "5px", alignItems: "center" } }, /* @__PURE__ */ e.createElement(
1578
1594
  "input",
1579
1595
  {
1580
1596
  type: "color",
1581
1597
  value: f[y] || (y === "negativeColor" ? "#B91C1C" : y === "positiveColor" ? "#2F855A" : "#2563EB"),
1582
- onChange: (D) => s({ [y]: D.target.value }),
1598
+ onChange: (R) => s({ [y]: R.target.value }),
1583
1599
  style: { width: "28px", height: "26px", padding: "1px 2px", border: `1px solid ${a.border}`, borderRadius: "4px", cursor: "pointer", background: "none" }
1584
1600
  }
1585
1601
  ), /* @__PURE__ */ e.createElement(
@@ -1587,7 +1603,7 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1587
1603
  {
1588
1604
  type: "text",
1589
1605
  value: f[y] || "",
1590
- onChange: (D) => s({ [y]: D.target.value }),
1606
+ onChange: (R) => s({ [y]: R.target.value }),
1591
1607
  placeholder: "Auto",
1592
1608
  style: { ...P, flex: 1 }
1593
1609
  }
@@ -1627,7 +1643,7 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1627
1643
  "button",
1628
1644
  {
1629
1645
  type: "button",
1630
- onClick: p,
1646
+ onClick: d,
1631
1647
  style: {
1632
1648
  background: a.primary,
1633
1649
  color: "#fff",
@@ -1644,26 +1660,26 @@ function Dn({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], on
1644
1660
  )
1645
1661
  );
1646
1662
  }
1647
- function kr({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], fixedSparklineValueKeySet: p = /* @__PURE__ */ new Set(), showNotification: f }) {
1648
- const [S, g] = e.useState(!1), z = Ct(r && r.sparkline), s = hn(r), x = !!(s && p && p.has(s)), W = e.useMemo(
1649
- () => vr(r, l),
1650
- [l, r]
1651
- ), P = !!z, M = !!(z && Dt(z.source || "pivot", W)), A = e.useCallback((T) => T.stopPropagation(), []), y = e.useCallback(() => {
1652
- let T = !1;
1663
+ function kr({ item: t, idx: n, setValConfigs: o, theme: a, colFields: l = [], fixedSparklineValueKeySet: d = /* @__PURE__ */ new Set(), showNotification: f }) {
1664
+ const [E, g] = e.useState(!1), z = Ct(t && t.sparkline), s = vn(t), x = !!(s && d && d.has(s)), W = e.useMemo(
1665
+ () => Er(t, l),
1666
+ [l, t]
1667
+ ), P = !!z, M = !!(z && Dt(z.source || "pivot", W)), A = e.useCallback((I) => I.stopPropagation(), []), y = e.useCallback(() => {
1668
+ let I = !1;
1653
1669
  return wt(
1654
1670
  o,
1655
1671
  n,
1656
1672
  /** @param {any} [current] @returns {any} */
1657
- (U) => {
1658
- const R = Sr(
1659
- U.sparkline || Fe,
1673
+ (N) => {
1674
+ const C = Sr(
1675
+ N.sparkline || Fe,
1660
1676
  W
1661
1677
  );
1662
- return R ? (T = !0, { ...U, sparkline: R }) : U;
1678
+ return C ? (I = !0, { ...N, sparkline: C }) : N;
1663
1679
  }
1664
- ), T;
1665
- }, [W, n, o]), C = e.useCallback((T) => {
1666
- if (T.stopPropagation(), P) {
1680
+ ), I;
1681
+ }, [W, n, o]), w = e.useCallback((I) => {
1682
+ if (I.stopPropagation(), P) {
1667
1683
  if (x) {
1668
1684
  f && f("This trend is defined by the app. You can adjust its settings, but not remove it here.", "info");
1669
1685
  return;
@@ -1672,11 +1688,11 @@ function kr({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], fi
1672
1688
  o,
1673
1689
  n,
1674
1690
  /** @param {any} [current] @returns {any} */
1675
- (U) => ({ ...U, sparkline: !1 })
1691
+ (N) => ({ ...N, sparkline: !1 })
1676
1692
  ), f && f("Removed trend column.", "info");
1677
1693
  } else W.canUseAny && y() ? (g(!0), f && f("Trend column enabled.", "success")) : f && f("Trend needs a column field, or a Series aggregation for field data.", "warning");
1678
- }, [W.canUseAny, P, y, n, x, o, f]), D = e.useCallback((T) => {
1679
- if (T.stopPropagation(), !W.canUseAny) {
1694
+ }, [W.canUseAny, P, y, n, x, o, f]), R = e.useCallback((I) => {
1695
+ if (I.stopPropagation(), !W.canUseAny) {
1680
1696
  f && f("Trend settings are not available for this value selection.", "warning");
1681
1697
  return;
1682
1698
  }
@@ -1697,7 +1713,7 @@ function kr({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], fi
1697
1713
  {
1698
1714
  type: "button",
1699
1715
  "data-value-sparkline-settings": "true",
1700
- onClick: D,
1716
+ onClick: R,
1701
1717
  style: {
1702
1718
  border: `1px solid ${a.border}`,
1703
1719
  background: a.headerSubtleBg || a.background,
@@ -1728,7 +1744,7 @@ function kr({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], fi
1728
1744
  {
1729
1745
  type: "button",
1730
1746
  "data-value-sparkline-toggle": "true",
1731
- onClick: C,
1747
+ onClick: w,
1732
1748
  style: {
1733
1749
  border: `1px solid ${a.border}`,
1734
1750
  background: a.background,
@@ -1745,11 +1761,11 @@ function kr({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], fi
1745
1761
  },
1746
1762
  "Remove Trend"
1747
1763
  ),
1748
- M && !S && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: a.primary, flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, (r.sparkline && r.sparkline.source) === "field" ? `series ${(r.sparkline && r.sparkline.displayMode) === "value" ? "value" : "trend"}` : "linked pivot", " | ", ["line", "area", "column", "bar"].includes(r.sparkline && r.sparkline.type) ? r.sparkline.type : "line", " | ", r.sparkline && r.sparkline.metric || "last"),
1749
- S && /* @__PURE__ */ e.createElement(
1764
+ M && !E && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: a.primary, flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, (t.sparkline && t.sparkline.source) === "field" ? `series ${(t.sparkline && t.sparkline.displayMode) === "value" ? "value" : "trend"}` : "linked pivot", " | ", ["line", "area", "column", "bar"].includes(t.sparkline && t.sparkline.type) ? t.sparkline.type : "line", " | ", t.sparkline && t.sparkline.metric || "last"),
1765
+ E && /* @__PURE__ */ e.createElement(
1750
1766
  Dn,
1751
1767
  {
1752
- item: r,
1768
+ item: t,
1753
1769
  idx: n,
1754
1770
  setValConfigs: o,
1755
1771
  theme: a,
@@ -1759,14 +1775,14 @@ function kr({ item: r, idx: n, setValConfigs: o, theme: a, colFields: l = [], fi
1759
1775
  )
1760
1776
  ) : null;
1761
1777
  }
1762
- function ir({ item: r, idx: n, selected: o, onSelect: a, onRemove: l, setValConfigs: p, theme: f, styles: S, dropLine: g, zoneId: z, valueSelectStyle: s, colFields: x = [], fixedSparklineValueKeySet: W = /* @__PURE__ */ new Set(), showNotification: P, serverError: M = null }) {
1763
- const A = o ? `${f.primary}77` : M ? "#F59E0B88" : f.border, y = o ? f.headerBg || `${f.primary}0f` : f.background || "transparent", C = String(r.formula || "").trim() || "Empty formula";
1778
+ function ir({ item: t, idx: n, selected: o, onSelect: a, onRemove: l, setValConfigs: d, theme: f, styles: E, dropLine: g, zoneId: z, valueSelectStyle: s, colFields: x = [], fixedSparklineValueKeySet: W = /* @__PURE__ */ new Set(), showNotification: P, serverError: M = null }) {
1779
+ const A = o ? `${f.primary}77` : M ? "#F59E0B88" : f.border, y = o ? f.headerBg || `${f.primary}0f` : f.background || "transparent", w = String(t.formula || "").trim() || "Empty formula";
1764
1780
  return /* @__PURE__ */ e.createElement(
1765
1781
  "div",
1766
1782
  {
1767
- onClick: () => a(r.field),
1783
+ onClick: () => a(t.field),
1768
1784
  style: {
1769
- ...S.chip,
1785
+ ...E.chip,
1770
1786
  border: `1px solid ${A}`,
1771
1787
  background: y,
1772
1788
  borderLeft: o ? `3px solid ${f.primary}` : "3px solid transparent",
@@ -1777,7 +1793,7 @@ function ir({ item: r, idx: n, selected: o, onSelect: a, onRemove: l, setValConf
1777
1793
  },
1778
1794
  title: "Select formula"
1779
1795
  },
1780
- g && g.zone === z && g.idx === n && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...S.dropLine, top: -2 } }),
1796
+ g && g.zone === z && g.idx === n && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...E.dropLine, top: -2 } }),
1781
1797
  /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement(F.DragIndicator, null), /* @__PURE__ */ e.createElement("span", { style: {
1782
1798
  fontSize: "10px",
1783
1799
  fontWeight: 700,
@@ -1787,7 +1803,7 @@ function ir({ item: r, idx: n, selected: o, onSelect: a, onRemove: l, setValConf
1787
1803
  padding: "3px 7px",
1788
1804
  letterSpacing: "0.5px",
1789
1805
  flexShrink: 0
1790
- } }, "fx"), /* @__PURE__ */ e.createElement("div", { style: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0 } }, /* @__PURE__ */ e.createElement("b", { style: { fontWeight: 600, display: "block", minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, r.label || "Formula"), /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: f.textSec, fontFamily: "monospace", flexShrink: 0 } }, q(r)), /* @__PURE__ */ e.createElement("span", { style: { fontSize: "9px", color: f.textSec, border: `1px solid ${f.border}`, borderRadius: "999px", padding: "1px 6px", flexShrink: 0 } }, $e(r.formulaScope) ? "columns" : "values")), /* @__PURE__ */ e.createElement("div", { style: {
1806
+ } }, "fx"), /* @__PURE__ */ e.createElement("div", { style: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0 } }, /* @__PURE__ */ e.createElement("b", { style: { fontWeight: 600, display: "block", minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, t.label || "Formula"), /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: f.textSec, fontFamily: "monospace", flexShrink: 0 } }, q(t)), /* @__PURE__ */ e.createElement("span", { style: { fontSize: "9px", color: f.textSec, border: `1px solid ${f.border}`, borderRadius: "999px", padding: "1px 6px", flexShrink: 0 } }, $e(t.formulaScope) ? "columns" : "values")), /* @__PURE__ */ e.createElement("div", { style: {
1791
1807
  marginTop: "2px",
1792
1808
  fontSize: "10px",
1793
1809
  lineHeight: 1.35,
@@ -1796,7 +1812,7 @@ function ir({ item: r, idx: n, selected: o, onSelect: a, onRemove: l, setValConf
1796
1812
  whiteSpace: "nowrap",
1797
1813
  overflow: "hidden",
1798
1814
  textOverflow: "ellipsis"
1799
- } }, "=", C), M && /* @__PURE__ */ e.createElement("div", { style: { marginTop: "2px", fontSize: "9px", color: "#B45309" } }, "⚠ ", An[M] || M))),
1815
+ } }, "=", w), M && /* @__PURE__ */ e.createElement("div", { style: { marginTop: "2px", fontSize: "9px", color: "#B45309" } }, "⚠ ", An[M] || M))),
1800
1816
  /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px", marginLeft: "8px", alignItems: "center", flexShrink: 0 } }, o && /* @__PURE__ */ e.createElement("span", { style: {
1801
1817
  fontSize: "9px",
1802
1818
  color: f.primary,
@@ -1807,8 +1823,8 @@ function ir({ item: r, idx: n, selected: o, onSelect: a, onRemove: l, setValConf
1807
1823
  } }, "Active"), /* @__PURE__ */ e.createElement(
1808
1824
  "span",
1809
1825
  {
1810
- onClick: (D) => {
1811
- D.stopPropagation(), l(n);
1826
+ onClick: (R) => {
1827
+ R.stopPropagation(), l(n);
1812
1828
  },
1813
1829
  style: { cursor: "pointer", color: "#9CA3AF", display: "flex", alignItems: "center" }
1814
1830
  },
@@ -1817,9 +1833,9 @@ function ir({ item: r, idx: n, selected: o, onSelect: a, onRemove: l, setValConf
1817
1833
  /* @__PURE__ */ e.createElement(
1818
1834
  kr,
1819
1835
  {
1820
- item: r,
1836
+ item: t,
1821
1837
  idx: n,
1822
- setValConfigs: p,
1838
+ setValConfigs: d,
1823
1839
  theme: f,
1824
1840
  valueSelectStyle: s,
1825
1841
  colFields: x,
@@ -1827,7 +1843,7 @@ function ir({ item: r, idx: n, selected: o, onSelect: a, onRemove: l, setValConf
1827
1843
  showNotification: P
1828
1844
  }
1829
1845
  ),
1830
- g && g.zone === z && g.idx === n + 1 && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...S.dropLine, bottom: -2 } })
1846
+ g && g.zone === z && g.idx === n + 1 && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...E.dropLine, bottom: -2 } })
1831
1847
  );
1832
1848
  }
1833
1849
  const An = {
@@ -1836,27 +1852,27 @@ const An = {
1836
1852
  expression_error: "Expression could not be evaluated (server)",
1837
1853
  missing_reference: "Unknown field reference (server)"
1838
1854
  };
1839
- function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClose: p, onRemove: f, displayedColumnOptions: S = [], availableRawFields: g = [], serverError: z = null }) {
1855
+ function $n({ item: t, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClose: d, onRemove: f, displayedColumnOptions: E = [], availableRawFields: g = [], serverError: z = null }) {
1840
1856
  const s = e.useRef(null), [x, W] = e.useState({
1841
- label: r.label || "",
1842
- formula: r.formula || "",
1843
- formulaRef: q(r),
1844
- formulaScope: Ne(r.formulaScope)
1845
- }), P = e.useRef(r);
1846
- P.current = r, e.useEffect(() => {
1857
+ label: t.label || "",
1858
+ formula: t.formula || "",
1859
+ formulaRef: q(t),
1860
+ formulaScope: He(t.formulaScope)
1861
+ }), P = e.useRef(t);
1862
+ P.current = t, e.useEffect(() => {
1847
1863
  const m = P.current;
1848
1864
  W({
1849
1865
  label: m.label || "",
1850
1866
  formula: m.formula || "",
1851
1867
  formulaRef: q(m),
1852
- formulaScope: Ne(m.formulaScope)
1868
+ formulaScope: He(m.formulaScope)
1853
1869
  });
1854
- }, [r.field]), e.useEffect(() => {
1870
+ }, [t.field]), e.useEffect(() => {
1855
1871
  if (!s.current) return;
1856
1872
  s.current.focus();
1857
1873
  const m = s.current.value.length;
1858
1874
  s.current.setSelectionRange(m, m);
1859
- }, [r.field]);
1875
+ }, [t.field]);
1860
1876
  const M = e.useMemo(
1861
1877
  () => o.filter(
1862
1878
  /** @param {any} [config] @returns {any} */
@@ -1872,13 +1888,13 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
1872
1888
  ), y = e.useMemo(
1873
1889
  () => M.filter(
1874
1890
  /** @param {any} [config] @returns {any} */
1875
- (m) => m.agg === "formula" && m.field !== r.field
1891
+ (m) => m.agg === "formula" && m.field !== t.field
1876
1892
  ),
1877
- [r.field, M]
1878
- ), C = e.useMemo(
1879
- () => (Array.isArray(S) ? S : []).filter((m) => m && m.id && m.id !== r.field),
1880
- [S, r.field]
1881
- ), D = e.useMemo(
1893
+ [t.field, M]
1894
+ ), w = e.useMemo(
1895
+ () => (Array.isArray(E) ? E : []).filter((m) => m && m.id && m.id !== t.field),
1896
+ [E, t.field]
1897
+ ), R = e.useMemo(
1882
1898
  () => {
1883
1899
  const m = new Set(M.map(
1884
1900
  /** @param {any} [c] @returns {any} */
@@ -1887,84 +1903,84 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
1887
1903
  return (Array.isArray(g) ? g : []).filter(($) => !m.has($));
1888
1904
  },
1889
1905
  [g, M]
1890
- ), T = e.useMemo(
1906
+ ), I = e.useMemo(
1891
1907
  () => kn(
1892
1908
  x.formula,
1893
1909
  M,
1894
- r.field,
1910
+ t.field,
1895
1911
  x.formulaRef,
1896
1912
  x.formulaScope,
1897
- C,
1898
- D
1913
+ w,
1914
+ R
1899
1915
  ),
1900
- [C, x.formula, x.formulaRef, x.formulaScope, r.field, M, D]
1901
- ), U = e.useMemo(
1902
- () => Rn(l, T.tone),
1903
- [T.tone, l]
1904
- ), R = e.useMemo(
1905
- () => $e(x.formulaScope) ? Cn(C) : wn(A),
1906
- [C, x.formulaScope, A]
1916
+ [w, x.formula, x.formulaRef, x.formulaScope, t.field, M, R]
1917
+ ), N = e.useMemo(
1918
+ () => Rn(l, I.tone),
1919
+ [I.tone, l]
1920
+ ), C = e.useMemo(
1921
+ () => $e(x.formulaScope) ? Cn(w) : wn(A),
1922
+ [w, x.formulaScope, A]
1907
1923
  ), O = e.useMemo(
1908
- () => $e(x.formulaScope) ? or(C) || "[column_id] - [other_column_id]" : Rt(A) || `${ze(x.formulaRef || r.field)} * 100`,
1909
- [C, x.formulaRef, x.formulaScope, r.field, A]
1910
- ), i = x.label !== (r.label || "") || x.formula !== (r.formula || "") || x.formulaRef !== q(r) || x.formulaScope !== Ne(r.formulaScope), k = e.useCallback(() => {
1911
- const m = Me(x.formulaRef, r.field);
1924
+ () => $e(x.formulaScope) ? or(w) || "[column_id] - [other_column_id]" : Rt(A) || `${ze(x.formulaRef || t.field)} * 100`,
1925
+ [w, x.formulaRef, x.formulaScope, t.field, A]
1926
+ ), i = x.label !== (t.label || "") || x.formula !== (t.formula || "") || x.formulaRef !== q(t) || x.formulaScope !== He(t.formulaScope), S = e.useCallback(() => {
1927
+ const m = Me(x.formulaRef, t.field);
1912
1928
  a(
1913
1929
  /** @param {any} [prev] @returns {any} */
1914
1930
  ($) => {
1915
- const E = [...$], j = E[n];
1916
- if (!j) return $;
1917
- const Z = q(j);
1918
- let V = m;
1931
+ const j = [...$], D = j[n];
1932
+ if (!D) return $;
1933
+ const H = q(D);
1934
+ let Y = m;
1919
1935
  const J = new Set(
1920
- E.filter((K, Q) => K && Q !== n).map((K) => K.agg === "formula" ? q(K) : K.field).filter(Boolean).map((K) => String(K).toLowerCase())
1936
+ j.filter((U, Q) => U && Q !== n).map((U) => U.agg === "formula" ? q(U) : U.field).filter(Boolean).map((U) => String(U).toLowerCase())
1921
1937
  );
1922
- if (J.has(V.toLowerCase())) {
1923
- let K = 2, Q = `${V}${K}`;
1938
+ if (J.has(Y.toLowerCase())) {
1939
+ let U = 2, Q = `${Y}${U}`;
1924
1940
  for (; J.has(Q.toLowerCase()); )
1925
- K += 1, Q = `${V}${K}`;
1926
- V = Q;
1941
+ U += 1, Q = `${Y}${U}`;
1942
+ Y = Q;
1927
1943
  }
1928
- if (E[n] = {
1929
- ...j,
1944
+ if (j[n] = {
1945
+ ...D,
1930
1946
  label: x.label,
1931
1947
  formula: x.formula,
1932
- formulaRef: V,
1948
+ formulaRef: Y,
1933
1949
  formulaScope: x.formulaScope
1934
- }, Z && Z !== V)
1935
- for (let K = 0; K < E.length; K += 1) {
1936
- if (K === n) continue;
1937
- const Q = E[K];
1938
- !Q || Q.agg !== "formula" || !Q.formula || (E[K] = {
1950
+ }, H && H !== Y)
1951
+ for (let U = 0; U < j.length; U += 1) {
1952
+ if (U === n) continue;
1953
+ const Q = j[U];
1954
+ !Q || Q.agg !== "formula" || !Q.formula || (j[U] = {
1939
1955
  ...Q,
1940
- formula: En(Q.formula, Z, V)
1956
+ formula: hn(Q.formula, H, Y)
1941
1957
  });
1942
1958
  }
1943
- return E;
1959
+ return j;
1944
1960
  }
1945
1961
  );
1946
- }, [x.formula, x.formulaRef, x.formulaScope, x.label, n, r.field, a]), w = e.useCallback(() => {
1962
+ }, [x.formula, x.formulaRef, x.formulaScope, x.label, n, t.field, a]), k = e.useCallback(() => {
1947
1963
  W({
1948
- label: r.label || "",
1949
- formula: r.formula || "",
1950
- formulaRef: q(r),
1951
- formulaScope: Ne(r.formulaScope)
1952
- }), p();
1953
- }, [r.field, r.formula, r.formulaRef, r.formulaScope, r.label, p]), B = e.useCallback((m) => {
1964
+ label: t.label || "",
1965
+ formula: t.formula || "",
1966
+ formulaRef: q(t),
1967
+ formulaScope: He(t.formulaScope)
1968
+ }), d();
1969
+ }, [t.field, t.formula, t.formulaRef, t.formulaScope, t.label, d]), B = e.useCallback((m) => {
1954
1970
  const $ = s.current;
1955
1971
  if (!$) return;
1956
- const E = x.formula || "", j = $.selectionStart ?? E.length, Z = $.selectionEnd ?? E.length, V = `${E.slice(0, j)}${m}${E.slice(Z)}`;
1972
+ const j = x.formula || "", D = $.selectionStart ?? j.length, H = $.selectionEnd ?? j.length, Y = `${j.slice(0, D)}${m}${j.slice(H)}`;
1957
1973
  W(
1958
1974
  /** @param {any} [prev] @returns {any} */
1959
- (K) => ({ ...K, formula: V })
1975
+ (U) => ({ ...U, formula: Y })
1960
1976
  );
1961
- const J = j + m.length;
1977
+ const J = D + m.length;
1962
1978
  setTimeout(() => {
1963
1979
  s.current && (s.current.focus(), s.current.setSelectionRange(J, J));
1964
1980
  }, 0);
1965
1981
  }, [x.formula]), _ = e.useCallback(() => {
1966
- k(), p();
1967
- }, [k, p]), N = {
1982
+ S(), d();
1983
+ }, [S, d]), K = {
1968
1984
  border: `1px solid ${l.border}`,
1969
1985
  background: l.background,
1970
1986
  color: l.text,
@@ -1987,7 +2003,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
1987
2003
  return /* @__PURE__ */ e.createElement(
1988
2004
  "div",
1989
2005
  {
1990
- onClick: w,
2006
+ onClick: k,
1991
2007
  style: {
1992
2008
  position: "fixed",
1993
2009
  inset: 0,
@@ -2004,7 +2020,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2004
2020
  {
2005
2021
  onClick: (m) => m.stopPropagation(),
2006
2022
  onKeyDown: (m) => {
2007
- m.key === "Escape" && w(), (m.ctrlKey || m.metaKey) && m.key === "Enter" && _();
2023
+ m.key === "Escape" && k(), (m.ctrlKey || m.metaKey) && m.key === "Enter" && _();
2008
2024
  },
2009
2025
  style: {
2010
2026
  width: "min(760px, 92vw)",
@@ -2021,7 +2037,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2021
2037
  "button",
2022
2038
  {
2023
2039
  type: "button",
2024
- onClick: w,
2040
+ onClick: k,
2025
2041
  style: {
2026
2042
  border: `1px solid ${l.border}`,
2027
2043
  background: l.headerSubtleBg || l.background,
@@ -2061,7 +2077,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2061
2077
  value: x.formulaRef,
2062
2078
  onChange: (m) => W(
2063
2079
  /** @param {any} [prev] @returns {any} */
2064
- ($) => ({ ...$, formulaRef: Me(m.target.value, r.field) })
2080
+ ($) => ({ ...$, formulaRef: Me(m.target.value, t.field) })
2065
2081
  ),
2066
2082
  placeholder: "formula1",
2067
2083
  style: {
@@ -2082,13 +2098,13 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2082
2098
  "aria-label": "Formula type",
2083
2099
  value: x.formulaScope,
2084
2100
  onChange: (m) => {
2085
- const $ = Ne(m.target.value);
2101
+ const $ = He(m.target.value);
2086
2102
  W(
2087
2103
  /** @param {any} [prev] @returns {any} */
2088
- (E) => ({
2089
- ...E,
2104
+ (j) => ({
2105
+ ...j,
2090
2106
  formulaScope: $,
2091
- formula: E.formula || ($ === "columns" ? or(C) : Rt(A))
2107
+ formula: j.formula || ($ === "columns" ? or(w) : Rt(A))
2092
2108
  })
2093
2109
  );
2094
2110
  },
@@ -2136,13 +2152,13 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2136
2152
  /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "8px", flexWrap: "wrap", marginBottom: "12px" } }, /* @__PURE__ */ e.createElement("div", { style: {
2137
2153
  padding: "5px 9px",
2138
2154
  borderRadius: "999px",
2139
- border: `1px solid ${U.border}`,
2140
- background: U.background,
2141
- color: U.text,
2155
+ border: `1px solid ${N.border}`,
2156
+ background: N.background,
2157
+ color: N.text,
2142
2158
  fontSize: "10px",
2143
2159
  lineHeight: "14px"
2144
- } }, T.text), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec } }, "Ctrl/Cmd + Enter applies")),
2145
- /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", marginBottom: "12px" } }, R.map(
2160
+ } }, I.text), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec } }, "Ctrl/Cmd + Enter applies")),
2161
+ /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", marginBottom: "12px" } }, C.map(
2146
2162
  /** @param {any} [template] @returns {any} */
2147
2163
  (m) => /* @__PURE__ */ e.createElement(
2148
2164
  "button",
@@ -2153,7 +2169,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2153
2169
  /** @param {any} [prev] @returns {any} */
2154
2170
  ($) => ({ ...$, formula: m.value })
2155
2171
  ),
2156
- style: N
2172
+ style: K
2157
2173
  },
2158
2174
  m.label
2159
2175
  )
@@ -2168,7 +2184,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2168
2184
  },
2169
2185
  m
2170
2186
  ))),
2171
- /* @__PURE__ */ e.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr", gap: "12px", marginBottom: "14px" } }, $e(x.formulaScope) ? /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec, textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "6px" } }, "Rendered Columns"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, C.map(
2187
+ /* @__PURE__ */ e.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr", gap: "12px", marginBottom: "14px" } }, $e(x.formulaScope) ? /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec, textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "6px" } }, "Rendered Columns"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, w.map(
2172
2188
  /** @param {any} [column] @returns {any} */
2173
2189
  (m) => /* @__PURE__ */ e.createElement(
2174
2190
  "button",
@@ -2177,12 +2193,12 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2177
2193
  type: "button",
2178
2194
  onMouseDown: ($) => $.preventDefault(),
2179
2195
  onClick: () => B(ie(m.id)),
2180
- style: N,
2196
+ style: K,
2181
2197
  title: `Insert ${m.id}`
2182
2198
  },
2183
2199
  m.label || m.id
2184
2200
  )
2185
- ), C.length === 0 && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "11px", color: l.textSec } }, "Render the pivot once, or type a bracketed column id directly."))) : /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec, textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "6px" } }, "Measures"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, A.map(
2201
+ ), w.length === 0 && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "11px", color: l.textSec } }, "Render the pivot once, or type a bracketed column id directly."))) : /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec, textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "6px" } }, "Measures"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, A.map(
2186
2202
  /** @param {any} [config] @returns {any} */
2187
2203
  (m) => /* @__PURE__ */ e.createElement(
2188
2204
  "button",
@@ -2191,7 +2207,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2191
2207
  type: "button",
2192
2208
  onMouseDown: ($) => $.preventDefault(),
2193
2209
  onClick: () => B(ze(m.field)),
2194
- style: N,
2210
+ style: K,
2195
2211
  title: `Insert ${m.field}`
2196
2212
  },
2197
2213
  m.field
@@ -2205,12 +2221,12 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2205
2221
  type: "button",
2206
2222
  onMouseDown: ($) => $.preventDefault(),
2207
2223
  onClick: () => B(ze(q(m))),
2208
- style: N,
2224
+ style: K,
2209
2225
  title: `${q(m)}${m.label ? ` (${m.label})` : ""}`
2210
2226
  },
2211
2227
  q(m)
2212
2228
  )
2213
- ))), !$e(x.formulaScope) && D.length > 0 && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec, textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "6px" } }, "Data Fields (auto-aggregated as sum)"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, D.map(
2229
+ ))), !$e(x.formulaScope) && R.length > 0 && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: l.textSec, textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "6px" } }, "Data Fields (auto-aggregated as sum)"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, R.map(
2214
2230
  /** @param {any} [f] @returns {any} */
2215
2231
  (m) => /* @__PURE__ */ e.createElement(
2216
2232
  "button",
@@ -2219,7 +2235,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2219
2235
  type: "button",
2220
2236
  onMouseDown: ($) => $.preventDefault(),
2221
2237
  onClick: () => B(ze(m)),
2222
- style: { ...N, borderColor: `${l.primary}66`, color: l.primary, background: `${l.primary}0d` },
2238
+ style: { ...K, borderColor: `${l.primary}66`, color: l.primary, background: `${l.primary}0d` },
2223
2239
  title: `Insert: ${m}`
2224
2240
  },
2225
2241
  Se(m)
@@ -2230,7 +2246,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2230
2246
  {
2231
2247
  type: "button",
2232
2248
  onClick: () => {
2233
- f(n), p();
2249
+ f(n), d();
2234
2250
  },
2235
2251
  style: {
2236
2252
  border: `1px solid ${l.border}`,
@@ -2248,7 +2264,7 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2248
2264
  "button",
2249
2265
  {
2250
2266
  type: "button",
2251
- onClick: w,
2267
+ onClick: k,
2252
2268
  style: {
2253
2269
  border: `1px solid ${l.border}`,
2254
2270
  background: l.background,
@@ -2285,89 +2301,89 @@ function $n({ item: r, idx: n, valConfigs: o, setValConfigs: a, theme: l, onClos
2285
2301
  );
2286
2302
  }
2287
2303
  function sr({
2288
- panelId: r,
2304
+ panelId: t,
2289
2305
  panelLabel: n,
2290
2306
  size: o,
2291
2307
  onSizeChange: a,
2292
2308
  getSidebarWidth: l = null,
2293
- onSidebarWidthChange: p = null,
2309
+ onSidebarWidthChange: d = null,
2294
2310
  theme: f,
2295
- outerStyle: S = {},
2311
+ outerStyle: E = {},
2296
2312
  contentStyle: g = {},
2297
2313
  children: z
2298
2314
  }) {
2299
- const s = e.useRef(null), x = e.useRef(null), W = e.useRef(null), P = e.useRef(null), M = e.useRef(null), A = e.useRef(null), y = e.useRef(null), [C, D] = e.useState(null), [T, U] = e.useState(null), R = e.useMemo(() => en(r), [r]), O = e.useMemo(
2300
- () => qt(r, o),
2301
- [r, o]
2315
+ const s = e.useRef(null), x = e.useRef(null), W = e.useRef(null), P = e.useRef(null), M = e.useRef(null), A = e.useRef(null), y = e.useRef(null), [w, R] = e.useState(null), [I, N] = e.useState(null), C = e.useMemo(() => en(t), [t]), O = e.useMemo(
2316
+ () => qt(t, o),
2317
+ [t, o]
2302
2318
  ), i = e.useRef(O);
2303
2319
  i.current = O;
2304
- const k = e.useMemo(() => C ? qt(r, {
2305
- width: C.width !== void 0 ? C.width : O.width,
2306
- height: C.height !== void 0 ? C.height : O.height
2307
- }) : O, [C, r, O]), w = e.useCallback((L = !0) => {
2320
+ const S = e.useMemo(() => w ? qt(t, {
2321
+ width: w.width !== void 0 ? w.width : O.width,
2322
+ height: w.height !== void 0 ? w.height : O.height
2323
+ }) : O, [w, t, O]), k = e.useCallback((L = !0) => {
2308
2324
  if (x.current) {
2309
2325
  const m = x.current;
2310
2326
  x.current = null, m(L);
2311
2327
  }
2312
2328
  }, []);
2313
- e.useEffect(() => (() => w(!1)), [w]);
2329
+ e.useEffect(() => (() => k(!1)), [k]);
2314
2330
  const B = e.useCallback((L, m) => {
2315
2331
  if (!s.current || typeof a != "function") return;
2316
- L.preventDefault(), L.stopPropagation(), w(!1);
2317
- const $ = s.current.getBoundingClientRect(), E = s.current.parentElement ? s.current.parentElement.getBoundingClientRect() : $, j = typeof l == "function" ? Number(l()) : NaN, Z = Number.isFinite(j) ? Math.max(200, Math.min(600, Math.round(j))) : null, V = Z !== null ? Math.max(0, Math.round(Z - E.width)) : 0, J = typeof p == "function" && Z !== null;
2318
- Z !== null && (i.current.width === null || A.current === null) && (A.current = Z, y.current = V);
2319
- const K = Z !== null ? A.current !== null ? Math.min(Z, A.current) : Z : null, Q = y.current !== null ? y.current : V, At = J ? Math.max(R.minWidth, Math.min(R.maxWidth, 600 - Q)) : Math.max(R.minWidth, Math.min(R.maxWidth, Math.floor(E.width))), ne = {
2332
+ L.preventDefault(), L.stopPropagation(), k(!1);
2333
+ const $ = s.current.getBoundingClientRect(), j = s.current.parentElement ? s.current.parentElement.getBoundingClientRect() : $, D = typeof l == "function" ? Number(l()) : NaN, H = Number.isFinite(D) ? Math.max(200, Math.min(600, Math.round(D))) : null, Y = H !== null ? Math.max(0, Math.round(H - j.width)) : 0, J = typeof d == "function" && H !== null;
2334
+ H !== null && (i.current.width === null || A.current === null) && (A.current = H, y.current = Y);
2335
+ const U = H !== null ? A.current !== null ? Math.min(H, A.current) : H : null, Q = y.current !== null ? y.current : Y, At = J ? Math.max(C.minWidth, Math.min(C.maxWidth, 600 - Q)) : Math.max(C.minWidth, Math.min(C.maxWidth, Math.floor(j.width))), ne = {
2320
2336
  startX: L.clientX,
2321
2337
  startY: L.clientY,
2322
2338
  startWidth: $.width,
2323
2339
  startHeight: $.height,
2324
- startParentWidth: Math.floor(E.width),
2325
- startSidebarWidth: Z,
2326
- baseSidebarWidth: K,
2340
+ startParentWidth: Math.floor(j.width),
2341
+ startSidebarWidth: H,
2342
+ baseSidebarWidth: U,
2327
2343
  chromeWidth: Q,
2328
2344
  canExpandSidebar: J,
2329
2345
  maxWidth: At,
2330
2346
  initialWidthProp: i.current.width
2331
2347
  }, ke = document.body.style.cursor, _e = document.body.style.userSelect;
2332
- document.body.style.cursor = m === "both" ? "nwse-resize" : m === "width" ? "ew-resize" : "ns-resize", document.body.style.userSelect = "none", P.current = null, M.current = null, U(m);
2348
+ document.body.style.cursor = m === "both" ? "nwse-resize" : m === "width" ? "ew-resize" : "ns-resize", document.body.style.userSelect = "none", P.current = null, M.current = null, N(m);
2333
2349
  const we = () => {
2334
- W.current = null, P.current && D(P.current), M.current !== null && typeof p == "function" && (p(M.current), M.current = null);
2335
- }, pe = (fe) => {
2350
+ W.current = null, P.current && R(P.current), M.current !== null && typeof d == "function" && (d(M.current), M.current = null);
2351
+ }, de = (fe) => {
2336
2352
  const me = fe.clientX - ne.startX, be = fe.clientY - ne.startY, Ue = {};
2337
2353
  if (m === "width" || m === "both" && (ne.initialWidthProp !== null || Math.abs(me) >= 3)) {
2338
- const Ee = Math.max(R.minWidth, Math.min(ne.maxWidth, Math.round(ne.startWidth + me)));
2339
- if (Ue.width = Ee, s.current && (s.current.style.width = `${Ee}px`), ne.canExpandSidebar) {
2340
- const ut = ne.baseSidebarWidth !== null ? ne.baseSidebarWidth : ne.startSidebarWidth, dt = Math.max(
2354
+ const he = Math.max(C.minWidth, Math.min(ne.maxWidth, Math.round(ne.startWidth + me)));
2355
+ if (Ue.width = he, s.current && (s.current.style.width = `${he}px`), ne.canExpandSidebar) {
2356
+ const ut = ne.baseSidebarWidth !== null ? ne.baseSidebarWidth : ne.startSidebarWidth, pt = Math.max(
2341
2357
  ut,
2342
- Math.min(600, Ee + ne.chromeWidth)
2358
+ Math.min(600, he + ne.chromeWidth)
2343
2359
  );
2344
- M.current = dt;
2360
+ M.current = pt;
2345
2361
  }
2346
2362
  }
2347
2363
  if (m === "height" || m === "both") {
2348
- const Ee = Math.max(R.minHeight, Math.min(R.maxHeight, Math.round(ne.startHeight + be)));
2349
- Ue.height = Ee, s.current && (s.current.style.height = `${Ee}px`);
2364
+ const he = Math.max(C.minHeight, Math.min(C.maxHeight, Math.round(ne.startHeight + be)));
2365
+ Ue.height = he, s.current && (s.current.style.height = `${he}px`);
2350
2366
  }
2351
2367
  Object.keys(Ue).length !== 0 && (P.current = Ue, typeof window < "u" && typeof window.requestAnimationFrame == "function" ? W.current === null && (W.current = window.requestAnimationFrame(we)) : we());
2352
2368
  }, Ce = (fe = !0) => {
2353
- W.current !== null && typeof window < "u" && typeof window.cancelAnimationFrame == "function" && (window.cancelAnimationFrame(W.current), W.current = null), document.body.style.cursor = ke, document.body.style.userSelect = _e, window.removeEventListener("mousemove", pe), window.removeEventListener("mouseup", se), window.removeEventListener("blur", se);
2369
+ W.current !== null && typeof window < "u" && typeof window.cancelAnimationFrame == "function" && (window.cancelAnimationFrame(W.current), W.current = null), document.body.style.cursor = ke, document.body.style.userSelect = _e, window.removeEventListener("mousemove", de), window.removeEventListener("mouseup", se), window.removeEventListener("blur", se);
2354
2370
  const me = P.current, be = M.current;
2355
- P.current = null, M.current = null, U(null), D(null), fe ? (be !== null && typeof p == "function" && p(be), me && a(r, me)) : s.current && (s.current.style.width = i.current.width === null ? "100%" : `${i.current.width}px`, s.current.style.height = `${i.current.height}px`);
2356
- }, se = () => w(!0);
2357
- x.current = Ce, window.addEventListener("mousemove", pe), window.addEventListener("mouseup", se), window.addEventListener("blur", se);
2371
+ P.current = null, M.current = null, N(null), R(null), fe ? (be !== null && typeof d == "function" && d(be), me && a(t, me)) : s.current && (s.current.style.width = i.current.width === null ? "100%" : `${i.current.width}px`, s.current.style.height = `${i.current.height}px`);
2372
+ }, se = () => k(!0);
2373
+ x.current = Ce, window.addEventListener("mousemove", de), window.addEventListener("mouseup", se), window.addEventListener("blur", se);
2358
2374
  }, [
2359
2375
  l,
2360
- R.maxHeight,
2361
- R.maxWidth,
2362
- R.minHeight,
2363
- R.minWidth,
2364
- p,
2376
+ C.maxHeight,
2377
+ C.maxWidth,
2378
+ C.minHeight,
2379
+ C.minWidth,
2380
+ d,
2365
2381
  a,
2366
- r,
2367
- w
2382
+ t,
2383
+ k
2368
2384
  ]), _ = e.useCallback((L, m) => {
2369
- m && (m.preventDefault(), m.stopPropagation()), w(!1), typeof a == "function" && (L === "width" ? (a(r, { width: null }), A.current !== null && typeof p == "function" && (p(A.current), A.current = null, y.current = null)) : L === "height" ? a(r, { height: null }) : (a(r, { width: null, height: null }), A.current !== null && typeof p == "function" && (p(A.current), A.current = null, y.current = null)));
2370
- }, [p, a, r, w]), N = `${f.primary}55`;
2385
+ m && (m.preventDefault(), m.stopPropagation()), k(!1), typeof a == "function" && (L === "width" ? (a(t, { width: null }), A.current !== null && typeof d == "function" && (d(A.current), A.current = null, y.current = null)) : L === "height" ? a(t, { height: null }) : (a(t, { width: null, height: null }), A.current !== null && typeof d == "function" && (d(A.current), A.current = null, y.current = null)));
2386
+ }, [d, a, t, k]), K = `${f.primary}55`;
2371
2387
  return /* @__PURE__ */ e.createElement(
2372
2388
  "div",
2373
2389
  {
@@ -2375,14 +2391,14 @@ function sr({
2375
2391
  style: {
2376
2392
  position: "relative",
2377
2393
  flexShrink: 0,
2378
- width: k.width === null ? "100%" : `${k.width}px`,
2394
+ width: S.width === null ? "100%" : `${S.width}px`,
2379
2395
  maxWidth: "100%",
2380
- height: `${k.height}px`,
2381
- minHeight: `${R.minHeight}px`,
2382
- maxHeight: `${R.maxHeight}px`,
2396
+ height: `${S.height}px`,
2397
+ minHeight: `${C.minHeight}px`,
2398
+ maxHeight: `${C.maxHeight}px`,
2383
2399
  boxSizing: "border-box",
2384
2400
  overflow: "hidden",
2385
- ...S
2401
+ ...E
2386
2402
  }
2387
2403
  },
2388
2404
  /* @__PURE__ */ e.createElement(
@@ -2402,7 +2418,7 @@ function sr({
2402
2418
  "div",
2403
2419
  {
2404
2420
  className: "sp-resize-handle",
2405
- "data-resizing": T === "width" ? "true" : void 0,
2421
+ "data-resizing": I === "width" ? "true" : void 0,
2406
2422
  onMouseDown: (L) => B(L, "width"),
2407
2423
  onDoubleClick: (L) => _("width", L),
2408
2424
  style: {
@@ -2421,13 +2437,13 @@ function sr({
2421
2437
  },
2422
2438
  title: `Resize ${n} width`
2423
2439
  },
2424
- /* @__PURE__ */ e.createElement("span", { className: "sp-resize-pill", "aria-hidden": "true", style: { width: "2px", height: "24px", borderRadius: "999px", background: N, opacity: 0.45, pointerEvents: "none" } })
2440
+ /* @__PURE__ */ e.createElement("span", { className: "sp-resize-pill", "aria-hidden": "true", style: { width: "2px", height: "24px", borderRadius: "999px", background: K, opacity: 0.45, pointerEvents: "none" } })
2425
2441
  ),
2426
2442
  /* @__PURE__ */ e.createElement(
2427
2443
  "div",
2428
2444
  {
2429
2445
  className: "sp-resize-handle",
2430
- "data-resizing": T === "height" ? "true" : void 0,
2446
+ "data-resizing": I === "height" ? "true" : void 0,
2431
2447
  onMouseDown: (L) => B(L, "height"),
2432
2448
  onDoubleClick: (L) => _("height", L),
2433
2449
  style: {
@@ -2446,13 +2462,13 @@ function sr({
2446
2462
  },
2447
2463
  title: `Resize ${n} height`
2448
2464
  },
2449
- /* @__PURE__ */ e.createElement("span", { className: "sp-resize-pill", "aria-hidden": "true", style: { width: "28px", height: "2px", borderRadius: "999px", background: N, opacity: 0.45, pointerEvents: "none" } })
2465
+ /* @__PURE__ */ e.createElement("span", { className: "sp-resize-pill", "aria-hidden": "true", style: { width: "28px", height: "2px", borderRadius: "999px", background: K, opacity: 0.45, pointerEvents: "none" } })
2450
2466
  ),
2451
2467
  /* @__PURE__ */ e.createElement(
2452
2468
  "div",
2453
2469
  {
2454
2470
  className: "sp-resize-handle",
2455
- "data-resizing": T === "both" ? "true" : void 0,
2471
+ "data-resizing": I === "both" ? "true" : void 0,
2456
2472
  onMouseDown: (L) => B(L, "both"),
2457
2473
  onDoubleClick: (L) => _("both", L),
2458
2474
  style: {
@@ -2479,9 +2495,9 @@ function sr({
2479
2495
  width: "3px",
2480
2496
  height: "3px",
2481
2497
  borderRadius: "999px",
2482
- background: N,
2498
+ background: K,
2483
2499
  opacity: 0.55,
2484
- boxShadow: `-4px 0 0 ${N}, 0 -4px 0 ${N}, -4px -4px 0 ${N}`,
2500
+ boxShadow: `-4px 0 0 ${K}, 0 -4px 0 ${K}, -4px -4px 0 ${K}`,
2485
2501
  pointerEvents: "none"
2486
2502
  }
2487
2503
  }
@@ -2489,8 +2505,8 @@ function sr({
2489
2505
  )
2490
2506
  );
2491
2507
  }
2492
- function cr({ measureAxis: r, setMeasureAxis: n, theme: o, valueSelectStyle: a, regularValueCount: l }) {
2493
- const p = e.useMemo(() => qe(r), [r]), f = e.useCallback((g) => {
2508
+ function cr({ measureAxis: t, setMeasureAxis: n, theme: o, valueSelectStyle: a, regularValueCount: l }) {
2509
+ const d = e.useMemo(() => qe(t), [t]), f = e.useCallback((g) => {
2494
2510
  typeof n == "function" && n(
2495
2511
  /** @param {any} [previous] @returns {any} */
2496
2512
  (z) => ({
@@ -2498,7 +2514,7 @@ function cr({ measureAxis: r, setMeasureAxis: n, theme: o, valueSelectStyle: a,
2498
2514
  ...typeof g == "function" ? g(qe(z)) : g
2499
2515
  })
2500
2516
  );
2501
- }, [n]), S = {
2517
+ }, [n]), E = {
2502
2518
  ...a,
2503
2519
  width: "112px",
2504
2520
  padding: "3px 6px",
@@ -2517,7 +2533,7 @@ function cr({ measureAxis: r, setMeasureAxis: n, theme: o, valueSelectStyle: a,
2517
2533
  re,
2518
2534
  {
2519
2535
  size: "sm",
2520
- value: p.placement,
2536
+ value: d.placement,
2521
2537
  onChange: (g) => f({ placement: g.target.value }),
2522
2538
  style: { ...a, width: "104px" },
2523
2539
  title: "Values placement"
@@ -2525,34 +2541,34 @@ function cr({ measureAxis: r, setMeasureAxis: n, theme: o, valueSelectStyle: a,
2525
2541
  /* @__PURE__ */ e.createElement("option", { value: "none" }, "Columns"),
2526
2542
  /* @__PURE__ */ e.createElement("option", { value: "rows" }, "Rows"),
2527
2543
  /* @__PURE__ */ e.createElement("option", { value: "columns" }, "Column Axis")
2528
- ), p.placement !== "none" && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
2544
+ ), d.placement !== "none" && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
2529
2545
  "input",
2530
2546
  {
2531
- value: p.labelField,
2547
+ value: d.labelField,
2532
2548
  onChange: (g) => f({ labelField: g.target.value }),
2533
- style: S,
2549
+ style: E,
2534
2550
  title: "Measure label field"
2535
2551
  }
2536
2552
  ), /* @__PURE__ */ e.createElement(
2537
2553
  "input",
2538
2554
  {
2539
- value: p.valueField,
2555
+ value: d.valueField,
2540
2556
  onChange: (g) => f({ valueField: g.target.value }),
2541
- style: { ...S, width: "82px" },
2557
+ style: { ...E, width: "82px" },
2542
2558
  title: "Measure value field"
2543
2559
  }
2544
2560
  ), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "10px", color: o.textSec } }, /* @__PURE__ */ e.createElement(
2545
2561
  "input",
2546
2562
  {
2547
2563
  type: "checkbox",
2548
- checked: p.suppressEmptyMembers,
2564
+ checked: d.suppressEmptyMembers,
2549
2565
  onChange: (g) => f({ suppressEmptyMembers: g.target.checked })
2550
2566
  }
2551
2567
  ), "Empty"), /* @__PURE__ */ e.createElement("label", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "10px", color: o.textSec } }, /* @__PURE__ */ e.createElement(
2552
2568
  "input",
2553
2569
  {
2554
2570
  type: "checkbox",
2555
- checked: p.suppressZeroMembers,
2571
+ checked: d.suppressZeroMembers,
2556
2572
  onChange: (g) => f({ suppressZeroMembers: g.target.checked })
2557
2573
  }
2558
2574
  ), "Zero")), /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: o.textSec } }, l, " selected"));
@@ -2564,9 +2580,9 @@ const _n = e.memo(
2564
2580
  setSidebarTab: o,
2565
2581
  rowFields: a,
2566
2582
  setRowFields: l,
2567
- colFields: p,
2583
+ colFields: d,
2568
2584
  setColFields: f,
2569
- valConfigs: S,
2585
+ valConfigs: E,
2570
2586
  setValConfigs: g,
2571
2587
  measureAxis: z = {},
2572
2588
  setMeasureAxis: s = null,
@@ -2576,51 +2592,51 @@ const _n = e.memo(
2576
2592
  setColumnPinning: M,
2577
2593
  availableFields: A,
2578
2594
  table: y,
2579
- pinningPresets: C,
2580
- showNotification: D,
2581
- filterAnchorEl: T,
2582
- setFilterAnchorEl: U,
2583
- colSearch: R,
2595
+ pinningPresets: w,
2596
+ showNotification: R,
2597
+ filterAnchorEl: I,
2598
+ setFilterAnchorEl: N,
2599
+ colSearch: C,
2584
2600
  setColSearch: O,
2585
2601
  colTypeFilter: i,
2586
- setColTypeFilter: k,
2587
- selectedCols: w,
2602
+ setColTypeFilter: S,
2603
+ selectedCols: k,
2588
2604
  setSelectedCols: B,
2589
2605
  dropLine: _,
2590
- onDragStart: N,
2606
+ onDragStart: K,
2591
2607
  onDragOver: L,
2592
2608
  onDrop: m,
2593
2609
  onDragEnd: $,
2594
- onKeyboardFieldDrop: E,
2595
- handleHeaderFilter: j,
2596
- handleFilterClick: Z,
2597
- requestFilterOptions: V,
2610
+ onKeyboardFieldDrop: j,
2611
+ handleHeaderFilter: D,
2612
+ handleFilterClick: H,
2613
+ requestFilterOptions: Y,
2598
2614
  handleExpandAllRows: J,
2599
- handlePinColumn: K,
2615
+ handlePinColumn: U,
2600
2616
  toggleAllColumnsPinned: Q,
2601
2617
  activeFilterCol: At,
2602
2618
  closeFilterPopover: ne,
2603
2619
  filterOptions: ke,
2604
2620
  filterOptionMeta: _e = {},
2605
2621
  clientFilterOptionMap: we = {},
2606
- data: pe,
2622
+ data: de,
2607
2623
  sidebarWidth: Ce,
2608
2624
  setSidebarWidth: se,
2609
2625
  fieldPanelSizes: fe,
2610
2626
  setFieldPanelSizes: me,
2611
2627
  fixedSparklineValueKeys: be = [],
2612
2628
  sparklineFields: Ue = null,
2613
- displayedColumnOptions: Ee = [],
2629
+ displayedColumnOptions: he = [],
2614
2630
  reportEditorSelection: ut = null,
2615
- showReportConfigColumn: dt = !0,
2631
+ showReportConfigColumn: pt = !0,
2616
2632
  setShowReportConfigColumn: wr = null,
2617
2633
  formulaErrors: We = {},
2618
2634
  serverSide: Je = !1
2619
2635
  }) {
2620
2636
  Yr("SidebarPanel");
2621
- const { theme: c, styles: Y } = Zr(), {
2637
+ const { theme: c, styles: Z } = Zr(), {
2622
2638
  filters: ce,
2623
- setFilters: pt,
2639
+ setFilters: dt,
2624
2640
  pivotMode: Cr,
2625
2641
  reportDef: Rr,
2626
2642
  setReportDef: Dr,
@@ -2630,184 +2646,184 @@ const _n = e.memo(
2630
2646
  setActiveReportId: Fr,
2631
2647
  customDimensions: je,
2632
2648
  setCustomDimensions: $t
2633
- } = Gr(), [Qe, zt] = e.useState({ columnId: null, anchorEl: null }), [Te, Ie] = e.useState(null), [ge, Re] = e.useState(null), [De, ft] = e.useState("report"), et = e.useRef(null), [Mr, tt] = e.useState(null), ue = e.useRef(null), Ft = e.useRef(0), Ve = e.useRef(null), xe = e.useRef(null), [X, mt] = e.useState(null), [gt, Mt] = e.useState(""), xt = e.useMemo(
2649
+ } = Gr(), [Qe, zt] = e.useState({ columnId: null, anchorEl: null }), [Ie, Te] = e.useState(null), [ge, Re] = e.useState(null), [De, ft] = e.useState("report"), et = e.useRef(null), [Mr, tt] = e.useState(null), ue = e.useRef(null), Ft = e.useRef(0), Ve = e.useRef(null), xe = e.useRef(null), [X, mt] = e.useState(null), [gt, Mt] = e.useState(""), xt = e.useMemo(
2634
2650
  () => new Set(Array.isArray(be) ? be : []),
2635
2651
  [be]
2636
2652
  ), ee = e.useCallback(
2637
- (t) => Xr(t, je),
2653
+ (r) => Xr(r, je),
2638
2654
  [je]
2639
2655
  ), _t = e.useMemo(
2640
2656
  () => qe(z),
2641
2657
  [z]
2642
- ), he = _t.labelField || "Measure Name", Be = e.useMemo(
2658
+ ), ve = _t.labelField || "Measure Name", Be = e.useMemo(
2643
2659
  () => (A || []).filter(
2644
2660
  /** @param {any} [field] @returns {any} */
2645
- (t) => t
2661
+ (r) => r
2646
2662
  ),
2647
2663
  [A]
2648
2664
  ), te = e.useMemo(
2649
2665
  () => Be.filter(
2650
2666
  /** @param {any} [field] @returns {any} */
2651
- (t) => t && !pr(t)
2667
+ (r) => r && !dr(r)
2652
2668
  ),
2653
2669
  [Be]
2654
- ), Ke = Array.isArray(S) && S.length > 0 && he && !Be.includes(he), Le = e.useMemo(
2655
- () => Ke ? [he, ...Be] : Be,
2656
- [Be, he, Ke]
2657
- ), Ye = gt.trim().toLowerCase(), rt = e.useCallback((t) => {
2670
+ ), Ke = Array.isArray(E) && E.length > 0 && ve && !Be.includes(ve), Le = e.useMemo(
2671
+ () => Ke ? [ve, ...Be] : Be,
2672
+ [Be, ve, Ke]
2673
+ ), Ye = gt.trim().toLowerCase(), rt = e.useCallback((r) => {
2658
2674
  if (!Ye) return !0;
2659
- const d = Ke && t === he ? "measure name measure names metric metrics value values" : "";
2660
- return String(t || "").toLowerCase().includes(Ye) || String(ee(t) || "").toLowerCase().includes(Ye) || d.includes(Ye);
2661
- }, [ee, he, Ye, Ke]), yt = e.useMemo(
2675
+ const p = Ke && r === ve ? "measure name measure names metric metrics value values" : "";
2676
+ return String(r || "").toLowerCase().includes(Ye) || String(ee(r) || "").toLowerCase().includes(Ye) || p.includes(Ye);
2677
+ }, [ee, ve, Ye, Ke]), yt = e.useMemo(
2662
2678
  () => Le.length > 8 ? Le.filter(rt) : Le,
2663
2679
  [Le, rt]
2664
2680
  ), bt = e.useMemo(
2665
2681
  () => te.length > 8 ? te.filter(rt) : te,
2666
2682
  [te, rt]
2667
- ), Wt = e.useCallback((t) => {
2683
+ ), Wt = e.useCallback((r) => {
2668
2684
  l(
2669
2685
  /** @param {any} [prev] @returns {any} */
2670
- (d) => (d || []).filter(
2686
+ (p) => (p || []).filter(
2671
2687
  /** @param {any} [item] @returns {any} */
2672
- (u) => u !== t
2688
+ (u) => u !== r
2673
2689
  )
2674
2690
  ), f(
2675
2691
  /** @param {any} [prev] @returns {any} */
2676
- (d) => (d || []).filter(
2692
+ (p) => (p || []).filter(
2677
2693
  /** @param {any} [item] @returns {any} */
2678
- (u) => u !== t
2694
+ (u) => u !== r
2679
2695
  )
2680
2696
  ), g(
2681
2697
  /** @param {any} [prev] @returns {any} */
2682
- (d) => (d || []).filter(
2698
+ (p) => (p || []).filter(
2683
2699
  /** @param {any} [item] @returns {any} */
2684
- (u) => !(u && u.field === t)
2700
+ (u) => !(u && u.field === r)
2685
2701
  )
2686
- ), pt(
2702
+ ), dt(
2687
2703
  /** @param {any} [prev] @returns {any} */
2688
- (d) => {
2689
- if (!d || !Object.prototype.hasOwnProperty.call(d, t)) return d;
2690
- const u = { ...d };
2691
- return delete u[t], u;
2704
+ (p) => {
2705
+ if (!p || !Object.prototype.hasOwnProperty.call(p, r)) return p;
2706
+ const u = { ...p };
2707
+ return delete u[r], u;
2692
2708
  }
2693
2709
  );
2694
- }, [f, pt, l, g]), _r = e.useCallback((t) => {
2695
- const d = ue.current;
2696
- if (!d) return;
2697
- const u = 60, b = 12, h = d.getBoundingClientRect(), I = t.clientY, G = I - h.top, v = h.bottom - I;
2698
- let H = 0;
2699
- if (G < u && G >= 0 ? H = -1 : v < u && v >= 0 && (H = 1), H === 0) {
2710
+ }, [f, dt, l, g]), _r = e.useCallback((r) => {
2711
+ const p = ue.current;
2712
+ if (!p) return;
2713
+ const u = 60, b = 12, h = p.getBoundingClientRect(), T = r.clientY, G = T - h.top, v = h.bottom - T;
2714
+ let V = 0;
2715
+ if (G < u && G >= 0 ? V = -1 : v < u && v >= 0 && (V = 1), V === 0) {
2700
2716
  xe.current && (cancelAnimationFrame(xe.current), xe.current = null);
2701
2717
  return;
2702
2718
  }
2703
2719
  const le = () => {
2704
- ue.current && (ue.current.scrollTop += H * b, xe.current = requestAnimationFrame(le));
2720
+ ue.current && (ue.current.scrollTop += V * b, xe.current = requestAnimationFrame(le));
2705
2721
  };
2706
2722
  xe.current || (xe.current = requestAnimationFrame(le));
2707
- }, []), Tt = e.useCallback(() => {
2723
+ }, []), It = e.useCallback(() => {
2708
2724
  xe.current && (cancelAnimationFrame(xe.current), xe.current = null);
2709
- }, []), de = e.useMemo(
2710
- () => S.filter(
2725
+ }, []), pe = e.useMemo(
2726
+ () => E.filter(
2711
2727
  /** @param {any} [config] @returns {any} */
2712
- (t) => t && t.agg === "formula"
2728
+ (r) => r && r.agg === "formula"
2713
2729
  ),
2714
- [S]
2730
+ [E]
2715
2731
  ), Ae = e.useMemo(
2716
- () => de.length,
2717
- [de]
2732
+ () => pe.length,
2733
+ [pe]
2718
2734
  ), Pe = e.useMemo(
2719
- () => S.filter(
2735
+ () => E.filter(
2720
2736
  /** @param {any} [config] @returns {any} */
2721
- (t) => t && t.agg !== "formula"
2737
+ (r) => r && r.agg !== "formula"
2722
2738
  ).length,
2723
- [S]
2739
+ [E]
2724
2740
  ), Wr = e.useMemo(() => [
2725
2741
  { id: "rows", label: "Rows", icon: /* @__PURE__ */ e.createElement(F.List, null) },
2726
2742
  { id: "cols", label: "Columns", icon: /* @__PURE__ */ e.createElement(F.Columns, null) },
2727
2743
  { id: "vals", label: "Values", icon: /* @__PURE__ */ e.createElement(F.Sigma, null) },
2728
2744
  { id: "filter", label: "Filters", icon: /* @__PURE__ */ e.createElement(F.Filter, null) }
2729
2745
  ], []), Ze = e.useMemo(() => ({
2730
- filter: Object.keys(ce || {}).filter((t) => t !== "global"),
2746
+ filter: Object.keys(ce || {}).filter((r) => r !== "global"),
2731
2747
  rows: a || [],
2732
- cols: p || [],
2733
- vals: S || []
2734
- }), [p, ce, a, S]), nt = e.useCallback(() => {
2735
- X && D && D("Keyboard move cancelled.", "info"), mt(null);
2736
- }, [X, D]), It = e.useCallback((t, d, u, b) => {
2737
- if (typeof E != "function") return;
2738
- mt({ field: t, zone: d, idx: u, label: b }), D && D(`Picked up ${b}. Focus a target field or zone and press Enter.`, "info");
2739
- }, [E, D]), lt = e.useCallback((t, d = null) => {
2740
- if (!X || typeof E != "function") return !1;
2741
- const u = Ze[t] || [], b = Number(d), h = Number.isFinite(b) ? Math.max(0, Math.min(Math.floor(b), u.length)) : u.length, I = E({
2748
+ cols: d || [],
2749
+ vals: E || []
2750
+ }), [d, ce, a, E]), nt = e.useCallback(() => {
2751
+ X && R && R("Keyboard move cancelled.", "info"), mt(null);
2752
+ }, [X, R]), Tt = e.useCallback((r, p, u, b) => {
2753
+ if (typeof j != "function") return;
2754
+ mt({ field: r, zone: p, idx: u, label: b }), R && R(`Picked up ${b}. Focus a target field or zone and press Enter.`, "info");
2755
+ }, [j, R]), lt = e.useCallback((r, p = null) => {
2756
+ if (!X || typeof j != "function") return !1;
2757
+ const u = Ze[r] || [], b = Number(p), h = Number.isFinite(b) ? Math.max(0, Math.min(Math.floor(b), u.length)) : u.length, T = j({
2742
2758
  field: X.field,
2743
2759
  srcZone: X.zone,
2744
2760
  srcIdx: X.idx,
2745
- targetZone: t,
2761
+ targetZone: r,
2746
2762
  targetIdx: h,
2747
2763
  source: "layout:keyboard-drop"
2748
2764
  });
2749
- return I !== !1 && (D && D(`Moved ${X.label}.`, "success"), mt(null)), I !== !1;
2750
- }, [X, E, D, Ze]), Bt = e.useCallback((t, d, u, b, h) => {
2751
- if (!ar(t.target)) {
2752
- if (t.key === "Escape") {
2753
- t.preventDefault(), t.stopPropagation(), nt();
2765
+ return T !== !1 && (R && R(`Moved ${X.label}.`, "success"), mt(null)), T !== !1;
2766
+ }, [X, j, R, Ze]), Bt = e.useCallback((r, p, u, b, h) => {
2767
+ if (!ar(r.target)) {
2768
+ if (r.key === "Escape") {
2769
+ r.preventDefault(), r.stopPropagation(), nt();
2754
2770
  return;
2755
2771
  }
2756
- t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), X ? lt(u, b) : It(d, u, b, h));
2772
+ r.key !== "Enter" && r.key !== " " || (r.preventDefault(), r.stopPropagation(), X ? lt(u, b) : Tt(p, u, b, h));
2757
2773
  }
2758
- }, [nt, lt, X, It]), Tr = e.useCallback((t, d) => {
2759
- if (!ar(t.target)) {
2760
- if (t.key === "Escape") {
2761
- t.preventDefault(), t.stopPropagation(), nt();
2774
+ }, [nt, lt, X, Tt]), Ir = e.useCallback((r, p) => {
2775
+ if (!ar(r.target)) {
2776
+ if (r.key === "Escape") {
2777
+ r.preventDefault(), r.stopPropagation(), nt();
2762
2778
  return;
2763
2779
  }
2764
- !X || t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), lt(d, (Ze[d] || []).length));
2780
+ !X || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), r.stopPropagation(), lt(p, (Ze[p] || []).length));
2765
2781
  }
2766
- }, [nt, lt, X, Ze]), Ir = e.useCallback((t) => {
2767
- t.preventDefault();
2768
- const d = t.clientX, u = Ce || 288;
2769
- Ve.current = { startX: d, startWidth: u };
2782
+ }, [nt, lt, X, Ze]), Tr = e.useCallback((r) => {
2783
+ r.preventDefault();
2784
+ const p = r.clientX, u = Ce || 288;
2785
+ Ve.current = { startX: p, startWidth: u };
2770
2786
  const b = document.body.style.cursor, h = document.body.style.userSelect;
2771
2787
  document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
2772
- const I = (v) => {
2788
+ const T = (v) => {
2773
2789
  if (!Ve.current) return;
2774
- const H = v.clientX - Ve.current.startX, le = Math.max(200, Math.min(600, Ve.current.startWidth + H));
2790
+ const V = v.clientX - Ve.current.startX, le = Math.max(200, Math.min(600, Ve.current.startWidth + V));
2775
2791
  se(le);
2776
2792
  }, G = () => {
2777
- Ve.current = null, document.body.style.cursor = b, document.body.style.userSelect = h, window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", G), window.removeEventListener("blur", G);
2793
+ Ve.current = null, document.body.style.cursor = b, document.body.style.userSelect = h, window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", G), window.removeEventListener("blur", G);
2778
2794
  };
2779
- window.addEventListener("mousemove", I), window.addEventListener("mouseup", G), window.addEventListener("blur", G);
2780
- }, [Ce, se]), Lt = e.useCallback(() => ue.current ? ue.current.getBoundingClientRect().width : Ce || 288, [Ce]), Pt = e.useCallback((t) => {
2795
+ window.addEventListener("mousemove", T), window.addEventListener("mouseup", G), window.addEventListener("blur", G);
2796
+ }, [Ce, se]), Lt = e.useCallback(() => ue.current ? ue.current.getBoundingClientRect().width : Ce || 288, [Ce]), Pt = e.useCallback((r) => {
2781
2797
  if (typeof se != "function") return;
2782
- const d = Math.max(200, Math.min(600, Math.round(t)));
2798
+ const p = Math.max(200, Math.min(600, Math.round(r)));
2783
2799
  se(
2784
2800
  /** @param {any} [prev] @returns {any} */
2785
- (u) => u === d ? u : d
2801
+ (u) => u === p ? u : p
2786
2802
  );
2787
- }, [se]), Ot = e.useCallback((t, d) => {
2803
+ }, [se]), Ot = e.useCallback((r, p) => {
2788
2804
  typeof me == "function" && me(
2789
2805
  /** @param {any} [prev] @returns {any} */
2790
2806
  (u) => {
2791
- const b = qr(u, t, d), h = u && u[t] ? u[t] : null, I = b[t];
2792
- return h && h.width === I.width && h.height === I.height ? u : b;
2807
+ const b = qr(u, r, p), h = u && u[r] ? u[r] : null, T = b[r];
2808
+ return h && h.width === T.width && h.height === T.height ? u : b;
2793
2809
  }
2794
2810
  );
2795
- }, [me]), Ht = Y.dropZone && Y.dropZone.padding || "8px", Nt = e.useMemo(() => {
2796
- const t = { ...Y.dropZone || {} };
2797
- return delete t.minHeight, delete t.maxHeight, delete t.overflowY, delete t.padding, delete t.border, delete t.boxShadow, t;
2798
- }, [Y.dropZone]), Ut = e.useCallback((t) => {
2799
- if (ke && ke[t]) return ke[t];
2800
- if (we && we[t]) return we[t];
2811
+ }, [me]), Nt = Z.dropZone && Z.dropZone.padding || "8px", Ht = e.useMemo(() => {
2812
+ const r = { ...Z.dropZone || {} };
2813
+ return delete r.minHeight, delete r.maxHeight, delete r.overflowY, delete r.padding, delete r.border, delete r.boxShadow, r;
2814
+ }, [Z.dropZone]), Ut = e.useCallback((r) => {
2815
+ if (ke && ke[r]) return ke[r];
2816
+ if (we && we[r]) return we[r];
2801
2817
  if (!y || !y.getColumn) return [];
2802
- if (!y.getColumn(t)) return [];
2818
+ if (!y.getColumn(r)) return [];
2803
2819
  const u = /* @__PURE__ */ new Set();
2804
2820
  return (y.getCoreRowModel ? y.getCoreRowModel().rows : []).forEach(
2805
2821
  /** @param {any} [row] @returns {any} */
2806
2822
  (h) => {
2807
- const I = h.getValue(t);
2808
- I != null && I !== "" && u.add(I);
2823
+ const T = h.getValue(r);
2824
+ T != null && T !== "" && u.add(T);
2809
2825
  }
2810
- ), Array.from(u).sort((h, I) => String(h).localeCompare(String(I), void 0, { numeric: !0, sensitivity: "base" }));
2826
+ ), Array.from(u).sort((h, T) => String(h).localeCompare(String(T), void 0, { numeric: !0, sensitivity: "base" }));
2811
2827
  }, [we, ke, y]), ye = e.useMemo(() => ({
2812
2828
  border: `1px solid ${c.border}`,
2813
2829
  background: c.headerSubtleBg || c.surfaceInset || c.background,
@@ -2819,56 +2835,56 @@ const _n = e.memo(
2819
2835
  padding: "1px 4px",
2820
2836
  minHeight: "20px",
2821
2837
  outline: "none"
2822
- }), [c.background, c.border, c.headerSubtleBg, c.radiusSm, c.surfaceInset, c.text]), jt = e.useCallback((t, d) => {
2838
+ }), [c.background, c.border, c.headerSubtleBg, c.radiusSm, c.surfaceInset, c.text]), jt = e.useCallback((r, p) => {
2823
2839
  g(
2824
2840
  /** @param {any} [prev] @returns {any} */
2825
2841
  (u) => {
2826
- const b = [...u], h = b[t];
2842
+ const b = [...u], h = b[r];
2827
2843
  if (!h) return u;
2828
- if (Xt(d) && !h.weightField) {
2829
- const I = Array.isArray(te) && te.length > 0 ? te.find((H) => H !== h.field) || te[0] : "", G = typeof window < "u" ? window.prompt(
2844
+ if (Xt(p) && !h.weightField) {
2845
+ const T = Array.isArray(te) && te.length > 0 ? te.find((V) => V !== h.field) || te[0] : "", G = typeof window < "u" ? window.prompt(
2830
2846
  `Weight field for weighted average of ${Se(h.field)}`,
2831
- h.weightField || I || ""
2832
- ) : h.weightField || I || "", v = typeof G == "string" ? G.trim() : "";
2833
- return v ? Array.isArray(te) && te.length > 0 && !te.includes(v) ? (D && D(`Unknown weight field: ${v}`, "warning"), u) : (b[t] = { ...h, agg: d, weightField: v }, b) : (D && D("Weighted average requires a weight field.", "warning"), u);
2847
+ h.weightField || T || ""
2848
+ ) : h.weightField || T || "", v = typeof G == "string" ? G.trim() : "";
2849
+ return v ? Array.isArray(te) && te.length > 0 && !te.includes(v) ? (R && R(`Unknown weight field: ${v}`, "warning"), u) : (b[r] = { ...h, agg: p, weightField: v }, b) : (R && R("Weighted average requires a weight field.", "warning"), u);
2834
2850
  }
2835
- return b[t] = { ...h, agg: d }, b;
2851
+ return b[r] = { ...h, agg: p }, b;
2836
2852
  }
2837
2853
  );
2838
- }, [te, g, D]), Br = e.useCallback((t, d) => {
2839
- if (!d) {
2840
- D && D("Weighted average requires a weight field.", "warning");
2854
+ }, [te, g, R]), Br = e.useCallback((r, p) => {
2855
+ if (!p) {
2856
+ R && R("Weighted average requires a weight field.", "warning");
2841
2857
  return;
2842
2858
  }
2843
2859
  g(
2844
2860
  /** @param {any} [prev] @returns {any} */
2845
2861
  (u) => {
2846
- const b = [...u], h = b[t];
2847
- return h ? (b[t] = { ...h, weightField: d }, b) : u;
2862
+ const b = [...u], h = b[r];
2863
+ return h ? (b[r] = { ...h, weightField: p }, b) : u;
2848
2864
  }
2849
2865
  );
2850
- }, [g, D]), Lr = e.useCallback((t, d) => {
2866
+ }, [g, R]), Lr = e.useCallback((r, p) => {
2851
2867
  g(
2852
2868
  /** @param {any} [prev] @returns {any} */
2853
2869
  (u) => {
2854
- const b = [...u], h = b[t];
2855
- return h ? (b[t] = {
2870
+ const b = [...u], h = b[r];
2871
+ return h ? (b[r] = {
2856
2872
  ...h,
2857
- windowFn: d === "none" ? null : d
2873
+ windowFn: p === "none" ? null : p
2858
2874
  }, b) : u;
2859
2875
  }
2860
2876
  );
2861
2877
  }, [g]), Vt = e.useCallback(() => {
2862
- const t = Sn(S), d = S.filter(
2878
+ const r = Sn(E), p = E.filter(
2863
2879
  /** @param {any} [config] @returns {any} */
2864
- (I) => I && I.agg !== "formula"
2865
- ), u = `Formula ${Ae + 1}`, b = Rt(d), h = bn(u, S, t);
2866
- Ie(t), Re(t), g(
2880
+ (T) => T && T.agg !== "formula"
2881
+ ), u = `Formula ${Ae + 1}`, b = Rt(p), h = bn(u, E, r);
2882
+ Te(r), Re(r), g(
2867
2883
  /** @param {any} [prev] @returns {any} */
2868
- (I) => [
2869
- ...I,
2884
+ (T) => [
2885
+ ...T,
2870
2886
  {
2871
- field: t,
2887
+ field: r,
2872
2888
  agg: "formula",
2873
2889
  label: u,
2874
2890
  formula: b,
@@ -2876,54 +2892,54 @@ const _n = e.memo(
2876
2892
  formulaScope: "measures"
2877
2893
  }
2878
2894
  ]
2879
- ), D && (d.length === 0 ? D("Added a formula column. Add at least one regular value measure to reference in it.", "warning") : D(`Added ${u}.`, "success"));
2880
- }, [Ae, Re, g, Ie, D, S]), Pr = (t, d) => {
2881
- t.stopPropagation(), ue.current && (Ft.current = ue.current.scrollTop), zt(
2895
+ ), R && (p.length === 0 ? R("Added a formula column. Add at least one regular value measure to reference in it.", "warning") : R(`Added ${u}.`, "success"));
2896
+ }, [Ae, Re, g, Te, R, E]), Pr = (r, p) => {
2897
+ r.stopPropagation(), ue.current && (Ft.current = ue.current.scrollTop), zt(
2882
2898
  /** @param {any} [prev] @returns {any} */
2883
- (u) => u.columnId === d ? { columnId: null, anchorEl: null } : { columnId: d, anchorEl: t.currentTarget }
2884
- ), V && V(d);
2899
+ (u) => u.columnId === p ? { columnId: null, anchorEl: null } : { columnId: p, anchorEl: r.currentTarget }
2900
+ ), Y && Y(p);
2885
2901
  }, Or = () => zt({ columnId: null, anchorEl: null });
2886
2902
  e.useEffect(() => {
2887
2903
  ue.current && Qe.columnId && (ue.current.scrollTop = Ft.current);
2888
2904
  }, [ke, Qe.columnId]), e.useEffect(() => {
2889
- if (de.length === 0) {
2890
- Te !== null && Ie(null), ge !== null && Re(null);
2905
+ if (pe.length === 0) {
2906
+ Ie !== null && Te(null), ge !== null && Re(null);
2891
2907
  return;
2892
2908
  }
2893
- de.some(
2909
+ pe.some(
2894
2910
  /** @param {any} [config] @returns {any} */
2895
- (d) => d.field === Te
2896
- ) || Ie(de[de.length - 1].field), ge && !de.some(
2911
+ (p) => p.field === Ie
2912
+ ) || Te(pe[pe.length - 1].field), ge && !pe.some(
2897
2913
  /** @param {any} [config] @returns {any} */
2898
- (d) => d.field === ge
2914
+ (p) => p.field === ge
2899
2915
  ) && Re(null);
2900
- }, [Te, de, ge]);
2901
- const Et = e.useMemo(
2902
- () => S.findIndex(
2916
+ }, [Ie, pe, ge]);
2917
+ const ht = e.useMemo(
2918
+ () => E.findIndex(
2903
2919
  /** @param {any} [config] @returns {any} */
2904
- (t) => t && t.agg === "formula" && t.field === ge
2920
+ (r) => r && r.agg === "formula" && r.field === ge
2905
2921
  ),
2906
- [ge, S]
2907
- ), ht = Et >= 0 ? S[Et] : null, Kt = e.useCallback((t) => {
2908
- Ie(t), Re(t);
2909
- }, []), Ge = e.useCallback((t) => {
2910
- const d = S[t] && S[t].agg === "formula" ? S[t].field : null;
2922
+ [ge, E]
2923
+ ), vt = ht >= 0 ? E[ht] : null, Kt = e.useCallback((r) => {
2924
+ Te(r), Re(r);
2925
+ }, []), Ge = e.useCallback((r) => {
2926
+ const p = E[r] && E[r].agg === "formula" ? E[r].field : null;
2911
2927
  if (g(
2912
2928
  /** @param {any} [prev] @returns {any} */
2913
2929
  (u) => u.filter(
2914
2930
  /** @param {any} [_] @param {any} [index] @returns {any} */
2915
- (b, h) => h !== t
2931
+ (b, h) => h !== r
2916
2932
  )
2917
- ), d && d === Te) {
2918
- const u = de.find(
2933
+ ), p && p === Ie) {
2934
+ const u = pe.find(
2919
2935
  /** @param {any} [config] @returns {any} */
2920
- (b) => b.field !== d
2936
+ (b) => b.field !== p
2921
2937
  );
2922
- Ie(u ? u.field : null);
2938
+ Te(u ? u.field : null);
2923
2939
  }
2924
- d && d === ge && Re(null);
2925
- }, [Te, de, ge, g, S]), Oe = Cr === "report", Yt = Math.max(Ce || 288, Oe ? 380 : 0), Zt = (t, d) => {
2926
- if (t <= 8) return null;
2940
+ p && p === ge && Re(null);
2941
+ }, [Ie, pe, ge, g, E]), Oe = Cr === "report", Yt = Math.max(Ce || 288, Oe ? 380 : 0), Zt = (r, p) => {
2942
+ if (r <= 8) return null;
2927
2943
  const u = gt.trim().length > 0;
2928
2944
  return /* @__PURE__ */ e.createElement("div", { style: {
2929
2945
  display: "flex",
@@ -2939,7 +2955,7 @@ const _n = e.memo(
2939
2955
  {
2940
2956
  type: "search",
2941
2957
  "aria-label": "Search available fields",
2942
- placeholder: `Search ${t} fields...`,
2958
+ placeholder: `Search ${r} fields...`,
2943
2959
  value: gt,
2944
2960
  onChange: (b) => Mt(b.target.value),
2945
2961
  style: {
@@ -2970,9 +2986,9 @@ const _n = e.memo(
2970
2986
  }
2971
2987
  },
2972
2988
  /* @__PURE__ */ e.createElement(F.Close, null)
2973
- ), u && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: c.textSec, whiteSpace: "nowrap" } }, d, "/", t));
2989
+ ), u && /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: c.textSec, whiteSpace: "nowrap" } }, p, "/", r));
2974
2990
  };
2975
- return /* @__PURE__ */ e.createElement("div", { style: { position: "relative", display: "flex", flexShrink: 0 } }, /* @__PURE__ */ e.createElement("div", { ref: ue, style: { ...Y.sidebar, width: `${Yt}px`, minWidth: `${Yt}px` }, role: "complementary", "aria-label": "Tool Panel", onDragOver: _r, onDragLeave: Tt, onDrop: Tt }, /* @__PURE__ */ e.createElement(
2991
+ return /* @__PURE__ */ e.createElement("div", { style: { position: "relative", display: "flex", flexShrink: 0 } }, /* @__PURE__ */ e.createElement("div", { ref: ue, style: { ...Z.sidebar, width: `${Yt}px`, minWidth: `${Yt}px` }, role: "complementary", "aria-label": "Tool Panel", onDragOver: _r, onDragLeave: It, onDrop: It }, /* @__PURE__ */ e.createElement(
2976
2992
  "div",
2977
2993
  {
2978
2994
  id: "pivot-sidebar-keyboard-dnd-help",
@@ -2983,38 +2999,38 @@ const _n = e.memo(
2983
2999
  { id: "report", label: "Builder", icon: /* @__PURE__ */ e.createElement(F.Report, null) },
2984
3000
  { id: "fields", label: "Fields", icon: /* @__PURE__ */ e.createElement(F.Sigma, null) },
2985
3001
  { id: "columns", label: "Columns", icon: /* @__PURE__ */ e.createElement(F.Columns, null) }
2986
- ].map((t, d, u) => /* @__PURE__ */ e.createElement(
3002
+ ].map((r, p, u) => /* @__PURE__ */ e.createElement(
2987
3003
  "div",
2988
3004
  {
2989
- key: t.id,
3005
+ key: r.id,
2990
3006
  role: "tab",
2991
3007
  tabIndex: 0,
2992
- "aria-selected": De === t.id,
3008
+ "aria-selected": De === r.id,
2993
3009
  className: "sp-tab",
2994
- onClick: () => ft(t.id),
3010
+ onClick: () => ft(r.id),
2995
3011
  onKeyDown: (b) => {
2996
3012
  if (b.key === "Enter" || b.key === " ")
2997
- b.preventDefault(), ft(t.id);
3013
+ b.preventDefault(), ft(r.id);
2998
3014
  else if (b.key === "ArrowRight" || b.key === "ArrowLeft") {
2999
3015
  b.preventDefault();
3000
- const h = b.key === "ArrowRight" ? 1 : -1, I = u[(d + h + u.length) % u.length];
3001
- I && ft(I.id);
3016
+ const h = b.key === "ArrowRight" ? 1 : -1, T = u[(p + h + u.length) % u.length];
3017
+ T && ft(T.id);
3002
3018
  }
3003
3019
  },
3004
3020
  style: {
3005
3021
  padding: "8px 10px",
3006
3022
  cursor: "pointer",
3007
3023
  justifyContent: "center",
3008
- fontWeight: De === t.id ? 600 : 400,
3009
- color: De === t.id ? c.primary : c.textSec,
3024
+ fontWeight: De === r.id ? 600 : 400,
3025
+ color: De === r.id ? c.primary : c.textSec,
3010
3026
  display: "flex",
3011
3027
  alignItems: "center",
3012
3028
  gap: "5px",
3013
3029
  fontSize: "13px"
3014
3030
  }
3015
3031
  },
3016
- t.icon,
3017
- t.label
3032
+ r.icon,
3033
+ r.label
3018
3034
  )), /* @__PURE__ */ e.createElement(
3019
3035
  "div",
3020
3036
  {
@@ -3040,8 +3056,8 @@ const _n = e.memo(
3040
3056
  "aria-selected": n === "fields",
3041
3057
  className: "sp-tab",
3042
3058
  onClick: () => o("fields"),
3043
- onKeyDown: (t) => {
3044
- t.key === "Enter" || t.key === " " ? (t.preventDefault(), o("fields")) : t.key === "ArrowRight" ? (t.preventDefault(), o("filters")) : t.key === "ArrowLeft" && (t.preventDefault(), o("columns"));
3059
+ onKeyDown: (r) => {
3060
+ r.key === "Enter" || r.key === " " ? (r.preventDefault(), o("fields")) : r.key === "ArrowRight" ? (r.preventDefault(), o("filters")) : r.key === "ArrowLeft" && (r.preventDefault(), o("columns"));
3045
3061
  },
3046
3062
  style: {
3047
3063
  padding: "8px 10px",
@@ -3060,8 +3076,8 @@ const _n = e.memo(
3060
3076
  "aria-selected": n === "filters",
3061
3077
  className: "sp-tab",
3062
3078
  onClick: () => o("filters"),
3063
- onKeyDown: (t) => {
3064
- t.key === "Enter" || t.key === " " ? (t.preventDefault(), o("filters")) : t.key === "ArrowRight" ? (t.preventDefault(), o("columns")) : t.key === "ArrowLeft" && (t.preventDefault(), o("fields"));
3079
+ onKeyDown: (r) => {
3080
+ r.key === "Enter" || r.key === " " ? (r.preventDefault(), o("filters")) : r.key === "ArrowRight" ? (r.preventDefault(), o("columns")) : r.key === "ArrowLeft" && (r.preventDefault(), o("fields"));
3065
3081
  },
3066
3082
  style: {
3067
3083
  padding: "8px 10px",
@@ -3084,8 +3100,8 @@ const _n = e.memo(
3084
3100
  "aria-selected": n === "columns",
3085
3101
  className: "sp-tab",
3086
3102
  onClick: () => o("columns"),
3087
- onKeyDown: (t) => {
3088
- t.key === "Enter" || t.key === " " ? (t.preventDefault(), o("columns")) : t.key === "ArrowRight" ? (t.preventDefault(), o("fields")) : t.key === "ArrowLeft" && (t.preventDefault(), o("filters"));
3103
+ onKeyDown: (r) => {
3104
+ r.key === "Enter" || r.key === " " ? (r.preventDefault(), o("columns")) : r.key === "ArrowRight" ? (r.preventDefault(), o("fields")) : r.key === "ArrowLeft" && (r.preventDefault(), o("filters"));
3089
3105
  },
3090
3106
  style: {
3091
3107
  padding: "8px 10px",
@@ -3121,19 +3137,19 @@ const _n = e.memo(
3121
3137
  availableFields: A,
3122
3138
  customDimensions: je,
3123
3139
  theme: c,
3124
- styles: Y,
3125
- data: pe,
3126
- valConfigs: S,
3127
- colFields: p,
3140
+ styles: Z,
3141
+ data: de,
3142
+ valConfigs: E,
3143
+ colFields: d,
3128
3144
  setColFields: f,
3129
3145
  setValConfigs: g,
3130
3146
  savedReports: Ar,
3131
3147
  setSavedReports: $r,
3132
3148
  activeReportId: zr,
3133
3149
  setActiveReportId: Fr,
3134
- showNotification: D,
3150
+ showNotification: R,
3135
3151
  requestedSelection: ut,
3136
- showReportConfigColumn: dt,
3152
+ showReportConfigColumn: pt,
3137
3153
  setShowReportConfigColumn: wr
3138
3154
  }
3139
3155
  )) : Oe && De === "fields" ? /* @__PURE__ */ e.createElement("div", { style: { padding: "0 4px" } }, /* @__PURE__ */ e.createElement(
@@ -3142,27 +3158,27 @@ const _n = e.memo(
3142
3158
  availableFields: A,
3143
3159
  customDimensions: je,
3144
3160
  setCustomDimensions: $t,
3145
- data: pe,
3161
+ data: de,
3146
3162
  theme: c,
3147
- showNotification: D,
3163
+ showNotification: R,
3148
3164
  getFieldLabel: ee,
3149
3165
  onDeleteField: Wt
3150
3166
  }
3151
3167
  ), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: c.textSec, textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "6px", padding: "0 2px" } }, /* @__PURE__ */ e.createElement(F.Database, { style: { verticalAlign: "middle", marginRight: "4px" } }), "Available Fields — click to add"), Zt(te.length, bt.length), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px", marginBottom: "14px" } }, bt.map(
3152
3168
  /** @param {any} [f] @returns {any} */
3153
- (t) => {
3154
- const d = S.some(
3169
+ (r) => {
3170
+ const p = E.some(
3155
3171
  /** @param {any} [c] @returns {any} */
3156
- (u) => u && u.field === t && u.agg !== "formula"
3172
+ (u) => u && u.field === r && u.agg !== "formula"
3157
3173
  );
3158
3174
  return /* @__PURE__ */ e.createElement(
3159
3175
  "div",
3160
3176
  {
3161
- key: t,
3177
+ key: r,
3162
3178
  onClick: () => {
3163
- d || g(
3179
+ p || g(
3164
3180
  /** @param {any} [prev] @returns {any} */
3165
- (u) => [...u, { field: t, agg: "sum", label: ee(t) }]
3181
+ (u) => [...u, { field: r, agg: "sum", label: ee(r) }]
3166
3182
  );
3167
3183
  },
3168
3184
  style: {
@@ -3171,17 +3187,17 @@ const _n = e.memo(
3171
3187
  lineHeight: 1.4,
3172
3188
  fontWeight: 500,
3173
3189
  borderRadius: "999px",
3174
- border: `1px solid ${d || c.isDark ? c.border : "#D7DDEA"}`,
3175
- background: d ? c.select || c.headerBg : c.isDark ? c.background : "#ffffff",
3176
- color: d ? c.primary : c.text,
3177
- cursor: d ? "default" : "pointer",
3178
- opacity: d ? 0.6 : 1,
3190
+ border: `1px solid ${p || c.isDark ? c.border : "#D7DDEA"}`,
3191
+ background: p ? c.select || c.headerBg : c.isDark ? c.background : "#ffffff",
3192
+ color: p ? c.primary : c.text,
3193
+ cursor: p ? "default" : "pointer",
3194
+ opacity: p ? 0.6 : 1,
3179
3195
  userSelect: "none"
3180
3196
  },
3181
- title: d ? `${ee(t)} already in values` : `Add ${ee(t)} to values`
3197
+ title: p ? `${ee(r)} already in values` : `Add ${ee(r)} to values`
3182
3198
  },
3183
- ee(t),
3184
- d ? " ✓" : ""
3199
+ ee(r),
3200
+ p ? " ✓" : ""
3185
3201
  );
3186
3202
  }
3187
3203
  ), te.length > 8 && bt.length === 0 && /* @__PURE__ */ e.createElement("div", { style: { width: "100%", padding: "8px 2px", fontSize: "11px", color: c.textSec } }, "No fields match the current search.")), /* @__PURE__ */ e.createElement("div", { style: { borderTop: `1px solid ${c.border}`, paddingTop: "10px", marginBottom: "8px" } }, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "0 2px 8px 2px", flexWrap: "wrap" } }, /* @__PURE__ */ e.createElement("button", { type: "button", onClick: Vt, style: { border: `1px solid ${c.primary}66`, background: `${c.primary}12`, color: c.primary, borderRadius: "999px", cursor: "pointer", padding: "4px 10px", fontSize: "11px", fontWeight: 700 } }, "+ Add Formula"), /* @__PURE__ */ e.createElement("span", { style: { fontSize: "10px", color: c.textSec } }, Pe, " value", Pe === 1 ? "" : "s", " · ", Ae, " formula", Ae === 1 ? "" : "s")), /* @__PURE__ */ e.createElement(
@@ -3193,32 +3209,32 @@ const _n = e.memo(
3193
3209
  valueSelectStyle: ye,
3194
3210
  regularValueCount: Pe
3195
3211
  }
3196
- )), S.map(
3212
+ )), E.map(
3197
3213
  /** @param {any} [item] @param {any} [idx] @returns {any} */
3198
- (t, d) => {
3199
- const u = t && t.agg === "formula";
3200
- if (!t) return null;
3201
- const b = Mr === d;
3214
+ (r, p) => {
3215
+ const u = r && r.agg === "formula";
3216
+ if (!r) return null;
3217
+ const b = Mr === p;
3202
3218
  return /* @__PURE__ */ e.createElement(
3203
3219
  "div",
3204
3220
  {
3205
- key: t.field || d,
3221
+ key: r.field || p,
3206
3222
  draggable: !0,
3207
3223
  onDragStart: () => {
3208
- et.current = d;
3224
+ et.current = p;
3209
3225
  },
3210
3226
  onDragOver: (h) => {
3211
- h.preventDefault(), tt(d);
3227
+ h.preventDefault(), tt(p);
3212
3228
  },
3213
3229
  onDragLeave: () => tt(null),
3214
3230
  onDrop: (h) => {
3215
3231
  h.preventDefault();
3216
- const I = et.current;
3217
- tt(null), et.current = null, !(I === null || I === d) && g(
3232
+ const T = et.current;
3233
+ tt(null), et.current = null, !(T === null || T === p) && g(
3218
3234
  /** @param {any} [prev] @returns {any} */
3219
3235
  (G) => {
3220
- const v = [...G], [H] = v.splice(I, 1);
3221
- return v.splice(d, 0, H), v;
3236
+ const v = [...G], [V] = v.splice(T, 1);
3237
+ return v.splice(p, 0, V), v;
3222
3238
  }
3223
3239
  );
3224
3240
  },
@@ -3227,15 +3243,15 @@ const _n = e.memo(
3227
3243
  },
3228
3244
  style: { marginBottom: "6px", borderTop: b ? `2px solid ${c.primary}` : "2px solid transparent", cursor: "grab" }
3229
3245
  },
3230
- u ? /* @__PURE__ */ e.createElement(ir, { item: t, idx: d, selected: t.field === ge, onSelect: Kt, onRemove: Ge, setValConfigs: g, theme: c, styles: Y, dropLine: null, zoneId: "vals", valueSelectStyle: ye, colFields: p, fixedSparklineValueKeySet: xt, showNotification: D, serverError: We && We[t.field] || null }) : /* @__PURE__ */ e.createElement("div", { style: { ...Y.chip, flexWrap: "wrap", alignItems: "flex-start" } }, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement(F.DragIndicator, { style: { flexShrink: 0, opacity: 0.4 } }), /* @__PURE__ */ e.createElement("b", { style: { fontWeight: 500, minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, ee(t.field))), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "4px", marginLeft: "8px", flexWrap: "nowrap", flexShrink: 0 } }, /* @__PURE__ */ e.createElement(re, { size: "sm", "aria-label": "Aggregation", value: t.agg, onClick: (h) => h.stopPropagation(), onChange: (h) => jt(d, h.target.value), style: { ...ye, width: "78px" } }, /* @__PURE__ */ e.createElement("option", { value: "sum" }, "Sum"), /* @__PURE__ */ e.createElement("option", { value: "avg" }, "Avg"), /* @__PURE__ */ e.createElement("option", { value: "count" }, "Cnt"), /* @__PURE__ */ e.createElement("option", { value: "min" }, "Min"), /* @__PURE__ */ e.createElement("option", { value: "max" }, "Max"), /* @__PURE__ */ e.createElement("option", { value: "weighted_avg" }, "WAvg")), /* @__PURE__ */ e.createElement("span", { onClick: () => Ge(d), style: { cursor: "pointer", color: "#9CA3AF", display: "flex", alignItems: "center" } }, /* @__PURE__ */ e.createElement(F.Close, null))))
3246
+ u ? /* @__PURE__ */ e.createElement(ir, { item: r, idx: p, selected: r.field === ge, onSelect: Kt, onRemove: Ge, setValConfigs: g, theme: c, styles: Z, dropLine: null, zoneId: "vals", valueSelectStyle: ye, colFields: d, fixedSparklineValueKeySet: xt, showNotification: R, serverError: We && We[r.field] || null }) : /* @__PURE__ */ e.createElement("div", { style: { ...Z.chip, flexWrap: "wrap", alignItems: "flex-start" } }, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement(F.DragIndicator, { style: { flexShrink: 0, opacity: 0.4 } }), /* @__PURE__ */ e.createElement("b", { style: { fontWeight: 500, minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, ee(r.field))), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "4px", marginLeft: "8px", flexWrap: "nowrap", flexShrink: 0 } }, /* @__PURE__ */ e.createElement(re, { size: "sm", "aria-label": "Aggregation", value: r.agg, onClick: (h) => h.stopPropagation(), onChange: (h) => jt(p, h.target.value), style: { ...ye, width: "78px" } }, /* @__PURE__ */ e.createElement("option", { value: "sum" }, "Sum"), /* @__PURE__ */ e.createElement("option", { value: "avg" }, "Avg"), /* @__PURE__ */ e.createElement("option", { value: "count" }, "Cnt"), /* @__PURE__ */ e.createElement("option", { value: "min" }, "Min"), /* @__PURE__ */ e.createElement("option", { value: "max" }, "Max"), /* @__PURE__ */ e.createElement("option", { value: "weighted_avg" }, "WAvg")), /* @__PURE__ */ e.createElement("span", { onClick: () => Ge(p), style: { cursor: "pointer", color: "#9CA3AF", display: "flex", alignItems: "center" } }, /* @__PURE__ */ e.createElement(F.Close, null))))
3231
3247
  );
3232
3248
  }
3233
- ), S.length === 0 && /* @__PURE__ */ e.createElement("div", { style: { opacity: 0.5, fontSize: "11px", padding: "12px", textAlign: "center" } }, "No value fields. Click a field above or add a formula.")) : !Oe && n === "filters" ? /* @__PURE__ */ e.createElement("div", { style: { flex: 1, overflowY: "auto", display: "flex", flexDirection: "column", padding: "8px" } }, /* @__PURE__ */ e.createElement("div", { style: { marginBottom: "10px", display: "flex", alignItems: "center", background: c.background, borderRadius: "6px", padding: "4px 8px", border: `1px solid ${c.border}` } }, /* @__PURE__ */ e.createElement(F.Search, null), /* @__PURE__ */ e.createElement(
3249
+ ), E.length === 0 && /* @__PURE__ */ e.createElement("div", { style: { opacity: 0.5, fontSize: "11px", padding: "12px", textAlign: "center" } }, "No value fields. Click a field above or add a formula.")) : !Oe && n === "filters" ? /* @__PURE__ */ e.createElement("div", { style: { flex: 1, overflowY: "auto", display: "flex", flexDirection: "column", padding: "8px" } }, /* @__PURE__ */ e.createElement("div", { style: { marginBottom: "10px", display: "flex", alignItems: "center", background: c.background, borderRadius: "6px", padding: "4px 8px", border: `1px solid ${c.border}` } }, /* @__PURE__ */ e.createElement(F.Search, null), /* @__PURE__ */ e.createElement(
3234
3250
  "input",
3235
3251
  {
3236
3252
  placeholder: "Search columns...",
3237
- value: R,
3238
- onChange: (t) => O(t.target.value),
3253
+ value: C,
3254
+ onChange: (r) => O(r.target.value),
3239
3255
  style: { border: "none", background: "transparent", marginLeft: "10px", outline: "none", width: "100%", color: c.text, fontSize: "13px" }
3240
3256
  }
3241
3257
  )), (() => {
@@ -3249,7 +3265,7 @@ const _n = e.memo(
3249
3265
  /** @param {any} [col] @returns {any} */
3250
3266
  (b) => {
3251
3267
  const h = b.columnDef && typeof b.columnDef.header == "string" ? b.columnDef.header : typeof b.header == "string" ? b.header : b.id;
3252
- return String(h).toLowerCase().includes(R.toLowerCase()) || b.id.toLowerCase().includes(R.toLowerCase());
3268
+ return String(h).toLowerCase().includes(C.toLowerCase()) || b.id.toLowerCase().includes(C.toLowerCase());
3253
3269
  }
3254
3270
  );
3255
3271
  return /* @__PURE__ */ e.createElement("div", { style: { display: "flex", flexDirection: "column" } }, u.map(
@@ -3260,23 +3276,23 @@ const _n = e.memo(
3260
3276
  key: b.id,
3261
3277
  column: b,
3262
3278
  theme: c,
3263
- styles: Y,
3279
+ styles: Z,
3264
3280
  onFilter: (
3265
3281
  /** @param {any} [val] @returns {any} */
3266
- ((h) => j(b.id, h))
3282
+ ((h) => D(b.id, h))
3267
3283
  ),
3268
3284
  currentFilter: ce[b.id],
3269
3285
  options: Ut(b.id),
3270
3286
  optionMeta: _e && _e[b.id],
3271
3287
  onSearchOptions: Je ? (
3272
3288
  /** @param {any} [search] @returns {any} */
3273
- ((h) => V && V(b.id, { search: h, offset: 0 }))
3289
+ ((h) => Y && Y(b.id, { search: h, offset: 0 }))
3274
3290
  ) : void 0,
3275
3291
  onLoadMoreOptions: Je ? (
3276
3292
  /** @param {any} [search] @param {any} [offset] @returns {any} */
3277
- ((h, I) => V && V(b.id, { search: h, offset: I }))
3293
+ ((h, T) => Y && Y(b.id, { search: h, offset: T }))
3278
3294
  ) : void 0,
3279
- onOpen: V
3295
+ onOpen: Y
3280
3296
  }
3281
3297
  )
3282
3298
  ));
@@ -3286,13 +3302,13 @@ const _n = e.memo(
3286
3302
  availableFields: A,
3287
3303
  customDimensions: je,
3288
3304
  setCustomDimensions: $t,
3289
- data: pe,
3305
+ data: de,
3290
3306
  theme: c,
3291
- showNotification: D,
3307
+ showNotification: R,
3292
3308
  getFieldLabel: ee,
3293
3309
  onDeleteField: Wt
3294
3310
  }
3295
- ), /* @__PURE__ */ e.createElement("div", { style: Y.sectionTitleSm }, /* @__PURE__ */ e.createElement(F.Database, null), " Available Fields"), Zt(Le.length, yt.length), /* @__PURE__ */ e.createElement(
3311
+ ), /* @__PURE__ */ e.createElement("div", { style: Z.sectionTitleSm }, /* @__PURE__ */ e.createElement(F.Database, null), " Available Fields"), Zt(Le.length, yt.length), /* @__PURE__ */ e.createElement(
3296
3312
  sr,
3297
3313
  {
3298
3314
  panelId: "availableFields",
@@ -3302,7 +3318,7 @@ const _n = e.memo(
3302
3318
  getSidebarWidth: Lt,
3303
3319
  onSidebarWidthChange: Pt,
3304
3320
  theme: c,
3305
- outerStyle: Nt,
3321
+ outerStyle: Ht,
3306
3322
  contentStyle: {
3307
3323
  display: "flex",
3308
3324
  flexWrap: "wrap",
@@ -3313,33 +3329,33 @@ const _n = e.memo(
3313
3329
  },
3314
3330
  yt.map(
3315
3331
  /** @param {any} [f] @returns {any} */
3316
- (t) => {
3317
- const d = Ke && t === he, u = d ? "Measure Names" : ee(t), b = d ? "measureAxis" : "pool";
3332
+ (r) => {
3333
+ const p = Ke && r === ve, u = p ? "Measure Names" : ee(r), b = p ? "measureAxis" : "pool";
3318
3334
  return /* @__PURE__ */ e.createElement(
3319
3335
  "div",
3320
3336
  {
3321
- key: d ? `__measure_axis__${t}` : t,
3337
+ key: p ? `__measure_axis__${r}` : r,
3322
3338
  draggable: !0,
3323
- "data-sidebar-field-chip": d ? "measure-axis-label" : "available",
3339
+ "data-sidebar-field-chip": p ? "measure-axis-label" : "available",
3324
3340
  role: "button",
3325
3341
  tabIndex: 0,
3326
3342
  "aria-describedby": "pivot-sidebar-keyboard-dnd-help",
3327
- "aria-grabbed": X && X.zone === b && X.field === t ? "true" : "false",
3343
+ "aria-grabbed": X && X.zone === b && X.field === r ? "true" : "false",
3328
3344
  "aria-label": `Move ${u}`,
3329
- onDragStart: (h) => N(h, t, b),
3345
+ onDragStart: (h) => K(h, r, b),
3330
3346
  onDragEnd: $,
3331
- onKeyDown: (h) => Bt(h, t, b, -1, u),
3332
- title: d ? "Drag to Rows or Columns to show measure names" : `Move ${ee(t)}`,
3347
+ onKeyDown: (h) => Bt(h, r, b, -1, u),
3348
+ title: p ? "Drag to Rows or Columns to show measure names" : `Move ${ee(r)}`,
3333
3349
  style: {
3334
3350
  padding: "4px 8px",
3335
3351
  fontSize: "11px",
3336
3352
  lineHeight: 1.2,
3337
- fontWeight: d ? 700 : 500,
3353
+ fontWeight: p ? 700 : 500,
3338
3354
  fontFamily: "'Inter', ui-sans-serif, system-ui, sans-serif",
3339
3355
  borderRadius: c.radiusSm || c.radius || "10px",
3340
- border: d ? `1px dashed ${c.primary}` : `1px solid ${c.isDark ? c.border : "#D7DDEA"}`,
3341
- background: d ? `${c.primary}12` : c.isDark ? c.background : c.surfaceInset || "#ffffff",
3342
- color: d ? c.primary : c.isDark ? c.text : "#334155",
3356
+ border: p ? `1px dashed ${c.primary}` : `1px solid ${c.isDark ? c.border : "#D7DDEA"}`,
3357
+ background: p ? `${c.primary}12` : c.isDark ? c.background : c.surfaceInset || "#ffffff",
3358
+ color: p ? c.primary : c.isDark ? c.text : "#334155",
3343
3359
  display: "inline-flex",
3344
3360
  alignItems: "center",
3345
3361
  gap: "4px",
@@ -3349,7 +3365,7 @@ const _n = e.memo(
3349
3365
  minHeight: "24px"
3350
3366
  }
3351
3367
  },
3352
- d && /* @__PURE__ */ e.createElement(F.Sigma, null),
3368
+ p && /* @__PURE__ */ e.createElement(F.Sigma, null),
3353
3369
  u
3354
3370
  );
3355
3371
  }
@@ -3357,9 +3373,9 @@ const _n = e.memo(
3357
3373
  Le.length > 8 && yt.length === 0 && /* @__PURE__ */ e.createElement("div", { style: { width: "100%", padding: "8px 2px", fontSize: "11px", color: c.textSec } }, "No fields match the current search.")
3358
3374
  )), Wr.map(
3359
3375
  /** @param {any} [zone] @returns {any} */
3360
- (t) => {
3361
- const d = Ze[t.id] || [];
3362
- return /* @__PURE__ */ e.createElement("div", { key: t.id, style: { marginBottom: "20px", flexShrink: 0 } }, /* @__PURE__ */ e.createElement("div", { style: Y.sectionTitle }, t.icon, t.label), t.id === "vals" && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "0 4px 8px 4px", flexWrap: "wrap" } }, /* @__PURE__ */ e.createElement(
3376
+ (r) => {
3377
+ const p = Ze[r.id] || [];
3378
+ return /* @__PURE__ */ e.createElement("div", { key: r.id, style: { marginBottom: "20px", flexShrink: 0 } }, /* @__PURE__ */ e.createElement("div", { style: Z.sectionTitle }, r.icon, r.label), r.id === "vals" && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "0 4px 8px 4px", flexWrap: "wrap" } }, /* @__PURE__ */ e.createElement(
3363
3379
  "button",
3364
3380
  {
3365
3381
  type: "button",
@@ -3385,7 +3401,7 @@ const _n = e.memo(
3385
3401
  valueSelectStyle: ye,
3386
3402
  regularValueCount: Pe
3387
3403
  }
3388
- )), t.id === "rows" && a.length > 0 && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px", padding: "0 4px 6px 4px" } }, /* @__PURE__ */ e.createElement(
3404
+ )), r.id === "rows" && a.length > 0 && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px", padding: "0 4px 6px 4px" } }, /* @__PURE__ */ e.createElement(
3389
3405
  "button",
3390
3406
  {
3391
3407
  title: "Expand all hierarchy levels",
@@ -3404,34 +3420,34 @@ const _n = e.memo(
3404
3420
  )), /* @__PURE__ */ e.createElement(
3405
3421
  sr,
3406
3422
  {
3407
- panelId: t.id,
3408
- panelLabel: t.label,
3409
- size: fe && fe[t.id],
3423
+ panelId: r.id,
3424
+ panelLabel: r.label,
3425
+ size: fe && fe[r.id],
3410
3426
  onSizeChange: Ot,
3411
3427
  getSidebarWidth: Lt,
3412
3428
  onSidebarWidthChange: Pt,
3413
3429
  theme: c,
3414
- outerStyle: Nt,
3415
- contentStyle: { padding: `${Ht} 12px 12px ${Ht}` }
3430
+ outerStyle: Ht,
3431
+ contentStyle: { padding: `${Nt} 12px 12px ${Nt}` }
3416
3432
  },
3417
3433
  /* @__PURE__ */ e.createElement(
3418
3434
  "div",
3419
3435
  {
3420
- "data-sidebar-drop-zone": t.id,
3436
+ "data-sidebar-drop-zone": r.id,
3421
3437
  role: "group",
3422
3438
  tabIndex: 0,
3423
- "aria-label": `${t.label} drop zone`,
3439
+ "aria-label": `${r.label} drop zone`,
3424
3440
  "aria-describedby": "pivot-sidebar-keyboard-dnd-help",
3425
- onKeyDown: (u) => Tr(u, t.id),
3441
+ onKeyDown: (u) => Ir(u, r.id),
3426
3442
  onDragOver: (u) => {
3427
- u.target === u.currentTarget ? L(u, t.id, d.length) : (u.preventDefault(), u.dataTransfer && (u.dataTransfer.dropEffect = "move"));
3443
+ u.target === u.currentTarget ? L(u, r.id, p.length) : (u.preventDefault(), u.dataTransfer && (u.dataTransfer.dropEffect = "move"));
3428
3444
  },
3429
- onDrop: (u) => m(u, t.id)
3445
+ onDrop: (u) => m(u, r.id)
3430
3446
  },
3431
- d.map(
3447
+ p.map(
3432
3448
  /** @param {any} [item] @param {any} [idx] @returns {any} */
3433
3449
  (u, b) => {
3434
- const h = t.id === "vals" ? u.field : u, I = t.id === "vals" ? u.agg === "formula" ? u.label || "Formula" : ee(u.field) : ee(u), G = (t.id === "rows" || t.id === "cols") && h === he && _t.placement !== "none";
3450
+ const h = r.id === "vals" ? u.field : u, T = r.id === "vals" ? u.agg === "formula" ? u.label || "Formula" : ee(u.field) : ee(u), G = (r.id === "rows" || r.id === "cols") && h === ve && _t.placement !== "none";
3435
3451
  return /* @__PURE__ */ e.createElement(
3436
3452
  "div",
3437
3453
  {
@@ -3441,39 +3457,39 @@ const _n = e.memo(
3441
3457
  role: "button",
3442
3458
  tabIndex: 0,
3443
3459
  "aria-describedby": "pivot-sidebar-keyboard-dnd-help",
3444
- "aria-grabbed": X && X.zone === t.id && X.idx === b ? "true" : "false",
3445
- "aria-label": `Move ${I}`,
3446
- onKeyDown: (v) => Bt(v, u, t.id, b, I),
3447
- onDragStart: (v) => N(v, u, t.id, b),
3448
- onDragOver: (v) => L(v, t.id, b),
3460
+ "aria-grabbed": X && X.zone === r.id && X.idx === b ? "true" : "false",
3461
+ "aria-label": `Move ${T}`,
3462
+ onKeyDown: (v) => Bt(v, u, r.id, b, T),
3463
+ onDragStart: (v) => K(v, u, r.id, b),
3464
+ onDragOver: (v) => L(v, r.id, b),
3449
3465
  onDragEnd: $
3450
3466
  },
3451
- t.id === "vals" && u.agg === "formula" ? /* @__PURE__ */ e.createElement(
3467
+ r.id === "vals" && u.agg === "formula" ? /* @__PURE__ */ e.createElement(
3452
3468
  ir,
3453
3469
  {
3454
3470
  item: u,
3455
3471
  idx: b,
3456
- selected: u.field === Te,
3472
+ selected: u.field === Ie,
3457
3473
  onSelect: Kt,
3458
3474
  onRemove: Ge,
3459
3475
  setValConfigs: g,
3460
3476
  theme: c,
3461
- styles: Y,
3477
+ styles: Z,
3462
3478
  dropLine: _,
3463
- zoneId: t.id,
3479
+ zoneId: r.id,
3464
3480
  valueSelectStyle: ye,
3465
- colFields: p,
3481
+ colFields: d,
3466
3482
  fixedSparklineValueKeySet: xt,
3467
- showNotification: D,
3483
+ showNotification: R,
3468
3484
  serverError: We && We[u.field] || null
3469
3485
  }
3470
3486
  ) : /* @__PURE__ */ e.createElement("div", { style: {
3471
- ...Y.chip,
3472
- ...t.id === "vals" ? { flexWrap: "wrap", alignItems: "flex-start" } : {}
3473
- } }, _ && _.zone === t.id && _.idx === b && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...Y.dropLine, top: -2 } }), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement(F.DragIndicator, null), /* @__PURE__ */ e.createElement("b", { style: { fontWeight: 500, display: "block", minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, I)), t.id === "vals" && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "4px", marginLeft: "8px", flexWrap: "nowrap", flexShrink: 0 } }, /* @__PURE__ */ e.createElement(re, { size: "sm", value: u.agg, onClick: (v) => v.stopPropagation(), onChange: (v) => jt(b, v.target.value), style: { ...ye, width: "78px" }, title: "Aggregation" }, /* @__PURE__ */ e.createElement("option", { value: "sum" }, "Sum"), /* @__PURE__ */ e.createElement("option", { value: "avg" }, "Avg"), /* @__PURE__ */ e.createElement("option", { value: "count" }, "Cnt"), /* @__PURE__ */ e.createElement("option", { value: "min" }, "Min"), /* @__PURE__ */ e.createElement("option", { value: "max" }, "Max"), /* @__PURE__ */ e.createElement("option", { value: "weighted_avg" }, "WAvg"), /* @__PURE__ */ e.createElement("option", { value: "array_agg" }, "Series")), Xt(u.agg) && /* @__PURE__ */ e.createElement(re, { size: "sm", value: u.weightField || "", onClick: (v) => v.stopPropagation(), onChange: (v) => Br(b, v.target.value), style: { ...ye, width: "96px" }, title: "Weight field" }, /* @__PURE__ */ e.createElement("option", { value: "", disabled: !0 }, "Weight"), te.map(
3487
+ ...Z.chip,
3488
+ ...r.id === "vals" ? { flexWrap: "wrap", alignItems: "flex-start" } : {}
3489
+ } }, _ && _.zone === r.id && _.idx === b && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...Z.dropLine, top: -2 } }), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0, flex: 1 } }, /* @__PURE__ */ e.createElement(F.DragIndicator, null), /* @__PURE__ */ e.createElement("b", { style: { fontWeight: 500, display: "block", minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, T)), r.id === "vals" && /* @__PURE__ */ e.createElement("div", { style: { display: "flex", alignItems: "center", gap: "4px", marginLeft: "8px", flexWrap: "nowrap", flexShrink: 0 } }, /* @__PURE__ */ e.createElement(re, { size: "sm", value: u.agg, onClick: (v) => v.stopPropagation(), onChange: (v) => jt(b, v.target.value), style: { ...ye, width: "78px" }, title: "Aggregation" }, /* @__PURE__ */ e.createElement("option", { value: "sum" }, "Sum"), /* @__PURE__ */ e.createElement("option", { value: "avg" }, "Avg"), /* @__PURE__ */ e.createElement("option", { value: "count" }, "Cnt"), /* @__PURE__ */ e.createElement("option", { value: "min" }, "Min"), /* @__PURE__ */ e.createElement("option", { value: "max" }, "Max"), /* @__PURE__ */ e.createElement("option", { value: "weighted_avg" }, "WAvg"), /* @__PURE__ */ e.createElement("option", { value: "array_agg" }, "Series")), Xt(u.agg) && /* @__PURE__ */ e.createElement(re, { size: "sm", value: u.weightField || "", onClick: (v) => v.stopPropagation(), onChange: (v) => Br(b, v.target.value), style: { ...ye, width: "96px" }, title: "Weight field" }, /* @__PURE__ */ e.createElement("option", { value: "", disabled: !0 }, "Weight"), te.map(
3474
3490
  /** @param {any} [fieldName] @returns {any} */
3475
3491
  (v) => /* @__PURE__ */ e.createElement("option", { key: v, value: v }, ee(v))
3476
- )), /* @__PURE__ */ e.createElement(re, { size: "sm", "aria-label": "Window calculation", value: u.windowFn || "none", onClick: (v) => v.stopPropagation(), onChange: (v) => Lr(b, v.target.value), style: { ...ye, width: "68px" } }, /* @__PURE__ */ e.createElement("option", { value: "none" }, "Norm"), /* @__PURE__ */ e.createElement("option", { value: "percent_of_row" }, "%Row"), /* @__PURE__ */ e.createElement("option", { value: "percent_of_col" }, "%Col"), /* @__PURE__ */ e.createElement("option", { value: "percent_of_grand_total" }, "%Tot"))), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px", marginLeft: "auto", alignItems: "center" } }, t.id === "filter" && /* @__PURE__ */ e.createElement("div", { onClick: (v) => Pr(v, h), style: { cursor: "pointer", display: "flex", alignItems: "center", padding: "2px", borderRadius: "4px" } }, /* @__PURE__ */ e.createElement(F.Filter, null)), /* @__PURE__ */ e.createElement("span", { onClick: () => {
3492
+ )), /* @__PURE__ */ e.createElement(re, { size: "sm", "aria-label": "Window calculation", value: u.windowFn || "none", onClick: (v) => v.stopPropagation(), onChange: (v) => Lr(b, v.target.value), style: { ...ye, width: "68px" } }, /* @__PURE__ */ e.createElement("option", { value: "none" }, "Norm"), /* @__PURE__ */ e.createElement("option", { value: "percent_of_row" }, "%Row"), /* @__PURE__ */ e.createElement("option", { value: "percent_of_col" }, "%Col"), /* @__PURE__ */ e.createElement("option", { value: "percent_of_grand_total" }, "%Tot"))), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px", marginLeft: "auto", alignItems: "center" } }, r.id === "filter" && /* @__PURE__ */ e.createElement("div", { onClick: (v) => Pr(v, h), style: { cursor: "pointer", display: "flex", alignItems: "center", padding: "2px", borderRadius: "4px" } }, /* @__PURE__ */ e.createElement(F.Filter, null)), /* @__PURE__ */ e.createElement("span", { onClick: () => {
3477
3493
  if (G && typeof s == "function") {
3478
3494
  s(
3479
3495
  /** @param {any} [previous] @returns {any} */
@@ -3481,62 +3497,62 @@ const _n = e.memo(
3481
3497
  ...qe(v),
3482
3498
  placement: "none"
3483
3499
  })
3484
- ), t.id === "rows" && l(
3500
+ ), r.id === "rows" && l(
3485
3501
  /** @param {any} [p] @returns {any} */
3486
3502
  (v) => Array.isArray(v) ? v.filter(
3487
3503
  /** @param {any} [x] @returns {any} */
3488
- (H) => H !== h
3504
+ (V) => V !== h
3489
3505
  ) : v
3490
- ), t.id === "cols" && f(
3506
+ ), r.id === "cols" && f(
3491
3507
  /** @param {any} [p] @returns {any} */
3492
3508
  (v) => Array.isArray(v) ? v.filter(
3493
3509
  /** @param {any} [x] @returns {any} */
3494
- (H) => H !== h
3510
+ (V) => V !== h
3495
3511
  ) : v
3496
3512
  );
3497
3513
  return;
3498
3514
  }
3499
- if (t.id === "filter") {
3515
+ if (r.id === "filter") {
3500
3516
  const v = { ...ce };
3501
- delete v[h], pt(v);
3517
+ delete v[h], dt(v);
3502
3518
  }
3503
- t.id === "rows" && l(
3519
+ r.id === "rows" && l(
3504
3520
  /** @param {any} [p] @returns {any} */
3505
3521
  (v) => v.filter(
3506
3522
  /** @param {any} [x] @returns {any} */
3507
- (H) => H !== h
3523
+ (V) => V !== h
3508
3524
  )
3509
- ), t.id === "cols" && f(
3525
+ ), r.id === "cols" && f(
3510
3526
  /** @param {any} [p] @returns {any} */
3511
3527
  (v) => v.filter(
3512
3528
  /** @param {any} [x] @returns {any} */
3513
- (H) => H !== h
3529
+ (V) => V !== h
3514
3530
  )
3515
- ), t.id === "vals" && Ge(b);
3516
- }, className: "sp-chip-remove", style: { cursor: "pointer", color: "#9CA3AF", display: "flex", alignItems: "center" } }, /* @__PURE__ */ e.createElement(F.Close, null))), t.id === "filter" && Qe.columnId === h && /* @__PURE__ */ e.createElement(
3531
+ ), r.id === "vals" && Ge(b);
3532
+ }, className: "sp-chip-remove", style: { cursor: "pointer", color: "#9CA3AF", display: "flex", alignItems: "center" } }, /* @__PURE__ */ e.createElement(F.Close, null))), r.id === "filter" && Qe.columnId === h && /* @__PURE__ */ e.createElement(
3517
3533
  Jr,
3518
3534
  {
3519
- column: { header: I, id: h },
3535
+ column: { header: T, id: h },
3520
3536
  anchorEl: Qe.anchorEl,
3521
3537
  onClose: Or,
3522
3538
  onFilter: (
3523
3539
  /** @param {any} [filterValue] @returns {any} */
3524
- ((v) => j(h, v))
3540
+ ((v) => D(h, v))
3525
3541
  ),
3526
3542
  currentFilter: ce[h],
3527
3543
  options: Ut(h),
3528
3544
  optionMeta: _e && _e[h],
3529
3545
  onSearchOptions: Je ? (
3530
3546
  /** @param {any} [search] @returns {any} */
3531
- ((v) => V && V(h, { search: v, offset: 0 }))
3547
+ ((v) => Y && Y(h, { search: v, offset: 0 }))
3532
3548
  ) : void 0,
3533
3549
  onLoadMoreOptions: Je ? (
3534
3550
  /** @param {any} [search] @param {any} [offset] @returns {any} */
3535
- ((v, H) => V && V(h, { search: v, offset: H }))
3551
+ ((v, V) => Y && Y(h, { search: v, offset: V }))
3536
3552
  ) : void 0,
3537
3553
  theme: c
3538
3554
  }
3539
- ), t.id === "vals" && /* @__PURE__ */ e.createElement(
3555
+ ), r.id === "vals" && /* @__PURE__ */ e.createElement(
3540
3556
  kr,
3541
3557
  {
3542
3558
  item: u,
@@ -3544,20 +3560,20 @@ const _n = e.memo(
3544
3560
  setValConfigs: g,
3545
3561
  theme: c,
3546
3562
  valueSelectStyle: ye,
3547
- colFields: p,
3563
+ colFields: d,
3548
3564
  fixedSparklineValueKeySet: xt,
3549
- showNotification: D
3565
+ showNotification: R
3550
3566
  }
3551
- ), _ && _.zone === t.id && _.idx === b + 1 && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...Y.dropLine, bottom: -2 } })),
3552
- t.id === "filter" && ce[h] && ce[h].conditions && /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: c.primary, padding: "0 8px 4px 8px", marginTop: "-4px" } }, ce[h].conditions.map(
3567
+ ), _ && _.zone === r.id && _.idx === b + 1 && /* @__PURE__ */ e.createElement("div", { className: "sp-drop-line", style: { ...Z.dropLine, bottom: -2 } })),
3568
+ r.id === "filter" && ce[h] && ce[h].conditions && /* @__PURE__ */ e.createElement("div", { style: { fontSize: "10px", color: c.primary, padding: "0 8px 4px 8px", marginTop: "-4px" } }, ce[h].conditions.map(
3553
3569
  /** @param {any} [c] @returns {any} */
3554
3570
  (v) => `${v.type}: ${v.value}${v.caseSensitive ? " (Match Case)" : ""}`
3555
3571
  ).join(` ${ce[h].operator} `))
3556
3572
  );
3557
3573
  }
3558
3574
  ),
3559
- d.length === 0 && /* @__PURE__ */ e.createElement("div", { style: { opacity: 0.5, fontSize: "11px", padding: "8px", textAlign: "center", pointerEvents: "none" } }, "Drag fields here"),
3560
- /* @__PURE__ */ e.createElement("div", { style: { height: 20 }, onDragOver: (u) => L(u, t.id, d.length), onDrop: (u) => m(u, t.id) })
3575
+ p.length === 0 && /* @__PURE__ */ e.createElement("div", { style: { opacity: 0.5, fontSize: "11px", padding: "8px", textAlign: "center", pointerEvents: "none" } }, "Drag fields here"),
3576
+ /* @__PURE__ */ e.createElement("div", { style: { height: 20 }, onDragOver: (u) => L(u, r.id, p.length), onDrop: (u) => m(u, r.id) })
3561
3577
  )
3562
3578
  ));
3563
3579
  }
@@ -3565,8 +3581,8 @@ const _n = e.memo(
3565
3581
  "input",
3566
3582
  {
3567
3583
  placeholder: "Search columns...",
3568
- value: R,
3569
- onChange: (t) => O(t.target.value),
3584
+ value: C,
3585
+ onChange: (r) => O(r.target.value),
3570
3586
  style: {
3571
3587
  border: "none",
3572
3588
  background: "transparent",
@@ -3578,7 +3594,7 @@ const _n = e.memo(
3578
3594
  fontWeight: 500
3579
3595
  }
3580
3596
  }
3581
- ), R && /* @__PURE__ */ e.createElement(
3597
+ ), C && /* @__PURE__ */ e.createElement(
3582
3598
  "button",
3583
3599
  {
3584
3600
  type: "button",
@@ -3603,102 +3619,105 @@ const _n = e.memo(
3603
3619
  { value: "number", label: "Numbers", Icon: F.TypeNumber },
3604
3620
  { value: "string", label: "Text", Icon: F.TypeText },
3605
3621
  { value: "date", label: "Dates", Icon: F.TypeDate }
3606
- ].map((t) => {
3607
- const d = i === t.value, u = t.Icon;
3622
+ ].map((r) => {
3623
+ const p = i === r.value, u = r.Icon;
3608
3624
  return /* @__PURE__ */ e.createElement(
3609
3625
  "button",
3610
3626
  {
3611
- key: t.value,
3627
+ key: r.value,
3612
3628
  type: "button",
3613
- className: `sp-btn ${d ? "sp-btn-primary" : "sp-btn-subtle"}`,
3614
- onClick: () => k(t.value),
3629
+ className: `sp-btn ${p ? "sp-btn-primary" : "sp-btn-subtle"}`,
3630
+ onClick: () => S(r.value),
3615
3631
  style: {
3616
3632
  padding: "6px 10px",
3617
3633
  borderRadius: "8px",
3618
- border: `1px solid ${d ? c.primary : c.border}`,
3619
- background: d ? c.primary : c.surfaceBg || c.background,
3620
- color: d ? "#fff" : c.text,
3634
+ border: `1px solid ${p ? c.primary : c.border}`,
3635
+ background: p ? c.primary : c.surfaceBg || c.background,
3636
+ color: p ? "#fff" : c.text,
3621
3637
  cursor: "pointer",
3622
3638
  fontSize: "11px",
3623
3639
  fontWeight: 600,
3624
3640
  display: "inline-flex",
3625
3641
  alignItems: "center",
3626
3642
  gap: "5px",
3627
- boxShadow: d ? "0 2px 6px rgba(0,0,0,0.12)" : "none"
3643
+ boxShadow: p ? "0 2px 6px rgba(0,0,0,0.12)" : "none"
3628
3644
  }
3629
3645
  },
3630
3646
  /* @__PURE__ */ e.createElement(u, null),
3631
- /* @__PURE__ */ e.createElement("span", null, t.label)
3647
+ /* @__PURE__ */ e.createElement("span", null, r.label)
3632
3648
  );
3633
- }))), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", padding: "0 8px" } }, /* @__PURE__ */ e.createElement(
3649
+ }))), /* @__PURE__ */ e.createElement("div", { style: { display: "grid", gridTemplateColumns: "repeat(3, minmax(0, 1fr))", gap: "4px", padding: "0 8px" } }, /* @__PURE__ */ e.createElement(
3634
3650
  "button",
3635
3651
  {
3652
+ type: "button",
3653
+ className: "sp-btn sp-btn-subtle",
3636
3654
  onClick: () => y.toggleAllColumnsVisible(!0),
3655
+ title: "Show All Columns",
3637
3656
  style: {
3638
- ...Y.btn,
3639
- padding: "8px 12px",
3657
+ ...Z.btn,
3658
+ padding: "6px 4px",
3640
3659
  fontSize: "11px",
3641
- flex: 1,
3660
+ gap: "4px",
3661
+ minWidth: 0,
3642
3662
  justifyContent: "center",
3643
3663
  background: c.background,
3644
3664
  fontWeight: 600,
3645
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
3646
- transition: "all 0.2s"
3647
- },
3648
- onMouseEnter: (t) => t.currentTarget.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)",
3649
- onMouseLeave: (t) => t.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.05)"
3665
+ boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
3666
+ }
3650
3667
  },
3651
- /* @__PURE__ */ e.createElement(F.Visibility, { style: { fontSize: "14px" } }),
3652
- /* @__PURE__ */ e.createElement("span", null, "Show All")
3668
+ /* @__PURE__ */ e.createElement(F.Visibility, { style: { fontSize: "13px", flexShrink: 0 } }),
3669
+ /* @__PURE__ */ e.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, "Show")
3653
3670
  ), /* @__PURE__ */ e.createElement(
3654
3671
  "button",
3655
3672
  {
3673
+ type: "button",
3674
+ className: "sp-btn sp-btn-subtle",
3656
3675
  onClick: () => y.toggleAllColumnsVisible(!1),
3676
+ title: "Hide All Columns",
3657
3677
  style: {
3658
- ...Y.btn,
3659
- padding: "8px 12px",
3678
+ ...Z.btn,
3679
+ padding: "6px 4px",
3660
3680
  fontSize: "11px",
3661
- flex: 1,
3681
+ gap: "4px",
3682
+ minWidth: 0,
3662
3683
  justifyContent: "center",
3663
3684
  background: c.background,
3664
3685
  fontWeight: 600,
3665
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
3666
- transition: "all 0.2s"
3667
- },
3668
- onMouseEnter: (t) => t.currentTarget.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)",
3669
- onMouseLeave: (t) => t.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.05)"
3686
+ boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
3687
+ }
3670
3688
  },
3671
- /* @__PURE__ */ e.createElement(F.VisibilityOff, { style: { fontSize: "14px" } }),
3672
- /* @__PURE__ */ e.createElement("span", null, "Hide All")
3689
+ /* @__PURE__ */ e.createElement(F.VisibilityOff, { style: { fontSize: "13px", flexShrink: 0 } }),
3690
+ /* @__PURE__ */ e.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, "Hide")
3673
3691
  ), /* @__PURE__ */ e.createElement(
3674
3692
  "button",
3675
3693
  {
3694
+ type: "button",
3695
+ className: "sp-btn sp-btn-subtle",
3676
3696
  onClick: () => Q(!1),
3697
+ title: "Unpin All Columns",
3677
3698
  style: {
3678
- ...Y.btn,
3679
- padding: "8px 12px",
3699
+ ...Z.btn,
3700
+ padding: "6px 4px",
3680
3701
  fontSize: "11px",
3681
- flex: 1,
3702
+ gap: "4px",
3703
+ minWidth: 0,
3682
3704
  justifyContent: "center",
3683
3705
  background: c.background,
3684
3706
  fontWeight: 600,
3685
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
3686
- transition: "all 0.2s"
3687
- },
3688
- onMouseEnter: (t) => t.currentTarget.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)",
3689
- onMouseLeave: (t) => t.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.05)"
3707
+ boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
3708
+ }
3690
3709
  },
3691
- /* @__PURE__ */ e.createElement(F.Unpin, { style: { fontSize: "14px" } }),
3692
- /* @__PURE__ */ e.createElement("span", null, "Unpin All")
3693
- )), w.size > 0 && /* @__PURE__ */ e.createElement("div", { style: {
3710
+ /* @__PURE__ */ e.createElement(F.Unpin, { style: { fontSize: "13px", flexShrink: 0 } }),
3711
+ /* @__PURE__ */ e.createElement("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, "Unpin")
3712
+ )), k.size > 0 && /* @__PURE__ */ e.createElement("div", { style: {
3694
3713
  display: "flex",
3695
3714
  flexDirection: "column",
3696
3715
  gap: "8px",
3697
- background: `linear-gradient(135deg, ${c.select}ee, ${c.select}dd)`,
3698
- padding: "12px",
3699
- borderRadius: "8px",
3700
- border: `2px solid ${c.primary}66`,
3701
- boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
3716
+ background: c.select || "var(--sp-select)",
3717
+ padding: "10px",
3718
+ borderRadius: "var(--sp-radius-md, 8px)",
3719
+ border: "1px solid var(--sp-border-strong, var(--sp-primary))",
3720
+ boxShadow: "var(--sp-shadow-sm, 0 2px 8px rgba(0,0,0,0.1))",
3702
3721
  margin: "0 8px"
3703
3722
  } }, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ e.createElement("span", { style: {
3704
3723
  fontSize: "12px",
@@ -3708,9 +3727,11 @@ const _n = e.memo(
3708
3727
  background: c.background,
3709
3728
  borderRadius: "6px",
3710
3729
  boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
3711
- } }, w.size, " Column", w.size > 1 ? "s" : "", " Selected"), /* @__PURE__ */ e.createElement(
3730
+ } }, k.size, " Column", k.size > 1 ? "s" : "", " Selected"), /* @__PURE__ */ e.createElement(
3712
3731
  "button",
3713
3732
  {
3733
+ type: "button",
3734
+ className: "sp-btn sp-btn-ghost",
3714
3735
  onClick: () => B(/* @__PURE__ */ new Set()),
3715
3736
  style: {
3716
3737
  border: "none",
@@ -3719,115 +3740,109 @@ const _n = e.memo(
3719
3740
  display: "flex",
3720
3741
  color: c.textSec,
3721
3742
  padding: "4px",
3722
- borderRadius: "4px",
3723
- transition: "all 0.2s"
3724
- },
3725
- onMouseEnter: (t) => t.currentTarget.style.background = c.hover,
3726
- onMouseLeave: (t) => t.currentTarget.style.background = c.background
3743
+ borderRadius: "4px"
3744
+ }
3727
3745
  },
3728
3746
  /* @__PURE__ */ e.createElement(F.Close, null)
3729
3747
  )), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" } }, /* @__PURE__ */ e.createElement(
3730
3748
  "button",
3731
3749
  {
3750
+ type: "button",
3751
+ className: "sp-btn sp-btn-subtle",
3732
3752
  onClick: () => {
3733
- Array.from(w).forEach((t) => K(t, "left")), B(/* @__PURE__ */ new Set());
3753
+ Array.from(k).forEach((r) => U(r, "left")), B(/* @__PURE__ */ new Set());
3734
3754
  },
3735
3755
  style: {
3736
- ...Y.btn,
3737
- padding: "6px 12px",
3756
+ ...Z.btn,
3757
+ padding: "6px 8px",
3738
3758
  fontSize: "11px",
3739
3759
  background: c.background,
3740
3760
  flex: 1,
3741
3761
  justifyContent: "center",
3742
3762
  fontWeight: 600,
3743
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
3744
- transition: "all 0.2s"
3745
- },
3746
- onMouseEnter: (t) => t.currentTarget.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)",
3747
- onMouseLeave: (t) => t.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.05)"
3763
+ boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
3764
+ }
3748
3765
  },
3749
3766
  /* @__PURE__ */ e.createElement(F.PinLeft, null),
3750
3767
  /* @__PURE__ */ e.createElement("span", null, "Pin Left")
3751
3768
  ), /* @__PURE__ */ e.createElement(
3752
3769
  "button",
3753
3770
  {
3771
+ type: "button",
3772
+ className: "sp-btn sp-btn-subtle",
3754
3773
  onClick: () => {
3755
- Array.from(w).forEach((t) => K(t, !1)), B(/* @__PURE__ */ new Set());
3774
+ Array.from(k).forEach((r) => U(r, !1)), B(/* @__PURE__ */ new Set());
3756
3775
  },
3757
3776
  style: {
3758
- ...Y.btn,
3759
- padding: "6px 12px",
3777
+ ...Z.btn,
3778
+ padding: "6px 8px",
3760
3779
  fontSize: "11px",
3761
3780
  background: c.background,
3762
3781
  flex: 1,
3763
3782
  justifyContent: "center",
3764
3783
  fontWeight: 600,
3765
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
3766
- transition: "all 0.2s"
3767
- },
3768
- onMouseEnter: (t) => t.currentTarget.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)",
3769
- onMouseLeave: (t) => t.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.05)"
3784
+ boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
3785
+ }
3770
3786
  },
3771
3787
  /* @__PURE__ */ e.createElement(F.Unpin, null),
3772
3788
  /* @__PURE__ */ e.createElement("span", null, "Unpin")
3773
3789
  ), /* @__PURE__ */ e.createElement(
3774
3790
  "button",
3775
3791
  {
3792
+ type: "button",
3793
+ className: "sp-btn sp-btn-subtle",
3776
3794
  onClick: () => {
3777
- Array.from(w).forEach((t) => K(t, "right")), B(/* @__PURE__ */ new Set());
3795
+ Array.from(k).forEach((r) => U(r, "right")), B(/* @__PURE__ */ new Set());
3778
3796
  },
3779
3797
  style: {
3780
- ...Y.btn,
3781
- padding: "6px 12px",
3798
+ ...Z.btn,
3799
+ padding: "6px 8px",
3782
3800
  fontSize: "11px",
3783
3801
  background: c.background,
3784
3802
  flex: 1,
3785
3803
  justifyContent: "center",
3786
3804
  fontWeight: 600,
3787
- boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
3788
- transition: "all 0.2s"
3789
- },
3790
- onMouseEnter: (t) => t.currentTarget.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)",
3791
- onMouseLeave: (t) => t.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.05)"
3805
+ boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
3806
+ }
3792
3807
  },
3793
3808
  /* @__PURE__ */ e.createElement(F.PinRight, null),
3794
3809
  /* @__PURE__ */ e.createElement("span", null, "Pin Right")
3795
3810
  ))), /* @__PURE__ */ e.createElement("div", { style: { flex: 1, overflowY: "auto", display: "flex", flexDirection: "column" } }, (() => {
3796
- const d = y.getAllColumns().filter(
3811
+ const p = y.getAllColumns().filter(
3797
3812
  /** @param {any} [c] @returns {any} */
3798
3813
  (v) => !v.parent && v.id !== "no_data"
3799
3814
  ).filter(
3800
3815
  /** @param {any} [col] @returns {any} */
3801
3816
  (v) => {
3802
3817
  if (i === "all") return !0;
3803
- let H = "string";
3804
- if (S.find(
3818
+ let V = "string";
3819
+ if (E.find(
3805
3820
  /** @param {any} [v] @returns {any} */
3806
3821
  (ae) => v.id.includes(ae.field)
3807
3822
  ))
3808
- H = "number";
3809
- else if (pe && pe.length > 0) {
3810
- const ae = pe[0];
3823
+ V = "number";
3824
+ else if (de && de.length > 0) {
3825
+ const ae = de[0];
3811
3826
  let oe = ae[v.id];
3812
3827
  if (oe === void 0 && v.accessorFn)
3813
3828
  try {
3814
3829
  oe = v.accessorFn(ae);
3815
3830
  } catch {
3816
3831
  }
3817
- typeof oe == "number" ? H = "number" : oe instanceof Date ? H = "date" : typeof oe == "string" && (!isNaN(Number(oe)) && oe.trim() !== "" ? H = "number" : !isNaN(Date.parse(oe)) && oe.includes("-") && (H = "date"));
3832
+ typeof oe == "number" ? V = "number" : oe instanceof Date ? V = "date" : typeof oe == "string" && (!isNaN(Number(oe)) && oe.trim() !== "" ? V = "number" : !isNaN(Date.parse(oe)) && oe.includes("-") && (V = "date"));
3818
3833
  }
3819
- return H === i;
3834
+ return V === i;
3820
3835
  }
3821
- ), u = d.filter(
3836
+ ), u = p.filter(
3822
3837
  /** @param {any} [c] @returns {any} */
3823
3838
  (v) => at(v, "left")
3824
- ), b = d.filter(
3839
+ ), b = p.filter(
3825
3840
  /** @param {any} [c] @returns {any} */
3826
3841
  (v) => at(v, "right")
3827
- ), h = d.filter(
3842
+ ), h = p.filter(
3828
3843
  /** @param {any} [c] @returns {any} */
3829
3844
  (v) => at(v, "unpinned")
3830
- ), I = (v, H) => v.map(
3845
+ ), T = (v, V) => v.map(
3831
3846
  /** @param {any} [column] @returns {any} */
3832
3847
  (le) => /* @__PURE__ */ e.createElement(
3833
3848
  fr,
@@ -3836,27 +3851,27 @@ const _n = e.memo(
3836
3851
  column: le,
3837
3852
  level: 0,
3838
3853
  theme: c,
3839
- styles: Y,
3840
- handlePinColumn: K,
3841
- colSearch: R,
3842
- selectedCols: w,
3854
+ styles: Z,
3855
+ handlePinColumn: U,
3856
+ colSearch: C,
3857
+ selectedCols: k,
3843
3858
  setSelectedCols: B,
3844
3859
  onDrop: G,
3845
- sectionId: H
3860
+ sectionId: V
3846
3861
  }
3847
3862
  )
3848
- ), G = (v, H, le) => {
3863
+ ), G = (v, V, le) => {
3849
3864
  let ae;
3850
3865
  const oe = P || { left: [], right: [] };
3851
3866
  if (le) {
3852
- const Xe = H === "left" ? oe.left : H === "right" ? oe.right : null;
3867
+ const Xe = V === "left" ? oe.left : V === "right" ? oe.right : null;
3853
3868
  if (Xe) {
3854
3869
  if (ae = Xe.indexOf(le), ae === -1) {
3855
- const vt = y.getColumn(le);
3856
- if (vt && tn(vt)) {
3857
- const Gt = kt(vt).find(
3870
+ const Et = y.getColumn(le);
3871
+ if (Et && tn(Et)) {
3872
+ const Gt = kt(Et).find(
3858
3873
  /** @param {any} [id] @returns {any} */
3859
- (Hr) => Xe.includes(Hr)
3874
+ (Nr) => Xe.includes(Nr)
3860
3875
  );
3861
3876
  Gt && (ae = Xe.indexOf(Gt));
3862
3877
  }
@@ -3864,7 +3879,7 @@ const _n = e.memo(
3864
3879
  ae === -1 && (ae = void 0);
3865
3880
  }
3866
3881
  }
3867
- H === "left" ? K(v, "left", ae) : H === "right" ? K(v, "right", ae) : K(v, !1);
3882
+ V === "left" ? U(v, "left", ae) : V === "right" ? U(v, "right", ae) : U(v, !1);
3868
3883
  };
3869
3884
  return /* @__PURE__ */ e.createElement(e.Fragment, null, u.length > 0 && /* @__PURE__ */ e.createElement(
3870
3885
  St,
@@ -3872,66 +3887,66 @@ const _n = e.memo(
3872
3887
  title: "Pinned Left",
3873
3888
  count: u.length,
3874
3889
  theme: c,
3875
- styles: Y,
3890
+ styles: Z,
3876
3891
  sectionId: "left",
3877
3892
  onDrop: G
3878
3893
  },
3879
- I(u, "left")
3894
+ T(u, "left")
3880
3895
  ), b.length > 0 && /* @__PURE__ */ e.createElement(
3881
3896
  St,
3882
3897
  {
3883
3898
  title: "Pinned Right",
3884
3899
  count: b.length,
3885
3900
  theme: c,
3886
- styles: Y,
3901
+ styles: Z,
3887
3902
  sectionId: "right",
3888
3903
  onDrop: G
3889
3904
  },
3890
- I(b, "right")
3905
+ T(b, "right")
3891
3906
  ), /* @__PURE__ */ e.createElement(
3892
3907
  St,
3893
3908
  {
3894
3909
  title: "Columns",
3895
3910
  count: h.length,
3896
3911
  theme: c,
3897
- styles: Y,
3912
+ styles: Z,
3898
3913
  sectionId: "unpinned",
3899
3914
  onDrop: G
3900
3915
  },
3901
- I(h, "unpinned")
3916
+ T(h, "unpinned")
3902
3917
  ));
3903
- })()), C && C.length > 0 && /* @__PURE__ */ e.createElement("div", { style: { padding: "8px", borderTop: `1px solid ${c.border}` } }, /* @__PURE__ */ e.createElement("div", { style: Y.sectionTitle }, "Pinning Presets"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, C.map(
3918
+ })()), w && w.length > 0 && /* @__PURE__ */ e.createElement("div", { style: { padding: "8px", borderTop: `1px solid ${c.border}` } }, /* @__PURE__ */ e.createElement("div", { style: Z.sectionTitle }, "Pinning Presets"), /* @__PURE__ */ e.createElement("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, w.map(
3904
3919
  /** @param {any} [preset] @param {any} [i] @returns {any} */
3905
- (t, d) => /* @__PURE__ */ e.createElement(
3920
+ (r, p) => /* @__PURE__ */ e.createElement(
3906
3921
  "button",
3907
3922
  {
3908
- key: d,
3923
+ key: p,
3909
3924
  onClick: () => {
3910
- M(t.config), D(`Applied preset: ${t.name}`);
3925
+ M(r.config), R(`Applied preset: ${r.name}`);
3911
3926
  },
3912
- style: { ...Y.btn, fontSize: "11px", background: c.headerBg }
3927
+ style: { ...Z.btn, fontSize: "11px", background: c.headerBg }
3913
3928
  },
3914
- t.name
3929
+ r.name
3915
3930
  )
3916
- ))), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "11px", color: c.textSec, fontStyle: "italic", padding: "8px", background: c.headerBg, borderTop: `1px solid ${c.border}44` } }, /* @__PURE__ */ e.createElement(F.Lock, { style: { verticalAlign: "middle", marginRight: "4px", opacity: 0.5 } }), "Drag columns or use pin icons to freeze areas."))), ht && /* @__PURE__ */ e.createElement(
3931
+ ))), /* @__PURE__ */ e.createElement("div", { style: { fontSize: "11px", color: c.textSec, fontStyle: "italic", padding: "8px", background: c.headerBg, borderTop: `1px solid ${c.border}44` } }, /* @__PURE__ */ e.createElement(F.Lock, { style: { verticalAlign: "middle", marginRight: "4px", opacity: 0.5 } }), "Drag columns or use pin icons to freeze areas."))), vt && /* @__PURE__ */ e.createElement(
3917
3932
  $n,
3918
3933
  {
3919
- item: ht,
3920
- idx: Et,
3921
- valConfigs: S,
3934
+ item: vt,
3935
+ idx: ht,
3936
+ valConfigs: E,
3922
3937
  setValConfigs: g,
3923
3938
  theme: c,
3924
3939
  onClose: () => Re(null),
3925
3940
  onRemove: Ge,
3926
- displayedColumnOptions: Ee,
3941
+ displayedColumnOptions: he,
3927
3942
  availableRawFields: te,
3928
- serverError: We && We[ht.field] || null
3943
+ serverError: We && We[vt.field] || null
3929
3944
  }
3930
3945
  ), /* @__PURE__ */ e.createElement(
3931
3946
  "div",
3932
3947
  {
3933
3948
  className: "sp-resize-handle",
3934
- onMouseDown: Ir,
3949
+ onMouseDown: Tr,
3935
3950
  title: "Drag to resize panel",
3936
3951
  style: { position: "absolute", right: -2, top: 0, bottom: 0, width: "9px", cursor: "col-resize", zIndex: 10, background: "transparent", display: "flex", alignItems: "center", justifyContent: "center" }
3937
3952
  },