import{u as g,r as u,bV as x,j as e,bY as h,bZ as j,b_ as R,b$ as f}from"./vendor-BKmmeuxg.js";import{T}from"./table-header-DVkEnG6Y.js";import{T as C,a as M,b as d,c as p}from"./table-DWOXv4Pu.js";import{c as N}from"./utils-DxSsnXxD.js";import w from"./courses-table-columns-DqeuEoHA.js";import S from"./table-filter-DOUvVAkf.js";import y from"./table-footer-DoSrFDMI.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";import"./table-page-size-OCfjNXER.js";import"./dropdown-menu-DO-po5c1.js";import"./route-B4ZMN77y.js";import"./debounce-CWHP_ANh.js";import"./scroll-area-C8HGru-R.js";const $=({courses:t,selectedIds:r=[],onCourseSelect:l})=>{var n;const i=g(),m=i.props.type==="demo"?"home.demo":"home",[b,c]=u.useState([]),a=x({data:t.data,columns:w(i.props.translate),onSortingChange:c,getCoreRowModel:f(),getSortedRowModel:R(),getFilteredRowModel:j(),state:{sorting:b}});return e.jsxs("div",{children:[e.jsx(S,{data:t,title:"Courses",globalSearch:!0,searchKey:"course",tablePageSizes:[10,15,20,25],routeName:m}),e.jsxs(C,{className:"border-border border-y",children:[e.jsx(T,{table:a}),e.jsx(M,{children:(n=a.getRowModel().rows)!=null&&n.length?a.getRowModel().rows.map(o=>e.jsx(d,{"data-state":o.getIsSelected()&&"selected",className:N("hover:bg-muted cursor-pointer",(r==null?void 0:r.includes(Number(o.original.id)))&&"bg-secondary-light"),onClick:()=>l&&l(Number(o.original.id)),children:o.getVisibleCells().map(s=>e.jsx(p,{children:h(s.column.columnDef.cell,s.getContext())},s.id))},o.id)):e.jsx(d,{children:e.jsx(p,{className:"h-24 text-center",children:"No results."})})})]}),e.jsx(y,{className:"p-4",routeName:m,paginationInfo:t})]})};export{$ as default};
