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