!function(e,n,i,t){"use strict";n=void 0!==n&&n.Math==Math?n:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.checkbox=function(t){var o,a=e(this),c=a.selector||"",r=(new Date).getTime(),d=[],l=arguments[0],s="string"==typeof l,u=[].slice.call(arguments,1);return a.each(function(){var a,b,h=e.extend(!0,{},e.fn.checkbox.settings,t),g=h.className,f=h.namespace,p=h.selector,k=h.error,m="."+f,v="module-"+f,y=e(this),C=e(this).children(p.label),x=e(this).children(p.input),w=x[0],I=!1,D=!1,S=y.data(v),E=this;b={initialize:function(){b.verbose("Initializing checkbox",h),b.create.label(),b.bind.events(),b.set.tabbable(),b.hide.input(),b.observeChanges(),b.instantiate(),b.setup()},instantiate:function(){b.verbose("Storing instance of module",b),S=b,y.data(v,b)},destroy:function(){b.verbose("Destroying module"),b.unbind.events(),b.show.input(),y.removeData(v)},fix:{reference:function(){y.is(p.input)&&(b.debug("Behavior called on adjusting invoked element"),y=y.closest(p.checkbox),b.refresh())}},setup:function(){b.set.initialLoad(),b.is.indeterminate()?(b.debug("Initial value is indeterminate"),b.indeterminate()):b.is.checked()?(b.debug("Initial value is checked"),b.check()):(b.debug("Initial value is unchecked"),b.uncheck()),b.remove.initialLoad()},refresh:function(){C=y.children(p.label),x=y.children(p.input),w=x[0]},hide:{input:function(){b.verbose("Modifying z-index to be unselectable"),x.addClass(g.hidden)}},show:{input:function(){b.verbose("Modifying z-index to be selectable"),x.removeClass(g.hidden)}},observeChanges:function(){"MutationObserver"in n&&(a=new MutationObserver(function(e){b.debug("DOM tree modified, updating selector cache"),b.refresh()}),a.observe(E,{childList:!0,subtree:!0}),b.debug("Setting up mutation observer",a))},attachEvents:function(n,i){var t=e(n);i=e.isFunction(b[i])?b[i]:b.toggle,t.length>0?(b.debug("Attaching checkbox events to element",n,i),t.on("click"+m,i)):b.error(k.notFound)},event:{click:function(n){var i=e(n.target);return i.is(p.input)?void b.verbose("Using default check action on initialized checkbox"):i.is(p.link)?void b.debug("Clicking link inside checkbox, skipping toggle"):(b.toggle(),x.focus(),void n.preventDefault())},keydown:function(e){var n=e.which,i={enter:13,space:32,escape:27};n==i.escape?(b.verbose("Escape key pressed blurring field"),x.blur(),D=!0):e.ctrlKey||n!=i.space&&n!=i.enter?D=!1:(b.verbose("Enter/space key pressed, toggling checkbox"),b.toggle(),D=!0)},keyup:function(e){D&&e.preventDefault()}},check:function(){b.should.allowCheck()&&(b.debug("Checking checkbox",x),b.set.checked(),b.should.ignoreCallbacks()||(h.onChecked.call(w),h.onChange.call(w)))},uncheck:function(){b.should.allowUncheck()&&(b.debug("Unchecking checkbox"),b.set.unchecked(),b.should.ignoreCallbacks()||(h.onUnchecked.call(w),h.onChange.call(w)))},indeterminate:function(){if(b.should.allowIndeterminate())return void b.debug("Checkbox is already indeterminate");b.debug("Making checkbox indeterminate"),b.set.indeterminate(),b.should.ignoreCallbacks()||(h.onIndeterminate.call(w),h.onChange.call(w))},determinate:function(){if(b.should.allowDeterminate())return void b.debug("Checkbox is already determinate");b.debug("Making checkbox determinate"),b.set.determinate(),b.should.ignoreCallbacks()||(h.onDeterminate.call(w),h.onChange.call(w))},enable:function(){if(b.is.enabled())return void b.debug("Checkbox is already enabled");b.debug("Enabling checkbox"),b.set.enabled(),h.onEnable.call(w),h.onEnabled.call(w)},disable:function(){if(b.is.disabled())return void b.debug("Checkbox is already disabled");b.debug("Disabling checkbox"),b.set.disabled(),h.onDisable.call(w),h.onDisabled.call(w)},get:{radios:function(){var n=b.get.name();return e('input[name="'+n+'"]').closest(p.checkbox)},otherRadios:function(){return b.get.radios().not(y)},name:function(){return x.attr("name")}},is:{initialLoad:function(){return I},radio:function(){return x.hasClass(g.radio)||"radio"==x.attr("type")},indeterminate:function(){return void 0!==x.prop("indeterminate")&&x.prop("indeterminate")},checked:function(){return void 0!==x.prop("checked")&&x.prop("checked")},disabled:function(){return void 0!==x.prop("disabled")&&x.prop("disabled")},enabled:function(){return!b.is.disabled()},determinate:function(){return!b.is.indeterminate()},unchecked:function(){return!b.is.checked()}},should:{allowCheck:function(){return b.is.determinate()&&b.is.checked()&&!b.should.forceCallbacks()?(b.debug("Should not allow check, checkbox is already checked"),!1):!1!==h.beforeChecked.apply(w)||(b.debug("Should not allow check, beforeChecked cancelled"),!1)},allowUncheck:function(){return b.is.determinate()&&b.is.unchecked()&&!b.should.forceCallbacks()?(b.debug("Should not allow uncheck, checkbox is already unchecked"),!1):!1!==h.beforeUnchecked.apply(w)||(b.debug("Should not allow uncheck, beforeUnchecked cancelled"),!1)},allowIndeterminate:function(){return b.is.indeterminate()&&!b.should.forceCallbacks()?(b.debug("Should not allow indeterminate, checkbox is already indeterminate"),!1):!1!==h.beforeIndeterminate.apply(w)||(b.debug("Should not allow indeterminate, beforeIndeterminate cancelled"),!1)},allowDeterminate:function(){return b.is.determinate()&&!b.should.forceCallbacks()?(b.debug("Should not allow determinate, checkbox is already determinate"),!1):!1!==h.beforeDeterminate.apply(w)||(b.debug("Should not allow determinate, beforeDeterminate cancelled"),!1)},forceCallbacks:function(){return b.is.initialLoad()&&h.fireOnInit},ignoreCallbacks:function(){return I&&!h.fireOnInit}},can:{change:function(){return!(y.hasClass(g.disabled)||y.hasClass(g.readOnly)||x.prop("disabled")||x.prop("readonly"))},uncheck:function(){return"boolean"==typeof h.uncheckable?h.uncheckable:!b.is.radio()}},set:{initialLoad:function(){I=!0},checked:function(){if(b.verbose("Setting class to checked"),y.removeClass(g.indeterminate).addClass(g.checked),b.is.radio()&&b.uncheckOthers(),!b.is.indeterminate()&&b.is.checked())return void b.debug("Input is already checked, skipping input property change");b.verbose("Setting state to checked",w),x.prop("indeterminate",!1).prop("checked",!0),b.trigger.change()},unchecked:function(){if(b.verbose("Removing checked class"),y.removeClass(g.indeterminate).removeClass(g.checked),!b.is.indeterminate()&&b.is.unchecked())return void b.debug("Input is already unchecked");b.debug("Setting state to unchecked"),x.prop("indeterminate",!1).prop("checked",!1),b.trigger.change()},indeterminate:function(){if(b.verbose("Setting class to indeterminate"),y.addClass(g.indeterminate),b.is.indeterminate())return void b.debug("Input is already indeterminate, skipping input property change");b.debug("Setting state to indeterminate"),x.prop("indeterminate",!0),b.trigger.change()},determinate:function(){if(b.verbose("Removing indeterminate class"),y.removeClass(g.indeterminate),b.is.determinate())return void b.debug("Input is already determinate, skipping input property change");b.debug("Setting state to determinate"),x.prop("indeterminate",!1)},disabled:function(){if(b.verbose("Setting class to disabled"),y.addClass(g.disabled),b.is.disabled())return void b.debug("Input is already disabled, skipping input property change");b.debug("Setting state to disabled"),x.prop("disabled","disabled"),b.trigger.change()},enabled:function(){if(b.verbose("Removing disabled class"),y.removeClass(g.disabled),b.is.enabled())return void b.debug("Input is already enabled, skipping input property change");b.debug("Setting state to enabled"),x.prop("disabled",!1),b.trigger.change()},tabbable:function(){b.verbose("Adding tabindex to checkbox"),void 0===x.attr("tabindex")&&x.attr("tabindex",0)}},remove:{initialLoad:function(){I=!1}},trigger:{change:function(){var e=i.createEvent("HTMLEvents"),n=x[0];n&&(b.verbose("Triggering native change event"),e.initEvent("change",!0,!1),n.dispatchEvent(e))}},create:{label:function(){x.prevAll(p.label).length>0?(x.prev(p.label).detach().insertAfter(x),b.debug("Moving existing label",C)):b.has.label()||(C=e("