var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,c,a){d instanceof String&&(d=String(d));for(var b=d.length,f=0;f<b;f++){var e=d[f];if(c.call(a,e,f,d))return{i:f,v:e}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,c,a){d!=Array.prototype&&d!=Object.prototype&&(d[c]=a.value)};
$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(d,c,a,b){if(c){a=$jscomp.global;d=d.split(".");for(b=0;b<d.length-1;b++){var f=d[b];f in a||(a[f]={});a=a[f]}d=d[d.length-1];b=a[d];c=c(b);c!=b&&null!=c&&$jscomp.defineProperty(a,d,{configurable:!0,writable:!0,value:c})}};
$jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(c,a){return $jscomp.findInternal(this,c,a).v}},"es6","es3");
(function(){function d(c){if(c.isBothPaging())return c.parent.rerender(),!0}zul.mesh.Paging=zk.$extends(zul.Widget,{_pageSize:20,_totalSize:0,_pageCount:1,_activePage:0,_pageIncrement:zk.mobile?5:10,_showFirstLast:!0,$define:{totalSize:function(){this._updatePageNum();if(this._detailed&&!d(this)){var c=this.$n("info");c?c.innerHTML=this.infoText_():this._totalSize&&this.rerender()}},pageIncrement:_zkf=function(){this.rerender()},detailed:_zkf,pageCount:_zkf,activePage:_zkf,pageSize:function(){this._updatePageNum()},
autohide:function(){1==this._pageCount&&this.rerender()},disabled:function(c){this.desktop&&this._drawDisabled(c)}},setStyle:function(){this.$supers("setStyle",arguments);d(this)},setSclass:function(){this.$supers("setSclass",arguments);d(this)},setWidth:function(){this.$supers("setWidth",arguments);d(this);this.desktop&&zUtl.fireSized(this,-1)},setHeight:function(){this.$supers("setHeight",arguments);d(this)},setLeft:function(){this.$supers("setLeft",arguments);d(this)},setTop:function(){this.$supers("setTop",
arguments);d(this)},setTooltiptext:function(){this.$supers("setTooltiptext",arguments);d(this)},replaceHTML:function(){d(this)||this.$supers("replaceHTML",arguments)},isBothPaging:function(){return this.parent&&this.parent.getPagingPosition&&"both"==this.parent.getPagingPosition()},_drawDisabled:function(c){var a=this.uuid,b=this._activePage,f=this._pageCount,e=jq.$$(a,"real");if("os"==this._mold)a=jq.$$(a,"button"),jq(a).attr("disabled",c);else for(b=0==b&&b==f-1?[]:0==b?["last","next"]:b==f-1?["first",
"prev"]:["first","prev","last","next"],f=e.length;f--;){jq(e[f]).attr("disabled",c);for(var d=b.length;d--;)for(var h=jq.$$(a,b[d]),g=h.length;g--;)jq(h[g]).attr("disabled",c);d=c?"addClass":"removeClass";jq(e[f].nextSibling)[d](this.$s("text-disabled"))}},_updatePageNum:function(){var c=Math.floor((this._totalSize-1)/this._pageSize+1);0==c&&(c=1);if(c!=this._pageCount&&(this._pageCount=c,this._activePage>=this._pageCount&&(this._activePage=this._pageCount-1),this.desktop&&this.parent&&!d(this)&&
(this.rerender(),this.parent.$instanceof(zul.mesh.MeshWidget)))){var a=this;setTimeout(function(){if(a.desktop){var b=a.parent.$n();b&&b._lastsz&&(b._lastsz=null,a.parent.onSize())}})}},infoText_:function(){var c=this._activePage,a=this._pageSize,b=this._totalSize,f=(c+1)*a,e="";"os"!=this.getMold()&&(e=" - "+(f>b?b:f));return"[ "+(c*a+1)+e+" / "+b+" ]"},_infoTags:function(c){0!=this._totalSize&&c.push('<div class="',this.$s("info"),'"><span ',d(this)?"name":"id",'="',this.uuid,'-info">',this.infoText_(),
"</span></div>")},_innerTags:function(){var c=new zk.Buffer,a=this._pageIncrement,b=this._pageCount,f=this._activePage,e=Math.round(a/2),d=this._activePage+e-1;d>=b?(d=b-1,e=d-a+1,0>e&&(e=0)):(e=this._activePage-e,0>e&&(e=0),d=e+a-1,d>=b&&(d=b-1));c.push("<ul>");0<f&&(0<e&&this.appendAnchor(c,msgzul.FIRST,0),this.appendAnchor(c,msgzul.PREV,f-1));for(a=f<b-1;e<=d;++e)this.appendAnchor(c,e+1,e,e==f);a&&(this.appendAnchor(c,msgzul.NEXT,f+1),d<b-1&&this.appendAnchor(c,msgzul.LAST,b-1));c.push("</ul>");
this._detailed&&this._infoTags(c);return c.join("")},appendAnchor:function(c,a,b,f){var d=0==a.toString().search(/^[0-9]+$/),k=this.$s("button"),h="";d||(k+=" "+this.$s("noborder"),h=' class="'+this.$s("navigate")+'"');f&&(k+=" "+this.$s("selected"));c.push("<li",h,'><a name="',this.uuid,'-button" class="',k,'" href="javascript:;" onclick="if (!zk.Widget.$(this)._disabled) zul.mesh.Paging.go(this,',b,')">',a,"</a></li>")},domClass_:function(){var c=this.$supers(zul.mesh.Paging,"domClass_",arguments),
a="os"==this.getMold()?" "+this.$s("os"):"";return c+a},isVisible:function(){return this.$supers("isVisible",arguments)&&(1<this._pageCount||!this._autohide)},bind_:function(){this.$supers(zul.mesh.Paging,"bind_",arguments);zWatch.listen({onSize:this});var c=this.uuid,a=jq.$$(c,"real"),b=this.$class,f=this._pageCount,d=this._activePage,k=["first","prev","last","next"],h=zul.mesh.Paging._autoFocusInfo;if(!this.$weave)for(var g=a.length;g--;)jq(a[g]).keydown(b._domKeyDown).blur(b._domBlur);for(g=k.length;g--;)for(var l=
jq.$$(c,k[g]),m=l.length;m--;)this.$weave||jq(l[m]).click(b["_dom"+k[g]+"Click"]),1==f?jq(l[m]).attr("disabled",!0):"first"==k[g]||"prev"==k[g]?0==d&&jq(l[m]).attr("disabled",!0):d==f-1&&jq(l[m]).attr("disabled",!0);this._disabled&&this._drawDisabled(!0);h&&h.uuid===this.uuid&&(c=h.lastPos,a=zk(a[h.inpIdx]),a.focus(),a.setSelectionRange(c[0],c[1]),zul.mesh.Paging._autoFocusInfo=null)},unbind_:function(){if("os"!=this.getMold()){for(var c=this.uuid,a=jq.$$(c,"real"),b=this.$class,f=["first","prev",
"last","next"],d=a.length;d--;)jq(a[d]).unbind("keydown",b._domKeyDown).unbind("blur",b._domBlur);for(a=f.length;a--;)for(d=jq.$$(c,f[a]),j=d.length;j--;)jq(d[j]).unbind("click",b["_dom"+f[a]+"Click"])}zWatch.unlisten({onSize:this});this.$supers(zul.mesh.Paging,"unbind_",arguments)},onSize:function(){if(this.desktop){var c=jq.$$(this.uuid);if(0<c.length){var a=c[0],b=this.$class._getNavWidth(a,this);b=jq(a).width()>b+50;if(a=this._lastIsWide!=b)this._lastIsWide=this._showFirstLast=b;for(b=0;b<c.length;b++)this.$class._fixControl(c[b],
this,a)}}}},{go:function(c,a,b){if((c=zk.Widget.isInstance(c)?c:zk.Widget.$(c))&&c.getActivePage()!=a){if(b){var f=c.uuid,d=zul.mesh.Paging._autoFocusInfo={uuid:f};d.lastPos=zk(b).getSelectionRange();jq(jq.$$(f,"real")).each(function(a){if(this==b)return d.inpIdx=a,!1})}c.fire("onPaging",a)}},_domKeyDown:function(c){var a=c.target,b=zk.Widget.$(a);zk(a).getSelectionRange();if(!a.disabled&&!a.readOnly){var d=c.keyCode;switch(d){case 48:case 96:case 49:case 97:case 50:case 98:case 51:case 99:case 52:case 100:case 53:case 101:case 54:case 102:case 55:case 103:case 56:case 104:case 57:case 105:break;
case 37:break;case 38:b.$class._increase(a,b,1);c.stop();break;case 39:break;case 40:b.$class._increase(a,b,-1);c.stop();break;case 33:b.$class._increase(a,b,-1);b.$class.go(b,a.value-1,a);c.stop();break;case 34:b.$class._increase(a,b,1);b.$class.go(b,a.value-1,a);c.stop();break;case 36:b.$class.go(b,0,a);c.stop();break;case 35:b.$class.go(b,b._pageCount-1,a);c.stop();break;case 9:case 8:case 46:break;case 13:b.$class._increase(a,b,0);b.$class.go(b,a.value-1,a);c.stop();break;default:112<=d&&123>=
d||c.ctrlKey||c.altKey||c.stop()}}},_domBlur:function(c){var a=c.target,b=zk.Widget.$(a);a.disabled||a.readOnly||(b.$class._increase(a,b,0),b.$class.go(b,a.value-1),c.stop())},_increase:function(c,a,b){var d=zk.parseInt(c.value);d+=b;1>d?d=1:d>a._pageCount&&(d=a._pageCount);c.value=d},_domfirstClick:function(c){var a=zk.Widget.$(c);if(!a._disabled){c=a.uuid;var b=["first","prev"];if(0!=a.getActivePage())for(a.$class.go(a,0),a=b.length;a--;)for(var d=jq.$$(c,b[a]),e=d.length;e--;)jq(d[e]).attr("disabled",
!0)}},_domprevClick:function(c){var a=zk.Widget.$(c);if(!a._disabled){c=a.uuid;var b=a.getActivePage(),d=["first","prev"];if(0<b&&(a.$class.go(a,b-1),0==b-1))for(a=d.length;a--;){b=jq.$$(c,d[a]);for(var e=b.length;e--;)jq(b[e]).attr("disabled",!0)}}},_domnextClick:function(c){var a=zk.Widget.$(c);if(!a._disabled){c=a.uuid;var b=a.getActivePage(),d=a.getPageCount(),e=["last","next"];if(b<d-1&&(a.$class.go(a,b+1),b+1==d-1))for(a=e.length;a--;)for(b=jq.$$(c,e[a]),d=b.length;d--;)jq(b[d]).attr("disabled",
!0)}},_domlastClick:function(c){var a=zk.Widget.$(c);if(!a._disabled){c=a.uuid;var b=a.getPageCount(),d=["last","next"];if(a.getActivePage()<b-1)for(a.$class.go(a,b-1),a=d.length;a--;){b=jq.$$(c,d[a]);for(var e=b.length;e--;)jq(b[e]).attr("disabled",!0)}}},_fixControl:function(c,a,b){var d=jq("> ul",c);c=jq("> .z-paging-info",c);var e=a.getMold();a=a._showFirstLast;b&&"default"==e&&(b=d.find("li"),b.first().toggle(a),b.last().toggle(a));c.css("visibility",function(){return zk(d).isOverlapped(this,
1)?"hidden":""})},_getNavWidth:function(c,a){if(a._navWidth)return a._navWidth;var b=0;jq("ul > li",c).each(function(){b+=jq(this).outerWidth(!0)});return a._navWidth=b}})})();
