+function($){"use strict";var Button=function(element,options){this.$element=$(element)
    this.options=$.extend({},Button.DEFAULTS,options)}
    Button.DEFAULTS={loadingText:'loading...'}
    Button.prototype.setState=function(state){var d='disabled'
        var $el=this.$element
        var val=$el.is('input')?'val':'html'
        var data=$el.data()
        state=state+'Text'
        if(!data.resetText)$el.data('resetText',$el[val]())
        $el[val](data[state]||this.options[state])
        setTimeout(function(){state=='loadingText'?$el.addClass(d).attr(d,d):$el.removeClass(d).removeAttr(d);},0)}
    Button.prototype.toggle=function(){var $parent=this.$element.closest('[data-toggle="buttons"]')
        if($parent.length){var $input=this.$element.find('input').prop('checked',!this.$element.hasClass('active')).trigger('change')
            if($input.prop('type')==='radio')$parent.find('.active').removeClass('active')}
        this.$element.toggleClass('active')}
    var old=$.fn.button
    $.fn.button=function(option){return this.each(function(){var $this=$(this)
        var data=$this.data('bs.button')
        var options=typeof option=='object'&&option
        if(!data)$this.data('bs.button',(data=new Button(this,options)))
        if(option=='toggle')data.toggle()
        else if(option)data.setState(option)})}
    $.fn.button.Constructor=Button
    $.fn.button.noConflict=function(){$.fn.button=old
        return this}
    $(document).on('click.bs.button.data-api','[data-toggle^=button]',function(e){var $btn=$(e.target)
        if(!$btn.hasClass('btn'))$btn=$btn.closest('.btn')
        $btn.button('toggle')
        e.preventDefault()})}(window.jQuery);