import{r as x,d0 as f,j as e,d3 as h,d4 as T,d5 as C,d6 as j}from"./react-vendor-xYZnmIII.js";import{T as R}from"./table-header-CjMHr8CW.js";import{aE as w,aF as M,aG as d,c as N,aH as c}from"./ui-components-CQM92IK3.js";import S from"./blogs-table-columns-BTIziXE_.js";import F from"./categories-table-columns-CBlgDcy1.js";import y from"./courses-table-columns-CGnsawL4.js";import E from"./instructors-table-columns-DOKTDX9Q.js";import v from"./table-filter-CqNe_5up.js";import B from"./table-footer-BOe2S7IJ.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";import"./table-page-size-CzF8rJAG.js";import"./route-D0xh7FtZ.js";import"./debounce-CWHP_ANh.js";const W=({type:l,title:u,data:r,selectedIds:t=[],onCourseSelect:i})=>{var m;const n="frontend.api",g=()=>{switch(l){case"courses":return y();case"instructors":return E();case"blogs":return S();default:return F()}},[b,p]=x.useState([]),a=f({data:r.data,columns:g(),onSortingChange:p,getCoreRowModel:j(),getSortedRowModel:C(),getFilteredRowModel:T(),state:{sorting:b}});return e.jsxs("div",{children:[e.jsx(v,{data:r,title:u,searchKey:l,globalSearch:!0,tablePageSizes:[10,15,20,25],routeName:n}),e.jsxs(w,{className:"border-border border-y",children:[e.jsx(R,{table:a}),e.jsx(M,{children:(m=a.getRowModel().rows)!=null&&m.length?a.getRowModel().rows.map(o=>e.jsx(d,{"data-state":o.getIsSelected()&&"selected",className:N("hover:bg-muted cursor-pointer",(t==null?void 0:t.includes(Number(o.original.id)))&&"bg-secondary-light"),onClick:()=>i&&i(Number(o.original.id)),children:o.getVisibleCells().map(s=>e.jsx(c,{children:h(s.column.columnDef.cell,s.getContext())},s.id))},o.id)):e.jsx(d,{children:e.jsx(c,{className:"h-24 text-center",children:"No results."})})})]}),e.jsx(B,{className:"p-4",routeName:n,paginationInfo:r})]})};export{W as default};
