@umriss-ui/table 0.2.4 → 0.3.1

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.
package/dist/table.js CHANGED
@@ -1,492 +1,657 @@
1
1
  import "./table.css";
2
- var wt = Object.defineProperty;
3
- var _t = (e, t, n) => t in e ? wt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var z = (e, t, n) => _t(e, typeof t != "symbol" ? t + "" : t, n);
5
- import { useState as P, useCallback as B, useMemo as V, useRef as oe, useId as Z, useContext as xe, useSyncExternalStore as pe, createContext as Ge, useLayoutEffect as J } from "react";
6
- import { DEFAULT_FORMATS as vt, useVirtual as kt, useFormats as te, useWording as $, Checkbox as ge, DateRangePicker as yt, FormField as Ee, NumberInput as Pe, Popover as Ue, Button as G, TagGroup as Ct, Tag as St, useDensityFor as qe, VisuallyHidden as be, Menu as Nt, MenuItem as At, assess as xt, verdictWeight as Tt, Select as Ot, Input as Rt, DEFAULT_WORDING as It, Badge as Ce, useFreshness as Ft } from "@umriss-ui/core";
7
- import { jsx as c, jsxs as x, Fragment as Q } from "react/jsx-runtime";
8
- import { createPortal as Lt } from "react-dom";
9
- function zt(e) {
10
- const [t, n] = P(/* @__PURE__ */ new Set()), o = B((u) => t.has(u), [t]), r = B((u) => {
11
- n((d) => {
12
- const h = new Set(d);
13
- return h.has(u) ? h.delete(u) : h.add(u), h;
2
+ var Jt = Object.defineProperty;
3
+ var Xt = (e, t, n) => t in e ? Jt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
+ var B = (e, t, n) => Xt(e, typeof t != "symbol" ? t + "" : t, n);
5
+ import { useState as H, useCallback as X, useMemo as $, useRef as re, useId as se, useContext as Ue, useSyncExternalStore as Le, createContext as yt, useLayoutEffect as W } from "react";
6
+ import { DEFAULT_FORMATS as Ct, useVirtual as Qt, useFormats as ue, useWording as U, Checkbox as Se, DateRangePicker as Zt, FormField as rt, NumberInput as st, Popover as St, Button as ee, TagGroup as Nt, Tag as xt, Menu as At, MenuItem as Fe, MenuSeparator as en, VisuallyHidden as Re, useDensityFor as Tt, assess as tn, verdictWeight as Ee, Select as nn, Input as on, DEFAULT_WORDING as rn, Badge as Ie, useFreshness as sn } from "@umriss-ui/core";
7
+ import { jsx as l, jsxs as O, Fragment as Q } from "react/jsx-runtime";
8
+ import { createPortal as an } from "react-dom";
9
+ function ln(e) {
10
+ const [t, n] = H(/* @__PURE__ */ new Set()), o = X((u) => t.has(u), [t]), r = X((u) => {
11
+ n((h) => {
12
+ const d = new Set(h);
13
+ return d.has(u) ? d.delete(u) : d.add(u), d;
14
14
  });
15
- }, []), i = V(
15
+ }, []), s = $(
16
16
  () => e.length > 0 && e.every((u) => t.has(u)),
17
17
  [e, t]
18
- ), s = V(
19
- () => !i && e.some((u) => t.has(u)),
20
- [e, t, i]
21
- ), l = B(() => {
18
+ ), i = $(
19
+ () => !s && e.some((u) => t.has(u)),
20
+ [e, t, s]
21
+ ), a = X(() => {
22
22
  n((u) => {
23
- const d = new Set(u);
24
- return e.length > 0 && e.every((_) => d.has(_)) ? e.forEach((_) => d.delete(_)) : e.forEach((_) => d.add(_)), d;
23
+ const h = new Set(u);
24
+ return e.length > 0 && e.every((m) => h.has(m)) ? e.forEach((m) => h.delete(m)) : e.forEach((m) => h.add(m)), h;
25
25
  });
26
- }, [e]), a = B(() => n(/* @__PURE__ */ new Set()), []);
27
- return { selected: t, isSelected: o, toggle: r, toggleAll: l, clear: a, allSelected: i, someSelected: s, count: t.size };
26
+ }, [e]), c = X(() => n(/* @__PURE__ */ new Set()), []);
27
+ return { selected: t, isSelected: o, toggle: r, toggleAll: a, clear: c, allSelected: s, someSelected: i, count: t.size };
28
+ }
29
+ const Y = (e) => e == null || typeof e == "number" && Number.isNaN(e);
30
+ function Me(e) {
31
+ return Y(e) ? "empty" : typeof e == "string" ? "text" : typeof e == "number" ? "number" : typeof e == "boolean" ? "boolean" : e instanceof Date ? Number.isNaN(e.getTime()) ? "empty" : "date" : "other";
32
+ }
33
+ function Ft(e, t) {
34
+ for (const n of e) {
35
+ const o = Me(t(n));
36
+ if (o !== "empty") return o;
37
+ }
38
+ return "empty";
28
39
  }
29
- function Te(e, t) {
40
+ const Ot = (e, t) => t ?? e === "number";
41
+ function _e(e, t, n, o) {
42
+ switch (Me(e)) {
43
+ case "text":
44
+ return e;
45
+ case "number": {
46
+ const r = e;
47
+ return t === "percent" ? n.percent(r) : t === "count" ? n.count(r) : typeof t == "object" ? n.number(r, t.decimals) : n.number(r);
48
+ }
49
+ case "date": {
50
+ const r = e;
51
+ return t === "date" ? n.date(r) : t === "time" ? n.time(r, !1) : n.dateTime(r, !1);
52
+ }
53
+ case "boolean":
54
+ return e ? o.booleanYes : o.booleanNo;
55
+ default:
56
+ return null;
57
+ }
58
+ }
59
+ function ze(e, t) {
60
+ if (!Y(e)) {
61
+ if (t) return ze(t(e));
62
+ switch (Me(e)) {
63
+ case "text":
64
+ return e;
65
+ case "number":
66
+ return e;
67
+ case "date":
68
+ return e.getTime();
69
+ case "boolean":
70
+ return e ? 1 : 0;
71
+ default:
72
+ return;
73
+ }
74
+ }
75
+ }
76
+ const cn = "ja", un = "nein";
77
+ function Lt(e, t) {
78
+ if (!Y(e)) {
79
+ if (t) return Lt(t(e));
80
+ switch (Me(e)) {
81
+ case "text":
82
+ return e;
83
+ case "number":
84
+ return e;
85
+ case "date":
86
+ return e.toISOString();
87
+ case "boolean":
88
+ return e ? cn : un;
89
+ default:
90
+ return;
91
+ }
92
+ }
93
+ }
94
+ const Je = "absent", ge = (e) => Y(e) ? Je : e instanceof Date ? `value:${e.getTime()}` : `value:${String(e)}`, it = (e) => e instanceof Date ? e.getTime() : typeof e == "number" && !Number.isNaN(e) ? e : void 0;
95
+ function Xe(e, t) {
96
+ const n = t.map(e.read).filter((c) => !Y(c) && !(c instanceof Date && Number.isNaN(c.getTime()))), o = e.aggregate;
97
+ if (typeof o == "function") return o(n, t);
98
+ if (o === "count") return n.length;
99
+ if (o === "distinct") return new Set(n.map(ge)).size;
100
+ const r = n.filter((c) => it(c) !== void 0);
101
+ if (r.length === 0) return;
102
+ const s = r.map((c) => it(c)), i = r[0] instanceof Date, a = (c) => i ? new Date(c) : c;
103
+ switch (o) {
104
+ case "sum":
105
+ return s.reduce((c, u) => c + u, 0);
106
+ case "avg":
107
+ return s.reduce((c, u) => c + u, 0) / s.length;
108
+ case "min":
109
+ return a(Math.min(...s));
110
+ case "max":
111
+ return a(Math.max(...s));
112
+ case "range":
113
+ return [a(Math.min(...s)), a(Math.max(...s))];
114
+ }
115
+ }
116
+ const Qe = 3, Ce = (e) => {
117
+ if (!Y(e))
118
+ return e instanceof Date ? e.getTime() : typeof e == "boolean" ? e ? 1 : 0 : typeof e == "number" ? e : String(e);
119
+ };
120
+ function Be(e, t, n) {
121
+ const o = Ce(e), r = Ce(t);
122
+ return o === void 0 || r === void 0 ? o === r ? 0 : o === void 0 ? 1 : -1 : typeof o == "number" && typeof r == "number" ? o - r : n(String(o), String(r));
123
+ }
124
+ function dn(e, t) {
125
+ const n = t.compareText ?? Ct.compareText, o = (r, s, i) => {
126
+ var b;
127
+ const a = /* @__PURE__ */ new Map(), c = t.levels[s];
128
+ if (!c) return [];
129
+ const u = /* @__PURE__ */ new Map();
130
+ for (const g of r) {
131
+ const _ = c.value(g), C = ge(_);
132
+ let S = u.get(C);
133
+ S || (S = {
134
+ path: JSON.stringify([...i, C]),
135
+ value: Y(_) ? void 0 : _,
136
+ level: s,
137
+ rows: [],
138
+ groups: [],
139
+ aggregates: {}
140
+ }, u.set(C, S), a.set(S, [...i, C])), S.rows.push(g);
141
+ }
142
+ for (const g of u.values())
143
+ for (const _ of t.aggregates ?? []) g.aggregates[_.id] = Xe(_, g.rows);
144
+ const h = (b = t.sort) == null ? void 0 : b.find(
145
+ (g) => {
146
+ var _;
147
+ return g.column === c.id || ((_ = t.aggregates) == null ? void 0 : _.some((C) => C.id === g.column));
148
+ }
149
+ ), d = (h == null ? void 0 : h.direction) === "desc" ? -1 : 1, m = h !== void 0 && h.column !== c.id ? h.column : void 0, w = (g) => {
150
+ let _;
151
+ for (const C of g.rows) {
152
+ const S = c.order(C);
153
+ Ce(S) !== void 0 && (_ === void 0 || Be(S, _, n) < 0) && (_ = S);
154
+ }
155
+ return _;
156
+ }, k = (g) => {
157
+ if (m === void 0) return c.order ? w(g) : g.value;
158
+ const _ = g.aggregates[m];
159
+ return Array.isArray(_) ? _[0] : _;
160
+ }, p = [...u.values()].sort((g, _) => {
161
+ if (g.value === void 0 || _.value === void 0) return Be(g.value, _.value, n);
162
+ const C = k(g), S = k(_), I = Be(C, S, n);
163
+ return Ce(C) === void 0 || Ce(S) === void 0 ? I : I * d;
164
+ });
165
+ for (const g of p)
166
+ g.groups = o(g.rows, s + 1, a.get(g));
167
+ return p;
168
+ };
169
+ return o(e, 0, []);
170
+ }
171
+ function fn(e, t) {
172
+ const n = /* @__PURE__ */ new Set(), o = (r) => {
173
+ for (const s of r)
174
+ n.add(s.path), o(s.groups);
175
+ };
176
+ return o(e), t.filter((r) => n.has(r));
177
+ }
178
+ const hn = (e) => (t) => {
179
+ if (!(t instanceof Date) || Number.isNaN(t.getTime())) return;
180
+ const n = t.getFullYear(), o = t.getMonth(), r = t.getDate();
181
+ return e === "year" ? new Date(n, 0, 1) : e === "month" ? new Date(n, o, 1) : e === "week" ? new Date(n, o, r - (t.getDay() + 6) % 7) : new Date(n, o, r);
182
+ };
183
+ function gn(e) {
184
+ const t = new Date(e.getFullYear(), e.getMonth(), e.getDate() + 3 - (e.getDay() + 6) % 7), n = new Date(t.getFullYear(), 0, 4);
185
+ return { week: 1 + Math.round((t.getTime() - n.getTime()) / 864e5 / 7 - ((n.getDay() + 6) % 7 - 3) / 7), year: t.getFullYear() };
186
+ }
187
+ function pn(e, t, n, o) {
188
+ if (e === "year") return String(t.getFullYear());
189
+ if (e === "month") return n.month(t);
190
+ if (e === "week") {
191
+ const { week: r, year: s } = gn(t);
192
+ return o.calendarWeek(r, s);
193
+ }
194
+ return n.date(t);
195
+ }
196
+ function mn(e, t) {
197
+ const n = [], o = (r, s) => {
198
+ for (const i of r) {
199
+ const a = t.has(i.path);
200
+ if (i.groups.length === 0 && i.level === 0) {
201
+ if (n.push({ kind: "header", group: i, parents: s, continued: !1 }), !a)
202
+ for (const c of i.rows) n.push({ kind: "row", row: c, parents: [i], span: void 0, first: !1, continued: !1 });
203
+ } else i.groups.length > 0 ? (n.push({ kind: "header", group: i, parents: s, continued: !1 }), a || o(i.groups, [...s, i])) : a ? n.push({ kind: "folded", group: i, parents: s }) : i.rows.forEach((c, u) => n.push({ kind: "row", row: c, parents: s, span: i, first: u === 0, continued: !1 }));
204
+ }
205
+ };
206
+ return o(e, []), n;
207
+ }
208
+ function wn(e, t, n) {
209
+ const o = n > 0 ? n : e.length || 1, r = Math.max(1, Math.ceil(e.length / o)), s = Math.min(Math.max(1, t), r), i = e.slice((s - 1) * o, s * o);
210
+ return { lines: Rt(i), page: s, pageCount: r };
211
+ }
212
+ const Ze = (e) => e.flatMap((t) => t.kind === "row" ? [t.row] : []);
213
+ function Rt(e) {
214
+ const t = e[0];
215
+ if (!t) return [...e];
216
+ const n = t.parents.map((r, s) => ({
217
+ kind: "header",
218
+ group: r,
219
+ parents: t.parents.slice(0, s),
220
+ continued: !0
221
+ })), o = t.kind === "row" && t.span && !t.first ? { ...t, first: !0, continued: !0 } : t;
222
+ return [...n, o, ...e.slice(1)];
223
+ }
224
+ function et(e, t) {
30
225
  return t != null && t.length ? [
31
226
  ...t.map((n) => e.find((o) => o.id === n)).filter((n) => n !== void 0),
32
227
  ...e.filter((n) => !t.includes(n.id))
33
228
  ] : e;
34
229
  }
35
- const ie = (e) => e == null || typeof e == "number" && Number.isNaN(e), jt = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : vt.compareText(String(e), String(t));
36
- function Oe(e, t, n) {
230
+ const ke = (e) => e == null || typeof e == "number" && Number.isNaN(e), bn = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : Ct.compareText(String(e), String(t));
231
+ function tt(e, t, n) {
232
+ var x;
37
233
  const {
38
234
  search: o = "",
39
235
  filter: r,
40
- sort: i = null,
41
- page: s = 1,
42
- pageSize: l,
43
- hidden: a,
236
+ sort: s = null,
237
+ page: i = 1,
238
+ pageSize: a,
239
+ hidden: c,
44
240
  order: u
45
- } = n, d = Te(t, u), h = a != null && a.length ? d.filter((w) => w.hideable === !1 || !a.includes(w.id)) : d, _ = o.trim().toLowerCase(), g = t.filter((w) => w.searchable && w.value), p = (w) => !_ || g.some((C) => {
46
- const I = C.value(w);
47
- return !ie(I) && String(I).toLowerCase().includes(_);
48
- }), b = e.filter((w) => p(w) && (r ? r(w) : !0)), m = (Array.isArray(i) ? i : i ? [i] : []).map((w) => {
49
- const C = t.find((T) => T.id === w.column);
50
- if (!C || !C.compare && !C.value) return null;
51
- const I = w.direction === "asc" ? 1 : -1, A = C.compare, S = C.value;
52
- return S ? (T, L) => {
53
- const F = S(T), E = S(L);
54
- return ie(F) || ie(E) ? ie(F) === ie(E) ? 0 : ie(F) ? 1 : -1 : (A ? A(T, L) : jt(F, E)) * I;
55
- } : (T, L) => A(T, L) * I;
56
- }).filter((w) => w !== null);
57
- m.length > 0 && b.sort((w, C) => {
58
- for (const I of m) {
59
- const A = I(w, C);
60
- if (A !== 0) return A;
241
+ } = n, h = et(t, u), d = c != null && c.length ? h.filter((A) => A.hideable === !1 || !c.includes(A.id)) : h, m = o.trim().toLowerCase(), w = t.filter((A) => A.searchable && A.value), k = (A) => !m || w.some((v) => {
242
+ const F = v.value(A);
243
+ return !ke(F) && String(F).toLowerCase().includes(m);
244
+ }), p = e.filter((A) => k(A) && (r ? r(A) : !0)), b = Array.isArray(s) ? s : s ? [s] : [], g = b.map((A) => {
245
+ const v = t.find((V) => V.id === A.column);
246
+ if (!v || !v.compare && !v.value) return null;
247
+ const F = A.direction === "asc" ? 1 : -1, L = v.compare, N = v.value;
248
+ return N ? (V, z) => {
249
+ const P = N(V), q = N(z);
250
+ return ke(P) || ke(q) ? ke(P) === ke(q) ? 0 : ke(P) ? 1 : -1 : (L ? L(V, z) : bn(P, q)) * F;
251
+ } : (V, z) => L(V, z) * F;
252
+ }).filter((A) => A !== null);
253
+ if (g.length > 0 && p.sort((A, v) => {
254
+ for (const F of g) {
255
+ const L = F(A, v);
256
+ if (L !== 0) return L;
61
257
  }
62
258
  return 0;
63
- });
64
- const y = l && l > 0 ? l : b.length || 1, O = Math.max(1, Math.ceil(b.length / y)), N = Math.min(Math.max(1, s), O), M = b.slice((N - 1) * y, N * y);
259
+ }), (x = n.grouping) != null && x.levels.length) {
260
+ const { folded: A, ...v } = n.grouping, F = dn(p, { ...v, sort: b }), L = mn(F, A), N = wn(L, i, a ?? 0);
261
+ return {
262
+ columns: d,
263
+ filtered: p,
264
+ visible: Ze(N.lines),
265
+ groups: F,
266
+ lines: L,
267
+ visibleLines: N.lines,
268
+ page: N.page,
269
+ pageCount: N.pageCount,
270
+ columnCount: d.length
271
+ };
272
+ }
273
+ const _ = a && a > 0 ? a : p.length || 1, C = Math.max(1, Math.ceil(p.length / _)), S = Math.min(Math.max(1, i), C), I = p.slice((S - 1) * _, S * _);
65
274
  return {
66
- columns: h,
67
- filtered: b,
68
- visible: M,
69
- page: N,
70
- pageCount: O,
71
- columnCount: h.length
275
+ columns: d,
276
+ filtered: p,
277
+ visible: I,
278
+ page: S,
279
+ pageCount: C,
280
+ columnCount: d.length
72
281
  };
73
282
  }
74
- function Et(e, t, n) {
75
- const { rowKey: o, filter: r, defaultSort: i = null, initialView: s, virtual: l } = n, [a, u] = P((s == null ? void 0 : s.search) ?? ""), [d, h] = P(() => {
76
- var k;
77
- return (k = s == null ? void 0 : s.sort) != null && k.length ? [...s.sort] : i ? Array.isArray(i) ? [...i] : [i] : [];
78
- }), [_, g] = P((s == null ? void 0 : s.page) ?? 1), [p, b] = P(
79
- (s == null ? void 0 : s.pageSize) ?? n.pageSize ?? 10
80
- ), [v, m] = P([]), [y, O] = P((s == null ? void 0 : s.hidden) ?? []), [N, M] = P((s == null ? void 0 : s.order) ?? []), [w, C] = P(() => {
81
- if (s != null && s.widths) return { ...s.widths };
82
- const k = {};
83
- for (const R of t)
84
- R.width !== void 0 && (k[R.id] = R.width);
85
- return k;
86
- }), I = l ? 0 : p, A = V(
87
- () => Oe(e, t, {
88
- search: a,
283
+ function kn(e, t, n) {
284
+ const { rowKey: o, filter: r, defaultSort: s = null, initialView: i, virtual: a, grouping: c } = n, [u, h] = H((i == null ? void 0 : i.search) ?? ""), [d, m] = H(() => {
285
+ var T;
286
+ return (T = i == null ? void 0 : i.sort) != null && T.length ? [...i.sort] : s ? Array.isArray(s) ? [...s] : [s] : [];
287
+ }), [w, k] = H((i == null ? void 0 : i.page) ?? 1), [p, b] = H(
288
+ (i == null ? void 0 : i.pageSize) ?? n.pageSize ?? 10
289
+ ), [g, _] = H([]), [C, S] = H((i == null ? void 0 : i.hidden) ?? []), [I, x] = H((i == null ? void 0 : i.order) ?? []), [A, v] = H(() => {
290
+ if (i != null && i.widths) return { ...i.widths };
291
+ const T = {};
292
+ for (const D of t)
293
+ D.width !== void 0 && (T[D.id] = D.width);
294
+ return T;
295
+ }), F = a ? 0 : p, L = $(
296
+ () => tt(e, t, {
297
+ search: u,
89
298
  filter: r,
90
299
  sort: d,
91
- page: _,
92
- pageSize: I,
93
- hidden: y,
94
- order: N
300
+ page: w,
301
+ pageSize: F,
302
+ hidden: C,
303
+ order: I,
304
+ grouping: c
95
305
  }),
96
- [e, t, a, r, d, _, I, y, N]
97
- ), S = kt(l ? A.filtered.length : 0, {
98
- rowHeight: (l == null ? void 0 : l.rowHeight) ?? 0,
99
- overscan: l == null ? void 0 : l.overscan
100
- }), T = V(
101
- () => l ? A.filtered.slice(S.from, S.to) : A.visible,
102
- [l, A.filtered, A.visible, S.from, S.to]
103
- ), L = V(() => A.filtered.map(o), [A.filtered, o]), F = zt(L), E = B((k) => {
104
- u(k), g(1);
105
- }, []), W = B((k) => {
106
- b(k), g(1);
107
- }, []), q = B((k, R = !1) => {
108
- h((j) => {
109
- const Y = j.find((ne) => ne.column === k);
110
- if (!R) {
111
- const ne = j.length === 1 && (Y == null ? void 0 : Y.direction) === "asc" ? "desc" : "asc";
112
- return [{ column: k, direction: ne }];
306
+ [e, t, u, r, d, w, F, C, I, c]
307
+ ), N = Qt(a ? (L.lines ?? L.filtered).length : 0, {
308
+ rowHeight: (a == null ? void 0 : a.rowHeight) ?? 0,
309
+ overscan: a == null ? void 0 : a.overscan
310
+ }), V = $(
311
+ () => a && L.lines ? L.lines.slice(N.from, N.to) : L.visibleLines,
312
+ [a, L.lines, L.visibleLines, N.from, N.to]
313
+ ), z = $(
314
+ () => a ? V ? Ze(V) : L.filtered.slice(N.from, N.to) : L.visible,
315
+ [a, V, L.filtered, L.visible, N.from, N.to]
316
+ ), P = $(() => L.filtered.map(o), [L.filtered, o]), q = ln(P), ie = X((T) => {
317
+ h(T), k(1);
318
+ }, []), ae = X((T) => {
319
+ b(T), k(1);
320
+ }, []), de = X((T, D = !1) => {
321
+ m((E) => {
322
+ const ne = E.find((he) => he.column === T);
323
+ if (!D) {
324
+ const he = E.length === 1 && (ne == null ? void 0 : ne.direction) === "asc" ? "desc" : "asc";
325
+ return [{ column: T, direction: he }];
113
326
  }
114
- return Y ? Y.direction === "asc" ? j.map(
115
- (ne) => ne.column === k ? { column: k, direction: "desc" } : ne
116
- ) : j.filter((ne) => ne.column !== k) : [...j, { column: k, direction: "asc" }];
117
- }), g(1);
118
- }, []), D = B((k) => {
119
- m(
120
- (R) => R.includes(k) ? R.filter((j) => j !== k) : [...R, k]
327
+ return ne ? ne.direction === "asc" ? E.map(
328
+ (he) => he.column === T ? { column: T, direction: "desc" } : he
329
+ ) : E.filter((he) => he.column !== T) : [...E, { column: T, direction: "asc" }];
330
+ }), k(1);
331
+ }, []), fe = X((T) => {
332
+ _(
333
+ (D) => D.includes(T) ? D.filter((E) => E !== T) : [...D, T]
121
334
  );
122
- }, []), K = B(
123
- (k) => v.includes(k),
124
- [v]
125
- ), ve = B((k) => {
126
- O(
127
- (R) => R.includes(k) ? R.filter((j) => j !== k) : [...R, k]
335
+ }, []), we = X(
336
+ (T) => g.includes(T),
337
+ [g]
338
+ ), be = X((T) => {
339
+ S(
340
+ (D) => D.includes(T) ? D.filter((E) => E !== T) : [...D, T]
128
341
  );
129
- }, []), ht = B((k, R) => {
130
- C((j) => {
131
- if (R === void 0) {
132
- if (!(k in j)) return j;
133
- const Y = { ...j };
134
- return delete Y[k], Y;
342
+ }, []), ye = X((T, D) => {
343
+ v((E) => {
344
+ if (D === void 0) {
345
+ if (!(T in E)) return E;
346
+ const ne = { ...E };
347
+ return delete ne[T], ne;
135
348
  }
136
- return { ...j, [k]: R };
349
+ return { ...E, [T]: D };
137
350
  });
138
- }, []), mt = B(
139
- (k) => {
140
- var R;
141
- return (R = d.find((j) => j.column === k)) == null ? void 0 : R.direction;
351
+ }, []), le = X(
352
+ (T) => {
353
+ var D;
354
+ return (D = d.find((E) => E.column === T)) == null ? void 0 : D.direction;
142
355
  },
143
356
  [d]
144
- ), pt = B(
145
- (k) => {
357
+ ), te = X(
358
+ (T) => {
146
359
  if (d.length < 2) return;
147
- const R = d.findIndex((j) => j.column === k);
148
- return R === -1 ? void 0 : R + 1;
360
+ const D = d.findIndex((E) => E.column === T);
361
+ return D === -1 ? void 0 : D + 1;
149
362
  },
150
363
  [d]
151
- ), gt = V(
152
- () => Te(t, N).filter((k) => k.label !== void 0 && k.hideable !== !1).map((k) => ({ id: k.id, label: k.label, visible: !y.includes(k.id) })),
153
- [t, N, y]
154
- ), Le = n.pageSize ?? 10, ze = V(() => {
155
- const k = {};
156
- for (const R of t)
157
- R.width !== void 0 && (k[R.id] = R.width);
158
- return k;
159
- }, [t]), ke = V(() => {
160
- const k = {};
161
- for (const [R, j] of Object.entries(w))
162
- ze[R] !== j && (k[R] = j);
163
- return k;
164
- }, [w, ze]), ye = V(
165
- () => i ? Array.isArray(i) ? i : [i] : [],
166
- [i]
167
- ), je = d.length === ye.length && d.every(
168
- (k, R) => {
169
- var j, Y;
170
- return k.column === ((j = ye[R]) == null ? void 0 : j.column) && k.direction === ((Y = ye[R]) == null ? void 0 : Y.direction);
364
+ ), y = $(
365
+ () => et(t, I).filter((T) => T.label !== void 0 && T.hideable !== !1).map((T) => ({ id: T.id, label: T.label, visible: !C.includes(T.id) })),
366
+ [t, I, C]
367
+ ), R = n.pageSize ?? 10, K = $(() => {
368
+ const T = {};
369
+ for (const D of t)
370
+ D.width !== void 0 && (T[D.id] = D.width);
371
+ return T;
372
+ }, [t]), j = $(() => {
373
+ const T = {};
374
+ for (const [D, E] of Object.entries(A))
375
+ K[D] !== E && (T[D] = E);
376
+ return T;
377
+ }, [A, K]), M = $(
378
+ () => s ? Array.isArray(s) ? s : [s] : [],
379
+ [s]
380
+ ), J = d.length === M.length && d.every(
381
+ (T, D) => {
382
+ var E, ne;
383
+ return T.column === ((E = M[D]) == null ? void 0 : E.column) && T.direction === ((ne = M[D]) == null ? void 0 : ne.direction);
171
384
  }
172
- ), bt = V(
385
+ ), Z = $(
173
386
  () => ({
174
- ...a ? { search: a } : {},
175
- ...d.length && !je ? { sort: d } : {},
387
+ ...u ? { search: u } : {},
388
+ ...d.length && !J ? { sort: d } : {},
176
389
  /* Without paging there is no page a view could carry - a page three in
177
390
  the view of a virtualised table would be a promise nobody redeems on
178
391
  opening. */
179
- ...!l && A.page > 1 ? { page: A.page } : {},
180
- ...!l && p !== Le ? { pageSize: p } : {},
181
- ...y.length ? { hidden: y } : {},
182
- ...N.length ? { order: N } : {},
183
- ...Object.keys(ke).length ? { widths: ke } : {}
392
+ ...!a && L.page > 1 ? { page: L.page } : {},
393
+ ...!a && p !== R ? { pageSize: p } : {},
394
+ ...C.length ? { hidden: C } : {},
395
+ ...I.length ? { order: I } : {},
396
+ ...Object.keys(j).length ? { widths: j } : {}
184
397
  }),
185
398
  [
186
- l,
187
399
  a,
400
+ u,
188
401
  d,
189
- je,
190
- A.page,
402
+ J,
403
+ L.page,
191
404
  p,
192
- Le,
193
- y,
194
- N,
195
- ke
405
+ R,
406
+ C,
407
+ I,
408
+ j
196
409
  ]
197
410
  );
198
411
  return {
199
- ...A,
200
- visible: T,
201
- virtual: l ? S : void 0,
202
- view: bt,
203
- search: a,
204
- setSearch: E,
412
+ ...L,
413
+ visible: z,
414
+ visibleLines: V,
415
+ virtual: a ? N : void 0,
416
+ view: Z,
417
+ search: u,
418
+ setSearch: ie,
205
419
  sort: d,
206
- toggleSort: q,
207
- sortDirectionOf: mt,
208
- sortRankOf: pt,
209
- setPage: g,
420
+ toggleSort: de,
421
+ sortDirectionOf: le,
422
+ sortRankOf: te,
423
+ setPage: k,
210
424
  pageSize: p,
211
- setPageSize: W,
212
- expanded: v,
213
- toggleRow: D,
214
- isExpanded: K,
215
- hidden: y,
216
- toggleColumn: ve,
217
- columnChoices: gt,
218
- order: N,
219
- setOrder: M,
220
- widths: w,
221
- setWidth: ht,
222
- selection: F
425
+ setPageSize: ae,
426
+ expanded: g,
427
+ toggleRow: fe,
428
+ isExpanded: we,
429
+ hidden: C,
430
+ toggleColumn: be,
431
+ columnChoices: y,
432
+ order: I,
433
+ setOrder: x,
434
+ widths: A,
435
+ setWidth: ye,
436
+ selection: q
223
437
  };
224
438
  }
225
- function Pt() {
439
+ function vn() {
226
440
  var t;
227
441
  const e = import.meta;
228
442
  return typeof ((t = e.env) == null ? void 0 : t.DEV) == "boolean" ? e.env.DEV : typeof process < "u" && (process != null && process.env) ? process.env.NODE_ENV !== "production" : !1;
229
443
  }
230
- const Ye = Pt(), Me = /* @__PURE__ */ new Set();
231
- function re(e, t) {
232
- !Ye || Me.has(e) || (Me.add(e), console.warn(`@umriss-ui/table: ${t}`));
233
- }
234
- const U = (e) => e == null || typeof e == "number" && Number.isNaN(e);
235
- function we(e) {
236
- return U(e) ? "empty" : typeof e == "string" ? "text" : typeof e == "number" ? "number" : typeof e == "boolean" ? "boolean" : e instanceof Date ? Number.isNaN(e.getTime()) ? "empty" : "date" : "other";
237
- }
238
- function Mt(e, t) {
239
- for (const n of e) {
240
- const o = we(t(n));
241
- if (o !== "empty") return o;
242
- }
243
- return "empty";
244
- }
245
- const Xe = (e, t) => t ?? e === "number";
246
- function ae(e, t, n, o) {
247
- switch (we(e)) {
248
- case "text":
249
- return e;
250
- case "number": {
251
- const r = e;
252
- return t === "percent" ? n.percent(r) : t === "count" ? n.count(r) : typeof t == "object" ? n.number(r, t.decimals) : n.number(r);
253
- }
254
- case "date": {
255
- const r = e;
256
- return t === "date" ? n.date(r) : t === "time" ? n.time(r, !1) : n.dateTime(r, !1);
257
- }
258
- case "boolean":
259
- return e ? o.booleanYes : o.booleanNo;
260
- default:
261
- return null;
262
- }
263
- }
264
- function Je(e, t) {
265
- if (!U(e)) {
266
- if (t) return Je(t(e));
267
- switch (we(e)) {
268
- case "text":
269
- return e;
270
- case "number":
271
- return e;
272
- case "date":
273
- return e.getTime();
274
- case "boolean":
275
- return e ? 1 : 0;
276
- default:
277
- return;
278
- }
279
- }
280
- }
281
- const Dt = "ja", Vt = "nein";
282
- function Qe(e, t) {
283
- if (!U(e)) {
284
- if (t) return Qe(t(e));
285
- switch (we(e)) {
286
- case "text":
287
- return e;
288
- case "number":
289
- return e;
290
- case "date":
291
- return e.toISOString();
292
- case "boolean":
293
- return e ? Dt : Vt;
294
- default:
295
- return;
296
- }
297
- }
298
- }
299
- function Ht(e, t, n) {
300
- let o = 0, r = 0;
301
- for (const i of e) {
302
- const s = t(i);
303
- typeof s != "number" || Number.isNaN(s) || (o += s, r += 1);
304
- }
305
- if (r !== 0)
306
- return n === "sum" ? o : o / r;
307
- }
308
- const Re = "absent", le = (e) => U(e) ? Re : e instanceof Date ? `value:${e.getTime()}` : `value:${String(e)}`, Bt = "_frame_10bwr_11 _text_1hv7a_23", $t = "_children_10bwr_23", Wt = "_scroll_10bwr_29 _scroll_1hv7a_40", Kt = "_footerTarget_10bwr_36", Gt = "_table_10bwr_40", Ut = "_th_10bwr_48 _ring_1hv7a_65", qt = "_sticky_10bwr_63", Yt = "_td_10bwr_71", Xt = "_rowHeader_10bwr_83", Jt = "_compact_10bwr_99", Qt = "_numeric_10bwr_114", Zt = "_absent_10bwr_126", en = "_striped_10bwr_130", tn = "_stickyCell_10bwr_154", nn = "_sortButton_10bwr_166 _ring_1hv7a_65", on = "_sortIndicator_10bwr_191", rn = "_sortArrow_10bwr_198", sn = "_sortArrowDesc_10bwr_202", ln = "_sortActive_10bwr_210", cn = "_sortRank_10bwr_216", an = "_thFlex_10bwr_224", dn = "_footerKind_10bwr_245", un = "_emptyCell_10bwr_253", fn = "_empty_10bwr_253", hn = "_emptyTitle_10bwr_269", mn = "_skeleton_10bwr_276", pn = "_toolbar_10bwr_304 _text_1hv7a_23", gn = "_toolbarGroup_10bwr_318", bn = "_toolbarInfo_10bwr_335", wn = "_pagination_10bwr_341 _text_1hv7a_23", _n = "_paginationControls_10bwr_354", vn = "_pageSize_10bwr_361", kn = "_paginationStatus_10bwr_373", yn = "_filterButton_10bwr_382 _ring_1hv7a_65", Cn = "_filterActive_10bwr_405", Sn = "_filterPanel_10bwr_410", Nn = "_filterContent_10bwr_423 _scroll_1hv7a_40", An = "_filterFooter_10bwr_434", xn = "_filterLabel_10bwr_448", Tn = "_filterValue_10bwr_458", On = "_filteredCount_10bwr_464", Rn = "_rangeFields_10bwr_475", In = "_rangePeriod_10bwr_485", Fn = "_conditions_10bwr_491", Ln = "_conditionButton_10bwr_497", zn = "_condition_10bwr_491", jn = "_columnsPanel_10bwr_521", En = "_columnsList_10bwr_529", Pn = "_columnsEntry_10bwr_538", Mn = "_move_10bwr_550", Dn = "_expander_10bwr_585", Vn = "_expanderOpen_10bwr_616", Hn = "_detailRow_10bwr_620", Bn = "_detailCell_10bwr_620", $n = "_actionsCell_10bwr_628", Wn = "_actions_10bwr_628", Kn = "_grip_10bwr_656", Gn = "_virtualBody_10bwr_697", Un = "_virtualRow_10bwr_705", qn = "_fillerRow_10bwr_710", Yn = "_control_10bwr_145", f = {
309
- frame: Bt,
310
- children: $t,
311
- scroll: Wt,
312
- footerTarget: Kt,
313
- table: Gt,
314
- th: Ut,
315
- sticky: qt,
316
- td: Yt,
317
- rowHeader: Xt,
318
- compact: Jt,
319
- numeric: Qt,
320
- absent: Zt,
321
- striped: en,
322
- stickyCell: tn,
323
- sortButton: nn,
324
- sortIndicator: on,
325
- sortArrow: rn,
326
- sortArrowDesc: sn,
327
- sortActive: ln,
328
- sortRank: cn,
329
- thFlex: an,
330
- footerKind: dn,
331
- emptyCell: un,
332
- empty: fn,
333
- emptyTitle: hn,
334
- skeleton: mn,
335
- toolbar: pn,
336
- toolbarGroup: gn,
337
- toolbarInfo: bn,
338
- pagination: wn,
339
- paginationControls: _n,
340
- pageSize: vn,
341
- paginationStatus: kn,
342
- filterButton: yn,
343
- filterActive: Cn,
344
- filterPanel: Sn,
345
- filterContent: Nn,
346
- filterFooter: An,
347
- filterLabel: xn,
348
- filterValue: Tn,
349
- filteredCount: On,
350
- rangeFields: Rn,
351
- rangePeriod: In,
352
- conditions: Fn,
353
- conditionButton: Ln,
354
- condition: zn,
355
- columnsPanel: jn,
356
- columnsList: En,
357
- columnsEntry: Pn,
358
- move: Mn,
359
- expander: Dn,
360
- expanderOpen: Vn,
361
- detailRow: Hn,
362
- detailCell: Bn,
363
- actionsCell: $n,
364
- actions: Wn,
365
- grip: Kn,
366
- virtualBody: Gn,
367
- virtualRow: Un,
368
- fillerRow: qn,
369
- control: Yn
444
+ const Mt = vn(), at = /* @__PURE__ */ new Set();
445
+ function pe(e, t) {
446
+ !Mt || at.has(e) || (at.add(e), console.warn(`@umriss-ui/table: ${t}`));
447
+ }
448
+ const _n = "_frame_1wkkr_11 _text_1hv7a_23", yn = "_children_1wkkr_23", Cn = "_scroll_1wkkr_29 _scroll_1hv7a_40", Sn = "_footerTarget_1wkkr_36", Nn = "_table_1wkkr_40", xn = "_th_1wkkr_48 _ring_1hv7a_65", An = "_sticky_1wkkr_63", Tn = "_td_1wkkr_71", Fn = "_rowHeader_1wkkr_83", On = "_compact_1wkkr_99", Ln = "_numeric_1wkkr_114", Rn = "_absent_1wkkr_126", Mn = "_striped_1wkkr_130", Vn = "_stickyCell_1wkkr_154", Dn = "_sortButton_1wkkr_166 _ring_1hv7a_65", In = "_sortIndicator_1wkkr_191", Bn = "_sortArrow_1wkkr_198", Pn = "_sortArrowDesc_1wkkr_202", Gn = "_sortActive_1wkkr_210", En = "_sortRank_1wkkr_216", zn = "_thFlex_1wkkr_224", jn = "_footerKind_1wkkr_245", Hn = "_emptyCell_1wkkr_253", $n = "_empty_1wkkr_253", Kn = "_emptyTitle_1wkkr_269", Wn = "_skeleton_1wkkr_276", qn = "_toolbar_1wkkr_304 _text_1hv7a_23", Yn = "_toolbarGroup_1wkkr_318", Un = "_toolbarInfo_1wkkr_335", Jn = "_pagination_1wkkr_341 _text_1hv7a_23", Xn = "_paginationControls_1wkkr_354", Qn = "_pageSize_1wkkr_361", Zn = "_paginationStatus_1wkkr_373", eo = "_filterButton_1wkkr_382 _ring_1hv7a_65", to = "_filterActive_1wkkr_405", no = "_filterPanel_1wkkr_410", oo = "_filterContent_1wkkr_423 _scroll_1hv7a_40", ro = "_filterFooter_1wkkr_434", so = "_filterLabel_1wkkr_448", io = "_filterValue_1wkkr_458", ao = "_filteredCount_1wkkr_464", lo = "_rangeFields_1wkkr_475", co = "_rangePeriod_1wkkr_485", uo = "_conditions_1wkkr_491", fo = "_conditionButton_1wkkr_497", ho = "_condition_1wkkr_491", go = "_columnsPanel_1wkkr_521", po = "_columnsList_1wkkr_529", mo = "_columnsEntry_1wkkr_538", wo = "_move_1wkkr_550", bo = "_groupingChoice_1wkkr_585", ko = "_groupingHeading_1wkkr_591", vo = "_groupingOptions_1wkkr_600", _o = "_groupingOption_1wkkr_600 _ring_1hv7a_65", yo = "_groupingLevel_1wkkr_639", Co = "_groupingTag_1wkkr_644", So = "_groupingTrigger_1wkkr_651", No = "_groupingPrefix_1wkkr_656", xo = "_groupingPath_1wkkr_661", Ao = "_groupingSeparator_1wkkr_665", To = "_groupHeader_1wkkr_682", Fo = "_spanCell_1wkkr_723", Oo = "_groupFolded_1wkkr_772", Lo = "_spanValue_1wkkr_776", Ro = "_groupLabel_1wkkr_777", Mo = "_spanText_1wkkr_789", Vo = "_groupValue_1wkkr_790", Do = "_groupCount_1wkkr_797", Io = "_continued_1wkkr_811", Bo = "_spanSelect_1wkkr_842", Po = "_fold_1wkkr_856", Go = "_foldClosed_1wkkr_888", Eo = "_foldedCount_1wkkr_898", zo = "_shareHost_1wkkr_906", jo = "_shareBar_1wkkr_913", Ho = "_expander_1wkkr_925", $o = "_expanderOpen_1wkkr_956", Ko = "_detailRow_1wkkr_960", Wo = "_detailCell_1wkkr_960", qo = "_actionsCell_1wkkr_968", Yo = "_actions_1wkkr_968", Uo = "_grip_1wkkr_996", Jo = "_virtualBody_1wkkr_1037", Xo = "_virtualRow_1wkkr_1045", Qo = "_fillerRow_1wkkr_1050", Zo = "_control_1wkkr_145", f = {
449
+ frame: _n,
450
+ children: yn,
451
+ scroll: Cn,
452
+ footerTarget: Sn,
453
+ table: Nn,
454
+ th: xn,
455
+ sticky: An,
456
+ td: Tn,
457
+ rowHeader: Fn,
458
+ compact: On,
459
+ numeric: Ln,
460
+ absent: Rn,
461
+ striped: Mn,
462
+ stickyCell: Vn,
463
+ sortButton: Dn,
464
+ sortIndicator: In,
465
+ sortArrow: Bn,
466
+ sortArrowDesc: Pn,
467
+ sortActive: Gn,
468
+ sortRank: En,
469
+ thFlex: zn,
470
+ footerKind: jn,
471
+ emptyCell: Hn,
472
+ empty: $n,
473
+ emptyTitle: Kn,
474
+ skeleton: Wn,
475
+ toolbar: qn,
476
+ toolbarGroup: Yn,
477
+ toolbarInfo: Un,
478
+ pagination: Jn,
479
+ paginationControls: Xn,
480
+ pageSize: Qn,
481
+ paginationStatus: Zn,
482
+ filterButton: eo,
483
+ filterActive: to,
484
+ filterPanel: no,
485
+ filterContent: oo,
486
+ filterFooter: ro,
487
+ filterLabel: so,
488
+ filterValue: io,
489
+ filteredCount: ao,
490
+ rangeFields: lo,
491
+ rangePeriod: co,
492
+ conditions: uo,
493
+ conditionButton: fo,
494
+ condition: ho,
495
+ columnsPanel: go,
496
+ columnsList: po,
497
+ columnsEntry: mo,
498
+ move: wo,
499
+ groupingChoice: bo,
500
+ groupingHeading: ko,
501
+ groupingOptions: vo,
502
+ groupingOption: _o,
503
+ groupingLevel: yo,
504
+ groupingTag: Co,
505
+ groupingTrigger: So,
506
+ groupingPrefix: No,
507
+ groupingPath: xo,
508
+ groupingSeparator: Ao,
509
+ groupHeader: To,
510
+ spanCell: Fo,
511
+ groupFolded: Oo,
512
+ spanValue: Lo,
513
+ groupLabel: Ro,
514
+ spanText: Mo,
515
+ groupValue: Vo,
516
+ groupCount: Do,
517
+ continued: Io,
518
+ spanSelect: Bo,
519
+ fold: Po,
520
+ foldClosed: Go,
521
+ foldedCount: Eo,
522
+ shareHost: zo,
523
+ shareBar: jo,
524
+ expander: Ho,
525
+ expanderOpen: $o,
526
+ detailRow: Ko,
527
+ detailCell: Wo,
528
+ actionsCell: qo,
529
+ actions: Yo,
530
+ grip: Uo,
531
+ virtualBody: Jo,
532
+ virtualRow: Xo,
533
+ fillerRow: Qo,
534
+ control: Zo
370
535
  };
371
- function jr(e) {
536
+ function Js(e) {
372
537
  return e;
373
538
  }
374
- const de = /* @__PURE__ */ new WeakMap();
375
- function Ze(e, t) {
376
- return de.set(e, t), e;
539
+ const Ne = /* @__PURE__ */ new WeakMap();
540
+ function Vt(e, t) {
541
+ return Ne.set(e, t), e;
377
542
  }
378
- const Xn = (e) => de.has(e);
379
- function se(e) {
380
- return e === "list" ? to : e === "range" ? ao : typeof e == "object" && e !== null ? e : void 0;
543
+ const er = (e) => Ne.has(e);
544
+ function me(e) {
545
+ return e === "list" ? sr : e === "range" ? hr : typeof e == "object" && e !== null ? e : void 0;
381
546
  }
382
- function et(e, t) {
547
+ function Dt(e, t) {
383
548
  if (t == null) return "empty";
384
- const n = de.get(e);
549
+ const n = Ne.get(e);
385
550
  return n ? n.isCondition(t) ? n.isEmpty(t) ? "empty" : "effective" : "foreign" : "effective";
386
551
  }
387
- function Jn(e, t, n) {
552
+ function tr(e, t, n) {
388
553
  var o;
389
- return U(t) ? ((o = de.get(e)) == null ? void 0 : o.absentMatches(n)) ?? !1 : e.matches(t, n);
554
+ return Y(t) ? ((o = Ne.get(e)) == null ? void 0 : o.absentMatches(n)) ?? !1 : e.matches(t, n);
390
555
  }
391
- function Qn(e, t, n) {
392
- const o = de.get(e);
556
+ function nr(e, t, n) {
557
+ const o = Ne.get(e);
393
558
  return o ? o.describeIn(t, n) : e.describe(t);
394
559
  }
395
- const De = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : void 0, tt = (e) => (t, n) => {
396
- const o = De(t.value), r = De(n.value);
560
+ const lt = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : void 0, It = (e) => (t, n) => {
561
+ const o = lt(t.value), r = lt(n.value);
397
562
  return o !== void 0 && r !== void 0 ? o - r : e.compareText(t.text, n.text);
398
563
  };
399
- function Zn(e, t, n) {
564
+ function or(e, t, n) {
400
565
  const o = /* @__PURE__ */ new Map();
401
566
  let r = !1;
402
- for (const s of e) {
403
- const l = t(s);
404
- if (U(l)) {
567
+ for (const i of e) {
568
+ const a = t(i);
569
+ if (Y(a)) {
405
570
  r = !0;
406
571
  continue;
407
572
  }
408
- const a = l instanceof Date ? `date:${l.getTime()}` : typeof l == "object" || typeof l == "function" ? l : `${typeof l}:${String(l)}`;
409
- o.has(a) || o.set(a, l);
573
+ const c = a instanceof Date ? `date:${a.getTime()}` : typeof a == "object" || typeof a == "function" ? a : `${typeof a}:${String(a)}`;
574
+ o.has(c) || o.set(c, a);
410
575
  }
411
- return { values: [...o.values()].map((s) => ({ value: s, text: String(s) })).sort(tt(n)).map(({ value: s }) => s), absent: r };
576
+ return { values: [...o.values()].map((i) => ({ value: i, text: String(i) })).sort(It(n)).map(({ value: i }) => i), absent: r };
412
577
  }
413
- const Ve = /* @__PURE__ */ new WeakMap();
414
- function Se(e) {
415
- let t = Ve.get(e);
416
- return t || (t = new Set(e.map(le)), Ve.set(e, t)), t;
578
+ const ct = /* @__PURE__ */ new WeakMap();
579
+ function je(e) {
580
+ let t = ct.get(e);
581
+ return t || (t = new Set(e.map(ge)), ct.set(e, t)), t;
417
582
  }
418
- const Ne = (e, t) => U(e) ? t.wording.cellAbsentValue : ae(e, t.format, t.formats, t.wording) ?? String(e);
419
- function eo({
583
+ const He = (e, t) => Y(e) ? t.wording.cellAbsentValue : _e(e, t.format, t.formats, t.wording) ?? String(e);
584
+ function rr({
420
585
  condition: e,
421
586
  setCondition: t,
422
587
  values: n,
423
588
  absentOccurs: o = !1,
424
589
  format: r
425
590
  }) {
426
- const i = te(), s = $(), l = V(() => e ?? [], [e]), a = V(() => {
427
- const h = { formats: i, wording: s, format: r }, _ = n.map((v) => ({ key: le(v), text: Ne(v, h), value: v }));
428
- _.sort(tt(i));
429
- const g = new Set(_.map((v) => v.key)), p = l.filter((v) => !U(v) && !g.has(le(v))).map((v) => ({ key: le(v), text: Ne(v, h), value: v })), b = o || l.some(U) ? [{ key: Re, text: s.cellAbsentValue, value: null }] : [];
430
- return [..._, ...p, ...b];
431
- }, [n, l, o, r, i, s]), u = Se(l), d = (h) => {
432
- const _ = u.has(h.key) ? l.filter((g) => le(g) !== h.key) : [...l, h.value];
433
- t(_.length > 0 ? _ : null);
591
+ const s = ue(), i = U(), a = $(() => e ?? [], [e]), c = $(() => {
592
+ const d = { formats: s, wording: i, format: r }, m = n.map((b) => ({ key: ge(b), text: He(b, d), value: b }));
593
+ m.sort(It(s));
594
+ const w = new Set(m.map((b) => b.key)), k = a.filter((b) => !Y(b) && !w.has(ge(b))).map((b) => ({ key: ge(b), text: He(b, d), value: b })), p = o || a.some(Y) ? [{ key: Je, text: i.cellAbsentValue, value: null }] : [];
595
+ return [...m, ...k, ...p];
596
+ }, [n, a, o, r, s, i]), u = je(a), h = (d) => {
597
+ const m = u.has(d.key) ? a.filter((w) => ge(w) !== d.key) : [...a, d.value];
598
+ t(m.length > 0 ? m : null);
434
599
  };
435
- return /* @__PURE__ */ c("div", { className: f.filterContent, children: a.map((h) => /* @__PURE__ */ c(
436
- ge,
600
+ return /* @__PURE__ */ l("div", { className: f.filterContent, children: c.map((d) => /* @__PURE__ */ l(
601
+ Se,
437
602
  {
438
- label: h.text,
439
- checked: u.has(h.key),
440
- onChange: () => d(h)
603
+ label: d.text,
604
+ checked: u.has(d.key),
605
+ onChange: () => h(d)
441
606
  },
442
- h.key
607
+ d.key
443
608
  )) });
444
609
  }
445
- const to = Ze(
610
+ const sr = Vt(
446
611
  {
447
- matches: (e, t) => Se(t).has(le(e)),
448
- Input: eo,
449
- describe: (e) => e.map((t) => U(t) ? "–" : String(t)).join(", ")
612
+ matches: (e, t) => je(t).has(ge(e)),
613
+ Input: rr,
614
+ describe: (e) => e.map((t) => Y(t) ? "–" : String(t)).join(", ")
450
615
  },
451
616
  {
452
617
  isCondition: (e) => Array.isArray(e),
453
618
  isEmpty: (e) => e.length === 0,
454
- absentMatches: (e) => Se(e).has(Re),
619
+ absentMatches: (e) => je(e).has(Je),
455
620
  /* From three values on the first two and how many more: a condition is one
456
621
  line in the table toolbar, not a list. */
457
622
  describeIn: (e, t) => {
458
- const n = e.map((r) => Ne(r, t));
623
+ const n = e.map((r) => He(r, t));
459
624
  if (n.length <= 2) return n.join(", ");
460
625
  const o = n.length - 2;
461
626
  return `${n.slice(0, 2).join(", ")} ${t.wording.moreValues(o, t.formats.count(o))}`;
462
627
  }
463
628
  }
464
- ), no = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), oo = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime(), ce = (e) => typeof e == "number" && Number.isFinite(e), ee = (e) => e instanceof Date && !Number.isNaN(e.getTime()), ro = (e) => ee(e) ? no(e) : ce(e) ? e : void 0, so = (e) => ee(e) ? { value: oo(e), open: !0 } : ce(e) ? { value: e, open: !1 } : void 0, fe = (e, t) => ee(e) ? t.formats.date(e) : ae(e, t.format, t.formats, t.wording) ?? String(e);
465
- function io({ condition: e, setCondition: t }) {
466
- const n = $(), [o, r] = P(null), i = o !== null, s = o ? o.from : ce(e == null ? void 0 : e.from) ? e.from : null, l = o ? o.to : ce(e == null ? void 0 : e.to) ? e.to : null, a = (u, d) => {
467
- const h = { from: s, to: l, [u]: d };
468
- if (h.from !== null && h.to !== null && h.from > h.to) {
469
- r(h);
629
+ ), ir = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), ar = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime(), ve = (e) => typeof e == "number" && Number.isFinite(e), ce = (e) => e instanceof Date && !Number.isNaN(e.getTime()), lr = (e) => ce(e) ? ir(e) : ve(e) ? e : void 0, cr = (e) => ce(e) ? { value: ar(e), open: !0 } : ve(e) ? { value: e, open: !1 } : void 0, Ae = (e, t) => ce(e) ? t.formats.date(e) : _e(e, t.format, t.formats, t.wording) ?? String(e);
630
+ function ur({ condition: e, setCondition: t }) {
631
+ const n = U(), [o, r] = H(null), s = o !== null, i = o ? o.from : ve(e == null ? void 0 : e.from) ? e.from : null, a = o ? o.to : ve(e == null ? void 0 : e.to) ? e.to : null, c = (u, h) => {
632
+ const d = { from: i, to: a, [u]: h };
633
+ if (d.from !== null && d.to !== null && d.from > d.to) {
634
+ r(d);
470
635
  return;
471
636
  }
472
- if (r(null), h.from === null && h.to === null) {
637
+ if (r(null), d.from === null && d.to === null) {
473
638
  t(null);
474
639
  return;
475
640
  }
476
641
  t({
477
- ...h.from !== null ? { from: h.from } : {},
478
- ...h.to !== null ? { to: h.to } : {}
642
+ ...d.from !== null ? { from: d.from } : {},
643
+ ...d.to !== null ? { to: d.to } : {}
479
644
  });
480
645
  };
481
- return /* @__PURE__ */ x("div", { className: f.rangeFields, children: [
482
- /* @__PURE__ */ c(Ee, { label: n.filterFrom, children: /* @__PURE__ */ c(Pe, { size: "sm", value: s, invalid: i, onChange: (u) => a("from", u) }) }),
483
- /* @__PURE__ */ c(Ee, { label: n.filterTo, error: i ? n.rangeInvalid : void 0, children: /* @__PURE__ */ c(Pe, { size: "sm", value: l, onChange: (u) => a("to", u) }) })
646
+ return /* @__PURE__ */ O("div", { className: f.rangeFields, children: [
647
+ /* @__PURE__ */ l(rt, { label: n.filterFrom, children: /* @__PURE__ */ l(st, { size: "sm", value: i, invalid: s, onChange: (u) => c("from", u) }) }),
648
+ /* @__PURE__ */ l(rt, { label: n.filterTo, error: s ? n.rangeInvalid : void 0, children: /* @__PURE__ */ l(st, { size: "sm", value: a, onChange: (u) => c("to", u) }) })
484
649
  ] });
485
650
  }
486
- function lo({ condition: e, setCondition: t }) {
487
- const n = ee(e == null ? void 0 : e.from) && ee(e == null ? void 0 : e.to) ? { from: e.from, to: e.to } : null;
488
- return /* @__PURE__ */ c("div", { className: f.rangePeriod, children: /* @__PURE__ */ c(
489
- yt,
651
+ function dr({ condition: e, setCondition: t }) {
652
+ const n = ce(e == null ? void 0 : e.from) && ce(e == null ? void 0 : e.to) ? { from: e.from, to: e.to } : null;
653
+ return /* @__PURE__ */ l("div", { className: f.rangePeriod, children: /* @__PURE__ */ l(
654
+ Zt,
490
655
  {
491
656
  size: "sm",
492
657
  clearable: !0,
@@ -495,46 +660,46 @@ function lo({ condition: e, setCondition: t }) {
495
660
  }
496
661
  ) });
497
662
  }
498
- function co(e) {
499
- return e.kind === "date" ? /* @__PURE__ */ c(lo, { ...e }) : /* @__PURE__ */ c(io, { ...e });
663
+ function fr(e) {
664
+ return e.kind === "date" ? /* @__PURE__ */ l(dr, { ...e }) : /* @__PURE__ */ l(ur, { ...e });
500
665
  }
501
- const ao = Ze(
666
+ const hr = Vt(
502
667
  {
503
668
  matches: (e, t) => {
504
- const n = ee(e) ? e.getTime() : ce(e) ? e : void 0;
669
+ const n = ce(e) ? e.getTime() : ve(e) ? e : void 0;
505
670
  if (n === void 0) return !1;
506
- const o = ro(t.from), r = so(t.to);
671
+ const o = lr(t.from), r = cr(t.to);
507
672
  return !(o !== void 0 && n < o || r !== void 0 && (r.open ? n >= r.value : n > r.value));
508
673
  },
509
- Input: co,
674
+ Input: fr,
510
675
  describe: (e) => [e.from, e.to].map((t) => t === void 0 ? "" : String(t)).join("–")
511
676
  },
512
677
  {
513
678
  isCondition: (e) => typeof e != "object" || e === null || Array.isArray(e) || e instanceof Date ? !1 : Object.entries(e).every(
514
- ([n, o]) => (n === "from" || n === "to") && (o === void 0 || ce(o) || ee(o))
679
+ ([n, o]) => (n === "from" || n === "to") && (o === void 0 || ve(o) || ce(o))
515
680
  ),
516
681
  isEmpty: (e) => e.from === void 0 && e.to === void 0,
517
682
  absentMatches: () => !1,
518
683
  describeIn: (e, t) => {
519
684
  const { from: n, to: o } = e;
520
685
  if (n !== void 0 && o !== void 0) {
521
- const r = ee(n) && ee(o) && n.getFullYear() === o.getFullYear();
686
+ const r = ce(n) && ce(o) && n.getFullYear() === o.getFullYear();
522
687
  return t.wording.rangeFromTo(
523
- r ? t.formats.dateShort(n) : fe(n, t),
524
- fe(o, t)
688
+ r ? t.formats.dateShort(n) : Ae(n, t),
689
+ Ae(o, t)
525
690
  );
526
691
  }
527
- return n !== void 0 ? t.wording.rangeFrom(fe(n, t)) : o === void 0 ? "" : t.wording.rangeTo(fe(o, t));
692
+ return n !== void 0 ? t.wording.rangeFrom(Ae(n, t)) : o === void 0 ? "" : t.wording.rangeTo(Ae(o, t));
528
693
  }
529
694
  }
530
695
  );
531
- class He {
696
+ class Pe {
532
697
  constructor(t) {
533
- z(this, "entries", /* @__PURE__ */ new Map());
698
+ B(this, "entries", /* @__PURE__ */ new Map());
534
699
  /** Keys in the order of the running pass. */
535
- z(this, "pass", []);
700
+ B(this, "pass", []);
536
701
  /** Order from the markers in the DOM, after the last commit. */
537
- z(this, "dom", []);
702
+ B(this, "dom", []);
538
703
  this.markerAttribute = t;
539
704
  }
540
705
  note(t) {
@@ -555,12 +720,13 @@ class He {
555
720
  return this.dom = n, this.pass = n, o !== this.ordered().map((r) => r.key).join("|");
556
721
  }
557
722
  }
558
- const uo = (e) => JSON.stringify([
723
+ const ut = (e) => JSON.stringify([
559
724
  e.id,
560
725
  e.label,
561
726
  typeof e.value == "string" ? e.value : "ƒ",
562
727
  e.format,
563
- e.footer,
728
+ typeof e.aggregate == "function" ? "ƒ" : e.aggregate,
729
+ e.share,
564
730
  e.rowHeader,
565
731
  e.rightAligned,
566
732
  e.width,
@@ -572,51 +738,63 @@ const uo = (e) => JSON.stringify([
572
738
  typeof e.filter == "object" ? "own" : e.filter,
573
739
  !!e.presentation,
574
740
  !!e.ownSortValue,
575
- !!e.ownExportValue
576
- ]), fo = (e, t) => e == null ? void 0 : e[t];
577
- class ho {
741
+ !!e.ownExportValue,
742
+ !!e.ownGroupValue,
743
+ e.group,
744
+ e.groupable
745
+ ]), dt = (e, t) => e == null ? void 0 : e[t];
746
+ class gr {
578
747
  constructor() {
579
- z(this, "columns", new He("data-umriss-column"));
580
- z(this, "actions", new He("data-umriss-action"));
581
- z(this, "signatures", /* @__PURE__ */ new Map());
748
+ B(this, "columns", new Pe("data-umriss-column"));
749
+ B(this, "actions", new Pe("data-umriss-action"));
750
+ /** The group keys: values to group by that are no column. */
751
+ B(this, "groupKeys", new Pe("data-umriss-groupkey"));
752
+ B(this, "signatures", /* @__PURE__ */ new Map());
582
753
  /** The row detail: the presentation of the `RowDetail` that registered last. */
583
- z(this, "detail", null);
754
+ B(this, "detail", null);
584
755
  /** How many `RowActions` stand right now. */
585
- z(this, "actionGroups", /* @__PURE__ */ new Set());
756
+ B(this, "actionGroups", /* @__PURE__ */ new Set());
586
757
  /** Whether the row header column sticks - it then stands first, on screen, in
587
758
  the column menu and in the export alike. */
588
- z(this, "stickyRowHeader", !1);
759
+ B(this, "stickyRowHeader", !1);
589
760
  /* Without a pagination bar the table does not page: one that stops quietly at
590
761
  the tenth row because nobody put one there is a trap (found at the alarm
591
762
  list, umriss-table 13). Without a table toolbar, but with a search or a
592
763
  column filter, the table puts one there itself (table-filters 04):
593
764
  conditions and the ratio need a place, and a place that came into being
594
765
  only with the first condition would shift the table. */
595
- z(this, "parts", /* @__PURE__ */ new Map());
766
+ B(this, "parts", /* @__PURE__ */ new Map());
596
767
  /** The element the table's children stand in - for the markers. */
597
- z(this, "children", null);
598
- z(this, "hook", null);
599
- z(this, "structure", 0);
600
- z(this, "values", 0);
601
- z(this, "presentation", 0);
602
- z(this, "hookVersion", 0);
603
- z(this, "reported", "");
604
- z(this, "listeners", /* @__PURE__ */ new Set());
768
+ B(this, "children", null);
769
+ B(this, "hook", null);
770
+ B(this, "structure", 0);
771
+ B(this, "values", 0);
772
+ B(this, "presentation", 0);
773
+ B(this, "hookVersion", 0);
774
+ B(this, "reported", "");
775
+ B(this, "listeners", /* @__PURE__ */ new Set());
605
776
  /* --- Subscription ------------------------------------------------------------- */
606
- z(this, "subscribe", (t) => (this.listeners.add(t), () => {
777
+ B(this, "subscribe", (t) => (this.listeners.add(t), () => {
607
778
  this.listeners.delete(t);
608
779
  }));
609
780
  /** What the hook reads. */
610
- z(this, "structureVersion", () => this.structure);
781
+ B(this, "structureVersion", () => this.structure);
611
782
  /** What body and unbound parts read. Every counter only rises, so the sum
612
783
  rises exactly when one of them rises. */
613
- z(this, "bodyVersion", () => this.structure + this.values + this.presentation + this.hookVersion);
784
+ B(this, "bodyVersion", () => this.structure + this.values + this.presentation + this.hookVersion);
785
+ /** The focus a fold may hide: the focused element of a grouped line, the
786
+ group that line stands in, and its table - noted before the fold, since
787
+ afterwards the element may be gone and the focus lost. */
788
+ B(this, "focusBeforeFold", null);
789
+ /** Whether the table lets itself be grouped at all (`<Table groupable>`). */
790
+ B(this, "tableGroupable", !0);
791
+ B(this, "groupingCache", null);
614
792
  /* --- The kind of a column ------------------------------------------------------- */
615
- z(this, "kinds", /* @__PURE__ */ new Map());
793
+ B(this, "kinds", /* @__PURE__ */ new Map());
616
794
  /* --- The model ------------------------------------------------------------------ */
617
- z(this, "modelCache", null);
618
- z(this, "projectionCache", null);
619
- z(this, "unpaged", null);
795
+ B(this, "modelCache", null);
796
+ B(this, "projectionCache", null);
797
+ B(this, "unpaged", null);
620
798
  }
621
799
  /** Reports from a layout effect what has changed since the last report.
622
800
  Without a change nothing happens. */
@@ -631,30 +809,30 @@ class ho {
631
809
  /** The table renders: a new pass begins. Idempotent - a second call within
632
810
  the same pass clears what is empty anyway. */
633
811
  beginPass() {
634
- this.columns.pass = [], this.actions.pass = [];
812
+ this.columns.pass = [], this.actions.pass = [], this.groupKeys.pass = [];
635
813
  }
636
814
  /** After the commit: check the order against the DOM. */
637
815
  checkOrder() {
638
- this.children && (this.columns.check(this.children) && this.structure++, this.actions.check(this.children) && this.structure++);
816
+ this.children && (this.columns.check(this.children) && this.structure++, this.actions.check(this.children) && this.structure++, this.groupKeys.check(this.children) && this.structure++);
639
817
  }
640
818
  /* --- Columns ------------------------------------------------------------------ */
641
819
  /** A column registers during the render. Idempotent: the same spec changes no
642
820
  version. */
643
821
  registerColumn(t, n) {
644
- const o = this.columns.entries.get(t), r = uo(n);
822
+ const o = this.columns.entries.get(t), r = ut(n);
645
823
  if (o) {
646
- const i = o.spec;
647
- this.signatures.get(t) !== r && this.structure++, (i.value !== n.value || i.ownSortValue !== n.ownSortValue) && this.values++, (i.presentation !== n.presentation || i.ownExportValue !== n.ownExportValue) && this.presentation++, o.spec = n;
824
+ const s = o.spec;
825
+ this.signatures.get(t) !== r && this.structure++, (s.value !== n.value || s.ownSortValue !== n.ownSortValue || s.ownGroupValue !== n.ownGroupValue) && this.values++, (s.presentation !== n.presentation || s.ownExportValue !== n.ownExportValue || s.aggregate !== n.aggregate) && this.presentation++, o.spec = n;
648
826
  } else {
649
- const i = {
827
+ const s = {
650
828
  key: t,
651
829
  spec: n,
652
- read: (s) => {
653
- const l = i.spec.value;
654
- return typeof l == "string" ? fo(s, l) : l(s);
830
+ read: (i) => {
831
+ const a = s.spec.value;
832
+ return typeof a == "string" ? dt(i, a) : a(i);
655
833
  }
656
834
  };
657
- this.columns.entries.set(t, i), this.structure++;
835
+ this.columns.entries.set(t, s), this.structure++;
658
836
  }
659
837
  this.signatures.set(t, r), this.columns.note(t), this.checkUniqueness();
660
838
  }
@@ -670,8 +848,8 @@ class ho {
670
848
  const t = /* @__PURE__ */ new Set();
671
849
  let n = 0;
672
850
  for (const { spec: o } of this.columns.entries.values())
673
- t.has(o.id) && re(`id:${o.id}`, `Two columns carry the id "${o.id}". The second one is passed over.`), t.add(o.id), o.rowHeader && n++;
674
- n > 1 && re("rowHeader", "More than one column is `rowHeader`. A table has at most one row header; the first one holds.");
851
+ t.has(o.id) && pe(`id:${o.id}`, `Two columns carry the id "${o.id}". The second one is passed over.`), t.add(o.id), o.rowHeader && n++;
852
+ n > 1 && pe("rowHeader", "More than one column is `rowHeader`. A table has at most one row header; the first one holds.");
675
853
  }
676
854
  /** The table says during the render whether its row header sticks. Idempotent. */
677
855
  setStickyRowHeader(t) {
@@ -696,11 +874,104 @@ class ho {
696
874
  rowHeader() {
697
875
  return this.orderedColumns().find((t) => t.spec.rowHeader);
698
876
  }
877
+ /* --- Group keys and the grouping ---------------------------------------------- */
878
+ /** A group key registers during the render, as a column does. Idempotent. */
879
+ registerGroupKey(t, n) {
880
+ const o = this.groupKeys.entries.get(t), r = ut(n);
881
+ if (o)
882
+ this.signatures.get(t) !== r && this.structure++, (o.spec.value !== n.value || o.spec.ownGroupValue !== n.ownGroupValue) && this.values++, o.spec = n;
883
+ else {
884
+ const s = {
885
+ key: t,
886
+ spec: n,
887
+ read: (i) => {
888
+ const a = s.spec.value;
889
+ return typeof a == "string" ? dt(i, a) : a(i);
890
+ }
891
+ };
892
+ this.groupKeys.entries.set(t, s), this.structure++;
893
+ }
894
+ this.signatures.set(t, r), this.groupKeys.note(t);
895
+ }
896
+ ensureGroupKey(t, n) {
897
+ this.groupKeys.entries.has(t) || this.registerGroupKey(t, n);
898
+ }
899
+ removeGroupKey(t) {
900
+ this.groupKeys.entries.delete(t) && (this.signatures.delete(t), this.kinds.delete(t), this.structure++);
901
+ }
902
+ /** Notes where the focus stands - from the event that folds, never in a
903
+ render. */
904
+ noteFocusBeforeFold() {
905
+ var o;
906
+ const t = document.activeElement, n = (o = t == null ? void 0 : t.closest("tr[data-group]")) == null ? void 0 : o.dataset.group;
907
+ this.focusBeforeFold = t && n !== void 0 ? { element: t, group: n, table: t.closest("table") } : null;
908
+ }
909
+ /** The focus noted before the last fold - once. */
910
+ takeFocusBeforeFold() {
911
+ const t = this.focusBeforeFold;
912
+ return this.focusBeforeFold = null, t;
913
+ }
914
+ setTableGroupable(t) {
915
+ this.tableGroupable !== t && (this.tableGroupable = t, this.structure++);
916
+ }
917
+ /** Everything a table can be grouped by: its columns, then its group keys. */
918
+ groupingEntries(t) {
919
+ if (!this.tableGroupable) return [];
920
+ const n = /* @__PURE__ */ new Set();
921
+ return [...this.orderedColumns(), ...this.groupKeys.ordered()].filter((o) => {
922
+ if (n.has(o.spec.id)) return !1;
923
+ n.add(o.spec.id);
924
+ const { groupable: r, ownGroupValue: s } = o.spec;
925
+ return r ?? (this.kindOf(o, t) !== "other" || !!s);
926
+ });
927
+ }
928
+ /** The ids of a grouping that something groupable carries - at most three,
929
+ each once. */
930
+ effectiveGrouping(t, n) {
931
+ const o = new Set(this.groupingEntries(n).map((r) => r.spec.id));
932
+ return [...new Set(t)].filter((r) => o.has(r)).slice(0, Qe);
933
+ }
934
+ /** The levels and aggregates for the model - the same identity as long as
935
+ nothing changed that they read. */
936
+ groupingModel(t, n) {
937
+ var a;
938
+ const o = [t.join("|"), this.structure, this.values].join(":");
939
+ if (((a = this.groupingCache) == null ? void 0 : a.key) === o) return this.groupingCache;
940
+ const r = this.groupingEntries(n), s = t.map((c) => r.find((u) => u.spec.id === c)).filter((c) => c !== void 0).map((c) => ({
941
+ id: c.spec.id,
942
+ value: (u) => {
943
+ const h = c.read(u);
944
+ if (h == null) return;
945
+ const { ownGroupValue: d, group: m } = c.spec;
946
+ return d ? d(h) : m ? hn(m)(h) : h;
947
+ },
948
+ /* A value of one's own is a name; its groups stand by what they hold. */
949
+ order: c.spec.ownGroupValue ? (u) => ze(c.read(u), c.spec.ownSortValue) : void 0
950
+ })), i = this.orderedColumns().filter((c) => c.spec.aggregate !== void 0).map(
951
+ (c) => ({
952
+ id: c.spec.id,
953
+ read: c.read,
954
+ /* Read with the latest spec on every call: an aggregate of one's own
955
+ written in the call is a new function on every render. */
956
+ aggregate: typeof c.spec.aggregate == "function" ? (u, h) => c.spec.aggregate(u, h) : c.spec.aggregate
957
+ })
958
+ );
959
+ return this.groupingCache = { key: o, levels: s, aggregates: i }, this.groupingCache;
960
+ }
961
+ /** The grouping for the body's own pass: resolved against the columns of
962
+ this pass, so that even the first frame stands grouped. */
963
+ groupingFor(t) {
964
+ var r;
965
+ const n = this.effectiveGrouping(t.publicSnapshot.grouping, t.rows);
966
+ if (n.length === 0) return;
967
+ const o = this.groupingModel(n, t.rows);
968
+ return ((r = t.grouping) == null ? void 0 : r.levels) === o.levels ? t.grouping : { ...o, folded: t.folded, compareText: t.formats.compareText };
969
+ }
699
970
  /** The kind of a column, read off the rows passed in and remembered. */
700
971
  kindOf(t, n) {
701
972
  const o = this.kinds.get(t.key);
702
973
  if (o && o.rows === n && o.value === t.spec.value) return o.kind;
703
- const r = Mt(n, t.read);
974
+ const r = Ft(n, t.read);
704
975
  return this.kinds.set(t.key, { rows: n, value: t.spec.value, kind: r }), r;
705
976
  }
706
977
  /** Can it be sorted by this column? Without a statement: when its value is
@@ -714,42 +985,45 @@ class ho {
714
985
  that the model reads - that is how the body recognises whether it may take
715
986
  over the hook's calculation. */
716
987
  modelColumns(t, n) {
717
- var s;
718
- const o = this.orderedColumns(), r = [this.structure, this.values, o.map((l) => l.key).join("|")].join(":");
719
- if (((s = this.modelCache) == null ? void 0 : s.key) === r && this.modelCache.rows === t && this.modelCache.formats === n)
988
+ var i;
989
+ const o = this.orderedColumns(), r = [this.structure, this.values, o.map((a) => a.key).join("|")].join(":");
990
+ if (((i = this.modelCache) == null ? void 0 : i.key) === r && this.modelCache.rows === t && this.modelCache.formats === n)
720
991
  return this.modelCache.columns;
721
- const i = o.map((l) => {
722
- const { spec: a } = l, u = this.kindOf(l, t), d = this.isSortable(l, t), h = a.searchable ?? u === "text", _ = (g) => Je(l.read(g), a.ownSortValue);
992
+ const s = o.map((a) => {
993
+ const { spec: c } = a, u = this.kindOf(a, t), h = this.isSortable(a, t), d = c.searchable ?? u === "text", m = (w) => ze(a.read(w), c.ownSortValue);
723
994
  return {
724
- id: a.id,
725
- label: a.label,
726
- value: d || h ? _ : void 0,
995
+ id: c.id,
996
+ label: c.label,
997
+ value: h || d ? m : void 0,
727
998
  /* Text sorts with the provider's comparison, not with the built-in
728
999
  German one (spec, the table of defaults). */
729
- compare: u === "text" && !a.ownSortValue ? (g, p) => n.compareText(String(_(g)), String(_(p))) : void 0,
730
- searchable: h,
731
- hideable: !a.rowHeader,
732
- resizable: a.resizable,
733
- width: a.width
1000
+ compare: u === "text" && !c.ownSortValue ? (w, k) => n.compareText(String(m(w)), String(m(k))) : void 0,
1001
+ searchable: d,
1002
+ hideable: !c.rowHeader,
1003
+ resizable: c.resizable,
1004
+ width: c.width
734
1005
  };
735
1006
  });
736
- return this.modelCache = { key: r, rows: t, formats: n, columns: i }, i;
1007
+ return this.modelCache = { key: r, rows: t, formats: n, columns: s }, s;
737
1008
  }
738
1009
  /** The projection for the body. Without a pagination bar it is a single page
739
1010
  holding all the filtered rows. */
740
1011
  projection() {
741
1012
  var n;
742
1013
  const t = this.computedProjection();
743
- return this.paginates() || this.hook.companion.virtual ? t : (((n = this.unpaged) == null ? void 0 : n.from) !== t && (this.unpaged = { from: t, projection: { ...t, visible: t.filtered, page: 1, pageCount: 1 } }), this.unpaged.projection);
1014
+ return this.paginates() || this.hook.companion.virtual ? t : (((n = this.unpaged) == null ? void 0 : n.from) !== t && (this.unpaged = {
1015
+ from: t,
1016
+ projection: { ...t, visible: t.filtered, visibleLines: t.lines, page: 1, pageCount: 1 }
1017
+ }), this.unpaged.projection);
744
1018
  }
745
1019
  /** The hook's projection when it calculated with the same columns - otherwise
746
1020
  a new one, with the columns of this pass. */
747
1021
  computedProjection() {
748
- var l;
1022
+ var a;
749
1023
  const t = this.hook, n = this.modelColumns(t.rows, t.formats), o = t.companion;
750
1024
  if (n === t.modelColumns)
751
1025
  return o;
752
- if (((l = this.projectionCache) == null ? void 0 : l.hook) === t && this.projectionCache.columns === n) return this.projectionCache.projection;
1026
+ if (((a = this.projectionCache) == null ? void 0 : a.hook) === t && this.projectionCache.columns === n) return this.projectionCache.projection;
753
1027
  const r = {
754
1028
  search: o.search,
755
1029
  filter: t.filter,
@@ -757,9 +1031,10 @@ class ho {
757
1031
  page: o.page,
758
1032
  pageSize: o.virtual ? 0 : o.pageSize,
759
1033
  hidden: o.hidden,
760
- order: o.order
761
- }, i = Oe(t.admitted, n, r), s = o.virtual ? { ...i, visible: i.filtered.slice(o.virtual.from, o.virtual.to) } : i;
762
- return this.projectionCache = { hook: t, columns: n, projection: s }, s;
1034
+ order: o.order,
1035
+ grouping: this.groupingFor(t)
1036
+ }, s = tt(t.admitted, n, r), i = o.virtual ? pr(s, o.virtual.from, o.virtual.to) : s;
1037
+ return this.projectionCache = { hook: t, columns: n, projection: i }, i;
763
1038
  }
764
1039
  /* --- The hook's snapshot ---------------------------------------------------------- */
765
1040
  /** The hook deposits its snapshot during the render. Idempotent for the same
@@ -788,9 +1063,11 @@ class ho {
788
1063
  paginates() {
789
1064
  return this.count("pagination") > 0;
790
1065
  }
791
- /** Whether the table puts up a table toolbar of its own. */
1066
+ /** Whether the table puts up a table toolbar of its own - also while it is
1067
+ grouped: the tag that names and removes the grouping needs a place. */
792
1068
  needsOwnToolbar() {
793
- return this.count("toolbar") > 0 ? !1 : this.count("search") > 0 || this.orderedColumns().some((t) => se(t.spec.filter) !== void 0);
1069
+ var t;
1070
+ return this.count("toolbar") > 0 ? !1 : this.count("search") > 0 || this.orderedColumns().some((n) => me(n.spec.filter) !== void 0) || (((t = this.hook) == null ? void 0 : t.publicSnapshot.grouping.length) ?? 0) > 0;
794
1071
  }
795
1072
  /* --- Row detail ------------------------------------------------------------------- */
796
1073
  registerDetail(t, n) {
@@ -827,78 +1104,83 @@ class ho {
827
1104
  this.actions.entries.delete(t) && this.structure++;
828
1105
  }
829
1106
  }
830
- const nt = /* @__PURE__ */ new WeakMap(), mo = (e, t) => {
831
- nt.set(e, t);
832
- }, po = (e) => typeof e == "function" || typeof e == "object" && e !== null ? nt.get(e) : void 0, H = (...e) => e.filter(Boolean).join(" ");
833
- function ot({
1107
+ function pr(e, t, n) {
1108
+ if (!e.lines) return { ...e, visible: e.filtered.slice(t, n) };
1109
+ const o = e.lines.slice(t, n);
1110
+ return { ...e, visibleLines: o, visible: Ze(o) };
1111
+ }
1112
+ const Bt = /* @__PURE__ */ new WeakMap(), mr = (e, t) => {
1113
+ Bt.set(e, t);
1114
+ }, wr = (e) => typeof e == "function" || typeof e == "object" && e !== null ? Bt.get(e) : void 0, G = (...e) => e.filter(Boolean).join(" ");
1115
+ function Pt({
834
1116
  entry: e,
835
1117
  registry: t,
836
1118
  hook: n,
837
1119
  anchor: o,
838
1120
  focus: r,
839
- open: i,
840
- setOpen: s,
841
- panelId: l
1121
+ open: s,
1122
+ setOpen: i,
1123
+ panelId: a
842
1124
  }) {
843
- const a = $(), u = te(), { id: d, label: h, format: _ } = e.spec, { values: g, absent: p } = V(() => Zn(n.admitted, e.read, u), [n.admitted, e, u]), b = se(e.spec.filter);
844
- if (!b) return null;
845
- const v = n.publicSnapshot, m = b.Input, y = Xn(b) ? { absentOccurs: p, format: _, kind: t.kindOf(e, n.rows) } : {}, O = () => {
846
- var N;
847
- s(!1), (N = (r ?? o).current) == null || N.focus();
1125
+ const c = U(), u = ue(), { id: h, label: d, format: m } = e.spec, { values: w, absent: k } = $(() => or(n.admitted, e.read, u), [n.admitted, e, u]), p = me(e.spec.filter);
1126
+ if (!p) return null;
1127
+ const b = n.publicSnapshot, g = p.Input, _ = er(p) ? { absentOccurs: k, format: m, kind: t.kindOf(e, n.rows) } : {}, C = () => {
1128
+ var S;
1129
+ i(!1), (S = (r ?? o).current) == null || S.focus();
848
1130
  };
849
- return /* @__PURE__ */ x(
850
- Ue,
1131
+ return /* @__PURE__ */ O(
1132
+ St,
851
1133
  {
852
- open: i,
853
- onOpenChange: s,
1134
+ open: s,
1135
+ onOpenChange: i,
854
1136
  anchorRef: o,
855
1137
  align: "end",
856
1138
  role: "dialog",
857
- ariaLabel: a.filterColumn(h),
858
- id: l,
1139
+ ariaLabel: c.filterColumn(d),
1140
+ id: a,
859
1141
  className: f.filterPanel,
860
1142
  children: [
861
- /* @__PURE__ */ c(
862
- m,
1143
+ /* @__PURE__ */ l(
1144
+ g,
863
1145
  {
864
- condition: v.filter[d] ?? null,
865
- setCondition: (N) => v.setFilter(d, N),
866
- values: g,
867
- column: { id: d, label: h },
868
- ...y
1146
+ condition: b.filter[h] ?? null,
1147
+ setCondition: (S) => b.setFilter(h, S),
1148
+ values: w,
1149
+ column: { id: h, label: d },
1150
+ ..._
869
1151
  }
870
1152
  ),
871
- /* @__PURE__ */ x("div", { className: f.filterFooter, children: [
872
- /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => v.setFilter(d, null), children: a.filterReset }),
873
- /* @__PURE__ */ c(G, { size: "sm", onClick: O, children: a.filterDone })
1153
+ /* @__PURE__ */ O("div", { className: f.filterFooter, children: [
1154
+ /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", onClick: () => b.setFilter(h, null), children: c.filterReset }),
1155
+ /* @__PURE__ */ l(ee, { size: "sm", onClick: C, children: c.filterDone })
874
1156
  ] })
875
1157
  ]
876
1158
  }
877
1159
  );
878
1160
  }
879
- function go({
1161
+ function br({
880
1162
  entry: e,
881
1163
  registry: t,
882
1164
  hook: n
883
1165
  }) {
884
- const o = $(), [r, i] = P(!1), s = oe(null), l = Z(), { id: a, label: u } = e.spec, d = a in n.publicSnapshot.filter;
885
- return /* @__PURE__ */ x(Q, { children: [
886
- /* @__PURE__ */ c(
1166
+ const o = U(), [r, s] = H(!1), i = re(null), a = se(), { id: c, label: u } = e.spec, h = c in n.publicSnapshot.filter;
1167
+ return /* @__PURE__ */ O(Q, { children: [
1168
+ /* @__PURE__ */ l(
887
1169
  "button",
888
1170
  {
889
- ref: s,
1171
+ ref: i,
890
1172
  type: "button",
891
- className: H(f.filterButton, d && f.filterActive),
1173
+ className: G(f.filterButton, h && f.filterActive),
892
1174
  "aria-label": o.filterColumn(u),
893
1175
  "aria-haspopup": "dialog",
894
1176
  "aria-expanded": r,
895
- "aria-controls": r ? l : void 0,
896
- onClick: () => i(!r),
897
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 14 14", width: "13", height: "13", "aria-hidden": "true", children: /* @__PURE__ */ c(
1177
+ "aria-controls": r ? a : void 0,
1178
+ onClick: () => s(!r),
1179
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 14 14", width: "13", height: "13", "aria-hidden": "true", children: /* @__PURE__ */ l(
898
1180
  "path",
899
1181
  {
900
1182
  d: "M1.8 2.6h10.4L8.3 7.5v3.4l-2.6 1.1V7.5L1.8 2.6z",
901
- fill: d ? "currentColor" : "none",
1183
+ fill: h ? "currentColor" : "none",
902
1184
  stroke: "currentColor",
903
1185
  strokeWidth: "1.4",
904
1186
  strokeLinecap: "round",
@@ -907,167 +1189,522 @@ function go({
907
1189
  ) })
908
1190
  }
909
1191
  ),
910
- /* @__PURE__ */ c(
911
- ot,
1192
+ /* @__PURE__ */ l(
1193
+ Pt,
912
1194
  {
913
1195
  entry: e,
914
1196
  registry: t,
915
1197
  hook: n,
916
- anchor: s,
1198
+ anchor: i,
917
1199
  open: r,
918
- setOpen: i,
919
- panelId: l
1200
+ setOpen: s,
1201
+ panelId: a
920
1202
  }
921
1203
  )
922
1204
  ] });
923
1205
  }
924
- function bo({ registry: e, hook: t }) {
925
- const n = $(), o = te(), r = Object.entries(t.publicSnapshot.filter).flatMap(([i, s]) => {
926
- const l = e.columnById(i), a = l ? se(l.spec.filter) : void 0;
927
- if (!l || !a) return [];
928
- const u = { formats: o, wording: n, format: l.spec.format, kind: e.kindOf(l, t.rows) };
929
- return [{ entry: l, text: Qn(a, s, u) }];
1206
+ function kr({ registry: e, hook: t }) {
1207
+ const n = U(), o = ue(), r = Object.entries(t.publicSnapshot.filter).flatMap(([s, i]) => {
1208
+ const a = e.columnById(s), c = a ? me(a.spec.filter) : void 0;
1209
+ if (!a || !c) return [];
1210
+ const u = { formats: o, wording: n, format: a.spec.format, kind: e.kindOf(a, t.rows) };
1211
+ return [{ entry: a, text: nr(c, i, u) }];
930
1212
  });
931
- return r.length === 0 ? null : /* @__PURE__ */ c(Ct, { "aria-label": n.conditions, className: f.conditions, children: r.map(({ entry: i, text: s }) => /* @__PURE__ */ c(wo, { entry: i, text: s, registry: e, hook: t }, i.spec.id)) });
1213
+ return r.length === 0 ? null : /* @__PURE__ */ l(Nt, { "aria-label": n.conditions, className: f.conditions, children: r.map(({ entry: s, text: i }) => /* @__PURE__ */ l(vr, { entry: s, text: i, registry: e, hook: t }, s.spec.id)) });
932
1214
  }
933
- function wo({
1215
+ function vr({
934
1216
  entry: e,
935
1217
  text: t,
936
1218
  registry: n,
937
1219
  hook: o
938
1220
  }) {
939
- const r = $(), [i, s] = P(!1), l = oe(null), a = oe(null), u = Z(), { id: d, label: h } = e.spec;
940
- return /* @__PURE__ */ x(Q, { children: [
941
- /* @__PURE__ */ c(
942
- St,
1221
+ const r = U(), [s, i] = H(!1), a = re(null), c = re(null), u = se(), { id: h, label: d } = e.spec;
1222
+ return /* @__PURE__ */ O(Q, { children: [
1223
+ /* @__PURE__ */ l(
1224
+ xt,
943
1225
  {
944
- ref: l,
1226
+ ref: a,
945
1227
  className: f.condition,
946
- onRemove: () => o.publicSnapshot.setFilter(d, null),
947
- removeLabel: r.removeConditionNamed(h, t),
948
- children: /* @__PURE__ */ x(
1228
+ onRemove: () => o.publicSnapshot.setFilter(h, null),
1229
+ removeLabel: r.removeConditionNamed(d, t),
1230
+ children: /* @__PURE__ */ O(
949
1231
  "button",
950
1232
  {
951
- ref: a,
1233
+ ref: c,
952
1234
  type: "button",
953
1235
  className: f.conditionButton,
954
- "aria-label": r.editConditionNamed(h, t),
1236
+ "aria-label": r.editConditionNamed(d, t),
955
1237
  "aria-haspopup": "dialog",
956
- "aria-expanded": i,
957
- "aria-controls": i ? u : void 0,
958
- onClick: () => s(!i),
1238
+ "aria-expanded": s,
1239
+ "aria-controls": s ? u : void 0,
1240
+ onClick: () => i(!s),
959
1241
  children: [
960
- /* @__PURE__ */ c("span", { className: f.filterLabel, children: h }),
961
- /* @__PURE__ */ c("span", { className: f.filterValue, children: t })
1242
+ /* @__PURE__ */ l("span", { className: f.filterLabel, children: d }),
1243
+ /* @__PURE__ */ l("span", { className: f.filterValue, children: t })
962
1244
  ]
963
1245
  }
964
1246
  )
965
1247
  }
966
1248
  ),
967
- /* @__PURE__ */ c(
968
- ot,
1249
+ /* @__PURE__ */ l(
1250
+ Pt,
969
1251
  {
970
1252
  entry: e,
971
1253
  registry: n,
972
1254
  hook: o,
973
- anchor: l,
974
- focus: a,
975
- open: i,
976
- setOpen: s,
1255
+ anchor: a,
1256
+ focus: c,
1257
+ open: s,
1258
+ setOpen: i,
977
1259
  panelId: u
978
1260
  }
979
1261
  )
980
1262
  ] });
981
1263
  }
982
- const Be = ";", _o = `\r
983
- `, vo = "\uFEFF", ko = (e) => String(e).replace(".", ","), rt = (e) => /[";\r\n]/.test(e) ? `"${e.replace(/"/g, '""')}"` : e, yo = (e, t) => {
1264
+ const ft = ";", _r = `\r
1265
+ `, yr = "\uFEFF", Cr = (e) => String(e).replace(".", ","), Gt = (e) => /[";\r\n]/.test(e) ? `"${e.replace(/"/g, '""')}"` : e, Sr = (e, t) => {
984
1266
  var o;
985
1267
  const n = (o = t.value) == null ? void 0 : o.call(t, e);
986
- return n == null ? "" : rt(typeof n == "number" ? ko(n) : String(n));
1268
+ return n == null ? "" : Gt(typeof n == "number" ? Cr(n) : String(n));
987
1269
  };
988
- function Co(e, t) {
989
- const n = t.map((r) => rt(r.label ?? r.id)).join(Be), o = e.map((r) => t.map((i) => yo(r, i)).join(Be));
990
- return vo + [n, ...o].join(_o);
1270
+ function Nr(e, t) {
1271
+ const n = t.map((r) => Gt(r.label ?? r.id)).join(ft), o = e.map((r) => t.map((s) => Sr(r, s)).join(ft));
1272
+ return yr + [n, ...o].join(_r);
991
1273
  }
992
- function st(e) {
1274
+ function Et(e) {
993
1275
  const t = new Map(e.orderedColumns().map((o) => [o.spec.id, o])), n = e.projection().columns.map((o) => t.get(o.id)).filter((o) => o !== void 0);
994
1276
  return e.withStickyHeaderFirst(n.map((o) => ({ id: o.spec.id, e: o }))).map(({ e: o }) => o);
995
1277
  }
996
- function it(e) {
1278
+ function zt(e) {
997
1279
  e.setSearch("");
998
1280
  for (const t of Object.keys(e.filter)) e.setFilter(t, null);
999
1281
  }
1000
- function So(e) {
1282
+ function xr(e) {
1001
1283
  const t = e.hook;
1002
1284
  if (!t) return "";
1003
- const n = st(e).filter((o) => e.kindOf(o, t.rows) !== "other" || o.spec.ownExportValue).map(
1285
+ const n = Et(e).filter((o) => e.kindOf(o, t.rows) !== "other" || o.spec.ownExportValue).map(
1004
1286
  (o) => ({
1005
1287
  id: o.spec.id,
1006
1288
  label: o.spec.label,
1007
- value: (r) => Qe(o.read(r), o.spec.ownExportValue)
1289
+ value: (r) => Lt(o.read(r), o.spec.ownExportValue)
1008
1290
  })
1009
1291
  );
1010
- return Co(e.projection().filtered, n);
1292
+ return Nr(e.projection().filtered, n);
1011
1293
  }
1012
- function lt({
1294
+ const Ar = (e, t, n) => {
1295
+ var o;
1296
+ return ((o = e.groupingEntries(t.rows).find((r) => r.spec.id === n)) == null ? void 0 : o.spec.label) ?? n;
1297
+ };
1298
+ function Tr({ registry: e, hook: t }) {
1299
+ const n = U(), o = e.groupingEntries(t.rows);
1300
+ if (o.length === 0) return null;
1301
+ const { grouping: r, setGrouping: s } = t.publicSnapshot;
1302
+ return /* @__PURE__ */ O("section", { className: f.groupingChoice, "aria-label": n.grouping, children: [
1303
+ /* @__PURE__ */ l("h3", { className: f.groupingHeading, children: n.grouping }),
1304
+ /* @__PURE__ */ l("div", { className: f.groupingOptions, children: o.map((i) => {
1305
+ const { id: a, label: c } = i.spec, u = r.indexOf(a), h = u !== -1;
1306
+ return /* @__PURE__ */ O(
1307
+ "button",
1308
+ {
1309
+ type: "button",
1310
+ className: f.groupingOption,
1311
+ "aria-label": n.groupBy(c),
1312
+ "aria-pressed": h,
1313
+ disabled: !h && r.length >= Qe,
1314
+ onClick: () => s(h ? r.filter((d) => d !== a) : [...r, a]),
1315
+ children: [
1316
+ h && /* @__PURE__ */ l("span", { className: f.groupingLevel, "aria-hidden": "true", children: u + 1 }),
1317
+ c
1318
+ ]
1319
+ },
1320
+ a
1321
+ );
1322
+ }) })
1323
+ ] });
1324
+ }
1325
+ function Fr({ registry: e, hook: t }) {
1326
+ const n = U(), o = t.publicSnapshot, { grouping: r } = o;
1327
+ if (r.length === 0) return null;
1328
+ const s = r.map((i) => Ar(e, t, i));
1329
+ return (
1330
+ /* In a tag group, as the conditions stand: the tag is one stop, its button
1331
+ the thing one tabs to, and the ring stands on the tag. */
1332
+ /* @__PURE__ */ l(Nt, { "aria-label": n.groupedBy, className: f.groupingTag, children: /* @__PURE__ */ l(xt, { onRemove: () => o.setGrouping([]), removeLabel: n.removeGrouping, children: /* @__PURE__ */ O(
1333
+ At,
1334
+ {
1335
+ trigger: /* @__PURE__ */ O("button", { type: "button", className: G(f.conditionButton, f.groupingTrigger), children: [
1336
+ /* @__PURE__ */ l("span", { className: f.groupingPrefix, children: n.groupedBy }),
1337
+ s.map((i, a) => /* @__PURE__ */ O("span", { className: f.groupingPath, children: [
1338
+ a > 0 && /* @__PURE__ */ l("span", { className: f.groupingSeparator, "aria-hidden": "true", children: "›" }),
1339
+ i
1340
+ ] }, r[a]))
1341
+ ] }),
1342
+ children: [
1343
+ r.map((i, a) => /* @__PURE__ */ l(Fe, { onSelect: () => o.setGrouping(r.filter((c) => c !== i)), children: n.removeGroupingLevel(s[a]) }, i)),
1344
+ /* @__PURE__ */ l(en, {}),
1345
+ /* @__PURE__ */ l(Fe, { onSelect: o.unfoldAll, children: n.unfoldAll }),
1346
+ /* @__PURE__ */ l(Fe, { onSelect: o.foldAll, children: n.foldAll })
1347
+ ]
1348
+ }
1349
+ ) }) })
1350
+ );
1351
+ }
1352
+ function jt({
1013
1353
  registry: e,
1014
1354
  className: t,
1015
1355
  children: n,
1016
1356
  own: o = !1
1017
1357
  }) {
1018
- const r = $(), i = te(), s = (e == null ? void 0 : e.hook) ?? null;
1019
- let l = null, a = null;
1020
- if (e && s) {
1021
- const u = s.publicSnapshot, d = u.search !== "" || Object.keys(u.filter).length > 0, h = o ? [] : u.filtered.filter((g) => u.selection.isSelected(s.rowKey(g))), _ = e.hasRowActions() ? e.actions.ordered().filter((g) => g.spec.bulk) : [];
1022
- l = /* @__PURE__ */ c(bo, { registry: e, hook: s }), a = /* @__PURE__ */ x("div", { className: f.toolbarGroup, children: [
1023
- /* @__PURE__ */ c("span", { role: "status", className: f.filteredCount, children: d ? r.filteredOfTotal(i.count(u.filtered.length), i.count(s.admitted.length)) : "" }),
1024
- d && /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => it(u), children: r.resetAll }),
1025
- h.length > 0 && /* @__PURE__ */ x(Q, { children: [
1026
- /* @__PURE__ */ c("span", { className: f.toolbarInfo, children: r.selectedCount(h.length, i.count(h.length)) }),
1027
- _.map(({ key: g, spec: p }) => /* @__PURE__ */ c(
1028
- G,
1358
+ const r = U(), s = ue(), i = (e == null ? void 0 : e.hook) ?? null;
1359
+ let a = null, c = null;
1360
+ if (e && i) {
1361
+ const u = i.publicSnapshot, h = u.search !== "" || Object.keys(u.filter).length > 0, d = o ? [] : u.filtered.filter((w) => u.selection.isSelected(i.rowKey(w))), m = e.hasRowActions() ? e.actions.ordered().filter((w) => w.spec.bulk) : [];
1362
+ a = /* @__PURE__ */ O(Q, { children: [
1363
+ /* @__PURE__ */ l(Fr, { registry: e, hook: i }),
1364
+ /* @__PURE__ */ l(kr, { registry: e, hook: i })
1365
+ ] }), c = /* @__PURE__ */ O("div", { className: f.toolbarGroup, children: [
1366
+ /* @__PURE__ */ l("span", { role: "status", className: f.filteredCount, children: h ? r.filteredOfTotal(s.count(u.filtered.length), s.count(i.admitted.length)) : "" }),
1367
+ h && /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", onClick: () => zt(u), children: r.resetAll }),
1368
+ d.length > 0 && /* @__PURE__ */ O(Q, { children: [
1369
+ /* @__PURE__ */ l("span", { className: f.toolbarInfo, children: r.selectedCount(d.length, s.count(d.length)) }),
1370
+ m.map(({ key: w, spec: k }) => /* @__PURE__ */ l(
1371
+ ee,
1029
1372
  {
1030
1373
  size: "sm",
1031
- variant: p.tone === "danger" ? "danger" : "secondary",
1032
- onClick: () => p.onSelect(h),
1033
- children: p.label
1374
+ variant: k.tone === "danger" ? "danger" : "secondary",
1375
+ onClick: () => k.onSelect(d),
1376
+ children: k.label
1034
1377
  },
1035
- g
1378
+ w
1036
1379
  ))
1037
1380
  ] })
1038
1381
  ] });
1039
1382
  }
1040
- return /* @__PURE__ */ x("div", { className: H(f.toolbar, t), children: [
1041
- /* @__PURE__ */ x("div", { className: f.toolbarGroup, children: [
1383
+ return /* @__PURE__ */ O("div", { className: G(f.toolbar, t), children: [
1384
+ /* @__PURE__ */ O("div", { className: f.toolbarGroup, children: [
1042
1385
  n,
1043
- l
1386
+ a
1044
1387
  ] }),
1045
- a
1388
+ c
1046
1389
  ] });
1047
1390
  }
1048
- const Ae = Ge(null), No = () => () => {
1049
- }, $e = () => 0;
1050
- function ue(e) {
1391
+ const $e = yt(null), Or = () => () => {
1392
+ }, ht = () => 0;
1393
+ function xe(e) {
1051
1394
  var r;
1052
- const t = xe(Ae), n = e ? po(e.Table) ?? null : (t == null ? void 0 : t.registry) ?? null;
1053
- pe(
1054
- n ? n.subscribe : No,
1055
- n ? n.bodyVersion : $e,
1056
- n ? n.bodyVersion : $e
1395
+ const t = Ue($e), n = e ? wr(e.Table) ?? null : (t == null ? void 0 : t.registry) ?? null;
1396
+ Le(
1397
+ n ? n.subscribe : Or,
1398
+ n ? n.bodyVersion : ht,
1399
+ n ? n.bodyVersion : ht
1057
1400
  );
1058
1401
  const o = (r = n == null ? void 0 : n.hook) == null ? void 0 : r.publicSnapshot;
1059
1402
  return !n || !o ? null : { registry: n, snapshot: o, inside: !e && t !== null, footerTarget: e ? null : (t == null ? void 0 : t.footerTarget) ?? null };
1060
1403
  }
1061
- function Ao(e) {
1404
+ function Ht({ wording: e }) {
1405
+ return /* @__PURE__ */ O(Q, { children: [
1406
+ /* @__PURE__ */ l("span", { "aria-hidden": "true", className: f.absent, children: "—" }),
1407
+ /* @__PURE__ */ l(Re, { children: e.cellAbsentValue })
1408
+ ] });
1409
+ }
1410
+ const Lr = { sum: "Σ", avg: "⌀", min: "min", max: "max" }, Rr = (e, t) => ({
1411
+ sum: t.footerSum,
1412
+ avg: t.footerAverage,
1413
+ min: t.footerMinimum,
1414
+ max: t.footerMaximum,
1415
+ range: t.footerRange,
1416
+ count: t.footerCount,
1417
+ distinct: t.footerDistinct
1418
+ })[e] ?? t.footerAggregate;
1419
+ function Ke({
1420
+ entry: e,
1421
+ rows: t,
1422
+ formats: n,
1423
+ wording: o,
1424
+ signed: r = !1
1425
+ }) {
1426
+ const { aggregate: s, format: i, presentation: a } = e.spec;
1427
+ if (!s) return null;
1428
+ const c = typeof s == "function" ? "own" : s, u = Xe({ id: e.spec.id, read: e.read, aggregate: s }, t), h = (w) => _e(w, i, n, o);
1429
+ let d;
1430
+ if (Y(u)) d = /* @__PURE__ */ l(Ht, { wording: o });
1431
+ else if (c === "range" && i === "date" && Mr(u)) {
1432
+ const [w, k] = u;
1433
+ d = w.getTime() === k.getTime() ? n.date(w) : o.rangeFromTo(n.dateShort(w), n.dateShort(k));
1434
+ } else if (c === "count" || c === "distinct") d = n.count(u);
1435
+ else if (c === "range") {
1436
+ const [w, k] = u;
1437
+ d = h(w) === h(k) ? h(w) : o.rangeFromTo(h(w) ?? "", h(k) ?? "");
1438
+ } else c === "own" && a ? d = a(u, t[0]) : d = h(u);
1439
+ const m = Lr[c];
1440
+ return /* @__PURE__ */ O(Q, { children: [
1441
+ r && m && /* @__PURE__ */ l("span", { "aria-hidden": "true", className: f.footerKind, children: m }),
1442
+ r && /* @__PURE__ */ O(Re, { children: [
1443
+ Rr(c, o),
1444
+ " "
1445
+ ] }),
1446
+ d
1447
+ ] });
1448
+ }
1449
+ const Mr = ([e, t]) => e instanceof Date && t instanceof Date && e.getFullYear() === t.getFullYear();
1450
+ function $t(e, t) {
1451
+ const n = e.spec.aggregate;
1452
+ return n === "count" || n === "distinct" ? !0 : e.spec.rightAligned !== void 0 ? e.spec.rightAligned : Ft(t, e.read) === "number";
1453
+ }
1454
+ function Vr(e, t) {
1455
+ const n = /* @__PURE__ */ new Map();
1456
+ for (const [o, r] of t) {
1457
+ const s = e.get(o);
1458
+ s !== void 0 && Math.abs(s - r) >= 0.5 && n.set(o, s - r);
1459
+ }
1460
+ return n;
1461
+ }
1462
+ function Kt(e, t) {
1463
+ const n = getComputedStyle(e).getPropertyValue(t).trim(), o = Number.parseFloat(n);
1464
+ return Number.isFinite(o) ? n.endsWith("ms") ? o : o * 1e3 : 0;
1465
+ }
1466
+ const Dr = (e) => {
1467
+ const t = /* @__PURE__ */ new Map(), n = e.getBoundingClientRect().top;
1468
+ for (const o of Array.from(e.querySelectorAll("tbody > tr[data-motion]")))
1469
+ t.set(o.dataset.motion, o.getBoundingClientRect().top - n);
1470
+ return t;
1471
+ };
1472
+ function Ir(e, t) {
1473
+ const n = re(null);
1474
+ W(() => {
1475
+ const o = e.current;
1476
+ if (!o) return;
1477
+ const r = Dr(o), s = n.current;
1478
+ if (n.current = { trigger: t, positions: r }, !s || s.trigger === t) return;
1479
+ const i = Kt(o, "--u-duration-medium");
1480
+ if (i === 0 || typeof o.animate != "function") return;
1481
+ const a = getComputedStyle(o).getPropertyValue("--u-ease-out").trim() || "ease-out", c = Vr(s.positions, r);
1482
+ for (const u of Array.from(o.querySelectorAll("tbody > tr[data-motion]"))) {
1483
+ const h = u.dataset.motion, d = c.get(h);
1484
+ d !== void 0 ? u.animate([{ transform: `translateY(${d}px)` }, { transform: "none" }], { duration: i, easing: a }) : s.positions.has(h) || u.animate([{ opacity: 0, transform: "translateY(-4px)" }, { opacity: 1, transform: "none" }], { duration: i, easing: a });
1485
+ }
1486
+ });
1487
+ }
1488
+ function Br(e, t, n) {
1489
+ const o = re(t);
1490
+ W(() => {
1491
+ const r = e.current, s = o.current;
1492
+ if (o.current = t, !r || s === t || typeof r.animate != "function") return;
1493
+ const i = Kt(r, "--u-duration-medium");
1494
+ if (i === 0) return;
1495
+ const a = performance.now();
1496
+ let c = requestAnimationFrame(function u(h) {
1497
+ const d = Math.min(1, (h - a) / i), m = 1 - (1 - d) ** 3;
1498
+ r.textContent = n(Math.round(s + (t - s) * m)), d < 1 && (c = requestAnimationFrame(u));
1499
+ });
1500
+ return () => {
1501
+ cancelAnimationFrame(c), r.textContent = n(t);
1502
+ };
1503
+ }, [e, t, n]);
1504
+ }
1505
+ function Ve(e, t, n, o) {
1506
+ if (t === void 0) return o.groupNoValue;
1507
+ const r = e == null ? void 0 : e.spec;
1508
+ if (r != null && r.group && t instanceof Date) return pn(r.group, t, n, o);
1509
+ const s = r != null && r.ownGroupValue || r == null ? void 0 : r.format;
1510
+ return _e(t, s, n, o) ?? String(t);
1511
+ }
1512
+ function We({ entry: e, group: t, formats: n, wording: o }) {
1513
+ const r = e == null ? void 0 : e.spec;
1514
+ return t.value !== void 0 && (r != null && r.presentation) && !r.ownGroupValue && !r.group ? /* @__PURE__ */ l(Q, { children: r.presentation(t.value, t.rows[0]) }) : /* @__PURE__ */ l(Q, { children: Ve(e, t.value, n, o) });
1515
+ }
1516
+ function qe({
1517
+ group: e,
1518
+ parent: t,
1519
+ entry: n,
1520
+ open: o,
1521
+ hook: r,
1522
+ formats: s,
1523
+ wording: i
1524
+ }) {
1525
+ const a = Ve(n, e.value, s, i), c = s.count(e.rows.length), u = () => r.publicSnapshot.toggleFold(e.path), h = (d) => {
1526
+ if (d.altKey && (d.key === "ArrowLeft" || d.key === "ArrowRight")) {
1527
+ d.preventDefault(), gt(e, d.key === "ArrowLeft", r);
1528
+ return;
1529
+ }
1530
+ if (d.key === "ArrowRight" && !o)
1531
+ d.preventDefault(), u();
1532
+ else if (d.key === "ArrowLeft") {
1533
+ if (d.preventDefault(), o) u();
1534
+ else if (t) {
1535
+ const m = d.currentTarget.closest("table"), w = Array.from((m == null ? void 0 : m.querySelectorAll("[data-fold-path]")) ?? []).find(
1536
+ (k) => k.dataset.foldPath === t.path
1537
+ );
1538
+ w == null || w.focus();
1539
+ }
1540
+ }
1541
+ };
1542
+ return /* @__PURE__ */ l(
1543
+ "button",
1544
+ {
1545
+ type: "button",
1546
+ className: G(f.fold, !o && f.foldClosed),
1547
+ "data-fold-path": e.path,
1548
+ "aria-expanded": o,
1549
+ "aria-label": o ? i.foldGroup(a, c) : i.unfoldGroup(a, c),
1550
+ onKeyDown: h,
1551
+ onClick: (d) => {
1552
+ if (!d.altKey) return u();
1553
+ gt(e, o, r);
1554
+ },
1555
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 12 12", width: "12", height: "12", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M3 4.5 6 7.5 9 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1556
+ }
1557
+ );
1558
+ }
1559
+ function Pr({ value: e, formats: t }) {
1560
+ const n = re(null);
1561
+ return Br(n, e, t.count), /* @__PURE__ */ l("span", { ref: n, className: f.groupCount, children: t.count(e) });
1562
+ }
1563
+ function Ye({ group: e, entry: t, hook: n, formats: o, wording: r }) {
1564
+ const { selection: s } = n.publicSnapshot, i = e.rows.map(n.rowKey), a = i.filter((u) => s.isSelected(u)).length, c = a === i.length;
1565
+ return /* @__PURE__ */ l(
1566
+ Se,
1567
+ {
1568
+ "aria-label": r.selectGroup(Ve(t, e.value, o, r)),
1569
+ checked: c,
1570
+ indeterminate: a > 0 && !c,
1571
+ onChange: () => {
1572
+ for (const u of i) s.isSelected(u) === c && s.toggle(u);
1573
+ }
1574
+ }
1575
+ );
1576
+ }
1577
+ function gt(e, t, n) {
1578
+ const o = n.publicSnapshot, r = [], s = (i) => {
1579
+ for (const a of i)
1580
+ a.level === e.level ? r.push(a) : s(a.groups);
1581
+ };
1582
+ s(n.companion.groups ?? []);
1583
+ for (const i of r)
1584
+ o.folded.includes(i.path) !== t && o.toggleFold(i.path);
1585
+ }
1586
+ function Gr({
1587
+ line: e,
1588
+ entry: t,
1589
+ selectable: n,
1590
+ hook: o,
1591
+ formats: r,
1592
+ wording: s
1593
+ }) {
1594
+ const i = e.span;
1595
+ return /* @__PURE__ */ l("td", { className: G(f.td, f.spanCell), children: e.first && /* @__PURE__ */ O("span", { className: f.spanValue, children: [
1596
+ n && /* @__PURE__ */ l("span", { className: f.spanSelect, children: /* @__PURE__ */ l(Ye, { group: i, entry: t, hook: o, formats: r, wording: s }) }),
1597
+ /* @__PURE__ */ l(qe, { group: i, parent: e.parents.at(-1), entry: t, open: !0, hook: o, formats: r, wording: s }),
1598
+ /* @__PURE__ */ O("span", { className: f.spanText, title: Ve(t, i.value, r, s), children: [
1599
+ /* @__PURE__ */ l(We, { entry: t, group: i, formats: r, wording: s }),
1600
+ e.continued && /* @__PURE__ */ l("span", { className: f.continued, children: s.groupContinued })
1601
+ ] }),
1602
+ /* @__PURE__ */ l("span", { className: f.groupCount, children: r.count(i.rows.length) })
1603
+ ] }) });
1604
+ }
1605
+ function pt({
1606
+ line: e,
1607
+ index: t,
1608
+ absolute: n,
1609
+ spanEntry: o,
1610
+ levelEntry: r,
1611
+ columns: s,
1612
+ controlColumns: i,
1613
+ selectable: a,
1614
+ hasActions: c,
1615
+ total: u,
1616
+ siblings: h,
1617
+ depth: d,
1618
+ hook: m,
1619
+ formats: w,
1620
+ wording: k
1621
+ }) {
1622
+ const { group: p } = e, b = e.kind === "header", g = b && !m.publicSnapshot.folded.includes(p.path), _ = s.findIndex((v) => v.spec.aggregate !== void 0), C = _ === -1 ? s.length : _, S = s.slice(C), I = s.find((v) => v.spec.aggregate === "sum" && v.spec.share !== !1), x = n !== void 0, A = /* @__PURE__ */ O("span", { className: f.groupLabel, children: [
1623
+ /* @__PURE__ */ l(qe, { group: p, parent: e.parents.at(-1), entry: r, open: g, hook: m, formats: w, wording: k }),
1624
+ /* @__PURE__ */ l("span", { className: f.groupValue, children: /* @__PURE__ */ l(We, { entry: r, group: p, formats: w, wording: k }) }),
1625
+ /* @__PURE__ */ l(Pr, { value: p.rows.length, formats: w }),
1626
+ b && e.continued && /* @__PURE__ */ l("span", { className: f.continued, children: k.groupContinued })
1627
+ ] });
1628
+ return /* @__PURE__ */ O(
1629
+ "tr",
1630
+ {
1631
+ className: G(b ? f.groupHeader : f.groupFolded, x && f.virtualRow),
1632
+ "data-line": e.kind,
1633
+ "data-level": p.level,
1634
+ "data-motion": n !== void 0 || !(b && e.continued) ? `${e.kind}:${p.path}` : void 0,
1635
+ "data-continued": b && e.continued ? "" : void 0,
1636
+ "data-group-first": b ? void 0 : "",
1637
+ "data-group": p.path,
1638
+ "data-row": x ? n : void 0,
1639
+ "aria-rowindex": x ? n + 2 : void 0,
1640
+ "data-index": t,
1641
+ style: b ? { "--u-header-level": p.level } : void 0,
1642
+ "aria-level": b ? p.level + 1 : d,
1643
+ "aria-expanded": g,
1644
+ "aria-posinset": h.indexOf(p) + 1 || void 0,
1645
+ "aria-setsize": h.length || void 0,
1646
+ children: [
1647
+ Array.from({ length: i }, (v, F) => /* @__PURE__ */ l("td", { className: G(f.td, f.control), children: F === 0 && a && b && /* @__PURE__ */ l(Ye, { group: p, entry: r, hook: m, formats: w, wording: k }) }, `c${F}`)),
1648
+ b ? /* @__PURE__ */ l("td", { className: f.td, colSpan: (o ? 1 : 0) + C, style: { paddingLeft: `calc(var(--u-space-3) + ${p.level * 20}px)` }, children: A }) : /* @__PURE__ */ O(Q, { children: [
1649
+ /* @__PURE__ */ l("td", { className: G(f.td, f.spanCell), children: /* @__PURE__ */ O("span", { className: f.spanValue, children: [
1650
+ a && /* @__PURE__ */ l("span", { className: f.spanSelect, children: /* @__PURE__ */ l(Ye, { group: p, entry: o, hook: m, formats: w, wording: k }) }),
1651
+ /* @__PURE__ */ l(qe, { group: p, parent: e.parents.at(-1), entry: o, open: !1, hook: m, formats: w, wording: k }),
1652
+ /* @__PURE__ */ l("span", { className: f.spanText, children: /* @__PURE__ */ l(We, { entry: o, group: p, formats: w, wording: k }) }),
1653
+ /* @__PURE__ */ l("span", { className: f.groupCount, children: w.count(p.rows.length) })
1654
+ ] }) }),
1655
+ C > 0 && /* @__PURE__ */ l("td", { className: G(f.td, f.foldedCount), colSpan: C, children: k.entries(p.rows.length, w.count(p.rows.length)) })
1656
+ ] }),
1657
+ S.map((v) => /* @__PURE__ */ l(
1658
+ Er,
1659
+ {
1660
+ entry: v,
1661
+ group: p,
1662
+ share: b && v === I,
1663
+ total: u,
1664
+ formats: w,
1665
+ wording: k
1666
+ },
1667
+ v.key
1668
+ )),
1669
+ c && /* @__PURE__ */ l("td", { className: f.td })
1670
+ ]
1671
+ }
1672
+ );
1673
+ }
1674
+ function Er({
1675
+ entry: e,
1676
+ group: t,
1677
+ share: n,
1678
+ total: o,
1679
+ formats: r,
1680
+ wording: s
1681
+ }) {
1682
+ const { spec: i } = e;
1683
+ if (!i.aggregate) return /* @__PURE__ */ l("td", { className: f.td });
1684
+ let a = null;
1685
+ if (n && i.aggregate === "sum" && i.share !== !1) {
1686
+ const c = Xe({ id: i.id, read: e.read, aggregate: "sum" }, o), u = t.aggregates[i.id];
1687
+ if (typeof c == "number" && c > 0 && typeof u == "number" && u > 0) {
1688
+ const h = Math.min(1, u / c);
1689
+ a = /* @__PURE__ */ l("span", { className: f.shareBar, style: { width: `${Math.max(2, Math.round(h * 64))}px` }, "aria-hidden": "true" });
1690
+ }
1691
+ }
1692
+ return /* @__PURE__ */ l("td", { className: G(f.td, $t(e, t.rows) && f.numeric, f.aggregateCell), "data-aggregate": typeof i.aggregate == "function" ? "own" : i.aggregate, children: a ? /* @__PURE__ */ O("span", { className: f.shareHost, children: [
1693
+ /* @__PURE__ */ l(Ke, { entry: e, rows: t.rows, formats: r, wording: s }),
1694
+ a
1695
+ ] }) : /* @__PURE__ */ l(Ke, { entry: e, rows: t.rows, formats: r, wording: s }) });
1696
+ }
1697
+ function zr(e) {
1062
1698
  const t = typeof e.value == "string" ? e.value : void 0;
1063
1699
  let n = e.id ?? t;
1064
- return n === void 0 && (re(`without-id:${e.label}`, `The column "${e.label}" has a computed value but no id. Its label serves as the id.`), n = e.label), e.children !== void 0 && typeof e.children != "function" && re(`children:${n}`, `The children of the column "${n}" are not a function and are passed over.`), {
1700
+ return n === void 0 && (pe(`without-id:${e.label}`, `The column "${e.label}" has a computed value but no id. Its label serves as the id.`), n = e.label), e.footer !== void 0 && pe(`footer:${n}`, `The column "${n}" uses \`footer\`, which is called \`aggregate\` now. The old name goes with the next minor version.`), e.children !== void 0 && typeof e.children != "function" && pe(`children:${n}`, `The children of the column "${n}" are not a function and are passed over.`), {
1065
1701
  id: n,
1066
1702
  label: e.label,
1067
1703
  value: e.value,
1068
1704
  presentation: typeof e.children == "function" ? e.children : void 0,
1069
1705
  format: e.format,
1070
- footer: e.footer,
1706
+ aggregate: e.aggregate ?? e.footer,
1707
+ share: e.share,
1071
1708
  rowHeader: e.rowHeader === !0,
1072
1709
  rightAligned: e.numeric,
1073
1710
  width: e.width,
@@ -1076,217 +1713,321 @@ function Ao(e) {
1076
1713
  searchable: e.searchable,
1077
1714
  filter: e.filter,
1078
1715
  ownSortValue: e.sortValue,
1079
- ownExportValue: e.exportValue
1716
+ ownExportValue: e.exportValue,
1717
+ ownGroupValue: e.groupValue,
1718
+ group: e.group,
1719
+ groupable: e.groupable
1080
1720
  };
1081
1721
  }
1082
- function ct({ wording: e }) {
1083
- return /* @__PURE__ */ x(Q, { children: [
1084
- /* @__PURE__ */ c("span", { "aria-hidden": "true", className: f.absent, children: "—" }),
1085
- /* @__PURE__ */ c(be, { children: e.cellAbsentValue })
1086
- ] });
1087
- }
1088
- function xo(e, t, n, o, r) {
1722
+ function jr(e, t, n, o, r) {
1089
1723
  if (!t) return n.rowKey(e);
1090
- const i = t.read(e);
1091
- return U(i) ? r.cellAbsentValue : ae(i, t.spec.format, o, r) ?? n.rowKey(e);
1092
- }
1093
- const me = 34;
1094
- function To(e) {
1095
- function t(l) {
1096
- const a = Z(), u = xe(Ae), d = Ao(l);
1097
- return e.registerColumn(a, d), J(
1724
+ const s = t.read(e);
1725
+ return Y(s) ? r.cellAbsentValue : _e(s, t.spec.format, o, r) ?? n.rowKey(e);
1726
+ }
1727
+ const Oe = 34;
1728
+ function Hr(e) {
1729
+ function t(c) {
1730
+ const u = se(), h = Ue($e), d = zr(c);
1731
+ return e.registerColumn(u, d), W(
1098
1732
  () => () => {
1099
- e.removeColumn(a), e.commit();
1733
+ e.removeColumn(u), e.commit();
1100
1734
  },
1101
- [a]
1102
- ), J(() => {
1103
- e.ensureColumn(a, d), e.checkOrder(), e.commit();
1104
- }), Ye && u && u.registry !== e && re(
1735
+ [u]
1736
+ ), W(() => {
1737
+ e.ensureColumn(u, d), e.checkOrder(), e.commit();
1738
+ }), Mt && h && h.registry !== e && pe(
1105
1739
  `foreign:${d.id}`,
1106
1740
  `The column "${d.id}" comes from a different useTable call than the table it stands in. It reads the rows of its own hook.`
1107
- ), /* @__PURE__ */ c("span", { hidden: !0, "data-umriss-column": a });
1741
+ ), /* @__PURE__ */ l("span", { hidden: !0, "data-umriss-column": u });
1108
1742
  }
1109
- function n({ children: l }) {
1110
- const a = Z();
1111
- return e.registerDetail(a, l), J(
1743
+ function n({ children: c }) {
1744
+ const u = se();
1745
+ return e.registerDetail(u, c), W(
1112
1746
  () => () => {
1113
- e.removeDetail(a), e.commit();
1747
+ e.removeDetail(u), e.commit();
1114
1748
  },
1115
- [a]
1116
- ), J(() => {
1117
- e.detail || e.registerDetail(a, l), e.commit();
1749
+ [u]
1750
+ ), W(() => {
1751
+ e.detail || e.registerDetail(u, c), e.commit();
1118
1752
  }), null;
1119
1753
  }
1120
- function o({ children: l }) {
1121
- const a = Z();
1122
- return e.registerActionGroup(a), J(
1754
+ function o({ children: c }) {
1755
+ const u = se();
1756
+ return e.registerActionGroup(u), W(
1123
1757
  () => () => {
1124
- e.removeActionGroup(a), e.commit();
1758
+ e.removeActionGroup(u), e.commit();
1125
1759
  },
1126
- [a]
1127
- ), J(() => {
1128
- e.registerActionGroup(a), e.commit();
1129
- }), /* @__PURE__ */ c(Q, { children: l });
1130
- }
1131
- function r(l) {
1132
- const a = Z(), u = {
1133
- label: l.children,
1134
- bulk: l.bulk === !0,
1135
- tone: l.tone ?? "default",
1136
- onSelect: l.onSelect
1760
+ [u]
1761
+ ), W(() => {
1762
+ e.registerActionGroup(u), e.commit();
1763
+ }), /* @__PURE__ */ l(Q, { children: c });
1764
+ }
1765
+ function r(c) {
1766
+ const u = se(), h = {
1767
+ label: c.children,
1768
+ bulk: c.bulk === !0,
1769
+ tone: c.tone ?? "default",
1770
+ onSelect: c.onSelect
1137
1771
  };
1138
- return e.registerAction(a, u), J(
1772
+ return e.registerAction(u, h), W(
1139
1773
  () => () => {
1140
- e.removeAction(a), e.commit();
1774
+ e.removeAction(u), e.commit();
1141
1775
  },
1142
- [a]
1143
- ), J(() => {
1144
- e.ensureAction(a, u), e.checkOrder(), e.commit();
1145
- }), /* @__PURE__ */ c("span", { hidden: !0, "data-umriss-action": a });
1146
- }
1147
- function i(l) {
1148
- e.beginPass(), e.setStickyRowHeader(l.stickyRowHeader === !0);
1149
- const a = oe(null), [u, d] = P(null);
1150
- J(() => {
1151
- e.children = a.current, e.checkOrder(), e.commit();
1776
+ [u]
1777
+ ), W(() => {
1778
+ e.ensureAction(u, h), e.checkOrder(), e.commit();
1779
+ }), /* @__PURE__ */ l("span", { hidden: !0, "data-umriss-action": u });
1780
+ }
1781
+ function s(c) {
1782
+ const u = se(), h = typeof c.value == "string" ? c.value : void 0, m = {
1783
+ id: c.id ?? h ?? c.label,
1784
+ label: c.label,
1785
+ value: c.value,
1786
+ rowHeader: !1,
1787
+ resizable: !1,
1788
+ ownGroupValue: c.groupValue,
1789
+ group: c.group,
1790
+ groupable: !0
1791
+ };
1792
+ return e.registerGroupKey(u, m), W(
1793
+ () => () => {
1794
+ e.removeGroupKey(u), e.commit();
1795
+ },
1796
+ [u]
1797
+ ), W(() => {
1798
+ e.ensureGroupKey(u, m), e.checkOrder(), e.commit();
1799
+ }), /* @__PURE__ */ l("span", { hidden: !0, "data-umriss-groupkey": u });
1800
+ }
1801
+ function i(c) {
1802
+ e.beginPass(), e.setStickyRowHeader(c.stickyRowHeader === !0), e.setTableGroupable(c.groupable !== !1);
1803
+ const u = re(null), [h, d] = H(null);
1804
+ W(() => {
1805
+ e.children = u.current, e.checkOrder(), e.commit();
1152
1806
  });
1153
- const h = V(() => ({ registry: e, footerTarget: u }), [u]);
1154
- return /* @__PURE__ */ c(Ae.Provider, { value: h, children: /* @__PURE__ */ x("div", { className: H(f.frame, l.className), children: [
1155
- /* @__PURE__ */ c("div", { ref: a, className: f.children, children: l.children }),
1156
- /* @__PURE__ */ c(Oo, { registry: e }),
1157
- /* @__PURE__ */ c(Ro, { registry: e, props: l }),
1158
- /* @__PURE__ */ c("div", { ref: d, className: f.footerTarget })
1807
+ const m = $(() => ({ registry: e, footerTarget: h }), [h]);
1808
+ return /* @__PURE__ */ l($e.Provider, { value: m, children: /* @__PURE__ */ O("div", { className: G(f.frame, c.className), children: [
1809
+ /* @__PURE__ */ l("div", { ref: u, className: f.children, children: c.children }),
1810
+ /* @__PURE__ */ l($r, { registry: e }),
1811
+ /* @__PURE__ */ l(Kr, { registry: e, props: c }),
1812
+ /* @__PURE__ */ l("div", { ref: d, className: f.footerTarget })
1159
1813
  ] }) });
1160
1814
  }
1161
- const s = { Table: i, Column: t, RowDetail: n, RowActions: o, Action: r };
1162
- return mo(i, e), s;
1815
+ const a = { Table: i, Column: t, RowDetail: n, RowActions: o, Action: r, GroupBy: s };
1816
+ return mr(i, e), a;
1163
1817
  }
1164
- function Oo({ registry: e }) {
1165
- return pe(e.subscribe, e.bodyVersion, e.bodyVersion), !e.hook || !e.needsOwnToolbar() ? null : /* @__PURE__ */ c(lt, { registry: e, own: !0 });
1818
+ function $r({ registry: e }) {
1819
+ return Le(e.subscribe, e.bodyVersion, e.bodyVersion), !e.hook || !e.needsOwnToolbar() ? null : /* @__PURE__ */ l(jt, { registry: e, own: !0 });
1166
1820
  }
1167
- function Ro({ registry: e, props: t }) {
1821
+ function Kr({ registry: e, props: t }) {
1168
1822
  const {
1169
1823
  selectable: n = !1,
1170
1824
  stickyHeader: o = !1,
1171
1825
  stickyRowHeader: r = !1,
1172
- striped: i = !1,
1173
- density: s,
1174
- maxHeight: l,
1175
- empty: a,
1826
+ striped: s = !1,
1827
+ density: i,
1828
+ maxHeight: a,
1829
+ empty: c,
1176
1830
  loading: u = !1,
1177
- rowProps: d,
1178
- ariaLabel: h
1831
+ rowProps: h,
1832
+ ariaLabel: d
1179
1833
  } = t;
1180
- pe(e.subscribe, e.bodyVersion, e.bodyVersion);
1181
- const _ = $(), g = te(), p = qe(s, "regular"), b = Z(), v = e.hook;
1182
- if (!v) return null;
1183
- const m = v.publicSnapshot, y = e.projection(), O = e.rowHeader(), N = st(e), M = e.detail, w = e.hasRowActions() ? e.actions.ordered() : [], C = v.companion.virtual, I = (n ? 1 : 0) + (M ? 1 : 0), A = I + N.length + (w.length > 0 ? 1 : 0), S = I * me, T = (D) => r && D === O, L = y.visible, F = !u && N.some((D) => D.spec.footer), E = m.search !== "" || Object.keys(m.filter).length > 0, W = (D, K, ve) => /* @__PURE__ */ c(
1184
- Fo,
1834
+ Le(e.subscribe, e.bodyVersion, e.bodyVersion);
1835
+ const m = U(), w = ue(), k = Tt(i, "regular"), p = se(), b = re(null);
1836
+ W(() => {
1837
+ var j, M;
1838
+ const y = b.current;
1839
+ if (!y || !o) return;
1840
+ const R = ((j = y.tHead) == null ? void 0 : j.getBoundingClientRect().height) ?? 0, K = ((M = y.querySelector("tr[data-line='header']")) == null ? void 0 : M.getBoundingClientRect().height) ?? 0;
1841
+ y.style.setProperty("--u-table-head", `${R}px`), y.style.setProperty("--u-table-group-header", `${K}px`), y.parentElement && mt(y.parentElement);
1842
+ }), W(() => {
1843
+ const y = e.takeFocusBeforeFold(), R = b.current;
1844
+ if (!y || !R || y.table !== R || y.element.isConnected) return;
1845
+ const K = Array.from(R.querySelectorAll("[data-fold-path]")), j = JSON.parse(y.group);
1846
+ for (let M = j.length; M > 0; M--) {
1847
+ const J = JSON.stringify(j.slice(0, M)), Z = K.find((T) => T.dataset.foldPath === J);
1848
+ if (Z) return Z.focus();
1849
+ }
1850
+ });
1851
+ const g = e.hook && !e.hook.companion.virtual ? e.hook.publicSnapshot : null;
1852
+ Ir(b, g ? `${g.grouping.join("|")}#${g.folded.join("|")}` : "");
1853
+ const _ = e.hook;
1854
+ if (!_) return null;
1855
+ const C = _.publicSnapshot, S = e.projection(), I = e.rowHeader(), x = Et(e), A = e.detail, v = e.hasRowActions() ? e.actions.ordered() : [], F = _.companion.virtual, L = C.grouping, N = L.length > 0 ? S.visibleLines : void 0, V = N ? e.groupingEntries(_.rows) : [], z = (y) => V.find((R) => R.spec.id === y), P = N && L.length > 1 ? z(L.at(-1)) : void 0, q = N ? x.filter((y) => !L.includes(y.spec.id)) : x, ie = (n ? 1 : 0) + (A ? 1 : 0), ae = ie + (P ? 1 : 0) + q.length + (v.length > 0 ? 1 : 0), de = ie * Oe, fe = (y) => r && y === I, we = S.visible, be = !u && q.some((y) => y.spec.aggregate), ye = C.search !== "" || Object.keys(C.filter).length > 0, le = (y, R, K, j) => /* @__PURE__ */ l(
1856
+ Wr,
1185
1857
  {
1186
- row: D,
1187
- index: K,
1188
- absolute: C ? ve : void 0,
1858
+ row: y,
1859
+ index: R,
1860
+ absolute: F ? K : void 0,
1189
1861
  registry: e,
1190
- hook: v,
1191
- columns: N,
1192
- header: O,
1862
+ hook: _,
1863
+ columns: q,
1864
+ line: j,
1865
+ spanEntry: P,
1866
+ header: I,
1193
1867
  selectable: n,
1194
- actions: w,
1868
+ actions: v,
1195
1869
  stickyRowHeader: r,
1196
- rowHeaderLeft: S,
1197
- columnCount: A,
1198
- rowProps: d,
1199
- baseId: b,
1200
- formats: g,
1201
- wording: _
1870
+ rowHeaderLeft: de,
1871
+ columnCount: ae,
1872
+ rowProps: h,
1873
+ baseId: p,
1874
+ formats: w,
1875
+ wording: m
1202
1876
  },
1203
- v.rowKey(D)
1877
+ _.rowKey(y)
1204
1878
  );
1205
- let q;
1206
- return u ? q = /* @__PURE__ */ c("tbody", { children: /* @__PURE__ */ c(Po, { columns: A }) }) : y.filtered.length === 0 ? q = /* @__PURE__ */ c("tbody", { children: /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c("td", { colSpan: A, className: f.emptyCell, children: /* @__PURE__ */ c("div", { className: f.empty, children: v.admitted.length > 0 && E ? /* @__PURE__ */ x(Q, { children: [
1207
- /* @__PURE__ */ c("p", { className: f.emptyTitle, children: _.nothingMatchesFilters }),
1208
- /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => it(m), children: _.resetAll })
1209
- ] }) : a ?? /* @__PURE__ */ c("p", { className: f.emptyTitle, children: _.noEntries }) }) }) }) }) : C ? q = /* @__PURE__ */ c(Mo, { virtual: C, colSpan: A, children: L.map((D, K) => W(D, K, C.from + K)) }) : q = /* @__PURE__ */ c("tbody", { children: L.map((D, K) => W(D, K, K)) }), /* @__PURE__ */ c(
1879
+ let te;
1880
+ if (u)
1881
+ te = /* @__PURE__ */ l("tbody", { children: /* @__PURE__ */ l(Xr, { columns: ae }) });
1882
+ else if (S.filtered.length === 0)
1883
+ te = /* @__PURE__ */ l("tbody", { children: /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: ae, className: f.emptyCell, children: /* @__PURE__ */ l("div", { className: f.empty, children: _.admitted.length > 0 && ye ? /* @__PURE__ */ O(Q, { children: [
1884
+ /* @__PURE__ */ l("p", { className: f.emptyTitle, children: m.nothingMatchesFilters }),
1885
+ /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", onClick: () => zt(C), children: m.resetAll })
1886
+ ] }) : c ?? /* @__PURE__ */ l("p", { className: f.emptyTitle, children: m.noEntries }) }) }) }) });
1887
+ else if (N) {
1888
+ const y = F ? Rt(N).map((M) => M.kind === "folded" || !M.continued ? M : { ...M, continued: !1 }) : N, R = y.length - N.length, K = F && F.from > 0 ? F.fillerBefore / F.from : 0, j = (M, J) => {
1889
+ var D, E;
1890
+ const Z = J - R, T = F ? F.from + Z : Z;
1891
+ return Z < 0 ? M.kind === "row" ? null : /* @__PURE__ */ l(
1892
+ pt,
1893
+ {
1894
+ line: M,
1895
+ index: J,
1896
+ absolute: void 0,
1897
+ spanEntry: P,
1898
+ levelEntry: z(L[M.group.level]),
1899
+ columns: q,
1900
+ controlColumns: ie,
1901
+ selectable: n,
1902
+ hasActions: v.length > 0,
1903
+ total: S.filtered,
1904
+ siblings: ((D = M.parents.at(-1)) == null ? void 0 : D.groups) ?? S.groups ?? [],
1905
+ depth: L.length,
1906
+ hook: _,
1907
+ formats: w,
1908
+ wording: m
1909
+ },
1910
+ `${M.kind}:${M.group.path}:repeated`
1911
+ ) : M.kind === "row" ? le(M.row, Z, T, M) : /* @__PURE__ */ l(
1912
+ pt,
1913
+ {
1914
+ line: M,
1915
+ index: Z,
1916
+ absolute: F ? T : void 0,
1917
+ spanEntry: P,
1918
+ levelEntry: z(L[M.group.level]),
1919
+ columns: q,
1920
+ controlColumns: ie,
1921
+ selectable: n,
1922
+ hasActions: v.length > 0,
1923
+ total: S.filtered,
1924
+ siblings: ((E = M.parents.at(-1)) == null ? void 0 : E.groups) ?? S.groups ?? [],
1925
+ depth: L.length,
1926
+ hook: _,
1927
+ formats: w,
1928
+ wording: m
1929
+ },
1930
+ `${M.kind}:${M.group.path}${M.kind === "header" && M.continued ? ":continued" : ""}`
1931
+ );
1932
+ };
1933
+ te = F ? /* @__PURE__ */ l(
1934
+ kt,
1935
+ {
1936
+ virtual: { ...F, fillerBefore: Math.max(0, F.fillerBefore - R * K) },
1937
+ colSpan: ae,
1938
+ children: y.map(j)
1939
+ }
1940
+ ) : /* @__PURE__ */ l("tbody", { children: N.map(j) });
1941
+ } else F ? te = /* @__PURE__ */ l(kt, { virtual: F, colSpan: ae, children: we.map((y, R) => le(y, R, F.from + R)) }) : te = /* @__PURE__ */ l("tbody", { children: we.map((y, R) => le(y, R, R)) });
1942
+ return /* @__PURE__ */ l(
1210
1943
  "div",
1211
1944
  {
1212
- ref: C == null ? void 0 : C.scrollRef,
1213
- onScroll: C == null ? void 0 : C.onScroll,
1945
+ ref: F == null ? void 0 : F.scrollRef,
1946
+ onScroll: (y) => {
1947
+ F == null || F.onScroll(), N && o && mt(y.currentTarget);
1948
+ },
1214
1949
  className: f.scroll,
1215
- style: l ? { maxHeight: l } : void 0,
1216
- children: /* @__PURE__ */ x(
1950
+ style: a ? { maxHeight: a } : void 0,
1951
+ children: /* @__PURE__ */ O(
1217
1952
  "table",
1218
1953
  {
1219
- "aria-label": h,
1220
- "aria-rowcount": C ? y.filtered.length + 1 + (F ? 1 : 0) : void 0,
1954
+ ref: b,
1955
+ role: N ? "treegrid" : void 0,
1956
+ "data-depth": N ? L.length : void 0,
1957
+ style: N ? { "--u-header-levels": L.length - 1 } : void 0,
1958
+ "aria-label": d,
1959
+ "aria-rowcount": F ? (S.lines ?? S.filtered).length + 1 + (be ? 1 : 0) : void 0,
1221
1960
  "aria-busy": u || void 0,
1222
- className: H(
1961
+ className: G(
1223
1962
  f.table,
1224
- p === "compact" && f.compact,
1963
+ k === "compact" && f.compact,
1225
1964
  o && f.sticky,
1226
- i && f.striped
1965
+ s && f.striped
1227
1966
  ),
1228
1967
  children: [
1229
- /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ x("tr", { "aria-rowindex": C ? 1 : void 0, children: [
1230
- n && /* @__PURE__ */ c(
1968
+ /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ O("tr", { "aria-rowindex": F ? 1 : void 0, children: [
1969
+ n && /* @__PURE__ */ l(
1231
1970
  "th",
1232
1971
  {
1233
1972
  scope: "col",
1234
- className: H(f.th, f.control, r && f.stickyCell),
1973
+ className: G(f.th, f.control, r && f.stickyCell),
1235
1974
  style: r ? { left: 0 } : void 0,
1236
- children: /* @__PURE__ */ c(
1237
- ge,
1975
+ children: /* @__PURE__ */ l(
1976
+ Se,
1238
1977
  {
1239
- "aria-label": _.selectAllRows,
1240
- checked: m.selection.allSelected,
1241
- indeterminate: m.selection.someSelected,
1242
- onChange: m.selection.toggleAll
1978
+ "aria-label": m.selectAllRows,
1979
+ checked: C.selection.allSelected,
1980
+ indeterminate: C.selection.someSelected,
1981
+ onChange: C.selection.toggleAll
1243
1982
  }
1244
1983
  )
1245
1984
  }
1246
1985
  ),
1247
- M && /* @__PURE__ */ c(
1986
+ A && /* @__PURE__ */ l(
1248
1987
  "td",
1249
1988
  {
1250
- className: H(f.th, f.control, r && f.stickyCell),
1251
- style: r ? { left: (n ? 1 : 0) * me } : void 0
1989
+ className: G(f.th, f.control, r && f.stickyCell),
1990
+ style: r ? { left: (n ? 1 : 0) * Oe } : void 0
1252
1991
  }
1253
1992
  ),
1254
- N.map((D) => /* @__PURE__ */ c(
1255
- Io,
1993
+ P && (e.columnById(P.spec.id) === P ? /* @__PURE__ */ l(wt, { entry: P, registry: e, hook: _, sticky: !1, left: de }) : /* @__PURE__ */ l("th", { scope: "col", className: f.th, children: P.spec.label })),
1994
+ q.map((y) => /* @__PURE__ */ l(
1995
+ wt,
1256
1996
  {
1257
- entry: D,
1997
+ entry: y,
1258
1998
  registry: e,
1259
- hook: v,
1260
- sticky: T(D),
1261
- left: S
1999
+ hook: _,
2000
+ sticky: fe(y),
2001
+ left: de
1262
2002
  },
1263
- D.key
2003
+ y.key
1264
2004
  )),
1265
- w.length > 0 && /* @__PURE__ */ c("th", { scope: "col", className: H(f.th, f.actionsCell), children: /* @__PURE__ */ c(be, { children: _.rowActions }) })
2005
+ v.length > 0 && /* @__PURE__ */ l("th", { scope: "col", className: G(f.th, f.actionsCell), children: /* @__PURE__ */ l(Re, { children: m.rowActions }) })
1266
2006
  ] }) }),
1267
- q,
1268
- F && /* @__PURE__ */ c("tfoot", { children: /* @__PURE__ */ x("tr", { "aria-rowindex": C ? y.filtered.length + 2 : void 0, children: [
1269
- Array.from({ length: I }, (D, K) => /* @__PURE__ */ c(
2007
+ te,
2008
+ be && /* @__PURE__ */ l("tfoot", { children: /* @__PURE__ */ O("tr", { "aria-rowindex": F ? (S.lines ?? S.filtered).length + 2 : void 0, children: [
2009
+ Array.from({ length: ie }, (y, R) => /* @__PURE__ */ l(
1270
2010
  "td",
1271
2011
  {
1272
- className: H(f.td, f.control, r && f.stickyCell),
1273
- style: r ? { left: K * me } : void 0
2012
+ className: G(f.td, f.control, r && f.stickyCell),
2013
+ style: r ? { left: R * Oe } : void 0
1274
2014
  },
1275
- K
2015
+ R
1276
2016
  )),
1277
- N.map((D) => /* @__PURE__ */ c(
1278
- zo,
2017
+ P && /* @__PURE__ */ l("td", { className: f.td }),
2018
+ q.map((y) => /* @__PURE__ */ l(
2019
+ Yr,
1279
2020
  {
1280
- entry: D,
1281
- rows: y.filtered,
1282
- formats: g,
1283
- wording: _,
1284
- sticky: T(D),
1285
- left: S
2021
+ entry: y,
2022
+ rows: S.filtered,
2023
+ formats: w,
2024
+ wording: m,
2025
+ sticky: fe(y),
2026
+ left: de
1286
2027
  },
1287
- D.key
2028
+ y.key
1288
2029
  )),
1289
- w.length > 0 && /* @__PURE__ */ c("td", { className: f.td })
2030
+ v.length > 0 && /* @__PURE__ */ l("td", { className: f.td })
1290
2031
  ] }) })
1291
2032
  ]
1292
2033
  }
@@ -1294,92 +2035,98 @@ function Ro({ registry: e, props: t }) {
1294
2035
  }
1295
2036
  );
1296
2037
  }
1297
- function Io({
2038
+ function mt(e) {
2039
+ for (const t of Array.from(e.querySelectorAll("tbody > tr[data-line='header']"))) {
2040
+ const n = t.cells[t.cells.length - 1], o = !!n && n.getBoundingClientRect().top > t.getBoundingClientRect().top + 0.5;
2041
+ t.toggleAttribute("data-stuck", o);
2042
+ }
2043
+ }
2044
+ function wt({
1298
2045
  entry: e,
1299
2046
  registry: t,
1300
2047
  hook: n,
1301
2048
  sticky: o,
1302
2049
  left: r
1303
2050
  }) {
1304
- const { spec: i } = e, s = n.publicSnapshot, l = t.kindOf(e, n.rows), a = Xe(l, i.rightAligned), u = t.isSortable(e, n.rows), d = i.id, h = s.sort.findIndex((w) => w.column === d), _ = h === -1 ? void 0 : s.sort[h].direction, g = s.sort.length > 1 && h !== -1 ? h + 1 : void 0, p = s.widths[d], b = 48, v = (w) => {
1305
- w.stopPropagation(), w.preventDefault();
1306
- const C = w.currentTarget, I = C.closest("th");
1307
- if (!I) return;
1308
- const A = w.clientX, S = I.getBoundingClientRect().width, T = w.pointerId;
1309
- C.setPointerCapture(T);
1310
- const L = (E) => {
1311
- E.pointerId === T && s.setWidth(d, Math.max(b, S + (E.clientX - A)));
1312
- }, F = (E) => {
1313
- E.pointerId === T && (C.removeEventListener("pointermove", L), C.removeEventListener("pointerup", F), C.removeEventListener("pointercancel", F), C.hasPointerCapture(T) && C.releasePointerCapture(T));
2051
+ const { spec: s } = e, i = n.publicSnapshot, a = t.kindOf(e, n.rows), c = Ot(a, s.rightAligned), u = t.isSortable(e, n.rows), h = s.id, d = i.sort.findIndex((x) => x.column === h), m = d === -1 ? void 0 : i.sort[d].direction, w = i.sort.length > 1 && d !== -1 ? d + 1 : void 0, k = i.widths[h], p = 48, b = (x) => {
2052
+ x.stopPropagation(), x.preventDefault();
2053
+ const A = x.currentTarget, v = A.closest("th");
2054
+ if (!v) return;
2055
+ const F = x.clientX, L = v.getBoundingClientRect().width, N = x.pointerId;
2056
+ A.setPointerCapture(N);
2057
+ const V = (P) => {
2058
+ P.pointerId === N && i.setWidth(h, Math.max(p, L + (P.clientX - F)));
2059
+ }, z = (P) => {
2060
+ P.pointerId === N && (A.removeEventListener("pointermove", V), A.removeEventListener("pointerup", z), A.removeEventListener("pointercancel", z), A.hasPointerCapture(N) && A.releasePointerCapture(N));
1314
2061
  };
1315
- C.addEventListener("pointermove", L), C.addEventListener("pointerup", F), C.addEventListener("pointercancel", F);
1316
- }, m = (w) => {
1317
- const C = w == null ? void 0 : w.parentElement, I = w == null ? void 0 : w.closest("table");
1318
- if (!w || !C || !I) return;
1319
- const A = Array.from(C.children).indexOf(w), S = C.children.length, T = { cell: w.style.width, table: I.style.width };
1320
- w.style.width = "", I.style.width = "auto";
1321
- let L = 0;
1322
- for (const F of Array.from(I.rows)) {
1323
- if (F.cells.length !== S) continue;
1324
- const E = F.cells[A];
1325
- E && (L = Math.max(L, E.scrollWidth));
2062
+ A.addEventListener("pointermove", V), A.addEventListener("pointerup", z), A.addEventListener("pointercancel", z);
2063
+ }, g = (x) => {
2064
+ const A = x == null ? void 0 : x.parentElement, v = x == null ? void 0 : x.closest("table");
2065
+ if (!x || !A || !v) return;
2066
+ const F = Array.from(A.children).indexOf(x), L = A.children.length, N = { cell: x.style.width, table: v.style.width };
2067
+ x.style.width = "", v.style.width = "auto";
2068
+ let V = 0;
2069
+ for (const z of Array.from(v.rows)) {
2070
+ if (z.cells.length !== L) continue;
2071
+ const P = z.cells[F];
2072
+ P && (V = Math.max(V, P.scrollWidth));
1326
2073
  }
1327
- w.style.width = T.cell, I.style.width = T.table, L > 0 && s.setWidth(d, Math.max(b, L + 1));
1328
- }, y = (w) => {
1329
- if (!i.resizable || !w.altKey) return;
1330
- const C = w.key === "ArrowRight", I = w.key === "ArrowLeft", A = w.key === "Home";
1331
- if (!C && !I && !A) return;
1332
- w.preventDefault();
1333
- const S = w.currentTarget;
1334
- if (A) {
1335
- m(S);
2074
+ x.style.width = N.cell, v.style.width = N.table, V > 0 && i.setWidth(h, Math.max(p, V + 1));
2075
+ }, _ = (x) => {
2076
+ if (!s.resizable || !x.altKey) return;
2077
+ const A = x.key === "ArrowRight", v = x.key === "ArrowLeft", F = x.key === "Home";
2078
+ if (!A && !v && !F) return;
2079
+ x.preventDefault();
2080
+ const L = x.currentTarget;
2081
+ if (F) {
2082
+ g(L);
1336
2083
  return;
1337
2084
  }
1338
- const T = S.getBoundingClientRect().width, L = w.shiftKey ? 32 : 8;
1339
- s.setWidth(d, Math.max(b, T + (C ? L : -L)));
1340
- }, O = u ? /* @__PURE__ */ x(
2085
+ const N = L.getBoundingClientRect().width, V = x.shiftKey ? 32 : 8;
2086
+ i.setWidth(h, Math.max(p, N + (A ? V : -V)));
2087
+ }, C = u ? /* @__PURE__ */ O(
1341
2088
  "button",
1342
2089
  {
1343
2090
  type: "button",
1344
2091
  className: f.sortButton,
1345
- onClick: (w) => s.toggleSort(d, w.shiftKey || w.metaKey),
2092
+ onClick: (x) => i.toggleSort(h, x.shiftKey || x.metaKey),
1346
2093
  children: [
1347
- /* @__PURE__ */ c("span", { children: i.label }),
1348
- g !== void 0 && /* @__PURE__ */ c("span", { className: f.sortRank, "aria-hidden": "true", children: g }),
1349
- /* @__PURE__ */ c("span", { className: H(f.sortIndicator, _ && f.sortActive), "aria-hidden": "true", children: _ ? /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", className: H(f.sortArrow, _ === "desc" && f.sortArrowDesc), children: /* @__PURE__ */ c("path", { d: "M2.2 6.2 5 3.4l2.8 2.8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ x("svg", { viewBox: "0 0 10 12", width: "10", height: "12", children: [
1350
- /* @__PURE__ */ c("path", { d: "M2.4 4.4 5 1.8l2.6 2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
1351
- /* @__PURE__ */ c("path", { d: "M2.4 7.6 5 10.2l2.6-2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2094
+ /* @__PURE__ */ l("span", { children: s.label }),
2095
+ w !== void 0 && /* @__PURE__ */ l("span", { className: f.sortRank, "aria-hidden": "true", children: w }),
2096
+ /* @__PURE__ */ l("span", { className: G(f.sortIndicator, m && f.sortActive), "aria-hidden": "true", children: m ? /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", className: G(f.sortArrow, m === "desc" && f.sortArrowDesc), children: /* @__PURE__ */ l("path", { d: "M2.2 6.2 5 3.4l2.8 2.8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ O("svg", { viewBox: "0 0 10 12", width: "10", height: "12", children: [
2097
+ /* @__PURE__ */ l("path", { d: "M2.4 4.4 5 1.8l2.6 2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
2098
+ /* @__PURE__ */ l("path", { d: "M2.4 7.6 5 10.2l2.6-2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1352
2099
  ] }) })
1353
2100
  ]
1354
2101
  }
1355
- ) : i.label, N = _ === "asc" ? "ascending" : _ === "desc" ? "descending" : "none", M = se(i.filter) !== void 0 && !(i.filter === "list" && l === "other");
1356
- return /* @__PURE__ */ x(
2102
+ ) : s.label, S = m === "asc" ? "ascending" : m === "desc" ? "descending" : "none", I = me(s.filter) !== void 0 && !(s.filter === "list" && a === "other");
2103
+ return /* @__PURE__ */ O(
1357
2104
  "th",
1358
2105
  {
1359
2106
  scope: "col",
1360
- "data-column": d,
1361
- "aria-sort": u ? N : void 0,
1362
- tabIndex: i.resizable && !u ? 0 : void 0,
1363
- onKeyDown: y,
1364
- className: H(f.th, a && f.numeric, o && f.stickyCell),
2107
+ "data-column": h,
2108
+ "aria-sort": u ? S : void 0,
2109
+ tabIndex: s.resizable && !u ? 0 : void 0,
2110
+ onKeyDown: _,
2111
+ className: G(f.th, c && f.numeric, o && f.stickyCell),
1365
2112
  style: {
1366
- ...p !== void 0 ? { width: p } : {},
2113
+ ...k !== void 0 ? { width: k } : {},
1367
2114
  ...o ? { left: r } : {}
1368
2115
  },
1369
2116
  children: [
1370
- M ? /* @__PURE__ */ x("span", { className: f.thFlex, children: [
1371
- O,
1372
- /* @__PURE__ */ c(go, { entry: e, registry: t, hook: n })
1373
- ] }) : O,
1374
- i.resizable && /* @__PURE__ */ c(
2117
+ I ? /* @__PURE__ */ O("span", { className: f.thFlex, children: [
2118
+ C,
2119
+ /* @__PURE__ */ l(br, { entry: e, registry: t, hook: n })
2120
+ ] }) : C,
2121
+ s.resizable && /* @__PURE__ */ l(
1375
2122
  "span",
1376
2123
  {
1377
2124
  role: "presentation",
1378
2125
  className: f.grip,
1379
- onPointerDown: v,
1380
- onClick: (w) => w.stopPropagation(),
1381
- onDoubleClick: (w) => {
1382
- w.stopPropagation(), m(w.currentTarget.closest("th"));
2126
+ onPointerDown: b,
2127
+ onClick: (x) => x.stopPropagation(),
2128
+ onDoubleClick: (x) => {
2129
+ x.stopPropagation(), g(x.currentTarget.closest("th"));
1383
2130
  }
1384
2131
  }
1385
2132
  )
@@ -1387,612 +2134,657 @@ function Io({
1387
2134
  }
1388
2135
  );
1389
2136
  }
1390
- function Fo({
2137
+ function Wr({
1391
2138
  row: e,
1392
2139
  index: t,
1393
2140
  absolute: n,
1394
2141
  registry: o,
1395
2142
  hook: r,
1396
- columns: i,
1397
- header: s,
1398
- selectable: l,
1399
- actions: a,
2143
+ columns: s,
2144
+ header: i,
2145
+ selectable: a,
2146
+ actions: c,
1400
2147
  stickyRowHeader: u,
1401
- rowHeaderLeft: d,
1402
- columnCount: h,
1403
- rowProps: _,
1404
- baseId: g,
1405
- formats: p,
1406
- wording: b
2148
+ rowHeaderLeft: h,
2149
+ columnCount: d,
2150
+ rowProps: m,
2151
+ baseId: w,
2152
+ formats: k,
2153
+ wording: p,
2154
+ line: b,
2155
+ spanEntry: g
1407
2156
  }) {
1408
- const v = xe(at), m = r.publicSnapshot, y = r.rowKey(e), O = xo(e, s, r, p, b), N = o.detail, M = N !== null && m.expanded.includes(y), w = `${g}-detail-${t}`, { className: C, ...I } = (_ == null ? void 0 : _(e)) ?? {}, A = n !== void 0;
1409
- return /* @__PURE__ */ x(Q, { children: [
1410
- /* @__PURE__ */ x(
2157
+ const _ = Ue(Wt), C = r.publicSnapshot, S = r.rowKey(e), I = jr(e, i, r, k, p), x = o.detail, A = x !== null && C.expanded.includes(S), v = `${w}-detail-${t}`, { className: F, ...L } = (m == null ? void 0 : m(e)) ?? {}, N = n !== void 0, V = b ? b.span ?? b.parents.at(-1) : void 0;
2158
+ return /* @__PURE__ */ O(Q, { children: [
2159
+ /* @__PURE__ */ O(
1411
2160
  "tr",
1412
2161
  {
1413
- ...I,
1414
- className: H(C, A && f.virtualRow),
1415
- "data-row": A ? n : void 0,
1416
- tabIndex: A ? n === v ? 0 : -1 : void 0,
1417
- "data-even": A && n % 2 === 1 ? "" : void 0,
1418
- "aria-rowindex": A ? n + 2 : void 0,
2162
+ ...L,
2163
+ className: G(F, N && f.virtualRow),
2164
+ "data-row": N ? n : void 0,
2165
+ "data-line": b ? "row" : void 0,
2166
+ "data-motion": S,
2167
+ "data-group-first": b != null && b.first ? "" : void 0,
2168
+ "data-group": V == null ? void 0 : V.path,
2169
+ "aria-level": b ? b.parents.length + 1 : void 0,
2170
+ "aria-posinset": V ? V.rows.indexOf(e) + 1 : void 0,
2171
+ "aria-setsize": V == null ? void 0 : V.rows.length,
2172
+ tabIndex: N ? n === _ ? 0 : -1 : void 0,
2173
+ "data-even": N && n % 2 === 1 ? "" : void 0,
2174
+ "aria-rowindex": N ? n + 2 : void 0,
1419
2175
  children: [
1420
- l && /* @__PURE__ */ c(
2176
+ a && /* @__PURE__ */ l(
1421
2177
  "td",
1422
2178
  {
1423
- className: H(f.td, f.control, u && f.stickyCell),
2179
+ className: G(f.td, f.control, u && f.stickyCell),
1424
2180
  style: u ? { left: 0 } : void 0,
1425
- children: /* @__PURE__ */ c(
1426
- ge,
2181
+ children: /* @__PURE__ */ l(
2182
+ Se,
1427
2183
  {
1428
- "aria-label": b.selectRow(O),
1429
- checked: m.selection.isSelected(y),
1430
- onChange: () => m.selection.toggle(y)
2184
+ "aria-label": p.selectRow(I),
2185
+ checked: C.selection.isSelected(S),
2186
+ onChange: () => C.selection.toggle(S)
1431
2187
  }
1432
2188
  )
1433
2189
  }
1434
2190
  ),
1435
- N && /* @__PURE__ */ c(
2191
+ x && /* @__PURE__ */ l(
1436
2192
  "td",
1437
2193
  {
1438
- className: H(f.td, f.control, u && f.stickyCell),
1439
- style: u ? { left: (l ? 1 : 0) * me } : void 0,
1440
- children: /* @__PURE__ */ c(
2194
+ className: G(f.td, f.control, u && f.stickyCell),
2195
+ style: u ? { left: (a ? 1 : 0) * Oe } : void 0,
2196
+ children: /* @__PURE__ */ l(
1441
2197
  "button",
1442
2198
  {
1443
2199
  type: "button",
1444
- "aria-expanded": M,
1445
- "aria-controls": M ? w : void 0,
1446
- "aria-label": M ? b.collapseRowNamed(O) : b.expandRowNamed(O),
1447
- className: H(f.expander, M && f.expanderOpen),
1448
- onClick: () => m.toggleRow(y),
1449
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M3.5 1.5 7 5l-3.5 3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2200
+ "aria-expanded": A,
2201
+ "aria-controls": A ? v : void 0,
2202
+ "aria-label": A ? p.collapseRowNamed(I) : p.expandRowNamed(I),
2203
+ className: G(f.expander, A && f.expanderOpen),
2204
+ onClick: () => C.toggleRow(S),
2205
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M3.5 1.5 7 5l-3.5 3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1450
2206
  }
1451
2207
  )
1452
2208
  }
1453
2209
  ),
1454
- i.map((S) => /* @__PURE__ */ c(
1455
- Lo,
2210
+ b && b.span && /* @__PURE__ */ l(Gr, { line: { ...b, span: b.span }, entry: g, selectable: a, hook: r, formats: k, wording: p }),
2211
+ s.map((z) => /* @__PURE__ */ l(
2212
+ qr,
1456
2213
  {
1457
- entry: S,
2214
+ entry: z,
1458
2215
  row: e,
1459
- kind: o.kindOf(S, r.rows),
1460
- sticky: u && S === s,
1461
- left: d,
1462
- formats: p,
1463
- wording: b
2216
+ kind: o.kindOf(z, r.rows),
2217
+ sticky: u && z === i,
2218
+ left: h,
2219
+ formats: k,
2220
+ wording: p
1464
2221
  },
1465
- S.key
2222
+ z.key
1466
2223
  )),
1467
- a.length > 0 && /* @__PURE__ */ c("td", { className: H(f.td, f.actionsCell), children: /* @__PURE__ */ c(Eo, { actions: a, row: e, name: O, wording: b }) })
2224
+ c.length > 0 && /* @__PURE__ */ l("td", { className: G(f.td, f.actionsCell), children: /* @__PURE__ */ l(Jr, { actions: c, row: e, name: I, wording: p }) })
1468
2225
  ]
1469
2226
  }
1470
2227
  ),
1471
- M && N && /* @__PURE__ */ c("tr", { id: w, className: f.detailRow, children: /* @__PURE__ */ c("td", { colSpan: h, className: f.detailCell, children: N.presentation(e) }) })
2228
+ A && x && /* @__PURE__ */ l("tr", { id: v, className: f.detailRow, "data-group": V == null ? void 0 : V.path, children: /* @__PURE__ */ l("td", { colSpan: d, className: f.detailCell, children: x.presentation(e) }) })
1472
2229
  ] });
1473
2230
  }
1474
- function Lo({
2231
+ function qr({
1475
2232
  entry: e,
1476
2233
  row: t,
1477
2234
  kind: n,
1478
2235
  sticky: o,
1479
2236
  left: r,
1480
- formats: i,
1481
- wording: s
2237
+ formats: s,
2238
+ wording: i
1482
2239
  }) {
1483
- const { spec: l } = e, a = e.read(t), u = Xe(n, l.rightAligned);
1484
- let d;
1485
- U(a) ? d = /* @__PURE__ */ c(ct, { wording: s }) : l.presentation ? d = l.presentation(a, t) : d = ae(a, l.format, i, s);
1486
- const h = l.rowHeader ? "th" : "td";
1487
- return /* @__PURE__ */ c(
1488
- h,
2240
+ const { spec: a } = e, c = e.read(t), u = Ot(n, a.rightAligned);
2241
+ let h;
2242
+ Y(c) ? h = /* @__PURE__ */ l(Ht, { wording: i }) : a.presentation ? h = a.presentation(c, t) : h = _e(c, a.format, s, i);
2243
+ const d = a.rowHeader ? "th" : "td";
2244
+ return /* @__PURE__ */ l(
2245
+ d,
1489
2246
  {
1490
- scope: l.rowHeader ? "row" : void 0,
1491
- className: H(f.td, u && f.numeric, l.rowHeader && f.rowHeader, o && f.stickyCell),
2247
+ scope: a.rowHeader ? "row" : void 0,
2248
+ className: G(f.td, u && f.numeric, a.rowHeader && f.rowHeader, o && f.stickyCell),
1492
2249
  style: o ? { left: r } : void 0,
1493
- children: d
2250
+ children: h
1494
2251
  }
1495
2252
  );
1496
2253
  }
1497
- function zo({
2254
+ function Yr({
1498
2255
  entry: e,
1499
2256
  rows: t,
1500
2257
  formats: n,
1501
2258
  wording: o,
1502
2259
  sticky: r,
1503
- left: i
2260
+ left: s
1504
2261
  }) {
1505
- const { footer: s, format: l } = e.spec, a = H(f.td, f.numeric, r && f.stickyCell), u = r ? { left: i } : void 0;
1506
- if (!s) return /* @__PURE__ */ c("td", { className: H(f.td, r && f.stickyCell), style: u });
1507
- const d = Ht(t, e.read, s);
1508
- return /* @__PURE__ */ x("td", { className: a, style: u, "data-footer": s, children: [
1509
- /* @__PURE__ */ c("span", { "aria-hidden": "true", className: f.footerKind, children: s === "sum" ? "Σ" : "⌀" }),
1510
- /* @__PURE__ */ x(be, { children: [
1511
- s === "sum" ? o.footerSum : o.footerAverage,
1512
- " "
1513
- ] }),
1514
- d === void 0 ? /* @__PURE__ */ c(ct, { wording: o }) : ae(d, l, n, o)
1515
- ] });
2262
+ const i = r ? { left: s } : void 0;
2263
+ if (!e.spec.aggregate) return /* @__PURE__ */ l("td", { className: G(f.td, r && f.stickyCell), style: i });
2264
+ const a = typeof e.spec.aggregate == "function" ? "own" : e.spec.aggregate;
2265
+ return /* @__PURE__ */ l("td", { className: G(f.td, $t(e, t) && f.numeric, r && f.stickyCell), style: i, "data-footer": a, children: /* @__PURE__ */ l(Ke, { entry: e, rows: t, formats: n, wording: o, signed: !0 }) });
1516
2266
  }
1517
- const jo = 2;
1518
- function Eo({
2267
+ const Ur = 2;
2268
+ function Jr({
1519
2269
  actions: e,
1520
2270
  row: t,
1521
2271
  name: n,
1522
2272
  wording: o
1523
2273
  }) {
1524
- const r = (i) => {
1525
- const s = i.onSelect;
1526
- s(i.bulk ? [t] : t);
2274
+ const r = (s) => {
2275
+ const i = s.onSelect;
2276
+ i(s.bulk ? [t] : t);
1527
2277
  };
1528
- return e.length <= jo ? /* @__PURE__ */ c("div", { className: f.actions, children: e.map(({ key: i, spec: s }) => /* @__PURE__ */ c(
1529
- G,
2278
+ return e.length <= Ur ? /* @__PURE__ */ l("div", { className: f.actions, children: e.map(({ key: s, spec: i }) => /* @__PURE__ */ l(
2279
+ ee,
1530
2280
  {
1531
2281
  size: "sm",
1532
2282
  variant: "ghost",
1533
- "aria-label": o.rowAction(s.label, n),
1534
- onClick: () => r(s),
1535
- children: s.label
2283
+ "aria-label": o.rowAction(i.label, n),
2284
+ onClick: () => r(i),
2285
+ children: i.label
1536
2286
  },
1537
- i
1538
- )) }) : /* @__PURE__ */ c("div", { className: f.actions, children: /* @__PURE__ */ c(
1539
- Nt,
2287
+ s
2288
+ )) }) : /* @__PURE__ */ l("div", { className: f.actions, children: /* @__PURE__ */ l(
2289
+ At,
1540
2290
  {
1541
2291
  align: "end",
1542
- trigger: /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", "aria-label": o.rowActionsMenu(n), children: "⋯" }),
1543
- children: e.map(({ key: i, spec: s }) => /* @__PURE__ */ c(At, { tone: s.tone, onSelect: () => r(s), children: s.label }, i))
2292
+ trigger: /* @__PURE__ */ l(ee, { size: "sm", variant: "ghost", "aria-label": o.rowActionsMenu(n), children: "⋯" }),
2293
+ children: e.map(({ key: s, spec: i }) => /* @__PURE__ */ l(Fe, { tone: i.tone, onSelect: () => r(i), children: i.label }, s))
1544
2294
  }
1545
2295
  ) });
1546
2296
  }
1547
- function Po({ columns: e, rows: t = 4 }) {
2297
+ function Xr({ columns: e, rows: t = 4 }) {
1548
2298
  const n = [72, 48, 60, 40, 56, 64];
1549
- return /* @__PURE__ */ c(Q, { children: Array.from({ length: t }, (o, r) => /* @__PURE__ */ c("tr", { "aria-hidden": "true", children: Array.from({ length: e }, (i, s) => /* @__PURE__ */ c("td", { className: f.td, children: /* @__PURE__ */ c("span", { className: f.skeleton, style: { width: `${n[(r + s) % n.length]}%` } }) }, s)) }, r)) });
2299
+ return /* @__PURE__ */ l(Q, { children: Array.from({ length: t }, (o, r) => /* @__PURE__ */ l("tr", { "aria-hidden": "true", children: Array.from({ length: e }, (s, i) => /* @__PURE__ */ l("td", { className: f.td, children: /* @__PURE__ */ l("span", { className: f.skeleton, style: { width: `${n[(r + i) % n.length]}%` } }) }, i)) }, r)) });
1550
2300
  }
1551
- const at = Ge(0);
1552
- function We({ height: e, colSpan: t }) {
1553
- return e <= 0 ? null : /* @__PURE__ */ c("tr", { "aria-hidden": "true", "data-filler": "", className: f.fillerRow, children: /* @__PURE__ */ c("td", { colSpan: t, style: { height: e } }) });
2301
+ const Wt = yt(0);
2302
+ function bt({ height: e, colSpan: t }) {
2303
+ return e <= 0 ? null : /* @__PURE__ */ l("tr", { "aria-hidden": "true", "data-filler": "", className: f.fillerRow, children: /* @__PURE__ */ l("td", { colSpan: t, style: { height: e } }) });
1554
2304
  }
1555
- function Mo({
2305
+ function kt({
1556
2306
  virtual: e,
1557
2307
  colSpan: t,
1558
2308
  children: n
1559
2309
  }) {
1560
- const { count: o, fillerBefore: r, fillerAfter: i, showRow: s } = e, l = oe(null), [a, u] = P(0), d = (g, p) => {
1561
- l.current = p, u(p), s(p), requestAnimationFrame(() => {
1562
- var b;
1563
- (b = g.querySelector(`[data-row="${p}"]`)) == null || b.focus();
2310
+ const { count: o, fillerBefore: r, fillerAfter: s, showRow: i } = e, a = re(null), [c, u] = H(0), h = (w, k) => {
2311
+ a.current = k, u(k), i(k), requestAnimationFrame(() => {
2312
+ var p;
2313
+ (p = w.querySelector(`[data-row="${k}"]`)) == null || p.focus();
1564
2314
  });
1565
- }, h = a >= e.from && a < e.to ? a : e.from, _ = (g) => {
1566
- if (g.defaultPrevented || o === 0) return;
1567
- const p = g.target, b = p.closest("[data-row]");
1568
- if (b && p !== b) return;
1569
- const v = b ? Number(b.dataset.row) : l.current ?? -1;
1570
- let m = null;
1571
- g.key === "ArrowDown" ? m = Math.min(o - 1, v + 1) : g.key === "ArrowUp" ? m = Math.max(0, v - 1) : g.key === "Home" ? m = 0 : g.key === "End" && (m = o - 1), !(m === null || m === v) && (g.preventDefault(), d(g.currentTarget, m));
2315
+ }, d = c >= e.from && c < e.to ? c : e.from, m = (w) => {
2316
+ if (w.defaultPrevented || o === 0) return;
2317
+ const k = w.target, p = k.closest("[data-row]");
2318
+ if (p && k !== p) return;
2319
+ const b = p ? Number(p.dataset.row) : a.current ?? -1;
2320
+ let g = null;
2321
+ w.key === "ArrowDown" ? g = Math.min(o - 1, b + 1) : w.key === "ArrowUp" ? g = Math.max(0, b - 1) : w.key === "Home" ? g = 0 : w.key === "End" && (g = o - 1), !(g === null || g === b) && (w.preventDefault(), h(w.currentTarget, g));
1572
2322
  };
1573
- return /* @__PURE__ */ c(
2323
+ return /* @__PURE__ */ l(
1574
2324
  "tbody",
1575
2325
  {
1576
2326
  className: f.virtualBody,
1577
- onKeyDown: _,
1578
- onFocus: (g) => {
1579
- const p = g.target.closest("[data-row]");
1580
- p && u(Number(p.dataset.row));
2327
+ onKeyDown: m,
2328
+ onFocus: (w) => {
2329
+ const k = w.target.closest("[data-row]");
2330
+ k && u(Number(k.dataset.row));
1581
2331
  },
1582
- children: /* @__PURE__ */ x(at.Provider, { value: h, children: [
1583
- /* @__PURE__ */ c(We, { height: r, colSpan: t }),
2332
+ children: /* @__PURE__ */ O(Wt.Provider, { value: d, children: [
2333
+ /* @__PURE__ */ l(bt, { height: r, colSpan: t }),
1584
2334
  n,
1585
- /* @__PURE__ */ c(We, { height: i, colSpan: t })
2335
+ /* @__PURE__ */ l(bt, { height: s, colSpan: t })
1586
2336
  ] })
1587
2337
  }
1588
2338
  );
1589
2339
  }
1590
- const Do = "_verdict_a8pbv_6", Vo = "_glyph_a8pbv_13", Ho = "_value_a8pbv_23", Bo = "_excess_a8pbv_28", he = {
1591
- verdict: Do,
1592
- glyph: Vo,
1593
- value: Ho,
1594
- excess: Bo
1595
- }, Ke = (e, t, n) => t === "percent" ? n.percent(e) : t === "count" ? n.count(e) : n.number(e, typeof t == "object" ? t.decimals : void 0), $o = (e, t) => e === "alarm" ? t.verdictAlarm : e === "warning" ? t.verdictWarning : e === "unknown" ? t.verdictUnknown : t.verdictOk, Wo = {
2340
+ const Qr = "_verdict_yxa4g_6", Zr = "_glyph_yxa4g_13", es = "_value_yxa4g_23", ts = "_excess_yxa4g_28", Te = {
2341
+ verdict: Qr,
2342
+ glyph: Zr,
2343
+ value: es,
2344
+ excess: ts
2345
+ }, vt = (e, t, n) => t === "percent" ? n.percent(e) : t === "count" ? n.count(e) : n.number(e, typeof t == "object" ? t.decimals : void 0), ns = (e, t) => e === "alarm" ? t.verdictAlarm : e === "warning" ? t.verdictWarning : e === "unknown" ? t.verdictUnknown : t.verdictOk, os = {
1596
2346
  ok: "✓",
1597
2347
  unknown: "?",
1598
2348
  warning: "▲",
1599
2349
  alarm: "■"
1600
2350
  };
1601
- function Ko({ reading: e, format: t }) {
1602
- const n = te(), o = $(), { measured: r, assessment: i } = e, s = $o(i.verdict, o);
1603
- return /* @__PURE__ */ x("span", { className: he.verdict, "data-verdict": i.verdict, title: s, children: [
1604
- /* @__PURE__ */ c("span", { "aria-hidden": "true", className: he.glyph, children: Wo[i.verdict] }),
1605
- /* @__PURE__ */ c("span", { className: he.value, children: r === null ? o.statAbsentValue : Ke(r, t, n) }),
1606
- i.excess !== void 0 && /* @__PURE__ */ x("span", { className: he.excess, children: [
2351
+ function rs({ reading: e, format: t }) {
2352
+ const n = ue(), o = U(), { measured: r, assessment: s } = e, i = ns(s.verdict, o);
2353
+ return /* @__PURE__ */ O("span", { className: Te.verdict, "data-verdict": s.verdict, title: i, children: [
2354
+ /* @__PURE__ */ l("span", { "aria-hidden": "true", className: Te.glyph, children: os[s.verdict] }),
2355
+ /* @__PURE__ */ l("span", { className: Te.value, children: r === null ? o.statAbsentValue : vt(r, t, n) }),
2356
+ s.excess !== void 0 && /* @__PURE__ */ O("span", { className: Te.excess, children: [
1607
2357
  "+",
1608
- Ke(i.excess, t, n)
2358
+ vt(s.excess, t, n)
1609
2359
  ] }),
1610
- /* @__PURE__ */ c(be, { children: s })
2360
+ /* @__PURE__ */ l(Re, { children: i })
1611
2361
  ] });
1612
2362
  }
1613
- const Go = (e) => e.measured;
1614
- function Uo(e) {
1615
- return function({ id: n, value: o, label: r, limits: i, format: s, sortBy: l = "verdict", width: a, resizable: u }) {
1616
- const d = JSON.stringify(i), h = V(() => {
1617
- const g = JSON.parse(d);
2363
+ const ss = (e) => e.measured, is = (e) => e.reduce(
2364
+ (t, n) => !t || Ee(n.assessment.verdict) > Ee(t.assessment.verdict) ? n : t,
2365
+ void 0
2366
+ );
2367
+ function as(e) {
2368
+ return function({ id: n, value: o, label: r, limits: s, format: i, sortBy: a = "verdict", width: c, resizable: u, aggregate: h }) {
2369
+ const d = JSON.stringify(s), m = $(() => {
2370
+ const k = JSON.parse(d);
1618
2371
  return (p) => {
1619
2372
  const b = typeof o == "string" ? p == null ? void 0 : p[o] : o(p);
1620
2373
  return {
1621
2374
  measured: typeof b == "number" && Number.isFinite(b) ? b : null,
1622
- assessment: xt(b, g)
2375
+ assessment: tn(b, k)
1623
2376
  };
1624
2377
  };
1625
- }, [o, d]), _ = B(
1626
- (g) => l === "value" ? g.measured : Tt(g.assessment.verdict),
1627
- [l]
2378
+ }, [o, d]), w = X(
2379
+ (k) => a === "value" ? k.measured : Ee(k.assessment.verdict),
2380
+ [a]
1628
2381
  );
1629
- return /* @__PURE__ */ c(
2382
+ return /* @__PURE__ */ l(
1630
2383
  e,
1631
2384
  {
1632
2385
  id: n ?? (typeof o == "string" ? o : void 0),
1633
2386
  label: r,
1634
2387
  numeric: !0,
1635
- width: a,
2388
+ width: c,
1636
2389
  resizable: u,
1637
- value: h,
1638
- sortValue: _,
1639
- exportValue: Go,
1640
- children: (g) => /* @__PURE__ */ c(Ko, { reading: g, format: s })
2390
+ value: m,
2391
+ sortValue: w,
2392
+ exportValue: ss,
2393
+ aggregate: h === "worst" ? is : void 0,
2394
+ children: (k) => /* @__PURE__ */ l(rs, { reading: k, format: i })
1641
2395
  }
1642
2396
  );
1643
2397
  };
1644
2398
  }
1645
- const dt = (e) => re(
2399
+ const qt = (e) => pe(
1646
2400
  `condition-foreign:${e}`,
1647
2401
  `The condition for "${e}" is not of the kind of its filter and is passed over.`
1648
2402
  );
1649
- function ut(e, t, n) {
1650
- const o = e.columnById(t), r = o ? se(o.spec.filter) : void 0;
2403
+ function Yt(e, t, n) {
2404
+ const o = e.columnById(t), r = o ? me(o.spec.filter) : void 0;
1651
2405
  if (!r) return !1;
1652
- const i = et(r, n);
1653
- return i === "foreign" && dt(t), i === "effective";
2406
+ const s = Dt(r, n);
2407
+ return s === "foreign" && qt(t), s === "effective";
1654
2408
  }
1655
- function qo(e, t) {
2409
+ function ls(e, t) {
1656
2410
  if (e.length === 0) return;
1657
2411
  let n = -1, o = [];
1658
2412
  return (r) => {
1659
2413
  if (n !== t.structureVersion()) {
1660
2414
  n = t.structureVersion(), o = [];
1661
- for (const [i, s] of e) {
1662
- const l = t.columnById(i);
1663
- l && ut(t, i, s) && o.push({ entry: l, condition: s });
2415
+ for (const [s, i] of e) {
2416
+ const a = t.columnById(s);
2417
+ a && Yt(t, s, i) && o.push({ entry: a, condition: i });
1664
2418
  }
1665
2419
  }
1666
- return o.every(({ entry: i, condition: s }) => {
1667
- const l = se(i.spec.filter);
1668
- return !l || Jn(l, i.read(r), s);
2420
+ return o.every(({ entry: s, condition: i }) => {
2421
+ const a = me(s.spec.filter);
2422
+ return !a || tr(a, s.read(r), i);
1669
2423
  });
1670
2424
  };
1671
2425
  }
1672
- function Yo(e, t) {
1673
- const n = V(() => t ? e.filter((s) => t(s)) : e, [e, t]), [o, r] = P(() => ({ source: e, result: n }));
2426
+ function cs(e, t) {
2427
+ const n = $(() => t ? e.filter((i) => t(i)) : e, [e, t]), [o, r] = H(() => ({ source: e, result: n }));
1674
2428
  if (!t) return e;
1675
- const i = o.source === e && (o.result === n || o.result.length === n.length && o.result.every((s, l) => s === n[l]));
1676
- return i || r({ source: e, result: n }), i ? o.result : n;
2429
+ const s = o.source === e && (o.result === n || o.result.length === n.length && o.result.every((i, a) => i === n[a]));
2430
+ return s || r({ source: e, result: n }), s ? o.result : n;
1677
2431
  }
1678
- function Xo(e, t) {
1679
- var l, a, u, d, h, _;
2432
+ function us(e, t) {
2433
+ var a, c, u, h, d, m;
1680
2434
  if (t.size === 0) return e;
1681
- const n = (l = e.sort) == null ? void 0 : l.filter((g) => t.has(g.column)), o = (a = e.hidden) == null ? void 0 : a.filter((g) => t.has(g)), r = (u = e.order) == null ? void 0 : u.filter((g) => t.has(g)), i = e.widths ? Object.fromEntries(Object.entries(e.widths).filter(([g]) => t.has(g))) : void 0;
1682
- return (n == null ? void 0 : n.length) === ((d = e.sort) == null ? void 0 : d.length) && (o == null ? void 0 : o.length) === ((h = e.hidden) == null ? void 0 : h.length) && (r == null ? void 0 : r.length) === ((_ = e.order) == null ? void 0 : _.length) && Object.keys(i ?? {}).length === Object.keys(e.widths ?? {}).length ? e : {
2435
+ const n = (a = e.sort) == null ? void 0 : a.filter((w) => t.has(w.column)), o = (c = e.hidden) == null ? void 0 : c.filter((w) => t.has(w)), r = (u = e.order) == null ? void 0 : u.filter((w) => t.has(w)), s = e.widths ? Object.fromEntries(Object.entries(e.widths).filter(([w]) => t.has(w))) : void 0;
2436
+ return (n == null ? void 0 : n.length) === ((h = e.sort) == null ? void 0 : h.length) && (o == null ? void 0 : o.length) === ((d = e.hidden) == null ? void 0 : d.length) && (r == null ? void 0 : r.length) === ((m = e.order) == null ? void 0 : m.length) && Object.keys(s ?? {}).length === Object.keys(e.widths ?? {}).length ? e : {
1683
2437
  ...e.search ? { search: e.search } : {},
1684
2438
  ...e.page ? { page: e.page } : {},
1685
2439
  ...e.pageSize ? { pageSize: e.pageSize } : {},
1686
2440
  ...n != null && n.length ? { sort: n } : {},
1687
2441
  ...o != null && o.length ? { hidden: o } : {},
1688
2442
  ...r != null && r.length ? { order: r } : {},
1689
- ...i && Object.keys(i).length ? { widths: i } : {}
2443
+ ...s && Object.keys(s).length ? { widths: s } : {}
1690
2444
  };
1691
2445
  }
1692
- const Jo = (e, t) => e.size === t.size && [...e].every((n) => t.has(n));
1693
- function Qo(e, t) {
2446
+ const Ge = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : [...e], ds = (e, t) => e.length === t.length && e.every((n, o) => n === t[o]);
2447
+ function _t(e) {
2448
+ const t = [], n = (o) => {
2449
+ for (const r of o)
2450
+ t.push(r.path), n(r.groups);
2451
+ };
2452
+ return n(e ?? []), t;
2453
+ }
2454
+ const fs = (e, t) => e.size === t.size && [...e].every((n) => t.has(n));
2455
+ function hs(e, t) {
1694
2456
  const n = {};
1695
2457
  for (const o of e) o.width !== void 0 && (n[o.id] = o.width);
1696
2458
  return { ...n, ...t };
1697
2459
  }
1698
- function Zo(e, t) {
1699
- const [n] = P(() => new ho()), [o] = P(() => {
1700
- const S = To(n);
1701
- return { ...S, VerdictColumn: Uo(S.Column) };
2460
+ function gs(e, t) {
2461
+ const [n] = H(() => new gr()), [o] = H(() => {
2462
+ const y = Hr(n);
2463
+ return { ...y, VerdictColumn: as(y.Column) };
1702
2464
  });
1703
- pe(n.subscribe, n.structureVersion, n.structureVersion);
1704
- const r = te(), i = e, s = n.modelColumns(i, r), [l] = P(() => t.initialView), [a, u] = P(() => Object.entries((l == null ? void 0 : l.conditions) ?? {})), d = V(() => qo(a, n), [a, n]), h = t.preFilter ?? t.filter, _ = Yo(i, h), g = t.rowKey, p = Et(_, s, {
1705
- rowKey: g,
2465
+ Le(n.subscribe, n.structureVersion, n.structureVersion);
2466
+ const r = ue(), s = e, i = n.modelColumns(s, r), [a] = H(() => t.initialView), [c, u] = H(() => Object.entries((a == null ? void 0 : a.conditions) ?? {})), h = $(() => ls(c, n), [c, n]), d = t.preFilter ?? t.filter, m = cs(s, d), [w, k] = H(
2467
+ () => a != null && a.grouping ? [...a.grouping] : Ge(t.defaultGrouping)
2468
+ ), [p, b] = H(() => (a == null ? void 0 : a.folded) ?? []), g = n.orderedColumns().length + n.groupKeys.entries.size > 0, _ = g ? n.effectiveGrouping(w, s) : w.slice(0, Qe), C = _.join("|"), S = $(() => new Set(p), [p]), I = _.length ? n.groupingModel(_, s) : null, x = $(
2469
+ () => I && I.levels.length ? { ...I, folded: S, compareText: r.compareText } : void 0,
2470
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- the model's identity carries the ids and the columns
2471
+ [I, S, r.compareText, C]
2472
+ ), A = t.rowKey, v = kn(m, i, {
2473
+ rowKey: A,
1706
2474
  pageSize: t.pageSize,
1707
2475
  defaultSort: t.defaultSort,
1708
- filter: d,
1709
- initialView: l,
1710
- virtual: t.virtual
1711
- }), { setPage: b } = p, v = B(
1712
- (S, T) => {
1713
- let L = T == null;
1714
- if (!L && n.orderedColumns().length > 0) {
1715
- const F = n.columnById(S), E = F ? se(F.spec.filter) : void 0;
1716
- if (!E) {
1717
- re(
1718
- `condition-without-filter:${S}`,
1719
- F ? `The column "${S}" has no filter; its condition is passed over.` : `No column is called "${S}"; its condition is passed over.`
2476
+ filter: h,
2477
+ initialView: a,
2478
+ virtual: t.virtual,
2479
+ grouping: x
2480
+ }), { setPage: F } = v, L = X(
2481
+ (y, R) => {
2482
+ let K = R == null;
2483
+ if (!K && n.orderedColumns().length > 0) {
2484
+ const j = n.columnById(y), M = j ? me(j.spec.filter) : void 0;
2485
+ if (!M) {
2486
+ pe(
2487
+ `condition-without-filter:${y}`,
2488
+ j ? `The column "${y}" has no filter; its condition is passed over.` : `No column is called "${y}"; its condition is passed over.`
1720
2489
  );
1721
2490
  return;
1722
2491
  }
1723
- const W = et(E, T);
1724
- if (W === "foreign") {
1725
- dt(S);
2492
+ const J = Dt(M, R);
2493
+ if (J === "foreign") {
2494
+ qt(y);
1726
2495
  return;
1727
2496
  }
1728
- L = W === "empty";
2497
+ K = J === "empty";
1729
2498
  }
1730
- u((F) => {
1731
- const E = F.findIndex(([W]) => W === S);
1732
- return L ? E === -1 ? F : F.filter((W, q) => q !== E) : E === -1 ? [...F, [S, T]] : F.map((W, q) => q === E ? [S, T] : W);
1733
- }), b(1);
2499
+ u((j) => {
2500
+ const M = j.findIndex(([J]) => J === y);
2501
+ return K ? M === -1 ? j : j.filter((J, Z) => Z !== M) : M === -1 ? [...j, [y, R]] : j.map((J, Z) => Z === M ? [y, R] : J);
2502
+ }), F(1);
1734
2503
  },
1735
- [n, b]
1736
- ), m = new Set(n.orderedColumns().map((S) => S.spec.id)), [y, O] = P(() => /* @__PURE__ */ new Set());
1737
- if (!Jo(y, m)) {
1738
- const S = new Set([...y].filter((T) => !m.has(T)));
1739
- O(m), a.some(([T]) => S.has(T)) && u((T) => T.filter(([L]) => !S.has(L)));
2504
+ [n, F]
2505
+ ), N = new Set(n.orderedColumns().map((y) => y.spec.id)), [V, z] = H(() => /* @__PURE__ */ new Set());
2506
+ if (!fs(V, N)) {
2507
+ const y = new Set([...V].filter((R) => !N.has(R)));
2508
+ z(N), c.some(([R]) => y.has(R)) && u((R) => R.filter(([K]) => !y.has(K)));
1740
2509
  }
1741
- const N = m.size === 0 ? a : a.filter(([S, T]) => ut(n, S, T)), M = Xo(p.view, m), w = N.length > 0 ? { ...M, conditions: Object.fromEntries(N) } : M, C = m.size === 0 ? p.sort : p.sort.filter((S) => m.has(S.column)), I = n.paginates() || t.virtual !== void 0, A = {
2510
+ const P = N.size === 0 ? c : c.filter(([y, R]) => Yt(n, y, R)), q = us(v.view, N), ie = P.length > 0 ? { ...q, conditions: Object.fromEntries(P) } : q, ae = N.size === 0 ? v.sort : v.sort.filter((y) => N.has(y.column)), de = g ? n.effectiveGrouping(Ge(t.defaultGrouping), s) : Ge(t.defaultGrouping), fe = v.groups ? fn(v.groups, p) : g ? [] : [...p], we = {
2511
+ ...ie,
2512
+ ...ds(_, de) ? {} : { grouping: _ },
2513
+ ...fe.length ? { folded: fe } : {}
2514
+ }, be = (y) => {
2515
+ k([...y]), F(1);
2516
+ }, ye = (y) => {
2517
+ _t(v.groups).includes(y) && (n.noteFocusBeforeFold(), b((R) => R.includes(y) ? R.filter((K) => K !== y) : [...R, y]));
2518
+ }, le = n.paginates() || t.virtual !== void 0, te = {
1742
2519
  rows: e,
1743
- filtered: p.filtered,
1744
- visible: I ? p.visible : p.filtered,
1745
- page: I ? p.page : 1,
1746
- pageCount: I ? p.pageCount : 1,
1747
- pageSize: p.pageSize,
1748
- setPage: p.setPage,
1749
- setPageSize: p.setPageSize,
1750
- search: p.search,
1751
- setSearch: p.setSearch,
1752
- sort: C,
1753
- toggleSort: p.toggleSort,
1754
- hidden: p.hidden,
1755
- toggleColumn: p.toggleColumn,
1756
- order: p.order,
1757
- setOrder: p.setOrder,
1758
- widths: Qo(s, p.widths),
1759
- setWidth: p.setWidth,
1760
- expanded: p.expanded,
1761
- toggleRow: p.toggleRow,
1762
- filter: Object.fromEntries(N),
1763
- setFilter: v,
1764
- selection: t.selection ?? p.selection,
1765
- view: w,
1766
- asCsv: () => So(n),
2520
+ filtered: v.filtered,
2521
+ visible: le ? v.visible : v.filtered,
2522
+ page: le ? v.page : 1,
2523
+ pageCount: le ? v.pageCount : 1,
2524
+ pageSize: v.pageSize,
2525
+ setPage: v.setPage,
2526
+ setPageSize: v.setPageSize,
2527
+ search: v.search,
2528
+ setSearch: v.setSearch,
2529
+ sort: ae,
2530
+ toggleSort: v.toggleSort,
2531
+ hidden: v.hidden,
2532
+ toggleColumn: v.toggleColumn,
2533
+ order: v.order,
2534
+ setOrder: v.setOrder,
2535
+ widths: hs(i, v.widths),
2536
+ setWidth: v.setWidth,
2537
+ expanded: v.expanded,
2538
+ toggleRow: v.toggleRow,
2539
+ filter: Object.fromEntries(P),
2540
+ setFilter: L,
2541
+ selection: t.selection ?? v.selection,
2542
+ view: we,
2543
+ grouping: _,
2544
+ setGrouping: be,
2545
+ folded: fe,
2546
+ toggleFold: ye,
2547
+ foldAll: () => {
2548
+ n.noteFocusBeforeFold(), b(_t(v.groups));
2549
+ },
2550
+ unfoldAll: () => {
2551
+ n.noteFocusBeforeFold(), b([]);
2552
+ },
2553
+ asCsv: () => xr(n),
1767
2554
  virtual: t.virtual !== void 0
1768
2555
  };
1769
2556
  return n.setHook({
1770
- rows: i,
1771
- admitted: _,
1772
- modelColumns: s,
1773
- companion: p,
1774
- filter: d,
1775
- publicSnapshot: A,
1776
- rowKey: g,
2557
+ rows: s,
2558
+ admitted: m,
2559
+ modelColumns: i,
2560
+ companion: v,
2561
+ filter: h,
2562
+ grouping: x,
2563
+ folded: S,
2564
+ publicSnapshot: te,
2565
+ rowKey: A,
1777
2566
  formats: r
1778
- }), { ...A, ...o };
2567
+ }), { ...te, ...o };
1779
2568
  }
1780
- function Er(e) {
2569
+ function Xs(e) {
1781
2570
  return e;
1782
2571
  }
1783
- function Ie(e, t) {
1784
- const n = Z();
1785
- e == null || e.register(t, n), J(() => {
2572
+ function nt(e, t) {
2573
+ const n = se();
2574
+ e == null || e.register(t, n), W(() => {
1786
2575
  if (e)
1787
2576
  return e.register(t, n), e.commit(), () => {
1788
2577
  e.remove(t, n), e.commit();
1789
2578
  };
1790
2579
  }, [e, t, n]);
1791
2580
  }
1792
- function Pr({ children: e, className: t, of: n }) {
1793
- const o = ue(n);
1794
- Ie(o == null ? void 0 : o.registry, "toolbar");
2581
+ function Qs({ children: e, className: t, of: n }) {
2582
+ const o = xe(n);
2583
+ nt(o == null ? void 0 : o.registry, "toolbar");
1795
2584
  const r = o == null ? void 0 : o.registry;
1796
- return /* @__PURE__ */ c(lt, { registry: r ?? null, className: t, children: e });
1797
- }
1798
- function Mr({ placeholder: e, "aria-label": t, className: n, of: o }) {
1799
- const r = ue(o), i = $();
1800
- if (Ie(r == null ? void 0 : r.registry, "search"), !r) return null;
1801
- const { snapshot: s } = r;
1802
- return /* @__PURE__ */ c(
1803
- Rt,
2585
+ return /* @__PURE__ */ l(jt, { registry: r ?? null, className: t, children: e });
2586
+ }
2587
+ function Zs({ placeholder: e, "aria-label": t, className: n, of: o }) {
2588
+ const r = xe(o), s = U();
2589
+ if (nt(r == null ? void 0 : r.registry, "search"), !r) return null;
2590
+ const { snapshot: i } = r;
2591
+ return /* @__PURE__ */ l(
2592
+ on,
1804
2593
  {
1805
2594
  size: "sm",
1806
2595
  type: "search",
1807
2596
  className: n,
1808
- value: s.search,
1809
- onChange: (l) => s.setSearch(l.target.value),
2597
+ value: i.search,
2598
+ onChange: (a) => i.setSearch(a.target.value),
1810
2599
  clearable: !0,
1811
- onClear: () => s.setSearch(""),
1812
- placeholder: e ?? i.tableSearchPlaceholder,
1813
- "aria-label": t ?? i.tableSearchLabel
2600
+ onClear: () => i.setSearch(""),
2601
+ placeholder: e ?? s.tableSearchPlaceholder,
2602
+ "aria-label": t ?? s.tableSearchLabel
1814
2603
  }
1815
2604
  );
1816
2605
  }
1817
- function Dr({ of: e }) {
1818
- var v;
1819
- const t = ue(e), n = $(), [o, r] = P(!1), i = oe(null), s = oe(null), l = Z(), [a, u] = P(null);
1820
- if (J(() => {
1821
- var N;
1822
- if (!a || !s.current) return;
1823
- const m = Array.from(s.current.children).find(
1824
- (M) => M.dataset.column === a.id
1825
- ), y = m == null ? void 0 : m.querySelector(`[data-direction="${a.direction}"]`), O = m == null ? void 0 : m.querySelector(
1826
- `[data-direction="${a.direction === "forward" ? "backward" : "forward"}"]`
2606
+ function ei({ of: e }) {
2607
+ var b;
2608
+ const t = xe(e), n = U(), [o, r] = H(!1), s = re(null), i = re(null), a = se(), [c, u] = H(null);
2609
+ if (W(() => {
2610
+ var S;
2611
+ if (!c || !i.current) return;
2612
+ const g = Array.from(i.current.children).find(
2613
+ (I) => I.dataset.column === c.id
2614
+ ), _ = g == null ? void 0 : g.querySelector(`[data-direction="${c.direction}"]`), C = g == null ? void 0 : g.querySelector(
2615
+ `[data-direction="${c.direction === "forward" ? "backward" : "forward"}"]`
1827
2616
  );
1828
- (N = y && !y.disabled ? y : O) == null || N.focus();
1829
- }, [a]), !t) return null;
1830
- const { registry: d, snapshot: h } = t, _ = d.hook, g = d.withStickyHeaderFirst(
1831
- Te(d.modelColumns(_.rows, _.formats), h.order)
1832
- ), p = d.stickyRowHeader ? ((v = g[0]) == null ? void 0 : v.hideable) === !1 : !1, b = (m, y) => {
1833
- const O = g.map((M) => M.id), N = m + y;
1834
- N < 0 || N >= O.length || ([O[m], O[N]] = [O[N], O[m]], h.setOrder(O), u({ id: g[m].id, direction: y < 0 ? "forward" : "backward" }));
2617
+ (S = _ && !_.disabled ? _ : C) == null || S.focus();
2618
+ }, [c]), !t) return null;
2619
+ const { registry: h, snapshot: d } = t, m = h.hook, w = h.withStickyHeaderFirst(
2620
+ et(h.modelColumns(m.rows, m.formats), d.order)
2621
+ ), k = h.stickyRowHeader ? ((b = w[0]) == null ? void 0 : b.hideable) === !1 : !1, p = (g, _) => {
2622
+ const C = w.map((I) => I.id), S = g + _;
2623
+ S < 0 || S >= C.length || ([C[g], C[S]] = [C[S], C[g]], d.setOrder(C), u({ id: w[g].id, direction: _ < 0 ? "forward" : "backward" }));
1835
2624
  };
1836
- return /* @__PURE__ */ x(Q, { children: [
1837
- /* @__PURE__ */ c(
1838
- G,
2625
+ return /* @__PURE__ */ O(Q, { children: [
2626
+ /* @__PURE__ */ l(
2627
+ ee,
1839
2628
  {
1840
- ref: i,
2629
+ ref: s,
1841
2630
  size: "sm",
1842
2631
  "aria-haspopup": "dialog",
1843
2632
  "aria-expanded": o,
1844
- "aria-controls": o ? l : void 0,
2633
+ "aria-controls": o ? a : void 0,
1845
2634
  onClick: () => r(!o),
1846
2635
  children: n.columns
1847
2636
  }
1848
2637
  ),
1849
- /* @__PURE__ */ c(
1850
- Ue,
2638
+ /* @__PURE__ */ O(
2639
+ St,
1851
2640
  {
1852
2641
  open: o,
1853
2642
  onOpenChange: r,
1854
- anchorRef: i,
2643
+ anchorRef: s,
1855
2644
  align: "end",
1856
2645
  role: "dialog",
1857
2646
  ariaLabel: n.arrangeColumns,
1858
- id: l,
2647
+ id: a,
1859
2648
  className: f.columnsPanel,
1860
- children: /* @__PURE__ */ c("ul", { ref: s, className: f.columnsList, "aria-label": n.arrangeColumns, children: g.map((m, y) => {
1861
- const O = m.label ?? m.id;
1862
- return /* @__PURE__ */ x("li", { className: f.columnsEntry, "data-column": m.id, children: [
1863
- /* @__PURE__ */ c(
1864
- ge,
1865
- {
1866
- label: O,
1867
- checked: !h.hidden.includes(m.id),
1868
- disabled: m.hideable === !1,
1869
- onChange: () => h.toggleColumn(m.id)
1870
- }
1871
- ),
1872
- /* @__PURE__ */ c(
1873
- "button",
1874
- {
1875
- type: "button",
1876
- className: f.move,
1877
- "data-direction": "forward",
1878
- "aria-label": n.columnForward(O),
1879
- disabled: y === 0 || p && y <= 1,
1880
- onClick: () => b(y, -1),
1881
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M2 6.5 5 3.5l3 3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1882
- }
1883
- ),
1884
- /* @__PURE__ */ c(
1885
- "button",
1886
- {
1887
- type: "button",
1888
- className: f.move,
1889
- "data-direction": "backward",
1890
- "aria-label": n.columnBackward(O),
1891
- disabled: y === g.length - 1 || p && y === 0,
1892
- onClick: () => b(y, 1),
1893
- children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M2 3.5 5 6.5l3-3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1894
- }
1895
- )
1896
- ] }, m.id);
1897
- }) })
2649
+ children: [
2650
+ /* @__PURE__ */ l("ul", { ref: i, className: f.columnsList, "aria-label": n.arrangeColumns, children: w.map((g, _) => {
2651
+ const C = g.label ?? g.id;
2652
+ return /* @__PURE__ */ O("li", { className: f.columnsEntry, "data-column": g.id, children: [
2653
+ /* @__PURE__ */ l(
2654
+ Se,
2655
+ {
2656
+ label: C,
2657
+ checked: !d.hidden.includes(g.id),
2658
+ disabled: g.hideable === !1,
2659
+ onChange: () => d.toggleColumn(g.id)
2660
+ }
2661
+ ),
2662
+ /* @__PURE__ */ l(
2663
+ "button",
2664
+ {
2665
+ type: "button",
2666
+ className: f.move,
2667
+ "data-direction": "forward",
2668
+ "aria-label": n.columnForward(C),
2669
+ disabled: _ === 0 || k && _ <= 1,
2670
+ onClick: () => p(_, -1),
2671
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M2 6.5 5 3.5l3 3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2672
+ }
2673
+ ),
2674
+ /* @__PURE__ */ l(
2675
+ "button",
2676
+ {
2677
+ type: "button",
2678
+ className: f.move,
2679
+ "data-direction": "backward",
2680
+ "aria-label": n.columnBackward(C),
2681
+ disabled: _ === w.length - 1 || k && _ === 0,
2682
+ onClick: () => p(_, 1),
2683
+ children: /* @__PURE__ */ l("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M2 3.5 5 6.5l3-3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2684
+ }
2685
+ )
2686
+ ] }, g.id);
2687
+ }) }),
2688
+ /* @__PURE__ */ l(Tr, { registry: h, hook: m })
2689
+ ]
1898
2690
  }
1899
2691
  )
1900
2692
  ] });
1901
2693
  }
1902
- function Vr({ filename: e, onExport: t, of: n }) {
1903
- const o = ue(n), r = $();
2694
+ function ti({ filename: e, onExport: t, of: n }) {
2695
+ const o = xe(n), r = U();
1904
2696
  if (!o) return null;
1905
- const { snapshot: i } = o;
1906
- return /* @__PURE__ */ c(G, { size: "sm", onClick: () => {
1907
- const l = i.asCsv();
2697
+ const { snapshot: s } = o;
2698
+ return /* @__PURE__ */ l(ee, { size: "sm", onClick: () => {
2699
+ const a = s.asCsv();
1908
2700
  if (t) {
1909
- t(l);
2701
+ t(a);
1910
2702
  return;
1911
2703
  }
1912
- const a = URL.createObjectURL(new Blob([l], { type: "text/csv;charset=utf-8" })), u = document.createElement("a");
1913
- u.href = a, u.download = e ?? r.exportFileName, u.click(), setTimeout(() => URL.revokeObjectURL(a), 1e4);
2704
+ const c = URL.createObjectURL(new Blob([a], { type: "text/csv;charset=utf-8" })), u = document.createElement("a");
2705
+ u.href = c, u.download = e ?? r.exportFileName, u.click(), setTimeout(() => URL.revokeObjectURL(c), 1e4);
1914
2706
  }, children: r.exportLabel });
1915
2707
  }
1916
- function Hr({ pageSizes: e = [10, 25, 50], className: t, of: n }) {
1917
- const o = ue(n), r = $(), i = te();
1918
- if (Ie(o == null ? void 0 : o.registry, "pagination"), !o || o.snapshot.virtual) return null;
1919
- const { snapshot: s } = o, l = s.filtered.length, a = e.includes(s.pageSize) ? e : [...e, s.pageSize].sort((d, h) => d - h), u = /* @__PURE__ */ x("nav", { "aria-label": r.pagination, className: H(f.pagination, t), children: [
1920
- /* @__PURE__ */ c("span", { children: r.entries(l, i.count(l)) }),
1921
- /* @__PURE__ */ x("div", { className: f.paginationControls, children: [
1922
- /* @__PURE__ */ x("label", { className: f.pageSize, children: [
2708
+ function ni({ pageSizes: e = [10, 25, 50], className: t, of: n }) {
2709
+ const o = xe(n), r = U(), s = ue();
2710
+ if (nt(o == null ? void 0 : o.registry, "pagination"), !o || o.snapshot.virtual) return null;
2711
+ const { snapshot: i } = o, a = i.filtered.length, c = e.includes(i.pageSize) ? e : [...e, i.pageSize].sort((h, d) => h - d), u = /* @__PURE__ */ O("nav", { "aria-label": r.pagination, className: G(f.pagination, t), children: [
2712
+ /* @__PURE__ */ l("span", { children: r.entries(a, s.count(a)) }),
2713
+ /* @__PURE__ */ O("div", { className: f.paginationControls, children: [
2714
+ /* @__PURE__ */ O("label", { className: f.pageSize, children: [
1923
2715
  r.rows,
1924
- /* @__PURE__ */ c(
1925
- Ot,
2716
+ /* @__PURE__ */ l(
2717
+ nn,
1926
2718
  {
1927
2719
  selectSize: "sm",
1928
- value: s.pageSize,
1929
- onChange: (d) => s.setPageSize(Number(d.target.value)),
2720
+ value: i.pageSize,
2721
+ onChange: (h) => i.setPageSize(Number(h.target.value)),
1930
2722
  "aria-label": r.rowsPerPage,
1931
- children: a.map((d) => /* @__PURE__ */ c("option", { value: d, children: d }, d))
2723
+ children: c.map((h) => /* @__PURE__ */ l("option", { value: h, children: h }, h))
1932
2724
  }
1933
2725
  )
1934
2726
  ] }),
1935
- /* @__PURE__ */ c("span", { className: f.paginationStatus, children: r.pageOfPages(s.page, s.pageCount) }),
1936
- /* @__PURE__ */ c(G, { size: "sm", disabled: s.page <= 1, onClick: () => s.setPage(s.page - 1), children: r.previousPage }),
1937
- /* @__PURE__ */ c(G, { size: "sm", disabled: s.page >= s.pageCount, onClick: () => s.setPage(s.page + 1), children: r.nextPage })
2727
+ /* @__PURE__ */ l("span", { className: f.paginationStatus, children: r.pageOfPages(i.page, i.pageCount) }),
2728
+ /* @__PURE__ */ l(ee, { size: "sm", disabled: i.page <= 1, onClick: () => i.setPage(i.page - 1), children: r.previousPage }),
2729
+ /* @__PURE__ */ l(ee, { size: "sm", disabled: i.page >= i.pageCount, onClick: () => i.setPage(i.page + 1), children: r.nextPage })
1938
2730
  ] })
1939
2731
  ] });
1940
- return o.inside ? o.footerTarget ? Lt(u, o.footerTarget) : null : u;
2732
+ return o.inside ? o.footerTarget ? an(u, o.footerTarget) : null : u;
1941
2733
  }
1942
- const er = ["high", "medium", "low"], tr = (e) => er.indexOf(e), nr = (e) => e === "standing-unacknowledged" || e === "standing-acknowledged", _e = (e) => e === "standing-acknowledged" || e === "cleared-acknowledged", or = (e) => e === "cleared-acknowledged";
1943
- function rr(e, t) {
2734
+ const ps = ["high", "medium", "low"], ms = (e) => ps.indexOf(e), ws = (e) => e === "standing-unacknowledged" || e === "standing-acknowledged", De = (e) => e === "standing-acknowledged" || e === "cleared-acknowledged", bs = (e) => e === "cleared-acknowledged";
2735
+ function ks(e, t) {
1944
2736
  switch (t) {
1945
2737
  case "raised":
1946
2738
  return "standing-unacknowledged";
1947
2739
  case "acknowledged":
1948
- return nr(e) ? "standing-acknowledged" : "cleared-acknowledged";
2740
+ return ws(e) ? "standing-acknowledged" : "cleared-acknowledged";
1949
2741
  case "cleared":
1950
- return _e(e) ? "cleared-acknowledged" : "cleared-unacknowledged";
2742
+ return De(e) ? "cleared-acknowledged" : "cleared-unacknowledged";
1951
2743
  }
1952
2744
  }
1953
- const Br = (e, t) => e.direction === "obere" ? t <= e.returnTo : t >= e.returnTo, Fe = (e, t, n) => e > n - t && e <= n, $r = (e, t, n) => e.reduce((o, r) => o + (Fe(r, t, n) ? 1 : 0), 0);
1954
- function sr(e, t, n) {
2745
+ const oi = (e, t) => e.direction === "obere" ? t <= e.returnTo : t >= e.returnTo, ot = (e, t, n) => e > n - t && e <= n, ri = (e, t, n) => e.reduce((o, r) => o + (ot(r, t, n) ? 1 : 0), 0);
2746
+ function vs(e, t, n) {
1955
2747
  const o = /* @__PURE__ */ new Map();
1956
2748
  for (const r of e)
1957
- Fe(r.raised, t, n) && o.set(r.type, (o.get(r.type) ?? 0) + 1);
2749
+ ot(r.raised, t, n) && o.set(r.type, (o.get(r.type) ?? 0) + 1);
1958
2750
  return o;
1959
2751
  }
1960
- function ir(e) {
2752
+ function _s(e) {
1961
2753
  let t = Number.POSITIVE_INFINITY;
1962
2754
  for (const n of e) n < t && (t = n);
1963
2755
  return t;
1964
2756
  }
1965
- function lr(e) {
2757
+ function ys(e) {
1966
2758
  let t = Number.NEGATIVE_INFINITY;
1967
2759
  for (const n of e) n > t && (t = n);
1968
2760
  return t;
1969
2761
  }
1970
- function cr(e, t, n) {
1971
- const o = e.filter((i) => Fe(i.raised, t.windowMs, n));
2762
+ function Cs(e, t, n) {
2763
+ const o = e.filter((s) => ot(s.raised, t.windowMs, n));
1972
2764
  if (o.length < t.atLeast) return null;
1973
- const r = o.map((i) => i.raised);
2765
+ const r = o.map((s) => s.raised);
1974
2766
  return {
1975
2767
  // No spread: a flood is the case with many elements, and an argument list
1976
2768
  // of that size blows the call stack at some point. A loop cannot.
1977
- from: ir(r),
1978
- to: lr(r),
2769
+ from: _s(r),
2770
+ to: ys(r),
1979
2771
  count: o.length,
1980
- alarms: o.map((i) => i.id)
2772
+ alarms: o.map((s) => s.id)
1981
2773
  };
1982
2774
  }
1983
- function ar(e, t) {
2775
+ function Ss(e, t) {
1984
2776
  const n = new Set(t);
1985
2777
  return e.reduce(
1986
- (o, r) => o + (n.has(r.id) && !_e(r.lifecycle) ? 1 : 0),
2778
+ (o, r) => o + (n.has(r.id) && !De(r.lifecycle) ? 1 : 0),
1987
2779
  0
1988
2780
  );
1989
2781
  }
1990
- function Wr(e, t, n) {
2782
+ function si(e, t, n) {
1991
2783
  const o = new Set(t);
1992
2784
  let r = 0;
1993
- return { alarms: e.map((s) => !o.has(s.id) || _e(s.lifecycle) ? s : (r += 1, { ...s, lifecycle: rr(s.lifecycle, "acknowledged"), acknowledgedAt: n })), count: r };
2785
+ return { alarms: e.map((i) => !o.has(i.id) || De(i.lifecycle) ? i : (r += 1, { ...i, lifecycle: ks(i.lifecycle, "acknowledged"), acknowledgedAt: n })), count: r };
1994
2786
  }
1995
- const dr = (e) => [
2787
+ const Ns = (e) => [
1996
2788
  {
1997
2789
  id: "type",
1998
2790
  label: e.columnAlarm,
@@ -2006,70 +2798,70 @@ const dr = (e) => [
2006
2798
  level of the order asks only about the acknowledgement and expressly not
2007
2799
  about whether the alarm is still standing. Otherwise the fleeting alarm
2008
2800
  falls back down again. */
2009
- { id: "acknowledgement", label: e.columnAcknowledgement, value: (t) => _e(t.lifecycle) ? 1 : 0 },
2801
+ { id: "acknowledgement", label: e.columnAcknowledgement, value: (t) => De(t.lifecycle) ? 1 : 0 },
2010
2802
  { id: "raised", label: e.columnRaised, value: (t) => t.alarm.raised },
2011
2803
  { id: "age", label: e.columnAge, value: (t) => t.age },
2012
2804
  { id: "frequency", label: e.columnFrequency, value: (t) => t.frequency }
2013
- ], ur = dr(It), fr = [
2805
+ ], xs = Ns(rn), As = [
2014
2806
  { column: "priority", direction: "asc" },
2015
2807
  { column: "acknowledgement", direction: "asc" },
2016
2808
  { column: "raised", direction: "desc" }
2017
- ], hr = (e) => ({
2809
+ ], Ts = (e) => ({
2018
2810
  id: e,
2019
2811
  label: e,
2020
2812
  priority: "high"
2021
2813
  });
2022
- function Kr(e, t = {}) {
2814
+ function ii(e, t = {}) {
2023
2815
  const {
2024
2816
  alarms: n,
2025
2817
  types: o,
2026
2818
  asOf: r,
2027
- chatter: i,
2028
- flood: s,
2029
- keepDone: l = !1,
2030
- columns: a = ur
2031
- } = e, u = new Map(o.map((b) => [b.id, b])), d = sr(n, (i == null ? void 0 : i.windowMs) ?? 1 / 0, r), h = s ? cr(n, s, r) : null, _ = new Set((h == null ? void 0 : h.alarms) ?? []), g = n.filter((b) => l || !or(b.lifecycle)).map((b) => {
2032
- const v = u.get(b.type) ?? hr(b.type), m = d.get(b.type) ?? 0;
2819
+ chatter: s,
2820
+ flood: i,
2821
+ keepDone: a = !1,
2822
+ columns: c = xs
2823
+ } = e, u = new Map(o.map((p) => [p.id, p])), h = vs(n, (s == null ? void 0 : s.windowMs) ?? 1 / 0, r), d = i ? Cs(n, i, r) : null, m = new Set((d == null ? void 0 : d.alarms) ?? []), w = n.filter((p) => a || !bs(p.lifecycle)).map((p) => {
2824
+ const b = u.get(p.type) ?? Ts(p.type), g = h.get(p.type) ?? 0;
2033
2825
  return {
2034
- id: b.id,
2035
- alarm: b,
2036
- type: v,
2037
- lifecycle: b.lifecycle,
2038
- priority: v.priority,
2039
- rank: tr(v.priority),
2040
- age: r - b.raised,
2041
- duration: (b.cleared ?? r) - b.raised,
2042
- frequency: m,
2043
- chatters: i !== void 0 && m >= i.atLeast,
2044
- inFlood: _.has(b.id)
2826
+ id: p.id,
2827
+ alarm: p,
2828
+ type: b,
2829
+ lifecycle: p.lifecycle,
2830
+ priority: b.priority,
2831
+ rank: ms(b.priority),
2832
+ age: r - p.raised,
2833
+ duration: (p.cleared ?? r) - p.raised,
2834
+ frequency: g,
2835
+ chatters: s !== void 0 && g >= s.atLeast,
2836
+ inFlood: m.has(p.id)
2045
2837
  };
2046
- }), p = Oe(g, a, {
2838
+ }), k = tt(w, c, {
2047
2839
  ...t,
2048
- sort: t.sort === void 0 ? fr : t.sort
2840
+ sort: t.sort === void 0 ? As : t.sort
2049
2841
  });
2050
2842
  return {
2051
- ...p,
2052
- flood: h,
2053
- standingUnacknowledged: p.filtered.reduce(
2054
- (b, v) => b + (v.lifecycle === "standing-unacknowledged" ? 1 : 0),
2843
+ ...k,
2844
+ flood: d,
2845
+ standingUnacknowledged: k.filtered.reduce(
2846
+ (p, b) => p + (b.lifecycle === "standing-unacknowledged" ? 1 : 0),
2055
2847
  0
2056
2848
  )
2057
2849
  };
2058
2850
  }
2059
- const mr = "_list_alpwk_4 _text_1hv7a_23", pr = "_bar_alpwk_12", gr = "_heading_alpwk_19", br = "_filler_alpwk_25", wr = "_asOf_alpwk_29", _r = "_live_alpwk_46", vr = "_label_alpwk_51", kr = "_counter_alpwk_55", yr = "_lifecycle_alpwk_59", Cr = "_empty_alpwk_63", Sr = "_row_alpwk_70", X = {
2060
- list: mr,
2061
- bar: pr,
2062
- heading: gr,
2063
- filler: br,
2064
- asOf: wr,
2065
- live: _r,
2066
- label: vr,
2067
- counter: kr,
2068
- lifecycle: yr,
2069
- empty: Cr,
2070
- row: Sr
2851
+ const Fs = "_list_17f0w_4 _text_1hv7a_23", Os = "_bar_17f0w_12", Ls = "_heading_17f0w_19", Rs = "_filler_17f0w_25", Ms = "_asOf_17f0w_29", Vs = "_live_17f0w_46", Ds = "_label_17f0w_51", Is = "_counter_17f0w_55", Bs = "_lifecycle_17f0w_59", Ps = "_empty_17f0w_63", Gs = "_row_17f0w_70", oe = {
2852
+ list: Fs,
2853
+ bar: Os,
2854
+ heading: Ls,
2855
+ filler: Rs,
2856
+ asOf: Ms,
2857
+ live: Vs,
2858
+ label: Ds,
2859
+ counter: Is,
2860
+ lifecycle: Bs,
2861
+ empty: Ps,
2862
+ row: Gs
2071
2863
  };
2072
- function Nr(e, t) {
2864
+ function Es(e, t) {
2073
2865
  switch (e) {
2074
2866
  case "standing-unacknowledged":
2075
2867
  return t.lifecycleStandingUnacknowledged;
@@ -2081,108 +2873,108 @@ function Nr(e, t) {
2081
2873
  return t.lifecycleClearedAcknowledged;
2082
2874
  }
2083
2875
  }
2084
- function Ar(e, t) {
2876
+ function zs(e, t) {
2085
2877
  return e === "high" ? t.priorityHigh : e === "medium" ? t.priorityMedium : t.priorityLow;
2086
2878
  }
2087
- function xr(e) {
2879
+ function js(e) {
2088
2880
  return e === "high" ? "danger" : e === "medium" ? "warning" : "neutral";
2089
2881
  }
2090
- function Tr(e, t) {
2091
- const n = Math.max(0, Math.floor(e / 6e4)), o = Math.floor(n / 60), r = n % 60, i = [];
2092
- return o > 0 && i.push(t.hoursShort(o)), (o === 0 || r > 0) && i.push(t.minutesShort(r)), i.join(" ");
2882
+ function Hs(e, t) {
2883
+ const n = Math.max(0, Math.floor(e / 6e4)), o = Math.floor(n / 60), r = n % 60, s = [];
2884
+ return o > 0 && s.push(t.hoursShort(o)), (o === 0 || r > 0) && s.push(t.minutesShort(r)), s.join(" ");
2093
2885
  }
2094
- function Gr(e) {
2886
+ function ai(e) {
2095
2887
  const { asOf: t, freshness: n, ...o } = e;
2096
- return t === void 0 || n === void 0 ? /* @__PURE__ */ c(ft, { ...o, freshness: null }) : /* @__PURE__ */ c(Or, { ...o, asOf: t, ages: n });
2888
+ return t === void 0 || n === void 0 ? /* @__PURE__ */ l(Ut, { ...o, freshness: null }) : /* @__PURE__ */ l($s, { ...o, asOf: t, ages: n });
2097
2889
  }
2098
- function Or({
2890
+ function $s({
2099
2891
  asOf: e,
2100
2892
  ages: t,
2101
2893
  ...n
2102
2894
  }) {
2103
- const o = Ft(e, t);
2104
- return /* @__PURE__ */ c(ft, { ...n, freshness: o });
2895
+ const o = sn(e, t);
2896
+ return /* @__PURE__ */ l(Ut, { ...n, freshness: o });
2105
2897
  }
2106
- function ft({
2898
+ function Ut({
2107
2899
  view: e,
2108
2900
  selection: t,
2109
2901
  onAcknowledge: n,
2110
2902
  density: o,
2111
2903
  className: r,
2112
- freshness: i,
2113
- ...s
2904
+ freshness: s,
2905
+ ...i
2114
2906
  }) {
2115
- const l = $(), a = te(), u = i !== null, d = (i == null ? void 0 : i.freshness) === "lost", { Table: h, Column: _ } = Zo(e.visible, { rowKey: (m) => m.id, selection: t }), g = V(() => e.filtered.map((m) => m.alarm), [e.filtered]), p = V(() => t === void 0 ? [] : e.filtered.map((m) => m.id).filter((m) => t.selected.has(m)), [e.filtered, t]), b = V(() => ar(g, p), [g, p]), v = qe(o, "compact");
2116
- return /* @__PURE__ */ x("div", { className: [X.list, r].filter(Boolean).join(" "), ...s, children: [
2117
- /* @__PURE__ */ x("div", { className: X.bar, children: [
2118
- /* @__PURE__ */ c("span", { className: X.heading, children: l.alarms }),
2119
- e.flood !== null && /* @__PURE__ */ c(Ce, { tone: "warning", children: l.floodHint(e.flood.count) }),
2120
- u && i !== null && /* @__PURE__ */ x("span", { className: X.asOf, "data-freshness": i.freshness, children: [
2121
- i.freshness === "lost" ? l.freshnessDisconnected : i.freshness === "stale" ? l.freshnessStale : l.freshnessFresh,
2122
- i.age !== null && ` · ${a.relative(i.age)}`
2907
+ const a = U(), c = ue(), u = s !== null, h = (s == null ? void 0 : s.freshness) === "lost", { Table: d, Column: m } = gs(e.visible, { rowKey: (g) => g.id, selection: t }), w = $(() => e.filtered.map((g) => g.alarm), [e.filtered]), k = $(() => t === void 0 ? [] : e.filtered.map((g) => g.id).filter((g) => t.selected.has(g)), [e.filtered, t]), p = $(() => Ss(w, k), [w, k]), b = Tt(o, "compact");
2908
+ return /* @__PURE__ */ O("div", { className: [oe.list, r].filter(Boolean).join(" "), ...i, children: [
2909
+ /* @__PURE__ */ O("div", { className: oe.bar, children: [
2910
+ /* @__PURE__ */ l("span", { className: oe.heading, children: a.alarms }),
2911
+ e.flood !== null && /* @__PURE__ */ l(Ie, { tone: "warning", children: a.floodHint(e.flood.count) }),
2912
+ u && s !== null && /* @__PURE__ */ O("span", { className: oe.asOf, "data-freshness": s.freshness, children: [
2913
+ s.freshness === "lost" ? a.freshnessDisconnected : s.freshness === "stale" ? a.freshnessStale : a.freshnessFresh,
2914
+ s.age !== null && ` · ${c.relative(s.age)}`
2123
2915
  ] }),
2124
- /* @__PURE__ */ c("span", { className: X.filler }),
2125
- t !== void 0 && n !== void 0 && /* @__PURE__ */ c(G, { variant: "primary", size: "sm", disabled: b === 0, onClick: () => n(p), children: b === 0 ? l.acknowledgeAlarm : l.acknowledgeAlarms(b) })
2916
+ /* @__PURE__ */ l("span", { className: oe.filler }),
2917
+ t !== void 0 && n !== void 0 && /* @__PURE__ */ l(ee, { variant: "primary", size: "sm", disabled: p === 0, onClick: () => n(k), children: p === 0 ? a.acknowledgeAlarm : a.acknowledgeAlarms(p) })
2126
2918
  ] }),
2127
- /* @__PURE__ */ c("div", { "aria-live": "polite", "aria-atomic": "true", className: X.live, children: l.standingUnacknowledged(e.standingUnacknowledged) }),
2128
- /* @__PURE__ */ x(
2129
- h,
2919
+ /* @__PURE__ */ l("div", { "aria-live": "polite", "aria-atomic": "true", className: oe.live, children: a.standingUnacknowledged(e.standingUnacknowledged) }),
2920
+ /* @__PURE__ */ O(
2921
+ d,
2130
2922
  {
2131
- ariaLabel: l.alarms,
2923
+ ariaLabel: a.alarms,
2132
2924
  selectable: t !== void 0,
2133
- density: v,
2925
+ density: b,
2134
2926
  stickyHeader: !0,
2135
- rowProps: (m) => ({ className: X.row, "data-lifecycle": m.lifecycle, "data-priority": m.priority }),
2136
- empty: /* @__PURE__ */ c("span", { className: X.empty, children: d ? l.noAlarmsDisconnected : l.noAlarms }),
2927
+ rowProps: (g) => ({ className: oe.row, "data-lifecycle": g.lifecycle, "data-priority": g.priority }),
2928
+ empty: /* @__PURE__ */ l("span", { className: oe.empty, children: h ? a.noAlarmsDisconnected : a.noAlarms }),
2137
2929
  children: [
2138
- /* @__PURE__ */ c(_, { id: "type", label: l.columnAlarm, value: (m) => m.type.label, rowHeader: !0, sortable: !1, children: (m, y) => /* @__PURE__ */ x(Q, { children: [
2139
- /* @__PURE__ */ c("span", { className: X.label, children: m }),
2140
- y.chatters && /* @__PURE__ */ c(Ce, { tone: "warning", pill: !0, className: X.counter, children: l.chatterHint(y.frequency) })
2930
+ /* @__PURE__ */ l(m, { id: "type", label: a.columnAlarm, value: (g) => g.type.label, rowHeader: !0, sortable: !1, children: (g, _) => /* @__PURE__ */ O(Q, { children: [
2931
+ /* @__PURE__ */ l("span", { className: oe.label, children: g }),
2932
+ _.chatters && /* @__PURE__ */ l(Ie, { tone: "warning", pill: !0, className: oe.counter, children: a.chatterHint(_.frequency) })
2141
2933
  ] }) }),
2142
- /* @__PURE__ */ c(_, { value: "lifecycle", label: l.columnLifecycleState, sortable: !1, children: (m) => /* @__PURE__ */ c("span", { className: X.lifecycle, children: Nr(m, l) }) }),
2143
- /* @__PURE__ */ c(_, { value: "priority", label: l.columnPriority, sortable: !1, children: (m) => /* @__PURE__ */ c(Ce, { tone: xr(m), children: Ar(m, l) }) }),
2144
- /* @__PURE__ */ c(
2145
- _,
2934
+ /* @__PURE__ */ l(m, { value: "lifecycle", label: a.columnLifecycleState, sortable: !1, children: (g) => /* @__PURE__ */ l("span", { className: oe.lifecycle, children: Es(g, a) }) }),
2935
+ /* @__PURE__ */ l(m, { value: "priority", label: a.columnPriority, sortable: !1, children: (g) => /* @__PURE__ */ l(Ie, { tone: js(g), children: zs(g, a) }) }),
2936
+ /* @__PURE__ */ l(
2937
+ m,
2146
2938
  {
2147
2939
  id: "raised",
2148
- label: l.columnRaised,
2149
- value: (m) => new Date(m.alarm.raised),
2940
+ label: a.columnRaised,
2941
+ value: (g) => new Date(g.alarm.raised),
2150
2942
  numeric: !0,
2151
2943
  sortable: !1
2152
2944
  }
2153
2945
  ),
2154
- /* @__PURE__ */ c(_, { value: "duration", label: l.columnDuration, sortable: !1, children: (m) => Tr(m, l) }),
2155
- /* @__PURE__ */ c(_, { value: "frequency", label: l.columnFrequency, format: "count", sortable: !1 })
2946
+ /* @__PURE__ */ l(m, { value: "duration", label: a.columnDuration, sortable: !1, children: (g) => Hs(g, a) }),
2947
+ /* @__PURE__ */ l(m, { value: "frequency", label: a.columnFrequency, format: "count", sortable: !1 })
2156
2948
  ]
2157
2949
  }
2158
2950
  )
2159
2951
  ] });
2160
2952
  }
2161
2953
  export {
2162
- ur as ALARM_COLUMNS,
2163
- Gr as AlarmList,
2164
- Dr as ColumnMenu,
2165
- fr as DEFAULT_ORDER,
2166
- Vr as Export,
2167
- er as PRIORITIES,
2168
- Hr as Pagination,
2169
- Mr as Search,
2170
- Pr as Toolbar,
2171
- Wr as acknowledge,
2172
- dr as alarmColumns,
2173
- Kr as alarmModel,
2174
- Er as column,
2175
- jr as columnFilter,
2176
- ar as countAcknowledgeable,
2177
- $r as countInWindow,
2178
- cr as detectFlood,
2179
- sr as frequencyByType,
2180
- Br as hasReturned,
2181
- _e as isAcknowledged,
2182
- or as isDone,
2183
- nr as isStanding,
2184
- rr as nextLifecycleState,
2185
- tr as priorityRank,
2186
- Zo as useTable,
2187
- zt as useTableSelection
2954
+ xs as ALARM_COLUMNS,
2955
+ ai as AlarmList,
2956
+ ei as ColumnMenu,
2957
+ As as DEFAULT_ORDER,
2958
+ ti as Export,
2959
+ ps as PRIORITIES,
2960
+ ni as Pagination,
2961
+ Zs as Search,
2962
+ Qs as Toolbar,
2963
+ si as acknowledge,
2964
+ Ns as alarmColumns,
2965
+ ii as alarmModel,
2966
+ Xs as column,
2967
+ Js as columnFilter,
2968
+ Ss as countAcknowledgeable,
2969
+ ri as countInWindow,
2970
+ Cs as detectFlood,
2971
+ vs as frequencyByType,
2972
+ oi as hasReturned,
2973
+ De as isAcknowledged,
2974
+ bs as isDone,
2975
+ ws as isStanding,
2976
+ ks as nextLifecycleState,
2977
+ ms as priorityRank,
2978
+ gs as useTable,
2979
+ ln as useTableSelection
2188
2980
  };