@fileflow/sdk 0.1.19 → 0.1.21

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