@ehfuse/mui-virtual-data-table 1.2.0 → 1.3.0

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var Dt=Object.create;var me=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Et=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty;var Ht=(o,d)=>{for(var l in d)me(o,l,{get:d[l],enumerable:!0})},Je=(o,d,l,w)=>{if(d&&typeof d=="object"||typeof d=="function")for(let m of Et(d))!It.call(o,m)&&m!==l&&me(o,m,{get:()=>d[m],enumerable:!(w=Lt(d,m))||w.enumerable});return o};var At=(o,d,l)=>(l=o!=null?Dt(Pt(o)):{},Je(d||!o||!o.__esModule?me(l,"default",{value:o,enumerable:!0}):l,o)),Nt=o=>Je(me({},"__esModule",{value:!0}),o);var $t={};Ht($t,{VirtualDataTable:()=>nt});module.exports=Nt($t);var a=require("react"),i=require("@mui/material"),et=require("react-virtuoso");var xe=require("react/jsx-runtime"),j=require("react"),ye=require("@mui/material"),re=function(){return re=Object.assign||function(d){for(var l,w=1,m=arguments.length;w<m;w++){l=arguments[w];for(var y in l)Object.prototype.hasOwnProperty.call(l,y)&&(d[y]=l[y])}return d},re.apply(this,arguments)};function Ue(o){var d=o.visible,l=o.onComplete,w=o.fadeoutDuration,m=w===void 0?200:w,y=o.exitDelay,oe=y===void 0?0:y,ae=o.size,G=ae===void 0?40:ae,X=o.className,J=o.style,I=o.sx,D=o.indicator,x=o.background,S=x===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:x,ie=(0,j.useRef)(void 0),B=(0,j.useRef)(null),se=(0,j.useState)(d),Ce=se[0],le=se[1],de=S.show,H=de===void 0?!0:de,O=S.color,L=O===void 0?"255, 255, 255":O,E=S.opacity,v=E===void 0?.9:E;if((0,j.useEffect)(function(){var F=ie.current;if(F===!0&&d===!1&&B.current){var z=B.current;z.style.opacity="0",setTimeout(function(){le(!1),l?.()},m+oe)}else d===!0&&(le(!0),B.current&&(B.current.style.opacity="1"));ie.current=d},[d,l,m,oe]),!Ce)return null;var ce=function(){return typeof D=="string"?(0,xe.jsx)("img",{src:D,alt:"Loading",style:{width:G,height:G}}):D||(0,xe.jsx)(ye.CircularProgress,{size:G})},we=function(){return H?L.startsWith("rgba")?{backgroundColor:L}:/^\d+,\s*\d+,\s*\d+$/.test(L)?{backgroundColor:"rgba(".concat(L,", ").concat(v,")")}:v!==1?{backgroundColor:L,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:L,opacity:v,zIndex:-1}}:{backgroundColor:L}:{backgroundColor:"transparent"}};return(0,xe.jsx)(ye.Box,{ref:B,className:X,style:re({},J),sx:re(re({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,opacity:d?1:0,transition:"opacity ".concat(m,"ms ease-out")},we()),I),children:ce()})}var Y=require("react/jsx-runtime"),Bt=`
1
+ "use strict";var jt=Object.create;var Me=Object.defineProperty;var Xt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty;var Jt=(a,c)=>{for(var l in c)Me(a,l,{get:c[l],enumerable:!0})},dt=(a,c,l,w)=>{if(c&&typeof c=="object"||typeof c=="function")for(let g of Kt(c))!Gt.call(a,g)&&g!==l&&Me(a,g,{get:()=>c[g],enumerable:!(w=Xt(c,g))||w.enumerable});return a};var Ut=(a,c,l)=>(l=a!=null?jt(qt(a)):{},dt(c||!a||!a.__esModule?Me(l,"default",{value:a,enumerable:!0}):l,a)),Zt=a=>dt(Me({},"__esModule",{value:!0}),a);var on={};Jt(on,{VirtualDataTable:()=>ht});module.exports=Zt(on);var o=require("react"),s=require("@mui/material"),ft=require("react-virtuoso");var Se=require("react/jsx-runtime"),X=require("react"),Re=require("@mui/material"),le=function(){return le=Object.assign||function(c){for(var l,w=1,g=arguments.length;w<g;w++){l=arguments[w];for(var C in l)Object.prototype.hasOwnProperty.call(l,C)&&(c[C]=l[C])}return c},le.apply(this,arguments)};function ct(a){var c=a.visible,l=a.onComplete,w=a.fadeoutDuration,g=w===void 0?200:w,C=a.exitDelay,de=C===void 0?0:C,ce=a.size,Z=ce===void 0?40:ce,q=a.className,Q=a.style,O=a.sx,P=a.indicator,x=a.background,L=x===void 0?{show:!0,color:"255, 255, 255",opacity:.9}:x,ue=(0,X.useRef)(void 0),z=(0,X.useRef)(null),pe=(0,X.useState)(c),ke=pe[0],fe=pe[1],ge=L.show,I=ge===void 0?!0:ge,F=L.color,A=F===void 0?"255, 255, 255":F,B=L.opacity,v=B===void 0?.9:B;if((0,X.useEffect)(function(){var W=ue.current;if(W===!0&&c===!1&&z.current){var $=z.current;$.style.opacity="0",setTimeout(function(){fe(!1),l?.()},g+de)}else c===!0&&(fe(!0),z.current&&(z.current.style.opacity="1"));ue.current=c},[c,l,g,de]),!ke)return null;var he=function(){return typeof P=="string"?(0,Se.jsx)("img",{src:P,alt:"Loading",style:{width:Z,height:Z}}):P||(0,Se.jsx)(Re.CircularProgress,{size:Z})},Le=function(){return I?A.startsWith("rgba")?{backgroundColor:A}:/^\d+,\s*\d+,\s*\d+$/.test(A)?{backgroundColor:"rgba(".concat(A,", ").concat(v,")")}:v!==1?{backgroundColor:A,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:A,opacity:v,zIndex:-1}}:{backgroundColor:A}:{backgroundColor:"transparent"}};return(0,Se.jsx)(Re.Box,{ref:z,className:q,style:le({},Q),sx:le(le({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,opacity:c?1:0,transition:"opacity ".concat(g,"ms ease-out")},Le()),O),children:he()})}var K=require("react/jsx-runtime"),Qt=`
2
2
  .vdt-css-spinner{box-sizing:border-box;border-radius:50%;border:4px solid rgba(28,64,125,0.14);border-top-color:#1c407d;animation:vdt-css-spinner-spin .75s linear infinite}
3
3
  @keyframes vdt-css-spinner-spin{to{transform:rotate(360deg)}}
4
- `;function Ze({size:o=54}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)("style",{children:Bt}),(0,Y.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:o,height:o}})]})}var tt=At(require("@ehfuse/overlay-scrollbar"),1),r=require("react/jsx-runtime"),Ot={alignment:"default",margin:0,radius:0},Oe=5,Ft={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7",emptyColor:"#9b9a97",selectedBg:"#dbeafe",selectedBar:"#3b82f6"},Qe="12px",zt={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36",emptyColor:"#7d8590",selectedBg:"rgba(59, 130, 246, 0.22)",selectedBar:"#60a5fa"};function Vt({data:o,loading:d=!1,columns:l,onRowClick:w,getRowId:m,selectedRowId:y,selectedRowSx:oe,rowHeight:ae,columnHeight:G,striped:X,rowDivider:J=!0,onSort:I,onLoadMore:D,sortBy:x,sortDirection:S,showPaper:ie=!0,paddingX:B,paddingTop:se=0,paddingBottom:Ce=0,rowHoverColor:le,rowHoverOpacity:de,viewportBuffer:H,overscan:O,scrollbars:L,emptyMessage:E="NO DATA",autoHeight:v=!1,LoadingComponent:ce,showFooter:we,footerHeight:F,footerSx:z,variant:rt="default",framed:U=!0,rowHeightMode:ot="fixed",tableLayout:Fe="fixed",renderFullWidthRow:ve,fullWidthRowSx:Z,onRowContextMenu:ze}){let f=rt==="notion",Me=(0,i.useTheme)(),h=Me.palette.mode==="dark"?zt:Ft,V=G??(f?40:56),R=ae??(f?48:50),ue=U?B??(f?"12px":"1rem"):0,Te=ot==="auto",Se=le??(f?h.hoverBg:void 0),Ve=de??(f?1:void 0),at=Math.max(R*12,480),it=Math.max(R*12,480),st=typeof H=="number"?H:H?.top??at,lt=typeof H=="number"?H:H?.bottom??it,dt=Math.max(R*8,420),ct=Math.max(R*10,520),ut=typeof O=="number"?O:{main:O?.main??dt,reverse:O?.reverse??ct},Q=R+(J?1:0),pt=(0,a.useMemo)(()=>f?{backgroundColor:h.selectedBg,"& > td:first-of-type":{boxShadow:`inset 3px 0 0 ${h.selectedBar}`},"& > td[data-vdt-pinned]":{backgroundColor:h.selectedBg}}:void 0,[f,h]),k=oe??pt,pe=!k||typeof k!="function",ft=(0,a.useMemo)(()=>!pe||y===null||y===void 0||!k?null:{[`& tbody tr[data-row-id="${String(y).replace(/["\\]/g,"\\$&")}"]`]:k},[pe,y,k]),_t=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[g]=(0,a.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),u=(0,a.useRef)({wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}),Re=(0,a.useCallback)(n=>{if(!g)return;let t=u.current;if(!(t.wheelEvents>0||t.rangeChangedCalls>0||t.rowContentCalls>0||t.cellRenderCalls>0))return;let c=t.rowContentCalls>0?t.rowContentMs/t.rowContentCalls:0,b=t.cellRenderCalls>0?t.cellRenderMs/t.cellRenderCalls:0;console.log("[VDT perf]",{reason:n,wheel:{events:t.wheelEvents,inputPx:Math.round(t.wheelInputPx),handlerMs:Number(t.wheelHandlerMs.toFixed(2)),rafFlushes:t.wheelRafFlushes,rafMs:Number(t.wheelRafMs.toFixed(2))},rangeChanged:{calls:t.rangeChangedCalls,totalMs:Number(t.rangeChangedMs.toFixed(2))},rowContent:{calls:t.rowContentCalls,totalMs:Number(t.rowContentMs.toFixed(2)),avgMs:Number(c.toFixed(3)),maxMs:Number(t.rowContentMaxMs.toFixed(3))},cellRender:{calls:t.cellRenderCalls,totalMs:Number(t.cellRenderMs.toFixed(2)),avgMs:Number(b.toFixed(3)),maxMs:Number(t.cellRenderMaxMs.toFixed(3))}}),u.current={wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}},[g]);(0,a.useEffect)(()=>{if(!g||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let n=window.setInterval(()=>{Re("interval")},1500);return()=>{window.clearInterval(n),Re("cleanup")}},[Re,g]);let $e=(0,a.useMemo)(()=>(0,a.forwardRef)((n,t)=>{let s=(0,a.useRef)(null),c=(0,a.useRef)(0),b=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=s.current;if(!e)return;let C=M=>{let A=g?performance.now():0;if(M.shiftKey||Math.abs(M.deltaX)>Math.abs(M.deltaY))return;M.preventDefault();let T=M.deltaY;M.deltaMode===1?T*=40:M.deltaMode===2&&(T*=e.clientHeight),g&&(u.current.wheelEvents+=1,u.current.wheelInputPx+=T),c.current+=T,b.current===null&&(b.current=requestAnimationFrame(()=>{let _=g?performance.now():0,N=Math.max(e.clientHeight*.4,160),p=Math.max(-N,Math.min(N,c.current));c.current=0,b.current=null,p!==0&&(e.scrollTop+=p),g&&(u.current.wheelRafFlushes+=1,u.current.wheelRafMs+=performance.now()-_)}),g&&(u.current.wheelHandlerMs+=performance.now()-A))};return e.addEventListener("wheel",C,{passive:!1}),()=>{e.removeEventListener("wheel",C),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),c.current=0}},[]),(0,r.jsx)(tt.default,{detectInnerScroll:!0,track:Ot,...L,children:(0,r.jsx)(i.TableContainer,{component:i.Box,...n,ref:e=>{s.current=e,typeof t=="function"?t(e):t&&(t.current=e)},sx:{userSelect:"auto",WebkitUserSelect:"auto",position:"relative",width:"100%",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none",msOverflowStyle:"none",transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"scroll-position","&::-webkit-scrollbar":{display:"none"},"& .MuiTable-root":{paddingRight:f?0:ue,paddingTop:se,paddingBottom:Ce}}})})}),[]),ke=(0,a.useMemo)(()=>{if(X===!0)return"#f5f5f5";if(typeof X=="string")return X},[X]),[gt,_e]=(0,a.useState)(d),[bt,ht]=(0,a.useState)(0);(0,a.useEffect)(()=>{d&&_e(!0)},[d]);let We=(0,a.useCallback)(()=>{_e(!1)},[]),mt=gt,Wt=d&&o.length>0,De=(0,a.useRef)(!1),Le=(0,a.useRef)(-1),Ee=(0,a.useRef)(null),Pe=(0,a.useRef)(w);Pe.current=w;let ee=(0,a.useRef)(m);ee.current=m;let Ie=(0,a.useRef)(ze);Ie.current=ze;let fe=(0,a.useMemo)(()=>{let n=new Map,t=0;return l.forEach(s=>{s.pinned==="left"&&(n.set(String(s.id),t),t+=typeof s.width=="number"?s.width:0)}),n},[l]),K=(0,a.useCallback)((n,t)=>{let s=fe.get(String(n.id));return s===void 0?{}:{position:"sticky",left:s,zIndex:t?3:1}},[fe]),ge=!!w,te=(0,a.useRef)(!1),$=(0,a.useRef)({x:0,y:0});(0,a.useEffect)(()=>{let n=t=>{let s=t.clientX-$.current.x,c=t.clientY-$.current.y;Math.sqrt(s*s+c*c)>Oe&&(te.current=!0)};return document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousemove",n)}},[]),(0,a.useEffect)(()=>{let n=document.querySelector('[data-testid="virtuoso-scroller"]');n&&n.querySelectorAll(".MuiTableSortLabel-root").forEach(s=>{let c=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});s.dispatchEvent(c)})},[x]);let be=(0,a.useCallback)(n=>{if(!I)return;I(n,x===n&&S==="asc"?"desc":"asc")},[I,x,S]),xt=(0,a.useCallback)(n=>{let t=g?performance.now():0;if(!D){g&&(u.current.rangeChangedCalls+=1,u.current.rangeChangedMs+=performance.now()-t);return}if(d&&o.length===0){g&&(u.current.rangeChangedCalls+=1,u.current.rangeChangedMs+=performance.now()-t);return}let s=o.length>=30,c=n>=o.length-1,b=Le.current===o.length;if(c&&s&&!De.current&&!b){De.current=!0,Le.current=o.length;let e=o.length;D(e,50)}g&&(u.current.rangeChangedCalls+=1,u.current.rangeChangedMs+=performance.now()-t)},[o.length,d,D,g]);(0,a.useEffect)(()=>{d||(De.current=!1)},[d]),(0,a.useEffect)(()=>{o.length===0&&ht(n=>n+1)},[o.length]);let He=(0,a.useRef)(o.length),Ae=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{let n=He.current,t=o.length,s=t>0?ee.current?ee.current(o[0],0):o[0]:void 0,c=Ae.current;if(t>n&&n>0){He.current=t,Ae.current=s;return}let b=t<n||n>0&&s!==c;b&&(Le.current=-1),Ee.current&&t>0&&b&&Ee.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),He.current=t,Ae.current=s},[o]);let je=(0,a.useCallback)(()=>{let n={},t=[];if(l.forEach(e=>{e.group?(n[e.group]||(n[e.group]=[]),n[e.group].push(e)):t.push(e)}),!(Object.keys(n).length>0))return(0,r.jsx)(i.TableRow,{children:l.map(e=>(0,r.jsx)(i.TableCell,{align:e.align||"left",...e.headerProps,style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...K(e,!0),...e.headerProps?.style},children:e.sortable?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(i.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>be(String(e.id)),children:[e.text,(0,r.jsx)(i.TableSortLabel,{active:x===e.id,direction:x===e.id?S:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===e.id?1:0,transition:"opacity 0.2s ease","& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id)))});let c=[...t.map(e=>(0,r.jsx)(i.TableCell,{rowSpan:2,align:e.align||"left",...e.headerProps,style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...K(e,!0),...e.headerProps?.style},children:e.sortable&&I?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(i.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>be(String(e.id)),children:[e.text,(0,r.jsx)(i.TableSortLabel,{active:x===e.id,direction:x===e.id?S:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):e.text},String(e.id))),...Object.entries(n).map(([e,C])=>(0,r.jsx)(i.TableCell,{align:"center",colSpan:C.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:e},e))],b=[...Object.values(n).flat().map(e=>(0,r.jsx)(i.TableCell,{align:e.align||"left",...e.headerProps,style:{width:e.width,minWidth:e.width,...e.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...K(e,!0),...e.headerProps?.style},children:e.sortable&&I?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:e.align==="center"?"center":e.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(i.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>be(String(e.id)),children:[e.text,(0,r.jsx)(i.TableSortLabel,{active:x===e.id,direction:x===e.id?S:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===e.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(0deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(180deg)"}}})]})}):e.text},String(e.id)))];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.TableRow,{children:c}),(0,r.jsx)(i.TableRow,{children:b})]})},[l,x,S,be,I,V,K]),Ye=(0,a.useCallback)((n,t)=>{let s=g?performance.now():0;if(!t){if(g){u.current.rowContentCalls+=1;let e=performance.now()-s;u.current.rowContentMs+=e,u.current.rowContentMaxMs=Math.max(u.current.rowContentMaxMs,e)}return null}let c=ve?ve(t,n):null;if(c!=null)return(0,r.jsx)(i.TableCell,{colSpan:l.length,"data-vdt-pad":"",sx:[{padding:f?"0 14px":"8px 16px"},...Array.isArray(Z)?Z:Z?[Z]:[]],children:c});let b=l.map(e=>{let C=g?performance.now():0,M=e.render?e.render(t,n):String(t[e.id]||"");if(g){let p=performance.now()-C;u.current.cellRenderCalls+=1,u.current.cellRenderMs+=p,u.current.cellRenderMaxMs=Math.max(u.current.cellRenderMaxMs,p)}let A=fe.has(String(e.id)),T=e.cellPadding!==void 0,_=e.rowSpan?e.rowSpan(t,n):1;if(_<=0)return null;let N=e.onCellClick;return(0,r.jsx)(i.TableCell,{align:e.align||"left",rowSpan:_>1?_:void 0,"data-vdt-pad":T?"":void 0,"data-vdt-pinned":A?"":void 0,"data-vdt-cell-click":N?"":void 0,onClick:N?p=>{let W=p.clientX-$.current.x,q=p.clientY-$.current.y;p.stopPropagation(),!(Math.sqrt(W*W+q*q)>Oe)&&N(t,n,p)}:void 0,style:{width:e.width,minWidth:e.width,...e.primary?{fontSize:15}:{},...e.style,...e.cellStyle?e.cellStyle(t,n):{},padding:T?e.cellPadding:"8px 16px",...K(e,!1)},children:M},String(e.id))});if(g){u.current.rowContentCalls+=1;let e=performance.now()-s;u.current.rowContentMs+=e,u.current.rowContentMaxMs=Math.max(u.current.rowContentMaxMs,e)}return(0,r.jsx)(r.Fragment,{children:b})},[l,g,ve,Z,f,fe,K]),P=we??l.some(n=>typeof n.footer=="function"),Xe=(0,a.useCallback)(()=>{if(!P)return null;let n=[];for(let t=0;t<l.length;t+=1){let s=l[t],c=s.footerColSpan&&s.footerColSpan>1?Math.min(s.footerColSpan,l.length-t):1;n.push((0,r.jsx)(i.TableCell,{align:s.align||"left",colSpan:c>1?c:void 0,style:{...c>1?{}:{width:s.width,minWidth:s.width},...s.style,fontWeight:"bold",padding:f?"0 14px":"16px"},children:s.footer?s.footer(o):null},String(s.id))),t+=c-1}return(0,r.jsx)(i.TableRow,{children:n})},[P,l,o,f]),Ke=(0,a.useMemo)(()=>({Scroller:$e,Table:n=>(0,r.jsx)(i.Table,{...n,sx:{borderCollapse:"separate",tableLayout:Fe,marginRight:U?"16px":0,...P?{height:"100%"}:{}}}),TableHead:(0,a.forwardRef)((n,t)=>(0,r.jsx)(i.TableHead,{...n,ref:t,sx:{userSelect:"none","& tr":{height:V,"& th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:n=>{let{item:t,selected:s,"aria-selected":c,className:b,...e}=n,C=e["data-index"]??0,M=C%2===1,A=t&&ee.current?ee.current(t,C):C,T=!pe&&y!==null&&y!==void 0&&A===y,_=T&&k?typeof k=="function"?k(t,C):k:void 0,N=String(b??"").split(/\s+/).filter(p=>p!=="Mui-selected"&&p!=="Mui-focusVisible").join(" ");return(0,r.jsx)(i.TableRow,{...e,"data-row-id":A!=null?String(A):void 0,className:N||void 0,selected:T,onMouseDown:p=>{te.current=!1,$.current={x:p.clientX,y:p.clientY}},onContextMenu:p=>{t&&Ie.current&&Ie.current(t,C,p)},onClick:p=>{let W=p.clientX-$.current.x,q=p.clientY-$.current.y;if(Math.sqrt(W*W+q*q)>Oe||te.current){p.preventDefault(),p.stopPropagation(),te.current=!1;return}t&&Pe.current&&Pe.current(t,C),te.current=!1},sx:[{userSelect:"none",...Te?{"& > td":{height:Q}}:{height:Q,maxHeight:Q},boxSizing:"border-box",backgroundColor:M&&ke?ke:"transparent","& td:not([data-vdt-pad])":{padding:"8px 16px"},"& td":{boxSizing:"border-box",borderBottom:J?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":ge&&!T?{backgroundColor:p=>{let W=p.palette.mode==="dark",Ne=Se??"#000000",Be=Ve??.06;if(!Se)return W?`rgba(255, 255, 255, ${Be})`:`rgba(0, 0, 0, ${Be})`;let he=Ne.replace("#","").trim();if(he.length!==6)return Ne;let St=parseInt(he.substring(0,2),16),Rt=parseInt(he.substring(2,4),16),kt=parseInt(he.substring(4,6),16);return`rgba(${St}, ${Rt}, ${kt}, ${Be})`}}:void 0,cursor:ge?"pointer":void 0},_]})},TableBody:(0,a.forwardRef)((n,t)=>{let{children:s,...c}=n;return(0,r.jsxs)(i.TableBody,{...c,ref:t,sx:P?{height:"100%"}:void 0,children:[s,P&&(0,r.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,r.jsx)("td",{colSpan:l.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,a.forwardRef)((n,t)=>(0,r.jsx)(i.TableFooter,{...n,ref:t,sx:[{"& tr":{height:F??R,maxHeight:F??R,boxSizing:"border-box"},"& td":{height:F??R,boxSizing:"border-box",backgroundColor:s=>s.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:`inset 0 1px 0 0 ${f?h.borderStrong:"#000000"}`}},...Array.isArray(z)?z:z?[z]:[]]}))}),[ge,pe?null:y,k,R,ke,J,V,Se,Ve,$e,F,z,P,f,h,l,Fe,U,Te]),yt=Ke,ne=Ke,Ct=ne.Table,wt=ne.TableHead,vt=ne.TableBody,Mt=ne.TableRow,Tt=ne.TableFoot,qe=(0,r.jsxs)(i.Box,{sx:{position:"relative",height:v?"auto":"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:n=>n.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...ft??{},"& tbody td[data-vdt-pinned]":{backgroundColor:f?h.bg:Me.palette.background.paper},"& tbody td[data-vdt-cell-click]":{cursor:"pointer"},"& tbody td[data-vdt-cell-click]:hover":{backgroundColor:f?h.hoverBg:Me.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"},...f&&ge?{"& tbody tr:hover td[data-vdt-pinned]":{backgroundColor:h.hoverBg}}:{},...f?{...U?{border:`1px solid ${h.borderStrong}`,borderRadius:"4px"}:{"& table":{backgroundColor:h.bg}},overflow:"hidden","& thead tr th":{height:V,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:h.headerColor,backgroundColor:`${h.bg} !important`,borderTop:"none",borderBottom:`1px solid ${h.borderStrong}`,borderRight:`1px solid ${h.border}`,"&:last-of-type":{borderRight:"none"}},"& tbody tr td:not([data-vdt-pad])":{padding:"0 14px !important"},"& tbody tr td":{fontSize:14,borderBottom:`1px solid ${h.border}`}}:{}},children:[v?(0,r.jsx)(i.Box,{sx:{overflowX:"auto",width:"100%"},children:(0,r.jsxs)(Ct,{children:[(0,r.jsx)(wt,{children:je()}),(0,r.jsx)(vt,{children:o.map((n,t)=>(0,r.jsx)(Mt,{item:n,"data-index":t,children:Ye(t,n)},m?String(m(n,t)):t))}),P?(0,r.jsx)(Tt,{children:Xe()}):null]})}):(0,r.jsx)(et.TableVirtuoso,{ref:Ee,data:o,totalCount:D?o.length+1:o.length,defaultItemHeight:Q,fixedItemHeight:Te?void 0:Q,fixedHeaderContent:je,fixedFooterContent:P?Xe:void 0,itemContent:Ye,endReached:xt,style:{height:"100%"},increaseViewportBy:{top:st,bottom:lt},overscan:ut,followOutput:!1,components:yt},bt),o.length===0&&!d&&f&&typeof E=="string"&&(0,r.jsx)(i.Box,{sx:{position:v?"static":"absolute",top:V,left:0,right:0,py:6,textAlign:"center",fontSize:14,color:h.emptyColor},children:E}),o.length===0&&!d&&!(f&&typeof E=="string")&&(0,r.jsx)(i.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2},children:typeof E=="string"?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,r.jsx)(i.Typography,{variant:"body1",sx:{color:"text.secondary"},children:E})]}):E}),mt&&(0,r.jsx)(r.Fragment,{children:ce?(0,r.jsx)(ce,{visible:d,onComplete:We}):(0,r.jsx)(Ue,{visible:d,onComplete:We,size:40,indicator:(0,r.jsx)(Ze,{}),sx:{top:`${l.some(n=>n.group)?V*2:V}px`,bottom:`${P?F??R:0}px`},background:{show:o.length===0,opacity:.8}})})]}),Ge=f&&U?{paddingRight:ue,paddingTop:Qe,paddingBottom:Qe}:{};return ie?(0,r.jsx)(i.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:ue,...Ge,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:qe}):(0,r.jsx)(i.Box,{className:"grow",style:{padding:0,paddingLeft:ue,...Ge,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:qe})}var nt=(0,a.memo)(Vt);
4
+ `;function ut({size:a=54}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("style",{children:Qt}),(0,K.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:a,height:a}})]})}var gt=Ut(require("@ehfuse/overlay-scrollbar"),1),r=require("react/jsx-runtime"),en={alignment:"default",margin:0,radius:0},Xe=5,tn={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7",emptyColor:"#9b9a97",selectedBg:"#dbeafe",selectedBar:"#3b82f6"},pt="12px",nn={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36",emptyColor:"#7d8590",selectedBg:"rgba(59, 130, 246, 0.22)",selectedBar:"#60a5fa"};function rn({data:a,loading:c=!1,columns:l,onRowClick:w,getRowId:g,selectedRowId:C,selectedRowSx:de,rowHeight:ce,columnHeight:Z,striped:q,rowDivider:Q=!0,onSort:O,onLoadMore:P,sortBy:x,sortDirection:L,showPaper:ue=!0,paddingX:z,paddingTop:pe=0,paddingBottom:ke=0,rowHoverColor:fe,rowHoverOpacity:ge,viewportBuffer:I,overscan:F,scrollbars:A,emptyMessage:B="NO DATA",autoHeight:v=!1,LoadingComponent:he,showFooter:Le,footerHeight:W,footerSx:$,variant:bt="default",framed:ee=!0,rowHeightMode:mt="fixed",tableLayout:be="fixed",renderFullWidthRow:De,fullWidthRowSx:te,onRowContextMenu:Ke,pinnedRows:ne,pinnedRowsMaxHeight:Ee,pinnedRowsSx:re,resetScrollOnDataChange:qe=!0,rowKeyFromId:yt=!1,onEndReached:Ge,colorMode:xt}){let f=bt==="notion",He=(0,s.useTheme)(),h=(xt??He.palette.mode)==="dark"?nn:tn,Je=(ne?.length??0)>0,V=Z??(f?40:56),D=ce??(f?48:50),me=ee?z??(f?"12px":"1rem"):0,Pe=mt==="auto",Ae=fe??(f?h.hoverBg:void 0),Ue=ge??(f?1:void 0),Ct=Math.max(D*12,480),wt=Math.max(D*12,480),vt=typeof I=="number"?I:I?.top??Ct,Tt=typeof I=="number"?I:I?.bottom??wt,Mt=Math.max(D*8,420),St=Math.max(D*10,520),Rt=typeof F=="number"?F:{main:F?.main??Mt,reverse:F?.reverse??St},oe=D+(Q?1:0),kt=(0,o.useMemo)(()=>f?{backgroundColor:h.selectedBg,"& > td:first-of-type":{boxShadow:`inset 3px 0 0 ${h.selectedBar}`},"& > td[data-vdt-pinned]":{backgroundColor:h.selectedBg}}:void 0,[f,h]),E=de??kt,ye=!E||typeof E!="function",Lt=(0,o.useMemo)(()=>!ye||C===null||C===void 0||!E?null:{[`& tbody tr[data-row-id="${String(C).replace(/["\\]/g,"\\$&")}"]`]:E},[ye,C,E]),an=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),[m]=(0,o.useState)(()=>typeof window>"u"?!1:window.localStorage.getItem("vdt-perf-debug")==="1"),p=(0,o.useRef)({wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}),Be=(0,o.useCallback)(t=>{if(!m)return;let e=p.current;if(!(e.wheelEvents>0||e.rangeChangedCalls>0||e.rowContentCalls>0||e.cellRenderCalls>0))return;let u=e.rowContentCalls>0?e.rowContentMs/e.rowContentCalls:0,b=e.cellRenderCalls>0?e.cellRenderMs/e.cellRenderCalls:0;console.log("[VDT perf]",{reason:t,wheel:{events:e.wheelEvents,inputPx:Math.round(e.wheelInputPx),handlerMs:Number(e.wheelHandlerMs.toFixed(2)),rafFlushes:e.wheelRafFlushes,rafMs:Number(e.wheelRafMs.toFixed(2))},rangeChanged:{calls:e.rangeChangedCalls,totalMs:Number(e.rangeChangedMs.toFixed(2))},rowContent:{calls:e.rowContentCalls,totalMs:Number(e.rowContentMs.toFixed(2)),avgMs:Number(u.toFixed(3)),maxMs:Number(e.rowContentMaxMs.toFixed(3))},cellRender:{calls:e.cellRenderCalls,totalMs:Number(e.cellRenderMs.toFixed(2)),avgMs:Number(b.toFixed(3)),maxMs:Number(e.cellRenderMaxMs.toFixed(3))}}),p.current={wheelEvents:0,wheelInputPx:0,wheelHandlerMs:0,wheelRafFlushes:0,wheelRafMs:0,rangeChangedCalls:0,rangeChangedMs:0,rowContentCalls:0,rowContentMs:0,rowContentMaxMs:0,cellRenderCalls:0,cellRenderMs:0,cellRenderMaxMs:0}},[m]);(0,o.useEffect)(()=>{if(!m||typeof window>"u")return;console.log("[VDT perf] enabled (localStorage vdt-perf-debug=1)");let t=window.setInterval(()=>{Be("interval")},1500);return()=>{window.clearInterval(t),Be("cleanup")}},[Be,m]);let Ze=(0,o.useMemo)(()=>(0,o.forwardRef)((t,e)=>{let i=(0,o.useRef)(null),u=(0,o.useRef)(0),b=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let n=i.current;if(!n)return;let d=T=>{let S=m?performance.now():0;if(T.shiftKey||Math.abs(T.deltaX)>Math.abs(T.deltaY))return;let M=T.target?.closest?.("[data-vdt-inner-scroll]");if(M&&n.contains(M)&&(T.deltaY<0?M.scrollTop>0:M.scrollTop+M.clientHeight<M.scrollHeight-1))return;T.preventDefault();let N=T.deltaY;T.deltaMode===1?N*=40:T.deltaMode===2&&(N*=n.clientHeight),m&&(p.current.wheelEvents+=1,p.current.wheelInputPx+=N),u.current+=N,b.current===null&&(b.current=requestAnimationFrame(()=>{let J=m?performance.now():0,y=Math.max(n.clientHeight*.4,160),R=Math.max(-y,Math.min(y,u.current));u.current=0,b.current=null,R!==0&&(n.scrollTop+=R),m&&(p.current.wheelRafFlushes+=1,p.current.wheelRafMs+=performance.now()-J)}),m&&(p.current.wheelHandlerMs+=performance.now()-S))};return n.addEventListener("wheel",d,{passive:!1}),()=>{n.removeEventListener("wheel",d),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),u.current=0}},[]),(0,r.jsx)(gt.default,{detectInnerScroll:!0,track:en,...A,children:(0,r.jsx)(s.TableContainer,{component:s.Box,...t,ref:n=>{i.current=n,typeof e=="function"?e(n):e&&(e.current=n)},sx:{userSelect:"auto",WebkitUserSelect:"auto",position:"relative",width:"100%",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none",msOverflowStyle:"none",transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"scroll-position","&::-webkit-scrollbar":{display:"none"},"& .MuiTable-root":{paddingRight:f?0:me,paddingTop:pe,paddingBottom:ke}}})})}),[]),Oe=(0,o.useMemo)(()=>{if(q===!0)return"#f5f5f5";if(typeof q=="string")return q},[q]),[Dt,Qe]=(0,o.useState)(c),[Et,Ht]=(0,o.useState)(0);(0,o.useEffect)(()=>{c&&Qe(!0)},[c]);let et=(0,o.useCallback)(()=>{Qe(!1)},[]),Pt=Dt,sn=c&&a.length>0,Ie=(0,o.useRef)(!1),Ne=(0,o.useRef)(-1),ze=(0,o.useRef)(null),Fe=(0,o.useRef)(null),[At,Bt]=(0,o.useState)(!1),xe=(0,o.useCallback)(()=>{let t=Fe.current;t&&Bt(t.scrollHeight>t.clientHeight+1)},[]);(0,o.useEffect)(()=>{let t=Fe.current;if(!t||typeof ResizeObserver>"u")return;let e=new ResizeObserver(()=>xe());return e.observe(t),()=>e.disconnect()},[xe,v]);let We=(0,o.useRef)(w);We.current=w;let ae=(0,o.useRef)(g);ae.current=g;let $e=(0,o.useRef)(Ke);$e.current=Ke;let tt=(0,o.useRef)(Ge);tt.current=Ge;let nt=(0,o.useRef)(null),Ce=(0,o.useMemo)(()=>{let t=new Map,e=0;return l.forEach(i=>{i.pinned==="left"&&(t.set(String(i.id),e),e+=typeof i.width=="number"?i.width:0)}),t},[l]),Ve=(0,o.useMemo)(()=>{if(l.some(t=>typeof t.minWidth=="number"))return l.reduce((t,e)=>t+(typeof e.width=="number"?e.width:typeof e.minWidth=="number"?e.minWidth:0),0)},[l]),G=(0,o.useCallback)((t,e)=>{let i=Ce.get(String(t.id));return i===void 0?{}:{position:"sticky",left:i,zIndex:e?3:1}},[Ce]),we=!!w,ie=(0,o.useRef)(!1),_=(0,o.useRef)({x:0,y:0});(0,o.useEffect)(()=>{let t=e=>{let i=e.clientX-_.current.x,u=e.clientY-_.current.y;Math.sqrt(i*i+u*u)>Xe&&(ie.current=!0)};return document.addEventListener("mousemove",t),()=>{document.removeEventListener("mousemove",t)}},[]),(0,o.useEffect)(()=>{let t=document.querySelector('[data-testid="virtuoso-scroller"]');t&&t.querySelectorAll(".MuiTableSortLabel-root").forEach(i=>{let u=new MouseEvent("mouseleave",{bubbles:!0,cancelable:!0});i.dispatchEvent(u)})},[x]);let ve=(0,o.useCallback)(t=>{if(!O)return;O(t,x===t&&L==="asc"?"desc":"asc")},[O,x,L]),Ot=(0,o.useCallback)(t=>{let e=m?performance.now():0;if(tt.current?.(),!P){m&&(p.current.rangeChangedCalls+=1,p.current.rangeChangedMs+=performance.now()-e);return}if(c&&a.length===0){m&&(p.current.rangeChangedCalls+=1,p.current.rangeChangedMs+=performance.now()-e);return}let i=a.length>=30,u=t>=a.length-1,b=Ne.current===a.length;if(u&&i&&!Ie.current&&!b){Ie.current=!0,Ne.current=a.length;let n=a.length;P(n,50)}m&&(p.current.rangeChangedCalls+=1,p.current.rangeChangedMs+=performance.now()-e)},[a.length,c,P,m]);(0,o.useEffect)(()=>{c||(Ie.current=!1)},[c]),(0,o.useEffect)(()=>{a.length===0&&Ht(t=>t+1)},[a.length]);let rt=(0,o.useRef)(qe);rt.current=qe;let _e=(0,o.useRef)(a.length),Ye=(0,o.useRef)(void 0);(0,o.useEffect)(()=>{let t=_e.current,e=a.length,i=e>0?ae.current?ae.current(a[0],0):a[0]:void 0,u=Ye.current;if(e>t&&t>0){_e.current=e,Ye.current=i;return}let b=e<t||t>0&&i!==u;b&&(Ne.current=-1),ze.current&&e>0&&b&&rt.current&&ze.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),_e.current=e,Ye.current=i},[a]);let ot=(0,o.useCallback)(()=>{let t={},e=[];if(l.forEach(n=>{n.group?(t[n.group]||(t[n.group]=[]),t[n.group].push(n)):e.push(n)}),!(Object.keys(t).length>0))return(0,r.jsx)(s.TableRow,{children:l.map(n=>(0,r.jsx)(s.TableCell,{align:n.align||"left",...n.headerProps,style:{width:n.width,minWidth:n.width??n.minWidth,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...G(n,!0),...n.headerProps?.style},children:n.sortable?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(s.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ve(String(n.id)),children:[n.text,(0,r.jsx)(s.TableSortLabel,{active:x===n.id,direction:x===n.id?L:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===n.id?1:0,transition:"opacity 0.2s ease","& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):n.text},String(n.id)))});let u=[...e.map(n=>(0,r.jsx)(s.TableCell,{rowSpan:2,align:n.align||"left",...n.headerProps,style:{width:n.width,minWidth:n.width,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...G(n,!0),...n.headerProps?.style},children:n.sortable&&O?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(s.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ve(String(n.id)),children:[n.text,(0,r.jsx)(s.TableSortLabel,{active:x===n.id,direction:x===n.id?L:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===n.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(180deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(0deg)"}}})]})}):n.text},String(n.id))),...Object.entries(t).map(([n,d])=>(0,r.jsx)(s.TableCell,{align:"center",colSpan:d.length,style:{fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px"},children:n},n))],b=[...Object.values(t).flat().map(n=>(0,r.jsx)(s.TableCell,{align:n.align||"left",...n.headerProps,style:{width:n.width,minWidth:n.width,...n.style,fontWeight:"bold",position:"sticky",top:0,zIndex:2,padding:"16px",...G(n,!0),...n.headerProps?.style},children:n.sortable&&O?(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:n.align==="center"?"center":n.align==="right"?"flex-end":"flex-start",position:"relative",width:"100%"},children:(0,r.jsxs)(s.Box,{sx:{position:"relative",cursor:"default","&:hover .MuiTableSortLabel-root":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}}},onClick:()=>ve(String(n.id)),children:[n.text,(0,r.jsx)(s.TableSortLabel,{active:x===n.id,direction:x===n.id?L:"desc",sx:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"4px",minWidth:"auto",width:"16px",height:"16px",cursor:"default",opacity:x===n.id?1:0,transition:"opacity 0.2s ease","&:hover":{opacity:"1 !important","& .MuiSvgIcon-root":{color:"#000",opacity:"1 !important"}},"& .MuiTableSortLabel-icon":{position:"relative",marginLeft:0,marginRight:0,opacity:1,transition:"color 0.2s ease"},"& .MuiTableSortLabel-iconDirectionAsc":{transform:"rotate(0deg)"},"& .MuiTableSortLabel-iconDirectionDesc":{transform:"rotate(180deg)"}}})]})}):n.text},String(n.id)))];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.TableRow,{children:u}),(0,r.jsx)(s.TableRow,{children:b})]})},[l,x,L,ve,O,V,G]),Te=(0,o.useCallback)((t,e)=>{let i=m?performance.now():0;if(!e){if(m){p.current.rowContentCalls+=1;let d=performance.now()-i;p.current.rowContentMs+=d,p.current.rowContentMaxMs=Math.max(p.current.rowContentMaxMs,d)}return null}let u=De?De(e,t):null;if(u!=null)return(0,r.jsx)(s.TableCell,{colSpan:l.length,"data-vdt-pad":"",sx:[{padding:f?"0 14px":"8px 16px"},...Array.isArray(te)?te:te?[te]:[]],children:u});let b=0,n=l.map((d,T)=>{if(b>0)return b-=1,null;let S=d.colSpan?Math.max(1,Math.min(d.colSpan(e,t),l.length-T)):1;b=S-1;let M=m?performance.now():0,N=d.render?d.render(e,t):String(e[d.id]||"");if(m){let k=performance.now()-M;p.current.cellRenderCalls+=1,p.current.cellRenderMs+=k,p.current.cellRenderMaxMs=Math.max(p.current.cellRenderMaxMs,k)}let J=Ce.has(String(d.id)),y=d.cellPadding!==void 0,R=d.rowSpan?d.rowSpan(e,t):1;if(R<=0)return null;let Y=d.onCellClick;return(0,r.jsx)(s.TableCell,{align:d.align||"left",rowSpan:R>1?R:void 0,colSpan:S>1?S:void 0,"data-vdt-pad":y?"":void 0,"data-vdt-pinned":J?"":void 0,"data-vdt-cell-click":Y?"":void 0,onClick:Y?k=>{let U=k.clientX-_.current.x,j=k.clientY-_.current.y;k.stopPropagation(),!(Math.sqrt(U*U+j*j)>Xe)&&Y(e,t,k)}:void 0,style:{...S>1?{}:{width:d.width,minWidth:d.width??d.minWidth},...d.primary?{fontSize:15}:{},...d.style,...d.cellStyle?d.cellStyle(e,t):{},padding:y?d.cellPadding:"8px 16px",...G(d,!1)},children:N},String(d.id))});if(m){p.current.rowContentCalls+=1;let d=performance.now()-i;p.current.rowContentMs+=d,p.current.rowContentMaxMs=Math.max(p.current.rowContentMaxMs,d)}return(0,r.jsx)(r.Fragment,{children:n})},[l,m,De,te,f,Ce,G]),at=(0,o.useCallback)(()=>{let t=ot();if(!ne||ne.length===0)return t;let e=nt.current;return(0,r.jsxs)(r.Fragment,{children:[t,(0,r.jsx)("tr",{"data-vdt-pinned-area":"",children:(0,r.jsx)("td",{colSpan:l.length,style:{padding:0,border:0},children:(0,r.jsx)(s.Box,{"data-vdt-inner-scroll":"",sx:[{maxHeight:Ee,overflowY:Ee?"auto":"visible",overflowX:"hidden",scrollbarWidth:"thin",borderBottom:`1px solid ${f?h.borderStrong:"rgba(224, 224, 224, 1)"}`,"& tbody tr:last-of-type > td":{borderBottom:"none"}},...Array.isArray(re)?re:re?[re]:[]],children:(0,r.jsxs)("table",{style:{width:"100%",tableLayout:be,borderCollapse:"separate",borderSpacing:0},children:[(0,r.jsx)("colgroup",{children:l.map(i=>(0,r.jsx)("col",{style:{width:i.width,minWidth:i.width??i.minWidth}},String(i.id)))}),(0,r.jsx)(s.TableBody,{children:ne.map((i,u)=>e?(0,r.jsx)(e,{item:i,"data-index":u,"data-vdt-pinned-row":"",children:Te(u,i)},g?String(g(i,u)):`p${u}`):null)})]})})})})]})},[ot,ne,Ee,re,l,Te,be,g,f,h]),H=Le??l.some(t=>typeof t.footer=="function"),it=(0,o.useCallback)(()=>{if(!H)return null;let t=[];for(let e=0;e<l.length;e+=1){let i=l[e],u=i.footerColSpan&&i.footerColSpan>1?Math.min(i.footerColSpan,l.length-e):1;t.push((0,r.jsx)(s.TableCell,{align:i.align||"left",colSpan:u>1?u:void 0,style:{...u>1?{}:{width:i.width,minWidth:i.width},...i.style,fontWeight:"bold",padding:f?"0 14px":"16px"},children:i.footer?i.footer(a):null},String(i.id))),e+=u-1}return(0,r.jsx)(s.TableRow,{children:t})},[H,l,a,f]),je=(0,o.useMemo)(()=>({Scroller:Ze,Table:t=>(0,r.jsx)(s.Table,{...t,sx:{borderCollapse:"separate",tableLayout:be,...Ve?{minWidth:Ve}:{},marginRight:ee?"16px":0,...H?{height:"100%"}:{}}}),TableHead:(0,o.forwardRef)((t,e)=>(0,r.jsx)(s.TableHead,{...t,ref:e,sx:{userSelect:"none","& > tr":{height:V,"& > th":{padding:"16px",position:"sticky",top:0,zIndex:2,fontWeight:"bold"}}}})),TableRow:t=>{let{item:e,selected:i,"aria-selected":u,className:b,...n}=t,d=n["data-index"]??0,T=d%2===1,S=e&&ae.current?ae.current(e,d):d,M=!ye&&C!==null&&C!==void 0&&S===C,N=M&&E?typeof E=="function"?E(e,d):E:void 0,J=String(b??"").split(/\s+/).filter(y=>y!=="Mui-selected"&&y!=="Mui-focusVisible").join(" ");return(0,r.jsx)(s.TableRow,{...n,"data-row-id":S!=null?String(S):void 0,className:J||void 0,selected:M,onMouseDown:y=>{ie.current=!1,_.current={x:y.clientX,y:y.clientY}},onContextMenu:y=>{e&&$e.current&&$e.current(e,d,y)},onClick:y=>{let R=y.clientX-_.current.x,Y=y.clientY-_.current.y;if(Math.sqrt(R*R+Y*Y)>Xe||ie.current){y.preventDefault(),y.stopPropagation(),ie.current=!1;return}e&&We.current&&We.current(e,d),ie.current=!1},sx:[{userSelect:"none",...Pe?{"& > td":{height:oe}}:{height:oe,maxHeight:oe},boxSizing:"border-box",backgroundColor:T&&Oe?Oe:"transparent","& td:not([data-vdt-pad])":{padding:"8px 16px"},"& td":{boxSizing:"border-box",borderBottom:Q?"1px solid rgba(224, 224, 224, 1)":"none"},"& th":{padding:"8px 16px",borderBottom:"none"},"&:hover":we&&!M?{backgroundColor:y=>{let R=y.palette.mode==="dark",k=Ae??"#000000",U=Ue??.06;if(!Ae)return R?`rgba(255, 255, 255, ${U})`:`rgba(0, 0, 0, ${U})`;let j=k.replace("#","").trim();if(j.length!==6)return k;let Vt=parseInt(j.substring(0,2),16),_t=parseInt(j.substring(2,4),16),Yt=parseInt(j.substring(4,6),16);return`rgba(${Vt}, ${_t}, ${Yt}, ${U})`}}:void 0,cursor:we?"pointer":void 0},N]})},TableBody:(0,o.forwardRef)((t,e)=>{let{children:i,...u}=t;return(0,r.jsxs)(s.TableBody,{...u,ref:e,sx:H?{height:"100%"}:void 0,children:[i,H&&(0,r.jsx)("tr",{"aria-hidden":!0,style:{height:"100%"},children:(0,r.jsx)("td",{colSpan:l.length,style:{padding:0,border:0}})})]})}),TableFoot:(0,o.forwardRef)((t,e)=>(0,r.jsx)(s.TableFooter,{...t,ref:e,sx:[{"& tr":{height:W??D,maxHeight:W??D,boxSizing:"border-box"},"& td":{height:W??D,boxSizing:"border-box",backgroundColor:i=>i.palette.mode==="dark"?"#1e1e1e":"#ffffff",padding:"0 16px",color:"inherit",fontSize:"0.875rem",border:"none",boxShadow:`inset 0 1px 0 0 ${f?h.borderStrong:"#000000"}`}},...Array.isArray($)?$:$?[$]:[]]}))}),[we,ye?null:C,E,D,Oe,Q,V,Ae,Ue,Ze,W,$,H,f,h,l,be,ee,Pe,Ve]);nt.current=je.TableRow;let It=je,se=je,Nt=se.Table,zt=se.TableHead,Ft=se.TableBody,Wt=se.TableRow,$t=se.TableFoot,st=(0,r.jsxs)(s.Box,{sx:{position:"relative",height:v?"auto":"100%",width:"100%","& .MuiTableHead-root":{backgroundColor:t=>f?`${h.bg} !important`:t.palette.mode==="dark"?"#1e1e1e !important":"#ffffff !important"},...Lt??{},"& tbody td[data-vdt-pinned]":{backgroundColor:f?h.bg:He.palette.background.paper},"& tbody td[data-vdt-cell-click]":{cursor:"pointer"},"& tbody td[data-vdt-cell-click]:hover":{backgroundColor:f?h.hoverBg:He.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"},...f&&we?{"& tbody tr:hover td[data-vdt-pinned]":{backgroundColor:h.hoverBg}}:{},...f?{...ee?{border:`1px solid ${h.borderStrong}`,borderRadius:"4px"}:{"& table":{backgroundColor:h.bg}},overflow:"hidden","& thead tr th":{height:V,boxSizing:"border-box",padding:"0 14px !important",fontSize:13,fontWeight:"500 !important",color:h.headerColor,backgroundColor:`${h.bg} !important`,borderTop:"none",borderBottom:`1px solid ${h.borderStrong}`,borderRight:`1px solid ${h.border}`,"&:last-of-type":{borderRight:"none"}},"& tbody tr td:not([data-vdt-pad])":{padding:"0 14px !important"},"& tbody tr td":{fontSize:14,borderBottom:`1px solid ${h.border}`},...a.length>0&&(v||At||H)?{[`& tbody tr[data-index="${a.length-1}"]:not([data-vdt-pinned-row]) td`]:{borderBottom:"none"}}:{}}:{}},children:[v?(0,r.jsx)(s.Box,{sx:{overflowX:"auto",width:"100%"},children:(0,r.jsxs)(Nt,{children:[(0,r.jsx)(zt,{children:at()}),(0,r.jsx)(Ft,{children:a.map((t,e)=>(0,r.jsx)(Wt,{item:t,"data-index":e,children:Te(e,t)},g?String(g(t,e)):e))}),H?(0,r.jsx)($t,{children:it()}):null]})}):(0,r.jsx)(ft.TableVirtuoso,{ref:ze,data:a,totalCount:P?a.length+1:a.length,defaultItemHeight:oe,fixedItemHeight:Pe?void 0:oe,fixedHeaderContent:at,fixedFooterContent:H?it:void 0,itemContent:Te,computeItemKey:yt&&g?(t,e)=>e?g(e,t):`vdt-${t}`:void 0,endReached:Ot,scrollerRef:t=>{Fe.current=t instanceof HTMLElement?t:null,xe()},totalListHeightChanged:xe,style:{height:"100%"},increaseViewportBy:{top:vt,bottom:Tt},overscan:Rt,followOutput:!1,components:It},Et),a.length===0&&!c&&!Je&&f&&typeof B=="string"&&(0,r.jsx)(s.Box,{sx:{position:v?"static":"absolute",top:V,left:0,right:0,py:6,textAlign:"center",fontSize:14,color:h.emptyColor},children:B}),a.length===0&&!c&&!Je&&!(f&&typeof B=="string")&&(0,r.jsx)(s.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2},children:typeof B=="string"?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.Box,{sx:{width:48,height:48,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",backgroundColor:"#f5f5f5",color:"#999"},children:"\u{1F4C4}"}),(0,r.jsx)(s.Typography,{variant:"body1",sx:{color:"text.secondary"},children:B})]}):B}),Pt&&(0,r.jsx)(r.Fragment,{children:he?(0,r.jsx)(he,{visible:c,onComplete:et}):(0,r.jsx)(ct,{visible:c,onComplete:et,size:40,indicator:(0,r.jsx)(ut,{}),sx:{top:`${l.some(t=>t.group)?V*2:V}px`,bottom:`${H?W??D:0}px`},background:{show:a.length===0,opacity:.8}})})]}),lt=f&&ee?{paddingRight:me,paddingTop:pt,paddingBottom:pt}:{};return ue?(0,r.jsx)(s.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:me,...lt,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:st}):(0,r.jsx)(s.Box,{className:"grow",style:{padding:0,paddingLeft:me,...lt,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:st})}var ht=(0,o.memo)(rn);
5
5
  /**
6
6
  * Virtual Data Table - A high-performance virtual data table component for React
7
7
  *