(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.Vueginate={},d.Vue))})(this,function(d,e){"use strict";var oe=Object.defineProperty;var ce=(d,e,u)=>e in d?oe(d,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[e]=u;var B=(d,e,u)=>(ce(d,typeof e!="symbol"?e+"":e,u),u);var u=(t=>(t.Page="page",t.Ellipsis="ellipsis",t.Current="current",t))(u||{});class I{constructor(c,l){B(this,"number");B(this,"type");this.number=l==="ellipsis"?0:c,this.type=l}isCurrent(){return this.type==="current"}isEllipsis(){return this.type==="ellipsis"}isPage(){return this.type==="page"}}Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};function z(t,c,l,o,r){const a=e.computed(()=>Math.trunc(o.value)),i=e.computed(()=>{const n=Math.trunc(c.value),p=Math.trunc(l.value),y=Math.trunc(n/p);return n%p===0?y:y+1}),s=e.computed(()=>{const n=Math.trunc(t.value);return n<1?1:n>i.value?(e.warn("`currentPage` should not be greater than the total number of pages"),i.value):n}),h=e.computed(()=>s.value<=1),b=e.computed(()=>s.value>=i.value),E=e.computed(()=>b.value?s.value:s.value+1),w=e.computed(()=>h.value?s.value:s.value-1),C=e.computed(()=>{if(!r.value)return a.value;const n=1+a.value+2-s.value;return n<=0?a.value:a.value+n}),f=e.computed(()=>{if(!r.value)return a.value;const n=s.value-(i.value-a.value-2);return n<=0?a.value:a.value+n}),g=e.computed(()=>{const n=[];for(let p=1;p<=i.value;p++){const y=new I(p,k(p));if(y.isEllipsis()){const $=p1&&np}return{totalPages:i,currentPage:s,isFirstPage:h,previousPage:w,pages:g,isLastPage:b,nextPage:E}}const x=Object.freeze({container:["vueginate-container"],item:["vg-item"],page:["vg-page"],arrow:["vg-arrow"],active:["vg-active"],disabled:["vg-disabled"],readers:["sr-only"]});function M(t,c){function l(i){const s=i;return c.value===!1?[]:typeof c.value=="object"?c.value[s]??x[s]??[]:x[s]??[]}function o(i){return t.value[i]??[]}function r(i){const s=[];return s.push(...l(i)),s.push(...o(i)),s}return e.computed(()=>({container:r("container"),item:r("item"),page:r("page"),arrow:r("arrow"),active:r("active"),disabled:r("disabled"),readers:r("readers")}))}const V=(t,c)=>{const l=t.__vccOpts||t;for(const[o,r]of c)l[o]=r;return l},L={},T={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"100%",height:"100%",viewBox:"0 0 20 20",fill:"currentColor"},q=[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z","clip-rule":"evenodd"},null,-1)];function j(t,c){return e.openBlock(),e.createElementBlock("svg",T,q)}const N=V(L,[["render",j]]),A={},D={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"100%",height:"100%",viewBox:"0 0 20 20",fill:"currentColor"},F=[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)];function O(t,c){return e.openBlock(),e.createElementBlock("svg",D,F)}const P=V(A,[["render",O]]),G={key:0,"aria-label":"Page navigation"},R=["onClick"],_=e.defineComponent({__name:"VueginateCore",props:{totalItems:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>=0}},currentPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},itemsPerPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},pagesToShow:{type:Number,default:2,validator(t){return Number.isInteger(t)&&t>=-1}},visibleAlways:{type:Boolean},withDefaultStyles:{type:[Object,Boolean],default:()=>!0},customStyles:{type:Object,default:()=>({})},fixedLength:{type:Boolean,default:!0},containerType:{type:String,default:"ul",validator(t){return["ul","div"].includes(t)}}},emits:["page-change"],setup(t,{emit:c}){const l=t,o=e.toRefs(l),r=M(o.customStyles,o.withDefaultStyles),a=e.computed(()=>l.visibleAlways||i.value>1),{totalPages:i,currentPage:s,isFirstPage:h,previousPage:b,pages:E,isLastPage:w,nextPage:C}=z(o.currentPage,o.totalItems,o.itemsPerPage,o.pagesToShow,o.fixedLength);function f(g){g<1||g>i.value||g===s.value||c("page-change",g)}return(g,k)=>e.unref(a)?(e.openBlock(),e.createElementBlock("nav",G,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.containerType),{class:e.normalizeClass([e.unref(r).container])},{default:e.withCtx(()=>[e.renderSlot(g.$slots,"previous",{item:{isFirst:e.unref(h),target:e.unref(b),cssClass:[e.unref(r).item,e.unref(r).arrow,e.unref(h)?e.unref(r).disabled:[]]},emit:e.unref(h)?null:()=>f(e.unref(b))},()=>[e.createElementVNode("li",null,[e.unref(h)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass([e.unref(r).item,e.unref(r).arrow,e.unref(r).disabled])},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(r).readers)},"Prev Page",2),e.createVNode(P)],2)):(e.openBlock(),e.createElementBlock("a",{key:0,onClick:k[0]||(k[0]=e.withModifiers(m=>f(e.unref(b)),["prevent"])),class:e.normalizeClass([e.unref(r).item,e.unref(r).arrow]),href:"#"},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(r).readers)},"Prev Page",2),e.createVNode(P)],2))])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),m=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m},[m.isEllipsis()?e.renderSlot(g.$slots,"ellipsis",{key:0,item:{target:m.number,cssClass:[e.unref(r).item,e.unref(r).disabled]}},()=>[e.createElementVNode("li",null,[e.createElementVNode("span",{class:e.normalizeClass([e.unref(r).item,e.unref(r).disabled])},"…",2)])]):m.isCurrent()?e.renderSlot(g.$slots,"active",{key:1,item:{target:m.number,cssClass:[e.unref(r).item,e.unref(r).active]}},()=>[e.createElementVNode("li",null,[e.createElementVNode("span",{class:e.normalizeClass([e.unref(r).item,e.unref(r).active]),"aria-current":"page"},e.toDisplayString(m.number),3)])]):e.renderSlot(g.$slots,"item",{key:2,item:{target:m.number,cssClass:[e.unref(r).item,e.unref(r).page]},emit:()=>f(m.number)},()=>[e.createElementVNode("li",null,[e.createElementVNode("a",{onClick:e.withModifiers(S=>f(m.number),["prevent"]),class:e.normalizeClass([e.unref(r).item,e.unref(r).page]),href:"#"},e.toDisplayString(m.number),11,R)])])],64))),128)),e.renderSlot(g.$slots,"next",{item:{isLast:e.unref(w),target:e.unref(C),cssClass:[e.unref(r).item,e.unref(r).arrow,e.unref(w)?e.unref(r).disabled:[]]},emit:e.unref(w)?null:()=>f(e.unref(C))},()=>[e.createElementVNode("li",null,[e.unref(w)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass([e.unref(r).item,e.unref(r).arrow,e.unref(r).disabled])},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(r).readers)},"Next Page",2),e.createVNode(N)],2)):(e.openBlock(),e.createElementBlock("a",{key:0,onClick:k[1]||(k[1]=e.withModifiers(m=>f(e.unref(C)),["prevent"])),class:e.normalizeClass([e.unref(r).item,e.unref(r).arrow]),href:"#"},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(r).readers)},"Next Page",2),e.createVNode(N)],2))])])]),_:3},8,["class"]))])):e.createCommentVNode("",!0)}}),U=["onClick"],Y=[e.createElementVNode("span",{"aria-hidden":"true"},"«",-1)],H={key:1,class:"page-link","aria-label":"Previous"},J=[e.createElementVNode("span",{"aria-hidden":"true"},"«",-1)],K=[e.createElementVNode("span",{class:"page-link"},"…",-1)],Q={class:"page-link"},W=["onClick"],X=["onClick"],Z=[e.createElementVNode("span",{"aria-hidden":"true"},"»",-1)],v={key:1,class:"page-link","aria-label":"Next"},ee=[e.createElementVNode("span",{"aria-hidden":"true"},"»",-1)],te=e.defineComponent({__name:"VueginateBootstrap",props:{totalItems:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>=0}},currentPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},itemsPerPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},pagesToShow:{type:Number,default:2,validator(t){return Number.isInteger(t)&&t>=-1}},visibleAlways:{type:Boolean},customStyles:{type:Object,default:()=>({})},fixedLength:{type:Boolean,default:!0}},emits:["page-change"],setup(t,{emit:c}){function l(o){c("page-change",o)}return(o,r)=>(e.openBlock(),e.createBlock(_,{"total-items":t.totalItems,"current-page":t.currentPage,"items-per-page":t.itemsPerPage,"pages-to-show":t.pagesToShow,"with-default-styles":{container:["pagination"],item:["page-item"],page:[],active:["active"],arrow:[],disabled:["disabled"],readers:[]},"custom-styles":t.customStyles,"visible-always":t.visibleAlways,"fixed-length":t.fixedLength,onPageChange:l},{previous:e.withCtx(({item:a})=>[e.createElementVNode("li",{class:e.normalizeClass([a.cssClass])},[a.isFirst?(e.openBlock(),e.createElementBlock("span",H,J)):(e.openBlock(),e.createElementBlock("a",{key:0,class:"page-link",onClick:e.withModifiers(i=>l(a.target),["prevent"]),href:"#","aria-label":"Previous"},Y,8,U))],2)]),ellipsis:e.withCtx(({item:a})=>[e.createElementVNode("li",{class:e.normalizeClass([a.cssClass])},K,2)]),active:e.withCtx(({item:a})=>[e.createElementVNode("li",{class:e.normalizeClass([a.cssClass]),"aria-current":"page"},[e.createElementVNode("span",Q,e.toDisplayString(a.target),1)],2)]),item:e.withCtx(({item:a})=>[e.createElementVNode("li",{class:e.normalizeClass([a.cssClass])},[e.createElementVNode("a",{class:"page-link",onClick:e.withModifiers(i=>l(a.target),["prevent"]),href:"#"},e.toDisplayString(a.target),9,W)],2)]),next:e.withCtx(({item:a})=>[e.createElementVNode("li",{class:e.normalizeClass([a.cssClass])},[a.isLast?(e.openBlock(),e.createElementBlock("span",v,ee)):(e.openBlock(),e.createElementBlock("a",{key:0,class:"page-link",onClick:e.withModifiers(i=>l(a.target),["prevent"]),href:"#","aria-label":"Next"},Z,8,X))],2)]),_:1},8,["total-items","current-page","items-per-page","pages-to-show","custom-styles","visible-always","fixed-length"]))}}),ae=["onClick"],re=["aria-label"],ne=["onClick","aria-label"],se=["onClick"],le=e.defineComponent({__name:"VueginateBulma",props:{totalItems:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>=0}},currentPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},itemsPerPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},pagesToShow:{type:Number,default:2,validator(t){return Number.isInteger(t)&&t>=-1}},visibleAlways:{type:Boolean},customStyles:{type:Object,default:()=>({})},fixedLength:{type:Boolean,default:!0}},emits:["page-change"],setup(t,{emit:c}){function l(o){c("page-change",o)}return(o,r)=>(e.openBlock(),e.createBlock(_,{class:"pagination",role:"navigation","aria-label":"pagination","total-items":t.totalItems,"current-page":t.currentPage,"items-per-page":t.itemsPerPage,"pages-to-show":t.pagesToShow,"with-default-styles":{container:["pagination-list"],item:[],page:[],active:[],arrow:["p-2"],disabled:["is-disabled"],readers:["is-sr-only"]},"custom-styles":t.customStyles,"visible-always":t.visibleAlways,"fixed-length":t.fixedLength,onPageChange:l},{previous:e.withCtx(({item:a})=>[e.createElementVNode("li",null,[a.isFirst?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(["pagination-previous",[a.cssClass]])},[e.createVNode(P)],2)):(e.openBlock(),e.createElementBlock("a",{key:0,onClick:e.withModifiers(i=>l(a.target),["prevent"]),class:e.normalizeClass(["pagination-previous",[a.cssClass]])},[e.createVNode(P)],10,ae))])]),ellipsis:e.withCtx(({item:a})=>[e.createElementVNode("li",null,[e.createElementVNode("span",{class:e.normalizeClass(["pagination-ellipsis",a.cssClass])},"…",2)])]),active:e.withCtx(({item:a})=>[e.createElementVNode("li",null,[e.createElementVNode("span",{class:e.normalizeClass(["pagination-link is-current",a.cssClass]),"aria-label":`Page ${a.target}`,"aria-current":"page"},e.toDisplayString(a.target),11,re)])]),item:e.withCtx(({item:a})=>[e.createElementVNode("li",null,[e.createElementVNode("a",{class:e.normalizeClass(["pagination-link",a.cssClass]),onClick:e.withModifiers(i=>l(a.target),["prevent"]),"aria-label":`Goto page ${a.target}`},e.toDisplayString(a.target),11,ne)])]),next:e.withCtx(({item:a})=>[e.createElementVNode("li",null,[a.isLast?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(["pagination-next",[a.cssClass]])},[e.createVNode(N)],2)):(e.openBlock(),e.createElementBlock("a",{key:0,onClick:e.withModifiers(i=>l(a.target),["prevent"]),class:e.normalizeClass(["pagination-next",[a.cssClass]])},[e.createVNode(N)],10,se))])]),_:1},8,["total-items","current-page","items-per-page","pages-to-show","custom-styles","visible-always","fixed-length"]))}}),ie=e.defineComponent({__name:"VueginateTailwind",props:{totalItems:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>=0}},currentPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},itemsPerPage:{type:Number,required:!0,validator(t){return Number.isInteger(t)&&t>0}},pagesToShow:{type:Number,default:2,validator(t){return Number.isInteger(t)&&t>=-1}},visibleAlways:{type:Boolean},customStyles:{type:Object,default:()=>({})},fixedLength:{type:Boolean,default:!0}},emits:["page-change"],setup(t,{emit:c}){function l(o){c("page-change",o)}return(o,r)=>(e.openBlock(),e.createBlock(_,{"total-items":t.totalItems,"current-page":t.currentPage,"items-per-page":t.itemsPerPage,"pages-to-show":t.pagesToShow,"with-default-styles":{container:["flex","select-none","gap-1","text-xs","font-medium","text-gray-600"],item:["block","h-8","w-8","rounded","border","text-center","leading-8","[&:not(.active)]:border-gray-300","[&:not(.active)]:[&:not(.disabled)]:hover:border-gray-400","[&:not(.active)]:[&:not(.disabled)]:hover:bg-gray-50"],page:[],active:["active","bg-blue-50","text-blue-600","border-blue-500"],arrow:["arrow","p-2"],disabled:["disabled","bg-gray-200","opacity-50"],readers:["sr-only"]},"custom-styles":t.customStyles,"visible-always":t.visibleAlways,"fixed-length":t.fixedLength,onPageChange:l},null,8,["total-items","current-page","items-per-page","pages-to-show","with-default-styles","custom-styles","visible-always","fixed-length"]))}}),ye="";d.Vueginate=_,d.VueginateBootstrap=te,d.VueginateBulma=le,d.VueginateTailwind=ie,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});