!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.PaginationBarGenerator=e():t.PaginationBarGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{PageItems:()=>r,Paginator:()=>ot,PaginatorBuildErrors:()=>n,PaginatorBuilder:()=>ut,PaginatorIter:()=>at,YesNoDepends:()=>X,pageItemsToString:()=>ft,stringToYesNoDepends:()=>Z});var r={};t.r(r),t.d(r,{CurrentPage:()=>P,Ignore:()=>b,Next:()=>d,Page:()=>v,PageItem:()=>y,PageItemWithNumber:()=>p,Prev:()=>m,ReservedNext:()=>_,ReservedPrev:()=>S,currentPage:()=>k,ignore:()=>j,next:()=>N,page:()=>w,prev:()=>O,reservedNext:()=>T,reservedPrev:()=>z});var n={};function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e,r){return e=a(e),function(t,e){if(e&&("object"==i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,u()?Reflect.construct(e,r||[],a(t).constructor):e.apply(t,r))}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(u=function(){return!!t})()}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var r=0;rW,CurrentPageTooLarge:()=>Q,EndSizeIncorrect:()=>K,MaxItemCountIncorrect:()=>q,MaxItemCountTooSmall:()=>V,PaginatorBuildError:()=>U,StartSizeIncorrect:()=>J,TotalPagesIncorrect:()=>$});var y=function(){return l((function t(){f(this,t)}),[{key:"isPage",value:function(){return!1}},{key:"isCurrentPage",value:function(){return!1}},{key:"isIgnore",value:function(){return!1}},{key:"isPrev",value:function(){return!1}},{key:"isNext",value:function(){return!1}},{key:"isReservedPrev",value:function(){return!1}},{key:"isReservedNext",value:function(){return!1}}])}(),p=function(t){function e(t){var r;return f(this,e),(r=o(this,e)).pageNumber=t,r}return s(e,t),l(e)}(y),v=function(t){function e(){return f(this,e),o(this,e,arguments)}return s(e,t),l(e,[{key:"toString",value:function(){return this.pageNumber.toString()}},{key:"isPage",value:function(){return!0}}])}(p),P=function(t){function e(){return f(this,e),o(this,e,arguments)}return s(e,t),l(e,[{key:"toString",value:function(){return"".concat(this.pageNumber,"*")}},{key:"isCurrentPage",value:function(){return!0}}])}(p),b=function(t){function e(){return f(this,e),o(this,e,arguments)}return s(e,t),l(e,[{key:"toString",value:function(){return"..."}},{key:"isIgnore",value:function(){return!0}}])}(y),m=function(t){function e(){return f(this,e),o(this,e,arguments)}return s(e,t),l(e,[{key:"toString",value:function(){return"<"}},{key:"isPrev",value:function(){return!0}}])}(p),d=function(t){function e(){return f(this,e),o(this,e,arguments)}return s(e,t),l(e,[{key:"toString",value:function(){return">"}},{key:"isNext",value:function(){return!0}}])}(p),S=function(t){function e(){return f(this,e),o(this,e,arguments)}return s(e,t),l(e,[{key:"toString",value:function(){return")"}},{key:"isReservedPrev",value:function(){return!0}}])}(y),_=function(t){function e(){return f(this,e),o(this,e,arguments)}return s(e,t),l(e,[{key:"toString",value:function(){return"("}},{key:"isReservedNext",value:function(){return!0}}])}(y),w=function(t){return new v(t)},k=function(t){return new P(t)},x=new b,I=new S,C=new _,j=function(){return x},O=function(t){return new m(t)},N=function(t){return new d(t)},z=function(){return I},T=function(){return C};function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function M(t,e){for(var r=0;r1&&this.totalPages>2,n=this.hasNext===X.Yes||this.hasNext===X.Depends&&this.currentPage2;if(r){var i=this.currentPage-1;0===i?t.push(z()):t.push(O(i)),e-=1}n&&(e-=1);var o=Math.min(this.startSize,this.totalPages),u=Math.min(this.endSize,this.totalPages),a=!1,s=!1;if(this.totalPages>e&&(a=this.currentPage>2+o,s=this.totalPages-this.currentPage>u),a)if(e-=o+2,s){e-=u+1;for(var c=1;c<=o;c++)t.push(w(c));var f=e>>1,h=this.currentPage-f,l=this.currentPage-1,g=this.currentPage+1,y=this.currentPage+(e-f),p=this.totalPages-this.endSize+1;if(o+2>=h){var v=h;y+=(h=o+1)+1-v}else{if(t.push(j()),y+2>p)h-=y-(y=p-2)}for(var P=h;P<=l;P++)t.push(w(P));t.push(k(this.currentPage));for(var b=g;b<=y;b++)t.push(w(b));y+2===p?t.push(w(y+1)):t.push(j());for(var m=p;m<=this.totalPages;m++)t.push(w(m))}else{this.currentPagethis.totalPages?t.push(T()):t.push(N(B))}return t}}],[{key:"builder",value:function(t){return new ut(t)}}])}(),ut=function(){function t(e){et(this,t),this._totalPages=e,this._currentPage=1,this._maxItemCount=9,this._startSize=1,this._endSize=1,this._hasPrev=X.Depends,this._hasNext=X.Depends}return nt(t,[{key:"getTotalPages",value:function(){return this._totalPages}},{key:"totalPages",value:function(t){return this._totalPages=t,this}},{key:"getCurrentPage",value:function(){return this._currentPage}},{key:"currentPage",value:function(t){return this._currentPage=t,this}},{key:"getMaxItemCount",value:function(){return this._maxItemCount}},{key:"maxItemCount",value:function(t){return this._maxItemCount=t,this}},{key:"getStartSize",value:function(){return this._startSize}},{key:"startSize",value:function(t){return this._startSize=t,this}},{key:"getEndSize",value:function(){return this._endSize}},{key:"endSize",value:function(t){return this._endSize=t,this}},{key:"getHasPrev",value:function(){return this._hasPrev}},{key:"hasPrev",value:function(t){return this._hasPrev=t,this}},{key:"getHasNext",value:function(){return this._hasNext}},{key:"hasNext",value:function(t){return this._hasNext=t,this}},{key:"computeMinItemCount",value:function(){switch(this._totalPages){case 0:case 1:case 2:return this._totalPages;default:var t=Math.min(this._startSize,this._totalPages)+Math.min(this._endSize,this._totalPages),e=Math.min(t+3,this._totalPages);return this._hasPrev!==X.No&&(e+=1),this._hasNext!==X.No&&(e+=1),e}}},{key:"buildCheckCommon",value:function(){if(!Number.isSafeInteger(this._currentPage)||this._currentPage<=0)throw new W;if(!Number.isSafeInteger(this._totalPages)||this._totalPages<=0)throw new $;if(!Number.isSafeInteger(this._maxItemCount))throw new q;if(!Number.isSafeInteger(this._startSize)||this._startSize<0)throw new J;if(!Number.isSafeInteger(this._endSize)||this._endSize<0)throw new K;if(this._currentPage>this._totalPages)throw new Q(this._currentPage,this._totalPages);var t=this.computeMinItemCount();if(this._maxItemCount=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,o=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw o}}}}function ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r