/* Minimal toast utility exposing a toastr-compatible API
   (toastr.success/info/warning/error + .options) with no jQuery dependency. */
(function () {
    var host;
    function ensure() {
        if (host) return host;
        host = document.createElement('div');
        host.className = 'toast-host';
        document.body.appendChild(host);
        return host;
    }
    var icons = { success: 'fa-circle-check', info: 'fa-circle-info', warning: 'fa-triangle-exclamation', error: 'fa-circle-xmark' };
    function show(type, msg, title) {
        ensure();
        var el = document.createElement('div');
        el.className = 'toast-msg toast-msg--' + type;
        el.innerHTML = '<i class="fa-solid ' + (icons[type] || icons.info) + '"></i><div>' +
            (title ? '<b>' + title + '</b><br>' : '') + (msg || '') + '</div>';
        host.appendChild(el);
        requestAnimationFrame(function () { el.classList.add('show'); });
        var t = window.toastr.options.timeOut || 2600;
        setTimeout(function () {
            el.classList.remove('show');
            setTimeout(function () { el.remove(); }, 250);
        }, t);
    }
    window.toastr = {
        options: { timeOut: 2600 },
        success: function (m, t) { show('success', m, t); },
        info: function (m, t) { show('info', m, t); },
        warning: function (m, t) { show('warning', m, t); },
        error: function (m, t) { show('error', m, t); }
    };
})();
