File: /home/dmstechonline/whatsapp.dmstech.online/node_modules/vue3-toastify/dist/index.mjs
import { reactive as w, toRaw as T, createApp as Te, nextTick as le, isVNode as ie, mergeProps as P, defineComponent as W, ref as q, computed as f, watchEffect as z, createVNode as i, cloneVNode as pe, onMounted as ue, onUnmounted as de, h as H, Fragment as Ae } from "vue";
const D = {
TOP_LEFT: "top-left",
TOP_RIGHT: "top-right",
TOP_CENTER: "top-center",
BOTTOM_LEFT: "bottom-left",
BOTTOM_RIGHT: "bottom-right",
BOTTOM_CENTER: "bottom-center"
}, M = {
LIGHT: "light",
DARK: "dark",
COLORED: "colored",
AUTO: "auto"
}, g = {
INFO: "info",
SUCCESS: "success",
WARNING: "warning",
ERROR: "error",
DEFAULT: "default"
}, Ne = {
BOUNCE: "bounce",
SLIDE: "slide",
FLIP: "flip",
ZOOM: "zoom"
}, ce = {
dangerouslyHTMLString: !1,
multiple: !0,
position: D.TOP_RIGHT,
autoClose: 5e3,
transition: "bounce",
hideProgressBar: !1,
pauseOnHover: !0,
pauseOnFocusLoss: !0,
closeOnClick: !0,
className: "",
bodyClassName: "",
style: {},
progressClassName: "",
progressStyle: {},
role: "alert",
theme: "light"
}, Ie = {
rtl: !1,
newestOnTop: !1,
toastClassName: ""
}, fe = {
...ce,
...Ie
};
({
...ce,
type: g.DEFAULT
});
var r = /* @__PURE__ */ ((e) => (e[e.COLLAPSE_DURATION = 300] = "COLLAPSE_DURATION", e[e.DEBOUNCE_DURATION = 50] = "DEBOUNCE_DURATION", e.CSS_NAMESPACE = "Toastify", e))(r || {}), J = /* @__PURE__ */ ((e) => (e.ENTRANCE_ANIMATION_END = "d", e))(J || {});
const _e = {
enter: "Toastify--animate Toastify__bounce-enter",
exit: "Toastify--animate Toastify__bounce-exit",
appendPosition: !0
}, he = {
enter: "Toastify--animate Toastify__slide-enter",
exit: "Toastify--animate Toastify__slide-exit",
appendPosition: !0
}, Oe = {
enter: "Toastify--animate Toastify__zoom-enter",
exit: "Toastify--animate Toastify__zoom-exit"
}, be = {
enter: "Toastify--animate Toastify__flip-enter",
exit: "Toastify--animate Toastify__flip-exit"
};
function me(e) {
let t = _e;
if (!e || typeof e == "string")
switch (e) {
case "flip":
t = be;
break;
case "zoom":
t = Oe;
break;
case "slide":
t = he;
break;
}
else
t = e;
return t;
}
function Pe(e) {
return e.containerId || String(e.position);
}
const K = "will-unmount";
function Le(e = D.TOP_RIGHT) {
return !!document.querySelector(".".concat(r.CSS_NAMESPACE, "__toast-container--").concat(e));
}
function $e(e = D.TOP_RIGHT) {
return "".concat(r.CSS_NAMESPACE, "__toast-container--").concat(e);
}
function qe(e, t, n = !1) {
const a = [
"".concat(r.CSS_NAMESPACE, "__toast-container"),
"".concat(r.CSS_NAMESPACE, "__toast-container--").concat(e),
n ? "".concat(r.CSS_NAMESPACE, "__toast-container--rtl") : null
].filter(Boolean).join(" ");
return B(t) ? t({
position: e,
rtl: n,
defaultClassName: a
}) : "".concat(a, " ").concat(t || "");
}
function Be(e) {
var C;
const { position: t, containerClassName: n, rtl: a = !1, style: o = {} } = e, s = r.CSS_NAMESPACE, u = $e(t), E = document.querySelector(".".concat(s)), d = document.querySelector(".".concat(u)), p = !!d && !((C = d.className) != null && C.includes(K)), m = E || document.createElement("div"), S = document.createElement("div");
S.className = qe(
t,
n,
a
), S.dataset.testid = "".concat(r.CSS_NAMESPACE, "__toast-container--").concat(t), S.id = Pe(e);
for (const v in o)
if (Object.prototype.hasOwnProperty.call(o, v)) {
const I = o[v];
S.style[v] = I;
}
return E || (m.className = r.CSS_NAMESPACE, document.body.appendChild(m)), p || m.appendChild(S), S;
}
function ee(e) {
var a, o, s;
const t = typeof e == "string" ? e : ((a = e.currentTarget) == null ? void 0 : a.id) || ((o = e.target) == null ? void 0 : o.id), n = document.getElementById(t);
n && n.removeEventListener("animationend", ee, !1);
try {
x[t].unmount(), (s = document.getElementById(t)) == null || s.remove(), delete x[t], delete c[t];
} catch {
}
}
const x = w({});
function Me(e, t) {
const n = document.getElementById(String(t));
n && (x[n.id] = e);
}
function te(e, t = !0) {
const n = String(e);
if (!x[n])
return;
const a = document.getElementById(n);
a && a.classList.add(K), t ? (Re(e), a && a.addEventListener("animationend", ee, !1)) : ee(n), N.items = N.items.filter((o) => o.containerId !== e);
}
function we(e) {
for (const t in x)
te(t, e);
N.items = [];
}
function ge(e, t) {
const n = document.getElementById(e.toastId);
if (n) {
let a = e;
a = {
...a,
...me(a.transition)
};
const o = a.appendPosition ? "".concat(a.exit, "--").concat(a.position) : a.exit;
n.className += " ".concat(o), t && t(n);
}
}
function Re(e) {
for (const t in c)
if (t === e)
for (const n of c[t] || [])
ge(n);
}
function Fe(e) {
const n = k().find((a) => a.toastId === e);
return n == null ? void 0 : n.containerId;
}
function se(e) {
return document.getElementById(e);
}
function Ue(e) {
const t = se(e.containerId);
return t && t.classList.contains(K);
}
function re(e) {
var n;
const t = ie(e.content) ? T(e.content.props) : null;
return t != null ? t : T((n = e.data) != null ? n : {});
}
function xe(e) {
return e ? N.items.filter((n) => n.containerId === e).length > 0 : N.items.length > 0;
}
function De() {
if (N.items.length > 0) {
const e = N.items.shift();
j(e == null ? void 0 : e.toastContent, e == null ? void 0 : e.toastProps);
}
}
const c = w({}), N = w({
items: []
});
function k() {
const e = T(c);
return Object.values(e).reduce((t, n) => [...t, ...n], []);
}
function ke(e) {
return k().find((n) => n.toastId === e);
}
function j(e, t = {}) {
if (Ue(t)) {
const n = se(t.containerId);
n && n.addEventListener("animationend", ne.bind(null, e, t), !1);
} else
ne(e, t);
}
function ne(e, t = {}) {
const n = se(t.containerId);
n && n.removeEventListener("animationend", ne.bind(null, e, t), !1);
const a = c[t.containerId] || [], o = a.length > 0;
if (!o && !Le(t.position)) {
const s = Be(t), u = Te(rt, t);
u.mount(s), Me(u, s.id);
}
o && (t.position = a[0].position), le(() => {
t.updateId ? A.update(t) : A.add(e, t);
});
}
const A = {
/**
* add a toast
* @param _ ..
* @param opts toast props
*/
add(e, t) {
const { containerId: n = "" } = t;
n && (c[n] = c[n] || [], c[n].find((a) => a.toastId === t.toastId) || setTimeout(() => {
var a, o;
t.newestOnTop ? (a = c[n]) == null || a.unshift(t) : (o = c[n]) == null || o.push(t), t.onOpen && t.onOpen(re(t));
}, t.delay || 0));
},
/**
* remove a toast
* @param id toastId
*/
remove(e) {
if (e) {
const t = Fe(e);
if (t) {
const n = c[t];
let a = n.find((o) => o.toastId === e);
c[t] = n.filter((o) => o.toastId !== e), !c[t].length && !xe(t) && te(t, !1), De(), le(() => {
a != null && a.onClose && (a.onClose(re(a)), a = void 0);
});
}
}
},
/**
* update the toast
* @param opts toast props
*/
update(e = {}) {
const { containerId: t = "" } = e;
if (t && e.updateId) {
c[t] = c[t] || [];
const n = c[t].find((a) => a.toastId === e.toastId);
n && setTimeout(() => {
for (const a in e)
if (Object.prototype.hasOwnProperty.call(e, a)) {
const o = e[a];
n[a] = o;
}
}, e.delay || 0);
}
},
/**
* clear all toasts in container.
* @param containerId container id
*/
clear(e, t = !0) {
e ? te(e, t) : we(t);
},
dismissCallback(e) {
var a;
const t = (a = e.currentTarget) == null ? void 0 : a.id, n = document.getElementById(t);
n && (n.removeEventListener("animationend", A.dismissCallback, !1), setTimeout(() => {
A.remove(t);
}));
},
dismiss(e) {
if (e) {
const t = k();
for (const n of t)
if (n.toastId === e) {
ge(n, (a) => {
a.addEventListener("animationend", A.dismissCallback, !1);
});
break;
}
}
}
}, Ce = w({}), Q = w({});
function ye() {
return Math.random().toString(36).substring(2, 9);
}
function He(e) {
return typeof e == "number" && !isNaN(e);
}
function ae(e) {
return typeof e == "string";
}
function B(e) {
return typeof e == "function";
}
function Y(...e) {
return P(...e);
}
function G(e) {
return typeof e == "object" && (!!(e != null && e.render) || !!(e != null && e.setup) || typeof (e == null ? void 0 : e.type) == "object");
}
function ze(e = {}) {
Ce["".concat(r.CSS_NAMESPACE, "-default-options")] = e;
}
function je() {
return Ce["".concat(r.CSS_NAMESPACE, "-default-options")] || fe;
}
function Ge() {
return document.documentElement.classList.contains("dark") ? "dark" : "light";
}
var V = /* @__PURE__ */ ((e) => (e[e.Enter = 0] = "Enter", e[e.Exit = 1] = "Exit", e))(V || {});
const Ee = {
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: D.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: M.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: g.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: ""
}
}, Ve = {
autoClose: {
type: [Number, Boolean],
required: !0
},
isRunning: {
type: Boolean,
required: !1,
default: void 0
},
type: {
type: String,
required: !1,
default: g.DEFAULT
},
theme: {
type: String,
required: !1,
default: M.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
}
}, Qe = /* @__PURE__ */ W({
name: "ProgressBar",
props: Ve,
// @ts-ignore
setup(e, {
attrs: t
}) {
const n = q(), a = f(() => e.hide ? "true" : "false"), o = f(() => ({
...t.style || {},
animationDuration: "".concat(e.autoClose === !0 ? 5e3 : e.autoClose, "ms"),
animationPlayState: e.isRunning ? "running" : "paused",
opacity: e.hide || e.autoClose === !1 ? 0 : 1,
transform: e.controlledProgress ? "scaleX(".concat(e.progress, ")") : "none"
})), s = f(() => ["".concat(r.CSS_NAMESPACE, "__progress-bar"), e.controlledProgress ? "".concat(r.CSS_NAMESPACE, "__progress-bar--controlled") : "".concat(r.CSS_NAMESPACE, "__progress-bar--animated"), "".concat(r.CSS_NAMESPACE, "__progress-bar-theme--").concat(e.theme), "".concat(r.CSS_NAMESPACE, "__progress-bar--").concat(e.type), e.rtl ? "".concat(r.CSS_NAMESPACE, "__progress-bar--rtl") : null].filter(Boolean).join(" ")), u = f(() => "".concat(s.value, " ").concat((t == null ? void 0 : t.class) || "")), E = () => {
n.value && (n.value.onanimationend = null, n.value.ontransitionend = null);
}, d = () => {
e.isIn && e.closeToast && e.autoClose !== !1 && (e.closeToast(), E());
}, p = f(() => e.controlledProgress ? null : d), m = f(() => e.controlledProgress ? d : null);
return z(() => {
n.value && (E(), n.value.onanimationend = p.value, n.value.ontransitionend = m.value);
}), () => i("div", {
ref: n,
role: "progressbar",
"aria-hidden": a.value,
"aria-label": "notification timer",
class: u.value,
style: o.value
}, null);
}
}), We = /* @__PURE__ */ W({
name: "CloseButton",
inheritAttrs: !1,
props: {
theme: {
type: String,
required: !1,
default: M.AUTO
},
type: {
type: String,
required: !1,
default: M.LIGHT
},
ariaLabel: {
type: String,
required: !1,
default: "close"
},
closeToast: {
type: Function,
required: !1,
default: void 0
}
},
setup(e) {
return () => i("button", {
class: "".concat(r.CSS_NAMESPACE, "__close-button ").concat(r.CSS_NAMESPACE, "__close-button--").concat(e.theme),
type: "button",
onClick: (t) => {
t.stopPropagation(), e.closeToast && e.closeToast(t);
},
"aria-label": e.ariaLabel
}, [i("svg", {
"aria-hidden": "true",
viewBox: "0 0 14 16"
}, [i("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)])]);
}
}), Z = ({
theme: e,
type: t,
path: n,
...a
}) => i("svg", P({
viewBox: "0 0 24 24",
width: "100%",
height: "100%",
fill: e === "colored" ? "currentColor" : "var(--toastify-icon-color-".concat(t, ")")
}, a), [i("path", {
d: n
}, null)]);
function Ke(e) {
return i(Z, P(e, {
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 Ye(e) {
return i(Z, P(e, {
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 Ze(e) {
return i(Z, P(e, {
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 Xe(e) {
return i(Z, P(e, {
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 Je() {
return i("div", {
class: "".concat(r.CSS_NAMESPACE, "__spinner")
}, null);
}
const oe = {
info: Ye,
warning: Ke,
success: Ze,
error: Xe,
spinner: Je
}, et = (e) => e in oe;
function tt({
theme: e,
type: t,
isLoading: n,
icon: a
}) {
let o;
const s = {
theme: e,
type: t
};
return n ? o = oe.spinner() : a === !1 ? o = void 0 : G(a) ? o = T(a) : B(a) ? o = a(s) : ie(a) ? o = pe(a, s) : ae(a) || He(a) ? o = a : et(t) && (o = oe[t](s)), o;
}
const nt = () => {
};
function at(e, t, n = r.COLLAPSE_DURATION) {
const { scrollHeight: a, style: o } = e, s = n;
requestAnimationFrame(() => {
o.minHeight = "initial", o.height = a + "px", o.transition = "all ".concat(s, "ms"), requestAnimationFrame(() => {
o.height = "0", o.padding = "0", o.margin = "0", setTimeout(t, s);
});
});
}
function ot(e) {
const t = q(!1), n = q(!1), a = q(!1), o = q(V.Enter), s = w({
...e,
appendPosition: e.appendPosition || !1,
collapse: typeof e.collapse > "u" ? !0 : e.collapse,
collapseDuration: e.collapseDuration || r.COLLAPSE_DURATION
}), u = s.done || nt, E = f(() => s.appendPosition ? "".concat(s.enter, "--").concat(s.position) : s.enter), d = f(() => s.appendPosition ? "".concat(s.exit, "--").concat(s.position) : s.exit), p = f(() => e.pauseOnHover ? {
onMouseenter: h,
onMouseleave: _
} : {});
function m() {
const y = E.value.split(" ");
C().addEventListener(
J.ENTRANCE_ANIMATION_END,
_,
{ once: !0 }
);
const O = ($) => {
const F = C();
$.target === F && (F.dispatchEvent(new Event(J.ENTRANCE_ANIMATION_END)), F.removeEventListener("animationend", O), F.removeEventListener("animationcancel", O), o.value === V.Enter && $.type !== "animationcancel" && F.classList.remove(...y));
}, b = () => {
const $ = C();
$.classList.add(...y), $.addEventListener("animationend", O), $.addEventListener("animationcancel", O);
};
e.pauseOnFocusLoss && v(), b();
}
function S() {
if (!C())
return;
const y = () => {
const b = C();
b.removeEventListener("animationend", y), s.collapse ? at(b, u, s.collapseDuration) : u();
}, O = () => {
const b = C();
o.value = V.Exit, b && (b.className += " ".concat(d.value), b.addEventListener("animationend", y));
};
n.value || (a.value ? y() : setTimeout(O));
}
function C() {
return e.toastRef.value;
}
function v() {
document.hasFocus() || h(), window.addEventListener("focus", _), window.addEventListener("blur", h);
}
function I() {
window.removeEventListener("focus", _), window.removeEventListener("blur", h);
}
function _() {
(!e.loading.value || e.isLoading === void 0) && (t.value = !0);
}
function h() {
t.value = !1;
}
function R(y) {
y && (y.stopPropagation(), y.preventDefault()), n.value = !1;
}
return z(S), z(() => {
const y = k();
n.value = y.findIndex((O) => O.toastId === s.toastId) > -1;
}), z(() => {
e.isLoading !== void 0 && (e.loading.value ? h() : _());
}), ue(m), de(() => {
e.pauseOnFocusLoss && I();
}), {
isIn: n,
isRunning: t,
hideToast: R,
eventHandlers: p
};
}
const st = /* @__PURE__ */ W({
name: "ToastItem",
inheritAttrs: !1,
props: Ee,
// @ts-ignore
setup(e) {
const t = q(), n = f(() => !!e.isLoading), a = f(() => e.progress !== void 0 && e.progress !== null), o = f(() => tt(e)), s = f(() => ["".concat(r.CSS_NAMESPACE, "__toast"), "".concat(r.CSS_NAMESPACE, "__toast-theme--").concat(e.theme), "".concat(r.CSS_NAMESPACE, "__toast--").concat(e.type), e.rtl ? "".concat(r.CSS_NAMESPACE, "__toast--rtl") : void 0, e.toastClassName || ""].filter(Boolean).join(" ")), {
isRunning: u,
isIn: E,
hideToast: d,
eventHandlers: p
} = ot({
toastRef: t,
loading: n,
done: () => {
A.remove(e.toastId);
},
...me(e.transition),
...e
});
return () => i("div", P({
id: e.toastId,
class: s.value,
style: e.toastStyle || {},
ref: t,
"data-testid": "toast-item-".concat(e.toastId),
onClick: (m) => {
e.closeOnClick && d(), e.onClick && e.onClick(m);
}
}, p.value), [i("div", {
role: e.role,
"data-testid": "toast-body",
class: "".concat(r.CSS_NAMESPACE, "__toast-body ").concat(e.bodyClassName || "")
}, [o.value != null && i("div", {
"data-testid": "toast-icon-".concat(e.type),
class: ["".concat(r.CSS_NAMESPACE, "__toast-icon"), e.isLoading ? "" : "".concat(r.CSS_NAMESPACE, "--animate-icon ").concat(r.CSS_NAMESPACE, "__zoom-enter")].join(" ")
}, [G(o.value) ? H(T(o.value), {
theme: e.theme,
type: e.type
}) : B(o.value) ? o.value({
theme: e.theme,
type: e.type
}) : o.value]), i("div", {
"data-testid": "toast-content"
}, [G(e.content) ? H(T(e.content), {
toastProps: T(e),
closeToast: d,
data: e.data
}) : B(e.content) ? e.content({
toastProps: T(e),
closeToast: d,
data: e.data
}) : e.dangerouslyHTMLString ? H("div", {
innerHTML: e.content
}) : e.content])]), (e.closeButton === void 0 || e.closeButton === !0) && i(We, {
theme: e.theme,
closeToast: (m) => {
m.stopPropagation(), m.preventDefault(), d();
}
}, null), G(e.closeButton) ? H(T(e.closeButton), {
closeToast: d,
type: e.type,
theme: e.theme
}) : B(e.closeButton) ? e.closeButton({
closeToast: d,
type: e.type,
theme: e.theme
}) : null, i(Qe, {
className: e.progressClassName,
style: e.progressStyle,
rtl: e.rtl,
theme: e.theme,
isIn: E.value,
type: e.type,
hide: e.hideProgressBar,
isRunning: u.value,
autoClose: e.autoClose,
controlledProgress: a.value,
progress: e.progress,
closeToast: e.isLoading ? void 0 : d
}, null)]);
}
});
let U = 0;
function Se() {
typeof window > "u" || (U && window.cancelAnimationFrame(U), U = window.requestAnimationFrame(Se), Q.lastUrl !== window.location.href && (Q.lastUrl = window.location.href, A.clear()));
}
const rt = /* @__PURE__ */ W({
name: "ToastifyContainer",
inheritAttrs: !1,
props: Ee,
// @ts-ignore
setup(e) {
const t = f(() => e.containerId), n = f(() => c[t.value] || []), a = f(() => n.value.filter((o) => o.position === e.position));
return ue(() => {
typeof window < "u" && e.clearOnUrlChange && window.requestAnimationFrame(Se);
}), de(() => {
typeof window < "u" && U && (window.cancelAnimationFrame(U), Q.lastUrl = "");
}), () => i(Ae, null, [a.value.map((o) => {
const {
toastId: s = ""
} = o;
return i(st, P({
key: s
}, o), null);
})]);
}
});
let X = !1;
function ve() {
const e = [];
return k().forEach((n) => {
const a = document.getElementById(n.containerId);
a && !a.classList.contains(K) && e.push(n);
}), e;
}
function lt(e) {
const t = ve().length, n = e != null ? e : 0;
return n > 0 && t + N.items.length >= n;
}
function it(e) {
lt(e.limit) && !e.updateId && N.items.push({
toastId: e.toastId,
containerId: e.containerId,
toastContent: e.content,
toastProps: e
});
}
function L(e, t, n = {}) {
if (X)
return;
n = Y(je(), {
type: t
}, T(n)), (!n.toastId || typeof n.toastId != "string" && typeof n.toastId != "number") && (n.toastId = ye()), n = {
...n,
content: e,
containerId: n.containerId || String(n.position)
};
const a = Number(n == null ? void 0 : n.progress);
return a < 0 && (n.progress = 0), a > 1 && (n.progress = 1), n.theme === "auto" && (n.theme = Ge()), it(n), Q.lastUrl = window.location.href, n.multiple ? N.items.length ? n.updateId && j(e, n) : j(e, n) : (X = !0, l.clearAll(void 0, !1), setTimeout(() => {
j(e, n);
}, 0), setTimeout(() => {
X = !1;
}, 390)), n.toastId;
}
const l = (e, t) => L(e, g.DEFAULT, t);
l.info = (e, t) => L(e, g.DEFAULT, {
...t,
type: g.INFO
});
l.error = (e, t) => L(e, g.DEFAULT, {
...t,
type: g.ERROR
});
l.warning = (e, t) => L(e, g.DEFAULT, {
...t,
type: g.WARNING
});
l.warn = l.warning;
l.success = (e, t) => L(e, g.DEFAULT, {
...t,
type: g.SUCCESS
});
l.loading = (e, t) => L(e, g.DEFAULT, Y(t, {
isLoading: !0,
autoClose: !1,
closeOnClick: !1,
closeButton: !1,
draggable: !1
}));
l.dark = (e, t) => L(e, g.DEFAULT, Y(t, {
theme: M.DARK
}));
l.remove = (e) => {
e ? A.dismiss(e) : A.clear();
};
l.clearAll = (e, t) => {
A.clear(e, t);
};
l.isActive = (e) => {
let t = !1;
return t = ve().findIndex((a) => a.toastId === e) > -1, t;
};
l.update = (e, t = {}) => {
setTimeout(() => {
const n = ke(e);
if (n) {
const a = T(n), {
content: o
} = a, s = {
...a,
...t,
toastId: t.toastId || e,
updateId: ye()
}, u = s.render || o;
delete s.render, L(u, s.type, s);
}
}, 0);
};
l.done = (e) => {
l.update(e, {
isLoading: !1,
progress: 1
});
};
l.promise = ut;
function ut(e, {
pending: t,
error: n,
success: a
}, o) {
var m, S, C;
let s;
const u = {
...o || {},
autoClose: !1
};
t && (s = ae(t) ? l.loading(t, u) : l.loading(t.render, {
...u,
...t
}));
const E = {
autoClose: (m = o == null ? void 0 : o.autoClose) != null ? m : !0,
closeOnClick: (S = o == null ? void 0 : o.closeOnClick) != null ? S : !0,
closeButton: (C = o == null ? void 0 : o.autoClose) != null ? C : null,
isLoading: void 0,
draggable: null,
delay: 100
}, d = (v, I, _) => {
if (I == null) {
l.remove(s);
return;
}
const h = {
type: v,
...E,
...o,
data: _
}, R = ae(I) ? {
render: I
} : I;
return s ? l.update(s, {
...h,
...R,
isLoading: !1
}) : l(R.render, {
...h,
...R,
isLoading: !1
}), _;
}, p = B(e) ? e() : e;
return p.then((v) => {
d("success", a, v);
}).catch((v) => {
d("error", n, v);
}), p;
}
l.POSITION = D;
l.THEME = M;
l.TYPE = g;
l.TRANSITIONS = Ne;
const dt = {
install(e, t = {}) {
ct(t);
}
};
typeof window < "u" && (window.Vue3Toastify = dt);
function ct(e = {}) {
const t = Y(fe, e);
ze(t);
}
export {
V as AnimationStep,
_e as Bounce,
be as Flip,
he as Slide,
A as ToastActions,
rt as ToastifyContainer,
Oe as Zoom,
ge as addExitAnimateToNode,
De as appendFromQueue,
Me as cacheRenderInstance,
we as clearContainers,
x as containerInstances,
dt as default,
j as doAppend,
k as getAllToast,
ke as getToast,
Q as globalCache,
Ce as globalOptions,
N as queue,
te as removeContainer,
l as toast,
c as toastContainers,
ct as updateGlobalOptions,
ot as useCssTransition
};