@toolbox-web/grid 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/all.d.ts +1 -0
  2. package/all.d.ts.map +1 -1
  3. package/all.js +899 -637
  4. package/all.js.map +1 -1
  5. package/index.js +641 -600
  6. package/index.js.map +1 -1
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/header.d.ts +7 -0
  9. package/lib/core/internal/header.d.ts.map +1 -1
  10. package/lib/core/types.d.ts +147 -0
  11. package/lib/core/types.d.ts.map +1 -1
  12. package/lib/plugins/clipboard/index.js +2 -1
  13. package/lib/plugins/clipboard/index.js.map +1 -1
  14. package/lib/plugins/column-virtualization/index.js +6 -5
  15. package/lib/plugins/column-virtualization/index.js.map +1 -1
  16. package/lib/plugins/context-menu/index.js +2 -1
  17. package/lib/plugins/context-menu/index.js.map +1 -1
  18. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  19. package/lib/plugins/editing/index.js +9 -6
  20. package/lib/plugins/editing/index.js.map +1 -1
  21. package/lib/plugins/export/index.js +2 -1
  22. package/lib/plugins/export/index.js.map +1 -1
  23. package/lib/plugins/filtering/index.js +60 -59
  24. package/lib/plugins/filtering/index.js.map +1 -1
  25. package/lib/plugins/grouping-columns/index.js +2 -1
  26. package/lib/plugins/grouping-columns/index.js.map +1 -1
  27. package/lib/plugins/grouping-rows/index.js +2 -1
  28. package/lib/plugins/grouping-rows/index.js.map +1 -1
  29. package/lib/plugins/master-detail/index.js +2 -1
  30. package/lib/plugins/master-detail/index.js.map +1 -1
  31. package/lib/plugins/multi-sort/index.js +2 -1
  32. package/lib/plugins/multi-sort/index.js.map +1 -1
  33. package/lib/plugins/pinned-columns/index.js +2 -1
  34. package/lib/plugins/pinned-columns/index.js.map +1 -1
  35. package/lib/plugins/pinned-rows/index.js +2 -1
  36. package/lib/plugins/pinned-rows/index.js.map +1 -1
  37. package/lib/plugins/pivot/index.js +2 -1
  38. package/lib/plugins/pivot/index.js.map +1 -1
  39. package/lib/plugins/print/PrintPlugin.d.ts +98 -0
  40. package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
  41. package/lib/plugins/print/index.d.ts +10 -0
  42. package/lib/plugins/print/index.d.ts.map +1 -0
  43. package/lib/plugins/print/index.js +626 -0
  44. package/lib/plugins/print/index.js.map +1 -0
  45. package/lib/plugins/print/print-isolated.d.ts +26 -0
  46. package/lib/plugins/print/print-isolated.d.ts.map +1 -0
  47. package/lib/plugins/print/types.d.ts +147 -0
  48. package/lib/plugins/print/types.d.ts.map +1 -0
  49. package/lib/plugins/reorder/index.js +2 -1
  50. package/lib/plugins/reorder/index.js.map +1 -1
  51. package/lib/plugins/responsive/index.js +2 -1
  52. package/lib/plugins/responsive/index.js.map +1 -1
  53. package/lib/plugins/row-reorder/index.js +2 -1
  54. package/lib/plugins/row-reorder/index.js.map +1 -1
  55. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  56. package/lib/plugins/selection/index.js +109 -97
  57. package/lib/plugins/selection/index.js.map +1 -1
  58. package/lib/plugins/server-side/index.js +2 -1
  59. package/lib/plugins/server-side/index.js.map +1 -1
  60. package/lib/plugins/tree/index.js +2 -1
  61. package/lib/plugins/tree/index.js.map +1 -1
  62. package/lib/plugins/undo-redo/index.js +2 -1
  63. package/lib/plugins/undo-redo/index.js.map +1 -1
  64. package/lib/plugins/visibility/index.js +2 -1
  65. package/lib/plugins/visibility/index.js.map +1 -1
  66. package/package.json +1 -1
  67. package/public.d.ts +1 -1
  68. package/public.d.ts.map +1 -1
  69. package/umd/grid.all.umd.js +98 -24
  70. package/umd/grid.all.umd.js.map +1 -1
  71. package/umd/grid.umd.js +11 -11
  72. package/umd/grid.umd.js.map +1 -1
  73. package/umd/plugins/editing.umd.js +1 -1
  74. package/umd/plugins/editing.umd.js.map +1 -1
  75. package/umd/plugins/filtering.umd.js +1 -1
  76. package/umd/plugins/filtering.umd.js.map +1 -1
  77. package/umd/plugins/print.umd.js +76 -0
  78. package/umd/plugins/print.umd.js.map +1 -0
  79. package/umd/plugins/selection.umd.js +2 -2
  80. package/umd/plugins/selection.umd.js.map +1 -1
package/all.js CHANGED
@@ -1,20 +1,20 @@
1
- import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ye, a as Xe, runAggregator as ce, e as Ze, s as Je, PLUGIN_QUERIES as Oe, getAggregator as ue, getValueAggregator as Qe, b as _, c as he, g as et } from "./index.js";
2
- import { DEFAULT_ANIMATION_CONFIG as gn, DGEvents as pn, DataGridElement as mn, FitModeEnum as wn, GridCSSVars as bn, GridClasses as vn, GridDataAttrs as yn, DataGridElement as Cn, GridSelectors as xn, PluginEvents as Rn, PluginManager as En, RenderPhase as Sn, builtInSort as kn, createGrid as An, defaultComparator as _n, queryGrid as Ln } from "./index.js";
3
- const Be = "__tbw_expander", tt = 32;
4
- function re(s) {
5
- return s.field === Be;
1
+ import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ze, a as Je, runAggregator as he, e as Qe, s as et, PLUGIN_QUERIES as Ve, getAggregator as ge, getValueAggregator as tt, b as _, c as fe, g as it } from "./index.js";
2
+ import { DEFAULT_ANIMATION_CONFIG as Cn, DGEvents as xn, DataGridElement as Rn, FitModeEnum as En, GridCSSVars as Sn, GridClasses as kn, GridDataAttrs as An, DataGridElement as _n, GridSelectors as Ln, PluginEvents as Tn, PluginManager as In, RenderPhase as Pn, builtInSort as Fn, createGrid as Dn, defaultComparator as Mn, queryGrid as qn } from "./index.js";
3
+ const We = "__tbw_expander", nt = 32;
4
+ function se(s) {
5
+ return s.field === We;
6
6
  }
7
7
  function I(s) {
8
8
  return s.meta?.utility === !0;
9
9
  }
10
- function it(s) {
11
- return s.find(re);
10
+ function rt(s) {
11
+ return s.find(se);
12
12
  }
13
- function nt(s) {
13
+ function ot(s) {
14
14
  return {
15
- field: Be,
15
+ field: We,
16
16
  header: "",
17
- width: tt,
17
+ width: nt,
18
18
  resizable: !1,
19
19
  sortable: !1,
20
20
  filterable: !1,
@@ -27,7 +27,7 @@ function nt(s) {
27
27
  }
28
28
  };
29
29
  }
30
- async function W(s) {
30
+ async function j(s) {
31
31
  try {
32
32
  return await navigator.clipboard.writeText(s), !0;
33
33
  } catch {
@@ -37,7 +37,7 @@ async function W(s) {
37
37
  return document.body.removeChild(e), t;
38
38
  }
39
39
  }
40
- function fe(s, e) {
40
+ function pe(s, e) {
41
41
  const t = e.delimiter ?? " ", i = e.newline ?? `
42
42
  `, n = s.replace(/\r\n/g, `
43
43
  `).replace(/\r/g, `
@@ -49,14 +49,14 @@ function fe(s, e) {
49
49
  }
50
50
  return o.push(a), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
51
51
  }
52
- async function rt() {
52
+ async function st() {
53
53
  try {
54
54
  return await navigator.clipboard.readText();
55
55
  } catch {
56
56
  return "";
57
57
  }
58
58
  }
59
- function ot(s, e) {
59
+ function at(s, e) {
60
60
  const { rows: t, target: i, fields: n } = s;
61
61
  if (!i) return;
62
62
  const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
@@ -65,23 +65,23 @@ function ot(s, e) {
65
65
  });
66
66
  const d = [...r], c = i.bounds ? i.bounds.endRow : 1 / 0;
67
67
  t.forEach((u, h) => {
68
- const f = i.row + h;
69
- if (!(f > c)) {
68
+ const g = i.row + h;
69
+ if (!(g > c)) {
70
70
  if (i.bounds) {
71
- if (f >= d.length)
71
+ if (g >= d.length)
72
72
  return;
73
- } else for (; f >= d.length; ) {
74
- const g = {};
75
- a.forEach((p) => g[p] = ""), d.push(g);
73
+ } else for (; g >= d.length; ) {
74
+ const f = {};
75
+ a.forEach((p) => f[p] = ""), d.push(f);
76
76
  }
77
- d[f] = { ...d[f] }, u.forEach((g, p) => {
77
+ d[g] = { ...d[g] }, u.forEach((f, p) => {
78
78
  const m = n[p];
79
- m && l.get(m) && (d[f][m] = g);
79
+ m && l.get(m) && (d[g][m] = f);
80
80
  });
81
81
  }
82
82
  }), e.rows = d;
83
83
  }
84
- class Ui extends R {
84
+ class en extends R {
85
85
  static dependencies = [
86
86
  { name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
87
87
  ];
@@ -110,7 +110,7 @@ class Ui extends R {
110
110
  return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#e(e.target), !0) : !1;
111
111
  }
112
112
  #e(e) {
113
- const t = this.#i(), i = t?.getSelection(), n = this.columns.length - 1, r = this.rows.length - 1;
113
+ const t = this.#n(), i = t?.getSelection(), n = this.columns.length - 1, r = this.rows.length - 1;
114
114
  let o;
115
115
  if (i && i.ranges.length > 0) {
116
116
  const { mode: l, ranges: d } = i, c = d[d.length - 1];
@@ -128,12 +128,12 @@ class Ui extends R {
128
128
  } else if (!t)
129
129
  o = { startRow: 0, startCol: 0, endRow: r, endCol: n };
130
130
  else {
131
- const l = this.#s(e);
131
+ const l = this.#r(e);
132
132
  if (!l) return;
133
133
  o = { startRow: l.row, startCol: l.col, endRow: l.row, endCol: l.col };
134
134
  }
135
- const a = this.#n(o);
136
- W(a.text).then(() => {
135
+ const a = this.#i(o);
136
+ j(a.text).then(() => {
137
137
  this.lastCopied = { text: a.text, timestamp: Date.now() }, this.emit("copy", {
138
138
  text: a.text,
139
139
  rowCount: a.rowCount,
@@ -145,21 +145,21 @@ class Ui extends R {
145
145
  const t = e.clipboardData?.getData("text/plain");
146
146
  if (!t) return;
147
147
  e.preventDefault();
148
- const i = fe(t, this.config), r = this.#i()?.getSelection(), o = r?.ranges?.[0], a = o?.from.row ?? 0, l = o?.from.col ?? 0, c = o && (r?.mode === "range" || r?.mode === "row") && (o.from.row !== o.to.row || o.from.col !== o.to.col) ? { endRow: o.to.row, endCol: o.to.col } : null, u = c?.endCol ?? this.columns.length - 1, h = this.columns[l], f = h ? { row: a, col: l, field: h.field, bounds: c } : null, g = [], p = i[0]?.length ?? 0;
148
+ const i = pe(t, this.config), r = this.#n()?.getSelection(), o = r?.ranges?.[0], a = o?.from.row ?? 0, l = o?.from.col ?? 0, c = o && (r?.mode === "range" || r?.mode === "row") && (o.from.row !== o.to.row || o.from.col !== o.to.col) ? { endRow: o.to.row, endCol: o.to.col } : null, u = c?.endCol ?? this.columns.length - 1, h = this.columns[l], g = h ? { row: a, col: l, field: h.field, bounds: c } : null, f = [], p = i[0]?.length ?? 0;
149
149
  for (let w = 0; w < p && l + w <= u; w++) {
150
150
  const b = this.columns[l + w];
151
- b && !b.hidden && g.push(b.field);
151
+ b && !b.hidden && f.push(b.field);
152
152
  }
153
- const m = { rows: i, text: t, target: f, fields: g };
153
+ const m = { rows: i, text: t, target: g, fields: f };
154
154
  this.emit("paste", m), this.#o(m);
155
155
  }
156
156
  #o(e) {
157
157
  if (!this.grid) return;
158
158
  const { pasteHandler: t } = this.config;
159
159
  if (t === null) return;
160
- (t ?? ot)(e, this.grid);
160
+ (t ?? at)(e, this.grid);
161
161
  }
162
- #i() {
162
+ #n() {
163
163
  try {
164
164
  const e = this.grid?.getPluginByName("selection");
165
165
  if (e)
@@ -167,17 +167,17 @@ class Ui extends R {
167
167
  } catch {
168
168
  }
169
169
  }
170
- #n(e) {
170
+ #i(e) {
171
171
  const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
172
- `, h = [], f = this.columns.slice(l, d + 1).filter((g) => !I(g));
172
+ `, h = [], g = this.columns.slice(l, d + 1).filter((f) => !I(f));
173
173
  if (this.config.includeHeaders) {
174
- const g = f.map((p) => p.header || p.field);
175
- h.push(g.join(c));
174
+ const f = g.map((p) => p.header || p.field);
175
+ h.push(f.join(c));
176
176
  }
177
- for (let g = o; g <= a; g++) {
178
- const p = this.rows[g];
177
+ for (let f = o; f <= a; f++) {
178
+ const p = this.rows[f];
179
179
  if (!p) continue;
180
- const m = f.map((w) => {
180
+ const m = g.map((w) => {
181
181
  const b = p[w.field];
182
182
  return b == null ? "" : b instanceof Date ? b.toISOString() : String(b);
183
183
  });
@@ -189,7 +189,7 @@ class Ui extends R {
189
189
  columnCount: d - l + 1
190
190
  };
191
191
  }
192
- #s(e) {
192
+ #r(e) {
193
193
  const t = e.closest("[data-field-cache]");
194
194
  if (!t) return null;
195
195
  const i = t.dataset.fieldCache, n = t.dataset.row;
@@ -200,7 +200,7 @@ class Ui extends R {
200
200
  return o === -1 ? null : { row: r, col: o };
201
201
  }
202
202
  async copy() {
203
- const t = this.#i()?.getSelection(), i = this.columns.length - 1;
203
+ const t = this.#n()?.getSelection(), i = this.columns.length - 1;
204
204
  let n = { startRow: 0, startCol: 0, endRow: this.rows.length - 1, endCol: i };
205
205
  if (t && t.ranges.length > 0) {
206
206
  const o = t.ranges[t.ranges.length - 1];
@@ -211,8 +211,8 @@ class Ui extends R {
211
211
  endCol: o.to.col
212
212
  };
213
213
  }
214
- const r = this.#n(n);
215
- return await W(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
214
+ const r = this.#i(n);
215
+ return await j(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
216
216
  }
217
217
  async copyRows(e) {
218
218
  if (e.length === 0) return "";
@@ -221,44 +221,44 @@ class Ui extends R {
221
221
  startCol: 0,
222
222
  endRow: t[t.length - 1],
223
223
  endCol: i
224
- }, r = this.#n(n);
225
- return await W(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
224
+ }, r = this.#i(n);
225
+ return await j(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
226
226
  }
227
227
  async paste() {
228
- const e = await rt();
229
- return e ? fe(e, this.config) : null;
228
+ const e = await st();
229
+ return e ? pe(e, this.config) : null;
230
230
  }
231
231
  getLastCopied() {
232
232
  return this.lastCopied;
233
233
  }
234
234
  }
235
- const ge = 100;
236
- function oe(s) {
235
+ const me = 100;
236
+ function ae(s) {
237
237
  if (s == null)
238
- return ge;
238
+ return me;
239
239
  if (typeof s == "number")
240
240
  return s;
241
241
  const e = parseFloat(s);
242
- return isNaN(e) ? ge : e;
242
+ return isNaN(e) ? me : e;
243
243
  }
244
- function pe(s) {
245
- return s.map((e) => oe(e.width));
244
+ function we(s) {
245
+ return s.map((e) => ae(e.width));
246
246
  }
247
- function me(s) {
247
+ function be(s) {
248
248
  const e = [];
249
249
  let t = 0;
250
250
  for (const i of s)
251
- e.push(t), t += oe(i.width);
251
+ e.push(t), t += ae(i.width);
252
252
  return e;
253
253
  }
254
- function we(s) {
255
- return s.reduce((e, t) => e + oe(t.width), 0);
254
+ function ve(s) {
255
+ return s.reduce((e, t) => e + ae(t.width), 0);
256
256
  }
257
- function st(s, e, t, i, n) {
257
+ function lt(s, e, t, i, n) {
258
258
  const r = t.length;
259
259
  if (r === 0)
260
260
  return { startCol: 0, endCol: 0, visibleColumns: [] };
261
- let o = at(s, t, i);
261
+ let o = dt(s, t, i);
262
262
  o = Math.max(0, o - n);
263
263
  const a = s + e;
264
264
  let l = o;
@@ -275,7 +275,7 @@ function st(s, e, t, i, n) {
275
275
  d.push(c);
276
276
  return { startCol: o, endCol: l, visibleColumns: d };
277
277
  }
278
- function at(s, e, t) {
278
+ function dt(s, e, t) {
279
279
  let i = 0, n = e.length - 1;
280
280
  for (; i < n; ) {
281
281
  const r = Math.floor((i + n) / 2);
@@ -283,10 +283,10 @@ function at(s, e, t) {
283
283
  }
284
284
  return i;
285
285
  }
286
- function lt(s, e, t) {
286
+ function ct(s, e, t) {
287
287
  return t ? s > e : !1;
288
288
  }
289
- class Yi extends R {
289
+ class tn extends R {
290
290
  name = "columnVirtualization";
291
291
  get defaultConfig() {
292
292
  return {
@@ -305,16 +305,16 @@ class Yi extends R {
305
305
  attach(e) {
306
306
  super.attach(e);
307
307
  const t = this.columns;
308
- this.columnWidths = pe(t), this.columnOffsets = me(t), this.totalWidth = we(t), this.endCol = t.length - 1;
308
+ this.columnWidths = we(t), this.columnOffsets = be(t), this.totalWidth = ve(t), this.endCol = t.length - 1;
309
309
  }
310
310
  detach() {
311
311
  this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
312
312
  }
313
313
  processColumns(e) {
314
- const t = lt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
315
- if (this.isVirtualized = t ?? !1, this.columnWidths = pe(e), this.columnOffsets = me(e), this.totalWidth = we(e), !t)
314
+ const t = ct(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
315
+ if (this.isVirtualized = t ?? !1, this.columnWidths = we(e), this.columnOffsets = be(e), this.totalWidth = ve(e), !t)
316
316
  return this.startCol = 0, this.endCol = e.length - 1, [...e];
317
- const i = this.grid.clientWidth || 800, n = st(
317
+ const i = this.grid.clientWidth || 800, n = lt(
318
318
  this.scrollLeft,
319
319
  i,
320
320
  this.columnOffsets,
@@ -354,14 +354,14 @@ class Yi extends R {
354
354
  return this.totalWidth;
355
355
  }
356
356
  }
357
- const $ = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg, light-dark(#f5f5f5, #2a2a2a)));color:var(--tbw-context-menu-fg, var(--tbw-color-fg, light-dark(#222, #eee)));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);box-shadow:0 2px 10px var(--tbw-color-shadow, rgba(0, 0, 0, .15));min-width:var(--tbw-menu-min-width, 10rem);padding:var(--tbw-spacing-xs, .25rem) 0;z-index:10000;font-size:var(--tbw-font-size-sm, .8125rem);font-family:var(--tbw-font-family, system-ui, sans-serif)}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-menu-item-padding, .375rem .75rem);cursor:pointer;gap:var(--tbw-menu-item-gap, .5rem)}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover, light-dark(#e8e8e8, #3a3a3a)))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:var(--tbw-icon-size, 1rem);text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-color-fg-muted, light-dark(#888, #888));font-size:var(--tbw-font-size-xs, .6875rem)}.tbw-context-menu-arrow{font-size:var(--tbw-font-size-2xs, .625rem);color:var(--tbw-color-fg-muted, light-dark(#888, #888))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));margin:var(--tbw-spacing-xs, .25rem) 0}}";
358
- function te(s, e) {
357
+ const U = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg, light-dark(#f5f5f5, #2a2a2a)));color:var(--tbw-context-menu-fg, var(--tbw-color-fg, light-dark(#222, #eee)));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);box-shadow:0 2px 10px var(--tbw-color-shadow, rgba(0, 0, 0, .15));min-width:var(--tbw-menu-min-width, 10rem);padding:var(--tbw-spacing-xs, .25rem) 0;z-index:10000;font-size:var(--tbw-font-size-sm, .8125rem);font-family:var(--tbw-font-family, system-ui, sans-serif)}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-menu-item-padding, .375rem .75rem);cursor:pointer;gap:var(--tbw-menu-item-gap, .5rem)}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover, light-dark(#e8e8e8, #3a3a3a)))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:var(--tbw-icon-size, 1rem);text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-color-fg-muted, light-dark(#888, #888));font-size:var(--tbw-font-size-xs, .6875rem)}.tbw-context-menu-arrow{font-size:var(--tbw-font-size-2xs, .625rem);color:var(--tbw-color-fg-muted, light-dark(#888, #888))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));margin:var(--tbw-spacing-xs, .25rem) 0}}";
358
+ function ne(s, e) {
359
359
  return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
360
360
  }
361
- function dt(s, e) {
361
+ function ut(s, e) {
362
362
  return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
363
363
  }
364
- function ie(s, e, t, i = Ye.submenuArrow) {
364
+ function re(s, e, t, i = Ze.submenuArrow) {
365
365
  const n = document.createElement("div");
366
366
  n.className = "tbw-context-menu", n.setAttribute("role", "menu");
367
367
  for (const r of s) {
@@ -372,7 +372,7 @@ function ie(s, e, t, i = Ye.submenuArrow) {
372
372
  }
373
373
  const o = document.createElement("div");
374
374
  o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
375
- const a = dt(r, e);
375
+ const a = ut(r, e);
376
376
  if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
377
377
  const d = document.createElement("span");
378
378
  d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
@@ -386,7 +386,7 @@ function ie(s, e, t, i = Ye.submenuArrow) {
386
386
  const d = document.createElement("span");
387
387
  d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
388
388
  if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
389
- const u = te(r.subMenu, e), h = ie(u, e, t, i);
389
+ const u = ne(r.subMenu, e), h = re(u, e, t, i);
390
390
  h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
391
391
  }), o.addEventListener("mouseleave", () => {
392
392
  const c = o.querySelector(".tbw-context-menu");
@@ -399,14 +399,14 @@ function ie(s, e, t, i = Ye.submenuArrow) {
399
399
  }
400
400
  return n;
401
401
  }
402
- function be(s, e, t) {
402
+ function ye(s, e, t) {
403
403
  s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
404
404
  const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
405
405
  let o = e, a = t;
406
406
  e + i.width > n && (o = e - i.width), t + i.height > r && (a = t - i.height), o = Math.max(0, o), a = Math.max(0, a), s.style.left = `${o}px`, s.style.top = `${a}px`, s.style.visibility = "visible";
407
407
  }
408
- let F = null, D = null, L = null, j = 0;
409
- const U = [
408
+ let P = null, F = null, L = null, Y = 0;
409
+ const X = [
410
410
  {
411
411
  id: "copy",
412
412
  name: "Copy",
@@ -424,11 +424,11 @@ const U = [
424
424
  }
425
425
  }
426
426
  ];
427
- class Xi extends R {
427
+ class nn extends R {
428
428
  name = "contextMenu";
429
429
  get defaultConfig() {
430
430
  return {
431
- items: U
431
+ items: X
432
432
  };
433
433
  }
434
434
  isOpen = !1;
@@ -436,20 +436,20 @@ class Xi extends R {
436
436
  params = null;
437
437
  menuElement = null;
438
438
  attach(e) {
439
- super.attach(e), this.installGlobalHandlers(), j++;
439
+ super.attach(e), this.installGlobalHandlers(), Y++;
440
440
  }
441
441
  detach() {
442
442
  this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
443
443
  }
444
444
  installGlobalHandlers() {
445
- !L && typeof document < "u" && typeof $ == "string" && $ && (L = document.createElement("style"), L.id = "tbw-context-menu-styles", L.textContent = $, document.head.appendChild(L)), F || (F = () => {
445
+ !L && typeof document < "u" && typeof U == "string" && U && (L = document.createElement("style"), L.id = "tbw-context-menu-styles", L.textContent = U, document.head.appendChild(L)), P || (P = () => {
446
446
  document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
447
- }, document.addEventListener("click", F)), D || (D = (e) => {
447
+ }, document.addEventListener("click", P)), F || (F = (e) => {
448
448
  e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
449
- }, document.addEventListener("keydown", D));
449
+ }, document.addEventListener("keydown", F));
450
450
  }
451
451
  uninstallGlobalHandlers() {
452
- j--, !(j > 0) && (F && (document.removeEventListener("click", F), F = null), D && (document.removeEventListener("keydown", D), D = null), L && (L.remove(), L = null));
452
+ Y--, !(Y > 0) && (P && (document.removeEventListener("click", P), P = null), F && (document.removeEventListener("keydown", F), F = null), L && (L.remove(), L = null));
453
453
  }
454
454
  afterRender() {
455
455
  const e = this.gridElement;
@@ -461,14 +461,14 @@ class Xi extends R {
461
461
  const r = n.target, o = r.closest("[data-row][data-col]"), a = r.closest(".header-cell");
462
462
  let l;
463
463
  if (o) {
464
- const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
464
+ const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], g = this.rows[c];
465
465
  l = {
466
- row: f,
466
+ row: g,
467
467
  rowIndex: c,
468
468
  column: h,
469
469
  columnIndex: u,
470
470
  field: h?.field ?? "",
471
- value: f?.[h?.field] ?? null,
471
+ value: g?.[h?.field] ?? null,
472
472
  isHeader: !1,
473
473
  event: n
474
474
  };
@@ -487,15 +487,15 @@ class Xi extends R {
487
487
  } else
488
488
  return;
489
489
  this.params = l, this.position = { x: n.clientX, y: n.clientY };
490
- const d = te(this.config.items ?? U, l);
491
- d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = ie(
490
+ const d = ne(this.config.items ?? X, l);
491
+ d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = re(
492
492
  d,
493
493
  l,
494
494
  (c) => {
495
495
  c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
496
496
  },
497
497
  this.gridIcons.submenuArrow
498
- ), document.body.appendChild(this.menuElement), be(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
498
+ ), document.body.appendChild(this.menuElement), ye(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
499
499
  }));
500
500
  }
501
501
  showMenu(e, t, i) {
@@ -508,15 +508,15 @@ class Xi extends R {
508
508
  value: i.value ?? null,
509
509
  isHeader: i.isHeader ?? !1,
510
510
  event: i.event ?? new MouseEvent("contextmenu")
511
- }, r = te(this.config.items ?? U, n);
512
- this.menuElement && this.menuElement.remove(), this.menuElement = ie(
511
+ }, r = ne(this.config.items ?? X, n);
512
+ this.menuElement && this.menuElement.remove(), this.menuElement = re(
513
513
  r,
514
514
  n,
515
515
  (o) => {
516
516
  o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
517
517
  },
518
518
  this.gridIcons.submenuArrow
519
- ), document.body.appendChild(this.menuElement), be(this.menuElement, e, t), this.isOpen = !0;
519
+ ), document.body.appendChild(this.menuElement), ye(this.menuElement, e, t), this.isOpen = !0;
520
520
  }
521
521
  hideMenu() {
522
522
  this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
@@ -525,12 +525,12 @@ class Xi extends R {
525
525
  return this.isOpen;
526
526
  }
527
527
  }
528
- const ct = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
529
- function ut(s) {
528
+ const ht = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
529
+ function gt(s) {
530
530
  const e = s.options;
531
531
  return e ? typeof e == "function" ? e() : e : [];
532
532
  }
533
- function ht(s) {
533
+ function ft(s) {
534
534
  return (e) => {
535
535
  const t = s.editorParams, i = document.createElement("input");
536
536
  i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
@@ -540,13 +540,13 @@ function ht(s) {
540
540
  }), i;
541
541
  };
542
542
  }
543
- function ft() {
543
+ function pt() {
544
544
  return (s) => {
545
545
  const e = document.createElement("input");
546
546
  return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
547
547
  };
548
548
  }
549
- function gt(s) {
549
+ function mt(s) {
550
550
  return (e) => {
551
551
  const t = s.editorParams, i = document.createElement("input");
552
552
  return i.type = "date", e.value instanceof Date && (i.valueAsDate = e.value), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("change", () => e.commit(i.valueAsDate)), i.addEventListener("keydown", (n) => {
@@ -554,14 +554,14 @@ function gt(s) {
554
554
  }), i;
555
555
  };
556
556
  }
557
- function pt(s) {
557
+ function wt(s) {
558
558
  return (e) => {
559
559
  const t = s.editorParams, i = document.createElement("select");
560
560
  if (s.multi && (i.multiple = !0), t?.includeEmpty) {
561
561
  const o = document.createElement("option");
562
562
  o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
563
563
  }
564
- ut(s).forEach((o) => {
564
+ gt(s).forEach((o) => {
565
565
  const a = document.createElement("option");
566
566
  a.value = String(o.value), a.textContent = o.label, (s.multi && Array.isArray(e.value) && e.value.includes(o.value) || !s.multi && e.value === o.value) && (a.selected = !0), i.appendChild(a);
567
567
  });
@@ -577,7 +577,7 @@ function pt(s) {
577
577
  }), i;
578
578
  };
579
579
  }
580
- function mt(s) {
580
+ function bt(s) {
581
581
  return (e) => {
582
582
  const t = s.editorParams, i = document.createElement("input");
583
583
  return i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("blur", () => e.commit(i.value)), i.addEventListener("keydown", (n) => {
@@ -585,22 +585,22 @@ function mt(s) {
585
585
  }), i;
586
586
  };
587
587
  }
588
- function wt(s) {
588
+ function vt(s) {
589
589
  switch (s.type) {
590
590
  case "number":
591
- return ht(s);
591
+ return ft(s);
592
592
  case "boolean":
593
- return ft();
593
+ return pt();
594
594
  case "date":
595
- return gt(s);
595
+ return mt(s);
596
596
  case "select":
597
- return pt(s);
597
+ return wt(s);
598
598
  default:
599
- return mt(s);
599
+ return bt(s);
600
600
  }
601
601
  }
602
- const Y = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
603
- function bt(s, e) {
602
+ const Z = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
603
+ function yt(s, e) {
604
604
  if (e.editor) return e.editor;
605
605
  if (e.__editorTemplate) return "template";
606
606
  if (!e.type) return;
@@ -614,28 +614,28 @@ function bt(s, e) {
614
614
  return r.editor;
615
615
  }
616
616
  }
617
- function K(s) {
617
+ function H(s) {
618
618
  return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
619
619
  }
620
- function vt(s) {
620
+ function Ct(s) {
621
621
  const e = (s.__editingCellCount ?? 0) + 1;
622
622
  s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
623
623
  }
624
- function yt(s) {
624
+ function xt(s) {
625
625
  s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
626
626
  }
627
- function N(s, e) {
627
+ function z(s, e) {
628
628
  return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
629
629
  }
630
- function ve(s) {
630
+ function Ce(s) {
631
631
  }
632
- function Ct(s, e, t) {
632
+ function Rt(s, e, t) {
633
633
  const i = s.querySelector("input,textarea,select");
634
634
  i && (i.addEventListener("blur", () => {
635
- t(N(i, e));
636
- }), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(N(i, e))));
635
+ t(z(i, e));
636
+ }), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(z(i, e))));
637
637
  }
638
- class Zi extends R {
638
+ class rn extends R {
639
639
  static manifest = {
640
640
  ownedProperties: [
641
641
  {
@@ -657,7 +657,7 @@ class Zi extends R {
657
657
  ]
658
658
  };
659
659
  name = "editing";
660
- styles = ct;
660
+ styles = ht;
661
661
  get defaultConfig() {
662
662
  return {
663
663
  editOn: "click"
@@ -666,9 +666,9 @@ class Zi extends R {
666
666
  #e = -1;
667
667
  #t = -1;
668
668
  #o = /* @__PURE__ */ new Map();
669
- #i = /* @__PURE__ */ new Set();
670
669
  #n = /* @__PURE__ */ new Set();
671
- #s = !1;
670
+ #i = /* @__PURE__ */ new Set();
671
+ #r = !1;
672
672
  attach(e) {
673
673
  super.attach(e);
674
674
  const t = this.disconnectSignal, i = e;
@@ -683,7 +683,7 @@ class Zi extends R {
683
683
  }, document.addEventListener(
684
684
  "keydown",
685
685
  (n) => {
686
- n.key === "Escape" && this.#e !== -1 && this.#r(this.#e, !0);
686
+ n.key === "Escape" && this.#e !== -1 && this.#s(this.#e, !0);
687
687
  },
688
688
  { capture: !0, signal: t }
689
689
  ), document.addEventListener(
@@ -691,13 +691,15 @@ class Zi extends R {
691
691
  (n) => {
692
692
  if (this.#e === -1) return;
693
693
  const r = i.findRenderedRowElement?.(this.#e);
694
- !r || (n.composedPath && n.composedPath() || []).includes(r) || this.#r(this.#e, !1);
694
+ !r || (n.composedPath && n.composedPath() || []).includes(r) || queueMicrotask(() => {
695
+ this.#e !== -1 && this.#s(this.#e, !1);
696
+ });
695
697
  },
696
698
  { signal: t }
697
699
  );
698
700
  }
699
701
  detach() {
700
- this.#e = -1, this.#t = -1, this.#o.clear(), this.#i.clear(), this.#n.clear(), super.detach();
702
+ this.#e = -1, this.#t = -1, this.#o.clear(), this.#n.clear(), this.#i.clear(), super.detach();
701
703
  }
702
704
  onCellClick(e) {
703
705
  const t = this.grid, i = this.config.editOn ?? t.effectiveConfig?.editOn;
@@ -710,16 +712,16 @@ class Zi extends R {
710
712
  onKeyDown(e) {
711
713
  const t = this.grid;
712
714
  if (e.key === "Escape" && this.#e !== -1)
713
- return this.#r(this.#e, !0), !0;
715
+ return this.#s(this.#e, !0), !0;
714
716
  if (e.key === " " || e.key === "Spacebar") {
715
717
  const i = t._focusRow, n = t._focusCol;
716
718
  if (i >= 0 && n >= 0) {
717
719
  const r = t._visibleColumns[n], o = t._rows[i];
718
720
  if (r?.editable && r.type === "boolean" && o) {
719
721
  const a = r.field;
720
- if (K(a)) {
722
+ if (H(a)) {
721
723
  const d = !o[a];
722
- return this.#u(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
724
+ return this.#h(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
723
725
  }
724
726
  }
725
727
  }
@@ -747,12 +749,12 @@ class Zi extends R {
747
749
  }
748
750
  });
749
751
  this.gridElement.dispatchEvent(h);
750
- const f = new CustomEvent("activate-cell", {
752
+ const g = new CustomEvent("activate-cell", {
751
753
  cancelable: !0,
752
754
  bubbles: !0,
753
755
  detail: { row: n, col: r }
754
756
  });
755
- return this.gridElement.dispatchEvent(f), h.defaultPrevented || f.defaultPrevented ? (e.preventDefault(), !0) : (this.beginBulkEdit(n), !0);
757
+ return this.gridElement.dispatchEvent(g), h.defaultPrevented || g.defaultPrevented ? (e.preventDefault(), !0) : (this.beginBulkEdit(n), !0);
756
758
  }
757
759
  return !1;
758
760
  }
@@ -775,8 +777,8 @@ class Zi extends R {
775
777
  }
776
778
  afterRender() {
777
779
  const e = this.grid;
778
- if (this.#s && (this.#s = !1, this.#h(e)), this.#n.size !== 0)
779
- for (const t of this.#n) {
780
+ if (this.#r && (this.#r = !1, this.#g(e)), this.#i.size !== 0)
781
+ for (const t of this.#i) {
780
782
  const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), a = e.findRenderedRowElement?.(r);
781
783
  if (!a) continue;
782
784
  const l = a.querySelector(`.cell[data-col="${o}"]`);
@@ -790,14 +792,14 @@ class Zi extends R {
790
792
  }
791
793
  get changedRows() {
792
794
  const e = [];
793
- for (const t of this.#i) {
795
+ for (const t of this.#n) {
794
796
  const i = this.grid.getRow(t);
795
797
  i && e.push(i);
796
798
  }
797
799
  return e;
798
800
  }
799
801
  get changedRowIds() {
800
- return Array.from(this.#i);
802
+ return Array.from(this.#n);
801
803
  }
802
804
  get activeEditRow() {
803
805
  return this.#e;
@@ -809,30 +811,30 @@ class Zi extends R {
809
811
  return this.#e === e;
810
812
  }
811
813
  isCellEditing(e, t) {
812
- return this.#n.has(`${e}:${t}`);
814
+ return this.#i.has(`${e}:${t}`);
813
815
  }
814
816
  isRowChanged(e) {
815
817
  const t = this.grid, i = t._rows[e];
816
818
  if (!i) return !1;
817
819
  try {
818
820
  const n = t.getRowId?.(i);
819
- return n ? this.#i.has(n) : !1;
821
+ return n ? this.#n.has(n) : !1;
820
822
  } catch {
821
823
  return !1;
822
824
  }
823
825
  }
824
826
  isRowChangedById(e) {
825
- return this.#i.has(e);
827
+ return this.#n.has(e);
826
828
  }
827
829
  resetChangedRows(e) {
828
830
  const t = this.changedRows, i = this.changedRowIds;
829
- this.#i.clear(), this.#l(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
831
+ this.#n.clear(), this.#a(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
830
832
  }
831
833
  beginCellEdit(e, t) {
832
834
  const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
833
835
  if (n === -1 || !i._visibleColumns[n]?.editable) return;
834
836
  const a = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
835
- a && this.#c(e, n, a);
837
+ a && this.#d(e, n, a);
836
838
  }
837
839
  beginBulkEdit(e) {
838
840
  const t = this.grid;
@@ -840,7 +842,7 @@ class Zi extends R {
840
842
  const r = t.findRenderedRowElement?.(e);
841
843
  if (!r) return;
842
844
  const o = t._rows[e];
843
- this.#d(e, o), Array.from(r.children).forEach((a, l) => {
845
+ this.#c(e, o), Array.from(r.children).forEach((a, l) => {
844
846
  const d = t._visibleColumns[l];
845
847
  if (d?.editable) {
846
848
  const c = a;
@@ -849,7 +851,7 @@ class Zi extends R {
849
851
  }), setTimeout(() => {
850
852
  let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
851
853
  if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
852
- const l = a.querySelector(Y);
854
+ const l = a.querySelector(Z);
853
855
  try {
854
856
  l?.focus({ preventScroll: !0 });
855
857
  } catch {
@@ -858,23 +860,23 @@ class Zi extends R {
858
860
  }, 0);
859
861
  }
860
862
  commitActiveRowEdit() {
861
- this.#e !== -1 && this.#r(this.#e, !1);
863
+ this.#e !== -1 && this.#s(this.#e, !1);
862
864
  }
863
865
  cancelActiveRowEdit() {
864
- this.#e !== -1 && this.#r(this.#e, !0);
866
+ this.#e !== -1 && this.#s(this.#e, !0);
865
867
  }
866
- #c(e, t, i) {
868
+ #d(e, t, i) {
867
869
  const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
868
- !r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#d(e, r), this.#t = t, this.#p(r, e, o, t, i, !1));
870
+ !r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#c(e, r), this.#t = t, this.#p(r, e, o, t, i, !1));
869
871
  }
870
- #l() {
872
+ #a() {
871
873
  const e = this.grid;
872
874
  e._activeEditRows = this.#e, e._rowEditSnapshots = this.#o;
873
875
  }
874
- #d(e, t) {
875
- this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#l());
876
+ #c(e, t) {
877
+ this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#a());
876
878
  }
877
- #r(e, t) {
879
+ #s(e, t) {
878
880
  if (this.#e !== e) return;
879
881
  const i = this.grid, n = this.#o.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
880
882
  let a;
@@ -890,15 +892,15 @@ class Zi extends R {
890
892
  if (!u) return;
891
893
  const h = d.querySelector("input,textarea,select");
892
894
  if (h) {
893
- const f = N(h, u);
894
- r[u.field] !== f && this.#u(e, u, f, r);
895
+ const g = z(h, u);
896
+ r[u.field] !== g && this.#h(e, u, g, r);
895
897
  }
896
898
  }), t && n && r)
897
899
  Object.keys(n).forEach((l) => {
898
900
  r[l] = n[l];
899
- }), a && this.#i.delete(a);
901
+ }), a && this.#n.delete(a);
900
902
  else if (!t && r) {
901
- const l = a ? this.#i.has(a) : !1;
903
+ const l = a ? this.#n.has(a) : !1;
902
904
  this.emit("row-commit", {
903
905
  rowIndex: e,
904
906
  rowId: a ?? "",
@@ -908,16 +910,16 @@ class Zi extends R {
908
910
  changedRowIds: this.changedRowIds
909
911
  }), l && this.isAnimationEnabled && i.animateRow?.(e, "change");
910
912
  }
911
- this.#o.delete(e), this.#e = -1, this.#t = -1, this.#l();
912
- for (const l of this.#n)
913
- l.startsWith(`${e}:`) && this.#n.delete(l);
913
+ this.#o.delete(e), this.#e = -1, this.#t = -1, this.#a();
914
+ for (const l of this.#i)
915
+ l.startsWith(`${e}:`) && this.#i.delete(l);
914
916
  o && (o.querySelectorAll(".cell.editing").forEach((l) => {
915
- l.classList.remove("editing"), yt(l.parentElement);
916
- }), this.requestRender()), this.#s = !0, o || (this.#h(i), this.#s = !1);
917
+ l.classList.remove("editing"), xt(l.parentElement);
918
+ }), this.requestRender()), this.#r = !0, o || (this.#g(i), this.#r = !1);
917
919
  }
918
- #u(e, t, i, n) {
920
+ #h(e, t, i, n) {
919
921
  const r = t.field;
920
- if (!K(r)) return;
922
+ if (!H(r)) return;
921
923
  const o = n[r];
922
924
  if (o === i) return;
923
925
  const a = this.grid;
@@ -926,7 +928,7 @@ class Zi extends R {
926
928
  l = this.grid.getRowId(n);
927
929
  } catch {
928
930
  }
929
- const d = l ? !this.#i.has(l) : !0, c = l ? (f) => this.grid.updateRow(l, f, "cascade") : ve;
931
+ const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : Ce;
930
932
  if (this.emitCancelable("cell-commit", {
931
933
  row: n,
932
934
  rowId: l ?? "",
@@ -939,9 +941,9 @@ class Zi extends R {
939
941
  firstTimeForRow: d,
940
942
  updateRow: c
941
943
  })) return;
942
- n[r] = i, l && this.#i.add(l), this.#l();
944
+ n[r] = i, l && this.#n.add(l), this.#a();
943
945
  const h = a.findRenderedRowElement?.(e);
944
- h && (h.classList.add("changed"), Xe(h, "change"));
946
+ h && (h.classList.add("changed"), Je(h, "change"));
945
947
  }
946
948
  #p(e, t, i, n, r, o) {
947
949
  if (!i.editable || r.classList.contains("editing")) return;
@@ -950,26 +952,26 @@ class Zi extends R {
950
952
  a = this.grid.getRowId(e);
951
953
  } catch {
952
954
  }
953
- const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : ve, d = K(i.field) ? e[i.field] : void 0;
954
- r.classList.add("editing"), this.#n.add(`${t}:${n}`);
955
+ const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : Ce, d = H(i.field) ? e[i.field] : void 0;
956
+ r.classList.add("editing"), this.#i.add(`${t}:${n}`);
955
957
  const c = r.parentElement;
956
- c && vt(c);
958
+ c && Ct(c);
957
959
  let u = !1;
958
960
  const h = (v) => {
959
- u || this.#e === -1 || this.#u(t, i, v, e);
960
- }, f = () => {
961
- u = !0, K(i.field) && (e[i.field] = d);
962
- }, g = document.createElement("div");
963
- g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
964
- v.key === "Enter" && (v.stopPropagation(), v.preventDefault(), u = !0, this.#r(t, !1)), v.key === "Escape" && (v.stopPropagation(), v.preventDefault(), f(), this.#r(t, !0));
961
+ u || this.#e === -1 || this.#h(t, i, v, e);
962
+ }, g = () => {
963
+ u = !0, H(i.field) && (e[i.field] = d);
964
+ }, f = document.createElement("div");
965
+ f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (v) => {
966
+ v.key === "Enter" && (v.stopPropagation(), v.preventDefault(), u = !0, this.#s(t, !1)), v.key === "Escape" && (v.stopPropagation(), v.preventDefault(), g(), this.#s(t, !0));
965
967
  });
966
- const p = i, m = p.__editorTemplate, w = bt(this.grid, p) ?? wt(i), b = d;
968
+ const p = i, m = p.__editorTemplate, w = yt(this.grid, p) ?? vt(i), b = d;
967
969
  if (w === "template" && m)
968
- this.#a(g, p, e, d, h, f, o, t);
970
+ this.#l(f, p, e, d, h, g, o, t);
969
971
  else if (typeof w == "string") {
970
972
  const v = document.createElement(w);
971
- v.value = b, v.addEventListener("change", () => h(v.value)), g.appendChild(v), o || queueMicrotask(() => {
972
- g.querySelector(Y)?.focus({ preventScroll: !0 });
973
+ v.value = b, v.addEventListener("change", () => h(v.value)), f.appendChild(v), o || queueMicrotask(() => {
974
+ f.querySelector(Z)?.focus({ preventScroll: !0 });
973
975
  });
974
976
  } else if (typeof w == "function") {
975
977
  const v = {
@@ -979,15 +981,15 @@ class Zi extends R {
979
981
  field: i.field,
980
982
  column: i,
981
983
  commit: h,
982
- cancel: f,
984
+ cancel: g,
983
985
  updateRow: l
984
986
  }, S = w(v);
985
- typeof S == "string" ? (g.innerHTML = S, Ct(g, i, h)) : S instanceof Node && g.appendChild(S), o || queueMicrotask(() => {
986
- g.querySelector(Y)?.focus({ preventScroll: !0 });
987
+ typeof S == "string" ? (f.innerHTML = S, Rt(f, i, h)) : S instanceof Node && f.appendChild(S), o || queueMicrotask(() => {
988
+ f.querySelector(Z)?.focus({ preventScroll: !0 });
987
989
  });
988
990
  } else if (w && typeof w == "object") {
989
991
  const v = document.createElement("div");
990
- v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), g.appendChild(v);
992
+ v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), f.appendChild(v);
991
993
  const S = {
992
994
  row: e,
993
995
  rowId: a ?? "",
@@ -995,14 +997,14 @@ class Zi extends R {
995
997
  field: i.field,
996
998
  column: i,
997
999
  commit: h,
998
- cancel: f,
1000
+ cancel: g,
999
1001
  updateRow: l
1000
1002
  };
1001
1003
  if (w.mount)
1002
1004
  try {
1003
1005
  w.mount({ placeholder: v, context: S, spec: w });
1004
- } catch (q) {
1005
- console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, q);
1006
+ } catch (N) {
1007
+ console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, N);
1006
1008
  }
1007
1009
  else
1008
1010
  this.grid.dispatchEvent(
@@ -1010,7 +1012,7 @@ class Zi extends R {
1010
1012
  );
1011
1013
  }
1012
1014
  }
1013
- #a(e, t, i, n, r, o, a, l) {
1015
+ #l(e, t, i, n, r, o, a, l) {
1014
1016
  const d = t.__editorTemplate;
1015
1017
  if (!d) return;
1016
1018
  const c = d.cloneNode(!0), u = t.__compiledEditor;
@@ -1021,9 +1023,9 @@ class Zi extends R {
1021
1023
  column: t,
1022
1024
  commit: r,
1023
1025
  cancel: o
1024
- }) : c.querySelectorAll("*").forEach((f) => {
1025
- f.childNodes.length === 1 && f.firstChild?.nodeType === Node.TEXT_NODE && (f.textContent = f.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (g, p) => {
1026
- if (!K(p)) return "";
1026
+ }) : c.querySelectorAll("*").forEach((g) => {
1027
+ g.childNodes.length === 1 && g.firstChild?.nodeType === Node.TEXT_NODE && (g.textContent = g.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (f, p) => {
1028
+ if (!H(p)) return "";
1027
1029
  const m = i[p];
1028
1030
  return m == null ? "" : String(m);
1029
1031
  }) || "");
@@ -1033,17 +1035,17 @@ class Zi extends R {
1033
1035
  );
1034
1036
  if (h) {
1035
1037
  h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
1036
- let f = !1;
1038
+ let g = !1;
1037
1039
  h.addEventListener("blur", () => {
1038
- f || r(N(h, t));
1039
- }), h.addEventListener("keydown", (g) => {
1040
- const p = g;
1041
- p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), f = !0, r(N(h, t)), this.#r(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#r(l, !0));
1040
+ g || r(z(h, t));
1041
+ }), h.addEventListener("keydown", (f) => {
1042
+ const p = f;
1043
+ p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(z(h, t)), this.#s(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#s(l, !0));
1042
1044
  }), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
1043
1045
  }
1044
1046
  e.appendChild(c);
1045
1047
  }
1046
- #h(e) {
1048
+ #g(e) {
1047
1049
  queueMicrotask(() => {
1048
1050
  try {
1049
1051
  const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
@@ -1059,7 +1061,7 @@ class Zi extends R {
1059
1061
  });
1060
1062
  }
1061
1063
  }
1062
- function ye(s, e = !0) {
1064
+ function xe(s, e = !0) {
1063
1065
  if (s == null) return "";
1064
1066
  if (s instanceof Date) return s.toISOString();
1065
1067
  if (typeof s == "object") return JSON.stringify(s);
@@ -1067,37 +1069,37 @@ function ye(s, e = !0) {
1067
1069
  return e && (t.includes(",") || t.includes('"') || t.includes(`
1068
1070
  `) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
1069
1071
  }
1070
- function xt(s, e, t, i = {}) {
1072
+ function Et(s, e, t, i = {}) {
1071
1073
  const n = i.delimiter ?? ",", r = i.newline ?? `
1072
1074
  `, o = [], a = i.bom ? "\uFEFF" : "";
1073
1075
  if (t.includeHeaders !== !1) {
1074
1076
  const l = e.map((d) => {
1075
1077
  const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
1076
- return ye(u);
1078
+ return xe(u);
1077
1079
  });
1078
1080
  o.push(l.join(n));
1079
1081
  }
1080
1082
  for (const l of s) {
1081
1083
  const d = e.map((c) => {
1082
1084
  let u = l[c.field];
1083
- return t.processCell && (u = t.processCell(u, c.field, l)), ye(u);
1085
+ return t.processCell && (u = t.processCell(u, c.field, l)), xe(u);
1084
1086
  });
1085
1087
  o.push(d.join(n));
1086
1088
  }
1087
1089
  return a + o.join(r);
1088
1090
  }
1089
- function se(s, e) {
1091
+ function le(s, e) {
1090
1092
  const t = URL.createObjectURL(s), i = document.createElement("a");
1091
1093
  i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
1092
1094
  }
1093
- function Rt(s, e) {
1095
+ function St(s, e) {
1094
1096
  const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
1095
- se(t, e);
1097
+ le(t, e);
1096
1098
  }
1097
- function Ce(s) {
1099
+ function Re(s) {
1098
1100
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1099
1101
  }
1100
- function Et(s, e, t) {
1102
+ function kt(s, e, t) {
1101
1103
  let i = `<?xml version="1.0" encoding="UTF-8"?>
1102
1104
  <?mso-application progid="Excel.Sheet"?>
1103
1105
  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
@@ -1109,7 +1111,7 @@ function Et(s, e, t) {
1109
1111
  <Row>`;
1110
1112
  for (const n of e) {
1111
1113
  const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
1112
- i += `<Cell><Data ss:Type="String">${Ce(o)}</Data></Cell>`;
1114
+ i += `<Cell><Data ss:Type="String">${Re(o)}</Data></Cell>`;
1113
1115
  }
1114
1116
  i += "</Row>";
1115
1117
  }
@@ -1120,7 +1122,7 @@ function Et(s, e, t) {
1120
1122
  let o = n[r.field];
1121
1123
  t.processCell && (o = t.processCell(o, r.field, n));
1122
1124
  let a = "String", l = "";
1123
- o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Ce(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
1125
+ o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Re(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
1124
1126
  }
1125
1127
  i += "</Row>";
1126
1128
  }
@@ -1129,13 +1131,13 @@ function Et(s, e, t) {
1129
1131
  </Worksheet>
1130
1132
  </Workbook>`, i;
1131
1133
  }
1132
- function St(s, e) {
1134
+ function At(s, e) {
1133
1135
  const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
1134
1136
  type: "application/vnd.ms-excel;charset=utf-8;"
1135
1137
  });
1136
- se(i, t);
1138
+ le(i, t);
1137
1139
  }
1138
- class Ji extends R {
1140
+ class on extends R {
1139
1141
  name = "export";
1140
1142
  get defaultConfig() {
1141
1143
  return {
@@ -1172,27 +1174,27 @@ class Ji extends R {
1172
1174
  try {
1173
1175
  switch (e) {
1174
1176
  case "csv": {
1175
- const l = xt(o, r, n, { bom: !0 });
1176
- a = a.endsWith(".csv") ? a : `${a}.csv`, Rt(l, a);
1177
+ const l = Et(o, r, n, { bom: !0 });
1178
+ a = a.endsWith(".csv") ? a : `${a}.csv`, St(l, a);
1177
1179
  break;
1178
1180
  }
1179
1181
  case "excel": {
1180
- const l = Et(o, r, n);
1181
- a = a.endsWith(".xls") ? a : `${a}.xls`, St(l, a);
1182
+ const l = kt(o, r, n);
1183
+ a = a.endsWith(".xls") ? a : `${a}.xls`, At(l, a);
1182
1184
  break;
1183
1185
  }
1184
1186
  case "json": {
1185
1187
  const l = o.map((u) => {
1186
1188
  const h = {};
1187
- for (const f of r) {
1188
- let g = u[f.field];
1189
- n.processCell && (g = n.processCell(g, f.field, u)), h[f.field] = g;
1189
+ for (const g of r) {
1190
+ let f = u[g.field];
1191
+ n.processCell && (f = n.processCell(f, g.field, u)), h[g.field] = f;
1190
1192
  }
1191
1193
  return h;
1192
1194
  }), d = JSON.stringify(l, null, 2);
1193
1195
  a = a.endsWith(".json") ? a : `${a}.json`;
1194
1196
  const c = new Blob([d], { type: "application/json" });
1195
- se(c, a);
1197
+ le(c, a);
1196
1198
  break;
1197
1199
  }
1198
1200
  }
@@ -1229,7 +1231,7 @@ class Ji extends R {
1229
1231
  return this.lastExportInfo;
1230
1232
  }
1231
1233
  }
1232
- function kt(s) {
1234
+ function _t(s) {
1233
1235
  const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
1234
1236
  let a = Math.floor(i / n) - r;
1235
1237
  a < 0 && (a = 0);
@@ -1241,10 +1243,10 @@ function kt(s) {
1241
1243
  totalHeight: e * n
1242
1244
  };
1243
1245
  }
1244
- function At(s, e) {
1246
+ function Lt(s, e) {
1245
1247
  return s <= e;
1246
1248
  }
1247
- function _t(s, e, t = !1) {
1249
+ function Tt(s, e, t = !1) {
1248
1250
  const i = s[e.field];
1249
1251
  if (e.operator === "blank")
1250
1252
  return i == null || i === "";
@@ -1283,10 +1285,10 @@ function _t(s, e, t = !1) {
1283
1285
  return !0;
1284
1286
  }
1285
1287
  }
1286
- function Lt(s, e, t = !1) {
1287
- return e.length ? s.filter((i) => e.every((n) => _t(i, n, t))) : s;
1288
+ function It(s, e, t = !1) {
1289
+ return e.length ? s.filter((i) => e.every((n) => Tt(i, n, t))) : s;
1288
1290
  }
1289
- function Tt(s) {
1291
+ function Pt(s) {
1290
1292
  return JSON.stringify(
1291
1293
  s.map((e) => ({
1292
1294
  field: e.field,
@@ -1296,7 +1298,7 @@ function Tt(s) {
1296
1298
  }))
1297
1299
  );
1298
1300
  }
1299
- function xe(s, e) {
1301
+ function Ee(s, e) {
1300
1302
  const t = /* @__PURE__ */ new Set();
1301
1303
  for (const i of s) {
1302
1304
  const n = i[e];
@@ -1304,10 +1306,10 @@ function xe(s, e) {
1304
1306
  }
1305
1307
  return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
1306
1308
  }
1307
- const It = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s;color:inherit;vertical-align:middle;&:hover,&.active{opacity:1;visibility:visible}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}}}', Ft = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-search-input{width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}}";
1309
+ const Ft = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', Dt = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-search-input{width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}}";
1308
1310
  class T extends R {
1309
1311
  name = "filtering";
1310
- styles = It;
1312
+ styles = Ft;
1311
1313
  get defaultConfig() {
1312
1314
  return {
1313
1315
  debounceMs: 300,
@@ -1354,10 +1356,10 @@ class T extends R {
1354
1356
  if (!t.length) return [...e];
1355
1357
  if (this.config.filterHandler)
1356
1358
  return this.cachedResult ? this.cachedResult : [...e];
1357
- const i = Tt(t);
1359
+ const i = Pt(t);
1358
1360
  if (this.cacheKey === i && this.cachedResult)
1359
1361
  return this.cachedResult;
1360
- const n = Lt([...e], t, this.config.caseSensitive);
1362
+ const n = It([...e], t, this.config.caseSensitive);
1361
1363
  return this.cachedResult = n, this.cacheKey = i, n;
1362
1364
  }
1363
1365
  afterRender() {
@@ -1435,7 +1437,7 @@ class T extends R {
1435
1437
  return this.getFilters();
1436
1438
  }
1437
1439
  getUniqueValues(e) {
1438
- return xe(this.sourceRows, e);
1440
+ return Ee(this.sourceRows, e);
1439
1441
  }
1440
1442
  copyGridThemeContext(e) {
1441
1443
  const t = this.gridElement;
@@ -1452,7 +1454,7 @@ class T extends R {
1452
1454
  return;
1453
1455
  }
1454
1456
  const e = document.createElement("style");
1455
- e.id = "tbw-filter-panel-styles", e.textContent = Ft, document.head.appendChild(e), this.globalStylesInjected = !0;
1457
+ e.id = "tbw-filter-panel-styles", e.textContent = Dt, document.head.appendChild(e), this.globalStylesInjected = !0;
1456
1458
  }
1457
1459
  toggleFilterPanel(e, t, i) {
1458
1460
  if (this.openPanelField === e) {
@@ -1467,7 +1469,7 @@ class T extends R {
1467
1469
  });
1468
1470
  return;
1469
1471
  }
1470
- const r = xe(this.sourceRows, e);
1472
+ const r = Ee(this.sourceRows, e);
1471
1473
  this.renderPanelContent(e, t, n, r), document.body.appendChild(n), this.positionPanel(n, i), this.setupPanelCloseHandler(n, i);
1472
1474
  }
1473
1475
  renderPanelContent(e, t, i, n) {
@@ -1540,7 +1542,7 @@ class T extends R {
1540
1542
  u.type = "checkbox", u.className = "tbw-filter-checkbox";
1541
1543
  const h = document.createElement("span");
1542
1544
  h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
1543
- const f = () => {
1545
+ const g = () => {
1544
1546
  const y = [...w.values()], E = y.every((C) => C), A = y.every((C) => !C);
1545
1547
  u.checked = E, u.indeterminate = !E && !A;
1546
1548
  };
@@ -1548,38 +1550,38 @@ class T extends R {
1548
1550
  const y = u.checked;
1549
1551
  for (const E of w.keys())
1550
1552
  w.set(E, y);
1551
- f(), S();
1553
+ g(), S();
1552
1554
  }), e.appendChild(d);
1553
- const g = document.createElement("div");
1554
- g.className = "tbw-filter-values";
1555
+ const f = document.createElement("div");
1556
+ f.className = "tbw-filter-values";
1555
1557
  const p = document.createElement("div");
1556
- p.className = "tbw-filter-values-spacer", g.appendChild(p);
1558
+ p.className = "tbw-filter-values-spacer", f.appendChild(p);
1557
1559
  const m = document.createElement("div");
1558
- m.className = "tbw-filter-values-content", g.appendChild(m);
1560
+ m.className = "tbw-filter-values-content", f.appendChild(m);
1559
1561
  const w = /* @__PURE__ */ new Map();
1560
1562
  i.forEach((y) => {
1561
1563
  const E = y == null ? "__null__" : String(y);
1562
1564
  w.set(E, !n.has(y));
1563
- }), f();
1565
+ }), g();
1564
1566
  let b = [];
1565
1567
  const v = (y, E) => {
1566
1568
  const A = y == null ? "(Blank)" : String(y), C = y == null ? "__null__" : String(y), x = document.createElement("label");
1567
1569
  x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `${E * o}px`, x.style.left = "0", x.style.right = "0", x.style.height = `${o}px`, x.style.boxSizing = "border-box";
1568
1570
  const k = document.createElement("input");
1569
1571
  k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = w.get(C) ?? !0, k.dataset.value = C, k.addEventListener("change", () => {
1570
- w.set(C, k.checked), f();
1572
+ w.set(C, k.checked), g();
1571
1573
  });
1572
- const de = document.createElement("span");
1573
- return de.textContent = A, x.appendChild(k), x.appendChild(de), x;
1574
+ const ue = document.createElement("span");
1575
+ return ue.textContent = A, x.appendChild(k), x.appendChild(ue), x;
1574
1576
  }, S = () => {
1575
- const y = b.length, E = g.clientHeight, A = g.scrollTop;
1576
- if (p.style.height = `${y * o}px`, At(y, T.LIST_BYPASS_THRESHOLD / 3)) {
1577
+ const y = b.length, E = f.clientHeight, A = f.scrollTop;
1578
+ if (p.style.height = `${y * o}px`, Lt(y, T.LIST_BYPASS_THRESHOLD / 3)) {
1577
1579
  m.innerHTML = "", m.style.transform = "translateY(0px)", b.forEach((x, k) => {
1578
1580
  m.appendChild(v(x, k));
1579
1581
  });
1580
1582
  return;
1581
1583
  }
1582
- const C = kt({
1584
+ const C = _t({
1583
1585
  totalRows: y,
1584
1586
  viewportHeight: E,
1585
1587
  scrollTop: A,
@@ -1589,7 +1591,7 @@ class T extends R {
1589
1591
  m.style.transform = `translateY(${C.offsetY}px)`, m.innerHTML = "";
1590
1592
  for (let x = C.start; x < C.end; x++)
1591
1593
  m.appendChild(v(b[x], x - C.start));
1592
- }, q = (y) => {
1594
+ }, N = (y) => {
1593
1595
  const E = this.config.caseSensitive ?? !1, A = E ? y : y.toLowerCase();
1594
1596
  if (b = i.filter((C) => {
1595
1597
  const x = C == null ? "(Blank)" : String(C), k = E ? x : x.toLowerCase();
@@ -1602,23 +1604,23 @@ class T extends R {
1602
1604
  }
1603
1605
  S();
1604
1606
  };
1605
- g.addEventListener(
1607
+ f.addEventListener(
1606
1608
  "scroll",
1607
1609
  () => {
1608
1610
  b.length > 0 && S();
1609
1611
  },
1610
1612
  { passive: !0 }
1611
- ), q(l.value), e.appendChild(g);
1612
- let le;
1613
+ ), N(l.value), e.appendChild(f);
1614
+ let ce;
1613
1615
  l.addEventListener("input", () => {
1614
- clearTimeout(le), le = setTimeout(() => {
1615
- this.searchText.set(r, l.value), q(l.value);
1616
+ clearTimeout(ce), ce = setTimeout(() => {
1617
+ this.searchText.set(r, l.value), N(l.value);
1616
1618
  }, this.config.debounceMs ?? 150);
1617
1619
  });
1618
- const z = document.createElement("div");
1619
- z.className = "tbw-filter-buttons";
1620
- const G = document.createElement("button");
1621
- G.className = "tbw-filter-apply-btn", G.textContent = "Apply", G.addEventListener("click", () => {
1620
+ const G = document.createElement("div");
1621
+ G.className = "tbw-filter-buttons";
1622
+ const O = document.createElement("button");
1623
+ O.className = "tbw-filter-apply-btn", O.textContent = "Apply", O.addEventListener("click", () => {
1622
1624
  const y = [];
1623
1625
  for (const [E, A] of w)
1624
1626
  if (!A)
@@ -1629,11 +1631,11 @@ class T extends R {
1629
1631
  y.push(C !== void 0 ? C : E);
1630
1632
  }
1631
1633
  t.applySetFilter(y);
1632
- }), z.appendChild(G);
1633
- const O = document.createElement("button");
1634
- O.className = "tbw-filter-clear-btn", O.textContent = "Clear Filter", O.addEventListener("click", () => {
1634
+ }), G.appendChild(O);
1635
+ const B = document.createElement("button");
1636
+ B.className = "tbw-filter-clear-btn", B.textContent = "Clear Filter", B.addEventListener("click", () => {
1635
1637
  t.clearFilter();
1636
- }), z.appendChild(O), e.appendChild(z);
1638
+ }), G.appendChild(B), e.appendChild(G);
1637
1639
  }
1638
1640
  applySetFilter(e, t) {
1639
1641
  this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
@@ -1699,7 +1701,7 @@ class T extends R {
1699
1701
  this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
1700
1702
  }
1701
1703
  }
1702
- function Re(s) {
1704
+ function Se(s) {
1703
1705
  if (!s.length) return [];
1704
1706
  const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
1705
1707
  if (!a.length) return;
@@ -1734,7 +1736,7 @@ function Re(s) {
1734
1736
  }, e.set(d, c), t.push(c)), c.columns.push(o);
1735
1737
  }), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
1736
1738
  }
1737
- function Dt(s, e, t) {
1739
+ function Mt(s, e, t) {
1738
1740
  if (!e.length || !s) return;
1739
1741
  const i = /* @__PURE__ */ new Map();
1740
1742
  for (const r of e)
@@ -1750,7 +1752,7 @@ function Dt(s, e, t) {
1750
1752
  a && a.classList.add("group-end");
1751
1753
  }
1752
1754
  }
1753
- function Pt(s, e) {
1755
+ function qt(s, e) {
1754
1756
  if (s.length === 0) return null;
1755
1757
  const t = document.createElement("div");
1756
1758
  t.className = "header-group-row", t.setAttribute("role", "row");
@@ -1762,11 +1764,11 @@ function Pt(s, e) {
1762
1764
  }
1763
1765
  return t;
1764
1766
  }
1765
- function Mt(s) {
1767
+ function Nt(s) {
1766
1768
  return s.some((e) => e.group != null);
1767
1769
  }
1768
- const qt = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
1769
- class Qi extends R {
1770
+ const Ht = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
1771
+ class sn extends R {
1770
1772
  static manifest = {
1771
1773
  ownedProperties: [
1772
1774
  {
@@ -1783,7 +1785,7 @@ class Qi extends R {
1783
1785
  ]
1784
1786
  };
1785
1787
  name = "groupingColumns";
1786
- styles = qt;
1788
+ styles = Ht;
1787
1789
  get defaultConfig() {
1788
1790
  return {
1789
1791
  showGroupBorders: !0
@@ -1798,7 +1800,7 @@ class Qi extends R {
1798
1800
  if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
1799
1801
  return !0;
1800
1802
  const i = t?.columns;
1801
- return Array.isArray(i) ? Mt(i) : !1;
1803
+ return Array.isArray(i) ? Nt(i) : !1;
1802
1804
  }
1803
1805
  processColumns(e) {
1804
1806
  const t = this.grid?.gridConfig?.columnGroups;
@@ -1814,7 +1816,7 @@ class Qi extends R {
1814
1816
  });
1815
1817
  } else
1816
1818
  i = [...e];
1817
- const n = Re(i);
1819
+ const n = Se(i);
1818
1820
  return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
1819
1821
  }
1820
1822
  afterRender() {
@@ -1827,16 +1829,16 @@ class Qi extends R {
1827
1829
  if (!e) return;
1828
1830
  const t = e.querySelector(".header-group-row");
1829
1831
  t && t.remove();
1830
- const i = this.columns, n = Re(i);
1832
+ const i = this.columns, n = Se(i);
1831
1833
  if (n.length === 0) return;
1832
- const r = Pt(n, i);
1834
+ const r = qt(n, i);
1833
1835
  if (r) {
1834
1836
  r.classList.toggle("no-borders", !this.config.showGroupBorders);
1835
1837
  const a = e.querySelector(".header-row");
1836
1838
  a ? e.insertBefore(r, a) : e.appendChild(r);
1837
1839
  }
1838
1840
  const o = e.querySelector(".header-row");
1839
- o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Dt(o, n)), this.#e(n);
1841
+ o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Mt(o, n)), this.#e(n);
1840
1842
  }
1841
1843
  #e(e) {
1842
1844
  if (!this.config.showGroupBorders) return;
@@ -1877,9 +1879,9 @@ function Kt({ rows: s, config: e, expanded: t }) {
1877
1879
  l == null || l === !1 ? l = ["__ungrouped__"] : Array.isArray(l) || (l = [l]);
1878
1880
  let d = n;
1879
1881
  l.forEach((c, u) => {
1880
- const h = c == null ? "∅" : String(c), f = d.key === "__root__" ? h : d.key + "||" + h;
1881
- let g = d.children.get(h);
1882
- g || (g = { key: f, value: c, depth: u, rows: [], children: /* @__PURE__ */ new Map(), parent: d }, d.children.set(h, g)), d = g;
1882
+ const h = c == null ? "∅" : String(c), g = d.key === "__root__" ? h : d.key + "||" + h;
1883
+ let f = d.children.get(h);
1884
+ f || (f = { key: g, value: c, depth: u, rows: [], children: /* @__PURE__ */ new Map(), parent: d }, d.children.set(h, f)), d = f;
1883
1885
  }), d.rows.push(a);
1884
1886
  }), n.children.size === 1 && n.children.has("__ungrouped__") && n.children.get("__ungrouped__").rows.length === s.length)
1885
1887
  return [];
@@ -1900,26 +1902,26 @@ function Kt({ rows: s, config: e, expanded: t }) {
1900
1902
  };
1901
1903
  return o(n), r;
1902
1904
  }
1903
- function Ht(s, e) {
1905
+ function zt(s, e) {
1904
1906
  const t = new Set(s);
1905
1907
  return t.has(e) ? t.delete(e) : t.add(e), t;
1906
1908
  }
1907
- function Nt(s) {
1909
+ function Gt(s) {
1908
1910
  const e = /* @__PURE__ */ new Set();
1909
1911
  for (const t of s)
1910
1912
  t.kind === "group" && e.add(t.key);
1911
1913
  return e;
1912
1914
  }
1913
- function zt() {
1915
+ function Ot() {
1914
1916
  return /* @__PURE__ */ new Set();
1915
1917
  }
1916
- function Gt(s) {
1918
+ function Bt(s) {
1917
1919
  return s.kind !== "group" ? 0 : s.rows.length;
1918
1920
  }
1919
- const Ot = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
1920
- class en extends R {
1921
+ const Vt = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
1922
+ class an extends R {
1921
1923
  name = "groupingRows";
1922
- styles = Ot;
1924
+ styles = Vt;
1923
1925
  get defaultConfig() {
1924
1926
  return {
1925
1927
  defaultExpanded: !1,
@@ -1968,7 +1970,7 @@ class en extends R {
1968
1970
  __groupDepth: r.depth,
1969
1971
  __groupRows: r.rows,
1970
1972
  __groupExpanded: r.expanded,
1971
- __groupRowCount: Gt(r)
1973
+ __groupRowCount: Bt(r)
1972
1974
  } : r.row);
1973
1975
  }
1974
1976
  onCellClick(e) {
@@ -2042,42 +2044,42 @@ class en extends R {
2042
2044
  d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
2043
2045
  let c = !1;
2044
2046
  o.forEach((u, h) => {
2045
- const f = document.createElement("div");
2046
- if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), re(u)) {
2047
- f.setAttribute("data-field", u.field), t.appendChild(f);
2047
+ const g = document.createElement("div");
2048
+ if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), se(u)) {
2049
+ g.setAttribute("data-field", u.field), t.appendChild(g);
2048
2050
  return;
2049
2051
  }
2050
2052
  if (c) {
2051
- const g = r[u.field];
2052
- if (g) {
2053
- const p = ce(g, a, u.field, u);
2054
- f.textContent = p != null ? String(p) : "";
2053
+ const f = r[u.field];
2054
+ if (f) {
2055
+ const p = he(f, a, u.field, u);
2056
+ g.textContent = p != null ? String(p) : "";
2055
2057
  } else
2056
- f.textContent = "";
2058
+ g.textContent = "";
2057
2059
  } else {
2058
- c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
2059
- const g = document.createElement("span"), p = r[u.field];
2060
+ c = !0, g.appendChild(this.createToggleButton(e.__groupExpanded, i));
2061
+ const f = document.createElement("span"), p = r[u.field];
2060
2062
  if (p) {
2061
- const m = ce(p, a, u.field, u);
2062
- g.textContent = m != null ? String(m) : String(e.__groupValue);
2063
+ const m = he(p, a, u.field, u);
2064
+ f.textContent = m != null ? String(m) : String(e.__groupValue);
2063
2065
  } else
2064
- g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
2065
- if (f.appendChild(g), n.showRowCount !== !1) {
2066
+ f.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
2067
+ if (g.appendChild(f), n.showRowCount !== !1) {
2066
2068
  const m = document.createElement("span");
2067
- m.className = "group-count", m.textContent = ` (${a.length})`, f.appendChild(m);
2069
+ m.className = "group-count", m.textContent = ` (${a.length})`, g.appendChild(m);
2068
2070
  }
2069
2071
  }
2070
- t.appendChild(f);
2072
+ t.appendChild(g);
2071
2073
  });
2072
2074
  }
2073
2075
  expandAll() {
2074
- this.expandedKeys = Nt(this.flattenedRows), this.requestRender();
2076
+ this.expandedKeys = Gt(this.flattenedRows), this.requestRender();
2075
2077
  }
2076
2078
  collapseAll() {
2077
- this.expandedKeys = zt(), this.requestRender();
2079
+ this.expandedKeys = Ot(), this.requestRender();
2078
2080
  }
2079
2081
  toggle(e) {
2080
- this.expandedKeys = Ht(this.expandedKeys, e);
2082
+ this.expandedKeys = zt(this.expandedKeys, e);
2081
2083
  const t = this.flattenedRows.find((i) => i.kind === "group" && i.key === e);
2082
2084
  this.emit("group-toggle", {
2083
2085
  key: e,
@@ -2126,22 +2128,22 @@ class en extends R {
2126
2128
  this.config.groupOn = e, this.requestRender();
2127
2129
  }
2128
2130
  }
2129
- function Ee(s, e) {
2131
+ function ke(s, e) {
2130
2132
  const t = new Set(s);
2131
2133
  return t.has(e) ? t.delete(e) : t.add(e), t;
2132
2134
  }
2133
- function Bt(s, e) {
2135
+ function Wt(s, e) {
2134
2136
  const t = new Set(s);
2135
2137
  return t.add(e), t;
2136
2138
  }
2137
- function Vt(s, e) {
2139
+ function $t(s, e) {
2138
2140
  const t = new Set(s);
2139
2141
  return t.delete(e), t;
2140
2142
  }
2141
- function Wt(s, e) {
2143
+ function jt(s, e) {
2142
2144
  return s.has(e);
2143
2145
  }
2144
- function $t(s, e, t, i) {
2146
+ function Ut(s, e, t, i) {
2145
2147
  const n = document.createElement("div");
2146
2148
  n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
2147
2149
  const r = document.createElement("div");
@@ -2149,10 +2151,10 @@ function $t(s, e, t, i) {
2149
2151
  const o = t(s, e);
2150
2152
  return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
2151
2153
  }
2152
- const jt = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
2153
- class Ve extends R {
2154
+ const Yt = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
2155
+ class $e extends R {
2154
2156
  name = "masterDetail";
2155
- styles = jt;
2157
+ styles = Yt;
2156
2158
  get defaultConfig() {
2157
2159
  return {
2158
2160
  detailHeight: "auto",
@@ -2181,8 +2183,8 @@ class Ve extends R {
2181
2183
  n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), a !== null && (d.collapseOnClickOutside = a === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
2182
2184
  const c = t.innerHTML.trim();
2183
2185
  c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
2184
- const f = Ze(c, { value: u, row: u });
2185
- return Je(f);
2186
+ const g = Qe(c, { value: u, row: u });
2187
+ return et(g);
2186
2188
  }), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
2187
2189
  }
2188
2190
  get animationStyle() {
@@ -2213,10 +2215,10 @@ class Ve extends R {
2213
2215
  static DEFAULT_DETAIL_HEIGHT = 150;
2214
2216
  getDetailHeight(e) {
2215
2217
  const t = this.detailElements.get(e);
2216
- return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : Ve.DEFAULT_DETAIL_HEIGHT;
2218
+ return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : $e.DEFAULT_DETAIL_HEIGHT;
2217
2219
  }
2218
2220
  toggleAndEmit(e, t) {
2219
- this.expandedRows = Ee(this.expandedRows, e), this.emit("detail-expand", {
2221
+ this.expandedRows = ke(this.expandedRows, e), this.emit("detail-expand", {
2220
2222
  rowIndex: t,
2221
2223
  row: e,
2222
2224
  expanded: this.expandedRows.has(e)
@@ -2229,9 +2231,9 @@ class Ve extends R {
2229
2231
  if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
2230
2232
  return [...e];
2231
2233
  const i = [...e];
2232
- if (it(i))
2234
+ if (rt(i))
2233
2235
  return i;
2234
- const r = nt(this.name);
2236
+ const r = ot(this.name);
2235
2237
  return r.viewRenderer = (o) => {
2236
2238
  const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
2237
2239
  d.className = "master-detail-expander expander-cell";
@@ -2251,7 +2253,7 @@ class Ve extends R {
2251
2253
  onKeyDown(e) {
2252
2254
  if (e.key !== " ") return;
2253
2255
  const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
2254
- if (!n || !re(n)) return;
2256
+ if (!n || !se(n)) return;
2255
2257
  const r = this.rows[i];
2256
2258
  if (r)
2257
2259
  return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
@@ -2284,7 +2286,7 @@ class Ve extends R {
2284
2286
  d.previousElementSibling !== a && a.after(d);
2285
2287
  continue;
2286
2288
  }
2287
- const c = $t(l, o, this.config.detailRenderer, n);
2289
+ const c = Ut(l, o, this.config.detailRenderer, n);
2288
2290
  typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
2289
2291
  }
2290
2292
  }
@@ -2319,19 +2321,19 @@ class Ve extends R {
2319
2321
  }
2320
2322
  expand(e) {
2321
2323
  const t = this.rows[e];
2322
- t && (this.expandedRows = Bt(this.expandedRows, t), this.requestRender());
2324
+ t && (this.expandedRows = Wt(this.expandedRows, t), this.requestRender());
2323
2325
  }
2324
2326
  collapse(e) {
2325
2327
  const t = this.rows[e];
2326
- t && (this.expandedRows = Vt(this.expandedRows, t), this.requestRender());
2328
+ t && (this.expandedRows = $t(this.expandedRows, t), this.requestRender());
2327
2329
  }
2328
2330
  toggle(e) {
2329
2331
  const t = this.rows[e];
2330
- t && (this.expandedRows = Ee(this.expandedRows, t), this.requestRender());
2332
+ t && (this.expandedRows = ke(this.expandedRows, t), this.requestRender());
2331
2333
  }
2332
2334
  isExpanded(e) {
2333
2335
  const t = this.rows[e];
2334
- return t ? Wt(this.expandedRows, t) : !1;
2336
+ return t ? jt(this.expandedRows, t) : !1;
2335
2337
  }
2336
2338
  expandAll() {
2337
2339
  for (const e of this.rows)
@@ -2361,34 +2363,34 @@ class Ve extends R {
2361
2363
  }
2362
2364
  }
2363
2365
  }
2364
- function Ut(s, e, t) {
2366
+ function Xt(s, e, t) {
2365
2367
  return e.length ? [...s].sort((i, n) => {
2366
2368
  for (const r of e) {
2367
- const a = t.find((u) => u.field === r.field)?.sortComparator ?? Yt, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
2369
+ const a = t.find((u) => u.field === r.field)?.sortComparator ?? Zt, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
2368
2370
  if (c !== 0)
2369
2371
  return r.direction === "asc" ? c : -c;
2370
2372
  }
2371
2373
  return 0;
2372
2374
  }) : [...s];
2373
2375
  }
2374
- function Yt(s, e) {
2376
+ function Zt(s, e) {
2375
2377
  return s == null && e == null ? 0 : s == null ? 1 : e == null ? -1 : typeof s == "number" && typeof e == "number" ? s - e : s instanceof Date && e instanceof Date ? s.getTime() - e.getTime() : typeof s == "boolean" && typeof e == "boolean" ? s === e ? 0 : s ? -1 : 1 : String(s).localeCompare(String(e));
2376
2378
  }
2377
- function Xt(s, e, t, i) {
2379
+ function Jt(s, e, t, i) {
2378
2380
  const n = s.find((r) => r.field === e);
2379
2381
  return t ? n ? n.direction === "asc" ? s.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : s.filter((r) => r.field !== e) : s.length < i ? [...s, { field: e, direction: "asc" }] : s : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
2380
2382
  }
2381
- function Se(s, e) {
2383
+ function Ae(s, e) {
2382
2384
  const t = s.findIndex((i) => i.field === e);
2383
2385
  return t >= 0 ? t + 1 : void 0;
2384
2386
  }
2385
- function ke(s, e) {
2387
+ function _e(s, e) {
2386
2388
  return s.find((t) => t.field === e)?.direction;
2387
2389
  }
2388
- const Zt = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
2389
- class tn extends R {
2390
+ const Qt = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
2391
+ class ln extends R {
2390
2392
  name = "multiSort";
2391
- styles = Zt;
2393
+ styles = Qt;
2392
2394
  get defaultConfig() {
2393
2395
  return {
2394
2396
  maxSortColumns: 3,
@@ -2400,12 +2402,12 @@ class tn extends R {
2400
2402
  this.sortModel = [];
2401
2403
  }
2402
2404
  processRows(e) {
2403
- return this.sortModel.length === 0 ? [...e] : Ut([...e], this.sortModel, [...this.columns]);
2405
+ return this.sortModel.length === 0 ? [...e] : Xt([...e], this.sortModel, [...this.columns]);
2404
2406
  }
2405
2407
  onHeaderClick(e) {
2406
2408
  if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
2407
2409
  const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
2408
- return this.sortModel = Xt(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2410
+ return this.sortModel = Jt(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2409
2411
  }
2410
2412
  afterRender() {
2411
2413
  const e = this.gridElement;
@@ -2414,15 +2416,15 @@ class tn extends R {
2414
2416
  e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
2415
2417
  const r = n.getAttribute("data-field");
2416
2418
  if (!r) return;
2417
- const o = Se(this.sortModel, r), a = ke(this.sortModel, r);
2419
+ const o = Ae(this.sortModel, r), a = _e(this.sortModel, r);
2418
2420
  if (n.querySelector(".sort-index")?.remove(), a) {
2419
2421
  n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
2420
2422
  const c = document.createElement("span");
2421
2423
  c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(a === "asc" ? "sortAsc" : "sortDesc"));
2422
- const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), f = u ?? h;
2423
- if (f ? n.insertBefore(c, f) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
2424
- const g = document.createElement("span");
2425
- g.className = "sort-index", g.textContent = String(o), c.nextSibling ? n.insertBefore(g, c.nextSibling) : n.appendChild(g);
2424
+ const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), g = u ?? h;
2425
+ if (g ? n.insertBefore(c, g) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
2426
+ const f = document.createElement("span");
2427
+ f.className = "sort-index", f.textContent = String(o), c.nextSibling ? n.insertBefore(f, c.nextSibling) : n.appendChild(f);
2426
2428
  }
2427
2429
  } else
2428
2430
  n.removeAttribute("data-sort");
@@ -2438,10 +2440,10 @@ class tn extends R {
2438
2440
  this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
2439
2441
  }
2440
2442
  getSortIndex(e) {
2441
- return Se(this.sortModel, e);
2443
+ return Ae(this.sortModel, e);
2442
2444
  }
2443
2445
  getSortDirection(e) {
2444
- return ke(this.sortModel, e);
2446
+ return _e(this.sortModel, e);
2445
2447
  }
2446
2448
  getColumnState(e) {
2447
2449
  const t = this.sortModel.findIndex((n) => n.field === e);
@@ -2464,16 +2466,16 @@ class tn extends R {
2464
2466
  i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
2465
2467
  }
2466
2468
  }
2467
- function Jt(s) {
2469
+ function ei(s) {
2468
2470
  return s.filter((e) => e.sticky === "left");
2469
2471
  }
2470
- function Qt(s) {
2472
+ function ti(s) {
2471
2473
  return s.filter((e) => e.sticky === "right");
2472
2474
  }
2473
- function X(s) {
2475
+ function J(s) {
2474
2476
  return s.some((e) => e.sticky === "left" || e.sticky === "right");
2475
2477
  }
2476
- function Ae(s, e) {
2478
+ function Le(s, e) {
2477
2479
  const t = Array.from(s.querySelectorAll(".header-row .cell"));
2478
2480
  if (!t.length) return;
2479
2481
  const i = /* @__PURE__ */ new Map();
@@ -2497,12 +2499,12 @@ function Ae(s, e) {
2497
2499
  }), r += l.offsetWidth);
2498
2500
  }
2499
2501
  }
2500
- function _e(s) {
2502
+ function Te(s) {
2501
2503
  s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
2502
2504
  t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
2503
2505
  });
2504
2506
  }
2505
- class nn extends R {
2507
+ class dn extends R {
2506
2508
  static manifest = {
2507
2509
  ownedProperties: [
2508
2510
  {
@@ -2525,26 +2527,26 @@ class nn extends R {
2525
2527
  }
2526
2528
  static detect(e, t) {
2527
2529
  const i = t?.columns;
2528
- return Array.isArray(i) ? X(i) : !1;
2530
+ return Array.isArray(i) ? J(i) : !1;
2529
2531
  }
2530
2532
  processColumns(e) {
2531
- return this.isApplied = X([...e]), [...e];
2533
+ return this.isApplied = J([...e]), [...e];
2532
2534
  }
2533
2535
  afterRender() {
2534
2536
  if (!this.isApplied)
2535
2537
  return;
2536
2538
  const e = this.grid, t = [...this.columns];
2537
- if (!X(t)) {
2538
- _e(e), this.isApplied = !1;
2539
+ if (!J(t)) {
2540
+ Te(e), this.isApplied = !1;
2539
2541
  return;
2540
2542
  }
2541
2543
  queueMicrotask(() => {
2542
- Ae(e, t);
2544
+ Le(e, t);
2543
2545
  });
2544
2546
  }
2545
2547
  onPluginQuery(e) {
2546
2548
  switch (e.type) {
2547
- case Oe.CAN_MOVE_COLUMN: {
2549
+ case Ve.CAN_MOVE_COLUMN: {
2548
2550
  const t = e.context, i = t.sticky;
2549
2551
  if (i === "left" || i === "right")
2550
2552
  return !1;
@@ -2557,18 +2559,18 @@ class nn extends R {
2557
2559
  }
2558
2560
  refreshStickyOffsets() {
2559
2561
  const e = [...this.columns];
2560
- Ae(this.grid, e);
2562
+ Le(this.grid, e);
2561
2563
  }
2562
2564
  getLeftPinnedColumns() {
2563
2565
  const e = [...this.columns];
2564
- return Jt(e);
2566
+ return ei(e);
2565
2567
  }
2566
2568
  getRightPinnedColumns() {
2567
2569
  const e = [...this.columns];
2568
- return Qt(e);
2570
+ return ti(e);
2569
2571
  }
2570
2572
  clearStickyPositions() {
2571
- _e(this.grid);
2573
+ Te(this.grid);
2572
2574
  }
2573
2575
  getHorizontalScrollOffsets(e, t) {
2574
2576
  if (!this.isApplied)
@@ -2589,10 +2591,10 @@ class nn extends R {
2589
2591
  return { left: i, right: n, skipScroll: r };
2590
2592
  }
2591
2593
  }
2592
- function ei(s) {
2594
+ function ii(s) {
2593
2595
  return typeof s == "object" && s !== null && "aggFunc" in s;
2594
2596
  }
2595
- function Z(s, e) {
2597
+ function Q(s, e) {
2596
2598
  const t = document.createElement("div");
2597
2599
  t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
2598
2600
  const i = document.createElement("div");
@@ -2614,7 +2616,7 @@ function Z(s, e) {
2614
2616
  }
2615
2617
  if (s.customPanels)
2616
2618
  for (const o of s.customPanels) {
2617
- const a = ti(o, e);
2619
+ const a = ni(o, e);
2618
2620
  switch (o.position) {
2619
2621
  case "left":
2620
2622
  i.appendChild(a);
@@ -2629,11 +2631,11 @@ function Z(s, e) {
2629
2631
  }
2630
2632
  return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
2631
2633
  }
2632
- function Le(s) {
2634
+ function Ie(s) {
2633
2635
  const e = document.createElement("div");
2634
2636
  return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
2635
2637
  }
2636
- function Te(s, e, t, i) {
2638
+ function Pe(s, e, t, i) {
2637
2639
  s.innerHTML = "";
2638
2640
  for (const n of e) {
2639
2641
  const r = document.createElement("div");
@@ -2647,11 +2649,11 @@ function Te(s, e, t, i) {
2647
2649
  let l, d;
2648
2650
  const c = n.aggregators?.[o.field];
2649
2651
  if (c)
2650
- if (ei(c)) {
2651
- const u = ue(c.aggFunc);
2652
+ if (ii(c)) {
2653
+ const u = ge(c.aggFunc);
2652
2654
  u && (l = u(i, o.field, o)), d = c.formatter;
2653
2655
  } else {
2654
- const u = ue(c);
2656
+ const u = ge(c);
2655
2657
  u && (l = u(i, o.field, o));
2656
2658
  }
2657
2659
  else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
@@ -2663,13 +2665,13 @@ function Te(s, e, t, i) {
2663
2665
  s.appendChild(r);
2664
2666
  }
2665
2667
  }
2666
- function ti(s, e) {
2668
+ function ni(s, e) {
2667
2669
  const t = document.createElement("div");
2668
2670
  t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
2669
2671
  const i = s.render(e);
2670
2672
  return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
2671
2673
  }
2672
- function Ie(s, e, t, i, n) {
2674
+ function Fe(s, e, t, i, n) {
2673
2675
  return {
2674
2676
  totalRows: s.length,
2675
2677
  filteredRows: n?.cachedResult?.length ?? s.length,
@@ -2679,10 +2681,10 @@ function Ie(s, e, t, i, n) {
2679
2681
  grid: t
2680
2682
  };
2681
2683
  }
2682
- const ii = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
2683
- class rn extends R {
2684
+ const ri = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
2685
+ class cn extends R {
2684
2686
  name = "pinnedRows";
2685
- styles = ii;
2687
+ styles = ri;
2686
2688
  get defaultConfig() {
2687
2689
  return {
2688
2690
  position: "bottom",
@@ -2704,7 +2706,7 @@ class rn extends R {
2704
2706
  const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
2705
2707
  if (!t) return;
2706
2708
  this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
2707
- const i = this.getSelectionState(), n = this.getFilterState(), r = Ie(
2709
+ const i = this.getSelectionState(), n = this.getFilterState(), r = Fe(
2708
2710
  this.rows,
2709
2711
  this.columns,
2710
2712
  this.grid,
@@ -2713,11 +2715,11 @@ class rn extends R {
2713
2715
  ), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
2714
2716
  if (a.length > 0) {
2715
2717
  if (!this.topAggregationContainer) {
2716
- this.topAggregationContainer = Le("top");
2718
+ this.topAggregationContainer = Ie("top");
2717
2719
  const h = e.querySelector(".header");
2718
2720
  h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
2719
2721
  }
2720
- Te(
2722
+ Pe(
2721
2723
  this.topAggregationContainer,
2722
2724
  a,
2723
2725
  this.visibleColumns,
@@ -2727,18 +2729,18 @@ class rn extends R {
2727
2729
  const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && r.selectedRows > 0 || this.config.showFilteredCount && r.filteredRows !== r.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = l.length > 0 || c;
2728
2730
  if (d && this.config.position === "top")
2729
2731
  if (!this.infoBarElement)
2730
- this.infoBarElement = Z(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
2732
+ this.infoBarElement = Q(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
2731
2733
  else {
2732
- const h = Z(this.config, r);
2734
+ const h = Q(this.config, r);
2733
2735
  this.infoBarElement.replaceWith(h), this.infoBarElement = h;
2734
2736
  }
2735
2737
  else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
2736
- u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Le("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Te(
2738
+ u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Ie("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Pe(
2737
2739
  this.bottomAggregationContainer,
2738
2740
  l,
2739
2741
  this.visibleColumns,
2740
2742
  this.rows
2741
- )), c && (this.infoBarElement = Z(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2743
+ )), c && (this.infoBarElement = Q(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2742
2744
  }
2743
2745
  cleanup() {
2744
2746
  this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null), this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null), this.bottomAggregationContainer && (this.bottomAggregationContainer.remove(), this.bottomAggregationContainer = null), this.footerWrapper && (this.footerWrapper.remove(), this.footerWrapper = null);
@@ -2765,7 +2767,7 @@ class rn extends R {
2765
2767
  }
2766
2768
  getContext() {
2767
2769
  const e = this.getSelectionState(), t = this.getFilterState();
2768
- return Ie(
2770
+ return Fe(
2769
2771
  this.rows,
2770
2772
  this.columns,
2771
2773
  this.grid,
@@ -2786,16 +2788,16 @@ class rn extends R {
2786
2788
  this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
2787
2789
  }
2788
2790
  }
2789
- const ni = Qe;
2790
- function ri(s) {
2791
+ const oi = tt;
2792
+ function si(s) {
2791
2793
  const e = [];
2792
2794
  return !s.rowGroupFields?.length && !s.columnGroupFields?.length && e.push("At least one row or column group field is required"), s.valueFields?.length || e.push("At least one value field is required"), e;
2793
2795
  }
2794
- function ae(s, e) {
2796
+ function de(s, e) {
2795
2797
  return [...s, e].join("|");
2796
2798
  }
2797
- function oi(s, e) {
2798
- const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = si(s, i), o = We(
2799
+ function ai(s, e) {
2800
+ const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = li(s, i), o = je(
2799
2801
  s,
2800
2802
  t,
2801
2803
  i,
@@ -2803,7 +2805,7 @@ function oi(s, e) {
2803
2805
  n,
2804
2806
  0,
2805
2807
  ""
2806
- ), a = li(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
2808
+ ), a = ci(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
2807
2809
  return {
2808
2810
  rows: o,
2809
2811
  columnKeys: r,
@@ -2811,7 +2813,7 @@ function oi(s, e) {
2811
2813
  grandTotal: l
2812
2814
  };
2813
2815
  }
2814
- function si(s, e) {
2816
+ function li(s, e) {
2815
2817
  if (e.length === 0) return ["value"];
2816
2818
  const t = /* @__PURE__ */ new Set();
2817
2819
  for (const i of s) {
@@ -2820,7 +2822,7 @@ function si(s, e) {
2820
2822
  }
2821
2823
  return [...t].sort();
2822
2824
  }
2823
- function ai(s, e) {
2825
+ function di(s, e) {
2824
2826
  const t = /* @__PURE__ */ new Map();
2825
2827
  for (const i of s) {
2826
2828
  const n = String(i[e] ?? ""), r = t.get(n);
@@ -2828,75 +2830,75 @@ function ai(s, e) {
2828
2830
  }
2829
2831
  return t;
2830
2832
  }
2831
- function We(s, e, t, i, n, r, o) {
2833
+ function je(s, e, t, i, n, r, o) {
2832
2834
  const a = [];
2833
2835
  if (e.length === 0) {
2834
- const h = Fe(s, t, i, n), f = De(h);
2836
+ const h = De(s, t, i, n), g = Me(h);
2835
2837
  return a.push({
2836
2838
  rowKey: o || "all",
2837
2839
  rowLabel: o || "All",
2838
2840
  depth: r,
2839
2841
  values: h,
2840
- total: f,
2842
+ total: g,
2841
2843
  isGroup: !1,
2842
2844
  rowCount: s.length
2843
2845
  }), a;
2844
2846
  }
2845
- const l = e[0], d = e.slice(1), c = d.length > 0, u = ai(s, l);
2846
- for (const [h, f] of u) {
2847
- const g = o ? `${o}|${h}` : h, p = Fe(f, t, i, n), m = De(p);
2847
+ const l = e[0], d = e.slice(1), c = d.length > 0, u = di(s, l);
2848
+ for (const [h, g] of u) {
2849
+ const f = o ? `${o}|${h}` : h, p = De(g, t, i, n), m = Me(p);
2848
2850
  let w;
2849
- c && (w = We(
2850
- f,
2851
+ c && (w = je(
2852
+ g,
2851
2853
  d,
2852
2854
  t,
2853
2855
  i,
2854
2856
  n,
2855
2857
  r + 1,
2856
- g
2858
+ f
2857
2859
  )), a.push({
2858
- rowKey: g,
2860
+ rowKey: f,
2859
2861
  rowLabel: h || "(blank)",
2860
2862
  depth: r,
2861
2863
  values: p,
2862
2864
  total: m,
2863
2865
  isGroup: c,
2864
2866
  children: w,
2865
- rowCount: f.length
2867
+ rowCount: g.length
2866
2868
  });
2867
2869
  }
2868
2870
  return a;
2869
2871
  }
2870
- function Fe(s, e, t, i) {
2872
+ function De(s, e, t, i) {
2871
2873
  const n = {};
2872
2874
  for (const r of t)
2873
2875
  for (const o of i) {
2874
- const l = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = ni(o.aggFunc), c = l.length > 0 ? d(l) : null, u = ae([r], o.field);
2876
+ const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = oi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = de([r], o.field);
2875
2877
  n[u] = c;
2876
2878
  }
2877
2879
  return n;
2878
2880
  }
2879
- function De(s) {
2881
+ function Me(s) {
2880
2882
  let e = 0;
2881
2883
  for (const t of Object.values(s))
2882
2884
  e += t ?? 0;
2883
2885
  return e;
2884
2886
  }
2885
- function li(s, e, t) {
2887
+ function ci(s, e, t) {
2886
2888
  const i = {};
2887
2889
  function n(r) {
2888
2890
  for (const o of r)
2889
2891
  if (!o.isGroup || !o.children?.length)
2890
2892
  for (const a of e)
2891
2893
  for (const l of t) {
2892
- const d = ae([a], l.field);
2894
+ const d = de([a], l.field);
2893
2895
  i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
2894
2896
  }
2895
2897
  else o.children && n(o.children);
2896
2898
  }
2897
2899
  return n(s), i;
2898
2900
  }
2899
- function di(s, e, t = !0) {
2901
+ function ui(s, e, t = !0) {
2900
2902
  const i = [];
2901
2903
  function n(r) {
2902
2904
  i.push(r);
@@ -2909,7 +2911,7 @@ function di(s, e, t = !0) {
2909
2911
  n(r);
2910
2912
  return i;
2911
2913
  }
2912
- function ci(s) {
2914
+ function hi(s) {
2913
2915
  const e = [];
2914
2916
  function t(i) {
2915
2917
  if (i.isGroup && e.push(i.rowKey), i.children)
@@ -2920,14 +2922,14 @@ function ci(s) {
2920
2922
  t(i);
2921
2923
  return e;
2922
2924
  }
2923
- const ui = ["sum", "avg", "count", "min", "max", "first", "last"];
2924
- function hi(s, e, t, i) {
2925
+ const gi = ["sum", "avg", "count", "min", "max", "first", "last"];
2926
+ function fi(s, e, t, i) {
2925
2927
  const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
2926
- return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () => wi(t, r))), o.appendChild(H("Row Groups", () => Pe("rowGroups", r))), o.appendChild(H("Column Groups", () => Pe("columnGroups", r))), o.appendChild(H("Values", () => gi(r))), o.appendChild(H("Available Fields", () => mi(r))), s.appendChild(o), () => {
2928
+ return o.className = "tbw-pivot-panel", o.appendChild(K("Options", () => vi(t, r))), o.appendChild(K("Row Groups", () => qe("rowGroups", r))), o.appendChild(K("Column Groups", () => qe("columnGroups", r))), o.appendChild(K("Values", () => mi(r))), o.appendChild(K("Available Fields", () => bi(r))), s.appendChild(o), () => {
2927
2929
  n.abort(), o.remove();
2928
2930
  };
2929
2931
  }
2930
- function H(s, e) {
2932
+ function K(s, e) {
2931
2933
  const t = document.createElement("div");
2932
2934
  t.className = "tbw-pivot-section";
2933
2935
  const i = document.createElement("div");
@@ -2935,7 +2937,7 @@ function H(s, e) {
2935
2937
  const n = document.createElement("div");
2936
2938
  return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
2937
2939
  }
2938
- function Pe(s, e) {
2940
+ function qe(s, e) {
2939
2941
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
2940
2942
  r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
2941
2943
  const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
@@ -2944,7 +2946,7 @@ function Pe(s, e) {
2944
2946
  a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
2945
2947
  } else
2946
2948
  for (const a of o)
2947
- r.appendChild(fi(a, s, e));
2949
+ r.appendChild(pi(a, s, e));
2948
2950
  return r.addEventListener(
2949
2951
  "dragover",
2950
2952
  (a) => {
@@ -2967,7 +2969,7 @@ function Pe(s, e) {
2967
2969
  { signal: n }
2968
2970
  ), r;
2969
2971
  }
2970
- function fi(s, e, t) {
2972
+ function pi(s, e, t) {
2971
2973
  const { callbacks: i, signal: n } = t, r = document.createElement("div");
2972
2974
  r.className = "tbw-pivot-field-chip", r.draggable = !0;
2973
2975
  const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
@@ -2993,7 +2995,7 @@ function fi(s, e, t) {
2993
2995
  { signal: n }
2994
2996
  ), r;
2995
2997
  }
2996
- function gi(s) {
2998
+ function mi(s) {
2997
2999
  const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
2998
3000
  n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
2999
3001
  const r = e.valueFields ?? [];
@@ -3002,7 +3004,7 @@ function gi(s) {
3002
3004
  o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
3003
3005
  } else
3004
3006
  for (const o of r)
3005
- n.appendChild(pi(o, s));
3007
+ n.appendChild(wi(o, s));
3006
3008
  return n.addEventListener(
3007
3009
  "dragover",
3008
3010
  (o) => {
@@ -3025,7 +3027,7 @@ function gi(s) {
3025
3027
  { signal: i }
3026
3028
  ), n;
3027
3029
  }
3028
- function pi(s, e) {
3030
+ function wi(s, e) {
3029
3031
  const { callbacks: t, signal: i } = e, n = document.createElement("div");
3030
3032
  n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
3031
3033
  const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
@@ -3034,7 +3036,7 @@ function pi(s, e) {
3034
3036
  a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
3035
3037
  const l = document.createElement("select");
3036
3038
  l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
3037
- for (const c of ui) {
3039
+ for (const c of gi) {
3038
3040
  const u = document.createElement("option");
3039
3041
  u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
3040
3042
  }
@@ -3054,7 +3056,7 @@ function pi(s, e) {
3054
3056
  { signal: i }
3055
3057
  ), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
3056
3058
  }
3057
- function mi(s) {
3059
+ function bi(s) {
3058
3060
  const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
3059
3061
  n.className = "tbw-pivot-available-fields";
3060
3062
  const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
@@ -3084,10 +3086,10 @@ function mi(s) {
3084
3086
  }
3085
3087
  return n;
3086
3088
  }
3087
- function wi(s, e) {
3089
+ function vi(s, e) {
3088
3090
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
3089
3091
  return r.className = "tbw-pivot-options", r.appendChild(
3090
- J(
3092
+ ee(
3091
3093
  "Enable Pivot View",
3092
3094
  s,
3093
3095
  (o) => {
@@ -3096,7 +3098,7 @@ function wi(s, e) {
3096
3098
  n
3097
3099
  )
3098
3100
  ), r.appendChild(
3099
- J(
3101
+ ee(
3100
3102
  "Show Row Totals",
3101
3103
  t.showTotals ?? !0,
3102
3104
  (o) => {
@@ -3105,7 +3107,7 @@ function wi(s, e) {
3105
3107
  n
3106
3108
  )
3107
3109
  ), r.appendChild(
3108
- J(
3110
+ ee(
3109
3111
  "Show Grand Total",
3110
3112
  t.showGrandTotal ?? !0,
3111
3113
  (o) => {
@@ -3115,7 +3117,7 @@ function wi(s, e) {
3115
3117
  )
3116
3118
  ), r;
3117
3119
  }
3118
- function J(s, e, t, i) {
3120
+ function ee(s, e, t, i) {
3119
3121
  const n = document.createElement("label");
3120
3122
  n.className = "tbw-pivot-checkbox";
3121
3123
  const r = document.createElement("input");
@@ -3123,7 +3125,7 @@ function J(s, e, t, i) {
3123
3125
  const o = document.createElement("span");
3124
3126
  return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
3125
3127
  }
3126
- function bi(s, e, t) {
3128
+ function yi(s, e, t) {
3127
3129
  return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
3128
3130
  const r = document.createElement("div");
3129
3131
  if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
@@ -3144,7 +3146,7 @@ function bi(s, e, t) {
3144
3146
  e.appendChild(r);
3145
3147
  }), !0;
3146
3148
  }
3147
- function vi(s, e, t, i) {
3149
+ function Ci(s, e, t, i) {
3148
3150
  return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
3149
3151
  const o = document.createElement("div");
3150
3152
  if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
@@ -3159,7 +3161,7 @@ function vi(s, e, t, i) {
3159
3161
  e.appendChild(o);
3160
3162
  }), !0;
3161
3163
  }
3162
- function yi(s, e, t) {
3164
+ function xi(s, e, t) {
3163
3165
  return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
3164
3166
  const r = document.createElement("div");
3165
3167
  if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
@@ -3172,10 +3174,10 @@ function yi(s, e, t) {
3172
3174
  e.appendChild(r);
3173
3175
  }), !0;
3174
3176
  }
3175
- const Ci = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
3176
- class P extends R {
3177
+ const Ri = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
3178
+ class D extends R {
3177
3179
  name = "pivot";
3178
- styles = Ci;
3180
+ styles = Ri;
3179
3181
  static PANEL_ID = "pivot";
3180
3182
  get defaultConfig() {
3181
3183
  return {
@@ -3209,7 +3211,7 @@ class P extends R {
3209
3211
  getToolPanel() {
3210
3212
  if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
3211
3213
  return {
3212
- id: P.PANEL_ID,
3214
+ id: D.PANEL_ID,
3213
3215
  title: "Pivot",
3214
3216
  icon: "⊞",
3215
3217
  tooltip: "Configure pivot table",
@@ -3220,11 +3222,11 @@ class P extends R {
3220
3222
  processRows(e) {
3221
3223
  if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
3222
3224
  return [...e];
3223
- const t = ri(this.config);
3225
+ const t = si(this.config);
3224
3226
  if (t.length > 0)
3225
3227
  return this.warn(`Config errors: ${t.join(", ")}`), [...e];
3226
- this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = oi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
3227
- const i = this.config.indentWidth ?? 20, n = di(
3228
+ this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = ai(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
3229
+ const i = this.config.indentWidth ?? 20, n = ui(
3228
3230
  this.pivotResult.rows,
3229
3231
  this.expandedKeys,
3230
3232
  this.defaultExpanded
@@ -3259,7 +3261,7 @@ class P extends R {
3259
3261
  });
3260
3262
  for (const n of this.pivotResult.columnKeys)
3261
3263
  for (const r of this.config.valueFields ?? []) {
3262
- const o = ae([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3264
+ const o = de([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3263
3265
  t.push({
3264
3266
  field: o,
3265
3267
  header: `${n} - ${a} (${r.aggFunc})`,
@@ -3276,13 +3278,13 @@ class P extends R {
3276
3278
  }
3277
3279
  renderRow(e, t, i) {
3278
3280
  const n = e;
3279
- return n.__pivotRowKey && n.__pivotHasChildren ? bi(n, t, {
3281
+ return n.__pivotRowKey && n.__pivotHasChildren ? yi(n, t, {
3280
3282
  columns: this.gridColumns,
3281
3283
  rowIndex: i,
3282
3284
  onToggle: (r) => this.toggle(r),
3283
3285
  resolveIcon: (r) => this.resolveIcon(r),
3284
3286
  setIcon: (r, o) => this.setIcon(r, o)
3285
- }) : n.__pivotRowKey !== void 0 && this.isActive ? vi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
3287
+ }) : n.__pivotRowKey !== void 0 && this.isActive ? Ci(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
3286
3288
  }
3287
3289
  cleanupPivotStyling(e) {
3288
3290
  (e.classList.contains("pivot-group-row") || e.classList.contains("pivot-leaf-row") || e.classList.contains("pivot-grand-total-row")) && (e.classList.remove("pivot-group-row", "pivot-leaf-row", "pivot-grand-total-row"), e.classList.add("data-grid-row"), e.removeAttribute("data-pivot-depth"), e.innerHTML = "");
@@ -3320,7 +3322,7 @@ class P extends R {
3320
3322
  __pivotTotal: this.pivotResult.grandTotal,
3321
3323
  ...this.pivotResult.totals
3322
3324
  };
3323
- yi(i, this.grandTotalFooter, this.gridColumns);
3325
+ xi(i, this.grandTotalFooter, this.gridColumns);
3324
3326
  }
3325
3327
  cleanupGrandTotalFooter() {
3326
3328
  this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
@@ -3342,7 +3344,7 @@ class P extends R {
3342
3344
  }
3343
3345
  expandAllKeys() {
3344
3346
  if (!this.pivotResult) return;
3345
- const e = ci(this.pivotResult.rows);
3347
+ const e = hi(this.pivotResult.rows);
3346
3348
  for (const t of e)
3347
3349
  this.expandedKeys.add(t);
3348
3350
  }
@@ -3374,16 +3376,16 @@ class P extends R {
3374
3376
  this.pivotResult = null, this.requestRender();
3375
3377
  }
3376
3378
  showPanel() {
3377
- this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(P.PANEL_ID) || this.grid.toggleToolPanelSection(P.PANEL_ID);
3379
+ this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(D.PANEL_ID) || this.grid.toggleToolPanelSection(D.PANEL_ID);
3378
3380
  }
3379
3381
  hidePanel() {
3380
3382
  this.grid.closeToolPanel();
3381
3383
  }
3382
3384
  togglePanel() {
3383
- this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(P.PANEL_ID);
3385
+ this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(D.PANEL_ID);
3384
3386
  }
3385
3387
  isPanelVisible() {
3386
- return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(P.PANEL_ID);
3388
+ return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(D.PANEL_ID);
3387
3389
  }
3388
3390
  get gridColumns() {
3389
3391
  return this.grid.columns ?? [];
@@ -3427,7 +3429,7 @@ class P extends R {
3427
3429
  },
3428
3430
  getAvailableFields: () => this.getAvailableFields()
3429
3431
  };
3430
- return hi(e, this.config, this.isActive, t);
3432
+ return fi(e, this.config, this.isActive, t);
3431
3433
  }
3432
3434
  refreshPanel() {
3433
3435
  this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
@@ -3460,19 +3462,266 @@ class P extends R {
3460
3462
  n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
3461
3463
  }
3462
3464
  }
3463
- function xi(s) {
3465
+ const W = "tbw-print-isolation-style";
3466
+ function Ei(s, e) {
3467
+ const t = document.createElement("style");
3468
+ return t.id = W, t.textContent = `
3469
+ /* Print isolation: hide everything except the target grid */
3470
+ @media print {
3471
+ /* Hide all body children by default */
3472
+ body > *:not(#${s}) {
3473
+ display: none !important;
3474
+ }
3475
+
3476
+ /* But show the grid and ensure it's not hidden by ancestor rules */
3477
+ #${s} {
3478
+ display: block !important;
3479
+ position: static !important;
3480
+ visibility: visible !important;
3481
+ opacity: 1 !important;
3482
+ overflow: visible !important;
3483
+ height: auto !important;
3484
+ width: 100% !important;
3485
+ max-height: none !important;
3486
+ margin: 0 !important;
3487
+ padding: 0 !important;
3488
+ transform: none !important;
3489
+ }
3490
+
3491
+ /* If grid is nested, we need to show its ancestors too */
3492
+ #${s},
3493
+ #${s} * {
3494
+ visibility: visible !important;
3495
+ }
3496
+
3497
+ /* Walk up the DOM and show all ancestors of the grid */
3498
+ body *:has(> #${s}),
3499
+ body *:has(#${s}) {
3500
+ display: block !important;
3501
+ visibility: visible !important;
3502
+ opacity: 1 !important;
3503
+ overflow: visible !important;
3504
+ height: auto !important;
3505
+ position: static !important;
3506
+ transform: none !important;
3507
+ background: transparent !important;
3508
+ border: none !important;
3509
+ padding: 0 !important;
3510
+ margin: 0 !important;
3511
+ }
3512
+
3513
+ /* Hide siblings of ancestors (everything that's not in the path to the grid) */
3514
+ body *:has(#${s}) > *:not(:has(#${s})):not(#${s}) {
3515
+ display: none !important;
3516
+ }
3517
+
3518
+ /* Page settings */
3519
+ @page {
3520
+ size: ${e};
3521
+ margin: 1cm;
3522
+ }
3523
+
3524
+ /* Ensure proper print styling */
3525
+ body {
3526
+ margin: 0 !important;
3527
+ padding: 0 !important;
3528
+ background: white !important;
3529
+ color-scheme: light !important;
3530
+ }
3531
+ }
3532
+
3533
+ /* Screen: also apply isolation for print preview */
3534
+ @media screen {
3535
+ /* When this stylesheet is active, we're about to print */
3536
+ /* No screen-specific rules needed - isolation only applies to print */
3537
+ }
3538
+ `, t;
3539
+ }
3540
+ async function Si(s, e = {}) {
3541
+ const { orientation: t = "landscape" } = e, i = s.id;
3542
+ document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
3543
+ `[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
3544
+ ), document.getElementById(W)?.remove();
3545
+ const r = Ei(i, t);
3546
+ return document.head.appendChild(r), new Promise((o) => {
3547
+ const a = () => {
3548
+ window.removeEventListener("afterprint", a), document.getElementById(W)?.remove(), o();
3549
+ };
3550
+ window.addEventListener("afterprint", a), window.print(), setTimeout(() => {
3551
+ window.removeEventListener("afterprint", a), document.getElementById(W)?.remove(), o();
3552
+ }, 5e3);
3553
+ });
3554
+ }
3555
+ const ki = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:.5em 0;margin-bottom:.5em;border-bottom:2px solid var(--tbw-color-border, #333);font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:.875em;color:var(--tbw-color-fg-muted, #666)}tbw-grid .tbw-print-footer{display:block;margin-top:.5em;padding-top:.5em;border-top:1px solid var(--tbw-color-border, #ccc);font-size:.75em;color:var(--tbw-color-fg-muted, #666);text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-color-border, #ddd)!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-right:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", Ai = {
3556
+ button: !1,
3557
+ orientation: "landscape",
3558
+ warnThreshold: 500,
3559
+ maxRows: 0,
3560
+ includeTitle: !0,
3561
+ includeTimestamp: !0,
3562
+ title: "",
3563
+ isolate: !1
3564
+ };
3565
+ class un extends R {
3566
+ name = "print";
3567
+ version = "1.0.0";
3568
+ styles = ki;
3569
+ #e = !1;
3570
+ #t = null;
3571
+ #o = null;
3572
+ #n = null;
3573
+ #i = null;
3574
+ #r = null;
3575
+ #d = null;
3576
+ get #a() {
3577
+ return this.grid;
3578
+ }
3579
+ isPrinting() {
3580
+ return this.#e;
3581
+ }
3582
+ async print(e) {
3583
+ if (this.#e) {
3584
+ console.warn("[PrintPlugin] Print already in progress");
3585
+ return;
3586
+ }
3587
+ const t = this.gridElement;
3588
+ if (!t) {
3589
+ console.warn("[PrintPlugin] Grid not available");
3590
+ return;
3591
+ }
3592
+ const i = { ...Ai, ...this.config, ...e }, r = this.rows.length;
3593
+ let o = r, a = !1;
3594
+ if (i.warnThreshold > 0 && r > i.warnThreshold) {
3595
+ const d = i.maxRows > 0 ? `
3596
+
3597
+ Note: Output will be limited to ${i.maxRows.toLocaleString()} rows.` : "";
3598
+ if (!confirm(
3599
+ `This grid has ${r.toLocaleString()} rows. Printing large datasets may cause performance issues or browser slowdowns.${d}
3600
+
3601
+ Click OK to continue, or Cancel to abort.`
3602
+ ))
3603
+ return;
3604
+ }
3605
+ i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, a = !0), this.#e = !0;
3606
+ const l = performance.now();
3607
+ this.emit("print-start", {
3608
+ rowCount: o,
3609
+ limitApplied: a,
3610
+ originalRowCount: r
3611
+ });
3612
+ try {
3613
+ const d = this.#a;
3614
+ this.#o = {
3615
+ bypassThreshold: d._virtualization?.bypassThreshold ?? 24
3616
+ }, this.#l(), a && (this.#n = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#c(i), await this.#s(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#h(), this.emit("print-complete", {
3617
+ success: !0,
3618
+ rowCount: o,
3619
+ duration: Math.round(performance.now() - l)
3620
+ });
3621
+ } catch (d) {
3622
+ console.error("[PrintPlugin] Print failed:", d), this.emit("print-complete", {
3623
+ success: !1,
3624
+ rowCount: 0,
3625
+ duration: Math.round(performance.now() - l)
3626
+ });
3627
+ } finally {
3628
+ this.#f(), this.#e = !1;
3629
+ }
3630
+ }
3631
+ #c(e) {
3632
+ const t = this.gridElement;
3633
+ if (t) {
3634
+ if (this.#i = document.createElement("div"), this.#i.className = "tbw-print-header", e.includeTitle) {
3635
+ const i = e.title || this.grid.effectiveConfig?.shell?.header?.title || "Grid Data", n = document.createElement("div");
3636
+ n.className = "tbw-print-header-title", n.textContent = i, this.#i.appendChild(n);
3637
+ }
3638
+ if (e.includeTimestamp) {
3639
+ const i = document.createElement("div");
3640
+ i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#i.appendChild(i);
3641
+ }
3642
+ t.insertBefore(this.#i, t.firstChild), this.#r = document.createElement("div"), this.#r.className = "tbw-print-footer", this.#r.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#r);
3643
+ }
3644
+ }
3645
+ async #s() {
3646
+ const e = this.#a;
3647
+ if (!e._virtualization) return;
3648
+ const t = this.rows.length;
3649
+ e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
3650
+ }
3651
+ async #h() {
3652
+ return new Promise((e) => {
3653
+ const t = () => {
3654
+ window.removeEventListener("afterprint", t), e();
3655
+ };
3656
+ window.addEventListener("afterprint", t), window.print(), setTimeout(() => {
3657
+ window.removeEventListener("afterprint", t), e();
3658
+ }, 1e3);
3659
+ });
3660
+ }
3661
+ async #p(e) {
3662
+ const t = this.gridElement;
3663
+ t && await Si(t, {
3664
+ orientation: e.orientation
3665
+ });
3666
+ }
3667
+ #l() {
3668
+ const e = this.columns;
3669
+ if (e) {
3670
+ this.#t = /* @__PURE__ */ new Map();
3671
+ for (const t of e)
3672
+ t.printHidden && t.field && (this.#t.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
3673
+ }
3674
+ }
3675
+ #g() {
3676
+ if (this.#t) {
3677
+ for (const [e, t] of this.#t)
3678
+ this.grid.setColumnVisible(e, t);
3679
+ this.#t = null;
3680
+ }
3681
+ }
3682
+ #f() {
3683
+ const e = this.gridElement;
3684
+ if (!e) return;
3685
+ this.#g(), e.classList.remove("print-portrait", "print-landscape"), this.#d !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#d = null), this.#i && (this.#i.remove(), this.#i = null), this.#r && (this.#r.remove(), this.#r = null);
3686
+ const t = this.#a;
3687
+ this.#o && t._virtualization && (t._virtualization.bypassThreshold = this.#o.bypassThreshold, t.refreshVirtualWindow(!0), this.#o = null), this.#n !== null && (this.grid.rows = this.#n, this.#n = null);
3688
+ }
3689
+ afterRender() {
3690
+ this.config?.button && !this.#u && (this.#m(), this.#u = !0);
3691
+ }
3692
+ #u = !1;
3693
+ #m() {
3694
+ this.#a.registerToolbarContent?.({
3695
+ id: "print-button",
3696
+ order: 900,
3697
+ render: (t) => {
3698
+ const i = document.createElement("button");
3699
+ i.className = "tbw-toolbar-btn tbw-print-btn", i.title = "Print grid", i.type = "button";
3700
+ const n = this.resolveIcon("print") || "🖨️";
3701
+ this.setIcon(i, n), i.addEventListener(
3702
+ "click",
3703
+ () => {
3704
+ this.print();
3705
+ },
3706
+ { signal: this.disconnectSignal }
3707
+ ), t.appendChild(i);
3708
+ }
3709
+ });
3710
+ }
3711
+ }
3712
+ function _i(s) {
3464
3713
  const e = s.meta ?? {};
3465
3714
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
3466
3715
  }
3467
- function Me(s, e, t) {
3716
+ function Ne(s, e, t) {
3468
3717
  if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
3469
3718
  const i = [...s], [n] = i.splice(e, 1);
3470
3719
  return i.splice(t, 0, n), i;
3471
3720
  }
3472
- const Ri = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
3473
- class on extends R {
3721
+ const Li = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
3722
+ class hn extends R {
3474
3723
  name = "reorder";
3475
- styles = Ri;
3724
+ styles = Li;
3476
3725
  get defaultConfig() {
3477
3726
  return {
3478
3727
  animation: "flip"
@@ -3489,8 +3738,8 @@ class on extends R {
3489
3738
  draggedIndex = null;
3490
3739
  dropIndex = null;
3491
3740
  canMoveColumnWithPlugins(e) {
3492
- return !e || !xi(e) ? !1 : !this.grid.queryPlugins({
3493
- type: Oe.CAN_MOVE_COLUMN,
3741
+ return !e || !_i(e) ? !1 : !this.grid.queryPlugins({
3742
+ type: Ve.CAN_MOVE_COLUMN,
3494
3743
  context: e
3495
3744
  }).includes(!1);
3496
3745
  }
@@ -3539,13 +3788,13 @@ class on extends R {
3539
3788
  const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
3540
3789
  if (!this.isDragging || l === null || d === null || c === null)
3541
3790
  return;
3542
- const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = Me(h, d, u), g = {
3791
+ const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g = Ne(h, d, u), f = {
3543
3792
  field: l,
3544
3793
  fromIndex: d,
3545
3794
  toIndex: u,
3546
- columnOrder: f
3795
+ columnOrder: g
3547
3796
  };
3548
- this.emitCancelable("column-move", g) || this.updateColumnOrder(f);
3797
+ this.emitCancelable("column-move", f) || this.updateColumnOrder(g);
3549
3798
  }));
3550
3799
  });
3551
3800
  }
@@ -3570,7 +3819,7 @@ class on extends R {
3570
3819
  moveColumn(e, t) {
3571
3820
  const i = this.getColumnOrder(), n = i.indexOf(e);
3572
3821
  if (n === -1) return;
3573
- const r = Me(i, n, t);
3822
+ const r = Ne(i, n, t);
3574
3823
  this.emitCancelable("column-move", {
3575
3824
  field: e,
3576
3825
  fromIndex: n,
@@ -3665,11 +3914,11 @@ class on extends R {
3665
3914
  this.grid.requestStateChange?.();
3666
3915
  }
3667
3916
  }
3668
- const Ei = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
3669
- class sn extends R {
3917
+ const Ti = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
3918
+ class gn extends R {
3670
3919
  name = "responsive";
3671
3920
  version = "1.0.0";
3672
- styles = Ei;
3921
+ styles = Ti;
3673
3922
  static manifest = {
3674
3923
  incompatibleWith: [
3675
3924
  {
@@ -3681,73 +3930,73 @@ class sn extends R {
3681
3930
  #e;
3682
3931
  #t = !1;
3683
3932
  #o;
3684
- #i = !1;
3685
- #n = 0;
3686
- #s = /* @__PURE__ */ new Set();
3687
- #c = /* @__PURE__ */ new Set();
3688
- #l = null;
3689
- #d = [];
3933
+ #n = !1;
3934
+ #i = 0;
3935
+ #r = /* @__PURE__ */ new Set();
3936
+ #d = /* @__PURE__ */ new Set();
3937
+ #a = null;
3938
+ #c = [];
3690
3939
  isResponsive() {
3691
3940
  return this.#t;
3692
3941
  }
3693
3942
  setResponsive(e) {
3694
- e !== this.#t && (this.#t = e, this.#h(), this.emit("responsive-change", {
3943
+ e !== this.#t && (this.#t = e, this.#g(), this.emit("responsive-change", {
3695
3944
  isResponsive: e,
3696
- width: this.#n,
3945
+ width: this.#i,
3697
3946
  breakpoint: this.config.breakpoint ?? 0
3698
3947
  }));
3699
3948
  }
3700
3949
  setBreakpoint(e) {
3701
- this.config.breakpoint = e, this.#u(this.#n);
3950
+ this.config.breakpoint = e, this.#h(this.#i);
3702
3951
  }
3703
3952
  setCardRenderer(e) {
3704
3953
  this.config.cardRenderer = e, this.#t && this.requestRender();
3705
3954
  }
3706
3955
  getWidth() {
3707
- return this.#n;
3956
+ return this.#i;
3708
3957
  }
3709
3958
  getActiveBreakpoint() {
3710
- return this.#l;
3959
+ return this.#a;
3711
3960
  }
3712
3961
  attach(e) {
3713
- super.attach(e), this.#r(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#d = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#e = new ResizeObserver((t) => {
3962
+ super.attach(e), this.#s(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#c = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#e = new ResizeObserver((t) => {
3714
3963
  const i = t[0]?.contentRect.width ?? 0;
3715
- this.#n = i, clearTimeout(this.#o), this.#o = setTimeout(() => {
3716
- this.#u(i);
3964
+ this.#i = i, clearTimeout(this.#o), this.#o = setTimeout(() => {
3965
+ this.#h(i);
3717
3966
  }, this.config.debounceMs ?? 100);
3718
3967
  }), this.#e.observe(this.gridElement);
3719
3968
  }
3720
- #r(e) {
3721
- if (this.#s.clear(), this.#c.clear(), !!e)
3969
+ #s(e) {
3970
+ if (this.#r.clear(), this.#d.clear(), !!e)
3722
3971
  for (const t of e)
3723
- typeof t == "string" ? this.#s.add(t) : t.showValue ? this.#c.add(t.field) : this.#s.add(t.field);
3972
+ typeof t == "string" ? this.#r.add(t) : t.showValue ? this.#d.add(t.field) : this.#r.add(t.field);
3724
3973
  }
3725
3974
  detach() {
3726
3975
  this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#o), this.#o = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
3727
3976
  }
3728
3977
  afterRender() {
3729
- if (this.#R(), !(this.#d.length > 0 ? this.#l !== null : this.#t))
3978
+ if (this.#R(), !(this.#c.length > 0 ? this.#a !== null : this.#t))
3730
3979
  return;
3731
- const t = this.#s.size > 0, i = this.#c.size > 0;
3980
+ const t = this.#r.size > 0, i = this.#d.size > 0;
3732
3981
  if (!t && !i)
3733
3982
  return;
3734
3983
  const n = this.gridElement.querySelectorAll(".cell[data-field]");
3735
3984
  for (const r of n) {
3736
3985
  const o = r.getAttribute("data-field");
3737
- o && (this.#s.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#c.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
3986
+ o && (this.#r.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#d.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
3738
3987
  }
3739
3988
  }
3740
- #u(e) {
3741
- if (this.#d.length > 0) {
3989
+ #h(e) {
3990
+ if (this.#c.length > 0) {
3742
3991
  this.#p(e);
3743
3992
  return;
3744
3993
  }
3745
3994
  const t = this.config.breakpoint ?? 0;
3746
- t === 0 && !this.#i && (this.#i = !0, console.warn(
3995
+ t === 0 && !this.#n && (this.#n = !0, console.warn(
3747
3996
  "[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
3748
3997
  ));
3749
3998
  const i = t > 0 && e < t;
3750
- i !== this.#t && (this.#t = i, this.#h(), this.emit("responsive-change", {
3999
+ i !== this.#t && (this.#t = i, this.#g(), this.emit("responsive-change", {
3751
4000
  isResponsive: i,
3752
4001
  width: e,
3753
4002
  breakpoint: t
@@ -3755,33 +4004,33 @@ class sn extends R {
3755
4004
  }
3756
4005
  #p(e) {
3757
4006
  let t = null;
3758
- for (const n of this.#d)
4007
+ for (const n of this.#c)
3759
4008
  e <= n.maxWidth && (t = n);
3760
- if (t !== this.#l) {
3761
- this.#l = t, t?.hiddenColumns ? this.#r(t.hiddenColumns) : this.#r(this.config.hiddenColumns);
4009
+ if (t !== this.#a) {
4010
+ this.#a = t, t?.hiddenColumns ? this.#s(t.hiddenColumns) : this.#s(this.config.hiddenColumns);
3762
4011
  const n = t?.cardLayout === !0;
3763
- n !== this.#t && (this.#t = n, this.#h()), this.emit("responsive-change", {
4012
+ n !== this.#t && (this.#t = n, this.#g()), this.emit("responsive-change", {
3764
4013
  isResponsive: this.#t,
3765
4014
  width: e,
3766
4015
  breakpoint: t?.maxWidth ?? 0
3767
4016
  }), this.requestRender();
3768
4017
  }
3769
4018
  }
3770
- #a;
3771
- #h() {
4019
+ #l;
4020
+ #g() {
3772
4021
  this.gridElement.toggleAttribute("data-responsive", this.#t);
3773
4022
  const e = this.config.animate !== !1;
3774
4023
  this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
3775
4024
  const t = this.grid;
3776
4025
  if (this.#t) {
3777
- t._virtualization && (this.#a = t._virtualization.rowHeight);
4026
+ t._virtualization && (this.#l = t._virtualization.rowHeight);
3778
4027
  const i = this.gridElement.querySelector(".tbw-scroll-area");
3779
4028
  i && (i.scrollLeft = 0);
3780
4029
  } else {
3781
4030
  const i = this.gridElement.querySelectorAll(".data-grid-row");
3782
4031
  for (const n of i)
3783
4032
  n.style.height = "", n.classList.remove("responsive-card");
3784
- this.#a && this.#a > 0 && t._virtualization && (t._virtualization.rowHeight = this.#a, this.#a = void 0), this.#f = void 0, this.#g = void 0, this.#m = void 0;
4033
+ this.#l && this.#l > 0 && t._virtualization && (t._virtualization.rowHeight = this.#l, this.#l = void 0), this.#f = void 0, this.#u = void 0, this.#m = void 0;
3785
4034
  }
3786
4035
  }
3787
4036
  renderRow(e, t, i) {
@@ -3822,7 +4071,7 @@ class sn extends R {
3822
4071
  return !1;
3823
4072
  }
3824
4073
  #f;
3825
- #g;
4074
+ #u;
3826
4075
  #m;
3827
4076
  #v() {
3828
4077
  if (this.#f && this.#f > 0)
@@ -3831,7 +4080,7 @@ class sn extends R {
3831
4080
  return typeof e == "number" && e > 0 ? e : 80;
3832
4081
  }
3833
4082
  #y() {
3834
- return this.#g && this.#g > 0 ? this.#g : this.#a ?? 28;
4083
+ return this.#u && this.#u > 0 ? this.#u : this.#l ?? 28;
3835
4084
  }
3836
4085
  #w() {
3837
4086
  for (const e of this.rows)
@@ -3848,13 +4097,13 @@ class sn extends R {
3848
4097
  getExtraHeight() {
3849
4098
  if (!this.#t || !this.config.cardRenderer || !this.#w())
3850
4099
  return 0;
3851
- const e = this.#a ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
4100
+ const e = this.#l ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
3852
4101
  return o + a;
3853
4102
  }
3854
4103
  getExtraHeightBefore(e) {
3855
4104
  if (!this.#t || !this.config.cardRenderer || !this.#w())
3856
4105
  return 0;
3857
- const t = this.#a ?? 28, i = this.#y(), n = this.#v(), r = Math.max(0, i - t), o = Math.max(0, n - t);
4106
+ const t = this.#l ?? 28, i = this.#y(), n = this.#v(), r = Math.max(0, i - t), o = Math.max(0, n - t);
3858
4107
  let a = 0, l = 0;
3859
4108
  const d = this.rows, c = Math.min(e, d.length);
3860
4109
  for (let u = 0; u < c; u++)
@@ -3877,7 +4126,7 @@ class sn extends R {
3877
4126
  const o = this.gridElement.querySelector(".data-grid-row.group-row");
3878
4127
  if (o) {
3879
4128
  const a = o.getBoundingClientRect().height;
3880
- a > 0 && a !== this.#g && (this.#g = a, e = !0);
4129
+ a > 0 && a !== this.#u && (this.#u = a, e = !0);
3881
4130
  }
3882
4131
  }
3883
4132
  const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
@@ -3890,10 +4139,10 @@ class sn extends R {
3890
4139
  }));
3891
4140
  }
3892
4141
  }
3893
- const Si = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px;&:hover{color:var(--tbw-color-fg, #333)}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', ki = "__tbw_row_drag";
3894
- class an extends R {
4142
+ const Ii = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px;&:hover{color:var(--tbw-color-fg, #333)}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', Pi = "__tbw_row_drag";
4143
+ class fn extends R {
3895
4144
  name = "rowReorder";
3896
- styles = Si;
4145
+ styles = Ii;
3897
4146
  get defaultConfig() {
3898
4147
  return {
3899
4148
  enableKeyboard: !0,
@@ -3917,7 +4166,7 @@ class an extends R {
3917
4166
  if (!this.config.showDragHandle)
3918
4167
  return [...e];
3919
4168
  const t = {
3920
- field: ki,
4169
+ field: Pi,
3921
4170
  header: "",
3922
4171
  width: this.config.dragHandleWidth ?? 40,
3923
4172
  resizable: !1,
@@ -4058,7 +4307,7 @@ class an extends R {
4058
4307
  this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
4059
4308
  }
4060
4309
  }
4061
- function V(s) {
4310
+ function q(s) {
4062
4311
  return {
4063
4312
  startRow: Math.min(s.startRow, s.endRow),
4064
4313
  startCol: Math.min(s.startCol, s.endCol),
@@ -4066,38 +4315,38 @@ function V(s) {
4066
4315
  endCol: Math.max(s.startCol, s.endCol)
4067
4316
  };
4068
4317
  }
4069
- function Ai(s) {
4070
- const e = V(s);
4318
+ function Fi(s) {
4319
+ const e = q(s);
4071
4320
  return {
4072
4321
  from: { row: e.startRow, col: e.startCol },
4073
4322
  to: { row: e.endRow, col: e.endCol }
4074
4323
  };
4075
4324
  }
4076
- function $e(s) {
4077
- return s.map(Ai);
4325
+ function Ue(s) {
4326
+ return s.map(Fi);
4078
4327
  }
4079
- function _i(s, e, t) {
4080
- const i = V(t);
4328
+ function Di(s, e, t) {
4329
+ const i = q(t);
4081
4330
  return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
4082
4331
  }
4083
- function qe(s, e, t) {
4084
- return t.some((i) => _i(s, e, i));
4332
+ function He(s, e, t) {
4333
+ return t.some((i) => Di(s, e, i));
4085
4334
  }
4086
- function Li(s) {
4087
- const e = [], t = V(s);
4335
+ function Mi(s) {
4336
+ const e = [], t = q(s);
4088
4337
  for (let i = t.startRow; i <= t.endRow; i++)
4089
4338
  for (let n = t.startCol; n <= t.endCol; n++)
4090
4339
  e.push({ row: i, col: n });
4091
4340
  return e;
4092
4341
  }
4093
- function Ti(s) {
4342
+ function qi(s) {
4094
4343
  const e = /* @__PURE__ */ new Map();
4095
4344
  for (const t of s)
4096
- for (const i of Li(t))
4345
+ for (const i of Mi(t))
4097
4346
  e.set(`${i.row},${i.col}`, i);
4098
4347
  return [...e.values()];
4099
4348
  }
4100
- function Q(s, e) {
4349
+ function te(s, e) {
4101
4350
  return {
4102
4351
  startRow: s.row,
4103
4352
  startCol: s.col,
@@ -4105,8 +4354,12 @@ function Q(s, e) {
4105
4354
  endCol: e.col
4106
4355
  };
4107
4356
  }
4108
- const Ii = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-color-warning-bg, rgba(255, 243, 205, .5))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
4109
- function Fi(s, e, t) {
4357
+ function V(s, e) {
4358
+ const t = q(s), i = q(e);
4359
+ return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
4360
+ }
4361
+ const Ni = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-color-warning-bg, rgba(255, 243, 205, .5))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
4362
+ function Hi(s, e, t) {
4110
4363
  if (s === "cell" && e.selectedCell)
4111
4364
  return {
4112
4365
  mode: s,
@@ -4124,9 +4377,9 @@ function Fi(s, e, t) {
4124
4377
  }));
4125
4378
  return { mode: s, ranges: i };
4126
4379
  }
4127
- return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: $e(e.ranges) } : { mode: s, ranges: [] };
4380
+ return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: Ue(e.ranges) } : { mode: s, ranges: [] };
4128
4381
  }
4129
- class ln extends R {
4382
+ class pn extends R {
4130
4383
  static manifest = {
4131
4384
  configRules: [
4132
4385
  {
@@ -4140,7 +4393,7 @@ class ln extends R {
4140
4393
  ]
4141
4394
  };
4142
4395
  name = "selection";
4143
- styles = Ii;
4396
+ styles = Ni;
4144
4397
  get defaultConfig() {
4145
4398
  return {
4146
4399
  mode: "cell",
@@ -4178,16 +4431,22 @@ class ln extends R {
4178
4431
  if (n.type !== o)
4179
4432
  return !1;
4180
4433
  const a = this.columns[i], l = a && I(a);
4181
- if (r === "cell")
4182
- return l || !this.isCellSelectable(t, i) || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
4434
+ if (r === "cell") {
4435
+ if (l || !this.isCellSelectable(t, i))
4436
+ return !1;
4437
+ const d = this.selectedCell;
4438
+ return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
4439
+ }
4183
4440
  if (r === "row")
4184
- return this.isRowSelectable(t) && (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
4441
+ return !this.isRowSelectable(t) || this.selected.size === 1 && this.selected.has(t) || (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
4185
4442
  if (r === "range") {
4186
4443
  if (l || !this.isCellSelectable(t, i))
4187
4444
  return !1;
4188
4445
  const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
4189
4446
  if (d && this.cellAnchor) {
4190
- const u = Q(this.cellAnchor, { row: t, col: i });
4447
+ const u = te(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
4448
+ if (h && V(h, u))
4449
+ return !1;
4191
4450
  c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
4192
4451
  } else if (c) {
4193
4452
  const u = {
@@ -4204,6 +4463,8 @@ class ln extends R {
4204
4463
  endRow: t,
4205
4464
  endCol: i
4206
4465
  };
4466
+ if (this.ranges.length === 1 && V(this.ranges[0], u))
4467
+ return !1;
4207
4468
  this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
4208
4469
  }
4209
4470
  return this.emit("selection-change", this.#t()), this.requestAfterRender(), !1;
@@ -4231,6 +4492,7 @@ class ln extends R {
4231
4492
  if (t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey)) {
4232
4493
  const r = this.rows.length, o = this.columns.length;
4233
4494
  if (r > 0 && o > 0) {
4495
+ e.preventDefault(), e.stopPropagation();
4234
4496
  const a = {
4235
4497
  startRow: 0,
4236
4498
  startCol: 0,
@@ -4248,26 +4510,24 @@ class ln extends R {
4248
4510
  if (t && I(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
4249
4511
  return;
4250
4512
  this.isDragging = !0;
4251
- const i = e.rowIndex, n = e.colIndex;
4252
- this.cellAnchor = { row: i, col: n }, e.originalEvent.ctrlKey || e.originalEvent.metaKey || (this.ranges = []);
4253
- const o = {
4513
+ const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
4254
4514
  startRow: i,
4255
4515
  startCol: n,
4256
4516
  endRow: i,
4257
4517
  endCol: n
4258
4518
  };
4259
- return this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
4519
+ return !r && this.ranges.length === 1 && V(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0);
4260
4520
  }
4261
4521
  onCellMouseMove(e) {
4262
4522
  if (this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
4263
4523
  let t = e.colIndex;
4264
4524
  const i = this.columns[t];
4265
4525
  if (i && I(i)) {
4266
- const r = this.columns.findIndex((o) => !I(o));
4267
- r >= 0 && (t = r);
4526
+ const o = this.columns.findIndex((a) => !I(a));
4527
+ o >= 0 && (t = o);
4268
4528
  }
4269
- const n = Q(this.cellAnchor, { row: e.rowIndex, col: t });
4270
- return this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
4529
+ const n = te(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
4530
+ return r && V(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
4271
4531
  }
4272
4532
  onCellMouseUp(e) {
4273
4533
  if (this.config.mode === "range" && this.isDragging)
@@ -4283,25 +4543,25 @@ class ln extends R {
4283
4543
  const r = e.querySelectorAll(".data-grid-row");
4284
4544
  if (r.forEach((o) => {
4285
4545
  o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
4286
- }), t === "row" && (he(e), r.forEach((o) => {
4287
- const a = o.querySelector(".cell[data-row]"), l = et(a);
4546
+ }), t === "row" && (fe(e), r.forEach((o) => {
4547
+ const a = o.querySelector(".cell[data-row]"), l = it(a);
4288
4548
  l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
4289
4549
  })), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
4290
4550
  const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
4291
4551
  l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
4292
4552
  }), t === "range" && this.ranges.length > 0) {
4293
- he(e);
4294
- const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !I(d));
4553
+ fe(e);
4554
+ const o = this.activeRange ? q(this.activeRange) : null, a = this.columns.findIndex((d) => !I(d));
4295
4555
  this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
4296
4556
  const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
4297
4557
  if (c >= 0 && u >= 0) {
4298
4558
  const h = this.columns[u];
4299
4559
  if (h && I(h))
4300
4560
  return;
4301
- if (qe(c, u, this.ranges) && (d.classList.add("selected"), o)) {
4561
+ if (He(c, u, this.ranges) && (d.classList.add("selected"), o)) {
4302
4562
  c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
4303
- const g = Math.max(o.startCol, a);
4304
- u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
4563
+ const f = Math.max(o.startCol, a);
4564
+ u === f && d.classList.add("first"), u === o.endCol && d.classList.add("last");
4305
4565
  }
4306
4566
  }
4307
4567
  });
@@ -4316,7 +4576,7 @@ class ln extends R {
4316
4576
  this.pendingKeyboardUpdate = null;
4317
4577
  const r = this.grid._focusRow, o = this.grid._focusCol;
4318
4578
  if (n && this.cellAnchor) {
4319
- const a = Q(this.cellAnchor, { row: r, col: o });
4579
+ const a = te(this.cellAnchor, { row: r, col: o });
4320
4580
  this.ranges = [a], this.activeRange = a;
4321
4581
  } else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
4322
4582
  this.emit("selection-change", this.#t());
@@ -4334,10 +4594,10 @@ class ln extends R {
4334
4594
  };
4335
4595
  }
4336
4596
  getSelectedCells() {
4337
- return Ti(this.ranges);
4597
+ return qi(this.ranges);
4338
4598
  }
4339
4599
  isCellSelected(e, t) {
4340
- return qe(e, t, this.ranges);
4600
+ return He(e, t, this.ranges);
4341
4601
  }
4342
4602
  clearSelection() {
4343
4603
  this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
@@ -4350,11 +4610,11 @@ class ln extends R {
4350
4610
  endCol: t.to.col
4351
4611
  })), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
4352
4612
  mode: this.config.mode,
4353
- ranges: $e(this.ranges)
4613
+ ranges: Ue(this.ranges)
4354
4614
  }), this.requestAfterRender();
4355
4615
  }
4356
4616
  #t() {
4357
- return Fi(
4617
+ return Hi(
4358
4618
  this.config.mode,
4359
4619
  {
4360
4620
  selectedCell: this.selectedCell,
@@ -4365,23 +4625,23 @@ class ln extends R {
4365
4625
  );
4366
4626
  }
4367
4627
  }
4368
- function B(s, e) {
4628
+ function $(s, e) {
4369
4629
  return Math.floor(s / e);
4370
4630
  }
4371
- function Di(s, e) {
4631
+ function Ki(s, e) {
4372
4632
  return {
4373
4633
  start: s * e,
4374
4634
  end: (s + 1) * e
4375
4635
  };
4376
4636
  }
4377
- function Pi(s, e, t) {
4378
- const i = B(s, t), n = B(e - 1, t), r = [];
4637
+ function zi(s, e, t) {
4638
+ const i = $(s, t), n = $(e - 1, t), r = [];
4379
4639
  for (let o = i; o <= n; o++)
4380
4640
  r.push(o);
4381
4641
  return r;
4382
4642
  }
4383
4643
  async function Ke(s, e, t, i) {
4384
- const n = Di(e, t);
4644
+ const n = Ki(e, t);
4385
4645
  return s.getRows({
4386
4646
  startRow: n.start,
4387
4647
  endRow: n.end,
@@ -4389,14 +4649,14 @@ async function Ke(s, e, t, i) {
4389
4649
  filterModel: i.filterModel
4390
4650
  });
4391
4651
  }
4392
- function Mi(s, e, t) {
4393
- const i = B(s, e), n = t.get(i);
4652
+ function Gi(s, e, t) {
4653
+ const i = $(s, e), n = t.get(i);
4394
4654
  if (!n) return;
4395
4655
  const r = s % e;
4396
4656
  return n[r];
4397
4657
  }
4398
- const qi = 100;
4399
- class dn extends R {
4658
+ const Oi = 100;
4659
+ class mn extends R {
4400
4660
  name = "serverSide";
4401
4661
  get defaultConfig() {
4402
4662
  return {
@@ -4416,7 +4676,7 @@ class dn extends R {
4416
4676
  }
4417
4677
  loadRequiredBlocks() {
4418
4678
  if (!this.dataSource) return;
4419
- const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Pi(i.startRow, i.endRow, t);
4679
+ const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = zi(i.startRow, i.endRow, t);
4420
4680
  for (const r of n)
4421
4681
  if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
4422
4682
  if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
@@ -4432,7 +4692,7 @@ class dn extends R {
4432
4692
  if (!this.dataSource) return [...e];
4433
4693
  const t = [];
4434
4694
  for (let i = 0; i < this.totalRowCount; i++) {
4435
- const n = Mi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
4695
+ const n = Gi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
4436
4696
  t.push(n ?? { __loading: !0, __index: i });
4437
4697
  }
4438
4698
  return t;
@@ -4440,7 +4700,7 @@ class dn extends R {
4440
4700
  onScroll(e) {
4441
4701
  this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
4442
4702
  this.loadRequiredBlocks();
4443
- }, qi));
4703
+ }, Oi));
4444
4704
  }
4445
4705
  setDataSource(e) {
4446
4706
  this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
@@ -4459,59 +4719,59 @@ class dn extends R {
4459
4719
  return this.totalRowCount;
4460
4720
  }
4461
4721
  isRowLoaded(e) {
4462
- const t = this.config.cacheBlockSize ?? 100, i = B(e, t);
4722
+ const t = this.config.cacheBlockSize ?? 100, i = $(e, t);
4463
4723
  return this.loadedBlocks.has(i);
4464
4724
  }
4465
4725
  getLoadedBlockCount() {
4466
4726
  return this.loadedBlocks.size;
4467
4727
  }
4468
4728
  }
4469
- function je(s, e, t) {
4729
+ function Ye(s, e, t) {
4470
4730
  return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
4471
4731
  }
4472
- function ee(s, e) {
4732
+ function ie(s, e) {
4473
4733
  const t = new Set(s);
4474
4734
  return t.has(e) ? t.delete(e) : t.add(e), t;
4475
4735
  }
4476
- function ne(s, e, t = null, i = 0) {
4736
+ function oe(s, e, t = null, i = 0) {
4477
4737
  const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
4478
4738
  for (let o = 0; o < s.length; o++) {
4479
- const a = s[o], l = je(a, o, t), d = a[n];
4739
+ const a = s[o], l = Ye(a, o, t), d = a[n];
4480
4740
  if (Array.isArray(d) && d.length > 0) {
4481
4741
  r.add(l);
4482
- const c = ne(d, e, l, i + 1);
4742
+ const c = oe(d, e, l, i + 1);
4483
4743
  for (const u of c) r.add(u);
4484
4744
  }
4485
4745
  }
4486
4746
  return r;
4487
4747
  }
4488
- function Ki() {
4748
+ function Bi() {
4489
4749
  return /* @__PURE__ */ new Set();
4490
4750
  }
4491
- function Ue(s, e, t, i = null, n = 0) {
4751
+ function Xe(s, e, t, i = null, n = 0) {
4492
4752
  const r = t.childrenField ?? "children";
4493
4753
  for (let o = 0; o < s.length; o++) {
4494
- const a = s[o], l = je(a, o, i);
4754
+ const a = s[o], l = Ye(a, o, i);
4495
4755
  if (l === e)
4496
4756
  return [l];
4497
4757
  const d = a[r];
4498
4758
  if (Array.isArray(d) && d.length > 0) {
4499
- const c = Ue(d, e, t, l, n + 1);
4759
+ const c = Xe(d, e, t, l, n + 1);
4500
4760
  if (c)
4501
4761
  return [l, ...c];
4502
4762
  }
4503
4763
  }
4504
4764
  return null;
4505
4765
  }
4506
- function Hi(s, e, t, i) {
4507
- const n = Ue(s, e, t);
4766
+ function Vi(s, e, t, i) {
4767
+ const n = Xe(s, e, t);
4508
4768
  if (!n) return i;
4509
4769
  const r = new Set(i);
4510
4770
  for (let o = 0; o < n.length - 1; o++)
4511
4771
  r.add(n[o]);
4512
4772
  return r;
4513
4773
  }
4514
- function He(s, e = "children") {
4774
+ function ze(s, e = "children") {
4515
4775
  if (!Array.isArray(s) || s.length === 0) return !1;
4516
4776
  for (const t of s) {
4517
4777
  if (!t) continue;
@@ -4521,7 +4781,7 @@ function He(s, e = "children") {
4521
4781
  }
4522
4782
  return !1;
4523
4783
  }
4524
- function Ni(s) {
4784
+ function Wi(s) {
4525
4785
  if (!Array.isArray(s) || s.length === 0) return null;
4526
4786
  const e = ["children", "items", "nodes", "subRows", "nested"];
4527
4787
  for (const t of s)
@@ -4533,10 +4793,10 @@ function Ni(s) {
4533
4793
  }
4534
4794
  return null;
4535
4795
  }
4536
- const zi = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
4537
- class cn extends R {
4796
+ const $i = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
4797
+ class wn extends R {
4538
4798
  name = "tree";
4539
- styles = zi;
4799
+ styles = $i;
4540
4800
  get defaultConfig() {
4541
4801
  return {
4542
4802
  childrenField: "children",
@@ -4562,15 +4822,15 @@ class cn extends R {
4562
4822
  }
4563
4823
  detect(e) {
4564
4824
  if (!this.config.autoDetect) return !1;
4565
- const t = e, i = this.config.childrenField ?? Ni(t) ?? "children";
4566
- return He(t, i);
4825
+ const t = e, i = this.config.childrenField ?? Wi(t) ?? "children";
4826
+ return ze(t, i);
4567
4827
  }
4568
4828
  processRows(e) {
4569
4829
  const t = this.config.childrenField ?? "children", i = e;
4570
- if (!He(i, t))
4830
+ if (!ze(i, t))
4571
4831
  return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
4572
4832
  let n = this.withStableKeys(i);
4573
- this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ne(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
4833
+ this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = oe(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
4574
4834
  const r = /* @__PURE__ */ new Set();
4575
4835
  for (const o of this.flattenedRows)
4576
4836
  this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
@@ -4623,11 +4883,11 @@ class cn extends R {
4623
4883
  const t = [...e];
4624
4884
  if (t.length === 0) return t;
4625
4885
  const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), a = this.resolveIcon.bind(this), l = (d) => {
4626
- const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, m = document.createElement("span");
4627
- if (m.className = "tree-cell-wrapper", m.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && m.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
4628
- if (g.__treeHasChildren) {
4886
+ const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0, m = document.createElement("span");
4887
+ if (m.className = "tree-cell-wrapper", m.style.setProperty("--tbw-tree-depth", String(p)), g !== void 0 && m.style.setProperty("--tbw-tree-indent-width", `${g}px`), h)
4888
+ if (f.__treeHasChildren) {
4629
4889
  const b = document.createElement("span");
4630
- b.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(b, a(g.__treeExpanded ? "collapse" : "expand")), b.setAttribute("data-tree-key", String(g.__treeKey ?? "")), m.appendChild(b);
4890
+ b.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(b, a(f.__treeExpanded ? "collapse" : "expand")), b.setAttribute("data-tree-key", String(f.__treeKey ?? "")), m.appendChild(b);
4631
4891
  } else {
4632
4892
  const b = document.createElement("span");
4633
4893
  b.className = "tree-spacer", m.appendChild(b);
@@ -4648,7 +4908,7 @@ class cn extends R {
4648
4908
  const i = t.getAttribute("data-tree-key");
4649
4909
  if (!i) return !1;
4650
4910
  const n = this.rowKeyMap.get(i);
4651
- return n ? (this.expandedKeys = ee(this.expandedKeys, i), this.emit("tree-expand", {
4911
+ return n ? (this.expandedKeys = ie(this.expandedKeys, i), this.emit("tree-expand", {
4652
4912
  key: i,
4653
4913
  row: n.data,
4654
4914
  expanded: this.expandedKeys.has(i),
@@ -4659,7 +4919,7 @@ class cn extends R {
4659
4919
  if (e.key !== " ") return;
4660
4920
  const t = this.grid._focusRow, i = this.flattenedRows[t];
4661
4921
  if (i?.hasChildren)
4662
- return e.preventDefault(), this.expandedKeys = ee(this.expandedKeys, i.key), this.emit("tree-expand", {
4922
+ return e.preventDefault(), this.expandedKeys = ie(this.expandedKeys, i.key), this.emit("tree-expand", {
4663
4923
  key: i.key,
4664
4924
  row: i.data,
4665
4925
  expanded: this.expandedKeys.has(i.key),
@@ -4692,13 +4952,13 @@ class cn extends R {
4692
4952
  this.expandedKeys.delete(e), this.requestRender();
4693
4953
  }
4694
4954
  toggle(e) {
4695
- this.expandedKeys = ee(this.expandedKeys, e), this.requestRender();
4955
+ this.expandedKeys = ie(this.expandedKeys, e), this.requestRender();
4696
4956
  }
4697
4957
  expandAll() {
4698
- this.expandedKeys = ne(this.rows, this.config), this.requestRender();
4958
+ this.expandedKeys = oe(this.rows, this.config), this.requestRender();
4699
4959
  }
4700
4960
  collapseAll() {
4701
- this.expandedKeys = Ki(), this.requestRender();
4961
+ this.expandedKeys = Bi(), this.requestRender();
4702
4962
  }
4703
4963
  isExpanded(e) {
4704
4964
  return this.expandedKeys.has(e);
@@ -4713,10 +4973,10 @@ class cn extends R {
4713
4973
  return this.rowKeyMap.get(e)?.data;
4714
4974
  }
4715
4975
  expandToKey(e) {
4716
- this.expandedKeys = Hi(this.rows, e, this.config, this.expandedKeys), this.requestRender();
4976
+ this.expandedKeys = Vi(this.rows, e, this.config, this.expandedKeys), this.requestRender();
4717
4977
  }
4718
4978
  }
4719
- function Gi(s, e, t) {
4979
+ function ji(s, e, t) {
4720
4980
  const i = [...s.undoStack, e];
4721
4981
  for (; i.length > t; )
4722
4982
  i.shift();
@@ -4725,7 +4985,7 @@ function Gi(s, e, t) {
4725
4985
  redoStack: []
4726
4986
  };
4727
4987
  }
4728
- function Ne(s) {
4988
+ function Ge(s) {
4729
4989
  if (s.undoStack.length === 0)
4730
4990
  return { newState: s, action: null };
4731
4991
  const e = [...s.undoStack], t = e.pop();
@@ -4737,7 +4997,7 @@ function Ne(s) {
4737
4997
  action: t
4738
4998
  } : { newState: s, action: null };
4739
4999
  }
4740
- function ze(s) {
5000
+ function Oe(s) {
4741
5001
  if (s.redoStack.length === 0)
4742
5002
  return { newState: s, action: null };
4743
5003
  const e = [...s.redoStack], t = e.pop();
@@ -4749,16 +5009,16 @@ function ze(s) {
4749
5009
  action: t
4750
5010
  } : { newState: s, action: null };
4751
5011
  }
4752
- function Oi(s) {
5012
+ function Ui(s) {
4753
5013
  return s.undoStack.length > 0;
4754
5014
  }
4755
- function Bi(s) {
5015
+ function Yi(s) {
4756
5016
  return s.redoStack.length > 0;
4757
5017
  }
4758
- function Vi() {
5018
+ function Xi() {
4759
5019
  return { undoStack: [], redoStack: [] };
4760
5020
  }
4761
- function Wi(s, e, t, i) {
5021
+ function Zi(s, e, t, i) {
4762
5022
  return {
4763
5023
  type: "cell-edit",
4764
5024
  rowIndex: s,
@@ -4768,7 +5028,7 @@ function Wi(s, e, t, i) {
4768
5028
  timestamp: Date.now()
4769
5029
  };
4770
5030
  }
4771
- class un extends R {
5031
+ class bn extends R {
4772
5032
  static dependencies = [
4773
5033
  { name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
4774
5034
  ];
@@ -4786,7 +5046,7 @@ class un extends R {
4786
5046
  onKeyDown(e) {
4787
5047
  const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
4788
5048
  if (t) {
4789
- const n = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
5049
+ const n = Ge({ undoStack: this.undoStack, redoStack: this.redoStack });
4790
5050
  if (n.action) {
4791
5051
  const r = this.rows;
4792
5052
  r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
@@ -4797,7 +5057,7 @@ class un extends R {
4797
5057
  return !0;
4798
5058
  }
4799
5059
  if (i) {
4800
- const n = ze({ undoStack: this.undoStack, redoStack: this.redoStack });
5060
+ const n = Oe({ undoStack: this.undoStack, redoStack: this.redoStack });
4801
5061
  if (n.action) {
4802
5062
  const r = this.rows;
4803
5063
  r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
@@ -4810,7 +5070,7 @@ class un extends R {
4810
5070
  return !1;
4811
5071
  }
4812
5072
  recordEdit(e, t, i, n) {
4813
- const r = Wi(e, t, i, n), o = Gi(
5073
+ const r = Zi(e, t, i, n), o = ji(
4814
5074
  { undoStack: this.undoStack, redoStack: this.redoStack },
4815
5075
  r,
4816
5076
  this.config.maxHistorySize ?? 100
@@ -4818,7 +5078,7 @@ class un extends R {
4818
5078
  this.undoStack = o.undoStack, this.redoStack = o.redoStack;
4819
5079
  }
4820
5080
  undo() {
4821
- const e = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
5081
+ const e = Ge({ undoStack: this.undoStack, redoStack: this.redoStack });
4822
5082
  if (e.action) {
4823
5083
  const t = this.rows;
4824
5084
  t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
@@ -4826,7 +5086,7 @@ class un extends R {
4826
5086
  return e.action;
4827
5087
  }
4828
5088
  redo() {
4829
- const e = ze({ undoStack: this.undoStack, redoStack: this.redoStack });
5089
+ const e = Oe({ undoStack: this.undoStack, redoStack: this.redoStack });
4830
5090
  if (e.action) {
4831
5091
  const t = this.rows;
4832
5092
  t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
@@ -4834,13 +5094,13 @@ class un extends R {
4834
5094
  return e.action;
4835
5095
  }
4836
5096
  canUndo() {
4837
- return Oi({ undoStack: this.undoStack, redoStack: this.redoStack });
5097
+ return Ui({ undoStack: this.undoStack, redoStack: this.redoStack });
4838
5098
  }
4839
5099
  canRedo() {
4840
- return Bi({ undoStack: this.undoStack, redoStack: this.redoStack });
5100
+ return Yi({ undoStack: this.undoStack, redoStack: this.redoStack });
4841
5101
  }
4842
5102
  clearHistory() {
4843
- const e = Vi();
5103
+ const e = Xi();
4844
5104
  this.undoStack = e.undoStack, this.redoStack = e.redoStack;
4845
5105
  }
4846
5106
  getUndoStack() {
@@ -4850,8 +5110,8 @@ class un extends R {
4850
5110
  return [...this.redoStack];
4851
5111
  }
4852
5112
  }
4853
- const $i = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}}';
4854
- function Ge(s) {
5113
+ const Ji = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}}';
5114
+ function Be(s) {
4855
5115
  const e = s.meta ?? {};
4856
5116
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
4857
5117
  }
@@ -4861,7 +5121,7 @@ class M extends R {
4861
5121
  ];
4862
5122
  name = "visibility";
4863
5123
  static PANEL_ID = "columns";
4864
- styles = $i;
5124
+ styles = Ji;
4865
5125
  get defaultConfig() {
4866
5126
  return {
4867
5127
  allowHideAll: !1
@@ -4951,7 +5211,7 @@ class M extends R {
4951
5211
  const i = this.grid.getAllColumns().filter((n) => !n.utility);
4952
5212
  for (let n = 0; n < i.length; n++) {
4953
5213
  const r = i[n], o = r.header || r.field, a = document.createElement("div");
4954
- a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ge(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
5214
+ a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Be(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
4955
5215
  const l = document.createElement("label");
4956
5216
  l.className = "tbw-visibility-label";
4957
5217
  const d = document.createElement("input");
@@ -4959,7 +5219,7 @@ class M extends R {
4959
5219
  this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
4960
5220
  });
4961
5221
  const c = document.createElement("span");
4962
- if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ge(r)) {
5222
+ if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Be(r)) {
4963
5223
  const u = document.createElement("span");
4964
5224
  u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
4965
5225
  }
@@ -4986,12 +5246,12 @@ class M extends R {
4986
5246
  return;
4987
5247
  const d = l > a ? l - 1 : l;
4988
5248
  if (d !== a) {
4989
- const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, f = h ? c.findIndex((p) => p.field === h) : c.length, g = {
5249
+ const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, g = h ? c.findIndex((p) => p.field === h) : c.length, f = {
4990
5250
  field: o,
4991
5251
  fromIndex: a,
4992
- toIndex: f
5252
+ toIndex: g
4993
5253
  };
4994
- this.emit("column-reorder-request", g), setTimeout(() => {
5254
+ this.emit("column-reorder-request", f), setTimeout(() => {
4995
5255
  this.rebuildToggles(n);
4996
5256
  }, 0);
4997
5257
  }
@@ -5000,47 +5260,49 @@ class M extends R {
5000
5260
  }
5001
5261
  export {
5002
5262
  R as BaseGridPlugin,
5003
- Ui as ClipboardPlugin,
5004
- Yi as ColumnVirtualizationPlugin,
5005
- Xi as ContextMenuPlugin,
5006
- gn as DEFAULT_ANIMATION_CONFIG,
5007
- Ye as DEFAULT_GRID_ICONS,
5008
- pn as DGEvents,
5009
- mn as DataGridElement,
5010
- Zi as EditingPlugin,
5011
- Ji as ExportPlugin,
5263
+ en as ClipboardPlugin,
5264
+ tn as ColumnVirtualizationPlugin,
5265
+ nn as ContextMenuPlugin,
5266
+ Cn as DEFAULT_ANIMATION_CONFIG,
5267
+ Ze as DEFAULT_GRID_ICONS,
5268
+ xn as DGEvents,
5269
+ Rn as DataGridElement,
5270
+ rn as EditingPlugin,
5271
+ on as ExportPlugin,
5012
5272
  T as FilteringPlugin,
5013
- wn as FitModeEnum,
5014
- bn as GridCSSVars,
5015
- vn as GridClasses,
5016
- yn as GridDataAttrs,
5017
- Cn as GridElement,
5018
- xn as GridSelectors,
5019
- Qi as GroupingColumnsPlugin,
5020
- en as GroupingRowsPlugin,
5021
- Ve as MasterDetailPlugin,
5022
- tn as MultiSortPlugin,
5023
- Oe as PLUGIN_QUERIES,
5024
- nn as PinnedColumnsPlugin,
5025
- rn as PinnedRowsPlugin,
5026
- P as PivotPlugin,
5027
- Rn as PluginEvents,
5028
- En as PluginManager,
5029
- ki as ROW_DRAG_HANDLE_FIELD,
5030
- Sn as RenderPhase,
5031
- on as ReorderPlugin,
5032
- sn as ResponsivePlugin,
5033
- an as RowReorderPlugin,
5034
- ln as SelectionPlugin,
5035
- dn as ServerSidePlugin,
5036
- cn as TreePlugin,
5037
- un as UndoRedoPlugin,
5273
+ En as FitModeEnum,
5274
+ Sn as GridCSSVars,
5275
+ kn as GridClasses,
5276
+ An as GridDataAttrs,
5277
+ _n as GridElement,
5278
+ Ln as GridSelectors,
5279
+ sn as GroupingColumnsPlugin,
5280
+ an as GroupingRowsPlugin,
5281
+ $e as MasterDetailPlugin,
5282
+ ln as MultiSortPlugin,
5283
+ Ve as PLUGIN_QUERIES,
5284
+ dn as PinnedColumnsPlugin,
5285
+ cn as PinnedRowsPlugin,
5286
+ D as PivotPlugin,
5287
+ Tn as PluginEvents,
5288
+ In as PluginManager,
5289
+ un as PrintPlugin,
5290
+ Pi as ROW_DRAG_HANDLE_FIELD,
5291
+ Pn as RenderPhase,
5292
+ hn as ReorderPlugin,
5293
+ gn as ResponsivePlugin,
5294
+ fn as RowReorderPlugin,
5295
+ pn as SelectionPlugin,
5296
+ mn as ServerSidePlugin,
5297
+ wn as TreePlugin,
5298
+ bn as UndoRedoPlugin,
5038
5299
  M as VisibilityPlugin,
5039
- kn as builtInSort,
5040
- An as createGrid,
5041
- _n as defaultComparator,
5042
- wt as defaultEditorFor,
5043
- ot as defaultPasteHandler,
5044
- Ln as queryGrid
5300
+ Fn as builtInSort,
5301
+ Dn as createGrid,
5302
+ Mn as defaultComparator,
5303
+ vt as defaultEditorFor,
5304
+ at as defaultPasteHandler,
5305
+ Si as printGridIsolated,
5306
+ qn as queryGrid
5045
5307
  };
5046
5308
  //# sourceMappingURL=all.js.map