File size: 12,914 Bytes
fd0f693
1
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[585],{585:function(t,e,n){let r,o;function a(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}n.r(e),n.d(e,{CheckmarkIcon:function(){return tp},ErrorIcon:function(){return ts},LoaderIcon:function(){return tc},ToastBar:function(){return tk},ToastIcon:function(){return ty},Toaster:function(){return tN},default:function(){return tz},resolveValue:function(){return B},toast:function(){return tt},useToaster:function(){return tr},useToasterStore:function(){return Q}});var i,s=n(4209);let l=t=>((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild,c=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,u=/\/\*[^]*?\*\/|  +/g,d=/\n+/g,p=(t,e)=>{let n="",r="",o="";for(let a in t){let i=t[a];"@"==a[0]?"i"==a[1]?n=a+" "+i+";":r+="f"==a[1]?p(i,a):a+"{"+p(i,"k"==a[1]?"":e)+"}":"object"==typeof i?r+=p(i,e?e.replace(/([^,])+/g,t=>a.replace(/(^:.*)|([^,])+/g,e=>/&/.test(e)?e.replace(/&/g,t):t?t+" "+e:e)):a):null!=i&&(a=/^--/.test(a)?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=p.p?p.p(a,i):a+":"+i+";")}return n+(e&&o?e+"{"+o+"}":o)+r},f={},m=t=>{if("object"==typeof t){let e="";for(let n in t)e+=n+m(t[n]);return e}return t},g=(t,e,n,r,o)=>{var a;let i=m(t),s=f[i]||(f[i]=(t=>{let e=0,n=11;for(;e<t.length;)n=101*n+t.charCodeAt(e++)>>>0;return"go"+n})(i));if(!f[s]){let e=i!==t?t:(t=>{let e,n,r=[{}];for(;e=c.exec(t.replace(u,""));)e[4]?r.shift():e[3]?(n=e[3].replace(d," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][e[1]]=e[2].replace(d," ").trim();return r[0]})(t);f[s]=p(o?{["@keyframes "+s]:e}:e,n?"":"."+s)}let l=n&&f.g?f.g:null;return n&&(f.g=f[s]),a=f[s],l?e.data=e.data.replace(l,a):-1===e.data.indexOf(a)&&(e.data=r?a+e.data:e.data+a),s},h=(t,e,n)=>t.reduce((t,r,o)=>{let a=e[o];if(a&&a.call){let t=a(n),e=t&&t.props&&t.props.className||/^go/.test(t)&&t;a=e?"."+e:t&&"object"==typeof t?t.props?"":p(t,""):!1===t?"":t}return t+r+(null==a?"":a)},"");function y(t){let e=this||{},n=t.call?t(e.p):t;return g(n.unshift?n.raw?h(n,[].slice.call(arguments,1),e.p):n.reduce((t,n)=>Object.assign(t,n&&n.call?n(e.p):n),{}):n,l(e.target),e.g,e.o,e.k)}y.bind({g:1});let b,v,x,w=y.bind({k:1});function E(t,e){let n=this||{};return function(){let r=arguments;function o(a,i){let s=Object.assign({},a),l=s.className||o.className;n.p=Object.assign({theme:v&&v()},s),n.o=/ *go\d+/.test(l),s.className=y.apply(n,r)+(l?" "+l:""),e&&(s.ref=i);let c=t;return t[0]&&(c=s.as||t,delete s.as),x&&c[0]&&x(s),b(c,s)}return e?e(o):o}}function k(){let t=a(["\nfrom {\n  transform: scale(0) rotate(45deg);\n	opacity: 0;\n}\nto {\n transform: scale(1) rotate(45deg);\n  opacity: 1;\n}"]);return k=function(){return t},t}function O(){let t=a(["\nfrom {\n  transform: scale(0);\n  opacity: 0;\n}\nto {\n  transform: scale(1);\n  opacity: 1;\n}"]);return O=function(){return t},t}function j(){let t=a(["\nfrom {\n  transform: scale(0) rotate(90deg);\n	opacity: 0;\n}\nto {\n  transform: scale(1) rotate(90deg);\n	opacity: 1;\n}"]);return j=function(){return t},t}function C(){let t=a(["\n  width: 20px;\n  opacity: 0;\n  height: 20px;\n  border-radius: 10px;\n  background: ",";\n  position: relative;\n  transform: rotate(45deg);\n\n  animation: "," 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n  animation-delay: 100ms;\n\n  &:after,\n  &:before {\n    content: '';\n    animation: "," 0.15s ease-out forwards;\n    animation-delay: 150ms;\n    position: absolute;\n    border-radius: 3px;\n    opacity: 0;\n    background: ",";\n    bottom: 9px;\n    left: 4px;\n    height: 2px;\n    width: 12px;\n  }\n\n  &:before {\n    animation: "," 0.15s ease-out forwards;\n    animation-delay: 180ms;\n    transform: rotate(90deg);\n  }\n"]);return C=function(){return t},t}function N(){let t=a(["\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n"]);return N=function(){return t},t}function z(){let t=a(["\n  width: 12px;\n  height: 12px;\n  box-sizing: border-box;\n  border: 2px solid;\n  border-radius: 100%;\n  border-color: ",";\n  border-right-color: ",";\n  animation: "," 1s linear infinite;\n"]);return z=function(){return t},t}function I(){let t=a(["\nfrom {\n  transform: scale(0) rotate(45deg);\n	opacity: 0;\n}\nto {\n  transform: scale(1) rotate(45deg);\n	opacity: 1;\n}"]);return I=function(){return t},t}function T(){let t=a(["\n0% {\n	height: 0;\n	width: 0;\n	opacity: 0;\n}\n40% {\n  height: 0;\n	width: 6px;\n	opacity: 1;\n}\n100% {\n  opacity: 1;\n  height: 10px;\n}"]);return T=function(){return t},t}function A(){let t=a(["\n  width: 20px;\n  opacity: 0;\n  height: 20px;\n  border-radius: 10px;\n  background: ",";\n  position: relative;\n  transform: rotate(45deg);\n\n  animation: "," 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n  animation-delay: 100ms;\n  &:after {\n    content: '';\n    box-sizing: border-box;\n    animation: "," 0.2s ease-out forwards;\n    opacity: 0;\n    animation-delay: 200ms;\n    position: absolute;\n    border-right: 2px solid;\n    border-bottom: 2px solid;\n    border-color: ",";\n    bottom: 6px;\n    left: 6px;\n    height: 10px;\n    width: 6px;\n  }\n"]);return A=function(){return t},t}function D(){let t=a(["\n  position: absolute;\n"]);return D=function(){return t},t}function P(){let t=a(["\n  position: relative;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  min-width: 20px;\n  min-height: 20px;\n"]);return P=function(){return t},t}function _(){let t=a(["\nfrom {\n  transform: scale(0.6);\n  opacity: 0.4;\n}\nto {\n  transform: scale(1);\n  opacity: 1;\n}"]);return _=function(){return t},t}function M(){let t=a(["\n  position: relative;\n  transform: scale(0.6);\n  opacity: 0.4;\n  min-width: 20px;\n  animation: "," 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n"]);return M=function(){return t},t}function F(){let t=a(["\n  display: flex;\n  align-items: center;\n  background: #fff;\n  color: #363636;\n  line-height: 1.3;\n  will-change: transform;\n  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);\n  max-width: 350px;\n  pointer-events: auto;\n  padding: 8px 10px;\n  border-radius: 8px;\n"]);return F=function(){return t},t}function H(){let t=a(["\n  display: flex;\n  justify-content: center;\n  margin: 4px 10px;\n  color: inherit;\n  flex: 1 1 auto;\n  white-space: pre-line;\n"]);return H=function(){return t},t}function L(){let t=a(["\n  z-index: 9999;\n  > * {\n    pointer-events: auto;\n  }\n"]);return L=function(){return t},t}var S=t=>"function"==typeof t,B=(t,e)=>S(t)?t(e):t,U=(r=0,()=>(++r).toString()),q=()=>{if(void 0===o){let t=matchMedia("(prefers-reduced-motion: reduce)");o=!t||t.matches}return o},R=new Map,V=t=>{if(R.has(t))return;let e=setTimeout(()=>{R.delete(t),J({type:4,toastId:t})},1e3);R.set(t,e)},Y=t=>{let e=R.get(t);e&&clearTimeout(e)},Z=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,20)};case 1:return e.toast.id&&Y(e.toast.id),{...t,toasts:t.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case 2:let{toast:n}=e;return t.toasts.find(t=>t.id===n.id)?Z(t,{type:1,toast:n}):Z(t,{type:0,toast:n});case 3:let{toastId:r}=e;return r?V(r):t.toasts.forEach(t=>{V(t.id)}),{...t,toasts:t.toasts.map(t=>t.id===r||void 0===r?{...t,visible:!1}:t)};case 4:return void 0===e.toastId?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(t=>t.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let o=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(t=>({...t,pauseDuration:t.pauseDuration+o}))}}},$=[],G={toasts:[],pausedAt:void 0},J=t=>{G=Z(G,t),$.forEach(t=>{t(G)})},K={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Q=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[e,n]=(0,s.useState)(G);(0,s.useEffect)(()=>($.push(n),()=>{let t=$.indexOf(n);t>-1&&$.splice(t,1)}),[e]);let r=e.toasts.map(e=>{var n,r;return{...t,...t[e.type],...e,duration:e.duration||(null==(n=t[e.type])?void 0:n.duration)||(null==t?void 0:t.duration)||K[e.type],style:{...t.style,...null==(r=t[e.type])?void 0:r.style,...e.style}}});return{...e,toasts:r}},W=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"blank",n=arguments.length>2?arguments[2]:void 0;return{createdAt:Date.now(),visible:!0,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...n,id:(null==n?void 0:n.id)||U()}},X=t=>(e,n)=>{let r=W(e,t,n);return J({type:2,toast:r}),r.id},tt=(t,e)=>X("blank")(t,e);tt.error=X("error"),tt.success=X("success"),tt.loading=X("loading"),tt.custom=X("custom"),tt.dismiss=t=>{J({type:3,toastId:t})},tt.remove=t=>J({type:4,toastId:t}),tt.promise=(t,e,n)=>{let r=tt.loading(e.loading,{...n,...null==n?void 0:n.loading});return t.then(t=>(tt.success(B(e.success,t),{id:r,...n,...null==n?void 0:n.success}),t)).catch(t=>{tt.error(B(e.error,t),{id:r,...n,...null==n?void 0:n.error})}),t};var te=(t,e)=>{J({type:1,toast:{id:t,height:e}})},tn=()=>{J({type:5,time:Date.now()})},tr=t=>{let{toasts:e,pausedAt:n}=Q(t);(0,s.useEffect)(()=>{if(n)return;let t=Date.now(),r=e.map(e=>{if(e.duration===1/0)return;let n=(e.duration||0)+e.pauseDuration-(t-e.createdAt);if(n<0){e.visible&&tt.dismiss(e.id);return}return setTimeout(()=>tt.dismiss(e.id),n)});return()=>{r.forEach(t=>t&&clearTimeout(t))}},[e,n]);let r=(0,s.useCallback)(()=>{n&&J({type:6,time:Date.now()})},[n]),o=(0,s.useCallback)((t,n)=>{let{reverseOrder:r=!1,gutter:o=8,defaultPosition:a}=n||{},i=e.filter(e=>(e.position||a)===(t.position||a)&&e.height),s=i.findIndex(e=>e.id===t.id),l=i.filter((t,e)=>e<s&&t.visible).length;return i.filter(t=>t.visible).slice(...r?[l+1]:[0,l]).reduce((t,e)=>t+(e.height||0)+o,0)},[e]);return{toasts:e,handlers:{updateHeight:te,startPause:tn,endPause:r,calculateOffset:o}}},to=w(k()),ta=w(O()),ti=w(j()),ts=E("div")(C(),t=>t.primary||"#ff4b4b",to,ta,t=>t.secondary||"#fff",ti),tl=w(N()),tc=E("div")(z(),t=>t.secondary||"#e0e0e0",t=>t.primary||"#616161",tl),tu=w(I()),td=w(T()),tp=E("div")(A(),t=>t.primary||"#61d345",tu,td,t=>t.secondary||"#fff"),tf=E("div")(D()),tm=E("div")(P()),tg=w(_()),th=E("div")(M(),tg),ty=t=>{let{toast:e}=t,{icon:n,type:r,iconTheme:o}=e;return void 0!==n?"string"==typeof n?s.createElement(th,null,n):n:"blank"===r?null:s.createElement(tm,null,s.createElement(tc,{...o}),"loading"!==r&&s.createElement(tf,null,"error"===r?s.createElement(ts,{...o}):s.createElement(tp,{...o})))},tb=t=>"\n0% {transform: translate3d(0,".concat(-200*t,"%,0) scale(.6); opacity:.5;}\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\n"),tv=t=>"\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\n100% {transform: translate3d(0,".concat(-150*t,"%,-1px) scale(.6); opacity:0;}\n"),tx=E("div")(F()),tw=E("div")(H()),tE=(t,e)=>{let n=t.includes("top")?1:-1,[r,o]=q()?["0%{opacity:0;} 100%{opacity:1;}","0%{opacity:1;} 100%{opacity:0;}"]:[tb(n),tv(n)];return{animation:e?"".concat(w(r)," 0.35s cubic-bezier(.21,1.02,.73,1) forwards"):"".concat(w(o)," 0.4s forwards cubic-bezier(.06,.71,.55,1)")}},tk=s.memo(t=>{let{toast:e,position:n,style:r,children:o}=t,a=e.height?tE(e.position||n||"top-center",e.visible):{opacity:0},i=s.createElement(ty,{toast:e}),l=s.createElement(tw,{...e.ariaProps},B(e.message,e));return s.createElement(tx,{className:e.className,style:{...a,...r,...e.style}},"function"==typeof o?o({icon:i,message:l}):s.createElement(s.Fragment,null,i,l))});i=s.createElement,p.p=void 0,b=i,v=void 0,x=void 0;var tO=t=>{let{id:e,className:n,style:r,onHeightUpdate:o,children:a}=t,i=s.useCallback(t=>{if(t){let n=()=>{o(e,t.getBoundingClientRect().height)};n(),new MutationObserver(n).observe(t,{subtree:!0,childList:!0,characterData:!0})}},[e,o]);return s.createElement("div",{ref:i,className:n,style:r},a)},tj=(t,e)=>{let n=t.includes("top"),r=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:q()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:"translateY(".concat(e*(n?1:-1),"px)"),...n?{top:0}:{bottom:0},...r}},tC=y(L()),tN=t=>{let{reverseOrder:e,position:n="top-center",toastOptions:r,gutter:o,children:a,containerStyle:i,containerClassName:l}=t,{toasts:c,handlers:u}=tr(r);return s.createElement("div",{style:{position:"fixed",zIndex:9999,top:16,left:16,right:16,bottom:16,pointerEvents:"none",...i},className:l,onMouseEnter:u.startPause,onMouseLeave:u.endPause},c.map(t=>{let r=t.position||n,i=tj(r,u.calculateOffset(t,{reverseOrder:e,gutter:o,defaultPosition:n}));return s.createElement(tO,{id:t.id,key:t.id,onHeightUpdate:u.updateHeight,className:t.visible?tC:"",style:i},"custom"===t.type?B(t.message,t):a?a(t):s.createElement(tk,{toast:t,position:r}))}))},tz=tt}}]);