import{F as e,bV as r,C as t,E as n,ao as a,S as c,a8 as l,as as o,G as i,bF as u,bH as h,ae as g,bL as s,bM as m,bN as d,bO as S}from"./index-C-dDkA_D.js";import{x,y as p,z as f}from"./index-BA8MiV3y.js";const z=z=>{var C;const $=e({maxShowPage:4,defaultPageSize:30,defaultCurrent:1,hideOnSinglePage:!0},z),[b,w]=r({pageSize:$.defaultPageSize,current:$.defaultCurrent});null==(C=$.setResetCallback)||C.call($,()=>{w("current",$.defaultCurrent)});const P=t(()=>Math.ceil($.total/b.pageSize)),k=t(()=>{const e=b.current,r=Math.max(2,e-Math.floor($.maxShowPage/2));return Array.from({length:e-r},(e,t)=>r+t)}),v=t(()=>{const e=b.current,r=Math.min(P()-1,e+Math.floor($.maxShowPage/2));return Array.from({length:r-e},(r,t)=>e+1+t)}),M=t(()=>Array.from({length:P()},(e,r)=>1+r)),y={"@initial":"sm","@md":"md"},_=e=>{var r;w("current",e),null==(r=$.onChange)||r.call($,e)};return n(c,{get when(){return!$.hideOnSinglePage||P()>1},get children(){return n(a,{spacing:"$1",get children(){return[n(c,{get when(){return 1!==b.current},get children(){return[n(l,{size:y,get colorScheme(){return $.colorScheme},onClick:()=>{_(1)},px:"$3",children:"1"}),n(o,{size:y,get icon(){return n(x,{})},"aria-label":"Previous",get colorScheme(){return $.colorScheme},onClick:()=>{_(b.current-1)},w:"2rem !important"})]}}),n(i,{get each(){return k()},children:e=>n(l,{size:y,get colorScheme(){return $.colorScheme},onClick:()=>{_(e)},px:e>10?"$2_5":"$3",children:e})}),n(u,{size:y,variant:"unstyled",get defaultValue(){return b.current},onChange:e=>{_(+e)},get children(){return[n(h,{as:l,size:y,width:"auto",px:"$1",variant:"solid",get colorScheme(){return $.colorScheme},get children(){return[n(g,{get px(){return b.current>10?"$1_5":"$2"},get children(){return b.current}}),n(p,{})]}}),n(s,{minW:"80px",get children(){return n(m,{get children(){return n(i,{get each(){return M()},children:e=>n(d,{value:e,get children(){return n(S,{px:"$2",children:e})}})})}})}})]}}),n(i,{get each(){return v()},children:e=>n(l,{size:y,get colorScheme(){return $.colorScheme},onClick:()=>{_(e)},px:e>10?"$2_5":"$3",children:e})}),n(c,{get when(){return b.current!==P()},get children(){return[n(o,{size:y,get icon(){return n(f,{})},"aria-label":"Next",get colorScheme(){return $.colorScheme},onClick:()=>{_(b.current+1)},w:"2rem !important"}),n(l,{size:y,get colorScheme(){return $.colorScheme},onClick:()=>{_(P())},get px(){return P()>10?"$2_5":"$3"},get children(){return P()}})]}})]}})}})};export{z as P};
