!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function($){return factory($,window,document)}):"object"==typeof exports?module.exports=function(root,$){return root||(root=window),$&&$.fn.dataTable||($=require("datatables.net")(root,$).$),factory($,root,root.document)}:factory(jQuery,window,document)}(function($,window,document,undefined){"use strict";function handleCurrentPage(dt){var ctx=dt.settings()[0];ctx._pfPagination.currentPage!==undefined&&0!==ctx._pfPagination.currentPage.length&&ctx._pfPagination.currentPage.on("keypress",function(e){var page,pageInfo=dt.table().page.info(),keycode=e.keyCode?e.keyCode:e.which;return 13!==keycode||(e.preventDefault(),page=parseInt(this.value)-1,page>=0&&pagepageInfo.length?$(ctx._pfPagination.currentPage).prop("disabled",!1):$(ctx._pfPagination.currentPage).prop("disabled",!0),$(ctx._pfPagination.currentPage).val(page))}function updateBackActions(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();0===pageInfo.page?$("li",ctx._pfPagination.backActions).each(function(){$(this).addClass("disabled")}):$("li",ctx._pfPagination.backActions).each(function(){$(this).removeClass("disabled")})}function updateCurrentItems(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info(),start=0===pageInfo.recordsDisplay?0:pageInfo.start+1;ctx._pfPagination.currentItems.html(start+"-"+pageInfo.end)}function updateForwardActions(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();0===pageInfo.recordsDisplay||pageInfo.page===pageInfo.pages-1?$("li",ctx._pfPagination.forwardActions).each(function(){$(this).addClass("disabled")}):$("li",ctx._pfPagination.forwardActions).each(function(){$(this).removeClass("disabled")})}function updateTotalItems(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();ctx._pfPagination.totalItems.html(pageInfo.recordsDisplay)}function updateTotalPages(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();ctx._pfPagination.totalPages.html(pageInfo.pages)}var DataTable=$.fn.dataTable,BACK_ACTIONS_SELECTOR=".pagination-pf-back",CURRENT_ITEMS_SELECTOR=".pagination-pf-items-current",CURRENT_PAGE_SELECTOR=".pagination-pf-page",FIRST_PAGE_SELECTOR=".pagination-pf-back .fa-angle-double-left",FORWARD_ACTIONS_SELECTOR=".pagination-pf-forward",LAST_PAGE_SELECTOR=".pagination-pf-forward .fa-angle-double-right",PAGE_SIZE_SELECTOR=".pagination-pf-pagesize",TOTAL_ITEMS_SELECTOR=".pagination-pf-items-total",TOTAL_PAGES_SELECTOR=".pagination-pf-pages",PREVIOUS_PAGE_SELECTOR=".pagination-pf-back .fa-angle-left",NEXT_PAGE_SELECTOR=".pagination-pf-forward .fa-angle-right";return DataTable.pfPagination={},DataTable.pfPagination.init=function(dt){var ctx=dt.settings()[0],opts=ctx.oInit.pfConfig?ctx.oInit.pfConfig:{};ctx._pfPagination={},ctx._pfPagination.backActions=$(BACK_ACTIONS_SELECTOR,opts.paginationSelector),ctx._pfPagination.currentItems=$(CURRENT_ITEMS_SELECTOR,opts.paginationSelector),ctx._pfPagination.currentPage=$(CURRENT_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.firstPage=$(FIRST_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.forwardActions=$(FORWARD_ACTIONS_SELECTOR,opts.paginationSelector),ctx._pfPagination.lastPage=$(LAST_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.nextPage=$(NEXT_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.pageSize=$(PAGE_SIZE_SELECTOR,opts.paginationSelector),ctx._pfPagination.previousPage=$(PREVIOUS_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.totalItems=$(TOTAL_ITEMS_SELECTOR,opts.paginationSelector),ctx._pfPagination.totalPages=$(TOTAL_PAGES_SELECTOR,opts.paginationSelector),ctx._pfPagination.currentPageSize=opts.pageSize!==undefined?opts.pageSize:15,handleCurrentPage(dt),handleFirstPage(dt),handleLastPage(dt),handlePageSize(dt),handleNextPage(dt),handlePreviousPage(dt),dt.on("draw.page",function(){updateCurrentPage(dt),updateCurrentItems(dt),updateTotalItems(dt),updateTotalPages(dt),updateBackActions(dt),updateForwardActions(dt)}),dt.table().page.len(ctx._pfPagination.currentPageSize),dt.table().draw("page")},DataTable.Api.register("pfPagination.next()",function(){return this.iterator("table",function(ctx){handleNextPage(new DataTable.Api(ctx))})}),DataTable.Api.register("pfPagination.previous()",function(){return this.iterator("table",function(ctx){handlePreviousPage(new DataTable.Api(ctx))})}),$(document).on("init.dt",function(e,ctx,json){"dt"===e.namespace&&DataTable.pfPagination.init(new DataTable.Api(ctx))}),DataTable.pfPagination});