1import { e as _, d as m, B as d, E as s, r as E } from "./dom.min.js?5.3.3"; 2 3const f = "toast", 4 p = "bs.toast", 5 o = `.${p}`, 6 T = `mouseover${o}`, 7 y = `mouseout${o}`, 8 w = `focusin${o}`, 9 S = `focusout${o}`, 10 b = `hide${o}`, 11 g = `hidden${o}`, 12 N = `show${o}`, 13 I = `shown${o}`, 14 A = "fade", 15 l = "hide", 16 r = "show", 17 h = "showing", 18 L = { 19 animation: "boolean", 20 autohide: "boolean", 21 delay: "number", 22 }, 23 O = { 24 animation: !0, 25 autohide: !0, 26 delay: 5e3, 27 }; 28 29class i extends d { 30 constructor(t, e) { 31 super(t, e); 32 this._timeout = null; 33 this._hasMouseInteraction = !1; 34 this._hasKeyboardInteraction = !1; 35 this._setListeners(); 36 } 37 static get Default() { 38 return O; 39 } 40 static get DefaultType() { 41 return L; 42 } 43 static get NAME() { 44 return f; 45 } 46 show() { 47 if (s.trigger(this._element, N).defaultPrevented) return; 48 this._clearTimeout(); 49 this._config.animation && this._element.classList.add(A); 50 const e = () => { 51 this._element.classList.remove(h); 52 s.trigger(this._element, I); 53 this._maybeScheduleHide(); 54 }; 55 this._element.classList.remove(l); 56 E(this._element); 57 this._element.classList.add(r, h); 58 this._queueCallback(e, this._element, this._config.animation); 59 } 60 hide() { 61 if (!this.isShown() || s.trigger(this._element, b).defaultPrevented) return; 62 const e = () => { 63 this._element.classList.add(l); 64 this._element.classList.remove(h, r); 65 s.trigger(this._element, g); 66 }; 67 this._element.classList.add(h); 68 this._queueCallback(e, this._element, this._config.animation); 69 } 70 dispose() { 71 this._clearTimeout(); 72 this.isShown() && this._element.classList.remove(r); 73 super.dispose(); 74 } 75 isShown() { 76 return this._element.classList.contains(r); 77 } 78 _maybeScheduleHide() { 79 this._config.autohide && 80 !(this._hasMouseInteraction || this._hasKeyboardInteraction) && 81 (this._timeout = setTimeout(() => { 82 this.hide(); 83 }, this._config.delay)); 84 } 85 _onInteraction(t, e) { 86 switch (t.type) { 87 case "mouseover": 88 case "mouseout": 89 this._hasMouseInteraction = e; 90 break; 91 case "focusin": 92 case "focusout": 93 this._hasKeyboardInteraction = e; 94 break; 95 } 96 if (e) { 97 this._clearTimeout(); 98 return; 99 } 100 const a = t.relatedTarget; 101 this._element === a || this._element.contains(a) || this._maybeScheduleHide(); 102 } 103 _setListeners() { 104 s.on(this._element, T, (t) => this._onInteraction(t, !0)); 105 s.on(this._element, y, (t) => this._onInteraction(t, !1)); 106 s.on(this._element, w, (t) => this._onInteraction(t, !0)); 107 s.on(this._element, S, (t) => this._onInteraction(t, !1)); 108 } 109 _clearTimeout() { 110 clearTimeout(this._timeout); 111 this._timeout = null; 112 } 113 static jQueryInterface(t) { 114 return this.each(function () { 115 const e = i.getOrCreateInstance(this, t); 116 if (typeof t === "string") { 117 if (typeof e[t] === "undefined") 118 throw new TypeError(`No method named "${t}"`); 119 e[t](this); 120 } 121 }); 122 } 123} 124 125_(i); 126m(i); 127window.bootstrap = window.bootstrap || {}; 128window.bootstrap.Toast = i; 129 130// Auto-init toasts using default config 131document.addEventListener("DOMContentLoaded", () => { 132 const defaultConfig = { animation: true, autohide: true, delay: 5000 }; 133 const toasts = document.querySelectorAll('[data-bs-toggle="toast"]'); 134 toasts.forEach((toastEl) => { 135 new window.bootstrap.Toast(toastEl, defaultConfig); 136 }); 137}); 138 139export { i as T };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.