"use strict";function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}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 f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);cb})||0;if(d!==g){var k=b.before,l=c[d.toString()],m=f[d.toString()];for(var p in l){var n=l[p],o=m[p];if("string"==typeof e&&1===n){var i=j(b.link,n.toString(),o);k+=Pagy.trim(i,e)}else k+="number"==typeof n?j(b.link,n.toString(),o):"gap"===n?b.gap:j(b.active,n,o)}k+=b.after,a.innerHTML="",a.insertAdjacentHTML("afterbegin",k),g=d}},a.pagyRender(),"undefined"!=typeof window){var l=0;window.addEventListener("resize",function(){clearTimeout(l),l=window.setTimeout(Pagy.renderNavs,100)},!0)}},renderNavs:function renderNavs(){var a=document.getElementsByClassName("pagy-njs");Array.from(a).forEach(function(a){return a.pagyRender()})},comboNav:function comboNav(a,b,c,d){var e=a.getElementsByTagName("input")[0];Pagy.addInputBehavior(e,function(){if(b!==e.value){var f=c.replace(/__pagy_page__/,e.value);"string"==typeof d&&"1"===e.value&&(f=Pagy.trim(f,d)),a.insertAdjacentHTML("afterbegin",f),a.getElementsByTagName("a")[0].click()}})},itemsSelector:function itemsSelector(a,b,c,d){var e=a.getElementsByTagName("input")[0],f=e.value;Pagy.addInputBehavior(e,function(){var g=Math.max,h=Math.ceil,i=e.value;if("0"!==i&&""!==i&&f!==i){var j=g(h(b/parseInt(i)),1).toString(),k=c.replace(/__pagy_page__/,j).replace(/__pagy_items__/,i);"string"==typeof d&&"1"===j&&(k=Pagy.trim(k,d)),a.insertAdjacentHTML("afterbegin",k),a.getElementsByTagName("a")[0].click()}})},addInputBehavior:function addInputBehavior(a,b){a.addEventListener("click",a.select),a.addEventListener("focusout",b),a.addEventListener("keypress",function(a){"Enter"===a.key&&b()})},trim:function trim(a,b){return a.replace(new RegExp("[?&]".concat(b,"=1\\b(?!&)|\\b").concat(b,"=1&")),"")}}; //# sourceMappingURL=pagy.js.map