import{c as h,j as s,B as t,b as u}from"./index-DHiKqTn6.js";import{C as N}from"./chevron-left-B2icCOsE.js";import{s as v}from"./en-US-BHI7lbCO.js";const b=h("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const w=h("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]),L=({currentPage:i,totalPages:l,totalItems:o,pageSize:m,onPageChange:n,className:d})=>{if(o<=m)return null;const x=(i-1)*m+1,f=Math.min(i*m,o),p=()=>{const e=[];if(l<=7)for(let a=1;a<=l;a++)e.push(a);else{e.push(1),i>3&&e.push("ellipsis");const a=Math.max(2,i-1),j=Math.min(l-1,i+1);for(let c=a;c<=j;c++)e.push(c);i<l-2&&e.push("ellipsis"),e.push(l)}return e};return s.jsxs("div",{className:u("flex flex-col sm:flex-row items-center justify-between gap-3 pt-4",d),children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",s.jsx("span",{className:"font-medium text-foreground",children:x}),"–",s.jsx("span",{className:"font-medium text-foreground",children:f})," of"," ",s.jsx("span",{className:"font-medium text-foreground",children:o})," results"]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(t,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:i<=1,onClick:()=>n(1),"aria-label":"First page",children:s.jsx(b,{className:"h-4 w-4"})}),s.jsx(t,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:i<=1,onClick:()=>n(i-1),"aria-label":"Previous page",children:s.jsx(N,{className:"h-4 w-4"})}),s.jsx("div",{className:"flex items-center gap-1 mx-1",children:p().map((e,r)=>e==="ellipsis"?s.jsx("span",{className:"px-1 text-muted-foreground text-sm",children:"…"},`ellipsis-${r}`):s.jsx(t,{variant:e===i?"default":"outline",size:"icon",className:"h-8 w-8 text-xs",onClick:()=>n(e),children:e},e))}),s.jsx(t,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:i>=l,onClick:()=>n(i+1),"aria-label":"Next page",children:s.jsx(v,{className:"h-4 w-4"})}),s.jsx(t,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:i>=l,onClick:()=>n(l),"aria-label":"Last page",children:s.jsx(w,{className:"h-4 w-4"})})]})]})};export{L as P};
