import{j as e,h as S,aB as B,r as d}from"./vendor-ClLR6ncd.js";import{A as R}from"./lodash-ZyeDnt0e.js";import"./index-OtVJl4GC.js";import{O as q}from"./OptionallyDenseMuiTable-D7b58l1V.js";import{T as y}from"./TableContainer-CN5gAdqf.js";import{c as O,T as m,b as T,a as g}from"./TableRow-CGDSOtFZ.js";import{T as v}from"./TableSortLabel-BJFq2axQ.js";function A(s){const[r,o]=d.useState("asc"),[a,i]=d.useState(s);return{sort:t=>R(t,a,r),handleRequestSort:t=>{o(a===t&&r==="asc"?"desc":"asc"),i(t)},order:r,orderBy:a}}function E({columns:s,order:r,orderBy:o,onRequestSort:a}){return e.jsx(g,{children:e.jsx(m,{children:s.map(({sortable:i=!0,label:n,sx:c,key:t})=>e.jsx(T,{sx:c,children:i?e.jsx(v,{active:o===t,direction:o===t?r:"asc",onClick:()=>a(t),children:n}):n},n))})})}const j=d.createContext();function z(){return d.useContext(j)}function F({children:s,value:r}){return e.jsx(j.Provider,{value:r,children:s})}function G({rows:s,uniqueRowKey:r,columns:o,tableProps:a,emptyRowsTitle:i,initSortingColumn:n,cellProps:c}){const{sort:t,handleRequestSort:u,order:p,orderBy:b}=A(n);return s.length===0?e.jsx(S,{children:i}):e.jsx(y,{component:B,children:e.jsxs(q,{...a,children:[e.jsx(E,{columns:o,order:p,orderBy:b,onRequestSort:u}),e.jsx(O,{sx:{width:1},children:t(s).map(l=>e.jsx(m,{sx:{"&:last-child td, &:last-child th":{border:0}},children:o.map(({key:x,label:f,Component:h,sx:C})=>e.jsx(T,{sx:C,children:h?e.jsx(h,{str:l[x],row:l,...c}):l[x]},f))},l[r]))})]})})}export{F as T,G as a,z as u};
