import{aT as b,r as u,d0 as x,j as e,d3 as h,d4 as j,d5 as R,d6 as T}from"./react-vendor-xYZnmIII.js";import{T as f}from"./table-header-CjMHr8CW.js";import{aE as C,aF as y,aG as m,c as M,aH as g}from"./ui-components-CQM92IK3.js";import N from"./categories-table-columns-BhRJO5hg.js";import w from"./table-filter-A5dRHZXr.js";import S from"./table-footer-DaE_7-Nu.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 q=({categories:t,selectedIds:a=[],onCourseSelect:l})=>{var n;const i=b(),d=i.props.type==="demo"?"home.demo":"home",[p,c]=u.useState([]),r=x({data:t.data,columns:N(i.props.translate),onSortingChange:c,getCoreRowModel:T(),getSortedRowModel:R(),getFilteredRowModel:j(),state:{sorting:p}});return e.jsxs("div",{children:[e.jsx(w,{data:t,title:"Categories",globalSearch:!0,searchKey:"category",tablePageSizes:[10,15,20,25],routeName:d}),e.jsxs(C,{className:"border-border border-y",children:[e.jsx(f,{table:r}),e.jsx(y,{children:(n=r.getRowModel().rows)!=null&&n.length?r.getRowModel().rows.map(o=>e.jsx(m,{"data-state":o.getIsSelected()&&"selected",className:M("hover:bg-muted cursor-pointer",(a==null?void 0:a.includes(Number(o.original.id)))&&"bg-secondary-light"),onClick:()=>l&&l(Number(o.original.id)),children:o.getVisibleCells().map(s=>e.jsx(g,{children:h(s.column.columnDef.cell,s.getContext())},s.id))},o.id)):e.jsx(m,{children:e.jsx(g,{className:"h-24 text-center",children:"No results."})})})]}),e.jsx(S,{className:"p-4",routeName:d,paginationInfo:t,paginationKey:"category"})]})};export{q as default};
