You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

9 lines
7.2 KiB

var t="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:global;var o={};
/*!
* Toastify js 1.12.0
* https://github.com/apvarun/toastify-js
* @license MIT licensed
*
* Copyright (C) 2018 Varun A P
*/(function(t,i){o?o=i():t.Toastify=i()})(o,(function(o){var Toastify=function(t){return new Toastify.lib.init(t)},i="1.12.0";Toastify.defaults={oldestFirst:true,text:"Toastify is awesome!",node:void 0,duration:3e3,selector:void 0,callback:function(){},destination:void 0,newWindow:false,close:false,gravity:"toastify-top",positionLeft:false,position:"",backgroundColor:"",avatar:"",className:"",stopOnFocus:true,onClick:function(){},offset:{x:0,y:0},escapeMarkup:true,ariaLive:"polite",style:{background:""}};Toastify.lib=Toastify.prototype={toastify:i,constructor:Toastify,init:function(o){o||(o={});(this||t).options={};(this||t).toastElement=null;(this||t).options.text=o.text||Toastify.defaults.text;(this||t).options.node=o.node||Toastify.defaults.node;(this||t).options.duration=0===o.duration?0:o.duration||Toastify.defaults.duration;(this||t).options.selector=o.selector||Toastify.defaults.selector;(this||t).options.callback=o.callback||Toastify.defaults.callback;(this||t).options.destination=o.destination||Toastify.defaults.destination;(this||t).options.newWindow=o.newWindow||Toastify.defaults.newWindow;(this||t).options.close=o.close||Toastify.defaults.close;(this||t).options.gravity="bottom"===o.gravity?"toastify-bottom":Toastify.defaults.gravity;(this||t).options.positionLeft=o.positionLeft||Toastify.defaults.positionLeft;(this||t).options.position=o.position||Toastify.defaults.position;(this||t).options.backgroundColor=o.backgroundColor||Toastify.defaults.backgroundColor;(this||t).options.avatar=o.avatar||Toastify.defaults.avatar;(this||t).options.className=o.className||Toastify.defaults.className;(this||t).options.stopOnFocus=void 0===o.stopOnFocus?Toastify.defaults.stopOnFocus:o.stopOnFocus;(this||t).options.onClick=o.onClick||Toastify.defaults.onClick;(this||t).options.offset=o.offset||Toastify.defaults.offset;(this||t).options.escapeMarkup=void 0!==o.escapeMarkup?o.escapeMarkup:Toastify.defaults.escapeMarkup;(this||t).options.ariaLive=o.ariaLive||Toastify.defaults.ariaLive;(this||t).options.style=o.style||Toastify.defaults.style;o.backgroundColor&&((this||t).options.style.background=o.backgroundColor);return this||t},buildToast:function(){if(!(this||t).options)throw"Toastify is not initialized";var o=document.createElement("div");o.className="toastify on "+(this||t).options.className;if(!(this||t).options.position)if(true===(this||t).options.positionLeft){o.className+=" toastify-left";console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")}else o.className+=" toastify-right";else o.className+=" toastify-"+(this||t).options.position;o.className+=" "+(this||t).options.gravity;(this||t).options.backgroundColor&&console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');for(var i in(this||t).options.style)o.style[i]=(this||t).options.style[i];(this||t).options.ariaLive&&o.setAttribute("aria-live",(this||t).options.ariaLive);if((this||t).options.node&&(this||t).options.node.nodeType===Node.ELEMENT_NODE)o.appendChild((this||t).options.node);else{(this||t).options.escapeMarkup?o.innerText=(this||t).options.text:o.innerHTML=(this||t).options.text;if(""!==(this||t).options.avatar){var e=document.createElement("img");e.src=(this||t).options.avatar;e.className="toastify-avatar";"left"==(this||t).options.position||true===(this||t).options.positionLeft?o.appendChild(e):o.insertAdjacentElement("afterbegin",e)}}if(true===(this||t).options.close){var s=document.createElement("button");s.type="button";s.setAttribute("aria-label","Close");s.className="toast-close";s.innerHTML="&#10006;";s.addEventListener("click",function(o){o.stopPropagation();this.removeElement((this||t).toastElement);window.clearTimeout((this||t).toastElement.timeOutValue)}.bind(this||t));var n=window.innerWidth>0?window.innerWidth:screen.width;("left"==(this||t).options.position||true===(this||t).options.positionLeft)&&n>360?o.insertAdjacentElement("afterbegin",s):o.appendChild(s)}if((this||t).options.stopOnFocus&&(this||t).options.duration>0){var a=this||t;o.addEventListener("mouseover",(function(t){window.clearTimeout(o.timeOutValue)}));o.addEventListener("mouseleave",(function(){o.timeOutValue=window.setTimeout((function(){a.removeElement(o)}),a.options.duration)}))}"undefined"!==typeof(this||t).options.destination&&o.addEventListener("click",function(o){o.stopPropagation();true===(this||t).options.newWindow?window.open((this||t).options.destination,"_blank"):window.location=(this||t).options.destination}.bind(this||t));"function"===typeof(this||t).options.onClick&&"undefined"===typeof(this||t).options.destination&&o.addEventListener("click",function(o){o.stopPropagation();(this||t).options.onClick()}.bind(this||t));if("object"===typeof(this||t).options.offset){var l=getAxisOffsetAValue("x",(this||t).options);var r=getAxisOffsetAValue("y",(this||t).options);var p="left"==(this||t).options.position?l:"-"+l;var d="toastify-top"==(this||t).options.gravity?r:"-"+r;o.style.transform="translate("+p+","+d+")"}return o},showToast:function(){(this||t).toastElement=this.buildToast();var o;o="string"===typeof(this||t).options.selector?document.getElementById((this||t).options.selector):(this||t).options.selector instanceof HTMLElement||"undefined"!==typeof ShadowRoot&&(this||t).options.selector instanceof ShadowRoot?(this||t).options.selector:document.body;if(!o)throw"Root element is not defined";var i=Toastify.defaults.oldestFirst?o.firstChild:o.lastChild;o.insertBefore((this||t).toastElement,i);Toastify.reposition();(this||t).options.duration>0&&((this||t).toastElement.timeOutValue=window.setTimeout(function(){this.removeElement((this||t).toastElement)}.bind(this||t),(this||t).options.duration));return this||t},hideToast:function(){(this||t).toastElement.timeOutValue&&clearTimeout((this||t).toastElement.timeOutValue);this.removeElement((this||t).toastElement)},removeElement:function(o){o.className=o.className.replace(" on","");window.setTimeout(function(){(this||t).options.node&&(this||t).options.node.parentNode&&(this||t).options.node.parentNode.removeChild((this||t).options.node);o.parentNode&&o.parentNode.removeChild(o);(this||t).options.callback.call(o);Toastify.reposition()}.bind(this||t),400)}};Toastify.reposition=function(){var o={top:15,bottom:15};var i={top:15,bottom:15};var e={top:15,bottom:15};var s=document.getElementsByClassName("toastify");var n;for(var a=0;a<s.length;a++){n=true===containsClass(s[a],"toastify-top")?"toastify-top":"toastify-bottom";var l=s[a].offsetHeight;n=n.substr(9,n.length-1);var r=15;var p=window.innerWidth>0?window.innerWidth:screen.width;if(p<=360){s[a].style[n]=e[n]+"px";e[n]+=l+r}else if(true===containsClass(s[a],"toastify-left")){s[a].style[n]=o[n]+"px";o[n]+=l+r}else{s[a].style[n]=i[n]+"px";i[n]+=l+r}}return this||t};function getAxisOffsetAValue(t,o){return o.offset[t]?isNaN(o.offset[t])?o.offset[t]:o.offset[t]+"px":"0px"}function containsClass(t,o){return!(!t||"string"!==typeof o)&&!!(t.className&&t.className.trim().split(/\s+/gi).indexOf(o)>-1)}Toastify.lib.init.prototype=Toastify.lib;return Toastify}));var i=o;export{i as default};