define(['jquery', 'handlebars', 'lib/handlebars/helpers'], function ($$1, Handlebars, Helpers0) { 'use strict';

    $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
    Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
    Helpers0 = Helpers0 && Object.prototype.hasOwnProperty.call(Helpers0, 'default') ? Helpers0['default'] : Helpers0;

    if (!Helpers0.__initialized) {
      Helpers0(Handlebars);
      Helpers0.__initialized = true;
    }
    var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
      this.compilerInfo = [4,'>= 1.0.0'];
    helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
      var buffer = "", stack1, helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function";


      buffer += "<div class=\"grid-row clearfix pagination\">\n    <div class=\"col-6\">"
        + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Page", options) : helperMissing.call(depth0, "__", "Page", options)))
        + " <strong class=\"page\">";
      if (helper = helpers.activePage) { stack1 = helper.call(depth0, {hash:{},data:data}); }
      else { helper = (depth0 && depth0.activePage); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
      buffer += escapeExpression(stack1)
        + "</strong> "
        + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "of", options) : helperMissing.call(depth0, "__", "of", options)))
        + " <span class=\"total\">";
      if (helper = helpers.totalPages) { stack1 = helper.call(depth0, {hash:{},data:data}); }
      else { helper = (depth0 && depth0.totalPages); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
      buffer += escapeExpression(stack1)
        + "</span></div>\n    <div class=\"col-6 txt-rgt\">\n        <button class=\"btn-info small\"><span class=\"icon-backward\"></span>"
        + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Previous", options) : helperMissing.call(depth0, "__", "Previous", options)))
        + "</button>\n        <button class=\"btn-info small\">"
        + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Next", options) : helperMissing.call(depth0, "__", "Next", options)))
        + "<span class=\"icon-forward r\"></span></button>\n    </div>\n</div>\n";
      return buffer;
      });
    function tpl(data, options, asString) {
      var html = Template(data, options);
      return (asString || true) ? html : $(html);
    }

    /**
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * as published by the Free Software Foundation; under version 2
     * of the License (non-upgradable).
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     *
     * Copyright (c) 2016  (original work) Open Assessment Technologies SA;
     *
     * @author Alexander Zagovorichev <zagovorichev@1pt.com>
     */
    var pagination = {
      init: function init() {
        var $paginationTpl;
        return {
          render: function render($container) {
            $paginationTpl = $$1(tpl());
            $container.append($paginationTpl);
          },
          forwardButton: function forwardButton() {
            return $$1('.icon-forward', $paginationTpl).parents('button');
          },
          backwardButton: function backwardButton() {
            return $$1('.icon-backward', $paginationTpl).parents('button');
          },
          setPages: function setPages(page, total) {
            $$1('.page', $paginationTpl).text(page);
            $$1('.total', $paginationTpl).text(total);
          },
          disableButton: function disableButton($btn) {
            $btn.attr('disabled', 'disabled');
          },
          enableButton: function enableButton($btn) {
            if ($btn.attr('disabled')) {
              $btn.removeAttr('disabled');
            }
          },
          pageButtons: function pageButton() {
            return false;
          },
          firstPageButton: function lastPageButton() {
            return false;
          },
          lastPageButton: function lastPageButton() {
            return false;
          },
          destroy: function destroy() {
            $paginationTpl.remove();
          },
          disable: function disable() {
            this.disableButton(this.backwardButton());
            this.disableButton(this.forwardButton());
          },
          enable: function enable() {
            // for that provider everything will be done in the pagination.js
          }
        };
      }
    };

    return pagination;

});
