@alfadocs/ui-kit 1.9.4 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1887 @@
1
+ import { jsx as i, jsxs as G } from "react/jsx-runtime";
2
+ import { useMemo as j, forwardRef as $, useState as _, useCallback as N, useEffect as K, useRef as W, createContext as Re, useContext as Se, isValidElement as He, cloneElement as Ve, useImperativeHandle as _t } from "react";
3
+ import { S as Gt } from "./skeleton-CZbwyJAA.js";
4
+ import { E as Lt } from "./empty-state-X0sVPfVo.js";
5
+ import { c as jt } from "./index-D2ZczOXr.js";
6
+ import { useTranslation as A } from "react-i18next";
7
+ import { useGridFilter as qt, AgGridReact as Bt } from "ag-grid-react";
8
+ import { ModuleRegistry as Wt, AllCommunityModule as $t } from "ag-grid-community";
9
+ import { I as Ue } from "./icon-button-group-D6SVMteH.js";
10
+ import { B as ce } from "./button-nJaPh_HC.js";
11
+ import { I as Q } from "./icon-button-DA2CAGHZ.js";
12
+ import { P as ge } from "./popover-Cqcjx-Ny.js";
13
+ import { C as Kt } from "./checkbox-BuZ1u__2.js";
14
+ import { T as Ie } from "./text-input-CUvCb6ST.js";
15
+ import { T as We } from "./tag-3wgkwwDB.js";
16
+ import { D as X } from "./dropdown-menu-DU-Hrf33.js";
17
+ import { X as Xe } from "./x-B5YnXwCz.js";
18
+ import { R as Ht } from "./refresh-cw-DnI0cLFC.js";
19
+ import { S as Ee } from "./search-QbWPlY5f.js";
20
+ import { c as Vt } from "./createLucideIcon-DhHxpK9K.js";
21
+ import { G as Ut } from "./grip-vertical-onSb1JXO.js";
22
+ import { P as Xt } from "./printer-rkK0T1gi.js";
23
+ import { F as Qe } from "./file-text-5yv6r2ls.js";
24
+ import { D as ye } from "./download-CfYKJO_j.js";
25
+ import { F as Qt } from "./file-spreadsheet-DmwyfV4O.js";
26
+ import Jt from "i18next";
27
+ import { S as Zt } from "./select-BW5ecXlX.js";
28
+ import { u as Yt } from "./registry-DvAUVLHh.js";
29
+ import { u as er } from "./use-prefers-reduced-motion-BMwIQRjB.js";
30
+ import { u as tr } from "./use-theme-CAuo6EYT.js";
31
+ import { E as rr } from "./ellipsis-dRo9ouSU.js";
32
+ /**
33
+ * @license lucide-react v1.22.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */
38
+ const nr = [
39
+ ["path", { d: "M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5", key: "1g2yzs" }],
40
+ ["path", { d: "m14.3 19.6 1-.4", key: "11sv9r" }],
41
+ ["path", { d: "M15 3v7.5", key: "7lm50a" }],
42
+ ["path", { d: "m15.2 16.9-.9-.3", key: "1t7mvx" }],
43
+ ["path", { d: "m16.6 21.7.3-.9", key: "1j67ps" }],
44
+ ["path", { d: "m16.8 15.3-.4-1", key: "1ei7r6" }],
45
+ ["path", { d: "m19.1 15.2.3-.9", key: "18r7jp" }],
46
+ ["path", { d: "m19.6 21.7-.4-1", key: "z2vh2" }],
47
+ ["path", { d: "m20.7 16.8 1-.4", key: "19m87a" }],
48
+ ["path", { d: "m21.7 19.4-.9-.3", key: "1qgwi9" }],
49
+ ["path", { d: "M9 3v18", key: "fh3hqa" }],
50
+ ["circle", { cx: "18", cy: "18", r: "3", key: "1xkwt0" }]
51
+ ], ar = Vt("columns-3-cog", nr);
52
+ function or(e) {
53
+ if (!He(e)) return e;
54
+ const t = e, o = t.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(o) ? o : `${o} ds:size-4`.trim();
55
+ return Ve(t, { className: n, size: t.props.size ?? 16 });
56
+ }
57
+ const Je = Re(null);
58
+ function V(e) {
59
+ const t = Se(Je);
60
+ if (!t)
61
+ throw new Error(
62
+ `${e} must be rendered inside <DataTable.Toolbar> as a descendant of <DataTable>.`
63
+ );
64
+ return t;
65
+ }
66
+ function sr({
67
+ getApi: e,
68
+ selectionCount: t,
69
+ onPrint: o,
70
+ markColumnsUserTouched: n,
71
+ children: s
72
+ }) {
73
+ const d = j(
74
+ () => ({ getApi: e, selectionCount: t, onPrint: o, markColumnsUserTouched: n }),
75
+ [e, t, o, n]
76
+ );
77
+ return /* @__PURE__ */ i(Je.Provider, { value: d, children: s });
78
+ }
79
+ const ir = [
80
+ "data-table-toolbar",
81
+ // Mobile (<sm) keeps `flex-wrap` so a wide QuickSearch can flow above the
82
+ // Actions cluster on narrow screens. From `sm` (≥640px) we switch to
83
+ // `flex-nowrap` + `min-w-0` so the row stays single-line at every common
84
+ // desktop width (1024 / 1280 / 1440) — the QuickSearch slot shrinks via
85
+ // its own `min-w-0` instead of pushing the trailing Actions to a new row.
86
+ "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
87
+ "ds:sm:flex-nowrap ds:min-w-0"
88
+ // No card surface: the toolbar sits directly on the page background,
89
+ // matching the header-tools layout the Patients / Care Plan List
90
+ // patterns established (the old bg-card + border + shadow bar is gone).
91
+ ].join(" "), Ze = $(
92
+ ({ className: e, children: t, ...o }, n) => /* @__PURE__ */ i(
93
+ "div",
94
+ {
95
+ ref: n,
96
+ role: "toolbar",
97
+ className: [ir, e ?? ""].join(" ").trim(),
98
+ ...o,
99
+ children: t
100
+ }
101
+ )
102
+ );
103
+ Ze.displayName = "DataTable.Toolbar";
104
+ const Ye = $(
105
+ ({ className: e, children: t, ...o }, n) => /* @__PURE__ */ i(
106
+ "div",
107
+ {
108
+ ref: n,
109
+ className: [
110
+ "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
111
+ // `grow` lets FilterBar absorb the free space; `min-w-0` lets the
112
+ // QuickSearch slot inside shrink below its intrinsic width when the
113
+ // toolbar runs `flex-nowrap` at `sm` and above, so the trailing
114
+ // Actions cluster stays pinned on a single row.
115
+ "ds:grow ds:min-w-0",
116
+ e ?? ""
117
+ ].join(" ").trim(),
118
+ ...o,
119
+ children: t
120
+ }
121
+ )
122
+ );
123
+ Ye.displayName = "DataTable.Toolbar.FilterBar";
124
+ const et = $(
125
+ ({ className: e, children: t, ...o }, n) => /* @__PURE__ */ i(
126
+ "div",
127
+ {
128
+ ref: n,
129
+ className: [
130
+ "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
131
+ "ds:ms-auto",
132
+ e ?? ""
133
+ ].join(" ").trim(),
134
+ ...o,
135
+ children: t
136
+ }
137
+ )
138
+ );
139
+ et.displayName = "DataTable.Toolbar.Actions";
140
+ const Ne = $(
141
+ ({ label: e, onExport: t, intent: o = "outline", ...n }, s) => {
142
+ const { t: d } = A(), { getApi: m } = V("DataTable.Toolbar.ExportCsv"), g = N(() => {
143
+ const p = m();
144
+ p && (t ? t(p) : p.exportDataAsCsv());
145
+ }, [m, t]);
146
+ return /* @__PURE__ */ i(
147
+ Q,
148
+ {
149
+ ref: s,
150
+ type: "button",
151
+ intent: o,
152
+ icon: /* @__PURE__ */ i(ye, { "aria-hidden": !0 }),
153
+ tooltip: e ?? d("dataTable.exportCsv"),
154
+ onClick: g,
155
+ ...n
156
+ }
157
+ );
158
+ }
159
+ );
160
+ Ne.displayName = "DataTable.Toolbar.ExportCsv";
161
+ function oe(e, t = [30, 30, 30]) {
162
+ if (typeof document > "u") return t;
163
+ const o = document.createElement("span");
164
+ o.style.color = `hsl(var(${e}))`, o.style.position = "absolute", o.style.visibility = "hidden", document.body.appendChild(o);
165
+ const n = getComputedStyle(o).color;
166
+ document.body.removeChild(o);
167
+ const s = n.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
168
+ return s ? [Number(s[1]), Number(s[2]), Number(s[3])] : t;
169
+ }
170
+ async function tt(e, t) {
171
+ if (!e) return;
172
+ const [{ jsPDF: o }, { default: n }] = await Promise.all([
173
+ import("./jspdf.es.min-DaapWjR1.js").then((y) => y.j),
174
+ import("./jspdf.plugin.autotable-CSiDNyPn.js")
175
+ ]), d = (e.getColumns() ?? []).filter((y) => y.isVisible()), m = [
176
+ d.map((y) => e.getDisplayNameForColumn(y, null) ?? "")
177
+ ], g = [];
178
+ e.forEachNodeAfterFilterAndSort((y) => {
179
+ if (!y.data) return;
180
+ const c = d.map((f) => {
181
+ const w = e.getCellValue({
182
+ rowNode: y,
183
+ colKey: f,
184
+ useFormatter: !0
185
+ });
186
+ return w == null ? "" : String(w);
187
+ });
188
+ g.push(c);
189
+ });
190
+ const p = oe("--muted", [240, 240, 240]), h = oe("--foreground", [30, 30, 30]), u = oe("--card-foreground", [30, 30, 30]), b = oe("--card", [250, 250, 250]), T = new o({ orientation: "landscape" });
191
+ n(T, {
192
+ head: m,
193
+ body: g,
194
+ headStyles: { fillColor: p, textColor: h },
195
+ bodyStyles: { textColor: u },
196
+ alternateRowStyles: { fillColor: b },
197
+ styles: {
198
+ font: "helvetica",
199
+ fontSize: 10,
200
+ cellPadding: 4
201
+ }
202
+ }), T.save(t.fileName);
203
+ }
204
+ const De = $(
205
+ ({ label: e, onClick: t, fileName: o, intent: n = "outline", ...s }, d) => {
206
+ const { t: m } = A(), { getApi: g } = V("DataTable.Toolbar.ExportPdf"), p = N(() => {
207
+ const h = g();
208
+ if (t) {
209
+ t(h);
210
+ return;
211
+ }
212
+ tt(h, {
213
+ fileName: o ?? "data-table-export.pdf"
214
+ });
215
+ }, [g, t, o]);
216
+ return /* @__PURE__ */ i(
217
+ Q,
218
+ {
219
+ ref: d,
220
+ type: "button",
221
+ intent: n,
222
+ icon: /* @__PURE__ */ i(Qe, { "aria-hidden": !0 }),
223
+ tooltip: e ?? m("dataTable.exportPdf"),
224
+ onClick: p,
225
+ ...s
226
+ }
227
+ );
228
+ }
229
+ );
230
+ De.displayName = "DataTable.Toolbar.ExportPdf";
231
+ const Fe = $(
232
+ ({ label: e, intent: t = "outline", ...o }, n) => {
233
+ const { t: s } = A(), { onPrint: d } = V("DataTable.Toolbar.Print");
234
+ return /* @__PURE__ */ i(
235
+ Q,
236
+ {
237
+ ref: n,
238
+ type: "button",
239
+ intent: t,
240
+ icon: /* @__PURE__ */ i(Xt, { "aria-hidden": !0 }),
241
+ tooltip: e ?? s("dataTable.print"),
242
+ onClick: d,
243
+ ...o
244
+ }
245
+ );
246
+ }
247
+ );
248
+ Fe.displayName = "DataTable.Toolbar.Print";
249
+ const rt = ({ placeholder: e, debounceMs: t = 150 }) => {
250
+ const { t: o } = A(), { getApi: n } = V("DataTable.Toolbar.QuickSearch"), [s, d] = _(""), m = W(void 0);
251
+ return K(() => (m.current && window.clearTimeout(m.current), m.current = window.setTimeout(() => {
252
+ const g = n();
253
+ g && g.setGridOption("quickFilterText", s);
254
+ }, t), () => {
255
+ m.current && window.clearTimeout(m.current);
256
+ }), [s, t, n]), // Slot wrapper caps the search at a sensible legible width on desktop —
257
+ // without this, TextInput's `w-full` lets the QuickSearch absorb the
258
+ // entire FilterBar row and push trailing Actions onto a second line at
259
+ // 1024 / 1280 / 1440. `min-w-0` lets the slot shrink below `24rem` when
260
+ // the toolbar is squeezed on narrow viewports. There is no
261
+ // `--toolbar-search-max` token in the kit yet — see this component's
262
+ // summary for a follow-up note recommending we add one.
263
+ /* @__PURE__ */ i("div", { className: "ds:w-full ds:max-w-[24rem] ds:min-w-0", children: /* @__PURE__ */ i(
264
+ Ie,
265
+ {
266
+ type: "search",
267
+ size: "sm",
268
+ value: s,
269
+ onChange: (g) => d(g.target.value),
270
+ placeholder: e ?? o("dataTable.quickSearch.placeholder", "Search…"),
271
+ startAdornment: /* @__PURE__ */ i(Ee, { "aria-hidden": !0, className: "ds:size-4" }),
272
+ clearable: !0,
273
+ onClear: () => d(""),
274
+ "aria-label": o("dataTable.quickSearch.label", "Quick search")
275
+ }
276
+ ) });
277
+ };
278
+ rt.displayName = "DataTable.Toolbar.QuickSearch";
279
+ const ke = $(
280
+ ({ onRefresh: e, label: t, intent: o = "outline", ...n }, s) => {
281
+ const { t: d } = A();
282
+ return /* @__PURE__ */ i(
283
+ Q,
284
+ {
285
+ ref: s,
286
+ type: "button",
287
+ intent: o,
288
+ icon: /* @__PURE__ */ i(Ht, { "aria-hidden": !0 }),
289
+ tooltip: t ?? d("dataTable.refresh", "Refresh"),
290
+ onClick: e,
291
+ ...n
292
+ }
293
+ );
294
+ }
295
+ );
296
+ ke.displayName = "DataTable.Toolbar.Refresh";
297
+ function lr(e) {
298
+ if (!e || typeof e != "object") return "";
299
+ const t = e;
300
+ if (typeof t.filter == "string" || typeof t.filter == "number") {
301
+ const o = typeof t.type == "string" ? t.type : "", n = typeof t.filterTo == "string" || typeof t.filterTo == "number" ? String(t.filterTo) : "";
302
+ return o === "inRange" && n ? `${t.filter} – ${n}` : o ? `${o} ${t.filter}` : String(t.filter);
303
+ }
304
+ return typeof t.dateFrom == "string" ? typeof t.dateTo == "string" && t.dateTo ? `${t.dateFrom} – ${t.dateTo}` : String(t.dateFrom) : Array.isArray(t.values) ? t.values.map(String).join(", ") : "";
305
+ }
306
+ const nt = () => {
307
+ const { t: e } = A(), { getApi: t } = V("DataTable.Toolbar.FilterChips"), [o, n] = _([]), [s, d] = _(""), m = N(() => {
308
+ const u = t();
309
+ if (!u) {
310
+ n([]), d("");
311
+ return;
312
+ }
313
+ const b = u.getFilterModel() ?? {}, T = u.getColumns() ?? [], y = [];
314
+ for (const f of Object.keys(b)) {
315
+ const w = T.find((S) => S.getColId() === f), C = u.getDisplayNameForColumn(w, null) ?? f;
316
+ y.push({
317
+ colId: f,
318
+ headerName: C,
319
+ text: lr(b[f])
320
+ });
321
+ }
322
+ n(y);
323
+ const c = u.getGridOption("quickFilterText");
324
+ d(typeof c == "string" ? c : "");
325
+ }, [t]);
326
+ if (K(() => {
327
+ let u;
328
+ const b = (c) => m(), T = (c) => {
329
+ c.addEventListener("filterChanged", b), m(), u = () => c.removeEventListener("filterChanged", b);
330
+ }, y = t();
331
+ if (y)
332
+ T(y);
333
+ else {
334
+ const c = window.setInterval(() => {
335
+ const f = t();
336
+ f && (window.clearInterval(c), T(f));
337
+ }, 50);
338
+ u = () => window.clearInterval(c);
339
+ }
340
+ return () => u == null ? void 0 : u();
341
+ }, [t, m]), o.length + (s ? 1 : 0) === 0) return null;
342
+ function p(u) {
343
+ const b = t();
344
+ b && b.destroyFilter(u);
345
+ }
346
+ function h() {
347
+ const u = t();
348
+ u && (u.setFilterModel(null), u.setGridOption("quickFilterText", ""), d(""));
349
+ }
350
+ return /* @__PURE__ */ G(
351
+ "div",
352
+ {
353
+ role: "group",
354
+ "aria-label": e("dataTable.filterChips.label", "Active filters"),
355
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
356
+ children: [
357
+ s && /* @__PURE__ */ i(
358
+ We,
359
+ {
360
+ label: `${e("dataTable.quickSearch.label", "Quick search")}: ${s}`,
361
+ size: "sm",
362
+ fill: "outline",
363
+ onRemove: () => {
364
+ const u = t();
365
+ u == null || u.setGridOption("quickFilterText", ""), d("");
366
+ }
367
+ }
368
+ ),
369
+ o.map((u) => /* @__PURE__ */ i(
370
+ We,
371
+ {
372
+ label: u.text ? `${u.headerName}: ${u.text}` : u.headerName,
373
+ size: "sm",
374
+ fill: "outline",
375
+ onRemove: () => p(u.colId)
376
+ },
377
+ u.colId
378
+ )),
379
+ /* @__PURE__ */ i(
380
+ ce,
381
+ {
382
+ type: "button",
383
+ intent: "ghost",
384
+ size: "sm",
385
+ onClick: h,
386
+ startIcon: /* @__PURE__ */ i(Xe, { "aria-hidden": !0, className: "ds:size-4" }),
387
+ children: e("dataTable.filterChips.clearAll", "Clear all")
388
+ }
389
+ )
390
+ ]
391
+ }
392
+ );
393
+ };
394
+ nt.displayName = "DataTable.Toolbar.FilterChips";
395
+ const at = ({
396
+ field: e,
397
+ options: t,
398
+ label: o
399
+ }) => {
400
+ const { t: n } = A(), { getApi: s } = V("DataTable.Toolbar.FacetFilter"), [d, m] = _(null);
401
+ function g(p) {
402
+ m(p);
403
+ const h = s();
404
+ if (h) {
405
+ if (p === null) {
406
+ h.destroyFilter(e);
407
+ return;
408
+ }
409
+ h.setColumnFilterModel(e, {
410
+ type: "equals",
411
+ filter: p
412
+ }), h.onFilterChanged();
413
+ }
414
+ }
415
+ return /* @__PURE__ */ i(
416
+ "div",
417
+ {
418
+ role: "group",
419
+ "aria-label": o ?? n("dataTable.facetFilter.label", "Filter"),
420
+ className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
421
+ children: t.map((p) => {
422
+ const h = d === p.value;
423
+ return /* @__PURE__ */ i(
424
+ ce,
425
+ {
426
+ type: "button",
427
+ size: "sm",
428
+ intent: h ? "primary" : "secondary",
429
+ "aria-pressed": h,
430
+ onClick: () => g(p.value),
431
+ children: p.label
432
+ },
433
+ String(p.value)
434
+ );
435
+ })
436
+ }
437
+ );
438
+ };
439
+ at.displayName = "DataTable.Toolbar.FacetFilter";
440
+ const dr = ["csv", "xlsx", "pdf"];
441
+ async function cr(e, t) {
442
+ if (!e) return;
443
+ const o = await import("./exceljs.min-D2MHbJsF.js").then((f) => f.e), n = new o.Workbook(), s = n.addWorksheet("Sheet1"), m = (e.getColumns() ?? []).filter((f) => f.isVisible());
444
+ s.addRow(
445
+ m.map(
446
+ (f) => e.getDisplayNameForColumn(f, null) ?? f.getColId()
447
+ )
448
+ ), e.forEachNodeAfterFilterAndSort((f) => {
449
+ f.data && s.addRow(
450
+ m.map((w) => {
451
+ const C = e.getCellValue({
452
+ rowNode: f,
453
+ colKey: w,
454
+ useFormatter: !0
455
+ });
456
+ return C ?? "";
457
+ })
458
+ );
459
+ });
460
+ const g = oe("--muted", [240, 240, 240]), p = oe("--foreground", [30, 30, 30]), h = s.getRow(1), u = ([f, w, C]) => `${f.toString(16).padStart(2, "0")}${w.toString(16).padStart(2, "0")}${C.toString(16).padStart(2, "0")}`.toUpperCase();
461
+ h.eachCell((f) => {
462
+ f.font = { bold: !0, color: { argb: `FF${u(p)}` } }, f.fill = {
463
+ type: "pattern",
464
+ pattern: "solid",
465
+ fgColor: { argb: `FF${u(g)}` }
466
+ };
467
+ });
468
+ const b = await n.xlsx.writeBuffer(), T = new Blob([b], {
469
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
470
+ }), y = URL.createObjectURL(T), c = document.createElement("a");
471
+ c.href = y, c.download = t.fileName, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(y);
472
+ }
473
+ const ot = Re(null);
474
+ function ur() {
475
+ const e = Se(ot);
476
+ if (!e)
477
+ throw new Error(
478
+ "DataTable.Toolbar.ExportMenu.Item must be rendered inside DataTable.Toolbar.ExportMenu."
479
+ );
480
+ return e;
481
+ }
482
+ const Ae = $(
483
+ ({ children: e, label: t, intent: o = "outline", ...n }, s) => {
484
+ const { t: d } = A(), { getApi: m } = V("DataTable.Toolbar.ExportMenu"), g = j(() => ({ getApi: m }), [m]), p = e ?? dr.map((h) => /* @__PURE__ */ i(Pe, { format: h }, h));
485
+ return /* @__PURE__ */ i(ot.Provider, { value: g, children: /* @__PURE__ */ G(X.Root, { children: [
486
+ /* @__PURE__ */ i(X.Trigger, { asChild: !0, children: /* @__PURE__ */ i(
487
+ Q,
488
+ {
489
+ ref: s,
490
+ type: "button",
491
+ intent: o,
492
+ icon: /* @__PURE__ */ i(ye, { "aria-hidden": !0 }),
493
+ tooltip: t ?? d("dataTable.export.menu", "Export"),
494
+ "aria-label": t ?? d("dataTable.export.menu", "Export"),
495
+ "aria-haspopup": "menu",
496
+ ...n
497
+ }
498
+ ) }),
499
+ /* @__PURE__ */ i(X.Content, { align: "end", sideOffset: 4, children: p })
500
+ ] }) });
501
+ }
502
+ );
503
+ Ae.displayName = "DataTable.Toolbar.ExportMenu";
504
+ function pr(e, t) {
505
+ return t === "csv" ? e("dataTable.export.csv", "Export CSV") : t === "xlsx" ? e("dataTable.export.xlsx", "Export Excel") : t === "pdf" ? e("dataTable.export.pdf", "Export PDF") : e("dataTable.export.custom", "Export");
506
+ }
507
+ function fr(e) {
508
+ return e === "csv" ? /* @__PURE__ */ i(ye, { "aria-hidden": !0, className: "ds:size-4" }) : e === "xlsx" ? /* @__PURE__ */ i(Qt, { "aria-hidden": !0, className: "ds:size-4" }) : e === "pdf" ? /* @__PURE__ */ i(Qe, { "aria-hidden": !0, className: "ds:size-4" }) : /* @__PURE__ */ i(ye, { "aria-hidden": !0, className: "ds:size-4" });
509
+ }
510
+ const Pe = ({
511
+ format: e,
512
+ label: t,
513
+ onClick: o,
514
+ fileName: n
515
+ }) => {
516
+ const { t: s } = A(), { getApi: d } = ur(), m = N(() => {
517
+ const g = d();
518
+ if (e === "csv") {
519
+ g == null || g.exportDataAsCsv();
520
+ return;
521
+ }
522
+ if (e === "pdf") {
523
+ tt(g, {
524
+ fileName: n ?? "data-table-export.pdf"
525
+ });
526
+ return;
527
+ }
528
+ if (e === "xlsx") {
529
+ cr(g, {
530
+ fileName: n ?? "data-table-export.xlsx"
531
+ });
532
+ return;
533
+ }
534
+ o == null || o(g);
535
+ }, [e, n, o, d]);
536
+ return /* @__PURE__ */ i(X.Item, { onSelect: m, children: /* @__PURE__ */ G("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
537
+ fr(e),
538
+ /* @__PURE__ */ i("span", { children: t ?? pr(s, e) })
539
+ ] }) });
540
+ };
541
+ Pe.displayName = "DataTable.Toolbar.ExportMenu.Item";
542
+ function mr(e) {
543
+ if (!e) return [];
544
+ const t = (n) => n.getPinned() === "left" ? 0 : n.getPinned() === "right" ? 2 : 1;
545
+ return [...e.getAllGridColumns() ?? []].sort(
546
+ (n, s) => t(n) - t(s)
547
+ ).map((n) => n.getColDef().hide === void 0 && n.getColId().startsWith("ag-Grid-") ? null : {
548
+ colId: n.getColId(),
549
+ displayName: e.getDisplayNameForColumn(n, null) || n.getColId(),
550
+ visible: n.isVisible()
551
+ }).filter((n) => n !== null);
552
+ }
553
+ const Oe = $(
554
+ function({ label: t, icon: o, footer: n, header: s, intent: d = "outline", ...m }, g) {
555
+ const { t: p } = A(), { getApi: h, markColumnsUserTouched: u } = V(
556
+ "DataTable.Toolbar.ColumnToggle"
557
+ ), [b, T] = _(!1), [y, c] = _([]), [f, w] = _(null), [C, S] = _(null);
558
+ K(() => {
559
+ b && c(mr(h()));
560
+ }, [b, h]);
561
+ const I = N(
562
+ (R, O) => {
563
+ const z = h();
564
+ z && (z.setColumnsVisible([R], O), u == null || u([R]), c(
565
+ (F) => F.map(
566
+ (D) => D.colId === R ? { ...D, visible: O } : D
567
+ )
568
+ ));
569
+ },
570
+ [h, u]
571
+ ), re = N(
572
+ (R, O) => {
573
+ if (R === O) return;
574
+ const z = h();
575
+ if (!z) return;
576
+ c((M) => {
577
+ const E = M.findIndex((Z) => Z.colId === R), ie = M.findIndex((Z) => Z.colId === O);
578
+ if (E < 0 || ie < 0) return M;
579
+ const J = [...M], [xe] = J.splice(E, 1);
580
+ return J.splice(ie, 0, xe), J;
581
+ });
582
+ const F = z.getAllGridColumns(), D = F.find((M) => M.getColId() === R), q = F.find((M) => M.getColId() === O);
583
+ if (!D || !q) return;
584
+ D.getPinned() !== q.getPinned() && z.setColumnsPinned([R], q.getPinned() ?? null);
585
+ const U = z.getAllGridColumns().findIndex((M) => M.getColId() === O);
586
+ U >= 0 && z.moveColumns([R], U);
587
+ },
588
+ [h]
589
+ ), L = t ?? p("dataTable.columnToggle");
590
+ return /* @__PURE__ */ G(ge.Root, { open: b, onOpenChange: T, children: [
591
+ /* @__PURE__ */ i(ge.Trigger, { asChild: !0, children: /* @__PURE__ */ i(
592
+ Q,
593
+ {
594
+ ref: g,
595
+ type: "button",
596
+ intent: d,
597
+ icon: o ?? /* @__PURE__ */ i(ar, { "aria-hidden": !0 }),
598
+ tooltip: L,
599
+ "aria-label": L,
600
+ "aria-haspopup": "dialog",
601
+ ...m
602
+ }
603
+ ) }),
604
+ /* @__PURE__ */ G(
605
+ ge.Content,
606
+ {
607
+ size: "sm",
608
+ align: "end",
609
+ className: "ds:flex ds:max-h-[var(--radix-popover-content-available-height)] ds:flex-col",
610
+ children: [
611
+ /* @__PURE__ */ i(ge.Heading, { children: L }),
612
+ s ? /* @__PURE__ */ i("div", { className: "ds:mb-[var(--spacing-xs)] ds:border-b ds:border-[color:var(--border)] ds:pb-[var(--spacing-sm)]", children: s }) : null,
613
+ /* @__PURE__ */ i(
614
+ "ul",
615
+ {
616
+ className: "ds:flex ds:min-h-0 ds:flex-col ds:gap-[var(--spacing-xs)] ds:overflow-y-auto",
617
+ "aria-label": L,
618
+ children: y.map((R) => {
619
+ const O = f === R.colId, z = C === R.colId && f !== R.colId;
620
+ return /* @__PURE__ */ G(
621
+ "li",
622
+ {
623
+ draggable: !0,
624
+ onDragStart: (F) => {
625
+ w(R.colId), F.dataTransfer.effectAllowed = "move", F.dataTransfer.setData("text/plain", R.colId);
626
+ },
627
+ onDragOver: (F) => {
628
+ F.preventDefault(), F.dataTransfer.dropEffect = "move", S(R.colId);
629
+ },
630
+ onDragLeave: () => {
631
+ S(
632
+ (F) => F === R.colId ? null : F
633
+ );
634
+ },
635
+ onDrop: (F) => {
636
+ F.preventDefault();
637
+ const D = F.dataTransfer.getData("text/plain");
638
+ D && re(D, R.colId), w(null), S(null);
639
+ },
640
+ onDragEnd: () => {
641
+ w(null), S(null);
642
+ },
643
+ className: [
644
+ "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-xs)] ds:py-[var(--spacing-2xs,var(--spacing-xs))] ds:transition-colors",
645
+ O ? "ds:opacity-50" : "",
646
+ z ? "ds:bg-[color:color-mix(in_srgb,var(--primary)_8%,transparent)]" : ""
647
+ ].filter(Boolean).join(" "),
648
+ children: [
649
+ /* @__PURE__ */ i(
650
+ "span",
651
+ {
652
+ "aria-hidden": "true",
653
+ className: "ds:cursor-grab ds:text-[color:var(--muted-foreground)] ds:active:cursor-grabbing",
654
+ children: /* @__PURE__ */ i(Ut, { className: "ds:size-4" })
655
+ }
656
+ ),
657
+ /* @__PURE__ */ i(
658
+ Kt,
659
+ {
660
+ label: R.displayName,
661
+ checked: R.visible,
662
+ onCheckedChange: (F) => I(R.colId, F === !0)
663
+ }
664
+ )
665
+ ]
666
+ },
667
+ R.colId
668
+ );
669
+ })
670
+ }
671
+ ),
672
+ n ? /* @__PURE__ */ i("div", { className: "ds:mt-[var(--spacing-xs)] ds:border-t ds:border-[color:var(--border)] ds:pt-[var(--spacing-sm)]", children: n }) : null
673
+ ]
674
+ }
675
+ )
676
+ ] });
677
+ }
678
+ );
679
+ Oe.displayName = "DataTable.Toolbar.ColumnToggle";
680
+ const st = $(
681
+ ({ label: e, icon: t, onClick: o, variant: n = "default", size: s = "sm", ...d }, m) => {
682
+ const { t: g } = A(), { getApi: p, selectionCount: h } = V(
683
+ "DataTable.Toolbar.BulkAction"
684
+ );
685
+ return h === 0 ? null : /* @__PURE__ */ G(
686
+ ce,
687
+ {
688
+ ref: m,
689
+ type: "button",
690
+ intent: n === "destructive" ? "destructive" : "secondary",
691
+ size: s,
692
+ startIcon: or(t),
693
+ onClick: () => o(p()),
694
+ "aria-label": `${e} (${g("dataTable.bulkAction", { count: h })})`,
695
+ ...d,
696
+ children: [
697
+ /* @__PURE__ */ i("span", { children: e }),
698
+ /* @__PURE__ */ i(
699
+ "span",
700
+ {
701
+ "aria-hidden": "true",
702
+ className: "ds:ms-[var(--spacing-xs)] ds:opacity-80",
703
+ children: g("dataTable.bulkAction", { count: h })
704
+ }
705
+ )
706
+ ]
707
+ }
708
+ );
709
+ }
710
+ );
711
+ st.displayName = "DataTable.Toolbar.BulkAction";
712
+ for (const e of [
713
+ Ne,
714
+ De,
715
+ Fe,
716
+ ke,
717
+ Ae,
718
+ Oe
719
+ ])
720
+ e.rendersIconButton = !0;
721
+ const gr = Object.assign(Ae, {
722
+ Item: Pe
723
+ }), be = Object.assign(Ze, {
724
+ FilterBar: Ye,
725
+ Actions: et,
726
+ /** @deprecated Use `Toolbar.ExportMenu` with a `csv` item. */
727
+ ExportCsv: Ne,
728
+ /** @deprecated Use `Toolbar.ExportMenu` with a `pdf` item. */
729
+ ExportPdf: De,
730
+ Print: Fe,
731
+ ColumnToggle: Oe,
732
+ BulkAction: st,
733
+ QuickSearch: rt,
734
+ Refresh: ke,
735
+ FilterChips: nt,
736
+ FacetFilter: at,
737
+ ExportMenu: gr
738
+ }), hr = [
739
+ "contains",
740
+ "equals",
741
+ "startsWith",
742
+ "endsWith",
743
+ "notContains"
744
+ ];
745
+ function br(e) {
746
+ const t = new Intl.Collator(e, {
747
+ sensitivity: "base",
748
+ usage: "search"
749
+ });
750
+ function o(n, s) {
751
+ if (s.length === 0) return 0;
752
+ if (s.length > n.length) return -1;
753
+ for (let d = 0; d <= n.length - s.length; d += 1)
754
+ if (t.compare(n.slice(d, d + s.length), s) === 0)
755
+ return d;
756
+ return -1;
757
+ }
758
+ return {
759
+ equals: (n, s) => t.compare(n, s) === 0,
760
+ contains: (n, s) => o(n, s) !== -1,
761
+ startsWith: (n, s) => s.length <= n.length && t.compare(n.slice(0, s.length), s) === 0,
762
+ endsWith: (n, s) => s.length <= n.length && t.compare(
763
+ n.slice(n.length - s.length),
764
+ s
765
+ ) === 0
766
+ };
767
+ }
768
+ function yr(e) {
769
+ return e == null ? null : typeof e == "string" ? e : String(e);
770
+ }
771
+ function xr(e) {
772
+ const { model: t, onModelChange: o, getValue: n, placeholder: s, defaultOperator: d } = e, { t: m } = A("ui"), g = (t == null ? void 0 : t.type) ?? d ?? "contains", [p, h] = _(g), [u, b] = _((t == null ? void 0 : t.filter) ?? "");
773
+ K(() => {
774
+ h((t == null ? void 0 : t.type) ?? d ?? "contains"), b((t == null ? void 0 : t.filter) ?? "");
775
+ }, [t, d]);
776
+ const T = j(() => br(Jt.language), []);
777
+ qt({
778
+ doesFilterPass: (C) => {
779
+ const S = t;
780
+ if (!S || S.filter === "") return !0;
781
+ const I = yr(n(C.node));
782
+ if (I === null) return !1;
783
+ switch (S.type) {
784
+ case "equals":
785
+ return T.equals(I, S.filter);
786
+ case "contains":
787
+ return T.contains(I, S.filter);
788
+ case "startsWith":
789
+ return T.startsWith(I, S.filter);
790
+ case "endsWith":
791
+ return T.endsWith(I, S.filter);
792
+ case "notContains":
793
+ return !T.contains(I, S.filter);
794
+ default:
795
+ return !0;
796
+ }
797
+ }
798
+ });
799
+ function y() {
800
+ if (u.trim() === "") {
801
+ o(null);
802
+ return;
803
+ }
804
+ o({ type: p, filter: u });
805
+ }
806
+ function c() {
807
+ b(""), h(d ?? "contains"), o(null);
808
+ }
809
+ const f = hr.map(
810
+ (C) => ({
811
+ value: C,
812
+ label: m(`dataTable.textFilter.operators.${C}`)
813
+ })
814
+ ), w = s ?? m("dataTable.textFilter.placeholder");
815
+ return /* @__PURE__ */ G(
816
+ "div",
817
+ {
818
+ "data-component": "text-filter",
819
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]",
820
+ children: [
821
+ /* @__PURE__ */ i(
822
+ Zt,
823
+ {
824
+ size: "sm",
825
+ options: f,
826
+ value: p,
827
+ onValueChange: (C) => {
828
+ C !== "" && h(C);
829
+ },
830
+ "aria-label": m("dataTable.textFilter.operators.contains")
831
+ }
832
+ ),
833
+ /* @__PURE__ */ i(
834
+ Ie,
835
+ {
836
+ size: "sm",
837
+ value: u,
838
+ onChange: (C) => b(C.target.value),
839
+ onKeyDown: (C) => {
840
+ C.key === "Enter" && (C.preventDefault(), y());
841
+ },
842
+ placeholder: w,
843
+ "aria-label": w,
844
+ startAdornment: /* @__PURE__ */ i(Ee, { "aria-hidden": "true", className: "ds:size-4" })
845
+ }
846
+ ),
847
+ /* @__PURE__ */ G("div", { className: "ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: [
848
+ /* @__PURE__ */ i(ce, { intent: "ghost", size: "sm", onClick: c, type: "button", children: m("dataTable.textFilter.clear") }),
849
+ /* @__PURE__ */ i(ce, { intent: "primary", size: "sm", onClick: y, type: "button", children: m("dataTable.textFilter.apply") })
850
+ ] })
851
+ ]
852
+ }
853
+ );
854
+ }
855
+ function vr(e) {
856
+ var b, T;
857
+ const { model: t, onModelChange: o, column: n } = e, { t: s } = A("ui"), d = ((T = (b = n == null ? void 0 : n.getColDef) == null ? void 0 : b.call(n)) == null ? void 0 : T.filterParams) ?? {}, m = d.defaultOperator ?? "contains", g = d.placeholder ?? s("dataTable.textFilter.placeholder"), [p, h] = _((t == null ? void 0 : t.filter) ?? "");
858
+ K(() => {
859
+ h((t == null ? void 0 : t.filter) ?? "");
860
+ }, [t == null ? void 0 : t.filter]), K(() => {
861
+ if (p === ((t == null ? void 0 : t.filter) ?? "")) return;
862
+ const y = setTimeout(() => {
863
+ if (p === "") {
864
+ t && o(null);
865
+ return;
866
+ }
867
+ o({ type: m, filter: p });
868
+ }, 200);
869
+ return () => clearTimeout(y);
870
+ }, [p, m, t, o]);
871
+ function u() {
872
+ h(""), t && o(null);
873
+ }
874
+ return /* @__PURE__ */ i("div", { "data-component": "text-floating-filter", className: "ds:w-full", children: /* @__PURE__ */ i(
875
+ Ie,
876
+ {
877
+ size: "sm",
878
+ value: p,
879
+ onChange: (y) => h(y.target.value),
880
+ placeholder: g,
881
+ "aria-label": g,
882
+ startAdornment: /* @__PURE__ */ i(Ee, { "aria-hidden": "true", className: "ds:size-4" }),
883
+ endAdornment: p.length > 0 ? /* @__PURE__ */ i(
884
+ "button",
885
+ {
886
+ type: "button",
887
+ "aria-label": s("dataTable.textFilter.clear"),
888
+ onClick: u,
889
+ className: "ds:pointer-events-auto ds:flex ds:items-center ds:text-[var(--muted-foreground)] ds:hover:text-[var(--foreground)] ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
890
+ children: /* @__PURE__ */ i(Xe, { "aria-hidden": "true", className: "ds:size-4" })
891
+ }
892
+ ) : void 0
893
+ }
894
+ ) });
895
+ }
896
+ const Tr = /* @__PURE__ */ new Set(["presentation", "none"]), $e = '[role="presentation"][aria-hidden], [role="none"][aria-hidden]';
897
+ function he(e) {
898
+ const t = e.getAttribute("role");
899
+ t === null || !Tr.has(t) || e.getAttribute("aria-hidden") === "false" && e.removeAttribute("aria-hidden");
900
+ }
901
+ function wr(e, t = !0) {
902
+ K(() => {
903
+ const o = e.current;
904
+ if (!t || !o || typeof MutationObserver > "u") return;
905
+ (() => {
906
+ for (const d of o.querySelectorAll($e)) he(d);
907
+ })();
908
+ const s = new MutationObserver((d) => {
909
+ for (const m of d)
910
+ if (m.type === "attributes")
911
+ he(m.target);
912
+ else
913
+ for (const g of m.addedNodes)
914
+ if (g instanceof Element) {
915
+ he(g);
916
+ for (const p of g.querySelectorAll($e))
917
+ he(p);
918
+ }
919
+ });
920
+ return s.observe(o, {
921
+ subtree: !0,
922
+ childList: !0,
923
+ attributes: !0,
924
+ attributeFilter: ["aria-hidden"]
925
+ }), () => s.disconnect();
926
+ }, [e, t]);
927
+ }
928
+ const se = "__dsDetailOf", Cr = "ds-data-table-expanded-row", it = "::detail", Rr = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
929
+ function B(e) {
930
+ return typeof e == "object" && e !== null && typeof e[se] == "string";
931
+ }
932
+ function Sr(e) {
933
+ return `${e}${it}`;
934
+ }
935
+ function xn(e) {
936
+ return e.endsWith(it);
937
+ }
938
+ function Ir(e, t) {
939
+ return { ...e, [se]: t };
940
+ }
941
+ const lt = Re(
942
+ null
943
+ );
944
+ function Er(e) {
945
+ var c;
946
+ const t = Se(
947
+ lt
948
+ ), { t: o } = A(), n = W(null), { data: s, node: d, api: m } = e, g = B(s), p = t == null ? void 0 : t.heights, h = d.id, u = W(t);
949
+ if (u.current = t, K(() => {
950
+ const f = n.current;
951
+ if (!f || !g || !p || h == null) return;
952
+ let w = p.get(h) ?? 0;
953
+ const C = () => {
954
+ const I = Math.ceil(f.getBoundingClientRect().height);
955
+ I <= 0 || I === w || (w = I, p.set(h, I), d.setRowHeight(I), m.onRowHeightChanged());
956
+ };
957
+ C();
958
+ const S = new ResizeObserver(C);
959
+ return S.observe(f), () => S.disconnect();
960
+ }, [m, h, p, g, d]), K(() => {
961
+ const f = n.current, w = f == null ? void 0 : f.parentElement;
962
+ if (!f || !w || !g) return;
963
+ const C = (S) => {
964
+ var I, re;
965
+ S.target !== w || S.defaultPrevented || (S.key === "Escape" ? (S.stopPropagation(), (re = (I = u.current) == null ? void 0 : I.onExpandedRowChange) == null || re.call(I, null)) : S.key === "Enter" && (S.preventDefault(), (f.querySelector(Rr) ?? f).focus()));
966
+ };
967
+ return w.addEventListener("keydown", C), () => w.removeEventListener("keydown", C);
968
+ }, [g]), !g) {
969
+ const f = t == null ? void 0 : t.fallbackRenderer;
970
+ return f ? /* @__PURE__ */ i(f, { ...e }) : null;
971
+ }
972
+ const b = s[se];
973
+ let T;
974
+ if (t != null && t.expanded && t.expanded.id === b)
975
+ T = t.expanded.row;
976
+ else {
977
+ const { [se]: f, ...w } = s;
978
+ T = w;
979
+ }
980
+ return /* @__PURE__ */ G(
981
+ "div",
982
+ {
983
+ ref: n,
984
+ role: "gridcell",
985
+ tabIndex: -1,
986
+ "data-component": "data-table-expanded-row",
987
+ "data-expanded-row-of": b,
988
+ className: "ds-data-table-expanded-row-surface",
989
+ onKeyDown: (f) => {
990
+ var w;
991
+ f.key !== "Escape" || f.defaultPrevented || (f.stopPropagation(), (w = t == null ? void 0 : t.onExpandedRowChange) == null || w.call(t, null));
992
+ },
993
+ children: [
994
+ /* @__PURE__ */ i("span", { className: "ds:sr-only", children: o("dataTable.expandedRow") }),
995
+ (c = t == null ? void 0 : t.renderExpandedRow) == null ? void 0 : c.call(t, T)
996
+ ]
997
+ }
998
+ );
999
+ }
1000
+ const Nr = {
1001
+ id: "data-table",
1002
+ capabilities: [
1003
+ "select_single",
1004
+ "select_multiple",
1005
+ "range_pick",
1006
+ "filter",
1007
+ "sort",
1008
+ "paginate"
1009
+ ],
1010
+ state: {
1011
+ selection: {
1012
+ type: "string[]",
1013
+ descriptionKey: "ui.agent.dataTable.state.selection",
1014
+ description: "Row ids of currently-selected rows.",
1015
+ read: (e) => e.getSelection()
1016
+ },
1017
+ filter: {
1018
+ type: "object",
1019
+ descriptionKey: "ui.agent.dataTable.state.filter",
1020
+ description: "Current ag-grid filter model, keyed by column id.",
1021
+ read: (e) => e.getFilter()
1022
+ },
1023
+ sort: {
1024
+ type: "Array<{ colId, sort }>",
1025
+ descriptionKey: "ui.agent.dataTable.state.sort",
1026
+ description: "Active sort, in priority order.",
1027
+ read: (e) => e.getSort()
1028
+ },
1029
+ currentPage: {
1030
+ type: "number",
1031
+ descriptionKey: "ui.agent.dataTable.state.currentPage",
1032
+ description: "Zero-indexed page number.",
1033
+ read: (e) => e.getCurrentPage()
1034
+ },
1035
+ expandedRowId: {
1036
+ type: "string | null",
1037
+ descriptionKey: "ui.agent.dataTable.state.expandedRowId",
1038
+ description: "Id of the row whose inline detail is open (expandable row), or null.",
1039
+ read: (e) => e.getExpandedRowId()
1040
+ }
1041
+ },
1042
+ actions: {
1043
+ select_rows: {
1044
+ // Transient grid selection (data-table convention) — stays read.
1045
+ safety: "read",
1046
+ argsType: "{ ids: string[] }",
1047
+ argsSchema: {
1048
+ type: "object",
1049
+ properties: {
1050
+ ids: {
1051
+ type: "array",
1052
+ items: { type: "string" },
1053
+ description: "Row ids to select (replaces the current selection)."
1054
+ }
1055
+ },
1056
+ required: ["ids"]
1057
+ },
1058
+ idempotent: !0,
1059
+ descriptionKey: "ui.agent.dataTable.actions.selectRows",
1060
+ description: "Replace the current selection with the given row ids.",
1061
+ examples: [
1062
+ { args: { ids: ["r-1", "r-2"] }, note: "Select the first two rows." }
1063
+ ],
1064
+ invoke: (e, t) => {
1065
+ e.setSelection(t.ids);
1066
+ }
1067
+ },
1068
+ select_range: {
1069
+ safety: "read",
1070
+ argsType: "{ fromId: string, toId: string }",
1071
+ argsSchema: {
1072
+ type: "object",
1073
+ properties: {
1074
+ fromId: { type: "string", description: "Start row id (inclusive)." },
1075
+ toId: { type: "string", description: "End row id (inclusive)." }
1076
+ },
1077
+ required: ["fromId", "toId"]
1078
+ },
1079
+ idempotent: !0,
1080
+ descriptionKey: "ui.agent.dataTable.actions.selectRange",
1081
+ description: "Select every row between fromId and toId, inclusive, in current sort order.",
1082
+ invoke: (e, t) => {
1083
+ e.selectRange(t.fromId, t.toId);
1084
+ }
1085
+ },
1086
+ clear_selection: {
1087
+ safety: "read",
1088
+ idempotent: !0,
1089
+ descriptionKey: "ui.agent.dataTable.actions.clearSelection",
1090
+ description: "Deselect all rows.",
1091
+ invoke: (e) => {
1092
+ e.clearSelection();
1093
+ }
1094
+ },
1095
+ get_selection: {
1096
+ safety: "read",
1097
+ returns: "string[]",
1098
+ returnsSchema: { type: "array", items: { type: "string" } },
1099
+ idempotent: !0,
1100
+ descriptionKey: "ui.agent.dataTable.actions.getSelection",
1101
+ description: "Return the row ids of the currently-selected rows.",
1102
+ invoke: (e) => e.getSelection()
1103
+ },
1104
+ apply_filter: {
1105
+ safety: "read",
1106
+ argsType: "{ model: Record<string, unknown> }",
1107
+ argsSchema: {
1108
+ type: "object",
1109
+ properties: {
1110
+ model: {
1111
+ type: "object",
1112
+ description: "ag-grid filter model keyed by column id. Opaque per-column filter shapes; replaces the current model.",
1113
+ additionalProperties: !0
1114
+ }
1115
+ },
1116
+ required: ["model"]
1117
+ },
1118
+ idempotent: !0,
1119
+ descriptionKey: "ui.agent.dataTable.actions.applyFilter",
1120
+ description: "Replace the filter model with the given object.",
1121
+ invoke: (e, t) => {
1122
+ e.setFilter(t.model);
1123
+ }
1124
+ },
1125
+ sort_by: {
1126
+ safety: "read",
1127
+ argsType: "{ model: DataTableSortEntry[] }",
1128
+ argsSchema: {
1129
+ type: "object",
1130
+ properties: {
1131
+ model: {
1132
+ type: "array",
1133
+ description: "Sort entries in priority order.",
1134
+ items: {
1135
+ type: "object",
1136
+ properties: {
1137
+ colId: { type: "string", description: "Column id to sort by." },
1138
+ sort: { enum: ["asc", "desc"], description: "Sort direction." }
1139
+ },
1140
+ required: ["colId", "sort"]
1141
+ }
1142
+ }
1143
+ },
1144
+ required: ["model"]
1145
+ },
1146
+ idempotent: !0,
1147
+ descriptionKey: "ui.agent.dataTable.actions.sortBy",
1148
+ description: "Replace the active sort with the given list (priority order).",
1149
+ examples: [
1150
+ {
1151
+ args: { model: [{ colId: "name", sort: "asc" }] },
1152
+ note: "Sort by name ascending."
1153
+ }
1154
+ ],
1155
+ invoke: (e, t) => {
1156
+ e.setSort(t.model);
1157
+ }
1158
+ },
1159
+ go_to_page: {
1160
+ safety: "read",
1161
+ argsType: "{ page: number }",
1162
+ argsSchema: {
1163
+ type: "object",
1164
+ properties: {
1165
+ page: {
1166
+ type: "integer",
1167
+ minimum: 0,
1168
+ description: "Zero-indexed page number."
1169
+ }
1170
+ },
1171
+ required: ["page"]
1172
+ },
1173
+ idempotent: !0,
1174
+ descriptionKey: "ui.agent.dataTable.actions.goToPage",
1175
+ description: "Navigate to the given zero-indexed page.",
1176
+ invoke: (e, t) => {
1177
+ e.goToPage(t.page);
1178
+ }
1179
+ }
1180
+ },
1181
+ domHooks: {
1182
+ root: {
1183
+ attr: "data-component",
1184
+ value: "data-table",
1185
+ description: "Marks the DataTable wrapper."
1186
+ },
1187
+ instanceId: {
1188
+ attr: "data-component-id",
1189
+ sourceProp: "gridId",
1190
+ description: "Sourced from the gridId prop. Required to address a specific table from the agent."
1191
+ },
1192
+ item: {
1193
+ attr: "row-id",
1194
+ description: 'Native ag-grid row-id attribute on each rendered record row. When an expandable row is open, one extra full-width row with row-id `<parentId>::detail` is the accordion detail, not a record — its cell carries data-component="data-table-expanded-row" and data-expanded-row-of="<parentId>"; skip it when enumerating rows (isExpandedRowDetailId). Selection is performed via the curated handle, not by DOM mutation.'
1195
+ }
1196
+ }
1197
+ };
1198
+ Wt.registerModules([$t]);
1199
+ const Dr = jt("ag-theme-alfadocs ds:w-full", {
1200
+ variants: {
1201
+ density: {
1202
+ default: "",
1203
+ compact: "data-table-compact",
1204
+ expanded: "data-table-expanded"
1205
+ },
1206
+ bordered: {
1207
+ true: "",
1208
+ false: "ds:[--ag-borders:none]"
1209
+ }
1210
+ },
1211
+ defaultVariants: {
1212
+ density: "default",
1213
+ bordered: !0
1214
+ }
1215
+ });
1216
+ function Fr() {
1217
+ const { t: e } = A();
1218
+ return j(
1219
+ () => ({
1220
+ // Filter strings
1221
+ contains: e("dataTable.agGrid.contains"),
1222
+ notContains: e("dataTable.agGrid.notContains"),
1223
+ equals: e("dataTable.agGrid.equals"),
1224
+ notEqual: e("dataTable.agGrid.notEqual"),
1225
+ startsWith: e("dataTable.agGrid.startsWith"),
1226
+ endsWith: e("dataTable.agGrid.endsWith"),
1227
+ lessThan: e("dataTable.agGrid.lessThan"),
1228
+ greaterThan: e("dataTable.agGrid.greaterThan"),
1229
+ inRange: e("dataTable.agGrid.inRange"),
1230
+ blank: e("dataTable.agGrid.blank"),
1231
+ notBlank: e("dataTable.agGrid.notBlank"),
1232
+ filterOoo: e("dataTable.agGrid.filterOoo"),
1233
+ applyFilter: e("dataTable.agGrid.applyFilter"),
1234
+ resetFilter: e("dataTable.agGrid.resetFilter"),
1235
+ noRowsToShow: e("dataTable.agGrid.noRowsToShow"),
1236
+ selectAll: e("dataTable.agGrid.selectAll"),
1237
+ // Pagination
1238
+ page: e("dataTable.page"),
1239
+ of: e("dataTable.of"),
1240
+ to: e("dataTable.to"),
1241
+ nextPage: e("dataTable.nextPage"),
1242
+ previousPage: e("dataTable.previousPage"),
1243
+ firstPage: e("dataTable.firstPage"),
1244
+ lastPage: e("dataTable.lastPage"),
1245
+ pageSize: e("dataTable.pageSize")
1246
+ }),
1247
+ [e]
1248
+ );
1249
+ }
1250
+ function kr() {
1251
+ return /* @__PURE__ */ i(
1252
+ "div",
1253
+ {
1254
+ role: "status",
1255
+ "aria-live": "polite",
1256
+ className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]",
1257
+ children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ i(
1258
+ Gt,
1259
+ {
1260
+ variant: "rectangular",
1261
+ className: "ds:h-[var(--min-target-size)] ds:w-full"
1262
+ },
1263
+ t
1264
+ ))
1265
+ }
1266
+ );
1267
+ }
1268
+ function Ar() {
1269
+ const { t: e } = A();
1270
+ return /* @__PURE__ */ i(
1271
+ Lt,
1272
+ {
1273
+ variant: "no-results",
1274
+ size: "sm",
1275
+ title: e("dataTable.noRows"),
1276
+ description: e("dataTable.noRowsDescription")
1277
+ }
1278
+ );
1279
+ }
1280
+ function Pr(e) {
1281
+ return e.map(({ pinned: t, ...o }) => o);
1282
+ }
1283
+ function Or(e) {
1284
+ return e.map(({ hide: t, pinned: o, ...n }) => n);
1285
+ }
1286
+ function zr(e, t) {
1287
+ try {
1288
+ const o = localStorage.getItem(`data-table-col-state:${e}`);
1289
+ if (!o) return null;
1290
+ const n = JSON.parse(o);
1291
+ if (Array.isArray(n))
1292
+ return {
1293
+ state: Or(n),
1294
+ touched: []
1295
+ };
1296
+ if (typeof n != "object" || n === null) return null;
1297
+ const s = n;
1298
+ return s.v !== 2 || !Array.isArray(s.state) ? null : {
1299
+ state: s.dir === t ? s.state : Pr(s.state),
1300
+ touched: Array.isArray(s.touched) ? s.touched.filter((d) => typeof d == "string") : []
1301
+ };
1302
+ } catch {
1303
+ return null;
1304
+ }
1305
+ }
1306
+ function Mr(e, t, o, n) {
1307
+ try {
1308
+ const s = {
1309
+ v: 2,
1310
+ dir: o,
1311
+ state: t.getColumnState(),
1312
+ touched: [...n]
1313
+ };
1314
+ localStorage.setItem(
1315
+ `data-table-col-state:${e}`,
1316
+ JSON.stringify(s)
1317
+ );
1318
+ } catch {
1319
+ }
1320
+ }
1321
+ const _r = /* @__PURE__ */ new Set([
1322
+ "api",
1323
+ "flex",
1324
+ "gridInitializing",
1325
+ "gridOptionsChanged",
1326
+ "autosizeColumns",
1327
+ "sizeColumnsToFit"
1328
+ ]);
1329
+ function Gr(e, t) {
1330
+ const {
1331
+ columnDefs: o,
1332
+ rowData: n,
1333
+ rowSelection: s,
1334
+ pagination: d = !1,
1335
+ paginationPageSize: m = 25,
1336
+ paginationPageSizeSelector: g = [10, 25, 50, 100],
1337
+ gridId: p,
1338
+ onSelectionChanged: h,
1339
+ onSortChanged: u,
1340
+ onFilterChanged: b,
1341
+ noRowsOverlay: T,
1342
+ loadingOverlay: y,
1343
+ gridOptions: c,
1344
+ density: f,
1345
+ bordered: w,
1346
+ heightClass: C = "ds:h-[500px]",
1347
+ className: S,
1348
+ getRowClass: I,
1349
+ pinnedBottomRowData: re,
1350
+ printMode: L = !1,
1351
+ expandedRowId: R,
1352
+ renderExpandedRow: O,
1353
+ onExpandedRowChange: z,
1354
+ children: F
1355
+ } = e, D = R !== void 0 || O !== void 0, q = c == null ? void 0 : c.getRowId;
1356
+ if (D && !q)
1357
+ throw new Error(
1358
+ "DataTable: `expandedRowId` / `renderExpandedRow` require `gridOptions.getRowId` — the expanded row is addressed by row id, not by index."
1359
+ );
1360
+ const { t: U, i18n: M } = A(), E = W(null), ie = W(null);
1361
+ wr(ie);
1362
+ const [J, xe] = _(0), [Z, ve] = _(""), ct = Fr(), ze = W(R);
1363
+ ze.current = R;
1364
+ const Te = j(
1365
+ () => ({
1366
+ getSelection: () => {
1367
+ var l;
1368
+ const r = (l = E.current) == null ? void 0 : l.api;
1369
+ if (!r) return [];
1370
+ const a = [];
1371
+ for (const x of r.getSelectedNodes())
1372
+ x.id != null && !B(x.data) && a.push(x.id);
1373
+ return a;
1374
+ },
1375
+ setSelection: (r) => {
1376
+ var x;
1377
+ const a = (x = E.current) == null ? void 0 : x.api;
1378
+ if (!a) return;
1379
+ const l = new Set(r);
1380
+ a.forEachNode((v) => {
1381
+ v.id != null && v.setSelected(l.has(v.id));
1382
+ });
1383
+ },
1384
+ selectRange: (r, a) => {
1385
+ var Be;
1386
+ const l = (Be = E.current) == null ? void 0 : Be.api;
1387
+ if (!l) return;
1388
+ const x = [];
1389
+ l.forEachNodeAfterFilterAndSort((te) => {
1390
+ te.id != null && !B(te.data) && x.push(te.id);
1391
+ });
1392
+ const v = x.indexOf(r), k = x.indexOf(a);
1393
+ if (v < 0 || k < 0) return;
1394
+ const [P, ae] = v <= k ? [v, k] : [k, v], ee = new Set(x.slice(P, ae + 1));
1395
+ l.forEachNode((te) => {
1396
+ te.id != null && te.setSelected(ee.has(te.id));
1397
+ });
1398
+ },
1399
+ clearSelection: () => {
1400
+ var r, a;
1401
+ (a = (r = E.current) == null ? void 0 : r.api) == null || a.deselectAll();
1402
+ },
1403
+ getFilter: () => {
1404
+ var r, a;
1405
+ return ((a = (r = E.current) == null ? void 0 : r.api) == null ? void 0 : a.getFilterModel()) ?? {};
1406
+ },
1407
+ setFilter: (r) => {
1408
+ var a, l;
1409
+ (l = (a = E.current) == null ? void 0 : a.api) == null || l.setFilterModel(r);
1410
+ },
1411
+ getSort: () => {
1412
+ var a;
1413
+ const r = (a = E.current) == null ? void 0 : a.api;
1414
+ return r ? r.getColumnState().filter((l) => l.sort === "asc" || l.sort === "desc").map((l) => ({ colId: l.colId, sort: l.sort })) : [];
1415
+ },
1416
+ setSort: (r) => {
1417
+ var x;
1418
+ const a = (x = E.current) == null ? void 0 : x.api;
1419
+ if (!a) return;
1420
+ const l = a.getColumnState().map((v) => {
1421
+ const k = r.find((P) => P.colId === v.colId);
1422
+ return { ...v, sort: k ? k.sort : null };
1423
+ });
1424
+ a.applyColumnState({ state: l, defaultState: { sort: null } });
1425
+ },
1426
+ getCurrentPage: () => {
1427
+ var r, a;
1428
+ return ((a = (r = E.current) == null ? void 0 : r.api) == null ? void 0 : a.paginationGetCurrentPage()) ?? 0;
1429
+ },
1430
+ goToPage: (r) => {
1431
+ var a, l;
1432
+ (l = (a = E.current) == null ? void 0 : a.api) == null || l.paginationGoToPage(r);
1433
+ },
1434
+ getExpandedRowId: () => ze.current ?? null,
1435
+ getUserTouchedColumns: () => [...ne.current],
1436
+ markColumnsUserTouched: (r) => Me.current(r),
1437
+ getRawApi: () => {
1438
+ var r;
1439
+ return (r = E.current) == null ? void 0 : r.api;
1440
+ }
1441
+ }),
1442
+ []
1443
+ ), ue = W(/* @__PURE__ */ new Map()), ne = W(/* @__PURE__ */ new Set()), Me = W(
1444
+ () => {
1445
+ }
1446
+ );
1447
+ _t(t, () => Te, [Te]), Yt(Nr, Te, p);
1448
+ const _e = M.dir() === "rtl", ut = n === void 0, pt = er(), { resolvedTheme: Ge } = tr(), ft = (Ge === "light-accessible" || Ge === "dark-accessible") && f === "compact" ? "default" : f, mt = j(() => {
1449
+ if (!s) return;
1450
+ const r = (a) => !B(a.data);
1451
+ return s === "single" ? { mode: "singleRow", isRowSelectable: r } : {
1452
+ mode: "multiRow",
1453
+ headerCheckbox: !0,
1454
+ checkboxes: !0,
1455
+ isRowSelectable: r
1456
+ };
1457
+ }, [s]), pe = _e ? "rtl" : "ltr", H = N(
1458
+ (r, a, l) => {
1459
+ const x = new Set(a);
1460
+ for (const v of r.getColumnState()) {
1461
+ if (!x.has(v.colId)) continue;
1462
+ const k = ue.current.get(v.colId) ?? {};
1463
+ for (const P of l) k[P] = v[P];
1464
+ ue.current.set(v.colId, k);
1465
+ }
1466
+ },
1467
+ []
1468
+ ), le = N(
1469
+ (r) => {
1470
+ p && Mr(p, r, pe, ne.current);
1471
+ },
1472
+ [p, pe]
1473
+ ), Le = N(
1474
+ (r) => {
1475
+ var l;
1476
+ for (const x of r) ne.current.add(x);
1477
+ const a = (l = E.current) == null ? void 0 : l.api;
1478
+ a && (H(a, r, ["hide"]), le(a));
1479
+ },
1480
+ [le, H]
1481
+ );
1482
+ Me.current = Le;
1483
+ const gt = N(() => {
1484
+ var l;
1485
+ if (!((l = E.current) != null && l.api)) return;
1486
+ const r = E.current.api, a = p ? zr(p, pe) : null;
1487
+ if (a) {
1488
+ for (const x of a.touched) ne.current.add(x);
1489
+ r.applyColumnState({
1490
+ state: a.state,
1491
+ applyOrder: !0
1492
+ }), H(r, a.touched, ["hide"]);
1493
+ }
1494
+ }, [p, pe, H]), ht = N(
1495
+ (r) => {
1496
+ var l;
1497
+ if (r.source !== "gridOptionsChanged") return;
1498
+ const a = (l = E.current) == null ? void 0 : l.api;
1499
+ !a || ue.current.size === 0 || a.applyColumnState({
1500
+ state: [...ue.current].map(([x, v]) => ({
1501
+ colId: x,
1502
+ ...v
1503
+ }))
1504
+ });
1505
+ },
1506
+ []
1507
+ ), fe = N(
1508
+ (r) => {
1509
+ var x;
1510
+ const a = (x = E.current) == null ? void 0 : x.api;
1511
+ if (!a) return;
1512
+ const l = (r.columns ?? (r.column ? [r.column] : [])).map((v) => v.getColId());
1513
+ if (r.source && _r.has(r.source)) {
1514
+ if (r.source === "api" && "visible" in r) {
1515
+ const v = l.filter(
1516
+ (k) => ne.current.has(k)
1517
+ );
1518
+ v.length > 0 && (H(a, v, ["hide"]), le(a));
1519
+ }
1520
+ return;
1521
+ }
1522
+ if ("visible" in r) {
1523
+ for (const v of l) ne.current.add(v);
1524
+ H(a, l, ["hide"]);
1525
+ } else "pinned" in r ? H(a, l, ["pinned"]) : "flexColumns" in r && H(a, l, ["width", "flex"]);
1526
+ le(a);
1527
+ },
1528
+ [le, H]
1529
+ ), bt = j(() => {
1530
+ if (!c) return;
1531
+ const r = { ...c };
1532
+ return delete r.defaultColDef, D && (delete r.getRowId, delete r.isFullWidthRow, delete r.fullWidthCellRenderer, delete r.getRowHeight, delete r.postSortRows, delete r.getRowClass, delete r.defaultCsvExportParams, delete r.defaultExcelExportParams), r;
1533
+ }, [D, c]), je = W(/* @__PURE__ */ new Map()), de = W(c);
1534
+ de.current = c;
1535
+ const qe = N(
1536
+ (r) => {
1537
+ var a;
1538
+ return q == null ? void 0 : q({
1539
+ data: r,
1540
+ level: 0,
1541
+ api: (a = E.current) == null ? void 0 : a.api,
1542
+ context: c == null ? void 0 : c.context
1543
+ });
1544
+ },
1545
+ [q, c == null ? void 0 : c.context]
1546
+ ), Y = j(() => {
1547
+ if (!D || R == null || !n) return null;
1548
+ const r = n.find((a) => qe(a) === R);
1549
+ return r === void 0 ? null : { id: R, row: r };
1550
+ }, [D, R, qe, n]), yt = j(() => {
1551
+ if (!Y || !n) return n;
1552
+ const r = n.indexOf(Y.row), a = Ir(Y.row, Y.id);
1553
+ return [
1554
+ ...n.slice(0, r + 1),
1555
+ a,
1556
+ ...n.slice(r + 1)
1557
+ ];
1558
+ }, [Y, n]), xt = N(
1559
+ (r) => B(r.data) ? Sr(r.data[se]) : q(r),
1560
+ [q]
1561
+ ), vt = N(
1562
+ (r) => {
1563
+ var a, l;
1564
+ return B(r.rowNode.data) || (((l = (a = de.current) == null ? void 0 : a.isFullWidthRow) == null ? void 0 : l.call(a, r)) ?? !1);
1565
+ },
1566
+ []
1567
+ ), Tt = N(
1568
+ (r) => {
1569
+ var a, l;
1570
+ return B(r.data) ? je.current.get(r.node.id ?? "") : (l = (a = de.current) == null ? void 0 : a.getRowHeight) == null ? void 0 : l.call(a, r);
1571
+ },
1572
+ []
1573
+ ), wt = N(
1574
+ (r) => {
1575
+ var P, ae;
1576
+ (ae = (P = de.current) == null ? void 0 : P.postSortRows) == null || ae.call(P, r);
1577
+ const { nodes: a } = r, l = a.findIndex((ee) => B(ee.data));
1578
+ if (l < 0) return;
1579
+ const [x] = a.splice(l, 1), v = x.data[se], k = a.findIndex((ee) => ee.id === v);
1580
+ a.splice(k < 0 ? a.length : k + 1, 0, x);
1581
+ },
1582
+ []
1583
+ ), Ct = N(
1584
+ (r) => {
1585
+ var a, l;
1586
+ return B(r.data) ? Cr : ((l = (a = de.current) == null ? void 0 : a.getRowClass) == null ? void 0 : l.call(a, r)) ?? (I == null ? void 0 : I(r));
1587
+ },
1588
+ [I]
1589
+ ), me = N(
1590
+ (r) => B(r.node.data),
1591
+ []
1592
+ ), Rt = j(() => {
1593
+ if (!D) return;
1594
+ const r = c == null ? void 0 : c.defaultCsvExportParams;
1595
+ return {
1596
+ ...r,
1597
+ shouldRowBeSkipped: (a) => {
1598
+ var l;
1599
+ return me(a) || (((l = r == null ? void 0 : r.shouldRowBeSkipped) == null ? void 0 : l.call(r, a)) ?? !1);
1600
+ }
1601
+ };
1602
+ }, [D, c == null ? void 0 : c.defaultCsvExportParams, me]), St = j(() => {
1603
+ if (!D) return;
1604
+ const r = c == null ? void 0 : c.defaultExcelExportParams;
1605
+ return {
1606
+ ...r,
1607
+ shouldRowBeSkipped: (a) => {
1608
+ var l;
1609
+ return me(a) || (((l = r == null ? void 0 : r.shouldRowBeSkipped) == null ? void 0 : l.call(r, a)) ?? !1);
1610
+ }
1611
+ };
1612
+ }, [D, c == null ? void 0 : c.defaultExcelExportParams, me]), we = c == null ? void 0 : c.fullWidthCellRenderer, It = j(
1613
+ () => ({
1614
+ renderExpandedRow: O,
1615
+ onExpandedRowChange: z,
1616
+ expanded: Y,
1617
+ heights: je.current,
1618
+ fallbackRenderer: typeof we == "function" ? we : void 0
1619
+ }),
1620
+ [
1621
+ we,
1622
+ Y,
1623
+ z,
1624
+ O
1625
+ ]
1626
+ ), Et = N(() => {
1627
+ var l;
1628
+ const r = (l = E.current) == null ? void 0 : l.api;
1629
+ if (!r) return;
1630
+ const a = r.getSelectedRows().filter((x) => !B(x));
1631
+ xe(a.length), h == null || h(a);
1632
+ }, [h]), Nt = N(
1633
+ (r) => {
1634
+ var l;
1635
+ const a = (l = E.current) == null ? void 0 : l.api;
1636
+ if (a) {
1637
+ const v = a.getColumnState().find((k) => k.sort);
1638
+ if (v) {
1639
+ const k = v.colId, P = a.getColumnDef(k), ae = (P == null ? void 0 : P.headerName) ?? k, ee = v.sort === "asc" ? "dataTable.sortAscending" : "dataTable.sortDescending";
1640
+ ve(
1641
+ U("dataTable.sortAnnounce", {
1642
+ column: ae,
1643
+ direction: U(ee)
1644
+ })
1645
+ );
1646
+ } else
1647
+ ve("");
1648
+ }
1649
+ u == null || u(r);
1650
+ },
1651
+ [u, U]
1652
+ ), Dt = N(
1653
+ (r) => {
1654
+ b == null || b(r);
1655
+ },
1656
+ [b]
1657
+ );
1658
+ K(() => {
1659
+ if (!Z) return;
1660
+ const r = setTimeout(() => ve(""), 3e3);
1661
+ return () => clearTimeout(r);
1662
+ }, [Z]);
1663
+ const Ft = T ?? Ar, kt = y ?? kr, At = N(
1664
+ () => {
1665
+ var r;
1666
+ return (r = E.current) == null ? void 0 : r.api;
1667
+ },
1668
+ []
1669
+ ), Pt = N(() => {
1670
+ typeof window < "u" && window.print();
1671
+ }, []), Ot = Dr({
1672
+ density: ft,
1673
+ bordered: w,
1674
+ className: S
1675
+ }), zt = F ?? /* @__PURE__ */ i("div", { className: "data-table-toolbar ds:flex ds:justify-end", children: /* @__PURE__ */ G(
1676
+ Ue,
1677
+ {
1678
+ role: "toolbar",
1679
+ "aria-label": U("dataTable.tableActions"),
1680
+ className: "ds:bg-[var(--background)]",
1681
+ children: [
1682
+ /* @__PURE__ */ i(be.ExportMenu, {}),
1683
+ /* @__PURE__ */ i(be.Print, {}),
1684
+ /* @__PURE__ */ i(be.ColumnToggle, {})
1685
+ ]
1686
+ }
1687
+ ) }), Mt = L ? !1 : d;
1688
+ return /* @__PURE__ */ G(
1689
+ "div",
1690
+ {
1691
+ className: "ds:flex ds:w-full ds:min-h-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-sm)]",
1692
+ "aria-busy": ut ? "true" : void 0,
1693
+ "data-component": "data-table",
1694
+ "data-component-id": p,
1695
+ "data-print-mode": L ? "true" : void 0,
1696
+ children: [
1697
+ !L && /* @__PURE__ */ i(
1698
+ sr,
1699
+ {
1700
+ getApi: At,
1701
+ selectionCount: J,
1702
+ onPrint: Pt,
1703
+ markColumnsUserTouched: Le,
1704
+ children: zt
1705
+ }
1706
+ ),
1707
+ /* @__PURE__ */ i(
1708
+ "div",
1709
+ {
1710
+ ref: ie,
1711
+ className: [Ot, L ? "" : C].join(" ").trim(),
1712
+ children: /* @__PURE__ */ i(
1713
+ lt.Provider,
1714
+ {
1715
+ value: It,
1716
+ children: /* @__PURE__ */ i(
1717
+ Bt,
1718
+ {
1719
+ ref: E,
1720
+ theme: "legacy",
1721
+ columnDefs: o,
1722
+ rowData: yt,
1723
+ defaultColDef: {
1724
+ sortable: !0,
1725
+ // Default filter = DS-styled text filter so untyped columns
1726
+ // (no explicit `filter:` override) inherit the kit's form
1727
+ // language instead of AG Grid's stock browser-skinned input.
1728
+ // Number / date / select columns opt into their dedicated
1729
+ // wrapper per-column.
1730
+ filter: xr,
1731
+ floatingFilterComponent: vr,
1732
+ resizable: !0,
1733
+ floatingFilter: !0,
1734
+ // §13d — faint sort icon advertises which columns are
1735
+ // sortable. v33+ moved this from grid-level to defaultColDef.
1736
+ unSortIcon: !0,
1737
+ ...c == null ? void 0 : c.defaultColDef
1738
+ },
1739
+ rowSelection: mt,
1740
+ pagination: Mt,
1741
+ paginationPageSize: m,
1742
+ paginationPageSizeSelector: g,
1743
+ paginationNumberFormatter: (r) => new Intl.NumberFormat(M.language).format(r.value),
1744
+ animateRows: !pt,
1745
+ enableRtl: _e,
1746
+ ensureDomOrder: !0,
1747
+ enableCellSpan: !0,
1748
+ enableCellTextSelection: !0,
1749
+ copyHeadersToClipboard: !0,
1750
+ accentedSort: !0,
1751
+ multiSortKey: "ctrl",
1752
+ suppressDragLeaveHidesColumns: !0,
1753
+ suppressRowClickSelection: s ? !0 : void 0,
1754
+ tooltipShowDelay: 500,
1755
+ tooltipHideDelay: 5e3,
1756
+ tooltipInteraction: !0,
1757
+ stopEditingWhenCellsLoseFocus: !0,
1758
+ maintainColumnOrder: !0,
1759
+ undoRedoCellEditing: !0,
1760
+ undoRedoCellEditingLimit: 20,
1761
+ suppressCellFocus: !1,
1762
+ rowBuffer: 10,
1763
+ localeText: ct,
1764
+ noRowsOverlayComponent: Ft,
1765
+ loadingOverlayComponent: kt,
1766
+ getRowClass: D ? Ct : I,
1767
+ pinnedBottomRowData: re,
1768
+ domLayout: L ? "autoHeight" : void 0,
1769
+ onGridReady: gt,
1770
+ onNewColumnsLoaded: ht,
1771
+ onColumnMoved: fe,
1772
+ onColumnResized: fe,
1773
+ onColumnPinned: fe,
1774
+ onColumnVisible: fe,
1775
+ onSortChanged: Nt,
1776
+ onFilterChanged: Dt,
1777
+ onSelectionChanged: Et,
1778
+ ...bt,
1779
+ ...D ? {
1780
+ getRowId: xt,
1781
+ isFullWidthRow: vt,
1782
+ fullWidthCellRenderer: Er,
1783
+ getRowHeight: Tt,
1784
+ postSortRows: wt,
1785
+ defaultCsvExportParams: Rt,
1786
+ defaultExcelExportParams: St
1787
+ } : {}
1788
+ }
1789
+ )
1790
+ }
1791
+ )
1792
+ }
1793
+ ),
1794
+ !L && /* @__PURE__ */ i("div", { className: "ds:flex ds:items-center ds:justify-between type-body-sm ds:text-[color:var(--muted-foreground)]", children: J > 0 ? /* @__PURE__ */ i("span", { children: U("dataTable.selected", { count: J }) }) : /* @__PURE__ */ i("span", {}) }),
1795
+ /* @__PURE__ */ i("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: Z })
1796
+ ]
1797
+ }
1798
+ );
1799
+ }
1800
+ const dt = $(Gr);
1801
+ dt.displayName = "DataTable";
1802
+ const vn = Object.assign(dt, {
1803
+ Toolbar: be
1804
+ });
1805
+ function Ke(e) {
1806
+ if (!He(e)) return e;
1807
+ const t = e, o = t.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(o) ? o : `${o} size-4`.trim();
1808
+ return Ve(t, { className: n, size: t.props.size ?? 16 });
1809
+ }
1810
+ function Tn(e) {
1811
+ return Math.max(1, e) * 32 + 28;
1812
+ }
1813
+ function Ce(e, t) {
1814
+ return typeof e == "function" ? e(t) : !!e;
1815
+ }
1816
+ const Lr = "ds:text-[color:var(--destructive)] ds:hover:text-[color:var(--destructive-hover)]";
1817
+ function wn(e) {
1818
+ const { data: t, actions: o, intent: n = "ghost", group: s, label: d, collapsed: m } = e, { t: g } = A();
1819
+ if (!t) return null;
1820
+ const p = o.filter((b) => !Ce(b.hidden, t));
1821
+ if (typeof m == "function" ? m() : !!m)
1822
+ return /* @__PURE__ */ G(X.Root, { children: [
1823
+ /* @__PURE__ */ i(X.Trigger, { asChild: !0, children: /* @__PURE__ */ i(
1824
+ Q,
1825
+ {
1826
+ size: "sm",
1827
+ intent: n,
1828
+ icon: /* @__PURE__ */ i(rr, { "aria-hidden": !0 }),
1829
+ "aria-label": d ?? g("dataTable.actions", "Actions")
1830
+ }
1831
+ ) }),
1832
+ /* @__PURE__ */ i(X.Content, { align: "end", children: p.map((b, T) => /* @__PURE__ */ i(
1833
+ X.Item,
1834
+ {
1835
+ startIcon: Ke(b.icon),
1836
+ disabled: Ce(b.disabled, t),
1837
+ onSelect: () => b.onClick(t),
1838
+ className: b.variant === "destructive" ? "ds:text-[color:var(--destructive)]" : void 0,
1839
+ children: b.label
1840
+ },
1841
+ T
1842
+ )) })
1843
+ ] });
1844
+ const u = p.map((b, T) => {
1845
+ const y = Ce(b.disabled, t), c = y && b.disabledReason ? b.disabledReason : b.label;
1846
+ return /* @__PURE__ */ i(
1847
+ Q,
1848
+ {
1849
+ size: "sm",
1850
+ intent: n,
1851
+ icon: Ke(b.icon),
1852
+ tooltip: c,
1853
+ "aria-label": b.label,
1854
+ disabled: y,
1855
+ onClick: (f) => {
1856
+ f.stopPropagation(), b.onClick(t);
1857
+ },
1858
+ className: b.variant === "destructive" ? Lr : void 0
1859
+ },
1860
+ T
1861
+ );
1862
+ });
1863
+ return s ? /* @__PURE__ */ i(
1864
+ Ue,
1865
+ {
1866
+ "aria-label": d ?? g("dataTable.actions", "Actions"),
1867
+ size: "sm",
1868
+ children: u
1869
+ }
1870
+ ) : /* @__PURE__ */ i("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: u });
1871
+ }
1872
+ export {
1873
+ wn as A,
1874
+ vn as D,
1875
+ Cr as E,
1876
+ xr as T,
1877
+ vr as a,
1878
+ be as b,
1879
+ sr as c,
1880
+ Tn as d,
1881
+ Nr as e,
1882
+ tt as f,
1883
+ Sr as g,
1884
+ xn as h,
1885
+ B as i
1886
+ };
1887
+ //# sourceMappingURL=actions-cell-renderer-BbzCqcld.js.map