@fileflow/sdk 0.1.24 → 0.1.26
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-C_B8FF5o.js +79 -0
- package/dist/ImportWizard-C_B8FF5o.js.map +1 -0
- package/dist/{ImportWizard-CnoaPUwN.mjs → ImportWizard-CdHW2xzf.mjs} +567 -549
- package/dist/ImportWizard-CdHW2xzf.mjs.map +1 -0
- package/dist/import.js +1 -1
- package/dist/import.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/ImportWizard-Bueox6It.js +0 -78
- package/dist/ImportWizard-Bueox6It.js.map +0 -1
- package/dist/ImportWizard-CnoaPUwN.mjs.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),E=require("react"),w=require("./index-RFYSKfrk.js");function dt(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 Se=dt(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 gt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],pt=w.createLucideIcon("arrow-right",gt);/**
|
|
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 mt=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ht=w.createLucideIcon("check",mt);/**
|
|
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 vt=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],xt=w.createLucideIcon("chevron-left",vt);/**
|
|
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 wt=[["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"}]],Ct=w.createLucideIcon("circle-question-mark",wt);/**
|
|
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 yt=[["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"}]],St=w.createLucideIcon("eye",yt);/**
|
|
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 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"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],_t=w.createLucideIcon("file-spreadsheet",Rt);/**
|
|
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 Ft=[["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"}]],jt=w.createLucideIcon("file",Ft);/**
|
|
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 It=[["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"}]],$t=w.createLucideIcon("git-branch",It);/**
|
|
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 Nt=[["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"}]],Mt=w.createLucideIcon("pen",Nt);/**
|
|
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 Vt=[["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"}]],Pt=w.createLucideIcon("square-check-big",Vt);/**
|
|
52
|
+
* @license lucide-react v0.563.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const kt=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],bt=w.createLucideIcon("trash-2",kt),He={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};function Et(e,o){var r;const t=[],n=(e==null?void 0:e.trim())||"";if(o.required&&!n)return t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"required",message:`${o.label} is required`}),t;if(!n)return t;switch(o.type){case"email":{if(!/^[^\s@]+@[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/.test(n))t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Invalid email format"});else{const i=(r=n.split("@")[1])==null?void 0:r.toLowerCase(),a={"gmial.com":"gmail.com","gmal.com":"gmail.com","gmai.com":"gmail.com","gamil.com":"gmail.com","gnail.com":"gmail.com","gmail.co":"gmail.com","gmail.cm":"gmail.com","gmil.com":"gmail.com","gmaill.com":"gmail.com","yaho.com":"yahoo.com","yahooo.com":"yahoo.com","yahoo.co":"yahoo.com","hotmal.com":"hotmail.com","hotmial.com":"hotmail.com","hotmai.com":"hotmail.com","hotmail.co":"hotmail.com","outlok.com":"outlook.com","outloo.com":"outlook.com","outlook.co":"outlook.com"};i&&a[i]&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:"warning",validatorType:"type",message:`Possible typo: did you mean @${a[i]}?`,suggestion:`${n.split("@")[0]}@${a[i]}`})}break}case"url":/^https?:\/\/.+/.test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Invalid URL format"});break;case"integer":/^-?\d+$/.test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Must be a whole number"});break;case"number":case"float":/^-?\d+(\.\d+)?$/.test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:"error",validatorType:"type",message:"Must be a valid number"});break;case"phone":n.replace(/\D/g,"").length<10&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:"warning",validatorType:"type",message:"Invalid phone number"});break}if(o.validators)for(const s of o.validators){const i=s.severity==="info"?"warning":s.severity||"error",a=s.params||{};switch(s.type){case"minLength":{const f=a.value??0;n.length<f&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at least ${f} characters`});break}case"maxLength":{const f=a.value??1/0;n.length>f&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at most ${f} characters`});break}case"min":{const f=parseFloat(n),c=a.value??-1/0;!isNaN(f)&&f<c&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at least ${c}`});break}case"max":{const f=parseFloat(n),c=a.value??1/0;!isNaN(f)&&f>c&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be at most ${c}`});break}case"pattern":{const f=a.regex??a.pattern??".*";new RegExp(f).test(n)||t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||"Format is invalid"});break}case"enum":{const f=a.values||[];f.map(p=>p.toLowerCase()).includes(n.toLowerCase())||t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Must be one of: ${f.slice(0,5).join(", ")}${f.length>5?"...":""}`});break}case"custom":{const f=a.validatorName;if(f==="commaSeparatedEnum"){const c=a.allowedValues||[],p=n.split(",").map(u=>u.trim().toLowerCase()).filter(u=>u),g=c.map(u=>u.toLowerCase()),d=p.filter(u=>!g.includes(u));d.length>0&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:s.message||`Invalid values: ${d.join(", ")}. Must be comma-separated values from: ${c.slice(0,5).join(", ")}${c.length>5?"...":""}`})}if(f==="commaSeparatedEmails"){const p=n.split(",").map(g=>g.trim()).filter(g=>g).filter(g=>!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(g));p.length>0&&t.push({rowIndex:0,columnKey:o.key,value:n,severity:i,validatorType:s.type,message:`Invalid email(s): ${p.join(", ")}`})}break}}}return t}function ge(e,o,t){var x;const n=[];for(const v of e)for(const C of t){if(!C.targetKey)continue;const R=o.columns.find(V=>V.key===C.targetKey);if(!R)continue;const $=v.data[C.targetKey]||v.data[C.sourceColumn]||"",F=Et(String($),R);for(const V of F)n.push({...V,rowIndex:v.rowIndex})}const r=((x=o.options)==null?void 0:x.uniqueKeys)||[];for(const v of r){const C=t.find($=>$.targetKey===v);if(!C)continue;const R=new Map;for(const $ of e){const F=String($.data[v]||$.data[C.sourceColumn]||"").toLowerCase().trim();if(!F)continue;const V=R.get(F)||[];V.push($.rowIndex),R.set(F,V)}for(const[$,F]of R.entries())if(F.length>1)for(const V of F.slice(1))n.push({rowIndex:V,columnKey:v,value:$,severity:"warning",validatorType:"unique",message:`Duplicate ${v} value`})}const s=new Map;for(const v of n){const C=s.get(v.rowIndex)||[];C.push(v),s.set(v.rowIndex,C)}const i=n.filter(v=>v.severity==="error").length,a=n.filter(v=>v.severity==="warning").length,f=n.filter(v=>v.severity==="info").length,c=new Set(n.filter(v=>v.severity==="error").map(v=>v.rowIndex)),p=e.length,g=p-c.size,d={};for(const v of n){d[v.columnKey]||(d[v.columnKey]={columnKey:v.columnKey,errorCount:0,warningCount:0,infoCount:0,mostCommonError:void 0});const C=d[v.columnKey];v.severity==="error"?C.errorCount++:v.severity==="warning"?C.warningCount++:C.infoCount++,C.mostCommonError||(C.mostCommonError=v.message)}const u={};for(const v of n)u[v.validatorType]=(u[v.validatorType]||0)+1;const m=[];for(const v of r){const C=t.find($=>$.targetKey===v);if(!C)continue;const R=new Map;for(const $ of e){const F=String($.data[v]||$.data[C.sourceColumn]||"").toLowerCase().trim();if(!F)continue;const V=R.get(F)||[];V.push($.rowIndex),R.set(F,V)}for(const[$,F]of R.entries())F.length>1&&m.push({columnKey:v,value:$,rowIndices:F})}const h={byColumn:d,byType:u,duplicates:m.length>0?m:void 0};return{validationResults:{isValid:i===0,totalRows:p,validRows:g,errorCount:i,warningCount:a,infoCount:f,errors:n,summary:h},errorsByRow:s}}const ne=w.create((e,o)=>({...He,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=>{if(!t){e({validationResults:null,errorsByRow:new Map});return}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})},revalidate:()=>{const t=o();if(!t.schema||!t.validationResults)return;const{validationResults:n,errorsByRow:r}=ge(t.rows,t.schema,t.mappings);e({validationResults:n,errorsByRow:r})},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)=>{const s=o(),i=[...s.rows],a=i.find(c=>c.rowIndex===t);a&&(a.data={...a.data,[n]:String(r)});const f=new Set(s.editedRows);if(f.add(t),e({rows:i,editedRows:f,editingCell:null}),s.schema&&s.validationResults){const{validationResults:c,errorsByRow:p}=ge(i,s.schema,s.mappings);e({validationResults:c,errorsByRow:p})}},deleteRow:t=>{const n=o(),s=n.rows.filter(i=>i.rowIndex!==t).map((i,a)=>({...i,rowIndex:a}));if(e({rows:s,totalRows:s.length}),n.schema&&n.validationResults){const{validationResults:i,errorsByRow:a}=ge(s,n.schema,n.mappings);e({validationResults:i,errorsByRow:a})}},setStatus:t=>e({status:t}),setLoading:t=>e({isLoading:t}),setError:t=>e({error:t}),reset:()=>e(He)})),Be=({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:c}=ne(),p=E.useCallback((x,v)=>{if(v.length>0){f("Invalid file type or file too large");return}if(x.length>0){const C=x[0];i(C),e==null||e(C)}},[e,i,f]),{getRootProps:g,getInputProps:d,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:c}),m=x=>x<1024?`${x} B`:x<1024*1024?`${(x/1024).toFixed(1)} KB`:`${(x/(1024*1024)).toFixed(1)} MB`,h=x=>{x.stopPropagation(),ne.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(jt,{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",c&&"ff-opacity-50 ff-cursor-not-allowed"),children:[l.jsx("input",{...d()}),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",c&&"ff-opacity-50 ff-cursor-wait"),children:c?"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})]})]})},Ke=({onMappingChange:e})=>{const{mappings:o,schema:t,unmappedSource:n,updateMapping:r}=ne(),s=(t==null?void 0:t.columns)||[],i=(g,d)=>{const u=d===""?null:d;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 d=g.targetKey!==null,u=g.confidence>=.85;return l.jsxs("div",{className:w.clsx("ff-mapping-row",d&&u&&"ff-mapping-row-success",d&&!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(pt,{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:d?u?l.jsx(ht,{className:"ff-w-5 ff-h-5",style:{color:"var(--ff-success)"}}):l.jsx(Ct,{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(d=>d.required&&!p.has(d.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(d=>d.label).join(", ")})]})]}):null})()]})};/**
|
|
57
|
+
* table-core
|
|
58
|
+
*
|
|
59
|
+
* Copyright (c) TanStack
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the MIT license found in the
|
|
62
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
63
|
+
*
|
|
64
|
+
* @license MIT
|
|
65
|
+
*/function Lt(){return{accessor:(e,o)=>typeof e=="function"?{...o,accessorFn:e}:{...o,accessorKey:e},display:e=>e,group:e=>e}}function Y(e,o){return typeof e=="function"?e(o):e}function T(e,o){return t=>{o.setState(n=>({...n,[e]:Y(t,n[e])}))}}function de(e){return e instanceof Function}function Dt(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function At(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 y(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 c;if(t.key&&t.debug&&(c=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()-c)*100)/100,d=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`,`
|
|
66
|
+
font-size: .6rem;
|
|
67
|
+
font-weight: bold;
|
|
68
|
+
color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,t==null?void 0:t.key)}return r}}function S(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 zt(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:y(()=>[e,t,o,s],(i,a,f,c)=>({table:i,column:a,row:f,cell:c,getValue:c.getValue,renderValue:c.renderValue}),S(e.options,"debugCells","cell.getContext"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(s,t,o,e)},{}),s}function Ht(e,o,t,n){var r,s;const a={...e._getDefaultColumnDef(),...o},f=a.accessorKey;let c=(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=d=>{let u=d;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=d=>d[a.accessorKey]),!c)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(c)}`,accessorFn:p,parent:n,depth:t,columnDef:a,columns:[],getFlatColumns:y(()=>[!0],()=>{var d;return[g,...(d=g.columns)==null?void 0:d.flatMap(u=>u.getFlatColumns())]},S(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:y(()=>[e._getOrderColumnsFn()],d=>{var u;if((u=g.columns)!=null&&u.length){let m=g.columns.flatMap(h=>h.getLeafColumns());return d(m)}return[g]},S(e.options,"debugColumns","column.getLeafColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(g,e);return g}const z="debugHeaders";function Ge(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 Gt={createTable:e=>{e.getHeaderGroups=y(()=>[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(d=>d.id===g)).filter(Boolean))!=null?s:[],f=(i=r==null?void 0:r.map(g=>t.find(d=>d.id===g)).filter(Boolean))!=null?i:[],c=t.filter(g=>!(n!=null&&n.includes(g.id))&&!(r!=null&&r.includes(g.id)));return ue(o,[...a,...c,...f],e)},S(e.options,z,"getHeaderGroups")),e.getCenterHeaderGroups=y(()=>[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))),ue(o,t,e,"center")),S(e.options,z,"getCenterHeaderGroups")),e.getLeftHeaderGroups=y(()=>[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 ue(o,s,e,"left")},S(e.options,z,"getLeftHeaderGroups")),e.getRightHeaderGroups=y(()=>[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 ue(o,s,e,"right")},S(e.options,z,"getRightHeaderGroups")),e.getFooterGroups=y(()=>[e.getHeaderGroups()],o=>[...o].reverse(),S(e.options,z,"getFooterGroups")),e.getLeftFooterGroups=y(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),S(e.options,z,"getLeftFooterGroups")),e.getCenterFooterGroups=y(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),S(e.options,z,"getCenterFooterGroups")),e.getRightFooterGroups=y(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),S(e.options,z,"getRightFooterGroups")),e.getFlatHeaders=y(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),S(e.options,z,"getFlatHeaders")),e.getLeftFlatHeaders=y(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),S(e.options,z,"getLeftFlatHeaders")),e.getCenterFlatHeaders=y(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),S(e.options,z,"getCenterFlatHeaders")),e.getRightFlatHeaders=y(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),S(e.options,z,"getRightFlatHeaders")),e.getCenterLeafHeaders=y(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),S(e.options,z,"getCenterLeafHeaders")),e.getLeftLeafHeaders=y(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),S(e.options,z,"getLeftLeafHeaders")),e.getRightLeafHeaders=y(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),S(e.options,z,"getRightLeafHeaders")),e.getLeafHeaders=y(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var r,s,i,a,f,c;return[...(r=(s=o[0])==null?void 0:s.headers)!=null?r:[],...(i=(a=t[0])==null?void 0:a.headers)!=null?i:[],...(f=(c=n[0])==null?void 0:c.headers)!=null?f:[]].map(p=>p.getLeafHeaders()).flat()},S(e.options,z,"getLeafHeaders"))}};function ue(e,o,t,n){var r,s;let i=0;const a=function(d,u){u===void 0&&(u=1),i=Math.max(i,u),d.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 c=(d,u)=>{const m={depth:u,id:[n,`${u}`].filter(Boolean).join("_"),headers:[]},h=[];d.forEach(x=>{const v=[...h].reverse()[0],C=x.column.depth===m.depth;let R,$=!1;if(C&&x.column.parent?R=x.column.parent:(R=x.column,$=!0),v&&(v==null?void 0:v.column)===R)v.subHeaders.push(x);else{const F=Ge(t,R,{id:[n,u,R.id,x==null?void 0:x.id].filter(Boolean).join("_"),isPlaceholder:$,placeholderId:$?`${h.filter(V=>V.column===R).length}`:void 0,depth:u,index:h.length});F.subHeaders.push(x),h.push(F)}m.headers.push(x),x.headerGroup=m}),f.push(m),u>0&&c(h,u-1)},p=o.map((d,u)=>Ge(t,d,{depth:i,index:u}));c(p,i-1),f.reverse();const g=d=>d.filter(m=>m.column.getIsVisible()).map(m=>{let h=0,x=0,v=[0];m.subHeaders&&m.subHeaders.length?(v=[],g(m.subHeaders).forEach(R=>{let{colSpan:$,rowSpan:F}=R;h+=$,v.push(F)})):h=1;const C=Math.min(...v);return x=x+C,m.colSpan=h,m.rowSpan=x,{colSpan:h,rowSpan:x}});return g((r=(s=f[0])==null?void 0:s.headers)!=null?r:[]),f}const Me=(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 c=e.getColumn(f);if(c!=null&&c.accessorFn)return a._valuesCache[f]=c.accessorFn(a.original,n),a._valuesCache[f]},getUniqueValues:f=>{if(a._uniqueValuesCache.hasOwnProperty(f))return a._uniqueValuesCache[f];const c=e.getColumn(f);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(a._uniqueValuesCache[f]=c.columnDef.getUniqueValues(a.original,n),a._uniqueValuesCache[f]):(a._uniqueValuesCache[f]=[a.getValue(f)],a._uniqueValuesCache[f])},renderValue:f=>{var c;return(c=a.getValue(f))!=null?c:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>At(a.subRows,f=>f.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let f=[],c=a;for(;;){const p=c.getParentRow();if(!p)break;f.push(p),c=p}return f.reverse()},getAllCells:y(()=>[e.getAllLeafColumns()],f=>f.map(c=>zt(e,a,c,c.id)),S(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:y(()=>[a.getAllCells()],f=>f.reduce((c,p)=>(c[p.column.id]=p,c),{}),S(e.options,"debugRows","getAllCellsByColumnId"))};for(let f=0;f<e._features.length;f++){const c=e._features[f];c==null||c.createRow==null||c.createRow(a,e)}return a},Ot={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()}}},qe=(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))};qe.autoRemove=e=>q(e);const Ue=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};Ue.autoRemove=e=>q(e);const Xe=(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())};Xe.autoRemove=e=>q(e);const Ze=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};Ze.autoRemove=e=>q(e);const We=(e,o,t)=>!t.some(n=>{var r;return!((r=e.getValue(o))!=null&&r.includes(n))});We.autoRemove=e=>q(e)||!(e!=null&&e.length);const Qe=(e,o,t)=>t.some(n=>{var r;return(r=e.getValue(o))==null?void 0:r.includes(n)});Qe.autoRemove=e=>q(e)||!(e!=null&&e.length);const Ye=(e,o,t)=>e.getValue(o)===t;Ye.autoRemove=e=>q(e);const Je=(e,o,t)=>e.getValue(o)==t;Je.autoRemove=e=>q(e);const Ve=(e,o,t)=>{let[n,r]=t;const s=e.getValue(o);return s>=n&&s<=r};Ve.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]};Ve.autoRemove=e=>q(e)||q(e[0])&&q(e[1]);const W={includesString:qe,includesStringSensitive:Ue,equalsString:Xe,arrIncludes:Ze,arrIncludesAll:We,arrIncludesSome:Qe,equals:Ye,weakEquals:Je,inNumberRange:Ve};function q(e){return e==null||e===""}const Tt={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:T("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"?W.includesString:typeof n=="number"?W.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?W.equals:Array.isArray(n)?W.arrIncludes:W.weakEquals},e.getFilterFn=()=>{var t,n;return de(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:W[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=Y(t,s?s.value:void 0);if(Oe(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 c;return(c=n==null?void 0:n.map(p=>p.id===e.id?f:p))!=null?c:[]}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=Y(o,r))==null?void 0:s.filter(i=>{const a=t.find(f=>f.id===i.id);if(a){const f=a.getFilterFn();if(Oe(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 Oe(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const Bt=(e,o,t)=>t.reduce((n,r)=>{const s=r.getValue(e);return n+(typeof s=="number"?s:0)},0),Kt=(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},qt=(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},Ut=(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]},Xt=(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},Zt=(e,o)=>{if(!o.length)return;const t=o.map(s=>s.getValue(e));if(!Dt(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},Wt=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Qt=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,Yt=(e,o)=>o.length,pe={sum:Bt,min:Kt,max:qt,extent:Ut,mean:Xt,median:Zt,unique:Wt,uniqueCount:Qt,count:Yt},Jt={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:T("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 pe.sum;if(Object.prototype.toString.call(n)==="[object Date]")return pe.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return de(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:pe[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 en(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 tn={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:T("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=y(t=>[se(o,t)],t=>t.findIndex(n=>n.id===e.id),S(o.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var n;return((n=se(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const r=se(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=y(()=>[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(),c=a.findIndex(p=>p.id===f);c>-1&&s.push(a.splice(c,1)[0])}s=[...s,...a]}return en(s,t,n)},S(e.options,"debugTable","_getOrderColumnsFn"))}},me=()=>({left:[],right:[]}),nn={getInitialState:e=>({columnPinning:me(),...e}),getDefaultOptions:e=>({onColumnPinningChange:T("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 c,p;return{left:[...((c=r==null?void 0:r.left)!=null?c:[]).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=y(()=>[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))},S(o.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=y(()=>[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"})),S(o.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=y(()=>[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"})),S(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?me():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:me())},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=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),S(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(r=>r.id===n)).filter(Boolean),S(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=y(()=>[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))},S(e.options,"debugColumns","getCenterLeafColumns"))}};function on(e){return e||(typeof document<"u"?document:null)}const fe={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},he=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),rn={getDefaultColumnDef:()=>fe,getInitialState:e=>({columnSizing:{},columnSizingInfo:he(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:T("columnSizing",e),onColumnSizingInfoChange:T("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:fe.minSize,(n=s??e.columnDef.size)!=null?n:fe.size),(r=e.columnDef.maxSize)!=null?r:fe.maxSize)},e.getStart=y(t=>[t,se(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((r,s)=>r+s.getSize(),0),S(o.options,"debugColumns","getStart")),e.getAfter=y(t=>[t,se(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((r,s)=>r+s.getSize(),0),S(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(),ve(s)&&s.touches&&s.touches.length>1))return;const i=e.getSize(),a=e?e.getLeafHeaders().map(v=>[v.column.id,v.column.getSize()]):[[n.id,n.getSize()]],f=ve(s)?Math.round(s.touches[0].clientX):s.clientX,c={},p=(v,C)=>{typeof C=="number"&&(o.setColumnSizingInfo(R=>{var $,F;const V=o.options.columnResizeDirection==="rtl"?-1:1,ee=(C-(($=R==null?void 0:R.startOffset)!=null?$:0))*V,D=Math.max(ee/((F=R==null?void 0:R.startSize)!=null?F:0),-.999999);return R.columnSizingStart.forEach(K=>{let[Q,A]=K;c[Q]=Math.round(Math.max(A+A*D,0)*100)/100}),{...R,deltaOffset:ee,deltaPercentage:D}}),(o.options.columnResizeMode==="onChange"||v==="end")&&o.setColumnSizing(R=>({...R,...c})))},g=v=>p("move",v),d=v=>{p("end",v),o.setColumnSizingInfo(C=>({...C,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=on(t),m={moveHandler:v=>g(v.clientX),upHandler:v=>{u==null||u.removeEventListener("mousemove",m.moveHandler),u==null||u.removeEventListener("mouseup",m.upHandler),d(v.clientX)}},h={moveHandler:v=>(v.cancelable&&(v.preventDefault(),v.stopPropagation()),g(v.touches[0].clientX),!1),upHandler:v=>{var C;u==null||u.removeEventListener("touchmove",h.moveHandler),u==null||u.removeEventListener("touchend",h.upHandler),v.cancelable&&(v.preventDefault(),v.stopPropagation()),d((C=v.touches[0])==null?void 0:C.clientX)}},x=sn()?{passive:!1}:!1;ve(s)?(u==null||u.addEventListener("touchmove",h.moveHandler,x),u==null||u.addEventListener("touchend",h.upHandler,x)):(u==null||u.addEventListener("mousemove",m.moveHandler,x),u==null||u.addEventListener("mouseup",m.upHandler,x)),o.setColumnSizingInfo(v=>({...v,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?he():(t=e.initialState.columnSizingInfo)!=null?t:he())},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 ce=null;function sn(){if(typeof ce=="boolean")return ce;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 ce=e,ce}function ve(e){return e.type==="touchstart"}const ln={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:T("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=y(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),S(o.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=y(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,r)=>[...t,...n,...r],S(o.options,"debugRows","getVisibleCells"))},createTable:e=>{const o=(t,n)=>y(()=>[n(),n().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),S(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 se(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const an={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()}}},un={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:T("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=()=>W.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return de(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:W[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},fn={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:T("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()}}}},Re=0,_e=10,xe=()=>({pageIndex:Re,pageSize:_e}),cn={getInitialState:e=>({...e,pagination:{...xe(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:T("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=>Y(n,s);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=n=>{var r;e.setPagination(n?xe():(r=e.initialState.pagination)!=null?r:xe())},e.setPageIndex=n=>{e.setPagination(r=>{let s=Y(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?Re:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:Re)},e.resetPageSize=n=>{var r,s;e.setPageSize(n?_e:(r=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:_e)},e.setPageSize=n=>{e.setPagination(r=>{const s=Math.max(1,Y(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=Y(n,(s=e.options.pageCount)!=null?s:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...r,pageCount:i}}),e.getPageOptions=y(()=>[e.getPageCount()],n=>{let r=[];return n&&n>0&&(r=[...new Array(n)].fill(null).map((s,i)=>i)),r},S(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}}},we=()=>({top:[],bottom:[]}),dn={getInitialState:e=>({rowPinning:we(),...e}),getDefaultOptions:e=>({onRowPinningChange:T("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,r)=>{const s=n?e.getLeafRows().map(f=>{let{id:c}=f;return c}):[],i=r?e.getParentRows().map(f=>{let{id:c}=f;return c}):[],a=new Set([...i,e.id,...s]);o.setRowPinning(f=>{var c,p;if(t==="bottom"){var g,d;return{top:((g=f==null?void 0:f.top)!=null?g:[]).filter(h=>!(a!=null&&a.has(h))),bottom:[...((d=f==null?void 0:f.bottom)!=null?d:[]).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:((c=f==null?void 0:f.top)!=null?c:[]).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?we():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:we())},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=y(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),S(e.options,"debugRows","getTopRows")),e.getBottomRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),S(e.options,"debugRows","getBottomRows")),e.getCenterRows=y(()=>[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))},S(e.options,"debugRows","getCenterRows"))}},gn={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:T("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=>{Fe(r,s.id,n,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=y(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?Ce(e,t):{rows:[],flatRows:[],rowsById:{}},S(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=y(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?Ce(e,t):{rows:[],flatRows:[],rowsById:{}},S(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=y(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?Ce(e,t):{rows:[],flatRows:[],rowsById:{}},S(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 Fe(a,e.id,t,(i=n==null?void 0:n.selectChildren)!=null?i:!0,o),a})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return Pe(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return je(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return je(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)}}}},Fe=(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=>Fe(e,a.id,t,n,r))};function Ce(e,o){const t=e.getState().rowSelection,n=[],r={},s=function(i,a){return i.map(f=>{var c;const p=Pe(f,t);if(p&&(n.push(f),r[f.id]=f),(c=f.subRows)!=null&&c.length&&(f={...f,subRows:s(f.subRows)}),p)return f}).filter(Boolean)};return{rows:s(o.rows),flatRows:n,rowsById:r}}function Pe(e,o){var t;return(t=o[e.id])!=null?t:!1}function je(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()&&(Pe(i,o)?s=!0:r=!1),i.subRows&&i.subRows.length)){const a=je(i,o);a==="all"?s=!0:(a==="some"&&(s=!0),r=!1)}}),r?"all":s?"some":!1}const Ie=/([0-9]+)/gm,pn=(e,o,t)=>et(J(e.getValue(t)).toLowerCase(),J(o.getValue(t)).toLowerCase()),mn=(e,o,t)=>et(J(e.getValue(t)),J(o.getValue(t))),hn=(e,o,t)=>ke(J(e.getValue(t)).toLowerCase(),J(o.getValue(t)).toLowerCase()),vn=(e,o,t)=>ke(J(e.getValue(t)),J(o.getValue(t))),xn=(e,o,t)=>{const n=e.getValue(t),r=o.getValue(t);return n>r?1:n<r?-1:0},wn=(e,o,t)=>ke(e.getValue(t),o.getValue(t));function ke(e,o){return e===o?0:e>o?1:-1}function J(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function et(e,o){const t=e.split(Ie).filter(Boolean),n=o.split(Ie).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 re={alphanumeric:pn,alphanumericCaseSensitive:mn,text:hn,textCaseSensitive:vn,datetime:xn,basic:wn},Cn={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:T("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 re.datetime;if(typeof s=="string"&&(n=!0,s.split(Ie).length>1))return re.alphanumeric}return n?re.text:re.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 de(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:re[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 c=[],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 d;c=[...i,{id:e.id,desc:g}],c.splice(0,c.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else p==="toggle"?c=i.map(u=>u.id===e.id?{...u,desc:g}:u):p==="remove"?c=i.filter(u=>u.id!==e.id):c=[{id:e.id,desc:g}];return c})},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())}},yn=[Gt,ln,tn,nn,Ot,Tt,an,un,Cn,Jt,fn,cn,dn,gn,rn];function Sn(e){var o,t;process.env.NODE_ENV!=="production"&&(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");const n=[...yn,...(o=e._features)!=null?o:[]];let r={_features:n};const s=r._features.reduce((d,u)=>Object.assign(d,u.getDefaultOptions==null?void 0:u.getDefaultOptions(r)),{}),i=d=>r.options.mergeOptions?r.options.mergeOptions(s,d):{...s,...d};let f={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(d=>{var u;f=(u=d.getInitialState==null?void 0:d.getInitialState(f))!=null?u:f});const c=[];let p=!1;const g={_features:n,options:{...s,...e},initialState:f,_queue:d=>{c.push(d),p||(p=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();p=!1}).catch(u=>setTimeout(()=>{throw u})))},reset:()=>{r.setState(r.initialState)},setOptions:d=>{const u=Y(d,r.options);r.options=i(u)},getState:()=>r.options.state,setState:d=>{r.options.onStateChange==null||r.options.onStateChange(d)},_getRowId:(d,u,m)=>{var h;return(h=r.options.getRowId==null?void 0:r.options.getRowId(d,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:(d,u)=>{let m=(u?r.getPrePaginationRowModel():r.getRowModel()).rowsById[d];if(!m&&(m=r.getCoreRowModel().rowsById[d],!m))throw process.env.NODE_ENV!=="production"?new Error(`getRow could not find row with ID: ${d}`):new Error;return m},_getDefaultColumnDef:y(()=>[r.options.defaultColumn],d=>{var u;return d=(u=d)!=null?u:{},{header:m=>{const h=m.header.column.columnDef;return h.accessorKey?h.accessorKey:h.accessorFn?h.id:null},cell:m=>{var h,x;return(h=(x=m.renderValue())==null||x.toString==null?void 0:x.toString())!=null?h:null},...r._features.reduce((m,h)=>Object.assign(m,h.getDefaultColumnDef==null?void 0:h.getDefaultColumnDef()),{}),...d}},S(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>r.options.columns,getAllColumns:y(()=>[r._getColumnDefs()],d=>{const u=function(m,h,x){return x===void 0&&(x=0),m.map(v=>{const C=Ht(r,v,x,h),R=v;return C.columns=R.columns?u(R.columns,C,x+1):[],C})};return u(d)},S(e,"debugColumns","getAllColumns")),getAllFlatColumns:y(()=>[r.getAllColumns()],d=>d.flatMap(u=>u.getFlatColumns()),S(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:y(()=>[r.getAllFlatColumns()],d=>d.reduce((u,m)=>(u[m.id]=m,u),{}),S(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:y(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(d,u)=>{let m=d.flatMap(h=>h.getLeafColumns());return u(m)},S(e,"debugColumns","getAllLeafColumns")),getColumn:d=>{const u=r._getAllFlatColumnsById()[d];return process.env.NODE_ENV!=="production"&&!u&&console.error(`[Table] Column with id '${d}' does not exist.`),u}};Object.assign(r,g);for(let d=0;d<r._features.length;d++){const u=r._features[d];u==null||u.createTable==null||u.createTable(r)}return r}function Rn(){return e=>y(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(r,s,i){s===void 0&&(s=0);const a=[];for(let c=0;c<r.length;c++){const p=Me(e,e._getRowId(r[c],c,i),r[c],c,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[c],c),(f=p.originalSubRows)!=null&&f.length&&(p.subRows=n(p.originalSubRows,s+1,p))}}return a};return t.rows=n(o),t},S(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function _n(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 Fn(e,o,t){return t.options.filterFromLeafRows?jn(e,o,t):In(e,o,t)}function jn(e,o,t){var n;const r=[],s={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,a=function(f,c){c===void 0&&(c=0);const p=[];for(let d=0;d<f.length;d++){var g;let u=f[d];const m=Me(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);if(m.columnFilters=u.columnFilters,(g=u.subRows)!=null&&g.length&&c<i){if(m.subRows=a(u.subRows,c+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 In(e,o,t){var n;const r=[],s={},i=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,a=function(f,c){c===void 0&&(c=0);const p=[];for(let d=0;d<f.length;d++){let u=f[d];if(o(u)){var g;if((g=u.subRows)!=null&&g.length&&c<i){const h=Me(t,u.id,u.original,u.index,u.depth,void 0,u.parentId);h.subRows=a(u.subRows,c+1),u=h}p.push(u),r.push(u),s[u.id]=u}}return p};return{rows:a(e),flatRows:r,rowsById:s}}function $n(){return e=>y(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let d=0;d<o.flatRows.length;d++)o.flatRows[d].columnFilters={},o.flatRows[d].columnFiltersMeta={};return o}const r=[],s=[];(t??[]).forEach(d=>{var u;const m=e.getColumn(d.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:d.id,filterFn:h,resolvedValue:(u=h.resolveFilterValue==null?void 0:h.resolveFilterValue(d.value))!=null?u:d.value})});const i=(t??[]).map(d=>d.id),a=e.getGlobalFilterFn(),f=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&a&&f.length&&(i.push("__global__"),f.forEach(d=>{var u;s.push({id:d.id,filterFn:a,resolvedValue:(u=a.resolveFilterValue==null?void 0:a.resolveFilterValue(n))!=null?u:n})}));let c,p;for(let d=0;d<o.flatRows.length;d++){const u=o.flatRows[d];if(u.columnFilters={},r.length)for(let m=0;m<r.length;m++){c=r[m];const h=c.id;u.columnFilters[h]=c.filterFn(u,h,c.resolvedValue,x=>{u.columnFiltersMeta[h]=x})}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,x=>{u.columnFiltersMeta[h]=x})){u.columnFilters.__global__=!0;break}}u.columnFilters.__global__!==!0&&(u.columnFilters.__global__=!1)}}const g=d=>{for(let u=0;u<i.length;u++)if(d.columnFilters[i[u]]===!1)return!1;return!0};return Fn(o.rows,g,e)},S(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Nn(e){return o=>y(()=>[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 c=r*s,p=c+r;i=i.slice(c,p);let g;o.options.paginateExpandedRows?g={rows:i,flatRows:a,rowsById:f}:g=_n({rows:i,flatRows:a,rowsById:f}),g.flatRows=[];const d=u=>{g.flatRows.push(u),u.subRows.length&&u.subRows.forEach(d)};return g.rows.forEach(d),g},S(o.options,"debugTable","getPaginationRowModel"))}function Mn(){return e=>y(()=>[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 c;return(c=e.getColumn(f.id))==null?void 0:c.getCanSort()}),i={};s.forEach(f=>{const c=e.getColumn(f.id);c&&(i[f.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const a=f=>{const c=f.map(p=>({...p}));return c.sort((p,g)=>{for(let u=0;u<s.length;u+=1){var d;const m=s[u],h=i[m.id],x=h.sortUndefined,v=(d=m==null?void 0:m.desc)!=null?d:!1;let C=0;if(x){const R=p.getValue(m.id),$=g.getValue(m.id),F=R===void 0,V=$===void 0;if(F||V){if(x==="first")return F?-1:1;if(x==="last")return F?1:-1;C=F&&V?0:F?x:-x}}if(C===0&&(C=h.sortingFn(p,g,m.id)),C!==0)return v&&(C*=-1),h.invertSorting&&(C*=-1),C}return p.index-g.index}),c.forEach(p=>{var g;r.push(p),(g=p.subRows)!=null&&g.length&&(p.subRows=a(p.subRows))}),c};return{rows:a(t.rows),flatRows:r,rowsById:t.rowsById}},S(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
69
|
+
* react-table
|
|
70
|
+
*
|
|
71
|
+
* Copyright (c) TanStack
|
|
72
|
+
*
|
|
73
|
+
* This source code is licensed under the MIT license found in the
|
|
74
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
75
|
+
*
|
|
76
|
+
* @license MIT
|
|
77
|
+
*/function Te(e,o){return e?Vn(e)?Se.createElement(e,o):e:null}function Vn(e){return Pn(e)||typeof e=="function"||kn(e)}function Pn(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function kn(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function bn(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=Se.useState(()=>({current:Sn(o)})),[n,r]=Se.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 $e=({editable:e=!0,deletable:o=!0,pageSize:t=25,onCellEdit:n,onRowDelete:r})=>{const{rows:s,schema:i,mappings:a,errorsByRow:f,editingCell:c,startEditing:p,stopEditing:g,updateCell:d,deleteRow:u}=ne(),[m,h]=E.useState([]),[x,v]=E.useState(""),[C,R]=E.useState(""),$=E.useMemo(()=>a.filter(j=>j.targetKey!==null).map(j=>{const I=i==null?void 0:i.columns.find(M=>M.key===j.targetKey);return{sourceColumn:j.sourceColumn,targetKey:j.targetKey,label:(I==null?void 0:I.label)||j.targetKey,type:(I==null?void 0:I.type)||"string"}}),[a,i]),F=E.useCallback((j,I)=>{const M=f.get(j);return M==null?void 0:M.find(O=>O.columnKey===I)},[f]),V=(j,I,M)=>{R(M),p(j,I)},ee=()=>{c&&(d(c.rowIndex,c.columnKey,C),n==null||n(c.rowIndex,c.columnKey,C)),g()},D=()=>{R(""),g()},K=j=>{u(j),r==null||r(j)},Q=Lt(),A=E.useMemo(()=>[Q.accessor("rowIndex",{header:"#",size:o?80:60,cell:j=>{const I=j.getValue();return l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[l.jsx("span",{className:"ff-font-mono ff-text-xs",style:{color:"var(--ff-text-muted)"},children:I+1}),o&&l.jsx("button",{onClick:M=>{M.stopPropagation(),K(I)},title:"Delete row",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"4px",borderRadius:"4px",cursor:"pointer",color:"#8e8d89",background:"transparent",border:"none",transition:"color 0.15s, background-color 0.15s",marginLeft:"2px",flexShrink:0},onMouseEnter:M=>{M.currentTarget.style.color="#d43338",M.currentTarget.style.backgroundColor="#fcdede"},onMouseLeave:M=>{M.currentTarget.style.color="#8e8d89",M.currentTarget.style.backgroundColor="transparent"},children:l.jsx(bt,{style:{width:"14px",height:"14px",display:"block"}})})]})}}),...$.map(j=>Q.accessor(I=>I.data[j.targetKey]||I.data[j.sourceColumn],{id:j.targetKey,header:j.label,cell:I=>{const M=I.row.original.rowIndex,O=String(I.getValue()??""),H=F(M,j.targetKey);return(c==null?void 0:c.rowIndex)===M&&(c==null?void 0:c.columnKey)===j.targetKey?l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2 ff-min-w-[280px]",children:[l.jsx("input",{type:"text",value:C,onChange:te=>R(te.target.value),onKeyDown:te=>{te.key==="Enter"&&ee(),te.key==="Escape"&&D()},className:"ff-input ff-py-2 ff-px-3 ff-text-sm ff-flex-1 ff-min-w-[160px]",autoFocus:!0}),l.jsx("button",{onClick:ee,className:"ff-btn ff-btn-primary ff-btn-sm ff-flex-shrink-0",children:"Save"}),l.jsx("button",{onClick:D,className:"ff-btn ff-btn-secondary ff-btn-sm ff-flex-shrink-0",children:"Cancel"})]}):l.jsxs("div",{className:w.clsx("ff-group ff-flex ff-items-center ff-gap-2",(H==null?void 0:H.severity)==="error"&&"ff-cell-error",(H==null?void 0:H.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:"—"})}),H&&l.jsxs("div",{className:"ff-relative ff-group/tooltip",children:[H.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:[H.message,H.suggestion&&l.jsx("span",{className:"ff-block ff-mt-1",style:{color:"var(--ff-text-muted)"},children:H.suggestion})]})]}),e&&l.jsx("button",{onClick:()=>V(M,j.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(Mt,{className:"ff-w-3 ff-h-3"})})]})}}))],[$,c,C,e,o,F,Q]),B=bn({data:s,columns:A,state:{sorting:m,globalFilter:x},onSortingChange:h,onGlobalFilterChange:v,getCoreRowModel:Rn(),getPaginationRowModel:Nn(),getSortedRowModel:Mn(),getFilteredRowModel:$n(),initialState:{pagination:{pageSize:t}}});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:x,onChange:j=>v(j.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:[B.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:B.getHeaderGroups().map(j=>l.jsx("tr",{children:j.headers.map(I=>l.jsx("th",{style:{width:I.getSize()},onClick:I.column.getToggleSortingHandler(),className:w.clsx(I.column.getCanSort()&&"ff-cursor-pointer ff-select-none"),children:l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-1",children:[Te(I.column.columnDef.header,I.getContext()),I.column.getIsSorted()&&l.jsx("span",{children:I.column.getIsSorted()==="asc"?"↑":"↓"})]})},I.id))},j.id))}),l.jsx("tbody",{children:B.getRowModel().rows.map(j=>{const I=f.has(j.original.rowIndex);return l.jsx("tr",{className:w.clsx(I&&"ff-row-error"),children:j.getVisibleCells().map(M=>l.jsx("td",{children:Te(M.column.columnDef.cell,M.getContext())},M.id))},j.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 ",B.getState().pagination.pageIndex+1," of ",B.getPageCount()]}),l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2",children:[l.jsxs("button",{onClick:()=>B.previousPage(),disabled:!B.getCanPreviousPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:[l.jsx(xt,{className:"ff-w-4 ff-h-4"}),"Previous"]}),l.jsxs("button",{onClick:()=>B.nextPage(),disabled:!B.getCanNextPage(),className:"ff-btn ff-btn-secondary ff-btn-sm",children:["Next",l.jsx(w.ChevronRight,{className:"ff-w-4 ff-h-4"})]})]})]})]})},Ne=({showDetails:e=!0})=>{const{validationResults:o}=ne();if(!o)return null;const{isValid:t,totalRows:n,validRows:r,errorCount:s,warningCount:i,infoCount:a,summary:f}=o,c=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 (",c,"%)"]})]})]}),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-xl 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",style:{backgroundColor:"var(--ff-bg-secondary)"},children:l.jsx("h4",{className:"ff-font-medium ff-text-sm",style:{color:"var(--ff-text-secondary)"},children:"Issues by Column"})}),l.jsx("div",{children:Object.entries(f.byColumn).filter(([,p])=>p.errorCount>0||p.warningCount>0).map(([p,g],d,u)=>l.jsxs("div",{className:"ff-flex ff-items-center ff-justify-between ff-px-4 ff-py-3",style:{borderTop:d>0?"1px solid var(--ff-border-light)":void 0},children:[l.jsxs("div",{className:"ff-flex-1 ff-min-w-0 ff-mr-4",children:[l.jsx("p",{className:"ff-font-medium ff-text-sm",style:{color:"var(--ff-text-primary)"},children:g.columnKey}),g.mostCommonError&&l.jsx("p",{className:"ff-text-sm ff-truncate",style:{color:"var(--ff-text-muted)"},children:g.mostCommonError})]}),l.jsxs("div",{className:"ff-flex ff-items-center ff-gap-2 ff-flex-shrink-0",children:[g.errorCount>0&&l.jsxs("span",{className:"ff-badge ff-badge-error ff-whitespace-nowrap",children:[l.jsx(w.CircleX,{className:"ff-w-3 ff-h-3 ff-mr-1"}),g.errorCount," ",g.errorCount===1?"error":"errors"]}),g.warningCount>0&&l.jsxs("span",{className:"ff-badge ff-badge-warning ff-whitespace-nowrap",children:[l.jsx(w.TriangleAlert,{className:"ff-w-3 ff-h-3 ff-mr-1"}),g.warningCount," ",g.warningCount===1?"warning":"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(d=>d+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"]})]})]})]})})]})},ye=["upload","mapping","validation","complete"],En=[{key:"upload",label:"Upload",icon:w.Upload},{key:"mapping",label:"Map Columns",icon:$t},{key:"validation",label:"Validate",icon:Pt},{key:"review",label:"Review",icon:St},{key:"complete",label:"Complete",icon:w.CircleCheckBig}],Ln=({template:e,schema:o,mode:t="modal",theme:n,useShadowDom:r=!1,onComplete:s,onCancel:i,onError:a})=>{const{step:f,sessionId:c,file:p,mappings:g,validationResults:d,isLoading:u,error:m,setSchema:h,setSessionId:x,setParsedData:v,setMappings:C,setUnmapped:R,setValidationResults:$,setStep:F,nextStep:V,previousStep:ee,setLoading:D,setError:K,reset:Q}=ne(),[A,B]=E.useState(null),[j,I]=E.useState(null),[M,O]=E.useState(0),[H,X]=E.useState("");E.useEffect(()=>{if(I(null),e)if(w.templateExists(e)){const _=w.getTemplateSchema(e);_?B(_):(I(`Failed to load template "${e}"`),a==null||a(new Error(`Failed to load template "${e}"`)))}else{const _=`Template "${e}" not found. Available templates: ${w.VALID_TEMPLATE_IDS.join(", ")}`;I(_),a==null||a(new Error(_))}else if(o)B(o);else{const _=`No template or schema provided. Please specify a template (${w.VALID_TEMPLATE_IDS.join(", ")}) or provide a custom schema.`;I(_),a==null||a(new Error(_))}},[e,o,a]),E.useEffect(()=>{A&&(h(A),te(A))},[A]);const te=async _=>{try{D(!0);const P=await w.getClient().createImportSession(_);x(P.sessionId)}catch(N){const P=N;K(P.message),a==null||a(P)}finally{D(!1)}},tt=_=>{const N=[];let P="",G=!1;for(let L=0;L<_.length;L++){const b=_[L];b==='"'?G&&_[L+1]==='"'?(P+='"',L++):G=!G:b===","&&!G?(N.push(P.trim()),P=""):P+=b}return N.push(P.trim()),N},nt=E.useCallback(async _=>{if(c)try{D(!0),K(null),C([]),R([],[]),$(null),O(10),X("Uploading file...");const N=w.getClient();O(20),X("Uploading to server...");const P=await N.uploadFile(c,_);O(40),X("Parsing all rows...");const L=(await _.text()).split(`
|
|
78
|
+
`).filter(Z=>Z.trim()),b=P.data.headers,U=L.slice(1).map((Z,ae)=>{const Ae=tt(Z),ze={};return b.forEach((ft,ct)=>{ze[ft]=Ae[ct]||""}),{rowIndex:ae,data:ze,rawData:Ae}});O(60),X("Processing rows..."),v({headers:b,rows:U,totalRows:U.length,sampleRows:U.slice(0,5)}),O(80),X("Matching columns..."),F("mapping"),await ot(),O(100),X("Done")}catch(N){K(`Failed to process the uploaded file: ${N.message}`)}finally{D(!1),O(0),X("")}},[c]),ot=async()=>{if(c)try{D(!0);const N=await w.getClient().matchColumns(c);C(N.mappings),R(N.unmappedSource,N.unmappedTarget)}catch(_){K(`Column matching failed: ${_.message}`)}finally{D(!1)}},rt=async()=>{if(c)try{D(!0),K(null);const N=await w.getClient().validateImport(c);$(N.validation),V()}catch(_){K(`Validation failed: ${_.message}`)}finally{D(!1)}},[be,le]=E.useState(null),[k,Ee]=E.useState(null),st=async()=>{if(c)try{D(!0),K(null),le(null);const P=await w.getClient().completeImport(c,{skipInvalidRows:!1,acknowledgeWarnings:!0}),G={...P,data:(P.data||[]).map(L=>L.data&&typeof L.data=="object"&&!Array.isArray(L.data)?{rowIndex:L.rowIndex??0,data:L.data,wasEdited:L.wasEdited??!1}:L)};Ee(G),F("complete"),s==null||s(G)}catch(_){le(_.message),F("complete")}finally{D(!1)}},ie=()=>{Q(),i==null||i()},Le=()=>{le(null),Ee(null),O(0),X(""),Q(),A&&(h(A),te(A))},lt=()=>En.findIndex(_=>_.key===f),it=()=>{switch(f){case"upload":return p!==null;case"mapping":return g.length>0&&g.some(_=>_.targetKey!==null);case"validation":return d!==null;case"review":return d!==null&&(d.isValid||d.errorCount===0);default:return!1}},at=async()=>{switch(f){case"mapping":await rt();break;case"validation":V();break;case"review":await st();break;default:V()}};if(j)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:j}),i&&l.jsx("button",{onClick:ie,className:"ff-btn ff-btn-secondary",children:"Close"})]})})});if(!A)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 oe=()=>{const _=f==="review"?"validation":f;return ye.indexOf(_)},ut=t==="embed"?"ff-container ff-embed":"ff-container ff-modal",De=l.jsx(l.Fragment,{children:l.jsxs("div",{className:ut,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(_t,{})}),l.jsx("h2",{className:"ff-modal-title",children:"Import Data"})]}),l.jsx("div",{className:"ff-steps ff-ml-4",children:ye.map((_,N)=>l.jsxs(E.Fragment,{children:[l.jsx("div",{className:w.clsx("ff-step",oe()===N&&"ff-step-active",oe()>N&&"ff-step-complete",oe()<N&&"ff-step-pending"),children:oe()>N?"✓":N+1}),N<ye.length-1&&l.jsx("div",{className:w.clsx("ff-step-connector",oe()>N&&"ff-step-connector-complete")})]},_))})]}),l.jsx("button",{onClick:ie,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:u&&M>0?l.jsxs("div",{className:"ff-p-8 ff-text-center",children:[l.jsx(w.LoaderCircle,{className:"ff-w-10 ff-h-10 ff-animate-spin ff-mx-auto ff-mb-4",style:{color:"var(--ff-primary-90)"}}),l.jsx("p",{className:"ff-font-medium ff-mb-2",style:{color:"var(--ff-text-primary)"},children:H}),l.jsx("div",{className:"ff-progress ff-w-full ff-max-w-xs ff-mx-auto ff-mb-2",children:l.jsx("div",{className:"ff-progress-bar",style:{width:`${M}%`,transition:"width 0.3s ease"}})}),l.jsxs("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:[M,"% complete"]})]}):l.jsx(Be,{onFileSelect:nt})})}),f==="mapping"&&(u&&M>0?l.jsxs("div",{className:"ff-py-12 ff-text-center",children:[l.jsx(w.LoaderCircle,{className:"ff-w-10 ff-h-10 ff-animate-spin ff-mx-auto ff-mb-4",style:{color:"var(--ff-primary-90)"}}),l.jsx("p",{className:"ff-font-medium ff-mb-3",style:{color:"var(--ff-text-primary)"},children:H}),l.jsx("div",{className:"ff-progress ff-w-full ff-max-w-xs ff-mx-auto ff-mb-2",children:l.jsx("div",{className:"ff-progress-bar",style:{width:`${M}%`,transition:"width 0.3s ease"}})}),l.jsxs("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:[M,"% complete"]})]}):l.jsx(Ke,{})),f==="validation"&&l.jsxs("div",{className:"ff-space-y-6",children:[l.jsx(Ne,{}),l.jsx($e,{editable:!0})]}),f==="review"&&l.jsxs("div",{className:"ff-space-y-6",children:[l.jsx(Ne,{showDetails:!1}),l.jsx($e,{editable:!1,pageSize:10})]}),f==="complete"&&l.jsx("div",{className:"ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8",children:be?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:be}),l.jsxs("div",{className:"ff-flex ff-gap-3",children:[l.jsx("button",{onClick:()=>{le(null),F("review")},className:"ff-btn ff-btn-secondary",children:"Back to Review"}),i&&l.jsx("button",{onClick:ie,className:"ff-btn ff-btn-secondary",children:"Close"})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ff-w-20 ff-h-20 ff-rounded-2xl ff-flex ff-items-center ff-justify-center ff-mb-6",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",{className:"ff-mb-6",style:{color:"var(--ff-text-muted)"},children:"Your data has been successfully imported."}),l.jsxs("div",{className:"ff-flex ff-gap-6 ff-mb-6",children:[l.jsxs("div",{className:"ff-text-center ff-px-6 ff-py-3 ff-rounded-xl ff-border",style:{borderColor:"var(--ff-border-light)",backgroundColor:"var(--ff-bg-primary)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-text-primary)"},children:(k==null?void 0:k.totalRows)??(d==null?void 0:d.totalRows)??0}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:"Total Rows"})]}),l.jsxs("div",{className:"ff-text-center ff-px-6 ff-py-3 ff-rounded-xl ff-border",style:{borderColor:"var(--ff-success)",backgroundColor:"var(--ff-success-light)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-success-dark)"},children:(k==null?void 0:k.importedRows)??(d==null?void 0:d.validRows)??0}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-success)"},children:"Imported"})]}),((k==null?void 0:k.skippedRows)??0)>0&&l.jsxs("div",{className:"ff-text-center ff-px-6 ff-py-3 ff-rounded-xl ff-border",style:{borderColor:"var(--ff-warning)",backgroundColor:"var(--ff-warning-light)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-warning-dark)"},children:(k==null?void 0:k.skippedRows)??0}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-warning)"},children:"Skipped"})]}),l.jsxs("div",{className:"ff-text-center ff-px-6 ff-py-3 ff-rounded-xl ff-border",style:{borderColor:"var(--ff-border-light)",backgroundColor:"var(--ff-bg-primary)"},children:[l.jsx("p",{className:"ff-text-2xl ff-font-bold",style:{color:"var(--ff-text-primary)"},children:g.filter(_=>_.targetKey!==null).length}),l.jsx("p",{className:"ff-text-sm",style:{color:"var(--ff-text-muted)"},children:"Columns Mapped"})]})]}),(k==null?void 0:k.data)&&k.data.length>0&&(()=>{const _=k.data.slice(0,5),N=_[0],P=(N==null?void 0:N.data)||N,G=Object.keys(typeof P=="object"?P:{}).slice(0,6),L=(A==null?void 0:A.columns)||[];return G.length===0?null:l.jsxs("div",{className:"ff-w-full ff-mb-6",children:[l.jsxs("p",{className:"ff-text-xs ff-font-semibold ff-uppercase ff-tracking-wider ff-mb-2",style:{color:"var(--ff-text-muted)"},children:["Data Preview (first ",_.length," rows)"]}),l.jsx("div",{className:"ff-table-container ff-max-h-[250px]",children:l.jsxs("table",{className:"ff-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:{width:40},children:"#"}),G.map(b=>{const U=L.find(Z=>Z.key===b);return l.jsx("th",{children:(U==null?void 0:U.label)||b},b)}),G.length<Object.keys(typeof P=="object"?P:{}).length&&l.jsx("th",{children:"..."})]})}),l.jsx("tbody",{children:_.map((b,U)=>{const Z=(b==null?void 0:b.data)||b;return l.jsxs("tr",{children:[l.jsx("td",{children:l.jsx("span",{className:"ff-font-mono ff-text-xs",style:{color:"var(--ff-text-muted)"},children:((b==null?void 0:b.rowIndex)??U)+1})}),G.map(ae=>l.jsx("td",{children:l.jsx("span",{className:"ff-text-sm ff-truncate ff-block ff-max-w-[150px]",children:String((Z==null?void 0:Z[ae])??"—")})},ae)),G.length<Object.keys(typeof P=="object"?P:{}).length&&l.jsx("td",{children:l.jsx("span",{style:{color:"var(--ff-text-muted)"},children:"..."})})]},U)})})]})}),k.data.length>5&&l.jsxs("p",{className:"ff-text-xs ff-mt-1",style:{color:"var(--ff-text-muted)"},children:["Showing 5 of ",k.data.length," imported rows"]})]})})(),l.jsxs("div",{className:"ff-flex ff-gap-3",children:[l.jsx("button",{onClick:Le,className:"ff-btn ff-btn-primary",children:"Start New Import"}),i&&l.jsx("button",{onClick:ie,className:"ff-btn ff-btn-secondary",children:"Close"})]})]})})]}),l.jsx("div",{className:"ff-modal-footer",children:f==="complete"?l.jsxs(l.Fragment,{children:[l.jsx("div",{}),l.jsx("button",{onClick:Le,className:"ff-btn ff-btn-primary",children:"Start New Import"})]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:ee,disabled:lt()===0||u,className:"ff-btn ff-btn-ghost",children:"Back"}),l.jsx("button",{onClick:at,disabled:!it()||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:De}):De})};exports.ColumnMapper=Ke;exports.DataTable=$e;exports.FileUploader=Be;exports.ImportWizard=Ln;exports.ValidationSummary=Ne;exports.useImportStore=ne;
|
|
79
|
+
//# sourceMappingURL=ImportWizard-C_B8FF5o.js.map
|