(function(factory){if (typeof define === 'function' && define.amd){define(['jquery'], factory);} else if (typeof module === 'object' && typeof module.exports === 'object'){module.exports = factory(require('jquery'));} else {factory(jQuery);}}(function(jQuery){ /*! * tablesorter (FORK) pager plugin * updated 2020-03-03 (v2.31.3) */ !function(E){"use strict";var L=E.tablesorter;E.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(e,t){return t},ajaxError:null,ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(e){return e},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,maxOptionSize:20,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last",cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};function l(e,t,a,i,s,r){if("function"==typeof a.ajaxProcessing){t.config.$tbodies.eq(0).empty();var o,n,l,g,c,d,p,f,u,h,w,b,R=t.config,z=R.$table,x="",e=a.ajaxProcessing(e,t,i)||[0,[]];if(L.showError(t),r)L.debug(R,"pager")&&console.error("Pager >> Ajax Error",i,s,r),L.showError(t,i,s,r),R.$tbodies.eq(0).children("tr").detach(),a.totalRows=0;else{if(E.isArray(e)?(s=e[(i=isNaN(e[0])&&!isNaN(e[1]))?1:0],a.totalRows=isNaN(s)?a.totalRows||0:s,R.totalRows=R.filteredRows=a.filteredRows=a.totalRows,h=0!==a.totalRows&&e[i?0:1]||[],u=e[2]):(a.ajaxData=e,R.totalRows=a.totalRows=e.total,R.filteredRows=a.filteredRows=void 0!==e.filteredRows?e.filteredRows:e.total,u=e.headers,h=e.rows||[]),w=h&&h.length,h instanceof E)a.processAjaxOnInit&&(R.$tbodies.eq(0).empty(),R.$tbodies.eq(0).append(h));else if(w){for(o=0;o",n=0;n"+h[o][n]+"";x+=""}a.processAjaxOnInit&&R.$tbodies.eq(0).html(x)}if(a.processAjaxOnInit=!0,u)for(c=(l=z.hasClass("hasStickyHeaders"))?R.widgetOptions.$sticky.children("thead:first").children("tr:not(."+R.cssIgnoreRow+")").children():"",g=z.find("tfoot tr:first").children(),b=(d=R.$headers.filter("th ")).length,n=0;n> Triggering pagerChange"),z.triggerHandler("pagerChange",a),L.applyWidget(t),j(t,a,!0)},0)})}a.initialized||F(t,a)}function d(e,t){t.page=0,S(e,t)}function u(e,t){t.page=$(e,t)-1,S(e,t)}function p(e,t){t.page++;var a=$(e,t)-1;t.page>=a&&(t.page=a),S(e,t)}function f(e,t){t.page--,t.page<=0&&(t.page=0),S(e,t)}function h(e,t,a){var i,s,r=e.config;t.$container.find(t.cssGoto+","+t.cssPageSize+",.ts-startRow, .ts-page").removeClass(t.cssDisabled).removeAttr("disabled").each(function(){this.ariaDisabled=!1}),t.isDisabled=!1,t.page=E.data(e,"pagerLastPage")||t.page||0,i=(s=t.$container.find(t.cssPageSize)).find("option[selected]").val(),t.size=E.data(e,"pagerLastSize")||N(t,i,"get"),t.totalPages="all"===t.size?1:Math.ceil($(e,t)/t.size),A(e,t.size,t),e.id&&!r.$table.attr("aria-describedby")&&((i=(s=t.$container.find(t.cssPageDisplay)).attr("id"))||(i=e.id+"_pager_info",s.attr("id",i)),r.$table.attr("aria-describedby",i)),P(e,t),a&&(L.update(r),A(e,t.size,t),S(e,t),m(e,t),L.debug(r,"pager"))&&console.log("Pager >> Enabled")}var w=this,b=function(e,t,a){var i="addClass",s="removeClass",r=t.cssDisabled,a=!!a,o=a||0===t.page,e=$(e,t),n=a||t.page===e-1||0===e;t.updateArrows&&((a=t.$container.find(t.cssFirst+","+t.cssPrev))[o?i:s](r),a.each(function(){this.ariaDisabled=o}),(a=t.$container.find(t.cssNext+","+t.cssLast))[n?i:s](r),a.each(function(){this.ariaDisabled=n}))},R=function(e,t){var a,i,s,r=e.config,e=r.$table.hasClass("hasFilters");if(e&&!t.ajax)if(L.isEmptyObject(r.cache))t.filteredRows=t.totalRows=r.$tbodies.eq(0).children("tr").not(t.countChildRows?"":"."+r.cssChildRow).length;else for(t.filteredRows=0,s=(a=r.cache[0].normalized).length,i=0;io.filteredRows&&t,o.page=a?o.pageReset||0:o.page,o.startRow=!a&&0===o.filteredRows?0:p*o.page+1,o.endRow=Math.min(o.filteredRows,o.totalRows,p*(o.page+1)),i=o.$container.find(o.cssPageDisplay),g="function"==typeof o.output?o.output(e,o):(g=i.attr("data-pager-output"+(o.filteredRows'):1'+l[r]+"";s.html(a).val(o.page+1)}i.length&&(i["INPUT"===i[0].nodeName?"val":"html"](g),i.find(".ts-startRow, .ts-page").unbind("change"+d).bind("change"+d,function(){var e=E(this).val(),e=E(this).hasClass("ts-startRow")?Math.floor(e/p)+1:e;c.$table.triggerHandler("pageSet"+d,[e])}))}b(e,o),x(e,o),o.initialized&&!1!==t&&(L.debug(c,"pager")&&console.log("Pager >> Triggering pagerComplete"),c.$table.triggerHandler("pagerComplete",o),o.savePages)&&L.storage&&L.storage(e,o.storageKey,{page:o.page,size:p===o.totalRows?"all":p})}},z=function(e,t){for(var a,i,s=$(e,t)||1,r=5*Math.ceil(s/t.maxOptionSize/5),o=s>t.maxOptionSize,e=t.page+1,n=r,l=s-r,g=[1],c=o?r:1;c<=s;)g[g.length]=c,c+=o?r:1;if(g[g.length]=s,o){for(a=[],s<(l=e+(i=Math.max(Math.floor(t.maxOptionSize/r)-1,5)))&&(l=s),c=n=(n=e-i)<1?1:n;c<=l;c++)a[a.length]=c;r/2<(e=(g=E.grep(g,function(e,t){return E.inArray(e,g)===t})).length)-(i=a.length)&&e+i>t.maxOptionSize&&(n=Math.floor(e/2)-Math.floor(i/2),Array.prototype.splice.apply(g,[n,i])),g=g.concat(a)}return g=E.grep(g,function(e,t){return E.inArray(e,g)===t}).sort(function(e,t){return e-t})},x=function(e,t){var a,i,s=e.config,r=s.$tbodies.eq(0);r.find("tr.pagerSavedHeightSpacer").remove(),t.fixedHeight&&!t.isDisabled&&(a=E.data(e,"pagerSavedHeight"))&&(i=0,1')},P=function(e,t){var a=e.config,i=a.$tbodies.eq(0);i.find("tr.pagerSavedHeightSpacer").remove(),i.children("tr:visible").length||i.append(' '),a=i.children("tr").eq(0).height()*("all"===t.size?t.totalRows:t.size),E.data(e,"pagerSavedHeight",a),x(e,t),E.data(e,"pagerLastSize",t.size)},v=function(e,t){if(!t.ajaxUrl){var a,i=0,s=e.config,r=s.$tbodies.eq(0).children("tr"),o=r.length,e="all"===t.size?t.totalRows:t.size,n=t.page*e,l=n+e,g=-1,c=0;for(t.cacheIndex=[],a=0;a> Ajax url = "+r);return r}(s,r),o=E(document),t=s.config,n=t.namespace+"pager";""!==e&&(t.showProcessing&&L.isProcessing(s,!0),o.bind("ajaxError"+n,function(e,t,a,i){l(null,s,r,t,a,i),o.unbind("ajaxError"+n)}),i=++r.ajaxCounter,r.last.ajaxUrl=e,r.ajaxObject.url=e,r.ajaxObject.success=function(e,t,a){i> Ajax initialized",r.ajaxObject),E.ajax(r.ajaxObject))},g=function(e,t,a){var i,s,r,o,n=E(e),l=e.config,g=L.debug(l,"pager"),c=l.$table.hasClass("hasFilters"),d=t&&t.length||0,p="all"===a.size?a.totalRows:a.size,f=a.page*p;if(d<1)g&&console.warn("Pager >> No rows for pager to render");else{if(a.page>=a.totalPages&&u(e,a),a.cacheIndex=[],a.isDisabled=!1,a.initialized&&(g&&console.log("Pager >> Triggering pagerChange"),n.triggerHandler("pagerChange",a)),a.removeRows){for(L.clearTableBody(e),i=L.processTbody(e,l.$tbodies.eq(0),!0),r=s=c?0:f,o=0;o> Triggering updateComplete"),n.triggerHandler("updateComplete",[e,!0]))}},y=function(e,t){var a,i,s;for(t.ajax?b(e,t,!0):(E.data(e,"pagerLastPage",t.page),E.data(e,"pagerLastSize",t.size),t.page=0,t.size=t.totalRows,t.totalPages=1,E(e).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),g(e,e.config.rowsCopy,t),t.isDisabled=!0,L.applyWidget(e),L.debug(e.config,"pager")&&console.log("Pager >> Disabled")),s=(i=t.$container.find(t.cssGoto+","+t.cssPageSize+", .ts-startRow, .ts-page")).length,a=0;a> Changing to page "+t.page),t.last={page:t.page,size:t.size,sortList:(i.sortList||[]).join(","),totalRows:t.totalRows,currentFilters:t.currentFilters||[],ajaxUrl:t.ajaxObject.url||"",optAjaxUrl:t.ajaxUrl||""},t.ajax?(t.processAjaxOnInit||L.isEmptyObject(t.initialRows)?n:(t.processAjaxOnInit=!0,o=t.initialRows,t.totalRows=void 0!==o.total?o.total:s&&console.error("Pager >> No initial total page set!")||0,t.filteredRows=void 0!==o.filtered?o.filtered:s&&console.error("Pager >> No initial filtered page set!")||0,F))(e,t):t.ajax||g(e,i.rowsCopy,t),E.data(e,"pagerLastPage",t.page),t.initialized&&!1!==a&&(s&&console.log("Pager >> Triggering pageMoved"),r.triggerHandler("pageMoved",t),L.applyWidget(e),e.isUpdating)&&(s&&console.log("Pager >> Triggering updateComplete"),r.triggerHandler("updateComplete",[e,!0]))))},$=function(e,t){return L.hasWidget(e,"filter")?Math.min(t.totalPages,t.filteredPages):t.totalPages},I=function(e,t){e=$(e,t)-1;return t.page=parseInt(t.page,10),(t.page<0||isNaN(t.page))&&(t.page=0),t.page>e&&0<=e&&(t.page=e),t.page},N=function(e,t,a){var i=parseInt(t,10)||e.size||e.settings.size||10;return e.initialized&&(/all/i.test(i+" "+t)||i===e.totalRows)?e.$container.find(e.cssPageSize+' option[value="all"]').length?"all":e.totalRows:"get"===a?i:e.size},A=function(e,t,a){a.size=N(a,t,"get"),a.$container.find(a.cssPageSize).val(a.size),E.data(e,"pagerLastPage",I(e,a)),E.data(e,"pagerLastSize",a.size),a.totalPages="all"===a.size?1:Math.ceil(a.totalRows/a.size),a.filteredPages="all"===a.size?1:Math.ceil(a.filteredRows/a.size)},F=function(e,t){t.initialized=!0,t.initializing=!1,L.debug(e.config,"pager")&&console.log("Pager >> Triggering pagerInitialized"),E(e).triggerHandler("pagerInitialized",t),L.applyWidget(e),j(e,t)},O=function(r,e){var s,o,i=r.config,t=i.widgetOptions,a=L.debug(i,"pager"),n=i.pager=E.extend(!0,{},E.tablesorterPager.defaults,e),l=i.$table,g=i.namespace+"pager",c=n.$container=E(n.container).addClass("tablesorter-pager").show();n.settings=E.extend(!0,{},E.tablesorterPager.defaults,e),a&&console.log("Pager >> Initializing"),n.oldAjaxSuccess=n.oldAjaxSuccess||n.ajaxObject.success,i.appender=w.appender,n.initializing=!0,n.savePages&&L.storage&&(e=L.storage(r,n.storageKey)||{},n.page=(isNaN(e.page)?n:e).page,n.size="all"===e.size?e.size:(isNaN(e.size)?n:e).size||n.setSize||10,A(r,n.size,n)),n.regexRows=new RegExp("("+(t.filter_filteredRow||"filtered")+"|"+i.selectorRemove.slice(1)+"|"+i.cssChildRow+")"),n.regexFiltered=new RegExp(t.filter_filteredRow||"filtered"),l.unbind("filterInit filterStart filterEnd sortEnd disablePager enablePager destroyPager updateComplete pageSize pageSet pageAndSize pagerUpdate refreshComplete ".split(" ").join(g+" ").replace(/\s+/g," ")).bind("filterInit filterStart ".split(" ").join(g+" "),function(e,t){if(n.currentFilters=E.isArray(t)?t:i.$table.data("lastSearch"),n.ajax&&"filterInit"===e.type)return S(r,n,!1);t=L.filter.equalFilters?L.filter.equalFilters(i,i.lastSearch,n.currentFilters):(i.lastSearch||[]).join("")!==(n.currentFilters||[]).join(""),"filterStart"!==e.type||!1===n.pageReset||t||(n.page=n.pageReset)}).bind("filterEnd sortEnd ".split(" ").join(g+" "),function(){n.currentFilters=i.$table.data("lastSearch"),(n.initialized||n.initializing)&&(i.delayInit&&i.rowsCopy&&0===i.rowsCopy.length&&C(r),j(r,n,!1),S(r,n,!1),L.applyWidget(r))}).bind("disablePager"+g,function(e){e.stopPropagation(),y(r,n)}).bind("enablePager"+g,function(e){e.stopPropagation(),h(r,n,!0)}).bind("destroyPager"+g,function(e){var t,a,i,s;e.stopPropagation(),e=n,a=(t=r).config,i=a.namespace+"pager",s=[e.cssFirst,e.cssPrev,e.cssNext,e.cssLast,e.cssGoto,e.cssPageSize].join(","),y(t,e),e.$container.hide().find(s).unbind(i),a.appender=null,a.$table.unbind(i),L.storage&&L.storage(t,e.storageKey,""),delete a.pager,delete a.rowsCopy}).bind("resetToLoadState"+g,function(e){var t;e.stopPropagation(),e=n,(t=r).config.pager=E.extend(!0,{},E.tablesorterPager.defaults,e.settings),O(t,e.settings)}).bind("updateComplete"+g,function(e,t,a){e.stopPropagation(),!t||a||n.ajax||(e=i.$tbodies.eq(0).children("tr").not(i.selectorRemove),n.totalRows=e.length-(n.countChildRows?0:e.filter("."+i.cssChildRow).length),n.totalPages="all"===n.size?1:Math.ceil(n.totalRows/n.size),e.length&&i.rowsCopy&&0===i.rowsCopy.length&&C(t),n.page>=n.totalPages&&u(t,n),v(t,n),P(t,n),j(t,n,!0))}).bind("pageSize refreshComplete ".split(" ").join(g+" "),function(e,t){e.stopPropagation(),A(r,N(n,t,"get"),n),S(r,n),v(r,n),j(r,n,!1)}).bind("pageSet pagerUpdate ".split(" ").join(g+" "),function(e,t){e.stopPropagation(),"pagerUpdate"===e.type&&(t=void 0===t?n.page+1:t,n.last.page=!0),n.page=(parseInt(t,10)||1)-1,S(r,n,!0),j(r,n,!1)}).bind("pageAndSize"+g,function(e,t,a){e.stopPropagation(),n.page=(parseInt(t,10)||1)-1,A(r,N(n,a,"get"),n),S(r,n,!0),v(r,n),j(r,n,!1)}),s=[n.cssFirst,n.cssPrev,n.cssNext,n.cssLast],o=[d,f,p,u],a&&!c.length&&console.warn('Pager >> "container" not found'),c.find(s.join(",")).attr("tabindex",0).unbind("click"+g).bind("click"+g,function(e){e.stopPropagation();var t,a=E(this),i=s.length;if(!a.hasClass(n.cssDisabled))for(t=0;t> "goto" selector not found'),(e=c.find(n.cssPageSize)).length?(e.find("option").removeAttr("selected"),e.unbind("change"+g).bind("change"+g,function(){var e;return E(this).hasClass(n.cssDisabled)||(e=E(this).val(),A(r,e,n),S(r,n),P(r,n)),!1})):a&&console.warn('Pager >> "size" selector not found'),n.initialized=!1,l.triggerHandler("pagerBeforeInitialized",n),h(r,n,!1),("string"==typeof n.ajaxUrl?(n.ajax=!0,i.widgetOptions.filter_serversideFiltering=!0,i.serverSideSorting=!0,S):(n.ajax=!1,L.appendCache(i,!0),m))(r,n),n.ajax||n.initialized||(n.initializing=!1,n.initialized=!0,A(r,n.size,n),S(r,n),a&&console.log("Pager >> Triggering pagerInitialized"),i.$table.triggerHandler("pagerInitialized",n),i.widgetOptions.filter_initialized&&L.hasWidget(r,"filter"))||j(r,n,!1),i.widgetInit.pager=!0};w.appender=function(e,t){var a=e.config,i=a.pager;i.ajax||(a.rowsCopy=t,i.totalRows=(i.countChildRows?a.$tbodies.eq(0).children("tr"):t).length,i.size=E.data(e,"pagerLastSize")||i.size||i.settings.size||10,i.totalPages="all"===i.size?1:Math.ceil(i.totalRows/i.size),g(e,t,i),j(e,i,!1))},w.construct=function(e){return this.each(function(){this.config&&this.hasInitialized&&O(this,e)})}}}),L.showError=function(e,t,a,i){function s(){r.$table.find("thead").find(r.selectorRemove).remove()}var e=E(e),r=e[0].config,o=r&&r.widgetOptions,n=r.pager&&r.pager.cssErrorRow||o&&o.pager_css&&o.pager_css.errorRow||"tablesorter-errorRow",l=typeof t,g=!0,c="";if(e.length){if("function"==typeof r.pager.ajaxError){if(!1===(g=r.pager.ajaxError(r,t,a,i)))return s();c=g}else if("function"==typeof o.pager_ajaxError){if(!1===(g=o.pager_ajaxError(r,t,a,i)))return s();c=g}if(""===c)if("object"==l)c=0===t.status?"Not connected, verify Network":404===t.status?"Requested page not found [404]":500===t.status?"Internal Server Error [500]":"parsererror"===i?"Requested JSON parse failed":"timeout"===i?"Time out error":"abort"===i?"Ajax Request aborted":"Uncaught error: "+t.statusText+" ["+t.status+"]";else{if("string"!=l)return s();c=t}E(/tr\>/.test(c)?c:''+c+"").click(function(){E(this).remove()}).appendTo(r.$table.find("thead:first")).addClass(n+" "+r.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"})}else console.error("tablesorter showError: no table parameter passed")},E.fn.extend({tablesorterPager:E.tablesorterPager.construct})}(jQuery);return jQuery;}));