{
  "version": 3,
  "sources": ["../src/toast.js"],
  "sourcesContent": ["/**\n * Toast Notifications\n * Used in: templates/base.html\n *\n * Supports:\n * - Django messages (server-rendered)\n * - Dynamic toasts via window.Toast.show()\n * - HTMX events via HX-Trigger header\n */\n(function() {\n    'use strict';\n\n    var CONTAINER_ID = 'toast-container';\n    var TOAST_CLASS = 'toast-notification';\n    var DEFAULT_DURATION = 5000;\n\n    // Icon SVGs by type\n    var ICONS = {\n        success: '<svg class=\"shrink-0 size-4 text-teal-500 mt-0.5\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z\"/></svg>',\n        error: '<svg class=\"shrink-0 size-4 text-red-500 mt-0.5\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z\"/></svg>',\n        warning: '<svg class=\"shrink-0 size-4 text-yellow-500 mt-0.5\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\"><path d=\"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z\"/></svg>',\n        info: '<svg class=\"shrink-0 size-4 text-blue-500 mt-0.5\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\"><path d=\"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z\"/></svg>'\n    };\n\n    // Color classes by type\n    // Dark theme uses opaque backgrounds for better readability\n    var COLORS = {\n        success: {\n            bg: 'bg-teal-50 border-teal-200 dark:bg-teal-900 dark:border-teal-800',\n            text: 'text-teal-700 dark:text-teal-200'\n        },\n        error: {\n            bg: 'bg-red-50 border-red-200 dark:bg-red-900 dark:border-red-800',\n            text: 'text-red-700 dark:text-red-200'\n        },\n        warning: {\n            bg: 'bg-yellow-50 border-yellow-200 dark:bg-yellow-900 dark:border-yellow-800',\n            text: 'text-yellow-700 dark:text-yellow-200'\n        },\n        info: {\n            bg: 'bg-blue-50 border-blue-200 dark:bg-blue-900 dark:border-blue-800',\n            text: 'text-blue-700 dark:text-blue-200'\n        }\n    };\n\n    /**\n     * Get or create toast container\n     */\n    function getContainer() {\n        var container = document.getElementById(CONTAINER_ID);\n        if (!container) {\n            container = document.createElement('div');\n            container.id = CONTAINER_ID;\n            container.className = 'fixed top-4 right-4 z-[100] space-y-3 w-[calc(100vw-2rem)] sm:w-full max-w-sm pointer-events-none';\n            document.body.appendChild(container);\n        }\n        return container;\n    }\n\n    /**\n     * Animate toast in\n     */\n    function showToast(toast) {\n        requestAnimationFrame(function() {\n            toast.classList.remove('translate-x-full', 'opacity-0');\n            toast.classList.add('translate-x-0', 'opacity-100');\n        });\n    }\n\n    /**\n     * Animate toast out and remove\n     */\n    function hideToast(toast) {\n        toast.classList.remove('translate-x-0', 'opacity-100');\n        toast.classList.add('translate-x-full', 'opacity-0');\n        setTimeout(function() {\n            if (toast.parentNode) {\n                toast.parentNode.removeChild(toast);\n            }\n        }, 300);\n    }\n\n    /**\n     * Create toast element\n     */\n    function createToast(type, message, duration) {\n        type = type || 'info';\n        duration = duration || DEFAULT_DURATION;\n\n        var colors = COLORS[type] || COLORS.info;\n        var icon = ICONS[type] || ICONS.info;\n\n        var toast = document.createElement('div');\n        toast.className = TOAST_CLASS + ' transform translate-x-full opacity-0 transition-all duration-300 ease-out pointer-events-auto';\n        toast.setAttribute('role', 'alert');\n\n        toast.innerHTML =\n            '<div class=\"' + colors.bg + ' border rounded-xl shadow-lg\">' +\n                '<div class=\"flex p-4\">' +\n                    '<div class=\"shrink-0\">' + icon + '</div>' +\n                    '<div class=\"ms-3 flex-1\">' +\n                        '<p class=\"text-sm ' + colors.text + '\">' + escapeHtml(message) + '</p>' +\n                    '</div>' +\n                    '<button type=\"button\" class=\"cursor-pointer ms-3 shrink-0 inline-flex justify-center items-center size-5 rounded-lg text-gray-800 opacity-50 hover:opacity-100 focus:outline-none focus:opacity-100 dark:text-white\">' +\n                        '<span class=\"sr-only\">\u0417\u0430\u043A\u0440\u044B\u0442\u044C</span>' +\n                        '<svg class=\"shrink-0 size-4\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">' +\n                            '<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>' +\n                        '</svg>' +\n                    '</button>' +\n                '</div>' +\n            '</div>';\n\n        // Close button handler\n        var closeBtn = toast.querySelector('button');\n        closeBtn.addEventListener('click', function() {\n            hideToast(toast);\n        });\n\n        // Auto-dismiss\n        if (duration > 0) {\n            setTimeout(function() {\n                hideToast(toast);\n            }, duration);\n        }\n\n        return toast;\n    }\n\n    /**\n     * Escape HTML to prevent XSS\n     */\n    function escapeHtml(text) {\n        var div = document.createElement('div');\n        div.textContent = text;\n        return div.innerHTML;\n    }\n\n    /**\n     * Show a toast notification\n     * @param {string} type - 'success', 'error', 'warning', 'info'\n     * @param {string} message - The message to display\n     * @param {number} duration - Auto-dismiss time in ms (0 = no auto-dismiss)\n     */\n    function show(type, message, duration) {\n        var container = getContainer();\n        var toast = createToast(type, message, duration);\n        container.appendChild(toast);\n\n        // Small delay for CSS transition\n        setTimeout(function() {\n            showToast(toast);\n        }, 10);\n    }\n\n    /**\n     * Initialize existing toasts (from Django messages)\n     */\n    function initExistingToasts() {\n        var toasts = document.querySelectorAll('.' + TOAST_CLASS);\n        if (!toasts.length) return;\n\n        toasts.forEach(function(toast, index) {\n            setTimeout(function() {\n                showToast(toast);\n            }, index * 100);\n\n            var dismissTime = parseInt(toast.dataset.autoDismiss) || DEFAULT_DURATION;\n            setTimeout(function() {\n                hideToast(toast);\n            }, dismissTime + index * 100);\n        });\n    }\n\n    /**\n     * Handle HTMX toast events\n     * Views can trigger toasts via HX-Trigger header:\n     * HX-Trigger: {\"showToast\": {\"type\": \"success\", \"message\": \"Saved!\"}}\n     */\n    function initHtmxListener() {\n        document.body.addEventListener('showToast', function(e) {\n            if (e.detail) {\n                show(e.detail.type, e.detail.message, e.detail.duration);\n            }\n        });\n    }\n\n    // Public API\n    window.Toast = {\n        show: show,\n        success: function(message, duration) { show('success', message, duration); },\n        error: function(message, duration) { show('error', message, duration); },\n        warning: function(message, duration) { show('warning', message, duration); },\n        info: function(message, duration) { show('info', message, duration); }\n    };\n\n    // Initialize on DOM ready\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', function() {\n            initExistingToasts();\n            initHtmxListener();\n        });\n    } else {\n        initExistingToasts();\n        initHtmxListener();\n    }\n})();\n"],
  "mappings": "OASC,UAAW,CACR,aAEA,IAAIA,EAAe,kBACfC,E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AAG,CACzE,EAGI,SAAS,aAAe,UACxB,SAAS,iBAAiB,mBAAoB,UAAW,CACrDQ,EAAmB,EACnBI,EAAiB,CACrB,CAAC,GAEDJ,EAAmB,EACnBI,EAAiB,EAEzB,GAAG",
  "names": ["CONTAINER_ID", "TOAST_CLASS", "DEFAULT_DURATION", "ICONS", "COLORS", "getContainer", "container", "showToast", "toast", "hideToast", "createToast", "type", "message", "duration", "colors", "icon", "escapeHtml", "closeBtn", "text", "div", "show", "initExistingToasts", "toasts", "index", "dismissTime", "initHtmxListener", "e"]
}
