/*
* Kendo UI Complete v2013.1.514 (http://kendoui.com)
* Copyright 2013 Telerik AD. All rights reserved.
*
* Kendo UI Complete commercial licenses may be obtained at
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
("function"==typeof define&&define.amd?define:function(e,t){return t()})(["./kendo.data.min"],function(){(function(e,t){function a(e,t,a,n){return e({idx:t,text:a,ns:p.ns,numeric:n})}function n(e,t){return w({className:e.substring(1),text:t})}function s(e,t,a,n){e.find(t).parent().attr(p.attr("page"),a).attr("tabindex",-1).toggleClass("k-state-disabled",n)}function i(e,t){s(e,u,1,1>=t)}function r(e,t){s(e,c,Math.max(1,t-1),1>=t)}function l(e,t,a){s(e,h,Math.min(a,t+1),t>=a)}function o(e,t,a){s(e,m,a,t>=a)}var p=window.kendo,d=p.ui,f=d.Widget,g=e.proxy,u=".k-i-seek-w",m=".k-i-seek-e",c=".k-i-arrow-w",h=".k-i-arrow-e",k="change",S=".kendoPager",x="click",v="keydown",b="disabled",w=p.template('#=text#'),y=f.extend({init:function(t,a){var s,d,b=this;f.fn.init.call(b,t,a),a=b.options,b.dataSource=p.data.DataSource.create(a.dataSource),b.linkTemplate=p.template(b.options.linkTemplate),b.selectTemplate=p.template(b.options.selectTemplate),s=b.page(),d=b.totalPages(),b._refreshHandler=g(b.refresh,b),b.dataSource.bind(k,b._refreshHandler),a.previousNext&&(b.element.find(u).length||(b.element.append(n(u,a.messages.first)),i(b.element,s,d)),b.element.find(c).length||(b.element.append(n(c,a.messages.previous)),r(b.element,s,d))),a.numeric&&(b.list=b.element.find(".k-pager-numbers"),b.list.length||(b.list=e('
',buttonCount:10,autoBind:!0,numeric:!0,info:!0,input:!1,previousNext:!0,pageSizes:!1,refresh:!1,messages:{display:"{0} - {1} of {2} items",empty:"No items to display",page:"Page",of:"of {0}",itemsPerPage:"items per page",first:"Go to the first page",previous:"Go to the previous page",next:"Go to the next page",last:"Go to the last page",refresh:"Refresh"}},setDataSource:function(e){var t=this;t.dataSource.unbind(k,t._refreshHandler),t.dataSource=t.options.dataSource=e,e.bind(k,t._refreshHandler),t.options.autoBind&&e.fetch()},refresh:function(){var e,t,n,s=this,d=1,f="",g=s.page(),u=s.options,m=s.pageSize(),c=s.dataSource.total(),h=s.totalPages(),k=s.linkTemplate,S=u.buttonCount;if(u.numeric){for(g>S&&(n=g%S,d=0===n?g-S+1:g-n+1),t=Math.min(d+S-1,h),d>1&&(f+=a(k,d-1,"...",!1)),e=d;t>=e;e++)f+=a(e==g?s.selectTemplate:k,e,e,!0);h>t&&(f+=a(k,e,"...",!1)),""===f&&(f=s.selectTemplate({text:0})),s.list.html(f)}u.info&&(f=c>0?p.format(u.messages.display,(g-1)*m+1,Math.min(g*m,c),c):u.messages.empty,s.element.find(".k-pager-info").html(f)),u.input&&s.element.find(".k-pager-input").html(s.options.messages.page+''+p.format(u.messages.of,h)).find("input").val(g).attr(b,1>c).toggleClass("k-state-disabled",1>c),u.previousNext&&(i(s.element,g,h),r(s.element,g,h),l(s.element,g,h),o(s.element,g,h)),u.pageSizes&&s.element.find(".k-pager-sizes select").val(m).filter("["+p.attr("role")+"=dropdownlist]").kendoDropDownList("value",m).kendoDropDownList("text",m)},_keydown:function(e){if(e.keyCode===p.keys.ENTER){var t=this.element.find(".k-pager-input").find("input"),a=parseInt(t.val(),10);(isNaN(a)||1>a||a>this.totalPages())&&(a=this.page()),t.val(a),this.page(a)}},_refreshClick:function(e){e.preventDefault(),this.dataSource.read()},_change:function(e){var t=parseInt(e.currentTarget.value,10);isNaN(t)||this.dataSource.pageSize(t)},_click:function(t){var a=e(t.currentTarget);t.preventDefault(),a.is(".k-state-disabled")||this.page(a.attr(p.attr("page")))},totalPages:function(){return Math.ceil((this.dataSource.total()||0)/this.pageSize())},pageSize:function(){return this.dataSource.pageSize()||this.dataSource.total()},page:function(e){return e===t?this.dataSource.total()>0?this.dataSource.page():0:(this.dataSource.page(e),this.trigger(k,{index:e}),t)}});d.plugin(y)})(window.kendo.jQuery)});