import{f as m,j as e,B as r,aq as w}from"./index-e79f7aad.js";import{T as c,a as i}from"./TableRow-0ea91e40.js";import{T as y,a as C,b as R}from"./TableHead-1f8b658d.js";import{T as S}from"./TablePagination-6f9f31d4.js";const d=m(c)(()=>({fontSize:"14px",borderBottom:"1px solid #ddd",padding:"8px"})),B=m(i)(()=>({"&:nth-of-type(odd)":{backgroundColor:"#f9f9f9"}})),E=({columns:s,rows:p,count:x,page:h,pageSize:f,loading:I,showPagination:N,handleChangePage:g,handleChangeRowsPerPage:j})=>{const n=[];let t=[];return p.forEach(a=>{const o=a.item||a.Item||"Unnamed Item";t.length===0||t[0].item===o||t[0].Item===o?t.push(a):(n.push({itemName:t[0].item||t[0].Item,rows:t}),t=[a])}),t.length>0&&n.push({itemName:t[0].item||t[0].Item,rows:t}),e.jsxs(r,{sx:{overflowX:"auto"},children:[e.jsxs(y,{size:"small",children:[e.jsx(C,{children:e.jsx(i,{children:s.map((a,o)=>e.jsx(d,{children:a.title},o))})}),e.jsx(R,{children:n.map((a,o)=>e.jsxs(w.Fragment,{children:[e.jsx(i,{children:e.jsx(c,{colSpan:s.length,sx:{backgroundColor:"#e0e0e0",fontWeight:"bold",textAlign:"center",fontSize:"15px"},children:a.itemName})}),a.rows.map((b,u)=>e.jsx(B,{children:s.map((T,P)=>{const l=b[T.field??""];return e.jsx(d,{children:l??"-"},P)})},`${o}-${u}`))]},o))})]}),e.jsx(r,{sx:{display:"flex",justifyContent:"center",mt:2},children:e.jsx(S,{rowsPerPageOptions:[10,20,50,100],component:"div",count:x,rowsPerPage:f,page:h-1,onPageChange:g,onRowsPerPageChange:j})})]})};export{E as G};
