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.startsWith",function(a){return a?a:function(a,c){var b=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var e=b.length,f=a.length;c=Math.max(0,Math.min(c|0,b.length));for(var h=0;h<f&&c<e;)if(b[c++]!=a[h++])return!1;return h>=f}},"es6","es3");
zul.inp.Combobox=zk.$extends(zul.inp.ComboWidget,{_autocomplete:!0,_instantSelect:!0,_iconSclass:"z-icon-caret-down",$define:{autocomplete:null,emptySearchMessage:null,repos:function(){if(this.desktop){var a=this.getInputNode();a.value=null!=this.valueEnter_?this.valueEnter_:this._value||"";if(11>=zk.ie&&a.value){var b=a.value.length;b=[b,b]}this._typeahead(this._bDel,b);this._bDel=null;if(a=this.getPopupNode_())a.style.width="auto",zk.webkit&&(this._shallRedoCss=!0)}this._repos=!1},instantSelect:null},
onResponse:function(){var a=arguments;if(this.isOpen()&&jq(this.getPopupNode_()).is(":animated")){var b=this;setTimeout(function(){b.desktop&&b.onResponse.apply(b,a)},50)}else{this.$supers("onResponse",arguments);this._shallRedoCss&&(zk(this.getPopupNode_()).redoCSS(-1),this._shallRedoCss=null);if(this._shallCheckPopupPosition||a[1]&&a[1].rtags&&a[1].rtags.onChanging&&this.isOpen())this._checkPopupPosition(),this._shallCheckPopupPosition=!1,this._fixEmptySearchMessage();this.isOpen()&&this._shallSyncPopupPosition&&
(zk(this.getPopupNode_()).position(this.getInputNode(),"before_start"),this._shallSyncPopupPosition=!1)}},setSelectedItemUuid_:function(a){if(this.desktop){if(!this._sel||a!=this._sel.uuid){var b=this._sel,c;this._sel=this._lastsel=null;(a=zk.$(a))&&(c=a);this._hiliteOpt(b,this._sel=c);this._lastsel=c}}else this._initSelUuid=a},setValue:function(a){this.$supers("setValue",arguments);this._reIndex();this.valueEnter_=null;this._lastsel=this._sel},_reIndex:function(){var a=this.getValue();if(!this._sel||
a!=this._sel.getLabel()){if(this._sel){var b=this._sel.$n();b&&jq(b).removeClass(this._sel.$s("selected"))}this._sel=this._lastsel=null;for(b=this.firstChild;b;b=b.nextSibling)if(a==b.getLabel()){this._sel=b;break}}},validateStrict:function(a){var b=this._cst;return this._findItem(a,!0)?null:(b?b._errmsg.STRICT?b._errmsg.STRICT:"":"")||msgzul.VALUE_NOT_MATCHED},_findItem:function(a,b){return this._findItem0(a,b)},_findItem0:function(a,b,c,d){var e=this.firstChild;if(e&&a){a=a.toLowerCase();var f=
this._sel;f&&f.parent==this||(f=e);for(d=d?f.nextSibling?f.nextSibling:e:f;;){if((!b||!d.isDisabled())&&d.isVisible()&&(c?d.getLabel().toLowerCase().startsWith(a):a==d.getLabel().toLowerCase()))return d;(d=d.nextSibling)||(d=e);if(d==f)break}}},_hilite:function(a){this._hilite2(this._findItem(this.valueEnter_=this.getInputNode().value,this._isStrict()||a&&a.strict),a)},_hilite2:function(a,b){b=b||{};var c=this._sel;this._sel=a;this._hiliteOpt(c,a);if(b.sendOnSelect&&this._lastsel!=a){if(a){c=this.getInputNode();
var d=a.getLabel();this.valueEnter_=c.value=d;b.noSelectRange||(zk.gecko?c.select():zk(c).setSelectionRange(0,d.length))}b.sendOnChange&&this.$supers("updateChange_",[]);this.fire("onSelect",{items:a?[a]:[],reference:a,prevSeld:this._lastsel});this._lastsel=a}else b.sendOnChange&&this.$supers("updateChange_",[])},_hiliteOpt:function(a,b){if(a&&a.parent==this){var c=a.$n();c&&jq(c).removeClass(a.$s("selected"))}b&&!b.isDisabled()&&jq(b.$n()).addClass(b.$s("selected"))},_isStrict:function(){var a=this.getConstraint();
return a&&a._flags&&a._flags.STRICT},onChildAdded_:function(a){this.$supers("onChildAdded_",arguments);this._shallCheckPopupPosition=!0},onChildRemoved_:function(a){this.$supers("onChildRemoved_",arguments);this._shallCheckPopupPosition=!0},open:function(a){this.$supers("open",arguments);this._hilite()},dnPressed_:function(a){this._updnSel(a)},upPressed_:function(a){this._updnSel(a,!0)},_updnSel:function(a,b){var c=this.getInputNode(),d=c.value;if(d||this._sel){d=d.toLowerCase();var e=this._sel;this._next(null,
b);e&&e.parent==this||(e=this._next(null,!b));if(!e){a.stop();return}for(var f=e;;){if(!f.isDisabled()&&f.isVisible()){var h=f.getLabel().toLowerCase();if(d==h){var g=f;break}else if(!k&&h.startsWith(d)){var k=f;break}}h=this._next(f,b);if(f==h)break;if((f=h)==e)break}g||(g=k);g?(c=zk(c).getSelectionRange(),0==c[0]&&c[1]==d.length&&(g=this._next(g,b))):g=this._next(null,!b)}else g=this._next(null,!0);g&&zk(g).scrollIntoView(this.$n("pp"));this._select(g,!this._instantSelect&&this._open?{}:{sendOnSelect:!0,
sendOnChange:!0});a.stop()},_next:function(){function a(a,c,d){c=c?"previousSibling":"nextSibling";for(a=d?a:a[c];a;a=a[c])if(!a.isDisabled()&&a.isVisible())return a;return null}return function(b,c){b&&(b=a(b,c));return b?b:a(c?this.firstChild:this.lastChild,!c,!0)}}(),_select:function(a,b){var c=this.getInputNode(),d=c.value=a?a.getLabel():"";this.valueSel_=d;this._hilite2(a,b);d&&(zk.gecko?c.select():zk(c).setSelectionRange(0,d.length))},otherPressed_:function(a){var b=a.keyCode;this._bDel=8==b||
46==b;if(this._readonly)switch(b){case 35:case 36:this._hilite2(),this.getInputNode().value="";case 37:case 39:this._updnSel(a,37==b||35==b);break;case 8:a.stop();break;default:96<=b&&105>=b&&(b-=48),a=String.fromCharCode(b),(a=this._findItem0(a,!0,!0,!!this._sel))&&this._select(a,{sendOnSelect:!0})}},escPressed_:function(){if(!this._instantSelect&&this._open&&this._lastsel!=this._sel){this._hilite2(this._lastsel);var a=this._lastsel?this._lastsel.getLabel():"";this.valueSel_=this.valueEnter_=this.getInputNode().value=
a}this.$supers("escPressed_",arguments)},doKeyUp_:function(a){if(!this._disabled){if(!this._readonly&&!this._autoCompleteSuppressed){var b=a.keyCode;this._typeahead(8==b||46==b)}this.$supers("doKeyUp_",arguments)}},_typeahead:function(a,b){if(zk.currentFocus==this){var c=this.getInputNode(),d=c.value;b=b||zk(c).getSelectionRange();var e=this.firstChild;this.valueEnter_=d;if(!d||!e||b[0]!=d.length||b[0]!=b[1])return this._hilite({strict:!0});if((b=this._findItem(d,!0))||a||!this._autocomplete)return b&&
b.getLabel().toLowerCase().startsWith(d.toLowerCase())&&this._autocomplete&&(c.value=b.getLabel()),this._hilite2(b);d=d.toLowerCase();(b=this._sel)&&b.parent==this||(b=e);for(a=b;;){if(!a.isDisabled()&&a.isVisible()&&a.getLabel().toLowerCase().startsWith(d)){c.value=a.getLabel();zk(c).setSelectionRange(d.length,c.value.length);this._hilite2(a);break}(a=a.nextSibling)||(a=e);if(a==b){this._hilite2();break}}}},updateChange_:function(){if(this._value!=this.getInputNode().value)return this._hilite({sendOnSelect:!0,
sendOnChange:!0,noSelectRange:!0}),!0;this.valueEnter_=null},bind_:function(){this.$supers(zul.inp.Combobox,"bind_",arguments);this.isListen("onOpen")&&this.listen({onChanging:zk.$void},-1E3);this._initSelUuid&&(this.setSelectedItemUuid_(this._initSelUuid),this._initSelUuid=null);var a=this.getInputNode();this.domListen_(a,"onCompositionstart","_doCompositionstart").domListen_(a,"onCompositionend","_doCompositionend")},unbind_:function(){this._hilite2();this._sel=this._lastsel=null;var a=this.getInputNode();
this.domUnlisten_(a,"onCompositionend","_doCompositionend").domUnlisten_(a,"onCompositionstart","_doCompositionstart");this.isListen("onOpen")&&this.unlisten({onChanging:zk.$void});this.$supers(zul.inp.Combobox,"unbind_",arguments)},_doCompositionstart:function(){this._autoCompleteSuppressed=!0},_doCompositionend:function(){this._autoCompleteSuppressed=!1;this._disabled||this._readonly||this._typeahead(!1)},redrawpp_:function(a){var b=this.uuid,c=this._emptySearchMessage;a.push('<div id="',b,'-pp" class="',
this.$s("popup")," ",this.getSclass(),'" style="display:none">');c&&a.push('<div id="',b,'-emptySearchMessage" class="',this.$s("emptySearchMessage")," ",this.$s("emptySearchMessage-hidden"),'">',c,"</div>");a.push('<ul id="',b,'-cave" class="',this.$s("content"),'" >');for(b=this.firstChild;b;b=b.nextSibling)b.redraw(a);a.push("</ul></div>")},afterAnima_:function(a){a&&this._lastsel&&zk(this._lastsel).scrollIntoView(this.$n("pp"));this.$supers("afterAnima_",arguments)},_fixsz:function(){var a=this.getPopupNode_();
a.style.width="auto";this.$supers("_fixsz",arguments);zk(a).hasVScroll()&&!this.getPopupWidth()&&(a.style.width=jq.px(a.offsetWidth+jq.scrollbarWidth()))},_fixEmptySearchMessage:function(){this._emptySearchMessage&&jq(this.$n("emptySearchMessage")).toggleClass(this.$s("emptySearchMessage-hidden"),0<this.nChildren)}});
