@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),L=require("react"),w=require("./index-j-Z3dkyz.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 de=Qe(L);/**
|
|
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 Ye=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Je=w.createLucideIcon("arrow-right",Ye);/**
|
|
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 Ze=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],et=w.createLucideIcon("check",Ze);/**
|
|
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 tt=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],nt=w.createLucideIcon("chevron-left",tt);/**
|
|
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 ot=[["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"}]],rt=w.createLucideIcon("circle-question-mark",ot);/**
|
|
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 st=[["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"}]],lt=w.createLucideIcon("eye",st);/**
|
|
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 it=[["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"}]],at=w.createLucideIcon("file-spreadsheet",it);/**
|
|
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 ut=[["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"}]],ft=w.createLucideIcon("file",ut);/**
|
|
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 dt=[["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"}]],ct=w.createLucideIcon("git-branch",dt);/**
|
|
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 gt=[["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"}]],pt=w.createLucideIcon("pen",gt);/**
|
|
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 mt=[["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"}]],ht=w.createLucideIcon("square-check-big",mt),je={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)=>({...je,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(i=>i.sourceColumn===t?{...i,targetKey:n,isAutoMapped:!1}:i)})),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 i=[...s.rows],a=i.find(d=>d.rowIndex===t);a&&(a.data={...a.data,[n]:String(r)});const f=new Set(s.editedRows);return f.add(t),{rows:i,editedRows:f,editingCell:null}}),setStatus:t=>e({status:t}),setLoading:t=>e({isLoading:t}),setError:t=>e({error:t}),reset:()=>e(je)})),Ve=({onFileSelect:e,maxSize:o=50*1024*1024,acceptedTypes:t=[".csv",".xlsx",".xls"]})=>{const{file:n,fileName:r,fileSize:s,setFile:i,error:a,setError:f,isLoading:d}=B(),p=L.useCallback((v,S)=>{if(S.length>0){f("Invalid file type or file too large");return}if(v.length>0){const y=v[0];i(y),e==null||e(y)}},[e,i,f]),{getRootProps:g,getInputProps:c,isDragActive:u}=w.useDropzone({onDrop:p,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?l.jsx("div",{className:"ff-p-4 ff-rounded-xl ff-border",style:{backgroundColor:"var(--ff-success-light)",borderColor:"var(--ff-success)"},children:l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[l.jsx("div",{className:"ff-p-2 ff-rounded-lg",style:{backgroundColor:"rgba(41, 142, 51, 0.15)"},children:l.jsx(ft,{className:"ff-w-6 ff-h-6",style:{color:"var(--ff-success)"}})}),l.jsxs("div",{className:"ff-flex-1 ff-min-w-0",children:[l.jsx("p",{className:"ff-font-medium ff-truncate",style:{color:"var(--ff-success-dark)"},children:r}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:m(s||0)})]}),l.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:l.jsx(w.X,{className:"ff-w-5 ff-h-5"})})]})}):l.jsxs("div",{className:"ff-space-y-6",children:[l.jsxs("div",{...g(),className:w.clsx("ff-dropzone",u&&"ff-dropzone-active",d&&"ff-opacity-50 ff-cursor-not-allowed"),children:[l.jsx("input",{...c()}),l.jsx("div",{className:"ff-dropzone-icon-wrapper",children:l.jsx(w.Upload,{className:"ff-dropzone-icon"})}),l.jsx("h3",{className:"ff-dropzone-text",children:u?"Drop your file here":"Upload your file"}),l.jsx("p",{className:"ff-dropzone-hint",children:"Drag and drop or click to select"}),l.jsx("label",{className:"ff-inline-block",children:l.jsx("span",{className:w.clsx("ff-btn ff-btn-primary",d&&"ff-opacity-50 ff-cursor-wait"),children:d?"Processing...":"Choose file"})}),l.jsxs("p",{className:"ff-dropzone-formats",children:["Supports ",t.join(", ")," up to ",m(o)]})]}),a&&l.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:[l.jsx(w.CircleAlert,{className:"ff-w-4 ff-h-4 ff-flex-shrink-0"}),l.jsx("p",{children:a})]})]})},Pe=({onMappingChange:e})=>{const{mappings:o,schema:t,unmappedSource:n,updateMapping:r}=B(),s=(t==null?void 0:t.columns)||[],i=(g,c)=>{const u=c===""?null:c;r(g,u),e==null||e(g,u)},a=g=>g>=.85?"var(--ff-success)":g>=.6?"var(--ff-warning)":"var(--ff-error)",f=g=>g>=.85?"High":g>=.6?"Medium":"Low",p=new Set(o.filter(g=>g.targetKey!==null).map(g=>g.targetKey));return l.jsxs("div",{className:"ff-space-y-4",children:[l.jsxs("div",{className:"ff-mapping-header",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"ff-mapping-title",children:"Column Mapping"}),l.jsx("p",{className:"ff-mapping-subtitle",children:"Match your file columns to the expected fields"})]}),l.jsxs("div",{className:"ff-mapping-legend",children:[l.jsxs("span",{className:"ff-mapping-legend-item",children:[l.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-success)"}}),l.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Mapped"})]}),l.jsxs("span",{className:"ff-mapping-legend-item",children:[l.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-warning)"}}),l.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Review"})]}),l.jsxs("span",{className:"ff-mapping-legend-item",children:[l.jsx("span",{className:"ff-mapping-legend-dot",style:{backgroundColor:"var(--ff-gray-70)"}}),l.jsx("span",{style:{color:"var(--ff-text-secondary)"},children:"Unmapped"})]})]})]}),l.jsx("div",{className:"ff-space-y-2",children:o.map(g=>{s.find(m=>m.key===g.targetKey);const c=g.targetKey!==null,u=g.confidence>=.85;return l.jsxs("div",{className:w.clsx("ff-mapping-row",c&&u&&"ff-mapping-row-success",c&&!u&&"ff-mapping-row-warning"),children:[l.jsx("div",{className:"ff-flex-1",children:l.jsx("div",{className:"ff-mapping-source",children:g.sourceColumn})}),l.jsx("div",{className:"ff-mapping-arrow",children:l.jsx(Je,{className:"ff-w-5 ff-h-5"})}),l.jsx("div",{className:"ff-flex-1 ff-mapping-target",children:l.jsxs("select",{value:g.targetKey||"",onChange:m=>i(g.sourceColumn,m.target.value),className:"ff-input",children:[l.jsx("option",{value:"",children:"-- Do not import --"}),s.map(m=>l.jsxs("option",{value:m.key,disabled:p.has(m.key)&&g.targetKey!==m.key,children:[m.label," (",m.type,")",m.required?" *":""]},m.key))]})}),l.jsx("div",{className:"ff-mapping-status",children:c?u?l.jsx(et,{className:"ff-w-5 ff-h-5",style:{color:"var(--ff-success)"}}):l.jsx(rt,{className:"ff-w-5 ff-h-5",style:{color:"var(--ff-warning)"}}):l.jsx("span",{className:"ff-w-5 ff-h-5"})}),g.confidence>0&&l.jsxs("div",{className:"ff-confidence",style:{color:a(g.confidence)},children:[l.jsxs("span",{children:[Math.round(g.confidence*100),"%"]}),l.jsxs("span",{style:{color:"var(--ff-text-muted)"},children:["(",f(g.confidence),")"]})]})]},g.sourceColumn)})}),(()=>{const g=s.filter(c=>c.required&&!p.has(c.key));return g.length>0?l.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:[l.jsx(w.CircleAlert,{className:"ff-w-5 ff-h-5 ff-flex-shrink-0 ff-mt-0.5",style:{color:"var(--ff-warning)"}}),l.jsxs("div",{children:[l.jsx("p",{className:"ff-text-sm ff-font-medium",style:{color:"var(--ff-warning-dark)"},children:"Required fields not mapped"}),l.jsx("p",{className:"ff-text-sm ff-mt-1",style:{color:"var(--ff-warning)"},children:g.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 vt(){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 ee(e){return e instanceof Function}function wt(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function Ct(e,o){const t=[],n=r=>{r.forEach(s=>{t.push(s);const i=o(s);i!=null&&i.length&&n(i)})};return n(e),t}function C(e,o,t){let n=[],r;return s=>{let i;t.key&&t.debug&&(i=Date.now());const a=e(s);if(!(a.length!==n.length||a.some((p,g)=>n[g]!==p)))return r;n=a;let d;if(t.key&&t.debug&&(d=Date.now()),r=o(...a),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const p=Math.round((Date.now()-i)*100)/100,g=Math.round((Date.now()-d)*100)/100,c=g/16,u=(m,h)=>{for(m=String(m);m.length<h;)m=" "+m;return m};console.info(`%c⏱ ${u(g,5)} /${u(p,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 xt(e,o,t,n){const r=()=>{var i;return(i=s.getValue())!=null?i: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],(i,a,f,d)=>({table:i,column:a,row:f,cell:d,getValue:d.getValue,renderValue:d.renderValue}),x(e.options,"debugCells","cell.getContext"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(s,t,o,e)},{}),s}function St(e,o,t,n){var r,s;const a={...e._getDefaultColumnDef(),...o},f=a.accessorKey;let d=(r=(s=a.id)!=null?s:f?typeof String.prototype.replaceAll=="function"?f.replaceAll(".","_"):f.replace(/\./g,"_"):void 0)!=null?r:typeof a.header=="string"?a.header:void 0,p;if(a.accessorFn?p=a.accessorFn:f&&(f.includes(".")?p=c=>{let u=c;for(const h of f.split(".")){var m;u=(m=u)==null?void 0:m[h],process.env.NODE_ENV!=="production"&&u===void 0&&console.warn(`"${h}" in deeply nested key "${f}" returned undefined.`)}return u}:p=c=>c[a.accessorKey]),!d)throw process.env.NODE_ENV!=="production"?new Error(a.accessorFn?"Columns require an id when using an accessorFn":"Columns require an id when using a non-string header"):new Error;let g={id:`${String(d)}`,accessorFn:p,parent:n,depth:t,columnDef:a,columns:[],getFlatColumns:C(()=>[!0],()=>{var c;return[g,...(c=g.columns)==null?void 0:c.flatMap(u=>u.getFlatColumns())]},x(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:C(()=>[e._getOrderColumnsFn()],c=>{var u;if((u=g.columns)!=null&&u.length){let m=g.columns.flatMap(h=>h.getLeafColumns());return c(m)}return[g]},x(e.options,"debugColumns","column.getLeafColumns"))};for(const c of e._features)c.createColumn==null||c.createColumn(g,e);return g}const P="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 i=[],a=f=>{f.subHeaders&&f.subHeaders.length&&f.subHeaders.map(a),i.push(f)};return a(s),i},getContext:()=>({table:e,header:s,column:o})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(s,e)}),s}const Rt={createTable:e=>{e.getHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,r)=>{var s,i;const a=(s=n==null?void 0:n.map(g=>t.find(c=>c.id===g)).filter(Boolean))!=null?s:[],f=(i=r==null?void 0:r.map(g=>t.find(c=>c.id===g)).filter(Boolean))!=null?i:[],d=t.filter(g=>!(n!=null&&n.includes(g.id))&&!(r!=null&&r.includes(g.id)));return Y(o,[...a,...d,...f],e)},x(e.options,P,"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))),Y(o,t,e,"center")),x(e.options,P,"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(i=>t.find(a=>a.id===i)).filter(Boolean))!=null?r:[];return Y(o,s,e,"left")},x(e.options,P,"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(i=>t.find(a=>a.id===i)).filter(Boolean))!=null?r:[];return Y(o,s,e,"right")},x(e.options,P,"getRightHeaderGroups")),e.getFooterGroups=C(()=>[e.getHeaderGroups()],o=>[...o].reverse(),x(e.options,P,"getFooterGroups")),e.getLeftFooterGroups=C(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),x(e.options,P,"getLeftFooterGroups")),e.getCenterFooterGroups=C(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),x(e.options,P,"getCenterFooterGroups")),e.getRightFooterGroups=C(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),x(e.options,P,"getRightFooterGroups")),e.getFlatHeaders=C(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,P,"getFlatHeaders")),e.getLeftFlatHeaders=C(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,P,"getLeftFlatHeaders")),e.getCenterFlatHeaders=C(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,P,"getCenterFlatHeaders")),e.getRightFlatHeaders=C(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),x(e.options,P,"getRightFlatHeaders")),e.getCenterLeafHeaders=C(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),x(e.options,P,"getCenterLeafHeaders")),e.getLeftLeafHeaders=C(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),x(e.options,P,"getLeftLeafHeaders")),e.getRightLeafHeaders=C(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),x(e.options,P,"getRightLeafHeaders")),e.getLeafHeaders=C(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,s,i,a,f,d;return[...(r=(s=o[0])==null?void 0:s.headers)!=null?r:[],...(i=(a=t[0])==null?void 0:a.headers)!=null?i:[],...(f=(d=n[0])==null?void 0:d.headers)!=null?f:[]].map(p=>p.getLeafHeaders()).flat()},x(e.options,P,"getLeafHeaders"))}};function Y(e,o,t,n){var r,s;let i=0;const a=function(c,u){u===void 0&&(u=1),i=Math.max(i,u),c.filter(m=>m.getIsVisible()).forEach(m=>{var h;(h=m.columns)!=null&&h.length&&a(m.columns,u+1)},0)};a(e);let f=[];const d=(c,u)=>{const m={depth:u,id:[n,`${u}`].filter(Boolean).join("_"),headers:[]},h=[];c.forEach(v=>{const S=[...h].reverse()[0],y=v.column.depth===m.depth;let j,N=!1;if(y&&v.column.parent?j=v.column.parent:(j=v.column,N=!0),S&&(S==null?void 0:S.column)===j)S.subHeaders.push(v);else{const V=$e(t,j,{id:[n,u,j.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:N,placeholderId:N?`${h.filter(D=>D.column===j).length}`:void 0,depth:u,index:h.length});V.subHeaders.push(v),h.push(V)}m.headers.push(v),v.headerGroup=m}),f.push(m),u>0&&d(h,u-1)},p=o.map((c,u)=>$e(t,c,{depth:i,index:u}));d(p,i-1),f.reverse();const g=c=>c.filter(m=>m.column.getIsVisible()).map(m=>{let h=0,v=0,S=[0];m.subHeaders&&m.subHeaders.length?(S=[],g(m.subHeaders).forEach(j=>{let{colSpan:N,rowSpan:V}=j;h+=N,S.push(V)})):h=1;const y=Math.min(...S);return v=v+y,m.colSpan=h,m.rowSpan=v,{colSpan:h,rowSpan:v}});return g((r=(s=f[0])==null?void 0:s.headers)!=null?r:[]),f}const Ce=(e,o,t,n,r,s,i)=>{let a={id:o,index:n,original:t,depth:r,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:f=>{if(a._valuesCache.hasOwnProperty(f))return a._valuesCache[f];const d=e.getColumn(f);if(d!=null&&d.accessorFn)return a._valuesCache[f]=d.accessorFn(a.original,n),a._valuesCache[f]},getUniqueValues:f=>{if(a._uniqueValuesCache.hasOwnProperty(f))return a._uniqueValuesCache[f];const d=e.getColumn(f);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(a._uniqueValuesCache[f]=d.columnDef.getUniqueValues(a.original,n),a._uniqueValuesCache[f]):(a._uniqueValuesCache[f]=[a.getValue(f)],a._uniqueValuesCache[f])},renderValue:f=>{var d;return(d=a.getValue(f))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Ct(a.subRows,f=>f.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let f=[],d=a;for(;;){const p=d.getParentRow();if(!p)break;f.push(p),d=p}return f.reverse()},getAllCells:C(()=>[e.getAllLeafColumns()],f=>f.map(d=>xt(e,a,d,d.id)),x(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:C(()=>[a.getAllCells()],f=>f.reduce((d,p)=>(d[p.column.id]=p,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(a,e)}return a},yt={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()}}},Ne=(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))};Ne.autoRemove=e=>A(e);const De=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};De.autoRemove=e=>A(e);const Ee=(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())};Ee.autoRemove=e=>A(e);const Le=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};Le.autoRemove=e=>A(e);const ke=(e,o,t)=>!t.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});ke.autoRemove=e=>A(e)||!(e!=null&&e.length);const Ae=(e,o,t)=>t.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});Ae.autoRemove=e=>A(e)||!(e!=null&&e.length);const ze=(e,o,t)=>e.getValue(o)===t;ze.autoRemove=e=>A(e);const He=(e,o,t)=>e.getValue(o)==t;He.autoRemove=e=>A(e);const xe=(e,o,t)=>{let[n,r]=t;const s=e.getValue(o);return s>=n&&s<=r};xe.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,i=t===null||Number.isNaN(r)?1/0:r;if(s>i){const a=s;s=i,i=a}return[s,i]};xe.autoRemove=e=>A(e)||A(e[0])&&A(e[1]);const H={includesString:Ne,includesStringSensitive:De,equalsString:Ee,arrIncludes:Le,arrIncludesAll:ke,arrIncludesSome:Ae,equals:ze,weakEquals:He,inNumberRange:xe};function A(e){return e==null||e===""}const _t={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 ee(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(p=>p.id===e.id),i=G(t,s?s.value:void 0);if(Ie(r,i,e)){var a;return(a=n==null?void 0:n.filter(p=>p.id!==e.id))!=null?a:[]}const f={id:e.id,value:i};if(s){var d;return(d=n==null?void 0:n.map(p=>p.id===e.id?f:p))!=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(i=>{const a=t.find(f=>f.id===i.id);if(a){const f=a.getFilterFn();if(Ie(f,i.value,a))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 Ie(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const Ft=(e,o,t)=>t.reduce((n,r)=>{const s=r.getValue(e);return n+(typeof s=="number"?s:0)},0),jt=(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},$t=(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},It=(e,o,t)=>{let n,r;return t.forEach(s=>{const i=s.getValue(e);i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}),[n,r]},Mt=(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},Vt=(e,o)=>{if(!o.length)return;const t=o.map(s=>s.getValue(e));if(!wt(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),r=t.sort((s,i)=>s-i);return t.length%2!==0?r[n]:(r[n-1]+r[n])/2},Pt=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Nt=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,Dt=(e,o)=>o.length,oe={sum:Ft,min:jt,max:$t,extent:It,mean:Mt,median:Vt,unique:Pt,uniqueCount:Nt,count:Dt},Et={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 oe.sum;if(Object.prototype.toString.call(n)==="[object Date]")return oe.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return ee(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:oe[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 Lt(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(i=>i.id===s)).filter(Boolean),...n]}const kt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:k("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=C(t=>[Q(o,t)],t=>t.findIndex(n=>n.id===e.id),x(o.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var n;return((n=Q(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=Q(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 i=[...o],a=[...r];for(;a.length&&i.length;){const f=i.shift(),d=a.findIndex(p=>p.id===f);d>-1&&s.push(a.splice(d,1)[0])}s=[...s,...a]}return Lt(s,t,n)},x(e.options,"debugTable","_getOrderColumnsFn"))}},re=()=>({left:[],right:[]}),At={getInitialState:e=>({columnPinning:re(),...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,i;if(t==="right"){var a,f;return{left:((a=r==null?void 0:r.left)!=null?a:[]).filter(g=>!(n!=null&&n.includes(g))),right:[...((f=r==null?void 0:r.right)!=null?f:[]).filter(g=>!(n!=null&&n.includes(g))),...n]}}if(t==="left"){var d,p;return{left:[...((d=r==null?void 0:r.left)!=null?d:[]).filter(g=>!(n!=null&&n.includes(g))),...n],right:((p=r==null?void 0:r.right)!=null?p:[]).filter(g=>!(n!=null&&n.includes(g)))}}return{left:((s=r==null?void 0:r.left)!=null?s:[]).filter(g=>!(n!=null&&n.includes(g))),right:((i=r==null?void 0:r.right)!=null?i:[]).filter(g=>!(n!=null&&n.includes(g)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var r,s,i;return((r=n.columnDef.enablePinning)!=null?r:!0)&&((s=(i=o.options.enableColumnPinning)!=null?i:o.options.enablePinning)!=null?s:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(a=>a.id),{left:n,right:r}=o.getState().columnPinning,s=t.some(a=>n==null?void 0:n.includes(a)),i=t.some(a=>r==null?void 0:r.includes(a));return s?"left":i?"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(i=>!s.includes(i.column.id))},x(o.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=C(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(i=>i.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(i=>i.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?re():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:re())},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 zt(e){return e||(typeof document<"u"?document:null)}const J={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},se=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Ht={getDefaultColumnDef:()=>J,getInitialState:e=>({columnSizing:{},columnSizingInfo:se(),...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:J.minSize,(n=s??e.columnDef.size)!=null?n:J.size),(r=e.columnDef.maxSize)!=null?r:J.maxSize)},e.getStart=C(t=>[t,Q(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,Q(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(),le(s)&&s.touches&&s.touches.length>1))return;const i=e.getSize(),a=e?e.getLeafHeaders().map(S=>[S.column.id,S.column.getSize()]):[[n.id,n.getSize()]],f=le(s)?Math.round(s.touches[0].clientX):s.clientX,d={},p=(S,y)=>{typeof y=="number"&&(o.setColumnSizingInfo(j=>{var N,V;const D=o.options.columnResizeDirection==="rtl"?-1:1,T=(y-((N=j==null?void 0:j.startOffset)!=null?N:0))*D,M=Math.max(T/((V=j==null?void 0:j.startSize)!=null?V:0),-.999999);return j.columnSizingStart.forEach(R=>{let[_,$]=R;d[_]=Math.round(Math.max($+$*M,0)*100)/100}),{...j,deltaOffset:T,deltaPercentage:M}}),(o.options.columnResizeMode==="onChange"||S==="end")&&o.setColumnSizing(j=>({...j,...d})))},g=S=>p("move",S),c=S=>{p("end",S),o.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=zt(t),m={moveHandler:S=>g(S.clientX),upHandler:S=>{u==null||u.removeEventListener("mousemove",m.moveHandler),u==null||u.removeEventListener("mouseup",m.upHandler),c(S.clientX)}},h={moveHandler:S=>(S.cancelable&&(S.preventDefault(),S.stopPropagation()),g(S.touches[0].clientX),!1),upHandler:S=>{var y;u==null||u.removeEventListener("touchmove",h.moveHandler),u==null||u.removeEventListener("touchend",h.upHandler),S.cancelable&&(S.preventDefault(),S.stopPropagation()),c((y=S.touches[0])==null?void 0:y.clientX)}},v=Gt()?{passive:!1}:!1;le(s)?(u==null||u.addEventListener("touchmove",h.moveHandler,v),u==null||u.addEventListener("touchend",h.upHandler,v)):(u==null||u.addEventListener("mousemove",m.moveHandler,v),u==null||u.addEventListener("mouseup",m.upHandler,v)),o.setColumnSizingInfo(S=>({...S,startOffset:f,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,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?se():(t=e.initialState.columnSizingInfo)!=null?t:se())},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 Z=null;function Gt(){if(typeof Z=="boolean")return Z;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 Z=e,Z}function le(e){return e.type==="touchstart"}const bt={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 Q(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Ot={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()}}},Bt={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 ee(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)}}},Tt={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 i=s.split(".");n=Math.max(n,i.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 i={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(a=>{i[a]=!0}):i=n,t=(r=t)!=null?r:!s,!s&&t)return{...i,[e.id]:!0};if(s&&!t){const{[e.id]:a,...f}=i;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()}}}},ce=0,ge=10,ie=()=>({pageIndex:ce,pageSize:ge}),qt={getInitialState:e=>({...e,pagination:{...ie(),...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?ie():(r=e.initialState.pagination)!=null?r:ie())},e.setPageIndex=n=>{e.setPagination(r=>{let s=G(n,r.pageIndex);const i=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,i)),{...r,pageIndex:s}})},e.resetPageIndex=n=>{var r,s;e.setPageIndex(n?ce:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:ce)},e.resetPageSize=n=>{var r,s;e.setPageSize(n?ge:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:ge)},e.setPageSize=n=>{e.setPagination(r=>{const s=Math.max(1,G(n,r.pageSize)),i=r.pageSize*r.pageIndex,a=Math.floor(i/s);return{...r,pageIndex:a,pageSize:s}})},e.setPageCount=n=>e.setPagination(r=>{var s;let i=G(n,(s=e.options.pageCount)!=null?s:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...r,pageCount:i}}),e.getPageOptions=C(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null).map((s,i)=>i)),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}}},ae=()=>({top:[],bottom:[]}),Ut={getInitialState:e=>({rowPinning:ae(),...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}):[],i=r?e.getParentRows().map(f=>{let{id:d}=f;return d}):[],a=new Set([...i,e.id,...s]);o.setRowPinning(f=>{var d,p;if(t==="bottom"){var g,c;return{top:((g=f==null?void 0:f.top)!=null?g:[]).filter(h=>!(a!=null&&a.has(h))),bottom:[...((c=f==null?void 0:f.bottom)!=null?c:[]).filter(h=>!(a!=null&&a.has(h))),...Array.from(a)]}}if(t==="top"){var u,m;return{top:[...((u=f==null?void 0:f.top)!=null?u:[]).filter(h=>!(a!=null&&a.has(h))),...Array.from(a)],bottom:((m=f==null?void 0:f.bottom)!=null?m:[]).filter(h=>!(a!=null&&a.has(h)))}}return{top:((d=f==null?void 0:f.top)!=null?d:[]).filter(h=>!(a!=null&&a.has(h))),bottom:((p=f==null?void 0:f.bottom)!=null?p:[]).filter(h=>!(a!=null&&a.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(a=>n==null?void 0:n.includes(a)),i=t.some(a=>r==null?void 0:r.includes(a));return s?"top":i?"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(i=>{let{id:a}=i;return a});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?ae():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:ae())},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(i=>{const a=e.getRow(i,!0);return a.getIsAllParentsExpanded()?a:null}):(t??[]).map(i=>o.find(a=>a.id===i))).filter(Boolean).map(i=>({...i,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"))}},Kt={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=>{pe(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?ue(e,t):{rows:[],flatRows:[],rowsById:{}},x(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=C(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?ue(e,t):{rows:[],flatRows:[],rowsById:{}},x(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=C(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?ue(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 i;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return s;const a={...s};return pe(a,e.id,t,(i=n==null?void 0:n.selectChildren)!=null?i:!0,o),a})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return Se(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return me(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return me(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)}}}},pe=(e,o,t,n,r)=>{var s;const i=r.getRow(o,!0);t?(i.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),i.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(s=i.subRows)!=null&&s.length&&i.getCanSelectSubRows()&&i.subRows.forEach(a=>pe(e,a.id,t,n,r))};function ue(e,o){const t=e.getState().rowSelection,n=[],r={},s=function(i,a){return i.map(f=>{var d;const p=Se(f,t);if(p&&(n.push(f),r[f.id]=f),(d=f.subRows)!=null&&d.length&&(f={...f,subRows:s(f.subRows)}),p)return f}).filter(Boolean)};return{rows:s(o.rows),flatRows:n,rowsById:r}}function Se(e,o){var t;return(t=o[e.id])!=null?t:!1}function me(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let r=!0,s=!1;return e.subRows.forEach(i=>{if(!(s&&!r)&&(i.getCanSelect()&&(Se(i,o)?s=!0:r=!1),i.subRows&&i.subRows.length)){const a=me(i,o);a==="all"?s=!0:(a==="some"&&(s=!0),r=!1)}}),r?"all":s?"some":!1}const he=/([0-9]+)/gm,Xt=(e,o,t)=>Ge(b(e.getValue(t)).toLowerCase(),b(o.getValue(t)).toLowerCase()),Wt=(e,o,t)=>Ge(b(e.getValue(t)),b(o.getValue(t))),Qt=(e,o,t)=>Re(b(e.getValue(t)).toLowerCase(),b(o.getValue(t)).toLowerCase()),Yt=(e,o,t)=>Re(b(e.getValue(t)),b(o.getValue(t))),Jt=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:n<r?-1:0},Zt=(e,o,t)=>Re(e.getValue(t),o.getValue(t));function Re(e,o){return e===o?0:e>o?1:-1}function b(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Ge(e,o){const t=e.split(he).filter(Boolean),n=o.split(he).filter(Boolean);for(;t.length&&n.length;){const r=t.shift(),s=n.shift(),i=parseInt(r,10),a=parseInt(s,10),f=[i,a].sort();if(isNaN(f[0])){if(r>s)return 1;if(s>r)return-1;continue}if(isNaN(f[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return t.length-n.length}const W={alphanumeric:Xt,alphanumericCaseSensitive:Wt,text:Qt,textCaseSensitive:Yt,datetime:Jt,basic:Zt},en={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 W.datetime;if(typeof s=="string"&&(n=!0,s.split(he).length>1))return W.alphanumeric}return n?W.text:W.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 ee(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:W[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const r=e.getNextSortingOrder(),s=typeof t<"u"&&t!==null;o.setSorting(i=>{const a=i==null?void 0:i.find(u=>u.id===e.id),f=i==null?void 0:i.findIndex(u=>u.id===e.id);let d=[],p,g=s?t:r==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&n?a?p="toggle":p="add":i!=null&&i.length&&f!==i.length-1?p="replace":a?p="toggle":p="replace",p==="toggle"&&(s||r||(p="remove")),p==="add"){var c;d=[...i,{id:e.id,desc:g}],d.splice(0,d.length-((c=o.options.maxMultiSortColCount)!=null?c:Number.MAX_SAFE_INTEGER))}else p==="toggle"?d=i.map(u=>u.id===e.id?{...u,desc:g}:u):p==="remove"?d=i.filter(u=>u.id!==e.id):d=[{id:e.id,desc:g}];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(),i=e.getIsSorted();return i?i!==s&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(r=o.options.enableMultiRemove)!=null)||r)?!1:i==="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())}},tn=[Rt,bt,kt,At,yt,_t,Ot,Bt,en,Et,Tt,qt,Ut,Kt,Ht];function nn(e){var o,t;process.env.NODE_ENV!=="production"&&(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");const n=[...tn,...(o=e._features)!=null?o:[]];let r={_features:n};const s=r._features.reduce((c,u)=>Object.assign(c,u.getDefaultOptions==null?void 0:u.getDefaultOptions(r)),{}),i=c=>r.options.mergeOptions?r.options.mergeOptions(s,c):{...s,...c};let f={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(c=>{var u;f=(u=c.getInitialState==null?void 0:c.getInitialState(f))!=null?u:f});const d=[];let p=!1;const g={_features:n,options:{...s,...e},initialState:f,_queue:c=>{d.push(c),p||(p=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();p=!1}).catch(u=>setTimeout(()=>{throw u})))},reset:()=>{r.setState(r.initialState)},setOptions:c=>{const u=G(c,r.options);r.options=i(u)},getState:()=>r.options.state,setState:c=>{r.options.onStateChange==null||r.options.onStateChange(c)},_getRowId:(c,u,m)=>{var h;return(h=r.options.getRowId==null?void 0:r.options.getRowId(c,u,m))!=null?h:`${m?[m.id,u].join("."):u}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(c,u)=>{let m=(u?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 u;return c=(u=c)!=null?u:{},{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 u=function(m,h,v){return v===void 0&&(v=0),m.map(S=>{const y=St(r,S,v,h),j=S;return y.columns=j.columns?u(j.columns,y,v+1):[],y})};return u(c)},x(e,"debugColumns","getAllColumns")),getAllFlatColumns:C(()=>[r.getAllColumns()],c=>c.flatMap(u=>u.getFlatColumns()),x(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:C(()=>[r.getAllFlatColumns()],c=>c.reduce((u,m)=>(u[m.id]=m,u),{}),x(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:C(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(c,u)=>{let m=c.flatMap(h=>h.getLeafColumns());return u(m)},x(e,"debugColumns","getAllLeafColumns")),getColumn:c=>{const u=r._getAllFlatColumnsById()[c];return process.env.NODE_ENV!=="production"&&!u&&console.error(`[Table] Column with id '${c}' does not exist.`),u}};Object.assign(r,g);for(let c=0;c<r._features.length;c++){const u=r._features[c];u==null||u.createTable==null||u.createTable(r)}return r}function on(){return e=>C(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,s,i){s===void 0&&(s=0);const a=[];for(let d=0;d<r.length;d++){const p=Ce(e,e._getRowId(r[d],d,i),r[d],d,s,void 0,i==null?void 0:i.id);if(t.flatRows.push(p),t.rowsById[p.id]=p,a.push(p),e.options.getSubRows){var f;p.originalSubRows=e.options.getSubRows(r[d],d),(f=p.originalSubRows)!=null&&f.length&&(p.subRows=n(p.originalSubRows,s+1,p))}}return a};return t.rows=n(o),t},x(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function rn(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 sn(e,o,t){return t.options.filterFromLeafRows?ln(e,o,t):an(e,o,t)}function ln(e,o,t){var n;const r=[],s={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,a=function(f,d){d===void 0&&(d=0);const p=[];for(let c=0;c<f.length;c++){var g;let u=f[c];const m=Ce(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);if(m.columnFilters=u.columnFilters,(g=u.subRows)!=null&&g.length&&d<i){if(m.subRows=a(u.subRows,d+1),u=m,o(u)&&!m.subRows.length){p.push(u),s[u.id]=u,r.push(u);continue}if(o(u)||m.subRows.length){p.push(u),s[u.id]=u,r.push(u);continue}}else u=m,o(u)&&(p.push(u),s[u.id]=u,r.push(u))}return p};return{rows:a(e),flatRows:r,rowsById:s}}function an(e,o,t){var n;const r=[],s={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,a=function(f,d){d===void 0&&(d=0);const p=[];for(let c=0;c<f.length;c++){let u=f[c];if(o(u)){var g;if((g=u.subRows)!=null&&g.length&&d<i){const h=Ce(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);h.subRows=a(u.subRows,d+1),u=h}p.push(u),r.push(u),s[u.id]=u}}return p};return{rows:a(e),flatRows:r,rowsById:s}}function un(){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 u;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:(u=h.resolveFilterValue==null?void 0:h.resolveFilterValue(c.value))!=null?u:c.value})});const i=(t??[]).map(c=>c.id),a=e.getGlobalFilterFn(),f=e.getAllLeafColumns().filter(c=>c.getCanGlobalFilter());n&&a&&f.length&&(i.push("__global__"),f.forEach(c=>{var u;s.push({id:c.id,filterFn:a,resolvedValue:(u=a.resolveFilterValue==null?void 0:a.resolveFilterValue(n))!=null?u:n})}));let d,p;for(let c=0;c<o.flatRows.length;c++){const u=o.flatRows[c];if(u.columnFilters={},r.length)for(let m=0;m<r.length;m++){d=r[m];const h=d.id;u.columnFilters[h]=d.filterFn(u,h,d.resolvedValue,v=>{u.columnFiltersMeta[h]=v})}if(s.length){for(let m=0;m<s.length;m++){p=s[m];const h=p.id;if(p.filterFn(u,h,p.resolvedValue,v=>{u.columnFiltersMeta[h]=v})){u.columnFilters.__global__=!0;break}}u.columnFilters.__global__!==!0&&(u.columnFilters.__global__=!1)}}const g=c=>{for(let u=0;u<i.length;u++)if(c.columnFilters[i[u]]===!1)return!1;return!0};return sn(o.rows,g,e)},x(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function fn(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:i,flatRows:a,rowsById:f}=n;const d=r*s,p=d+r;i=i.slice(d,p);let g;o.options.paginateExpandedRows?g={rows:i,flatRows:a,rowsById:f}:g=rn({rows:i,flatRows:a,rowsById:f}),g.flatRows=[];const c=u=>{g.flatRows.push(u),u.subRows.length&&u.subRows.forEach(c)};return g.rows.forEach(c),g},x(o.options,"debugTable","getPaginationRowModel"))}function dn(){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()}),i={};s.forEach(f=>{const d=e.getColumn(f.id);d&&(i[f.id]={sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortingFn:d.getSortingFn()})});const a=f=>{const d=f.map(p=>({...p}));return d.sort((p,g)=>{for(let u=0;u<s.length;u+=1){var c;const m=s[u],h=i[m.id],v=h.sortUndefined,S=(c=m==null?void 0:m.desc)!=null?c:!1;let y=0;if(v){const j=p.getValue(m.id),N=g.getValue(m.id),V=j===void 0,D=N===void 0;if(V||D){if(v==="first")return V?-1:1;if(v==="last")return V?1:-1;y=V&&D?0:V?v:-v}}if(y===0&&(y=h.sortingFn(p,g,m.id)),y!==0)return S&&(y*=-1),h.invertSorting&&(y*=-1),y}return p.index-g.index}),d.forEach(p=>{var g;r.push(p),(g=p.subRows)!=null&&g.length&&(p.subRows=a(p.subRows))}),d};return{rows:a(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 Me(e,o){return e?cn(e)?de.createElement(e,o):e:null}function cn(e){return gn(e)||typeof e=="function"||pn(e)}function gn(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function pn(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function mn(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=de.useState(()=>({current:nn(o)})),[n,r]=de.useState(()=>t.current.initialState);return t.current.setOptions(s=>({...s,...e,state:{...n,...e.state},onStateChange:i=>{r(i),e.onStateChange==null||e.onStateChange(i)}})),t.current}const ve=({editable:e=!0,pageSize:o=25,onCellEdit:t})=>{const{rows:n,schema:r,mappings:s,errorsByRow:i,editingCell:a,startEditing:f,stopEditing:d,updateCell:p}=B(),[g,c]=L.useState([]),[u,m]=L.useState(""),[h,v]=L.useState(""),S=L.useMemo(()=>s.filter(R=>R.targetKey!==null).map(R=>{const _=r==null?void 0:r.columns.find($=>$.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=L.useCallback((R,_)=>{const $=i.get(R);return $==null?void 0:$.find(O=>O.columnKey===_)},[i]),j=(R,_,$)=>{v($),f(R,_)},N=()=>{a&&(p(a.rowIndex,a.columnKey,h),t==null||t(a.rowIndex,a.columnKey,h)),d()},V=()=>{v(""),d()},D=vt(),T=L.useMemo(()=>[D.accessor("rowIndex",{header:"#",size:60,cell:R=>l.jsx("span",{className:"ff-font-mono ff-text-xs",style:{color:"var(--ff-text-muted)"},children:R.getValue()+1})}),...S.map(R=>D.accessor(_=>_.data[R.targetKey]||_.data[R.sourceColumn],{id:R.targetKey,header:R.label,cell:_=>{const $=_.row.original.rowIndex,O=String(_.getValue()??""),E=y($,R.targetKey);return(a==null?void 0:a.rowIndex)===$&&(a==null?void 0:a.columnKey)===R.targetKey?l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-1",children:[l.jsx("input",{type:"text",value:h,onChange:q=>v(q.target.value),onKeyDown:q=>{q.key==="Enter"&&N(),q.key==="Escape"&&V()},className:"ff-input ff-py-1 ff-text-sm",autoFocus:!0}),l.jsx("button",{onClick:N,className:"ff-btn ff-btn-primary ff-btn-sm",children:"Save"}),l.jsx("button",{onClick:V,className:"ff-btn ff-btn-secondary ff-btn-sm",children:"Cancel"})]}):l.jsxs("div",{className:w.clsx("ff-group ff-flex ff-items-center ff-gap-2",(E==null?void 0:E.severity)==="error"&&"ff-cell-error",(E==null?void 0:E.severity)==="warning"&&"ff-cell-warning"),children:[l.jsx("span",{className:"ff-flex-1 ff-truncate",children:O||l.jsx("span",{style:{color:"var(--ff-text-muted)"},children:"—"})}),E&&l.jsxs("div",{className:"ff-relative ff-group/tooltip",children:[E.severity==="error"?l.jsx(w.CircleAlert,{className:"ff-w-4 ff-h-4",style:{color:"var(--ff-error)"}}):l.jsx(w.TriangleAlert,{className:"ff-w-4 ff-h-4",style:{color:"var(--ff-warning)"}}),l.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:[E.message,E.suggestion&&l.jsx("span",{className:"ff-block ff-mt-1",style:{color:"var(--ff-text-muted)"},children:E.suggestion})]})]}),e&&!E&&l.jsx("button",{onClick:()=>j($,R.targetKey,O),className:"ff-opacity-0 group-hover:ff-opacity-100 ff-p-1 ff-rounded ff-transition-opacity ff-edit-btn",children:l.jsx(pt,{className:"ff-w-3 ff-h-3"})})]})}}))],[S,a,h,e,y,D]),M=mn({data:n,columns:T,state:{sorting:g,globalFilter:u},onSortingChange:c,onGlobalFilterChange:m,getCoreRowModel:on(),getPaginationRowModel:fn(),getSortedRowModel:dn(),getFilteredRowModel:un(),initialState:{pagination:{pageSize:o}}});return l.jsxs("div",{className:"ff-space-y-4",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between",children:[l.jsx("input",{type:"text",value:u,onChange:R=>m(R.target.value),placeholder:"Search all columns...",className:"ff-input ff-max-w-xs"}),l.jsxs("div",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:[M.getFilteredRowModel().rows.length," rows"]})]}),l.jsx("div",{className:"ff-table-container ff-max-h-[500px]",children:l.jsxs("table",{className:"ff-table",children:[l.jsx("thead",{children:M.getHeaderGroups().map(R=>l.jsx("tr",{children:R.headers.map(_=>l.jsx("th",{style:{width:_.getSize()},onClick:_.column.getToggleSortingHandler(),className:w.clsx(_.column.getCanSort()&&"ff-cursor-pointer ff-select-none"),children:l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-1",children:[Me(_.column.columnDef.header,_.getContext()),_.column.getIsSorted()&&l.jsx("span",{children:_.column.getIsSorted()==="asc"?"↑":"↓"})]})},_.id))},R.id))}),l.jsx("tbody",{children:M.getRowModel().rows.map(R=>{const _=i.has(R.original.rowIndex);return l.jsx("tr",{className:w.clsx(_&&"ff-row-error"),children:R.getVisibleCells().map($=>l.jsx("td",{children:Me($.column.columnDef.cell,$.getContext())},$.id))},R.id)})})]})}),l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-2",children:[l.jsxs("div",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:["Page ",M.getState().pagination.pageIndex+1," of ",M.getPageCount()]}),l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2",children:[l.jsxs("button",{onClick:()=>M.previousPage(),disabled:!M.getCanPreviousPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:[l.jsx(nt,{className:"ff-w-4 ff-h-4"}),"Previous"]}),l.jsxs("button",{onClick:()=>M.nextPage(),disabled:!M.getCanNextPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:["Next",l.jsx(w.ChevronRight,{className:"ff-w-4 ff-h-4"})]})]})]})]})},we=({showDetails:e=!0})=>{const{validationResults:o}=B();if(!o)return null;const{isValid:t,totalRows:n,validRows:r,errorCount:s,warningCount:i,infoCount:a,summary:f}=o,d=Math.round(r/n*100);return l.jsxs("div",{className:"ff-space-y-4",children:[l.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?l.jsx(w.CircleCheckBig,{className:"ff-w-8 ff-h-8",style:{color:"var(--ff-success)"}}):l.jsx(w.CircleX,{className:"ff-w-8 ff-h-8",style:{color:"var(--ff-error)"}}),l.jsxs("div",{children:[l.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"}),l.jsxs("p",{className:"ff-text-sm",style:{color:t?"var(--ff-success)":"var(--ff-error)"},children:[r," of ",n," rows are valid (",d,"%)"]})]})]}),l.jsxs("div",{className:"ff-grid ff-grid-cols-4 ff-gap-4",children:[l.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:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-text-primary)"},children:n}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:"Total Rows"})]}),l.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:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-success-dark)"},children:r}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:"Valid Rows"})]}),l.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:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-error-dark)"},children:s}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-error)"},children:"Errors"})]}),l.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:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-warning-dark)"},children:i}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-warning)"},children:"Warnings"})]})]}),e&&f.byColumn&&Object.keys(f.byColumn).length>0&&l.jsxs("div",{className:"ff-border ff-rounded-lg ff-overflow-hidden",style:{backgroundColor:"var(--ff-bg-primary)",borderColor:"var(--ff-border-light)"},children:[l.jsx("div",{className:"ff-px-4 ff-py-3 ff-border-b",style:{backgroundColor:"var(--ff-bg-secondary)",borderColor:"var(--ff-border-light)"},children:l.jsx("h4",{className:"ff-font-medium",style:{color:"var(--ff-text-secondary)"},children:"Issues by Column"})}),l.jsx("div",{className:"ff-divide-y",style:{borderColor:"var(--ff-border-light)"},children:Object.entries(f.byColumn).filter(([,p])=>p.errorCount>0||p.warningCount>0).map(([p,g])=>l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-4 ff-py-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"ff-font-medium",style:{color:"var(--ff-text-primary)"},children:g.columnKey}),g.mostCommonError&&l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:g.mostCommonError})]}),l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[g.errorCount>0&&l.jsxs("span",{className:"ff-badge ff-badge-error",children:[l.jsx(w.CircleX,{className:"ff-w-3 ff-h-3 ff-mr-1"}),g.errorCount," errors"]}),g.warningCount>0&&l.jsxs("span",{className:"ff-badge ff-badge-warning",children:[l.jsx(w.TriangleAlert,{className:"ff-w-3 ff-h-3 ff-mr-1"}),g.warningCount," warnings"]})]})]},p))})]}),e&&f.duplicates&&f.duplicates.length>0&&l.jsx("div",{className:"ff-border ff-rounded-lg ff-p-4",style:{backgroundColor:"var(--ff-warning-light)",borderColor:"var(--ff-warning)"},children:l.jsxs("div",{className:"ff-flex ff-items-start ff-gap-3",children:[l.jsx(w.TriangleAlert,{className:"ff-w-5 ff-h-5 ff-flex-shrink-0 ff-mt-0.5",style:{color:"var(--ff-warning)"}}),l.jsxs("div",{children:[l.jsx("h4",{className:"ff-font-medium",style:{color:"var(--ff-warning-dark)"},children:"Duplicate Values Found"}),l.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((p,g)=>l.jsxs("li",{children:[l.jsx("span",{className:"ff-font-mono",children:p.columnKey}),': "',String(p.value),'" appears'," ",p.rowIndices.length," times (rows"," ",p.rowIndices.slice(0,3).map(c=>c+1).join(", "),p.rowIndices.length>3?"...":"",")"]},g)),f.duplicates.length>5&&l.jsxs("li",{style:{color:"var(--ff-warning)"},children:["... and ",f.duplicates.length-5," more duplicate groups"]})]})]})]})})]})},fe=["upload","mapping","validation","complete"],hn=[{key:"upload",label:"Upload",icon:w.Upload},{key:"mapping",label:"Map Columns",icon:ct},{key:"validation",label:"Validate",icon:ht},{key:"review",label:"Review",icon:lt},{key:"complete",label:"Complete",icon:w.CircleCheckBig}],vn=({template:e,schema:o,mode:t="modal",theme:n,useShadowDom:r=!1,onComplete:s,onCancel:i,onError:a})=>{const{step:f,sessionId:d,file:p,mappings:g,validationResults:c,isLoading:u,error:m,setSchema:h,setSessionId:v,setParsedData:S,setMappings:y,setUnmapped:j,setValidationResults:N,setStep:V,nextStep:D,previousStep:T,setLoading:M,setError:R,reset:_}=B(),[$,O]=L.useState(null),[E,K]=L.useState(null);L.useEffect(()=>{if(K(null),e)if(w.templateExists(e)){const F=w.getTemplateSchema(e);F?O(F):(K(`Failed to load template "${e}"`),a==null||a(new Error(`Failed to load template "${e}"`)))}else{const F=`Template "${e}" not found. Available templates: ${w.VALID_TEMPLATE_IDS.join(", ")}`;K(F),a==null||a(new Error(F))}else if(o)O(o);else{const F=`No template or schema provided. Please specify a template (${w.VALID_TEMPLATE_IDS.join(", ")}) or provide a custom schema.`;K(F),a==null||a(new Error(F))}},[e,o,a]),L.useEffect(()=>{$&&(h($),q($))},[$]);const q=async F=>{try{M(!0);const z=await w.getClient().createImportSession(F);v(z.sessionId)}catch(I){const z=I;R(z.message),a==null||a(z)}finally{M(!1)}},be=L.useCallback(async F=>{if(d)try{M(!0),R(null);const z=await w.getClient().uploadFile(d,F),Fe=(U,We)=>({rowIndex:U.rowIndex??We,data:U.data??U,rawData:U.rawData??Object.values(U.data??U)});S({headers:z.data.headers,rows:z.data.sampleRows.map(Fe),totalRows:z.data.totalRows,sampleRows:z.data.sampleRows.map(Fe)}),D(),await Oe()}catch(I){R(`Failed to process the uploaded file: ${I.message}`)}finally{M(!1)}},[d]),Oe=async()=>{if(d)try{M(!0);const I=await w.getClient().matchColumns(d);y(I.mappings),j(I.unmappedSource,I.unmappedTarget)}catch(F){R(`Column matching failed: ${F.message}`)}finally{M(!1)}},Be=async()=>{if(d)try{M(!0),R(null);const I=await w.getClient().validateImport(d);N(I.validation),D()}catch(F){R(`Validation failed: ${F.message}`)}finally{M(!1)}},[ye,te]=L.useState(null),Te=async()=>{if(d)try{M(!0),R(null),te(null);const I=await w.getClient().completeImport(d,{skipInvalidRows:!0,acknowledgeWarnings:!0});V("complete"),s==null||s(I)}catch(F){te(F.message),V("complete")}finally{M(!1)}},ne=()=>{_(),i==null||i()},qe=()=>hn.findIndex(F=>F.key===f),Ue=()=>{switch(f){case"upload":return p!==null;case"mapping":return g.length>0&&g.some(F=>F.targetKey!==null);case"validation":return c!==null;case"review":return c!==null&&(c.isValid||c.errorCount===0);default:return!1}},Ke=async()=>{switch(f){case"mapping":await Be();break;case"validation":D();break;case"review":await Te();break;default:D()}};if(E)return l.jsx(w.StyleProvider,{theme:n,useShadowDom:r,children:l.jsx("div",{className:"ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6",children:l.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:[l.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:l.jsx(w.X,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-error)"}})}),l.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Configuration Error"}),l.jsx("p",{className:"ff-text-center ff-max-w-md ff-mb-4",style:{color:"var(--ff-text-muted)"},children:E}),i&&l.jsx("button",{onClick:ne,className:"ff-btn ff-btn-secondary",children:"Close"})]})})});if(!$)return l.jsx(w.StyleProvider,{theme:n,useShadowDom:r,children:l.jsx("div",{className:"ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6",children:l.jsxs("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:[l.jsx(w.LoaderCircle,{className:"ff-w-10 ff-h-10 ff-animate-spin ff-mb-4",style:{color:"var(--ff-primary-90)"}}),l.jsx("p",{style:{color:"var(--ff-text-muted)"},children:"Loading template..."})]})})});const X=()=>{const F=f==="review"?"validation":f;return fe.indexOf(F)},Xe=t==="embed"?"ff-container ff-embed":"ff-container ff-modal",_e=l.jsx(l.Fragment,{children:l.jsxs("div",{className:Xe,children:[l.jsxs("div",{className:"ff-modal-header",children:[l.jsxs("div",{className:"ff-modal-header-left",children:[l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-3",children:[l.jsx("div",{className:"ff-modal-icon",children:l.jsx(at,{})}),l.jsx("h2",{className:"ff-modal-title",children:"Import Data"})]}),l.jsx("div",{className:"ff-steps ff-ml-4",children:fe.map((F,I)=>l.jsxs(L.Fragment,{children:[l.jsx("div",{className:w.clsx("ff-step",X()===I&&"ff-step-active",X()>I&&"ff-step-complete",X()<I&&"ff-step-pending"),children:X()>I?"✓":I+1}),I<fe.length-1&&l.jsx("div",{className:w.clsx("ff-step-connector",X()>I&&"ff-step-connector-complete")})]},F))})]}),l.jsx("button",{onClick:ne,className:"ff-modal-close",children:l.jsx(w.X,{className:"ff-w-5 ff-h-5"})})]}),l.jsxs("div",{className:"ff-modal-body",children:[m&&l.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:m}),f==="upload"&&l.jsx("div",{className:"ff-py-4",children:l.jsx("div",{className:"ff-max-w-xl ff-mx-auto",children:l.jsx(Ve,{onFileSelect:be})})}),f==="mapping"&&l.jsx(Pe,{}),f==="validation"&&l.jsxs("div",{className:"ff-space-y-6",children:[l.jsx(we,{}),l.jsx(ve,{editable:!0})]}),f==="review"&&l.jsxs("div",{className:"ff-space-y-6",children:[l.jsx(we,{showDetails:!1}),l.jsx(ve,{editable:!1,pageSize:10})]}),f==="complete"&&l.jsx("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12",children:ye?l.jsxs(l.Fragment,{children:[l.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:l.jsx(w.X,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-error)"}})}),l.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Import Failed"}),l.jsx("p",{className:"ff-text-center ff-max-w-md ff-mb-4",style:{color:"var(--ff-text-muted)"},children:ye}),l.jsxs("div",{className:"ff-flex ff-gap-3",children:[l.jsx("button",{onClick:()=>{te(null),V("review")},className:"ff-btn ff-btn-secondary",children:"Back to Review"}),i&&l.jsx("button",{onClick:ne,className:"ff-btn ff-btn-secondary",children:"Close"})]})]}):l.jsxs(l.Fragment,{children:[l.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:l.jsx(w.CircleCheckBig,{className:"ff-w-10 ff-h-10",style:{color:"var(--ff-success)"}})}),l.jsx("h3",{className:"ff-text-xl ff-font-semibold ff-mb-2",style:{color:"var(--ff-text-primary)"},children:"Import Complete!"}),l.jsx("p",{style:{color:"var(--ff-text-muted)"},children:"Your data has been successfully imported."})]})})]}),f!=="complete"&&l.jsxs("div",{className:"ff-modal-footer",children:[l.jsx("button",{onClick:T,disabled:qe()===0||u,className:"ff-btn ff-btn-secondary",children:"Back"}),l.jsx("button",{onClick:Ke,disabled:!Ue()||u,className:"ff-btn ff-btn-primary",children:u?l.jsxs(l.Fragment,{children:[l.jsx(w.LoaderCircle,{className:"ff-w-4 ff-h-4 ff-animate-spin"}),"Processing..."]}):f==="review"?"Complete Import":"Continue"})]})]})});return l.jsx(w.StyleProvider,{theme:n,useShadowDom:r,children:t==="modal"?l.jsx("div",{className:"ff-overlay",children:_e}):_e})};exports.ColumnMapper=Pe;exports.DataTable=ve;exports.FileUploader=Ve;exports.ImportWizard=vn;exports.ValidationSummary=we;exports.useImportStore=B;
|
|
73
|
+
//# sourceMappingURL=ImportWizard-B5Uegimf.js.map
|