UNPKG

@czkoudy/data-table

Version:

A React data table component with pagination, sorting, and filtering capabilities.

1,338 lines (1,336 loc) 154 kB
import * as st from "react"; import J, { forwardRef as Pn, useImperativeHandle as Mn } from "react"; var Le = { exports: {} }, Ee = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Vt; function Dn() { if (Vt) return Ee; Vt = 1; var e = J, n = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 }; function a(u, c, d) { var g, m = {}, f = null, l = null; d !== void 0 && (f = "" + d), c.key !== void 0 && (f = "" + c.key), c.ref !== void 0 && (l = c.ref); for (g in c) r.call(c, g) && !i.hasOwnProperty(g) && (m[g] = c[g]); if (u && u.defaultProps) for (g in c = u.defaultProps, c) m[g] === void 0 && (m[g] = c[g]); return { $$typeof: n, type: u, key: f, ref: l, props: m, _owner: o.current }; } return Ee.Fragment = t, Ee.jsx = a, Ee.jsxs = a, Ee; } var Ve = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var bt; function En() { return bt || (bt = 1, process.env.NODE_ENV !== "production" && (function() { var e = J, n = Symbol.for("react.element"), t = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), l = Symbol.for("react.offscreen"), p = Symbol.iterator, w = "@@iterator"; function F(s) { if (s === null || typeof s != "object") return null; var h = p && s[p] || s[w]; return typeof h == "function" ? h : null; } var R = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function P(s) { { for (var h = arguments.length, S = new Array(h > 1 ? h - 1 : 0), D = 1; D < h; D++) S[D - 1] = arguments[D]; $("error", s, S); } } function $(s, h, S) { { var D = R.ReactDebugCurrentFrame, T = D.getStackAddendum(); T !== "" && (h += "%s", S = S.concat([T])); var L = S.map(function(b) { return String(b); }); L.unshift("Warning: " + h), Function.prototype.apply.call(console[s], console, L); } } var H = !1, j = !1, I = !1, ae = !1, se = !1, le; le = Symbol.for("react.module.reference"); function Fe(s) { return !!(typeof s == "string" || typeof s == "function" || s === r || s === i || se || s === o || s === d || s === g || ae || s === l || H || j || I || typeof s == "object" && s !== null && (s.$$typeof === f || s.$$typeof === m || s.$$typeof === a || s.$$typeof === u || s.$$typeof === c || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. s.$$typeof === le || s.getModuleId !== void 0)); } function we(s, h, S) { var D = s.displayName; if (D) return D; var T = h.displayName || h.name || ""; return T !== "" ? S + "(" + T + ")" : S; } function ke(s) { return s.displayName || "Context"; } function ie(s) { if (s == null) return null; if (typeof s.tag == "number" && P("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof s == "function") return s.displayName || s.name || null; if (typeof s == "string") return s; switch (s) { case r: return "Fragment"; case t: return "Portal"; case i: return "Profiler"; case o: return "StrictMode"; case d: return "Suspense"; case g: return "SuspenseList"; } if (typeof s == "object") switch (s.$$typeof) { case u: var h = s; return ke(h) + ".Consumer"; case a: var S = s; return ke(S._context) + ".Provider"; case c: return we(s, s.render, "ForwardRef"); case m: var D = s.displayName || null; return D !== null ? D : ie(s.type) || "Memo"; case f: { var T = s, L = T._payload, b = T._init; try { return ie(b(L)); } catch { return null; } } } return null; } var ue = Object.assign, Se = 0, Q, Pe, O, Me, Re, je, ce; function C() { } C.__reactDisabledLog = !0; function te() { { if (Se === 0) { Q = console.log, Pe = console.info, O = console.warn, Me = console.error, Re = console.group, je = console.groupCollapsed, ce = console.groupEnd; var s = { configurable: !0, enumerable: !0, value: C, writable: !0 }; Object.defineProperties(console, { info: s, log: s, warn: s, error: s, group: s, groupCollapsed: s, groupEnd: s }); } Se++; } } function M() { { if (Se--, Se === 0) { var s = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: ue({}, s, { value: Q }), info: ue({}, s, { value: Pe }), warn: ue({}, s, { value: O }), error: ue({}, s, { value: Me }), group: ue({}, s, { value: Re }), groupCollapsed: ue({}, s, { value: je }), groupEnd: ue({}, s, { value: ce }) }); } Se < 0 && P("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var G = R.ReactCurrentDispatcher, E; function N(s, h, S) { { if (E === void 0) try { throw Error(); } catch (T) { var D = T.stack.trim().match(/\n( *(at )?)/); E = D && D[1] || ""; } return ` ` + E + s; } } var y = !1, z; { var A = typeof WeakMap == "function" ? WeakMap : Map; z = new A(); } function W(s, h) { if (!s || y) return ""; { var S = z.get(s); if (S !== void 0) return S; } var D; y = !0; var T = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var L; L = G.current, G.current = null, te(); try { if (h) { var b = function() { throw Error(); }; if (Object.defineProperty(b.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(b, []); } catch (K) { D = K; } Reflect.construct(s, [], b); } else { try { b.call(); } catch (K) { D = K; } s.call(b.prototype); } } else { try { throw Error(); } catch (K) { D = K; } s(); } } catch (K) { if (K && D && typeof K.stack == "string") { for (var V = K.stack.split(` `), X = D.stack.split(` `), q = V.length - 1, B = X.length - 1; q >= 1 && B >= 0 && V[q] !== X[B]; ) B--; for (; q >= 1 && B >= 0; q--, B--) if (V[q] !== X[B]) { if (q !== 1 || B !== 1) do if (q--, B--, B < 0 || V[q] !== X[B]) { var ee = ` ` + V[q].replace(" at new ", " at "); return s.displayName && ee.includes("<anonymous>") && (ee = ee.replace("<anonymous>", s.displayName)), typeof s == "function" && z.set(s, ee), ee; } while (q >= 1 && B >= 0); break; } } } finally { y = !1, G.current = L, M(), Error.prepareStackTrace = T; } var _e = s ? s.displayName || s.name : "", ve = _e ? N(_e) : ""; return typeof s == "function" && z.set(s, ve), ve; } function U(s, h, S) { return W(s, !1); } function ge(s) { var h = s.prototype; return !!(h && h.isReactComponent); } function ne(s, h, S) { if (s == null) return ""; if (typeof s == "function") return W(s, ge(s)); if (typeof s == "string") return N(s); switch (s) { case d: return N("Suspense"); case g: return N("SuspenseList"); } if (typeof s == "object") switch (s.$$typeof) { case c: return U(s.render); case m: return ne(s.type, h, S); case f: { var D = s, T = D._payload, L = D._init; try { return ne(L(T), h, S); } catch { } } } return ""; } var De = Object.prototype.hasOwnProperty, ht = {}, wt = R.ReactDebugCurrentFrame; function Ae(s) { if (s) { var h = s._owner, S = ne(s.type, s._source, h ? h.type : null); wt.setExtraStackFrame(S); } else wt.setExtraStackFrame(null); } function rn(s, h, S, D, T) { { var L = Function.call.bind(De); for (var b in s) if (L(s, b)) { var V = void 0; try { if (typeof s[b] != "function") { var X = Error((D || "React class") + ": " + S + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw X.name = "Invariant Violation", X; } V = s[b](h, b, D, S, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (q) { V = q; } V && !(V instanceof Error) && (Ae(T), P("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", D || "React class", S, b, typeof V), Ae(null)), V instanceof Error && !(V.message in ht) && (ht[V.message] = !0, Ae(T), P("Failed %s type: %s", S, V.message), Ae(null)); } } } var on = Array.isArray; function Ue(s) { return on(s); } function an(s) { { var h = typeof Symbol == "function" && Symbol.toStringTag, S = h && s[Symbol.toStringTag] || s.constructor.name || "Object"; return S; } } function sn(s) { try { return St(s), !1; } catch { return !0; } } function St(s) { return "" + s; } function vt(s) { if (sn(s)) return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", an(s)), St(s); } var Ct = R.ReactCurrentOwner, ln = { key: !0, ref: !0, __self: !0, __source: !0 }, Rt, yt; function un(s) { if (De.call(s, "ref")) { var h = Object.getOwnPropertyDescriptor(s, "ref").get; if (h && h.isReactWarning) return !1; } return s.ref !== void 0; } function cn(s) { if (De.call(s, "key")) { var h = Object.getOwnPropertyDescriptor(s, "key").get; if (h && h.isReactWarning) return !1; } return s.key !== void 0; } function dn(s, h) { typeof s.ref == "string" && Ct.current; } function gn(s, h) { { var S = function() { Rt || (Rt = !0, P("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h)); }; S.isReactWarning = !0, Object.defineProperty(s, "key", { get: S, configurable: !0 }); } } function fn(s, h) { { var S = function() { yt || (yt = !0, P("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h)); }; S.isReactWarning = !0, Object.defineProperty(s, "ref", { get: S, configurable: !0 }); } } var pn = function(s, h, S, D, T, L, b) { var V = { // This tag allows us to uniquely identify this as a React Element $$typeof: n, // Built-in properties that belong on the element type: s, key: h, ref: S, props: b, // Record the component responsible for creating this element. _owner: L }; return V._store = {}, Object.defineProperty(V._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(V, "_self", { configurable: !1, enumerable: !1, writable: !1, value: D }), Object.defineProperty(V, "_source", { configurable: !1, enumerable: !1, writable: !1, value: T }), Object.freeze && (Object.freeze(V.props), Object.freeze(V)), V; }; function mn(s, h, S, D, T) { { var L, b = {}, V = null, X = null; S !== void 0 && (vt(S), V = "" + S), cn(h) && (vt(h.key), V = "" + h.key), un(h) && (X = h.ref, dn(h, T)); for (L in h) De.call(h, L) && !ln.hasOwnProperty(L) && (b[L] = h[L]); if (s && s.defaultProps) { var q = s.defaultProps; for (L in q) b[L] === void 0 && (b[L] = q[L]); } if (V || X) { var B = typeof s == "function" ? s.displayName || s.name || "Unknown" : s; V && gn(b, B), X && fn(b, B); } return pn(s, V, X, T, D, Ct.current, b); } } var Xe = R.ReactCurrentOwner, _t = R.ReactDebugCurrentFrame; function ye(s) { if (s) { var h = s._owner, S = ne(s.type, s._source, h ? h.type : null); _t.setExtraStackFrame(S); } else _t.setExtraStackFrame(null); } var Je; Je = !1; function Qe(s) { return typeof s == "object" && s !== null && s.$$typeof === n; } function xt() { { if (Xe.current) { var s = ie(Xe.current.type); if (s) return ` Check the render method of \`` + s + "`."; } return ""; } } function hn(s) { return ""; } var Ft = {}; function wn(s) { { var h = xt(); if (!h) { var S = typeof s == "string" ? s : s.displayName || s.name; S && (h = ` Check the top-level render call using <` + S + ">."); } return h; } } function Pt(s, h) { { if (!s._store || s._store.validated || s.key != null) return; s._store.validated = !0; var S = wn(h); if (Ft[S]) return; Ft[S] = !0; var D = ""; s && s._owner && s._owner !== Xe.current && (D = " It was passed a child from " + ie(s._owner.type) + "."), ye(s), P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', S, D), ye(null); } } function Mt(s, h) { { if (typeof s != "object") return; if (Ue(s)) for (var S = 0; S < s.length; S++) { var D = s[S]; Qe(D) && Pt(D, h); } else if (Qe(s)) s._store && (s._store.validated = !0); else if (s) { var T = F(s); if (typeof T == "function" && T !== s.entries) for (var L = T.call(s), b; !(b = L.next()).done; ) Qe(b.value) && Pt(b.value, h); } } } function Sn(s) { { var h = s.type; if (h == null || typeof h == "string") return; var S; if (typeof h == "function") S = h.propTypes; else if (typeof h == "object" && (h.$$typeof === c || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. h.$$typeof === m)) S = h.propTypes; else return; if (S) { var D = ie(h); rn(S, s.props, "prop", D, s); } else if (h.PropTypes !== void 0 && !Je) { Je = !0; var T = ie(h); P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", T || "Unknown"); } typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && P("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function vn(s) { { for (var h = Object.keys(s.props), S = 0; S < h.length; S++) { var D = h[S]; if (D !== "children" && D !== "key") { ye(s), P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", D), ye(null); break; } } s.ref !== null && (ye(s), P("Invalid attribute `ref` supplied to `React.Fragment`."), ye(null)); } } var Dt = {}; function Et(s, h, S, D, T, L) { { var b = Fe(s); if (!b) { var V = ""; (s === void 0 || typeof s == "object" && s !== null && Object.keys(s).length === 0) && (V += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var X = hn(); X ? V += X : V += xt(); var q; s === null ? q = "null" : Ue(s) ? q = "array" : s !== void 0 && s.$$typeof === n ? (q = "<" + (ie(s.type) || "Unknown") + " />", V = " Did you accidentally export a JSX literal instead of a component?") : q = typeof s, P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, V); } var B = mn(s, h, S, T, L); if (B == null) return B; if (b) { var ee = h.children; if (ee !== void 0) if (D) if (Ue(ee)) { for (var _e = 0; _e < ee.length; _e++) Mt(ee[_e], s); Object.freeze && Object.freeze(ee); } else P("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else Mt(ee, s); } if (De.call(h, "key")) { var ve = ie(s), K = Object.keys(h).filter(function(Fn) { return Fn !== "key"; }), Ke = K.length > 0 ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Dt[ve + Ke]) { var xn = K.length > 0 ? "{" + K.join(": ..., ") + ": ...}" : "{}"; P(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, Ke, ve, xn, ve), Dt[ve + Ke] = !0; } } return s === r ? vn(B) : Sn(B), B; } } function Cn(s, h, S) { return Et(s, h, S, !0); } function Rn(s, h, S) { return Et(s, h, S, !1); } var yn = Rn, _n = Cn; Ve.Fragment = r, Ve.jsx = yn, Ve.jsxs = _n; })()), Ve; } var $t; function Vn() { return $t || ($t = 1, process.env.NODE_ENV === "production" ? Le.exports = Dn() : Le.exports = En()), Le.exports; } var v = Vn(); /** * table-core * * Copyright (c) TanStack * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ function pe(e, n) { return typeof e == "function" ? e(n) : e; } function Z(e, n) { return (t) => { n.setState((r) => ({ ...r, [e]: pe(t, r[e]) })); }; } function qe(e) { return e instanceof Function; } function bn(e) { return Array.isArray(e) && e.every((n) => typeof n == "number"); } function Nt(e, n) { const t = [], r = (o) => { o.forEach((i) => { t.push(i); const a = n(i); a != null && a.length && r(a); }); }; return r(e), t; } function _(e, n, t) { let r = [], o; return (i) => { let a; t.key && t.debug && (a = Date.now()); const u = e(i); if (!(u.length !== r.length || u.some((g, m) => r[m] !== g))) return o; r = u; let d; if (t.key && t.debug && (d = Date.now()), o = n(...u), t == null || t.onChange == null || t.onChange(o), t.key && t.debug && t != null && t.debug()) { const g = Math.round((Date.now() - a) * 100) / 100, m = Math.round((Date.now() - d) * 100) / 100, f = m / 16, l = (p, w) => { for (p = String(p); p.length < w; ) p = " " + p; return p; }; console.info(`%c⏱ ${l(m, 5)} /${l(g, 5)} ms`, ` font-size: .6rem; font-weight: bold; color: hsl(${Math.max(0, Math.min(120 - 120 * f, 120))}deg 100% 31%);`, t?.key); } return o; }; } function x(e, n, t, r) { return { debug: () => { var o; return (o = e?.debugAll) != null ? o : e[n]; }, key: process.env.NODE_ENV === "development" && t, onChange: r }; } function $n(e, n, t, r) { const o = () => { var a; return (a = i.getValue()) != null ? a : e.options.renderFallbackValue; }, i = { id: `${n.id}_${t.id}`, row: n, column: t, getValue: () => n.getValue(r), renderValue: o, getContext: _(() => [e, t, n, i], (a, u, c, d) => ({ table: a, column: u, row: c, cell: d, getValue: d.getValue, renderValue: d.renderValue }), x(e.options, "debugCells", "cell.getContext")) }; return e._features.forEach((a) => { a.createCell == null || a.createCell(i, t, n, e); }, {}), i; } function In(e, n, t, r) { var o, i; const u = { ...e._getDefaultColumnDef(), ...n }, c = u.accessorKey; let d = (o = (i = u.id) != null ? i : c ? typeof String.prototype.replaceAll == "function" ? c.replaceAll(".", "_") : c.replace(/\./g, "_") : void 0) != null ? o : typeof u.header == "string" ? u.header : void 0, g; if (u.accessorFn ? g = u.accessorFn : c && (c.includes(".") ? g = (f) => { let l = f; for (const w of c.split(".")) { var p; l = (p = l) == null ? void 0 : p[w], process.env.NODE_ENV !== "production" && l === void 0 && console.warn(`"${w}" in deeply nested key "${c}" returned undefined.`); } return l; } : g = (f) => f[u.accessorKey]), !d) throw process.env.NODE_ENV !== "production" ? new Error(u.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header") : new Error(); let m = { id: `${String(d)}`, accessorFn: g, parent: r, depth: t, columnDef: u, columns: [], getFlatColumns: _(() => [!0], () => { var f; return [m, ...(f = m.columns) == null ? void 0 : f.flatMap((l) => l.getFlatColumns())]; }, x(e.options, "debugColumns", "column.getFlatColumns")), getLeafColumns: _(() => [e._getOrderColumnsFn()], (f) => { var l; if ((l = m.columns) != null && l.length) { let p = m.columns.flatMap((w) => w.getLeafColumns()); return f(p); } return [m]; }, x(e.options, "debugColumns", "column.getLeafColumns")) }; for (const f of e._features) f.createColumn == null || f.createColumn(m, e); return m; } const Y = "debugHeaders"; function It(e, n, t) { var r; let i = { id: (r = t.id) != null ? r : n.id, column: n, index: t.index, isPlaceholder: !!t.isPlaceholder, placeholderId: t.placeholderId, depth: t.depth, subHeaders: [], colSpan: 0, rowSpan: 0, headerGroup: null, getLeafHeaders: () => { const a = [], u = (c) => { c.subHeaders && c.subHeaders.length && c.subHeaders.map(u), a.push(c); }; return u(i), a; }, getContext: () => ({ table: e, header: i, column: n }) }; return e._features.forEach((a) => { a.createHeader == null || a.createHeader(i, e); }), i; } const On = { createTable: (e) => { e.getHeaderGroups = _(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (n, t, r, o) => { var i, a; const u = (i = r?.map((m) => t.find((f) => f.id === m)).filter(Boolean)) != null ? i : [], c = (a = o?.map((m) => t.find((f) => f.id === m)).filter(Boolean)) != null ? a : [], d = t.filter((m) => !(r != null && r.includes(m.id)) && !(o != null && o.includes(m.id))); return Ge(n, [...u, ...d, ...c], e); }, x(e.options, Y, "getHeaderGroups")), e.getCenterHeaderGroups = _(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (n, t, r, o) => (t = t.filter((i) => !(r != null && r.includes(i.id)) && !(o != null && o.includes(i.id))), Ge(n, t, e, "center")), x(e.options, Y, "getCenterHeaderGroups")), e.getLeftHeaderGroups = _(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left], (n, t, r) => { var o; const i = (o = r?.map((a) => t.find((u) => u.id === a)).filter(Boolean)) != null ? o : []; return Ge(n, i, e, "left"); }, x(e.options, Y, "getLeftHeaderGroups")), e.getRightHeaderGroups = _(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.right], (n, t, r) => { var o; const i = (o = r?.map((a) => t.find((u) => u.id === a)).filter(Boolean)) != null ? o : []; return Ge(n, i, e, "right"); }, x(e.options, Y, "getRightHeaderGroups")), e.getFooterGroups = _(() => [e.getHeaderGroups()], (n) => [...n].reverse(), x(e.options, Y, "getFooterGroups")), e.getLeftFooterGroups = _(() => [e.getLeftHeaderGroups()], (n) => [...n].reverse(), x(e.options, Y, "getLeftFooterGroups")), e.getCenterFooterGroups = _(() => [e.getCenterHeaderGroups()], (n) => [...n].reverse(), x(e.options, Y, "getCenterFooterGroups")), e.getRightFooterGroups = _(() => [e.getRightHeaderGroups()], (n) => [...n].reverse(), x(e.options, Y, "getRightFooterGroups")), e.getFlatHeaders = _(() => [e.getHeaderGroups()], (n) => n.map((t) => t.headers).flat(), x(e.options, Y, "getFlatHeaders")), e.getLeftFlatHeaders = _(() => [e.getLeftHeaderGroups()], (n) => n.map((t) => t.headers).flat(), x(e.options, Y, "getLeftFlatHeaders")), e.getCenterFlatHeaders = _(() => [e.getCenterHeaderGroups()], (n) => n.map((t) => t.headers).flat(), x(e.options, Y, "getCenterFlatHeaders")), e.getRightFlatHeaders = _(() => [e.getRightHeaderGroups()], (n) => n.map((t) => t.headers).flat(), x(e.options, Y, "getRightFlatHeaders")), e.getCenterLeafHeaders = _(() => [e.getCenterFlatHeaders()], (n) => n.filter((t) => { var r; return !((r = t.subHeaders) != null && r.length); }), x(e.options, Y, "getCenterLeafHeaders")), e.getLeftLeafHeaders = _(() => [e.getLeftFlatHeaders()], (n) => n.filter((t) => { var r; return !((r = t.subHeaders) != null && r.length); }), x(e.options, Y, "getLeftLeafHeaders")), e.getRightLeafHeaders = _(() => [e.getRightFlatHeaders()], (n) => n.filter((t) => { var r; return !((r = t.subHeaders) != null && r.length); }), x(e.options, Y, "getRightLeafHeaders")), e.getLeafHeaders = _(() => [e.getLeftHeaderGroups(), e.getCenterHeaderGroups(), e.getRightHeaderGroups()], (n, t, r) => { var o, i, a, u, c, d; return [...(o = (i = n[0]) == null ? void 0 : i.headers) != null ? o : [], ...(a = (u = t[0]) == null ? void 0 : u.headers) != null ? a : [], ...(c = (d = r[0]) == null ? void 0 : d.headers) != null ? c : []].map((g) => g.getLeafHeaders()).flat(); }, x(e.options, Y, "getLeafHeaders")); } }; function Ge(e, n, t, r) { var o, i; let a = 0; const u = function(f, l) { l === void 0 && (l = 1), a = Math.max(a, l), f.filter((p) => p.getIsVisible()).forEach((p) => { var w; (w = p.columns) != null && w.length && u(p.columns, l + 1); }, 0); }; u(e); let c = []; const d = (f, l) => { const p = { depth: l, id: [r, `${l}`].filter(Boolean).join("_"), headers: [] }, w = []; f.forEach((F) => { const R = [...w].reverse()[0], P = F.column.depth === p.depth; let $, H = !1; if (P && F.column.parent ? $ = F.column.parent : ($ = F.column, H = !0), R && R?.column === $) R.subHeaders.push(F); else { const j = It(t, $, { id: [r, l, $.id, F?.id].filter(Boolean).join("_"), isPlaceholder: H, placeholderId: H ? `${w.filter((I) => I.column === $).length}` : void 0, depth: l, index: w.length }); j.subHeaders.push(F), w.push(j); } p.headers.push(F), F.headerGroup = p; }), c.push(p), l > 0 && d(w, l - 1); }, g = n.map((f, l) => It(t, f, { depth: a, index: l })); d(g, a - 1), c.reverse(); const m = (f) => f.filter((p) => p.column.getIsVisible()).map((p) => { let w = 0, F = 0, R = [0]; p.subHeaders && p.subHeaders.length ? (R = [], m(p.subHeaders).forEach(($) => { let { colSpan: H, rowSpan: j } = $; w += H, R.push(j); })) : w = 1; const P = Math.min(...R); return F = F + P, p.colSpan = w, p.rowSpan = F, { colSpan: w, rowSpan: F }; }); return m((o = (i = c[0]) == null ? void 0 : i.headers) != null ? o : []), c; } const Be = (e, n, t, r, o, i, a) => { let u = { id: n, index: r, original: t, depth: o, parentId: a, _valuesCache: {}, _uniqueValuesCache: {}, getValue: (c) => { if (u._valuesCache.hasOwnProperty(c)) return u._valuesCache[c]; const d = e.getColumn(c); if (d != null && d.accessorFn) return u._valuesCache[c] = d.accessorFn(u.original, r), u._valuesCache[c]; }, getUniqueValues: (c) => { if (u._uniqueValuesCache.hasOwnProperty(c)) return u._uniqueValuesCache[c]; const d = e.getColumn(c); if (d != null && d.accessorFn) return d.columnDef.getUniqueValues ? (u._uniqueValuesCache[c] = d.columnDef.getUniqueValues(u.original, r), u._uniqueValuesCache[c]) : (u._uniqueValuesCache[c] = [u.getValue(c)], u._uniqueValuesCache[c]); }, renderValue: (c) => { var d; return (d = u.getValue(c)) != null ? d : e.options.renderFallbackValue; }, subRows: i ?? [], getLeafRows: () => Nt(u.subRows, (c) => c.subRows), getParentRow: () => u.parentId ? e.getRow(u.parentId, !0) : void 0, getParentRows: () => { let c = [], d = u; for (; ; ) { const g = d.getParentRow(); if (!g) break; c.push(g), d = g; } return c.reverse(); }, getAllCells: _(() => [e.getAllLeafColumns()], (c) => c.map((d) => $n(e, u, d, d.id)), x(e.options, "debugRows", "getAllCells")), _getAllCellsByColumnId: _(() => [u.getAllCells()], (c) => c.reduce((d, g) => (d[g.column.id] = g, d), {}), x(e.options, "debugRows", "getAllCellsByColumnId")) }; for (let c = 0; c < e._features.length; c++) { const d = e._features[c]; d == null || d.createRow == null || d.createRow(u, e); } return u; }, Tn = { createColumn: (e, n) => { e._getFacetedRowModel = n.options.getFacetedRowModel && n.options.getFacetedRowModel(n, e.id), e.getFacetedRowModel = () => e._getFacetedRowModel ? e._getFacetedRowModel() : n.getPreFilteredRowModel(), e._getFacetedUniqueValues = n.options.getFacetedUniqueValues && n.options.getFacetedUniqueValues(n, e.id), e.getFacetedUniqueValues = () => e._getFacetedUniqueValues ? e._getFacetedUniqueValues() : /* @__PURE__ */ new Map(), e._getFacetedMinMaxValues = n.options.getFacetedMinMaxValues && n.options.getFacetedMinMaxValues(n, e.id), e.getFacetedMinMaxValues = () => { if (e._getFacetedMinMaxValues) return e._getFacetedMinMaxValues(); }; } }, zt = (e, n, t) => { var r, o; const i = t == null || (r = t.toString()) == null ? void 0 : r.toLowerCase(); return !!(!((o = e.getValue(n)) == null || (o = o.toString()) == null || (o = o.toLowerCase()) == null) && o.includes(i)); }; zt.autoRemove = (e) => re(e); const Wt = (e, n, t) => { var r; return !!(!((r = e.getValue(n)) == null || (r = r.toString()) == null) && r.includes(t)); }; Wt.autoRemove = (e) => re(e); const qt = (e, n, t) => { var r; return ((r = e.getValue(n)) == null || (r = r.toString()) == null ? void 0 : r.toLowerCase()) === t?.toLowerCase(); }; qt.autoRemove = (e) => re(e); const Bt = (e, n, t) => { var r; return (r = e.getValue(n)) == null ? void 0 : r.includes(t); }; Bt.autoRemove = (e) => re(e); const Yt = (e, n, t) => !t.some((r) => { var o; return !((o = e.getValue(n)) != null && o.includes(r)); }); Yt.autoRemove = (e) => re(e) || !(e != null && e.length); const Ut = (e, n, t) => t.some((r) => { var o; return (o = e.getValue(n)) == null ? void 0 : o.includes(r); }); Ut.autoRemove = (e) => re(e) || !(e != null && e.length); const Xt = (e, n, t) => e.getValue(n) === t; Xt.autoRemove = (e) => re(e); const Jt = (e, n, t) => e.getValue(n) == t; Jt.autoRemove = (e) => re(e); const ft = (e, n, t) => { let [r, o] = t; const i = e.getValue(n); return i >= r && i <= o; }; ft.resolveFilterValue = (e) => { let [n, t] = e, r = typeof n != "number" ? parseFloat(n) : n, o = typeof t != "number" ? parseFloat(t) : t, i = n === null || Number.isNaN(r) ? -1 / 0 : r, a = t === null || Number.isNaN(o) ? 1 / 0 : o; if (i > a) { const u = i; i = a, a = u; } return [i, a]; }; ft.autoRemove = (e) => re(e) || re(e[0]) && re(e[1]); const de = { includesString: zt, includesStringSensitive: Wt, equalsString: qt, arrIncludes: Bt, arrIncludesAll: Yt, arrIncludesSome: Ut, equals: Xt, weakEquals: Jt, inNumberRange: ft }; function re(e) { return e == null || e === ""; } const kn = { getDefaultColumnDef: () => ({ filterFn: "auto" }), getInitialState: (e) => ({ columnFilters: [], ...e }), getDefaultOptions: (e) => ({ onColumnFiltersChange: Z("columnFilters", e), filterFromLeafRows: !1, maxLeafRowFilterDepth: 100 }), createColumn: (e, n) => { e.getAutoFilterFn = () => { const t = n.getCoreRowModel().flatRows[0], r = t?.getValue(e.id); return typeof r == "string" ? de.includesString : typeof r == "number" ? de.inNumberRange : typeof r == "boolean" || r !== null && typeof r == "object" ? de.equals : Array.isArray(r) ? de.arrIncludes : de.weakEquals; }, e.getFilterFn = () => { var t, r; return qe(e.columnDef.filterFn) ? e.columnDef.filterFn : e.columnDef.filterFn === "auto" ? e.getAutoFilterFn() : ( // @ts-ignore (t = (r = n.options.filterFns) == null ? void 0 : r[e.columnDef.filterFn]) != null ? t : de[e.columnDef.filterFn] ); }, e.getCanFilter = () => { var t, r, o; return ((t = e.columnDef.enableColumnFilter) != null ? t : !0) && ((r = n.options.enableColumnFilters) != null ? r : !0) && ((o = n.options.enableFilters) != null ? o : !0) && !!e.accessorFn; }, e.getIsFiltered = () => e.getFilterIndex() > -1, e.getFilterValue = () => { var t; return (t = n.getState().columnFilters) == null || (t = t.find((r) => r.id === e.id)) == null ? void 0 : t.value; }, e.getFilterIndex = () => { var t, r; return (t = (r = n.getState().columnFilters) == null ? void 0 : r.findIndex((o) => o.id === e.id)) != null ? t : -1; }, e.setFilterValue = (t) => { n.setColumnFilters((r) => { const o = e.getFilterFn(), i = r?.find((g) => g.id === e.id), a = pe(t, i ? i.value : void 0); if (Ot(o, a, e)) { var u; return (u = r?.filter((g) => g.id !== e.id)) != null ? u : []; } const c = { id: e.id, value: a }; if (i) { var d; return (d = r?.map((g) => g.id === e.id ? c : g)) != null ? d : []; } return r != null && r.length ? [...r, c] : [c]; }); }; }, createRow: (e, n) => { e.columnFilters = {}, e.columnFiltersMeta = {}; }, createTable: (e) => { e.setColumnFilters = (n) => { const t = e.getAllLeafColumns(), r = (o) => { var i; return (i = pe(n, o)) == null ? void 0 : i.filter((a) => { const u = t.find((c) => c.id === a.id); if (u) { const c = u.getFilterFn(); if (Ot(c, a.value, u)) return !1; } return !0; }); }; e.options.onColumnFiltersChange == null || e.options.onColumnFiltersChange(r); }, e.resetColumnFilters = (n) => { var t, r; e.setColumnFilters(n ? [] : (t = (r = e.initialState) == null ? void 0 : r.columnFilters) != null ? t : []); }, 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()); } }; function Ot(e, n, t) { return (e && e.autoRemove ? e.autoRemove(n, t) : !1) || typeof n > "u" || typeof n == "string" && !n; } const jn = (e, n, t) => t.reduce((r, o) => { const i = o.getValue(e); return r + (typeof i == "number" ? i : 0); }, 0), An = (e, n, t) => { let r; return t.forEach((o) => { const i = o.getValue(e); i != null && (r > i || r === void 0 && i >= i) && (r = i); }), r; }, Ln = (e, n, t) => { let r; return t.forEach((o) => { const i = o.getValue(e); i != null && (r < i || r === void 0 && i >= i) && (r = i); }), r; }, Gn = (e, n, t) => { let r, o; return t.forEach((i) => { const a = i.getValue(e); a != null && (r === void 0 ? a >= a && (r = o = a) : (r > a && (r = a), o < a && (o = a))); }), [r, o]; }, Hn = (e, n) => { let t = 0, r = 0; if (n.forEach((o) => { let i = o.getValue(e); i != null && (i = +i) >= i && (++t, r += i); }), t) return r / t; }, Nn = (e, n) => { if (!n.length) return; const t = n.map((i) => i.getValue(e)); if (!bn(t)) return; if (t.length === 1) return t[0]; const r = Math.floor(t.length / 2), o = t.sort((i, a) => i - a); return t.length % 2 !== 0 ? o[r] : (o[r - 1] + o[r]) / 2; }, zn = (e, n) => Array.from(new Set(n.map((t) => t.getValue(e))).values()), Wn = (e, n) => new Set(n.map((t) => t.getValue(e))).size, qn = (e, n) => n.length, Ze = { sum: jn, min: An, max: Ln, extent: Gn, mean: Hn, median: Nn, unique: zn, uniqueCount: Wn, count: qn }, Bn = { getDefaultColumnDef: () => ({ aggregatedCell: (e) => { var n, t; return (n = (t = e.getValue()) == null || t.toString == null ? void 0 : t.toString()) != null ? n : null; }, aggregationFn: "auto" }), getInitialState: (e) => ({ grouping: [], ...e }), getDefaultOptions: (e) => ({ onGroupingChange: Z("grouping", e), groupedColumnMode: "reorder" }), createColumn: (e, n) => { e.toggleGrouping = () => { n.setGrouping((t) => t != null && t.includes(e.id) ? t.filter((r) => r !== e.id) : [...t ?? [], e.id]); }, e.getCanGroup = () => { var t, r; return ((t = e.columnDef.enableGrouping) != null ? t : !0) && ((r = n.options.enableGrouping) != null ? r : !0) && (!!e.accessorFn || !!e.columnDef.getGroupingValue); }, e.getIsGrouped = () => { var t; return (t = n.getState().grouping) == null ? void 0 : t.includes(e.id); }, e.getGroupedIndex = () => { var t; return (t = n.getState().grouping) == null ? void 0 : t.indexOf(e.id); }, e.getToggleGroupingHandler = () => { const t = e.getCanGroup(); return () => { t && e.toggleGrouping(); }; }, e.getAutoAggregationFn = () => { const t = n.getCoreRowModel().flatRows[0], r = t?.getValue(e.id); if (typeof r == "number") return Ze.sum; if (Object.prototype.toString.call(r) === "[object Date]") return Ze.extent; }, e.getAggregationFn = () => { var t, r; if (!e) throw new Error(); return qe(e.columnDef.aggregationFn) ? e.columnDef.aggregationFn : e.columnDef.aggregationFn === "auto" ? e.getAutoAggregationFn() : (t = (r = n.options.aggregationFns) == null ? void 0 : r[e.columnDef.aggregationFn]) != null ? t : Ze[e.columnDef.aggregationFn]; }; }, createTable: (e) => { e.setGrouping = (n) => e.options.onGroupingChange == null ? void 0 : e.options.onGroupingChange(n), e.resetGrouping = (n) => { var t, r; e.setGrouping(n ? [] : (t = (r = e.initialState) == null ? void 0 : r.grouping) != null ? t : []); }, 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()); }, createRow: (e, n) => { e.getIsGrouped = () => !!e.groupingColumnId, e.getGroupingValue = (t) => { if (e._groupingValuesCache.hasOwnProperty(t)) return e._groupingValuesCache[t]; const r = n.getColumn(t); return r != null && r.columnDef.getGroupingValue ? (e._groupingValuesCache[t] = r.columnDef.getGroupingValue(e.original), e._groupingValuesCache[t]) : e.getValue(t); }, e._groupingValuesCache = {}; }, createCell: (e, n, t, r) => { e.getIsGrouped = () => n.getIsGrouped() && n.id === t.groupingColumnId, e.getIsPlaceholder = () => !e.getIsGrouped() && n.getIsGrouped(), e.getIsAggregated = () => { var o; return !e.getIsGrouped() && !e.getIsPlaceholder() && !!((o = t.subRows) != null && o.length); }; } }; function Yn(e, n, t) { if (!(n != null && n.length) || !t) return e; const r = e.filter((i) => !n.includes(i.id)); return t === "remove" ? r : [...n.map((i) => e.find((a) => a.id === i)).filter(Boolean), ...r]; } const Un = { getInitialState: (e) => ({ columnOrder: [], ...e }), getDefaultOptions: (e) => ({ onColumnOrderChange: Z("columnOrder", e) }), createColumn: (e, n) => { e.getIndex = _((t) => [Oe(n, t)], (t) => t.findIndex((r) => r.id === e.id), x(n.options, "debugColumns", "getIndex")), e.getIsFirstColumn = (t) => { var r; return ((r = Oe(n, t)[0]) == null ? void 0 : r.id) === e.id; }, e.getIsLastColumn = (t) => { var r; const o = Oe(n, t); return ((r = o[o.length - 1]) == null ? void 0 : r.id) === e.id; }; }, createTable: (e) => { e.setColumnOrder = (n) => e.options.onColumnOrderChange == null ? void 0 : e.options.onColumnOrderChange(n), e.resetColumnOrder = (n) => { var t; e.setColumnOrder(n ? [] : (t = e.initialState.columnOrder) != null ? t : []); }, e._getOrderColumnsFn = _(() => [e.getState().columnOrder, e.getState().grouping, e.options.groupedColumnMode], (n, t, r) => (o) => { let i = []; if (!(n != null && n.length)) i = o; else { const a = [...n], u = [...o]; for (; u.length && a.length; ) { const c = a.shift(), d = u.findIndex((g) => g.id === c); d > -1 && i.push(u.splice(d, 1)[0]); } i = [...i, ...u]; } return Yn(i, t, r); }, x(e.options, "debugTable", "_getOrderColumnsFn")); } }, et = () => ({ left: [], right: [] }), Xn = { getInitialState: (e) => ({ columnPinning: et(), ...e }), getDefaultOptions: (e) => ({ onColumnPinningChange: Z("columnPinning", e) }), createColumn: (e, n) => { e.pin = (t) => { const r = e.getLeafColumns().map((o) => o.id).filter(Boolean); n.setColumnPinning((o) => { var i, a; if (t === "right") { var u, c; return { left: ((u = o?.left) != null ? u : []).filter((m) => !(r != null && r.includes(m))), right: [...((c = o?.right) != null ? c : []).filter((m) => !(r != null && r.includes(m))), ...r] }; } if (t === "left") { var d, g; return { left: [...((d = o?.left) != null ? d : []).filter((m) => !(r != null && r.includes(m))), ...r], right: ((g = o?.right) != null ? g : []).filter((m) => !(r != null && r.includes(m))) }; } return { left: ((i = o?.left) != null ? i : []).filter((m) => !(r != null && r.includes(m))), right: ((a = o?.right) != null ? a : []).filter((m) => !(r != null && r.includes(m))) }; }); }, e.getCanPin = () => e.getLeafColumns().some((r) => { var o, i, a; return ((o = r.columnDef.enablePinning) != null ? o : !0) && ((i = (a = n.options.enableColumnPinning) != null ? a : n.options.enablePinning) != null ? i : !0); }), e.getIsPinned = () => { const t = e.getLeafColumns().map((u) => u.id), { left: r, right: o } = n.getState().columnPinning, i = t.some((u) => r?.includes(u)), a = t.some((u) => o?.includes(u)); return i ? "left" : a ? "right" : !1; }, e.getPinnedIndex = () => { var t, r; const o = e.getIsPinned(); return o ? (t = (r = n.getState().columnPinning) == null || (r = r[o]) == null ? void 0 : r.indexOf(e.id)) != null ? t : -1 : 0; }; }, createRow: (e, n) => { e.getCenterVisibleCells = _(() => [e._getAllVisibleCells(), n.getState().columnPinning.left, n.getState().columnPinning.right], (t, r, o) => { const i = [...r ?? [], ...o ?? []]; return t.filter((a) => !i.includes(a.column.id)); }, x(n.options, "debugRows", "getCenterVisibleCells")), e.getLeftVisibleCells = _(() => [e._getAllVisibleCells(), n.getState().columnPinning.left], (t, r) => (r ?? []).map((i) => t.find((a) => a.column.id === i)).filter(Boolean).map((i) => ({ ...i, position: "left" })), x(n.options, "debugRows", "getLeftVisibleCells")), e.getRightVisibleCells = _(() => [e._getAllVisibleCells(), n.getState().columnPinning.right], (t, r) => (r ?? []).map((i) => t.find((a) => a.column.id === i)).filter(Boolean).map((i) => ({ ...i, position: "right" })), x(n.options, "debugRows", "getRightVisibleCells")); }, createTable: (e) => { e.setColumnPinning = (n) => e.options.onColumnPinningChange == null ? void 0 : e.options.onColumnPinningChange(n), e.resetColumnPinning = (n) => { var t, r; return e.setColumnPinning(n ? et() : (t = (r = e.initialState) == null ? void 0 : r.columnPinning) != null ? t : et()); }, e.getIsSomeColumnsPinned = (n) => { var t; const r = e.getState().columnPinning; if (!n) { var o, i; return !!((o = r.left) != null && o.length || (i = r.right) != null && i.length); } return !!((t = r[n]) != null && t.length); }, e.getLeftLeafColumns = _(() => [e.getAllLeafColumns(), e.getState().columnPinning.left], (n, t) => (t ?? []).map((r) => n.find((o) => o.id === r)).filter(Boolean), x(e.options, "debugColumns", "getLeftLeafColumns")), e.getRightLeafColumns = _(() => [e.getAllLeafColumns(), e.getState().columnPinning.right], (n, t) => (t ?? []).map((r) => n.find((o) => o.id === r)).filter(Boolean), x(e.options, "debugColumns", "getRightLeafColumns")), e.getCenterLeafColumns = _(() => [e.getAllLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (n, t, r) => { const o = [...t ?? [], ...r ?? []]; return n.filter((i) => !o.includes(i.id)); }, x(e.options, "debugColumns", "getCenterLeafColumns")); } }; function Jn(e) { return e || (typeof document < "u" ? document : null); } const He = { size: 150, minSize: 20, maxSize: Number.MAX_SAFE_INTEGER }, tt = () => ({ startOffset: null, startSize: null, deltaOffset: null, deltaPercentage: null, isResizingColumn: !1, columnSizingStart: [] }), Qn = { getDefaultColumnDef: () => He, getInitialState: (e) => ({ columnSizing: {}, columnSizingInfo: tt(), ...e }), getDefaultOptions: (e) => ({ columnResizeMode: "onEnd", columnResizeDirection: "ltr", onColumnSizingChange: Z("columnSizing", e), onColumnSizingInfoChange: Z("c