GoScrobble/web/node_modules/react-toastify/dist/react-toastify.cjs.production.min.js

3 lines
15 KiB
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),o=e(require("clsx")),r=require("react-dom");function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function a(e){return"number"==typeof e&&!isNaN(e)}function i(e){return"boolean"==typeof e}function c(e){return"string"==typeof e}function u(e){return"function"==typeof e}function l(e){return c(e)||u(e)?e:null}function d(e){return 0===e||e}var f=!("undefined"==typeof window||!window.document||!window.document.createElement);function p(e){return t.isValidElement(e)||c(e)||u(e)||a(e)}var m={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},g={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default",DARK:"dark"};function v(e,t,n){void 0===n&&(n=300);var o=e.scrollHeight,r=e.style;requestAnimationFrame((function(){r.minHeight="initial",r.height=o+"px",r.transition="all "+n+"ms",requestAnimationFrame((function(){r.height="0",r.padding="0",r.margin="0",setTimeout(t,n)}))}))}function y(e){var o=e.enter,r=e.exit,s=e.appendPosition,a=void 0!==s&&s,i=e.collapse,c=void 0===i||i,u=e.collapseDuration,l=void 0===u?300:u;return function(e){var s=e.children,i=e.position,u=e.preventExitTransition,d=e.done,f=e.nodeRef,p=e.isIn,m=a?o+"--"+i:o,g=a?r+"--"+i:r,y=t.useRef(),T=t.useRef(0);function h(){var e=f.current;e.removeEventListener("animationend",h),0===T.current&&(e.className=y.current)}function b(){var e=f.current;e.removeEventListener("animationend",b),c?v(e,d,l):d()}return t.useLayoutEffect((function(){var e;y.current=(e=f.current).className,e.className+=" "+m,e.addEventListener("animationend",h)}),[]),t.useEffect((function(){p||(u?b():function(){T.current=1;var e=f.current;e.className+=" "+g,e.addEventListener("animationend",b)}())}),[p]),n.createElement(n.Fragment,null,s)}}var T={list:new Map,emitQueue:new Map,on:function(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off:function(e,t){if(t){var n=this.list.get(e).filter((function(e){return e!==t}));return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit:function(e){var t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit:function(e){for(var t=this,n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];this.list.has(e)&&this.list.get(e).forEach((function(n){var r=setTimeout((function(){n.apply(void 0,o)}),0);t.emitQueue.has(e)||t.emitQueue.set(e,[]),t.emitQueue.get(e).push(r)}))}};function h(e,n){void 0===n&&(n=!1);var o=t.useRef(e);return t.useEffect((function(){n&&(o.current=e)})),o.current}function b(e,t){switch(t.type){case 0:return[].concat(e,[t.toastId]).filter((function(e){return e!==t.staleId}));case 1:return d(t.toastId)?e.filter((function(e){return e!==t.toastId})):[]}}function E(e){var n=t.useReducer((function(e){return e+1}),0)[1],o=t.useReducer(b,[]),r=o[0],s=o[1],f=t.useRef(null),m=h(0),g=h([]),v=h({}),y=h({toastKey:1,displayedToast:0,props:e,containerId:null,isToastActive:E,getToast:function(e){return v[e]||null}});function E(e){return-1!==r.indexOf(e)}function O(e){var t=e.containerId;!y.props.limit||t&&y.containerId!==t||(m-=g.length,g=[])}function C(e){s({type:1,toastId:e})}function I(){var e=g.shift();x(e.toastContent,e.toastProps,e.staleId)}function _(e,o){var r=o.delay,s=o.staleId,T=function(e,t){if(null==e)return{};var n,o,r={},s=Object.keys(e);for(o=0;o<s.length;o++)t.indexOf(n=s[o])>=0||(r[n]=e[n]);return r}(o,["delay","staleId"]);if(p(e)&&(h=T,!(!f.current||y.props.enableMultiContainer&&h.containerId!==y.props.containerId||v[h.toastId]&&null==h.updateId))){var h,b=T.toastId,E=y.props,O=function(){return C(b)},_=null==T.updateId;_&&m++;var R,N,P={toastId:b,updateId:T.updateId,isIn:!1,key:T.key||y.toastKey++,type:
//# sourceMappingURL=react-toastify.cjs.production.min.js.map