{"version":3,"file":"modal-BxFedHCr.js","sources":["../../../app/resources/javascript/components/modal.js"],"sourcesContent":["// This file extends the Bootstrap modal by looking for modals with the `blur` class added.\n// When a modal with the `blur` class is opened, it will add a `modal-backdrop-blur` class to the backdrop.\n\n// This function looks for the modal backdrop and returns a promise that resolves when it finds it.\n// It checks every 20ms for the backdrop to be added to the DOM.\n// This is needed because the backdrop is added to the DOM AFTER the `show.bs.modal` event is fired.\nconst waitForModalBackdrop = () => {\n return new Promise(resolve => {\n const interval = setInterval(() => {\n const backdrop = document.querySelector('.modal-backdrop')\n if (backdrop) {\n clearInterval(interval)\n resolve(backdrop)\n }\n }, 20)\n })\n}\n\nconst handleModalShow = async () => {\n const backDrop = await waitForModalBackdrop()\n backDrop.classList.add('modal-backdrop-blur')\n}\n\nconst addEventListener = (element, event, callback) => {\n if (typeof $ !== 'undefined') {\n // Use JQuery if it is defined, for some reason this is needed for Bootstrap 3 compatibility.\n /* eslint-disable-next-line no-undef */\n $(element).on(event, callback)\n } else {\n element.addEventListener(event, callback)\n }\n}\n\ndocument.querySelectorAll('.modal.blur').forEach(modal => {\n // We listen for the `show.bs.modal` event instead of the `shown.bs.modal` event.\n // This is because the `shown.bs.modal` event is fired AFTER the backdrop is added to the DOM.\n // Meaning the user sees the backdrop without the blur effect for a second.\n addEventListener(modal, 'show.bs.modal', handleModalShow)\n})\n"],"names":["__vite_legacy_guard","waitForModalBackdrop","resolve","interval","backdrop","handleModalShow","addEventListener","element","event","callback","modal"],"mappings":"AAAA,SAAAA,GAAA,CAAA,OAAA,uBAAA,CAAA,CAMA,MAAMC,EAAuB,IACpB,IAAI,QAAQC,GAAW,CAC5B,MAAMC,EAAW,YAAY,IAAM,CACjC,MAAMC,EAAW,SAAS,cAAc,iBAAiB,EACrDA,IACF,cAAcD,CAAQ,EACtBD,EAAQE,CAAQ,EAExB,EAAO,EAAE,CACN,CAAA,EAGGC,EAAkB,SAAY,EACjB,MAAMJ,EAAoB,GAClC,UAAU,IAAI,qBAAqB,CAC9C,EAEMK,EAAmB,CAACC,EAASC,EAAOC,IAAa,CACjD,OAAO,EAAM,IAGf,EAAEF,CAAO,EAAE,GAAGC,EAAOC,CAAQ,EAE7BF,EAAQ,iBAAiBC,EAAOC,CAAQ,CAE5C,EAEA,SAAS,iBAAiB,aAAa,EAAE,QAAQC,GAAS,CAIxDJ,EAAiBI,EAAO,gBAAiBL,CAAe,CAC1D,CAAC"}