var MsSc=MsSc||{},jq2143;MsSc.Ultra=MsSc.Ultra||{};MsSc.Ultra.FlexNotification=MsSc.Ultra.FlexNotification||{};jq2143=jq2143||jQuery;jq2143(document).ready(function(){MsSc.Ultra.FlexNotification.Init()});MsSc.Ultra.FlexNotification.Popover=function(){var n=jq2143.fn.popover,t=function(){n.Constructor.apply(this,arguments)};t.prototype=jq2143.extend({},n.Constructor.prototype,{constructor:t,_super:function(){var t=jq2143.makeArray(arguments);n.Constructor.prototype[t.shift()].apply(this,t)},show:function(){var u,e,n,i,r,f,t,o=jq2143.Event("show");if(this.hasContent&&this.enabled){this.$element.trigger(o);u=this.tip();this.setContent();this.options.animation&&u.addClass("fade");f=typeof this.options.placement=="function"?this.options.placement.call(this,u[0],this.$element[0]):this.options.placement;e=/in/.test(f);u.remove().css({top:0,left:0,display:"block"}).appendTo(e?this.$element:document.body);n=this.getPosition(e);i=u[0].offsetWidth;r=u[0].offsetHeight;switch(e?f.split(" ")[1]:f){case"bottom":t={top:n.top+n.height,left:n.left+n.width/2-i/2};break;case"top":t={top:n.top-r,left:n.left+n.width/2-i/2};break;case"left":t={top:n.top+n.height/2-r/2,left:n.left-i};break;case"right":t={top:n.top+n.height/2-r/2,left:n.left+n.width};break;case"topLeft":t={top:n.top-r,left:n.left+n.width/2-i*.2};break;case"topRight":t={top:n.top-r,left:n.left+n.width/2-i*.8};break;case"rightTop":t={top:n.top+n.height/2-r*.2,left:n.left+n.width};break;case"rightBottom":t={top:n.top+n.height/2-r*.8,left:n.left+n.width};break;case"bottomLeft":t={top:n.top+n.height,left:n.left+n.width/2-i*.2};break;case"bottomRight":t={top:n.top+n.height,left:n.left+n.width/2-i*.8};break;case"leftTop":t={top:n.top+n.height/2-r*.2,left:n.left-i};break;case"leftBottom":t={top:n.top+n.height/2-r*.8,left:n.left-i}}u.css(t).addClass(f).addClass("in");this.$element.trigger("shown")}}});jq2143.fn.popover=jq2143.extend(function(n){return this.each(function(){var r=jq2143(this),i=r.data("bs.popover"),u=typeof n=="object"&&n;i||r.data("bs.popover",i=new t(this,u));typeof n=="string"&&i[n]()})},n)};MsSc.Ultra.FlexNotification.Init=function(){var n,r,t,i;if(jq2143(".flex-notification-body").length>0){n=localStorage.getItem("mssc.notification.inline.dismissed")?JSON.parse(localStorage.getItem("mssc.notification.inline.dismissed")):{};r=new Date;jq2143(".flex-alert").on("click",".close",function(){var i=parseInt(jq2143(this).attr("data-duration")),r=jq2143(this).attr("data-id"),t;i&&r&&(t=new Date,t.setTime(t.getTime()+i*864e5),n[r]=t.getTime(),localStorage.setItem("mssc.notification.inline.dismissed",JSON.stringify(n)))});for(t in n)n[t]>r.getTime()&&jq2143("[data-id='"+t+"']").closest(".flex-alert").addClass("hidden");i=jq2143(".flex-popover");i.length>0&&(MsSc.Ultra.FlexNotification.Popover(),i.each(function(){var n=jq2143(this),t=jq2143(n.data("target"));if(t.length==0)return!0;n.popover({trigger:"manual",container:"body",template:t.html()}).on("shown.bs.popover",function(){n.data("bs.popover").tip().find(".close").on("click",function(t){t.preventDefault();n.popover("hide")})});n.popover("show")}));jq2143(window).load(function(){jq2143(".flex-toast.alert-success, .flex-toast.alert-info").length>0&&setTimeout(function(){jq2143(".flex-toast.alert-success, .flex-toast.alert-info").find(".close").click()},8e3);jq2143(".modal.flex-modal-alert").length>0&&jq2143(".modal.flex-modal-alert:first").modal("show")})}}