import{s as y,j as t,r as o,b}from"./index-42f456b7.js";import{g as u,r as c,G as E,p as F}from"./persist-df9114c1.js";const P=(r,x,l,a)=>{if(a){const{instanceId:i}=a,{sortBy:n,globalFilter:d}=r;F(i,{sortBy:n,globalFilter:d})}return r},R=({columns:r,data:x,id:l,initialState:a={}})=>{const i=y.get(u(l))||a,{getTableProps:n,getTableBodyProps:d,headerGroups:g,rows:h,prepareRow:m,state:j,visibleColumns:S,setGlobalFilter:f}=c.useTable({instanceId:l,stateReducer:P,columns:r,data:x,autoResetSortBy:!1,autoResetFilters:!1,initialState:i},c.useGlobalFilter,c.useSortBy);return t.jsxs("table",{...n(),className:"table responsive",children:[t.jsxs("thead",{children:[t.jsx("tr",{children:t.jsx("th",{colSpan:S.length+1,children:t.jsx(E,{globalFilter:j.globalFilter,setGlobalFilter:f})})}),g.map((s,p)=>o.createElement("tr",{...s.getHeaderGroupProps(),key:p},t.jsx("th",{className:"text-nowrap",children:"#"}),s.headers.map(e=>o.createElement("th",{className:"text-nowrap",...e.getHeaderProps(e.getSortByToggleProps()),key:e.id},t.jsx("span",{className:b({"btn-link me-1":e.canSort}),children:e.render("Header")}),t.jsx("span",{children:t.jsx("i",{className:b("fa",{"fa-sort-amount-down invisible":!e.isSorted,"fa-sort-amount-down-alt":e.isSorted&&!e.isSortedDesc,"fa-sort-amount-down":e.isSorted&&e.isSortedDesc})})})))))]}),t.jsx("tbody",{...d(),children:h.map((s,p)=>(m(s),o.createElement("tr",{...s.getRowProps(),key:s.id},t.jsx("td",{children:t.jsx("div",{className:"font-weight-bold",children:p+1})}),s.cells.map(e=>o.createElement("td",{...e.getCellProps(),key:e.column.id},e.render("Cell"))))))})]})};export{R as T};
