import{r as h,j as s}from"./wp-i18n-shim-DUX0OV_V.js";import{S as u}from"./skeleton-DfFmlQ5i.js";import{a as i}from"./utils-Bl0WAcve.js";import{b}from"./Button-BveKhP38.js";import{d as v,c as R}from"./CalenderCheck-2TB2QVYq.js";const j=h.memo(({pagination:e,loading:r,type:t})=>{const c=((e==null?void 0:e.current_page)-1)*(e==null?void 0:e.per_page)+1,o=Math.min((e==null?void 0:e.current_page)*(e==null?void 0:e.per_page),e==null?void 0:e.total);return r?s.jsx(u,{className:"h-4 w-48"}):s.jsxs(s.Fragment,{children:["Showing ",s.jsxs("span",{className:"text-primary-colordefault",children:[c,"-",o]})," of"," ",s.jsx("span",{className:"text-primary-colordefault",children:e==null?void 0:e.total})," ",t]})});j.displayName="PaginationInfo";const y=({className:e,...r})=>s.jsx("nav",{role:"navigation","aria-label":"pagination",className:i("mx-auto flex w-full justify-center",e),...r});y.displayName="Pagination";const w=h.forwardRef(({className:e,...r},t)=>s.jsx("ul",{ref:t,className:i("flex flex-row items-center gap-1",e),...r}));w.displayName="PaginationContent";const x=h.forwardRef(({className:e,...r},t)=>s.jsx("li",{ref:t,className:i("",e),...r}));x.displayName="PaginationItem";const N=({className:e,isActive:r,size:t="icon",...c})=>s.jsx("a",{"aria-current":r?"page":void 0,className:i(b({variant:r?"outline":"ghost",size:t}),e),...c});N.displayName="PaginationLink";function P(e,r,t=1){const c=t*2+5;if(r<=c)return[...Array(r)].map((f,a)=>a+1);const o=Math.max(e-t,1),l=Math.min(e+t,r),m=o>2,d=l<r-2;if(!m&&d)return[...[...Array(3+2*t)].map((a,n)=>n+1),"...",r];if(m&&!d)return[1,"...",...[...Array(3+2*t)].map((a,n)=>r-(3+2*t)+n+1)];if(m&&d)return[1,"...",...[...Array(l-o+1)].map((a,n)=>o+n),"...",r]}function _({paginationData:e,onPageChange:r}){const t=(e==null?void 0:e.current_page)||1,c=(e==null?void 0:e.last_page)||1;if(c<=1)return null;const o=P(t,c);return s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:"flex items-center gap-2 text-sm text-text-titel-colorparagraph",children:s.jsx(y,{children:s.jsxs(w,{className:"flex items-center gap-2",children:[s.jsx(x,{children:s.jsx("button",{onClick:()=>r(Math.max(t-1,1)),disabled:t===1,className:`w-6 h-6 md:w-9 md:h-9 flex items-center justify-center rounded-md border border-[#e0e0e0] transition-colors ${t===1?"opacity-40 cursor-not-allowed":"hover:bg-bg-5 hover:border-primary"}`,children:s.jsx(v,{className:"w-4 h-4"})})}),o.map((l,m)=>{if(l==="...")return s.jsx("span",{className:"w-6 h-6 md:w-9 md:h-9 flex items-center justify-center",children:"..."},`dots-${m}`);const d=t===l;return s.jsx(x,{children:s.jsx(N,{onClick:()=>r(l),className:`w-6 h-6 md:w-9 md:h-9 p-0 rounded-md flex items-center justify-center font-medium transition-colors cursor-pointer ${d?"bg-primary text-white":"border border-[#e0e0e0] text-black hover:border-primary hover:text-primary"}`,children:l})},l)}),s.jsx(x,{children:s.jsx("button",{onClick:()=>r(Math.min(t+1,c)),disabled:t===c,className:`w-6 h-6 md:w-9 md:h-9 flex items-center justify-center rounded-md border border-[#e0e0e0] transition-colors ${t===c?"opacity-40 cursor-not-allowed":"hover:bg-bg-5 hover:border-primary"}`,children:s.jsx(R,{className:"w-4 h-4"})})})]})})})})}function $(e){const{pagination:r,loading:t,onPageChange:c,type:o}=e,l=h.useMemo(()=>(r==null?void 0:r.total)>0,[r==null?void 0:r.total]);return s.jsx(s.Fragment,{children:l&&s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-center gap-4 mt-4",children:[s.jsx("div",{className:"text-text-titel-colortitel text-sm font-medium",children:s.jsx(j,{pagination:r,loading:t,type:o})}),t?s.jsx(u,{className:"h-8 w-48 rounded-md"}):s.jsx(_,{paginationData:r,onPageChange:c})]})})}export{$ as P};
//# sourceMappingURL=Pagination-D4i_uNKG.js.map
