var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(e,l,f){e instanceof String&&(e=String(e));for(var m=e.length,n=0;n<m;n++){var q=e[n];if(l.call(f,q,n,e))return{i:n,v:q}}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(e,l,f){e!=Array.prototype&&e!=Object.prototype&&(e[l]=f.value)};
$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(e,l,f,m){if(l){f=$jscomp.global;e=e.split(".");for(m=0;m<e.length-1;m++){var n=e[m];n in f||(f[n]={});f=f[n]}e=e[e.length-1];m=f[e];l=l(m);l!=m&&null!=l&&$jscomp.defineProperty(f,e,{configurable:!0,writable:!0,value:l})}};
$jscomp.polyfill("Array.prototype.find",function(e){return e?e:function(e,f){return $jscomp.findInternal(this,e,f).v}},"es6","es3");
(function(){function e(a){switch(a.data.keyCode){case 33:case 34:case 38:case 40:case 37:case 39:case 32:case 36:case 35:return a.stop(),!1}return!0}function l(a){return a.target.$button||zk.isLoaded("zul.wgt")&&a.target.$instanceof(zul.wgt.Button,zul.wgt.Toolbarbutton)}function f(a){var b;(b=jq.nodeName(a.domTarget,"input","textarea","button","select","option","a")&&!a.target.$instanceof(zul.sel.SelectWidget)||l(a))||(b=a.target.$inputWidget||zk.isLoaded("zul.inp")&&a.target.$instanceof(zul.inp.InputWidget));
return b}function m(a){return a&&(a=a.uuid)?zk.Widget.$(a):null}function n(a){return zk.isLoaded("zkex.sel")&&a.$instanceof(zkex.sel.Listgroup)}function q(a){return zk.isLoaded("zkex.sel")&&a.$instanceof(zkex.sel.Listgroupfoot)}var r=zul.sel.SelectWidget=zk.$extends(zul.mesh.MeshWidget,{rightSelect:!0,_anchorTop:0,_anchorLeft:0,_isSelecting:!0,_startRow:null,$init:function(){this.$supers("$init",arguments);this._selItems=[]},$define:{checkmark:function(a){this.desktop&&this.rerenderLater_()},multiple:function(a){if(!this._multiple&&
this._selItems.length){a=this.getSelectedItem();for(var b;b=this._selItems.pop();)b!=a&&(this._checkmark?b._selected=!1:b._setSelectedDirectly(!1));this._selItems.push(a)}this._checkmark&&this.desktop&&this.rerenderLater_()},selectedIndex:[function(a){return-1>a||!a&&0!==a?-1:a},function(){var a=this._selectedIndex;this.clearSelection();this._selectedIndex=a;if(-1<a){for(var b,c=this.getBodyWidgetIterator();0<=a--;)b=c.next();b&&(a=1<this._selItems.length,this._selectOne(b,!0),a||((a=this._scrollbar)?
a.scrollToElement(item.$n()):zk(b).scrollIntoView(this.ebody)))}}],name:function(){this.destkop&&this.updateFormData()},selectOnHighlightDisabled:_zkf},setChgSel:function(a){for(var b={},c=0;;){var d=a.indexOf(",",c);(c=(0<=d?a.substring(c,d):a.substring(c)).trim())&&(b[c]=!0);if(0>d)break;c=d+1}this.$$selectAll=void 0;for(a=this.getBodyWidgetIterator();d=a.next();)this._changeSelect(d,1==b[d.uuid])},setFocusIndex:function(a){if(!(0>a)){var b=this;setTimeout(function(){for(var c,d=b.getBodyWidgetIterator();(c=
d.next())&&a--&&d.hasNext(););b._focusItem=c})}},updateFormData:function(){if(this._name){this.efield||(this.efield=jq(this.$n()).append('<div style="display:none;"></div>').find("> div:last-child")[0]);jq(this.efield).children().remove();for(var a="",b='<input type="hidden" name="'+zUtl.encodeXML(this._name)+'" value="',c=0,d=this._selItems.length;c<d;c++)a+=b+zUtl.encodeXML(this._selItems[c].getValue())+'"/>';jq(this.efield).append(a)}else this.efield&&(jq(this.efield).remove(),this.efield=null)},
setSelectedItem:function(a){if(a){var b=1<this._selItems.length;this._selectOne(a,!0);b||((b=this._scrollbar)&&b.scrollToElement(a.$n()),this._nativebar&&zk(a).scrollIntoView(this.ebody));(zk.edge||4<=zk.ff)&&this.ebody&&this._nativebar&&(this._currentTop=this.ebody.scrollTop,this._currentLeft=this.ebody.scrollLeft)}else this.clearSelection()},getSelectedItem:function(){return this._selItems[0]},getSelectedItems:function(){return this._selItems.$clone()},setHeight:function(a){if(!this._nvflex&&this._height!=
a){this._height=a;var b=this.$n();b&&(b.style.height=a||"",this.onSize())}},setVflex:function(a){this.$supers("setVflex",arguments);if(this.desktop)this.onSize()},setHflex:function(a){this.$supers("setHflex",arguments);if(this.desktop)this.onSize()},_getEbodyWd:function(){var a=this.$n("a");zk.webkit&&(a.style.display="none");var b=zk.opera&&0==this.ebody.offsetHeight?this.ebody.offsetWidth:this.ebody.clientWidth;zk.webkit&&(a.style.display="");return b},_beforeCalcSize:function(){if(zk.ie8){var a=
this.$n("a");this._oldCSS=a.style.display;a.style.display="none"}11>zk.ie&&this._syncFocus(this._focusItem);this._calcHgh()},_afterCalcSize:function(){zk.ie8&&(this.$n("a").style.display=this._oldCSS,delete this._oldCSS);this.$supers("_afterCalcSize",arguments)},indexOfItem:function(a){if(a.getMeshWidget()==this)for(var b=0,c=this.getBodyWidgetIterator(),d;d=c.next();b++)if(d==a)return b;return-1},toggleItemSelection:function(a){a.isSelected()?this._removeItemFromSelection(a):this._addItemToSelection(a);
this.updateFormData()},selectItem:function(a){a?!this._multiple&&a.isSelected()||this.setSelectedIndex(this.indexOfItem(a)):this.setSelectedIndex(-1)},_addItemToSelection:function(a){if(!a.isSelected()){if(this._multiple){var b=this.indexOfItem(a);if(b<this._selectedIndex||0>this._selectedIndex)this._selectedIndex=b;a._setSelectedDirectly(!0)}else this._selectedIndex=this.indexOfItem(a);this._selItems.push(a)}},_removeItemFromSelection:function(a){a.isSelected()&&(this._multiple?(a._setSelectedDirectly(!1),
this._selItems.$remove(a)):this.clearSelection())},clearSelection:function(){if(this._selItems.length){for(var a;a=this._selItems.pop();)a._setSelectedDirectly(!1);this._selectedIndex=-1;this._updHeaderCM()}else this._focusItem=null,this._anchorTop=this._anchorLeft=0,this._syncFocus()},focus_:function(a){var b;if(b=this.$n("a")){if(this._focusItem)for(var c=this.getBodyWidgetIterator(),d;d=c.next();){if(this._isFocus(d)){d.focus_(a);break}}else this._currentTop&&(c=this.ebody.scrollHeight,b.style.top=
this._currentTop>c?c+"px":this._currentTop+"px"),this._currentLeft&&(b.style.left=this._currentLeft+"px");this.focusA_(b,a);return!0}return!1},focusA_:function(a,b){zk(a).focus(b)},bind_:function(){this.$supers(r,"bind_",arguments);var a=this.$n("a");a&&this.domListen_(a,"onFocus","doFocus_").domListen_(a,"onKeyDown").domListen_(a,"onBlur","doBlur_");this.updateFormData();this._updHeaderCM()},unbind_:function(){var a=this.$n("a");a&&this.domUnlisten_(a,"onFocus","doFocus_").domUnlisten_(a,"onKeyDown").domUnlisten_(a,
"onBlur","doBlur_");this.$supers(r,"unbind_",arguments)},clearCache:function(){this.$supers("clearCache",arguments);this.efield=null},doFocus_:function(a){var b=this._focusItem||this._lastSelectedItem;b&&b._doFocusIn();this.$supers("doFocus_",arguments)},doBlur_:function(a){this._focusItem&&(this._lastSelectedItem=this._focusItem,this._focusItem._doFocusOut());this._focusItem=null;this.$supers("doBlur_",arguments)},shallIgnoreSelect_:function(a){return"onRightClick"==a.name?this.rightSelect?-1:!0:
!1},_shallIgnore:function(a,b){if(this.checkOnHighlightDisabled_()||!a.domTarget||!a.target.canActivate())return!0;if(b){try{var c=a.domTarget;if(c)for(;c.id!=this.uuid;)if(!(c=c.parentNode))return!0}catch(h){zk.debugLog(h.message||h)}if("string"==typeof(b=this.nonselectableTags)){if(!b)return;if("*"==b)return!0;c=jq.nodeName(a.domTarget);var d="input"==c&&"button"==a.domTarget.type.toLowerCase();return 0>b.indexOf(c)?0<=b.indexOf("button")&&(l(a)||d):!d||0<=b.indexOf("button")}}return f(a)},checkOnHighlightDisabled_:zk.$void,
_doItemSelect:function(a,b){var c,d=b.domTarget,h=a.$n("cm");h=this._checkmark&&(d==h||d.parentNode==h);if(!(zk.dragging||!h&&(this._shallIgnore(b,!0)||(c=this.shallIgnoreSelect_(b,a))&&!(c=0>c))))if(d=f(b),!this._checkmark||b.data.shiftKey||b.data.ctrlKey||b.data.metaKey||this._cdo&&!h){if((zk.gecko||zk.webkit)&&a.isListen("onDoubleClick")){h=jq.now();var e=a._last;a._last=h;if(e&&900>h-e)return}this._syncFocus(a);this._multiple?b.data.shiftKey?this._selectUpto(a,b,d):b.data.ctrlKey||b.data.metaKey?
this._toggleSelect(a,!a.isSelected(),b,d):c&&a.isSelected()||this._select(a,b,d):this._select(a,b,d);d||a.focus()}else this._syncFocus(a),this._multiple?(h=a.isSelected())&&c||this._toggleSelect(a,!h,b,d):this._select(a,b,d)},doKeyDown_:function(a){if(!this._shallIgnore(a))switch(a.data.keyCode){case 33:case 34:case 38:case 40:case 37:case 39:case 32:case 36:case 35:return jq.nodeName(a.domTarget,"a")||this.focus(),a.domTarget==this.$n("a")&&(a.target==this&&(a.target=this._focusItem||this.getSelectedItem()||
this),this._doKeyDown(a)),a.stop(),!1}jq.nodeName(a.domTarget,"input","textarea")||(this._disableSelection_=!0,zk(this.$n()).disableSelection());a.target==this&&(a.target=this._focusItem||this.getSelectedItem()||this);this.$supers("doKeyDown_",arguments)},doKeyUp_:function(a){this._disableSelection_&&(this._disableSelection_=!1,zk(this.$n()).enableSelection());a.stop({propagation:!0});this.$supers("doKeyUp_",arguments)},_doKeyDown:function(a){if(zAu.processing()||this._shallIgnore(a))return!0;var b=
this._focusItem||this.getSelectedItem(),c=a.data,d=c.shiftKey,h=c.ctrlKey||c.metaKey;d&&!this._multiple&&(d=!1);this._startRow&&!d&&this._multiple?this._startRow=null:!this._startRow&&d&&(this._startRow=b);var p=!1;zk.webkit&&"string"==typeof c.keyCode&&(c.keyCode=zk.parseInt(c.keyCode));switch(c.keyCode){case 33:case 34:var g=this.paging||this._paginal;if(b&&g&&!g.isDisabled()){a=this.getActivePage()+(33==c.keyCode?-1:1);-1<a&&a<this.getPageCount()&&this.fire("onAcrossPage",{page:a,offset:this.indexOfItem(b),
shift:d&&this._multiple?33==c.keyCode?this.getPageSize():-this.getPageSize():0});return}g=this._visibleRows();0==g&&(g=this.getPageSize()||20);33==c.keyCode&&(g=-g);break;case 38:case 40:g=40==c.keyCode?1:-1;break;case 32:b&&(this._multiple?this._toggleSelect(b,!b.isSelected(),a):this._select(b,a));break;case 36:case 35:g=35==c.keyCode?1:-1;p=!0;break;case 37:b&&this._doLeft(b);break;case 39:b&&this._doRight(b)}if(0<g||0>g&&b)for(b&&d&&!b.isDisabled()&&b.isSelectable()&&this._toggleSelect(b,this._getToSelFlag(b,
this._startRow,g),a),b=b?b.$n():null;;){if(b)b=0<g?b.nextSibling:b.previousSibling;else if(b=this.getBodyWidgetIterator().next())b=b.$n();else return;if(!b){if(p)break;(p=this.paging||this._paginal)&&!p.isDisabled()&&(b=p.getActivePage(),0<g?b+1<p.getPageCount():0<b)&&(this.fire("onAcrossPage",{page:b+(0<g?1:0),offset:0<g?0:-1,shift:this._multiple&&d?0<g?-1:1:0}),this.$class.shallSyncSelInView||(this.$class.shallSyncSelInView={}),this.$class.shallSyncSelInView[this.uuid]=!0);break}c=zk.Widget.$(b);
c.$instanceof(zul.sel.Treerow)&&(c=c.parent);if(!c.isDisabled()&&c.isSelectable()&&(d&&this._toggleSelect(c,p?this._getToSelFlag(c,this._startRow,g):!0,a),zk(b).isVisible())){var f=c;if(!p&&(0<g?--g:++g,0==g))break}}f&&(d||(h?this._focus(f):this._select(f,a)),this._syncFocus(f),(d=this._scrollbar)?d.scrollToElement(f.$n()):zk(f.$n()).scrollIntoView(this.ebody));return e(a)},_getToSelFlag:function(a,b,c){if(!b)return!0;a=b.compareItemPos_(a);return 0==a||-1==a&&-1==c||1==a&&1==c},_doKeyUp:function(a){return zAu.processing()||
this._shallIgnore(a)||e(a)},_doLeft:zk.$void,_doRight:zk.$void,_syncFocus:function(a){var b=this.$n("a");if(b){var c=b.style,d=this._anchorTop,h=this._anchorLeft,e;a&&(e=a.$n())?(a=zk(e).revisedOffset(),a=this._toStyleOffset(b,a[0]+this.ebody.scrollLeft,a[1])):a=[h?h:0,d?d:0];this.fixAnchor_(a,b);if(this._anchorTop!=a[1]||this._anchorLeft!=a[0])this._anchorTop=a[1],this._anchorLeft=a[0],this.fire("onAnchorPos",{top:this._anchorTop,left:this._anchorLeft});c.top=this._anchorTop+"px";c.left=this._anchorLeft+
"px"}},_toStyleOffset:function(a,b,c){var d=zk(a).revisedOffset(),h=zk.parseInt(a.style.left);a=zk.parseInt(a.style.top);return[b-d[0]+h,c-d[1]+a]},fixAnchor_:function(a,b){var c=this.ebody,d=c.scrollWidth;c=c.scrollHeight;a[0]>=d&&(a[0]=d-jq(b).width());a[1]>=c&&(a[1]=c-jq(b).height())},_select:function(a,b,c){this._selectOne(a,c)&&this.fireOnSelect(a,b)},_selectUpto:function(a,b,c){if(a.isSelected())c||this._focus(a);else{var d=!1,h=!1,e=this._focusItem||this._lastSelectedItem;if(!e.isSelected())for(var g=
this.indexOfItem(a),f=Number.MAX_VALUE,k=0;k<this._selItems.length;++k){var l=this._selItems[k],m=this.indexOfItem(l),n=f;f=Math.min(g-m,f);f!=n&&(e=l)}g=this.getBodyWidgetIterator();for(f=this.getSelectedItem();k=g.next();)if(!k.isDisabled()&&k.isSelectable())if(d){if(this._changeSelect(k,!0),k==a)break}else if(h){if(this._changeSelect(k,!0),this._isFocus(k)||k==e)break}else if(f){if(h=k==a,d=this._isFocus(k)||k==e,h||d)if(this._changeSelect(k,!0),h&&d)break}else if(k==a){this._changeSelect(k,!0);
break}c||this._focus(a);this.fireOnSelect(a,b)}},setSelectAll:_zkf=function(a,b){for(var c=this.getBodyWidgetIterator(),d;d=c.next();)d._loaded&&!d.isDisabled()&&d.isSelectable()&&this._changeSelect(d,!0);a&&!0!==b&&this.fireOnSelect(this.getSelectedItem(),b)},selectAll:_zkf,_selectOne:function(a,b){var c=this.getSelectedItem();if(this._multiple){if(a&&!b&&this._unsetFocusExcept(a),!this._unsetSelectAllExcept(a)&&a&&c==a)return b||this._setFocus(a,!0),!1}else{if(c){if(c==a)return b||this._setFocus(a,
!0),!1;this._changeSelect(c,!1);a&&(b||this._setFocus(c,!1))}a&&!b&&this._unsetFocusExcept(a)}a&&(this._changeSelect(a,!0),b||this._setFocus(a,!0));return!0},_toggleSelect:function(a,b,c,d){this._isSelecting=b;if(!this._multiple){var e=this.getSelectedItem();a!=e&&b&&this._changeSelect(a,!1)}this._changeSelect(a,b);d||this._focus(a);this.fireOnSelect(a,c)},fireOnSelect:function(a,b){for(var c=[],d=this.getSelectedItems(),e=d.length;e--;)d[e].isSelected()&&c.push(d[e]);e=!0;d=!1;this._multiple&&this._headercm&&
(d=jq(this._headercm).hasClass(zk.Widget.$(this._headercm).$s("checked")));if(b){var f=b.data;this._multiple&&(this._headercm&&jq.isAncestor(this._headercm,b.domTarget)&&!d?e=!1:(b=b.domTarget,e=a&&a.$n("cm"),e=f.ctrlKey||f.metaKey||f.shiftKey||this._checkmark&&(!this._cdo||b==e||b.parentNode==e||d)))}this.fire("onSelect",zk.copy({items:c,reference:a,clearFirst:!e,selectAll:d},f),{rtags:{selectAll:d}})},_focus:function(a){this.canActivate({checkOnly:!0})&&(this._unsetFocusExcept(a),this._setFocus(a,
!0))},_changeSelect:function(a,b){var c=!!a.isSelected()!=b;c&&a.setSelected(b);return c},_isFocus:function(a){return this._focusItem==a},_setFocus:function(a,b){var c=this._isFocus(a)!=b;c&&b&&(a.focus()||this.focus(),!this.paging&&zk.gecko&&this.fireOnRender(5));b||a._doFocusOut();return c},_unsetSelectAllExcept:function(a){this.$$selectAll=void 0;for(var b=!1,c=this.getSelectedItems(),d=c.length;d--;)c[d]!=a&&this._changeSelect(c[d],!1)&&(b=!0);return b},_unsetFocusExcept:function(a){this._focusItem&&
this._focusItem!=a?this._setFocus(this._focusItem,!1):this._focusItem=null},_updHeaderCM:function(){if(this._headercm&&this._multiple){var a=this,b;this._nUpdHeaderCM=0<(b=this._nUpdHeaderCM)?b+1:1;setTimeout(function(){if(void 0==a.$$selectAll&&0>=--a._nUpdHeaderCM&&a.desktop&&a._headercm&&a._multiple){var b=zk.Widget.$(a._headercm).getZclass()+"-checked";jq(a._headercm)[a._isAllSelected()?"addClass":"removeClass"](b)}},100)}},$fireService:function(a,b,c){this._$services||(this._$services={});this._$services[a]||
(this._$services[a]=[]);this._$services[a].push(c);this.fire(a,b,{toServer:!0},250)},$doService:function(a,b){var c=this._$services&&this._$services[a];if(c){for(;c.length;)c.shift().call(this,b);this._$services[a]=null}},$hasService:function(a){return this._$services&&this._$services[a]},_isAllSelected:function(){if(!this._selItems.length){if(this._headercm&&this._model&&!this.$hasService("onUpdateSelectAll")){var a=zk.Widget.$(this._headercm).getZclass()+"-checked";jq(this._headercm).removeClass(a)}return!1}if(this._model&&
(this.$hasService("onUpdateSelectAll")||this.$fireService("onUpdateSelectAll",null,function(a){if(this.desktop&&this._headercm&&this._multiple){var b=zk.Widget.$(this._headercm).getZclass()+"-checked";jq(this._headercm)[a?"addClass":"removeClass"](b);this.$$selectAll=a}}),void 0!=this.$$selectAll))return this.$$selectAll;a=this.groupSelect;for(var b=this.getBodyWidgetIterator({skipHidden:!0}),c;c=b.next();)if((!n(c)&&!q(c)||a)&&c._loaded&&!c.isDisabled()&&c.isSelectable()&&!c.isSelected())return!1;
return!0},_ignoreHghExt:function(){return 0<this._rows},onResponse:function(a,b){if(this._shallSyncFocus){var c=this._shallSyncFocus;if(c&&!0===c)jq(this.$n("a")).offset({top:0,left:0});else{if(!c.desktop&&(c=this.getSelectedItem(),!c&&jq.isNumeric(this.getSelectedIndex()))){var d=this.getSelectedIndex();if(0<=d)for(var e=this.getBodyWidgetIterator();e.hasNext();){var f=e.next();if(f&&f._index==d){c=f;break}}}this._focusItem=c;this._syncFocus(c)}this._shallSyncFocus=!1}this._shallSyncCM&&(b.rtags.selectAll||
this._updHeaderCM(),this._shallSyncCM=!1);this.$supers(r,"onResponse",arguments)},onChildAdded_:function(a){this.$supers("onChildAdded_",arguments);this.desktop&&a.$instanceof(zul.sel.ItemWidget)&&a.isSelected()&&(this._shallSyncFocus=a)},onChildRemoved_:function(a){this.$supers("onChildRemoved_",arguments);var b=this._selItems,c;this.desktop&&(c=b.length)&&a.$instanceof(zul.sel.ItemWidget)&&(this._shallSyncFocus=b[c-1]);this._focusItem==a&&(this._lastSelectedItem=this._focusItem=null,this._itemForSelect=
a)},replaceWidget:function(a){this.$supers("replaceWidget",arguments);a._lastSelectedItem=m(this._lastSelectedItem);a._focusItem=m(this._focusItem)}})})();
