var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.checkStringArgs=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""};$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("String.prototype.endsWith",function(a){return a?a:function(a,c){var b=$jscomp.checkStringArgs(this,a,"endsWith");a+="";void 0===c&&(c=b.length);c=Math.max(0,Math.min(c|0,b.length));for(var e=a.length;0<e&&0<c;)if(b[--c]!=a[--e])return!1;return 0>=e}},"es6","es3");
zul.inp.ComboWidget=zk.$extends(zul.inp.InputWidget,{_buttonVisible:!0,_iconSclass:null,$define:{buttonVisible:function(a){zul.inp.RoundUtl.buttonVisible(this,a)},autodrop:null,popupWidth:function(a){if(this._open){a=this.getPopupNode_();var b=this.getPopupNode_(!0);if(a){var c=this._getPopupSize(a,b);this._fixsz(c);this._checkPopupSpaceAndPosition(a,this.$n());this._fixFfWhileBothScrollbar(a,b)}}},type:11>zk.ie?function(){this.rerender()}:function(a){var b=this.getInputNode();b&&(b.type=a)},iconSclass:function(a){var b=
this.$n("icon");this.desktop&&b&&(b.className=this.$s("icon")+" "+a)}},setWidth:function(){this.$supers("setWidth",arguments);if(this.desktop)this.onSize()},onSize:function(){if(this._open){var a=this.getPopupNode_();a&&this._checkPopupSpaceAndPosition(a,this.$n())}},onFloatUp:function(a){if((this._inplace||this.isOpen())&&!jq(this.getPopupNode_()).is(":animated")&&!zUtl.isAncestor(this,a.origin)&&(this.isOpen()&&this.close({sendOnOpen:!0}),this._inplace)){a=this.$n();var b=this.getInplaceCSS();jq(a).hasClass(b)||
(a.style.width=jq.px0(zk(a).revisedWidth(a.offsetWidth)),jq(this.getInputNode()).addClass(b),jq(a).addClass(b),this.onSize(),a.style.width=this.getWidth()||"")}},onResponse:function(a,b){if((b.rtags.onOpen||b.rtags.onChanging)&&this.isOpen())if(jq(this.getPopupNode_()).is(":animated")){var c=this;setTimeout(function(){if(c.desktop)c.onResponse(a,b)},50)}else{var d=this.getPopupNode_(),e=this.getPopupSize_(d);try{var f=d.scrollLeft;var g=d.scrollTop;d.style.height="auto";zk.ie9&&(d.style.width=e[0]);
this._fixsz(e)}finally{d.scrollTop=g||0,d.scrollLeft=f||0}}},onScroll:function(a){this.isOpen()&&a&&((a=this.getInputNode())&&zul.inp.InputWidget._isInView(this)?zk(this.getPopupNode_()).position(a,"after_start"):this.close({sendOnOpen:!0}))},setOpen:function(a,b){this.isRealVisible()&&(a?this.open(b):this.close(b))},isOpen:function(){return this._open},open:function(a){if(!this._open){this._inplace&&(this._inplaceIgnore=!0);this._open=!0;a&&a.focus&&this.focus();var b=this.getPopupNode_(),c=this.getInputNode(),
d=this.getPopupNode_(!0);if(b){this.setFloating_(!0,{node:b});zWatch.fire("onFloatUp",this);var e=this.setTopmost(),f=this.getSclass();b.className=this.$s("popup")+(f?" "+f:"");b.style.zIndex=0<e?e:1;b.style.position="absolute";b.style.display="block";e=this._getPopupSize(b,d);(f=zk.ie10_||zk.ie11_)&&this._fixsz(e);b.style.visibility="hidden";b.style.left="-10000px";zk(b).makeVParent();zWatch.fireDown("onVParent",this);f&&(b.style.height=b.style.width="auto");this._fixsz(e);b.style.left="";var g=
this.$n();e=jq(g);f=jq(b);this._checkPopupSpaceAndPosition(b,g);this._shallSyncPopupPosition=!1;g=f.offset().top;b.style.display="none";b.style.visibility="";e.offset().top>g?this.slideDown_(b,"b"):this.slideDown_(b);this._fixFfWhileBothScrollbar(b,d);this._shadow||(this._shadow=new zk.eff.Shadow(b,{left:-4,right:4,top:-2,bottom:3}));a&&a.sendOnOpen&&this.fire("onOpen",{open:!0,value:c.value},{rtags:{onOpen:1}});a=this.$s("open");e.addClass(a);f.addClass(a)}}},_getPopupSize:function(a,b){var c=this.getPopupSize_(a);
a.style.width=c[0];a.style.height="auto";b&&(b.style.width=b.style.height="auto");this.presize_()&&(c=this.getPopupSize_(a));return c},_checkPopupSpaceAndPosition:function(a,b){a=zk(a);var c=a.dimension().height,d=a.dimension().width,e=(b.nodeType?zk(b):b).dimension(!0),f=e.top,g=e.left,p=e.height,h=this.$n("btn");e=e.width-(h?h.offsetWidth:0);h=jq.innerX();var n=jq.innerY(),q=jq.innerHeight(),r=jq.innerWidth(),k="start",l="after",m;h+r-g-e>d?k="start":g-h>d?k="end":m={overflow:!0};n+q-f-p>c?l="after":
f-n>c?l="before":m={overflow:!0};a.position(b,l+"_"+k,m)},_fixFfWhileBothScrollbar:function(a,b){if(zk.gecko&&(b=b?b.rows:null)&&10<a.offsetHeight-a.clientHeight&&150>a.offsetHeight){for(var c=0,d=b.length;d--;)c+=b[d].offsetHeight;a.style.height=jq.px0(c+20)}},_checkPopupPosition:function(){var a=this.getPopupNode_(),b=zk(a),c=this.getInputNode();a=b.dimension(!0);c=zk(c).dimension(!0);var d=a.top+a.height,e=a.left+a.width;b=d-b.scrollOffset()[1];var f=c.top+c.height,g=c.left+c.width;return b>=jq.innerHeight()||
a.top<c.top&&d<c.top||a.left<g&&e>c.left&&d>c.top&&a.top<f?this._shallSyncPopupPosition=!0:!1},presize_:zk.$void,slideDown_:function(a,b){zk(a).slideDown(this,{afterAnima:this._afterSlideDown,duration:100,anchor:b})},slideUp_:function(a){a.style.display="none"},zsync:function(){this.$supers("zsync",arguments);!zk.css3&&this.isOpen()&&this._shadow&&this._shadow.sync()},_afterSlideDown:function(a){this.desktop||(zk(a).undoVParent(),jq(a).remove());this._shadow&&this._shadow.sync()},getPopupNode_:function(a){return a?
this.$n("cave"):this.$n("pp")},close:function(a){if(this._open){this._inplace&&(this._inplaceIgnore=!1);var b=this;if(jq(this.getPopupNode_()).is(":animated"))setTimeout(function(){b.desktop&&b.close(a)},50);else{this._open=!1;a&&a.focus&&this.focus();var c=this.getPopupNode_();if(c){this.setFloating_(!1);zWatch.fireDown("onHide",this);this.slideUp_(c);zk.afterAnimate(function(){zk(c).undoVParent();zWatch.fireDown("onVParent",b)},-1);this._shadow&&(this._shadow.destroy(),this._shadow=null);a&&a.sendOnOpen&&
this.fire("onOpen",{open:!1,value:this.getInputNode().value},{rtags:{onOpen:1}});var d=this.$s("open");jq(this.$n()).removeClass(d);jq(c).removeClass(d)}}}},_fixsz:function(a){var b=this.getPopupNode_();if(b){var c=this.getPopupNode_(!0);"auto"==a[1]&&350<b.offsetHeight?b.style.height="350px":10>b.offsetHeight&&this._shadow&&this._shadow.sync();var d=this.$n(),e;(e=this.getPopupWidth())?e.endsWith("%")?b.style.width=jq.px0(d.offsetWidth*parseFloat(e)/100):b.style.width=e:"auto"==a[0]&&(b.offsetWidth<=
d.offsetWidth?(b.style.width=jq.px0(zk(b).revisedWidth(d.offsetWidth)),c&&(c.style.width="100%")):(a=jq.innerWidth()-20,a<d.offsetWidth&&(a=d.offsetWidth),b.offsetWidth>a&&(b.style.width=jq.px0(a))))}},dnPressed_:zk.$void,upPressed_:zk.$void,otherPressed_:zk.$void,enterPressed_:function(a){this.close({sendOnOpen:!0});this.updateChange_();a.stop()},escPressed_:function(a){this.close({sendOnOpen:!0});a.stop()},getPopupSize_:function(a){return["auto","auto"]},redrawpp_:function(a){},afterKeyDown_:function(a,
b){!b&&this._inplace&&jq(this.$n()).toggleClass(this.getInplaceCSS(),13==a.keyCode?null:!1);return this.$supers("afterKeyDown_",arguments)},_dnInputOpen:function(){this._autodrop&&!this._open&&this.open({sendOnOpen:!0})},bind_:function(){this.$supers(zul.inp.ComboWidget,"bind_",arguments);var a;if(a=this.$n("btn"))this.domListen_(a,zk.android?"onTouchstart":"onClick","_doBtnClick"),this._inplace&&this.domListen_(a,"onMouseDown","_doBtnMouseDown");this.domListen_(this.$n("real"),"onInput","_dnInputOpen");
zWatch.listen({onSize:this,onFloatUp:this,onResponse:this,onScroll:this});if(!zk.css3)jq.onzsync(this)},unbind_:function(){this.close();var a=this.$n("btn");a&&(this.domUnlisten_(a,zk.android?"onTouchstart":"onClick","_doBtnClick"),this._inplace&&this.domUnlisten_(a,"onMouseDown","_doBtnMouseDown"));zWatch.unlisten({onSize:this,onFloatUp:this,onResponse:this,onScroll:this});zk.css3||jq.unzsync(this);this.domUnlisten_(this.$n("real"),"onInput","_dnInputOpen");this.$supers(zul.inp.ComboWidget,"unbind_",
arguments)},inRoundedMold:function(){return!0},_doBtnClick:function(a){this._inplaceIgnore=!1;this._buttonVisible&&(this._disabled||jq(this.getPopupNode_()).is(":animated")||(this._open?this.close({focus:zul.inp.InputCtrl.isPreservedFocus(this),sendOnOpen:!0}):this.open({focus:zul.inp.InputCtrl.isPreservedFocus(this),sendOnOpen:!0})),zk.ios&&(this._windowX=window.pageXOffset,this._windowY=window.pageYOffset),a.stop(this._open?{propagation:1}:null))},_doBtnMouseDown:function(a){this._inplaceIgnore=
!0},doKeyDown_:function(a){this._disabled||(this._doKeyDown(a),a.stopped||this.$supers("doKeyDown_",arguments))},doClick_:function(a){this._disabled||(a.domTarget==this.getPopupNode_()?this.close({focus:zul.inp.InputCtrl.isPreservedFocus(this),sendOnOpen:!0}):this._readonly&&!this.isOpen()&&this._buttonVisible&&this.open({focus:zul.inp.InputCtrl.isPreservedFocus(this),sendOnOpen:!0}),this.$supers("doClick_",arguments))},_doKeyDown:function(a){var b=a.keyCode,c=this._open;a.target==this&&(9==b||zk.webkit&&
0==b)?c&&this.close({sendOnOpen:!0}):!a.altKey||38!=b&&40!=b?!c||13!=b&&27!=b?38==b?this.upPressed_(a):40==b?this.dnPressed_(a):this.otherPressed_(a):13==b?this.enterPressed_(a):this.escPressed_(a):(c?this.close({sendOnOpen:!0}):this.open({sendOnOpen:!0}),b={propagation:!0},11>zk.ie&&(b.dom=!0),a.stop(b))},redraw_:_zkf=function(a){var b=this.uuid,c=this._buttonVisible;a.push("<span",this.domAttrs_({text:!0,tabindex:!0}),'><input id="',b,'-real" class="',this.$s("input"));c||a.push(" ",this.$s("input-full"));
a.push('" autocomplete="off"',this.textAttrs_(),'/><a id="',b,'-btn" class="',this.$s("button"));c||a.push(" ",this.$s("disabled"));a.push('"><i id="',b,'-icon" class="',this.$s("icon")," ",this.getIconSclass(),'"></i></a>');this.redrawpp_(a);a.push("</span>")}},{$redraw:_zkf});
