import{I as f}from"./index-4b46c3db.js";import{_ as x,r as y,o as r,b as n,d as l,t as o,j as u,h as g,e as P,F as h,m as v,I as p,M as _,K as I,L as b}from"./index-be2d4151.js";const C={components:{Icon:f},props:{currentPage:{type:Number,required:!0},totalItems:{type:Number,default:0},totalPages:{type:Number,required:!0},itemsPerPage:{type:Number,required:!0},pageOptions:{type:Array},pageNumberClass:{type:String},inactiveClass:{type:String,default:"bg-slate-50 text-slate-700"},activeClass:{type:String,default:"bg-slate-900 text-white"}},data(){return{selectedItemsPerPage:this.itemsPerPage,itemsPerPageOptions:this.pageOptions??[5,10,20,50,100]}},computed:{pages(){let t=[],a=Math.max(1,this.currentPage-2),e=Math.min(this.totalPages,this.currentPage+2);e-a<4&&(a===1?e=Math.min(5,this.totalPages):e===this.totalPages&&(a=Math.max(1,this.totalPages-4)));for(let c=a;c<=e;c++)t.push(c);return t},countStart:function(){return(this.currentPage-1)*this.selectedItemsPerPage+1},countEnd:function(){let t=this.currentPage*this.selectedItemsPerPage;return t>this.totalItems?this.totalItems:t}},methods:{changeItemsPerPage(){this.$emit("changeItemsPerPage",this.selectedItemsPerPage)}}},k=t=>(I("data-v-2e539a7b"),t=t(),b(),t),S={class:"mt-4 grid grid-cols-3 space-x-2 px-6"},N={key:0,class:"self-center text-slate-700"},M={class:"flex-grow flex justify-center items-center space-x-2"},w=["onClick"],B={class:"flex space-x-4 justify-end"},O=k(()=>l("span",null,"per page",-1)),V=["value"],j={class:"text-slate-700 text-sm"};function q(t,a,e,c,d,i){const m=y("Icon");return r(),n("div",S,[l("div",null,[e.totalItems?(r(),n("div",N,o(`${i.countStart}-${i.countEnd}`)+" of "+o(e.totalItems)+" "+o(e.totalItems>1?"records":"record"),1)):u("",!0)]),l("div",M,[e.currentPage!==1?(r(),n("button",{key:0,class:g(["px-2 py-0 text-gray-800 rounded-full text-2xl text-slate-300 hover:text-primary-900 hover:font-semibold",t.prevBtnClass]),onClick:a[0]||(a[0]=s=>t.$emit("changePage",e.currentPage-1))},[P(m,{icon:"carbon:chevron-left"})],2)):u("",!0),e.totalPages>1?(r(!0),n(h,{key:1},v(i.pages,s=>(r(),n("button",{key:s,class:g(["px-2 py-0 rounded-full border border-slate-900",e.pageNumberClass,s===e.currentPage?e.activeClass:e.inactiveClass]),onClick:E=>t.$emit("changePage",s)},o(s),11,w))),128)):u("",!0),e.currentPage!==e.totalPages?(r(),n("button",{key:2,class:g(["px-2 py-0 text-gray-800 rounded-full text-2xl text-slate-300 hover:text-primary-900 hover:font-semibold",t.nextBtnClass]),onClick:a[1]||(a[1]=s=>t.$emit("changePage",e.currentPage+1))},[P(m,{icon:"carbon:chevron-right",class:""})],2)):u("",!0)]),l("div",B,[l("div",null,[O,p(l("select",{class:"ml-4 px-2 py-1 bg-white border rounded","onUpdate:modelValue":a[2]||(a[2]=s=>d.selectedItemsPerPage=s),onChange:a[3]||(a[3]=(...s)=>i.changeItemsPerPage&&i.changeItemsPerPage(...s))},[(r(!0),n(h,null,v(d.itemsPerPageOptions,s=>(r(),n("option",{key:s,value:s},o(s),9,V))),128))],544),[[_,d.selectedItemsPerPage]])]),l("div",null,[l("span",j,"Page "+o(e.currentPage)+" of "+o(e.totalPages),1)])])])}const L=x(C,[["render",q],["__scopeId","data-v-2e539a7b"]]);export{L as P};