/*! Widget: Pager - updated 5/1/2016 (v2.26.0) */ !function(a){"use strict";var b,c=a.tablesorter;c.addWidget({id:"pager",priority:55,options:{pager_output:"{startRow} to {endRow} of {totalRows} rows",pager_updateArrows:!0,pager_startPage:0,pager_pageReset:0,pager_size:10,pager_maxOptionSize:20,pager_savePages:!0,pager_storageKey:"tablesorter-pager",pager_fixedHeight:!1,pager_countChildRows:!1,pager_removeRows:!1,pager_ajaxUrl:null,pager_customAjaxUrl:function(a,b){return b},pager_ajaxError:null,pager_ajaxObject:{dataType:"json"},pager_processAjaxOnInit:!0,pager_ajaxProcessing:function(a){return[0,[],null]},pager_css:{container:"tablesorter-pager",errorRow:"tablesorter-errorRow",disabled:"disabled"},pager_selectors:{container:".pager",first:".first",prev:".prev",next:".next",last:".last",gotoPage:".gotoPage",pageDisplay:".pagedisplay",pageSize:".pagesize"}},init:function(a){b.init(a)},format:function(a,c){return c.pager&&c.pager.initialized?void b.moveToPage(c,c.pager,!1):b.initComplete(c)},remove:function(a,c,d,e){b.destroyPager(c,e)}}),b=c.pager={init:function(d){if(!(d.hasInitialized&&d.config.pager&&d.config.pager.initialized)){var e,f=d.config,g=f.widgetOptions,h=g.pager_selectors,i=f.pager=a.extend({totalPages:0,filteredRows:0,filteredPages:0,currentFilters:[],page:g.pager_startPage,startRow:0,endRow:0,ajaxCounter:0,$size:null,last:{},setSize:g.pager_size,setPage:g.pager_startPage},f.pager);i.isInitializing||(i.isInitializing=!0,f.debug&&console.log("Pager: Initializing"),i.size=a.data(d,"pagerLastSize")||g.pager_size,i.$container=a(h.container).addClass(g.pager_css.container).show(),i.$goto=i.$container.find(h.gotoPage),i.$size=i.$container.find(h.pageSize),i.totalRows=f.$tbodies.eq(0).children("tr").not(g.pager_countChildRows?"":"."+f.cssChildRow).length,i.oldAjaxSuccess=i.oldAjaxSuccess||g.pager_ajaxObject.success,f.appender=b.appender,i.initializing=!0,g.pager_savePages&&c.storage&&(e=c.storage(d,g.pager_storageKey)||{},i.page=(isNaN(e.page)?i.page:e.page)||i.setPage||0,i.size="all"===e.size?e.size:(isNaN(e.size)?i.size:e.size)||i.setSize||10,a.data(d,"pagerLastSize",i.size),i.$size.val(i.size)),i.regexRows=new RegExp("("+(g.filter_filteredRow||"filtered")+"|"+f.selectorRemove.slice(1)+"|"+f.cssChildRow+")"),i.initialized=!1,f.$table.triggerHandler("pagerBeforeInitialized",f),b.enablePager(f,!1),i.ajaxObject=g.pager_ajaxObject,i.ajaxObject.url=g.pager_ajaxUrl,"string"==typeof g.pager_ajaxUrl?(i.ajax=!0,g.filter_serversideFiltering=!0,f.serverSideSorting=!0,b.moveToPage(f,i)):(i.ajax=!1,c.appendCache(f,!0)))}},initComplete:function(a){var d=a.pager;b.bindEvents(a),b.setPageSize(a,0),d.ajax||b.hideRowsSetup(a),d.initialized=!0,d.initializing=!1,d.isInitializing=!1,a.debug&&console.log("Pager: Triggering pagerInitialized"),a.$table.triggerHandler("pagerInitialized",a),a.widgetOptions.filter_initialized&&c.hasWidget(a.table,"filter")||b.updatePageDisplay(a,!d.ajax)},bindEvents:function(d){var e,f,g=d.pager,h=d.widgetOptions,i=d.namespace+"pager",j=h.pager_selectors;d.$table.off(i).on("filterInit filterStart ".split(" ").join(i+" "),function(b,c){g.currentFilters=a.isArray(c)?c:d.$table.data("lastSearch"),"filterStart"===b.type&&h.pager_pageReset!==!1&&(d.lastCombinedFilter||"")!==(g.currentFilters||[]).join("")&&(g.page=h.pager_pageReset)}).on("filterEnd sortEnd ".split(" ").join(i+" "),function(){g.currentFilters=d.$table.data("lastSearch"),(g.initialized||g.initializing)&&(d.delayInit&&d.rowsCopy&&0===d.rowsCopy.length&&b.updateCache(d),b.updatePageDisplay(d,!1),c.applyWidget(d.table))}).on("disablePager"+i,function(a){a.stopPropagation(),b.showAllRows(d)}).on("enablePager"+i,function(a){a.stopPropagation(),b.enablePager(d,!0)}).on("destroyPager"+i,function(a,b){a.stopPropagation(),c.removeWidget(d.table,"pager",!1)}).on("updateComplete"+i,function(a,e,f){if(a.stopPropagation(),e&&!f&&!g.ajax){var i=d.$tbodies.eq(0).children("tr").not(d.selectorRemove);g.totalRows=i.length-(h.pager_countChildRows?0:i.filter("."+d.cssChildRow).length),g.totalPages="all"===g.size?1:Math.ceil(g.totalRows/g.size),i.length&&d.rowsCopy&&0===d.rowsCopy.length&&b.updateCache(d),g.page>=g.totalPages&&b.moveToLastPage(d,g),b.hideRows(d),b.changeHeight(d),b.updatePageDisplay(d,!1),c.applyWidget(e),b.updatePageDisplay(d)}}).on("pageSize refreshComplete ".split(" ").join(i+" "),function(a,c){a.stopPropagation(),b.setPageSize(d,b.parsePageSize(d,c,"get")),b.hideRows(d),b.updatePageDisplay(d,!1)}).on("pageSet pagerUpdate ".split(" ").join(i+" "),function(a,c){a.stopPropagation(),"pagerUpdate"===a.type&&(c="undefined"==typeof c?g.page+1:c,g.last.page=!0),g.page=(parseInt(c,10)||1)-1,b.moveToPage(d,g,!0),b.updatePageDisplay(d,!1)}).on("pageAndSize"+i,function(a,c,e){a.stopPropagation(),g.page=(parseInt(c,10)||1)-1,b.setPageSize(d,b.parsePageSize(d,e,"get")),b.moveToPage(d,g,!0),b.hideRows(d),b.updatePageDisplay(d,!1)}),e=[j.first,j.prev,j.next,j.last],f=["moveToFirstPage","moveToPrevPage","moveToNextPage","moveToLastPage"],d.debug&&!g.$container.length&&console.warn("Pager: >> Container not found"),g.$container.find(e.join(",")).attr("tabindex",0).off("click"+i).on("click"+i,function(c){c.stopPropagation();var i,j=a(this),k=e.length;if(!j.hasClass(h.pager_css.disabled))for(i=0;k>i;i++)if(j.is(e[i])){b[f[i]](d,g);break}}),g.$goto.length?g.$goto.off("change"+i).on("change"+i,function(){g.page=a(this).val()-1,b.moveToPage(d,g,!0),b.updatePageDisplay(d,!1)}):d.debug&&console.warn("Pager: >> Goto selector not found"),g.$size.length?(g.$size.find("option").removeAttr("selected"),g.$size.off("change"+i).on("change"+i,function(){if(!a(this).hasClass(h.pager_css.disabled)){var c=a(this).val();g.$size.val(c),b.setPageSize(d,c),b.changeHeight(d)}return!1})):d.debug&&console.warn("Pager: >> Size selector not found")},pagerArrows:function(a,c){var d=a.pager,e=!!c,f=e||0===d.page,g=b.getTotalPages(a,d),h=e||d.page===g-1||0===g,i=a.widgetOptions,j=i.pager_selectors;i.pager_updateArrows&&(d.$container.find(j.first+","+j.prev).toggleClass(i.pager_css.disabled,f).attr("aria-disabled",f),d.$container.find(j.next+","+j.last).toggleClass(i.pager_css.disabled,h).attr("aria-disabled",h))},calcFilters:function(b){var c,d,e,f=b.widgetOptions,g=b.pager,h=b.$table.hasClass("hasFilters");if(h&&!f.pager_ajaxUrl)if(a.isEmptyObject(b.cache))g.filteredRows=g.totalRows=b.$tbodies.eq(0).children("tr").not(f.pager_countChildRows?"":"."+b.cssChildRow).length;else for(g.filteredRows=0,c=b.cache[0].normalized,e=c.length,d=0;e>d;d++)g.filteredRows+=g.regexRows.test(c[d][b.columns].$row[0].className)?0:1;else h||(g.filteredRows=g.totalRows)},updatePageDisplay:function(d,e){if(!d.pager||!d.pager.initializing){var f,g,h,i,j,k,l=d.table,m=d.widgetOptions,n=d.pager,o=d.namespace+"pager",p=b.parsePageSize(d,n.size,"get");if("all"===p&&(p=n.totalRows),m.pager_countChildRows&&(g[g.length]=d.cssChildRow),n.$size.add(n.$goto).removeClass(m.pager_css.disabled).removeAttr("disabled").attr("aria-disabled","false"),n.totalPages=Math.ceil(n.totalRows/p),d.totalRows=n.totalRows,b.parsePageNumber(d,n),b.calcFilters(d),d.filteredRows=n.filteredRows,n.filteredPages=Math.ceil(n.filteredRows/p)||0,b.getTotalPages(d,n)>=0){if(g=p*n.page>n.filteredRows&&e,n.page=g?m.pager_pageReset||0:n.page,n.startRow=g?p*n.page+1:0===n.filteredRows?0:p*n.page+1,n.endRow=Math.min(n.filteredRows,n.totalRows,p*(n.page+1)),h=n.$container.find(m.pager_selectors.pageDisplay),f=(n.ajaxData&&n.ajaxData.output?n.ajaxData.output||m.pager_output:m.pager_output).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return n.totalPages?n.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c,d=a.replace(/[{}\s]/g,""),e=d.split(":"),f=n.ajaxData,g=/(rows?|pages?)$/i.test(d)?0:"";return/(startRow|page)/.test(e[0])&&"input"===e[1]?(b=(""+("page"===e[0]?n.totalPages:n.totalRows)).length,c="page"===e[0]?n.page+1:n.startRow,''):e.length>1&&f&&f[e[0]]?f[e[0]][e[1]]:n[d]||(f?f[d]:g)||g}),n.$goto.length){for(g="",i=b.buildPageSelect(d,n),k=i.length,j=0;k>j;j++)g+='";n.$goto.html(g).val(n.page+1)}h.length&&(h["INPUT"===h[0].nodeName?"val":"html"](f),h.find(".ts-startRow, .ts-page").off("change"+o).on("change"+o,function(){var b=a(this).val(),c=a(this).hasClass("ts-startRow")?Math.floor(b/p)+1:b;d.$table.triggerHandler("pageSet"+o,[c])}))}b.pagerArrows(d),b.fixHeight(d),n.initialized&&e!==!1&&(d.debug&&console.log("Pager: Triggering pagerComplete"),d.$table.triggerHandler("pagerComplete",d),m.pager_savePages&&c.storage&&c.storage(l,m.pager_storageKey,{page:n.page,size:p===n.totalRows?"all":p}))}},buildPageSelect:function(c,d){var e,f,g,h,i,j,k=c.widgetOptions,l=b.getTotalPages(c,d)||1,m=5*Math.ceil(l/k.pager_maxOptionSize/5),n=l>k.pager_maxOptionSize,o=d.page+1,p=m,q=l-m,r=[1],s=n?m:1;for(e=s;l>=e;)r[r.length]=e,e+=n?m:1;if(r[r.length]=l,n){for(g=[],f=Math.max(Math.floor(k.pager_maxOptionSize/m)-1,5),p=o-f,1>p&&(p=1),q=o+f,q>l&&(q=l),e=p;q>=e;e++)g[g.length]=e;r=a.grep(r,function(b,c){return a.inArray(b,r)===c}),i=r.length,j=g.length,i-j>m/2&&i+j>k.pager_maxOptionSize&&(h=Math.floor(i/2)-Math.floor(j/2),Array.prototype.splice.apply(r,[h,j])),r=r.concat(g)}return r=a.grep(r,function(b,c){return a.inArray(b,r)===c}).sort(function(a,b){return a-b})},fixHeight:function(b){var c,d,e=b.table,f=b.pager,g=b.widgetOptions,h=b.$tbodies.eq(0);h.find("tr.pagerSavedHeightSpacer").remove(),g.pager_fixedHeight&&!f.isDisabled&&(d=a.data(e,"pagerSavedHeight"),d&&(c=d-h.height(),c>5&&a.data(e,"pagerLastSize")===f.size&&h.children("tr:visible").length<("all"===f.size?f.totalRows:f.size)&&h.append('