!function(a){"function"==typeof define&&define.amd?define([],a):a(jQuery)}(function(){function a(a,b){return this.currModeIndex=0,this._init(a,b)}a.prototype.DATA_KEY="mode-button",a.prototype.defaults={switchModesOnClick:!0},a.prototype._init=function(a,b){if(b=b||{},this.$element=$(a),this.options=$.extend(!0,{},this.defaults,b),!b.modes)throw new Error('ModeButton requires a "modes" array');var c=this;return this.$element.click(function(){c.callModeFn(),c.options.switchModesOnClick&&c._incModeIndex(),$(this).html(c.options.modes[c.currModeIndex].html)}),this.reset()},a.prototype._incModeIndex=function(){return this.currModeIndex+=1,this.currModeIndex>=this.options.modes.length&&(this.currModeIndex=0),this},a.prototype._getModeIndex=function(a){for(var b=0;b