+function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.toggle"),f="object"==typeof i&&i;r||u.data("bs.toggle",r=new t(this,f));"string"==typeof i&&r[i]&&r[i]()})}var t=function(t,i){this.$element=n(t);this.options=n.extend({},this.defaults(),i);this.render()},i;t.VERSION="2.2.0";t.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"default",size:"normal",style:"",width:null,height:null};t.prototype.defaults=function(){return{on:this.$element.attr("data-on")||t.DEFAULTS.on,off:this.$element.attr("data-off")||t.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||t.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||t.DEFAULTS.offstyle,size:this.$element.attr("data-size")||t.DEFAULTS.size,style:this.$element.attr("data-style")||t.DEFAULTS.style,width:this.$element.attr("data-width")||t.DEFAULTS.width,height:this.$element.attr("data-height")||t.DEFAULTS.height}};t.prototype.render=function(){var e,o;this._onstyle="btn-"+this.options.onstyle;this._offstyle="btn-"+this.options.offstyle;var r="large"===this.options.size?"btn-lg":"small"===this.options.size?"btn-sm":"mini"===this.options.size?"btn-xs":"",t=n('<label class="btn">').html(this.options.on).addClass(this._onstyle+" "+r),i=n('<label class="btn">').html(this.options.off).addClass(this._offstyle+" "+r+" active"),u=n('<span class="toggle-handle btn btn-default">').addClass(r),f=n('<div class="toggle-group">').append(t,i,u),s=n('<div class="toggle btn" data-toggle="toggle">').addClass(this.$element.prop("checked")?this._onstyle:this._offstyle+" off").addClass(r).addClass(this.options.style);this.$element.wrap(s);n.extend(this,{$toggle:this.$element.parent(),$toggleOn:t,$toggleOff:i,$toggleGroup:f});this.$toggle.append(f);e=this.options.width||Math.max(t.outerWidth(),i.outerWidth())+u.outerWidth()/2;o=this.options.height||Math.max(t.outerHeight(),i.outerHeight());t.addClass("toggle-on");i.addClass("toggle-off");this.$toggle.css({width:e,height:o});this.options.height&&(t.css("line-height",t.height()+"px"),i.css("line-height",i.height()+"px"));this.update(!0);this.trigger(!0)};t.prototype.toggle=function(){this.$element.prop("checked")?this.off():this.on()};t.prototype.on=function(n){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._offstyle+" off").addClass(this._onstyle),this.$element.prop("checked",!0),void(n||this.trigger()))};t.prototype.off=function(n){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._onstyle).addClass(this._offstyle+" off"),this.$element.prop("checked",!1),void(n||this.trigger()))};t.prototype.enable=function(){this.$toggle.removeAttr("disabled");this.$element.prop("disabled",!1)};t.prototype.disable=function(){this.$toggle.attr("disabled","disabled");this.$element.prop("disabled",!0)};t.prototype.update=function(n){this.$element.prop("disabled")?this.disable():this.enable();this.$element.prop("checked")?this.on(n):this.off(n)};t.prototype.trigger=function(t){this.$element.off("change.bs.toggle");t||this.$element.change();this.$element.on("change.bs.toggle",n.proxy(function(){this.update()},this))};t.prototype.destroy=function(){this.$element.off("change.bs.toggle");this.$toggleGroup.remove();this.$element.removeData("bs.toggle");this.$element.unwrap()};i=n.fn.bootstrapToggle;n.fn.bootstrapToggle=r;n.fn.bootstrapToggle.Constructor=t;n.fn.toggle.noConflict=function(){return n.fn.bootstrapToggle=i,this};n(function(){n("input[type=checkbox][data-toggle^=toggle]").bootstrapToggle()});n(document).on("click.bs.toggle","div[data-toggle^=toggle]",function(t){var i=n(this).find("input[type=checkbox]");i.bootstrapToggle("toggle");t.preventDefault()})}(jQuery)