import{e as L,g as t,c as l,a as c,H as f,n as _,F as B,s as V,t as x,h as p,o as u,_ as j}from"./DAAb38x0.js";const E={key:0,class:"custom-pagination"},$=["disabled"],F={key:1,class:"custom-pagination__ellipsis"},N=["onClick"],z={key:2,class:"custom-pagination__ellipsis"},D=["disabled"],H=L({__name:"CustomPagination",props:{page:{default:1},total:{},pageCount:{default:10},maxVisible:{default:5}},emits:["update:page","change"],setup(w,{emit:P}){const d=w,h=P,s=p(()=>Math.ceil(d.total/d.pageCount)),e=p({get:()=>d.page,set:o=>{h("update:page",o),h("change",o)}}),g=p(()=>{const o=[],n=s.value,a=e.value,r=d.maxVisible;if(n<=r)for(let i=1;i<=n;i++)o.push(i);else{let i=Math.max(1,a-Math.floor(r/2));const v=Math.min(n,i+r-1);v-i+1<r&&(i=Math.max(1,v-r+1));for(let b=i;b<=v;b++)o.push(b)}return o}),k=p(()=>g.value[0]>1),C=p(()=>g.value[g.value.length-1]<s.value);function m(o){o<1||o>s.value||(e.value=o)}function y(){e.value>1&&(e.value-=1)}function M(){e.value<s.value&&(e.value+=1)}return(o,n)=>t(s)>0?(u(),l("nav",E,[c("button",{class:f(["custom-pagination__btn custom-pagination__btn--nav",{"custom-pagination__btn--disabled":t(e)===1}]),disabled:t(e)===1,onClick:y},[...n[2]||(n[2]=[c("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[c("path",{d:"M10.5 12L6.5 8L10.5 4",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],10,$),t(k)?(u(),l("button",{key:0,class:"custom-pagination__btn",onClick:n[0]||(n[0]=a=>m(1))}," 1 ")):_("",!0),t(k)?(u(),l("span",F,"...")):_("",!0),(u(!0),l(B,null,V(t(g),a=>(u(),l("button",{key:a,class:f(["custom-pagination__btn",{"custom-pagination__btn--active":a===t(e)}]),onClick:r=>m(a)},x(a),11,N))),128)),t(C)?(u(),l("span",z,"...")):_("",!0),t(C)?(u(),l("button",{key:3,class:"custom-pagination__btn",onClick:n[1]||(n[1]=a=>m(t(s)))},x(t(s)),1)):_("",!0),c("button",{class:f(["custom-pagination__btn custom-pagination__btn--nav",{"custom-pagination__btn--disabled":t(e)===t(s)}]),disabled:t(e)===t(s),onClick:M},[...n[3]||(n[3]=[c("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[c("path",{d:"M5.5 4L9.5 8L5.5 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],10,D)])):_("",!0)}}),O=Object.assign(j(H,[["__scopeId","data-v-8f52590c"]]),{__name:"CustomPagination"});export{O as _};
