Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

1078 řádky
27 KiB

  1. import { reactive as F, toRaw as A, createApp as Ae, nextTick as se, isVNode as de, mergeProps as P, defineComponent as W, ref as B, computed as f, watchEffect as z, createVNode as l, cloneVNode as Ne, onMounted as ue, onUnmounted as ce, h as H, Fragment as _e } from "vue";
  2. const k = {
  3. TOP_LEFT: "top-left",
  4. TOP_RIGHT: "top-right",
  5. TOP_CENTER: "top-center",
  6. BOTTOM_LEFT: "bottom-left",
  7. BOTTOM_RIGHT: "bottom-right",
  8. BOTTOM_CENTER: "bottom-center"
  9. }, M = {
  10. LIGHT: "light",
  11. DARK: "dark",
  12. COLORED: "colored",
  13. AUTO: "auto"
  14. }, g = {
  15. INFO: "info",
  16. SUCCESS: "success",
  17. WARNING: "warning",
  18. ERROR: "error",
  19. DEFAULT: "default"
  20. }, Ie = {
  21. BOUNCE: "bounce",
  22. SLIDE: "slide",
  23. FLIP: "flip",
  24. ZOOM: "zoom",
  25. NONE: "none"
  26. }, fe = {
  27. dangerouslyHTMLString: !1,
  28. multiple: !0,
  29. position: k.TOP_RIGHT,
  30. autoClose: 5e3,
  31. transition: "bounce",
  32. hideProgressBar: !1,
  33. pauseOnHover: !0,
  34. pauseOnFocusLoss: !0,
  35. closeOnClick: !0,
  36. className: "",
  37. bodyClassName: "",
  38. style: {},
  39. progressClassName: "",
  40. progressStyle: {},
  41. role: "alert",
  42. theme: "light"
  43. }, pe = {
  44. rtl: !1,
  45. newestOnTop: !1,
  46. toastClassName: ""
  47. }, me = {
  48. ...fe,
  49. ...pe
  50. };
  51. ({
  52. ...fe,
  53. type: g.DEFAULT
  54. });
  55. 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 || {});
  56. const he = {
  57. enter: "Toastify--animate Toastify__bounce-enter",
  58. exit: "Toastify--animate Toastify__bounce-exit",
  59. appendPosition: !0
  60. }, Oe = {
  61. enter: "Toastify--animate Toastify__slide-enter",
  62. exit: "Toastify--animate Toastify__slide-exit",
  63. appendPosition: !0
  64. }, be = {
  65. enter: "Toastify--animate Toastify__zoom-enter",
  66. exit: "Toastify--animate Toastify__zoom-exit"
  67. }, Pe = {
  68. enter: "Toastify--animate Toastify__flip-enter",
  69. exit: "Toastify--animate Toastify__flip-exit"
  70. }, ie = "Toastify--animate Toastify__none-enter";
  71. function ge(e, t = !1) {
  72. var a;
  73. let n = he;
  74. if (!e || typeof e == "string")
  75. switch (e) {
  76. case "flip":
  77. n = Pe;
  78. break;
  79. case "zoom":
  80. n = be;
  81. break;
  82. case "slide":
  83. n = Oe;
  84. break;
  85. }
  86. else
  87. n = e;
  88. if (t)
  89. n.enter = ie;
  90. else if (n.enter === ie) {
  91. const o = (a = n.exit.split("__")[1]) == null ? void 0 : a.split("-")[0];
  92. n.enter = `Toastify--animate Toastify__${o}-enter`;
  93. }
  94. return n;
  95. }
  96. function Le(e) {
  97. return e.containerId || String(e.position);
  98. }
  99. const K = "will-unmount";
  100. function $e(e = k.TOP_RIGHT) {
  101. return !!document.querySelector(`.${r.CSS_NAMESPACE}__toast-container--${e}`);
  102. }
  103. function Be(e = k.TOP_RIGHT) {
  104. return `${r.CSS_NAMESPACE}__toast-container--${e}`;
  105. }
  106. function qe(e, t, n = !1) {
  107. const a = [
  108. `${r.CSS_NAMESPACE}__toast-container`,
  109. `${r.CSS_NAMESPACE}__toast-container--${e}`,
  110. n ? `${r.CSS_NAMESPACE}__toast-container--rtl` : null
  111. ].filter(Boolean).join(" ");
  112. return q(t) ? t({
  113. position: e,
  114. rtl: n,
  115. defaultClassName: a
  116. }) : `${a} ${t || ""}`;
  117. }
  118. function Me(e) {
  119. var E;
  120. const { position: t, containerClassName: n, rtl: a = !1, style: o = {} } = e, s = r.CSS_NAMESPACE, d = Be(t), T = document.querySelector(`.${s}`), u = document.querySelector(`.${d}`), N = !!u && !((E = u.className) != null && E.includes(K)), m = T || document.createElement("div"), S = document.createElement("div");
  121. S.className = qe(
  122. t,
  123. n,
  124. a
  125. ), S.dataset.testid = `${r.CSS_NAMESPACE}__toast-container--${t}`, S.id = Le(e);
  126. for (const v in o)
  127. if (Object.prototype.hasOwnProperty.call(o, v)) {
  128. const I = o[v];
  129. S.style[v] = I;
  130. }
  131. return T || (m.className = r.CSS_NAMESPACE, document.body.appendChild(m)), N || m.appendChild(S), S;
  132. }
  133. function ee(e) {
  134. var a, o, s;
  135. 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);
  136. n && n.removeEventListener("animationend", ee, !1);
  137. try {
  138. D[t].unmount(), (s = document.getElementById(t)) == null || s.remove(), delete D[t], delete c[t];
  139. } catch {
  140. }
  141. }
  142. const D = F({});
  143. function we(e, t) {
  144. const n = document.getElementById(String(t));
  145. n && (D[n.id] = e);
  146. }
  147. function te(e, t = !0) {
  148. const n = String(e);
  149. if (!D[n]) return;
  150. const a = document.getElementById(n);
  151. a && a.classList.add(K), t ? (Re(e), a && a.addEventListener("animationend", ee, !1)) : ee(n), _.items = _.items.filter((o) => o.containerId !== e);
  152. }
  153. function Fe(e) {
  154. for (const t in D)
  155. te(t, e);
  156. _.items = [];
  157. }
  158. function Ce(e, t) {
  159. const n = document.getElementById(e.toastId);
  160. if (n) {
  161. let a = e;
  162. a = {
  163. ...a,
  164. ...ge(a.transition)
  165. };
  166. const o = a.appendPosition ? `${a.exit}--${a.position}` : a.exit;
  167. n.className += ` ${o}`, t && t(n);
  168. }
  169. }
  170. function Re(e) {
  171. for (const t in c)
  172. if (t === e)
  173. for (const n of c[t] || [])
  174. Ce(n);
  175. }
  176. function Ue(e) {
  177. const n = w().find((a) => a.toastId === e);
  178. return n == null ? void 0 : n.containerId;
  179. }
  180. function re(e) {
  181. return document.getElementById(e);
  182. }
  183. function xe(e) {
  184. const t = re(e.containerId);
  185. return t && t.classList.contains(K);
  186. }
  187. function le(e) {
  188. var n;
  189. const t = de(e.content) ? A(e.content.props) : null;
  190. return t != null ? t : A((n = e.data) != null ? n : {});
  191. }
  192. function De(e) {
  193. return e ? _.items.filter((n) => n.containerId === e).length > 0 : _.items.length > 0;
  194. }
  195. function ke() {
  196. if (_.items.length > 0) {
  197. const e = _.items.shift();
  198. j(e == null ? void 0 : e.toastContent, e == null ? void 0 : e.toastProps);
  199. }
  200. }
  201. const c = F({}), _ = F({ items: [] });
  202. function w() {
  203. const e = A(c);
  204. return Object.values(e).reduce((t, n) => [...t, ...n], []);
  205. }
  206. function He(e) {
  207. return w().find((n) => n.toastId === e);
  208. }
  209. function j(e, t = {}) {
  210. if (xe(t)) {
  211. const n = re(t.containerId);
  212. n && n.addEventListener("animationend", ne.bind(null, e, t), !1);
  213. } else
  214. ne(e, t);
  215. }
  216. function ne(e, t = {}) {
  217. const n = re(t.containerId);
  218. n && n.removeEventListener("animationend", ne.bind(null, e, t), !1);
  219. const a = c[t.containerId] || [], o = a.length > 0;
  220. if (!o && !$e(t.position)) {
  221. const s = Me(t), d = Ae(it, t);
  222. d.mount(s), we(d, s.id);
  223. }
  224. o && !t.updateId && (t.position = a[0].position), se(() => {
  225. t.updateId ? C.update(t) : C.add(e, t);
  226. });
  227. }
  228. const C = {
  229. /**
  230. * add a toast
  231. * @param _ ..
  232. * @param opts toast props
  233. */
  234. add(e, t) {
  235. const { containerId: n = "" } = t;
  236. n && (c[n] = c[n] || [], c[n].find((a) => a.toastId === t.toastId) || setTimeout(() => {
  237. var a, o;
  238. t.newestOnTop ? (a = c[n]) == null || a.unshift(t) : (o = c[n]) == null || o.push(t), t.onOpen && t.onOpen(le(t));
  239. }, t.delay || 0));
  240. },
  241. /**
  242. * remove a toast
  243. * @param id toastId
  244. */
  245. remove(e) {
  246. if (e) {
  247. const t = Ue(e);
  248. if (t) {
  249. const n = c[t];
  250. let a = n.find((o) => o.toastId === e);
  251. c[t] = n.filter((o) => o.toastId !== e), !c[t].length && !De(t) && te(t, !1), ke(), se(() => {
  252. a != null && a.onClose && (a.onClose(le(a)), a = void 0);
  253. });
  254. }
  255. }
  256. },
  257. /**
  258. * update the toast
  259. * @param opts toast props
  260. */
  261. update(e = {}) {
  262. const { containerId: t = "" } = e;
  263. if (t && e.updateId) {
  264. c[t] = c[t] || [];
  265. const n = c[t].find((s) => s.toastId === e.toastId), a = (n == null ? void 0 : n.position) !== e.position || (n == null ? void 0 : n.transition) !== e.transition, o = {
  266. ...e,
  267. disabledEnterTransition: !a,
  268. updateId: void 0
  269. };
  270. C.dismissForce(e == null ? void 0 : e.toastId), setTimeout(() => {
  271. i(o.content, o);
  272. }, e.delay || 0);
  273. }
  274. },
  275. /**
  276. * clear all toasts in container.
  277. * @param containerId container id
  278. */
  279. clear(e, t = !0) {
  280. e ? te(e, t) : Fe(t);
  281. },
  282. dismissCallback(e) {
  283. var a;
  284. const t = (a = e.currentTarget) == null ? void 0 : a.id, n = document.getElementById(t);
  285. n && (n.removeEventListener("animationend", C.dismissCallback, !1), setTimeout(() => {
  286. C.remove(t);
  287. }));
  288. },
  289. dismiss(e) {
  290. if (e) {
  291. const t = w();
  292. for (const n of t)
  293. if (n.toastId === e) {
  294. Ce(n, (a) => {
  295. a.addEventListener("animationend", C.dismissCallback, !1);
  296. });
  297. break;
  298. }
  299. }
  300. },
  301. dismissForce(e) {
  302. if (e) {
  303. const t = w();
  304. for (const n of t)
  305. if (n.toastId === e) {
  306. const a = document.getElementById(e);
  307. a && (a.remove(), a.removeEventListener("animationend", C.dismissCallback, !1), C.remove(e));
  308. break;
  309. }
  310. }
  311. }
  312. }, Ee = F({}), Q = F({});
  313. function ye() {
  314. return Math.random().toString(36).substring(2, 9);
  315. }
  316. function ze(e) {
  317. return typeof e == "number" && !isNaN(e);
  318. }
  319. function ae(e) {
  320. return typeof e == "string";
  321. }
  322. function q(e) {
  323. return typeof e == "function";
  324. }
  325. function Y(...e) {
  326. return P(...e);
  327. }
  328. function G(e) {
  329. return typeof e == "object" && (!!(e != null && e.render) || !!(e != null && e.setup) || typeof (e == null ? void 0 : e.type) == "object");
  330. }
  331. function je(e = {}) {
  332. Ee[`${r.CSS_NAMESPACE}-default-options`] = e;
  333. }
  334. function Ge() {
  335. return Ee[`${r.CSS_NAMESPACE}-default-options`] || me;
  336. }
  337. function Ve() {
  338. return document.documentElement.classList.contains("dark") ? "dark" : "light";
  339. }
  340. var V = /* @__PURE__ */ ((e) => (e[e.Enter = 0] = "Enter", e[e.Exit = 1] = "Exit", e))(V || {});
  341. const Te = {
  342. containerId: {
  343. type: [String, Number],
  344. required: !1,
  345. default: ""
  346. },
  347. clearOnUrlChange: {
  348. type: Boolean,
  349. required: !1,
  350. default: !0
  351. },
  352. disabledEnterTransition: {
  353. type: Boolean,
  354. required: !1,
  355. default: !1
  356. },
  357. dangerouslyHTMLString: {
  358. type: Boolean,
  359. required: !1,
  360. default: !1
  361. },
  362. multiple: {
  363. type: Boolean,
  364. required: !1,
  365. default: !0
  366. },
  367. limit: {
  368. type: Number,
  369. required: !1,
  370. default: void 0
  371. },
  372. position: {
  373. type: String,
  374. required: !1,
  375. default: k.TOP_LEFT
  376. },
  377. bodyClassName: {
  378. type: String,
  379. required: !1,
  380. default: ""
  381. },
  382. autoClose: {
  383. type: [Number, Boolean],
  384. required: !1,
  385. default: !1
  386. },
  387. closeButton: {
  388. type: [Boolean, Function, Object],
  389. required: !1,
  390. default: void 0
  391. },
  392. transition: {
  393. type: [String, Object],
  394. required: !1,
  395. default: "bounce"
  396. },
  397. hideProgressBar: {
  398. type: Boolean,
  399. required: !1,
  400. default: !1
  401. },
  402. pauseOnHover: {
  403. type: Boolean,
  404. required: !1,
  405. default: !0
  406. },
  407. pauseOnFocusLoss: {
  408. type: Boolean,
  409. required: !1,
  410. default: !0
  411. },
  412. closeOnClick: {
  413. type: Boolean,
  414. required: !1,
  415. default: !0
  416. },
  417. progress: {
  418. type: Number,
  419. required: !1,
  420. default: void 0
  421. },
  422. progressClassName: {
  423. type: String,
  424. required: !1,
  425. default: ""
  426. },
  427. toastStyle: {
  428. type: Object,
  429. required: !1,
  430. default() {
  431. return {};
  432. }
  433. },
  434. progressStyle: {
  435. type: Object,
  436. required: !1,
  437. default() {
  438. return {};
  439. }
  440. },
  441. role: {
  442. type: String,
  443. required: !1,
  444. default: "alert"
  445. },
  446. theme: {
  447. type: String,
  448. required: !1,
  449. default: M.AUTO
  450. },
  451. content: {
  452. type: [String, Object, Function],
  453. required: !1,
  454. default: ""
  455. },
  456. toastId: {
  457. type: [String, Number],
  458. required: !1,
  459. default: ""
  460. },
  461. data: {
  462. type: [Object, String],
  463. required: !1,
  464. default() {
  465. return {};
  466. }
  467. },
  468. type: {
  469. type: String,
  470. required: !1,
  471. default: g.DEFAULT
  472. },
  473. icon: {
  474. type: [Boolean, String, Number, Object, Function],
  475. required: !1,
  476. default: void 0
  477. },
  478. delay: {
  479. type: Number,
  480. required: !1,
  481. default: void 0
  482. },
  483. onOpen: {
  484. type: Function,
  485. required: !1,
  486. default: void 0
  487. },
  488. onClose: {
  489. type: Function,
  490. required: !1,
  491. default: void 0
  492. },
  493. onClick: {
  494. type: Function,
  495. required: !1,
  496. default: void 0
  497. },
  498. isLoading: {
  499. type: Boolean,
  500. required: !1,
  501. default: void 0
  502. },
  503. rtl: {
  504. type: Boolean,
  505. required: !1,
  506. default: !1
  507. },
  508. toastClassName: {
  509. type: String,
  510. required: !1,
  511. default: ""
  512. },
  513. updateId: {
  514. type: [String, Number],
  515. required: !1,
  516. default: ""
  517. }
  518. }, Qe = {
  519. autoClose: {
  520. type: [Number, Boolean],
  521. required: !0
  522. },
  523. isRunning: {
  524. type: Boolean,
  525. required: !1,
  526. default: void 0
  527. },
  528. type: {
  529. type: String,
  530. required: !1,
  531. default: g.DEFAULT
  532. },
  533. theme: {
  534. type: String,
  535. required: !1,
  536. default: M.AUTO
  537. },
  538. hide: {
  539. type: Boolean,
  540. required: !1,
  541. default: void 0
  542. },
  543. className: {
  544. type: [String, Function],
  545. required: !1,
  546. default: ""
  547. },
  548. controlledProgress: {
  549. type: Boolean,
  550. required: !1,
  551. default: void 0
  552. },
  553. rtl: {
  554. type: Boolean,
  555. required: !1,
  556. default: void 0
  557. },
  558. isIn: {
  559. type: Boolean,
  560. required: !1,
  561. default: void 0
  562. },
  563. progress: {
  564. type: Number,
  565. required: !1,
  566. default: void 0
  567. },
  568. closeToast: {
  569. type: Function,
  570. required: !1,
  571. default: void 0
  572. }
  573. }, We = /* @__PURE__ */ W({
  574. name: "ProgressBar",
  575. props: Qe,
  576. // @ts-ignore
  577. setup(e, {
  578. attrs: t
  579. }) {
  580. const n = B(), a = f(() => e.hide ? "true" : "false"), o = f(() => ({
  581. ...t.style || {},
  582. animationDuration: `${e.autoClose === !0 ? 5e3 : e.autoClose}ms`,
  583. animationPlayState: e.isRunning ? "running" : "paused",
  584. opacity: e.hide || e.autoClose === !1 ? 0 : 1,
  585. transform: e.controlledProgress ? `scaleX(${e.progress})` : "none"
  586. })), s = f(() => [`${r.CSS_NAMESPACE}__progress-bar`, e.controlledProgress ? `${r.CSS_NAMESPACE}__progress-bar--controlled` : `${r.CSS_NAMESPACE}__progress-bar--animated`, `${r.CSS_NAMESPACE}__progress-bar-theme--${e.theme}`, `${r.CSS_NAMESPACE}__progress-bar--${e.type}`, e.rtl ? `${r.CSS_NAMESPACE}__progress-bar--rtl` : null].filter(Boolean).join(" ")), d = f(() => `${s.value} ${(t == null ? void 0 : t.class) || ""}`), T = () => {
  587. n.value && (n.value.onanimationend = null, n.value.ontransitionend = null);
  588. }, u = () => {
  589. e.isIn && e.closeToast && e.autoClose !== !1 && (e.closeToast(), T());
  590. }, N = f(() => e.controlledProgress ? null : u), m = f(() => e.controlledProgress ? u : null);
  591. return z(() => {
  592. n.value && (T(), n.value.onanimationend = N.value, n.value.ontransitionend = m.value);
  593. }), () => l("div", {
  594. ref: n,
  595. role: "progressbar",
  596. "aria-hidden": a.value,
  597. "aria-label": "notification timer",
  598. class: d.value,
  599. style: o.value
  600. }, null);
  601. }
  602. }), Ke = /* @__PURE__ */ W({
  603. name: "CloseButton",
  604. inheritAttrs: !1,
  605. props: {
  606. theme: {
  607. type: String,
  608. required: !1,
  609. default: M.AUTO
  610. },
  611. type: {
  612. type: String,
  613. required: !1,
  614. default: M.LIGHT
  615. },
  616. ariaLabel: {
  617. type: String,
  618. required: !1,
  619. default: "close"
  620. },
  621. closeToast: {
  622. type: Function,
  623. required: !1,
  624. default: void 0
  625. }
  626. },
  627. setup(e) {
  628. return () => l("button", {
  629. class: `${r.CSS_NAMESPACE}__close-button ${r.CSS_NAMESPACE}__close-button--${e.theme}`,
  630. type: "button",
  631. onClick: (t) => {
  632. t.stopPropagation(), e.closeToast && e.closeToast(t);
  633. },
  634. "aria-label": e.ariaLabel
  635. }, [l("svg", {
  636. "aria-hidden": "true",
  637. viewBox: "0 0 14 16"
  638. }, [l("path", {
  639. "fill-rule": "evenodd",
  640. 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"
  641. }, null)])]);
  642. }
  643. }), Z = ({
  644. theme: e,
  645. type: t,
  646. path: n,
  647. ...a
  648. }) => l("svg", P({
  649. viewBox: "0 0 24 24",
  650. width: "100%",
  651. height: "100%",
  652. fill: e === "colored" ? "currentColor" : `var(--toastify-icon-color-${t})`
  653. }, a), [l("path", {
  654. d: n
  655. }, null)]);
  656. function Ye(e) {
  657. return l(Z, P(e, {
  658. 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"
  659. }), null);
  660. }
  661. function Ze(e) {
  662. return l(Z, P(e, {
  663. 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"
  664. }), null);
  665. }
  666. function Xe(e) {
  667. return l(Z, P(e, {
  668. 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"
  669. }), null);
  670. }
  671. function Je(e) {
  672. return l(Z, P(e, {
  673. 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"
  674. }), null);
  675. }
  676. function et() {
  677. return l("div", {
  678. class: `${r.CSS_NAMESPACE}__spinner`
  679. }, null);
  680. }
  681. const oe = {
  682. info: Ze,
  683. warning: Ye,
  684. success: Xe,
  685. error: Je,
  686. spinner: et
  687. }, tt = (e) => e in oe;
  688. function nt({
  689. theme: e,
  690. type: t,
  691. isLoading: n,
  692. icon: a
  693. }) {
  694. let o;
  695. const s = {
  696. theme: e,
  697. type: t
  698. };
  699. return n ? o = oe.spinner() : a === !1 ? o = void 0 : G(a) ? o = A(a) : q(a) ? o = a(s) : de(a) ? o = Ne(a, s) : ae(a) || ze(a) ? o = a : tt(t) && (o = oe[t](s)), o;
  700. }
  701. const at = () => {
  702. };
  703. function ot(e, t, n = r.COLLAPSE_DURATION) {
  704. const { scrollHeight: a, style: o } = e, s = n;
  705. requestAnimationFrame(() => {
  706. o.minHeight = "initial", o.height = a + "px", o.transition = `all ${s}ms`, requestAnimationFrame(() => {
  707. o.height = "0", o.padding = "0", o.margin = "0", setTimeout(t, s);
  708. });
  709. });
  710. }
  711. function st(e) {
  712. const t = B(!1), n = B(!1), a = B(!1), o = B(V.Enter), s = F({
  713. ...e,
  714. appendPosition: e.appendPosition || !1,
  715. collapse: typeof e.collapse > "u" ? !0 : e.collapse,
  716. collapseDuration: e.collapseDuration || r.COLLAPSE_DURATION
  717. }), d = s.done || at, T = f(() => s.appendPosition ? `${s.enter}--${s.position}` : s.enter), u = f(() => s.appendPosition ? `${s.exit}--${s.position}` : s.exit), N = f(() => e.pauseOnHover ? {
  718. onMouseenter: h,
  719. onMouseleave: p
  720. } : {});
  721. function m() {
  722. const y = T.value.split(" ");
  723. E().addEventListener(
  724. J.ENTRANCE_ANIMATION_END,
  725. p,
  726. { once: !0 }
  727. );
  728. const O = ($) => {
  729. const U = E();
  730. $.target === U && (U.dispatchEvent(new Event(J.ENTRANCE_ANIMATION_END)), U.removeEventListener("animationend", O), U.removeEventListener("animationcancel", O), o.value === V.Enter && $.type !== "animationcancel" && U.classList.remove(...y));
  731. }, b = () => {
  732. const $ = E();
  733. $.classList.add(...y), $.addEventListener("animationend", O), $.addEventListener("animationcancel", O);
  734. };
  735. e.pauseOnFocusLoss && v(), b();
  736. }
  737. function S() {
  738. if (!E()) return;
  739. const y = () => {
  740. const b = E();
  741. b.removeEventListener("animationend", y), s.collapse ? ot(b, d, s.collapseDuration) : d();
  742. }, O = () => {
  743. const b = E();
  744. o.value = V.Exit, b && (b.className += ` ${u.value}`, b.addEventListener("animationend", y));
  745. };
  746. n.value || (a.value ? y() : setTimeout(O));
  747. }
  748. function E() {
  749. return e.toastRef.value;
  750. }
  751. function v() {
  752. document.hasFocus() || h(), window.addEventListener("focus", p), window.addEventListener("blur", h);
  753. }
  754. function I() {
  755. window.removeEventListener("focus", p), window.removeEventListener("blur", h);
  756. }
  757. function p() {
  758. (!e.loading.value || e.isLoading === void 0) && (t.value = !0);
  759. }
  760. function h() {
  761. t.value = !1;
  762. }
  763. function R(y) {
  764. y && (y.stopPropagation(), y.preventDefault()), n.value = !1;
  765. }
  766. return z(S), z(() => {
  767. const y = w();
  768. n.value = y.findIndex((O) => O.toastId === s.toastId) > -1;
  769. }), z(() => {
  770. e.isLoading !== void 0 && (e.loading.value ? h() : p());
  771. }), ue(m), ce(() => {
  772. e.pauseOnFocusLoss && I();
  773. }), {
  774. isIn: n,
  775. isRunning: t,
  776. hideToast: R,
  777. eventHandlers: N
  778. };
  779. }
  780. const rt = /* @__PURE__ */ W({
  781. name: "ToastItem",
  782. inheritAttrs: !1,
  783. props: Te,
  784. // @ts-ignore
  785. setup(e) {
  786. const t = B(), n = f(() => !!e.isLoading), a = f(() => e.progress !== void 0 && e.progress !== null), o = f(() => nt(e)), s = f(() => [`${r.CSS_NAMESPACE}__toast`, `${r.CSS_NAMESPACE}__toast-theme--${e.theme}`, `${r.CSS_NAMESPACE}__toast--${e.type}`, e.rtl ? `${r.CSS_NAMESPACE}__toast--rtl` : void 0, e.toastClassName || ""].filter(Boolean).join(" ")), {
  787. isRunning: d,
  788. isIn: T,
  789. hideToast: u,
  790. eventHandlers: N
  791. } = st({
  792. toastRef: t,
  793. loading: n,
  794. done: () => {
  795. C.remove(e.toastId);
  796. },
  797. ...ge(e.transition, e.disabledEnterTransition),
  798. ...e
  799. });
  800. return () => l("div", P({
  801. id: e.toastId,
  802. class: s.value,
  803. style: e.toastStyle || {},
  804. ref: t,
  805. "data-testid": `toast-item-${e.toastId}`,
  806. onClick: (m) => {
  807. e.closeOnClick && u(), e.onClick && e.onClick(m);
  808. }
  809. }, N.value), [l("div", {
  810. role: e.role,
  811. "data-testid": "toast-body",
  812. class: `${r.CSS_NAMESPACE}__toast-body ${e.bodyClassName || ""}`
  813. }, [o.value != null && l("div", {
  814. "data-testid": `toast-icon-${e.type}`,
  815. class: [`${r.CSS_NAMESPACE}__toast-icon`, e.isLoading ? "" : `${r.CSS_NAMESPACE}--animate-icon ${r.CSS_NAMESPACE}__zoom-enter`].join(" ")
  816. }, [G(o.value) ? H(A(o.value), {
  817. theme: e.theme,
  818. type: e.type
  819. }) : q(o.value) ? o.value({
  820. theme: e.theme,
  821. type: e.type
  822. }) : o.value]), l("div", {
  823. "data-testid": "toast-content"
  824. }, [G(e.content) ? H(A(e.content), {
  825. toastProps: A(e),
  826. closeToast: u,
  827. data: e.data
  828. }) : q(e.content) ? e.content({
  829. toastProps: A(e),
  830. closeToast: u,
  831. data: e.data
  832. }) : e.dangerouslyHTMLString ? H("div", {
  833. innerHTML: e.content
  834. }) : e.content])]), (e.closeButton === void 0 || e.closeButton === !0) && l(Ke, {
  835. theme: e.theme,
  836. closeToast: (m) => {
  837. m.stopPropagation(), m.preventDefault(), u();
  838. }
  839. }, null), G(e.closeButton) ? H(A(e.closeButton), {
  840. closeToast: u,
  841. type: e.type,
  842. theme: e.theme
  843. }) : q(e.closeButton) ? e.closeButton({
  844. closeToast: u,
  845. type: e.type,
  846. theme: e.theme
  847. }) : null, l(We, {
  848. className: e.progressClassName,
  849. style: e.progressStyle,
  850. rtl: e.rtl,
  851. theme: e.theme,
  852. isIn: T.value,
  853. type: e.type,
  854. hide: e.hideProgressBar,
  855. isRunning: d.value,
  856. autoClose: e.autoClose,
  857. controlledProgress: a.value,
  858. progress: e.progress,
  859. closeToast: e.isLoading ? void 0 : u
  860. }, null)]);
  861. }
  862. });
  863. let x = 0;
  864. function Se() {
  865. typeof window > "u" || (x && window.cancelAnimationFrame(x), x = window.requestAnimationFrame(Se), Q.lastUrl !== window.location.href && (Q.lastUrl = window.location.href, C.clear()));
  866. }
  867. const it = /* @__PURE__ */ W({
  868. name: "ToastifyContainer",
  869. inheritAttrs: !1,
  870. props: Te,
  871. // @ts-ignore
  872. setup(e) {
  873. const t = f(() => e.containerId), n = f(() => c[t.value] || []), a = f(() => n.value.filter((o) => o.position === e.position));
  874. return ue(() => {
  875. typeof window < "u" && e.clearOnUrlChange && window.requestAnimationFrame(Se);
  876. }), ce(() => {
  877. typeof window < "u" && x && (window.cancelAnimationFrame(x), Q.lastUrl = "");
  878. }), () => l(_e, null, [a.value.map((o) => {
  879. const {
  880. toastId: s = ""
  881. } = o;
  882. return l(rt, P({
  883. key: s
  884. }, o), null);
  885. })]);
  886. }
  887. });
  888. let X = !1;
  889. function ve() {
  890. const e = [];
  891. return w().forEach((n) => {
  892. const a = document.getElementById(n.containerId);
  893. a && !a.classList.contains(K) && e.push(n);
  894. }), e;
  895. }
  896. function lt(e) {
  897. const t = ve().length, n = e != null ? e : 0;
  898. return n > 0 && t + _.items.length >= n;
  899. }
  900. function dt(e) {
  901. lt(e.limit) && !e.updateId && _.items.push({
  902. toastId: e.toastId,
  903. containerId: e.containerId,
  904. toastContent: e.content,
  905. toastProps: e
  906. });
  907. }
  908. function L(e, t, n = {}) {
  909. if (X) return;
  910. n = Y(Ge(), {
  911. type: t
  912. }, A(n)), (!n.toastId || typeof n.toastId != "string" && typeof n.toastId != "number") && (n.toastId = ye()), n = {
  913. ...n,
  914. content: e,
  915. containerId: n.containerId || String(n.position)
  916. };
  917. const a = Number(n == null ? void 0 : n.progress);
  918. return a < 0 && (n.progress = 0), a > 1 && (n.progress = 1), n.theme === "auto" && (n.theme = Ve()), dt(n), Q.lastUrl = window.location.href, n.multiple ? _.items.length ? n.updateId && j(e, n) : j(e, n) : (X = !0, i.clearAll(void 0, !1), setTimeout(() => {
  919. j(e, n);
  920. }, 0), setTimeout(() => {
  921. X = !1;
  922. }, 390)), n.toastId;
  923. }
  924. const i = (e, t) => L(e, g.DEFAULT, t);
  925. i.info = (e, t) => L(e, g.DEFAULT, {
  926. ...t,
  927. type: g.INFO
  928. });
  929. i.error = (e, t) => L(e, g.DEFAULT, {
  930. ...t,
  931. type: g.ERROR
  932. });
  933. i.warning = (e, t) => L(e, g.DEFAULT, {
  934. ...t,
  935. type: g.WARNING
  936. });
  937. i.warn = i.warning;
  938. i.success = (e, t) => L(e, g.DEFAULT, {
  939. ...t,
  940. type: g.SUCCESS
  941. });
  942. i.loading = (e, t) => L(e, g.DEFAULT, Y(t, {
  943. isLoading: !0,
  944. autoClose: !1,
  945. closeOnClick: !1,
  946. closeButton: !1,
  947. draggable: !1
  948. }));
  949. i.dark = (e, t) => L(e, g.DEFAULT, Y(t, {
  950. theme: M.DARK
  951. }));
  952. i.remove = (e) => {
  953. e ? C.dismiss(e) : C.clear();
  954. };
  955. i.clearAll = (e, t) => {
  956. se(() => {
  957. C.clear(e, t);
  958. });
  959. };
  960. i.isActive = (e) => {
  961. let t = !1;
  962. return t = ve().findIndex((a) => a.toastId === e) > -1, t;
  963. };
  964. i.update = (e, t = {}) => {
  965. setTimeout(() => {
  966. const n = He(e);
  967. if (n) {
  968. const a = A(n), {
  969. content: o
  970. } = a, s = {
  971. ...a,
  972. ...t,
  973. toastId: t.toastId || e,
  974. updateId: ye()
  975. }, d = s.render || o;
  976. delete s.render, L(d, s.type, s);
  977. }
  978. }, 0);
  979. };
  980. i.done = (e) => {
  981. i.update(e, {
  982. isLoading: !1,
  983. progress: 1
  984. });
  985. };
  986. i.promise = ut;
  987. function ut(e, {
  988. pending: t,
  989. error: n,
  990. success: a
  991. }, o) {
  992. var m, S, E;
  993. let s;
  994. const d = {
  995. ...o || {},
  996. autoClose: !1
  997. };
  998. t && (s = ae(t) ? i.loading(t, d) : i.loading(t.render, {
  999. ...d,
  1000. ...t
  1001. }));
  1002. const T = {
  1003. autoClose: (m = o == null ? void 0 : o.autoClose) != null ? m : !0,
  1004. closeOnClick: (S = o == null ? void 0 : o.closeOnClick) != null ? S : !0,
  1005. closeButton: (E = o == null ? void 0 : o.autoClose) != null ? E : null,
  1006. isLoading: void 0,
  1007. draggable: null,
  1008. delay: 100
  1009. }, u = (v, I, p) => {
  1010. if (I == null) {
  1011. i.remove(s);
  1012. return;
  1013. }
  1014. const h = {
  1015. type: v,
  1016. ...T,
  1017. ...o,
  1018. data: p
  1019. }, R = ae(I) ? {
  1020. render: I
  1021. } : I;
  1022. return s ? i.update(s, {
  1023. ...h,
  1024. ...R,
  1025. isLoading: !1
  1026. }) : i(R.render, {
  1027. ...h,
  1028. ...R,
  1029. isLoading: !1
  1030. }), p;
  1031. }, N = q(e) ? e() : e;
  1032. return N.then((v) => {
  1033. u("success", a, v);
  1034. }).catch((v) => {
  1035. u("error", n, v);
  1036. }), N;
  1037. }
  1038. i.POSITION = k;
  1039. i.THEME = M;
  1040. i.TYPE = g;
  1041. i.TRANSITIONS = Ie;
  1042. const ct = {
  1043. install(e, t = {}) {
  1044. ft(t);
  1045. }
  1046. };
  1047. typeof window < "u" && (window.Vue3Toastify = ct);
  1048. function ft(e = {}) {
  1049. const t = Y(me, e);
  1050. je(t);
  1051. }
  1052. export {
  1053. V as AnimationStep,
  1054. he as Bounce,
  1055. Pe as Flip,
  1056. Oe as Slide,
  1057. C as ToastActions,
  1058. it as ToastifyContainer,
  1059. be as Zoom,
  1060. Ce as addExitAnimateToNode,
  1061. ke as appendFromQueue,
  1062. we as cacheRenderInstance,
  1063. Fe as clearContainers,
  1064. D as containerInstances,
  1065. ct as default,
  1066. j as doAppend,
  1067. w as getAllToast,
  1068. He as getToast,
  1069. Q as globalCache,
  1070. Ee as globalOptions,
  1071. _ as queue,
  1072. te as removeContainer,
  1073. i as toast,
  1074. c as toastContainers,
  1075. ft as updateGlobalOptions,
  1076. st as useCssTransition
  1077. };