{"version":3,"file":"../modal.js","names":["modalButtons","document","querySelectorAll","handleModal","e","opener","target","closest","modalContentId","dataset","modalTarget","modalContent","querySelector","isSmall","modalSize","modalContentClone","cloneNode","classList","remove","setAttribute","modal","getElementById","ariaLabelText","textContent","contentContainer","innerHTML","appendChild","bootstrap","Modal","show","modalElement","add","addEventListener","focus","forEach","modalButton"],"sources":["modal.js"],"sourcesContent":["\r\nvar modalButtons = document.querySelectorAll(\".modal-toggle\");\r\n\r\nif (modalButtons) {\r\n modalButtons.forEach((modalButton) => {\r\n modalButton.addEventListener(\"click\", handleModal);\r\n });\r\n}\r\n\r\nfunction handleModal(e) {\r\n // handle updating modal content\r\n const opener = e.target.closest('[data-modal-target]');\r\n const modalContentId = opener.dataset.modalTarget;\r\n const modalContent = document.querySelector(\"#\" + modalContentId);\r\n var isSmall = modalContent.dataset.modalSize === \"small\";\r\n const modalContentClone = modalContent.cloneNode(true);\r\n modalContentClone.classList.remove(\"hidden\");\r\n modalContentClone.setAttribute(\"id\", \"\");\r\n const modal = document.getElementById(\"modal\");\r\n const ariaLabelText = modalContent.querySelector(\".modalInfoText\").textContent;\r\n modal.setAttribute(\"aria-label\", ariaLabelText);\r\n const contentContainer = document.getElementById(\"modalPlaceholder\");\r\n contentContainer.innerHTML = \"\";\r\n contentContainer.appendChild(modalContentClone);\r\n\r\n // handle showing modal\r\n const bootstrapModal = new bootstrap.Modal('#modal');\r\n bootstrapModal.show(opener);\r\n\r\n const modalElement = document.getElementById('modal');\r\n if (isSmall) {\r\n modalElement.classList.add(\"modal--small\");\r\n }\r\n modalElement.addEventListener('hidden.bs.modal', () => {\r\n // focus on the modal toggle\r\n opener.focus();\r\n });\r\n}\r\n"],"mappings":"AACA,IAAIA,aAAeC,SAASC,iBAAiB,iBAQ7C,SAASC,YAAYC,GAEjB,MAAMC,EAASD,EAAEE,OAAOC,QAAQ,uBAC1BC,EAAiBH,EAAOI,QAAQC,YAChCC,EAAeV,SAASW,cAAc,IAAMJ,GAClD,IAAIK,EAA6C,UAAnCF,EAAaF,QAAQK,UACnC,MAAMC,EAAoBJ,EAAaK,WAAU,GACjDD,EAAkBE,UAAUC,OAAO,UACnCH,EAAkBI,aAAa,KAAM,IACrC,MAAMC,EAAQnB,SAASoB,eAAe,SAChCC,EAAgBX,EAAaC,cAAc,kBAAkBW,YACnEH,EAAMD,aAAa,aAAcG,GACjC,MAAME,EAAmBvB,SAASoB,eAAe,oBACjDG,EAAiBC,UAAY,GAC7BD,EAAiBE,YAAYX,GAGN,IAAIY,UAAUC,MAAM,UAC5BC,KAAKxB,GAEpB,MAAMyB,EAAe7B,SAASoB,eAAe,SACzCR,GACAiB,EAAab,UAAUc,IAAI,gBAE/BD,EAAaE,iBAAiB,mBAAmB,KAE7C3B,EAAO4B,OAAO,GAEtB,CAlCIjC,cACAA,aAAakC,SAASC,IAClBA,EAAYH,iBAAiB,QAAS7B,YAAY"}