!function(a,b,c,d){a.fn.checkbox=function(b){var c,e=a(this),f=a.extend(!0,{},a.fn.checkbox.settings,b),g=f.className,h=f.namespace,i=f.error,j="."+h,k="module-"+h,l=e.selector||"",m=(new Date).getTime(),n=[],o=arguments[0],p="string"==typeof o,q=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),h=a(this).next(f.selector.label).first(),r=a(this).find(f.selector.input),s=e.selector||"",t=e.data(k),u=this;b={initialize:function(){b.verbose("Initializing checkbox",f),f.context&&""!==s?(b.verbose("Adding delegated events"),a(u,f.context).on(s,"click"+j,b.toggle).on(s+" + "+f.selector.label,"click"+j,b.toggle)):(e.on("click"+j,b.toggle).data(k,b),h.on("click"+j,b.toggle)),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),t=b,e.data(k,b)},destroy:function(){b.verbose("Destroying previous module"),e.off(j).removeData(k)},is:{radio:function(){return e.hasClass(g.radio)}},can:{disable:function(){return"boolean"==typeof f.required?f.required:!b.is.radio()}},enable:function(){b.debug("Enabling checkbox",r),r.prop("checked",!0),a.proxy(f.onChange,r.get())(),a.proxy(f.onEnable,r.get())()},disable:function(){b.debug("Disabling checkbox"),r.prop("checked",!1),a.proxy(f.onChange,r.get())(),a.proxy(f.onDisable,r.get())()},toggle:function(){b.verbose("Determining new checkbox state"),r.prop("checked")!==d&&r.prop("checked")?b.can.disable()&&b.disable():b.enable()},setting:function(b,c){return c===d?f[b]:(a.isPlainObject(b)?a.extend(!0,f,b):f[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,f.name+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.name+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=m||c,d=c-e,m=c,n.push({Element:u,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=f.name+":",e=0;m=!1,clearTimeout(b.performance.timer),a.each(n,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",l&&(c+=" '"+l+"'"),(console.group!==d||console.table!==d)&&n.length>0&&(console.groupCollapsed(c),console.table?console.table(n):a.each(n,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),n=[]}},invoke:function(e,f,g){var h,j,k;return f=f||q,g=u||g,"string"==typeof e&&t!==d&&(e=e.split(/[\. ]/),h=e.length-1,a.each(e,function(c,f){var g=c!=h?f+e[c+1].charAt(0).toUpperCase()+e[c+1].slice(1):e;if(a.isPlainObject(t[f])&&c!=h)t=t[f];else{if(!a.isPlainObject(t[g])||c==h)return t[f]!==d?(j=t[f],!1):t[g]!==d?(j=t[g],!1):(b.error(i.method),!1);t=t[g]}})),a.isFunction(j)?k=j.apply(g,f):j!==d&&(k=j),a.isArray(c)?c.push(k):"string"==typeof c?c=[c,k]:k!==d&&(c=k),j}},p?(t===d&&b.initialize(),b.invoke(o)):(t!==d&&b.destroy(),b.initialize())}),c!==d?c:this},a.fn.checkbox.settings={name:"Checkbox",namespace:"checkbox",verbose:!0,debug:!0,performance:!0,context:!1,required:"auto",onChange:function(){},onEnable:function(){},onDisable:function(){},error:{method:"The method you called is not defined."},selector:{input:"input[type=checkbox], input[type=radio]",label:"label"},className:{radio:"radio"}}}(jQuery,window,document);