!function(){function n(t){var e=t.domEvent;return e&&jq.nodeName(e.target,"label")}var i=zul.wgt.Checkbox=zk.$extends(zul.LabelImageWidget,{_checked:!1,_disabled:!1,$define:{disabled:[function(t,e){if(e&&e.adbs?this._adbs=!0:e&&void 0!==e.adbs||(this._adbs=!1),!t)if(this._adbs)this._adbs=!1;else if(e&&!1===e.adbs)return this._disabled;return t},function(t){var e=this.$n("real");e&&(e.disabled=t,this._isDefaultMold()||(jq(this.$n()).toggleClass(this.$s(this.getMold()+"-disabled"),t),this._setTabIndexForMold()))}],checked:function(t){var e=this.$n("real");if(e&&(jq(e).prop("checked",t),!this._isDefaultMold())){this.getMold();this._clearStateClassName(),jq(this.$n()).addClass(this._getClassNameByState())}},name:function(t){var e=this.$n("real");e&&(e.name=t||"")},tabindex:function(t){var e=this.$n("real");e&&(null==t?e.removeAttribute("tabindex"):e.tabIndex=t)},value:function(t){var e=this.$n("real");e&&(e.value=t||"")},autodisable:null,indeterminate:function(t){var e=this.$n("real");e&&(jq(e).prop("indeterminate",t),this._isDefaultMold()||(this._clearStateClassName(),jq(this.$n()).addClass(this._getClassNameByState())))}},getState:function(){return this.isIndeterminate()?null:this.isChecked()},focus_:function(t){return zk(this.$n("real")||this.$n()).focus(t),!0},contentAttrs_:function(){var t,e="";return(t=this.getName())&&(e+=' name="'.concat(t,'"')),this._disabled&&(e+=' disabled="disabled"'),this._checked&&(e+=' checked="checked"'),(t=this._tabindex)&&(e+=' tabindex="'.concat(t,'"')),(t=this.getValue())&&(e+=' value="'.concat(t,'"')),e},bind_:function(){this.$supers(i,"bind_",arguments);var t=this.$n("real"),e=this.$n("mold"),s=this.getIndeterminate();t.checked!=t.defaultChecked&&(t.checked=t.defaultChecked),s&&(t.indeterminate=!0),this.domListen_(t,"onFocus","doFocus_").domListen_(t,"onBlur","doBlur_").domListen_(e,"onMouseDown","_doMoldMouseDown"),this._setTabIndexForMold()},unbind_:function(){var t=this.$n("real"),e=this.$n("mold");this.domUnlisten_(e,"onMouseDown","_doMoldMouseDown").domUnlisten_(t,"onFocus","doFocus_").domUnlisten_(t,"onBlur","doBlur_"),this.$supers(i,"unbind_",arguments)},_setTabIndexForMold:function(){var t=this.$n("mold");t&&(t.tabIndex=this._canTabOnMold()?0:-1)},_canTabOnMold:function(){return!this._isDefaultMold()&&!this.isDisabled()},doSelect_:function(t){n(t)||this.$supers("doSelect_",arguments)},doClick_:function(t){if(!n(t))if(zul.wgt.ADBS.autodisable(this),this._isTristateMold())this.nextState_(),this.fireOnCheck_(this.getState());else{var e=this.$n("real"),s=e.checked;if(s!=this._checked&&(this.setChecked(s),this.setIndeterminate(!1),this.fireOnCheck_(s)),zk.webkit&&!zk.mobile&&zk(e).focus(),t.stop({propagation:!0}),this.$supers("doClick_",arguments),this.$instanceof(zul.wgt.Radio)){var i=this.getRadiogroup();i&&i.doClick_(t)}}},_doMoldMouseDown:function(t){this.isDisabled()&&t.stop()},fireOnCheck_:function(t){this.fire("onCheck",t)},beforeSendAU_:function(t,e){"onClick"!=e.name&&this.$supers("beforeSendAU_",arguments)},getTextNode:function(){return this.$n("cnt")},shallIgnoreClick_:function(){return this.isDisabled()},domClass_:function(){var t=this.$supers("domClass_",arguments),e=this.getMold();return t+=" "+this.$s(e),this._isDefaultMold()||(t+=" "+this._getClassNameByState(),this.isDisabled()&&(t+=" "+this.$s(e+"-disabled"))),t},_isDefaultMold:function(){return"default"==this.getMold()},_isTristateMold:function(){return"tristate"==this.getMold()},nextState_:function(){this._indeterminate?(this.setIndeterminate(!1),this.setChecked(!0)):this._checked?this.setChecked(!1):this.setIndeterminate(!0)},_getClassNameByState:function(){var t=this.getMold();return this._indeterminate?this.$s(t+"-indeterminate"):this.$s(t+(this._checked?"-on":"-off"))},_clearStateClassName:function(){var t=jq(this.$n()),e=this.getMold();t&&t.removeClass(this.$s(e+"-off")).removeClass(this.$s(e+"-indeterminate")).removeClass(this.$s(e+"-on"))},doKeyDown_:function(t){this.$supers("doKeyDown_",arguments);if(t.domTarget==this.$n("mold")&&32==t.keyCode){if(this._isTristateMold())return this.nextState_(),void this.fireOnCheck_(this.getState());var e=!this.isChecked();this.setChecked(e),this.fireOnCheck_(e)}}})}();