var Notify=function(){"use strict";var t=function(t){t.wrapper.classList.add("notify--fade"),setTimeout((function(){t.wrapper.classList.add("notify--fadeIn")}),100)},e=function(t){t.wrapper.classList.remove("notify--fadeIn"),setTimeout((function(){t.wrapper.remove()}),t.speed)},s=function(t){t.wrapper.classList.add("notify--slide"),setTimeout((function(){t.wrapper.classList.add("notify--slideIn")}),100)},i=function(t){t.wrapper.classList.remove("notify--slideIn"),setTimeout((function(){t.wrapper.remove()}),t.speed)};return function(){function o(o){var n=this;this.notifyOut=function(t){t(n)},this.fadeIn=t,this.fadeOut=e,this.slideIn=s,this.slideOut=i;var r=o.status,a=void 0===r?null:r,c=o.title,C=void 0===c?null:c,d=o.text,l=void 0===d?null:d,h=o.isIcon,p=void 0===h||h,u=o.customIcon,f=void 0===u?null:u,v=o.customClass,y=void 0===v?null:v,m=o.speed,w=void 0===m?500:m,L=o.effect,g=void 0===L?"fade":L,I=o.isCloseButton,x=void 0===I||I,E=o.autoclose,O=void 0!==E&&E,M=o.autotimeout,Z=void 0===M?3e3:M,b=o.gap,B=void 0===b?20:b,N=o.distance,T=void 0===N?20:N,_=o.type,k=void 0===_?1:_,P=o.position,R=void 0===P?"right top":P;this.status=a,this.title=C,this.text=l,this.isIcon=p,this.customIcon=f,this.customClass=y,this.speed=w,this.effect=g,this.isCloseButton=x,this.autoclose=O,this.autotimeout=Z,this.gap=B,this.distance=T,this.type=k,this.position=R,this.checkRequirements()?(this.setContainer(),this.setWrapper(),this.setPosition(),this.isIcon&&this.setIcon(),this.isCloseButton&&this.setCloseButton(),this.setContent(),this.container.prepend(this.wrapper),this.setEffect(),this.notifyIn(this.selectedNotifyInEffect),this.autoclose&&this.autoClose(),this.setObserver()):console.error("You must specify 'title' or 'text' at least.")}return o.prototype.checkRequirements=function(){return!(!this.title&&!this.text)},o.prototype.setContainer=function(){var t=document.querySelector(".notifications-container");t?this.container=t:(this.container=document.createElement("div"),this.container.classList.add("notifications-container"),document.body.appendChild(this.container)),this.container.style.setProperty("--distance",this.distance+"px")},o.prototype.setPosition=function(){var t="notify-is-";this.position.includes("left")?this.container.classList.add(t+"left"):this.container.classList.remove(t+"left"),this.position.includes("right")?this.container.classList.add(t+"right"):this.container.classList.remove(t+"right"),this.position.includes("top")?this.container.classList.add(t+"top"):this.container.classList.remove(t+"top"),this.position.includes("bottom")?this.container.classList.add(t+"bottom"):this.container.classList.remove(t+"bottom")},o.prototype.setCloseButton=function(){var t=this,e=document.createElement("div");e.classList.add("notify__close"),e.innerHTML='',this.wrapper.appendChild(e),e.addEventListener("click",(function(){t.close()}))},o.prototype.setWrapper=function(){var t=document.createElement("div");this.wrapper=t,this.wrapper.style.setProperty("--gap",this.gap+"px"),this.wrapper.style.transitionDuration=this.speed+"ms",this.wrapper.classList.add("notify"),this.wrapper.classList.add("notify--type-"+this.type),this.wrapper.classList.add("notify--"+this.status),this.customClass&&this.wrapper.classList.add(this.customClass)},o.prototype.setContent=function(){var t=document.createElement("div");t.classList.add("notify-content");var e=document.createElement("div");e.classList.add("notify__title"),e.textContent=this.title,this.isCloseButton||(e.style.paddingRight="0");var s=document.createElement("div");s.classList.add("notify__text"),s.textContent=this.text,this.title||(s.style.marginTop="0"),this.wrapper.appendChild(t),t.appendChild(e),t.appendChild(s)},o.prototype.setIcon=function(){var t=document.createElement("div");t.classList.add("notify__icon"),t.innerHTML=this.customIcon||function(t){switch(t){case"success":return'';case"warning":return'';case"error":return''}}(this.status),(this.status||this.customIcon)&&this.wrapper.appendChild(t)},o.prototype.setObserver=function(){var t=this,e=new IntersectionObserver((function(e){e[0].intersectionRatio<=0&&t.close()}),{threshold:0});setTimeout((function(){e.observe(t.wrapper)}),this.speed)},o.prototype.notifyIn=function(t){t(this)},o.prototype.autoClose=function(){var t=this;setTimeout((function(){t.close()}),this.autotimeout+this.speed)},o.prototype.close=function(){this.notifyOut(this.selectedNotifyOutEffect)},o.prototype.setEffect=function(){switch(this.effect){case"fade":this.selectedNotifyInEffect=this.fadeIn,this.selectedNotifyOutEffect=this.fadeOut;break;case"slide":this.selectedNotifyInEffect=this.slideIn,this.selectedNotifyOutEffect=this.slideOut;break;default:this.selectedNotifyInEffect=this.fadeIn,this.selectedNotifyOutEffect=this.fadeOut}},o}()}();