import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,t as n}from"./jsx-runtime-CIxEorsV.js";t();var r=e(n(),1),i=[10,25,50,100];function a({count:e,page:t,pageSize:n,totalPages:a,onPageChange:o,onPageSizeChange:s}){let c=a??Math.ceil(e/n);if(c<=1&&e<=n)return null;let l=(t-1)*n+1,u=Math.min(t*n,e),d=[];if(c<=7)for(let e=1;e<=c;e++)d.push(e);else{d.push(1),t>3&&d.push(`...`);for(let e=Math.max(2,t-1);e<=Math.min(c-1,t+1);e++)d.push(e);t<c-2&&d.push(`...`),d.push(c)}return(0,r.jsxs)(`div`,{className:`flex items-center justify-between px-1 py-2 border-t text-xs text-muted-foreground`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,r.jsx)(`span`,{children:`Rows per page:`}),(0,r.jsx)(`select`,{className:`h-7 rounded border border-input bg-background px-1.5 text-xs`,value:n,onChange:e=>s(Number(e.target.value)),children:i.map(e=>(0,r.jsx)(`option`,{value:e,children:e},e))}),(0,r.jsx)(`span`,{className:`text-muted-foreground`,children:e>0?`${l}–${u} of ${e}`:`0 records`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>o(1),disabled:t===1,title:`First page`,children:`«`}),(0,r.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>o(t-1),disabled:t===1,title:`Previous page`,children:`‹`}),d.map((e,n)=>e===`...`?(0,r.jsx)(`span`,{className:`px-1`,children:`…`},`ellipsis-${n}`):(0,r.jsx)(`button`,{className:`h-7 min-w-[28px] px-1.5 rounded border text-xs ${e===t?`bg-primary text-primary-foreground border-primary font-semibold`:`border-input bg-background hover:bg-muted`}`,onClick:()=>o(e),children:e},e)),(0,r.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>o(t+1),disabled:t===c,title:`Next page`,children:`›`}),(0,r.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>o(c),disabled:t===c,title:`Last page`,children:`»`})]})]})}export{a as t};