bolt-table 0.1.41 → 0.1.42

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,8 +1,8 @@
1
- 'use strict';var reactVirtual=require('@tanstack/react-virtual'),re=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var re__default=/*#__PURE__*/_interopDefault(re);var ce={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},bn=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("circle",{cx:"9",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"19",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"19",r:"1"})]}),pi=({style:o,className:s})=>jsxRuntime.jsx("svg",{...ce,style:o,className:s,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})}),gi=({style:o,className:s})=>jsxRuntime.jsx("svg",{...ce,style:o,className:s,children:jsxRuntime.jsx("path",{d:"m15 18-6-6 6-6"})}),Qr=({style:o,className:s})=>jsxRuntime.jsx("svg",{...ce,style:o,className:s,children:jsxRuntime.jsx("path",{d:"m9 18 6-6-6-6"})}),fi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m11 17-5-5 5-5"}),jsxRuntime.jsx("path",{d:"m18 17-5-5 5-5"})]}),yi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m6 17 5-5-5-5"}),jsxRuntime.jsx("path",{d:"m13 17 5-5-5-5"})]}),eo=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"}),jsxRuntime.jsx("path",{d:"M20 8h-5"}),jsxRuntime.jsx("path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10"}),jsxRuntime.jsx("path",{d:"M15 14h5l-5 6h5"})]}),to=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m3 16 4 4 4-4"}),jsxRuntime.jsx("path",{d:"M7 20V4"}),jsxRuntime.jsx("path",{d:"M20 8h-5"}),jsxRuntime.jsx("path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10"}),jsxRuntime.jsx("path",{d:"M15 14h5l-5 6h5"})]}),no=({style:o,className:s})=>jsxRuntime.jsx("svg",{...ce,style:o,className:s,children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),hi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055"}),jsxRuntime.jsx("path",{d:"m22 3-5 5"}),jsxRuntime.jsx("path",{d:"m17 3 5 5"})]}),Gt=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"22"}),jsxRuntime.jsx("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"})]}),Mt=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"}),jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"22"}),jsxRuntime.jsx("path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4"})]}),mi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),jsxRuntime.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),bi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),jsxRuntime.jsx("path",{d:"m15 5 4 4"})]}),xi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),jsxRuntime.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),jsxRuntime.jsx("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),jsxRuntime.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"})]}),vi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.3-4.3"})]}),ki=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"3",y2:"21"})]}),Ve=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}),er=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"}),jsxRuntime.jsx("path",{d:"M5 3v4"}),jsxRuntime.jsx("path",{d:"M19 17v4"}),jsxRuntime.jsx("path",{d:"M3 5h4"}),jsxRuntime.jsx("path",{d:"M17 19h4"})]}),Si=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...ce,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),jsxRuntime.jsx("path",{d:"M22 2 11 13"})]}),Ri=({style:o,className:s})=>jsxRuntime.jsx("svg",{...ce,style:o,className:s,children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})});function rs(o){return o.sortable!==false}function os(o){return o.filterable!==false}var Ci=re__default.default.memo(({column:o,visualIndex:s,accentColor:c,onResizeStart:b,styles:R,classNames:p,hideGripIcon:E=false,gripIcon:h,stickyOffset:g,onTogglePin:k,onToggleHide:K,isLastColumn:X=false,sortDirection:x,sortPriority:T,onSort:D,filterValue:P="",onFilter:J,onClearFilter:Me,customContextMenuItems:Se,icons:B,onColumnDragStart:ue,disabledFilters:qe,headerGridRow:be=1,headerHeight:$=36,stickyTop:Re=0,isFirstColumn:we=false,onAutoFitColumn:Ce,isDark:he=false})=>{let Ee=rs(o),Ae=!qe&&os(o),[xe,ge]=re.useState(null),[ve,Be]=re.useState(false),nt=re.useRef(null),We=re.useRef(null);re.useEffect(()=>{let v=w=>{We.current&&!We.current.contains(w.target)&&ge(null);};if(xe)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[xe]);let Xe=(v,w)=>{let ke=v,j=w;ke+160>window.innerWidth&&(ke=window.innerWidth-160-10),j+180>window.innerHeight&&(j=window.innerHeight-180-10),ge({x:ke,y:j});},se=v=>{v.preventDefault(),v.stopPropagation(),Xe(v.clientX,v.clientY);},Y=re.useRef(null),ee=re.useRef(null),fe=()=>{Y.current&&(clearTimeout(Y.current),Y.current=null),ee.current=null;},Fe=v=>{fe();let w=v.touches[0];ee.current={x:w.clientX,y:w.clientY},Y.current=setTimeout(()=>{Y.current=null,Xe(w.clientX,w.clientY);},500);},Ye=v=>{if(!ee.current)return;let w=v.touches[0],O=w.clientX-ee.current.x,F=w.clientY-ee.current.y;(Math.abs(O)>10||Math.abs(F)>10)&&fe();},$e=v=>{v.preventDefault(),v.stopPropagation(),!o.pinned&&b?.(o.key,v);},pe=v=>{v.preventDefault(),v.stopPropagation(),!o.pinned&&Ce?.(o.key);},Le=`${o.width??150}px`,ne=!!o.pinned,rt=ne?12:10,M="1px solid rgba(128,128,128,0.2)",U={position:"sticky",top:Re,zIndex:rt,width:X?"100%":Le,minWidth:Le,...X?{}:{maxWidth:Le},gridColumn:s+1,gridRow:be,display:"flex",height:$,alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",...o.pinned==="left"&&g!==void 0?{left:`${g}px`}:{},...o.pinned==="right"&&g!==void 0?{right:`${g}px`}:{},...o.style,...ne?R?.pinnedHeader:{},...R?.header,borderTop:"none",borderLeft:"none",borderBottom:M,borderRight:X?"none":M};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{"data-column-key":o.key,"data-bt-header":"",role:"columnheader","aria-sort":x==="asc"?"ascending":x==="desc"?"descending":void 0,...ne?{"data-bt-pinned":""}:{},style:U,className:`${o.className??""} ${p?.header??""} ${ne?p?.pinnedHeader??"":""}`,onContextMenu:se,onTouchStart:Fe,onTouchMove:Ye,onTouchEnd:fe,onTouchCancel:fe,children:[jsxRuntime.jsxs("div",{role:ne?void 0:"button",tabIndex:ne?void 0:0,"aria-roledescription":ne?void 0:"sortable",onPointerDown:ne?void 0:v=>{v.button===0&&(v.preventDefault(),ue?.(o.key,v));},style:{position:"relative",zIndex:10,display:"flex",height:"100%",flex:"1 1 0%",touchAction:"none",alignItems:"center",gap:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8,fontWeight:500,cursor:ne?"default":"grab"},"aria-label":ne?`${o.key} column (pinned)`:`Drag ${o.key} column`,children:[E||ne?null:B?.gripVertical??h??jsxRuntime.jsx("span",{"data-bt-grip":"",style:{opacity:.35,flexShrink:0,display:"flex"},children:jsxRuntime.jsx(bn,{style:{width:12,height:12}})}),jsxRuntime.jsxs("div",{style:{display:"flex",minWidth:0,alignItems:"center",gap:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left",userSelect:"none"},children:[o.title,x==="asc"&&jsxRuntime.jsxs("span",{style:{color:c,flexShrink:0,display:"flex",alignItems:"center",gap:1},children:[B?.sortAsc??jsxRuntime.jsx(eo,{style:{width:12,height:12}}),T!=null&&T>0&&jsxRuntime.jsx("span",{style:{fontSize:"0.6em",fontWeight:700,lineHeight:1,opacity:.8,minWidth:8,textAlign:"center"},children:T})]}),x==="desc"&&jsxRuntime.jsxs("span",{style:{color:c,flexShrink:0,display:"flex",alignItems:"center",gap:1},children:[B?.sortDesc??jsxRuntime.jsx(to,{style:{width:12,height:12}}),T!=null&&T>0&&jsxRuntime.jsx("span",{style:{fontSize:"0.6em",fontWeight:700,lineHeight:1,opacity:.8,minWidth:8,textAlign:"center"},children:T})]}),P&&jsxRuntime.jsx("span",{style:{color:c,flexShrink:0,display:"flex"},children:B?.filter??jsxRuntime.jsx(no,{style:{width:10,height:10}})})]})]}),ne&&jsxRuntime.jsx("button",{type:"button",style:{position:"relative",height:"100%",width:24,flexShrink:0,cursor:"pointer",border:"none",background:"transparent",padding:0,color:c||"#1788ff",display:"flex",alignItems:"center",justifyContent:"center"},onClick:v=>{v.preventDefault(),v.stopPropagation(),k?.(o.key,false);},"aria-label":`Unpin ${o.key} column`,title:"Unpin column",children:B?.pinOff??jsxRuntime.jsx(Mt,{style:{width:12,height:12}})}),!ne&&jsxRuntime.jsx("button",{type:"button","data-bt-resize":"",style:{position:"relative",height:"100%",width:12,flexShrink:0,cursor:"col-resize",border:"none",background:"transparent",padding:0},onMouseDown:$e,onDoubleClick:pe,"aria-label":`Resize ${o.key} column (double-click to auto-fit)`,children:jsxRuntime.jsx("div",{"data-bt-resize-line":"",style:{position:"absolute",top:0,right:0,height:"100%",width:2,opacity:0,transition:"opacity 0.15s",backgroundColor:c||"#1788ff"}})})]}),xe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:We,style:{fontSize:"0.75em",position:"fixed",zIndex:9999,minWidth:160,borderRadius:6,border:"1px solid rgba(128,128,128,0.2)",paddingTop:4,paddingBottom:4,boxShadow:he?"0 10px 20px rgba(0,0,0,0.4)":"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:he?"rgba(28,28,30,0.88)":"rgba(255,255,255,0.92)",color:he?"#e0e0e0":"#1a1a2e",left:`${xe.x}px`,top:`${xe.y}px`},role:"menu",children:(()=>{let v={cursor:"pointer",display:"flex",width:"100%",alignItems:"center",gap:8,paddingLeft:12,paddingRight:12,paddingTop:6,paddingBottom:6,textAlign:"left",background:"none",border:"none",fontSize:"inherit",color:"inherit",...R?.contextMenuItem};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ee&&D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:{...v,fontWeight:x==="asc"?600:void 0,...x==="asc"?{color:c}:{}},onClick:w=>{D(o.key,"asc",w.shiftKey),ge(null);},children:[B?.sortAsc??jsxRuntime.jsx(eo,{style:{width:12,height:12}}),"Sort Ascending"]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:{...v,fontWeight:x==="desc"?600:void 0,...x==="desc"?{color:c}:{}},onClick:w=>{D(o.key,"desc",w.shiftKey),ge(null);},children:[B?.sortDesc??jsxRuntime.jsx(to,{style:{width:12,height:12}}),"Sort Descending"]}),jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}})]}),Ae&&J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ve?jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:o.filterType==="dateRange"||o.filterType==="numberRange"?"column":"row",alignItems:o.filterType==="dateRange"||o.filterType==="numberRange"?"stretch":"center",gap:4,paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},children:o.filterType==="dateRange"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"From"}),jsxRuntime.jsx("input",{type:"date",autoFocus:true,defaultValue:P?.split("..")?.[0]??"",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:w=>{let O=P?.split("..")?.[1]??"",F=w.target.value;(F||O)&&J(o.key,`${F}..${O}`);}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"To"}),jsxRuntime.jsx("input",{type:"date",defaultValue:P?.split("..")?.[1]??"",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:w=>{let O=P?.split("..")?.[0]??"",F=w.target.value;(O||F)&&J(o.key,`${O}..${F}`);}})]})]}):o.filterType==="numberRange"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"Min"}),jsxRuntime.jsx("input",{type:"number",autoFocus:true,defaultValue:P?.split("..")?.[0]??"",placeholder:"Min",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:w=>{let O=P?.split("..")?.[1]??"",F=w.target.value;J(o.key,`${F}..${O}`);}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"Max"}),jsxRuntime.jsx("input",{type:"number",defaultValue:P?.split("..")?.[1]??"",placeholder:"Max",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:w=>{let O=P?.split("..")?.[0]??"",F=w.target.value;J(o.key,`${O}..${F}`);}})]})]}):jsxRuntime.jsx("input",{ref:nt,type:"text",autoFocus:true,defaultValue:P,placeholder:"Filter...",style:{width:"100%",borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",paddingLeft:6,paddingRight:6,paddingTop:2,paddingBottom:2,fontSize:"inherit",outline:"none",background:"inherit",color:"inherit"},onKeyDown:w=>{w.key==="Enter"&&(J(o.key,w.target.value),Be(false),ge(null)),w.key==="Escape"&&Be(false);}})}):jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:v,onClick:()=>{Be(true);},children:[B?.filter??jsxRuntime.jsx(no,{style:{width:12,height:12}}),P?`Filtered: "${P}"`:"Filter Column"]}),P&&jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:{...v,color:"#ef4444"},onClick:()=>{Me?.(o.key),Be(false),ge(null);},children:[B?.filterClear??jsxRuntime.jsx(hi,{style:{width:12,height:12}}),"Clear Filter"]}),jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}})]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:v,onClick:()=>{k?.(o.key,o.pinned==="left"?false:"left"),ge(null);},children:[o.pinned==="left"?B?.pinOff??jsxRuntime.jsx(Mt,{style:{width:12,height:12}}):B?.pin??jsxRuntime.jsx(Gt,{style:{width:12,height:12}}),o.pinned==="left"?"Unpin Left":"Pin Left"]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:v,onClick:()=>{k?.(o.key,o.pinned==="right"?false:"right"),ge(null);},children:[o.pinned==="right"?B?.pinOff??jsxRuntime.jsx(Mt,{style:{width:12,height:12}}):B?.pin??jsxRuntime.jsx(Gt,{style:{width:12,height:12}}),o.pinned==="right"?"Unpin Right":"Pin Right"]}),!ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:v,onClick:()=>{K?.(o.key),ge(null);},children:[B?.eyeOff??jsxRuntime.jsx(xi,{style:{width:12,height:12}}),"Hide Column"]})]}),Se&&Se.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}}),Se.map(w=>{let O=typeof w.icon=="function"?w.icon(o.key):w.icon,F=typeof w.label=="function"?w.label(o.key):w.label;return jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",disabled:w.disabled,style:{display:"flex",width:"100%",alignItems:"center",gap:8,paddingLeft:12,paddingRight:12,paddingTop:6,paddingBottom:6,textAlign:"left",background:"none",border:"none",fontSize:"inherit",cursor:w.disabled?"not-allowed":"pointer",opacity:w.disabled?.5:1,color:w.danger?"#ef4444":"inherit"},onClick:()=>{w.onClick?.(o.key),ge(null);},children:[O&&jsxRuntime.jsx("span",{style:{display:"flex",width:12,height:12,alignItems:"center",justifyContent:"center"},children:O}),F]},w.key)})]})]})})()}),document.body)]})},(o,s)=>o.column.width===s.column.width&&o.column.key===s.column.key&&o.column.pinned===s.column.pinned&&o.column.sortable===s.column.sortable&&o.column.filterable===s.column.filterable&&o.column.sorter===s.column.sorter&&o.column.filterFn===s.column.filterFn&&o.visualIndex===s.visualIndex&&o.stickyOffset===s.stickyOffset&&o.isLastColumn===s.isLastColumn&&o.sortDirection===s.sortDirection&&o.sortPriority===s.sortPriority&&o.filterValue===s.filterValue&&o.classNames===s.classNames&&o.styles===s.styles&&o.customContextMenuItems===s.customContextMenuItems&&o.disabledFilters===s.disabledFilters&&o.headerGridRow===s.headerGridRow&&o.headerHeight===s.headerHeight&&o.stickyTop===s.stickyTop&&o.isFirstColumn===s.isFirstColumn);Ci.displayName="DraggableHeader";var ro=Ci;function is(o,s){let c=[];for(let h=0;h<Math.min(s.length,20);h++){let g=s[h]?.[o];g!=null&&c.push(g);}if(c.length===0)return {type:"unknown",sample:""};let b=c.every(h=>typeof h=="number"),R=c.every(h=>typeof h=="boolean"),p=[...new Set(c.map(String))],E=p.length<=8?p.join(", "):p.slice(0,6).join(", ")+"...";if(R)return {type:"boolean",sample:E};if(b){let h=c,g=Math.min(...h),k=Math.max(...h);return {type:"number",sample:`range ${g}\u2013${k}`}}return {type:"string",sample:E}}var oo=null;function as(o,s){return o.filter(c=>c.key!=="__select__"&&c.key!=="__expand__").map(c=>c.key).join(",")+`:${s}`}function Ii(o,s){let c=as(o,s.length);if(oo?.fingerprint===c)return oo.prompt;let b=o.filter(h=>h.key!=="__select__"&&h.key!=="__expand__"),R=b.map(h=>{let g=h.dataIndex??h.key,k=typeof h.title=="string"?h.title:h.key,K=is(g,s),X=h.width??150,x=h.pinned?`, pinned: "${h.pinned}"`:"",T=h.hidden?", hidden: true":"",D=K.sample?"|vals: "+K.sample:"";return ` ${h.key}|${g}|"${k}"|${K.type}|w:${X}${x}${T}${D}`}).join(`
2
- `),p=s.slice(0,3).map(h=>{let g={};for(let k of b){let K=k.dataIndex??k.key;g[K]=h[K];}return g}),E=`Data table AI. Respond ONLY with valid JSON, no markdown/explanation.
1
+ 'use strict';var reactVirtual=require('@tanstack/react-virtual'),oe=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var oe__default=/*#__PURE__*/_interopDefault(oe);var pe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},mn=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("circle",{cx:"9",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"19",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"19",r:"1"})]}),pi=({style:o,className:s})=>jsxRuntime.jsx("svg",{...pe,style:o,className:s,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})}),gi=({style:o,className:s})=>jsxRuntime.jsx("svg",{...pe,style:o,className:s,children:jsxRuntime.jsx("path",{d:"m15 18-6-6 6-6"})}),Qr=({style:o,className:s})=>jsxRuntime.jsx("svg",{...pe,style:o,className:s,children:jsxRuntime.jsx("path",{d:"m9 18 6-6-6-6"})}),fi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m11 17-5-5 5-5"}),jsxRuntime.jsx("path",{d:"m18 17-5-5 5-5"})]}),yi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m6 17 5-5-5-5"}),jsxRuntime.jsx("path",{d:"m13 17 5-5-5-5"})]}),eo=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"}),jsxRuntime.jsx("path",{d:"M20 8h-5"}),jsxRuntime.jsx("path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10"}),jsxRuntime.jsx("path",{d:"M15 14h5l-5 6h5"})]}),to=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m3 16 4 4 4-4"}),jsxRuntime.jsx("path",{d:"M7 20V4"}),jsxRuntime.jsx("path",{d:"M20 8h-5"}),jsxRuntime.jsx("path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10"}),jsxRuntime.jsx("path",{d:"M15 14h5l-5 6h5"})]}),no=({style:o,className:s})=>jsxRuntime.jsx("svg",{...pe,style:o,className:s,children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),hi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055"}),jsxRuntime.jsx("path",{d:"m22 3-5 5"}),jsxRuntime.jsx("path",{d:"m17 3 5 5"})]}),jt=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"22"}),jsxRuntime.jsx("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"})]}),Et=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"}),jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"17",y2:"22"}),jsxRuntime.jsx("path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4"})]}),mi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),jsxRuntime.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),bi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),jsxRuntime.jsx("path",{d:"m15 5 4 4"})]}),xi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),jsxRuntime.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),jsxRuntime.jsx("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),jsxRuntime.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"})]}),vi=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.3-4.3"})]}),ki=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"3",y2:"21"})]}),Ge=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}),nr=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"}),jsxRuntime.jsx("path",{d:"M5 3v4"}),jsxRuntime.jsx("path",{d:"M19 17v4"}),jsxRuntime.jsx("path",{d:"M3 5h4"}),jsxRuntime.jsx("path",{d:"M17 19h4"})]}),Si=({style:o,className:s})=>jsxRuntime.jsxs("svg",{...pe,style:o,className:s,children:[jsxRuntime.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),jsxRuntime.jsx("path",{d:"M22 2 11 13"})]}),Ri=({style:o,className:s})=>jsxRuntime.jsx("svg",{...pe,style:o,className:s,children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})});function as(o){return o.sortable!==false}function ss(o){return o.filterable!==false}var Ci=oe__default.default.memo(({column:o,visualIndex:s,accentColor:c,onResizeStart:b,styles:w,classNames:p,hideGripIcon:E=false,gripIcon:h,stickyOffset:g,onTogglePin:k,onToggleHide:V,isLastColumn:X=false,sortDirection:x,sortPriority:T,onSort:$,filterValue:D="",onFilter:J,onClearFilter:Ae,customContextMenuItems:ke,icons:B,onColumnDragStart:ge,disabledFilters:Ve,headerGridRow:be=1,headerHeight:N=36,stickyTop:Se=0,isFirstColumn:Re=false,onAutoFitColumn:we,isDark:me=false})=>{let Ie=as(o),_e=!Ve&&ss(o),[Te,ye]=oe.useState(null),[xe,Be]=oe.useState(false),st=oe.useRef(null),We=oe.useRef(null);oe.useEffect(()=>{let A=R=>{We.current&&!We.current.contains(R.target)&&ye(null);};if(Te)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[Te]);let qe=(A,R)=>{let q=A,Pe=R;q+160>window.innerWidth&&(q=window.innerWidth-160-10),Pe+180>window.innerHeight&&(Pe=window.innerHeight-180-10),ye({x:q,y:Pe});},ie=A=>{A.preventDefault(),A.stopPropagation(),qe(A.clientX,A.clientY);},U=oe.useRef(null),te=oe.useRef(null),ae=()=>{U.current&&(clearTimeout(U.current),U.current=null),te.current=null;},Xe=A=>{ae();let R=A.touches[0];te.current={x:R.clientX,y:R.clientY},U.current=setTimeout(()=>{U.current=null,qe(R.clientX,R.clientY);},500);},Ne=A=>{if(!te.current)return;let R=A.touches[0],z=R.clientX-te.current.x,Z=R.clientY-te.current.y;(Math.abs(z)>10||Math.abs(Z)>10)&&ae();},Ee=A=>{A.preventDefault(),A.stopPropagation(),!o.pinned&&b?.(o.key,A);},Me=A=>{A.preventDefault(),A.stopPropagation(),!o.pinned&&we?.(o.key);},De=`${o.width??150}px`,re=!!o.pinned,P=re?12:10,F="1px solid rgba(128,128,128,0.2)",H={position:"sticky",top:Se,zIndex:P,width:X?"100%":De,minWidth:De,...X?{}:{maxWidth:De},gridColumn:s+1,gridRow:be,display:"flex",height:N,alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",...o.pinned==="left"&&g!==void 0?{left:`${g}px`}:{},...o.pinned==="right"&&g!==void 0?{right:`${g}px`}:{},...o.style,...re?w?.pinnedHeader:{},...w?.header,borderTop:"none",borderLeft:"none",borderBottom:F,borderRight:X?"none":F};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{"data-column-key":o.key,"data-bt-header":"",role:"columnheader","aria-sort":x==="asc"?"ascending":x==="desc"?"descending":void 0,...re?{"data-bt-pinned":""}:{},style:H,className:`${o.className??""} ${p?.header??""} ${re?p?.pinnedHeader??"":""}`,onContextMenu:ie,onTouchStart:Xe,onTouchMove:Ne,onTouchEnd:ae,onTouchCancel:ae,children:[jsxRuntime.jsxs("div",{role:re?void 0:"button",tabIndex:re?void 0:0,"aria-roledescription":re?void 0:"sortable",onPointerDown:re?void 0:A=>{A.button===0&&(A.preventDefault(),ge?.(o.key,A));},style:{position:"relative",zIndex:10,display:"flex",height:"100%",flex:"1 1 0%",touchAction:"none",alignItems:"center",gap:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8,fontWeight:500,cursor:re?"default":"grab"},"aria-label":re?`${o.key} column (pinned)`:`Drag ${o.key} column`,children:[E||re?null:B?.gripVertical??h??jsxRuntime.jsx("span",{"data-bt-grip":"",style:{opacity:.35,flexShrink:0,display:"flex"},children:jsxRuntime.jsx(mn,{style:{width:12,height:12}})}),jsxRuntime.jsxs("div",{style:{display:"flex",minWidth:0,alignItems:"center",gap:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left",userSelect:"none"},children:[o.title,x==="asc"&&jsxRuntime.jsxs("span",{style:{color:c,flexShrink:0,display:"flex",alignItems:"center",gap:1},children:[B?.sortAsc??jsxRuntime.jsx(eo,{style:{width:12,height:12}}),T!=null&&T>0&&jsxRuntime.jsx("span",{style:{fontSize:"0.6em",fontWeight:700,lineHeight:1,opacity:.8,minWidth:8,textAlign:"center"},children:T})]}),x==="desc"&&jsxRuntime.jsxs("span",{style:{color:c,flexShrink:0,display:"flex",alignItems:"center",gap:1},children:[B?.sortDesc??jsxRuntime.jsx(to,{style:{width:12,height:12}}),T!=null&&T>0&&jsxRuntime.jsx("span",{style:{fontSize:"0.6em",fontWeight:700,lineHeight:1,opacity:.8,minWidth:8,textAlign:"center"},children:T})]}),D&&jsxRuntime.jsx("span",{style:{color:c,flexShrink:0,display:"flex"},children:B?.filter??jsxRuntime.jsx(no,{style:{width:10,height:10}})})]})]}),re&&jsxRuntime.jsx("button",{type:"button",style:{position:"relative",height:"100%",width:24,flexShrink:0,cursor:"pointer",border:"none",background:"transparent",padding:0,color:c||"#1788ff",display:"flex",alignItems:"center",justifyContent:"center"},onClick:A=>{A.preventDefault(),A.stopPropagation(),k?.(o.key,false);},"aria-label":`Unpin ${o.key} column`,title:"Unpin column",children:B?.pinOff??jsxRuntime.jsx(Et,{style:{width:12,height:12}})}),!re&&jsxRuntime.jsx("button",{type:"button","data-bt-resize":"",style:{position:"relative",height:"100%",width:12,flexShrink:0,cursor:"col-resize",border:"none",background:"transparent",padding:0},onMouseDown:Ee,onDoubleClick:Me,"aria-label":`Resize ${o.key} column (double-click to auto-fit)`,children:jsxRuntime.jsx("div",{"data-bt-resize-line":"",style:{position:"absolute",top:0,right:0,height:"100%",width:2,opacity:0,transition:"opacity 0.15s",backgroundColor:c||"#1788ff"}})})]}),Te&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:We,style:{fontSize:"0.75em",position:"fixed",zIndex:9999,minWidth:160,borderRadius:6,border:"1px solid rgba(128,128,128,0.2)",paddingTop:4,paddingBottom:4,boxShadow:me?"0 10px 20px rgba(0,0,0,0.4)":"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:me?"rgba(28,28,30,0.88)":"rgba(255,255,255,0.92)",color:me?"#e0e0e0":"#1a1a2e",left:`${Te.x}px`,top:`${Te.y}px`},role:"menu",children:(()=>{let A={cursor:"pointer",display:"flex",width:"100%",alignItems:"center",gap:8,paddingLeft:12,paddingRight:12,paddingTop:6,paddingBottom:6,textAlign:"left",background:"none",border:"none",fontSize:"inherit",color:"inherit",...w?.contextMenuItem};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ie&&$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:{...A,fontWeight:x==="asc"?600:void 0,...x==="asc"?{color:c}:{}},onClick:R=>{$(o.key,"asc",R.shiftKey),ye(null);},children:[B?.sortAsc??jsxRuntime.jsx(eo,{style:{width:12,height:12}}),"Sort Ascending"]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:{...A,fontWeight:x==="desc"?600:void 0,...x==="desc"?{color:c}:{}},onClick:R=>{$(o.key,"desc",R.shiftKey),ye(null);},children:[B?.sortDesc??jsxRuntime.jsx(to,{style:{width:12,height:12}}),"Sort Descending"]}),jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}})]}),_e&&J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[xe?jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:o.filterType==="dateRange"||o.filterType==="numberRange"?"column":"row",alignItems:o.filterType==="dateRange"||o.filterType==="numberRange"?"stretch":"center",gap:4,paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},children:o.filterType==="dateRange"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"From"}),jsxRuntime.jsx("input",{type:"date",autoFocus:true,defaultValue:D?.split("..")?.[0]??"",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:R=>{let z=D?.split("..")?.[1]??"",Z=R.target.value;(Z||z)&&J(o.key,`${Z}..${z}`);}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"To"}),jsxRuntime.jsx("input",{type:"date",defaultValue:D?.split("..")?.[1]??"",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:R=>{let z=D?.split("..")?.[0]??"",Z=R.target.value;(z||Z)&&J(o.key,`${z}..${Z}`);}})]})]}):o.filterType==="numberRange"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"Min"}),jsxRuntime.jsx("input",{type:"number",autoFocus:true,defaultValue:D?.split("..")?.[0]??"",placeholder:"Min",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:R=>{let z=D?.split("..")?.[1]??"",Z=R.target.value;J(o.key,`${Z}..${z}`);}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.85em"},children:[jsxRuntime.jsx("span",{style:{opacity:.6,minWidth:32},children:"Max"}),jsxRuntime.jsx("input",{type:"number",defaultValue:D?.split("..")?.[1]??"",placeholder:"Max",style:{flex:1,borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",padding:"2px 6px",fontSize:"0.85em",outline:"none",background:"inherit",color:"inherit"},onChange:R=>{let z=D?.split("..")?.[0]??"",Z=R.target.value;J(o.key,`${z}..${Z}`);}})]})]}):jsxRuntime.jsx("input",{ref:st,type:"text",autoFocus:true,defaultValue:D,placeholder:"Filter...",style:{width:"100%",borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",paddingLeft:6,paddingRight:6,paddingTop:2,paddingBottom:2,fontSize:"inherit",outline:"none",background:"inherit",color:"inherit"},onKeyDown:R=>{R.key==="Enter"&&(J(o.key,R.target.value),Be(false),ye(null)),R.key==="Escape"&&Be(false);}})}):jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:A,onClick:()=>{Be(true);},children:[B?.filter??jsxRuntime.jsx(no,{style:{width:12,height:12}}),D?`Filtered: "${D}"`:"Filter Column"]}),D&&jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:{...A,color:"#ef4444"},onClick:()=>{Ae?.(o.key),Be(false),ye(null);},children:[B?.filterClear??jsxRuntime.jsx(hi,{style:{width:12,height:12}}),"Clear Filter"]}),jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}})]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:A,onClick:()=>{k?.(o.key,o.pinned==="left"?false:"left"),ye(null);},children:[o.pinned==="left"?B?.pinOff??jsxRuntime.jsx(Et,{style:{width:12,height:12}}):B?.pin??jsxRuntime.jsx(jt,{style:{width:12,height:12}}),o.pinned==="left"?"Unpin Left":"Pin Left"]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:A,onClick:()=>{k?.(o.key,o.pinned==="right"?false:"right"),ye(null);},children:[o.pinned==="right"?B?.pinOff??jsxRuntime.jsx(Et,{style:{width:12,height:12}}):B?.pin??jsxRuntime.jsx(jt,{style:{width:12,height:12}}),o.pinned==="right"?"Unpin Right":"Pin Right"]}),!re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",style:A,onClick:()=>{V?.(o.key),ye(null);},children:[B?.eyeOff??jsxRuntime.jsx(xi,{style:{width:12,height:12}}),"Hide Column"]})]}),ke&&ke.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{marginTop:4,marginBottom:4,borderTop:"1px solid rgba(128,128,128,0.2)"}}),ke.map(R=>{let z=typeof R.icon=="function"?R.icon(o.key):R.icon,Z=typeof R.label=="function"?R.label(o.key):R.label;return jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",disabled:R.disabled,style:{display:"flex",width:"100%",alignItems:"center",gap:8,paddingLeft:12,paddingRight:12,paddingTop:6,paddingBottom:6,textAlign:"left",background:"none",border:"none",fontSize:"inherit",cursor:R.disabled?"not-allowed":"pointer",opacity:R.disabled?.5:1,color:R.danger?"#ef4444":"inherit"},onClick:()=>{R.onClick?.(o.key),ye(null);},children:[z&&jsxRuntime.jsx("span",{style:{display:"flex",width:12,height:12,alignItems:"center",justifyContent:"center"},children:z}),Z]},R.key)})]})]})})()}),document.body)]})},(o,s)=>o.column.width===s.column.width&&o.column.key===s.column.key&&o.column.pinned===s.column.pinned&&o.column.sortable===s.column.sortable&&o.column.filterable===s.column.filterable&&o.column.sorter===s.column.sorter&&o.column.filterFn===s.column.filterFn&&o.visualIndex===s.visualIndex&&o.stickyOffset===s.stickyOffset&&o.isLastColumn===s.isLastColumn&&o.sortDirection===s.sortDirection&&o.sortPriority===s.sortPriority&&o.filterValue===s.filterValue&&o.classNames===s.classNames&&o.styles===s.styles&&o.customContextMenuItems===s.customContextMenuItems&&o.disabledFilters===s.disabledFilters&&o.headerGridRow===s.headerGridRow&&o.headerHeight===s.headerHeight&&o.stickyTop===s.stickyTop&&o.isFirstColumn===s.isFirstColumn);Ci.displayName="DraggableHeader";var ro=Ci;function ls(o,s){let c=[];for(let h=0;h<Math.min(s.length,20);h++){let g=s[h]?.[o];g!=null&&c.push(g);}if(c.length===0)return {type:"unknown",sample:""};let b=c.every(h=>typeof h=="number"),w=c.every(h=>typeof h=="boolean"),p=[...new Set(c.map(String))],E=p.length<=8?p.join(", "):p.slice(0,6).join(", ")+"...";if(w)return {type:"boolean",sample:E};if(b){let h=c,g=Math.min(...h),k=Math.max(...h);return {type:"number",sample:`range ${g}\u2013${k}`}}return {type:"string",sample:E}}var oo=null;function ds(o,s){return o.filter(c=>c.key!=="__select__"&&c.key!=="__expand__").map(c=>c.key).join(",")+`:${s}`}function _i(o,s){let c=ds(o,s.length);if(oo?.fingerprint===c)return oo.prompt;let b=o.filter(h=>h.key!=="__select__"&&h.key!=="__expand__"),w=b.map(h=>{let g=h.dataIndex??h.key,k=typeof h.title=="string"?h.title:h.key,V=ls(g,s),X=h.width??150,x=h.pinned?`, pinned: "${h.pinned}"`:"",T=h.hidden?", hidden: true":"",$=V.sample?"|vals: "+V.sample:"";return ` ${h.key}|${g}|"${k}"|${V.type}|w:${X}${x}${T}${$}`}).join(`
2
+ `),p=s.slice(0,3).map(h=>{let g={};for(let k of b){let V=k.dataIndex??k.key;g[V]=h[V];}return g}),E=`Data table AI. Respond ONLY with valid JSON, no markdown/explanation.
3
3
 
4
4
  SCHEMA (key|dataIndex|title|type|width|flags|sample):
5
- ${R}
5
+ ${w}
6
6
 
7
7
  SAMPLE (${p.length}/${s.length} rows):
8
8
  ${JSON.stringify(p)}
@@ -30,14 +30,14 @@ RULES:
30
30
  - Colors: semi-transparent rgba. CSS props: camelCase.
31
31
  - reorderColumns: provide FULL ordered array of ALL visible column keys.
32
32
  - resizeColumn width: integer pixels (min 40, max 800).
33
- - Combine multiple ops freely. Message: concise plain English.`;return oo={fingerprint:c,prompt:E},E}async function io(o,s,c,b=[]){let{provider:R,apiKey:p,model:E,baseUrl:h,maxTokens:g=1024,temperature:k=.1}=o;if(R==="openai"||R==="custom"){let K=h?`${h.replace(/\/$/,"")}/chat/completions`:"https://api.openai.com/v1/chat/completions",X=[{role:"system",content:s},...b,{role:"user",content:c}],x=await fetch(K,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`},body:JSON.stringify({model:E??"gpt-4o-mini",messages:X,max_tokens:g,temperature:k})});if(!x.ok){let D=await x.text().catch(()=>"");throw new Error(`AI request failed (${x.status}): ${D}`)}return (await x.json()).choices?.[0]?.message?.content??""}if(R==="anthropic"){let K=h?`${h.replace(/\/$/,"")}/messages`:"https://api.anthropic.com/v1/messages",X=await fetch(K,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":"2023-06-01","anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify({model:E??"claude-sonnet-4-20250514",system:s,messages:[...b,{role:"user",content:c}],max_tokens:g,temperature:k})});if(!X.ok){let D=await X.text().catch(()=>"");throw new Error(`AI request failed (${X.status}): ${D}`)}return (await X.json()).content?.find(D=>D.type==="text")?.text??""}throw new Error(`Unsupported AI provider: ${R}`)}function Ti(o){let s=o.trim(),c=s.match(/```(?:json)?\s*([\s\S]*?)```/);c&&(s=c[1].trim());let b=s.indexOf("{"),R=s.lastIndexOf("}");b!==-1&&R>b&&(s=s.slice(b,R+1));let p=JSON.parse(s);if(!p.operations||!Array.isArray(p.operations))throw new Error("Invalid AI response: missing operations array");return {operations:p.operations,message:p.message??"AI operations applied."}}function _i(o,s){let c=s[o.column],b=o.value;switch(o.op){case "eq":return c==b;case "neq":return c!=b;case "gt":return Number(c)>Number(b);case "gte":return Number(c)>=Number(b);case "lt":return Number(c)<Number(b);case "lte":return Number(c)<=Number(b);case "contains":return String(c??"").toLowerCase().includes(String(b).toLowerCase());case "notContains":return !String(c??"").toLowerCase().includes(String(b).toLowerCase());case "startsWith":return String(c??"").toLowerCase().startsWith(String(b).toLowerCase());case "endsWith":return String(c??"").toLowerCase().endsWith(String(b).toLowerCase());case "in":return Array.isArray(b)?b.some(R=>c==R):false;case "notIn":return Array.isArray(b)?!b.some(R=>c==R):true;default:return true}}function ao(o,s,c){return !o||o.length===0?true:s==="or"?o.some(b=>_i(b,c)):o.every(b=>_i(b,c))}function ss(o,s){return o.filter(c=>ao(s.conditions,s.logic,c))}function ls(o,s){let c=s.direction==="asc"?1:-1,b=s.column;return [...o].sort((R,p)=>{let E=R[b],h=p[b];return E==null&&h==null?0:E==null?1:h==null?-1:typeof E=="number"&&typeof h=="number"?(E-h)*c:String(E).localeCompare(String(h))*c})}function Ei(o,s){let c;for(let b of s)ao(b.conditions,b.logic,o)&&(c||(c={}),Object.assign(c,b.style));return c}function Ai(o,s,c){let b;for(let R of c)R.column===s&&ao(R.conditions,R.logic,o)&&(b||(b={}),Object.assign(b,R.style));return b}function so(o,s){let c=o,b=null,R=[],p=[],E=[],h=[],g=[],k=null,K=[],X=null;for(let x of s)switch(x.type){case "filter":c=ss(c,x);break;case "sort":b=x;break;case "rowStyle":R.push(x);break;case "cellStyle":p.push(x);break;case "hideColumns":E.push(...x.columns);break;case "showColumns":h.push(...x.columns);break;case "resizeColumn":g.push(x);break;case "reorderColumns":k=x;break;case "pinColumn":K.push(x);break;case "setPage":X=x;break}return b&&(c=ls(c,b)),{filteredData:c,sortOp:b,styleOps:R,cellStyleOps:p,hideColumns:E,showColumns:h,resizeOps:g,reorderOp:k,pinOps:K,setPageOp:X}}var Li=re.forwardRef(({accentColor:o="#1778ff"},s)=>{let c=re.useRef(null),b=re.useRef(null),R=re.useRef({headerLeftLocal:0,minSize:40,areaLeft:0,areaWidth:0,labelWidth:80,scrollLeft:0});return re.useImperativeHandle(s,()=>({show(E,h,g,k,K,X,x,T){let D=c.current,P=b.current;if(!D||!P)return;D.style.top=`${X}px`,D.style.height=`${g.height}px`,D.style.left=`${T-2.5}px`,D.style.display="block",P.textContent=`${h}`,P.style.top=`${X+8}px`,P.style.left=`${T+6}px`,P.style.display="block";let J=P.offsetWidth??80;R.current={headerLeftLocal:k,minSize:K,areaLeft:g.left,areaWidth:g.width,labelWidth:J,scrollLeft:x};},move(E){let h=c.current,g=b.current;if(!h||!g)return;let{headerLeftLocal:k,minSize:K,areaLeft:X,areaWidth:x,labelWidth:T,scrollLeft:D}=R.current,P=E-X+D,J=Math.max(P,k+K);h.style.left=`${J}px`;let Me=g.textContent||"",Se=Me.indexOf(":");Se!==-1&&(g.textContent=`${Me.substring(0,Se)}`),J-D+T+20>x?g.style.left=`${J-T-10}px`:g.style.left=`${J+6}px`;},hide(){let E=c.current,h=b.current;E&&(E.style.display="none"),h&&(h.style.display="none");}}),[]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:c,"aria-hidden":"true",style:{display:"none",position:"absolute",top:0,height:"0px",left:0,width:"2px",zIndex:30,pointerEvents:"none",backgroundColor:o,boxShadow:`0 0 4px ${((E,h)=>{let g=parseInt(E.slice(1,3),16),k=parseInt(E.slice(3,5),16),K=parseInt(E.slice(5,7),16);return `rgba(${g}, ${k}, ${K}, ${h})`})(o,.5)}`,willChange:"left"}}),jsxRuntime.jsx("div",{ref:b,"aria-hidden":"true",style:{display:"none",position:"absolute",top:"8px",left:0,zIndex:31,pointerEvents:"none",backgroundColor:o,color:"white",fontSize:"11px",fontWeight:600,lineHeight:1,padding:"4px 8px",borderRadius:"5px",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,0,0,0.2)",userSelect:"none",willChange:"left"}})]})});Li.displayName="ResizeOverlay";var co=Li;var zi=[55,70,45,80,60,50,75,65],Ni=({value:o,record:s,column:c,rowIndex:b,onEdit:R,onEditComplete:p})=>{let E=c.editorType??"text",[h,g]=re.useState(String(o??"")),k=re.useRef(null);re.useEffect(()=>{g(String(o??"")),requestAnimationFrame(()=>{k.current?.focus(),k.current instanceof HTMLInputElement&&k.current.select();});},[o]);let K=re.useCallback(T=>{let D=String(o??""),P=T!==void 0?T:h;if(String(P)!==D&&c.dataIndex){let J=P;T===void 0&&(J=typeof o=="number"&&!Number.isNaN(Number(h))?Number(h):h),R(J,s,c.dataIndex,b);}p();},[h,o,c.dataIndex,s,b,R,p]),X=re.useCallback(()=>{p();},[p]),x={width:"100%",height:"100%",border:"none",outline:"none",background:"transparent",font:"inherit",color:"inherit",padding:0,margin:0,boxSizing:"border-box"};if(E==="toggle")return jsxRuntime.jsx("label",{style:{display:"flex",alignItems:"center",cursor:"pointer",width:"100%",height:"100%"},children:jsxRuntime.jsx("input",{"data-bt-check":"",type:"checkbox",checked:!!o,onChange:T=>{K(T.target.checked);}})});if(E==="select"){let T=c.editorOptions??[];return jsxRuntime.jsx("select",{ref:k,value:h,onChange:D=>{g(D.target.value),K(D.target.value);},onBlur:()=>K(),onKeyDown:D=>{D.key==="Escape"&&X();},style:{...x,cursor:"pointer"},children:T.map(D=>{let P=typeof D=="string"?D:D.label,J=typeof D=="string"?D:String(D.value);return jsxRuntime.jsx("option",{value:J,children:P},J)})})}return jsxRuntime.jsx("input",{ref:k,type:E==="date"?"date":E==="number"?"number":"text",value:h,onChange:T=>g(T.target.value),onBlur:()=>K(),onKeyDown:T=>{T.key==="Enter"&&K(),T.key==="Escape"&&X();},style:x})};Ni.displayName="EditableCell";var xn=re__default.default.memo(({value:o,record:s,column:c,rowIndex:b,classNames:R,styles:p,isSelected:E,rowSelection:h,rowKey:g,allData:k,getRowKey:K,getRawRowKey:X,accentColor:x,isLoading:T,onEdit:D,isEditing:P,onEditComplete:J,cellStyleFn:Me,treeLevel:Se,treeHasChildren:B,treeExpanded:ue,treeIndentSize:qe=20,onTreeToggle:be,treeKey:$,isFirstDataCol:Re})=>{let we=!!c.pinned,Ce=Me?.(s,c.dataIndex??c.key),[he,Ee]=re.useState({loaded:false,value:void 0});if(re.useEffect(()=>{if(!c.lazyLoad)return;let se=false;return Ee({loaded:false,value:void 0}),c.lazyLoad(s).then(Y=>{se||Ee({loaded:true,value:Y});}).catch(()=>{se||Ee({loaded:true,value:void 0});}),()=>{se=true;}},[c.lazyLoad,s]),T&&c.key!=="__select__"&&c.key!=="__expand__"){let se=c.shimmerRender?c.shimmerRender():jsxRuntime.jsx("div",{style:{backgroundColor:"rgba(100, 116, 139, 0.15)",animation:"bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:4,width:`${zi[(b+c.key.length)%zi.length]}%`,height:14}});return jsxRuntime.jsx("div",{className:`${c.className??""} ${R?.cell??""} ${we?R?.pinnedCell??"":""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:8,paddingRight:8,height:"100%",boxSizing:"border-box",...c.style,...we?p?.pinnedCell:void 0,...p?.cell},children:se})}if(c.key==="__select__"&&h&&g!==void 0){let se=h.getCheckboxProps?.(s)??{disabled:false},Y=X?X(s,b):g,ee=h.type==="radio"?jsxRuntime.jsx("input",{"data-bt-check":"",type:"radio",checked:!!E,disabled:se.disabled,onChange:fe=>{fe.stopPropagation(),h.onSelect?.(s,true,[s],fe.nativeEvent),h.onChange?.([Y],[s],{type:"single"});}}):jsxRuntime.jsx("input",{"data-bt-check":"",type:"checkbox",checked:!!E,disabled:se.disabled,onChange:fe=>{fe.stopPropagation();let Fe=h.selectedRowKeys??[],Ye=E?Fe.filter(pe=>String(pe)!==g):[...Fe,Y],$e=(k??[]).filter((pe,Ke)=>{let Le=K?K(pe,Ke):String(Ke);return Ye.some(ne=>String(ne)===Le)});h.onSelect?.(s,!E,$e,fe.nativeEvent),h.onChange?.(Ye,$e,{type:"multiple"});}});return jsxRuntime.jsx("div",{className:`${c.className??""} ${R?.cell??""} ${we?R?.pinnedCell??"":""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:8,paddingRight:8,justifyContent:c.key==="__select__"||c.key==="__expand__"?"center":void 0,height:"100%",boxSizing:"border-box",...c.style,...we?p?.pinnedCell:void 0,...p?.cell},children:ee})}if(c.lazyLoad&&!he.loaded)return jsxRuntime.jsx("div",{role:"gridcell",className:`${c.className??""} ${R?.cell??""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:8,paddingRight:8,height:"100%",boxSizing:"border-box",...c.style,...p?.cell},children:jsxRuntime.jsx("div",{style:{backgroundColor:"rgba(100, 116, 139, 0.15)",animation:"bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:4,width:"60%",height:14}})});let Ae=c.lazyLoad?he.value:o,ge=!!c.editable&&!c.render&&!!D&&P&&J,ve;if(ge)ve=jsxRuntime.jsx(Ni,{value:Ae,record:s,column:c,rowIndex:b,onEdit:D,onEditComplete:J});else if(c.render)try{ve=c.render(Ae,s,b);}catch{ve=String(Ae??"");}else ve=Ae??"";let Be=c.key==="__select__"||c.key==="__expand__",nt=Re&&Se!=null&&Se>0,We=Re&&B,Xe=nt?Se*qe:0;return jsxRuntime.jsxs("div",{role:"gridcell",className:`${c.className??""} ${R?.cell??""} ${we?R?.pinnedCell??"":""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:Re?8+Xe:8,paddingRight:8,justifyContent:Be?"center":void 0,height:"100%",boxSizing:"border-box",minWidth:0,...c.style,...we?p?.pinnedCell:void 0,...p?.cell,...Ce},children:[We&&jsxRuntime.jsx("button",{type:"button",onClick:se=>{se.stopPropagation(),be?.($);},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,marginRight:4,width:16,height:16,flexShrink:0,transform:ue?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.15s ease",fontSize:"0.75em",color:"inherit",opacity:.6},children:"\u25BC"}),Re&&Se!=null&&!B&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:20,flexShrink:0}}),Be||ge?ve:jsxRuntime.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,maxWidth:"100%"},onMouseEnter:se=>{let Y=se.currentTarget;Y.scrollWidth>Y.clientWidth?Y.title=Y.textContent??"":Y.removeAttribute("title");},children:ve})]})},(o,s)=>o.isLoading!==s.isLoading||o.column.pinned!==s.column.pinned||o.classNames!==s.classNames||o.styles!==s.styles||o.column.editable!==s.column.editable||o.onEdit!==s.onEdit||o.isEditing!==s.isEditing||o.onEditComplete!==s.onEditComplete||o.cellStyleFn!==s.cellStyleFn?false:o.column.key==="__select__"?o.isSelected===s.isSelected&&o.normalizedSelectedKeys===s.normalizedSelectedKeys:o.column.key==="__expand__"?o.isExpanded===s.isExpanded:o.column.render?o.recordFingerprint!==s.recordFingerprint||o.rowIndex!==s.rowIndex?false:o.column.render===s.column.render:o.value===s.value&&o.rowIndex===s.rowIndex&&o.column.key===s.column.key);xn.displayName="Cell";var Di=re__default.default.memo(({rowKey:o,onResize:s,children:c})=>{let b=re.useRef(null),R=re.useRef(s);return re.useEffect(()=>{R.current=s;},[s]),re.useEffect(()=>{let p=b.current;if(!p)return;let E=new ResizeObserver(h=>{let g=h[0]?.borderBoxSize?.[0]?.blockSize;g!=null&&g>0&&R.current(o,g);});return E.observe(p),()=>E.disconnect()},[o]),jsxRuntime.jsx("div",{ref:b,children:c})});Di.displayName="MeasuredExpandedRow";var Bi=re__default.default.memo(({index:o,onHeightChange:s,children:c})=>{let b=re.useRef(null),R=re.useRef(s);return re.useEffect(()=>{R.current=s;},[s]),re.useEffect(()=>{let p=b.current;if(!p)return;let E=new ResizeObserver(h=>{let g=h[0]?.borderBoxSize?.[0]?.blockSize;g!=null&&g>0&&R.current(o,Math.ceil(g));});return E.observe(p),()=>E.disconnect()},[o]),jsxRuntime.jsx("div",{ref:b,children:c})});Bi.displayName="DynamicRowMeasurer";var Fi=({data:o,orderedColumns:s,rowVirtualizer:c,columnOffsets:b,styles:R,classNames:p,rowSelection:E,normalizedSelectedKeys:h=[],getRowKey:g,getRawRowKey:k,expandable:K,resolvedExpandedKeys:X,rowHeight:x=40,totalTableWidth:T,scrollAreaWidth:D,accentColor:P,isLoading:J=false,onExpandedRowResize:Me,maxExpandedRowHeight:Se,pinnedTopData:B=[],pinnedBottomData:ue=[],gridTemplateColumns:qe,headerHeight:be=36,rowClassName:$,rowStyle:Re,bodyGridRow:we=2,onEdit:Ce,editingCell:he,onEditComplete:Ee,enableDynamicRowHeight:Ae=false,onRowHeightChange:xe,columnGridIndexMap:ge,cellStyleFn:ve,onRowDragStart:Be,focusedCell:nt,enableRowAnimation:We=false,onGroupToggle:Xe,groupAccentColor:se,onTreeToggle:Y,treeIndentSize:ee=20})=>{let fe=c.getVirtualItems(),Fe=c.getTotalSize(),Ye=re.useMemo(()=>new Set(h),[h]),$e=o??[],pe=s??[],Ke=re.useMemo(()=>{let M=new Set(["__select__","__expand__","__drag__"]);return pe.findIndex(U=>!M.has(U.key))},[pe]),Le=re.useMemo(()=>B.length===0&&ue.length===0?$e:[...B,...$e,...ue],[B,$e,ue]),ne=R?.pinnedRowBg??R?.pinnedBg,rt=re.useMemo(()=>pe.map((M,U)=>{let v=b.get(M.key),w=!!M.pinned,O=0;M.key==="__select__"||M.key==="__expand__"?O=11:w&&(O=2);let ke={gridColumn:ge?.get(M.key)??U+1,gridRow:we,height:`${Fe}px`,position:w?"sticky":"relative",zIndex:O};return M.pinned==="left"&&v!==void 0?ke.left=`${v}px`:M.pinned==="right"&&v!==void 0&&(ke.right=`${v}px`),w&&R?.pinnedCell&&Object.assign(ke,R.pinnedCell),{key:M.key,style:ke,isPinned:w}}),[pe,b,Fe,R,we,ge]);return $e.length===0||pe.length===0?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[rt.map((M,U)=>{let v=pe[U];if(!v)return null;let w=!!v.render;return jsxRuntime.jsx("div",{...M.isPinned?{"data-bt-pinned":""}:{},style:M.style,children:fe.map(O=>{let F=$e[O.index];if(F==null)return null;if(!!F.__bt_group_header__){let Ie=F.__bt_group_key__,rr=F.__bt_group_value__,or=F.__bt_group_count__,Rn=F.__bt_group_collapsed__,gt=F.__bt_group_aggregates__??{};return U===0?jsxRuntime.jsxs("div",{"data-bt-group-header":Ie,className:p?.groupHeader??"",style:{position:"absolute",top:`${O.start}px`,left:0,right:0,height:`${O.size}px`,display:"flex",alignItems:"center",gap:8,paddingLeft:8,paddingRight:8,fontSize:"inherit",fontWeight:600,cursor:"pointer",borderBottom:"1px solid rgba(128,128,128,0.2)",background:`linear-gradient(90deg, ${se??"#6366f1"}08, transparent)`,gridColumn:"1 / -1",userSelect:"none",...R?.groupHeader},onClick:()=>Xe?.(Ie),children:[jsxRuntime.jsx("span",{style:{display:"inline-flex",transform:Rn?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.15s ease",fontSize:"0.75em"},children:"\u25BC"}),jsxRuntime.jsx("span",{children:String(rr??Ie)}),jsxRuntime.jsxs("span",{style:{opacity:.5,fontWeight:400},children:["(",or,")"]}),Object.entries(gt).map(([ie,V])=>jsxRuntime.jsxs("span",{style:{opacity:.6,fontWeight:400,marginLeft:4},children:[ie,": ",String(V??"")]},ie))]},`group-${Ie}`):null}let j=F.__bt_tree_level__,_e=F.__bt_tree_has_children__,oe=F.__bt_tree_expanded__,Oe=F.__bt_tree_key__,le=g?g(F,O.index):String(O.index),Ne=Ye.has(le),kn=X?.has(le)??false,ut=v.dataIndex!=null?F[v.dataIndex]:void 0,ot=J||le.startsWith("__shimmer_"),Lt;if(w&&!ot)try{Lt=JSON.stringify(F);}catch{Lt=le;}let Sn="";try{Sn=$?$(F,O.index):"";}catch{}let pt;try{pt=Re?Re(F,O.index):void 0;}catch{}let it=nt?.row===O.index&&nt?.col===U;return jsxRuntime.jsx("div",{"data-row-key":le,"data-row-index":O.index,"data-column-key":v.key,"data-bt-cell":"","data-selected":Ne||void 0,...it?{"data-bt-focused":""}:{},className:Sn||void 0,style:{position:"absolute",top:`${O.start}px`,left:0,right:0,height:Ae?void 0:`${O.size}px`,minHeight:Ae?`${x}px`:void 0,...We?{transition:"top 0.2s ease, opacity 0.2s ease"}:{}},children:v.key==="__drag__"&&Be?jsxRuntime.jsx("div",{style:{height:`${x}px`,display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid rgba(128,128,128,0.2)",...pt},children:jsxRuntime.jsx("span",{"data-bt-row-grip":"",onPointerDown:Ie=>{Ie.button===0&&Be(O.index,Ie);},style:{display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none",width:"100%",height:"100%"},children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"9",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"19",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"19",r:"1"})]})})}):Ae&&xe&&U===0?jsxRuntime.jsx(Bi,{index:O.index,onHeightChange:xe,children:jsxRuntime.jsx("div",{style:{minHeight:`${x}px`,position:"relative",...pt},children:jsxRuntime.jsx(xn,{value:ut,record:F,column:v,rowIndex:O.index,classNames:p,styles:R,isSelected:Ne,isExpanded:kn,rowSelection:E,normalizedSelectedKeys:h,rowKey:le,allData:Le,getRowKey:g,getRawRowKey:k,accentColor:P,isLoading:ot,recordFingerprint:Lt,onEdit:Ce,isEditing:he?.rowKey===le&&he?.columnKey===v.key,onEditComplete:Ee,cellStyleFn:ve,treeLevel:j,treeHasChildren:_e,treeExpanded:oe,treeIndentSize:ee,onTreeToggle:Y,treeKey:Oe,isFirstDataCol:U===Ke})})}):jsxRuntime.jsx("div",{style:{height:Ae?void 0:`${x}px`,minHeight:Ae?`${x}px`:void 0,position:"relative",...pt},children:jsxRuntime.jsx(xn,{value:ut,record:F,column:v,rowIndex:O.index,classNames:p,styles:R,isSelected:Ne,isExpanded:kn,rowSelection:E,normalizedSelectedKeys:h,rowKey:le,allData:Le,getRowKey:g,getRawRowKey:k,accentColor:P,isLoading:ot,recordFingerprint:Lt,onEdit:Ce,isEditing:he?.rowKey===le&&he?.columnKey===v.key,onEditComplete:Ee,cellStyleFn:ve,treeLevel:j,treeHasChildren:_e,treeExpanded:oe,treeIndentSize:ee,onTreeToggle:Y,treeKey:Oe,isFirstDataCol:U===Ke})})},`${le}-${v.key}`)})},`spacer-${M.key}`)}),K&&jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",gridRow:we,height:`${Fe}px`,position:"relative",zIndex:15,pointerEvents:"none"},children:fe.map(M=>{let U=$e[M.index];if(U==null)return null;let v=g?g(U,M.index):String(M.index);if(!(X?.has(v)??false))return null;let w=null;try{w=K.expandedRowRender(U,M.index,0,!0);}catch{}let O=jsxRuntime.jsx("div",{className:p?.expandedRow??"",style:{position:"sticky",left:0,zIndex:5,width:D&&D>0?`${D}px`:"100%",overflow:"auto",pointerEvents:"auto",borderBottom:"1px solid rgba(128,128,128,0.2)",backgroundColor:"rgba(128,128,128,0.06)",padding:20,...Se?{maxHeight:`${Se}px`}:void 0,...R?.expandedRow},children:w});return jsxRuntime.jsx("div",{style:{position:"absolute",top:M.start+x,left:0,right:0},children:Me?jsxRuntime.jsx(Di,{rowKey:v,onResize:Me,children:O}):O},`expanded-${v}`)})}),B.length>0&&jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",gridRow:we,height:`${Fe}px`,position:"relative",zIndex:20,pointerEvents:"none"},children:jsxRuntime.jsx("div",{style:{position:"sticky",top:be,pointerEvents:"auto",boxShadow:"0 2px 6px -1px rgba(0,0,0,0.08)"},children:B.map((M,U)=>{if(M==null)return null;let v=g?g(M,U):String(U),w=Ye.has(v),O=X?.has(v)??false,F="";try{F=$?$(M,U):"";}catch{}let ke;try{ke=Re?Re(M,U):void 0;}catch{}return jsxRuntime.jsx("div",{className:`${p?.pinnedRow??""} ${F}`.trim()||void 0,style:{display:"grid",gridTemplateColumns:qe??"",minWidth:T?`${T}px`:void 0,...R?.pinnedRow,...ke},children:pe.map(j=>{let _e=j.dataIndex!=null?M[j.dataIndex]:void 0,oe=b.get(j.key),Oe=!!j.pinned,le=0;j.key==="__select__"||j.key==="__expand__"?le=11:Oe&&(le=2);let Ne;if(j.render)try{Ne=JSON.stringify(M);}catch{Ne=v;}return jsxRuntime.jsx("div",{"data-row-key":v,"data-column-key":j.key,"data-bt-cell":"","data-selected":w||void 0,style:{position:Oe?"sticky":"relative",...j.pinned==="left"&&oe!==void 0?{left:`${oe}px`}:{},...j.pinned==="right"&&oe!==void 0?{right:`${oe}px`}:{},zIndex:le,backgroundColor:ne,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",...Oe&&R?.pinnedCell?R.pinnedCell:{}},children:jsxRuntime.jsx("div",{style:{height:`${x}px`,position:"relative"},children:jsxRuntime.jsx(xn,{value:_e,record:M,column:j,rowIndex:U,classNames:p,styles:R,isSelected:w,isExpanded:O,rowSelection:E,normalizedSelectedKeys:h,rowKey:v,allData:Le,getRowKey:g,getRawRowKey:k,accentColor:P,isLoading:false,recordFingerprint:Ne,onEdit:Ce,isEditing:he?.rowKey===v&&he?.columnKey===j.key,onEditComplete:Ee,cellStyleFn:ve,isFirstDataCol:false})})},j.key)})},`pinned-top-${v}`)})})}),ue.length>0&&jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",gridRow:we,height:`${Fe}px`,position:"relative",zIndex:20,pointerEvents:"none",display:"flex",flexDirection:"column"},children:jsxRuntime.jsx("div",{style:{marginTop:"auto",position:"sticky",bottom:0,pointerEvents:"auto",boxShadow:"0 -2px 6px -1px rgba(0,0,0,0.08)"},children:ue.map((M,U)=>{if(M==null)return null;let v=g?g(M,U):String(U),w=Ye.has(v),O=X?.has(v)??false,F="";try{F=$?$(M,U):"";}catch{}let ke;try{ke=Re?Re(M,U):void 0;}catch{}return jsxRuntime.jsx("div",{className:`${p?.pinnedRow??""} ${F}`.trim()||void 0,style:{display:"grid",gridTemplateColumns:qe??"",minWidth:T?`${T}px`:void 0,...R?.pinnedRow,...ke},children:pe.map(j=>{let _e=j.dataIndex!=null?M[j.dataIndex]:void 0,oe=b.get(j.key),Oe=!!j.pinned,le=0;j.key==="__select__"||j.key==="__expand__"?le=11:Oe&&(le=2);let Ne;if(j.render)try{Ne=JSON.stringify(M);}catch{Ne=v;}return jsxRuntime.jsx("div",{"data-row-key":v,"data-column-key":j.key,"data-bt-cell":"","data-selected":w||void 0,style:{position:Oe?"sticky":"relative",...j.pinned==="left"&&oe!==void 0?{left:`${oe}px`}:{},...j.pinned==="right"&&oe!==void 0?{right:`${oe}px`}:{},zIndex:le,backgroundColor:ne,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",...Oe&&R?.pinnedCell?R.pinnedCell:{}},children:jsxRuntime.jsx("div",{style:{height:`${x}px`,position:"relative"},children:jsxRuntime.jsx(xn,{value:_e,record:M,column:j,rowIndex:U,classNames:p,styles:R,isSelected:w,isExpanded:O,rowSelection:E,normalizedSelectedKeys:h,rowKey:v,allData:Le,getRowKey:g,getRawRowKey:k,accentColor:P,isLoading:false,recordFingerprint:Ne,onEdit:Ce,isEditing:he?.rowKey===v&&he?.columnKey===j.key,onEditComplete:Ee,cellStyleFn:ve,isFirstDataCol:false})})},j.key)})},`pinned-bottom-${v}`)})})})]})};Fi.displayName="TableBody";var po=Fi;function ys(o,s,c){let b=o.slice(),[R]=b.splice(s,1);return b.splice(c,0,R),b}function fo(o){let s=[];for(let c of o)c!=null&&(c.children&&c.children.length>0?s.push(...fo(c.children)):s.push(c));return s}var Pi=[55,70,45,80,60,50,75,65,40,72],hs={},ms={},Hi=[],Wi=[];function Ki({columns:o,data:s,rowHeight:c=40,expandedRowHeight:b=200,maxExpandedRowHeight:R,accentColor:p="#1890ff",theme:E="auto",className:h="",classNames:g=hs,styles:k=ms,gripIcon:K,hideGripIcon:X,icons:x,pagination:T,onPaginationChange:D,onColumnResize:P,onColumnOrderChange:J,onColumnPin:Me,onColumnHide:Se,rowSelection:B,rowPinning:ue,onRowPin:qe,expandable:be,rowKey:$="id",onEndReached:Re,onEndReachedThreshold:we=5,isLoading:Ce=false,onSortChange:he,multiSort:Ee=false,onMultiSortChange:Ae,onFilterChange:xe,columnContextMenuItems:ge,autoHeight:ve=true,layoutLoading:Be,emptyRenderer:nt,rowClassName:We,rowStyle:Xe,conditionalFormatting:se,rowGrouping:Y,treeData:ee,masterDetail:fe,enableFilterBuilder:Fe=false,disabledFilters:Ye,onCopy:$e,keepPinnedRowsAcrossPages:pe,onEdit:Ke,onRowClick:Le,enableColumnVirtualization:ne=false,enableDynamicRowHeight:rt=false,columnPersistence:M=false,showColumnSettings:U=true,hideGlobalSearch:v=false,globalSearchValue:w,onGlobalSearchChange:O,toolbarContent:F,toolbarRight:ke,columnSettingsLabel:j,aiMode:_e=false,aiConfig:oe,onAIQuery:Oe,onAIResponse:le,aiPlaceholder:Ne="Ask AI anything about your data...",aiButtonLabel:kn,onAIInsights:ut,onAIChart:ot,enableRowAnimation:Lt=false,showStatusBar:Sn=false,statusBarContent:pt,rowDragEnabled:it=false,onRowReorder:Ie}){let rr=re__default.default.useRef(null),[or,Rn]=re__default.default.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:false);re__default.default.useEffect(()=>{if(E!=="auto")return;let e=window.matchMedia("(prefers-color-scheme: dark)");Rn(e.matches);let t=n=>Rn(n.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[E]);let gt=E==="dark"||E==="auto"&&or,ie=re.useMemo(()=>gt?{color:"#e0e0e0",bg:"#0f0f0f",cardBg:"#181818",border:"#333",inputBg:"#1a1a1a",menuBg:"rgba(28,28,30,0.92)",menuShadow:"0 8px 24px rgba(0,0,0,0.5)"}:{color:"#1a1a2e",bg:"#ffffff",cardBg:"#ffffff",border:"#ddd",inputBg:"#ffffff",menuBg:"rgba(255,255,255,0.95)",menuShadow:"0 8px 24px rgba(0,0,0,0.12)"},[gt]),V=re.useMemo(()=>{if(!Array.isArray(s))return Hi;let e=s.filter(t=>t!=null);return e.length>0?e:Hi},[s]),ae=re.useMemo(()=>{if(!Array.isArray(o))return Wi;let e=o.filter(r=>r!=null&&typeof r.key=="string"),n=fo(e).filter(r=>r!=null&&typeof r.key=="string");return n.length>0?n:Wi},[o]),Ot=re.useMemo(()=>{if(!Array.isArray(o))return [];let e=[];for(let t of o)if(t!=null&&typeof t.key=="string"&&t.children&&t.children.length>0){let n=fo([t]).filter(r=>r!=null&&typeof r.key=="string").map(r=>r.key);n.length>0&&e.push({key:t.key,title:t.title,childKeys:n,style:t.style,className:t.className});}return e},[o]),Ue=Ot.length>0,ji=re.useMemo(()=>{if(!Ue)return null;let e=new Set;for(let t of Ot)for(let n of t.childKeys)e.add(n);return e},[Ot,Ue]),[ft,at]=re.useState(ae),[wn,Yt]=re.useState(()=>ae.map(e=>e.key)),[yo,ho]=re.useState(null),[ir,Gi]=re.useState(false),[Ut,yt]=re.useState(null),[mo,ar]=re.useState(null);re__default.default.useEffect(()=>{Gi(true);},[]);let bo=re.useRef(""),sr=ae.map(e=>{let t=typeof e.width=="number"?Math.round(e.width):e.width??"";return `${e.key}:${!!e.hidden}:${e.pinned||""}:${t}`}).join("|"),Cn=re.useRef(ae);Cn.current=ae,re__default.default.useEffect(()=>{bo.current!==sr&&(bo.current=sr,at(Cn.current),Yt(Cn.current.map(e=>e.key)));},[sr]);let Vi=(e,t=150)=>typeof e=="number"&&Number.isFinite(e)?e:t,[_n,Jt]=re.useState(()=>new Map),xo=re.useRef(new Set),lr=re.useRef(false);re__default.default.useEffect(()=>{if(!M||lr.current)return;lr.current=true;let{storageKey:e,persistOrder:t=true,persistWidths:n=true,persistVisibility:r=true,persistPinned:l=true}=M;try{let d=localStorage.getItem(`bt_${e}`);if(!d)return;let i=JSON.parse(d);t&&i.order&&Yt(i.order),n&&i.widths&&Jt(new Map(Object.entries(i.widths).map(([u,y])=>[u,Number(y)]))),(r&&i.hidden||l&&i.pinned)&&at(u=>u.map(y=>{let m=y;return r&&i.hidden&&y.key in i.hidden&&(m={...m,hidden:i.hidden[y.key]}),l&&i.pinned&&y.key in i.pinned&&(m={...m,pinned:i.pinned[y.key]}),m}));}catch{}},[M]);let vo=re.useCallback(()=>{if(!M)return;let{storageKey:e,persistOrder:t=true,persistWidths:n=true,persistVisibility:r=true,persistPinned:l=true}=M;try{let d={};if(t&&(d.order=wn),n){let i={};_n.forEach((u,y)=>{i[y]=u;}),d.widths=i;}if(r){let i={};ft.forEach(u=>{u.hidden&&(i[u.key]=!0);}),d.hidden=i;}if(l){let i={};ft.forEach(u=>{u.pinned&&(i[u.key]=u.pinned);}),d.pinned=i;}localStorage.setItem(`bt_${e}`,JSON.stringify(d));}catch{}},[M,wn,_n,ft]);re__default.default.useEffect(()=>{!M||!lr.current||vo();},[M,vo]);let[dr,cr]=re.useState(false),ur=re.useRef(null);re__default.default.useEffect(()=>{if(!dr)return;let e=n=>{ur.current&&!ur.current.contains(n.target)&&cr(false);},t=n=>{n.key==="Escape"&&cr(false);};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t);}},[dr]);let Zt=!!(_e&&v&&!U&&!F),[qi,ko]=re.useState(false),st=Zt||qi,[ze,pr]=re.useState(""),[zt,So]=re.useState(false),[ht,gr]=re.useState(null),[Ro,In]=re.useState(null),fr=re.useRef(null),[wo,Co]=re.useState([]),[Xi,$t]=re.useState(false),[_o,Tn]=re.useState(null),[En,Io]=re.useState(false),Yi=re.useCallback(async()=>{Io(true),Tn(null);try{let e;if(ut)e=await ut(V,ae);else if(oe){let t=`You are a data analyst. Analyze the provided dataset and give concise insights: trends, outliers, summary statistics, and notable patterns. Reply in plain text, not JSON.
33
+ - Combine multiple ops freely. Message: concise plain English.`;return oo={fingerprint:c,prompt:E},E}async function io(o,s,c,b=[]){let{provider:w,apiKey:p,model:E,baseUrl:h,maxTokens:g=1024,temperature:k=.1}=o;if(w==="openai"||w==="custom"){let V=h?`${h.replace(/\/$/,"")}/chat/completions`:"https://api.openai.com/v1/chat/completions",X=[{role:"system",content:s},...b,{role:"user",content:c}],x=await fetch(V,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`},body:JSON.stringify({model:E??"gpt-4o-mini",messages:X,max_tokens:g,temperature:k})});if(!x.ok){let $=await x.text().catch(()=>"");throw new Error(`AI request failed (${x.status}): ${$}`)}return (await x.json()).choices?.[0]?.message?.content??""}if(w==="anthropic"){let V=h?`${h.replace(/\/$/,"")}/messages`:"https://api.anthropic.com/v1/messages",X=await fetch(V,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":"2023-06-01","anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify({model:E??"claude-sonnet-4-20250514",system:s,messages:[...b,{role:"user",content:c}],max_tokens:g,temperature:k})});if(!X.ok){let $=await X.text().catch(()=>"");throw new Error(`AI request failed (${X.status}): ${$}`)}return (await X.json()).content?.find($=>$.type==="text")?.text??""}throw new Error(`Unsupported AI provider: ${w}`)}function Ti(o){let s=o.trim(),c=s.match(/```(?:json)?\s*([\s\S]*?)```/);c&&(s=c[1].trim());let b=s.indexOf("{"),w=s.lastIndexOf("}");b!==-1&&w>b&&(s=s.slice(b,w+1));let p=JSON.parse(s);if(!p.operations||!Array.isArray(p.operations))throw new Error("Invalid AI response: missing operations array");return {operations:p.operations,message:p.message??"AI operations applied."}}function Ii(o,s){let c=s[o.column],b=o.value;switch(o.op){case "eq":return c==b;case "neq":return c!=b;case "gt":return Number(c)>Number(b);case "gte":return Number(c)>=Number(b);case "lt":return Number(c)<Number(b);case "lte":return Number(c)<=Number(b);case "contains":return String(c??"").toLowerCase().includes(String(b).toLowerCase());case "notContains":return !String(c??"").toLowerCase().includes(String(b).toLowerCase());case "startsWith":return String(c??"").toLowerCase().startsWith(String(b).toLowerCase());case "endsWith":return String(c??"").toLowerCase().endsWith(String(b).toLowerCase());case "in":return Array.isArray(b)?b.some(w=>c==w):false;case "notIn":return Array.isArray(b)?!b.some(w=>c==w):true;default:return true}}function ao(o,s,c){return !o||o.length===0?true:s==="or"?o.some(b=>Ii(b,c)):o.every(b=>Ii(b,c))}function cs(o,s){return o.filter(c=>ao(s.conditions,s.logic,c))}function us(o,s){let c=s.direction==="asc"?1:-1,b=s.column;return [...o].sort((w,p)=>{let E=w[b],h=p[b];return E==null&&h==null?0:E==null?1:h==null?-1:typeof E=="number"&&typeof h=="number"?(E-h)*c:String(E).localeCompare(String(h))*c})}function Ei(o,s){let c;for(let b of s)ao(b.conditions,b.logic,o)&&(c||(c={}),Object.assign(c,b.style));return c}function Ai(o,s,c){let b;for(let w of c)w.column===s&&ao(w.conditions,w.logic,o)&&(b||(b={}),Object.assign(b,w.style));return b}function so(o,s){let c=o,b=null,w=[],p=[],E=[],h=[],g=[],k=null,V=[],X=null;for(let x of s)switch(x.type){case "filter":c=cs(c,x);break;case "sort":b=x;break;case "rowStyle":w.push(x);break;case "cellStyle":p.push(x);break;case "hideColumns":E.push(...x.columns);break;case "showColumns":h.push(...x.columns);break;case "resizeColumn":g.push(x);break;case "reorderColumns":k=x;break;case "pinColumn":V.push(x);break;case "setPage":X=x;break}return b&&(c=us(c,b)),{filteredData:c,sortOp:b,styleOps:w,cellStyleOps:p,hideColumns:E,showColumns:h,resizeOps:g,reorderOp:k,pinOps:V,setPageOp:X}}var Li=oe.forwardRef(({accentColor:o="#1778ff"},s)=>{let c=oe.useRef(null),b=oe.useRef(null),w=oe.useRef({headerLeftLocal:0,minSize:40,areaLeft:0,areaWidth:0,labelWidth:80,scrollLeft:0});return oe.useImperativeHandle(s,()=>({show(E,h,g,k,V,X,x,T){let $=c.current,D=b.current;if(!$||!D)return;$.style.top=`${X}px`,$.style.height=`${g.height}px`,$.style.left=`${T-2.5}px`,$.style.display="block",D.textContent=`${h}`,D.style.top=`${X+8}px`,D.style.left=`${T+6}px`,D.style.display="block";let J=D.offsetWidth??80;w.current={headerLeftLocal:k,minSize:V,areaLeft:g.left,areaWidth:g.width,labelWidth:J,scrollLeft:x};},move(E){let h=c.current,g=b.current;if(!h||!g)return;let{headerLeftLocal:k,minSize:V,areaLeft:X,areaWidth:x,labelWidth:T,scrollLeft:$}=w.current,D=E-X+$,J=Math.max(D,k+V);h.style.left=`${J}px`;let Ae=g.textContent||"",ke=Ae.indexOf(":");ke!==-1&&(g.textContent=`${Ae.substring(0,ke)}`),J-$+T+20>x?g.style.left=`${J-T-10}px`:g.style.left=`${J+6}px`;},hide(){let E=c.current,h=b.current;E&&(E.style.display="none"),h&&(h.style.display="none");}}),[]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:c,"aria-hidden":"true",style:{display:"none",position:"absolute",top:0,height:"0px",left:0,width:"2px",zIndex:30,pointerEvents:"none",backgroundColor:o,boxShadow:`0 0 4px ${((E,h)=>{let g=parseInt(E.slice(1,3),16),k=parseInt(E.slice(3,5),16),V=parseInt(E.slice(5,7),16);return `rgba(${g}, ${k}, ${V}, ${h})`})(o,.5)}`,willChange:"left"}}),jsxRuntime.jsx("div",{ref:b,"aria-hidden":"true",style:{display:"none",position:"absolute",top:"8px",left:0,zIndex:31,pointerEvents:"none",backgroundColor:o,color:"white",fontSize:"11px",fontWeight:600,lineHeight:1,padding:"4px 8px",borderRadius:"5px",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,0,0,0.2)",userSelect:"none",willChange:"left"}})]})});Li.displayName="ResizeOverlay";var co=Li;var zi=[55,70,45,80,60,50,75,65],$i=({value:o,record:s,column:c,rowIndex:b,onEdit:w,onEditComplete:p})=>{let E=c.editorType??"text",[h,g]=oe.useState(String(o??"")),k=oe.useRef(null);oe.useEffect(()=>{g(String(o??"")),requestAnimationFrame(()=>{k.current?.focus(),k.current instanceof HTMLInputElement&&k.current.select();});},[o]);let V=oe.useCallback(T=>{let $=String(o??""),D=T!==void 0?T:h;if(String(D)!==$&&c.dataIndex){let J=D;T===void 0&&(J=typeof o=="number"&&!Number.isNaN(Number(h))?Number(h):h),w(J,s,c.dataIndex,b);}p();},[h,o,c.dataIndex,s,b,w,p]),X=oe.useCallback(()=>{p();},[p]),x={width:"100%",height:"100%",border:"none",outline:"none",background:"transparent",font:"inherit",color:"inherit",padding:0,margin:0,boxSizing:"border-box"};if(E==="toggle")return jsxRuntime.jsx("label",{style:{display:"flex",alignItems:"center",cursor:"pointer",width:"100%",height:"100%"},children:jsxRuntime.jsx("input",{"data-bt-check":"",type:"checkbox",checked:!!o,onChange:T=>{V(T.target.checked);}})});if(E==="select"){let T=c.editorOptions??[];return jsxRuntime.jsx("select",{ref:k,value:h,onChange:$=>{g($.target.value),V($.target.value);},onBlur:()=>V(),onKeyDown:$=>{$.key==="Escape"&&X();},style:{...x,cursor:"pointer"},children:T.map($=>{let D=typeof $=="string"?$:$.label,J=typeof $=="string"?$:String($.value);return jsxRuntime.jsx("option",{value:J,children:D},J)})})}return jsxRuntime.jsx("input",{ref:k,type:E==="date"?"date":E==="number"?"number":"text",value:h,onChange:T=>g(T.target.value),onBlur:()=>V(),onKeyDown:T=>{T.key==="Enter"&&V(),T.key==="Escape"&&X();},style:x})};$i.displayName="EditableCell";var bn=oe__default.default.memo(({value:o,record:s,column:c,rowIndex:b,classNames:w,styles:p,isSelected:E,rowSelection:h,rowKey:g,allData:k,getRowKey:V,getRawRowKey:X,accentColor:x,isLoading:T,onEdit:$,isEditing:D,onEditComplete:J,cellStyleFn:Ae,treeLevel:ke,treeHasChildren:B,treeExpanded:ge,treeIndentSize:Ve=20,onTreeToggle:be,treeKey:N,isFirstDataCol:Se})=>{let Re=!!c.pinned,we=Ae?.(s,c.dataIndex??c.key),[me,Ie]=oe.useState({loaded:false,value:void 0});if(oe.useEffect(()=>{if(!c.lazyLoad)return;let ie=false;return Ie({loaded:false,value:void 0}),c.lazyLoad(s).then(U=>{ie||Ie({loaded:true,value:U});}).catch(()=>{ie||Ie({loaded:true,value:void 0});}),()=>{ie=true;}},[c.lazyLoad,s]),T&&c.key!=="__select__"&&c.key!=="__expand__"){let ie=c.shimmerRender?c.shimmerRender():jsxRuntime.jsx("div",{style:{backgroundColor:"rgba(100, 116, 139, 0.15)",animation:"bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:4,width:`${zi[(b+c.key.length)%zi.length]}%`,height:14}});return jsxRuntime.jsx("div",{className:`${c.className??""} ${w?.cell??""} ${Re?w?.pinnedCell??"":""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:8,paddingRight:8,height:"100%",boxSizing:"border-box",...c.style,...Re?p?.pinnedCell:void 0,...p?.cell},children:ie})}if(c.key==="__select__"&&h&&g!==void 0){let ie=h.getCheckboxProps?.(s)??{disabled:false},U=X?X(s,b):g,te=h.type==="radio"?jsxRuntime.jsx("input",{"data-bt-check":"",type:"radio",checked:!!E,disabled:ie.disabled,onChange:ae=>{ae.stopPropagation(),h.onSelect?.(s,true,[s],ae.nativeEvent),h.onChange?.([U],[s],{type:"single"});}}):jsxRuntime.jsx("input",{"data-bt-check":"",type:"checkbox",checked:!!E,disabled:ie.disabled,onChange:ae=>{ae.stopPropagation();let Xe=h.selectedRowKeys??[],Ne=E?Xe.filter(Me=>String(Me)!==g):[...Xe,U],Ee=(k??[]).filter((Me,ze)=>{let De=V?V(Me,ze):String(ze);return Ne.some(re=>String(re)===De)});h.onSelect?.(s,!E,Ee,ae.nativeEvent),h.onChange?.(Ne,Ee,{type:"multiple"});}});return jsxRuntime.jsx("div",{className:`${c.className??""} ${w?.cell??""} ${Re?w?.pinnedCell??"":""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:8,paddingRight:8,justifyContent:c.key==="__select__"||c.key==="__expand__"?"center":void 0,height:"100%",boxSizing:"border-box",...c.style,...Re?p?.pinnedCell:void 0,...p?.cell},children:te})}if(c.lazyLoad&&!me.loaded)return jsxRuntime.jsx("div",{role:"gridcell",className:`${c.className??""} ${w?.cell??""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:8,paddingRight:8,height:"100%",boxSizing:"border-box",...c.style,...p?.cell},children:jsxRuntime.jsx("div",{style:{backgroundColor:"rgba(100, 116, 139, 0.15)",animation:"bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:4,width:"60%",height:14}})});let _e=c.lazyLoad?me.value:o,ye=!!c.editable&&!c.render&&!!$&&D&&J,xe;if(ye)xe=jsxRuntime.jsx($i,{value:_e,record:s,column:c,rowIndex:b,onEdit:$,onEditComplete:J});else if(c.render)try{xe=c.render(_e,s,b);}catch{xe=String(_e??"");}else xe=_e??"";let Be=c.key==="__select__"||c.key==="__expand__",st=Se&&ke!=null&&ke>0,We=Se&&B,qe=st?ke*Ve:0;return jsxRuntime.jsxs("div",{role:"gridcell",className:`${c.className??""} ${w?.cell??""} ${Re?w?.pinnedCell??"":""}`,style:{display:"flex",alignItems:"center",overflow:"hidden",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:Se?8+qe:8,paddingRight:8,justifyContent:Be?"center":void 0,height:"100%",boxSizing:"border-box",minWidth:0,...c.style,...Re?p?.pinnedCell:void 0,...p?.cell,...we},children:[We&&jsxRuntime.jsx("button",{type:"button",onClick:ie=>{ie.stopPropagation(),be?.(N);},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,marginRight:4,width:16,height:16,flexShrink:0,transform:ge?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.15s ease",fontSize:"0.75em",color:"inherit",opacity:.6},children:"\u25BC"}),Se&&ke!=null&&!B&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:20,flexShrink:0}}),Be||ye?xe:jsxRuntime.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,maxWidth:"100%"},onMouseEnter:ie=>{let U=ie.currentTarget;U.scrollWidth>U.clientWidth?U.title=U.textContent??"":U.removeAttribute("title");},children:xe})]})},(o,s)=>o.isLoading!==s.isLoading||o.column.pinned!==s.column.pinned||o.classNames!==s.classNames||o.styles!==s.styles||o.column.editable!==s.column.editable||o.onEdit!==s.onEdit||o.isEditing!==s.isEditing||o.onEditComplete!==s.onEditComplete||o.cellStyleFn!==s.cellStyleFn?false:o.column.key==="__select__"?o.isSelected===s.isSelected&&o.normalizedSelectedKeys===s.normalizedSelectedKeys:o.column.key==="__expand__"?o.isExpanded===s.isExpanded:o.column.render?o.record!==s.record||o.rowIndex!==s.rowIndex?false:o.column.render===s.column.render:o.value===s.value&&o.rowIndex===s.rowIndex&&o.column.key===s.column.key);bn.displayName="Cell";var Bi=oe__default.default.memo(({rowKey:o,onResize:s,children:c})=>{let b=oe.useRef(null),w=oe.useRef(s);return oe.useEffect(()=>{w.current=s;},[s]),oe.useEffect(()=>{let p=b.current;if(!p)return;let E=new ResizeObserver(h=>{let g=h[0]?.borderBoxSize?.[0]?.blockSize;g!=null&&g>0&&w.current(o,g);});return E.observe(p),()=>E.disconnect()},[o]),jsxRuntime.jsx("div",{ref:b,children:c})});Bi.displayName="MeasuredExpandedRow";var Di=oe__default.default.memo(({index:o,onHeightChange:s,children:c})=>{let b=oe.useRef(null),w=oe.useRef(s);return oe.useEffect(()=>{w.current=s;},[s]),oe.useEffect(()=>{let p=b.current;if(!p)return;let E=new ResizeObserver(h=>{let g=h[0]?.borderBoxSize?.[0]?.blockSize;g!=null&&g>0&&w.current(o,Math.ceil(g));});return E.observe(p),()=>E.disconnect()},[o]),jsxRuntime.jsx("div",{ref:b,children:c})});Di.displayName="DynamicRowMeasurer";var Pi=({data:o,orderedColumns:s,rowVirtualizer:c,columnOffsets:b,styles:w,classNames:p,rowSelection:E,normalizedSelectedKeys:h=[],getRowKey:g,getRawRowKey:k,expandable:V,resolvedExpandedKeys:X,rowHeight:x=40,totalTableWidth:T,scrollAreaWidth:$,accentColor:D,isLoading:J=false,onExpandedRowResize:Ae,maxExpandedRowHeight:ke,pinnedTopData:B=[],pinnedBottomData:ge=[],gridTemplateColumns:Ve,headerHeight:be=36,rowClassName:N,rowStyle:Se,bodyGridRow:Re=2,onEdit:we,editingCell:me,onEditComplete:Ie,enableDynamicRowHeight:_e=false,onRowHeightChange:Te,columnGridIndexMap:ye,cellStyleFn:xe,onRowDragStart:Be,enableRowAnimation:st=false,onGroupToggle:We,groupAccentColor:qe,onTreeToggle:ie,treeIndentSize:U=20})=>{let te=c.getVirtualItems(),ae=c.getTotalSize(),Xe=oe.useMemo(()=>new Set(h),[h]),Ne=o??[],Ee=s??[],Me=oe.useMemo(()=>{let P=new Set(["__select__","__expand__","__drag__"]);return Ee.findIndex(F=>!P.has(F.key))},[Ee]),ze=oe.useMemo(()=>B.length===0&&ge.length===0?Ne:[...B,...Ne,...ge],[B,Ne,ge]),De=w?.pinnedRowBg??w?.pinnedBg,re=oe.useMemo(()=>Ee.map((P,F)=>{let H=b.get(P.key),A=!!P.pinned,R=0;P.key==="__select__"||P.key==="__expand__"?R=11:A&&(R=2);let Z={gridColumn:ye?.get(P.key)??F+1,gridRow:Re,height:`${ae}px`,position:A?"sticky":"relative",zIndex:R};return P.pinned==="left"&&H!==void 0?Z.left=`${H}px`:P.pinned==="right"&&H!==void 0&&(Z.right=`${H}px`),A&&w?.pinnedCell&&Object.assign(Z,w.pinnedCell),{key:P.key,style:Z,isPinned:A}}),[Ee,b,ae,w,Re,ye]);return Ne.length===0||Ee.length===0?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re.map((P,F)=>{let H=Ee[F];if(!H)return null;!!H.render;return jsxRuntime.jsx("div",{...P.isPinned?{"data-bt-pinned":""}:{},style:P.style,children:te.map(R=>{let z=Ne[R.index];if(z==null)return null;if(!!z.__bt_group_header__){let Ze=z.__bt_group_key__,Sn=z.__bt_group_value__,nt=z.__bt_group_count__,Ye=z.__bt_group_collapsed__,ir=z.__bt_group_aggregates__??{};return F===0?jsxRuntime.jsxs("div",{"data-bt-group-header":Ze,className:p?.groupHeader??"",style:{position:"absolute",top:`${R.start}px`,left:0,right:0,height:`${R.size}px`,display:"flex",alignItems:"center",gap:8,paddingLeft:8,paddingRight:8,fontSize:"inherit",fontWeight:600,cursor:"pointer",borderBottom:"1px solid rgba(128,128,128,0.2)",background:`linear-gradient(90deg, ${qe??"#6366f1"}08, transparent)`,gridColumn:"1 / -1",userSelect:"none",...w?.groupHeader},onClick:()=>We?.(Ze),children:[jsxRuntime.jsx("span",{style:{display:"inline-flex",transform:Ye?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.15s ease",fontSize:"0.75em"},children:"\u25BC"}),jsxRuntime.jsx("span",{children:String(Sn??Ze)}),jsxRuntime.jsxs("span",{style:{opacity:.5,fontWeight:400},children:["(",nt,")"]}),Object.entries(ir).map(([Rn,wn])=>jsxRuntime.jsxs("span",{style:{opacity:.6,fontWeight:400,marginLeft:4},children:[Rn,": ",String(wn??"")]},Rn))]},`group-${Ze}`):null}let q=z.__bt_tree_level__,Pe=z.__bt_tree_has_children__,se=z.__bt_tree_expanded__,de=z.__bt_tree_key__,ce=g?g(z,R.index):String(R.index),At=Xe.has(ce),vn=X?.has(ce)??false,kn=H.dataIndex!=null?z[H.dataIndex]:void 0,lt=J||ce.startsWith("__shimmer_"),dt="";try{dt=N?N(z,R.index):"";}catch{}let Mt;try{Mt=Se?Se(z,R.index):void 0;}catch{}return jsxRuntime.jsx("div",{"data-row-key":ce,"data-row-index":R.index,"data-column-key":H.key,"data-bt-cell":"","data-selected":At||void 0,className:dt||void 0,style:{position:"absolute",top:`${R.start}px`,left:0,right:0,height:_e?void 0:`${R.size}px`,minHeight:_e?`${x}px`:void 0,...st?{transition:"top 0.2s ease, opacity 0.2s ease"}:{}},children:H.key==="__drag__"&&Be?jsxRuntime.jsx("div",{style:{height:`${x}px`,display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid rgba(128,128,128,0.2)",...Mt},children:jsxRuntime.jsx("span",{"data-bt-row-grip":"",onPointerDown:Ze=>{Ze.button===0&&Be(R.index,Ze);},style:{display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none",width:"100%",height:"100%"},children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"9",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"9",cy:"19",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"5",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"12",r:"1"}),jsxRuntime.jsx("circle",{cx:"15",cy:"19",r:"1"})]})})}):_e&&Te&&F===0?jsxRuntime.jsx(Di,{index:R.index,onHeightChange:Te,children:jsxRuntime.jsx("div",{style:{minHeight:`${x}px`,position:"relative",...Mt},children:jsxRuntime.jsx(bn,{value:kn,record:z,column:H,rowIndex:R.index,classNames:p,styles:w,isSelected:At,isExpanded:vn,rowSelection:E,normalizedSelectedKeys:h,rowKey:ce,allData:ze,getRowKey:g,getRawRowKey:k,accentColor:D,isLoading:lt,onEdit:we,isEditing:me?.rowKey===ce&&me?.columnKey===H.key,onEditComplete:Ie,cellStyleFn:xe,treeLevel:q,treeHasChildren:Pe,treeExpanded:se,treeIndentSize:U,onTreeToggle:ie,treeKey:de,isFirstDataCol:F===Me})})}):jsxRuntime.jsx("div",{style:{height:_e?void 0:`${x}px`,minHeight:_e?`${x}px`:void 0,position:"relative",...Mt},children:jsxRuntime.jsx(bn,{value:kn,record:z,column:H,rowIndex:R.index,classNames:p,styles:w,isSelected:At,isExpanded:vn,rowSelection:E,normalizedSelectedKeys:h,rowKey:ce,allData:ze,getRowKey:g,getRawRowKey:k,accentColor:D,isLoading:lt,onEdit:we,isEditing:me?.rowKey===ce&&me?.columnKey===H.key,onEditComplete:Ie,cellStyleFn:xe,treeLevel:q,treeHasChildren:Pe,treeExpanded:se,treeIndentSize:U,onTreeToggle:ie,treeKey:de,isFirstDataCol:F===Me})})},`${ce}-${H.key}`)})},`spacer-${P.key}`)}),V&&jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",gridRow:Re,height:`${ae}px`,position:"relative",zIndex:15,pointerEvents:"none"},children:te.map(P=>{let F=Ne[P.index];if(F==null)return null;let H=g?g(F,P.index):String(P.index);if(!(X?.has(H)??false))return null;let A=null;try{A=V.expandedRowRender(F,P.index,0,!0);}catch{}let R=jsxRuntime.jsx("div",{className:p?.expandedRow??"",style:{position:"sticky",left:0,zIndex:5,width:$&&$>0?`${$}px`:"100%",overflow:"auto",pointerEvents:"auto",borderBottom:"1px solid rgba(128,128,128,0.2)",backgroundColor:"rgba(128,128,128,0.06)",padding:20,...ke?{maxHeight:`${ke}px`}:void 0,...w?.expandedRow},children:A});return jsxRuntime.jsx("div",{style:{position:"absolute",top:P.start+x,left:0,right:0},children:Ae?jsxRuntime.jsx(Bi,{rowKey:H,onResize:Ae,children:R}):R},`expanded-${H}`)})}),B.length>0&&jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",gridRow:Re,height:`${ae}px`,position:"relative",zIndex:20,pointerEvents:"none"},children:jsxRuntime.jsx("div",{style:{position:"sticky",top:be,pointerEvents:"auto",boxShadow:"0 2px 6px -1px rgba(0,0,0,0.08)"},children:B.map((P,F)=>{if(P==null)return null;let H=g?g(P,F):String(F),A=Xe.has(H),R=X?.has(H)??false,z="";try{z=N?N(P,F):"";}catch{}let Z;try{Z=Se?Se(P,F):void 0;}catch{}return jsxRuntime.jsx("div",{className:`${p?.pinnedRow??""} ${z}`.trim()||void 0,style:{display:"grid",gridTemplateColumns:Ve??"",minWidth:T?`${T}px`:void 0,...w?.pinnedRow,...Z},children:Ee.map(q=>{let Pe=q.dataIndex!=null?P[q.dataIndex]:void 0,se=b.get(q.key),de=!!q.pinned,ce=0;return q.key==="__select__"||q.key==="__expand__"?ce=11:de&&(ce=2),jsxRuntime.jsx("div",{"data-row-key":H,"data-column-key":q.key,"data-bt-cell":"","data-selected":A||void 0,style:{position:de?"sticky":"relative",...q.pinned==="left"&&se!==void 0?{left:`${se}px`}:{},...q.pinned==="right"&&se!==void 0?{right:`${se}px`}:{},zIndex:ce,backgroundColor:De,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",...de&&w?.pinnedCell?w.pinnedCell:{}},children:jsxRuntime.jsx("div",{style:{height:`${x}px`,position:"relative"},children:jsxRuntime.jsx(bn,{value:Pe,record:P,column:q,rowIndex:F,classNames:p,styles:w,isSelected:A,isExpanded:R,rowSelection:E,normalizedSelectedKeys:h,rowKey:H,allData:ze,getRowKey:g,getRawRowKey:k,accentColor:D,isLoading:false,onEdit:we,isEditing:me?.rowKey===H&&me?.columnKey===q.key,onEditComplete:Ie,cellStyleFn:xe,isFirstDataCol:false})})},q.key)})},`pinned-top-${H}`)})})}),ge.length>0&&jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",gridRow:Re,height:`${ae}px`,position:"relative",zIndex:20,pointerEvents:"none",display:"flex",flexDirection:"column"},children:jsxRuntime.jsx("div",{style:{marginTop:"auto",position:"sticky",bottom:0,pointerEvents:"auto",boxShadow:"0 -2px 6px -1px rgba(0,0,0,0.08)"},children:ge.map((P,F)=>{if(P==null)return null;let H=g?g(P,F):String(F),A=Xe.has(H),R=X?.has(H)??false,z="";try{z=N?N(P,F):"";}catch{}let Z;try{Z=Se?Se(P,F):void 0;}catch{}return jsxRuntime.jsx("div",{className:`${p?.pinnedRow??""} ${z}`.trim()||void 0,style:{display:"grid",gridTemplateColumns:Ve??"",minWidth:T?`${T}px`:void 0,...w?.pinnedRow,...Z},children:Ee.map(q=>{let Pe=q.dataIndex!=null?P[q.dataIndex]:void 0,se=b.get(q.key),de=!!q.pinned,ce=0;return q.key==="__select__"||q.key==="__expand__"?ce=11:de&&(ce=2),jsxRuntime.jsx("div",{"data-row-key":H,"data-column-key":q.key,"data-bt-cell":"","data-selected":A||void 0,style:{position:de?"sticky":"relative",...q.pinned==="left"&&se!==void 0?{left:`${se}px`}:{},...q.pinned==="right"&&se!==void 0?{right:`${se}px`}:{},zIndex:ce,backgroundColor:De,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",...de&&w?.pinnedCell?w.pinnedCell:{}},children:jsxRuntime.jsx("div",{style:{height:`${x}px`,position:"relative"},children:jsxRuntime.jsx(bn,{value:Pe,record:P,column:q,rowIndex:F,classNames:p,styles:w,isSelected:A,isExpanded:R,rowSelection:E,normalizedSelectedKeys:h,rowKey:H,allData:ze,getRowKey:g,getRawRowKey:k,accentColor:D,isLoading:false,onEdit:we,isEditing:me?.rowKey===H&&me?.columnKey===q.key,onEditComplete:Ie,cellStyleFn:xe,isFirstDataCol:false})})},q.key)})},`pinned-bottom-${H}`)})})})]})};Pi.displayName="TableBody";var po=Pi;function bs(o,s,c){let b=o.slice(),[w]=b.splice(s,1);return b.splice(c,0,w),b}function fo(o){let s=[];for(let c of o)c!=null&&(c.children&&c.children.length>0?s.push(...fo(c.children)):s.push(c));return s}var Fi=[55,70,45,80,60,50,75,65,40,72],xs={},vs={},Hi=[],Wi=[];function Ki({columns:o,data:s,rowHeight:c=40,expandedRowHeight:b=200,maxExpandedRowHeight:w,accentColor:p="#1890ff",theme:E="auto",className:h="",classNames:g=xs,styles:k=vs,gripIcon:V,hideGripIcon:X,icons:x,pagination:T,onPaginationChange:$,onColumnResize:D,onColumnOrderChange:J,onColumnPin:Ae,onColumnHide:ke,rowSelection:B,rowPinning:ge,onRowPin:Ve,expandable:be,rowKey:N="id",onEndReached:Se,onEndReachedThreshold:Re=5,isLoading:we=false,onSortChange:me,multiSort:Ie=false,onMultiSortChange:_e,onFilterChange:Te,columnContextMenuItems:ye,autoHeight:xe=true,layoutLoading:Be,emptyRenderer:st,rowClassName:We,rowStyle:qe,conditionalFormatting:ie,rowGrouping:U,treeData:te,masterDetail:ae,enableFilterBuilder:Xe=false,disabledFilters:Ne,onCopy:Ee,keepPinnedRowsAcrossPages:Me,onEdit:ze,onRowClick:De,enableColumnVirtualization:re=false,enableDynamicRowHeight:P=false,columnPersistence:F=false,showColumnSettings:H=true,hideGlobalSearch:A=false,globalSearchValue:R,onGlobalSearchChange:z,toolbarContent:Z,toolbarRight:q,columnSettingsLabel:Pe,aiMode:se=false,aiConfig:de,onAIQuery:ce,onAIResponse:At,aiPlaceholder:vn="Ask AI anything about your data...",aiButtonLabel:kn,onAIInsights:lt,onAIChart:dt,enableRowAnimation:Mt=false,showStatusBar:Ze=false,statusBarContent:Sn,rowDragEnabled:nt=false,onRowReorder:Ye}){let ir=oe__default.default.useRef(null),[Rn,wn]=oe__default.default.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:false);oe__default.default.useEffect(()=>{if(E!=="auto")return;let e=window.matchMedia("(prefers-color-scheme: dark)");wn(e.matches);let t=n=>wn(n.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[E]);let Xt=E==="dark"||E==="auto"&&Rn,fe=oe.useMemo(()=>Xt?{color:"#e0e0e0",bg:"#0f0f0f",cardBg:"#181818",border:"#333",inputBg:"#1a1a1a",menuBg:"rgba(28,28,30,0.92)",menuShadow:"0 8px 24px rgba(0,0,0,0.5)"}:{color:"#1a1a2e",bg:"#ffffff",cardBg:"#ffffff",border:"#ddd",inputBg:"#ffffff",menuBg:"rgba(255,255,255,0.95)",menuShadow:"0 8px 24px rgba(0,0,0,0.12)"},[Xt]),Y=oe.useMemo(()=>{if(!Array.isArray(s))return Hi;let e=s.filter(t=>t!=null);return e.length>0?e:Hi},[s]),le=oe.useMemo(()=>{if(!Array.isArray(o))return Wi;let e=o.filter(r=>r!=null&&typeof r.key=="string"),n=fo(e).filter(r=>r!=null&&typeof r.key=="string");return n.length>0?n:Wi},[o]),Lt=oe.useMemo(()=>{if(!Array.isArray(o))return [];let e=[];for(let t of o)if(t!=null&&typeof t.key=="string"&&t.children&&t.children.length>0){let n=fo([t]).filter(r=>r!=null&&typeof r.key=="string").map(r=>r.key);n.length>0&&e.push({key:t.key,title:t.title,childKeys:n,style:t.style,className:t.className});}return e},[o]),Ue=Lt.length>0,ji=oe.useMemo(()=>{if(!Ue)return null;let e=new Set;for(let t of Lt)for(let n of t.childKeys)e.add(n);return e},[Lt,Ue]),[ct,rt]=oe.useState(le),[Cn,Yt]=oe.useState(()=>le.map(e=>e.key)),[yo,ho]=oe.useState(null),[ar,Gi]=oe.useState(false),[mo,sr]=oe.useState(null);oe__default.default.useEffect(()=>{Gi(true);},[]);let bo=oe.useRef(""),lr=le.map(e=>{let t=typeof e.width=="number"?Math.round(e.width):e.width??"";return `${e.key}:${!!e.hidden}:${e.pinned||""}:${t}`}).join("|"),In=oe.useRef(le);In.current=le,oe__default.default.useEffect(()=>{bo.current!==lr&&(bo.current=lr,rt(In.current),Yt(In.current.map(e=>e.key)));},[lr]);let Vi=(e,t=150)=>typeof e=="number"&&Number.isFinite(e)?e:t,[_n,Ut]=oe.useState(()=>new Map),xo=oe.useRef(new Set),dr=oe.useRef(false);oe__default.default.useEffect(()=>{if(!F||dr.current)return;dr.current=true;let{storageKey:e,persistOrder:t=true,persistWidths:n=true,persistVisibility:r=true,persistPinned:l=true}=F;try{let d=localStorage.getItem(`bt_${e}`);if(!d)return;let i=JSON.parse(d);t&&i.order&&Yt(i.order),n&&i.widths&&Ut(new Map(Object.entries(i.widths).map(([u,m])=>[u,Number(m)]))),(r&&i.hidden||l&&i.pinned)&&rt(u=>u.map(m=>{let f=m;return r&&i.hidden&&m.key in i.hidden&&(f={...f,hidden:i.hidden[m.key]}),l&&i.pinned&&m.key in i.pinned&&(f={...f,pinned:i.pinned[m.key]}),f}));}catch{}},[F]);let vo=oe.useCallback(()=>{if(!F)return;let{storageKey:e,persistOrder:t=true,persistWidths:n=true,persistVisibility:r=true,persistPinned:l=true}=F;try{let d={};if(t&&(d.order=Cn),n){let i={};_n.forEach((u,m)=>{i[m]=u;}),d.widths=i;}if(r){let i={};ct.forEach(u=>{u.hidden&&(i[u.key]=!0);}),d.hidden=i;}if(l){let i={};ct.forEach(u=>{u.pinned&&(i[u.key]=u.pinned);}),d.pinned=i;}localStorage.setItem(`bt_${e}`,JSON.stringify(d));}catch{}},[F,Cn,_n,ct]);oe__default.default.useEffect(()=>{!F||!dr.current||vo();},[F,vo]);let[cr,ur]=oe.useState(false),pr=oe.useRef(null);oe__default.default.useEffect(()=>{if(!cr)return;let e=n=>{pr.current&&!pr.current.contains(n.target)&&ur(false);},t=n=>{n.key==="Escape"&&ur(false);};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t);}},[cr]);let Jt=!!(se&&A&&!H&&!Z),[qi,ko]=oe.useState(false),ot=Jt||qi,[Le,gr]=oe.useState(""),[Nt,So]=oe.useState(false),[ut,fr]=oe.useState(null),[Ro,Tn]=oe.useState(null),yr=oe.useRef(null),[wo,Co]=oe.useState([]),[Xi,zt]=oe.useState(false),[Io,En]=oe.useState(null),[An,_o]=oe.useState(false),Yi=oe.useCallback(async()=>{_o(true),En(null);try{let e;if(lt)e=await lt(Y,le);else if(de){let t=`You are a data analyst. Analyze the provided dataset and give concise insights: trends, outliers, summary statistics, and notable patterns. Reply in plain text, not JSON.
34
34
 
35
- Columns: ${ae.map(n=>`${n.key}${n.dataIndex?` (${n.dataIndex})`:""}`).join(", ")}
35
+ Columns: ${le.map(n=>`${n.key}${n.dataIndex?` (${n.dataIndex})`:""}`).join(", ")}
36
36
 
37
37
  Sample data (first 20 rows):
38
- ${JSON.stringify(V.slice(0,20),null,2)}
38
+ ${JSON.stringify(Y.slice(0,20),null,2)}
39
39
 
40
- Total rows: ${V.length}`;e=await io(oe,t,"Analyze this data and provide key insights.");}else e="AI insights requires either aiConfig or onAIInsights prop.";Tn(e);}catch(e){Tn(`Error: ${e instanceof Error?e.message:"Failed to generate insights"}`);}finally{Io(false);}},[V,ae,oe,ut]),[To,Nt]=re.useState(null),[An,Eo]=re.useState(false),Ui=re.useCallback(async()=>{Eo(true),Nt(null);try{if(ot){let e=await ot(V,ae);Nt(e);}else if(oe){let e=ae.filter(i=>V.slice(0,5).map(y=>y[i.dataIndex??i.key]).some(y=>typeof y=="number"));if(e.length===0){Nt(jsxRuntime.jsx("div",{style:{padding:16,textAlign:"center",color:"GrayText"},children:"No numeric columns found for chart generation."}));return}let t=e[0],n=t.dataIndex??t.key,r=V.slice(0,20).map(i=>{let u=i[n];return typeof u=="number"?u:0}),l=Math.max(...r,1),d=Math.floor(400/r.length);Nt(jsxRuntime.jsxs("div",{style:{padding:8},children:[jsxRuntime.jsxs("div",{style:{fontSize:"0.85em",fontWeight:600,marginBottom:8,color:p},children:[typeof t.title=="string"?t.title:t.key," (first ",r.length," rows)"]}),jsxRuntime.jsx("svg",{width:"100%",viewBox:`0 0 ${r.length*d} 120`,style:{maxWidth:500},children:r.map((i,u)=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:u*d+2,y:120-i/l*100,width:d-4,height:i/l*100,fill:p,opacity:.7,rx:2}),jsxRuntime.jsx("text",{x:u*d+d/2,y:115,textAnchor:"middle",fontSize:8,fill:"GrayText",children:i})]},u))})]}));}}catch(e){Nt(jsxRuntime.jsxs("div",{style:{padding:16,color:"#ef4444"},children:["Chart generation failed: ",e instanceof Error?e.message:"Unknown error"]}));}finally{Eo(false);}},[V,ae,oe,ot,p]),Ao=re.useMemo(()=>{if(!_e)return [];let e=ae.filter(n=>!n.key.startsWith("__")&&n.dataIndex).map(n=>({key:n.dataIndex??n.key,title:typeof n.title=="string"?n.title:n.key})),t=[];for(let n of e.slice(0,6))t.push(`Show rows where ${n.title} is highest`),t.push(`Filter by ${n.title}`),t.push(`Sort by ${n.title} descending`);return t.push("Highlight rows with missing values"),t.push("Show only the top 10 rows"),t.push("Remove all filters"),t.push("Show all columns"),t},[_e,ae]),[Mn,yr]=re.useState([]),[Ln,hr]=re.useState([]),[mr,Qt]=re.useState(null),[br,en]=re.useState(null),[xr,tn]=re.useState(null),nn=M&&typeof M=="object"?`bt-ai-filters-${M.storageKey}`:"bt-ai-filters",[Je,Mo]=re.useState(()=>{try{let e=localStorage.getItem(nn);return e?JSON.parse(e):[]}catch{return []}}),[On,zn]=re.useState(false),[mt,Lo]=re.useState(false),$n=re.useRef(null);re__default.default.useEffect(()=>{if(!On)return;let e=t=>{$n.current&&!$n.current.contains(t.target)&&zn(false);};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[On]);let Ji=re.useCallback(()=>{if(!ht)return;let t={label:ze||ht.message,operations:ht.operations,query:ze},n=[...Je,t];Mo(n);try{localStorage.setItem(nn,JSON.stringify(n));}catch{}Lo(true),setTimeout(()=>Lo(false),1500);},[ht,ze,Je,nn]),Oo=re.useCallback(e=>{let t=Je.filter((n,r)=>r!==e);Mo(t);try{localStorage.setItem(nn,JSON.stringify(t));}catch{}},[Je,nn]),zo=re.useCallback(e=>{let{filteredData:t,sortOp:n,styleOps:r,cellStyleOps:l,hideColumns:d,showColumns:i,resizeOps:u,reorderOp:y,pinOps:m,setPageOp:I}=so(V,e.operations);if(yr(r),hr(l),e.operations.some(f=>f.type==="filter")){let f=new Set;t.forEach((_,A)=>{let G=typeof $=="function"?$(_):String(_[typeof $=="string"?$:"id"]??A);f.add(G);}),Qt(f);}else Qt(null);n?(en(n.column),tn(n.direction)):(en(null),tn(null)),(d.length>0||i.length>0)&&at(f=>f.map(_=>d.includes(_.key)?{..._,hidden:true}:i.includes(_.key)?{..._,hidden:false}:_));for(let f of u){let _=Math.max(40,Math.min(800,f.width));Jt(A=>{let G=new Map(A);return G.set(f.column,_),G}),P?.(f.column,_);}y&&(Yt(y.order),J?.(y.order));for(let f of m)at(_=>_.map(A=>A.key===f.column?{...A,pinned:f.pinned}:A)),Me?.(f.column,f.pinned);I&&Wt(I.page),gr({operations:e.operations,message:`Applied saved filter: ${e.label}`}),zn(false);},[V,$,P,J,Me]),$o=re.useRef(le);$o.current=le;let No=re.useCallback(async()=>{let e=ze.trim();if(e){So(true),In(null);try{let t;if(Oe)t=await Oe(e,{data:V,columns:ae});else if(oe){let _=Ii(ae,V),A=await io(oe,_,e,wo);t=Ti(A),Co(G=>[...G,{role:"user",content:e},{role:"assistant",content:A}]);}else throw new Error("AI mode requires either aiConfig or onAIQuery prop");let{filteredData:n,sortOp:r,styleOps:l,cellStyleOps:d,hideColumns:i,showColumns:u,resizeOps:y,reorderOp:m,pinOps:I,setPageOp:f}=so(V,t.operations);if(yr(l),hr(d),t.operations.some(_=>_.type==="filter")){let _=new Set;n.forEach((A,G)=>{let Q=typeof $=="function"?$(A):String(A[typeof $=="string"?$:"id"]??G);_.add(Q);}),Qt(_);}else Qt(null);r?(en(r.column),tn(r.direction)):(en(null),tn(null)),(i.length>0||u.length>0)&&at(_=>_.map(A=>i.includes(A.key)?{...A,hidden:!0}:u.includes(A.key)?{...A,hidden:!1}:A));for(let _ of y){let A=Math.max(40,Math.min(800,_.width));Jt(G=>{let Q=new Map(G);return Q.set(_.column,A),Q}),P?.(_.column,A);}m&&(Yt(m.order),J?.(m.order));for(let _ of I)at(A=>A.map(G=>G.key===_.column?{...G,pinned:_.pinned}:G)),Me?.(_.column,_.pinned);f&&Wt(f.page),gr(t),$o.current?.(t);}catch(t){In(t instanceof Error?t.message:"AI query failed");}finally{So(false);}}},[ze,oe,Oe,V,ae,$,wo]),vr=re.useCallback(()=>{gr(null),In(null),yr([]),hr([]),Qt(null),en(null),tn(null),pr(""),Co([]);},[]),Do=re.useCallback(()=>{ko(false),vr();},[vr]);re__default.default.useEffect(()=>{st&&fr.current&&setTimeout(()=>fr.current?.focus(),300);},[st]);let kr=re.useMemo(()=>ft.map(e=>({...e,width:Vi(_n.get(e.key)??e.width)})),[ft,_n]),[Bo,Zi]=re.useState(()=>be?.defaultExpandAllRows&&V.length>0?new Set(V.map((e,t)=>{if(e==null)return t;try{if(typeof $=="function")return $(e)}catch{return t}return typeof $=="string"?e[$]??t:t})):new Set(be?.defaultExpandedRowKeys??[])),Qi=be?.expandedRowKeys?.map(String).join("|"),rn=re.useMemo(()=>be?.expandedRowKeys!==void 0?new Set(be.expandedRowKeys):Bo,[Qi,Bo]),on=re.useRef(be);on.current=be;let Fo=re.useCallback(e=>{let t=on.current;if(t?.expandedRowKeys!==void 0){let n=new Set(t.expandedRowKeys);n.has(e)?n.delete(e):n.add(e),t.onExpandedRowsChange?.(Array.from(n));}else Zi(n=>{let r=new Set(n);return r.has(e)?r.delete(e):r.add(e),t?.onExpandedRowsChange?.(Array.from(r)),r});},[]),bt=re.useCallback((e,t)=>{if(e==null)return `__row_${t}`;try{if(typeof $=="function"){let n=$(e),r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?`__row_${t}`:r}if(typeof $=="string"){let n=e[$];if(n==null)return `__row_${t}`;let r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?`__row_${t}`:r}}catch{return `__row_${t}`}return `__row_${t}`},[$]),Po=re.useMemo(()=>{let e=new Map;return V.map((t,n)=>{let r=bt(t,n),l=e.get(r)??0;return e.set(r,l+1),l>0?`${r}__${n}`:r})},[V,bt]),Ho=re.useMemo(()=>{let e=new Set;for(let t of V){if(t==null)continue;let n=bt(t,0);if(e.has(n))return true;e.add(n);}return false},[V,bt]),je=re.useCallback((e,t)=>Ho?Po[t]??bt(e,t):bt(e,t),[bt,Ho,Po]),Wo=re.useCallback((e,t)=>{if(e==null)return t;try{if(typeof $=="function"){let n=$(e);if(n==null||typeof n=="number"&&Number.isNaN(n))return t;let r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?t:n}if(typeof $=="string"){let n=e[$];if(n==null||typeof n=="number"&&Number.isNaN(n))return t;let r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?t:typeof n=="number"||typeof n=="string"?n:r}}catch{return t}return t},[$]),Nn=re.useMemo(()=>{let e=B?.selectedRowKeys;return Array.isArray(e)?e.filter(t=>t!=null).map(t=>String(t)):[]},[B?.selectedRowKeys]),Ko=re.useRef(je);Ko.current=je;let jo=re.useRef(rn);jo.current=rn;let Sr=re.useRef(Fo);Sr.current=Fo;let Rr=re.useRef(x);Rr.current=x;let Go=!!be?.rowExpandable,wr=re.useMemo(()=>Go?[{key:"__expand__",dataIndex:"__expand__",title:"",width:40,pinned:"left",hidden:false,render:(t,n,r)=>{let l=Ko.current(n,r),d=on.current?.rowExpandable?.(n)??true,i=jo.current.has(l);return d?typeof on.current?.expandIcon=="function"?on.current.expandIcon({expanded:i,onExpand:(u,y)=>{y.stopPropagation(),Sr.current(l);},record:n}):jsxRuntime.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),Sr.current(l);},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:"2px",borderRadius:"3px",color:p},children:i?Rr.current?.chevronDown??jsxRuntime.jsx(pi,{style:{width:14,height:14}}):Rr.current?.chevronRight??jsxRuntime.jsx(Qr,{style:{width:14,height:14}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:16}})}},...kr]:kr,[Go,kr,p]),Cr=re.useMemo(()=>B?[{key:"__select__",dataIndex:"__select__",title:"",width:48,pinned:"left",hidden:false,render:()=>null},...wr]:wr,[B,wr]),xt=re.useMemo(()=>!it||!Ie?Cr:[{key:"__drag__",dataIndex:"__drag__",title:"",width:36,pinned:"left",hidden:false,render:()=>null},...Cr],[it,Ie,Cr]),Dn=re.useRef(null),me=re.useRef(null),[_r,ea]=re.useState(0),Vo=re.useRef(0),Ir=re.useRef(null),vt=re.useRef(null),ta=re.useCallback(e=>{if(Ir.current?.disconnect(),Ir.current=null,vt.current!==null&&(cancelAnimationFrame(vt.current),vt.current=null),me.current=e,!e)return;let t=()=>{vt.current=null;let r=e.clientWidth;r!==Vo.current&&(Vo.current=r,ea(r));};t();let n=new ResizeObserver(()=>{vt.current!==null&&cancelAnimationFrame(vt.current),vt.current=requestAnimationFrame(t);});n.observe(e),Ir.current=n;},[]),Bn=re.useRef(null);re__default.default.useEffect(()=>{let e=me.current;if(!e)return;let t=l=>{Bn.current!==l&&(Bn.current&&e.querySelectorAll(`[data-row-key="${Bn.current}"]`).forEach(d=>d.removeAttribute("data-hover")),Bn.current=l,l&&e.querySelectorAll(`[data-row-key="${l}"]`).forEach(d=>d.setAttribute("data-hover","")));},n=l=>{let d=l.target.closest("[data-row-key]");t(d?.dataset.rowKey??null);},r=()=>t(null);return e.addEventListener("mouseover",n,{passive:true}),e.addEventListener("mouseleave",r,{passive:true}),()=>{e.removeEventListener("mouseover",n),e.removeEventListener("mouseleave",r);}},[]);let Dt=re.useRef(null),an=re.useRef(new Map);re.useMemo(()=>{let e=new Map;for(let t of Ot)for(let n of t.childKeys)e.set(n,t.key);for(let t of ae)e.has(t.key)||e.set(t.key,null);an.current=e;},[Ot,ae]);let Tr=re.useRef(null),Er=re.useRef(null),qo=re.useRef(null),Xo=re.useRef(J);Xo.current=J;let na=re.useCallback((e,t)=>{if(e==="__select__"||e==="__expand__"||e==="__drag__")return;let n=t.currentTarget.closest("[data-column-key]");if(!n)return;let r=n.getBoundingClientRect(),l=t.clientX-r.left,d=t.clientY-r.top;ho(e),Er.current=e,n.setAttribute("data-dragging","");let i=qo.current;i&&(i.style.display="flex",i.style.width=`${r.width}px`,i.style.left=`${t.clientX-l}px`,i.style.top=`${r.top}px`);let u=document.createElement("style");u.textContent="* { cursor: grabbing !important; }",document.head.appendChild(u);let y=an.current.get(e),m=f=>{i&&(i.style.left=`${f.clientX-l}px`,i.style.top=`${f.clientY-d}px`);let _=me.current;if(!_)return;let A=_.querySelectorAll("[data-bt-header][data-column-key]"),G=null;A.forEach(Q=>{let He=Q.dataset.columnKey;if(!He||He==="__select__"||He==="__expand__"||He==="__drag__"||He===e){Q.removeAttribute("data-drag-over");return}let Et=an.current.get(He);if(y!==Et){Q.removeAttribute("data-drag-over");return}let At=Q.getBoundingClientRect();f.clientX>=At.left&&f.clientX<=At.right&&f.clientY>=At.top-20&&f.clientY<=At.bottom+20?(G=He,Q.setAttribute("data-drag-over","")):Q.removeAttribute("data-drag-over");}),Tr.current=G;},I=()=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",I),u.remove();let f=me.current;f&&(f.querySelectorAll("[data-dragging]").forEach(G=>G.removeAttribute("data-dragging")),f.querySelectorAll("[data-drag-over]").forEach(G=>G.removeAttribute("data-drag-over"))),i&&(i.style.display="none");let _=Tr.current,A=Er.current;_&&A&&_!==A&&an.current.get(A)===an.current.get(_)&&re__default.default.startTransition(()=>{Yt(G=>{let Q=G.indexOf(A),He=G.indexOf(_);if(Q===-1||He===-1)return G;let Et=ys(G,Q,He);return setTimeout(()=>Xo.current?.(Et),0),Et});}),ho(null),Er.current=null,Tr.current=null;};document.addEventListener("pointermove",m),document.addEventListener("pointerup",I);},[]),Yo=re.useRef(null),Fn=re.useRef(null),sn=re.useRef(null),Ar=re.useRef(Ie);Ar.current=Ie;let ra=re.useCallback((e,t)=>{if(!Ar.current)return;t.preventDefault(),Fn.current=e,sn.current=null;let r=t.currentTarget.closest("[data-row-key]")?.offsetHeight??40,l=Yo.current;l&&(l.textContent=`Row ${e+1}`,l.style.display="flex",l.style.left=`${t.clientX+12}px`,l.style.top=`${t.clientY-12}px`,l.style.height=`${Math.min(r,36)}px`);let d=document.createElement("style");d.textContent="* { cursor: grabbing !important; }",document.head.appendChild(d);let i=me.current,u=m=>{if(l&&(l.style.left=`${m.clientX+12}px`,l.style.top=`${m.clientY-12}px`),!i)return;let I=i.querySelectorAll("[data-bt-cell][data-row-key]"),f=null,_=1/0;I.forEach(A=>{if(!A.dataset.rowKey)return;let Q=A.getBoundingClientRect(),He=Q.top+Q.height/2,Et=Math.abs(m.clientY-He);if(Et<_){_=Et;let At=A.dataset.rowIndex;At!=null&&(f=Number(At));}}),i.querySelectorAll("[data-row-drag-over]").forEach(A=>A.removeAttribute("data-row-drag-over")),f!=null&&f!==Fn.current?(sn.current=f,i.querySelectorAll(`[data-bt-cell][data-row-index="${f}"]`).forEach(A=>A.setAttribute("data-row-drag-over",""))):sn.current=null;},y=()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",y),d.remove(),l&&(l.style.display="none"),i&&i.querySelectorAll("[data-row-drag-over]").forEach(f=>f.removeAttribute("data-row-drag-over"));let m=Fn.current,I=sn.current;m!=null&&I!=null&&m!==I&&Ar.current?.(m,I),Fn.current=null,sn.current=null;};document.addEventListener("pointermove",u),document.addEventListener("pointerup",y);},[]),oa=(e,t)=>{if(t.preventDefault(),t.stopPropagation(),e==="__select__"||e==="__expand__"||e==="__drag__")return;let n=xt.findIndex(d=>d.key===e);if(n===-1||xt[n].pinned)return;let r=xt[n],l=r.width??150;if(Dt.current={columnKey:e,startX:t.clientX,startWidth:l,columnIndex:n,currentX:t.clientX},me.current){let d=me.current.querySelector(`[data-column-key="${e}"]`);if(d){let i=me.current.getBoundingClientRect(),u=d.getBoundingClientRect(),y=me.current.scrollTop,m=me.current.scrollLeft,I=u.left-i.left+m;Dn.current?.show(u.right,typeof r.title=="string"?r.title:String(r.key),i,I,40,y,m,I+l);}}document.addEventListener("mousemove",Uo),document.addEventListener("mouseup",Jo);},Uo=e=>{Dt.current&&(Dt.current.currentX=e.clientX,Dn.current?.move(e.clientX));},Jo=re__default.default.useCallback(()=>{if(!Dt.current)return;let{startX:e,startWidth:t,currentX:n,columnKey:r}=Dt.current,l=Math.max(40,t+(n-e));Dn.current?.hide(),Dt.current=null,document.removeEventListener("mousemove",Uo),document.removeEventListener("mouseup",Jo),xo.current.add(r),re__default.default.startTransition(()=>{Jt(d=>{let i=new Map(d);return i.set(r,l),i});}),P?.(r,l);},[P]),ia=re.useCallback(e=>{let t=me.current;if(!t)return;let n=xt.find(u=>u.key===e);if(!n)return;let r=t.querySelector(`[data-column-key="${e}"] [data-bt-grip]`)?.parentElement??t.querySelector(`[data-column-key="${e}"]`),l=0;if(r){let u=typeof n.title=="string"?n.title:n.key,m=document.createElement("canvas").getContext("2d");if(m){let I=window.getComputedStyle(r);m.font=`${I.fontWeight} ${I.fontSize} ${I.fontFamily}`,l=m.measureText(u).width+60;}}t.querySelectorAll(`[data-bt-cell][data-column-key="${e}"]`).forEach(u=>{let y=u.querySelector("div > div");if(y){let m=y.scrollWidth;m>l&&(l=m);}});let i=Math.max(60,Math.min(Math.ceil(l)+24,800));xo.current.add(e),re__default.default.startTransition(()=>{Jt(u=>{let y=new Map(u);return y.set(e,i),y});}),P?.(e,i);},[xt,P]),{leftPinned:Pn,unpinned:Zo,rightPinned:ln}=re.useMemo(()=>{let e=new Map(xt.map(i=>[i.key,i])),n=[...[...it&&Ie?["__drag__"]:[],...B?["__select__"]:[],...be?["__expand__"]:[]],...wn].map(i=>e.get(i)).filter(i=>i!==void 0&&!i.hidden),r=[],l=[],d=[];return n.forEach(i=>{i.pinned==="left"?r.push(i):i.pinned==="right"?d.push(i):l.push(i);}),{leftPinned:r,unpinned:l,rightPinned:d}},[wn,xt,B,be,it,Ie]),Z=re.useMemo(()=>[...Pn,...Zo,...ln],[Pn,Zo,ln]),Bt=re.useMemo(()=>{let e=new Map(Cn.current.map(t=>[t.key,t]));return Z.map(t=>{if(t.key==="__select__"||t.key==="__expand__"||t.key==="__drag__")return t;let n=e.get(t.key);return n?{...n,width:t.width,hidden:t.hidden,pinned:t.pinned}:t})},[Z,ae]),Mr=re.useMemo(()=>Z.slice(0,-1).reduce((e,t)=>e+(t.width??150),0)+(Z.at(-1)?.width??150),[Z]),Hn=re.useMemo(()=>Z.length===0?"":Z.map((e,t)=>{let n=e.width??150;return t===Z.length-1?`minmax(${n}px, 1fr)`:`${n}px`}).join(" "),[Z]),kt=re.useMemo(()=>{let e=new Map,t=0;Pn.forEach(r=>{e.set(r.key,t),t+=r.width??150;});let n=0;for(let r=ln.length-1;r>=0;r--){let l=ln[r];e.set(l.key,n),n+=l.width??150;}return e},[Pn,ln]),aa=re.useMemo(()=>{let e=new Map;return Z.forEach((t,n)=>e.set(t.key,n+1)),e},[Z]),sa=(e,t)=>{at(n=>n.map(r=>r.key===e?{...r,pinned:t}:r)),Me?.(e,t);},Qo=e=>{at(n=>n.map(r=>r.key!==e||r.pinned?r:{...r,hidden:!r.hidden}));let t=ft.find(n=>n.key===e);t&&!t.pinned&&Se?.(e,!t.hidden);},[la,da]=re.useState({top:[],bottom:[]}),Pe=ue===true?la:ue&&typeof ue=="object"?ue:void 0,ei=re.useCallback((e,t)=>{if(qe){qe(e,t);return}ue===true&&da(n=>{let r=String(e),l=(n.top??[]).filter(i=>String(i)!==r),d=(n.bottom??[]).filter(i=>String(i)!==r);return t==="top"?l.push(e):t==="bottom"&&d.push(e),{top:l,bottom:d}});},[qe,ue]),Lr=re.useRef(he);Lr.current=he;let ti=re.useRef(Ae);ti.current=Ae;let[Qe,ca]=re.useState([]),ua=re.useCallback((e,t,n)=>{ca(r=>{let l=r.findIndex(y=>y.key===e),d=l>=0?r[l]:null,i;t!==void 0?i=d?.direction===t?null:t:i=d?d.direction==="asc"?"desc":d.direction==="desc"?null:"asc":"asc";let u;return n&&Ee?(u=r.filter(y=>y.key!==e),i&&u.push({key:e,direction:i})):u=i?[{key:e,direction:i}]:[],Lr.current?.(e,i),Ee&&ti.current?.(u.map(y=>({columnKey:y.key,direction:y.direction}))),u});},[Ee]),[Ze,Or]=re.useState({}),[Ft,zr]=re.useState(""),[$r,pa]=re.useState([]),[ga,Wn]=re.useState(false),fa=re.useRef(null),ya=re.useCallback(e=>{e.trim()&&pa(t=>{let n=t.filter(r=>r!==e);return [e,...n].slice(0,10)});},[]),[Kn,jn]=re.useState(false),[Pt,Ht]=re.useState([{id:1,column:"",operator:"contains",value:""}]),[Nr,ha]=re.useState("and"),ni=re.useRef(2),ma=re.useCallback(()=>{let e=Pt.filter(n=>n.column&&n.value);if(e.length===0)return;let t={};for(let n of e)t[n.column]=`${n.operator}:${n.value}`;Or(n=>{let r={...n,...t};return xe?.(r),r}),jn(false);},[Pt,xe]),Dr=re.useCallback((e,t)=>{Or(n=>{let r={...n};return t?r[e]=t:delete r[e],xe?.(r),r});},[xe]),ba=re.useCallback(e=>{Dr(e,"");},[Dr]),ri=re.useRef(xe);ri.current=xe;let Br=re.useRef(ae);Br.current=ae;let oi=re.useMemo(()=>{let e=V,t=w??Ft;if(t){let n=t.toLowerCase();e=e.filter(r=>{if(r==null)return false;for(let l of Object.keys(r)){let d=r[l];if(d!=null&&String(d).toLowerCase().includes(n))return true}return false});}if(!ri.current){let n=Object.keys(Ze);n.length>0&&(e=e.filter(r=>r==null?false:n.every(l=>{try{let d=Br.current.find(m=>m.key===l);if(typeof d?.filterFn=="function")return d.filterFn(Ze[l],r,d.dataIndex??l);let i=Ze[l];if(d?.filterType==="dateRange"&&i.includes("..")){let[m,I]=i.split(".."),f=String(r[d.dataIndex??l]??"");return !(m&&f<m||I&&f>I)}if(d?.filterType==="numberRange"&&i.includes("..")){let[m,I]=i.split(".."),f=Number(r[d.dataIndex??l]);return !(Number.isNaN(f)||m&&f<Number(m)||I&&f>Number(I))}let u=i.match(/^(eq|neq|gt|gte|lt|lte|contains|startsWith|endsWith):(.*)$/);if(u){let m=u[1],I=u[2],f=r[d?.dataIndex??l],_=String(f??"").toLowerCase(),A=I.toLowerCase(),G=Number(f),Q=Number(I);switch(m){case "eq":return _===A;case "neq":return _!==A;case "gt":return !Number.isNaN(G)&&!Number.isNaN(Q)&&G>Q;case "gte":return !Number.isNaN(G)&&!Number.isNaN(Q)&&G>=Q;case "lt":return !Number.isNaN(G)&&!Number.isNaN(Q)&&G<Q;case "lte":return !Number.isNaN(G)&&!Number.isNaN(Q)&&G<=Q;case "contains":return _.includes(A);case "startsWith":return _.startsWith(A);case "endsWith":return _.endsWith(A);default:return !0}}return String(r[l]??"").toLowerCase().includes(i.toLowerCase())}catch{return true}})));}if(!Lr.current&&Qe.length>0){let n=Qe.filter(r=>r.key&&r.direction);if(n.length>0)try{e=[...e].sort((r,l)=>{if(r==null&&l==null)return 0;if(r==null)return 1;if(l==null)return -1;for(let{key:d,direction:i}of n){let u=i==="asc"?1:-1,y=Br.current.find(I=>I.key===d),m=0;if(typeof y?.sorter=="function")m=y.sorter(r,l)*u;else {let I=r[d],f=l[d];I==null&&f!=null?m=1:I!=null&&f==null?m=-1:I!=null&&f!=null&&(typeof I=="number"&&typeof f=="number"?m=(I-f)*u:m=String(I).localeCompare(String(f))*u);}if(m!==0)return m}return 0});}catch{}}return e},[V,Qe,Ze,w,Ft]),Fr=re.useMemo(()=>{let e=oi;if(mr&&(e=e.filter((t,n)=>{if(t==null)return false;let r=typeof $=="function"?$(t):String(t[typeof $=="string"?$:"id"]??n);return mr.has(r)})),br&&xr){let t=xr==="asc"?1:-1,n=br;e=[...e].sort((r,l)=>{let d=r[n],i=l[n];return d==null&&i==null?0:d==null?1:i==null?-1:typeof d=="number"&&typeof i=="number"?(d-i)*t:String(d).localeCompare(String(i))*t});}return e},[oi,mr,br,xr,$]),[xa,va]=re.useState(()=>Y?.defaultCollapsed?new Set(["__all_collapsed__"]):new Set),dn=Y?.collapsedGroups??xa,ka=re.useCallback(e=>{let t=!dn.has(e);Y?.onGroupToggle?Y.onGroupToggle(e,t):va(n=>{let r=new Set(n);return r.delete("__all_collapsed__"),t?r.add(e):r.delete(e),r});},[dn,Y]),ii=re.useCallback((e,t)=>{if(typeof t=="function")return t(e);let n=e.filter(r=>typeof r=="number");switch(t){case "count":return e.length;case "sum":return n.reduce((r,l)=>r+l,0);case "avg":return n.length?n.reduce((r,l)=>r+l,0)/n.length:0;case "min":return n.length?Math.min(...n):void 0;case "max":return n.length?Math.max(...n):void 0;default:return}},[]),Pr=re.useMemo(()=>{if(!Y?.groupBy)return Fr;let e=Y.groupBy,t=new Map,n=[];for(let d of Fr){if(d==null)continue;let i=String(d[e]??"");t.has(i)||(t.set(i,[]),n.push(i)),t.get(i).push(d);}let r=dn.has("__all_collapsed__")&&Y.defaultCollapsed,l=[];for(let d of n){let i=t.get(d),u=r||dn.has(d),y={};if(Y.aggregations)for(let[I,f]of Object.entries(Y.aggregations)){let _=i.map(A=>A[I]);y[I]=ii(_,f);}let m={__bt_group_header__:true,__bt_group_key__:d,__bt_group_value__:i[0]?.[e],__bt_group_count__:i.length,__bt_group_collapsed__:u,__bt_group_aggregates__:y,__bt_group_rows__:i};l.push(m),u||l.push(...i);}return l},[Fr,Y,dn,ii]),[ai,Sa]=re.useState(()=>ee?ee.defaultExpandAll?new Set(["__tree_expand_all__"]):new Set(ee.defaultExpandedKeys??[]):new Set),St=re.useMemo(()=>ee?.expandedKeys?new Set(ee.expandedKeys):ai,[ee?.expandedKeys,ai]),Ra=re.useCallback(e=>{let t=St.has(e);if(ee?.onExpandChange){let n=t?[...St].filter(r=>r!==e&&r!=="__tree_expand_all__"):[...St,e].filter(r=>r!=="__tree_expand_all__");ee.onExpandChange(n);}else Sa(n=>{let r=new Set(n);return r.delete("__tree_expand_all__"),t?r.delete(e):r.add(e),r});},[St,ee]),lt=re.useMemo(()=>{if(!ee)return Pr;let e=ee.childrenKey??"children",t=St.has("__tree_expand_all__"),n=[],r=(l,d)=>{for(let i of l){if(i==null)continue;let u=i,y=u[e],m=Array.isArray(y)&&y.length>0,I=typeof $=="function"?$(i):String(u[typeof $=="string"?$:"id"]??n.length),f=t||St.has(I),_={...u,__bt_tree_level__:d,__bt_tree_has_children__:m,__bt_tree_expanded__:f,__bt_tree_key__:I};n.push(_),m&&f&&r(y,d+1);}};return r(Pr,0),n},[Pr,ee,St,$]),wa=re.useCallback(e=>{if(Mn.length!==0)return Ei(e,Mn)},[Mn]),Ca=re.useCallback((e,t)=>{if(Ln.length!==0)return Ai(e,t,Ln)},[Ln]),dt=re.useMemo(()=>(se??[]).filter(e=>e.applyToRow),[se]),Gn=re.useMemo(()=>(se??[]).filter(e=>!e.applyToRow),[se]),_a=re.useCallback(e=>{if(dt.length===0)return;let t;for(let n of dt)try{n.condition(void 0,e,"")&&(t=t?{...t,...n.style}:{...n.style});}catch{}return t},[dt]),Ia=re.useCallback(e=>{if(dt.length===0)return "";let t=[];for(let n of dt)try{n.className&&n.condition(void 0,e,"")&&t.push(n.className);}catch{}return t.join(" ")},[dt]),Ta=re.useCallback((e,t)=>{if(Gn.length===0)return;let n;for(let r of Gn)if(!(r.columns&&r.columns.length>0&&!r.columns.includes(t)))try{let l=e[t];r.condition(l,e,t)&&(n=n?{...n,...r.style}:{...r.style});}catch{}return n},[Gn]),et=re.useRef(new Map),{pinnedTopRows:Rt,pinnedBottomRows:wt,unpinnedProcessedData:cn}=re.useMemo(()=>{if(!Pe||!Pe.top?.length&&!Pe.bottom?.length)return pe&&et.current.clear(),{pinnedTopRows:[],pinnedBottomRows:[],unpinnedProcessedData:lt};let e=new Set((Pe.top??[]).map(String)),t=new Set((Pe.bottom??[]).map(String)),n=new Map,r=new Map,l=[];if(lt.forEach((u,y)=>{if(u==null)return;let m=je(u,y);e.has(m)?(n.set(m,u),pe&&et.current.set(m,u)):t.has(m)?(r.set(m,u),pe&&et.current.set(m,u)):l.push(u);}),pe){for(let y of e)!n.has(y)&&et.current.has(y)&&n.set(y,et.current.get(y));for(let y of t)!r.has(y)&&et.current.has(y)&&r.set(y,et.current.get(y));let u=new Set([...e,...t]);for(let y of et.current.keys())u.has(y)||et.current.delete(y);}let d=(Pe.top??[]).map(u=>n.get(String(u))).filter(u=>u!==void 0),i=(Pe.bottom??[]).map(u=>r.get(String(u))).filter(u=>u!==void 0);return {pinnedTopRows:d,pinnedBottomRows:i,unpinnedProcessedData:l}},[lt,Pe,je,pe]),Ea=Rt.length*c,Aa=wt.length*c,Ma=re.useMemo(()=>new Set((Pe?.top??[]).map(String)),[Pe?.top]),La=re.useMemo(()=>new Set((Pe?.bottom??[]).map(String)),[Pe?.bottom]),[Oa,si]=re.useState(null),za=re.useCallback(()=>{si(null);},[]),[De,tt]=re.useState(null),Hr=re.useRef(null),un=re.useRef(null),pn=re.useRef(null),Vn=re.useCallback(()=>{un.current&&(clearTimeout(un.current),un.current=null),pn.current=null;},[]);re__default.default.useEffect(()=>{if(!De)return;let e=n=>{Hr.current&&Hr.current.contains(n.target)||tt(null);},t=n=>{n.key==="Escape"&&tt(null);};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t);}},[De]);let $a=Object.keys(Ze).sort().map(e=>`${e}:${Ze[e]}`).join("|"),Na=w??Ft;re__default.default.useEffect(()=>{Wt(1),me.current?.scrollTo({top:0});},[$a,Na]);let li=15,[Wr,Wt]=re.useState(1),[Da,Ba]=re.useState(li),Ct=V.length,Fa=T===void 0&&Ct>li,_t=T===false?false:!!T||Fa,It=_t&&typeof T=="object"&&T?.pageSize!==void 0?T.pageSize:Da,Pa=typeof T=="object"&&T?.current!==void 0,gn=_t?Pa?Number(T.current):Wr:1,fn=_t&&cn.length>It,qn=re.useMemo(()=>{if(!fn)return cn;let e=(gn-1)*It;return cn.slice(e,e+It)},[cn,fn,gn,It]),Kr=_t?It:15,Tt=Ce&&lt.length===0,Xn=typeof $=="string"?$:"id",yn=re.useMemo(()=>Tt?Array.from({length:Kr},(e,t)=>({[Xn]:`__shimmer_${t}__`})):null,[Tt,Kr,Xn]),Ha=5,di=Ce&&qn.length>0&&!Tt&&!_t,jr=re.useMemo(()=>di?Array.from({length:Ha},(e,t)=>({[Xn]:`__shimmer_${t}__`})):null,[di,Xn]),Ge=re.useMemo(()=>yn||(jr?[...qn,...jr]:qn),[yn,jr,qn]),Gr=re.useRef(new Map),Vr=re.useRef(new Map),Wa=re.useCallback((e,t)=>{!rt||Vr.current.get(e)===t||(Vr.current.set(e,t),qr.current?.measure());},[rt]),Yn=re.useRef(null),Ka=re.useCallback((e,t)=>{let n=Gr.current.get(e),r=Math.round(t);n!==r&&(Gr.current.set(e,r),Yn.current!==null&&cancelAnimationFrame(Yn.current),Yn.current=requestAnimationFrame(()=>{Yn.current=null,qr.current?.measure();}));},[]),Kt=reactVirtual.useVirtualizer({count:Ge.length,getScrollElement:()=>me.current,estimateSize:e=>{if(yn)return c;let t=Ge[e];if(!t)return c;let n=rt?Vr.current.get(e)??c:c,r=je(t,e);if(!rn.has(r))return n;let l=Gr.current.get(r);return l?n+l:n+b},overscan:5,getItemKey:e=>{if(yn)return `__shimmer_${e}__`;let t=Ge[e];return t?je(t,e):`__fallback_${e}__`},paddingStart:Ea,paddingEnd:Aa}),qr=re.useRef(Kt);qr.current=Kt;let ja=re.useRef(0),[Un,Ga]=re.useState(null);re__default.default.useEffect(()=>{if(!ne)return;let e=me.current;if(!e)return;let t=()=>{let n=e.scrollLeft;ja.current=n;let r=e.clientWidth,l=n,d=n+r,i=0,u=-1,y=Z.length-1;for(let m=0;m<Z.length;m++){let I=Z[m],f=I.width??150,_=i,A=i+f;if(i=A,!I.pinned&&(u===-1&&A>l&&(u=Math.max(0,m-1)),_>d)){y=Math.min(Z.length-1,m+1);break}}u===-1&&(u=0),Ga(m=>m&&m.start===u&&m.end===y?m:{start:u,end:y});};return t(),e.addEventListener("scroll",t,{passive:true}),()=>e.removeEventListener("scroll",t)},[ne,Z]);let Va=re.useMemo(()=>!ne||!Un?Bt:Bt.filter((e,t)=>e.pinned||e.key==="__select__"||e.key==="__expand__"||e.key==="__drag__"?true:t>=Un.start&&t<=Un.end),[ne,Un,Bt]),qa=Array.from(rn).sort().join(",");re__default.default.useLayoutEffect(()=>{Kt.measure();},[qa]);let Xr=re.useRef(false),Yr=re.useRef(Re);Yr.current=Re;let ci=re.useRef(Ce);ci.current=Ce,re__default.default.useEffect(()=>{let e=setTimeout(()=>{Xr.current=false;},200);return ()=>clearTimeout(e)},[Ct,Ce]),re__default.default.useEffect(()=>{let e=me.current;if(!e)return;let t=()=>{if(!Yr.current||Ge.length===0||Xr.current||ci.current)return;let n=Kt.getVirtualItems();if(n.length===0)return;let r=n[n.length-1].index;Ge.length-1-r<=we&&(Xr.current=true,Yr.current());};return e.addEventListener("scroll",t,{passive:true}),()=>e.removeEventListener("scroll",t)},[Ge.length,we]);let Jn=yo?Z.find(e=>e.key===yo):null,de=gn,hn=It,Ur=_t?(typeof T=="object"?T?.total:void 0)??(fn?cn.length:Ct):Ct,Jr=re.useRef(0);(!Ce||Ur>0)&&(Jr.current=Ur);let jt=Ce&&Jr.current>0?Jr.current:Ur,ye=Math.max(1,Math.ceil(jt/hn));re__default.default.useEffect(()=>{ye>0&&Wr>ye&&Wt(ye);},[ye,Wr]);let mn=e=>{e>=1&&e<=ye&&(Wt(e),D?.(e,hn));},Xa=e=>{Wt(1),Ba(e),D?.(1,e);};re__default.default.useEffect(()=>{fn&&me.current?.scrollTo({top:0});},[gn,fn]);let Ya=()=>{if(ye<=7)return Array.from({length:ye},(l,d)=>d+1);let e=Math.max(de-1,2),t=e>2,n=Math.min(de+1,ye-1),r=de<ye-3;return !t&&r?[1,2,3,4,5,"ellipsis-right",ye]:t&&!r?[1,"ellipsis-left",...Array.from({length:5},(l,d)=>ye-4+d)]:[1,"ellipsis-left",e,de,n,"ellipsis-right",ye]},Zn=Ue?72:36,Ua=10,Zr=Kt.getTotalSize(),Ja=Zr+Zn,Za=Ua*c+Zn,Qn=Ge.length===0&&!Tt,Qa=4*c+Zn,ui=Qn?Qa:Math.min(Ja,Za);return re__default.default.useEffect(()=>{if(!Ut)return;let e=me.current;if(!e)return;e.querySelector("[data-bt-focused]")?.scrollIntoView?.({block:"nearest",inline:"nearest"});},[Ut]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{ref:rr,className:`${h??""} ${g.wrapper??""}`,style:{display:"flex",width:"100%",flexDirection:"column",fontSize:"inherit",fontWeight:400,color:ie.color,background:ie.bg,colorScheme:gt?"dark":"light",position:"relative",...ve?{maxHeight:"100%"}:{height:"100%"},...k.wrapper},children:[jsxRuntime.jsx("style",{children:`
40
+ Total rows: ${Y.length}`;e=await io(de,t,"Analyze this data and provide key insights.");}else e="AI insights requires either aiConfig or onAIInsights prop.";En(e);}catch(e){En(`Error: ${e instanceof Error?e.message:"Failed to generate insights"}`);}finally{_o(false);}},[Y,le,de,lt]),[To,Ot]=oe.useState(null),[Mn,Eo]=oe.useState(false),Ui=oe.useCallback(async()=>{Eo(true),Ot(null);try{if(dt){let e=await dt(Y,le);Ot(e);}else if(de){let e=le.filter(i=>Y.slice(0,5).map(m=>m[i.dataIndex??i.key]).some(m=>typeof m=="number"));if(e.length===0){Ot(jsxRuntime.jsx("div",{style:{padding:16,textAlign:"center",color:"GrayText"},children:"No numeric columns found for chart generation."}));return}let t=e[0],n=t.dataIndex??t.key,r=Y.slice(0,20).map(i=>{let u=i[n];return typeof u=="number"?u:0}),l=Math.max(...r,1),d=Math.floor(400/r.length);Ot(jsxRuntime.jsxs("div",{style:{padding:8},children:[jsxRuntime.jsxs("div",{style:{fontSize:"0.85em",fontWeight:600,marginBottom:8,color:p},children:[typeof t.title=="string"?t.title:t.key," (first ",r.length," rows)"]}),jsxRuntime.jsx("svg",{width:"100%",viewBox:`0 0 ${r.length*d} 120`,style:{maxWidth:500},children:r.map((i,u)=>jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:u*d+2,y:120-i/l*100,width:d-4,height:i/l*100,fill:p,opacity:.7,rx:2}),jsxRuntime.jsx("text",{x:u*d+d/2,y:115,textAnchor:"middle",fontSize:8,fill:"GrayText",children:i})]},u))})]}));}}catch(e){Ot(jsxRuntime.jsxs("div",{style:{padding:16,color:"#ef4444"},children:["Chart generation failed: ",e instanceof Error?e.message:"Unknown error"]}));}finally{Eo(false);}},[Y,le,de,dt,p]),Ao=oe.useMemo(()=>{if(!se)return [];let e=le.filter(n=>!n.key.startsWith("__")&&n.dataIndex).map(n=>({key:n.dataIndex??n.key,title:typeof n.title=="string"?n.title:n.key})),t=[];for(let n of e.slice(0,6))t.push(`Show rows where ${n.title} is highest`),t.push(`Filter by ${n.title}`),t.push(`Sort by ${n.title} descending`);return t.push("Highlight rows with missing values"),t.push("Show only the top 10 rows"),t.push("Remove all filters"),t.push("Show all columns"),t},[se,le]),[Ln,hr]=oe.useState([]),[Nn,mr]=oe.useState([]),[br,Zt]=oe.useState(null),[xr,Qt]=oe.useState(null),[vr,en]=oe.useState(null),tn=F&&typeof F=="object"?`bt-ai-filters-${F.storageKey}`:"bt-ai-filters",[Je,Mo]=oe.useState(()=>{try{let e=localStorage.getItem(tn);return e?JSON.parse(e):[]}catch{return []}}),[zn,On]=oe.useState(false),[pt,Lo]=oe.useState(false),$n=oe.useRef(null);oe__default.default.useEffect(()=>{if(!zn)return;let e=t=>{$n.current&&!$n.current.contains(t.target)&&On(false);};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[zn]);let Ji=oe.useCallback(()=>{if(!ut)return;let t={label:Le||ut.message,operations:ut.operations,query:Le},n=[...Je,t];Mo(n);try{localStorage.setItem(tn,JSON.stringify(n));}catch{}Lo(true),setTimeout(()=>Lo(false),1500);},[ut,Le,Je,tn]),No=oe.useCallback(e=>{let t=Je.filter((n,r)=>r!==e);Mo(t);try{localStorage.setItem(tn,JSON.stringify(t));}catch{}},[Je,tn]),zo=oe.useCallback(e=>{let{filteredData:t,sortOp:n,styleOps:r,cellStyleOps:l,hideColumns:d,showColumns:i,resizeOps:u,reorderOp:m,pinOps:f,setPageOp:C}=so(Y,e.operations);if(hr(r),mr(l),e.operations.some(v=>v.type==="filter")){let v=new Set;t.forEach((y,I)=>{let K=typeof N=="function"?N(y):String(y[typeof N=="string"?N:"id"]??I);v.add(K);}),Zt(v);}else Zt(null);n?(Qt(n.column),en(n.direction)):(Qt(null),en(null)),(d.length>0||i.length>0)&&rt(v=>v.map(y=>d.includes(y.key)?{...y,hidden:true}:i.includes(y.key)?{...y,hidden:false}:y));for(let v of u){let y=Math.max(40,Math.min(800,v.width));Ut(I=>{let K=new Map(I);return K.set(v.column,y),K}),D?.(v.column,y);}m&&(Yt(m.order),J?.(m.order));for(let v of f)rt(y=>y.map(I=>I.key===v.column?{...I,pinned:v.pinned}:I)),Ae?.(v.column,v.pinned);C&&Ht(C.page),fr({operations:e.operations,message:`Applied saved filter: ${e.label}`}),On(false);},[Y,N,D,J,Ae]),Oo=oe.useRef(At);Oo.current=At;let $o=oe.useCallback(async()=>{let e=Le.trim();if(e){So(true),Tn(null);try{let t;if(ce)t=await ce(e,{data:Y,columns:le});else if(de){let y=_i(le,Y),I=await io(de,y,e,wo);t=Ti(I),Co(K=>[...K,{role:"user",content:e},{role:"assistant",content:I}]);}else throw new Error("AI mode requires either aiConfig or onAIQuery prop");let{filteredData:n,sortOp:r,styleOps:l,cellStyleOps:d,hideColumns:i,showColumns:u,resizeOps:m,reorderOp:f,pinOps:C,setPageOp:v}=so(Y,t.operations);if(hr(l),mr(d),t.operations.some(y=>y.type==="filter")){let y=new Set;n.forEach((I,K)=>{let ee=typeof N=="function"?N(I):String(I[typeof N=="string"?N:"id"]??K);y.add(ee);}),Zt(y);}else Zt(null);r?(Qt(r.column),en(r.direction)):(Qt(null),en(null)),(i.length>0||u.length>0)&&rt(y=>y.map(I=>i.includes(I.key)?{...I,hidden:!0}:u.includes(I.key)?{...I,hidden:!1}:I));for(let y of m){let I=Math.max(40,Math.min(800,y.width));Ut(K=>{let ee=new Map(K);return ee.set(y.column,I),ee}),D?.(y.column,I);}f&&(Yt(f.order),J?.(f.order));for(let y of C)rt(I=>I.map(K=>K.key===y.column?{...K,pinned:y.pinned}:K)),Ae?.(y.column,y.pinned);v&&Ht(v.page),fr(t),Oo.current?.(t);}catch(t){Tn(t instanceof Error?t.message:"AI query failed");}finally{So(false);}}},[Le,de,ce,Y,le,N,wo]),kr=oe.useCallback(()=>{fr(null),Tn(null),hr([]),mr([]),Zt(null),Qt(null),en(null),gr(""),Co([]);},[]),Bo=oe.useCallback(()=>{ko(false),kr();},[kr]);oe__default.default.useEffect(()=>{ot&&yr.current&&setTimeout(()=>yr.current?.focus(),300);},[ot]);let Sr=oe.useMemo(()=>ct.map(e=>({...e,width:Vi(_n.get(e.key)??e.width)})),[ct,_n]),[Do,Zi]=oe.useState(()=>be?.defaultExpandAllRows&&Y.length>0?new Set(Y.map((e,t)=>{if(e==null)return t;try{if(typeof N=="function")return N(e)}catch{return t}return typeof N=="string"?e[N]??t:t})):new Set(be?.defaultExpandedRowKeys??[])),Qi=be?.expandedRowKeys?.map(String).join("|"),gt=oe.useMemo(()=>be?.expandedRowKeys!==void 0?new Set(be.expandedRowKeys):Do,[Qi,Do]),nn=oe.useRef(be);nn.current=be;let Po=oe.useCallback(e=>{let t=nn.current;if(t?.expandedRowKeys!==void 0){let n=new Set(t.expandedRowKeys);n.has(e)?n.delete(e):n.add(e),t.onExpandedRowsChange?.(Array.from(n));}else Zi(n=>{let r=new Set(n);return r.has(e)?r.delete(e):r.add(e),t?.onExpandedRowsChange?.(Array.from(r)),r});},[]),ft=oe.useCallback((e,t)=>{if(e==null)return `__row_${t}`;try{if(typeof N=="function"){let n=N(e),r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?`__row_${t}`:r}if(typeof N=="string"){let n=e[N];if(n==null)return `__row_${t}`;let r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?`__row_${t}`:r}}catch{return `__row_${t}`}return `__row_${t}`},[N]),Fo=oe.useMemo(()=>{let e=new Map;return Y.map((t,n)=>{let r=ft(t,n),l=e.get(r)??0;return e.set(r,l+1),l>0?`${r}__${n}`:r})},[Y,ft]),Ho=oe.useMemo(()=>{let e=new Set;for(let t of Y){if(t==null)continue;let n=ft(t,0);if(e.has(n))return true;e.add(n);}return false},[Y,ft]),Ke=oe.useCallback((e,t)=>Ho?Fo[t]??ft(e,t):ft(e,t),[ft,Ho,Fo]),Wo=oe.useCallback((e,t)=>{if(e==null)return t;try{if(typeof N=="function"){let n=N(e);if(n==null||typeof n=="number"&&Number.isNaN(n))return t;let r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?t:n}if(typeof N=="string"){let n=e[N];if(n==null||typeof n=="number"&&Number.isNaN(n))return t;let r=String(n);return r==="undefined"||r==="null"||r==="NaN"||r===""?t:typeof n=="number"||typeof n=="string"?n:r}}catch{return t}return t},[N]),Bn=oe.useMemo(()=>{let e=B?.selectedRowKeys;return Array.isArray(e)?e.filter(t=>t!=null).map(t=>String(t)):[]},[B?.selectedRowKeys]),Ko=oe.useRef(Ke);Ko.current=Ke;let jo=oe.useRef(gt);jo.current=gt;let Rr=oe.useRef(Po);Rr.current=Po;let wr=oe.useRef(x);wr.current=x;let Go=!!be?.rowExpandable,Cr=oe.useMemo(()=>Go?[{key:"__expand__",dataIndex:"__expand__",title:"",width:40,pinned:"left",hidden:false,render:(t,n,r)=>{let l=Ko.current(n,r),d=nn.current?.rowExpandable?.(n)??true,i=jo.current.has(l);return d?typeof nn.current?.expandIcon=="function"?nn.current.expandIcon({expanded:i,onExpand:(u,m)=>{m.stopPropagation(),Rr.current(l);},record:n}):jsxRuntime.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),Rr.current(l);},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:"2px",borderRadius:"3px",color:p},children:i?wr.current?.chevronDown??jsxRuntime.jsx(pi,{style:{width:14,height:14}}):wr.current?.chevronRight??jsxRuntime.jsx(Qr,{style:{width:14,height:14}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:16}})}},...Sr]:Sr,[Go,Sr,p]),Ir=oe.useMemo(()=>B?[{key:"__select__",dataIndex:"__select__",title:"",width:48,pinned:"left",hidden:false,render:()=>null},...Cr]:Cr,[B,Cr]),yt=oe.useMemo(()=>!nt||!Ye?Ir:[{key:"__drag__",dataIndex:"__drag__",title:"",width:36,pinned:"left",hidden:false,render:()=>null},...Ir],[nt,Ye,Ir]),Dn=oe.useRef(null),ve=oe.useRef(null),[_r,ea]=oe.useState(0),Vo=oe.useRef(0),Tr=oe.useRef(null),ht=oe.useRef(null),ta=oe.useCallback(e=>{if(Tr.current?.disconnect(),Tr.current=null,ht.current!==null&&(cancelAnimationFrame(ht.current),ht.current=null),ve.current=e,!e)return;let t=()=>{ht.current=null;let r=e.clientWidth;r!==Vo.current&&(Vo.current=r,ea(r));};t();let n=new ResizeObserver(()=>{ht.current!==null&&cancelAnimationFrame(ht.current),ht.current=requestAnimationFrame(t);});n.observe(e),Tr.current=n;},[]),Pn=oe.useRef(null);oe__default.default.useEffect(()=>{let e=ve.current;if(!e)return;let t=l=>{Pn.current!==l&&(Pn.current&&e.querySelectorAll(`[data-row-key="${Pn.current}"]`).forEach(d=>d.removeAttribute("data-hover")),Pn.current=l,l&&e.querySelectorAll(`[data-row-key="${l}"]`).forEach(d=>d.setAttribute("data-hover","")));},n=l=>{let d=l.target.closest("[data-row-key]");t(d?.dataset.rowKey??null);},r=()=>t(null);return e.addEventListener("mouseover",n,{passive:true}),e.addEventListener("mouseleave",r,{passive:true}),()=>{e.removeEventListener("mouseover",n),e.removeEventListener("mouseleave",r);}},[]);let $t=oe.useRef(null),rn=oe.useRef(new Map);oe.useMemo(()=>{let e=new Map;for(let t of Lt)for(let n of t.childKeys)e.set(n,t.key);for(let t of le)e.has(t.key)||e.set(t.key,null);rn.current=e;},[Lt,le]);let Er=oe.useRef(null),Ar=oe.useRef(null),qo=oe.useRef(null),Xo=oe.useRef(J);Xo.current=J;let na=oe.useCallback((e,t)=>{if(e==="__select__"||e==="__expand__"||e==="__drag__")return;let n=t.currentTarget.closest("[data-column-key]");if(!n)return;let r=n.getBoundingClientRect(),l=t.clientX-r.left,d=t.clientY-r.top;ho(e),Ar.current=e,n.setAttribute("data-dragging","");let i=qo.current;i&&(i.style.display="flex",i.style.width=`${r.width}px`,i.style.height=`${r.height}px`,i.style.left=`${t.clientX-l}px`,i.style.top=`${r.top}px`);let u=document.createElement("style");u.textContent="* { cursor: grabbing !important; }",document.head.appendChild(u);let m=rn.current.get(e),f=v=>{i&&(i.style.left=`${v.clientX-l}px`,i.style.top=`${v.clientY-d}px`);let y=ve.current;if(!y)return;let I=y.querySelectorAll("[data-bt-header][data-column-key]"),K=null;I.forEach(ee=>{let He=ee.dataset.columnKey;if(!He||He==="__select__"||He==="__expand__"||He==="__drag__"||He===e){ee.removeAttribute("data-drag-over");return}let _t=rn.current.get(He);if(m!==_t){ee.removeAttribute("data-drag-over");return}let Tt=ee.getBoundingClientRect();v.clientX>=Tt.left&&v.clientX<=Tt.right&&v.clientY>=Tt.top-20&&v.clientY<=Tt.bottom+20?(K=He,ee.setAttribute("data-drag-over","")):ee.removeAttribute("data-drag-over");}),Er.current=K;},C=()=>{document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",C),u.remove();let v=ve.current;v&&(v.querySelectorAll("[data-dragging]").forEach(K=>K.removeAttribute("data-dragging")),v.querySelectorAll("[data-drag-over]").forEach(K=>K.removeAttribute("data-drag-over"))),i&&(i.style.display="none");let y=Er.current,I=Ar.current;y&&I&&y!==I&&rn.current.get(I)===rn.current.get(y)&&oe__default.default.startTransition(()=>{Yt(K=>{let ee=K.indexOf(I),He=K.indexOf(y);if(ee===-1||He===-1)return K;let _t=bs(K,ee,He);return setTimeout(()=>Xo.current?.(_t),0),_t});}),ho(null),Ar.current=null,Er.current=null;};document.addEventListener("pointermove",f),document.addEventListener("pointerup",C);},[]),Yo=oe.useRef(null),Fn=oe.useRef(null),on=oe.useRef(null),Mr=oe.useRef(Ye);Mr.current=Ye;let ra=oe.useCallback((e,t)=>{if(!Mr.current)return;t.preventDefault(),Fn.current=e,on.current=null;let r=t.currentTarget.closest("[data-row-key]")?.offsetHeight??40,l=Yo.current;l&&(l.textContent=`Row ${e+1}`,l.style.display="flex",l.style.left=`${t.clientX+12}px`,l.style.top=`${t.clientY-12}px`,l.style.height=`${Math.min(r,36)}px`);let d=document.createElement("style");d.textContent="* { cursor: grabbing !important; }",document.head.appendChild(d);let i=ve.current,u=f=>{if(l&&(l.style.left=`${f.clientX+12}px`,l.style.top=`${f.clientY-12}px`),!i)return;let C=i.querySelectorAll("[data-bt-cell][data-row-key]"),v=null,y=1/0;C.forEach(I=>{if(!I.dataset.rowKey)return;let ee=I.getBoundingClientRect(),He=ee.top+ee.height/2,_t=Math.abs(f.clientY-He);if(_t<y){y=_t;let Tt=I.dataset.rowIndex;Tt!=null&&(v=Number(Tt));}}),i.querySelectorAll("[data-row-drag-over]").forEach(I=>I.removeAttribute("data-row-drag-over")),v!=null&&v!==Fn.current?(on.current=v,i.querySelectorAll(`[data-bt-cell][data-row-index="${v}"]`).forEach(I=>I.setAttribute("data-row-drag-over",""))):on.current=null;},m=()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",m),d.remove(),l&&(l.style.display="none"),i&&i.querySelectorAll("[data-row-drag-over]").forEach(v=>v.removeAttribute("data-row-drag-over"));let f=Fn.current,C=on.current;f!=null&&C!=null&&f!==C&&Mr.current?.(f,C),Fn.current=null,on.current=null;};document.addEventListener("pointermove",u),document.addEventListener("pointerup",m);},[]),oa=(e,t)=>{if(t.preventDefault(),t.stopPropagation(),e==="__select__"||e==="__expand__"||e==="__drag__")return;let n=yt.findIndex(d=>d.key===e);if(n===-1||yt[n].pinned)return;let r=yt[n],l=r.width??150;if($t.current={columnKey:e,startX:t.clientX,startWidth:l,columnIndex:n,currentX:t.clientX},ve.current){let d=ve.current.querySelector(`[data-column-key="${e}"]`);if(d){let i=ve.current.getBoundingClientRect(),u=d.getBoundingClientRect(),m=ve.current.scrollTop,f=ve.current.scrollLeft,C=u.left-i.left+f;Dn.current?.show(u.right,typeof r.title=="string"?r.title:String(r.key),i,C,40,m,f,C+l);}}document.addEventListener("mousemove",Uo),document.addEventListener("mouseup",Jo);},Uo=e=>{$t.current&&($t.current.currentX=e.clientX,Dn.current?.move(e.clientX));},Jo=oe__default.default.useCallback(()=>{if(!$t.current)return;let{startX:e,startWidth:t,currentX:n,columnKey:r}=$t.current,l=Math.max(40,t+(n-e));Dn.current?.hide(),$t.current=null,document.removeEventListener("mousemove",Uo),document.removeEventListener("mouseup",Jo),xo.current.add(r),oe__default.default.startTransition(()=>{Ut(d=>{let i=new Map(d);return i.set(r,l),i});}),D?.(r,l);},[D]),ia=oe.useCallback(e=>{let t=ve.current;if(!t)return;let n=yt.find(u=>u.key===e);if(!n)return;let r=t.querySelector(`[data-column-key="${e}"] [data-bt-grip]`)?.parentElement??t.querySelector(`[data-column-key="${e}"]`),l=0;if(r){let u=typeof n.title=="string"?n.title:n.key,f=document.createElement("canvas").getContext("2d");if(f){let C=window.getComputedStyle(r);f.font=`${C.fontWeight} ${C.fontSize} ${C.fontFamily}`,l=f.measureText(u).width+60;}}t.querySelectorAll(`[data-bt-cell][data-column-key="${e}"]`).forEach(u=>{let m=u.querySelector("div > div");if(m){let f=m.scrollWidth;f>l&&(l=f);}});let i=Math.max(60,Math.min(Math.ceil(l)+24,800));xo.current.add(e),oe__default.default.startTransition(()=>{Ut(u=>{let m=new Map(u);return m.set(e,i),m});}),D?.(e,i);},[yt,D]),{leftPinned:Hn,unpinned:Zo,rightPinned:an}=oe.useMemo(()=>{let e=new Map(yt.map(i=>[i.key,i])),n=[...[...nt&&Ye?["__drag__"]:[],...B?["__select__"]:[],...be?["__expand__"]:[]],...Cn].map(i=>e.get(i)).filter(i=>i!==void 0&&!i.hidden),r=[],l=[],d=[];return n.forEach(i=>{i.pinned==="left"?r.push(i):i.pinned==="right"?d.push(i):l.push(i);}),{leftPinned:r,unpinned:l,rightPinned:d}},[Cn,yt,B,be,nt,Ye]),Q=oe.useMemo(()=>[...Hn,...Zo,...an],[Hn,Zo,an]),Bt=oe.useMemo(()=>{let e=new Map(In.current.map(t=>[t.key,t]));return Q.map(t=>{if(t.key==="__select__"||t.key==="__expand__"||t.key==="__drag__")return t;let n=e.get(t.key);return n?{...n,width:t.width,hidden:t.hidden,pinned:t.pinned}:t})},[Q,le]),Lr=oe.useMemo(()=>Q.slice(0,-1).reduce((e,t)=>e+(t.width??150),0)+(Q.at(-1)?.width??150),[Q]),Wn=oe.useMemo(()=>Q.length===0?"":Q.map((e,t)=>{let n=e.width??150;return t===Q.length-1?`minmax(${n}px, 1fr)`:`${n}px`}).join(" "),[Q]),mt=oe.useMemo(()=>{let e=new Map,t=0;Hn.forEach(r=>{e.set(r.key,t),t+=r.width??150;});let n=0;for(let r=an.length-1;r>=0;r--){let l=an[r];e.set(l.key,n),n+=l.width??150;}return e},[Hn,an]),aa=oe.useMemo(()=>{let e=new Map;return Q.forEach((t,n)=>e.set(t.key,n+1)),e},[Q]),sa=(e,t)=>{rt(n=>n.map(r=>r.key===e?{...r,pinned:t}:r)),Ae?.(e,t);},Qo=e=>{rt(n=>n.map(r=>r.key!==e||r.pinned?r:{...r,hidden:!r.hidden}));let t=ct.find(n=>n.key===e);t&&!t.pinned&&ke?.(e,!t.hidden);},[la,da]=oe.useState({top:[],bottom:[]}),Fe=ge===true?la:ge&&typeof ge=="object"?ge:void 0,ei=oe.useCallback((e,t)=>{if(Ve){Ve(e,t);return}ge===true&&da(n=>{let r=String(e),l=(n.top??[]).filter(i=>String(i)!==r),d=(n.bottom??[]).filter(i=>String(i)!==r);return t==="top"?l.push(e):t==="bottom"&&d.push(e),{top:l,bottom:d}});},[Ve,ge]),Nr=oe.useRef(me);Nr.current=me;let ti=oe.useRef(_e);ti.current=_e;let[Qe,ca]=oe.useState([]),ua=oe.useCallback((e,t,n)=>{ca(r=>{let l=r.findIndex(m=>m.key===e),d=l>=0?r[l]:null,i;t!==void 0?i=d?.direction===t?null:t:i=d?d.direction==="asc"?"desc":d.direction==="desc"?null:"asc":"asc";let u;return n&&Ie?(u=r.filter(m=>m.key!==e),i&&u.push({key:e,direction:i})):u=i?[{key:e,direction:i}]:[],Nr.current?.(e,i),Ie&&ti.current?.(u.map(m=>({columnKey:m.key,direction:m.direction}))),u});},[Ie]),[je,ni]=oe.useState({}),[Dt,zr]=oe.useState(""),[Or,pa]=oe.useState([]),[ga,Kn]=oe.useState(false),fa=oe.useRef(null),ya=oe.useCallback(e=>{e.trim()&&pa(t=>{let n=t.filter(r=>r!==e);return [e,...n].slice(0,10)});},[]),[jn,Gn]=oe.useState(false),[Pt,Ft]=oe.useState([{id:1,column:"",operator:"contains",value:""}]),[sn,ha]=oe.useState("and"),ri=oe.useRef(2),[Vn,$r]=oe.useState(null),ma=oe.useCallback(()=>{let e=Pt.filter(t=>t.column&&t.value);e.length===0?$r(null):$r({rules:e,logic:sn}),Gn(false);},[Pt,sn]),Br=oe.useCallback((e,t)=>{ni(n=>{let r={...n};return t?r[e]=t:delete r[e],Te?.(r),r});},[Te]),ba=oe.useCallback(e=>{Br(e,"");},[Br]),Dr=oe.useRef(Te);Dr.current=Te;let ln=oe.useRef(le);ln.current=le;let oi=oe.useMemo(()=>{let e=Y,t=R??Dt;if(t){let n=t.toLowerCase(),r=ln.current.filter(l=>l.dataIndex).map(l=>l.dataIndex);e=e.filter(l=>{if(l==null)return false;for(let d of r){let i=l[d];if(i!=null&&String(i).toLowerCase().includes(n))return true}return false});}if(!Dr.current){let n=Object.keys(je);n.length>0&&(e=e.filter(r=>r==null?false:n.every(l=>{try{let d=ln.current.find(f=>f.key===l);if(typeof d?.filterFn=="function")return d.filterFn(je[l],r,d.dataIndex??l);let i=je[l];if(d?.filterType==="dateRange"&&i.includes("..")){let[f,C]=i.split(".."),v=String(r[d.dataIndex??l]??"");return !(f&&v<f||C&&v>C)}if(d?.filterType==="numberRange"&&i.includes("..")){let[f,C]=i.split(".."),v=Number(r[d.dataIndex??l]);return !(Number.isNaN(v)||f&&v<Number(f)||C&&v>Number(C))}let u=i.match(/^(eq|neq|gt|gte|lt|lte|contains|startsWith|endsWith):(.*)$/);if(u){let f=u[1],C=u[2],v=r[d?.dataIndex??l],y=String(v??"").toLowerCase(),I=C.toLowerCase(),K=Number(v),ee=Number(C);switch(f){case "eq":return y===I;case "neq":return y!==I;case "gt":return !Number.isNaN(K)&&!Number.isNaN(ee)&&K>ee;case "gte":return !Number.isNaN(K)&&!Number.isNaN(ee)&&K>=ee;case "lt":return !Number.isNaN(K)&&!Number.isNaN(ee)&&K<ee;case "lte":return !Number.isNaN(K)&&!Number.isNaN(ee)&&K<=ee;case "contains":return y.includes(I);case "startsWith":return y.startsWith(I);case "endsWith":return y.endsWith(I);default:return !0}}return String(r[l]??"").toLowerCase().includes(i.toLowerCase())}catch{return true}})));}if(Vn&&Vn.rules.length>0&&!Dr.current){let{rules:n,logic:r}=Vn;e=e.filter(l=>{if(l==null)return false;let d=i=>{try{let u=ln.current.find(I=>I.key===i.column),m=l[u?.dataIndex??i.column],f=String(m??"").toLowerCase(),C=i.value.toLowerCase(),v=Number(m),y=Number(i.value);switch(i.operator){case "eq":return f===C;case "neq":return f!==C;case "gt":return !Number.isNaN(v)&&!Number.isNaN(y)&&v>y;case "gte":return !Number.isNaN(v)&&!Number.isNaN(y)&&v>=y;case "lt":return !Number.isNaN(v)&&!Number.isNaN(y)&&v<y;case "lte":return !Number.isNaN(v)&&!Number.isNaN(y)&&v<=y;case "contains":return f.includes(C);case "startsWith":return f.startsWith(C);case "endsWith":return f.endsWith(C);default:return f.includes(C)}}catch{return true}};return r==="or"?n.some(d):n.every(d)});}if(!Nr.current&&Qe.length>0){let n=Qe.filter(r=>r.key&&r.direction);if(n.length>0)try{e=[...e].sort((r,l)=>{if(r==null&&l==null)return 0;if(r==null)return 1;if(l==null)return -1;for(let{key:d,direction:i}of n){let u=i==="asc"?1:-1,m=ln.current.find(C=>C.key===d),f=0;if(typeof m?.sorter=="function")f=m.sorter(r,l)*u;else {let C=r[d],v=l[d];C==null&&v!=null?f=1:C!=null&&v==null?f=-1:C!=null&&v!=null&&(typeof C=="number"&&typeof v=="number"?f=(C-v)*u:f=String(C).localeCompare(String(v))*u);}if(f!==0)return f}return 0});}catch{}}return e},[Y,Qe,je,R,Dt,Vn]),Pr=oe.useMemo(()=>{let e=oi;if(br&&(e=e.filter((t,n)=>{if(t==null)return false;let r=typeof N=="function"?N(t):String(t[typeof N=="string"?N:"id"]??n);return br.has(r)})),xr&&vr){let t=vr==="asc"?1:-1,n=xr;e=[...e].sort((r,l)=>{let d=r[n],i=l[n];return d==null&&i==null?0:d==null?1:i==null?-1:typeof d=="number"&&typeof i=="number"?(d-i)*t:String(d).localeCompare(String(i))*t});}return e},[oi,br,xr,vr,N]),[xa,va]=oe.useState(()=>U?.defaultCollapsed?new Set(["__all_collapsed__"]):new Set),dn=U?.collapsedGroups??xa,ka=oe.useCallback(e=>{let t=!dn.has(e);U?.onGroupToggle?U.onGroupToggle(e,t):va(n=>{let r=new Set(n);return r.delete("__all_collapsed__"),t?r.add(e):r.delete(e),r});},[dn,U]),ii=oe.useCallback((e,t)=>{if(typeof t=="function")return t(e);let n=e.filter(r=>typeof r=="number");switch(t){case "count":return e.length;case "sum":return n.reduce((r,l)=>r+l,0);case "avg":return n.length?n.reduce((r,l)=>r+l,0)/n.length:0;case "min":return n.length?Math.min(...n):void 0;case "max":return n.length?Math.max(...n):void 0;default:return}},[]),Fr=oe.useMemo(()=>{if(!U?.groupBy)return Pr;let e=U.groupBy,t=new Map,n=[];for(let d of Pr){if(d==null)continue;let i=String(d[e]??"");t.has(i)||(t.set(i,[]),n.push(i)),t.get(i).push(d);}let r=dn.has("__all_collapsed__")&&U.defaultCollapsed,l=[];for(let d of n){let i=t.get(d),u=r||dn.has(d),m={};if(U.aggregations)for(let[C,v]of Object.entries(U.aggregations)){let y=i.map(I=>I[C]);m[C]=ii(y,v);}let f={__bt_group_header__:true,__bt_group_key__:d,__bt_group_value__:i[0]?.[e],__bt_group_count__:i.length,__bt_group_collapsed__:u,__bt_group_aggregates__:m,__bt_group_rows__:i};l.push(f),u||l.push(...i);}return l},[Pr,U,dn,ii]),[ai,Sa]=oe.useState(()=>te?te.defaultExpandAll?new Set(["__tree_expand_all__"]):new Set(te.defaultExpandedKeys??[]):new Set),bt=oe.useMemo(()=>te?.expandedKeys?new Set(te.expandedKeys):ai,[te?.expandedKeys,ai]),Ra=oe.useCallback(e=>{let t=bt.has(e);if(te?.onExpandChange){let n=t?[...bt].filter(r=>r!==e&&r!=="__tree_expand_all__"):[...bt,e].filter(r=>r!=="__tree_expand_all__");te.onExpandChange(n);}else Sa(n=>{let r=new Set(n);return r.delete("__tree_expand_all__"),t?r.delete(e):r.add(e),r});},[bt,te]),xt=oe.useMemo(()=>{if(!te)return Fr;let e=te.childrenKey??"children",t=bt.has("__tree_expand_all__"),n=[],r=(l,d)=>{for(let i of l){if(i==null)continue;let u=i,m=u[e],f=Array.isArray(m)&&m.length>0,C=typeof N=="function"?N(i):String(u[typeof N=="string"?N:"id"]??n.length),v=t||bt.has(C),y={...u,__bt_tree_level__:d,__bt_tree_has_children__:f,__bt_tree_expanded__:v,__bt_tree_key__:C};n.push(y),f&&v&&r(m,d+1);}};return r(Fr,0),n},[Fr,te,bt,N]),wa=oe.useCallback(e=>{if(Ln.length!==0)return Ei(e,Ln)},[Ln]),Ca=oe.useCallback((e,t)=>{if(Nn.length!==0)return Ai(e,t,Nn)},[Nn]),it=oe.useMemo(()=>(ie??[]).filter(e=>e.applyToRow),[ie]),qn=oe.useMemo(()=>(ie??[]).filter(e=>!e.applyToRow),[ie]),Ia=oe.useCallback(e=>{if(it.length===0)return;let t;for(let n of it)try{n.condition(void 0,e,"")&&(t=t?{...t,...n.style}:{...n.style});}catch{}return t},[it]),_a=oe.useCallback(e=>{if(it.length===0)return "";let t=[];for(let n of it)try{n.className&&n.condition(void 0,e,"")&&t.push(n.className);}catch{}return t.join(" ")},[it]),Ta=oe.useCallback((e,t)=>{if(qn.length===0)return;let n;for(let r of qn)if(!(r.columns&&r.columns.length>0&&!r.columns.includes(t)))try{let l=e[t];r.condition(l,e,t)&&(n=n?{...n,...r.style}:{...r.style});}catch{}return n},[qn]),et=oe.useRef(new Map),{pinnedTopRows:vt,pinnedBottomRows:kt,unpinnedProcessedData:cn}=oe.useMemo(()=>{if(!Fe||!Fe.top?.length&&!Fe.bottom?.length)return Me&&et.current.clear(),{pinnedTopRows:[],pinnedBottomRows:[],unpinnedProcessedData:xt};let e=new Set((Fe.top??[]).map(String)),t=new Set((Fe.bottom??[]).map(String)),n=new Map,r=new Map,l=[];if(xt.forEach((u,m)=>{if(u==null)return;let f=Ke(u,m);e.has(f)?(n.set(f,u),Me&&et.current.set(f,u)):t.has(f)?(r.set(f,u),Me&&et.current.set(f,u)):l.push(u);}),Me){for(let m of e)!n.has(m)&&et.current.has(m)&&n.set(m,et.current.get(m));for(let m of t)!r.has(m)&&et.current.has(m)&&r.set(m,et.current.get(m));let u=new Set([...e,...t]);for(let m of et.current.keys())u.has(m)||et.current.delete(m);}let d=(Fe.top??[]).map(u=>n.get(String(u))).filter(u=>u!==void 0),i=(Fe.bottom??[]).map(u=>r.get(String(u))).filter(u=>u!==void 0);return {pinnedTopRows:d,pinnedBottomRows:i,unpinnedProcessedData:l}},[xt,Fe,Ke,Me]),Ea=vt.length*c,Aa=kt.length*c,Ma=oe.useMemo(()=>new Set((Fe?.top??[]).map(String)),[Fe?.top]),La=oe.useMemo(()=>new Set((Fe?.bottom??[]).map(String)),[Fe?.bottom]),[Na,si]=oe.useState(null),za=oe.useCallback(()=>{si(null);},[]),[Oe,tt]=oe.useState(null),Hr=oe.useRef(null),un=oe.useRef(null),pn=oe.useRef(null),Xn=oe.useCallback(()=>{un.current&&(clearTimeout(un.current),un.current=null),pn.current=null;},[]);oe__default.default.useEffect(()=>{if(!Oe)return;let e=n=>{Hr.current&&Hr.current.contains(n.target)||tt(null);},t=n=>{n.key==="Escape"&&tt(null);};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t);}},[Oe]);let Oa=oe.useMemo(()=>Object.keys(je).sort().map(e=>`${e}:${je[e]}`).join("|"),[je]),$a=R??Dt;oe__default.default.useEffect(()=>{Ht(1),ve.current?.scrollTo({top:0});},[Oa,$a]);let li=15,[Wr,Ht]=oe.useState(1),[Ba,Da]=oe.useState(li),St=Y.length,Pa=T===void 0&&St>li,Rt=T===false?false:!!T||Pa,wt=Rt&&typeof T=="object"&&T?.pageSize!==void 0?T.pageSize:Ba,Fa=typeof T=="object"&&T?.current!==void 0,gn=Rt?Fa?Number(T.current):Wr:1,fn=Rt&&cn.length>wt,Yn=oe.useMemo(()=>{if(!fn)return cn;let e=(gn-1)*wt;return cn.slice(e,e+wt)},[cn,fn,gn,wt]),Kr=Rt?wt:15,Ct=we&&xt.length===0,Un=typeof N=="string"?N:"id",It=oe.useMemo(()=>Ct?Array.from({length:Kr},(e,t)=>({[Un]:`__shimmer_${t}__`})):null,[Ct,Kr,Un]),Ha=5,di=we&&Yn.length>0&&!Ct&&!Rt,jr=oe.useMemo(()=>di?Array.from({length:Ha},(e,t)=>({[Un]:`__shimmer_${t}__`})):null,[di,Un]),$e=oe.useMemo(()=>It||(jr?[...Yn,...jr]:Yn),[It,jr,Yn]),Gr=oe.useRef(new Map),Vr=oe.useRef(new Map),Wa=oe.useCallback((e,t)=>{!P||Vr.current.get(e)===t||(Vr.current.set(e,t),qr.current?.measure());},[P]),Jn=oe.useRef(null),Ka=oe.useCallback((e,t)=>{let n=Gr.current.get(e),r=Math.round(t);n!==r&&(Gr.current.set(e,r),Jn.current!==null&&cancelAnimationFrame(Jn.current),Jn.current=requestAnimationFrame(()=>{Jn.current=null,qr.current?.measure();}));},[]),ja=oe.useCallback(e=>{if(It)return c;let t=$e[e];if(!t)return c;let n=P?Vr.current.get(e)??c:c,r=Ke(t,e);if(!gt.has(r))return n;let l=Gr.current.get(r);return l?n+l:n+b},[It,$e,c,P,gt,b]),Ga=oe.useCallback(e=>{if(It)return `__shimmer_${e}__`;let t=$e[e];return t?Ke(t,e):`__fallback_${e}__`},[It,$e]),Va=oe.useCallback(()=>ve.current,[]),Wt=reactVirtual.useVirtualizer({count:$e.length,getScrollElement:Va,estimateSize:ja,overscan:5,getItemKey:Ga,paddingStart:Ea,paddingEnd:Aa}),qr=oe.useRef(Wt);qr.current=Wt;let qa=oe.useRef(0),[Zn,Xa]=oe.useState(null);oe__default.default.useEffect(()=>{if(!re)return;let e=ve.current;if(!e)return;let t=()=>{let n=e.scrollLeft;qa.current=n;let r=e.clientWidth,l=n,d=n+r,i=0,u=-1,m=Q.length-1;for(let f=0;f<Q.length;f++){let C=Q[f],v=C.width??150,y=i,I=i+v;if(i=I,!C.pinned&&(u===-1&&I>l&&(u=Math.max(0,f-1)),y>d)){m=Math.min(Q.length-1,f+1);break}}u===-1&&(u=0),Xa(f=>f&&f.start===u&&f.end===m?f:{start:u,end:m});};return t(),e.addEventListener("scroll",t,{passive:true}),()=>e.removeEventListener("scroll",t)},[re,Q]);let Ya=oe.useMemo(()=>!re||!Zn?Bt:Bt.filter((e,t)=>e.pinned||e.key==="__select__"||e.key==="__expand__"||e.key==="__drag__"?true:t>=Zn.start&&t<=Zn.end),[re,Zn,Bt]),Ua=oe.useMemo(()=>Array.from(gt).sort().join(","),[gt]);oe__default.default.useLayoutEffect(()=>{Wt.measure();},[Ua]);let Xr=oe.useRef(false),Yr=oe.useRef(Se);Yr.current=Se;let ci=oe.useRef(we);ci.current=we,oe__default.default.useEffect(()=>{let e=setTimeout(()=>{Xr.current=false;},200);return ()=>clearTimeout(e)},[St,we]),oe__default.default.useEffect(()=>{let e=ve.current;if(!e)return;let t=()=>{if(!Yr.current||$e.length===0||Xr.current||ci.current)return;let n=Wt.getVirtualItems();if(n.length===0)return;let r=n[n.length-1].index;$e.length-1-r<=Re&&(Xr.current=true,Yr.current());};return e.addEventListener("scroll",t,{passive:true}),()=>e.removeEventListener("scroll",t)},[$e.length,Re]);let Qn=yo?Q.find(e=>e.key===yo):null,ue=gn,yn=wt,Ur=Rt?(typeof T=="object"?T?.total:void 0)??(fn?cn.length:St):St,Jr=oe.useRef(0);(!we||Ur>0)&&(Jr.current=Ur);let Kt=we&&Jr.current>0?Jr.current:Ur,he=Math.max(1,Math.ceil(Kt/yn));oe__default.default.useEffect(()=>{he>0&&Wr>he&&Ht(he);},[he,Wr]);let hn=e=>{e>=1&&e<=he&&(Ht(e),$?.(e,yn));},Ja=e=>{Ht(1),Da(e),$?.(1,e);};oe__default.default.useEffect(()=>{fn&&ve.current?.scrollTo({top:0});},[gn,fn]);let Za=()=>{if(he<=7)return Array.from({length:he},(l,d)=>d+1);let e=Math.max(ue-1,2),t=e>2,n=Math.min(ue+1,he-1),r=ue<he-3;return !t&&r?[1,2,3,4,5,"ellipsis-right",he]:t&&!r?[1,"ellipsis-left",...Array.from({length:5},(l,d)=>he-4+d)]:[1,"ellipsis-left",e,ue,n,"ellipsis-right",he]},er=Ue?72:36,Qa=10,Zr=Wt.getTotalSize(),es=Zr+er,ts=Qa*c+er,tr=$e.length===0&&!Ct,ns=4*c+er,ui=tr?ns:Math.min(es,ts);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{ref:ir,className:`${h??""} ${g.wrapper??""}`,style:{display:"flex",width:"100%",flexDirection:"column",fontSize:"inherit",fontWeight:400,color:fe.color,background:fe.bg,colorScheme:Xt?"dark":"light",position:"relative",...xe?{maxHeight:"100%"}:{height:"100%"},...k.wrapper},children:[jsxRuntime.jsx("style",{children:`
41
41
  @keyframes bt-pulse {
42
42
  0%, 100% { opacity: 1; }
43
43
  50% { opacity: 0.5; }
@@ -79,7 +79,7 @@ Total rows: ${V.length}`;e=await io(oe,t,"Analyze this data and provide key insi
79
79
  [data-bt-header][data-drag-over] {
80
80
  border: 1px dashed ${p} !important;
81
81
  }
82
- ${Le||fe?"[data-bt-cell] { cursor: pointer; }":""}
82
+ ${De||ae?"[data-bt-cell] { cursor: pointer; }":""}
83
83
  [data-row-drag-over] {
84
84
  box-shadow: 0 -2px 0 0 ${p} inset;
85
85
  }
@@ -100,11 +100,6 @@ Total rows: ${V.length}`;e=await io(oe,t,"Analyze this data and provide key insi
100
100
  0% { background-position: -200% 0; }
101
101
  100% { background-position: 200% 0; }
102
102
  }
103
- [data-bt-focused] {
104
- outline: 2px solid ${p};
105
- outline-offset: -2px;
106
- z-index: 12 !important;
107
- }
108
103
  [data-bt-check] {
109
104
  appearance: none;
110
105
  -webkit-appearance: none;
@@ -174,4 +169,4 @@ Total rows: ${V.length}`;e=await io(oe,t,"Analyze this data and provide key insi
174
169
  scrollbar-width: thin;
175
170
  scrollbar-color: rgba(128,128,128,0.3) transparent;
176
171
  }
177
- `}),(!v||U||_e)&&jsxRuntime.jsxs("div",{className:g.toolbar??"",style:{position:"relative",display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderBottom:"1px solid rgba(128,128,128,0.2)",fontSize:"inherit",flexShrink:0,zIndex:20,...k.toolbar},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:"1 1 0%",opacity:st?0:1,transform:st?"scale(0.97)":"scale(1)",transition:"opacity 0.25s ease, transform 0.25s ease",pointerEvents:st?"none":"auto",minWidth:0},children:[!v&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flex:"1 1 0%",position:"relative"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"GrayText",flexShrink:0},children:x?.search??jsxRuntime.jsx(vi,{style:{width:14,height:14}})}),jsxRuntime.jsx("input",{ref:fa,type:"text",placeholder:"Search all columns...",value:w??Ft,onChange:e=>{let t=e.target.value;O?O(t):zr(t);},onFocus:()=>{$r.length>0&&Wn(true);},onBlur:()=>{setTimeout(()=>Wn(false),150);},onKeyDown:e=>{e.key==="Enter"&&(ya((w??Ft)||""),Wn(false));},className:g.searchInput??"",style:{flex:"1 1 0%",border:"none",outline:"none",background:"transparent",font:"inherit",color:"inherit",padding:"4px 6px",minWidth:0,...k.searchInput}}),ga&&$r.length>0&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:99999,borderRadius:6,border:"1px solid rgba(128,128,128,0.2)",boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,padding:"4px 0",marginTop:2,maxHeight:200,overflowY:"auto"},children:[jsxRuntime.jsx("div",{style:{padding:"4px 10px",fontSize:"0.75em",opacity:.5,fontWeight:600},children:"Recent"}),$r.map((e,t)=>jsxRuntime.jsx("button",{type:"button",style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 10px",fontSize:"inherit",color:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},onMouseDown:n=>{n.preventDefault(),O?O(e):zr(e),Wn(false);},children:e},t))]}),(w??Ft)&&jsxRuntime.jsx("button",{type:"button",onClick:()=>{O?O(""):zr("");},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},children:x?.close??jsxRuntime.jsx(Ve,{style:{width:12,height:12}})})]}),F,U&&jsxRuntime.jsxs("div",{style:{position:"relative",flexShrink:0},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>cr(e=>!e),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"4px 6px",color:"inherit",gap:4,fontSize:"inherit"},title:"Column settings",children:[x?.columns??jsxRuntime.jsx(ki,{style:{width:14,height:14}}),jsxRuntime.jsx("span",{children:j??"Columns"})]}),dr&&jsxRuntime.jsx("div",{ref:ur,style:{position:"absolute",top:"100%",right:0,zIndex:99999,minWidth:200,maxHeight:320,overflowY:"auto",borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,padding:"4px 0",marginTop:4},children:ae.filter(e=>e.key!=="__select__"&&e.key!=="__expand__"&&e.key!=="__drag__").map(e=>{let t=ft.find(l=>l.key===e.key),n=t?.hidden??false,r=!!t?.pinned;return jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,fontSize:"inherit"},children:[jsxRuntime.jsx("input",{type:"checkbox",checked:!n,disabled:r,onChange:()=>{r||Qo(e.key);},style:{cursor:r?"not-allowed":"pointer",accentColor:p}}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:typeof e.title=="string"?e.title:e.key})]},e.key)})})]}),Fe&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>jn(e=>!e),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,background:Kn?`${p}15`:"none",border:`1px solid ${Kn?p+"40":"rgba(128,128,128,0.2)"}`,borderRadius:4,cursor:"pointer",padding:"4px 6px",color:Kn?p:"inherit",flexShrink:0,fontSize:"inherit"},title:"Advanced filter builder",children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{children:"Filters"})]}),_e&&!Zt&&Je.length>0&&jsxRuntime.jsxs("div",{ref:$n,style:{position:"relative",flexShrink:0},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>zn(e=>!e),style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"4px 6px",color:"inherit",fontSize:"inherit"},title:"Saved AI filters",children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{children:Je.length})]}),On&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:99999,minWidth:240,maxWidth:360,maxHeight:320,overflowY:"auto",borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,padding:"4px 0",marginTop:4},children:[jsxRuntime.jsx("div",{style:{padding:"6px 12px",fontSize:"0.85em",opacity:.5,fontWeight:600},children:"Saved Filters"}),Je.map((e,t)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",cursor:"pointer",fontSize:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{style:{flex:"1 1 0%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>zo(e),children:e.label}),jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),Oo(t);},style:{display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},title:"Remove",children:x?.close??jsxRuntime.jsx(Ve,{style:{width:10,height:10}})})]},t))]})]}),_e&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>ko(true),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,background:`linear-gradient(135deg, ${p}18, ${p}08)`,border:`1px solid ${p}40`,borderRadius:4,cursor:"pointer",padding:"4px 8px",color:p,fontSize:"inherit",fontWeight:500,flexShrink:0,transition:"all 0.2s ease"},title:"Ask AI",children:[x?.sparkles??jsxRuntime.jsx(er,{style:{width:14,height:14}}),jsxRuntime.jsx("span",{children:kn??"Ask AI"})]}),_e&&(oe||ut)&&jsxRuntime.jsxs("button",{type:"button",onClick:Yi,disabled:En,style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:En?"wait":"pointer",padding:"4px 8px",color:"inherit",fontSize:"inherit",flexShrink:0,opacity:En?.6:1},title:"AI Data Insights",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M2 20h.01"}),jsxRuntime.jsx("path",{d:"M7 20v-4"}),jsxRuntime.jsx("path",{d:"M12 20v-8"}),jsxRuntime.jsx("path",{d:"M17 20V8"}),jsxRuntime.jsx("path",{d:"M22 4v16"})]}),jsxRuntime.jsx("span",{children:En?"Analyzing...":"Insights"})]}),_e&&(oe||ot)&&jsxRuntime.jsxs("button",{type:"button",onClick:Ui,disabled:An,style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:An?"wait":"pointer",padding:"4px 8px",color:"inherit",fontSize:"inherit",flexShrink:0,opacity:An?.6:1},title:"AI Chart",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",x2:"18",y1:"20",y2:"10"}),jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"20",y2:"4"}),jsxRuntime.jsx("line",{x1:"6",x2:"6",y1:"20",y2:"14"})]}),jsxRuntime.jsx("span",{children:An?"Generating...":"Chart"})]}),ke]}),_e&&jsxRuntime.jsxs("div",{className:g.aiBar??"",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",gap:8,padding:"4px 8px",opacity:st?1:0,transform:st?"translateX(0)":"translateX(40px)",transition:"opacity 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.4,0,0.2,1)",pointerEvents:st?"auto":"none",zIndex:2,background:"inherit",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",...k.aiBar},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:p,flexShrink:0},children:x?.sparkles??jsxRuntime.jsx(er,{style:{width:16,height:16}})}),jsxRuntime.jsx("input",{ref:fr,type:"text",placeholder:Ne,value:ze,onChange:e=>{pr(e.target.value),$t(!!e.target.value.trim());},onKeyDown:e=>{e.key==="Enter"&&!zt&&(No(),$t(false)),e.key==="Escape"&&!Zt&&Do(),e.key==="Escape"&&$t(false);},onFocus:()=>{(ze.trim()||!ze)&&$t(true);},onBlur:()=>{setTimeout(()=>$t(false),150);},disabled:zt,style:{flex:"1 1 0%",border:"none",outline:"none",background:"transparent",font:"inherit",color:"inherit",padding:"4px 6px",minWidth:0,fontSize:"inherit"}}),Xi&&Ao.length>0&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:99999,borderRadius:6,border:"1px solid rgba(128,128,128,0.2)",boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,padding:"4px 0",marginTop:4,maxHeight:180,overflowY:"auto"},children:[jsxRuntime.jsx("div",{style:{padding:"4px 10px",fontSize:"0.75em",opacity:.5,fontWeight:600},children:"Suggestions"}),Ao.filter(e=>!ze.trim()||e.toLowerCase().includes(ze.toLowerCase())).slice(0,6).map((e,t)=>jsxRuntime.jsx("button",{type:"button",style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 10px",fontSize:"0.85em",color:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},onMouseDown:n=>{n.preventDefault(),pr(e),$t(false);},children:e},t))]}),Zt&&Je.length>0&&jsxRuntime.jsxs("div",{ref:$n,style:{position:"relative",flexShrink:0},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>zn(e=>!e),style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"4px 6px",color:"inherit",fontSize:"inherit"},title:"Saved AI filters",children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{children:Je.length})]}),On&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:99999,minWidth:240,maxWidth:360,maxHeight:320,overflowY:"auto",borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,padding:"4px 0",marginTop:4},children:[jsxRuntime.jsx("div",{style:{padding:"6px 12px",fontSize:"0.85em",opacity:.5,fontWeight:600},children:"Saved Filters"}),Je.map((e,t)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",cursor:"pointer",fontSize:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{style:{flex:"1 1 0%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>zo(e),children:e.label}),jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),Oo(t);},style:{display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},title:"Remove",children:x?.close??jsxRuntime.jsx(Ve,{style:{width:10,height:10}})})]},t))]})]}),jsxRuntime.jsx("button",{type:"button",onClick:No,disabled:zt||!ze.trim(),style:{display:"flex",alignItems:"center",justifyContent:"center",background:ze.trim()?p:"rgba(128,128,128,0.15)",border:"none",borderRadius:4,cursor:zt||!ze.trim()?"not-allowed":"pointer",padding:"4px 8px",color:ze.trim()?"#fff":"GrayText",transition:"all 0.2s ease",flexShrink:0,gap:4,fontSize:"inherit",opacity:zt?.7:1},title:"Send",children:zt?jsxRuntime.jsx(jsxRuntime.Fragment,{children:x?.loader??jsxRuntime.jsx(Ri,{style:{width:14,height:14,animation:"bt-spin 1s linear infinite"}})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:x?.send??jsxRuntime.jsx(Si,{style:{width:14,height:14}})})}),!Zt&&jsxRuntime.jsx("button",{type:"button",onClick:Do,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},title:"Close AI",children:x?.close??jsxRuntime.jsx(Ve,{style:{width:14,height:14}})})]})]}),Kn&&jsxRuntime.jsxs("div",{className:g.filterDrawer??"",style:{position:"absolute",top:0,right:0,bottom:0,width:340,maxWidth:"80%",zIndex:50,display:"flex",flexDirection:"column",background:gt?"rgba(20,20,20,0.75)":"rgba(255,255,255,0.8)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderLeft:"1px solid rgba(128,128,128,0.15)",boxShadow:"-4px 0 20px rgba(0,0,0,0.15)",animation:"bt-drawer-in 0.2s ease",color:"inherit",...k.filterDrawer},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",borderBottom:"1px solid rgba(128,128,128,0.15)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{style:{fontWeight:600},children:"Filter Builder"})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>jn(false),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"GrayText",padding:2},children:x?.close??jsxRuntime.jsx(Ve,{style:{width:14,height:14}})})]}),jsxRuntime.jsxs("div",{style:{padding:"10px 14px",borderBottom:"1px solid rgba(128,128,128,0.1)",flexShrink:0},children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:6},children:"Logic"}),jsxRuntime.jsx("div",{style:{display:"flex",gap:6},children:["and","or"].map(e=>jsxRuntime.jsx("button",{type:"button",onClick:()=>ha(e),style:{flex:1,padding:"5px 0",borderRadius:5,border:`1.5px solid ${Nr===e?p:"rgba(128,128,128,0.2)"}`,background:Nr===e?`${p}15`:"transparent",color:Nr===e?p:"inherit",cursor:"pointer",fontSize:"inherit",fontWeight:500},children:e==="and"?"Match ALL":"Match ANY"},e))})]}),jsxRuntime.jsxs("div",{style:{flex:"1 1 0%",overflowY:"auto",padding:"10px 14px",display:"flex",flexDirection:"column",gap:10},children:[Pt.map((e,t)=>jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:10,borderRadius:6,border:"1px solid rgba(128,128,128,0.15)",background:"rgba(128,128,128,0.04)",position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",top:4,right:4,display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("span",{style:{fontSize:"0.75em",color:"GrayText",fontWeight:500},children:["#",t+1]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ht(n=>n.length>1?n.filter(r=>r.id!==e.id):n),style:{background:"none",border:"none",cursor:Pt.length>1?"pointer":"not-allowed",color:Pt.length>1?"#ef4444":"GrayText",fontSize:"inherit",padding:"0 2px",lineHeight:1,opacity:Pt.length>1?1:.4},title:"Remove condition",children:"\xD7"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:3},children:"Column"}),jsxRuntime.jsxs("select",{value:e.column,onChange:n=>Ht(r=>r.map(l=>l.id===e.id?{...l,column:n.target.value}:l)),style:{width:"100%",fontSize:"inherit",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"5px 8px",background:"transparent",color:"inherit",outline:"none"},children:[jsxRuntime.jsx("option",{value:"",children:"Select column..."}),Z.filter(n=>!n.key.startsWith("__")).map(n=>jsxRuntime.jsx("option",{value:n.key,children:typeof n.title=="string"?n.title:n.key},n.key))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:3},children:"Operator"}),jsxRuntime.jsxs("select",{value:e.operator,onChange:n=>Ht(r=>r.map(l=>l.id===e.id?{...l,operator:n.target.value}:l)),style:{width:"100%",fontSize:"inherit",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"5px 8px",background:"transparent",color:"inherit",outline:"none"},children:[jsxRuntime.jsx("option",{value:"contains",children:"Contains"}),jsxRuntime.jsx("option",{value:"eq",children:"Equals"}),jsxRuntime.jsx("option",{value:"neq",children:"Not equals"}),jsxRuntime.jsx("option",{value:"gt",children:"Greater than"}),jsxRuntime.jsx("option",{value:"gte",children:"Greater or equal"}),jsxRuntime.jsx("option",{value:"lt",children:"Less than"}),jsxRuntime.jsx("option",{value:"lte",children:"Less or equal"}),jsxRuntime.jsx("option",{value:"startsWith",children:"Starts with"}),jsxRuntime.jsx("option",{value:"endsWith",children:"Ends with"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:3},children:"Value"}),jsxRuntime.jsx("input",{type:"text",value:e.value,placeholder:"Enter value...",onChange:n=>Ht(r=>r.map(l=>l.id===e.id?{...l,value:n.target.value}:l)),style:{width:"100%",fontSize:"inherit",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"5px 8px",outline:"none",background:"transparent",color:"inherit",boxSizing:"border-box"},onFocus:n=>{n.currentTarget.style.borderColor=p;},onBlur:n=>{n.currentTarget.style.borderColor="rgba(128,128,128,0.2)";}})]})]},e.id)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{Ht(e=>[...e,{id:ni.current++,column:"",operator:"contains",value:""}]);},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,background:"none",border:"1px dashed rgba(128,128,128,0.25)",borderRadius:6,cursor:"pointer",color:p,fontSize:"inherit",padding:"8px 0",fontWeight:500},children:"+ Add condition"})]}),jsxRuntime.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(128,128,128,0.15)",display:"flex",gap:8,flexShrink:0},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{Or({}),xe?.({}),Ht([{id:ni.current++,column:"",operator:"contains",value:""}]);},style:{flex:1,fontSize:"inherit",background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"6px 0",cursor:"pointer",color:"inherit",fontWeight:500},children:"Clear All"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{ma(),jn(false);},style:{flex:1,fontSize:"inherit",background:p,border:"none",borderRadius:5,padding:"6px 0",cursor:"pointer",color:"#fff",fontWeight:600},children:"Apply Filters"})]})]}),_o&&jsxRuntime.jsxs("div",{style:{borderBottom:"1px solid rgba(128,128,128,0.2)",padding:"10px 12px",fontSize:"inherit",lineHeight:1.6,background:`linear-gradient(90deg, ${p}06, transparent)`,flexShrink:0,maxHeight:200,overflowY:"auto",position:"relative",whiteSpace:"pre-wrap"},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Tn(null),style:{position:"absolute",top:6,right:6,background:"none",border:"none",cursor:"pointer",color:"GrayText",padding:2,display:"flex"},children:x?.close??jsxRuntime.jsx(Ve,{style:{width:12,height:12}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:6,fontWeight:600,fontSize:"0.85em",color:p},children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M2 20h.01"}),jsxRuntime.jsx("path",{d:"M7 20v-4"}),jsxRuntime.jsx("path",{d:"M12 20v-8"}),jsxRuntime.jsx("path",{d:"M17 20V8"}),jsxRuntime.jsx("path",{d:"M22 4v16"})]}),"AI Insights"]}),_o]}),To&&jsxRuntime.jsxs("div",{style:{borderBottom:"1px solid rgba(128,128,128,0.2)",flexShrink:0,position:"relative"},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Nt(null),style:{position:"absolute",top:6,right:6,background:"none",border:"none",cursor:"pointer",color:"GrayText",padding:2,display:"flex",zIndex:1},children:x?.close??jsxRuntime.jsx(Ve,{style:{width:12,height:12}})}),To]}),ht&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",fontSize:"inherit",borderBottom:"1px solid rgba(128,128,128,0.2)",background:`linear-gradient(90deg, ${p}08, transparent)`,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{color:p,display:"flex",flexShrink:0},children:x?.sparkles??jsxRuntime.jsx(er,{style:{width:14,height:14}})}),jsxRuntime.jsx("span",{style:{flex:"1 1 0%",opacity:.85},children:ht.message}),jsxRuntime.jsxs("button",{type:"button",onClick:Ji,disabled:mt,style:{display:"flex",alignItems:"center",gap:4,background:mt?`${p}25`:`${p}12`,border:`1px solid ${mt?p:`${p}30`}`,borderRadius:4,cursor:mt?"default":"pointer",padding:"2px 8px",color:p,fontSize:"0.85em",flexShrink:0,fontWeight:500,transition:"all 0.2s ease"},title:mt?"Filter saved!":"Save this filter for quick access later",children:[mt?jsxRuntime.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}):jsxRuntime.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),jsxRuntime.jsx("polyline",{points:"17 21 17 13 7 13 7 21"}),jsxRuntime.jsx("polyline",{points:"7 3 7 8 15 8"})]}),jsxRuntime.jsx("span",{children:mt?"Saved":"Save Filter"})]}),jsxRuntime.jsxs("button",{type:"button",onClick:vr,style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"2px 8px",color:"inherit",fontSize:"0.85em",flexShrink:0,opacity:.7},title:"Clear AI results",children:[x?.close??jsxRuntime.jsx(Ve,{style:{width:10,height:10}}),jsxRuntime.jsx("span",{children:"Clear"})]})]}),Ro&&!ht&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",fontSize:"inherit",borderBottom:"1px solid rgba(239,68,68,0.2)",background:"rgba(239,68,68,0.06)",color:"#ef4444",flexShrink:0},children:[jsxRuntime.jsx("span",{style:{flex:"1 1 0%"},children:Ro}),jsxRuntime.jsx("button",{type:"button",onClick:()=>In(null),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"#ef4444",flexShrink:0},children:x?.close??jsxRuntime.jsx(Ve,{style:{width:12,height:12}})})]}),jsxRuntime.jsx("div",{style:{position:"relative",...ve?{height:`${ui}px`,maxHeight:`${ui}px`,flexShrink:1,flexGrow:0}:{flex:"1 1 0%"}},children:Be?jsxRuntime.jsx("div",{"data-bt-scroll":"",style:{position:"absolute",inset:0,overflow:"auto",contain:"layout paint"},children:jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:Hn,gridTemplateRows:"36px auto",minWidth:`${Mr}px`,width:"100%",position:"relative"},children:[Z.map(e=>{let t=!!e.pinned,n=kt.get(e.key),r=e.key==="__select__"||e.key==="__expand__"||e.key==="__drag__";return jsxRuntime.jsx("div",{className:t?g.pinnedHeader??"":g.header??"",style:{display:"flex",height:36,alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderBottom:"1px solid rgba(128,128,128,0.2)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",position:"sticky",top:0,zIndex:t?13:10,paddingLeft:r?0:8,paddingRight:r?0:8,...t?{[e.pinned]:n??0,...k.pinnedHeader}:k.header}},e.key)}),jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1"},children:Array.from({length:Kr}).map((e,t)=>jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:Hn,height:c},children:Z.map((n,r)=>{let l=!!n.pinned,d=kt.get(n.key),i=n.key==="__select__"||n.key==="__expand__"||n.key==="__drag__",u=Pi[(t*7+r)%Pi.length];return jsxRuntime.jsx("div",{className:l?g.pinnedCell??"":"",style:{display:"flex",alignItems:"center",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:i?0:8,paddingRight:i?0:8,justifyContent:i?"center":void 0,...l?{position:"sticky",[n.pinned]:d??0,zIndex:5,...k.pinnedCell}:{}},children:jsxRuntime.jsx("div",{style:{backgroundColor:"rgba(100, 116, 139, 0.15)",animation:"bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:i?3:4,height:i?16:14,width:i?16:`${u}%`,animationDelay:`${(t*7+r)*50}ms`}})},n.key)})},t))})]})}):jsxRuntime.jsxs("div",{ref:ta,tabIndex:0,"data-bt-scroll":"",style:{position:"absolute",inset:0,overflow:"auto",contain:"layout paint",outline:"none"},onKeyDown:e=>{let t=lt.length-1,n=Z.length-1;if(t<0||n<0)return;let r=(l,d)=>{e.preventDefault(),yt(i=>{let u=Math.max(0,Math.min(t,(i?.row??0)+l)),y=Math.max(0,Math.min(n,(i?.col??0)+d));return {row:u,col:y}});};switch(e.key){case "ArrowDown":r(1,0);break;case "ArrowUp":r(-1,0);break;case "ArrowRight":r(0,1);break;case "ArrowLeft":r(0,-1);break;case "Home":e.preventDefault(),yt(l=>({row:l?.row??0,col:(e.ctrlKey,0)}));break;case "End":e.preventDefault(),yt(l=>({row:l?.row??0,col:n}));break;case "Tab":if(Ut){e.preventDefault();let l=e.shiftKey?-1:1;yt(d=>{if(!d)return {row:0,col:0};let i=d.col+l,u=d.row;return i>n?(i=0,u=Math.min(u+1,t)):i<0&&(i=n,u=Math.max(u-1,0)),{row:u,col:i}});}break;case "Escape":yt(null);break}},onFocus:()=>{Ut||yt({row:0,col:0});},onBlur:()=>yt(null),children:[jsxRuntime.jsx(co,{ref:Dn,accentColor:p}),jsxRuntime.jsxs("div",{role:"grid","aria-rowcount":V.length,"aria-colcount":Z.length,style:{display:"grid",gridTemplateColumns:Hn,gridTemplateRows:Qn?Ue?"36px 36px 1fr":"36px 1fr":Ue?`36px 36px ${Zr}px`:`36px ${Zr}px`,minWidth:`${Mr}px`,width:"100%",position:"relative",...Qn?{height:"100%"}:{}},onContextMenu:e=>{let t=e.target.closest("[data-bt-cell]");if(!t)return;let n=t.dataset.rowKey,r=t.dataset.columnKey;if(!n||!r)return;let l=Bt.find(m=>m.key===r),d=!!l?.copy,i=!!ue,u=l?.columnCellContextMenuItems&&l.columnCellContextMenuItems.length>0,y=!!l?.editable&&!l?.render&&!!Ke;!d&&!i&&!u&&!y||(e.preventDefault(),tt({x:Math.min(e.clientX,window.innerWidth-200),y:Math.min(e.clientY,window.innerHeight-200),rowKey:n,columnKey:r}));},onTouchStart:e=>{Vn();let t=e.target.closest("[data-bt-cell]");if(!t)return;let n=e.touches[0];pn.current={x:n.clientX,y:n.clientY};let r=t.dataset.rowKey,l=t.dataset.columnKey;un.current=setTimeout(()=>{if(un.current=null,!r||!l)return;let d=Bt.find(I=>I.key===l),i=!!d?.copy,u=!!ue,y=d?.columnCellContextMenuItems&&d.columnCellContextMenuItems.length>0,m=!!d?.editable&&!d?.render&&!!Ke;!i&&!u&&!y&&!m||tt({x:Math.min(n.clientX,window.innerWidth-200),y:Math.min(n.clientY,window.innerHeight-200),rowKey:r,columnKey:l});},500);},onTouchMove:e=>{if(!pn.current)return;let t=e.touches[0],n=t.clientX-pn.current.x,r=t.clientY-pn.current.y;(Math.abs(n)>10||Math.abs(r)>10)&&Vn();},onTouchEnd:Vn,onTouchCancel:Vn,onClick:Le||fe?e=>{let t=e.target;if(t.closest("input, button, a, select, textarea"))return;let n=t.closest("[data-bt-cell]");if(!n)return;let r=n.dataset.rowKey;if(!r)return;let l=(d,i)=>{Le?.(d,i,e),fe&&ar(d);};for(let d=0;d<Ge.length;d++){let i=Ge[d];if(i!=null&&je(i,d)===r){l(i,d);return}}for(let d=0;d<Rt.length;d++)if(Rt[d]!=null&&je(Rt[d],d)===r){l(Rt[d],d);return}for(let d=0;d<wt.length;d++)if(wt[d]!=null&&je(wt[d],d)===r){l(wt[d],d);return}}:void 0,children:[Ue&&Ot.map(e=>{let t=1/0,n=-1;if(Z.forEach((l,d)=>{e.childKeys.includes(l.key)&&(t=Math.min(t,d),n=Math.max(n,d));}),t===1/0)return null;let r=n===Z.length-1;return jsxRuntime.jsx("div",{"data-bt-header":"",className:`${e.className??""} ${g.header??""}`,style:{gridColumn:`${t+1} / ${n+2}`,gridRow:1,position:"sticky",top:0,zIndex:10,display:"flex",height:36,alignItems:"center",justifyContent:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",fontWeight:500,userSelect:"none",borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:r?"none":"1px solid rgba(128,128,128,0.2)",...e.style,...k.header},children:e.title},`group-${e.key}`)}),(()=>{let e=Z.findIndex(t=>t.key!=="__select__"&&t.key!=="__expand__"&&t.key!=="__drag__");return Z.map((t,n)=>{let r=ji?.has(t.key)??false,l=Ue?r?2:"1 / 3":1,d=Ue&&!r?72:36,i=Ue&&r?36:0;return t.key==="__select__"&&B?jsxRuntime.jsx("div",{"data-bt-header":"","data-bt-pinned":"",className:`${g.header??""} ${g.pinnedHeader??""}`,style:{display:"flex",height:d,alignItems:"center",justifyContent:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",position:"sticky",left:kt.get("__select__")??0,top:0,zIndex:13,width:"48px",gridRow:l,borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:"1px solid rgba(128,128,128,0.2)",...k.header,...k.pinnedHeader},children:B.type!=="radio"&&!B.hideSelectAll&&jsxRuntime.jsx("input",{"data-bt-check":"",type:"checkbox",checked:Ct>0&&Nn.length===Ct,ref:u=>{u&&(u.indeterminate=Nn.length>0&&Nn.length<Ct);},onChange:u=>{if(u.target.checked){let y=V.map((m,I)=>Wo(m,I));B.onSelectAll?.(true,V,V),B.onChange?.(y,V,{type:"all"});}else B.onSelectAll?.(false,[],V),B.onChange?.([],[],{type:"all"});}})},"__select__"):t.key==="__drag__"?jsxRuntime.jsx("div",{"data-bt-header":"","data-bt-pinned":"",className:`${g.header??""} ${g.pinnedHeader??""}`,style:{display:"flex",height:d,alignItems:"center",justifyContent:"center",overflow:"hidden",whiteSpace:"nowrap",boxSizing:"border-box",position:"sticky",left:kt.get("__drag__")??0,top:0,zIndex:13,width:"36px",gridRow:l,borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:"1px solid rgba(128,128,128,0.2)",...k.header,...k.pinnedHeader},children:jsxRuntime.jsx(bn,{style:{width:12,height:12,opacity:.4}})},"__drag__"):t.key==="__expand__"?jsxRuntime.jsx("div",{"data-bt-header":"","data-bt-pinned":"",className:`${g.header??""} ${g.pinnedHeader??""}`,style:{display:"flex",height:d,alignItems:"center",justifyContent:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",position:"sticky",left:kt.get("__expand__")??0,top:0,zIndex:13,width:"40px",backgroundColor:k.pinnedBg,gridRow:l,borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:"1px solid rgba(128,128,128,0.2)",...k.header,...k.pinnedHeader}},"__expand__"):jsxRuntime.jsx(ro,{column:t,accentColor:p,visualIndex:n,onResizeStart:oa,onColumnDragStart:na,styles:k,classNames:g,gripIcon:K,hideGripIcon:X,icons:x,stickyOffset:kt.get(t.key),onTogglePin:sa,onToggleHide:Qo,isLastColumn:n===Z.length-1,isFirstColumn:n===e,sortDirection:Qe.find(u=>u.key===t.key)?.direction??null,sortPriority:Ee&&Qe.length>1&&Qe.findIndex(u=>u.key===t.key)+1||void 0,onSort:ua,filterValue:Ze[t.key]??"",onFilter:Dr,onClearFilter:ba,customContextMenuItems:t.columnHeaderContextMenuItems?[...ge??[],...t.columnHeaderContextMenuItems]:ge,disabledFilters:Ye,headerGridRow:l,headerHeight:d,stickyTop:i,onAutoFitColumn:ia,isDark:gt},t.key)})})(),Qn?jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",height:"100%",position:"relative"},children:jsxRuntime.jsx("div",{style:{position:"sticky",left:0,width:_r>0?`${_r}px`:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:nt??jsxRuntime.jsx("div",{className:g.emptyState??"",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,paddingTop:32,paddingBottom:32,color:"GrayText",...k.emptyState},children:jsxRuntime.jsx("span",{style:{fontSize:"inherit"},children:"No data"})})})}):jsxRuntime.jsx(po,{data:Ge,orderedColumns:Va,rowVirtualizer:Kt,columnOffsets:kt,styles:k,classNames:g,rowSelection:Tt?void 0:B,normalizedSelectedKeys:Nn,getRowKey:je,getRawRowKey:Wo,expandable:Tt?void 0:be,resolvedExpandedKeys:rn,rowHeight:c,totalTableWidth:Mr,scrollAreaWidth:_r,accentColor:p,scrollContainerRef:me,isLoading:Tt,onExpandedRowResize:Ka,maxExpandedRowHeight:R,pinnedTopData:Rt,pinnedBottomData:wt,gridTemplateColumns:Hn,headerHeight:Zn,rowClassName:dt.length>0?(e,t)=>{let n=We?We(e,t):"",r=Ia(e);return [n,r].filter(Boolean).join(" ")||""}:We,rowStyle:Mn.length>0||dt.length>0?(e,t)=>{let n=Xe?Xe(e,t):void 0,r=wa(e),l=_a(e);return !n&&!r&&!l?{}:{...n,...l,...r}}:Xe,bodyGridRow:Ue?3:2,onEdit:Ke,editingCell:Oa,onEditComplete:za,enableDynamicRowHeight:rt,onRowHeightChange:Wa,columnGridIndexMap:aa,cellStyleFn:Ln.length>0||Gn.length>0?(e,t)=>{let n=Ca(e,t),r=Ta(e,t);if(!(!n&&!r))return {...r,...n}}:void 0,onRowDragStart:it&&Ie?ra:void 0,focusedCell:Ut,enableRowAnimation:Lt,onGroupToggle:Y?ka:void 0,groupAccentColor:p,onTreeToggle:ee?Ra:void 0,treeIndentSize:ee?.indentSize??20})]})]})}),fe&&mo&&jsxRuntime.jsxs("div",{className:g.masterDetailPanel??"",style:{borderTop:`2px solid ${p}`,padding:12,flexShrink:0,maxHeight:"40%",overflow:"auto",position:"relative",...k.masterDetailPanel},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>ar(null),style:{position:"absolute",top:8,right:8,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"2px 4px",color:"GrayText",fontSize:"0.85em"},title:"Close detail",children:x?.close??jsxRuntime.jsx(Ve,{style:{width:12,height:12}})}),fe(mo,()=>ar(null))]}),_t&&jsxRuntime.jsxs("div",{className:g.pagination??"",style:{display:"flex",height:36,minHeight:36,maxHeight:36,boxSizing:"border-box",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(128,128,128,0.2)",paddingLeft:12,paddingRight:12,fontSize:"inherit",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",backgroundColor:"rgba(128,128,128,0.06)",gap:12,flexShrink:0,...k.pagination},children:[jsxRuntime.jsx("div",{style:{display:"flex",flex:"1 1 0%",alignItems:"center"},children:(()=>{let e=jt>0?(de-1)*hn+1:0,t=Math.min(de*hn,jt);return typeof T=="object"&&T?.showTotal?jsxRuntime.jsxs("span",{className:g.paginationInfo??"",style:{color:"GrayText",fontSize:"inherit",...k.paginationInfo},children:["Showing"," ",T.showTotal(jt,[e,t])," of"," ",jt," items"]}):jsxRuntime.jsxs("span",{className:g.paginationInfo??"",style:{color:"GrayText",fontSize:"inherit",...k.paginationInfo},children:[e,"\u2013",t," of ",jt]})})()}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",alignItems:"center",justifyContent:"center",gap:4},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>mn(1),disabled:de===1,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:de===1?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:de===1?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"First page",children:x?.chevronsLeft??jsxRuntime.jsx(fi,{style:{width:12,height:12}})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>mn(de-1),disabled:de===1,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:de===1?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:de===1?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"Previous page",children:x?.chevronLeft??jsxRuntime.jsx(gi,{style:{width:12,height:12}})}),Ya().map(e=>{if(e==="ellipsis-left"||e==="ellipsis-right")return jsxRuntime.jsx("span",{style:{color:"GrayText",paddingLeft:4,paddingRight:4,fontSize:"inherit",userSelect:"none"},children:"..."},e);let t=e===de;return jsxRuntime.jsx("button",{type:"button",className:`${g.paginationButton??""} ${t?g.paginationActiveButton??"":""}`.trim()||void 0,style:{display:"inline-flex",height:24,minWidth:24,cursor:"pointer",alignItems:"center",justifyContent:"center",borderRadius:4,paddingLeft:6,paddingRight:6,fontSize:"inherit",color:t?p:"inherit",fontWeight:t?600:"inherit",background:"none",border:"none",...k.paginationButton,...t?k.paginationActiveButton:void 0},onClick:()=>mn(e),children:e},e)}),jsxRuntime.jsx("button",{type:"button",onClick:()=>mn(de+1),disabled:de===ye,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:de===ye?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:de===ye?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"Next page",children:x?.chevronRight??jsxRuntime.jsx(Qr,{style:{width:12,height:12}})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>mn(ye),disabled:de===ye,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:de===ye?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:de===ye?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"Last page",children:x?.chevronsRight??jsxRuntime.jsx(yi,{style:{width:12,height:12}})})]}),jsxRuntime.jsx("div",{style:{display:"flex",flex:"1 1 0%",alignItems:"center",justifyContent:"flex-end",gap:8},children:typeof T=="object"&&T?.hidePageSelector?null:jsxRuntime.jsx("select",{value:hn,onChange:e=>Xa(Number(e.target.value)),className:g.paginationSelect??"",style:{cursor:"pointer",borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",paddingLeft:6,paddingRight:6,paddingTop:2,paddingBottom:2,fontSize:"inherit",height:24,background:"inherit",color:"inherit",...k.paginationSelect},children:(typeof T=="object"&&T?.pageSizeOptions?T.pageSizeOptions:[10,15,20,25,50,100]).map(e=>jsxRuntime.jsxs("option",{value:e,children:[e," / page"]},e))})})]}),Sn&&jsxRuntime.jsx("div",{className:g.statusBar??"",style:{display:"flex",alignItems:"center",gap:12,padding:"4px 12px",borderTop:"1px solid rgba(128,128,128,0.2)",fontSize:"0.85em",color:"GrayText",flexShrink:0,minHeight:24,...k.statusBar},children:pt?pt({totalRows:V.length,filteredRows:lt.length,selectedRows:B?.selectedRowKeys?.length??0,currentPage:gn,pageSize:It}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:lt.length===V.length?`${V.length} rows`:`${lt.length} of ${V.length} rows`}),B&&B.selectedRowKeys.length>0&&jsxRuntime.jsxs("span",{style:{color:p,fontWeight:500},children:[B.selectedRowKeys.length," selected"]}),Object.keys(Ze).length>0&&jsxRuntime.jsxs("span",{children:[Object.keys(Ze).length," filter",Object.keys(Ze).length>1?"s":""," active"]}),Qe.length>0&&jsxRuntime.jsxs("span",{children:["Sorted by ",Qe.length," column",Qe.length>1?"s":""]})]})})]}),ir&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:qo,className:`${g.header??""} ${g.dragHeader??""}`,style:{display:"none",position:"fixed",zIndex:99999,height:36,fontSize:"inherit",color:ie.color,alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:6,border:"1px dashed rgba(128,128,128,0.2)",boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,cursor:"grabbing",pointerEvents:"none",...k.header,...k.dragHeader},children:jsxRuntime.jsxs("div",{style:{display:"flex",height:"100%",flex:"1 1 0%",alignItems:"center",gap:4,overflow:"hidden",paddingLeft:8,paddingRight:8,fontWeight:500},children:[x?.gripVertical??K??jsxRuntime.jsx(bn,{style:{width:12,height:12,flexShrink:0}}),jsxRuntime.jsx("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left",userSelect:"none"},children:Jn?typeof Jn.title=="string"?Jn.title:Jn.key:""})]})}),document.body),ir&&it&&Ie&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:Yo,style:{display:"none",position:"fixed",zIndex:99999,height:32,fontSize:"0.85em",alignItems:"center",justifyContent:"center",padding:"0 12px",borderRadius:6,border:`1px dashed ${p}60`,boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,cursor:"grabbing",pointerEvents:"none",fontWeight:500,color:p}}),document.body),De&&ir&&(()=>{let e=Bt.find(f=>f.key===De.columnKey),t=Ma.has(De.rowKey),n=La.has(De.rowKey),r=!!e?.copy,l=!!ue,d=!!e?.editable&&!e?.render&&!!Ke,i,u=0,y=[...Rt,...Ge,...wt];for(let f=0;f<y.length;f++){if(y[f]==null)continue;if(je(y[f],f)===De.rowKey){i=y[f],u=f;break}}let m=i&&e?.dataIndex!=null?i[e.dataIndex]:void 0,I={display:"flex",width:"100%",alignItems:"center",gap:8,background:"none",border:"none",padding:"6px 12px",fontSize:"inherit",cursor:"pointer",color:"inherit",whiteSpace:"nowrap",...k.contextMenuItem};return reactDom.createPortal(jsxRuntime.jsxs("div",{ref:Hr,style:{position:"fixed",top:De.y,left:De.x,zIndex:99999,minWidth:170,borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:ie.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:ie.menuBg,color:ie.color,padding:"4px 0",fontSize:"0.75em"},children:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:I,onClick:()=>{ei(De.rowKey,t?false:"top"),tt(null);},children:[t?x?.pinOff??jsxRuntime.jsx(Mt,{style:{width:14,height:14,flexShrink:0}}):x?.pin??jsxRuntime.jsx(Gt,{style:{width:14,height:14,flexShrink:0}}),t?"Unpin Row from Top":"Pin Row to Top"]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:I,onClick:()=>{ei(De.rowKey,n?false:"bottom"),tt(null);},children:[n?x?.pinOff??jsxRuntime.jsx(Mt,{style:{width:14,height:14,flexShrink:0}}):x?.pin??jsxRuntime.jsx(Gt,{style:{width:14,height:14,flexShrink:0,transform:"rotate(180deg)"}}),n?"Unpin Row from Bottom":"Pin Row to Bottom"]})]}),l&&(r||d)&&jsxRuntime.jsx("div",{style:{borderTop:"1px solid rgba(128,128,128,0.2)",margin:"4px 0"}}),d&&jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:I,onClick:()=>{si({rowKey:De.rowKey,columnKey:De.columnKey}),tt(null);},children:[x?.edit??jsxRuntime.jsx(bi,{style:{width:14,height:14,flexShrink:0}}),"Edit"]}),(d||l)&&r&&jsxRuntime.jsx("div",{style:{borderTop:"1px solid rgba(128,128,128,0.2)",margin:"4px 0"}}),r&&i&&e&&jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:I,onClick:()=>{let f=typeof e.copy=="function"?e.copy(m,i,u):String(m??"");navigator.clipboard?.writeText(f),$e?.(f,e.key,i,u),tt(null);},children:[x?.copy??jsxRuntime.jsx(mi,{style:{width:14,height:14,flexShrink:0}}),"Copy"]}),e?.columnCellContextMenuItems&&e.columnCellContextMenuItems.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(r||l||d)&&jsxRuntime.jsx("div",{style:{borderTop:"1px solid rgba(128,128,128,0.2)",margin:"4px 0"}}),e.columnCellContextMenuItems.map(f=>{let _=typeof f.icon=="function"?i?f.icon(e.key,i,u):null:f.icon,A=typeof f.label=="function"?i?f.label(e.key,i,u):null:f.label;return jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",disabled:f.disabled,style:{...I,cursor:f.disabled?"not-allowed":"pointer",opacity:f.disabled?.5:1,color:f.danger?"#ef4444":"inherit"},onClick:()=>{i&&f.onClick&&f.onClick(e.key,i,u),tt(null);},children:[_&&jsxRuntime.jsx("span",{style:{display:"flex",width:14,height:14,alignItems:"center",justifyContent:"center",flexShrink:0},children:_}),A]},f.key)})]})]}),document.body)})()]})}function bs(o){return o}exports.BoltTable=Ki;exports.DraggableHeader=ro;exports.ResizeOverlay=co;exports.TableBody=po;exports.defineConfig=bs;
172
+ `}),(!A||H||se)&&jsxRuntime.jsxs("div",{className:g.toolbar??"",style:{position:"relative",display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderBottom:"1px solid rgba(128,128,128,0.2)",fontSize:"inherit",flexShrink:0,zIndex:20,...k.toolbar},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:"1 1 0%",opacity:ot?0:1,transform:ot?"scale(0.97)":"scale(1)",transition:"opacity 0.25s ease, transform 0.25s ease",pointerEvents:ot?"none":"auto",minWidth:0},children:[!A&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flex:"1 1 0%",position:"relative"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"GrayText",flexShrink:0},children:x?.search??jsxRuntime.jsx(vi,{style:{width:14,height:14}})}),jsxRuntime.jsx("input",{ref:fa,type:"text",placeholder:"Search all columns...",value:R??Dt,onChange:e=>{let t=e.target.value;z?z(t):zr(t);},onFocus:()=>{Or.length>0&&Kn(true);},onBlur:()=>{setTimeout(()=>Kn(false),150);},onKeyDown:e=>{e.key==="Enter"&&(ya((R??Dt)||""),Kn(false));},className:g.searchInput??"",style:{flex:"1 1 0%",border:"none",outline:"none",background:"transparent",font:"inherit",color:"inherit",padding:"4px 6px",minWidth:0,...k.searchInput}}),ga&&Or.length>0&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:99999,borderRadius:6,border:"1px solid rgba(128,128,128,0.2)",boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,padding:"4px 0",marginTop:2,maxHeight:200,overflowY:"auto"},children:[jsxRuntime.jsx("div",{style:{padding:"4px 10px",fontSize:"0.75em",opacity:.5,fontWeight:600},children:"Recent"}),Or.map((e,t)=>jsxRuntime.jsx("button",{type:"button",style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 10px",fontSize:"inherit",color:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},onMouseDown:n=>{n.preventDefault(),z?z(e):zr(e),Kn(false);},children:e},t))]}),(R??Dt)&&jsxRuntime.jsx("button",{type:"button",onClick:()=>{z?z(""):zr("");},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},children:x?.close??jsxRuntime.jsx(Ge,{style:{width:12,height:12}})})]}),Z,H&&jsxRuntime.jsxs("div",{style:{position:"relative",flexShrink:0},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ur(e=>!e),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"4px 6px",color:"inherit",gap:4,fontSize:"inherit"},title:"Column settings",children:[x?.columns??jsxRuntime.jsx(ki,{style:{width:14,height:14}}),jsxRuntime.jsx("span",{children:Pe??"Columns"})]}),cr&&jsxRuntime.jsx("div",{ref:pr,style:{position:"absolute",top:"100%",right:0,zIndex:99999,minWidth:200,maxHeight:320,overflowY:"auto",borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,padding:"4px 0",marginTop:4},children:le.filter(e=>e.key!=="__select__"&&e.key!=="__expand__"&&e.key!=="__drag__").map(e=>{let t=ct.find(l=>l.key===e.key),n=t?.hidden??false,r=!!t?.pinned;return jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,fontSize:"inherit"},children:[jsxRuntime.jsx("input",{type:"checkbox",checked:!n,disabled:r,onChange:()=>{r||Qo(e.key);},style:{cursor:r?"not-allowed":"pointer",accentColor:p}}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:typeof e.title=="string"?e.title:e.key})]},e.key)})})]}),Xe&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>Gn(e=>!e),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,background:jn?`${p}15`:"none",border:`1px solid ${jn?p+"40":"rgba(128,128,128,0.2)"}`,borderRadius:4,cursor:"pointer",padding:"4px 6px",color:jn?p:"inherit",flexShrink:0,fontSize:"inherit"},title:"Advanced filter builder",children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{children:"Filters"})]}),se&&!Jt&&Je.length>0&&jsxRuntime.jsxs("div",{ref:$n,style:{position:"relative",flexShrink:0},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>On(e=>!e),style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"4px 6px",color:"inherit",fontSize:"inherit"},title:"Saved AI filters",children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{children:Je.length})]}),zn&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:99999,minWidth:240,maxWidth:360,maxHeight:320,overflowY:"auto",borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,padding:"4px 0",marginTop:4},children:[jsxRuntime.jsx("div",{style:{padding:"6px 12px",fontSize:"0.85em",opacity:.5,fontWeight:600},children:"Saved Filters"}),Je.map((e,t)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",cursor:"pointer",fontSize:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{style:{flex:"1 1 0%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>zo(e),children:e.label}),jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),No(t);},style:{display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},title:"Remove",children:x?.close??jsxRuntime.jsx(Ge,{style:{width:10,height:10}})})]},t))]})]}),se&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>ko(true),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,background:`linear-gradient(135deg, ${p}18, ${p}08)`,border:`1px solid ${p}40`,borderRadius:4,cursor:"pointer",padding:"4px 8px",color:p,fontSize:"inherit",fontWeight:500,flexShrink:0,transition:"all 0.2s ease"},title:"Ask AI",children:[x?.sparkles??jsxRuntime.jsx(nr,{style:{width:14,height:14}}),jsxRuntime.jsx("span",{children:kn??"Ask AI"})]}),se&&(de||lt)&&jsxRuntime.jsxs("button",{type:"button",onClick:Yi,disabled:An,style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:An?"wait":"pointer",padding:"4px 8px",color:"inherit",fontSize:"inherit",flexShrink:0,opacity:An?.6:1},title:"AI Data Insights",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M2 20h.01"}),jsxRuntime.jsx("path",{d:"M7 20v-4"}),jsxRuntime.jsx("path",{d:"M12 20v-8"}),jsxRuntime.jsx("path",{d:"M17 20V8"}),jsxRuntime.jsx("path",{d:"M22 4v16"})]}),jsxRuntime.jsx("span",{children:An?"Analyzing...":"Insights"})]}),se&&(de||dt)&&jsxRuntime.jsxs("button",{type:"button",onClick:Ui,disabled:Mn,style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:Mn?"wait":"pointer",padding:"4px 8px",color:"inherit",fontSize:"inherit",flexShrink:0,opacity:Mn?.6:1},title:"AI Chart",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",x2:"18",y1:"20",y2:"10"}),jsxRuntime.jsx("line",{x1:"12",x2:"12",y1:"20",y2:"4"}),jsxRuntime.jsx("line",{x1:"6",x2:"6",y1:"20",y2:"14"})]}),jsxRuntime.jsx("span",{children:Mn?"Generating...":"Chart"})]}),q]}),se&&jsxRuntime.jsxs("div",{className:g.aiBar??"",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",gap:8,padding:"4px 8px",opacity:ot?1:0,transform:ot?"translateX(0)":"translateX(40px)",transition:"opacity 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.4,0,0.2,1)",pointerEvents:ot?"auto":"none",zIndex:2,background:"inherit",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",...k.aiBar},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:p,flexShrink:0},children:x?.sparkles??jsxRuntime.jsx(nr,{style:{width:16,height:16}})}),jsxRuntime.jsx("input",{ref:yr,type:"text",placeholder:vn,value:Le,onChange:e=>{gr(e.target.value),zt(!!e.target.value.trim());},onKeyDown:e=>{e.key==="Enter"&&!Nt&&($o(),zt(false)),e.key==="Escape"&&!Jt&&Bo(),e.key==="Escape"&&zt(false);},onFocus:()=>{(Le.trim()||!Le)&&zt(true);},onBlur:()=>{setTimeout(()=>zt(false),150);},disabled:Nt,style:{flex:"1 1 0%",border:"none",outline:"none",background:"transparent",font:"inherit",color:"inherit",padding:"4px 6px",minWidth:0,fontSize:"inherit"}}),Xi&&Ao.length>0&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:99999,borderRadius:6,border:"1px solid rgba(128,128,128,0.2)",boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,padding:"4px 0",marginTop:4,maxHeight:180,overflowY:"auto"},children:[jsxRuntime.jsx("div",{style:{padding:"4px 10px",fontSize:"0.75em",opacity:.5,fontWeight:600},children:"Suggestions"}),Ao.filter(e=>!Le.trim()||e.toLowerCase().includes(Le.toLowerCase())).slice(0,6).map((e,t)=>jsxRuntime.jsx("button",{type:"button",style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 10px",fontSize:"0.85em",color:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},onMouseDown:n=>{n.preventDefault(),gr(e),zt(false);},children:e},t))]}),Jt&&Je.length>0&&jsxRuntime.jsxs("div",{ref:$n,style:{position:"relative",flexShrink:0},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>On(e=>!e),style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"4px 6px",color:"inherit",fontSize:"inherit"},title:"Saved AI filters",children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{children:Je.length})]}),zn&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:99999,minWidth:240,maxWidth:360,maxHeight:320,overflowY:"auto",borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,padding:"4px 0",marginTop:4},children:[jsxRuntime.jsx("div",{style:{padding:"6px 12px",fontSize:"0.85em",opacity:.5,fontWeight:600},children:"Saved Filters"}),Je.map((e,t)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",cursor:"pointer",fontSize:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="rgba(128,128,128,0.15)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{style:{flex:"1 1 0%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>zo(e),children:e.label}),jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),No(t);},style:{display:"flex",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},title:"Remove",children:x?.close??jsxRuntime.jsx(Ge,{style:{width:10,height:10}})})]},t))]})]}),jsxRuntime.jsx("button",{type:"button",onClick:$o,disabled:Nt||!Le.trim(),style:{display:"flex",alignItems:"center",justifyContent:"center",background:Le.trim()?p:"rgba(128,128,128,0.15)",border:"none",borderRadius:4,cursor:Nt||!Le.trim()?"not-allowed":"pointer",padding:"4px 8px",color:Le.trim()?"#fff":"GrayText",transition:"all 0.2s ease",flexShrink:0,gap:4,fontSize:"inherit",opacity:Nt?.7:1},title:"Send",children:Nt?jsxRuntime.jsx(jsxRuntime.Fragment,{children:x?.loader??jsxRuntime.jsx(Ri,{style:{width:14,height:14,animation:"bt-spin 1s linear infinite"}})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:x?.send??jsxRuntime.jsx(Si,{style:{width:14,height:14}})})}),!Jt&&jsxRuntime.jsx("button",{type:"button",onClick:Bo,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"GrayText",flexShrink:0},title:"Close AI",children:x?.close??jsxRuntime.jsx(Ge,{style:{width:14,height:14}})})]})]}),jn&&jsxRuntime.jsxs("div",{className:g.filterDrawer??"",style:{position:"absolute",top:0,right:0,bottom:0,width:340,maxWidth:"80%",zIndex:50,display:"flex",flexDirection:"column",background:Xt?"rgba(20,20,20,0.75)":"rgba(255,255,255,0.8)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderLeft:"1px solid rgba(128,128,128,0.15)",boxShadow:"-4px 0 20px rgba(0,0,0,0.15)",animation:"bt-drawer-in 0.2s ease",color:"inherit",...k.filterDrawer},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",borderBottom:"1px solid rgba(128,128,128,0.15)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})}),jsxRuntime.jsx("span",{style:{fontWeight:600},children:"Filter Builder"})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Gn(false),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"GrayText",padding:2},children:x?.close??jsxRuntime.jsx(Ge,{style:{width:14,height:14}})})]}),jsxRuntime.jsxs("div",{style:{padding:"10px 14px",borderBottom:"1px solid rgba(128,128,128,0.1)",flexShrink:0},children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:6},children:"Logic"}),jsxRuntime.jsx("div",{style:{display:"flex",gap:6},children:["and","or"].map(e=>jsxRuntime.jsx("button",{type:"button",onClick:()=>ha(e),style:{flex:1,padding:"5px 0",borderRadius:5,border:`1.5px solid ${sn===e?p:"rgba(128,128,128,0.2)"}`,background:sn===e?`${p}15`:"transparent",color:sn===e?p:"inherit",cursor:"pointer",fontSize:"inherit",fontWeight:500},children:e==="and"?"Match ALL":"Match ANY"},e))})]}),jsxRuntime.jsxs("div",{style:{flex:"1 1 0%",overflowY:"auto",padding:"10px 14px",display:"flex",flexDirection:"column",gap:10},children:[Pt.map((e,t)=>jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:10,borderRadius:6,border:"1px solid rgba(128,128,128,0.15)",background:"rgba(128,128,128,0.04)",position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",top:4,right:4,display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("span",{style:{fontSize:"0.75em",color:"GrayText",fontWeight:500},children:["#",t+1]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ft(n=>n.length>1?n.filter(r=>r.id!==e.id):n),style:{background:"none",border:"none",cursor:Pt.length>1?"pointer":"not-allowed",color:Pt.length>1?"#ef4444":"GrayText",fontSize:"inherit",padding:"0 2px",lineHeight:1,opacity:Pt.length>1?1:.4},title:"Remove condition",children:"\xD7"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:3},children:"Column"}),jsxRuntime.jsxs("select",{value:e.column,onChange:n=>Ft(r=>r.map(l=>l.id===e.id?{...l,column:n.target.value}:l)),style:{width:"100%",fontSize:"inherit",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"5px 8px",background:"transparent",color:"inherit",outline:"none"},children:[jsxRuntime.jsx("option",{value:"",children:"Select column..."}),Q.filter(n=>!n.key.startsWith("__")).map(n=>jsxRuntime.jsx("option",{value:n.key,children:typeof n.title=="string"?n.title:n.key},n.key))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:3},children:"Operator"}),jsxRuntime.jsxs("select",{value:e.operator,onChange:n=>Ft(r=>r.map(l=>l.id===e.id?{...l,operator:n.target.value}:l)),style:{width:"100%",fontSize:"inherit",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"5px 8px",background:"transparent",color:"inherit",outline:"none"},children:[jsxRuntime.jsx("option",{value:"contains",children:"Contains"}),jsxRuntime.jsx("option",{value:"eq",children:"Equals"}),jsxRuntime.jsx("option",{value:"neq",children:"Not equals"}),jsxRuntime.jsx("option",{value:"gt",children:"Greater than"}),jsxRuntime.jsx("option",{value:"gte",children:"Greater or equal"}),jsxRuntime.jsx("option",{value:"lt",children:"Less than"}),jsxRuntime.jsx("option",{value:"lte",children:"Less or equal"}),jsxRuntime.jsx("option",{value:"startsWith",children:"Starts with"}),jsxRuntime.jsx("option",{value:"endsWith",children:"Ends with"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{fontSize:"0.85em",color:"GrayText",marginBottom:3},children:"Value"}),jsxRuntime.jsx("input",{type:"text",value:e.value,placeholder:"Enter value...",onChange:n=>Ft(r=>r.map(l=>l.id===e.id?{...l,value:n.target.value}:l)),style:{width:"100%",fontSize:"inherit",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"5px 8px",outline:"none",background:"transparent",color:"inherit",boxSizing:"border-box"},onFocus:n=>{n.currentTarget.style.borderColor=p;},onBlur:n=>{n.currentTarget.style.borderColor="rgba(128,128,128,0.2)";}})]})]},e.id)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{Ft(e=>[...e,{id:ri.current++,column:"",operator:"contains",value:""}]);},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,background:"none",border:"1px dashed rgba(128,128,128,0.25)",borderRadius:6,cursor:"pointer",color:p,fontSize:"inherit",padding:"8px 0",fontWeight:500},children:"+ Add condition"})]}),jsxRuntime.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(128,128,128,0.15)",display:"flex",gap:8,flexShrink:0},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{ni({}),Te?.({}),$r(null),Ft([{id:ri.current++,column:"",operator:"contains",value:""}]);},style:{flex:1,fontSize:"inherit",background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:5,padding:"6px 0",cursor:"pointer",color:"inherit",fontWeight:500},children:"Clear All"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{ma(),Gn(false);},style:{flex:1,fontSize:"inherit",background:p,border:"none",borderRadius:5,padding:"6px 0",cursor:"pointer",color:"#fff",fontWeight:600},children:"Apply Filters"})]})]}),Io&&jsxRuntime.jsxs("div",{style:{borderBottom:"1px solid rgba(128,128,128,0.2)",padding:"10px 12px",fontSize:"inherit",lineHeight:1.6,background:`linear-gradient(90deg, ${p}06, transparent)`,flexShrink:0,maxHeight:200,overflowY:"auto",position:"relative",whiteSpace:"pre-wrap"},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>En(null),style:{position:"absolute",top:6,right:6,background:"none",border:"none",cursor:"pointer",color:"GrayText",padding:2,display:"flex"},children:x?.close??jsxRuntime.jsx(Ge,{style:{width:12,height:12}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:6,fontWeight:600,fontSize:"0.85em",color:p},children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M2 20h.01"}),jsxRuntime.jsx("path",{d:"M7 20v-4"}),jsxRuntime.jsx("path",{d:"M12 20v-8"}),jsxRuntime.jsx("path",{d:"M17 20V8"}),jsxRuntime.jsx("path",{d:"M22 4v16"})]}),"AI Insights"]}),Io]}),To&&jsxRuntime.jsxs("div",{style:{borderBottom:"1px solid rgba(128,128,128,0.2)",flexShrink:0,position:"relative"},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Ot(null),style:{position:"absolute",top:6,right:6,background:"none",border:"none",cursor:"pointer",color:"GrayText",padding:2,display:"flex",zIndex:1},children:x?.close??jsxRuntime.jsx(Ge,{style:{width:12,height:12}})}),To]}),ut&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",fontSize:"inherit",borderBottom:"1px solid rgba(128,128,128,0.2)",background:`linear-gradient(90deg, ${p}08, transparent)`,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{color:p,display:"flex",flexShrink:0},children:x?.sparkles??jsxRuntime.jsx(nr,{style:{width:14,height:14}})}),jsxRuntime.jsx("span",{style:{flex:"1 1 0%",opacity:.85},children:ut.message}),jsxRuntime.jsxs("button",{type:"button",onClick:Ji,disabled:pt,style:{display:"flex",alignItems:"center",gap:4,background:pt?`${p}25`:`${p}12`,border:`1px solid ${pt?p:`${p}30`}`,borderRadius:4,cursor:pt?"default":"pointer",padding:"2px 8px",color:p,fontSize:"0.85em",flexShrink:0,fontWeight:500,transition:"all 0.2s ease"},title:pt?"Filter saved!":"Save this filter for quick access later",children:[pt?jsxRuntime.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}):jsxRuntime.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),jsxRuntime.jsx("polyline",{points:"17 21 17 13 7 13 7 21"}),jsxRuntime.jsx("polyline",{points:"7 3 7 8 15 8"})]}),jsxRuntime.jsx("span",{children:pt?"Saved":"Save Filter"})]}),jsxRuntime.jsxs("button",{type:"button",onClick:kr,style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"2px 8px",color:"inherit",fontSize:"0.85em",flexShrink:0,opacity:.7},title:"Clear AI results",children:[x?.close??jsxRuntime.jsx(Ge,{style:{width:10,height:10}}),jsxRuntime.jsx("span",{children:"Clear"})]})]}),Ro&&!ut&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",fontSize:"inherit",borderBottom:"1px solid rgba(239,68,68,0.2)",background:"rgba(239,68,68,0.06)",color:"#ef4444",flexShrink:0},children:[jsxRuntime.jsx("span",{style:{flex:"1 1 0%"},children:Ro}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Tn(null),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:2,color:"#ef4444",flexShrink:0},children:x?.close??jsxRuntime.jsx(Ge,{style:{width:12,height:12}})})]}),jsxRuntime.jsx("div",{style:{position:"relative",...xe?{height:`${ui}px`,maxHeight:`${ui}px`,flexShrink:1,flexGrow:0}:{flex:"1 1 0%"}},children:Be?jsxRuntime.jsx("div",{"data-bt-scroll":"",style:{position:"absolute",inset:0,overflow:"auto",contain:"layout paint"},children:jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:Wn,gridTemplateRows:"36px auto",minWidth:`${Lr}px`,width:"100%",position:"relative"},children:[Q.map(e=>{let t=!!e.pinned,n=mt.get(e.key),r=e.key==="__select__"||e.key==="__expand__"||e.key==="__drag__";return jsxRuntime.jsx("div",{className:t?g.pinnedHeader??"":g.header??"",style:{display:"flex",height:36,alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderBottom:"1px solid rgba(128,128,128,0.2)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",position:"sticky",top:0,zIndex:t?13:10,paddingLeft:r?0:8,paddingRight:r?0:8,...t?{[e.pinned]:n??0,...k.pinnedHeader}:k.header}},e.key)}),jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1"},children:Array.from({length:Kr}).map((e,t)=>jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:Wn,height:c},children:Q.map((n,r)=>{let l=!!n.pinned,d=mt.get(n.key),i=n.key==="__select__"||n.key==="__expand__"||n.key==="__drag__",u=Fi[(t*7+r)%Fi.length];return jsxRuntime.jsx("div",{className:l?g.pinnedCell??"":"",style:{display:"flex",alignItems:"center",borderBottom:"1px solid rgba(128,128,128,0.2)",paddingLeft:i?0:8,paddingRight:i?0:8,justifyContent:i?"center":void 0,...l?{position:"sticky",[n.pinned]:d??0,zIndex:5,...k.pinnedCell}:{}},children:jsxRuntime.jsx("div",{style:{backgroundColor:"rgba(100, 116, 139, 0.15)",animation:"bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",borderRadius:i?3:4,height:i?16:14,width:i?16:`${u}%`,animationDelay:`${(t*7+r)*50}ms`}})},n.key)})},t))})]})}):jsxRuntime.jsxs("div",{ref:ta,tabIndex:0,"data-bt-scroll":"",style:{position:"absolute",inset:0,overflow:"auto",contain:"layout paint"},children:[jsxRuntime.jsx(co,{ref:Dn,accentColor:p}),jsxRuntime.jsxs("div",{role:"grid","aria-rowcount":Y.length,"aria-colcount":Q.length,style:{display:"grid",gridTemplateColumns:Wn,gridTemplateRows:tr?Ue?"36px 36px 1fr":"36px 1fr":Ue?`36px 36px ${Zr}px`:`36px ${Zr}px`,minWidth:`${Lr}px`,width:"100%",position:"relative",...tr?{height:"100%"}:{}},onContextMenu:e=>{let t=e.target.closest("[data-bt-cell]");if(!t)return;let n=t.dataset.rowKey,r=t.dataset.columnKey;if(!n||!r)return;let l=Bt.find(f=>f.key===r),d=!!l?.copy,i=!!ge,u=l?.columnCellContextMenuItems&&l.columnCellContextMenuItems.length>0,m=!!l?.editable&&!l?.render&&!!ze;!d&&!i&&!u&&!m||(e.preventDefault(),tt({x:Math.min(e.clientX,window.innerWidth-200),y:Math.min(e.clientY,window.innerHeight-200),rowKey:n,columnKey:r}));},onTouchStart:e=>{Xn();let t=e.target.closest("[data-bt-cell]");if(!t)return;let n=e.touches[0];pn.current={x:n.clientX,y:n.clientY};let r=t.dataset.rowKey,l=t.dataset.columnKey;un.current=setTimeout(()=>{if(un.current=null,!r||!l)return;let d=Bt.find(C=>C.key===l),i=!!d?.copy,u=!!ge,m=d?.columnCellContextMenuItems&&d.columnCellContextMenuItems.length>0,f=!!d?.editable&&!d?.render&&!!ze;!i&&!u&&!m&&!f||tt({x:Math.min(n.clientX,window.innerWidth-200),y:Math.min(n.clientY,window.innerHeight-200),rowKey:r,columnKey:l});},500);},onTouchMove:e=>{if(!pn.current)return;let t=e.touches[0],n=t.clientX-pn.current.x,r=t.clientY-pn.current.y;(Math.abs(n)>10||Math.abs(r)>10)&&Xn();},onTouchEnd:Xn,onTouchCancel:Xn,onClick:De||ae?e=>{let t=e.target;if(t.closest("input, button, a, select, textarea"))return;let n=t.closest("[data-bt-cell]");if(!n)return;let r=n.dataset.rowKey;if(!r)return;let l=(d,i)=>{De?.(d,i,e),ae&&sr(d);};for(let d=0;d<$e.length;d++){let i=$e[d];if(i!=null&&Ke(i,d)===r){l(i,d);return}}for(let d=0;d<vt.length;d++)if(vt[d]!=null&&Ke(vt[d],d)===r){l(vt[d],d);return}for(let d=0;d<kt.length;d++)if(kt[d]!=null&&Ke(kt[d],d)===r){l(kt[d],d);return}}:void 0,children:[Ue&&Lt.map(e=>{let t=1/0,n=-1;if(Q.forEach((l,d)=>{e.childKeys.includes(l.key)&&(t=Math.min(t,d),n=Math.max(n,d));}),t===1/0)return null;let r=n===Q.length-1;return jsxRuntime.jsx("div",{"data-bt-header":"",className:`${e.className??""} ${g.header??""}`,style:{gridColumn:`${t+1} / ${n+2}`,gridRow:1,position:"sticky",top:0,zIndex:10,display:"flex",height:36,alignItems:"center",justifyContent:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",fontWeight:500,userSelect:"none",borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:r?"none":"1px solid rgba(128,128,128,0.2)",...e.style,...k.header},children:e.title},`group-${e.key}`)}),(()=>{let e=Q.findIndex(t=>t.key!=="__select__"&&t.key!=="__expand__"&&t.key!=="__drag__");return Q.map((t,n)=>{let r=ji?.has(t.key)??false,l=Ue?r?2:"1 / 3":1,d=Ue&&!r?72:36,i=Ue&&r?36:0;return t.key==="__select__"&&B?jsxRuntime.jsx("div",{"data-bt-header":"","data-bt-pinned":"",className:`${g.header??""} ${g.pinnedHeader??""}`,style:{display:"flex",height:d,alignItems:"center",justifyContent:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",position:"sticky",left:mt.get("__select__")??0,top:0,zIndex:13,width:"48px",gridRow:l,borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:"1px solid rgba(128,128,128,0.2)",...k.header,...k.pinnedHeader},children:B.type!=="radio"&&!B.hideSelectAll&&jsxRuntime.jsx("input",{"data-bt-check":"",type:"checkbox",checked:St>0&&Bn.length===St,ref:u=>{u&&(u.indeterminate=Bn.length>0&&Bn.length<St);},onChange:u=>{if(u.target.checked){let m=Y.map((f,C)=>Wo(f,C));B.onSelectAll?.(true,Y,Y),B.onChange?.(m,Y,{type:"all"});}else B.onSelectAll?.(false,[],Y),B.onChange?.([],[],{type:"all"});}})},"__select__"):t.key==="__drag__"?jsxRuntime.jsx("div",{"data-bt-header":"","data-bt-pinned":"",className:`${g.header??""} ${g.pinnedHeader??""}`,style:{display:"flex",height:d,alignItems:"center",justifyContent:"center",overflow:"hidden",whiteSpace:"nowrap",boxSizing:"border-box",position:"sticky",left:mt.get("__drag__")??0,top:0,zIndex:13,width:"36px",gridRow:l,borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:"1px solid rgba(128,128,128,0.2)",...k.header,...k.pinnedHeader},children:jsxRuntime.jsx(mn,{style:{width:12,height:12,opacity:.4}})},"__drag__"):t.key==="__expand__"?jsxRuntime.jsx("div",{"data-bt-header":"","data-bt-pinned":"",className:`${g.header??""} ${g.pinnedHeader??""}`,style:{display:"flex",height:d,alignItems:"center",justifyContent:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",boxSizing:"border-box",position:"sticky",left:mt.get("__expand__")??0,top:0,zIndex:13,width:"40px",backgroundColor:k.pinnedBg,gridRow:l,borderTop:"none",borderLeft:"none",borderBottom:"1px solid rgba(128,128,128,0.2)",borderRight:"1px solid rgba(128,128,128,0.2)",...k.header,...k.pinnedHeader}},"__expand__"):jsxRuntime.jsx(ro,{column:t,accentColor:p,visualIndex:n,onResizeStart:oa,onColumnDragStart:na,styles:k,classNames:g,gripIcon:V,hideGripIcon:X,icons:x,stickyOffset:mt.get(t.key),onTogglePin:sa,onToggleHide:Qo,isLastColumn:n===Q.length-1,isFirstColumn:n===e,sortDirection:Qe.find(u=>u.key===t.key)?.direction??null,sortPriority:Ie&&Qe.length>1&&Qe.findIndex(u=>u.key===t.key)+1||void 0,onSort:ua,filterValue:je[t.key]??"",onFilter:Br,onClearFilter:ba,customContextMenuItems:t.columnHeaderContextMenuItems?[...ye??[],...t.columnHeaderContextMenuItems]:ye,disabledFilters:Ne,headerGridRow:l,headerHeight:d,stickyTop:i,onAutoFitColumn:ia,isDark:Xt},t.key)})})(),tr?jsxRuntime.jsx("div",{style:{gridColumn:"1 / -1",height:"100%",position:"relative"},children:jsxRuntime.jsx("div",{style:{position:"sticky",left:0,width:_r>0?`${_r}px`:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:st??jsxRuntime.jsx("div",{className:g.emptyState??"",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,paddingTop:32,paddingBottom:32,color:"GrayText",...k.emptyState},children:jsxRuntime.jsx("span",{style:{fontSize:"inherit"},children:"No data"})})})}):jsxRuntime.jsx(po,{data:$e,orderedColumns:Ya,rowVirtualizer:Wt,columnOffsets:mt,styles:k,classNames:g,rowSelection:Ct?void 0:B,normalizedSelectedKeys:Bn,getRowKey:Ke,getRawRowKey:Wo,expandable:Ct?void 0:be,resolvedExpandedKeys:gt,rowHeight:c,totalTableWidth:Lr,scrollAreaWidth:_r,accentColor:p,scrollContainerRef:ve,isLoading:Ct,onExpandedRowResize:Ka,maxExpandedRowHeight:w,pinnedTopData:vt,pinnedBottomData:kt,gridTemplateColumns:Wn,headerHeight:er,rowClassName:it.length>0?(e,t)=>{let n=We?We(e,t):"",r=_a(e);return [n,r].filter(Boolean).join(" ")||""}:We,rowStyle:Ln.length>0||it.length>0?(e,t)=>{let n=qe?qe(e,t):void 0,r=wa(e),l=Ia(e);return !n&&!r&&!l?{}:{...n,...l,...r}}:qe,bodyGridRow:Ue?3:2,onEdit:ze,editingCell:Na,onEditComplete:za,enableDynamicRowHeight:P,onRowHeightChange:Wa,columnGridIndexMap:aa,cellStyleFn:Nn.length>0||qn.length>0?(e,t)=>{let n=Ca(e,t),r=Ta(e,t);if(!(!n&&!r))return {...r,...n}}:void 0,onRowDragStart:nt&&Ye?ra:void 0,enableRowAnimation:Mt,onGroupToggle:U?ka:void 0,groupAccentColor:p,onTreeToggle:te?Ra:void 0,treeIndentSize:te?.indentSize??20})]})]})}),ae&&mo&&jsxRuntime.jsxs("div",{className:g.masterDetailPanel??"",style:{borderTop:`2px solid ${p}`,padding:12,flexShrink:0,maxHeight:"40%",overflow:"auto",position:"relative",...k.masterDetailPanel},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>sr(null),style:{position:"absolute",top:8,right:8,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"1px solid rgba(128,128,128,0.2)",borderRadius:4,cursor:"pointer",padding:"2px 4px",color:"GrayText",fontSize:"0.85em"},title:"Close detail",children:x?.close??jsxRuntime.jsx(Ge,{style:{width:12,height:12}})}),ae(mo,()=>sr(null))]}),Rt&&jsxRuntime.jsxs("div",{className:g.pagination??"",style:{display:"flex",height:36,minHeight:36,maxHeight:36,boxSizing:"border-box",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(128,128,128,0.2)",paddingLeft:12,paddingRight:12,fontSize:"inherit",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",backgroundColor:"rgba(128,128,128,0.06)",gap:12,flexShrink:0,...k.pagination},children:[jsxRuntime.jsx("div",{style:{display:"flex",flex:"1 1 0%",alignItems:"center"},children:(()=>{let e=Kt>0?(ue-1)*yn+1:0,t=Math.min(ue*yn,Kt);return typeof T=="object"&&T?.showTotal?jsxRuntime.jsxs("span",{className:g.paginationInfo??"",style:{color:"GrayText",fontSize:"inherit",...k.paginationInfo},children:["Showing"," ",T.showTotal(Kt,[e,t])," of"," ",Kt," items"]}):jsxRuntime.jsxs("span",{className:g.paginationInfo??"",style:{color:"GrayText",fontSize:"inherit",...k.paginationInfo},children:[e,"\u2013",t," of ",Kt]})})()}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",alignItems:"center",justifyContent:"center",gap:4},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>hn(1),disabled:ue===1,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:ue===1?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:ue===1?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"First page",children:x?.chevronsLeft??jsxRuntime.jsx(fi,{style:{width:12,height:12}})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>hn(ue-1),disabled:ue===1,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:ue===1?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:ue===1?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"Previous page",children:x?.chevronLeft??jsxRuntime.jsx(gi,{style:{width:12,height:12}})}),Za().map(e=>{if(e==="ellipsis-left"||e==="ellipsis-right")return jsxRuntime.jsx("span",{style:{color:"GrayText",paddingLeft:4,paddingRight:4,fontSize:"inherit",userSelect:"none"},children:"..."},e);let t=e===ue;return jsxRuntime.jsx("button",{type:"button",className:`${g.paginationButton??""} ${t?g.paginationActiveButton??"":""}`.trim()||void 0,style:{display:"inline-flex",height:24,minWidth:24,cursor:"pointer",alignItems:"center",justifyContent:"center",borderRadius:4,paddingLeft:6,paddingRight:6,fontSize:"inherit",color:t?p:"inherit",fontWeight:t?600:"inherit",background:"none",border:"none",...k.paginationButton,...t?k.paginationActiveButton:void 0},onClick:()=>hn(e),children:e},e)}),jsxRuntime.jsx("button",{type:"button",onClick:()=>hn(ue+1),disabled:ue===he,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:ue===he?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:ue===he?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"Next page",children:x?.chevronRight??jsxRuntime.jsx(Qr,{style:{width:12,height:12}})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>hn(he),disabled:ue===he,className:g.paginationButton??"",style:{display:"inline-flex",height:24,width:24,cursor:ue===he?"not-allowed":"pointer",alignItems:"center",justifyContent:"center",fontSize:"inherit",opacity:ue===he?.2:1,background:"none",border:"none",padding:0,color:"inherit",...k.paginationButton},title:"Last page",children:x?.chevronsRight??jsxRuntime.jsx(yi,{style:{width:12,height:12}})})]}),jsxRuntime.jsx("div",{style:{display:"flex",flex:"1 1 0%",alignItems:"center",justifyContent:"flex-end",gap:8},children:typeof T=="object"&&T?.hidePageSelector?null:jsxRuntime.jsx("select",{value:yn,onChange:e=>Ja(Number(e.target.value)),className:g.paginationSelect??"",style:{cursor:"pointer",borderRadius:4,border:"1px solid rgba(128,128,128,0.2)",paddingLeft:6,paddingRight:6,paddingTop:2,paddingBottom:2,fontSize:"inherit",height:24,background:"inherit",color:"inherit",...k.paginationSelect},children:(typeof T=="object"&&T?.pageSizeOptions?T.pageSizeOptions:[10,15,20,25,50,100]).map(e=>jsxRuntime.jsxs("option",{value:e,children:[e," / page"]},e))})})]}),Ze&&jsxRuntime.jsx("div",{className:g.statusBar??"",style:{display:"flex",alignItems:"center",gap:12,padding:"4px 12px",borderTop:"1px solid rgba(128,128,128,0.2)",fontSize:"0.85em",color:"GrayText",flexShrink:0,minHeight:24,...k.statusBar},children:Sn?Sn({totalRows:Y.length,filteredRows:xt.length,selectedRows:B?.selectedRowKeys?.length??0,currentPage:gn,pageSize:wt}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:xt.length===Y.length?`${Y.length} rows`:`${xt.length} of ${Y.length} rows`}),B&&B.selectedRowKeys.length>0&&jsxRuntime.jsxs("span",{style:{color:p,fontWeight:500},children:[B.selectedRowKeys.length," selected"]}),Object.keys(je).length>0&&jsxRuntime.jsxs("span",{children:[Object.keys(je).length," filter",Object.keys(je).length>1?"s":""," active"]}),Qe.length>0&&jsxRuntime.jsxs("span",{children:["Sorted by ",Qe.length," column",Qe.length>1?"s":""]})]})})]}),ar&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:qo,className:`${g.header??""} ${g.dragHeader??""}`,style:{display:"none",position:"fixed",zIndex:99999,fontSize:"inherit",color:fe.color,alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:6,border:"1px dashed rgba(128,128,128,0.2)",boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,cursor:"grabbing",pointerEvents:"none",...k.header,...k.dragHeader},children:jsxRuntime.jsxs("div",{style:{display:"flex",height:"100%",flex:"1 1 0%",alignItems:"center",gap:4,overflow:"hidden",paddingLeft:8,paddingRight:8,fontWeight:500},children:[x?.gripVertical??V??jsxRuntime.jsx(mn,{style:{width:12,height:12,flexShrink:0}}),jsxRuntime.jsx("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left",userSelect:"none"},children:Qn?typeof Qn.title=="string"?Qn.title:Qn.key:""})]})}),document.body),ar&&nt&&Ye&&reactDom.createPortal(jsxRuntime.jsx("div",{ref:Yo,style:{display:"none",position:"fixed",zIndex:99999,height:32,fontSize:"0.85em",alignItems:"center",justifyContent:"center",padding:"0 12px",borderRadius:6,border:`1px dashed ${p}60`,boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,cursor:"grabbing",pointerEvents:"none",fontWeight:500,color:p}}),document.body),Oe&&ar&&(()=>{let e=Bt.find(y=>y.key===Oe.columnKey),t=Ma.has(Oe.rowKey),n=La.has(Oe.rowKey),r=!!e?.copy,l=!!ge,d=!!e?.editable&&!e?.render&&!!ze,i,u=0,m=[vt,$e,kt],f=0;e:for(let y of m)for(let I=0;I<y.length;I++){if(y[I]==null){f++;continue}if(Ke(y[I],f)===Oe.rowKey){i=y[I],u=f;break e}f++;}let C=i&&e?.dataIndex!=null?i[e.dataIndex]:void 0,v={display:"flex",width:"100%",alignItems:"center",gap:8,background:"none",border:"none",padding:"6px 12px",fontSize:"inherit",cursor:"pointer",color:"inherit",whiteSpace:"nowrap",...k.contextMenuItem};return reactDom.createPortal(jsxRuntime.jsxs("div",{ref:Hr,style:{position:"fixed",top:Oe.y,left:Oe.x,zIndex:99999,minWidth:170,borderRadius:8,border:"1px solid rgba(128,128,128,0.2)",boxShadow:fe.menuShadow,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",backgroundColor:fe.menuBg,color:fe.color,padding:"4px 0",fontSize:"0.75em"},children:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:v,onClick:()=>{ei(Oe.rowKey,t?false:"top"),tt(null);},children:[t?x?.pinOff??jsxRuntime.jsx(Et,{style:{width:14,height:14,flexShrink:0}}):x?.pin??jsxRuntime.jsx(jt,{style:{width:14,height:14,flexShrink:0}}),t?"Unpin Row from Top":"Pin Row to Top"]}),jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:v,onClick:()=>{ei(Oe.rowKey,n?false:"bottom"),tt(null);},children:[n?x?.pinOff??jsxRuntime.jsx(Et,{style:{width:14,height:14,flexShrink:0}}):x?.pin??jsxRuntime.jsx(jt,{style:{width:14,height:14,flexShrink:0,transform:"rotate(180deg)"}}),n?"Unpin Row from Bottom":"Pin Row to Bottom"]})]}),l&&(r||d)&&jsxRuntime.jsx("div",{style:{borderTop:"1px solid rgba(128,128,128,0.2)",margin:"4px 0"}}),d&&jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:v,onClick:()=>{si({rowKey:Oe.rowKey,columnKey:Oe.columnKey}),tt(null);},children:[x?.edit??jsxRuntime.jsx(bi,{style:{width:14,height:14,flexShrink:0}}),"Edit"]}),(d||l)&&r&&jsxRuntime.jsx("div",{style:{borderTop:"1px solid rgba(128,128,128,0.2)",margin:"4px 0"}}),r&&i&&e&&jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":true,style:v,onClick:()=>{let y=typeof e.copy=="function"?e.copy(C,i,u):String(C??"");navigator.clipboard?.writeText(y),Ee?.(y,e.key,i,u),tt(null);},children:[x?.copy??jsxRuntime.jsx(mi,{style:{width:14,height:14,flexShrink:0}}),"Copy"]}),e?.columnCellContextMenuItems&&e.columnCellContextMenuItems.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(r||l||d)&&jsxRuntime.jsx("div",{style:{borderTop:"1px solid rgba(128,128,128,0.2)",margin:"4px 0"}}),e.columnCellContextMenuItems.map(y=>{let I=typeof y.icon=="function"?i?y.icon(e.key,i,u):null:y.icon,K=typeof y.label=="function"?i?y.label(e.key,i,u):null:y.label;return jsxRuntime.jsxs("button",{type:"button","data-bt-ctx-item":"",disabled:y.disabled,style:{...v,cursor:y.disabled?"not-allowed":"pointer",opacity:y.disabled?.5:1,color:y.danger?"#ef4444":"inherit"},onClick:()=>{i&&y.onClick&&y.onClick(e.key,i,u),tt(null);},children:[I&&jsxRuntime.jsx("span",{style:{display:"flex",width:14,height:14,alignItems:"center",justifyContent:"center",flexShrink:0},children:I}),K]},y.key)})]})]}),document.body)})()]})}function ks(o){return o}exports.BoltTable=Ki;exports.DraggableHeader=ro;exports.ResizeOverlay=co;exports.TableBody=po;exports.defineConfig=ks;