text: !function(b){var a=function(d,c){this.init(d,c)};a.prototype={constructor:a,init:function(e,c){var f=this;this.options=c;this.$element=b(e).delegate('[data-dismiss="modal"]',"click.dismiss.modal",b.proxy(this.hide,this));this.options.remote&&this.$element.find(".modal-body").load(this.options.remote,function(){var g=b.Event("loaded");f.$element.trigger(g)});var d=typeof this.options.manager==="function"?this.options.manager.call(this):this.options.manager;d=d.appendModal?d:b(d).modalmanager().data("modalmanager");d.appendModal(this)},toggle:function(){return this[!this.isShown?"show":"hide"]()},show:function(){var c=b.Event("show");if(this.isShown){return}this.$element.trigger(c);if(c.isDefaultPrevented()){return}this.escape();this.tab();this.options.loading&&this.loading()},hide:function(c){c&&c.preventDefault();c=b.Event("hide");this.$element.trigger(c);if(!this.isShown||c.isDefaultPrevented()){return}this.isShown=false;this.escape();this.tab();this.isLoading&&this.loading();b(document).off("focusin.modal");this.$element.removeClass("in").removeClass("animated").removeClass(this.options.attentionAnimation).removeClass("modal-overflow").attr("aria-hidden",true);b.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},layout:function(){var f=this.options.height?"height":"max-height",d=this.options.height||this.options.maxHeight;if(this.options.width){this.$element.css("width",this.options.width);var c=this;this.$element.css("margin-left",function(){if(/%/ig.test(c.options.width)){return -(parseInt(c.options.width)/2)+"%"}else{return -(b(this).width()/2)+"px"}})}else{this.$element.css("width","");this.$element.css("margin-left","")}this.$element.find(".modal-body").css("overflow","").css(f,"");if(d){this.$element.find(".modal-body").css("overflow","auto").css(f,d)}var e=b(window).height()-10<this.$element.height();if(e||this.options.modalOverflow){this.$element.css("margin-top",0).addClass("modal-overflow")}else{this.$element.css("margin-top",0-this.$element.height()/2).removeClass("modal-overflow")}},tab:function(){var c=this;if(this.isShown&&this.options.consumeTab){this.$element.on("keydown.tabindex.modal","[data-tabindex]",function(h){if(h.keyCode&&h.keyCode==9){var g=[],f=Number(b(this).data("tabindex"));c.$element.find("[data-tabindex]:enabled:visible:not([readonly])").each(function(e){g.push(Number(b(this).data("tabindex")))});g.sort(function(i,e){return i-e});var d=b.inArray(f,g);if(!h.shiftKey){d<g.length-1?c.$element.find("[data-tabindex="+g[d+1]+"]").focus():c.$element.find("[data-tabindex="+g[0]+"]").focus()}else{d==0?c.$element.find("[data-tabindex="+g[g.length-1]+"]").focus():c.$element.find("[data-tabindex="+g[d-1]+"]").focus()}h.preventDefault()}})}else{if(!this.isShown){this.$element.off("keydown.tabindex.modal")}}},escape:function(){var c=this;if(this.isShown&&this.options.keyboard){if(!this.$element.attr("tabindex")){this.$element.attr("tabindex",-1)}this.$element.on("keyup.dismiss.modal",function(d){d.which==27&&c.hide()})}else{if(!this.isShown){this.$element.off("keyup.dismiss.modal")}}},hideWithTransition:function(){var c=this,d=setTimeout(function(){c.$element.off(b.support.transition.end);c.hideModal()},500);this.$element.one(b.support.transition.end,function(){clearTimeout(d);c.hideModal()})},hideModal:function(){var d=this.options.height?"height":"max-height";var c=this.options.height||this.options.maxHeight;if(c){this.$element.find(".modal-body").css("overflow","").css(d,"")}this.$element.hide().trigger("hidden")},removeLoading:function(){this.$loading.remove();this.$loading=null;this.isLoading=false},loading:function(f){f=f||function(){};var d=this.$element.hasClass("fade")?"fade":"";if(!this.isLoading){var c=b.support.transition&&d;this.$loading=b('<div class="loading-mask '+d+'">').append(this.options.spinner).appendTo(this.$element);if(c){this.$loading[0].offsetWidth}this.$loading.addClass("in");this.isLoading=true;c?this.$loading.one(b.support.transition.end,f):f()}else{if(this.isLoading&&this.$loading){this.$loading.removeClass("in");var e=this;b.support.transition&&this.$element.hasClass("fade")?this.$loading.one(b.support.transition.end,function(){e.removeLoading()}):e.removeLoading()}else{if(f){f(this.isLoading)}}}},focus:function(){var c=this.$element.find(this.options.focusOn);c=c.length?c:this.$element;c.focus()},attention:function(){if(this.options.attentionAnimation){this.$element.removeClass("animated").removeClass(this.options.attentionAnimation);var c=this;setTimeout(function(){c.$element.addClass("animated").addClass(c.options.attentionAnimation)},0)}this.focus()},destroy:function(){var c=b.Event("destroy");this.$element.trigger(c);if(c.isDefaultPrevented()){return}this.$element.off(".modal").removeData("modal").removeClass("in").attr("aria-hidden",true);if(this.$parent!==this.$element.parent()){this.$element.appendTo(this.$parent)}else{if(!this.$parent.length){this.$element.remove();this.$element=null}}this.$element.trigger("destroyed")}};b.fn.modal=function(d,c){return this.each(function(){var g=b(this),f=g.data("modal"),e=b.extend({},b.fn.modal.defaults,g.data(),typeof d=="object"&&d);if(!f){g.data("modal",(f=new a(this,e)))}if(typeof d=="string"){f[d].apply(f,[].concat(c))}else{if(e.show){f.show()}}})};b.fn.modal.defaults={keyboard:true,backdrop:true,loading:false,show:true,width:null,height:null,maxHeight:null,modalOverflow:false,consumeTab:true,focusOn:null,replace:false,resize:false,attentionAnimation:"shake",manager:"body",spinner:'<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',backdropTemplate:'<div class="modal-backdrop" />'};b.fn.modal.Constructor=a;b(function(){b(document).off("click.modal").on("click.modal.data-api",'[data-toggle="modal"]',function(h){var g=b(this),d=g.attr("href"),c=b(g.attr("data-target")||(d&&d.replace(/.*(?=#[^\s]+$)/,""))),f=c.data("modal")?"toggle":b.extend({remote:!/#/.test(d)&&d},c.data(),g.data());h.preventDefault();c.modal(f).one("hide",function(){g.focus()})})})}(window.jQuery);