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

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 Ht=Object.create;var xe=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var Nt=(o,d)=>{for(var l in d)xe(o,l,{get:d[l],enumerable:!0})},Ze=(o,d,l,C)=>{if(d&&typeof d=="object"||typeof d=="function")for(let m of Ot(d))!Bt.call(o,m)&&m!==l&&xe(o,m,{get:()=>d[m],enumerable:!(C=It(d,m))||C.enumerable});return o};var zt=(o,d,l)=>(l=o!=null?Ht(At(o)):{},Ze(d||!o||!o.__esModule?xe(l,"default",{value:o,enumerable:!0}):l,o)),Ft=o=>Ze(xe({},"__esModule",{value:!0}),o);var Yt={};Nt(Yt,{VirtualDataTable:()=>ot});module.exports=Ft(Yt);var a=require("react"),i=require("@mui/material"),nt=require("react-virtuoso");var ye=require("react/jsx-runtime"),j=require("react"),we=require("@mui/material"),re=function(){return re=Object.assign||function(d){for(var l,C=1,m=arguments.length;C<m;C++){l=arguments[C];for(var y in l)Object.prototype.hasOwnProperty.call(l,y)&&(d[y]=l[y])}return d},re.apply(this,arguments)};function Qe(o){var d=o.visible,l=o.onComplete,C=o.fadeoutDuration,m=C===void 0?200:C,y=o.exitDelay,oe=y===void 0?0:y,ae=o.size,G=ae===void 0?40:ae,X=o.className,J=o.style,H=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,I=de===void 0?!0:de,N=S.color,E=N===void 0?"255, 255, 255":N,P=S.opacity,v=P===void 0?.9:P;if((0,j.useEffect)(function(){var z=ie.current;if(z===!0&&d===!1&&B.current){var F=B.current;F.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,ye.jsx)("img",{src:D,alt:"Loading",style:{width:G,height:G}}):D||(0,ye.jsx)(we.CircularProgress,{size:G})},ve=function(){return I?E.startsWith("rgba")?{backgroundColor:E}:/^\d+,\s*\d+,\s*\d+$/.test(E)?{backgroundColor:"rgba(".concat(E,", ").concat(v,")")}:v!==1?{backgroundColor:E,"&::before":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:E,opacity:v,zIndex:-1}}:{backgroundColor:E}:{backgroundColor:"transparent"}};return(0,ye.jsx)(we.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")},ve()),H),children:ce()})}var Y=require("react/jsx-runtime"),Vt=`
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 et({size:o=54}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)("style",{children:Vt}),(0,Y.jsx)("span",{className:"vdt-css-spinner",role:"progressbar","aria-label":"loading",style:{display:"inline-block",width:o,height:o}})]})}var rt=zt(require("@ehfuse/overlay-scrollbar"),1),r=require("react/jsx-runtime"),$t={alignment:"default",margin:0,radius:0},Fe=5,_t={bg:"#ffffff",border:"#e6e6e3",borderStrong:"#dedddb",headerColor:"#787774",hoverBg:"#f8f8f7",emptyColor:"#9b9a97",selectedBg:"#dbeafe",selectedBar:"#3b82f6"},tt="12px",Wt={bg:"#1e1e1e",border:"#2c333c",borderStrong:"#3b434e",headerColor:"#a3adbb",hoverBg:"#272d36",emptyColor:"#7d8590",selectedBg:"rgba(59, 130, 246, 0.22)",selectedBar:"#60a5fa"};function jt({data:o,loading:d=!1,columns:l,onRowClick:C,getRowId:m,selectedRowId:y,selectedRowSx:oe,rowHeight:ae,columnHeight:G,striped:X,rowDivider:J=!0,onSort:H,onLoadMore:D,sortBy:x,sortDirection:S,showPaper:ie=!0,paddingX:B,paddingTop:se=0,paddingBottom:Ce=0,rowHoverColor:le,rowHoverOpacity:de,viewportBuffer:I,overscan:N,scrollbars:E,emptyMessage:P="NO DATA",autoHeight:v=!1,LoadingComponent:ce,showFooter:ve,footerHeight:z,footerSx:F,variant:at="default",framed:U=!0,rowHeightMode:it="fixed",tableLayout:Ve="fixed",renderFullWidthRow:Me,fullWidthRowSx:Z,onRowContextMenu:$e}){let f=at==="notion",Te=(0,i.useTheme)(),h=Te.palette.mode==="dark"?Wt:_t,V=G??(f?40:56),R=ae??(f?48:50),ue=U?B??(f?"12px":"1rem"):0,Se=it==="auto",Re=le??(f?h.hoverBg:void 0),_e=de??(f?1:void 0),st=Math.max(R*12,480),lt=Math.max(R*12,480),dt=typeof I=="number"?I:I?.top??st,ct=typeof I=="number"?I:I?.bottom??lt,ut=Math.max(R*8,420),pt=Math.max(R*10,520),ft=typeof N=="number"?N:{main:N?.main??ut,reverse:N?.reverse??pt},Q=R+(J?1:0),gt=(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??gt,pe=!k||typeof k!="function",bt=(0,a.useMemo)(()=>!pe||y===null||y===void 0||!k?null:{[`& tbody tr[data-row-id="${String(y).replace(/["\\]/g,"\\$&")}"]`]:k},[pe,y,k]),Xt=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}),ke=(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(()=>{ke("interval")},1500);return()=>{window.clearInterval(n),ke("cleanup")}},[ke,g]);let We=(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 w=M=>{let O=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,A=Math.max(e.clientHeight*.4,160),p=Math.max(-A,Math.min(A,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()-O))};return e.addEventListener("wheel",w,{passive:!1}),()=>{e.removeEventListener("wheel",w),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),c.current=0}},[]),(0,r.jsx)(rt.default,{detectInnerScroll:!0,track:$t,...E,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}}})})}),[]),Le=(0,a.useMemo)(()=>{if(X===!0)return"#f5f5f5";if(typeof X=="string")return X},[X]),[ht,je]=(0,a.useState)(d),[mt,xt]=(0,a.useState)(0);(0,a.useEffect)(()=>{d&&je(!0)},[d]);let Ye=(0,a.useCallback)(()=>{je(!1)},[]),yt=ht,Kt=d&&o.length>0,De=(0,a.useRef)(!1),Ee=(0,a.useRef)(-1),Pe=(0,a.useRef)(null),He=(0,a.useRef)(null),[wt,Ct]=(0,a.useState)(!1),fe=(0,a.useCallback)(()=>{let n=He.current;n&&Ct(n.scrollHeight>n.clientHeight+1)},[]);(0,a.useEffect)(()=>{let n=He.current;if(!n||typeof ResizeObserver>"u")return;let t=new ResizeObserver(()=>fe());return t.observe(n),()=>t.disconnect()},[fe,v]);let Ie=(0,a.useRef)(C);Ie.current=C;let ee=(0,a.useRef)(m);ee.current=m;let Oe=(0,a.useRef)($e);Oe.current=$e;let ge=(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=ge.get(String(n.id));return s===void 0?{}:{position:"sticky",left:s,zIndex:t?3:1}},[ge]),be=!!C,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)>Fe&&(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 he=(0,a.useCallback)(n=>{if(!H)return;H(n,x===n&&S==="asc"?"desc":"asc")},[H,x,S]),vt=(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=Ee.current===o.length;if(c&&s&&!De.current&&!b){De.current=!0,Ee.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&&xt(n=>n+1)},[o.length]);let Ae=(0,a.useRef)(o.length),Be=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{let n=Ae.current,t=o.length,s=t>0?ee.current?ee.current(o[0],0):o[0]:void 0,c=Be.current;if(t>n&&n>0){Ae.current=t,Be.current=s;return}let b=t<n||n>0&&s!==c;b&&(Ee.current=-1),Pe.current&&t>0&&b&&Pe.current.scrollToIndex({index:0,align:"start",behavior:"auto"}),Ae.current=t,Be.current=s},[o]);let Xe=(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:()=>he(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&&H?(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:()=>he(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,w])=>(0,r.jsx)(i.TableCell,{align:"center",colSpan:w.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&&H?(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:()=>he(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,he,H,V,K]),Ke=(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=Me?Me(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 w=g?performance.now():0,M=e.render?e.render(t,n):String(t[e.id]||"");if(g){let p=performance.now()-w;u.current.cellRenderCalls+=1,u.current.cellRenderMs+=p,u.current.cellRenderMaxMs=Math.max(u.current.cellRenderMaxMs,p)}let O=ge.has(String(e.id)),T=e.cellPadding!==void 0,_=e.rowSpan?e.rowSpan(t,n):1;if(_<=0)return null;let A=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":O?"":void 0,"data-vdt-cell-click":A?"":void 0,onClick:A?p=>{let W=p.clientX-$.current.x,q=p.clientY-$.current.y;p.stopPropagation(),!(Math.sqrt(W*W+q*q)>Fe)&&A(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,Me,Z,f,ge,K]),L=ve??l.some(n=>typeof n.footer=="function"),qe=(0,a.useCallback)(()=>{if(!L)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})},[L,l,o,f]),Ge=(0,a.useMemo)(()=>({Scroller:We,Table:n=>(0,r.jsx)(i.Table,{...n,sx:{borderCollapse:"separate",tableLayout:Ve,marginRight:U?"16px":0,...L?{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,w=e["data-index"]??0,M=w%2===1,O=t&&ee.current?ee.current(t,w):w,T=!pe&&y!==null&&y!==void 0&&O===y,_=T&&k?typeof k=="function"?k(t,w):k:void 0,A=String(b??"").split(/\s+/).filter(p=>p!=="Mui-selected"&&p!=="Mui-focusVisible").join(" ");return(0,r.jsx)(i.TableRow,{...e,"data-row-id":O!=null?String(O):void 0,className:A||void 0,selected:T,onMouseDown:p=>{te.current=!1,$.current={x:p.clientX,y:p.clientY}},onContextMenu:p=>{t&&Oe.current&&Oe.current(t,w,p)},onClick:p=>{let W=p.clientX-$.current.x,q=p.clientY-$.current.y;if(Math.sqrt(W*W+q*q)>Fe||te.current){p.preventDefault(),p.stopPropagation(),te.current=!1;return}t&&Ie.current&&Ie.current(t,w),te.current=!1},sx:[{userSelect:"none",...Se?{"& > td":{height:Q}}:{height:Q,maxHeight:Q},boxSizing:"border-box",backgroundColor:M&&Le?Le:"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":be&&!T?{backgroundColor:p=>{let W=p.palette.mode==="dark",Ne=Re??"#000000",ze=_e??.06;if(!Re)return W?`rgba(255, 255, 255, ${ze})`:`rgba(0, 0, 0, ${ze})`;let me=Ne.replace("#","").trim();if(me.length!==6)return Ne;let Dt=parseInt(me.substring(0,2),16),Et=parseInt(me.substring(2,4),16),Pt=parseInt(me.substring(4,6),16);return`rgba(${Dt}, ${Et}, ${Pt}, ${ze})`}}:void 0,cursor:be?"pointer":void 0},_]})},TableBody:(0,a.forwardRef)((n,t)=>{let{children:s,...c}=n;return(0,r.jsxs)(i.TableBody,{...c,ref:t,sx:L?{height:"100%"}:void 0,children:[s,L&&(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:z??R,maxHeight:z??R,boxSizing:"border-box"},"& td":{height:z??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(F)?F:F?[F]:[]]}))}),[be,pe?null:y,k,R,Le,J,V,Re,_e,We,z,F,L,f,h,l,Ve,U,Se]),Mt=Ge,ne=Ge,Tt=ne.Table,St=ne.TableHead,Rt=ne.TableBody,kt=ne.TableRow,Lt=ne.TableFoot,Je=(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"},...bt??{},"& tbody td[data-vdt-pinned]":{backgroundColor:f?h.bg:Te.palette.background.paper},"& tbody td[data-vdt-cell-click]":{cursor:"pointer"},"& tbody td[data-vdt-cell-click]:hover":{backgroundColor:f?h.hoverBg:Te.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"},...f&&be?{"& 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}`},...o.length>0&&(v||wt||L)?{[`& tbody tr[data-index="${o.length-1}"] td`]:{borderBottom:"none"}}:{}}:{}},children:[v?(0,r.jsx)(i.Box,{sx:{overflowX:"auto",width:"100%"},children:(0,r.jsxs)(Tt,{children:[(0,r.jsx)(St,{children:Xe()}),(0,r.jsx)(Rt,{children:o.map((n,t)=>(0,r.jsx)(kt,{item:n,"data-index":t,children:Ke(t,n)},m?String(m(n,t)):t))}),L?(0,r.jsx)(Lt,{children:qe()}):null]})}):(0,r.jsx)(nt.TableVirtuoso,{ref:Pe,data:o,totalCount:D?o.length+1:o.length,defaultItemHeight:Q,fixedItemHeight:Se?void 0:Q,fixedHeaderContent:Xe,fixedFooterContent:L?qe:void 0,itemContent:Ke,endReached:vt,scrollerRef:n=>{He.current=n instanceof HTMLElement?n:null,fe()},totalListHeightChanged:fe,style:{height:"100%"},increaseViewportBy:{top:dt,bottom:ct},overscan:ft,followOutput:!1,components:Mt},mt),o.length===0&&!d&&f&&typeof P=="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:P}),o.length===0&&!d&&!(f&&typeof P=="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 P=="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:P})]}):P}),yt&&(0,r.jsx)(r.Fragment,{children:ce?(0,r.jsx)(ce,{visible:d,onComplete:Ye}):(0,r.jsx)(Qe,{visible:d,onComplete:Ye,size:40,indicator:(0,r.jsx)(et,{}),sx:{top:`${l.some(n=>n.group)?V*2:V}px`,bottom:`${L?z??R:0}px`},background:{show:o.length===0,opacity:.8}})})]}),Ue=f&&U?{paddingRight:ue,paddingTop:tt,paddingBottom:tt}:{};return ie?(0,r.jsx)(i.Paper,{className:"grow",elevation:1,sx:{padding:0,paddingLeft:ue,...Ue,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:Je}):(0,r.jsx)(i.Box,{className:"grow",style:{padding:0,paddingLeft:ue,...Ue,boxSizing:"border-box",height:v?"auto":"100%",minHeight:0,flex:v?"none":1,display:"flex",flexDirection:"column"},children:Je})}var ot=(0,a.memo)(jt);
5
5
  /**
6
6
  * Virtual Data Table - A high-performance virtual data table component for React
7
7
  *