@fileflow/sdk 0.1.5 → 0.1.7

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,2848 @@
1
+ import { jsx as g, jsxs as w, Fragment as et } from "react/jsx-runtime";
2
+ import * as ge from "react";
3
+ import tt, { useCallback as Ce, useState as Y, useMemo as Ve, useEffect as Pe } from "react";
4
+ import { f as k, h as nt, u as ot, X as ce, j as A, U as Oe, A as Re, m as pe, o as rt, n as xe, k as Ne, t as lt, c as it, V as De, g as Z, L as Le } from "./index-CEvc89fO.mjs";
5
+ /**
6
+ * @license lucide-react v0.321.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ */
11
+ const st = k("ArrowRight", [
12
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
13
+ ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
14
+ ]);
15
+ /**
16
+ * @license lucide-react v0.321.0 - ISC
17
+ *
18
+ * This source code is licensed under the ISC license.
19
+ * See the LICENSE file in the root directory of this source tree.
20
+ */
21
+ const at = k("CheckSquare", [
22
+ ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }],
23
+ ["path", { d: "M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11", key: "1jnkn4" }]
24
+ ]);
25
+ /**
26
+ * @license lucide-react v0.321.0 - ISC
27
+ *
28
+ * This source code is licensed under the ISC license.
29
+ * See the LICENSE file in the root directory of this source tree.
30
+ */
31
+ const ut = k("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
32
+ /**
33
+ * @license lucide-react v0.321.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 ft = k("ChevronLeft", [
39
+ ["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
40
+ ]);
41
+ /**
42
+ * @license lucide-react v0.321.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */
47
+ const dt = k("Eye", [
48
+ ["path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z", key: "rwhkz3" }],
49
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
50
+ ]);
51
+ /**
52
+ * @license lucide-react v0.321.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */
57
+ const gt = k("FileSpreadsheet", [
58
+ ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
59
+ ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
60
+ ["path", { d: "M8 13h2", key: "yr2amv" }],
61
+ ["path", { d: "M14 13h2", key: "un5t4a" }],
62
+ ["path", { d: "M8 17h2", key: "2yhykz" }],
63
+ ["path", { d: "M14 17h2", key: "10kma7" }]
64
+ ]);
65
+ /**
66
+ * @license lucide-react v0.321.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */
71
+ const ct = k("File", [
72
+ ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
73
+ ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }]
74
+ ]);
75
+ /**
76
+ * @license lucide-react v0.321.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */
81
+ const pt = k("GitBranch", [
82
+ ["line", { x1: "6", x2: "6", y1: "3", y2: "15", key: "17qcm7" }],
83
+ ["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
84
+ ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
85
+ ["path", { d: "M18 9a9 9 0 0 1-9 9", key: "n2h4wq" }]
86
+ ]);
87
+ /**
88
+ * @license lucide-react v0.321.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */
93
+ const mt = k("HelpCircle", [
94
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
95
+ ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
96
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
97
+ ]);
98
+ /**
99
+ * @license lucide-react v0.321.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */
104
+ const ht = k("Pen", [
105
+ ["path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z", key: "5qss01" }]
106
+ ]), Ee = {
107
+ sessionId: null,
108
+ status: "idle",
109
+ step: "upload",
110
+ schema: null,
111
+ file: null,
112
+ fileName: null,
113
+ fileSize: null,
114
+ headers: [],
115
+ rows: [],
116
+ totalRows: 0,
117
+ sampleRows: [],
118
+ mappings: [],
119
+ unmappedSource: [],
120
+ unmappedTarget: [],
121
+ validationResults: null,
122
+ errorsByRow: /* @__PURE__ */ new Map(),
123
+ isLoading: !1,
124
+ error: null,
125
+ editingCell: null,
126
+ editedRows: /* @__PURE__ */ new Set()
127
+ }, U = nt((e, o) => ({
128
+ ...Ee,
129
+ setSchema: (t) => e({ schema: t }),
130
+ setSessionId: (t) => e({ sessionId: t }),
131
+ setFile: (t) => e({
132
+ file: t,
133
+ fileName: t.name,
134
+ fileSize: t.size,
135
+ error: null
136
+ }),
137
+ setParsedData: (t) => e({
138
+ headers: t.headers,
139
+ rows: t.rows,
140
+ totalRows: t.totalRows,
141
+ sampleRows: t.sampleRows
142
+ }),
143
+ setMappings: (t) => e({ mappings: t }),
144
+ updateMapping: (t, n) => e((r) => ({ mappings: r.mappings.map(
145
+ (i) => i.sourceColumn === t ? { ...i, targetKey: n, isAutoMapped: !1 } : i
146
+ ) })),
147
+ setUnmapped: (t, n) => e({
148
+ unmappedSource: t,
149
+ unmappedTarget: n
150
+ }),
151
+ setValidationResults: (t) => {
152
+ const n = /* @__PURE__ */ new Map();
153
+ for (const r of t.errors) {
154
+ const l = n.get(r.rowIndex) || [];
155
+ l.push(r), n.set(r.rowIndex, l);
156
+ }
157
+ e({ validationResults: t, errorsByRow: n });
158
+ },
159
+ setStep: (t) => e({ step: t }),
160
+ nextStep: () => {
161
+ const t = ["upload", "mapping", "validation", "review", "complete"], n = t.indexOf(o().step);
162
+ n < t.length - 1 && e({ step: t[n + 1] });
163
+ },
164
+ previousStep: () => {
165
+ const t = ["upload", "mapping", "validation", "review", "complete"], n = t.indexOf(o().step);
166
+ n > 0 && e({ step: t[n - 1] });
167
+ },
168
+ startEditing: (t, n) => e({
169
+ editingCell: { rowIndex: t, columnKey: n }
170
+ }),
171
+ stopEditing: () => e({ editingCell: null }),
172
+ updateCell: (t, n, r) => e((l) => {
173
+ const i = [...l.rows], a = i.find((f) => f.rowIndex === t);
174
+ a && (a.data = { ...a.data, [n]: String(r) });
175
+ const u = new Set(l.editedRows);
176
+ return u.add(t), { rows: i, editedRows: u, editingCell: null };
177
+ }),
178
+ setStatus: (t) => e({ status: t }),
179
+ setLoading: (t) => e({ isLoading: t }),
180
+ setError: (t) => e({ error: t }),
181
+ reset: () => e(Ee)
182
+ })), wt = ({
183
+ onFileSelect: e,
184
+ maxSize: o = 50 * 1024 * 1024,
185
+ // 50MB
186
+ acceptedTypes: t = [".csv", ".xlsx", ".xls"]
187
+ }) => {
188
+ const { file: n, fileName: r, fileSize: l, setFile: i, error: a, setError: u, isLoading: f } = U(), c = Ce(
189
+ (v, R) => {
190
+ if (R.length > 0) {
191
+ u("Invalid file type or file too large");
192
+ return;
193
+ }
194
+ if (v.length > 0) {
195
+ const _ = v[0];
196
+ i(_), e == null || e(_);
197
+ }
198
+ },
199
+ [e, i, u]
200
+ ), { getRootProps: p, getInputProps: d, isDragActive: s } = ot({
201
+ onDrop: c,
202
+ accept: {
203
+ "text/csv": [".csv"],
204
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
205
+ "application/vnd.ms-excel": [".xls"]
206
+ },
207
+ maxSize: o,
208
+ multiple: !1,
209
+ disabled: f
210
+ }), m = (v) => v < 1024 ? `${v} B` : v < 1024 * 1024 ? `${(v / 1024).toFixed(1)} KB` : `${(v / (1024 * 1024)).toFixed(1)} MB`, h = (v) => {
211
+ v.stopPropagation(), U.getState().reset();
212
+ };
213
+ return n ? /* @__PURE__ */ g("div", { className: "ff-p-4 ff-rounded-xl ff-border", style: { backgroundColor: "var(--ff-success-light)", borderColor: "var(--ff-success)" }, children: /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
214
+ /* @__PURE__ */ g("div", { className: "ff-p-2 ff-rounded-lg", style: { backgroundColor: "rgba(41, 142, 51, 0.15)" }, children: /* @__PURE__ */ g(ct, { className: "ff-w-6 ff-h-6", style: { color: "var(--ff-success)" } }) }),
215
+ /* @__PURE__ */ w("div", { className: "ff-flex-1 ff-min-w-0", children: [
216
+ /* @__PURE__ */ g("p", { className: "ff-font-medium ff-truncate", style: { color: "var(--ff-success-dark)" }, children: r }),
217
+ /* @__PURE__ */ g("p", { className: "ff-text-sm", style: { color: "var(--ff-success)" }, children: m(l || 0) })
218
+ ] }),
219
+ /* @__PURE__ */ g(
220
+ "button",
221
+ {
222
+ onClick: h,
223
+ className: "ff-p-1.5 ff-rounded-full ff-transition-colors",
224
+ style: { color: "var(--ff-success)" },
225
+ "aria-label": "Remove file",
226
+ children: /* @__PURE__ */ g(ce, { className: "ff-w-5 ff-h-5" })
227
+ }
228
+ )
229
+ ] }) }) : /* @__PURE__ */ w("div", { className: "ff-space-y-6", children: [
230
+ /* @__PURE__ */ w(
231
+ "div",
232
+ {
233
+ ...p(),
234
+ className: A(
235
+ "ff-dropzone",
236
+ s && "ff-dropzone-active",
237
+ f && "ff-opacity-50 ff-cursor-not-allowed"
238
+ ),
239
+ children: [
240
+ /* @__PURE__ */ g("input", { ...d() }),
241
+ /* @__PURE__ */ g("div", { className: "ff-dropzone-icon-wrapper", children: /* @__PURE__ */ g(Oe, { className: "ff-dropzone-icon" }) }),
242
+ /* @__PURE__ */ g("h3", { className: "ff-dropzone-text", children: s ? "Drop your file here" : "Upload your file" }),
243
+ /* @__PURE__ */ g("p", { className: "ff-dropzone-hint", children: "Drag and drop or click to select" }),
244
+ /* @__PURE__ */ g("label", { className: "ff-inline-block", children: /* @__PURE__ */ g("span", { className: A(
245
+ "ff-btn ff-btn-primary",
246
+ f && "ff-opacity-50 ff-cursor-wait"
247
+ ), children: f ? "Processing..." : "Choose file" }) }),
248
+ /* @__PURE__ */ w("p", { className: "ff-dropzone-formats", children: [
249
+ "Supports ",
250
+ t.join(", "),
251
+ " up to ",
252
+ m(o)
253
+ ] })
254
+ ]
255
+ }
256
+ ),
257
+ a && /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-2 ff-p-4 ff-rounded-lg ff-text-sm", style: { backgroundColor: "var(--ff-error-light)", color: "var(--ff-error)" }, children: [
258
+ /* @__PURE__ */ g(Re, { className: "ff-w-4 ff-h-4 ff-flex-shrink-0" }),
259
+ /* @__PURE__ */ g("p", { children: a })
260
+ ] })
261
+ ] });
262
+ }, vt = ({ onMappingChange: e }) => {
263
+ const { mappings: o, schema: t, unmappedSource: n, updateMapping: r } = U(), l = (t == null ? void 0 : t.columns) || [], i = (p, d) => {
264
+ const s = d === "" ? null : d;
265
+ r(p, s), e == null || e(p, s);
266
+ }, a = (p) => p >= 0.85 ? "ff-text-success-600" : p >= 0.6 ? "ff-text-warning-600" : "ff-text-error-600", u = (p) => p >= 0.85 ? "High" : p >= 0.6 ? "Medium" : "Low", c = new Set(
267
+ o.filter((p) => p.targetKey !== null).map((p) => p.targetKey)
268
+ );
269
+ return /* @__PURE__ */ w("div", { className: "ff-space-y-4", children: [
270
+ /* @__PURE__ */ w("div", { className: "ff-mapping-header", children: [
271
+ /* @__PURE__ */ w("div", { children: [
272
+ /* @__PURE__ */ g("h3", { className: "ff-mapping-title", children: "Column Mapping" }),
273
+ /* @__PURE__ */ g("p", { className: "ff-mapping-subtitle", children: "Match your file columns to the expected fields" })
274
+ ] }),
275
+ /* @__PURE__ */ w("div", { className: "ff-mapping-legend", children: [
276
+ /* @__PURE__ */ w("span", { className: "ff-mapping-legend-item", children: [
277
+ /* @__PURE__ */ g("span", { className: "ff-mapping-legend-dot", style: { backgroundColor: "var(--ff-success)" } }),
278
+ /* @__PURE__ */ g("span", { style: { color: "var(--ff-text-secondary)" }, children: "Mapped" })
279
+ ] }),
280
+ /* @__PURE__ */ w("span", { className: "ff-mapping-legend-item", children: [
281
+ /* @__PURE__ */ g("span", { className: "ff-mapping-legend-dot", style: { backgroundColor: "var(--ff-warning)" } }),
282
+ /* @__PURE__ */ g("span", { style: { color: "var(--ff-text-secondary)" }, children: "Review" })
283
+ ] }),
284
+ /* @__PURE__ */ w("span", { className: "ff-mapping-legend-item", children: [
285
+ /* @__PURE__ */ g("span", { className: "ff-mapping-legend-dot", style: { backgroundColor: "var(--ff-gray-70)" } }),
286
+ /* @__PURE__ */ g("span", { style: { color: "var(--ff-text-secondary)" }, children: "Unmapped" })
287
+ ] })
288
+ ] })
289
+ ] }),
290
+ /* @__PURE__ */ g("div", { className: "ff-space-y-2", children: o.map((p) => {
291
+ l.find((m) => m.key === p.targetKey);
292
+ const d = p.targetKey !== null, s = p.confidence >= 0.85;
293
+ return /* @__PURE__ */ w(
294
+ "div",
295
+ {
296
+ className: A(
297
+ "ff-mapping-row",
298
+ d && s && "ff-mapping-row-success",
299
+ d && !s && "ff-mapping-row-warning"
300
+ ),
301
+ children: [
302
+ /* @__PURE__ */ g("div", { className: "ff-flex-1", children: /* @__PURE__ */ g("div", { className: "ff-mapping-source", children: p.sourceColumn }) }),
303
+ /* @__PURE__ */ g("div", { className: "ff-mapping-arrow", children: /* @__PURE__ */ g(st, { className: "ff-w-5 ff-h-5" }) }),
304
+ /* @__PURE__ */ g("div", { className: "ff-flex-1 ff-mapping-target", children: /* @__PURE__ */ w(
305
+ "select",
306
+ {
307
+ value: p.targetKey || "",
308
+ onChange: (m) => i(p.sourceColumn, m.target.value),
309
+ className: "ff-input",
310
+ children: [
311
+ /* @__PURE__ */ g("option", { value: "", children: "-- Do not import --" }),
312
+ l.map((m) => /* @__PURE__ */ w(
313
+ "option",
314
+ {
315
+ value: m.key,
316
+ disabled: c.has(m.key) && p.targetKey !== m.key,
317
+ children: [
318
+ m.label,
319
+ " (",
320
+ m.type,
321
+ ")",
322
+ m.required ? " *" : ""
323
+ ]
324
+ },
325
+ m.key
326
+ ))
327
+ ]
328
+ }
329
+ ) }),
330
+ /* @__PURE__ */ g("div", { className: "ff-mapping-status", children: d ? s ? /* @__PURE__ */ g(ut, { className: "ff-w-5 ff-h-5", style: { color: "var(--ff-success)" } }) : /* @__PURE__ */ g(mt, { className: "ff-w-5 ff-h-5", style: { color: "var(--ff-warning)" } }) : /* @__PURE__ */ g("span", { className: "ff-w-5 ff-h-5" }) }),
331
+ p.confidence > 0 && /* @__PURE__ */ w("div", { className: A("ff-confidence", a(p.confidence)), children: [
332
+ /* @__PURE__ */ w("span", { children: [
333
+ Math.round(p.confidence * 100),
334
+ "%"
335
+ ] }),
336
+ /* @__PURE__ */ w("span", { style: { color: "var(--ff-text-muted)" }, children: [
337
+ "(",
338
+ u(p.confidence),
339
+ ")"
340
+ ] })
341
+ ] })
342
+ ]
343
+ },
344
+ p.sourceColumn
345
+ );
346
+ }) }),
347
+ (() => {
348
+ const p = l.filter(
349
+ (d) => d.required && !c.has(d.key)
350
+ );
351
+ return p.length > 0 ? /* @__PURE__ */ w("div", { className: "ff-flex ff-items-start ff-gap-2 ff-p-4 ff-rounded-lg", style: { backgroundColor: "var(--ff-warning-light)", borderColor: "var(--ff-warning)" }, children: [
352
+ /* @__PURE__ */ g(Re, { className: "ff-w-5 ff-h-5 ff-flex-shrink-0 ff-mt-0.5", style: { color: "var(--ff-warning)" } }),
353
+ /* @__PURE__ */ w("div", { children: [
354
+ /* @__PURE__ */ g("p", { className: "ff-text-sm ff-font-medium", style: { color: "var(--ff-warning-dark)" }, children: "Required fields not mapped" }),
355
+ /* @__PURE__ */ g("p", { className: "ff-text-sm ff-mt-1", style: { color: "var(--ff-warning)" }, children: p.map((d) => d.label).join(", ") })
356
+ ] })
357
+ ] }) : null;
358
+ })()
359
+ ] });
360
+ };
361
+ /**
362
+ * table-core
363
+ *
364
+ * Copyright (c) TanStack
365
+ *
366
+ * This source code is licensed under the MIT license found in the
367
+ * LICENSE.md file in the root directory of this source tree.
368
+ *
369
+ * @license MIT
370
+ */
371
+ function St() {
372
+ return {
373
+ accessor: (e, o) => typeof e == "function" ? {
374
+ ...o,
375
+ accessorFn: e
376
+ } : {
377
+ ...o,
378
+ accessorKey: e
379
+ },
380
+ display: (e) => e,
381
+ group: (e) => e
382
+ };
383
+ }
384
+ function b(e, o) {
385
+ return typeof e == "function" ? e(o) : e;
386
+ }
387
+ function H(e, o) {
388
+ return (t) => {
389
+ o.setState((n) => ({
390
+ ...n,
391
+ [e]: b(t, n[e])
392
+ }));
393
+ };
394
+ }
395
+ function ne(e) {
396
+ return e instanceof Function;
397
+ }
398
+ function Ct(e) {
399
+ return Array.isArray(e) && e.every((o) => typeof o == "number");
400
+ }
401
+ function Rt(e, o) {
402
+ const t = [], n = (r) => {
403
+ r.forEach((l) => {
404
+ t.push(l);
405
+ const i = o(l);
406
+ i != null && i.length && n(i);
407
+ });
408
+ };
409
+ return n(e), t;
410
+ }
411
+ function S(e, o, t) {
412
+ let n = [], r;
413
+ return (l) => {
414
+ let i;
415
+ t.key && t.debug && (i = Date.now());
416
+ const a = e(l);
417
+ if (!(a.length !== n.length || a.some((c, p) => n[p] !== c)))
418
+ return r;
419
+ n = a;
420
+ let f;
421
+ if (t.key && t.debug && (f = Date.now()), r = o(...a), t == null || t.onChange == null || t.onChange(r), t.key && t.debug && t != null && t.debug()) {
422
+ const c = Math.round((Date.now() - i) * 100) / 100, p = Math.round((Date.now() - f) * 100) / 100, d = p / 16, s = (m, h) => {
423
+ for (m = String(m); m.length < h; )
424
+ m = " " + m;
425
+ return m;
426
+ };
427
+ console.info(`%c⏱ ${s(p, 5)} /${s(c, 5)} ms`, `
428
+ font-size: .6rem;
429
+ font-weight: bold;
430
+ color: hsl(${Math.max(0, Math.min(120 - 120 * d, 120))}deg 100% 31%);`, t == null ? void 0 : t.key);
431
+ }
432
+ return r;
433
+ };
434
+ }
435
+ function C(e, o, t, n) {
436
+ return {
437
+ debug: () => {
438
+ var r;
439
+ return (r = e == null ? void 0 : e.debugAll) != null ? r : e[o];
440
+ },
441
+ key: process.env.NODE_ENV === "development" && t,
442
+ onChange: n
443
+ };
444
+ }
445
+ function xt(e, o, t, n) {
446
+ const r = () => {
447
+ var i;
448
+ return (i = l.getValue()) != null ? i : e.options.renderFallbackValue;
449
+ }, l = {
450
+ id: `${o.id}_${t.id}`,
451
+ row: o,
452
+ column: t,
453
+ getValue: () => o.getValue(n),
454
+ renderValue: r,
455
+ getContext: S(() => [e, t, o, l], (i, a, u, f) => ({
456
+ table: i,
457
+ column: a,
458
+ row: u,
459
+ cell: f,
460
+ getValue: f.getValue,
461
+ renderValue: f.renderValue
462
+ }), C(e.options, "debugCells", "cell.getContext"))
463
+ };
464
+ return e._features.forEach((i) => {
465
+ i.createCell == null || i.createCell(l, t, o, e);
466
+ }, {}), l;
467
+ }
468
+ function yt(e, o, t, n) {
469
+ var r, l;
470
+ const a = {
471
+ ...e._getDefaultColumnDef(),
472
+ ...o
473
+ }, u = a.accessorKey;
474
+ let f = (r = (l = a.id) != null ? l : u ? typeof String.prototype.replaceAll == "function" ? u.replaceAll(".", "_") : u.replace(/\./g, "_") : void 0) != null ? r : typeof a.header == "string" ? a.header : void 0, c;
475
+ if (a.accessorFn ? c = a.accessorFn : u && (u.includes(".") ? c = (d) => {
476
+ let s = d;
477
+ for (const h of u.split(".")) {
478
+ var m;
479
+ s = (m = s) == null ? void 0 : m[h], process.env.NODE_ENV !== "production" && s === void 0 && console.warn(`"${h}" in deeply nested key "${u}" returned undefined.`);
480
+ }
481
+ return s;
482
+ } : c = (d) => d[a.accessorKey]), !f)
483
+ throw process.env.NODE_ENV !== "production" ? new Error(a.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header") : new Error();
484
+ let p = {
485
+ id: `${String(f)}`,
486
+ accessorFn: c,
487
+ parent: n,
488
+ depth: t,
489
+ columnDef: a,
490
+ columns: [],
491
+ getFlatColumns: S(() => [!0], () => {
492
+ var d;
493
+ return [p, ...(d = p.columns) == null ? void 0 : d.flatMap((s) => s.getFlatColumns())];
494
+ }, C(e.options, "debugColumns", "column.getFlatColumns")),
495
+ getLeafColumns: S(() => [e._getOrderColumnsFn()], (d) => {
496
+ var s;
497
+ if ((s = p.columns) != null && s.length) {
498
+ let m = p.columns.flatMap((h) => h.getLeafColumns());
499
+ return d(m);
500
+ }
501
+ return [p];
502
+ }, C(e.options, "debugColumns", "column.getLeafColumns"))
503
+ };
504
+ for (const d of e._features)
505
+ d.createColumn == null || d.createColumn(p, e);
506
+ return p;
507
+ }
508
+ const D = "debugHeaders";
509
+ function He(e, o, t) {
510
+ var n;
511
+ let l = {
512
+ id: (n = t.id) != null ? n : o.id,
513
+ column: o,
514
+ index: t.index,
515
+ isPlaceholder: !!t.isPlaceholder,
516
+ placeholderId: t.placeholderId,
517
+ depth: t.depth,
518
+ subHeaders: [],
519
+ colSpan: 0,
520
+ rowSpan: 0,
521
+ headerGroup: null,
522
+ getLeafHeaders: () => {
523
+ const i = [], a = (u) => {
524
+ u.subHeaders && u.subHeaders.length && u.subHeaders.map(a), i.push(u);
525
+ };
526
+ return a(l), i;
527
+ },
528
+ getContext: () => ({
529
+ table: e,
530
+ header: l,
531
+ column: o
532
+ })
533
+ };
534
+ return e._features.forEach((i) => {
535
+ i.createHeader == null || i.createHeader(l, e);
536
+ }), l;
537
+ }
538
+ const _t = {
539
+ createTable: (e) => {
540
+ e.getHeaderGroups = S(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (o, t, n, r) => {
541
+ var l, i;
542
+ const a = (l = n == null ? void 0 : n.map((p) => t.find((d) => d.id === p)).filter(Boolean)) != null ? l : [], u = (i = r == null ? void 0 : r.map((p) => t.find((d) => d.id === p)).filter(Boolean)) != null ? i : [], f = t.filter((p) => !(n != null && n.includes(p.id)) && !(r != null && r.includes(p.id)));
543
+ return Q(o, [...a, ...f, ...u], e);
544
+ }, C(e.options, D, "getHeaderGroups")), e.getCenterHeaderGroups = S(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (o, t, n, r) => (t = t.filter((l) => !(n != null && n.includes(l.id)) && !(r != null && r.includes(l.id))), Q(o, t, e, "center")), C(e.options, D, "getCenterHeaderGroups")), e.getLeftHeaderGroups = S(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left], (o, t, n) => {
545
+ var r;
546
+ const l = (r = n == null ? void 0 : n.map((i) => t.find((a) => a.id === i)).filter(Boolean)) != null ? r : [];
547
+ return Q(o, l, e, "left");
548
+ }, C(e.options, D, "getLeftHeaderGroups")), e.getRightHeaderGroups = S(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.right], (o, t, n) => {
549
+ var r;
550
+ const l = (r = n == null ? void 0 : n.map((i) => t.find((a) => a.id === i)).filter(Boolean)) != null ? r : [];
551
+ return Q(o, l, e, "right");
552
+ }, C(e.options, D, "getRightHeaderGroups")), e.getFooterGroups = S(() => [e.getHeaderGroups()], (o) => [...o].reverse(), C(e.options, D, "getFooterGroups")), e.getLeftFooterGroups = S(() => [e.getLeftHeaderGroups()], (o) => [...o].reverse(), C(e.options, D, "getLeftFooterGroups")), e.getCenterFooterGroups = S(() => [e.getCenterHeaderGroups()], (o) => [...o].reverse(), C(e.options, D, "getCenterFooterGroups")), e.getRightFooterGroups = S(() => [e.getRightHeaderGroups()], (o) => [...o].reverse(), C(e.options, D, "getRightFooterGroups")), e.getFlatHeaders = S(() => [e.getHeaderGroups()], (o) => o.map((t) => t.headers).flat(), C(e.options, D, "getFlatHeaders")), e.getLeftFlatHeaders = S(() => [e.getLeftHeaderGroups()], (o) => o.map((t) => t.headers).flat(), C(e.options, D, "getLeftFlatHeaders")), e.getCenterFlatHeaders = S(() => [e.getCenterHeaderGroups()], (o) => o.map((t) => t.headers).flat(), C(e.options, D, "getCenterFlatHeaders")), e.getRightFlatHeaders = S(() => [e.getRightHeaderGroups()], (o) => o.map((t) => t.headers).flat(), C(e.options, D, "getRightFlatHeaders")), e.getCenterLeafHeaders = S(() => [e.getCenterFlatHeaders()], (o) => o.filter((t) => {
553
+ var n;
554
+ return !((n = t.subHeaders) != null && n.length);
555
+ }), C(e.options, D, "getCenterLeafHeaders")), e.getLeftLeafHeaders = S(() => [e.getLeftFlatHeaders()], (o) => o.filter((t) => {
556
+ var n;
557
+ return !((n = t.subHeaders) != null && n.length);
558
+ }), C(e.options, D, "getLeftLeafHeaders")), e.getRightLeafHeaders = S(() => [e.getRightFlatHeaders()], (o) => o.filter((t) => {
559
+ var n;
560
+ return !((n = t.subHeaders) != null && n.length);
561
+ }), C(e.options, D, "getRightLeafHeaders")), e.getLeafHeaders = S(() => [e.getLeftHeaderGroups(), e.getCenterHeaderGroups(), e.getRightHeaderGroups()], (o, t, n) => {
562
+ var r, l, i, a, u, f;
563
+ return [...(r = (l = o[0]) == null ? void 0 : l.headers) != null ? r : [], ...(i = (a = t[0]) == null ? void 0 : a.headers) != null ? i : [], ...(u = (f = n[0]) == null ? void 0 : f.headers) != null ? u : []].map((c) => c.getLeafHeaders()).flat();
564
+ }, C(e.options, D, "getLeafHeaders"));
565
+ }
566
+ };
567
+ function Q(e, o, t, n) {
568
+ var r, l;
569
+ let i = 0;
570
+ const a = function(d, s) {
571
+ s === void 0 && (s = 1), i = Math.max(i, s), d.filter((m) => m.getIsVisible()).forEach((m) => {
572
+ var h;
573
+ (h = m.columns) != null && h.length && a(m.columns, s + 1);
574
+ }, 0);
575
+ };
576
+ a(e);
577
+ let u = [];
578
+ const f = (d, s) => {
579
+ const m = {
580
+ depth: s,
581
+ id: [n, `${s}`].filter(Boolean).join("_"),
582
+ headers: []
583
+ }, h = [];
584
+ d.forEach((v) => {
585
+ const R = [...h].reverse()[0], _ = v.column.depth === m.depth;
586
+ let $, L = !1;
587
+ if (_ && v.column.parent ? $ = v.column.parent : ($ = v.column, L = !0), R && (R == null ? void 0 : R.column) === $)
588
+ R.subHeaders.push(v);
589
+ else {
590
+ const I = He(t, $, {
591
+ id: [n, s, $.id, v == null ? void 0 : v.id].filter(Boolean).join("_"),
592
+ isPlaceholder: L,
593
+ placeholderId: L ? `${h.filter((P) => P.column === $).length}` : void 0,
594
+ depth: s,
595
+ index: h.length
596
+ });
597
+ I.subHeaders.push(v), h.push(I);
598
+ }
599
+ m.headers.push(v), v.headerGroup = m;
600
+ }), u.push(m), s > 0 && f(h, s - 1);
601
+ }, c = o.map((d, s) => He(t, d, {
602
+ depth: i,
603
+ index: s
604
+ }));
605
+ f(c, i - 1), u.reverse();
606
+ const p = (d) => d.filter((m) => m.column.getIsVisible()).map((m) => {
607
+ let h = 0, v = 0, R = [0];
608
+ m.subHeaders && m.subHeaders.length ? (R = [], p(m.subHeaders).forEach(($) => {
609
+ let {
610
+ colSpan: L,
611
+ rowSpan: I
612
+ } = $;
613
+ h += L, R.push(I);
614
+ })) : h = 1;
615
+ const _ = Math.min(...R);
616
+ return v = v + _, m.colSpan = h, m.rowSpan = v, {
617
+ colSpan: h,
618
+ rowSpan: v
619
+ };
620
+ });
621
+ return p((r = (l = u[0]) == null ? void 0 : l.headers) != null ? r : []), u;
622
+ }
623
+ const ye = (e, o, t, n, r, l, i) => {
624
+ let a = {
625
+ id: o,
626
+ index: n,
627
+ original: t,
628
+ depth: r,
629
+ parentId: i,
630
+ _valuesCache: {},
631
+ _uniqueValuesCache: {},
632
+ getValue: (u) => {
633
+ if (a._valuesCache.hasOwnProperty(u))
634
+ return a._valuesCache[u];
635
+ const f = e.getColumn(u);
636
+ if (f != null && f.accessorFn)
637
+ return a._valuesCache[u] = f.accessorFn(a.original, n), a._valuesCache[u];
638
+ },
639
+ getUniqueValues: (u) => {
640
+ if (a._uniqueValuesCache.hasOwnProperty(u))
641
+ return a._uniqueValuesCache[u];
642
+ const f = e.getColumn(u);
643
+ if (f != null && f.accessorFn)
644
+ return f.columnDef.getUniqueValues ? (a._uniqueValuesCache[u] = f.columnDef.getUniqueValues(a.original, n), a._uniqueValuesCache[u]) : (a._uniqueValuesCache[u] = [a.getValue(u)], a._uniqueValuesCache[u]);
645
+ },
646
+ renderValue: (u) => {
647
+ var f;
648
+ return (f = a.getValue(u)) != null ? f : e.options.renderFallbackValue;
649
+ },
650
+ subRows: [],
651
+ getLeafRows: () => Rt(a.subRows, (u) => u.subRows),
652
+ getParentRow: () => a.parentId ? e.getRow(a.parentId, !0) : void 0,
653
+ getParentRows: () => {
654
+ let u = [], f = a;
655
+ for (; ; ) {
656
+ const c = f.getParentRow();
657
+ if (!c) break;
658
+ u.push(c), f = c;
659
+ }
660
+ return u.reverse();
661
+ },
662
+ getAllCells: S(() => [e.getAllLeafColumns()], (u) => u.map((f) => xt(e, a, f, f.id)), C(e.options, "debugRows", "getAllCells")),
663
+ _getAllCellsByColumnId: S(() => [a.getAllCells()], (u) => u.reduce((f, c) => (f[c.column.id] = c, f), {}), C(e.options, "debugRows", "getAllCellsByColumnId"))
664
+ };
665
+ for (let u = 0; u < e._features.length; u++) {
666
+ const f = e._features[u];
667
+ f == null || f.createRow == null || f.createRow(a, e);
668
+ }
669
+ return a;
670
+ }, Ft = {
671
+ createColumn: (e, o) => {
672
+ e._getFacetedRowModel = o.options.getFacetedRowModel && o.options.getFacetedRowModel(o, e.id), e.getFacetedRowModel = () => e._getFacetedRowModel ? e._getFacetedRowModel() : o.getPreFilteredRowModel(), e._getFacetedUniqueValues = o.options.getFacetedUniqueValues && o.options.getFacetedUniqueValues(o, e.id), e.getFacetedUniqueValues = () => e._getFacetedUniqueValues ? e._getFacetedUniqueValues() : /* @__PURE__ */ new Map(), e._getFacetedMinMaxValues = o.options.getFacetedMinMaxValues && o.options.getFacetedMinMaxValues(o, e.id), e.getFacetedMinMaxValues = () => {
673
+ if (e._getFacetedMinMaxValues)
674
+ return e._getFacetedMinMaxValues();
675
+ };
676
+ }
677
+ }, be = (e, o, t) => {
678
+ var n, r;
679
+ const l = t == null || (n = t.toString()) == null ? void 0 : n.toLowerCase();
680
+ return !!(!((r = e.getValue(o)) == null || (r = r.toString()) == null || (r = r.toLowerCase()) == null) && r.includes(l));
681
+ };
682
+ be.autoRemove = (e) => z(e);
683
+ const Be = (e, o, t) => {
684
+ var n;
685
+ return !!(!((n = e.getValue(o)) == null || (n = n.toString()) == null) && n.includes(t));
686
+ };
687
+ Be.autoRemove = (e) => z(e);
688
+ const Te = (e, o, t) => {
689
+ var n;
690
+ return ((n = e.getValue(o)) == null || (n = n.toString()) == null ? void 0 : n.toLowerCase()) === (t == null ? void 0 : t.toLowerCase());
691
+ };
692
+ Te.autoRemove = (e) => z(e);
693
+ const qe = (e, o, t) => {
694
+ var n;
695
+ return (n = e.getValue(o)) == null ? void 0 : n.includes(t);
696
+ };
697
+ qe.autoRemove = (e) => z(e);
698
+ const je = (e, o, t) => !t.some((n) => {
699
+ var r;
700
+ return !((r = e.getValue(o)) != null && r.includes(n));
701
+ });
702
+ je.autoRemove = (e) => z(e) || !(e != null && e.length);
703
+ const Ue = (e, o, t) => t.some((n) => {
704
+ var r;
705
+ return (r = e.getValue(o)) == null ? void 0 : r.includes(n);
706
+ });
707
+ Ue.autoRemove = (e) => z(e) || !(e != null && e.length);
708
+ const Ke = (e, o, t) => e.getValue(o) === t;
709
+ Ke.autoRemove = (e) => z(e);
710
+ const Xe = (e, o, t) => e.getValue(o) == t;
711
+ Xe.autoRemove = (e) => z(e);
712
+ const _e = (e, o, t) => {
713
+ let [n, r] = t;
714
+ const l = e.getValue(o);
715
+ return l >= n && l <= r;
716
+ };
717
+ _e.resolveFilterValue = (e) => {
718
+ let [o, t] = e, n = typeof o != "number" ? parseFloat(o) : o, r = typeof t != "number" ? parseFloat(t) : t, l = o === null || Number.isNaN(n) ? -1 / 0 : n, i = t === null || Number.isNaN(r) ? 1 / 0 : r;
719
+ if (l > i) {
720
+ const a = l;
721
+ l = i, i = a;
722
+ }
723
+ return [l, i];
724
+ };
725
+ _e.autoRemove = (e) => z(e) || z(e[0]) && z(e[1]);
726
+ const O = {
727
+ includesString: be,
728
+ includesStringSensitive: Be,
729
+ equalsString: Te,
730
+ arrIncludes: qe,
731
+ arrIncludesAll: je,
732
+ arrIncludesSome: Ue,
733
+ equals: Ke,
734
+ weakEquals: Xe,
735
+ inNumberRange: _e
736
+ };
737
+ function z(e) {
738
+ return e == null || e === "";
739
+ }
740
+ const $t = {
741
+ getDefaultColumnDef: () => ({
742
+ filterFn: "auto"
743
+ }),
744
+ getInitialState: (e) => ({
745
+ columnFilters: [],
746
+ ...e
747
+ }),
748
+ getDefaultOptions: (e) => ({
749
+ onColumnFiltersChange: H("columnFilters", e),
750
+ filterFromLeafRows: !1,
751
+ maxLeafRowFilterDepth: 100
752
+ }),
753
+ createColumn: (e, o) => {
754
+ e.getAutoFilterFn = () => {
755
+ const t = o.getCoreRowModel().flatRows[0], n = t == null ? void 0 : t.getValue(e.id);
756
+ return typeof n == "string" ? O.includesString : typeof n == "number" ? O.inNumberRange : typeof n == "boolean" || n !== null && typeof n == "object" ? O.equals : Array.isArray(n) ? O.arrIncludes : O.weakEquals;
757
+ }, e.getFilterFn = () => {
758
+ var t, n;
759
+ return ne(e.columnDef.filterFn) ? e.columnDef.filterFn : e.columnDef.filterFn === "auto" ? e.getAutoFilterFn() : (
760
+ // @ts-ignore
761
+ (t = (n = o.options.filterFns) == null ? void 0 : n[e.columnDef.filterFn]) != null ? t : O[e.columnDef.filterFn]
762
+ );
763
+ }, e.getCanFilter = () => {
764
+ var t, n, r;
765
+ return ((t = e.columnDef.enableColumnFilter) != null ? t : !0) && ((n = o.options.enableColumnFilters) != null ? n : !0) && ((r = o.options.enableFilters) != null ? r : !0) && !!e.accessorFn;
766
+ }, e.getIsFiltered = () => e.getFilterIndex() > -1, e.getFilterValue = () => {
767
+ var t;
768
+ return (t = o.getState().columnFilters) == null || (t = t.find((n) => n.id === e.id)) == null ? void 0 : t.value;
769
+ }, e.getFilterIndex = () => {
770
+ var t, n;
771
+ return (t = (n = o.getState().columnFilters) == null ? void 0 : n.findIndex((r) => r.id === e.id)) != null ? t : -1;
772
+ }, e.setFilterValue = (t) => {
773
+ o.setColumnFilters((n) => {
774
+ const r = e.getFilterFn(), l = n == null ? void 0 : n.find((c) => c.id === e.id), i = b(t, l ? l.value : void 0);
775
+ if (Ge(r, i, e)) {
776
+ var a;
777
+ return (a = n == null ? void 0 : n.filter((c) => c.id !== e.id)) != null ? a : [];
778
+ }
779
+ const u = {
780
+ id: e.id,
781
+ value: i
782
+ };
783
+ if (l) {
784
+ var f;
785
+ return (f = n == null ? void 0 : n.map((c) => c.id === e.id ? u : c)) != null ? f : [];
786
+ }
787
+ return n != null && n.length ? [...n, u] : [u];
788
+ });
789
+ };
790
+ },
791
+ createRow: (e, o) => {
792
+ e.columnFilters = {}, e.columnFiltersMeta = {};
793
+ },
794
+ createTable: (e) => {
795
+ e.setColumnFilters = (o) => {
796
+ const t = e.getAllLeafColumns(), n = (r) => {
797
+ var l;
798
+ return (l = b(o, r)) == null ? void 0 : l.filter((i) => {
799
+ const a = t.find((u) => u.id === i.id);
800
+ if (a) {
801
+ const u = a.getFilterFn();
802
+ if (Ge(u, i.value, a))
803
+ return !1;
804
+ }
805
+ return !0;
806
+ });
807
+ };
808
+ e.options.onColumnFiltersChange == null || e.options.onColumnFiltersChange(n);
809
+ }, e.resetColumnFilters = (o) => {
810
+ var t, n;
811
+ e.setColumnFilters(o ? [] : (t = (n = e.initialState) == null ? void 0 : n.columnFilters) != null ? t : []);
812
+ }, e.getPreFilteredRowModel = () => e.getCoreRowModel(), e.getFilteredRowModel = () => (!e._getFilteredRowModel && e.options.getFilteredRowModel && (e._getFilteredRowModel = e.options.getFilteredRowModel(e)), e.options.manualFiltering || !e._getFilteredRowModel ? e.getPreFilteredRowModel() : e._getFilteredRowModel());
813
+ }
814
+ };
815
+ function Ge(e, o, t) {
816
+ return (e && e.autoRemove ? e.autoRemove(o, t) : !1) || typeof o > "u" || typeof o == "string" && !o;
817
+ }
818
+ const Mt = (e, o, t) => t.reduce((n, r) => {
819
+ const l = r.getValue(e);
820
+ return n + (typeof l == "number" ? l : 0);
821
+ }, 0), It = (e, o, t) => {
822
+ let n;
823
+ return t.forEach((r) => {
824
+ const l = r.getValue(e);
825
+ l != null && (n > l || n === void 0 && l >= l) && (n = l);
826
+ }), n;
827
+ }, Vt = (e, o, t) => {
828
+ let n;
829
+ return t.forEach((r) => {
830
+ const l = r.getValue(e);
831
+ l != null && (n < l || n === void 0 && l >= l) && (n = l);
832
+ }), n;
833
+ }, Pt = (e, o, t) => {
834
+ let n, r;
835
+ return t.forEach((l) => {
836
+ const i = l.getValue(e);
837
+ i != null && (n === void 0 ? i >= i && (n = r = i) : (n > i && (n = i), r < i && (r = i)));
838
+ }), [n, r];
839
+ }, Nt = (e, o) => {
840
+ let t = 0, n = 0;
841
+ if (o.forEach((r) => {
842
+ let l = r.getValue(e);
843
+ l != null && (l = +l) >= l && (++t, n += l);
844
+ }), t) return n / t;
845
+ }, Dt = (e, o) => {
846
+ if (!o.length)
847
+ return;
848
+ const t = o.map((l) => l.getValue(e));
849
+ if (!Ct(t))
850
+ return;
851
+ if (t.length === 1)
852
+ return t[0];
853
+ const n = Math.floor(t.length / 2), r = t.sort((l, i) => l - i);
854
+ return t.length % 2 !== 0 ? r[n] : (r[n - 1] + r[n]) / 2;
855
+ }, Lt = (e, o) => Array.from(new Set(o.map((t) => t.getValue(e))).values()), Et = (e, o) => new Set(o.map((t) => t.getValue(e))).size, Ht = (e, o) => o.length, re = {
856
+ sum: Mt,
857
+ min: It,
858
+ max: Vt,
859
+ extent: Pt,
860
+ mean: Nt,
861
+ median: Dt,
862
+ unique: Lt,
863
+ uniqueCount: Et,
864
+ count: Ht
865
+ }, Gt = {
866
+ getDefaultColumnDef: () => ({
867
+ aggregatedCell: (e) => {
868
+ var o, t;
869
+ return (o = (t = e.getValue()) == null || t.toString == null ? void 0 : t.toString()) != null ? o : null;
870
+ },
871
+ aggregationFn: "auto"
872
+ }),
873
+ getInitialState: (e) => ({
874
+ grouping: [],
875
+ ...e
876
+ }),
877
+ getDefaultOptions: (e) => ({
878
+ onGroupingChange: H("grouping", e),
879
+ groupedColumnMode: "reorder"
880
+ }),
881
+ createColumn: (e, o) => {
882
+ e.toggleGrouping = () => {
883
+ o.setGrouping((t) => t != null && t.includes(e.id) ? t.filter((n) => n !== e.id) : [...t ?? [], e.id]);
884
+ }, e.getCanGroup = () => {
885
+ var t, n;
886
+ return ((t = e.columnDef.enableGrouping) != null ? t : !0) && ((n = o.options.enableGrouping) != null ? n : !0) && (!!e.accessorFn || !!e.columnDef.getGroupingValue);
887
+ }, e.getIsGrouped = () => {
888
+ var t;
889
+ return (t = o.getState().grouping) == null ? void 0 : t.includes(e.id);
890
+ }, e.getGroupedIndex = () => {
891
+ var t;
892
+ return (t = o.getState().grouping) == null ? void 0 : t.indexOf(e.id);
893
+ }, e.getToggleGroupingHandler = () => {
894
+ const t = e.getCanGroup();
895
+ return () => {
896
+ t && e.toggleGrouping();
897
+ };
898
+ }, e.getAutoAggregationFn = () => {
899
+ const t = o.getCoreRowModel().flatRows[0], n = t == null ? void 0 : t.getValue(e.id);
900
+ if (typeof n == "number")
901
+ return re.sum;
902
+ if (Object.prototype.toString.call(n) === "[object Date]")
903
+ return re.extent;
904
+ }, e.getAggregationFn = () => {
905
+ var t, n;
906
+ if (!e)
907
+ throw new Error();
908
+ return ne(e.columnDef.aggregationFn) ? e.columnDef.aggregationFn : e.columnDef.aggregationFn === "auto" ? e.getAutoAggregationFn() : (t = (n = o.options.aggregationFns) == null ? void 0 : n[e.columnDef.aggregationFn]) != null ? t : re[e.columnDef.aggregationFn];
909
+ };
910
+ },
911
+ createTable: (e) => {
912
+ e.setGrouping = (o) => e.options.onGroupingChange == null ? void 0 : e.options.onGroupingChange(o), e.resetGrouping = (o) => {
913
+ var t, n;
914
+ e.setGrouping(o ? [] : (t = (n = e.initialState) == null ? void 0 : n.grouping) != null ? t : []);
915
+ }, e.getPreGroupedRowModel = () => e.getFilteredRowModel(), e.getGroupedRowModel = () => (!e._getGroupedRowModel && e.options.getGroupedRowModel && (e._getGroupedRowModel = e.options.getGroupedRowModel(e)), e.options.manualGrouping || !e._getGroupedRowModel ? e.getPreGroupedRowModel() : e._getGroupedRowModel());
916
+ },
917
+ createRow: (e, o) => {
918
+ e.getIsGrouped = () => !!e.groupingColumnId, e.getGroupingValue = (t) => {
919
+ if (e._groupingValuesCache.hasOwnProperty(t))
920
+ return e._groupingValuesCache[t];
921
+ const n = o.getColumn(t);
922
+ return n != null && n.columnDef.getGroupingValue ? (e._groupingValuesCache[t] = n.columnDef.getGroupingValue(e.original), e._groupingValuesCache[t]) : e.getValue(t);
923
+ }, e._groupingValuesCache = {};
924
+ },
925
+ createCell: (e, o, t, n) => {
926
+ e.getIsGrouped = () => o.getIsGrouped() && o.id === t.groupingColumnId, e.getIsPlaceholder = () => !e.getIsGrouped() && o.getIsGrouped(), e.getIsAggregated = () => {
927
+ var r;
928
+ return !e.getIsGrouped() && !e.getIsPlaceholder() && !!((r = t.subRows) != null && r.length);
929
+ };
930
+ }
931
+ };
932
+ function At(e, o, t) {
933
+ if (!(o != null && o.length) || !t)
934
+ return e;
935
+ const n = e.filter((l) => !o.includes(l.id));
936
+ return t === "remove" ? n : [...o.map((l) => e.find((i) => i.id === l)).filter(Boolean), ...n];
937
+ }
938
+ const zt = {
939
+ getInitialState: (e) => ({
940
+ columnOrder: [],
941
+ ...e
942
+ }),
943
+ getDefaultOptions: (e) => ({
944
+ onColumnOrderChange: H("columnOrder", e)
945
+ }),
946
+ createColumn: (e, o) => {
947
+ e.getIndex = S((t) => [J(o, t)], (t) => t.findIndex((n) => n.id === e.id), C(o.options, "debugColumns", "getIndex")), e.getIsFirstColumn = (t) => {
948
+ var n;
949
+ return ((n = J(o, t)[0]) == null ? void 0 : n.id) === e.id;
950
+ }, e.getIsLastColumn = (t) => {
951
+ var n;
952
+ const r = J(o, t);
953
+ return ((n = r[r.length - 1]) == null ? void 0 : n.id) === e.id;
954
+ };
955
+ },
956
+ createTable: (e) => {
957
+ e.setColumnOrder = (o) => e.options.onColumnOrderChange == null ? void 0 : e.options.onColumnOrderChange(o), e.resetColumnOrder = (o) => {
958
+ var t;
959
+ e.setColumnOrder(o ? [] : (t = e.initialState.columnOrder) != null ? t : []);
960
+ }, e._getOrderColumnsFn = S(() => [e.getState().columnOrder, e.getState().grouping, e.options.groupedColumnMode], (o, t, n) => (r) => {
961
+ let l = [];
962
+ if (!(o != null && o.length))
963
+ l = r;
964
+ else {
965
+ const i = [...o], a = [...r];
966
+ for (; a.length && i.length; ) {
967
+ const u = i.shift(), f = a.findIndex((c) => c.id === u);
968
+ f > -1 && l.push(a.splice(f, 1)[0]);
969
+ }
970
+ l = [...l, ...a];
971
+ }
972
+ return At(l, t, n);
973
+ }, C(e.options, "debugTable", "_getOrderColumnsFn"));
974
+ }
975
+ }, le = () => ({
976
+ left: [],
977
+ right: []
978
+ }), kt = {
979
+ getInitialState: (e) => ({
980
+ columnPinning: le(),
981
+ ...e
982
+ }),
983
+ getDefaultOptions: (e) => ({
984
+ onColumnPinningChange: H("columnPinning", e)
985
+ }),
986
+ createColumn: (e, o) => {
987
+ e.pin = (t) => {
988
+ const n = e.getLeafColumns().map((r) => r.id).filter(Boolean);
989
+ o.setColumnPinning((r) => {
990
+ var l, i;
991
+ if (t === "right") {
992
+ var a, u;
993
+ return {
994
+ left: ((a = r == null ? void 0 : r.left) != null ? a : []).filter((p) => !(n != null && n.includes(p))),
995
+ right: [...((u = r == null ? void 0 : r.right) != null ? u : []).filter((p) => !(n != null && n.includes(p))), ...n]
996
+ };
997
+ }
998
+ if (t === "left") {
999
+ var f, c;
1000
+ return {
1001
+ left: [...((f = r == null ? void 0 : r.left) != null ? f : []).filter((p) => !(n != null && n.includes(p))), ...n],
1002
+ right: ((c = r == null ? void 0 : r.right) != null ? c : []).filter((p) => !(n != null && n.includes(p)))
1003
+ };
1004
+ }
1005
+ return {
1006
+ left: ((l = r == null ? void 0 : r.left) != null ? l : []).filter((p) => !(n != null && n.includes(p))),
1007
+ right: ((i = r == null ? void 0 : r.right) != null ? i : []).filter((p) => !(n != null && n.includes(p)))
1008
+ };
1009
+ });
1010
+ }, e.getCanPin = () => e.getLeafColumns().some((n) => {
1011
+ var r, l, i;
1012
+ return ((r = n.columnDef.enablePinning) != null ? r : !0) && ((l = (i = o.options.enableColumnPinning) != null ? i : o.options.enablePinning) != null ? l : !0);
1013
+ }), e.getIsPinned = () => {
1014
+ const t = e.getLeafColumns().map((a) => a.id), {
1015
+ left: n,
1016
+ right: r
1017
+ } = o.getState().columnPinning, l = t.some((a) => n == null ? void 0 : n.includes(a)), i = t.some((a) => r == null ? void 0 : r.includes(a));
1018
+ return l ? "left" : i ? "right" : !1;
1019
+ }, e.getPinnedIndex = () => {
1020
+ var t, n;
1021
+ const r = e.getIsPinned();
1022
+ return r ? (t = (n = o.getState().columnPinning) == null || (n = n[r]) == null ? void 0 : n.indexOf(e.id)) != null ? t : -1 : 0;
1023
+ };
1024
+ },
1025
+ createRow: (e, o) => {
1026
+ e.getCenterVisibleCells = S(() => [e._getAllVisibleCells(), o.getState().columnPinning.left, o.getState().columnPinning.right], (t, n, r) => {
1027
+ const l = [...n ?? [], ...r ?? []];
1028
+ return t.filter((i) => !l.includes(i.column.id));
1029
+ }, C(o.options, "debugRows", "getCenterVisibleCells")), e.getLeftVisibleCells = S(() => [e._getAllVisibleCells(), o.getState().columnPinning.left], (t, n) => (n ?? []).map((l) => t.find((i) => i.column.id === l)).filter(Boolean).map((l) => ({
1030
+ ...l,
1031
+ position: "left"
1032
+ })), C(o.options, "debugRows", "getLeftVisibleCells")), e.getRightVisibleCells = S(() => [e._getAllVisibleCells(), o.getState().columnPinning.right], (t, n) => (n ?? []).map((l) => t.find((i) => i.column.id === l)).filter(Boolean).map((l) => ({
1033
+ ...l,
1034
+ position: "right"
1035
+ })), C(o.options, "debugRows", "getRightVisibleCells"));
1036
+ },
1037
+ createTable: (e) => {
1038
+ e.setColumnPinning = (o) => e.options.onColumnPinningChange == null ? void 0 : e.options.onColumnPinningChange(o), e.resetColumnPinning = (o) => {
1039
+ var t, n;
1040
+ return e.setColumnPinning(o ? le() : (t = (n = e.initialState) == null ? void 0 : n.columnPinning) != null ? t : le());
1041
+ }, e.getIsSomeColumnsPinned = (o) => {
1042
+ var t;
1043
+ const n = e.getState().columnPinning;
1044
+ if (!o) {
1045
+ var r, l;
1046
+ return !!((r = n.left) != null && r.length || (l = n.right) != null && l.length);
1047
+ }
1048
+ return !!((t = n[o]) != null && t.length);
1049
+ }, e.getLeftLeafColumns = S(() => [e.getAllLeafColumns(), e.getState().columnPinning.left], (o, t) => (t ?? []).map((n) => o.find((r) => r.id === n)).filter(Boolean), C(e.options, "debugColumns", "getLeftLeafColumns")), e.getRightLeafColumns = S(() => [e.getAllLeafColumns(), e.getState().columnPinning.right], (o, t) => (t ?? []).map((n) => o.find((r) => r.id === n)).filter(Boolean), C(e.options, "debugColumns", "getRightLeafColumns")), e.getCenterLeafColumns = S(() => [e.getAllLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (o, t, n) => {
1050
+ const r = [...t ?? [], ...n ?? []];
1051
+ return o.filter((l) => !r.includes(l.id));
1052
+ }, C(e.options, "debugColumns", "getCenterLeafColumns"));
1053
+ }
1054
+ };
1055
+ function Ot(e) {
1056
+ return e || (typeof document < "u" ? document : null);
1057
+ }
1058
+ const ee = {
1059
+ size: 150,
1060
+ minSize: 20,
1061
+ maxSize: Number.MAX_SAFE_INTEGER
1062
+ }, ie = () => ({
1063
+ startOffset: null,
1064
+ startSize: null,
1065
+ deltaOffset: null,
1066
+ deltaPercentage: null,
1067
+ isResizingColumn: !1,
1068
+ columnSizingStart: []
1069
+ }), bt = {
1070
+ getDefaultColumnDef: () => ee,
1071
+ getInitialState: (e) => ({
1072
+ columnSizing: {},
1073
+ columnSizingInfo: ie(),
1074
+ ...e
1075
+ }),
1076
+ getDefaultOptions: (e) => ({
1077
+ columnResizeMode: "onEnd",
1078
+ columnResizeDirection: "ltr",
1079
+ onColumnSizingChange: H("columnSizing", e),
1080
+ onColumnSizingInfoChange: H("columnSizingInfo", e)
1081
+ }),
1082
+ createColumn: (e, o) => {
1083
+ e.getSize = () => {
1084
+ var t, n, r;
1085
+ const l = o.getState().columnSizing[e.id];
1086
+ return Math.min(Math.max((t = e.columnDef.minSize) != null ? t : ee.minSize, (n = l ?? e.columnDef.size) != null ? n : ee.size), (r = e.columnDef.maxSize) != null ? r : ee.maxSize);
1087
+ }, e.getStart = S((t) => [t, J(o, t), o.getState().columnSizing], (t, n) => n.slice(0, e.getIndex(t)).reduce((r, l) => r + l.getSize(), 0), C(o.options, "debugColumns", "getStart")), e.getAfter = S((t) => [t, J(o, t), o.getState().columnSizing], (t, n) => n.slice(e.getIndex(t) + 1).reduce((r, l) => r + l.getSize(), 0), C(o.options, "debugColumns", "getAfter")), e.resetSize = () => {
1088
+ o.setColumnSizing((t) => {
1089
+ let {
1090
+ [e.id]: n,
1091
+ ...r
1092
+ } = t;
1093
+ return r;
1094
+ });
1095
+ }, e.getCanResize = () => {
1096
+ var t, n;
1097
+ return ((t = e.columnDef.enableResizing) != null ? t : !0) && ((n = o.options.enableColumnResizing) != null ? n : !0);
1098
+ }, e.getIsResizing = () => o.getState().columnSizingInfo.isResizingColumn === e.id;
1099
+ },
1100
+ createHeader: (e, o) => {
1101
+ e.getSize = () => {
1102
+ let t = 0;
1103
+ const n = (r) => {
1104
+ if (r.subHeaders.length)
1105
+ r.subHeaders.forEach(n);
1106
+ else {
1107
+ var l;
1108
+ t += (l = r.column.getSize()) != null ? l : 0;
1109
+ }
1110
+ };
1111
+ return n(e), t;
1112
+ }, e.getStart = () => {
1113
+ if (e.index > 0) {
1114
+ const t = e.headerGroup.headers[e.index - 1];
1115
+ return t.getStart() + t.getSize();
1116
+ }
1117
+ return 0;
1118
+ }, e.getResizeHandler = (t) => {
1119
+ const n = o.getColumn(e.column.id), r = n == null ? void 0 : n.getCanResize();
1120
+ return (l) => {
1121
+ if (!n || !r || (l.persist == null || l.persist(), se(l) && l.touches && l.touches.length > 1))
1122
+ return;
1123
+ const i = e.getSize(), a = e ? e.getLeafHeaders().map((R) => [R.column.id, R.column.getSize()]) : [[n.id, n.getSize()]], u = se(l) ? Math.round(l.touches[0].clientX) : l.clientX, f = {}, c = (R, _) => {
1124
+ typeof _ == "number" && (o.setColumnSizingInfo(($) => {
1125
+ var L, I;
1126
+ const P = o.options.columnResizeDirection === "rtl" ? -1 : 1, T = (_ - ((L = $ == null ? void 0 : $.startOffset) != null ? L : 0)) * P, N = Math.max(T / ((I = $ == null ? void 0 : $.startSize) != null ? I : 0), -0.999999);
1127
+ return $.columnSizingStart.forEach((x) => {
1128
+ let [y, V] = x;
1129
+ f[y] = Math.round(Math.max(V + V * N, 0) * 100) / 100;
1130
+ }), {
1131
+ ...$,
1132
+ deltaOffset: T,
1133
+ deltaPercentage: N
1134
+ };
1135
+ }), (o.options.columnResizeMode === "onChange" || R === "end") && o.setColumnSizing(($) => ({
1136
+ ...$,
1137
+ ...f
1138
+ })));
1139
+ }, p = (R) => c("move", R), d = (R) => {
1140
+ c("end", R), o.setColumnSizingInfo((_) => ({
1141
+ ..._,
1142
+ isResizingColumn: !1,
1143
+ startOffset: null,
1144
+ startSize: null,
1145
+ deltaOffset: null,
1146
+ deltaPercentage: null,
1147
+ columnSizingStart: []
1148
+ }));
1149
+ }, s = Ot(t), m = {
1150
+ moveHandler: (R) => p(R.clientX),
1151
+ upHandler: (R) => {
1152
+ s == null || s.removeEventListener("mousemove", m.moveHandler), s == null || s.removeEventListener("mouseup", m.upHandler), d(R.clientX);
1153
+ }
1154
+ }, h = {
1155
+ moveHandler: (R) => (R.cancelable && (R.preventDefault(), R.stopPropagation()), p(R.touches[0].clientX), !1),
1156
+ upHandler: (R) => {
1157
+ var _;
1158
+ s == null || s.removeEventListener("touchmove", h.moveHandler), s == null || s.removeEventListener("touchend", h.upHandler), R.cancelable && (R.preventDefault(), R.stopPropagation()), d((_ = R.touches[0]) == null ? void 0 : _.clientX);
1159
+ }
1160
+ }, v = Bt() ? {
1161
+ passive: !1
1162
+ } : !1;
1163
+ se(l) ? (s == null || s.addEventListener("touchmove", h.moveHandler, v), s == null || s.addEventListener("touchend", h.upHandler, v)) : (s == null || s.addEventListener("mousemove", m.moveHandler, v), s == null || s.addEventListener("mouseup", m.upHandler, v)), o.setColumnSizingInfo((R) => ({
1164
+ ...R,
1165
+ startOffset: u,
1166
+ startSize: i,
1167
+ deltaOffset: 0,
1168
+ deltaPercentage: 0,
1169
+ columnSizingStart: a,
1170
+ isResizingColumn: n.id
1171
+ }));
1172
+ };
1173
+ };
1174
+ },
1175
+ createTable: (e) => {
1176
+ e.setColumnSizing = (o) => e.options.onColumnSizingChange == null ? void 0 : e.options.onColumnSizingChange(o), e.setColumnSizingInfo = (o) => e.options.onColumnSizingInfoChange == null ? void 0 : e.options.onColumnSizingInfoChange(o), e.resetColumnSizing = (o) => {
1177
+ var t;
1178
+ e.setColumnSizing(o ? {} : (t = e.initialState.columnSizing) != null ? t : {});
1179
+ }, e.resetHeaderSizeInfo = (o) => {
1180
+ var t;
1181
+ e.setColumnSizingInfo(o ? ie() : (t = e.initialState.columnSizingInfo) != null ? t : ie());
1182
+ }, e.getTotalSize = () => {
1183
+ var o, t;
1184
+ return (o = (t = e.getHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, r) => n + r.getSize(), 0)) != null ? o : 0;
1185
+ }, e.getLeftTotalSize = () => {
1186
+ var o, t;
1187
+ return (o = (t = e.getLeftHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, r) => n + r.getSize(), 0)) != null ? o : 0;
1188
+ }, e.getCenterTotalSize = () => {
1189
+ var o, t;
1190
+ return (o = (t = e.getCenterHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, r) => n + r.getSize(), 0)) != null ? o : 0;
1191
+ }, e.getRightTotalSize = () => {
1192
+ var o, t;
1193
+ return (o = (t = e.getRightHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, r) => n + r.getSize(), 0)) != null ? o : 0;
1194
+ };
1195
+ }
1196
+ };
1197
+ let te = null;
1198
+ function Bt() {
1199
+ if (typeof te == "boolean") return te;
1200
+ let e = !1;
1201
+ try {
1202
+ const o = {
1203
+ get passive() {
1204
+ return e = !0, !1;
1205
+ }
1206
+ }, t = () => {
1207
+ };
1208
+ window.addEventListener("test", t, o), window.removeEventListener("test", t);
1209
+ } catch {
1210
+ e = !1;
1211
+ }
1212
+ return te = e, te;
1213
+ }
1214
+ function se(e) {
1215
+ return e.type === "touchstart";
1216
+ }
1217
+ const Tt = {
1218
+ getInitialState: (e) => ({
1219
+ columnVisibility: {},
1220
+ ...e
1221
+ }),
1222
+ getDefaultOptions: (e) => ({
1223
+ onColumnVisibilityChange: H("columnVisibility", e)
1224
+ }),
1225
+ createColumn: (e, o) => {
1226
+ e.toggleVisibility = (t) => {
1227
+ e.getCanHide() && o.setColumnVisibility((n) => ({
1228
+ ...n,
1229
+ [e.id]: t ?? !e.getIsVisible()
1230
+ }));
1231
+ }, e.getIsVisible = () => {
1232
+ var t, n;
1233
+ const r = e.columns;
1234
+ return (t = r.length ? r.some((l) => l.getIsVisible()) : (n = o.getState().columnVisibility) == null ? void 0 : n[e.id]) != null ? t : !0;
1235
+ }, e.getCanHide = () => {
1236
+ var t, n;
1237
+ return ((t = e.columnDef.enableHiding) != null ? t : !0) && ((n = o.options.enableHiding) != null ? n : !0);
1238
+ }, e.getToggleVisibilityHandler = () => (t) => {
1239
+ e.toggleVisibility == null || e.toggleVisibility(t.target.checked);
1240
+ };
1241
+ },
1242
+ createRow: (e, o) => {
1243
+ e._getAllVisibleCells = S(() => [e.getAllCells(), o.getState().columnVisibility], (t) => t.filter((n) => n.column.getIsVisible()), C(o.options, "debugRows", "_getAllVisibleCells")), e.getVisibleCells = S(() => [e.getLeftVisibleCells(), e.getCenterVisibleCells(), e.getRightVisibleCells()], (t, n, r) => [...t, ...n, ...r], C(o.options, "debugRows", "getVisibleCells"));
1244
+ },
1245
+ createTable: (e) => {
1246
+ const o = (t, n) => S(() => [n(), n().filter((r) => r.getIsVisible()).map((r) => r.id).join("_")], (r) => r.filter((l) => l.getIsVisible == null ? void 0 : l.getIsVisible()), C(e.options, "debugColumns", t));
1247
+ e.getVisibleFlatColumns = o("getVisibleFlatColumns", () => e.getAllFlatColumns()), e.getVisibleLeafColumns = o("getVisibleLeafColumns", () => e.getAllLeafColumns()), e.getLeftVisibleLeafColumns = o("getLeftVisibleLeafColumns", () => e.getLeftLeafColumns()), e.getRightVisibleLeafColumns = o("getRightVisibleLeafColumns", () => e.getRightLeafColumns()), e.getCenterVisibleLeafColumns = o("getCenterVisibleLeafColumns", () => e.getCenterLeafColumns()), e.setColumnVisibility = (t) => e.options.onColumnVisibilityChange == null ? void 0 : e.options.onColumnVisibilityChange(t), e.resetColumnVisibility = (t) => {
1248
+ var n;
1249
+ e.setColumnVisibility(t ? {} : (n = e.initialState.columnVisibility) != null ? n : {});
1250
+ }, e.toggleAllColumnsVisible = (t) => {
1251
+ var n;
1252
+ t = (n = t) != null ? n : !e.getIsAllColumnsVisible(), e.setColumnVisibility(e.getAllLeafColumns().reduce((r, l) => ({
1253
+ ...r,
1254
+ [l.id]: t || !(l.getCanHide != null && l.getCanHide())
1255
+ }), {}));
1256
+ }, e.getIsAllColumnsVisible = () => !e.getAllLeafColumns().some((t) => !(t.getIsVisible != null && t.getIsVisible())), e.getIsSomeColumnsVisible = () => e.getAllLeafColumns().some((t) => t.getIsVisible == null ? void 0 : t.getIsVisible()), e.getToggleAllColumnsVisibilityHandler = () => (t) => {
1257
+ var n;
1258
+ e.toggleAllColumnsVisible((n = t.target) == null ? void 0 : n.checked);
1259
+ };
1260
+ }
1261
+ };
1262
+ function J(e, o) {
1263
+ return o ? o === "center" ? e.getCenterVisibleLeafColumns() : o === "left" ? e.getLeftVisibleLeafColumns() : e.getRightVisibleLeafColumns() : e.getVisibleLeafColumns();
1264
+ }
1265
+ const qt = {
1266
+ createTable: (e) => {
1267
+ e._getGlobalFacetedRowModel = e.options.getFacetedRowModel && e.options.getFacetedRowModel(e, "__global__"), e.getGlobalFacetedRowModel = () => e.options.manualFiltering || !e._getGlobalFacetedRowModel ? e.getPreFilteredRowModel() : e._getGlobalFacetedRowModel(), e._getGlobalFacetedUniqueValues = e.options.getFacetedUniqueValues && e.options.getFacetedUniqueValues(e, "__global__"), e.getGlobalFacetedUniqueValues = () => e._getGlobalFacetedUniqueValues ? e._getGlobalFacetedUniqueValues() : /* @__PURE__ */ new Map(), e._getGlobalFacetedMinMaxValues = e.options.getFacetedMinMaxValues && e.options.getFacetedMinMaxValues(e, "__global__"), e.getGlobalFacetedMinMaxValues = () => {
1268
+ if (e._getGlobalFacetedMinMaxValues)
1269
+ return e._getGlobalFacetedMinMaxValues();
1270
+ };
1271
+ }
1272
+ }, jt = {
1273
+ getInitialState: (e) => ({
1274
+ globalFilter: void 0,
1275
+ ...e
1276
+ }),
1277
+ getDefaultOptions: (e) => ({
1278
+ onGlobalFilterChange: H("globalFilter", e),
1279
+ globalFilterFn: "auto",
1280
+ getColumnCanGlobalFilter: (o) => {
1281
+ var t;
1282
+ const n = (t = e.getCoreRowModel().flatRows[0]) == null || (t = t._getAllCellsByColumnId()[o.id]) == null ? void 0 : t.getValue();
1283
+ return typeof n == "string" || typeof n == "number";
1284
+ }
1285
+ }),
1286
+ createColumn: (e, o) => {
1287
+ e.getCanGlobalFilter = () => {
1288
+ var t, n, r, l;
1289
+ return ((t = e.columnDef.enableGlobalFilter) != null ? t : !0) && ((n = o.options.enableGlobalFilter) != null ? n : !0) && ((r = o.options.enableFilters) != null ? r : !0) && ((l = o.options.getColumnCanGlobalFilter == null ? void 0 : o.options.getColumnCanGlobalFilter(e)) != null ? l : !0) && !!e.accessorFn;
1290
+ };
1291
+ },
1292
+ createTable: (e) => {
1293
+ e.getGlobalAutoFilterFn = () => O.includesString, e.getGlobalFilterFn = () => {
1294
+ var o, t;
1295
+ const {
1296
+ globalFilterFn: n
1297
+ } = e.options;
1298
+ return ne(n) ? n : n === "auto" ? e.getGlobalAutoFilterFn() : (o = (t = e.options.filterFns) == null ? void 0 : t[n]) != null ? o : O[n];
1299
+ }, e.setGlobalFilter = (o) => {
1300
+ e.options.onGlobalFilterChange == null || e.options.onGlobalFilterChange(o);
1301
+ }, e.resetGlobalFilter = (o) => {
1302
+ e.setGlobalFilter(o ? void 0 : e.initialState.globalFilter);
1303
+ };
1304
+ }
1305
+ }, Ut = {
1306
+ getInitialState: (e) => ({
1307
+ expanded: {},
1308
+ ...e
1309
+ }),
1310
+ getDefaultOptions: (e) => ({
1311
+ onExpandedChange: H("expanded", e),
1312
+ paginateExpandedRows: !0
1313
+ }),
1314
+ createTable: (e) => {
1315
+ let o = !1, t = !1;
1316
+ e._autoResetExpanded = () => {
1317
+ var n, r;
1318
+ if (!o) {
1319
+ e._queue(() => {
1320
+ o = !0;
1321
+ });
1322
+ return;
1323
+ }
1324
+ if ((n = (r = e.options.autoResetAll) != null ? r : e.options.autoResetExpanded) != null ? n : !e.options.manualExpanding) {
1325
+ if (t) return;
1326
+ t = !0, e._queue(() => {
1327
+ e.resetExpanded(), t = !1;
1328
+ });
1329
+ }
1330
+ }, e.setExpanded = (n) => e.options.onExpandedChange == null ? void 0 : e.options.onExpandedChange(n), e.toggleAllRowsExpanded = (n) => {
1331
+ n ?? !e.getIsAllRowsExpanded() ? e.setExpanded(!0) : e.setExpanded({});
1332
+ }, e.resetExpanded = (n) => {
1333
+ var r, l;
1334
+ e.setExpanded(n ? {} : (r = (l = e.initialState) == null ? void 0 : l.expanded) != null ? r : {});
1335
+ }, e.getCanSomeRowsExpand = () => e.getPrePaginationRowModel().flatRows.some((n) => n.getCanExpand()), e.getToggleAllRowsExpandedHandler = () => (n) => {
1336
+ n.persist == null || n.persist(), e.toggleAllRowsExpanded();
1337
+ }, e.getIsSomeRowsExpanded = () => {
1338
+ const n = e.getState().expanded;
1339
+ return n === !0 || Object.values(n).some(Boolean);
1340
+ }, e.getIsAllRowsExpanded = () => {
1341
+ const n = e.getState().expanded;
1342
+ return typeof n == "boolean" ? n === !0 : !(!Object.keys(n).length || e.getRowModel().flatRows.some((r) => !r.getIsExpanded()));
1343
+ }, e.getExpandedDepth = () => {
1344
+ let n = 0;
1345
+ return (e.getState().expanded === !0 ? Object.keys(e.getRowModel().rowsById) : Object.keys(e.getState().expanded)).forEach((l) => {
1346
+ const i = l.split(".");
1347
+ n = Math.max(n, i.length);
1348
+ }), n;
1349
+ }, e.getPreExpandedRowModel = () => e.getSortedRowModel(), e.getExpandedRowModel = () => (!e._getExpandedRowModel && e.options.getExpandedRowModel && (e._getExpandedRowModel = e.options.getExpandedRowModel(e)), e.options.manualExpanding || !e._getExpandedRowModel ? e.getPreExpandedRowModel() : e._getExpandedRowModel());
1350
+ },
1351
+ createRow: (e, o) => {
1352
+ e.toggleExpanded = (t) => {
1353
+ o.setExpanded((n) => {
1354
+ var r;
1355
+ const l = n === !0 ? !0 : !!(n != null && n[e.id]);
1356
+ let i = {};
1357
+ if (n === !0 ? Object.keys(o.getRowModel().rowsById).forEach((a) => {
1358
+ i[a] = !0;
1359
+ }) : i = n, t = (r = t) != null ? r : !l, !l && t)
1360
+ return {
1361
+ ...i,
1362
+ [e.id]: !0
1363
+ };
1364
+ if (l && !t) {
1365
+ const {
1366
+ [e.id]: a,
1367
+ ...u
1368
+ } = i;
1369
+ return u;
1370
+ }
1371
+ return n;
1372
+ });
1373
+ }, e.getIsExpanded = () => {
1374
+ var t;
1375
+ const n = o.getState().expanded;
1376
+ return !!((t = o.options.getIsRowExpanded == null ? void 0 : o.options.getIsRowExpanded(e)) != null ? t : n === !0 || n != null && n[e.id]);
1377
+ }, e.getCanExpand = () => {
1378
+ var t, n, r;
1379
+ return (t = o.options.getRowCanExpand == null ? void 0 : o.options.getRowCanExpand(e)) != null ? t : ((n = o.options.enableExpanding) != null ? n : !0) && !!((r = e.subRows) != null && r.length);
1380
+ }, e.getIsAllParentsExpanded = () => {
1381
+ let t = !0, n = e;
1382
+ for (; t && n.parentId; )
1383
+ n = o.getRow(n.parentId, !0), t = n.getIsExpanded();
1384
+ return t;
1385
+ }, e.getToggleExpandedHandler = () => {
1386
+ const t = e.getCanExpand();
1387
+ return () => {
1388
+ t && e.toggleExpanded();
1389
+ };
1390
+ };
1391
+ }
1392
+ }, me = 0, he = 10, ae = () => ({
1393
+ pageIndex: me,
1394
+ pageSize: he
1395
+ }), Kt = {
1396
+ getInitialState: (e) => ({
1397
+ ...e,
1398
+ pagination: {
1399
+ ...ae(),
1400
+ ...e == null ? void 0 : e.pagination
1401
+ }
1402
+ }),
1403
+ getDefaultOptions: (e) => ({
1404
+ onPaginationChange: H("pagination", e)
1405
+ }),
1406
+ createTable: (e) => {
1407
+ let o = !1, t = !1;
1408
+ e._autoResetPageIndex = () => {
1409
+ var n, r;
1410
+ if (!o) {
1411
+ e._queue(() => {
1412
+ o = !0;
1413
+ });
1414
+ return;
1415
+ }
1416
+ if ((n = (r = e.options.autoResetAll) != null ? r : e.options.autoResetPageIndex) != null ? n : !e.options.manualPagination) {
1417
+ if (t) return;
1418
+ t = !0, e._queue(() => {
1419
+ e.resetPageIndex(), t = !1;
1420
+ });
1421
+ }
1422
+ }, e.setPagination = (n) => {
1423
+ const r = (l) => b(n, l);
1424
+ return e.options.onPaginationChange == null ? void 0 : e.options.onPaginationChange(r);
1425
+ }, e.resetPagination = (n) => {
1426
+ var r;
1427
+ e.setPagination(n ? ae() : (r = e.initialState.pagination) != null ? r : ae());
1428
+ }, e.setPageIndex = (n) => {
1429
+ e.setPagination((r) => {
1430
+ let l = b(n, r.pageIndex);
1431
+ const i = typeof e.options.pageCount > "u" || e.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : e.options.pageCount - 1;
1432
+ return l = Math.max(0, Math.min(l, i)), {
1433
+ ...r,
1434
+ pageIndex: l
1435
+ };
1436
+ });
1437
+ }, e.resetPageIndex = (n) => {
1438
+ var r, l;
1439
+ e.setPageIndex(n ? me : (r = (l = e.initialState) == null || (l = l.pagination) == null ? void 0 : l.pageIndex) != null ? r : me);
1440
+ }, e.resetPageSize = (n) => {
1441
+ var r, l;
1442
+ e.setPageSize(n ? he : (r = (l = e.initialState) == null || (l = l.pagination) == null ? void 0 : l.pageSize) != null ? r : he);
1443
+ }, e.setPageSize = (n) => {
1444
+ e.setPagination((r) => {
1445
+ const l = Math.max(1, b(n, r.pageSize)), i = r.pageSize * r.pageIndex, a = Math.floor(i / l);
1446
+ return {
1447
+ ...r,
1448
+ pageIndex: a,
1449
+ pageSize: l
1450
+ };
1451
+ });
1452
+ }, e.setPageCount = (n) => e.setPagination((r) => {
1453
+ var l;
1454
+ let i = b(n, (l = e.options.pageCount) != null ? l : -1);
1455
+ return typeof i == "number" && (i = Math.max(-1, i)), {
1456
+ ...r,
1457
+ pageCount: i
1458
+ };
1459
+ }), e.getPageOptions = S(() => [e.getPageCount()], (n) => {
1460
+ let r = [];
1461
+ return n && n > 0 && (r = [...new Array(n)].fill(null).map((l, i) => i)), r;
1462
+ }, C(e.options, "debugTable", "getPageOptions")), e.getCanPreviousPage = () => e.getState().pagination.pageIndex > 0, e.getCanNextPage = () => {
1463
+ const {
1464
+ pageIndex: n
1465
+ } = e.getState().pagination, r = e.getPageCount();
1466
+ return r === -1 ? !0 : r === 0 ? !1 : n < r - 1;
1467
+ }, e.previousPage = () => e.setPageIndex((n) => n - 1), e.nextPage = () => e.setPageIndex((n) => n + 1), e.firstPage = () => e.setPageIndex(0), e.lastPage = () => e.setPageIndex(e.getPageCount() - 1), e.getPrePaginationRowModel = () => e.getExpandedRowModel(), e.getPaginationRowModel = () => (!e._getPaginationRowModel && e.options.getPaginationRowModel && (e._getPaginationRowModel = e.options.getPaginationRowModel(e)), e.options.manualPagination || !e._getPaginationRowModel ? e.getPrePaginationRowModel() : e._getPaginationRowModel()), e.getPageCount = () => {
1468
+ var n;
1469
+ return (n = e.options.pageCount) != null ? n : Math.ceil(e.getRowCount() / e.getState().pagination.pageSize);
1470
+ }, e.getRowCount = () => {
1471
+ var n;
1472
+ return (n = e.options.rowCount) != null ? n : e.getPrePaginationRowModel().rows.length;
1473
+ };
1474
+ }
1475
+ }, ue = () => ({
1476
+ top: [],
1477
+ bottom: []
1478
+ }), Xt = {
1479
+ getInitialState: (e) => ({
1480
+ rowPinning: ue(),
1481
+ ...e
1482
+ }),
1483
+ getDefaultOptions: (e) => ({
1484
+ onRowPinningChange: H("rowPinning", e)
1485
+ }),
1486
+ createRow: (e, o) => {
1487
+ e.pin = (t, n, r) => {
1488
+ const l = n ? e.getLeafRows().map((u) => {
1489
+ let {
1490
+ id: f
1491
+ } = u;
1492
+ return f;
1493
+ }) : [], i = r ? e.getParentRows().map((u) => {
1494
+ let {
1495
+ id: f
1496
+ } = u;
1497
+ return f;
1498
+ }) : [], a = /* @__PURE__ */ new Set([...i, e.id, ...l]);
1499
+ o.setRowPinning((u) => {
1500
+ var f, c;
1501
+ if (t === "bottom") {
1502
+ var p, d;
1503
+ return {
1504
+ top: ((p = u == null ? void 0 : u.top) != null ? p : []).filter((h) => !(a != null && a.has(h))),
1505
+ bottom: [...((d = u == null ? void 0 : u.bottom) != null ? d : []).filter((h) => !(a != null && a.has(h))), ...Array.from(a)]
1506
+ };
1507
+ }
1508
+ if (t === "top") {
1509
+ var s, m;
1510
+ return {
1511
+ top: [...((s = u == null ? void 0 : u.top) != null ? s : []).filter((h) => !(a != null && a.has(h))), ...Array.from(a)],
1512
+ bottom: ((m = u == null ? void 0 : u.bottom) != null ? m : []).filter((h) => !(a != null && a.has(h)))
1513
+ };
1514
+ }
1515
+ return {
1516
+ top: ((f = u == null ? void 0 : u.top) != null ? f : []).filter((h) => !(a != null && a.has(h))),
1517
+ bottom: ((c = u == null ? void 0 : u.bottom) != null ? c : []).filter((h) => !(a != null && a.has(h)))
1518
+ };
1519
+ });
1520
+ }, e.getCanPin = () => {
1521
+ var t;
1522
+ const {
1523
+ enableRowPinning: n,
1524
+ enablePinning: r
1525
+ } = o.options;
1526
+ return typeof n == "function" ? n(e) : (t = n ?? r) != null ? t : !0;
1527
+ }, e.getIsPinned = () => {
1528
+ const t = [e.id], {
1529
+ top: n,
1530
+ bottom: r
1531
+ } = o.getState().rowPinning, l = t.some((a) => n == null ? void 0 : n.includes(a)), i = t.some((a) => r == null ? void 0 : r.includes(a));
1532
+ return l ? "top" : i ? "bottom" : !1;
1533
+ }, e.getPinnedIndex = () => {
1534
+ var t, n;
1535
+ const r = e.getIsPinned();
1536
+ if (!r) return -1;
1537
+ const l = (t = r === "top" ? o.getTopRows() : o.getBottomRows()) == null ? void 0 : t.map((i) => {
1538
+ let {
1539
+ id: a
1540
+ } = i;
1541
+ return a;
1542
+ });
1543
+ return (n = l == null ? void 0 : l.indexOf(e.id)) != null ? n : -1;
1544
+ };
1545
+ },
1546
+ createTable: (e) => {
1547
+ e.setRowPinning = (o) => e.options.onRowPinningChange == null ? void 0 : e.options.onRowPinningChange(o), e.resetRowPinning = (o) => {
1548
+ var t, n;
1549
+ return e.setRowPinning(o ? ue() : (t = (n = e.initialState) == null ? void 0 : n.rowPinning) != null ? t : ue());
1550
+ }, e.getIsSomeRowsPinned = (o) => {
1551
+ var t;
1552
+ const n = e.getState().rowPinning;
1553
+ if (!o) {
1554
+ var r, l;
1555
+ return !!((r = n.top) != null && r.length || (l = n.bottom) != null && l.length);
1556
+ }
1557
+ return !!((t = n[o]) != null && t.length);
1558
+ }, e._getPinnedRows = (o, t, n) => {
1559
+ var r;
1560
+ return ((r = e.options.keepPinnedRows) == null || r ? (
1561
+ //get all rows that are pinned even if they would not be otherwise visible
1562
+ //account for expanded parent rows, but not pagination or filtering
1563
+ (t ?? []).map((i) => {
1564
+ const a = e.getRow(i, !0);
1565
+ return a.getIsAllParentsExpanded() ? a : null;
1566
+ })
1567
+ ) : (
1568
+ //else get only visible rows that are pinned
1569
+ (t ?? []).map((i) => o.find((a) => a.id === i))
1570
+ )).filter(Boolean).map((i) => ({
1571
+ ...i,
1572
+ position: n
1573
+ }));
1574
+ }, e.getTopRows = S(() => [e.getRowModel().rows, e.getState().rowPinning.top], (o, t) => e._getPinnedRows(o, t, "top"), C(e.options, "debugRows", "getTopRows")), e.getBottomRows = S(() => [e.getRowModel().rows, e.getState().rowPinning.bottom], (o, t) => e._getPinnedRows(o, t, "bottom"), C(e.options, "debugRows", "getBottomRows")), e.getCenterRows = S(() => [e.getRowModel().rows, e.getState().rowPinning.top, e.getState().rowPinning.bottom], (o, t, n) => {
1575
+ const r = /* @__PURE__ */ new Set([...t ?? [], ...n ?? []]);
1576
+ return o.filter((l) => !r.has(l.id));
1577
+ }, C(e.options, "debugRows", "getCenterRows"));
1578
+ }
1579
+ }, Zt = {
1580
+ getInitialState: (e) => ({
1581
+ rowSelection: {},
1582
+ ...e
1583
+ }),
1584
+ getDefaultOptions: (e) => ({
1585
+ onRowSelectionChange: H("rowSelection", e),
1586
+ enableRowSelection: !0,
1587
+ enableMultiRowSelection: !0,
1588
+ enableSubRowSelection: !0
1589
+ // enableGroupingRowSelection: false,
1590
+ // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
1591
+ // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
1592
+ }),
1593
+ createTable: (e) => {
1594
+ e.setRowSelection = (o) => e.options.onRowSelectionChange == null ? void 0 : e.options.onRowSelectionChange(o), e.resetRowSelection = (o) => {
1595
+ var t;
1596
+ return e.setRowSelection(o ? {} : (t = e.initialState.rowSelection) != null ? t : {});
1597
+ }, e.toggleAllRowsSelected = (o) => {
1598
+ e.setRowSelection((t) => {
1599
+ o = typeof o < "u" ? o : !e.getIsAllRowsSelected();
1600
+ const n = {
1601
+ ...t
1602
+ }, r = e.getPreGroupedRowModel().flatRows;
1603
+ return o ? r.forEach((l) => {
1604
+ l.getCanSelect() && (n[l.id] = !0);
1605
+ }) : r.forEach((l) => {
1606
+ delete n[l.id];
1607
+ }), n;
1608
+ });
1609
+ }, e.toggleAllPageRowsSelected = (o) => e.setRowSelection((t) => {
1610
+ const n = typeof o < "u" ? o : !e.getIsAllPageRowsSelected(), r = {
1611
+ ...t
1612
+ };
1613
+ return e.getRowModel().rows.forEach((l) => {
1614
+ we(r, l.id, n, !0, e);
1615
+ }), r;
1616
+ }), e.getPreSelectedRowModel = () => e.getCoreRowModel(), e.getSelectedRowModel = S(() => [e.getState().rowSelection, e.getCoreRowModel()], (o, t) => Object.keys(o).length ? fe(e, t) : {
1617
+ rows: [],
1618
+ flatRows: [],
1619
+ rowsById: {}
1620
+ }, C(e.options, "debugTable", "getSelectedRowModel")), e.getFilteredSelectedRowModel = S(() => [e.getState().rowSelection, e.getFilteredRowModel()], (o, t) => Object.keys(o).length ? fe(e, t) : {
1621
+ rows: [],
1622
+ flatRows: [],
1623
+ rowsById: {}
1624
+ }, C(e.options, "debugTable", "getFilteredSelectedRowModel")), e.getGroupedSelectedRowModel = S(() => [e.getState().rowSelection, e.getSortedRowModel()], (o, t) => Object.keys(o).length ? fe(e, t) : {
1625
+ rows: [],
1626
+ flatRows: [],
1627
+ rowsById: {}
1628
+ }, C(e.options, "debugTable", "getGroupedSelectedRowModel")), e.getIsAllRowsSelected = () => {
1629
+ const o = e.getFilteredRowModel().flatRows, {
1630
+ rowSelection: t
1631
+ } = e.getState();
1632
+ let n = !!(o.length && Object.keys(t).length);
1633
+ return n && o.some((r) => r.getCanSelect() && !t[r.id]) && (n = !1), n;
1634
+ }, e.getIsAllPageRowsSelected = () => {
1635
+ const o = e.getPaginationRowModel().flatRows.filter((r) => r.getCanSelect()), {
1636
+ rowSelection: t
1637
+ } = e.getState();
1638
+ let n = !!o.length;
1639
+ return n && o.some((r) => !t[r.id]) && (n = !1), n;
1640
+ }, e.getIsSomeRowsSelected = () => {
1641
+ var o;
1642
+ const t = Object.keys((o = e.getState().rowSelection) != null ? o : {}).length;
1643
+ return t > 0 && t < e.getFilteredRowModel().flatRows.length;
1644
+ }, e.getIsSomePageRowsSelected = () => {
1645
+ const o = e.getPaginationRowModel().flatRows;
1646
+ return e.getIsAllPageRowsSelected() ? !1 : o.filter((t) => t.getCanSelect()).some((t) => t.getIsSelected() || t.getIsSomeSelected());
1647
+ }, e.getToggleAllRowsSelectedHandler = () => (o) => {
1648
+ e.toggleAllRowsSelected(o.target.checked);
1649
+ }, e.getToggleAllPageRowsSelectedHandler = () => (o) => {
1650
+ e.toggleAllPageRowsSelected(o.target.checked);
1651
+ };
1652
+ },
1653
+ createRow: (e, o) => {
1654
+ e.toggleSelected = (t, n) => {
1655
+ const r = e.getIsSelected();
1656
+ o.setRowSelection((l) => {
1657
+ var i;
1658
+ if (t = typeof t < "u" ? t : !r, e.getCanSelect() && r === t)
1659
+ return l;
1660
+ const a = {
1661
+ ...l
1662
+ };
1663
+ return we(a, e.id, t, (i = n == null ? void 0 : n.selectChildren) != null ? i : !0, o), a;
1664
+ });
1665
+ }, e.getIsSelected = () => {
1666
+ const {
1667
+ rowSelection: t
1668
+ } = o.getState();
1669
+ return Fe(e, t);
1670
+ }, e.getIsSomeSelected = () => {
1671
+ const {
1672
+ rowSelection: t
1673
+ } = o.getState();
1674
+ return ve(e, t) === "some";
1675
+ }, e.getIsAllSubRowsSelected = () => {
1676
+ const {
1677
+ rowSelection: t
1678
+ } = o.getState();
1679
+ return ve(e, t) === "all";
1680
+ }, e.getCanSelect = () => {
1681
+ var t;
1682
+ return typeof o.options.enableRowSelection == "function" ? o.options.enableRowSelection(e) : (t = o.options.enableRowSelection) != null ? t : !0;
1683
+ }, e.getCanSelectSubRows = () => {
1684
+ var t;
1685
+ return typeof o.options.enableSubRowSelection == "function" ? o.options.enableSubRowSelection(e) : (t = o.options.enableSubRowSelection) != null ? t : !0;
1686
+ }, e.getCanMultiSelect = () => {
1687
+ var t;
1688
+ return typeof o.options.enableMultiRowSelection == "function" ? o.options.enableMultiRowSelection(e) : (t = o.options.enableMultiRowSelection) != null ? t : !0;
1689
+ }, e.getToggleSelectedHandler = () => {
1690
+ const t = e.getCanSelect();
1691
+ return (n) => {
1692
+ var r;
1693
+ t && e.toggleSelected((r = n.target) == null ? void 0 : r.checked);
1694
+ };
1695
+ };
1696
+ }
1697
+ }, we = (e, o, t, n, r) => {
1698
+ var l;
1699
+ const i = r.getRow(o, !0);
1700
+ t ? (i.getCanMultiSelect() || Object.keys(e).forEach((a) => delete e[a]), i.getCanSelect() && (e[o] = !0)) : delete e[o], n && (l = i.subRows) != null && l.length && i.getCanSelectSubRows() && i.subRows.forEach((a) => we(e, a.id, t, n, r));
1701
+ };
1702
+ function fe(e, o) {
1703
+ const t = e.getState().rowSelection, n = [], r = {}, l = function(i, a) {
1704
+ return i.map((u) => {
1705
+ var f;
1706
+ const c = Fe(u, t);
1707
+ if (c && (n.push(u), r[u.id] = u), (f = u.subRows) != null && f.length && (u = {
1708
+ ...u,
1709
+ subRows: l(u.subRows)
1710
+ }), c)
1711
+ return u;
1712
+ }).filter(Boolean);
1713
+ };
1714
+ return {
1715
+ rows: l(o.rows),
1716
+ flatRows: n,
1717
+ rowsById: r
1718
+ };
1719
+ }
1720
+ function Fe(e, o) {
1721
+ var t;
1722
+ return (t = o[e.id]) != null ? t : !1;
1723
+ }
1724
+ function ve(e, o, t) {
1725
+ var n;
1726
+ if (!((n = e.subRows) != null && n.length)) return !1;
1727
+ let r = !0, l = !1;
1728
+ return e.subRows.forEach((i) => {
1729
+ if (!(l && !r) && (i.getCanSelect() && (Fe(i, o) ? l = !0 : r = !1), i.subRows && i.subRows.length)) {
1730
+ const a = ve(i, o);
1731
+ a === "all" ? l = !0 : (a === "some" && (l = !0), r = !1);
1732
+ }
1733
+ }), r ? "all" : l ? "some" : !1;
1734
+ }
1735
+ const Se = /([0-9]+)/gm, Wt = (e, o, t) => Ze(B(e.getValue(t)).toLowerCase(), B(o.getValue(t)).toLowerCase()), Yt = (e, o, t) => Ze(B(e.getValue(t)), B(o.getValue(t))), Jt = (e, o, t) => $e(B(e.getValue(t)).toLowerCase(), B(o.getValue(t)).toLowerCase()), Qt = (e, o, t) => $e(B(e.getValue(t)), B(o.getValue(t))), en = (e, o, t) => {
1736
+ const n = e.getValue(t), r = o.getValue(t);
1737
+ return n > r ? 1 : n < r ? -1 : 0;
1738
+ }, tn = (e, o, t) => $e(e.getValue(t), o.getValue(t));
1739
+ function $e(e, o) {
1740
+ return e === o ? 0 : e > o ? 1 : -1;
1741
+ }
1742
+ function B(e) {
1743
+ return typeof e == "number" ? isNaN(e) || e === 1 / 0 || e === -1 / 0 ? "" : String(e) : typeof e == "string" ? e : "";
1744
+ }
1745
+ function Ze(e, o) {
1746
+ const t = e.split(Se).filter(Boolean), n = o.split(Se).filter(Boolean);
1747
+ for (; t.length && n.length; ) {
1748
+ const r = t.shift(), l = n.shift(), i = parseInt(r, 10), a = parseInt(l, 10), u = [i, a].sort();
1749
+ if (isNaN(u[0])) {
1750
+ if (r > l)
1751
+ return 1;
1752
+ if (l > r)
1753
+ return -1;
1754
+ continue;
1755
+ }
1756
+ if (isNaN(u[1]))
1757
+ return isNaN(i) ? -1 : 1;
1758
+ if (i > a)
1759
+ return 1;
1760
+ if (a > i)
1761
+ return -1;
1762
+ }
1763
+ return t.length - n.length;
1764
+ }
1765
+ const W = {
1766
+ alphanumeric: Wt,
1767
+ alphanumericCaseSensitive: Yt,
1768
+ text: Jt,
1769
+ textCaseSensitive: Qt,
1770
+ datetime: en,
1771
+ basic: tn
1772
+ }, nn = {
1773
+ getInitialState: (e) => ({
1774
+ sorting: [],
1775
+ ...e
1776
+ }),
1777
+ getDefaultColumnDef: () => ({
1778
+ sortingFn: "auto",
1779
+ sortUndefined: 1
1780
+ }),
1781
+ getDefaultOptions: (e) => ({
1782
+ onSortingChange: H("sorting", e),
1783
+ isMultiSortEvent: (o) => o.shiftKey
1784
+ }),
1785
+ createColumn: (e, o) => {
1786
+ e.getAutoSortingFn = () => {
1787
+ const t = o.getFilteredRowModel().flatRows.slice(10);
1788
+ let n = !1;
1789
+ for (const r of t) {
1790
+ const l = r == null ? void 0 : r.getValue(e.id);
1791
+ if (Object.prototype.toString.call(l) === "[object Date]")
1792
+ return W.datetime;
1793
+ if (typeof l == "string" && (n = !0, l.split(Se).length > 1))
1794
+ return W.alphanumeric;
1795
+ }
1796
+ return n ? W.text : W.basic;
1797
+ }, e.getAutoSortDir = () => {
1798
+ const t = o.getFilteredRowModel().flatRows[0];
1799
+ return typeof (t == null ? void 0 : t.getValue(e.id)) == "string" ? "asc" : "desc";
1800
+ }, e.getSortingFn = () => {
1801
+ var t, n;
1802
+ if (!e)
1803
+ throw new Error();
1804
+ return ne(e.columnDef.sortingFn) ? e.columnDef.sortingFn : e.columnDef.sortingFn === "auto" ? e.getAutoSortingFn() : (t = (n = o.options.sortingFns) == null ? void 0 : n[e.columnDef.sortingFn]) != null ? t : W[e.columnDef.sortingFn];
1805
+ }, e.toggleSorting = (t, n) => {
1806
+ const r = e.getNextSortingOrder(), l = typeof t < "u" && t !== null;
1807
+ o.setSorting((i) => {
1808
+ const a = i == null ? void 0 : i.find((s) => s.id === e.id), u = i == null ? void 0 : i.findIndex((s) => s.id === e.id);
1809
+ let f = [], c, p = l ? t : r === "desc";
1810
+ if (i != null && i.length && e.getCanMultiSort() && n ? a ? c = "toggle" : c = "add" : i != null && i.length && u !== i.length - 1 ? c = "replace" : a ? c = "toggle" : c = "replace", c === "toggle" && (l || r || (c = "remove")), c === "add") {
1811
+ var d;
1812
+ f = [...i, {
1813
+ id: e.id,
1814
+ desc: p
1815
+ }], f.splice(0, f.length - ((d = o.options.maxMultiSortColCount) != null ? d : Number.MAX_SAFE_INTEGER));
1816
+ } else c === "toggle" ? f = i.map((s) => s.id === e.id ? {
1817
+ ...s,
1818
+ desc: p
1819
+ } : s) : c === "remove" ? f = i.filter((s) => s.id !== e.id) : f = [{
1820
+ id: e.id,
1821
+ desc: p
1822
+ }];
1823
+ return f;
1824
+ });
1825
+ }, e.getFirstSortDir = () => {
1826
+ var t, n;
1827
+ return ((t = (n = e.columnDef.sortDescFirst) != null ? n : o.options.sortDescFirst) != null ? t : e.getAutoSortDir() === "desc") ? "desc" : "asc";
1828
+ }, e.getNextSortingOrder = (t) => {
1829
+ var n, r;
1830
+ const l = e.getFirstSortDir(), i = e.getIsSorted();
1831
+ return i ? i !== l && ((n = o.options.enableSortingRemoval) == null || n) && // If enableSortRemove, enable in general
1832
+ (!(t && (r = o.options.enableMultiRemove) != null) || r) ? !1 : i === "desc" ? "asc" : "desc" : l;
1833
+ }, e.getCanSort = () => {
1834
+ var t, n;
1835
+ return ((t = e.columnDef.enableSorting) != null ? t : !0) && ((n = o.options.enableSorting) != null ? n : !0) && !!e.accessorFn;
1836
+ }, e.getCanMultiSort = () => {
1837
+ var t, n;
1838
+ return (t = (n = e.columnDef.enableMultiSort) != null ? n : o.options.enableMultiSort) != null ? t : !!e.accessorFn;
1839
+ }, e.getIsSorted = () => {
1840
+ var t;
1841
+ const n = (t = o.getState().sorting) == null ? void 0 : t.find((r) => r.id === e.id);
1842
+ return n ? n.desc ? "desc" : "asc" : !1;
1843
+ }, e.getSortIndex = () => {
1844
+ var t, n;
1845
+ return (t = (n = o.getState().sorting) == null ? void 0 : n.findIndex((r) => r.id === e.id)) != null ? t : -1;
1846
+ }, e.clearSorting = () => {
1847
+ o.setSorting((t) => t != null && t.length ? t.filter((n) => n.id !== e.id) : []);
1848
+ }, e.getToggleSortingHandler = () => {
1849
+ const t = e.getCanSort();
1850
+ return (n) => {
1851
+ t && (n.persist == null || n.persist(), e.toggleSorting == null || e.toggleSorting(void 0, e.getCanMultiSort() ? o.options.isMultiSortEvent == null ? void 0 : o.options.isMultiSortEvent(n) : !1));
1852
+ };
1853
+ };
1854
+ },
1855
+ createTable: (e) => {
1856
+ e.setSorting = (o) => e.options.onSortingChange == null ? void 0 : e.options.onSortingChange(o), e.resetSorting = (o) => {
1857
+ var t, n;
1858
+ e.setSorting(o ? [] : (t = (n = e.initialState) == null ? void 0 : n.sorting) != null ? t : []);
1859
+ }, e.getPreSortedRowModel = () => e.getGroupedRowModel(), e.getSortedRowModel = () => (!e._getSortedRowModel && e.options.getSortedRowModel && (e._getSortedRowModel = e.options.getSortedRowModel(e)), e.options.manualSorting || !e._getSortedRowModel ? e.getPreSortedRowModel() : e._getSortedRowModel());
1860
+ }
1861
+ }, on = [
1862
+ _t,
1863
+ Tt,
1864
+ zt,
1865
+ kt,
1866
+ Ft,
1867
+ $t,
1868
+ qt,
1869
+ //depends on ColumnFaceting
1870
+ jt,
1871
+ //depends on ColumnFiltering
1872
+ nn,
1873
+ Gt,
1874
+ //depends on RowSorting
1875
+ Ut,
1876
+ Kt,
1877
+ Xt,
1878
+ Zt,
1879
+ bt
1880
+ ];
1881
+ function rn(e) {
1882
+ var o, t;
1883
+ process.env.NODE_ENV !== "production" && (e.debugAll || e.debugTable) && console.info("Creating Table Instance...");
1884
+ const n = [...on, ...(o = e._features) != null ? o : []];
1885
+ let r = {
1886
+ _features: n
1887
+ };
1888
+ const l = r._features.reduce((d, s) => Object.assign(d, s.getDefaultOptions == null ? void 0 : s.getDefaultOptions(r)), {}), i = (d) => r.options.mergeOptions ? r.options.mergeOptions(l, d) : {
1889
+ ...l,
1890
+ ...d
1891
+ };
1892
+ let u = {
1893
+ ...{},
1894
+ ...(t = e.initialState) != null ? t : {}
1895
+ };
1896
+ r._features.forEach((d) => {
1897
+ var s;
1898
+ u = (s = d.getInitialState == null ? void 0 : d.getInitialState(u)) != null ? s : u;
1899
+ });
1900
+ const f = [];
1901
+ let c = !1;
1902
+ const p = {
1903
+ _features: n,
1904
+ options: {
1905
+ ...l,
1906
+ ...e
1907
+ },
1908
+ initialState: u,
1909
+ _queue: (d) => {
1910
+ f.push(d), c || (c = !0, Promise.resolve().then(() => {
1911
+ for (; f.length; )
1912
+ f.shift()();
1913
+ c = !1;
1914
+ }).catch((s) => setTimeout(() => {
1915
+ throw s;
1916
+ })));
1917
+ },
1918
+ reset: () => {
1919
+ r.setState(r.initialState);
1920
+ },
1921
+ setOptions: (d) => {
1922
+ const s = b(d, r.options);
1923
+ r.options = i(s);
1924
+ },
1925
+ getState: () => r.options.state,
1926
+ setState: (d) => {
1927
+ r.options.onStateChange == null || r.options.onStateChange(d);
1928
+ },
1929
+ _getRowId: (d, s, m) => {
1930
+ var h;
1931
+ return (h = r.options.getRowId == null ? void 0 : r.options.getRowId(d, s, m)) != null ? h : `${m ? [m.id, s].join(".") : s}`;
1932
+ },
1933
+ getCoreRowModel: () => (r._getCoreRowModel || (r._getCoreRowModel = r.options.getCoreRowModel(r)), r._getCoreRowModel()),
1934
+ // The final calls start at the bottom of the model,
1935
+ // expanded rows, which then work their way up
1936
+ getRowModel: () => r.getPaginationRowModel(),
1937
+ //in next version, we should just pass in the row model as the optional 2nd arg
1938
+ getRow: (d, s) => {
1939
+ let m = (s ? r.getPrePaginationRowModel() : r.getRowModel()).rowsById[d];
1940
+ if (!m && (m = r.getCoreRowModel().rowsById[d], !m))
1941
+ throw process.env.NODE_ENV !== "production" ? new Error(`getRow could not find row with ID: ${d}`) : new Error();
1942
+ return m;
1943
+ },
1944
+ _getDefaultColumnDef: S(() => [r.options.defaultColumn], (d) => {
1945
+ var s;
1946
+ return d = (s = d) != null ? s : {}, {
1947
+ header: (m) => {
1948
+ const h = m.header.column.columnDef;
1949
+ return h.accessorKey ? h.accessorKey : h.accessorFn ? h.id : null;
1950
+ },
1951
+ // footer: props => props.header.column.id,
1952
+ cell: (m) => {
1953
+ var h, v;
1954
+ return (h = (v = m.renderValue()) == null || v.toString == null ? void 0 : v.toString()) != null ? h : null;
1955
+ },
1956
+ ...r._features.reduce((m, h) => Object.assign(m, h.getDefaultColumnDef == null ? void 0 : h.getDefaultColumnDef()), {}),
1957
+ ...d
1958
+ };
1959
+ }, C(e, "debugColumns", "_getDefaultColumnDef")),
1960
+ _getColumnDefs: () => r.options.columns,
1961
+ getAllColumns: S(() => [r._getColumnDefs()], (d) => {
1962
+ const s = function(m, h, v) {
1963
+ return v === void 0 && (v = 0), m.map((R) => {
1964
+ const _ = yt(r, R, v, h), $ = R;
1965
+ return _.columns = $.columns ? s($.columns, _, v + 1) : [], _;
1966
+ });
1967
+ };
1968
+ return s(d);
1969
+ }, C(e, "debugColumns", "getAllColumns")),
1970
+ getAllFlatColumns: S(() => [r.getAllColumns()], (d) => d.flatMap((s) => s.getFlatColumns()), C(e, "debugColumns", "getAllFlatColumns")),
1971
+ _getAllFlatColumnsById: S(() => [r.getAllFlatColumns()], (d) => d.reduce((s, m) => (s[m.id] = m, s), {}), C(e, "debugColumns", "getAllFlatColumnsById")),
1972
+ getAllLeafColumns: S(() => [r.getAllColumns(), r._getOrderColumnsFn()], (d, s) => {
1973
+ let m = d.flatMap((h) => h.getLeafColumns());
1974
+ return s(m);
1975
+ }, C(e, "debugColumns", "getAllLeafColumns")),
1976
+ getColumn: (d) => {
1977
+ const s = r._getAllFlatColumnsById()[d];
1978
+ return process.env.NODE_ENV !== "production" && !s && console.error(`[Table] Column with id '${d}' does not exist.`), s;
1979
+ }
1980
+ };
1981
+ Object.assign(r, p);
1982
+ for (let d = 0; d < r._features.length; d++) {
1983
+ const s = r._features[d];
1984
+ s == null || s.createTable == null || s.createTable(r);
1985
+ }
1986
+ return r;
1987
+ }
1988
+ function ln() {
1989
+ return (e) => S(() => [e.options.data], (o) => {
1990
+ const t = {
1991
+ rows: [],
1992
+ flatRows: [],
1993
+ rowsById: {}
1994
+ }, n = function(r, l, i) {
1995
+ l === void 0 && (l = 0);
1996
+ const a = [];
1997
+ for (let f = 0; f < r.length; f++) {
1998
+ const c = ye(e, e._getRowId(r[f], f, i), r[f], f, l, void 0, i == null ? void 0 : i.id);
1999
+ if (t.flatRows.push(c), t.rowsById[c.id] = c, a.push(c), e.options.getSubRows) {
2000
+ var u;
2001
+ c.originalSubRows = e.options.getSubRows(r[f], f), (u = c.originalSubRows) != null && u.length && (c.subRows = n(c.originalSubRows, l + 1, c));
2002
+ }
2003
+ }
2004
+ return a;
2005
+ };
2006
+ return t.rows = n(o), t;
2007
+ }, C(e.options, "debugTable", "getRowModel", () => e._autoResetPageIndex()));
2008
+ }
2009
+ function sn(e) {
2010
+ const o = [], t = (n) => {
2011
+ var r;
2012
+ o.push(n), (r = n.subRows) != null && r.length && n.getIsExpanded() && n.subRows.forEach(t);
2013
+ };
2014
+ return e.rows.forEach(t), {
2015
+ rows: o,
2016
+ flatRows: e.flatRows,
2017
+ rowsById: e.rowsById
2018
+ };
2019
+ }
2020
+ function an(e, o, t) {
2021
+ return t.options.filterFromLeafRows ? un(e, o, t) : fn(e, o, t);
2022
+ }
2023
+ function un(e, o, t) {
2024
+ var n;
2025
+ const r = [], l = {}, i = (n = t.options.maxLeafRowFilterDepth) != null ? n : 100, a = function(u, f) {
2026
+ f === void 0 && (f = 0);
2027
+ const c = [];
2028
+ for (let d = 0; d < u.length; d++) {
2029
+ var p;
2030
+ let s = u[d];
2031
+ const m = ye(t, s.id, s.original, s.index, s.depth, void 0, s.parentId);
2032
+ if (m.columnFilters = s.columnFilters, (p = s.subRows) != null && p.length && f < i) {
2033
+ if (m.subRows = a(s.subRows, f + 1), s = m, o(s) && !m.subRows.length) {
2034
+ c.push(s), l[s.id] = s, r.push(s);
2035
+ continue;
2036
+ }
2037
+ if (o(s) || m.subRows.length) {
2038
+ c.push(s), l[s.id] = s, r.push(s);
2039
+ continue;
2040
+ }
2041
+ } else
2042
+ s = m, o(s) && (c.push(s), l[s.id] = s, r.push(s));
2043
+ }
2044
+ return c;
2045
+ };
2046
+ return {
2047
+ rows: a(e),
2048
+ flatRows: r,
2049
+ rowsById: l
2050
+ };
2051
+ }
2052
+ function fn(e, o, t) {
2053
+ var n;
2054
+ const r = [], l = {}, i = (n = t.options.maxLeafRowFilterDepth) != null ? n : 100, a = function(u, f) {
2055
+ f === void 0 && (f = 0);
2056
+ const c = [];
2057
+ for (let d = 0; d < u.length; d++) {
2058
+ let s = u[d];
2059
+ if (o(s)) {
2060
+ var p;
2061
+ if ((p = s.subRows) != null && p.length && f < i) {
2062
+ const h = ye(t, s.id, s.original, s.index, s.depth, void 0, s.parentId);
2063
+ h.subRows = a(s.subRows, f + 1), s = h;
2064
+ }
2065
+ c.push(s), r.push(s), l[s.id] = s;
2066
+ }
2067
+ }
2068
+ return c;
2069
+ };
2070
+ return {
2071
+ rows: a(e),
2072
+ flatRows: r,
2073
+ rowsById: l
2074
+ };
2075
+ }
2076
+ function dn() {
2077
+ return (e) => S(() => [e.getPreFilteredRowModel(), e.getState().columnFilters, e.getState().globalFilter], (o, t, n) => {
2078
+ if (!o.rows.length || !(t != null && t.length) && !n) {
2079
+ for (let d = 0; d < o.flatRows.length; d++)
2080
+ o.flatRows[d].columnFilters = {}, o.flatRows[d].columnFiltersMeta = {};
2081
+ return o;
2082
+ }
2083
+ const r = [], l = [];
2084
+ (t ?? []).forEach((d) => {
2085
+ var s;
2086
+ const m = e.getColumn(d.id);
2087
+ if (!m)
2088
+ return;
2089
+ const h = m.getFilterFn();
2090
+ if (!h) {
2091
+ process.env.NODE_ENV !== "production" && console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${m.id}.`);
2092
+ return;
2093
+ }
2094
+ r.push({
2095
+ id: d.id,
2096
+ filterFn: h,
2097
+ resolvedValue: (s = h.resolveFilterValue == null ? void 0 : h.resolveFilterValue(d.value)) != null ? s : d.value
2098
+ });
2099
+ });
2100
+ const i = (t ?? []).map((d) => d.id), a = e.getGlobalFilterFn(), u = e.getAllLeafColumns().filter((d) => d.getCanGlobalFilter());
2101
+ n && a && u.length && (i.push("__global__"), u.forEach((d) => {
2102
+ var s;
2103
+ l.push({
2104
+ id: d.id,
2105
+ filterFn: a,
2106
+ resolvedValue: (s = a.resolveFilterValue == null ? void 0 : a.resolveFilterValue(n)) != null ? s : n
2107
+ });
2108
+ }));
2109
+ let f, c;
2110
+ for (let d = 0; d < o.flatRows.length; d++) {
2111
+ const s = o.flatRows[d];
2112
+ if (s.columnFilters = {}, r.length)
2113
+ for (let m = 0; m < r.length; m++) {
2114
+ f = r[m];
2115
+ const h = f.id;
2116
+ s.columnFilters[h] = f.filterFn(s, h, f.resolvedValue, (v) => {
2117
+ s.columnFiltersMeta[h] = v;
2118
+ });
2119
+ }
2120
+ if (l.length) {
2121
+ for (let m = 0; m < l.length; m++) {
2122
+ c = l[m];
2123
+ const h = c.id;
2124
+ if (c.filterFn(s, h, c.resolvedValue, (v) => {
2125
+ s.columnFiltersMeta[h] = v;
2126
+ })) {
2127
+ s.columnFilters.__global__ = !0;
2128
+ break;
2129
+ }
2130
+ }
2131
+ s.columnFilters.__global__ !== !0 && (s.columnFilters.__global__ = !1);
2132
+ }
2133
+ }
2134
+ const p = (d) => {
2135
+ for (let s = 0; s < i.length; s++)
2136
+ if (d.columnFilters[i[s]] === !1)
2137
+ return !1;
2138
+ return !0;
2139
+ };
2140
+ return an(o.rows, p, e);
2141
+ }, C(e.options, "debugTable", "getFilteredRowModel", () => e._autoResetPageIndex()));
2142
+ }
2143
+ function gn(e) {
2144
+ return (o) => S(() => [o.getState().pagination, o.getPrePaginationRowModel(), o.options.paginateExpandedRows ? void 0 : o.getState().expanded], (t, n) => {
2145
+ if (!n.rows.length)
2146
+ return n;
2147
+ const {
2148
+ pageSize: r,
2149
+ pageIndex: l
2150
+ } = t;
2151
+ let {
2152
+ rows: i,
2153
+ flatRows: a,
2154
+ rowsById: u
2155
+ } = n;
2156
+ const f = r * l, c = f + r;
2157
+ i = i.slice(f, c);
2158
+ let p;
2159
+ o.options.paginateExpandedRows ? p = {
2160
+ rows: i,
2161
+ flatRows: a,
2162
+ rowsById: u
2163
+ } : p = sn({
2164
+ rows: i,
2165
+ flatRows: a,
2166
+ rowsById: u
2167
+ }), p.flatRows = [];
2168
+ const d = (s) => {
2169
+ p.flatRows.push(s), s.subRows.length && s.subRows.forEach(d);
2170
+ };
2171
+ return p.rows.forEach(d), p;
2172
+ }, C(o.options, "debugTable", "getPaginationRowModel"));
2173
+ }
2174
+ function cn() {
2175
+ return (e) => S(() => [e.getState().sorting, e.getPreSortedRowModel()], (o, t) => {
2176
+ if (!t.rows.length || !(o != null && o.length))
2177
+ return t;
2178
+ const n = e.getState().sorting, r = [], l = n.filter((u) => {
2179
+ var f;
2180
+ return (f = e.getColumn(u.id)) == null ? void 0 : f.getCanSort();
2181
+ }), i = {};
2182
+ l.forEach((u) => {
2183
+ const f = e.getColumn(u.id);
2184
+ f && (i[u.id] = {
2185
+ sortUndefined: f.columnDef.sortUndefined,
2186
+ invertSorting: f.columnDef.invertSorting,
2187
+ sortingFn: f.getSortingFn()
2188
+ });
2189
+ });
2190
+ const a = (u) => {
2191
+ const f = u.map((c) => ({
2192
+ ...c
2193
+ }));
2194
+ return f.sort((c, p) => {
2195
+ for (let s = 0; s < l.length; s += 1) {
2196
+ var d;
2197
+ const m = l[s], h = i[m.id], v = h.sortUndefined, R = (d = m == null ? void 0 : m.desc) != null ? d : !1;
2198
+ let _ = 0;
2199
+ if (v) {
2200
+ const $ = c.getValue(m.id), L = p.getValue(m.id), I = $ === void 0, P = L === void 0;
2201
+ if (I || P) {
2202
+ if (v === "first") return I ? -1 : 1;
2203
+ if (v === "last") return I ? 1 : -1;
2204
+ _ = I && P ? 0 : I ? v : -v;
2205
+ }
2206
+ }
2207
+ if (_ === 0 && (_ = h.sortingFn(c, p, m.id)), _ !== 0)
2208
+ return R && (_ *= -1), h.invertSorting && (_ *= -1), _;
2209
+ }
2210
+ return c.index - p.index;
2211
+ }), f.forEach((c) => {
2212
+ var p;
2213
+ r.push(c), (p = c.subRows) != null && p.length && (c.subRows = a(c.subRows));
2214
+ }), f;
2215
+ };
2216
+ return {
2217
+ rows: a(t.rows),
2218
+ flatRows: r,
2219
+ rowsById: t.rowsById
2220
+ };
2221
+ }, C(e.options, "debugTable", "getSortedRowModel", () => e._autoResetPageIndex()));
2222
+ }
2223
+ /**
2224
+ * react-table
2225
+ *
2226
+ * Copyright (c) TanStack
2227
+ *
2228
+ * This source code is licensed under the MIT license found in the
2229
+ * LICENSE.md file in the root directory of this source tree.
2230
+ *
2231
+ * @license MIT
2232
+ */
2233
+ function Ae(e, o) {
2234
+ return e ? pn(e) ? /* @__PURE__ */ ge.createElement(e, o) : e : null;
2235
+ }
2236
+ function pn(e) {
2237
+ return mn(e) || typeof e == "function" || hn(e);
2238
+ }
2239
+ function mn(e) {
2240
+ return typeof e == "function" && (() => {
2241
+ const o = Object.getPrototypeOf(e);
2242
+ return o.prototype && o.prototype.isReactComponent;
2243
+ })();
2244
+ }
2245
+ function hn(e) {
2246
+ return typeof e == "object" && typeof e.$$typeof == "symbol" && ["react.memo", "react.forward_ref"].includes(e.$$typeof.description);
2247
+ }
2248
+ function wn(e) {
2249
+ const o = {
2250
+ state: {},
2251
+ // Dummy state
2252
+ onStateChange: () => {
2253
+ },
2254
+ // noop
2255
+ renderFallbackValue: null,
2256
+ ...e
2257
+ }, [t] = ge.useState(() => ({
2258
+ current: rn(o)
2259
+ })), [n, r] = ge.useState(() => t.current.initialState);
2260
+ return t.current.setOptions((l) => ({
2261
+ ...l,
2262
+ ...e,
2263
+ state: {
2264
+ ...n,
2265
+ ...e.state
2266
+ },
2267
+ // Similarly, we'll maintain both our internal state and any user-provided
2268
+ // state.
2269
+ onStateChange: (i) => {
2270
+ r(i), e.onStateChange == null || e.onStateChange(i);
2271
+ }
2272
+ })), t.current;
2273
+ }
2274
+ const ze = ({
2275
+ editable: e = !0,
2276
+ pageSize: o = 25,
2277
+ onCellEdit: t
2278
+ }) => {
2279
+ const {
2280
+ rows: n,
2281
+ schema: r,
2282
+ mappings: l,
2283
+ errorsByRow: i,
2284
+ editingCell: a,
2285
+ startEditing: u,
2286
+ stopEditing: f,
2287
+ updateCell: c
2288
+ } = U(), [p, d] = Y([]), [s, m] = Y(""), [h, v] = Y(""), R = Ve(() => l.filter((x) => x.targetKey !== null).map((x) => {
2289
+ const y = r == null ? void 0 : r.columns.find((V) => V.key === x.targetKey);
2290
+ return {
2291
+ sourceColumn: x.sourceColumn,
2292
+ targetKey: x.targetKey,
2293
+ label: (y == null ? void 0 : y.label) || x.targetKey,
2294
+ type: (y == null ? void 0 : y.type) || "string"
2295
+ };
2296
+ }), [l, r]), _ = Ce(
2297
+ (x, y) => {
2298
+ const V = i.get(x);
2299
+ return V == null ? void 0 : V.find((q) => q.columnKey === y);
2300
+ },
2301
+ [i]
2302
+ ), $ = (x, y, V) => {
2303
+ v(V), u(x, y);
2304
+ }, L = () => {
2305
+ a && (c(a.rowIndex, a.columnKey, h), t == null || t(a.rowIndex, a.columnKey, h)), f();
2306
+ }, I = () => {
2307
+ v(""), f();
2308
+ }, P = St(), T = Ve(
2309
+ () => [
2310
+ P.accessor("rowIndex", {
2311
+ header: "#",
2312
+ size: 60,
2313
+ cell: (x) => /* @__PURE__ */ g("span", { className: "ff-text-gray-400 ff-font-mono ff-text-xs", children: x.getValue() + 1 })
2314
+ }),
2315
+ ...R.map(
2316
+ (x) => P.accessor((y) => y.data[x.targetKey] || y.data[x.sourceColumn], {
2317
+ id: x.targetKey,
2318
+ header: x.label,
2319
+ cell: (y) => {
2320
+ const V = y.row.original.rowIndex, q = String(y.getValue() ?? ""), E = _(V, x.targetKey);
2321
+ return (a == null ? void 0 : a.rowIndex) === V && (a == null ? void 0 : a.columnKey) === x.targetKey ? /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-1", children: [
2322
+ /* @__PURE__ */ g(
2323
+ "input",
2324
+ {
2325
+ type: "text",
2326
+ value: h,
2327
+ onChange: (j) => v(j.target.value),
2328
+ onKeyDown: (j) => {
2329
+ j.key === "Enter" && L(), j.key === "Escape" && I();
2330
+ },
2331
+ className: "ff-input ff-py-1 ff-text-sm",
2332
+ autoFocus: !0
2333
+ }
2334
+ ),
2335
+ /* @__PURE__ */ g(
2336
+ "button",
2337
+ {
2338
+ onClick: L,
2339
+ className: "ff-px-3 ff-py-1 ff-text-xs ff-font-medium ff-text-white ff-bg-success-500 hover:ff-bg-success-600 ff-rounded ff-transition-colors",
2340
+ children: "Save"
2341
+ }
2342
+ ),
2343
+ /* @__PURE__ */ g(
2344
+ "button",
2345
+ {
2346
+ onClick: I,
2347
+ className: "ff-px-3 ff-py-1 ff-text-xs ff-font-medium ff-text-gray-110 ff-bg-gray-30 hover:ff-bg-gray-40 ff-rounded ff-transition-colors",
2348
+ children: "Cancel"
2349
+ }
2350
+ )
2351
+ ] }) : /* @__PURE__ */ w(
2352
+ "div",
2353
+ {
2354
+ className: A(
2355
+ "ff-group ff-flex ff-items-center ff-gap-2",
2356
+ (E == null ? void 0 : E.severity) === "error" && "ff-cell-error",
2357
+ (E == null ? void 0 : E.severity) === "warning" && "ff-cell-warning"
2358
+ ),
2359
+ children: [
2360
+ /* @__PURE__ */ g("span", { className: "ff-flex-1 ff-truncate", children: q || /* @__PURE__ */ g("span", { className: "ff-text-gray-300", children: "—" }) }),
2361
+ E && /* @__PURE__ */ w("div", { className: "ff-relative ff-group/tooltip", children: [
2362
+ E.severity === "error" ? /* @__PURE__ */ g(Re, { className: "ff-w-4 ff-h-4 ff-text-error-500" }) : /* @__PURE__ */ g(pe, { className: "ff-w-4 ff-h-4 ff-text-warning-500" }),
2363
+ /* @__PURE__ */ w("div", { className: "ff-tooltip ff-bottom-full ff-left-1/2 ff-transform ff--translate-x-1/2 ff-mb-2 ff-w-48 group-hover/tooltip:ff-tooltip-visible", children: [
2364
+ E.message,
2365
+ E.suggestion && /* @__PURE__ */ g("span", { className: "ff-block ff-mt-1 ff-text-gray-300", children: E.suggestion })
2366
+ ] })
2367
+ ] }),
2368
+ e && !E && /* @__PURE__ */ g(
2369
+ "button",
2370
+ {
2371
+ onClick: () => $(V, x.targetKey, q),
2372
+ className: "ff-opacity-0 group-hover:ff-opacity-100 ff-p-1 ff-text-gray-400 hover:ff-text-gray-600 ff-rounded ff-transition-opacity",
2373
+ children: /* @__PURE__ */ g(ht, { className: "ff-w-3 ff-h-3" })
2374
+ }
2375
+ )
2376
+ ]
2377
+ }
2378
+ );
2379
+ }
2380
+ })
2381
+ )
2382
+ ],
2383
+ [R, a, h, e, _, P]
2384
+ ), N = wn({
2385
+ data: n,
2386
+ columns: T,
2387
+ state: {
2388
+ sorting: p,
2389
+ globalFilter: s
2390
+ },
2391
+ onSortingChange: d,
2392
+ onGlobalFilterChange: m,
2393
+ getCoreRowModel: ln(),
2394
+ getPaginationRowModel: gn(),
2395
+ getSortedRowModel: cn(),
2396
+ getFilteredRowModel: dn(),
2397
+ initialState: {
2398
+ pagination: {
2399
+ pageSize: o
2400
+ }
2401
+ }
2402
+ });
2403
+ return /* @__PURE__ */ w("div", { className: "ff-space-y-4", children: [
2404
+ /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between", children: [
2405
+ /* @__PURE__ */ g(
2406
+ "input",
2407
+ {
2408
+ type: "text",
2409
+ value: s,
2410
+ onChange: (x) => m(x.target.value),
2411
+ placeholder: "Search all columns...",
2412
+ className: "ff-input ff-max-w-xs"
2413
+ }
2414
+ ),
2415
+ /* @__PURE__ */ w("div", { className: "ff-text-sm", style: { color: "var(--ff-text-muted)" }, children: [
2416
+ N.getFilteredRowModel().rows.length,
2417
+ " rows"
2418
+ ] })
2419
+ ] }),
2420
+ /* @__PURE__ */ g("div", { className: "ff-table-container ff-max-h-[500px]", children: /* @__PURE__ */ w("table", { className: "ff-table", children: [
2421
+ /* @__PURE__ */ g("thead", { children: N.getHeaderGroups().map((x) => /* @__PURE__ */ g("tr", { children: x.headers.map((y) => /* @__PURE__ */ g(
2422
+ "th",
2423
+ {
2424
+ style: { width: y.getSize() },
2425
+ onClick: y.column.getToggleSortingHandler(),
2426
+ className: A(
2427
+ y.column.getCanSort() && "ff-cursor-pointer ff-select-none"
2428
+ ),
2429
+ children: /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-1", children: [
2430
+ Ae(y.column.columnDef.header, y.getContext()),
2431
+ y.column.getIsSorted() && /* @__PURE__ */ g("span", { children: y.column.getIsSorted() === "asc" ? "↑" : "↓" })
2432
+ ] })
2433
+ },
2434
+ y.id
2435
+ )) }, x.id)) }),
2436
+ /* @__PURE__ */ g("tbody", { children: N.getRowModel().rows.map((x) => {
2437
+ const y = i.has(x.original.rowIndex);
2438
+ return /* @__PURE__ */ g(
2439
+ "tr",
2440
+ {
2441
+ className: A(y && "ff-bg-error-50/30"),
2442
+ children: x.getVisibleCells().map((V) => /* @__PURE__ */ g("td", { children: Ae(V.column.columnDef.cell, V.getContext()) }, V.id))
2443
+ },
2444
+ x.id
2445
+ );
2446
+ }) })
2447
+ ] }) }),
2448
+ /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-2", children: [
2449
+ /* @__PURE__ */ w("div", { className: "ff-text-sm", style: { color: "var(--ff-text-muted)" }, children: [
2450
+ "Page ",
2451
+ N.getState().pagination.pageIndex + 1,
2452
+ " of ",
2453
+ N.getPageCount()
2454
+ ] }),
2455
+ /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-2", children: [
2456
+ /* @__PURE__ */ w(
2457
+ "button",
2458
+ {
2459
+ onClick: () => N.previousPage(),
2460
+ disabled: !N.getCanPreviousPage(),
2461
+ className: "ff-btn ff-btn-secondary ff-btn-sm",
2462
+ children: [
2463
+ /* @__PURE__ */ g(ft, { className: "ff-w-4 ff-h-4" }),
2464
+ "Previous"
2465
+ ]
2466
+ }
2467
+ ),
2468
+ /* @__PURE__ */ w(
2469
+ "button",
2470
+ {
2471
+ onClick: () => N.nextPage(),
2472
+ disabled: !N.getCanNextPage(),
2473
+ className: "ff-btn ff-btn-secondary ff-btn-sm",
2474
+ children: [
2475
+ "Next",
2476
+ /* @__PURE__ */ g(rt, { className: "ff-w-4 ff-h-4" })
2477
+ ]
2478
+ }
2479
+ )
2480
+ ] })
2481
+ ] })
2482
+ ] });
2483
+ }, ke = ({
2484
+ showDetails: e = !0
2485
+ }) => {
2486
+ const { validationResults: o } = U();
2487
+ if (!o)
2488
+ return null;
2489
+ const { isValid: t, totalRows: n, validRows: r, errorCount: l, warningCount: i, infoCount: a, summary: u } = o, f = Math.round(r / n * 100);
2490
+ return /* @__PURE__ */ w("div", { className: "ff-space-y-4", children: [
2491
+ /* @__PURE__ */ w(
2492
+ "div",
2493
+ {
2494
+ className: A(
2495
+ "ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-lg ff-border",
2496
+ t ? "ff-bg-success-50 ff-border-success-200" : "ff-bg-error-50 ff-border-error-200"
2497
+ ),
2498
+ children: [
2499
+ t ? /* @__PURE__ */ g(xe, { className: "ff-w-8 ff-h-8 ff-text-success-600" }) : /* @__PURE__ */ g(Ne, { className: "ff-w-8 ff-h-8 ff-text-error-600" }),
2500
+ /* @__PURE__ */ w("div", { children: [
2501
+ /* @__PURE__ */ g(
2502
+ "h3",
2503
+ {
2504
+ className: A(
2505
+ "ff-text-lg ff-font-semibold",
2506
+ t ? "ff-text-success-800" : "ff-text-error-800"
2507
+ ),
2508
+ children: t ? "Validation Passed" : "Validation Failed"
2509
+ }
2510
+ ),
2511
+ /* @__PURE__ */ w("p", { className: A("ff-text-sm", t ? "ff-text-success-600" : "ff-text-error-600"), children: [
2512
+ r,
2513
+ " of ",
2514
+ n,
2515
+ " rows are valid (",
2516
+ f,
2517
+ "%)"
2518
+ ] })
2519
+ ] })
2520
+ ]
2521
+ }
2522
+ ),
2523
+ /* @__PURE__ */ w("div", { className: "ff-grid ff-grid-cols-4 ff-gap-4", children: [
2524
+ /* @__PURE__ */ w("div", { className: "ff-bg-white ff-border ff-border-gray-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2525
+ /* @__PURE__ */ g("p", { className: "ff-text-2xl ff-font-bold ff-text-gray-900", children: n }),
2526
+ /* @__PURE__ */ g("p", { className: "ff-text-sm ff-text-gray-500", children: "Total Rows" })
2527
+ ] }),
2528
+ /* @__PURE__ */ w("div", { className: "ff-bg-success-50 ff-border ff-border-success-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2529
+ /* @__PURE__ */ g("p", { className: "ff-text-2xl ff-font-bold ff-text-success-700", children: r }),
2530
+ /* @__PURE__ */ g("p", { className: "ff-text-sm ff-text-success-600", children: "Valid Rows" })
2531
+ ] }),
2532
+ /* @__PURE__ */ w("div", { className: "ff-bg-error-50 ff-border ff-border-error-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2533
+ /* @__PURE__ */ g("p", { className: "ff-text-2xl ff-font-bold ff-text-error-700", children: l }),
2534
+ /* @__PURE__ */ g("p", { className: "ff-text-sm ff-text-error-600", children: "Errors" })
2535
+ ] }),
2536
+ /* @__PURE__ */ w("div", { className: "ff-bg-warning-50 ff-border ff-border-warning-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2537
+ /* @__PURE__ */ g("p", { className: "ff-text-2xl ff-font-bold ff-text-warning-700", children: i }),
2538
+ /* @__PURE__ */ g("p", { className: "ff-text-sm ff-text-warning-600", children: "Warnings" })
2539
+ ] })
2540
+ ] }),
2541
+ e && u.byColumn && Object.keys(u.byColumn).length > 0 && /* @__PURE__ */ w("div", { className: "ff-bg-white ff-border ff-border-gray-200 ff-rounded-lg ff-overflow-hidden", children: [
2542
+ /* @__PURE__ */ g("div", { className: "ff-px-4 ff-py-3 ff-bg-gray-50 ff-border-b ff-border-gray-200", children: /* @__PURE__ */ g("h4", { className: "ff-font-medium ff-text-gray-700", children: "Issues by Column" }) }),
2543
+ /* @__PURE__ */ g("div", { className: "ff-divide-y ff-divide-gray-100", children: Object.entries(u.byColumn).filter(([, c]) => c.errorCount > 0 || c.warningCount > 0).map(([c, p]) => /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-4 ff-py-3", children: [
2544
+ /* @__PURE__ */ w("div", { children: [
2545
+ /* @__PURE__ */ g("p", { className: "ff-font-medium ff-text-gray-900", children: p.columnKey }),
2546
+ p.mostCommonError && /* @__PURE__ */ g("p", { className: "ff-text-sm ff-text-gray-500", children: p.mostCommonError })
2547
+ ] }),
2548
+ /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
2549
+ p.errorCount > 0 && /* @__PURE__ */ w("span", { className: "ff-badge ff-badge-error", children: [
2550
+ /* @__PURE__ */ g(Ne, { className: "ff-w-3 ff-h-3 ff-mr-1" }),
2551
+ p.errorCount,
2552
+ " errors"
2553
+ ] }),
2554
+ p.warningCount > 0 && /* @__PURE__ */ w("span", { className: "ff-badge ff-badge-warning", children: [
2555
+ /* @__PURE__ */ g(pe, { className: "ff-w-3 ff-h-3 ff-mr-1" }),
2556
+ p.warningCount,
2557
+ " warnings"
2558
+ ] })
2559
+ ] })
2560
+ ] }, c)) })
2561
+ ] }),
2562
+ e && u.duplicates && u.duplicates.length > 0 && /* @__PURE__ */ g("div", { className: "ff-bg-warning-50 ff-border ff-border-warning-200 ff-rounded-lg ff-p-4", children: /* @__PURE__ */ w("div", { className: "ff-flex ff-items-start ff-gap-3", children: [
2563
+ /* @__PURE__ */ g(pe, { className: "ff-w-5 ff-h-5 ff-text-warning-600 ff-flex-shrink-0 ff-mt-0.5" }),
2564
+ /* @__PURE__ */ w("div", { children: [
2565
+ /* @__PURE__ */ g("h4", { className: "ff-font-medium ff-text-warning-800", children: "Duplicate Values Found" }),
2566
+ /* @__PURE__ */ w("ul", { className: "ff-mt-2 ff-space-y-1 ff-text-sm ff-text-warning-700", children: [
2567
+ u.duplicates.slice(0, 5).map((c, p) => /* @__PURE__ */ w("li", { children: [
2568
+ /* @__PURE__ */ g("span", { className: "ff-font-mono", children: c.columnKey }),
2569
+ ': "',
2570
+ String(c.value),
2571
+ '" appears',
2572
+ " ",
2573
+ c.rowIndices.length,
2574
+ " times (rows",
2575
+ " ",
2576
+ c.rowIndices.slice(0, 3).map((d) => d + 1).join(", "),
2577
+ c.rowIndices.length > 3 ? "..." : "",
2578
+ ")"
2579
+ ] }, p)),
2580
+ u.duplicates.length > 5 && /* @__PURE__ */ w("li", { className: "ff-text-warning-600", children: [
2581
+ "... and ",
2582
+ u.duplicates.length - 5,
2583
+ " more duplicate groups"
2584
+ ] })
2585
+ ] })
2586
+ ] })
2587
+ ] }) })
2588
+ ] });
2589
+ }, de = ["upload", "mapping", "validation", "complete"], vn = [
2590
+ { key: "upload", label: "Upload", icon: Oe },
2591
+ { key: "mapping", label: "Map Columns", icon: pt },
2592
+ { key: "validation", label: "Validate", icon: at },
2593
+ { key: "review", label: "Review", icon: dt },
2594
+ { key: "complete", label: "Complete", icon: xe }
2595
+ ], xn = ({
2596
+ template: e,
2597
+ schema: o,
2598
+ onComplete: t,
2599
+ onCancel: n,
2600
+ onError: r
2601
+ }) => {
2602
+ const {
2603
+ step: l,
2604
+ sessionId: i,
2605
+ file: a,
2606
+ mappings: u,
2607
+ validationResults: f,
2608
+ isLoading: c,
2609
+ error: p,
2610
+ setSchema: d,
2611
+ setSessionId: s,
2612
+ setParsedData: m,
2613
+ setMappings: h,
2614
+ setUnmapped: v,
2615
+ setValidationResults: R,
2616
+ setStep: _,
2617
+ nextStep: $,
2618
+ previousStep: L,
2619
+ setLoading: I,
2620
+ setError: P,
2621
+ reset: T
2622
+ } = U(), [N, x] = Y(null), [y, V] = Y(null);
2623
+ Pe(() => {
2624
+ if (V(null), e)
2625
+ if (lt(e)) {
2626
+ const M = it(e);
2627
+ M ? x(M) : (V(`Failed to load template "${e}"`), r == null || r(new Error(`Failed to load template "${e}"`)));
2628
+ } else {
2629
+ const M = `Template "${e}" not found. Available templates: ${De.join(", ")}`;
2630
+ V(M), r == null || r(new Error(M));
2631
+ }
2632
+ else if (o)
2633
+ x(o);
2634
+ else {
2635
+ const M = `No template or schema provided. Please specify a template (${De.join(", ")}) or provide a custom schema.`;
2636
+ V(M), r == null || r(new Error(M));
2637
+ }
2638
+ }, [e, o, r]), Pe(() => {
2639
+ N && (d(N), q(N));
2640
+ }, [N]);
2641
+ const q = async (M) => {
2642
+ try {
2643
+ I(!0);
2644
+ const G = await Z().createImportSession(M);
2645
+ s(G.sessionId);
2646
+ } catch (F) {
2647
+ const G = F;
2648
+ P(G.message), r == null || r(G);
2649
+ } finally {
2650
+ I(!1);
2651
+ }
2652
+ }, E = Ce(async (M) => {
2653
+ if (i)
2654
+ try {
2655
+ I(!0), P(null);
2656
+ const G = await Z().uploadFile(i, M);
2657
+ m({
2658
+ headers: G.data.headers,
2659
+ rows: G.data.sampleRows.map((X, oe) => ({
2660
+ rowIndex: oe,
2661
+ data: X,
2662
+ rawData: Object.values(X)
2663
+ })),
2664
+ totalRows: G.data.totalRows,
2665
+ sampleRows: G.data.sampleRows.map((X, oe) => ({
2666
+ rowIndex: oe,
2667
+ data: X,
2668
+ rawData: Object.values(X)
2669
+ }))
2670
+ }), $(), await Me();
2671
+ } catch (F) {
2672
+ const G = F;
2673
+ P(G.message), r == null || r(G);
2674
+ } finally {
2675
+ I(!1);
2676
+ }
2677
+ }, [i]), Me = async () => {
2678
+ if (i)
2679
+ try {
2680
+ I(!0);
2681
+ const F = await Z().matchColumns(i);
2682
+ h(F.mappings), v(F.unmappedSource, F.unmappedTarget);
2683
+ } catch (M) {
2684
+ const F = M;
2685
+ P(F.message), r == null || r(F);
2686
+ } finally {
2687
+ I(!1);
2688
+ }
2689
+ }, j = async () => {
2690
+ if (i)
2691
+ try {
2692
+ I(!0), P(null);
2693
+ const F = await Z().validateImport(i);
2694
+ R(F.validation), $();
2695
+ } catch (M) {
2696
+ const F = M;
2697
+ P(F.message), r == null || r(F);
2698
+ } finally {
2699
+ I(!1);
2700
+ }
2701
+ }, We = async () => {
2702
+ if (i)
2703
+ try {
2704
+ I(!0), P(null);
2705
+ const F = await Z().completeImport(i, {
2706
+ skipInvalidRows: !0,
2707
+ acknowledgeWarnings: !0
2708
+ });
2709
+ _("complete"), t == null || t(F);
2710
+ } catch (M) {
2711
+ const F = M;
2712
+ P(F.message), r == null || r(F);
2713
+ } finally {
2714
+ I(!1);
2715
+ }
2716
+ }, Ie = () => {
2717
+ T(), n == null || n();
2718
+ }, Ye = () => vn.findIndex((M) => M.key === l), Je = () => {
2719
+ switch (l) {
2720
+ case "upload":
2721
+ return a !== null;
2722
+ case "mapping":
2723
+ return u.length > 0 && u.some((M) => M.targetKey !== null);
2724
+ case "validation":
2725
+ return f !== null;
2726
+ case "review":
2727
+ return !0;
2728
+ default:
2729
+ return !1;
2730
+ }
2731
+ }, Qe = async () => {
2732
+ switch (l) {
2733
+ case "mapping":
2734
+ await j();
2735
+ break;
2736
+ case "validation":
2737
+ $();
2738
+ break;
2739
+ case "review":
2740
+ await We();
2741
+ break;
2742
+ default:
2743
+ $();
2744
+ }
2745
+ };
2746
+ if (y)
2747
+ return /* @__PURE__ */ g("div", { className: "ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6", children: /* @__PURE__ */ w("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8", children: [
2748
+ /* @__PURE__ */ g("div", { className: "ff-w-16 ff-h-16 ff-bg-error-100 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4", children: /* @__PURE__ */ g(ce, { className: "ff-w-10 ff-h-10 ff-text-error-600" }) }),
2749
+ /* @__PURE__ */ g("h3", { className: "ff-text-xl ff-font-semibold ff-text-gray-900 ff-mb-2", children: "Configuration Error" }),
2750
+ /* @__PURE__ */ g("p", { className: "ff-text-gray-500 ff-text-center ff-max-w-md ff-mb-4", children: y }),
2751
+ n && /* @__PURE__ */ g("button", { onClick: Ie, className: "ff-btn ff-btn-secondary", children: "Close" })
2752
+ ] }) });
2753
+ if (!N)
2754
+ return /* @__PURE__ */ g("div", { className: "ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6", children: /* @__PURE__ */ w("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8", children: [
2755
+ /* @__PURE__ */ g(Le, { className: "ff-w-10 ff-h-10 ff-text-primary-600 ff-animate-spin ff-mb-4" }),
2756
+ /* @__PURE__ */ g("p", { className: "ff-text-gray-500", children: "Loading template..." })
2757
+ ] }) });
2758
+ const K = () => {
2759
+ const M = l === "review" ? "validation" : l;
2760
+ return de.indexOf(M);
2761
+ };
2762
+ return /* @__PURE__ */ w("div", { className: "ff-container ff-modal", children: [
2763
+ /* @__PURE__ */ w("div", { className: "ff-modal-header", children: [
2764
+ /* @__PURE__ */ w("div", { className: "ff-modal-header-left", children: [
2765
+ /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
2766
+ /* @__PURE__ */ g("div", { className: "ff-modal-icon", children: /* @__PURE__ */ g(gt, {}) }),
2767
+ /* @__PURE__ */ g("h2", { className: "ff-modal-title", children: "Import Data" })
2768
+ ] }),
2769
+ /* @__PURE__ */ g("div", { className: "ff-steps ff-ml-4", children: de.map((M, F) => /* @__PURE__ */ w(tt.Fragment, { children: [
2770
+ /* @__PURE__ */ g(
2771
+ "div",
2772
+ {
2773
+ className: A(
2774
+ "ff-step",
2775
+ K() === F && "ff-step-active",
2776
+ K() > F && "ff-step-complete",
2777
+ K() < F && "ff-step-pending"
2778
+ ),
2779
+ children: K() > F ? "✓" : F + 1
2780
+ }
2781
+ ),
2782
+ F < de.length - 1 && /* @__PURE__ */ g("div", { className: A(
2783
+ "ff-step-connector",
2784
+ K() > F && "ff-step-connector-complete"
2785
+ ) })
2786
+ ] }, M)) })
2787
+ ] }),
2788
+ /* @__PURE__ */ g(
2789
+ "button",
2790
+ {
2791
+ onClick: Ie,
2792
+ className: "ff-modal-close",
2793
+ children: /* @__PURE__ */ g(ce, { className: "ff-w-5 ff-h-5" })
2794
+ }
2795
+ )
2796
+ ] }),
2797
+ /* @__PURE__ */ w("div", { className: "ff-modal-body", children: [
2798
+ p && /* @__PURE__ */ g("div", { className: "ff-mb-4 ff-p-4 ff-bg-error-50 ff-border ff-border-error-200 ff-rounded-lg ff-text-error-700 ff-text-sm", children: p }),
2799
+ l === "upload" && /* @__PURE__ */ g("div", { className: "ff-py-4", children: /* @__PURE__ */ g("div", { className: "ff-max-w-xl ff-mx-auto", children: /* @__PURE__ */ g(wt, { onFileSelect: E }) }) }),
2800
+ l === "mapping" && /* @__PURE__ */ g(vt, {}),
2801
+ l === "validation" && /* @__PURE__ */ w("div", { className: "ff-space-y-6", children: [
2802
+ /* @__PURE__ */ g(ke, {}),
2803
+ /* @__PURE__ */ g(ze, { editable: !0 })
2804
+ ] }),
2805
+ l === "review" && /* @__PURE__ */ w("div", { className: "ff-space-y-6", children: [
2806
+ /* @__PURE__ */ g(ke, { showDetails: !1 }),
2807
+ /* @__PURE__ */ g(ze, { editable: !1, pageSize: 10 })
2808
+ ] }),
2809
+ l === "complete" && /* @__PURE__ */ w("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12", children: [
2810
+ /* @__PURE__ */ g("div", { className: "ff-w-16 ff-h-16 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4", style: { backgroundColor: "var(--ff-success-light)" }, children: /* @__PURE__ */ g(xe, { className: "ff-w-10 ff-h-10", style: { color: "var(--ff-success)" } }) }),
2811
+ /* @__PURE__ */ g("h3", { className: "ff-text-xl ff-font-semibold ff-mb-2", style: { color: "var(--ff-text-primary)" }, children: "Import Complete!" }),
2812
+ /* @__PURE__ */ g("p", { style: { color: "var(--ff-text-muted)" }, children: "Your data has been successfully imported." })
2813
+ ] })
2814
+ ] }),
2815
+ l !== "complete" && /* @__PURE__ */ w("div", { className: "ff-modal-footer", children: [
2816
+ /* @__PURE__ */ g(
2817
+ "button",
2818
+ {
2819
+ onClick: L,
2820
+ disabled: Ye() === 0 || c,
2821
+ className: "ff-btn ff-btn-secondary",
2822
+ children: "Back"
2823
+ }
2824
+ ),
2825
+ /* @__PURE__ */ g(
2826
+ "button",
2827
+ {
2828
+ onClick: Qe,
2829
+ disabled: !Je() || c,
2830
+ className: "ff-btn ff-btn-primary",
2831
+ children: c ? /* @__PURE__ */ w(et, { children: [
2832
+ /* @__PURE__ */ g(Le, { className: "ff-w-4 ff-h-4 ff-animate-spin" }),
2833
+ "Processing..."
2834
+ ] }) : l === "review" ? "Complete Import" : "Continue"
2835
+ }
2836
+ )
2837
+ ] })
2838
+ ] });
2839
+ };
2840
+ export {
2841
+ vt as C,
2842
+ ze as D,
2843
+ wt as F,
2844
+ xn as I,
2845
+ ke as V,
2846
+ U as u
2847
+ };
2848
+ //# sourceMappingURL=ImportWizard-Bl9foTic.mjs.map