import{j as e}from"./sikshya-admin-sikshya-react-E_TY_un4.js";import{N as m}from"./sikshya-admin.js";import{b as p}from"./sikshya-admin-Skeleton-CUjXMume.js";function u(t,s,d){const r=t.sortKey;if(!r||!s||!d)return t.header;const i=s.orderby===r,n=i?s.order==="asc"?"ascending":"descending":void 0;return e.jsxs("button",{type:"button",onClick:()=>d(r),className:"inline-flex max-w-full items-center gap-1 text-left font-semibold uppercase tracking-wide text-slate-500 hover:text-slate-800 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 dark:text-slate-400 dark:hover:text-slate-200",children:[e.jsx("span",{className:"min-w-0 truncate",children:t.header}),e.jsx(m,{name:"chevronDown",className:`h-3.5 w-3.5 shrink-0 transition-transform ${i?s.order==="asc"?"-rotate-180":"":"opacity-30"}`,"aria-hidden":!0}),i&&n?e.jsxs("span",{className:"sr-only",children:[", sorted ",n]}):null]})}function v({columns:t,rows:s,rowKey:d,emptyMessage:r="No rows to display.",emptyContent:i,wrapInCard:n=!0,getRowClassName:l,sortState:o,onSortColumn:h}){const x=e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 text-sm dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-slate-50 text-left text-xs font-semibold uppercase tracking-wide text-slate-500 dark:bg-slate-800/80 dark:text-slate-400",children:e.jsx("tr",{children:t.map(a=>e.jsx("th",{className:`px-4 py-3 ${a.headerClassName||""}`,scope:"col",children:u(a,o,h)},a.id))})}),s.length===0?e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:Math.max(1,t.length),className:"p-0",children:i??e.jsx("div",{className:"px-4 py-12 text-center text-sm text-slate-500 dark:text-slate-400",children:r})})})}):e.jsx("tbody",{className:"divide-y divide-slate-100 dark:divide-slate-800",children:s.map(a=>e.jsx("tr",{className:`group hover:bg-slate-50/80 dark:hover:bg-slate-800/40 ${(l==null?void 0:l(a))??""}`.trim(),children:t.map(c=>e.jsx("td",{className:`px-4 py-3 ${c.cellClassName||""}`,children:c.render(a)},c.id))},d(a)))})]})});return n?e.jsx(p,{children:x}):x}export{v as D};
