import{j as e}from"./vendor-react-wBh_31cN.js";import{r as c}from"./utils-D7-Swg4H.js";import{d as f,aw as P,aC as D}from"./index-dNe6i2rS.js";import{ac as S,ad as C}from"./vendor-icons-BUUmD6ht.js";import{A as T}from"./avatar-DDfx1nOU.js";import"./hoverable-link-BgaAJWrR.js";import{V as x}from"./value-7N0Keti9.js";const k=({isSorted:s,isSortedDesc:l,sortOrder:i})=>{const n=s&&l,o=s&&!l;return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(S,{className:f("h-3.5 w-3.5 -mb-1",o?"text-primary":"text-muted-foreground/50")}),e.jsx(C,{className:f("h-3.5 w-3.5 -mt-1",n?"text-primary":"text-muted-foreground/50")})]}),i>0&&e.jsx("span",{className:"text-xs font-bold text-primary",children:i})]})},A=({data:s,columns:l,initialState:i,children:n,onRowClick:o})=>{const{getTableProps:y,getTableBodyProps:h,headerGroups:b,rows:j,prepareRow:g}=c.useTable({columns:l,data:s,initialState:i},c.useGroupBy,c.useSortBy,c.useRowSelect);return s!=null&&s.length?e.jsxs("table",{className:"w-full border-collapse text-sm",...y(),children:[e.jsx("thead",{children:b.map(a=>{const{key:d,...p}=a.getHeaderGroupProps();return e.jsxs("tr",{...p,children:[a.headers.map(r=>{const{key:t,...m}=r.getHeaderProps(r.getSortByToggleProps());return e.jsx("th",{className:"pb-2 pt-0 text-left text-xs font-medium uppercase text-quartz-gray",...m,children:!r.noHeader&&e.jsxs("span",{className:"inline-flex items-center",children:[r.render("Header")," ",r.canSort&&!r.disableSortBy&&e.jsx(k,{isSorted:r.isSorted,isSortedDesc:!!r.isSortedDesc,sortOrder:0})]})},t)}),n&&e.jsx("th",{"aria-label":"actions",children:" "})]},d)})}),e.jsx("tbody",{...h(),children:j.map(a=>{g(a);const{key:d,...p}=a.getRowProps(),r=o?()=>o(a.original):void 0;return e.jsxs("tr",{className:`border-b border-border hover:bg-muted/50${o?" cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-quartz-primary":""}`,onClick:r,role:o?"button":void 0,tabIndex:o?0:void 0,onKeyDown:o?t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),r==null||r())}:void 0,...p,children:[a.cells.map(t=>{const{key:m,...v}=t.getCellProps();return e.jsx("td",{className:"px-2 py-3 text-sm",...v,onClick:N=>{var u;return(u=t.column.cellProps)==null?void 0:u.onClick(N,a.original)},children:t.render("Cell")},m)}),n&&e.jsx("td",{id:"actions",className:"sticky right-0 ml-2 bg-muted/10 backdrop-blur-[1px]",children:e.jsx("div",{className:"flex gap-2.5",children:n})})]},d)})})]}):null},B="yyyy/MM/dd HH:mm:ss",M=({value:s})=>e.jsxs(x,{children:["#",s]}),q=({value:s,transformFn:l=D})=>e.jsx(x,{className:"w-full text-left",children:l(s)||"-"}),z=({value:s})=>s?e.jsx("div",{className:"w-8",children:e.jsx(T,{firstName:s.firstname,lastName:s.lastname})}):null,G=({value:s})=>e.jsx(x,{children:P(new Date(s),B)});export{G as D,M as I,A as R,z as U,q as V};
