{"version":3,"file":"hide_flash.js","mappings":"yBAMA,SAASA,IACP,MAAMC,EAAQC,SAASC,eAAe,SAClCF,GAAOA,EAAMG,QACnB,CAEA,SAASC,IACP,MAAMJ,EAAQC,SAASC,eAAe,SACjCF,IACLA,EAAMK,MAAMC,WAAa,iBACzBN,EAAMK,MAAME,QAAU,IACtBC,WAAWT,EAZG,MAahB,CCdAE,SAASQ,iBAAiB,oBDiBnB,WACL,MAAMC,EAAcT,SAASC,eAAe,cACxCQ,GAAaA,EAAYD,iBAAiB,QAASV,GACvDS,WAAWJ,EApBM,IAqBnB,G","sources":["webpack://trace_taiwan/./app/javascript/packs/flash_messages/display.js","webpack://trace_taiwan/./app/javascript/packs/hide_flash.js"],"sourcesContent":["// Single source of truth for flash behaviour, shared by the server-rendered flash\n// (hide_flash.js, on page load) and AJAX responses (window.showFlash, after a remote\n// action). A flash stays visible briefly, then fades out and removes itself.\nconst VISIBLE_MS = 3000;\nconst FADE_MS = 1500;\n\nfunction removeFlash() {\n const flash = document.getElementById(\"flash\");\n if (flash) flash.remove();\n}\n\nfunction fadeOutFlash() {\n const flash = document.getElementById(\"flash\");\n if (!flash) return;\n flash.style.transition = `opacity ${FADE_MS}ms`;\n flash.style.opacity = \"0\";\n setTimeout(removeFlash, FADE_MS);\n}\n\n// Wire the close button and schedule the auto-fade for the flash currently in the DOM.\nexport function wireFlashDismissal() {\n const closeButton = document.getElementById(\"hide-flash\");\n if (closeButton) closeButton.addEventListener(\"click\", removeFlash);\n setTimeout(fadeOutFlash, VISIBLE_MS);\n}\n\n// Replace the flash region with freshly rendered markup, then wire its dismissal.\nexport function showFlash(html) {\n const container = document.getElementById(\"flash-container\");\n if (!container) return;\n container.innerHTML = html;\n wireFlashDismissal();\n}\n","// Loaded with a server-rendered flash: wire its close button and auto-fade on load.\nimport { wireFlashDismissal } from \"./flash_messages/display\";\n\ndocument.addEventListener(\"DOMContentLoaded\", wireFlashDismissal);\n"],"names":["removeFlash","flash","document","getElementById","remove","fadeOutFlash","style","transition","opacity","setTimeout","addEventListener","closeButton"],"ignoreList":[],"sourceRoot":""}