var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,d,e){c instanceof String&&(c=String(c));for(var f=c.length,g=0;g<f;g++){var a=c[g];if(d.call(e,a,g,c))return{i:g,v:a}}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(c,d,e){c!=Array.prototype&&c!=Object.prototype&&(c[d]=e.value)};
$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,d,e,f){if(d){e=$jscomp.global;c=c.split(".");for(f=0;f<c.length-1;f++){var g=c[f];g in e||(e[g]={});e=e[g]}c=c[c.length-1];f=e[c];d=d(f);d!=f&&null!=d&&$jscomp.defineProperty(e,c,{configurable:!0,writable:!0,value:d})}};
$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,e){return $jscomp.findInternal(this,c,e).v}},"es6","es3");
(function(){function c(a,b){if(a.isListen("onClick"))jq(a.$n())[b?"removeClass":"addClass"](a.$s("hover"))}function d(a,b){if(a.isListen("onClick")){var c=jq(a.$n()).find("."+a.$s("separator"));c=zk(c).revisedOffset()[0];b.pageX>c?(jq(a.$n()).addClass(a.$s("selected")),a.menupopup._shallClose=!1,a._togglePopup(),b.stop()):a.fireX(new zk.Event(a,"onClick",b.data))}else jq(a.$n()).addClass(a.isTopmost()?a.$s("selected"):a.$s("hover")),a.menupopup._shallClose=!1,a._togglePopup()}function e(a){return a.isVisible()&&
a.$instanceof(zul.menu.Menu)&&!a.isDisabled()}function f(a){for(var b=a;b;b=b.nextSibling)if(e(b))return b;b=a.parent;return b.firstChild==a?a:f(b.firstChild)}function g(a){for(var b=a;b;b=b.previousSibling)if(e(b))return b;b=a.parent;return b.lastChild==a?a:g(b.lastChild)}zul.menu.Menu=zk.$extends(zul.LabelImageWidget,{$define:{content:function(a){if(a&&0!=a.length)if(this._contentHandler)this._contentHandler.setContent(a);else if(zk.feature.pe){var b=this;zk.load("zkex.inp",null,function(){b._contentHandler=
new zkex.inp.ContentHandler(b,a)})}else this._contentHandler=new zul.menu.ContentHandler(this,a)},disabled:function(a){this.desktop&&(a?jq(this.$n("a")).attr("disabled","disabled").attr("tabindex","-1"):jq(this.$n("a")).removeAttr("disabled").removeAttr("tabindex"))},image:function(a){a&&this._preloadImage&&zUtl.loadImage(a);this.rerender()}},open:function(){if(this.desktop&&this.isTopmost()){jq(this.$n()).addClass(this.$s("selected"));var a=this.getMenubar();a._lastTarget&&this.$class._rmActive(a._lastTarget);
a._lastTarget=this;this.menupopup._shallClose=!1;this._togglePopup()}},getAnchor_:function(){return this.$n("a")},domContent_:function(){var a='<span class="'+this.$s("text")+'">'+zUtl.encodeXML(this.getLabel())+"</span>",b=this.getImage(),c='<i class="'+this.$s("icon")+" z-icon-caret-"+(this.isTopmost()&&!this.isVertical_()?"down":"right")+'"></i>',e='<div class="'+this.$s("separator")+'"></div>',d=this.domIcon_();b=b?'<img id="'+this.uuid+'-img" src="'+b+'" class="'+this.$s("image")+'" align="absmiddle" />'+
(d?" "+d:""):d?d:'<img id="'+this.uuid+'-img" '+(this.isTopmost()?'style="display:none"':"")+' src="data:image/png;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="'+this.$s("image")+'" align="absmiddle" />';return b+a+e+c},isTopmost:function(){return this._topmost},beforeParentChanged_:function(a){this._topmost=a&&!a.$instanceof(zul.menu.Menupopup);this.$supers("beforeParentChanged_",arguments)},onChildAdded_:function(a){this.$supers("onChildAdded_",arguments);a.$instanceof(zul.menu.Menupopup)&&
(this.menupopup=a,this._contentHandler&&this._contentHandler.destroy())},onChildRemoved_:function(a){this.$supers("onChildRemoved_",arguments);a==this.menupopup&&(this.menupopup=null,this._contentHandler&&this._contentHandler.setContent(this._content))},getMenubar:function(){for(var a=this.parent;a;a=a.parent){if(a.$instanceof(zul.menu.Menubar))return a;if(!a.$instanceof(zul.menu.Menupopup,zul.menu.Menu))break}return null},onShow:function(){if(this._contentHandler)this._contentHandler.onShow()},onFloatUp:function(a){if(this._contentHandler)this._contentHandler.onFloatUp(a)},
onHide:function(){if(this._contentHandler)this._contentHandler.onHide()},focus_:function(a,b){return this.isTopmost()&&zk(this.getAnchor_()).focus(a)?(b&&(this._ignoreActive=!0),!0):this.$supers("focus_",arguments)},_getPrevVisibleMenu:function(){var a=this.previousSibling;if(!a){var b=this.getMenubar();b&&(a=b.lastChild)}return a?g(a):this},_getNextVisibleMenu:function(){var a=this.nextSibling;if(!a){var b=this.getMenubar();b&&(a=b.firstChild)}return a?f(a):this},doKeyDown_:function(a){if(this.isTopmost()){var b=
a.keyCode;if(this.isVertical_())switch(b){case 38:b=37;break;case 40:b=39;break;case 37:b=38;break;case 39:b=40}switch(b){case 38:(b=this.menupopup)&&b.isOpen()&&(jq(this.$n()).removeClass(this.$s("hover")).removeClass(this.$s("selected")),b.close());this.$class._addActive(this);a.stop();break;case 40:this.menupopup&&!this._disabled&&(jq(this.$n()).addClass(this.$s("selected")).removeClass(this.$s("hover")),this.menupopup._shallClose=!1,this.menupopup.open());a.stop();break;case 37:case 39:(b=37==
b?this._getPrevVisibleMenu():this._getNextVisibleMenu())&&b.focus();a.stop();break;case 13:this.menupopup&&d(this,a);a.stop();break;case 9:this.$class._rmActive(this)}}this.$supers("doKeyDown_",arguments)},doFocus_:function(){if(this.isTopmost()){var a=this.getMenubar(),b=this.$class;a&&a._lastTarget&&b._rmActive(a._lastTarget);this._ignoreActive||b._addActive(this)}delete this._ignoreActive;this.$supers("doFocus_",arguments)},bind_:function(){this.$supers(zul.menu.Menu,"bind_",arguments);var a=this.getAnchor_();
this.domListen_(a,"onFocus","doFocus_").domListen_(a,"onBlur","doBlur_").domListen_(a,"onMouseEnter").domListen_(a,"onMouseLeave");this.isTopmost()&&this.isListen("onClick")&&jq(this.$n()).addClass(this.$s("clickable"));this._contentHandler&&this._contentHandler.bind()},unbind_:function(){var a=this.getAnchor_();this.domUnlisten_(a,"onFocus","doFocus_").domUnlisten_(a,"onBlur","doBlur_").domUnlisten_(a,"onMouseEnter").domUnlisten_(a,"onMouseLeave");this._contentHandler&&this._contentHandler.unbind();
this.$supers(zul.menu.Menu,"unbind_",arguments)},_getArrowWidth:function(){return 20},_showContentHandler:function(){var a=this._contentHandler;if(a&&!a.isOpen())a.onShow()},doClick_:function(a){this._disabled||(this.menupopup?(this.isTopmost()&&(this.getMenubar()._lastTarget=this),d(this,a)):this._showContentHandler());a.stop()},doMouseOver_:function(){this.isTopmost()||this._showContentHandler();this.$supers("doMouseOver_",arguments)},_togglePopup:function(){!this.menupopup&&this._contentHandler?
this._showContentHandler():this.menupopup.isOpen()?this.isTopmost()?this.menupopup.close({sendOnOpen:!0}):zk(this.menupopup.$n("a")).focus():(this.isTopmost()&&c(this),this.menupopup.open())},_doMouseEnter:function(a){var b=this.getMenubar();b&&(b._noFloatUp=!1);if(!this._disabled){var d=this.isTopmost();d&&c(this);d&&11>zk.ie&&!jq.isAncestor(this.getAnchor_(),a.domTarget)||(this.menupopup&&(this.menupopup._shallClose=!1),d?this.menupopup&&b._autodrop?(zWatch.fire("onFloatUp",this),this.menupopup.isOpen()||
this.menupopup.open()):(a=b._lastTarget)&&a!=this&&a.menupopup&&a.menupopup.isVisible()&&(a.menupopup.close({sendOnOpen:!0}),this.$class._rmActive(a),this.menupopup&&this.menupopup.open()):(zWatch.fire("onFloatUp",this),this.menupopup&&!this.menupopup.isOpen()&&this.menupopup.open()),this.$class._addActive(this))}},_doMouseLeave:function(a){a=this.getMenubar();this._updateHoverImage();if(!this._disabled){var b=this.isTopmost(),c=this.menupopup;b?(this.$class._rmActive(this,!0),c&&a._autodrop&&c.isOpen()&&
(c._shallClose=!0)):c&&c.isOpen()||this.$class._rmActive(this)}},getImageNode:function(){!this._eimg&&(this._image||this._hoverImage)&&this.$n()&&(this._eimg=this.$n("a").firstChild);return this._eimg},ignoreDescendantFloatUp_:function(a){return a&&a.$instanceof(zul.menu.Menupopup)},isVertical_:function(){if(this.isTopmost()){var a=this.getMenubar();if(a)return"vertical"==a.getOrient()}return!1}},{_isActive:function(a){var b=a.isTopmost(),c=a.$n(),d=a.menupopup;a=b?d&&d.isOpen()?a.$s("selected"):
a.$s("hover"):a.$s("hover");return jq(c).hasClass(a)},_addActive:function(a){var b=a.isTopmost(),c=a.$n(),d=a.menupopup;d=b?d&&d.isOpen()?a.$s("selected"):a.$s("hover"):a.$s("hover");jq(c).addClass(d);b&&(c=a.getMenubar())&&(c._lastTarget=a);!b&&a.parent.parent.$instanceof(zul.menu.Menu)&&this._addActive(a.parent.parent)},_rmActive:function(a,b){var d=a.isTopmost(),e=a.$n(),f=a.menupopup;b=d?!b&&f&&f.isOpen()?a.$s("selected"):a.$s("hover"):a.$s("hover");e=jq(e).removeClass(b);!d||e.hasClass(a.$s("selected"))||
e.hasClass(a.$s("hover"))||c(a,!0)}});zul.menu.ContentHandler=zk.$extends(zk.Object,{$init:function(a,b){this._wgt=a;this._content=b},setContent:function(a){this._content==a&&this._pp||(this._content=a,this._wgt.rerender())},redraw:function(a){var b=this._wgt;b.getZclass();a.push('<div id="',b.uuid,'-cnt-pp" class="',b.$s("content-popup"),'" style=""><div class="',b.$s("content-body"),'">',this._content,"</div></div>")},bind:function(){var a=this._wgt;a.menupopup||(a.domListen_(a.$n(),"onClick","onShow"),
zWatch.listen({onFloatUp:a,onHide:a}));this._pp=a.$n("cnt-pp");jq(this._pp,zk).bind("mouseenter",this.proxy(this._doMouseEnter)).bind("mouseleave",this.proxy(this._doMouseLeave))},unbind:function(){var a=this._wgt;a.menupopup||(this._shadow&&(this._shadow.destroy(),this._shadow=null),a.domUnlisten_(a.$n(),"onClick","onShow"),zWatch.unlisten({onFloatUp:a,onHide:a}));jq(this._pp,zk).unbind("mouseenter",this.proxy(this._doMouseEnter)).unbind("mouseleave",this.proxy(this._doMouseLeave));this._pp=null},
isOpen:function(){var a=this._pp;return a&&zk(a).isVisible()},_doMouseEnter:function(){var a=this._wgt.getMenubar();a&&(a._bOver=!0)},_doMouseLeave:function(){var a=this._wgt.getMenubar();a&&(a._bOver=!1)},onShow:function(){var a=this._wgt,b=this._pp;b&&(b.style.display="block",jq(b).zk.makeVParent(),zWatch.fireDown("onVParent",this),zk(b).position(a.$n(),this.getPosition()),this.syncShadow())},onHide:function(){var a=this._pp;a&&zk(a).isVisible()&&(a.style.display="none",jq(a).zk.undoVParent(),zWatch.fireDown("onVParent",
this),this.hideShadow())},onFloatUp:function(a){if(!zUtl.isAncestor(this._wgt,a.origin))this.onHide()},syncShadow:function(){this._shadow||(this._shadow=new zk.eff.Shadow(this._wgt.$n("cnt-pp"),{stackup:zk.useStackup}));this._shadow.sync()},hideShadow:function(){this._shadow&&this._shadow.hide()},destroy:function(){this._wgt.rerender()},getPosition:function(){return this._wgt.isVertical_()?"end_before":"after_start"},deferRedrawHTML_:function(a){a.push("<li",this.domAttrs_({domClass:1}),' class="z-renderdefer"></li>')}})})();
