@fileflow/sdk 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ImportWizard-B5Uegimf.js +73 -0
- package/dist/{ImportWizard-BAmeOWXl.js.map → ImportWizard-B5Uegimf.js.map} +1 -1
- package/dist/{ImportWizard-B69XBxtG.mjs → ImportWizard-BNCe0g8q.mjs} +751 -748
- package/dist/{ImportWizard-B69XBxtG.mjs.map → ImportWizard-BNCe0g8q.mjs.map} +1 -1
- package/dist/{KYCWizard-CYdeoPXE.mjs → KYCWizard-BQkfxOw-.mjs} +2 -2
- package/dist/{KYCWizard-CYdeoPXE.mjs.map → KYCWizard-BQkfxOw-.mjs.map} +1 -1
- package/dist/{KYCWizard-Bei2tyWT.js → KYCWizard-Cq4Q7c8v.js} +2 -2
- package/dist/{KYCWizard-Bei2tyWT.js.map → KYCWizard-Cq4Q7c8v.js.map} +1 -1
- package/dist/import.d.ts +46 -0
- package/dist/import.js +1 -1
- package/dist/import.mjs +1 -1
- package/dist/{index-oKr8Wtf5.mjs → index-BNtIB3cM.mjs} +1080 -1038
- package/dist/index-BNtIB3cM.mjs.map +1 -0
- package/dist/{index-DOOgWkvj.js → index-j-Z3dkyz.js} +35 -35
- package/dist/index-j-Z3dkyz.js.map +1 -0
- package/dist/index.d.ts +67 -8
- package/dist/index.js +1 -1
- package/dist/index.mjs +3 -3
- package/dist/kyc.js +1 -1
- package/dist/kyc.mjs +1 -1
- package/dist/styles.css +1329 -0
- package/package.json +8 -3
- package/dist/ImportWizard-BAmeOWXl.js +0 -73
- package/dist/index-DOOgWkvj.js.map +0 -1
- package/dist/index-oKr8Wtf5.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileflow/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "FileFlow SDK - Embeddable data import and KYC verification components with automatic style injection",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
-
"sideEffects":
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"*.css",
|
|
10
|
+
"./dist/*.js",
|
|
11
|
+
"./dist/*.mjs"
|
|
12
|
+
],
|
|
9
13
|
"exports": {
|
|
10
14
|
".": {
|
|
11
15
|
"import": "./dist/index.mjs",
|
|
@@ -21,7 +25,8 @@
|
|
|
21
25
|
"import": "./dist/kyc.mjs",
|
|
22
26
|
"require": "./dist/kyc.js",
|
|
23
27
|
"types": "./dist/kyc.d.ts"
|
|
24
|
-
}
|
|
28
|
+
},
|
|
29
|
+
"./styles.css": "./dist/styles.css"
|
|
25
30
|
},
|
|
26
31
|
"files": [
|
|
27
32
|
"dist"
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("react/jsx-runtime"),E=require("react"),w=require("./index-DOOgWkvj.js");function qe(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const fe=qe(E);/**
|
|
2
|
-
* @license lucide-react v0.563.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ue=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ke=w.createLucideIcon("arrow-right",Ue);/**
|
|
7
|
-
* @license lucide-react v0.563.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Xe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],We=w.createLucideIcon("check",Xe);/**
|
|
12
|
-
* @license lucide-react v0.563.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Qe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ye=w.createLucideIcon("chevron-left",Qe);/**
|
|
17
|
-
* @license lucide-react v0.563.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Je=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ze=w.createLucideIcon("circle-question-mark",Je);/**
|
|
22
|
-
* @license lucide-react v0.563.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const et=[["path",{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",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],tt=w.createLucideIcon("eye",et);/**
|
|
27
|
-
* @license lucide-react v0.563.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const nt=[["path",{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",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],ot=w.createLucideIcon("file-spreadsheet",nt);/**
|
|
32
|
-
* @license lucide-react v0.563.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const rt=[["path",{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",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],st=w.createLucideIcon("file",rt);/**
|
|
37
|
-
* @license lucide-react v0.563.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const lt=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],it=w.createLucideIcon("git-branch",lt);/**
|
|
42
|
-
* @license lucide-react v0.563.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const at=[["path",{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",key:"1a8usu"}]],ut=w.createLucideIcon("pen",at);/**
|
|
47
|
-
* @license lucide-react v0.563.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const ft=[["path",{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"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],dt=w.createLucideIcon("square-check-big",ft),Fe={sessionId:null,status:"idle",step:"upload",schema:null,file:null,fileName:null,fileSize:null,headers:[],rows:[],totalRows:0,sampleRows:[],mappings:[],unmappedSource:[],unmappedTarget:[],validationResults:null,errorsByRow:new Map,isLoading:!1,error:null,editingCell:null,editedRows:new Set},b=w.create((e,o)=>({...Fe,setSchema:t=>e({schema:t}),setSessionId:t=>e({sessionId:t}),setFile:t=>e({file:t,fileName:t.name,fileSize:t.size,error:null}),setParsedData:t=>e({headers:t.headers,rows:t.rows,totalRows:t.totalRows,sampleRows:t.sampleRows}),setMappings:t=>e({mappings:t}),updateMapping:(t,n)=>e(r=>({mappings:r.mappings.map(l=>l.sourceColumn===t?{...l,targetKey:n,isAutoMapped:!1}:l)})),setUnmapped:(t,n)=>e({unmappedSource:t,unmappedTarget:n}),setValidationResults:t=>{const n=new Map;for(const r of t.errors){const s=n.get(r.rowIndex)||[];s.push(r),n.set(r.rowIndex,s)}e({validationResults:t,errorsByRow:n})},setStep:t=>e({step:t}),nextStep:()=>{const t=["upload","mapping","validation","review","complete"],n=t.indexOf(o().step);n<t.length-1&&e({step:t[n+1]})},previousStep:()=>{const t=["upload","mapping","validation","review","complete"],n=t.indexOf(o().step);n>0&&e({step:t[n-1]})},startEditing:(t,n)=>e({editingCell:{rowIndex:t,columnKey:n}}),stopEditing:()=>e({editingCell:null}),updateCell:(t,n,r)=>e(s=>{const l=[...s.rows],u=l.find(d=>d.rowIndex===t);u&&(u.data={...u.data,[n]:String(r)});const f=new Set(s.editedRows);return f.add(t),{rows:l,editedRows:f,editingCell:null}}),setStatus:t=>e({status:t}),setLoading:t=>e({isLoading:t}),setError:t=>e({error:t}),reset:()=>e(Fe)})),Me=({onFileSelect:e,maxSize:o=50*1024*1024,acceptedTypes:t=[".csv",".xlsx",".xls"]})=>{const{file:n,fileName:r,fileSize:s,setFile:l,error:u,setError:f,isLoading:d}=b(),g=E.useCallback((v,S)=>{if(S.length>0){f("Invalid file type or file too large");return}if(v.length>0){const y=v[0];l(y),e==null||e(y)}},[e,l,f]),{getRootProps:p,getInputProps:c,isDragActive:a}=w.useDropzone({onDrop:g,accept:{"text/csv":[".csv"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.ms-excel":[".xls"]},maxSize:o,multiple:!1,disabled:d}),m=v=>v<1024?`${v} B`:v<1024*1024?`${(v/1024).toFixed(1)} KB`:`${(v/(1024*1024)).toFixed(1)} MB`,h=v=>{v.stopPropagation(),b.getState().reset()};return n?i.jsx("div",{className:"ff-p-4 ff-rounded-xl ff-border",style:{backgroundColor:"var(--ff-success-light)",borderColor:"var(--ff-success)"},children:i.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[i.jsx("div",{className:"ff-p-2 ff-rounded-lg",style:{backgroundColor:"rgba(41, 142, 51, 0.15)"},children:i.jsx(st,{className:"ff-w-6 ff-h-6",style:{color:"var(--ff-success)"}})}),i.jsxs("div",{className:"ff-flex-1 ff-min-w-0",children:[i.jsx("p",{className:"ff-font-medium ff-truncate",style:{color:"var(--ff-success-dark)"},children:r}),i.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:m(s||0)})]}),i.jsx("button",{onClick:h,className:"ff-p-1.5 ff-rounded-full ff-transition-colors",style:{color:"var(--ff-success)"},"aria-label":"Remove file",children:i.jsx(w.X,{className:"ff-w-5 ff-h-5"})})]})}):i.jsxs("div",{className:"ff-space-y-6",children:[i.jsxs("div",{...p(),className:w.clsx("ff-dropzone",a&&"ff-dropzone-active",d&&"ff-opacity-50 ff-cursor-not-allowed"),children:[i.jsx("input",{...c()}),i.jsx("div",{className:"ff-dropzone-icon-wrapper",children:i.jsx(w.Upload,{className:"ff-dropzone-icon"})}),i.jsx("h3",{className:"ff-dropzone-text",children:a?"Drop your file here":"Upload your file"}),i.jsx("p",{className:"ff-dropzone-hint",children:"Drag and drop or click to select"}),i.jsx("label",{className:"ff-inline-block",children:i.jsx("span",{className:w.clsx("ff-btn ff-btn-primary",d&&"ff-opacity-50 ff-cursor-wait"),children:d?"Processing...":"Choose file"})}),i.jsxs("p",{className:"ff-dropzone-formats",children:["Supports ",t.join(", ")," up to ",m(o)]})]}),u&&i.jsxs("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:[i.jsx(w.CircleAlert,{className:"ff-w-4 ff-h-4 ff-flex-shrink-0"}),i.jsx("p",{children:u})]})]})},Ve=({onMappingChange:e})=>{const{mappings:o,schema:t,unmappedSource:n,updateMapping:r}=b(),s=(t==null?void 0:t.columns)||[],l=(p,c)=>{const a=c===""?null:c;r(p,a),e==null||e(p,a)},u=p=>p>=.85?"var(--ff-success)":p>=.6?"var(--ff-warning)":"var(--ff-error)",f=p=>p>=.85?"High":p>=.6?"Medium":"Low",g=new Set(o.filter(p=>p.targetKey!==null).map(p=>p.targetKey));return i.jsxs("div",{className:"ff-space-y-4",children:[i.jsxs("div",{className:"ff-mapping-header",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"ff-mapping-title",children:"Column Mapping"}),i.jsx("p",{className:"ff-mapping-subtitle",children:"Match your file columns to the expected fields"})]}),i.jsxs("div",{className:"ff-mapping-legend",children:[i.jsxs("span",{className:"ff-mapping-legend-item",children:[i.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-success)"}}),i.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Mapped"})]}),i.jsxs("span",{className:"ff-mapping-legend-item",children:[i.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-warning)"}}),i.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Review"})]}),i.jsxs("span",{className:"ff-mapping-legend-item",children:[i.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-gray-70)"}}),i.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Unmapped"})]})]})]}),i.jsx("div",{className:"ff-space-y-2",children:o.map(p=>{s.find(m=>m.key===p.targetKey);const c=p.targetKey!==null,a=p.confidence>=.85;return i.jsxs("div",{className:w.clsx("ff-mapping-row",c&&a&&"ff-mapping-row-success",c&&!a&&"ff-mapping-row-warning"),children:[i.jsx("div",{className:"ff-flex-1",children:i.jsx("div",{className:"ff-mapping-source",children:p.sourceColumn})}),i.jsx("div",{className:"ff-mapping-arrow",children:i.jsx(Ke,{className:"ff-w-5 ff-h-5"})}),i.jsx("div",{className:"ff-flex-1 ff-mapping-target",children:i.jsxs("select",{value:p.targetKey||"",onChange:m=>l(p.sourceColumn,m.target.value),className:"ff-input",children:[i.jsx("option",{value:"",children:"-- Do not import --"}),s.map(m=>i.jsxs("option",{value:m.key,disabled:g.has(m.key)&&p.targetKey!==m.key,children:[m.label," (",m.type,")",m.required?" *":""]},m.key))]})}),i.jsx("div",{className:"ff-mapping-status",children:c?a?i.jsx(We,{className:"ff-w-5 ff-h-5",style:{color:"var(--ff-success)"}}):i.jsx(Ze,{className:"ff-w-5 ff-h-5",style:{color:"var(--ff-warning)"}}):i.jsx("span",{className:"ff-w-5 ff-h-5"})}),p.confidence>0&&i.jsxs("div",{className:"ff-confidence",style:{color:u(p.confidence)},children:[i.jsxs("span",{children:[Math.round(p.confidence*100),"%"]}),i.jsxs("span",{style:{color:"var(--ff-text-muted)"},children:["(",f(p.confidence),")"]})]})]},p.sourceColumn)})}),(()=>{const p=s.filter(c=>c.required&&!g.has(c.key));return p.length>0?i.jsxs("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:[i.jsx(w.CircleAlert,{className:"ff-w-5 ff-h-5 ff-flex-shrink-0 ff-mt-0.5",style:{color:"var(--ff-warning)"}}),i.jsxs("div",{children:[i.jsx("p",{className:"ff-text-sm ff-font-medium",style:{color:"var(--ff-warning-dark)"},children:"Required fields not mapped"}),i.jsx("p",{className:"ff-text-sm ff-mt-1",style:{color:"var(--ff-warning)"},children:p.map(c=>c.label).join(", ")})]})]}):null})()]})};/**
|
|
52
|
-
* table-core
|
|
53
|
-
*
|
|
54
|
-
* Copyright (c) TanStack
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the MIT license found in the
|
|
57
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
58
|
-
*
|
|
59
|
-
* @license MIT
|
|
60
|
-
*/function ct(){return{accessor:(e,o)=>typeof e=="function"?{...o,accessorFn:e}:{...o,accessorKey:e},display:e=>e,group:e=>e}}function G(e,o){return typeof e=="function"?e(o):e}function k(e,o){return t=>{o.setState(n=>({...n,[e]:G(t,n[e])}))}}function Z(e){return e instanceof Function}function gt(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function pt(e,o){const t=[],n=r=>{r.forEach(s=>{t.push(s);const l=o(s);l!=null&&l.length&&n(l)})};return n(e),t}function C(e,o,t){let n=[],r;return s=>{let l;t.key&&t.debug&&(l=Date.now());const u=e(s);if(!(u.length!==n.length||u.some((g,p)=>n[p]!==g)))return r;n=u;let d;if(t.key&&t.debug&&(d=Date.now()),r=o(...u),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const g=Math.round((Date.now()-l)*100)/100,p=Math.round((Date.now()-d)*100)/100,c=p/16,a=(m,h)=>{for(m=String(m);m.length<h;)m=" "+m;return m};console.info(`%c⏱ ${a(p,5)} /${a(g,5)} ms`,`
|
|
61
|
-
font-size: .6rem;
|
|
62
|
-
font-weight: bold;
|
|
63
|
-
color: hsl(${Math.max(0,Math.min(120-120*c,120))}deg 100% 31%);`,t==null?void 0:t.key)}return r}}function x(e,o,t,n){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[o]},key:process.env.NODE_ENV==="development"&&t,onChange:n}}function mt(e,o,t,n){const r=()=>{var l;return(l=s.getValue())!=null?l:e.options.renderFallbackValue},s={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:r,getContext:C(()=>[e,t,o,s],(l,u,f,d)=>({table:l,column:u,row:f,cell:d,getValue:d.getValue,renderValue:d.renderValue}),x(e.options,"debugCells","cell.getContext"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(s,t,o,e)},{}),s}function ht(e,o,t,n){var r,s;const u={...e._getDefaultColumnDef(),...o},f=u.accessorKey;let d=(r=(s=u.id)!=null?s:f?typeof String.prototype.replaceAll=="function"?f.replaceAll(".","_"):f.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,g;if(u.accessorFn?g=u.accessorFn:f&&(f.includes(".")?g=c=>{let a=c;for(const h of f.split(".")){var m;a=(m=a)==null?void 0:m[h],process.env.NODE_ENV!=="production"&&a===void 0&&console.warn(`"${h}" in deeply nested key "${f}" returned undefined.`)}return a}:g=c=>c[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 p={id:`${String(d)}`,accessorFn:g,parent:n,depth:t,columnDef:u,columns:[],getFlatColumns:C(()=>[!0],()=>{var c;return[p,...(c=p.columns)==null?void 0:c.flatMap(a=>a.getFlatColumns())]},x(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:C(()=>[e._getOrderColumnsFn()],c=>{var a;if((a=p.columns)!=null&&a.length){let m=p.columns.flatMap(h=>h.getLeafColumns());return c(m)}return[p]},x(e.options,"debugColumns","column.getLeafColumns"))};for(const c of e._features)c.createColumn==null||c.createColumn(p,e);return p}const N="debugHeaders";function $e(e,o,t){var n;let s={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],u=f=>{f.subHeaders&&f.subHeaders.length&&f.subHeaders.map(u),l.push(f)};return u(s),l},getContext:()=>({table:e,header:s,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(s,e)}),s}const vt={createTable:e=>{e.getHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>{var s,l;const u=(s=n==null?void 0:n.map(p=>t.find(c=>c.id===p)).filter(Boolean))!=null?s:[],f=(l=r==null?void 0:r.map(p=>t.find(c=>c.id===p)).filter(Boolean))!=null?l:[],d=t.filter(p=>!(n!=null&&n.includes(p.id))&&!(r!=null&&r.includes(p.id)));return Q(o,[...u,...d,...f],e)},x(e.options,N,"getHeaderGroups")),e.getCenterHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>(t=t.filter(s=>!(n!=null&&n.includes(s.id))&&!(r!=null&&r.includes(s.id))),Q(o,t,e,"center")),x(e.options,N,"getCenterHeaderGroups")),e.getLeftHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var r;const s=(r=n==null?void 0:n.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?r:[];return Q(o,s,e,"left")},x(e.options,N,"getLeftHeaderGroups")),e.getRightHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var r;const s=(r=n==null?void 0:n.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?r:[];return Q(o,s,e,"right")},x(e.options,N,"getRightHeaderGroups")),e.getFooterGroups=C(()=>[e.getHeaderGroups()],o=>[...o].reverse(),x(e.options,N,"getFooterGroups")),e.getLeftFooterGroups=C(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),x(e.options,N,"getLeftFooterGroups")),e.getCenterFooterGroups=C(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),x(e.options,N,"getCenterFooterGroups")),e.getRightFooterGroups=C(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),x(e.options,N,"getRightFooterGroups")),e.getFlatHeaders=C(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,N,"getFlatHeaders")),e.getLeftFlatHeaders=C(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,N,"getLeftFlatHeaders")),e.getCenterFlatHeaders=C(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,N,"getCenterFlatHeaders")),e.getRightFlatHeaders=C(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,N,"getRightFlatHeaders")),e.getCenterLeafHeaders=C(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),x(e.options,N,"getCenterLeafHeaders")),e.getLeftLeafHeaders=C(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),x(e.options,N,"getLeftLeafHeaders")),e.getRightLeafHeaders=C(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),x(e.options,N,"getRightLeafHeaders")),e.getLeafHeaders=C(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,s,l,u,f,d;return[...(r=(s=o[0])==null?void 0:s.headers)!=null?r:[],...(l=(u=t[0])==null?void 0:u.headers)!=null?l:[],...(f=(d=n[0])==null?void 0:d.headers)!=null?f:[]].map(g=>g.getLeafHeaders()).flat()},x(e.options,N,"getLeafHeaders"))}};function Q(e,o,t,n){var r,s;let l=0;const u=function(c,a){a===void 0&&(a=1),l=Math.max(l,a),c.filter(m=>m.getIsVisible()).forEach(m=>{var h;(h=m.columns)!=null&&h.length&&u(m.columns,a+1)},0)};u(e);let f=[];const d=(c,a)=>{const m={depth:a,id:[n,`${a}`].filter(Boolean).join("_"),headers:[]},h=[];c.forEach(v=>{const S=[...h].reverse()[0],y=v.column.depth===m.depth;let F,D=!1;if(y&&v.column.parent?F=v.column.parent:(F=v.column,D=!0),S&&(S==null?void 0:S.column)===F)S.subHeaders.push(v);else{const j=$e(t,F,{id:[n,a,F.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:D,placeholderId:D?`${h.filter(V=>V.column===F).length}`:void 0,depth:a,index:h.length});j.subHeaders.push(v),h.push(j)}m.headers.push(v),v.headerGroup=m}),f.push(m),a>0&&d(h,a-1)},g=o.map((c,a)=>$e(t,c,{depth:l,index:a}));d(g,l-1),f.reverse();const p=c=>c.filter(m=>m.column.getIsVisible()).map(m=>{let h=0,v=0,S=[0];m.subHeaders&&m.subHeaders.length?(S=[],p(m.subHeaders).forEach(F=>{let{colSpan:D,rowSpan:j}=F;h+=D,S.push(j)})):h=1;const y=Math.min(...S);return v=v+y,m.colSpan=h,m.rowSpan=v,{colSpan:h,rowSpan:v}});return p((r=(s=f[0])==null?void 0:s.headers)!=null?r:[]),f}const we=(e,o,t,n,r,s,l)=>{let u={id:o,index:n,original:t,depth:r,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:f=>{if(u._valuesCache.hasOwnProperty(f))return u._valuesCache[f];const d=e.getColumn(f);if(d!=null&&d.accessorFn)return u._valuesCache[f]=d.accessorFn(u.original,n),u._valuesCache[f]},getUniqueValues:f=>{if(u._uniqueValuesCache.hasOwnProperty(f))return u._uniqueValuesCache[f];const d=e.getColumn(f);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(u._uniqueValuesCache[f]=d.columnDef.getUniqueValues(u.original,n),u._uniqueValuesCache[f]):(u._uniqueValuesCache[f]=[u.getValue(f)],u._uniqueValuesCache[f])},renderValue:f=>{var d;return(d=u.getValue(f))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>pt(u.subRows,f=>f.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let f=[],d=u;for(;;){const g=d.getParentRow();if(!g)break;f.push(g),d=g}return f.reverse()},getAllCells:C(()=>[e.getAllLeafColumns()],f=>f.map(d=>mt(e,u,d,d.id)),x(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:C(()=>[u.getAllCells()],f=>f.reduce((d,g)=>(d[g.column.id]=g,d),{}),x(e.options,"debugRows","getAllCellsByColumnId"))};for(let f=0;f<e._features.length;f++){const d=e._features[f];d==null||d.createRow==null||d.createRow(u,e)}return u},wt={createColumn:(e,o)=>{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():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Pe=(e,o,t)=>{var n,r;const s=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((r=e.getValue(o))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(s))};Pe.autoRemove=e=>A(e);const Ne=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};Ne.autoRemove=e=>A(e);const De=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};De.autoRemove=e=>A(e);const Ee=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};Ee.autoRemove=e=>A(e);const Le=(e,o,t)=>!t.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});Le.autoRemove=e=>A(e)||!(e!=null&&e.length);const ke=(e,o,t)=>t.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});ke.autoRemove=e=>A(e)||!(e!=null&&e.length);const Ae=(e,o,t)=>e.getValue(o)===t;Ae.autoRemove=e=>A(e);const ze=(e,o,t)=>e.getValue(o)==t;ze.autoRemove=e=>A(e);const Ce=(e,o,t)=>{let[n,r]=t;const s=e.getValue(o);return s>=n&&s<=r};Ce.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,r=typeof t!="number"?parseFloat(t):t,s=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(r)?1/0:r;if(s>l){const u=s;s=l,l=u}return[s,l]};Ce.autoRemove=e=>A(e)||A(e[0])&&A(e[1]);const H={includesString:Pe,includesStringSensitive:Ne,equalsString:De,arrIncludes:Ee,arrIncludesAll:Le,arrIncludesSome:ke,equals:Ae,weakEquals:ze,inNumberRange:Ce};function A(e){return e==null||e===""}const Ct={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:k("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?H.includesString:typeof n=="number"?H.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?H.equals:Array.isArray(n)?H.arrIncludes:H.weakEquals},e.getFilterFn=()=>{var t,n;return Z(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:H[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const r=e.getFilterFn(),s=n==null?void 0:n.find(g=>g.id===e.id),l=G(t,s?s.value:void 0);if(je(r,l,e)){var u;return(u=n==null?void 0:n.filter(g=>g.id!==e.id))!=null?u:[]}const f={id:e.id,value:l};if(s){var d;return(d=n==null?void 0:n.map(g=>g.id===e.id?f:g))!=null?d:[]}return n!=null&&n.length?[...n,f]:[f]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=r=>{var s;return(s=G(o,r))==null?void 0:s.filter(l=>{const u=t.find(f=>f.id===l.id);if(u){const f=u.getFilterFn();if(je(f,l.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.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 je(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const xt=(e,o,t)=>t.reduce((n,r)=>{const s=r.getValue(e);return n+(typeof s=="number"?s:0)},0),St=(e,o,t)=>{let n;return t.forEach(r=>{const s=r.getValue(e);s!=null&&(n>s||n===void 0&&s>=s)&&(n=s)}),n},Rt=(e,o,t)=>{let n;return t.forEach(r=>{const s=r.getValue(e);s!=null&&(n<s||n===void 0&&s>=s)&&(n=s)}),n},yt=(e,o,t)=>{let n,r;return t.forEach(s=>{const l=s.getValue(e);l!=null&&(n===void 0?l>=l&&(n=r=l):(n>l&&(n=l),r<l&&(r=l)))}),[n,r]},_t=(e,o)=>{let t=0,n=0;if(o.forEach(r=>{let s=r.getValue(e);s!=null&&(s=+s)>=s&&(++t,n+=s)}),t)return n/t},Ft=(e,o)=>{if(!o.length)return;const t=o.map(s=>s.getValue(e));if(!gt(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),r=t.sort((s,l)=>s-l);return t.length%2!==0?r[n]:(r[n-1]+r[n])/2},$t=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),jt=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,It=(e,o)=>o.length,ne={sum:xt,min:St,max:Rt,extent:yt,mean:_t,median:Ft,unique:$t,uniqueCount:jt,count:It},Mt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:k("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return ne.sum;if(Object.prototype.toString.call(n)==="[object Date]")return ne.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return Z(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:ne[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.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,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function Vt(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(s=>!o.includes(s.id));return t==="remove"?n:[...o.map(s=>e.find(l=>l.id===s)).filter(Boolean),...n]}const Pt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:k("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=C(t=>[W(o,t)],t=>t.findIndex(n=>n.id===e.id),x(o.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var n;return((n=W(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=W(o,t);return((n=r[r.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=C(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>r=>{let s=[];if(!(o!=null&&o.length))s=r;else{const l=[...o],u=[...r];for(;u.length&&l.length;){const f=l.shift(),d=u.findIndex(g=>g.id===f);d>-1&&s.push(u.splice(d,1)[0])}s=[...s,...u]}return Vt(s,t,n)},x(e.options,"debugTable","_getOrderColumnsFn"))}},oe=()=>({left:[],right:[]}),Nt={getInitialState:e=>({columnPinning:oe(),...e}),getDefaultOptions:e=>({onColumnPinningChange:k("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(r=>r.id).filter(Boolean);o.setColumnPinning(r=>{var s,l;if(t==="right"){var u,f;return{left:((u=r==null?void 0:r.left)!=null?u:[]).filter(p=>!(n!=null&&n.includes(p))),right:[...((f=r==null?void 0:r.right)!=null?f:[]).filter(p=>!(n!=null&&n.includes(p))),...n]}}if(t==="left"){var d,g;return{left:[...((d=r==null?void 0:r.left)!=null?d:[]).filter(p=>!(n!=null&&n.includes(p))),...n],right:((g=r==null?void 0:r.right)!=null?g:[]).filter(p=>!(n!=null&&n.includes(p)))}}return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(p=>!(n!=null&&n.includes(p))),right:((l=r==null?void 0:r.right)!=null?l:[]).filter(p=>!(n!=null&&n.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var r,s,l;return((r=n.columnDef.enablePinning)!=null?r:!0)&&((s=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?s:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(u=>u.id),{left:n,right:r}=o.getState().columnPinning,s=t.some(u=>n==null?void 0:n.includes(u)),l=t.some(u=>r==null?void 0:r.includes(u));return s?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();return r?(t=(n=o.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=C(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,r)=>{const s=[...n??[],...r??[]];return t.filter(l=>!s.includes(l.column.id))},x(o.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=C(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(l=>l.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),x(o.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=C(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(s=>t.find(l=>l.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),x(o.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?oe():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:oe())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var r,s;return!!((r=n.left)!=null&&r.length||(s=n.right)!=null&&s.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=C(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),x(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=C(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),x(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=C(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const r=[...t??[],...n??[]];return o.filter(s=>!r.includes(s.id))},x(e.options,"debugColumns","getCenterLeafColumns"))}};function Dt(e){return e||(typeof document<"u"?document:null)}const Y={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},re=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Et={getDefaultColumnDef:()=>Y,getInitialState:e=>({columnSizing:{},columnSizingInfo:re(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:k("columnSizing",e),onColumnSizingInfoChange:k("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,r;const s=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Y.minSize,(n=s??e.columnDef.size)!=null?n:Y.size),(r=e.columnDef.maxSize)!=null?r:Y.maxSize)},e.getStart=C(t=>[t,W(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((r,s)=>r+s.getSize(),0),x(o.options,"debugColumns","getStart")),e.getAfter=C(t=>[t,W(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((r,s)=>r+s.getSize(),0),x(o.options,"debugColumns","getAfter")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=r=>{if(r.subHeaders.length)r.subHeaders.forEach(n);else{var s;t+=(s=r.column.getSize())!=null?s:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return s=>{if(!n||!r||(s.persist==null||s.persist(),se(s)&&s.touches&&s.touches.length>1))return;const l=e.getSize(),u=e?e.getLeafHeaders().map(S=>[S.column.id,S.column.getSize()]):[[n.id,n.getSize()]],f=se(s)?Math.round(s.touches[0].clientX):s.clientX,d={},g=(S,y)=>{typeof y=="number"&&(o.setColumnSizingInfo(F=>{var D,j;const V=o.options.columnResizeDirection==="rtl"?-1:1,B=(y-((D=F==null?void 0:F.startOffset)!=null?D:0))*V,P=Math.max(B/((j=F==null?void 0:F.startSize)!=null?j:0),-.999999);return F.columnSizingStart.forEach(R=>{let[_,M]=R;d[_]=Math.round(Math.max(M+M*P,0)*100)/100}),{...F,deltaOffset:B,deltaPercentage:P}}),(o.options.columnResizeMode==="onChange"||S==="end")&&o.setColumnSizing(F=>({...F,...d})))},p=S=>g("move",S),c=S=>{g("end",S),o.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},a=Dt(t),m={moveHandler:S=>p(S.clientX),upHandler:S=>{a==null||a.removeEventListener("mousemove",m.moveHandler),a==null||a.removeEventListener("mouseup",m.upHandler),c(S.clientX)}},h={moveHandler:S=>(S.cancelable&&(S.preventDefault(),S.stopPropagation()),p(S.touches[0].clientX),!1),upHandler:S=>{var y;a==null||a.removeEventListener("touchmove",h.moveHandler),a==null||a.removeEventListener("touchend",h.upHandler),S.cancelable&&(S.preventDefault(),S.stopPropagation()),c((y=S.touches[0])==null?void 0:y.clientX)}},v=Lt()?{passive:!1}:!1;se(s)?(a==null||a.addEventListener("touchmove",h.moveHandler,v),a==null||a.addEventListener("touchend",h.upHandler,v)):(a==null||a.addEventListener("mousemove",m.moveHandler,v),a==null||a.addEventListener("mouseup",m.upHandler,v)),o.setColumnSizingInfo(S=>({...S,startOffset:f,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:n.id}))}}},createTable:e=>{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=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?re():(t=e.initialState.columnSizingInfo)!=null?t:re())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,r)=>n+r.getSize(),0))!=null?o:0}}};let J=null;function Lt(){if(typeof J=="boolean")return J;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return J=e,J}function se(e){return e.type==="touchstart"}const kt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:k("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const r=e.columns;return(t=r.length?r.some(s=>s.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=C(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),x(o.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=C(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,r)=>[...t,...n,...r],x(o.options,"debugRows","getVisibleCells"))},createTable:e=>{const o=(t,n)=>C(()=>[n(),n().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),x(e.options,"debugColumns",t));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=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,s)=>({...r,[s.id]:t||!(s.getCanHide!=null&&s.getCanHide())}),{}))},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=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function W(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const At={createTable:e=>{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():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},zt={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:k("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,r,s;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((r=o.options.enableFilters)!=null?r:!0)&&((s=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?s:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>H.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return Z(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:H[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},Ht={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:k("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var r,s;e.setExpanded(n?{}:(r=(s=e.initialState)==null?void 0:s.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(s=>{const l=s.split(".");n=Math.max(n,l.length)}),n},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())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var r;const s=n===!0?!0:!!(n!=null&&n[e.id]);let l={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(u=>{l[u]=!0}):l=n,t=(r=t)!=null?r:!s,!s&&t)return{...l,[e.id]:!0};if(s&&!t){const{[e.id]:u,...f}=l;return f}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,r;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)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},de=0,ce=10,le=()=>({pageIndex:de,pageSize:ce}),Gt={getInitialState:e=>({...e,pagination:{...le(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:k("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,r;if(!o){e._queue(()=>{o=!0});return}if((n=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const r=s=>G(n,s);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=n=>{var r;e.setPagination(n?le():(r=e.initialState.pagination)!=null?r:le())},e.setPageIndex=n=>{e.setPagination(r=>{let s=G(n,r.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return s=Math.max(0,Math.min(s,l)),{...r,pageIndex:s}})},e.resetPageIndex=n=>{var r,s;e.setPageIndex(n?de:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:de)},e.resetPageSize=n=>{var r,s;e.setPageSize(n?ce:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:ce)},e.setPageSize=n=>{e.setPagination(r=>{const s=Math.max(1,G(n,r.pageSize)),l=r.pageSize*r.pageIndex,u=Math.floor(l/s);return{...r,pageIndex:u,pageSize:s}})},e.setPageCount=n=>e.setPagination(r=>{var s;let l=G(n,(s=e.options.pageCount)!=null?s:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...r,pageCount:l}}),e.getPageOptions=C(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null).map((s,l)=>l)),r},x(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:n<r-1},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=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},ie=()=>({top:[],bottom:[]}),Ot={getInitialState:e=>({rowPinning:ie(),...e}),getDefaultOptions:e=>({onRowPinningChange:k("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,r)=>{const s=n?e.getLeafRows().map(f=>{let{id:d}=f;return d}):[],l=r?e.getParentRows().map(f=>{let{id:d}=f;return d}):[],u=new Set([...l,e.id,...s]);o.setRowPinning(f=>{var d,g;if(t==="bottom"){var p,c;return{top:((p=f==null?void 0:f.top)!=null?p:[]).filter(h=>!(u!=null&&u.has(h))),bottom:[...((c=f==null?void 0:f.bottom)!=null?c:[]).filter(h=>!(u!=null&&u.has(h))),...Array.from(u)]}}if(t==="top"){var a,m;return{top:[...((a=f==null?void 0:f.top)!=null?a:[]).filter(h=>!(u!=null&&u.has(h))),...Array.from(u)],bottom:((m=f==null?void 0:f.bottom)!=null?m:[]).filter(h=>!(u!=null&&u.has(h)))}}return{top:((d=f==null?void 0:f.top)!=null?d:[]).filter(h=>!(u!=null&&u.has(h))),bottom:((g=f==null?void 0:f.bottom)!=null?g:[]).filter(h=>!(u!=null&&u.has(h)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:r}=o.options;return typeof n=="function"?n(e):(t=n??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:r}=o.getState().rowPinning,s=t.some(u=>n==null?void 0:n.includes(u)),l=t.some(u=>r==null?void 0:r.includes(u));return s?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const r=e.getIsPinned();if(!r)return-1;const s=(t=r==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(l=>{let{id:u}=l;return u});return(n=s==null?void 0:s.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?ie():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:ie())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var r,s;return!!((r=n.top)!=null&&r.length||(s=n.bottom)!=null&&s.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[]).map(l=>{const u=e.getRow(l,!0);return u.getIsAllParentsExpanded()?u:null}):(t??[]).map(l=>o.find(u=>u.id===l))).filter(Boolean).map(l=>({...l,position:n}))},e.getTopRows=C(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),x(e.options,"debugRows","getTopRows")),e.getBottomRows=C(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),x(e.options,"debugRows","getBottomRows")),e.getCenterRows=C(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const r=new Set([...t??[],...n??[]]);return o.filter(s=>!r.has(s.id))},x(e.options,"debugRows","getCenterRows"))}},bt={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:k("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},r=e.getPreGroupedRowModel().flatRows;return o?r.forEach(s=>{s.getCanSelect()&&(n[s.id]=!0)}):r.forEach(s=>{delete n[s.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(s=>{ge(r,s.id,n,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=C(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?ae(e,t):{rows:[],flatRows:[],rowsById:{}},x(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=C(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?ae(e,t):{rows:[],flatRows:[],rowsById:{}},x(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=C(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?ae(e,t):{rows:[],flatRows:[],rowsById:{}},x(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(r=>r.getCanSelect()&&!t[r.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(r=>!t[r.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const r=e.getIsSelected();o.setRowSelection(s=>{var l;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return s;const u={...s};return ge(u,e.id,t,(l=n==null?void 0:n.selectChildren)!=null?l:!0,o),u})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return xe(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return pe(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return pe(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected((r=n.target)==null?void 0:r.checked)}}}},ge=(e,o,t,n,r)=>{var s;const l=r.getRow(o,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),l.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(s=l.subRows)!=null&&s.length&&l.getCanSelectSubRows()&&l.subRows.forEach(u=>ge(e,u.id,t,n,r))};function ae(e,o){const t=e.getState().rowSelection,n=[],r={},s=function(l,u){return l.map(f=>{var d;const g=xe(f,t);if(g&&(n.push(f),r[f.id]=f),(d=f.subRows)!=null&&d.length&&(f={...f,subRows:s(f.subRows)}),g)return f}).filter(Boolean)};return{rows:s(o.rows),flatRows:n,rowsById:r}}function xe(e,o){var t;return(t=o[e.id])!=null?t:!1}function pe(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let r=!0,s=!1;return e.subRows.forEach(l=>{if(!(s&&!r)&&(l.getCanSelect()&&(xe(l,o)?s=!0:r=!1),l.subRows&&l.subRows.length)){const u=pe(l,o);u==="all"?s=!0:(u==="some"&&(s=!0),r=!1)}}),r?"all":s?"some":!1}const me=/([0-9]+)/gm,Bt=(e,o,t)=>He(O(e.getValue(t)).toLowerCase(),O(o.getValue(t)).toLowerCase()),Tt=(e,o,t)=>He(O(e.getValue(t)),O(o.getValue(t))),qt=(e,o,t)=>Se(O(e.getValue(t)).toLowerCase(),O(o.getValue(t)).toLowerCase()),Ut=(e,o,t)=>Se(O(e.getValue(t)),O(o.getValue(t))),Kt=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:n<r?-1:0},Xt=(e,o,t)=>Se(e.getValue(t),o.getValue(t));function Se(e,o){return e===o?0:e>o?1:-1}function O(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function He(e,o){const t=e.split(me).filter(Boolean),n=o.split(me).filter(Boolean);for(;t.length&&n.length;){const r=t.shift(),s=n.shift(),l=parseInt(r,10),u=parseInt(s,10),f=[l,u].sort();if(isNaN(f[0])){if(r>s)return 1;if(s>r)return-1;continue}if(isNaN(f[1]))return isNaN(l)?-1:1;if(l>u)return 1;if(u>l)return-1}return t.length-n.length}const X={alphanumeric:Bt,alphanumericCaseSensitive:Tt,text:qt,textCaseSensitive:Ut,datetime:Kt,basic:Xt},Wt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:k("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const r of t){const s=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(s)==="[object Date]")return X.datetime;if(typeof s=="string"&&(n=!0,s.split(me).length>1))return X.alphanumeric}return n?X.text:X.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return Z(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:X[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const r=e.getNextSortingOrder(),s=typeof t<"u"&&t!==null;o.setSorting(l=>{const u=l==null?void 0:l.find(a=>a.id===e.id),f=l==null?void 0:l.findIndex(a=>a.id===e.id);let d=[],g,p=s?t:r==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?u?g="toggle":g="add":l!=null&&l.length&&f!==l.length-1?g="replace":u?g="toggle":g="replace",g==="toggle"&&(s||r||(g="remove")),g==="add"){var c;d=[...l,{id:e.id,desc:p}],d.splice(0,d.length-((c=o.options.maxMultiSortColCount)!=null?c:Number.MAX_SAFE_INTEGER))}else g==="toggle"?d=l.map(a=>a.id===e.id?{...a,desc:p}:a):g==="remove"?d=l.filter(a=>a.id!==e.id):d=[{id:e.id,desc:p}];return d})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,r;const s=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==s&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(r=o.options.enableMultiRemove)!=null)||r)?!1:l==="desc"?"asc":"desc":s},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{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))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},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())}},Qt=[vt,kt,Pt,Nt,wt,Ct,At,zt,Wt,Mt,Ht,Gt,Ot,bt,Et];function Yt(e){var o,t;process.env.NODE_ENV!=="production"&&(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");const n=[...Qt,...(o=e._features)!=null?o:[]];let r={_features:n};const s=r._features.reduce((c,a)=>Object.assign(c,a.getDefaultOptions==null?void 0:a.getDefaultOptions(r)),{}),l=c=>r.options.mergeOptions?r.options.mergeOptions(s,c):{...s,...c};let f={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(c=>{var a;f=(a=c.getInitialState==null?void 0:c.getInitialState(f))!=null?a:f});const d=[];let g=!1;const p={_features:n,options:{...s,...e},initialState:f,_queue:c=>{d.push(c),g||(g=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();g=!1}).catch(a=>setTimeout(()=>{throw a})))},reset:()=>{r.setState(r.initialState)},setOptions:c=>{const a=G(c,r.options);r.options=l(a)},getState:()=>r.options.state,setState:c=>{r.options.onStateChange==null||r.options.onStateChange(c)},_getRowId:(c,a,m)=>{var h;return(h=r.options.getRowId==null?void 0:r.options.getRowId(c,a,m))!=null?h:`${m?[m.id,a].join("."):a}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(c,a)=>{let m=(a?r.getPrePaginationRowModel():r.getRowModel()).rowsById[c];if(!m&&(m=r.getCoreRowModel().rowsById[c],!m))throw process.env.NODE_ENV!=="production"?new Error(`getRow could not find row with ID: ${c}`):new Error;return m},_getDefaultColumnDef:C(()=>[r.options.defaultColumn],c=>{var a;return c=(a=c)!=null?a:{},{header:m=>{const h=m.header.column.columnDef;return h.accessorKey?h.accessorKey:h.accessorFn?h.id:null},cell:m=>{var h,v;return(h=(v=m.renderValue())==null||v.toString==null?void 0:v.toString())!=null?h:null},...r._features.reduce((m,h)=>Object.assign(m,h.getDefaultColumnDef==null?void 0:h.getDefaultColumnDef()),{}),...c}},x(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>r.options.columns,getAllColumns:C(()=>[r._getColumnDefs()],c=>{const a=function(m,h,v){return v===void 0&&(v=0),m.map(S=>{const y=ht(r,S,v,h),F=S;return y.columns=F.columns?a(F.columns,y,v+1):[],y})};return a(c)},x(e,"debugColumns","getAllColumns")),getAllFlatColumns:C(()=>[r.getAllColumns()],c=>c.flatMap(a=>a.getFlatColumns()),x(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:C(()=>[r.getAllFlatColumns()],c=>c.reduce((a,m)=>(a[m.id]=m,a),{}),x(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:C(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(c,a)=>{let m=c.flatMap(h=>h.getLeafColumns());return a(m)},x(e,"debugColumns","getAllLeafColumns")),getColumn:c=>{const a=r._getAllFlatColumnsById()[c];return process.env.NODE_ENV!=="production"&&!a&&console.error(`[Table] Column with id '${c}' does not exist.`),a}};Object.assign(r,p);for(let c=0;c<r._features.length;c++){const a=r._features[c];a==null||a.createTable==null||a.createTable(r)}return r}function Jt(){return e=>C(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,s,l){s===void 0&&(s=0);const u=[];for(let d=0;d<r.length;d++){const g=we(e,e._getRowId(r[d],d,l),r[d],d,s,void 0,l==null?void 0:l.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,u.push(g),e.options.getSubRows){var f;g.originalSubRows=e.options.getSubRows(r[d],d),(f=g.originalSubRows)!=null&&f.length&&(g.subRows=n(g.originalSubRows,s+1,g))}}return u};return t.rows=n(o),t},x(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Zt(e){const o=[],t=n=>{var r;o.push(n),(r=n.subRows)!=null&&r.length&&n.getIsExpanded()&&n.subRows.forEach(t)};return e.rows.forEach(t),{rows:o,flatRows:e.flatRows,rowsById:e.rowsById}}function en(e,o,t){return t.options.filterFromLeafRows?tn(e,o,t):nn(e,o,t)}function tn(e,o,t){var n;const r=[],s={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,u=function(f,d){d===void 0&&(d=0);const g=[];for(let c=0;c<f.length;c++){var p;let a=f[c];const m=we(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);if(m.columnFilters=a.columnFilters,(p=a.subRows)!=null&&p.length&&d<l){if(m.subRows=u(a.subRows,d+1),a=m,o(a)&&!m.subRows.length){g.push(a),s[a.id]=a,r.push(a);continue}if(o(a)||m.subRows.length){g.push(a),s[a.id]=a,r.push(a);continue}}else a=m,o(a)&&(g.push(a),s[a.id]=a,r.push(a))}return g};return{rows:u(e),flatRows:r,rowsById:s}}function nn(e,o,t){var n;const r=[],s={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,u=function(f,d){d===void 0&&(d=0);const g=[];for(let c=0;c<f.length;c++){let a=f[c];if(o(a)){var p;if((p=a.subRows)!=null&&p.length&&d<l){const h=we(t,a.id,a.original,a.index,a.depth,void 0,a.parentId);h.subRows=u(a.subRows,d+1),a=h}g.push(a),r.push(a),s[a.id]=a}}return g};return{rows:u(e),flatRows:r,rowsById:s}}function on(){return e=>C(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let c=0;c<o.flatRows.length;c++)o.flatRows[c].columnFilters={},o.flatRows[c].columnFiltersMeta={};return o}const r=[],s=[];(t??[]).forEach(c=>{var a;const m=e.getColumn(c.id);if(!m)return;const h=m.getFilterFn();if(!h){process.env.NODE_ENV!=="production"&&console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${m.id}.`);return}r.push({id:c.id,filterFn:h,resolvedValue:(a=h.resolveFilterValue==null?void 0:h.resolveFilterValue(c.value))!=null?a:c.value})});const l=(t??[]).map(c=>c.id),u=e.getGlobalFilterFn(),f=e.getAllLeafColumns().filter(c=>c.getCanGlobalFilter());n&&u&&f.length&&(l.push("__global__"),f.forEach(c=>{var a;s.push({id:c.id,filterFn:u,resolvedValue:(a=u.resolveFilterValue==null?void 0:u.resolveFilterValue(n))!=null?a:n})}));let d,g;for(let c=0;c<o.flatRows.length;c++){const a=o.flatRows[c];if(a.columnFilters={},r.length)for(let m=0;m<r.length;m++){d=r[m];const h=d.id;a.columnFilters[h]=d.filterFn(a,h,d.resolvedValue,v=>{a.columnFiltersMeta[h]=v})}if(s.length){for(let m=0;m<s.length;m++){g=s[m];const h=g.id;if(g.filterFn(a,h,g.resolvedValue,v=>{a.columnFiltersMeta[h]=v})){a.columnFilters.__global__=!0;break}}a.columnFilters.__global__!==!0&&(a.columnFilters.__global__=!1)}}const p=c=>{for(let a=0;a<l.length;a++)if(c.columnFilters[l[a]]===!1)return!1;return!0};return en(o.rows,p,e)},x(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function rn(e){return o=>C(()=>[o.getState().pagination,o.getPrePaginationRowModel(),o.options.paginateExpandedRows?void 0:o.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:s}=t;let{rows:l,flatRows:u,rowsById:f}=n;const d=r*s,g=d+r;l=l.slice(d,g);let p;o.options.paginateExpandedRows?p={rows:l,flatRows:u,rowsById:f}:p=Zt({rows:l,flatRows:u,rowsById:f}),p.flatRows=[];const c=a=>{p.flatRows.push(a),a.subRows.length&&a.subRows.forEach(c)};return p.rows.forEach(c),p},x(o.options,"debugTable","getPaginationRowModel"))}function sn(){return e=>C(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,r=[],s=n.filter(f=>{var d;return(d=e.getColumn(f.id))==null?void 0:d.getCanSort()}),l={};s.forEach(f=>{const d=e.getColumn(f.id);d&&(l[f.id]={sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortingFn:d.getSortingFn()})});const u=f=>{const d=f.map(g=>({...g}));return d.sort((g,p)=>{for(let a=0;a<s.length;a+=1){var c;const m=s[a],h=l[m.id],v=h.sortUndefined,S=(c=m==null?void 0:m.desc)!=null?c:!1;let y=0;if(v){const F=g.getValue(m.id),D=p.getValue(m.id),j=F===void 0,V=D===void 0;if(j||V){if(v==="first")return j?-1:1;if(v==="last")return j?1:-1;y=j&&V?0:j?v:-v}}if(y===0&&(y=h.sortingFn(g,p,m.id)),y!==0)return S&&(y*=-1),h.invertSorting&&(y*=-1),y}return g.index-p.index}),d.forEach(g=>{var p;r.push(g),(p=g.subRows)!=null&&p.length&&(g.subRows=u(g.subRows))}),d};return{rows:u(t.rows),flatRows:r,rowsById:t.rowsById}},x(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
64
|
-
* react-table
|
|
65
|
-
*
|
|
66
|
-
* Copyright (c) TanStack
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the MIT license found in the
|
|
69
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
70
|
-
*
|
|
71
|
-
* @license MIT
|
|
72
|
-
*/function Ie(e,o){return e?ln(e)?fe.createElement(e,o):e:null}function ln(e){return an(e)||typeof e=="function"||un(e)}function an(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function un(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function fn(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=fe.useState(()=>({current:Yt(o)})),[n,r]=fe.useState(()=>t.current.initialState);return t.current.setOptions(s=>({...s,...e,state:{...n,...e.state},onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}const he=({editable:e=!0,pageSize:o=25,onCellEdit:t})=>{const{rows:n,schema:r,mappings:s,errorsByRow:l,editingCell:u,startEditing:f,stopEditing:d,updateCell:g}=b(),[p,c]=E.useState([]),[a,m]=E.useState(""),[h,v]=E.useState(""),S=E.useMemo(()=>s.filter(R=>R.targetKey!==null).map(R=>{const _=r==null?void 0:r.columns.find(M=>M.key===R.targetKey);return{sourceColumn:R.sourceColumn,targetKey:R.targetKey,label:(_==null?void 0:_.label)||R.targetKey,type:(_==null?void 0:_.type)||"string"}}),[s,r]),y=E.useCallback((R,_)=>{const M=l.get(R);return M==null?void 0:M.find(T=>T.columnKey===_)},[l]),F=(R,_,M)=>{v(M),f(R,_)},D=()=>{u&&(g(u.rowIndex,u.columnKey,h),t==null||t(u.rowIndex,u.columnKey,h)),d()},j=()=>{v(""),d()},V=ct(),B=E.useMemo(()=>[V.accessor("rowIndex",{header:"#",size:60,cell:R=>i.jsx("span",{className:"ff-font-mono ff-text-xs",style:{color:"var(--ff-text-muted)"},children:R.getValue()+1})}),...S.map(R=>V.accessor(_=>_.data[R.targetKey]||_.data[R.sourceColumn],{id:R.targetKey,header:R.label,cell:_=>{const M=_.row.original.rowIndex,T=String(_.getValue()??""),L=y(M,R.targetKey);return(u==null?void 0:u.rowIndex)===M&&(u==null?void 0:u.columnKey)===R.targetKey?i.jsxs("div",{className:"ff-flex ff-items-center ff-gap-1",children:[i.jsx("input",{type:"text",value:h,onChange:q=>v(q.target.value),onKeyDown:q=>{q.key==="Enter"&&D(),q.key==="Escape"&&j()},className:"ff-input ff-py-1 ff-text-sm",autoFocus:!0}),i.jsx("button",{onClick:D,className:"ff-btn ff-btn-primary ff-btn-sm",children:"Save"}),i.jsx("button",{onClick:j,className:"ff-btn ff-btn-secondary ff-btn-sm",children:"Cancel"})]}):i.jsxs("div",{className:w.clsx("ff-group ff-flex ff-items-center ff-gap-2",(L==null?void 0:L.severity)==="error"&&"ff-cell-error",(L==null?void 0:L.severity)==="warning"&&"ff-cell-warning"),children:[i.jsx("span",{className:"ff-flex-1 ff-truncate",children:T||i.jsx("span",{style:{color:"var(--ff-text-muted)"},children:"—"})}),L&&i.jsxs("div",{className:"ff-relative ff-group/tooltip",children:[L.severity==="error"?i.jsx(w.CircleAlert,{className:"ff-w-4 ff-h-4",style:{color:"var(--ff-error)"}}):i.jsx(w.TriangleAlert,{className:"ff-w-4 ff-h-4",style:{color:"var(--ff-warning)"}}),i.jsxs("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:[L.message,L.suggestion&&i.jsx("span",{className:"ff-block ff-mt-1",style:{color:"var(--ff-text-muted)"},children:L.suggestion})]})]}),e&&!L&&i.jsx("button",{onClick:()=>F(M,R.targetKey,T),className:"ff-opacity-0 group-hover:ff-opacity-100 ff-p-1 ff-rounded ff-transition-opacity ff-edit-btn",children:i.jsx(ut,{className:"ff-w-3 ff-h-3"})})]})}}))],[S,u,h,e,y,V]),P=fn({data:n,columns:B,state:{sorting:p,globalFilter:a},onSortingChange:c,onGlobalFilterChange:m,getCoreRowModel:Jt(),getPaginationRowModel:rn(),getSortedRowModel:sn(),getFilteredRowModel:on(),initialState:{pagination:{pageSize:o}}});return i.jsxs("div",{className:"ff-space-y-4",children:[i.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between",children:[i.jsx("input",{type:"text",value:a,onChange:R=>m(R.target.value),placeholder:"Search all columns...",className:"ff-input ff-max-w-xs"}),i.jsxs("div",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:[P.getFilteredRowModel().rows.length," rows"]})]}),i.jsx("div",{className:"ff-table-container ff-max-h-[500px]",children:i.jsxs("table",{className:"ff-table",children:[i.jsx("thead",{children:P.getHeaderGroups().map(R=>i.jsx("tr",{children:R.headers.map(_=>i.jsx("th",{style:{width:_.getSize()},onClick:_.column.getToggleSortingHandler(),className:w.clsx(_.column.getCanSort()&&"ff-cursor-pointer ff-select-none"),children:i.jsxs("div",{className:"ff-flex ff-items-center ff-gap-1",children:[Ie(_.column.columnDef.header,_.getContext()),_.column.getIsSorted()&&i.jsx("span",{children:_.column.getIsSorted()==="asc"?"↑":"↓"})]})},_.id))},R.id))}),i.jsx("tbody",{children:P.getRowModel().rows.map(R=>{const _=l.has(R.original.rowIndex);return i.jsx("tr",{className:w.clsx(_&&"ff-row-error"),children:R.getVisibleCells().map(M=>i.jsx("td",{children:Ie(M.column.columnDef.cell,M.getContext())},M.id))},R.id)})})]})}),i.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-2",children:[i.jsxs("div",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:["Page ",P.getState().pagination.pageIndex+1," of ",P.getPageCount()]}),i.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2",children:[i.jsxs("button",{onClick:()=>P.previousPage(),disabled:!P.getCanPreviousPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:[i.jsx(Ye,{className:"ff-w-4 ff-h-4"}),"Previous"]}),i.jsxs("button",{onClick:()=>P.nextPage(),disabled:!P.getCanNextPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:["Next",i.jsx(w.ChevronRight,{className:"ff-w-4 ff-h-4"})]})]})]})]})},ve=({showDetails:e=!0})=>{const{validationResults:o}=b();if(!o)return null;const{isValid:t,totalRows:n,validRows:r,errorCount:s,warningCount:l,infoCount:u,summary:f}=o,d=Math.round(r/n*100);return i.jsxs("div",{className:"ff-space-y-4",children:[i.jsxs("div",{className:"ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-lg ff-border",style:{backgroundColor:t?"var(--ff-success-light)":"var(--ff-error-light)",borderColor:t?"var(--ff-success)":"var(--ff-error)"},children:[t?i.jsx(w.CircleCheckBig,{className:"ff-w-8 ff-h-8",style:{color:"var(--ff-success)"}}):i.jsx(w.CircleX,{className:"ff-w-8 ff-h-8",style:{color:"var(--ff-error)"}}),i.jsxs("div",{children:[i.jsx("h3",{className:"ff-text-lg ff-font-semibold",style:{color:t?"var(--ff-success-dark)":"var(--ff-error-dark)"},children:t?"Validation Passed":"Validation Failed"}),i.jsxs("p",{className:"ff-text-sm",style:{color:t?"var(--ff-success)":"var(--ff-error)"},children:[r," of ",n," rows are valid (",d,"%)"]})]})]}),i.jsxs("div",{className:"ff-grid ff-grid-cols-4 ff-gap-4",children:[i.jsxs("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:[i.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-text-primary)"},children:n}),i.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:"Total Rows"})]}),i.jsxs("div",{className:"ff-border ff-rounded-lg ff-p-4 ff-text-center",style:{backgroundColor:"var(--ff-success-light)",borderColor:"var(--ff-success)"},children:[i.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-success-dark)"},children:r}),i.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:"Valid Rows"})]}),i.jsxs("div",{className:"ff-border ff-rounded-lg ff-p-4 ff-text-center",style:{backgroundColor:"var(--ff-error-light)",borderColor:"var(--ff-error)"},children:[i.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-error-dark)"},children:s}),i.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-error)"},children:"Errors"})]}),i.jsxs("div",{className:"ff-border ff-rounded-lg ff-p-4 ff-text-center",style:{backgroundColor:"var(--ff-warning-light)",borderColor:"var(--ff-warning)"},children:[i.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-warning-dark)"},children:l}),i.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-warning)"},children:"Warnings"})]})]}),e&&f.byColumn&&Object.keys(f.byColumn).length>0&&i.jsxs("div",{className:"ff-border ff-rounded-lg ff-overflow-hidden",style:{backgroundColor:"var(--ff-bg-primary)",borderColor:"var(--ff-border-light)"},children:[i.jsx("div",{className:"ff-px-4 ff-py-3 ff-border-b",style:{backgroundColor:"var(--ff-bg-secondary)",borderColor:"var(--ff-border-light)"},children:i.jsx("h4",{className:"ff-font-medium",style:{color:"var(--ff-text-secondary)"},children:"Issues by Column"})}),i.jsx("div",{className:"ff-divide-y",style:{borderColor:"var(--ff-border-light)"},children:Object.entries(f.byColumn).filter(([,g])=>g.errorCount>0||g.warningCount>0).map(([g,p])=>i.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-4 ff-py-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"ff-font-medium",style:{color:"var(--ff-text-primary)"},children:p.columnKey}),p.mostCommonError&&i.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:p.mostCommonError})]}),i.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[p.errorCount>0&&i.jsxs("span",{className:"ff-badge ff-badge-error",children:[i.jsx(w.CircleX,{className:"ff-w-3 ff-h-3 ff-mr-1"}),p.errorCount," errors"]}),p.warningCount>0&&i.jsxs("span",{className:"ff-badge ff-badge-warning",children:[i.jsx(w.TriangleAlert,{className:"ff-w-3 ff-h-3 ff-mr-1"}),p.warningCount," warnings"]})]})]},g))})]}),e&&f.duplicates&&f.duplicates.length>0&&i.jsx("div",{className:"ff-border ff-rounded-lg ff-p-4",style:{backgroundColor:"var(--ff-warning-light)",borderColor:"var(--ff-warning)"},children:i.jsxs("div",{className:"ff-flex ff-items-start ff-gap-3",children:[i.jsx(w.TriangleAlert,{className:"ff-w-5 ff-h-5 ff-flex-shrink-0 ff-mt-0.5",style:{color:"var(--ff-warning)"}}),i.jsxs("div",{children:[i.jsx("h4",{className:"ff-font-medium",style:{color:"var(--ff-warning-dark)"},children:"Duplicate Values Found"}),i.jsxs("ul",{className:"ff-mt-2 ff-space-y-1 ff-text-sm",style:{color:"var(--ff-warning-dark)"},children:[f.duplicates.slice(0,5).map((g,p)=>i.jsxs("li",{children:[i.jsx("span",{className:"ff-font-mono",children:g.columnKey}),': "',String(g.value),'" appears'," ",g.rowIndices.length," times (rows"," ",g.rowIndices.slice(0,3).map(c=>c+1).join(", "),g.rowIndices.length>3?"...":"",")"]},p)),f.duplicates.length>5&&i.jsxs("li",{style:{color:"var(--ff-warning)"},children:["... and ",f.duplicates.length-5," more duplicate groups"]})]})]})]})})]})},ue=["upload","mapping","validation","complete"],dn=[{key:"upload",label:"Upload",icon:w.Upload},{key:"mapping",label:"Map Columns",icon:it},{key:"validation",label:"Validate",icon:dt},{key:"review",label:"Review",icon:tt},{key:"complete",label:"Complete",icon:w.CircleCheckBig}],cn=({template:e,schema:o,onComplete:t,onCancel:n,onError:r})=>{const{step:s,sessionId:l,file:u,mappings:f,validationResults:d,isLoading:g,error:p,setSchema:c,setSessionId:a,setParsedData:m,setMappings:h,setUnmapped:v,setValidationResults:S,setStep:y,nextStep:F,previousStep:D,setLoading:j,setError:V,reset:B}=b(),[P,R]=E.useState(null),[_,M]=E.useState(null);E.useEffect(()=>{if(M(null),e)if(w.templateExists(e)){const $=w.getTemplateSchema(e);$?R($):(M(`Failed to load template "${e}"`),r==null||r(new Error(`Failed to load template "${e}"`)))}else{const $=`Template "${e}" not found. Available templates: ${w.VALID_TEMPLATE_IDS.join(", ")}`;M($),r==null||r(new Error($))}else if(o)R(o);else{const $=`No template or schema provided. Please specify a template (${w.VALID_TEMPLATE_IDS.join(", ")}) or provide a custom schema.`;M($),r==null||r(new Error($))}},[e,o,r]),E.useEffect(()=>{P&&(c(P),T(P))},[P]);const T=async $=>{try{j(!0);const z=await w.getClient().createImportSession($);a(z.sessionId)}catch(I){const z=I;V(z.message),r==null||r(z)}finally{j(!1)}},L=E.useCallback(async $=>{if(l)try{j(!0),V(null);const z=await w.getClient().uploadFile(l,$),_e=(U,Te)=>({rowIndex:U.rowIndex??Te,data:U.data??U,rawData:U.rawData??Object.values(U.data??U)});m({headers:z.data.headers,rows:z.data.sampleRows.map(_e),totalRows:z.data.totalRows,sampleRows:z.data.sampleRows.map(_e)}),F(),await Re()}catch(I){V(`Failed to process the uploaded file: ${I.message}`)}finally{j(!1)}},[l]),Re=async()=>{if(l)try{j(!0);const I=await w.getClient().matchColumns(l);h(I.mappings),v(I.unmappedSource,I.unmappedTarget)}catch($){V(`Column matching failed: ${$.message}`)}finally{j(!1)}},q=async()=>{if(l)try{j(!0),V(null);const I=await w.getClient().validateImport(l);S(I.validation),F()}catch($){V(`Validation failed: ${$.message}`)}finally{j(!1)}},[ye,ee]=E.useState(null),Ge=async()=>{if(l)try{j(!0),V(null),ee(null);const I=await w.getClient().completeImport(l,{skipInvalidRows:!0,acknowledgeWarnings:!0});y("complete"),t==null||t(I)}catch($){ee($.message),y("complete")}finally{j(!1)}},te=()=>{B(),n==null||n()},Oe=()=>dn.findIndex($=>$.key===s),be=()=>{switch(s){case"upload":return u!==null;case"mapping":return f.length>0&&f.some($=>$.targetKey!==null);case"validation":return d!==null;case"review":return d!==null&&(d.isValid||d.errorCount===0);default:return!1}},Be=async()=>{switch(s){case"mapping":await q();break;case"validation":F();break;case"review":await Ge();break;default:F()}};if(_)return i.jsx(w.StyleProvider,{children:i.jsx("div",{className:"ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6",children:i.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:[i.jsx("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:i.jsx(w.X,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-error)"}})}),i.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Configuration Error"}),i.jsx("p",{className:"ff-text-center ff-max-w-md ff-mb-4",style:{color:"var(--ff-text-muted)"},children:_}),n&&i.jsx("button",{onClick:te,className:"ff-btn ff-btn-secondary",children:"Close"})]})})});if(!P)return i.jsx(w.StyleProvider,{children:i.jsx("div",{className:"ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6",children:i.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:[i.jsx(w.LoaderCircle,{className:"ff-w-10 ff-h-10 ff-animate-spin ff-mb-4",style:{color:"var(--ff-primary-90)"}}),i.jsx("p",{style:{color:"var(--ff-text-muted)"},children:"Loading template..."})]})})});const K=()=>{const $=s==="review"?"validation":s;return ue.indexOf($)};return i.jsx(w.StyleProvider,{children:i.jsxs("div",{className:"ff-container ff-modal",children:[i.jsxs("div",{className:"ff-modal-header",children:[i.jsxs("div",{className:"ff-modal-header-left",children:[i.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[i.jsx("div",{className:"ff-modal-icon",children:i.jsx(ot,{})}),i.jsx("h2",{className:"ff-modal-title",children:"Import Data"})]}),i.jsx("div",{className:"ff-steps ff-ml-4",children:ue.map(($,I)=>i.jsxs(E.Fragment,{children:[i.jsx("div",{className:w.clsx("ff-step",K()===I&&"ff-step-active",K()>I&&"ff-step-complete",K()<I&&"ff-step-pending"),children:K()>I?"✓":I+1}),I<ue.length-1&&i.jsx("div",{className:w.clsx("ff-step-connector",K()>I&&"ff-step-connector-complete")})]},$))})]}),i.jsx("button",{onClick:te,className:"ff-modal-close",children:i.jsx(w.X,{className:"ff-w-5 ff-h-5"})})]}),i.jsxs("div",{className:"ff-modal-body",children:[p&&i.jsx("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:p}),s==="upload"&&i.jsx("div",{className:"ff-py-4",children:i.jsx("div",{className:"ff-max-w-xl ff-mx-auto",children:i.jsx(Me,{onFileSelect:L})})}),s==="mapping"&&i.jsx(Ve,{}),s==="validation"&&i.jsxs("div",{className:"ff-space-y-6",children:[i.jsx(ve,{}),i.jsx(he,{editable:!0})]}),s==="review"&&i.jsxs("div",{className:"ff-space-y-6",children:[i.jsx(ve,{showDetails:!1}),i.jsx(he,{editable:!1,pageSize:10})]}),s==="complete"&&i.jsx("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12",children:ye?i.jsxs(i.Fragment,{children:[i.jsx("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:i.jsx(w.X,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-error)"}})}),i.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Import Failed"}),i.jsx("p",{className:"ff-text-center ff-max-w-md ff-mb-4",style:{color:"var(--ff-text-muted)"},children:ye}),i.jsxs("div",{className:"ff-flex ff-gap-3",children:[i.jsx("button",{onClick:()=>{ee(null),y("review")},className:"ff-btn ff-btn-secondary",children:"Back to Review"}),n&&i.jsx("button",{onClick:te,className:"ff-btn ff-btn-secondary",children:"Close"})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("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:i.jsx(w.CircleCheckBig,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-success)"}})}),i.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Import Complete!"}),i.jsx("p",{style:{color:"var(--ff-text-muted)"},children:"Your data has been successfully imported."})]})})]}),s!=="complete"&&i.jsxs("div",{className:"ff-modal-footer",children:[i.jsx("button",{onClick:D,disabled:Oe()===0||g,className:"ff-btn ff-btn-secondary",children:"Back"}),i.jsx("button",{onClick:Be,disabled:!be()||g,className:"ff-btn ff-btn-primary",children:g?i.jsxs(i.Fragment,{children:[i.jsx(w.LoaderCircle,{className:"ff-w-4 ff-h-4 ff-animate-spin"}),"Processing..."]}):s==="review"?"Complete Import":"Continue"})]})]})})};exports.ColumnMapper=Ve;exports.DataTable=he;exports.FileUploader=Me;exports.ImportWizard=cn;exports.ValidationSummary=ve;exports.useImportStore=b;
|
|
73
|
-
//# sourceMappingURL=ImportWizard-BAmeOWXl.js.map
|