13 lines
24 KiB
JavaScript
13 lines
24 KiB
JavaScript
import{S as D,m as M,X as N,Y as Bt,M as J,k as _t,d as m,j as p,f as ct,H as ht,F as Mt,e as q,N as z,Z as Tt,$ as kt,J as W,_ as qt,c as vt,o as Ct,a as Ft,b as G,p as V,w as Et}from"./main-D6qyxymd.js";const H={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},R={LIGHT:"light",DARK:"dark",COLORED:"colored",AUTO:"auto"},S={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Rt={BOUNCE:"bounce",SLIDE:"slide",FLIP:"flip",ZOOM:"zoom"},Dt={dangerouslyHTMLString:!1,multiple:!0,position:H.TOP_RIGHT,autoClose:5e3,transition:"bounce",hideProgressBar:!1,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,className:"",bodyClassName:"",style:{},progressClassName:"",progressStyle:{},role:"alert",theme:"light"},Ut={rtl:!1,newestOnTop:!1,toastClassName:""},At={...Dt,...Ut};S.DEFAULT;var u=(t=>(t[t.COLLAPSE_DURATION=300]="COLLAPSE_DURATION",t[t.DEBOUNCE_DURATION=50]="DEBOUNCE_DURATION",t.CSS_NAMESPACE="Toastify",t))(u||{}),nt=(t=>(t.ENTRANCE_ANIMATION_END="d",t))(nt||{});const xt={enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0},Ht={enter:"Toastify--animate Toastify__slide-enter",exit:"Toastify--animate Toastify__slide-exit",appendPosition:!0},jt={enter:"Toastify--animate Toastify__zoom-enter",exit:"Toastify--animate Toastify__zoom-exit"},zt={enter:"Toastify--animate Toastify__flip-enter",exit:"Toastify--animate Toastify__flip-exit"};function bt(t){let e=xt;if(!t||typeof t=="string")switch(t){case"flip":e=zt;break;case"zoom":e=jt;break;case"slide":e=Ht;break}else e=t;return e}function Gt(t){return t.containerId||String(t.position)}const Q="will-unmount";function Vt(t=H.TOP_RIGHT){return!!document.querySelector(".".concat(u.CSS_NAMESPACE,"__toast-container--").concat(t))}function Wt(t=H.TOP_RIGHT){return"".concat(u.CSS_NAMESPACE,"__toast-container--").concat(t)}function Kt(t,e,n=!1){const o=["".concat(u.CSS_NAMESPACE,"__toast-container"),"".concat(u.CSS_NAMESPACE,"__toast-container--").concat(t),n?"".concat(u.CSS_NAMESPACE,"__toast-container--rtl"):null].filter(Boolean).join(" ");return F(e)?e({position:t,rtl:n,defaultClassName:o}):"".concat(o," ").concat(e||"")}function Xt(t){var e;const{position:n,containerClassName:o,rtl:a=!1,style:s={}}=t,d=u.CSS_NAMESPACE,A=Wt(n),f=document.querySelector(".".concat(d)),b=document.querySelector(".".concat(A)),i=!!b&&!((e=b.className)!=null&&e.includes(Q)),y=f||document.createElement("div"),l=document.createElement("div");l.className=Kt(n,o,a),l.dataset.testid="".concat(u.CSS_NAMESPACE,"__toast-container--").concat(n),l.id=Gt(t);for(const v in s)if(Object.prototype.hasOwnProperty.call(s,v)){const _=s[v];l.style[v]=_}return f||(y.className=u.CSS_NAMESPACE,document.body.appendChild(y)),i||y.appendChild(l),l}function ot(t){var e,n,o;const a=typeof t=="string"?t:((e=t.currentTarget)==null?void 0:e.id)||((n=t.target)==null?void 0:n.id),s=document.getElementById(a);s&&s.removeEventListener("animationend",ot,!1);try{x[a].unmount(),(o=document.getElementById(a))==null||o.remove(),delete x[a],delete C[a]}catch{}}const x=D({});function Yt(t,e){const n=document.getElementById(String(e));n&&(x[n.id]=t)}function at(t,e=!0){const n=String(t);if(!x[n])return;const o=document.getElementById(n);o&&o.classList.add(Q),e?(Jt(t),o&&o.addEventListener("animationend",ot,!1)):ot(n),P.items=P.items.filter(a=>a.containerId!==t)}function Zt(t){for(const e in x)at(e,t);P.items=[]}function Nt(t,e){const n=document.getElementById(t.toastId);if(n){let o=t;o={...o,...bt(o.transition)};const a=o.appendPosition?"".concat(o.exit,"--").concat(o.position):o.exit;n.className+=" ".concat(a),e&&e(n)}}function Jt(t){for(const e in C)if(e===t)for(const n of C[e]||[])Nt(n)}function Qt(t){const e=j().find(n=>n.toastId===t);return e==null?void 0:e.containerId}function ut(t){return document.getElementById(t)}function $t(t){const e=ut(t.containerId);return e&&e.classList.contains(Q)}function St(t){var e;const n=Tt(t.content)?N(t.content.props):null;return n??N((e=t.data)!=null?e:{})}function te(t){return t?P.items.filter(e=>e.containerId===t).length>0:P.items.length>0}function ee(){if(P.items.length>0){const t=P.items.shift();K(t==null?void 0:t.toastContent,t==null?void 0:t.toastProps)}}const C=D({}),P=D({items:[]});function j(){const t=N(C);return Object.values(t).reduce((e,n)=>[...e,...n],[])}function ne(t){return j().find(e=>e.toastId===t)}function K(t,e={}){if($t(e)){const n=ut(e.containerId);n&&n.addEventListener("animationend",st.bind(null,t,e),!1)}else st(t,e)}function st(t,e={}){const n=ut(e.containerId);n&&n.removeEventListener("animationend",st.bind(null,t,e),!1);const o=C[e.containerId]||[],a=o.length>0;if(!a&&!Vt(e.position)){const s=Xt(e),d=Bt(_e,e);d.mount(s),Yt(d,s.id)}a&&(e.position=o[0].position),_t(()=>{e.updateId?L.update(e):L.add(t,e)})}const L={add(t,e){const{containerId:n=""}=e;n&&(C[n]=C[n]||[],C[n].find(o=>o.toastId===e.toastId)||setTimeout(()=>{var o,a;e.newestOnTop?(o=C[n])==null||o.unshift(e):(a=C[n])==null||a.push(e),e.onOpen&&e.onOpen(St(e))},e.delay||0))},remove(t){if(t){const e=Qt(t);if(e){const n=C[e];let o=n.find(a=>a.toastId===t);C[e]=n.filter(a=>a.toastId!==t),!C[e].length&&!te(e)&&at(e,!1),ee(),_t(()=>{o!=null&&o.onClose&&(o.onClose(St(o)),o=void 0)})}}},update(t={}){const{containerId:e=""}=t;if(e&&t.updateId){C[e]=C[e]||[];const n=C[e].find(o=>o.toastId===t.toastId);n&&setTimeout(()=>{for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const a=t[o];n[o]=a}},t.delay||0)}},clear(t,e=!0){t?at(t,e):Zt(e)},dismissCallback(t){var e;const n=(e=t.currentTarget)==null?void 0:e.id,o=document.getElementById(n);o&&(o.removeEventListener("animationend",L.dismissCallback,!1),setTimeout(()=>{L.remove(n)}))},dismiss(t){if(t){const e=j();for(const n of e)if(n.toastId===t){Nt(n,o=>{o.addEventListener("animationend",L.dismissCallback,!1)});break}}}},It=D({}),Z=D({});function Ot(){return Math.random().toString(36).substring(2,9)}function oe(t){return typeof t=="number"&&!isNaN(t)}function it(t){return typeof t=="string"}function F(t){return typeof t=="function"}function $(...t){return M(...t)}function X(t){return typeof t=="object"&&(!!(t!=null&&t.render)||!!(t!=null&&t.setup)||typeof(t==null?void 0:t.type)=="object")}function ae(t={}){It["".concat(u.CSS_NAMESPACE,"-default-options")]=t}function se(){return It["".concat(u.CSS_NAMESPACE,"-default-options")]||At}function ie(){return document.documentElement.classList.contains("dark")?"dark":"light"}var Y=(t=>(t[t.Enter=0]="Enter",t[t.Exit=1]="Exit",t))(Y||{});const Lt={containerId:{type:[String,Number],required:!1,default:""},clearOnUrlChange:{type:Boolean,required:!1,default:!0},dangerouslyHTMLString:{type:Boolean,required:!1,default:!1},multiple:{type:Boolean,required:!1,default:!0},limit:{type:Number,required:!1,default:void 0},position:{type:String,required:!1,default:H.TOP_LEFT},bodyClassName:{type:String,required:!1,default:""},autoClose:{type:[Number,Boolean],required:!1,default:!1},closeButton:{type:[Boolean,Function,Object],required:!1,default:void 0},transition:{type:[String,Object],required:!1,default:"bounce"},hideProgressBar:{type:Boolean,required:!1,default:!1},pauseOnHover:{type:Boolean,required:!1,default:!0},pauseOnFocusLoss:{type:Boolean,required:!1,default:!0},closeOnClick:{type:Boolean,required:!1,default:!0},progress:{type:Number,required:!1,default:void 0},progressClassName:{type:String,required:!1,default:""},toastStyle:{type:Object,required:!1,default(){return{}}},progressStyle:{type:Object,required:!1,default(){return{}}},role:{type:String,required:!1,default:"alert"},theme:{type:String,required:!1,default:R.AUTO},content:{type:[String,Object,Function],required:!1,default:""},toastId:{type:[String,Number],required:!1,default:""},data:{type:[Object,String],required:!1,default(){return{}}},type:{type:String,required:!1,default:S.DEFAULT},icon:{type:[Boolean,String,Number,Object,Function],required:!1,default:void 0},delay:{type:Number,required:!1,default:void 0},onOpen:{type:Function,required:!1,default:void 0},onClose:{type:Function,required:!1,default:void 0},onClick:{type:Function,required:!1,default:void 0},isLoading:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},toastClassName:{type:String,required:!1,default:""},updateId:{type:[String,Number],required:!1,default:""}},re={autoClose:{type:[Number,Boolean],required:!0},isRunning:{type:Boolean,required:!1,default:void 0},type:{type:String,required:!1,default:S.DEFAULT},theme:{type:String,required:!1,default:R.AUTO},hide:{type:Boolean,required:!1,default:void 0},className:{type:[String,Function],required:!1,default:""},controlledProgress:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:void 0},isIn:{type:Boolean,required:!1,default:void 0},progress:{type:Number,required:!1,default:void 0},closeToast:{type:Function,required:!1,default:void 0}},le=J({name:"ProgressBar",props:re,setup(t,{attrs:e}){const n=q(),o=m(()=>t.hide?"true":"false"),a=m(()=>({...e.style||{},animationDuration:"".concat(t.autoClose===!0?5e3:t.autoClose,"ms"),animationPlayState:t.isRunning?"running":"paused",opacity:t.hide||t.autoClose===!1?0:1,transform:t.controlledProgress?"scaleX(".concat(t.progress,")"):"none"})),s=m(()=>["".concat(u.CSS_NAMESPACE,"__progress-bar"),t.controlledProgress?"".concat(u.CSS_NAMESPACE,"__progress-bar--controlled"):"".concat(u.CSS_NAMESPACE,"__progress-bar--animated"),"".concat(u.CSS_NAMESPACE,"__progress-bar-theme--").concat(t.theme),"".concat(u.CSS_NAMESPACE,"__progress-bar--").concat(t.type),t.rtl?"".concat(u.CSS_NAMESPACE,"__progress-bar--rtl"):null].filter(Boolean).join(" ")),d=m(()=>"".concat(s.value," ").concat((e==null?void 0:e.class)||"")),A=()=>{n.value&&(n.value.onanimationend=null,n.value.ontransitionend=null)},f=()=>{t.isIn&&t.closeToast&&t.autoClose!==!1&&(t.closeToast(),A())},b=m(()=>t.controlledProgress?null:f),i=m(()=>t.controlledProgress?f:null);return W(()=>{n.value&&(A(),n.value.onanimationend=b.value,n.value.ontransitionend=i.value)}),()=>p("div",{ref:n,role:"progressbar","aria-hidden":o.value,"aria-label":"notification timer",class:d.value,style:a.value},null)}}),ce=J({name:"CloseButton",inheritAttrs:!1,props:{theme:{type:String,required:!1,default:R.AUTO},type:{type:String,required:!1,default:R.LIGHT},ariaLabel:{type:String,required:!1,default:"close"},closeToast:{type:Function,required:!1,default:void 0}},setup(t){return()=>p("button",{class:"".concat(u.CSS_NAMESPACE,"__close-button ").concat(u.CSS_NAMESPACE,"__close-button--").concat(t.theme),type:"button",onClick:e=>{e.stopPropagation(),t.closeToast&&t.closeToast(e)},"aria-label":t.ariaLabel},[p("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},[p("path",{"fill-rule":"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"},null)])])}}),tt=({theme:t,type:e,path:n,...o})=>p("svg",M({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":"var(--toastify-icon-color-".concat(e,")")},o),[p("path",{d:n},null)]);function ue(t){return p(tt,M(t,{path:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}),null)}function de(t){return p(tt,M(t,{path:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}),null)}function fe(t){return p(tt,M(t,{path:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}),null)}function me(t){return p(tt,M(t,{path:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}),null)}function pe(){return p("div",{class:"".concat(u.CSS_NAMESPACE,"__spinner")},null)}const rt={info:de,warning:ue,success:fe,error:me,spinner:pe},ge=t=>t in rt;function ye({theme:t,type:e,isLoading:n,icon:o}){let a;const s={theme:t,type:e};return n?a=rt.spinner():o===!1?a=void 0:X(o)?a=N(o):F(o)?a=o(s):Tt(o)?a=kt(o,s):it(o)||oe(o)?a=o:ge(e)&&(a=rt[e](s)),a}const ve=()=>{};function Ce(t,e,n=u.COLLAPSE_DURATION){const{scrollHeight:o,style:a}=t,s=n;requestAnimationFrame(()=>{a.minHeight="initial",a.height=o+"px",a.transition="all ".concat(s,"ms"),requestAnimationFrame(()=>{a.height="0",a.padding="0",a.margin="0",setTimeout(e,s)})})}function Ee(t){const e=q(!1),n=q(!1),o=q(!1),a=q(Y.Enter),s=D({...t,appendPosition:t.appendPosition||!1,collapse:typeof t.collapse>"u"?!0:t.collapse,collapseDuration:t.collapseDuration||u.COLLAPSE_DURATION}),d=s.done||ve,A=m(()=>s.appendPosition?"".concat(s.enter,"--").concat(s.position):s.enter),f=m(()=>s.appendPosition?"".concat(s.exit,"--").concat(s.position):s.exit),b=m(()=>t.pauseOnHover?{onMouseenter:T,onMouseleave:h}:{});function i(){const c=A.value.split(" ");l().addEventListener(nt.ENTRANCE_ANIMATION_END,h,{once:!0});const E=w=>{const B=l();w.target===B&&(B.dispatchEvent(new Event(nt.ENTRANCE_ANIMATION_END)),B.removeEventListener("animationend",E),B.removeEventListener("animationcancel",E),a.value===Y.Enter&&w.type!=="animationcancel"&&B.classList.remove(...c))},g=()=>{const w=l();w.classList.add(...c),w.addEventListener("animationend",E),w.addEventListener("animationcancel",E)};t.pauseOnFocusLoss&&v(),g()}function y(){if(!l())return;const c=()=>{const g=l();g.removeEventListener("animationend",c),s.collapse?Ce(g,d,s.collapseDuration):d()},E=()=>{const g=l();a.value=Y.Exit,g&&(g.className+=" ".concat(f.value),g.addEventListener("animationend",c))};n.value||(o.value?c():setTimeout(E))}function l(){return t.toastRef.value}function v(){document.hasFocus()||T(),window.addEventListener("focus",h),window.addEventListener("blur",T)}function _(){window.removeEventListener("focus",h),window.removeEventListener("blur",T)}function h(){(!t.loading.value||t.isLoading===void 0)&&(e.value=!0)}function T(){e.value=!1}function I(c){c&&(c.stopPropagation(),c.preventDefault()),n.value=!1}return W(y),W(()=>{const c=j();n.value=c.findIndex(E=>E.toastId===s.toastId)>-1}),W(()=>{t.isLoading!==void 0&&(t.loading.value?T():h())}),ct(i),ht(()=>{t.pauseOnFocusLoss&&_()}),{isIn:n,isRunning:e,hideToast:I,eventHandlers:b}}const Se=J({name:"ToastItem",inheritAttrs:!1,props:Lt,setup(t){const e=q(),n=m(()=>!!t.isLoading),o=m(()=>t.progress!==void 0&&t.progress!==null),a=m(()=>ye(t)),s=m(()=>["".concat(u.CSS_NAMESPACE,"__toast"),"".concat(u.CSS_NAMESPACE,"__toast-theme--").concat(t.theme),"".concat(u.CSS_NAMESPACE,"__toast--").concat(t.type),t.rtl?"".concat(u.CSS_NAMESPACE,"__toast--rtl"):void 0,t.toastClassName||""].filter(Boolean).join(" ")),{isRunning:d,isIn:A,hideToast:f,eventHandlers:b}=Ee({toastRef:e,loading:n,done:()=>{L.remove(t.toastId)},...bt(t.transition),...t});return()=>p("div",M({id:t.toastId,class:s.value,style:t.toastStyle||{},ref:e,"data-testid":"toast-item-".concat(t.toastId),onClick:i=>{t.closeOnClick&&f(),t.onClick&&t.onClick(i)}},b.value),[p("div",{role:t.role,"data-testid":"toast-body",class:"".concat(u.CSS_NAMESPACE,"__toast-body ").concat(t.bodyClassName||"")},[a.value!=null&&p("div",{"data-testid":"toast-icon-".concat(t.type),class:["".concat(u.CSS_NAMESPACE,"__toast-icon"),t.isLoading?"":"".concat(u.CSS_NAMESPACE,"--animate-icon ").concat(u.CSS_NAMESPACE,"__zoom-enter")].join(" ")},[X(a.value)?z(N(a.value),{theme:t.theme,type:t.type}):F(a.value)?a.value({theme:t.theme,type:t.type}):a.value]),p("div",{"data-testid":"toast-content"},[X(t.content)?z(N(t.content),{toastProps:N(t),closeToast:f,data:t.data}):F(t.content)?t.content({toastProps:N(t),closeToast:f,data:t.data}):t.dangerouslyHTMLString?z("div",{innerHTML:t.content}):t.content])]),(t.closeButton===void 0||t.closeButton===!0)&&p(ce,{theme:t.theme,closeToast:i=>{i.stopPropagation(),i.preventDefault(),f()}},null),X(t.closeButton)?z(N(t.closeButton),{closeToast:f,type:t.type,theme:t.theme}):F(t.closeButton)?t.closeButton({closeToast:f,type:t.type,theme:t.theme}):null,p(le,{className:t.progressClassName,style:t.progressStyle,rtl:t.rtl,theme:t.theme,isIn:A.value,type:t.type,hide:t.hideProgressBar,isRunning:d.value,autoClose:t.autoClose,controlledProgress:o.value,progress:t.progress,closeToast:t.isLoading?void 0:f},null)])}});let U=0;function Pt(){typeof window>"u"||(U&&window.cancelAnimationFrame(U),U=window.requestAnimationFrame(Pt),Z.lastUrl!==window.location.href&&(Z.lastUrl=window.location.href,L.clear()))}const _e=J({name:"ToastifyContainer",inheritAttrs:!1,props:Lt,setup(t){const e=m(()=>t.containerId),n=m(()=>C[e.value]||[]),o=m(()=>n.value.filter(a=>a.position===t.position));return ct(()=>{typeof window<"u"&&t.clearOnUrlChange&&window.requestAnimationFrame(Pt)}),ht(()=>{typeof window<"u"&&U&&(window.cancelAnimationFrame(U),Z.lastUrl="")}),()=>p(Mt,null,[o.value.map(a=>{const{toastId:s=""}=a;return p(Se,M({key:s},a),null)})])}});let et=!1;function wt(){const t=[];return j().forEach(e=>{const n=document.getElementById(e.containerId);n&&!n.classList.contains(Q)&&t.push(e)}),t}function he(t){const e=wt().length,n=t??0;return n>0&&e+P.items.length>=n}function Te(t){he(t.limit)&&!t.updateId&&P.items.push({toastId:t.toastId,containerId:t.containerId,toastContent:t.content,toastProps:t})}function k(t,e,n={}){if(et)return;n=$(se(),{type:e},N(n)),(!n.toastId||typeof n.toastId!="string"&&typeof n.toastId!="number")&&(n.toastId=Ot()),n={...n,content:t,containerId:n.containerId||String(n.position)};const o=Number(n==null?void 0:n.progress);return o<0&&(n.progress=0),o>1&&(n.progress=1),n.theme==="auto"&&(n.theme=ie()),Te(n),Z.lastUrl=window.location.href,n.multiple?P.items.length?n.updateId&&K(t,n):K(t,n):(et=!0,r.clearAll(void 0,!1),setTimeout(()=>{K(t,n)},0),setTimeout(()=>{et=!1},390)),n.toastId}const r=(t,e)=>k(t,S.DEFAULT,e);r.info=(t,e)=>k(t,S.DEFAULT,{...e,type:S.INFO});r.error=(t,e)=>k(t,S.DEFAULT,{...e,type:S.ERROR});r.warning=(t,e)=>k(t,S.DEFAULT,{...e,type:S.WARNING});r.warn=r.warning;r.success=(t,e)=>k(t,S.DEFAULT,{...e,type:S.SUCCESS});r.loading=(t,e)=>k(t,S.DEFAULT,$(e,{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1}));r.dark=(t,e)=>k(t,S.DEFAULT,$(e,{theme:R.DARK}));r.remove=t=>{t?L.dismiss(t):L.clear()};r.clearAll=(t,e)=>{L.clear(t,e)};r.isActive=t=>{let e=!1;return e=wt().findIndex(n=>n.toastId===t)>-1,e};r.update=(t,e={})=>{setTimeout(()=>{const n=ne(t);if(n){const o=N(n),{content:a}=o,s={...o,...e,toastId:e.toastId||t,updateId:Ot()},d=s.render||a;delete s.render,k(d,s.type,s)}},0)};r.done=t=>{r.update(t,{isLoading:!1,progress:1})};r.promise=Ae;function Ae(t,{pending:e,error:n,success:o},a){var s,d,A;let f;const b={...a||{},autoClose:!1};e&&(f=it(e)?r.loading(e,b):r.loading(e.render,{...b,...e}));const i={autoClose:(s=a==null?void 0:a.autoClose)!=null?s:!0,closeOnClick:(d=a==null?void 0:a.closeOnClick)!=null?d:!0,closeButton:(A=a==null?void 0:a.autoClose)!=null?A:null,isLoading:void 0,draggable:null,delay:100},y=(v,_,h)=>{if(_==null){r.remove(f);return}const T={type:v,...i,...a,data:h},I=it(_)?{render:_}:_;return f?r.update(f,{...T,...I,isLoading:!1}):r(I.render,{...T,...I,isLoading:!1}),h},l=F(t)?t():t;return l.then(v=>{y("success",o,v)}).catch(v=>{y("error",n,v)}),l}r.POSITION=H;r.THEME=R;r.TYPE=S;r.TRANSITIONS=Rt;const be={install(t,e={}){lt(e)}};typeof window<"u"&&(window.Vue3Toastify=be);function lt(t={}){const e=$(At,t);ae(e)}const Ne={props:{content:{type:Object,required:!0},uid:{type:String,required:!0}},emits:["trigger-event"],setup(t,{emit:e}){const n=m(()=>!1),o={"top-right":"top-right","top-center":"top-center","top-left":"top-left","bottom-right":"bottom-right","bottom-center":"bottom-center","bottom-left":"bottom-left"},a=m(()=>{var i;return((i=t.content)==null?void 0:i.edgeOffset)??0}),s=m(()=>{var i,y,l,v,_,h,T,I,c,E,g;return{position:o[(i=t.content)==null?void 0:i.position]||"top-right",autoClose:((y=t.content)==null?void 0:y.autoClose)??3e3,hideProgressBar:((l=t.content)==null?void 0:l.hideProgressBar)??!1,closeOnClick:((v=t.content)==null?void 0:v.closeOnClick)??!0,pauseOnHover:((_=t.content)==null?void 0:_.pauseOnHover)??!0,draggable:((h=t.content)==null?void 0:h.draggable)??!0,theme:((T=t.content)==null?void 0:T.theme)||"light",transition:((I=t.content)==null?void 0:I.transition)||"bounce",rtl:((c=t.content)==null?void 0:c.rtl)??!1,closeButton:((E=t.content)==null?void 0:E.closeButton)??!0,toastClassName:((g=t.content)==null?void 0:g.customClass)||""}});Et(s,i=>{lt(i)},{immediate:!0,deep:!0}),Et(a,i=>{d(i)},{immediate:!0});const d=i=>{const y="toastify-offset-styles";let l=document.getElementById(y);l||(l=document.createElement("style"),l.id=y,document.head.appendChild(l)),l.innerHTML=`
|
|
.Toastify__toast-container--top-right,
|
|
.Toastify__toast-container--top-center,
|
|
.Toastify__toast-container--top-left {
|
|
top: ${i}px !important;
|
|
}
|
|
.Toastify__toast-container--bottom-right,
|
|
.Toastify__toast-container--bottom-center,
|
|
.Toastify__toast-container--bottom-left {
|
|
bottom: ${i}px !important;
|
|
}
|
|
`};return ct(()=>{lt(s.value),d(a.value)}),{showToast:(i,y,l="",v,_,h,T,I={})=>{var B,dt,ft,mt,pt,gt,yt;if(n.value)return;let c={};typeof l=="object"?c={...s.value,...l}:(c={...s.value,...I},l&&(c.position=l),v!==void 0&&(c.autoClose=v),_!==void 0&&(c.hideProgressBar=_),h!==void 0&&(c.closeOnClick=h),T!==void 0&&(c.pauseOnHover=T));const E=((B=t.content)==null?void 0:B.theme)||"light";if(E==="light"&&((dt=t.content)!=null&&dt.lightBackgroundColor)?c.style={...c.style||{},"--toastify-color-light":t.content.lightBackgroundColor}:E==="dark"&&((ft=t.content)!=null&&ft.darkBackgroundColor)&&(c.style={...c.style||{},"--toastify-color-dark":t.content.darkBackgroundColor}),E==="colored"){let O;switch(i){case"success":O=((mt=t.content)==null?void 0:mt.successColor)||"#4caf50";break;case"error":O=((pt=t.content)==null?void 0:pt.errorColor)||"#f44336";break;case"info":O=((gt=t.content)==null?void 0:gt.infoColor)||"#2196f3";break;case"warning":O=((yt=t.content)==null?void 0:yt.warningColor)||"#ff9800";break;default:O=null}O&&(c.style={...c.style||{},backgroundColor:O,"--toastify-color-progress-light":O,"--toastify-color-progress-dark":O,"--toastify-color-progress-colored":O})}let g;switch(i){case"success":g=r.success;break;case"error":g=r.error;break;case"info":g=r.info;break;case"warning":g=r.warning;break;default:g=r}const w=g(y,c);return e("trigger-event",{name:"toast-shown",event:{type:i,message:y,id:w}}),w},dismissToast:i=>{n.value||(r.dismiss(i),e("trigger-event",{name:"toast-dismissed",event:{id:i}}))},dismissAllToasts:()=>{n.value||(r.dismiss(),e("trigger-event",{name:"all-toasts-dismissed",event:{}}))},isEditing:n}}},Ie={class:"toast-notifications-container"},Oe={key:0,class:"toast-demo-buttons"};function Le(t,e,n,o,a,s){return Ct(),vt("div",Ie,[n.content.showDemoButtons?(Ct(),vt("div",Oe,[G("button",{class:"toast-button success",onClick:e[0]||(e[0]=d=>o.showToast("success",n.content.successMessage||"Success!")),style:V({backgroundColor:n.content.successColor||"#4caf50"})}," Success ",4),G("button",{class:"toast-button error",onClick:e[1]||(e[1]=d=>o.showToast("error",n.content.errorMessage||"Error!")),style:V({backgroundColor:n.content.errorColor||"#f44336"})}," Error ",4),G("button",{class:"toast-button info",onClick:e[2]||(e[2]=d=>o.showToast("info",n.content.infoMessage||"Info!")),style:V({backgroundColor:n.content.infoColor||"#2196f3"})}," Info ",4),G("button",{class:"toast-button warning",onClick:e[3]||(e[3]=d=>o.showToast("warning",n.content.warningMessage||"Warning!")),style:V({backgroundColor:n.content.warningColor||"#ff9800"})}," Warning ",4)])):Ft("",!0)])}const we=qt(Ne,[["render",Le],["__scopeId","data-v-ca5856d1"]]);export{we as e};
|