1import{r as h,j as u}from"./components-5FRlAwVN.js";import{f as v}from"./constants-BFwIr2YJ.js";const b=e=>{const{totalPage:a,currentPage:i,siblingCount:m=1}=e;return h.useMemo(()=>{if(m*2+5>=a)return x(1,a);const r=Math.max(i-m,1),P=Math.min(i+m,a),c=r>3,l=P<a-2,t=1,o=a;if(!c&&l){let g=3+2*m;return[...x(1,g),_,a]}if(c&&!l){let g=3+2*m,n=x(a-g+1,a);return[t,_,...n]}if(c&&l){let g=x(r,P);return[t,_,...g,_,o]}return x(1,a)},[a,i,m])},_="...",x=(e,a)=>{let i=a-e+1;return Array.from({length:i},(m,r)=>r+e)},j=e=>{const{totalPage:a,selectedPage:i,nextElm:m="Next",prevElm:r=" Previous",dotElm:P="...",siblingCount:c=1,loop:l=!1,classes:t}=e,o=b({totalPage:a,currentPage:i,siblingCount:c}),g=o?o[o.length-1]:0;return u.jsxs("ul",{className:v("com-pagination-pages text-body2",t==null?void 0:t.root),children:[u.jsx("li",{className:v("com-pagination-pages__nav-item",t==null?void 0:t.navItem,{[`com-pagination-pages__nav-item--disable${t!=null&&t.navItemDisable?` ${t.navItemDisable}`:""}`]:i===1&&!l}),onClick:()=>{var n;return(n=e.onPagePrev)==null?void 0:n.call(e)},children:r}),o==null?void 0:o.map((n,d)=>n===_?u.jsx("li",{className:v("com-pagination-pages__page-dot",t==null?void 0:t.pageDot),children:P},d):u.jsx("li",{className:v("com-pagination-pages__page-item",t==null?void 0:t.pageItem,{[`com-pagination-pages__page-item--active${t!=null&&t.pageItemActive?` ${t.pageItemActive}`:""}`]:i===n}),onClick:()=>{var f;return(f=e.onPageSelected)==null?void 0:f.call(e,n)},children:n.toString().padStart(2,"0")},d)),u.jsx("li",{className:v("com-pagination-pages__nav-item",t==null?void 0:t.navItem,{[`com-pagination-pages__nav-item--disable${t!=null&&t.navItemDisable?` ${t.navItemDisable}`:""}`]:i===g&&!l}),onClick:()=>{var n;return(n=e.onPageNext)==null?void 0:n.call(e)},children:m})]})};export{j as B};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.