const e=require(`./chunk-BcutgqC9.cjs`),t=require(`./utils-8yHOSEWy.cjs`),n=require(`./chevron-left-BXf0cK2Z.cjs`),r=require(`./chevron-right-DLjQFD-m.cjs`),i=require(`./ellipsis-BAXs6cXc.cjs`);let a=require(`react`);a=e.n(a,1);let o=require(`react/jsx-runtime`);function s({className:e,...n}){return(0,o.jsx)(`nav`,{...n,"aria-label":`pagination`,className:t.t(`mx-auto flex w-full justify-center`,e)})}s.displayName=`PaginationUnit`;var c=a.default.forwardRef(({className:e,...n},r)=>(0,o.jsx)(`ul`,{...n,ref:r,className:t.t(`flex flex-row items-center gap-1 list-none`,e)}));c.displayName=`PaginationContent`;var l=a.default.forwardRef(({className:e,...n},r)=>(0,o.jsx)(`li`,{...n,ref:r,className:t.t(`mr-2 last:mr-0`,e)}));l.displayName=`PaginationItem`;function u({className:e,children:n,...r}){return(0,o.jsx)(`button`,{...r,type:`button`,className:t.t(`p-4 text-base text-primary-black dark:text-primary-gray-100 dark:hover:bg-primary-gray-600`,e),children:n})}u.displayName=`PaginationLink`;function d({className:e,...r}){return(0,o.jsx)(u,{...r,"aria-label":`Go to previous page`,className:t.t(`p-2 bg-primary-gray-300 dark:bg-primary-gray-600 rtl:scale-x-[-1] rounded-full hover:bg-primary-gray-400 dark:hover:bg-primary-gray-550`,e),children:(0,o.jsx)(n.t,{className:`h-6 w-6 stroke-primary-gray-700 dark:stroke-primary-gray-100`})})}d.displayName=`PaginationPrevious`;function f({className:e,...n}){return(0,o.jsx)(u,{...n,"aria-label":`Go to next page`,className:t.t(`p-2 bg-primary-gray-300 dark:bg-primary-gray-600 rtl:scale-x-[-1] rounded-full hover:bg-primary-gray-400 dark:hover:bg-primary-gray-550`,e),children:(0,o.jsx)(r.t,{className:`h-6 w-6 stroke-primary-gray-700 dark:stroke-primary-gray-100`})})}f.displayName=`PaginationNext`;function p({className:e,...n}){return(0,o.jsxs)(`span`,{...n,"aria-hidden":!0,className:t.t(`flex h-9 w-9 items-center justify-center`,e),children:[(0,o.jsx)(i.t,{className:`h-4 w-4 text-primary-gray-700 dark:text-primary-gray-100`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`More pages`})]})}p.displayName=`PaginationEllipsis`;var m=(e,t)=>{let n=[];return t<=7?Array.from({length:t},(e,t)=>t+1):(n.push(1),e<=3?n.push(2,3,4,`ellipsis`):e>=t-2?n.push(`ellipsis`,t-3,t-2,t-1):n.push(`ellipsis`,e-1,e,e+1,`ellipsis`),n.push(t),n)};function h(e){let{defaultPage:n=1,total:r,pageSize:i,onChange:h,className:g,classNames:_}=e,v=Math.ceil(r/i),[y,b]=(0,a.useState)(n),[x,S]=(0,a.useState)(m(n,v));return(0,a.useEffect)(()=>{S(m(y,v))},[y,v]),(0,o.jsx)(s,{className:t.t(`select-none`,g,_?.control),children:(0,o.jsxs)(c,{children:[(0,o.jsx)(l,{children:(0,o.jsx)(d,{onClick:()=>{y>1&&(h(y-1),b(y-1))},className:t.t(`cursor-pointer`,_?.navigation,y<=1&&`cursor-not-allowed pointer-events-none opacity-35`)})}),x.map(e=>(0,o.jsx)(l,{children:e===`ellipsis`?(0,o.jsx)(p,{className:_?.ellipsis}):(0,o.jsx)(u,{onClick:()=>{b(e),h(e)},className:t.t(`cursor-pointer w-[32px] h-[32px] flex items-center justify-center rounded-full hover:bg-primary-gray-300`,_?.list,e===y&&[`bg-primary-blue-600 hover:bg-primary-blue-700 dark:bg-primary-blue-500 dark:hover:bg-primary-blue-400 hover:text-primary-white text-primary-white`,_?.active]),children:e})},e)),(0,o.jsx)(l,{children:(0,o.jsx)(f,{onClick:()=>{y<v&&(h(y+1),b(y+1))},className:t.t(`cursor-pointer`,_?.navigation,y>=v&&`cursor-not-allowed pointer-events-none opacity-35`)})})]})})}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
//# sourceMappingURL=Pagination-DVmZeyne.cjs.map