var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}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(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
zul.mesh.HeaderWidget=zk.$extends(zul.LabelImageWidget,{_sumWidth:!0,$define:{align:function(a){this.adjustDOMAlign_("align",a)},valign:function(a){this.adjustDOMAlign_("valign",a)},height:function(){this.updateMesh_()}},getWidth:function(){return this.isVisible()?this._width:0},setWidth:function(a){this._width=a;this.updateMesh_()},doFocus_:function(a){this.$supers("doFocus_",arguments);var b,c;(b=this.getMeshWidget())&&b.efrozen&&zk.Widget.$(b.efrozen.firstChild)&&(c=this.$n())&&b._moveToHidingFocusCell(c.cellIndex)},
updateMesh_:function(a,b){this.desktop&&(a=this.getMeshWidget())&&(a._minWd=null,a.rerender())},adjustDOMAlign_:function(a,b){var c=this.$n();c&&("align"==a?c.style.textAlign=b:"valign"==a&&(c.style.verticalAlign=b))},setFlexSize_:function(a){if(void 0!==a.width&&"auto"!=a.width&&""!=a.width||0==a.width){var b="min"==this._hflex&&this.firstChild&&this.isRealVisible()?zk(this.$n("cave")).revisedWidth(a.width):a.width;this._hflexWidth=b;return{width:b}}this.$supers("setFlexSize_",arguments)},getContentEdgeHeight_:function(){return zk(this).sumStyles("tb",
jq.margins)},getContentEdgeWidth_:function(){return zk(this).sumStyles("lr",jq.margins)},domStyle_:function(a){var b="";this._hflexWidth&&(b="width: "+this._hflexWidth+"px;",a?a.width=!0:a={width:!0});this._align&&(b+="text-align:"+this._align+";");this._valign&&(b+="vertical-align:"+this._valign+";");return b+this.$super("domStyle_",a)},getMeshWidget:function(){return this.parent?this.parent.parent:null},isSortable_:function(){return!1},setVisible:function(a){if(this.isVisible()!=a){this.$supers("setVisible",
arguments);this.updateMesh_("visible",a);var b=this.getMeshWidget();b&&b.desktop&&!this._hflexWidth&&this.getWidth()&&this.parent.fire("onColSize",{index:zk(this.$n()).cellIndex(),column:this,width:this.isVisible()?this._width:"-1"},null,0)}},getTextNode:function(){return jq(this.$n()).find(">div:first")[0]},bind_:function(){this.$supers(zul.mesh.HeaderWidget,"bind_",arguments);this.parent.isSizable()&&this._initsz();var a=this.getMeshWidget(),b=zul.mesh.MeshWidget.WIDTH0;if(a){a=jq(this.$n());var c=
jq(this.$n("hdfaker")),d=this.getWidth();this.isVisible()?(c.css("visibility",""),!this._hflexWidth&&d&&c.css("width",d)):(a.css("display",""),c.css("display",""),c.css("visibility","collapse"),c.css("width",b))}this.fixFaker_()},unbind_:function(){this._dragsz&&(this._dragsz.destroy(),this._dragsz=null);this.$supers(zul.mesh.HeaderWidget,"unbind_",arguments)},_initsz:function(){if(this.$n()&&!this._dragsz){var a=this.$class;this._dragsz=new zk.Draggable(this,null,{revert:!0,constraint:"horizontal",
ghosting:a._ghostsizing,endghosting:a._endghostsizing,snap:a._snapsizing,ignoredrag:a._ignoresizing,zIndex:99999,endeffect:a._aftersizing})}},fixFaker_:function(){if(!this.parent.$instanceof(zul.mesh.Auxhead))for(var a=this.$n(),b=zk(a).cellIndex(),c=this.getMeshWidget(),d,e=this.$class._faker,f=e.length;f--;)(d=c["e"+e[f]])&&!this.$n(e[f])&&(d[d.childNodes.length>b?"insertBefore":"appendChild"](this._createFaker(a,e[f]),d.childNodes[b]),this._subnodes[e[f]]=null)},_createFaker:function(a,b){var c=
zul.mesh.MeshWidget._getWidth;c=c(this,this._hflexWidth?this._hflexWidth+"px":this.getWidth());var d=document.createElement("col"),e=this.getMeshWidget().frozen;(c=c?"width: "+c+";":"")||!e||e._smooth||(c=this._calcFakerWidth(b));d.id=a.id+"-"+b;d.style.cssText=c;return d},_calcFakerWidth:function(a){for(var b=this.parent.firstChild,c=0,d=1;b;){if(!b.getWidth()&&!b.getHflex()&&b!=this){var e=b.$n(a).style.width;if(""==e)break;c=e==zul.mesh.MeshWidget.WIDTH0?c+parseFloat(b._origWd):c+parseFloat(e);
d++}b=b.nextSibling}if(0==c)return"";b=jq.px0(c/d);this._syncFakerWidth(b,a);return"width: "+b},_syncFakerWidth:function(a,b){for(var c=this.parent.firstChild;c;){if(!c.getWidth()&&!c.getHflex()&&c!=this){var d=c.$n(b);d.style.width==zul.mesh.MeshWidget.WIDTH0?"hdfaker"==b&&(c._origWd=a):d.style.width=a}c=c.nextSibling}},doClick_:function(a){var b=a.domTarget,c=zk.Widget.$(b),d=this.$n();d=this._dragsz?zk(d).revisedOffset():!1;var e=c.$n("btn"),f=!1;11>zk.ie&&e&&!zk(e).isRealVisible()&&(f=!0);zk.dragging||
c!=this&&!c.$instanceof(zul.wgt.Label)||!this.isSortable_()||jq.nodeName(b,"input")||this._dragsz&&this._insizer(a.pageX-d[0])||f?(jq.nodeName(b,"input")&&a.stop({propagation:!0}),this.$supers("doClick_",arguments)):(this.fire("onSort","ascending"!=this.getSortDirection()),a.stop())},doDoubleClick_:function(a){if(this._dragsz){var b=this.$n();b=zk(b);var c=b.revisedOffset();this._insizer(a.pageX-c[0])?(c=this.getMeshWidget(),zk(this.$n("cave")).textSize(),b=b.cellIndex(),c.clearCachedSize_(),c._calcMinWds(),
this.$class._aftersizing({control:this,_zszofs:c._minWd.wds[b]},a)):this.$supers("doDoubleClick_",arguments)}else this.$supers("doDoubleClick_",arguments)},doMouseMove_:function(a){if(!zk.dragging&&this.parent.isSizable()){var b=this.$n(),c=zk(b).revisedOffset();this._insizer(a.pageX-c[0])?jq(b).addClass(this.$s("sizing")):jq(b).removeClass(this.$s("sizing"))}},doMouseOut_:function(a){if(this.parent.isSizable()){var b=this.$n();jq(b).removeClass(this.$s("sizing"))}this.$supers("doMouseOut_",arguments)},
ignoreDrag_:function(a){if(this.parent.isSizable()){var b=this.$n();b=zk(b).revisedOffset();return this._insizer(a[0]-b[0])}return!1},ignoreChildNodeOffset_:function(a){return!0},listenOnFitSize_:zk.$void,unlistenOnFitSize_:zk.$void,beforeMinFlex_:function(a){if("w"==a&&(a=this.getMeshWidget())&&(a._calcMinWds(),a._minWd)){var b=this.$n();b=zk(b);var c=b.cellIndex();return b.revisedWidth(a._minWd.wds[c])}return null},clearCachedSize_:function(){this.$supers("clearCachedSize_",arguments);var a;(a=
this.getMeshWidget())&&a._clearCachedSize()},getParentSize_:function(){var a=this.getMeshWidget(),b=a.$n();return(b=b?zk(b):null)?(a.ebody&&11>zk.ie&&a.ebodytbl&&!a.ebodytbl.width&&(a.ebodytbl.width="100%"),{height:b.contentHeight(),width:b.contentWidth()}):{}},isWatchable_:function(a,b,c){var d;return this._visible&&(d=this.parent)&&d._visible&&(d=d.parent)&&d.isWatchable_(a,b,c)},_insizer:function(a){return a>=this.$n().offsetWidth-8},deferRedrawHTML_:function(a){a.push("<th",this.domAttrs_({domClass:1}),
' class="z-renderdefer"></th>')}},{_faker:["hdfaker","bdfaker","ftfaker"],_ghostsizing:function(a,b,c){var d=a.control;a=d.getMeshWidget().eheadtbl;c=zk(a).revisedOffset();d=d.$n();b[1]=c[1];b[0]+=zk(d).offsetWidth();jq(document.body).append('<div id="zk_hdghost" style="position:absolute;top:'+b[1]+"px;left:"+b[0]+"px;width:3px;height:"+zk(a.parentNode.parentNode).offsetHeight()+'px;background:darkgray"></div>');return jq("#zk_hdghost")[0]},_endghostsizing:function(a,b){a._zszofs=zk(a.node).revisedOffset()[0]-
zk(b).revisedOffset()[0]},_snapsizing:function(a,b){var c=a.control.$n();c=zk(c);var d=c.revisedOffset();b[0]+=c.offsetWidth();d[0]+a._zmin>=b[0]&&(b[0]=d[0]+a._zmin);return b},_ignoresizing:function(a,b,c){c=a.control;var d=c.$n();d=zk(d);var e=d.revisedOffset();return c._insizer(b[0]-e[0])?(a._zmin=10+d.padBorderWidth(),!1):!0},_aftersizing:function(a,b){var c=a.control,d=c.getMeshWidget();a=jq.px(a._zszofs);var e=d.ehdfaker,f=d.ebdfaker,l=d.eftfaker,n=zk(c.$n()).cellIndex();e=e.childNodes;f=f.childNodes;
l=l?l.childNodes:null;for(var k=[],g=d.head.firstChild,h=0;g;g=g.nextSibling,h++){var m=e[h].style.width,p=g._origWd,q=m&&0>m.indexOf("%");p?(q&&1<zk.parseFloat(m)&&(p=m),g._width=k[h]=p):(k[h]=q?m:jq.px0(g.$n().offsetWidth),g.isVisible()&&(g._width=k[h]));q||(e[h].style.width=f[h].style.width=k[h],l&&(l[h].style.width=k[h]));m=zk.parseInt(k[h]);g._hflexWidth&&(g.setHflex_(null),g._hflexWidth=void 0);d._minWd&&(d._minWd.wds[h]=m)}c.origWd||(c._width=k[n]=a);e[n].style.width=f[n].style.width=a;l&&
(l[n].style.width=a);d.eheadtbl.width="";d.ebodytbl.width="";d.efoottbl&&(d.efoottbl.width="");delete d._span;delete d._sizedByContent;for(g=d.head.firstChild;g;g=g.nextSibling)g.setHflex_(null);c.parent.fire("onColSize",zk.copy({index:n,column:c,width:a,widths:k},b.data),null,0);d.$n()._lastsz=null;zk.webkit||(d.eheadtbl.width="100%",d.ebodytbl.width="100%",d.efoottbl&&(d.efoottbl.width="100%"));zUtl.fireSized(d,-1)},redraw:function(a){var b=this.uuid;this.getZclass();var c=this.domContent_();a.push("<th",
this.domAttrs_({width:!0}),'><div id="',b,'-cave" class="',this.$s("content"),'"',this.domTextStyleAttr_(),'><div class="',this.$s("sorticon"),'"><i id="',b,'-sort-icon"></i></div>',this.firstChild||""!=c?c:"&nbsp;");this.parent._menupopup&&"none"!=this.parent._menupopup&&a.push('<a id="',b,'-btn" href="javascript:;" class="',this.$s("button"),'"><i class="z-icon-caret-down"></i></a>');for(b=this.firstChild;b;b=b.nextSibling)b.redraw(a);a.push("</div></th>")}});
