var NotyObject,windowAlert;typeof Object.create!="function"&&(Object.create=function(n){function t(){}return t.prototype=n,new t});NotyObject={init:function(n){return this.options=$.extend({},$.noty.defaults,n),this.options.layout=this.options.custom?$.noty.layouts.inline:$.noty.layouts[this.options.layout],$.noty.themes[this.options.theme]?this.options.theme=$.noty.themes[this.options.theme]:n.themeClassName=this.options.theme,delete n.layout,delete n.theme,this.options=$.extend({},this.options,this.options.layout.options),this.options.id="noty_"+(new Date).getTime()*Math.floor(Math.random()*1e6),this.options=$.extend({},this.options,n),this._build(),this},_build:function(){var n=$('<div class="noty_bar noty_type_'+this.options.type+'"><\/div>').attr("id",this.options.id),t,i;n.append(this.options.template).find(".noty_text").html(this.options.text);this.$bar=this.options.layout.parent.object!==null?$(this.options.layout.parent.object).css(this.options.layout.parent.css).append(n):n;this.options.themeClassName&&this.$bar.addClass(this.options.themeClassName).addClass("noty_container_type_"+this.options.type);this.options.buttons&&(this.options.closeWith=[],this.options.timeout=!1,t=$("<div/>").addClass("noty_buttons"),this.options.layout.parent.object!==null?this.$bar.find(".noty_bar").append(t):this.$bar.append(t),i=this,$.each(this.options.buttons,function(n,t){var r=$("<button/>").addClass(t.addClass?t.addClass:"gray").html(t.text).attr("id",t.id?t.id:"button-"+n).appendTo(i.$bar.find(".noty_buttons")).on("click",function(n){$.isFunction(t.onClick)&&t.onClick.call(r,i,n)})}));this.$message=this.$bar.find(".noty_message");this.$closeButton=this.$bar.find(".noty_close");this.$buttons=this.$bar.find(".noty_buttons");$.noty.store[this.options.id]=this},show:function(){var n=this;if(n.options.custom?n.options.custom.find(n.options.layout.container.selector).append(n.$bar):$(n.options.layout.container.selector).append(n.$bar),n.options.theme&&n.options.theme.style&&n.options.theme.style.apply(n),$.type(n.options.layout.css)==="function"?this.options.layout.css.apply(n.$bar):n.$bar.css(this.options.layout.css||{}),n.$bar.addClass(n.options.layout.addClass),n.options.layout.container.style.apply($(n.options.layout.container.selector)),n.showing=!0,n.options.theme&&n.options.theme.style&&n.options.theme.callback.onShow.apply(this),$.inArray("click",n.options.closeWith)>-1)n.$bar.css("cursor","pointer").one("click",function(t){n.stopPropagation(t);n.options.callback.onCloseClick&&n.options.callback.onCloseClick.apply(n);n.close()});if($.inArray("hover",n.options.closeWith)>-1)n.$bar.one("mouseenter",function(){n.close()});if($.inArray("button",n.options.closeWith)>-1)n.$closeButton.one("click",function(t){n.stopPropagation(t);n.close()});if($.inArray("button",n.options.closeWith)==-1&&n.$closeButton.remove(),n.options.callback.onShow&&n.options.callback.onShow.apply(n),typeof n.options.animation.open=="string"){n.$bar.css("height",n.$bar.innerHeight());n.$bar.show().addClass(n.options.animation.open).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){n.options.callback.afterShow&&n.options.callback.afterShow.apply(n);n.showing=!1;n.shown=!0})}else n.$bar.animate(n.options.animation.open,n.options.animation.speed,n.options.animation.easing,function(){n.options.callback.afterShow&&n.options.callback.afterShow.apply(n);n.showing=!1;n.shown=!0});return n.options.timeout&&n.$bar.delay(n.options.timeout).promise().done(function(){n.close()}),this},close:function(){var n,t;if(!this.closed&&(!this.$bar||!this.$bar.hasClass("i-am-closing-now"))){if(n=this,this.showing){n.$bar.queue(function(){n.close.apply(n)});return}if(!this.shown&&!this.showing){t=[];$.each($.noty.queue,function(i,r){r.options.id!=n.options.id&&t.push(r)});$.noty.queue=t;return}if(n.$bar.addClass("i-am-closing-now"),n.options.callback.onClose&&n.options.callback.onClose.apply(n),typeof n.options.animation.close=="string")n.$bar.addClass(n.options.animation.close).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){n.options.callback.afterClose&&n.options.callback.afterClose.apply(n);n.closeCleanUp()});else n.$bar.clearQueue().stop().animate(n.options.animation.close,n.options.animation.speed,n.options.animation.easing,function(){n.options.callback.afterClose&&n.options.callback.afterClose.apply(n)}).promise().done(function(){n.closeCleanUp()})}},closeCleanUp:function(){var n=this;if(n.options.modal&&($.notyRenderer.setModalCount(-1),$.notyRenderer.getModalCount()==0&&$(".noty_modal").fadeOut("fast",function(){$(this).remove()})),$.notyRenderer.setLayoutCountFor(n,-1),$.notyRenderer.getLayoutCountFor(n)==0&&$(n.options.layout.container.selector).remove(),typeof n.$bar!="undefined"&&n.$bar!==null)if(typeof n.options.animation.close=="string"){n.$bar.css("transition","all 100ms ease").css("border",0).css("margin",0).height(0);n.$bar.one("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){n.$bar.remove();n.$bar=null;n.closed=!0;n.options.theme.callback&&n.options.theme.callback.onClose&&n.options.theme.callback.onClose.apply(n)})}else n.$bar.remove(),n.$bar=null,n.closed=!0;delete $.noty.store[n.options.id];n.options.theme.callback&&n.options.theme.callback.onClose&&n.options.theme.callback.onClose.apply(n);n.options.dismissQueue||($.noty.ontap=!0,$.notyRenderer.render());n.options.maxVisible>0&&n.options.dismissQueue&&$.notyRenderer.render()},setText:function(n){return this.closed||(this.options.text=n,this.$bar.find(".noty_text").html(n)),this},setType:function(n){return this.closed||(this.options.type=n,this.options.theme.style.apply(this),this.options.theme.callback.onShow.apply(this)),this},setTimeout:function(n){if(!this.closed){var t=this;this.options.timeout=n;t.$bar.delay(t.options.timeout).promise().done(function(){t.close()})}return this},stopPropagation:function(n){n=n||window.event;typeof n.stopPropagation!="undefined"?n.stopPropagation():n.cancelBubble=!0},closed:!1,showing:!1,shown:!1};$.notyRenderer={};$.notyRenderer.init=function(n){var t=Object.create(NotyObject).init(n);return t.options.killer&&$.noty.closeAll(),t.options.force?$.noty.queue.unshift(t):$.noty.queue.push(t),$.notyRenderer.render(),$.noty.returns=="object"?t:t.options.id};$.notyRenderer.render=function(){var n=$.noty.queue[0];$.type(n)==="object"?n.options.dismissQueue?n.options.maxVisible>0?$(n.options.layout.container.selector+" li").length<n.options.maxVisible&&$.notyRenderer.show($.noty.queue.shift()):$.notyRenderer.show($.noty.queue.shift()):$.noty.ontap&&($.notyRenderer.show($.noty.queue.shift()),$.noty.ontap=!1):$.noty.ontap=!0};$.notyRenderer.show=function(n){n.options.modal&&($.notyRenderer.createModalFor(n),$.notyRenderer.setModalCount(1));n.options.custom?n.options.custom.find(n.options.layout.container.selector).length==0?n.options.custom.append($(n.options.layout.container.object).addClass("i-am-new")):n.options.custom.find(n.options.layout.container.selector).removeClass("i-am-new"):$(n.options.layout.container.selector).length==0?$("body").append($(n.options.layout.container.object).addClass("i-am-new")):$(n.options.layout.container.selector).removeClass("i-am-new");$.notyRenderer.setLayoutCountFor(n,1);n.show()};$.notyRenderer.createModalFor=function(n){if($(".noty_modal").length==0){var t=$("<div/>").addClass("noty_modal").addClass(n.options.theme).data("noty_modal_count",0);if(n.options.theme.modal&&n.options.theme.modal.css&&t.css(n.options.theme.modal.css),t.prependTo($("body")).fadeIn("fast"),$.inArray("backdrop",n.options.closeWith)>-1)t.on("click",function(){$.noty.closeAll()})}};$.notyRenderer.getLayoutCountFor=function(n){return $(n.options.layout.container.selector).data("noty_layout_count")||0};$.notyRenderer.setLayoutCountFor=function(n,t){return $(n.options.layout.container.selector).data("noty_layout_count",$.notyRenderer.getLayoutCountFor(n)+t)};$.notyRenderer.getModalCount=function(){return $(".noty_modal").data("noty_modal_count")||0};$.notyRenderer.setModalCount=function(n){return $(".noty_modal").data("noty_modal_count",$.notyRenderer.getModalCount()+n)};$.fn.noty=function(n){return n.custom=$(this),$.notyRenderer.init(n)};$.noty={};$.noty.queue=[];$.noty.ontap=!0;$.noty.layouts={};$.noty.themes={};$.noty.returns="object";$.noty.store={};$.noty.get=function(n){return $.noty.store.hasOwnProperty(n)?$.noty.store[n]:!1};$.noty.close=function(n){return $.noty.get(n)?$.noty.get(n).close():!1};$.noty.setText=function(n,t){return $.noty.get(n)?$.noty.get(n).setText(t):!1};$.noty.setType=function(n,t){return $.noty.get(n)?$.noty.get(n).setType(t):!1};$.noty.clearQueue=function(){$.noty.queue=[]};$.noty.closeAll=function(){$.noty.clearQueue();$.each($.noty.store,function(n,t){t.close()})};windowAlert=window.alert;$.noty.consumeAlert=function(n){window.alert=function(t){n?n.text=t:n={text:t};$.notyRenderer.init(n)}};$.noty.stopConsumeAlert=function(){window.alert=windowAlert};$.noty.defaults={layout:"top",theme:"defaultTheme",type:"alert",text:"",dismissQueue:!0,template:'<div class="noty_message"><span class="noty_text"><\/span><div class="noty_close"><\/div><\/div>',animation:{open:{height:"toggle"},close:{height:"toggle"},easing:"swing",speed:500},timeout:!1,force:!1,modal:!1,maxVisible:5,killer:!1,closeWith:["click"],callback:{onShow:function(){},afterShow:function(){},onClose:function(){},afterClose:function(){},onCloseClick:function(){}},buttons:!1};$(window).on("resize",function(){$.each($.noty.layouts,function(n,t){t.container.style.apply($(t.container.selector))})});window.noty=function(n){return $.notyRenderer.init(n)};$.noty.themes.bootstrapTheme={name:"bootstrapTheme",modal:{css:{position:"fixed",width:"100%",height:"100%",backgroundColor:"#000",zIndex:1e4,opacity:.6,display:"none",left:0,top:0}},style:function(){var n=this.options.layout.container.selector;$(n).addClass("list-group");this.$closeButton.append('<span aria-hidden="true">&times;<\/span><span class="sr-only">Close<\/span>');this.$closeButton.addClass("close");this.$bar.addClass("list-group-item").css("padding","0px");switch(this.options.type){case"alert":case"notification":this.$bar.addClass("list-group-item-info");break;case"warning":this.$bar.addClass("list-group-item-warning");break;case"error":this.$bar.addClass("list-group-item-danger");break;case"information":this.$bar.addClass("list-group-item-info");break;case"success":this.$bar.addClass("list-group-item-success")}this.$message.css({fontSize:"13px",lineHeight:"16px",textAlign:"center",padding:"8px 10px 9px",width:"auto",position:"relative"})},callback:{onShow:function(){},onClose:function(){}}};$.noty.layouts.topCenter={name:"topCenter",options:{},container:{object:'<ul id="noty_topCenter_layout_container" />',selector:"ul#noty_topCenter_layout_container",style:function(){$(this).css({top:20,left:0,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});$(this).css({left:($(window).width()-$(this).outerWidth(!1))/2+"px"})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""};$.noty.layouts.center={name:"center",options:{},container:{object:'<ul id="noty_center_layout_container" />',selector:"ul#noty_center_layout_container",style:function(){var n,t;$(this).css({position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});n=$(this).clone().css({visibility:"hidden",display:"block",position:"absolute",top:0,left:0}).attr("id","dupe");$("body").append(n);n.find(".i-am-closing-now").remove();n.find("li").css("display","block");t=n.height();n.remove();$(this).hasClass("i-am-new")?$(this).css({left:($(window).width()-$(this).outerWidth(!1))/2+"px",top:($(window).height()-t)/2+"px"}):$(this).animate({left:($(window).width()-$(this).outerWidth(!1))/2+"px",top:($(window).height()-t)/2+"px"},500)}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""}