(()=>{const i={init:function(){this.bindEvents(),this.showPopup()},bindEvents:function(){const o=this;document.addEventListener("click",function(t){t.target.closest(".notifal-activation-popup-close")&&(t.preventDefault(),o.closePopup())}),document.addEventListener("click",function(t){t.target.matches(".notifal-activation-popup-overlay")&&o.closePopup()}),document.addEventListener("keydown",function(t){t.key==="Escape"&&document.getElementById("notifal-activation-popup").offsetParent!==null&&o.closePopup()}),document.addEventListener("click",function(t){if(t.target.matches(".notifal-activation-popup-button")){const n=t.target.getAttribute("data-button-id");o.trackButtonClick(n),o.closePopup(!0)}})},showPopup:function(){const o=document.querySelector(".notifal-activation-popup-overlay"),t=document.querySelector(".notifal-activation-popup-content");if(!t)return;o.style.display="block",t.style.display="block",o.classList.add("show"),t.classList.add("show"),t.setAttribute("aria-hidden","false");const n=t.querySelector(".notifal-activation-popup-close");n&&n.focus(),document.body.classList.add("notifal-activation-popup-active")},closePopup:function(o){const t=this,n=document.querySelector(".notifal-activation-popup-overlay"),e=document.querySelector(".notifal-activation-popup-content");e.classList.add("hide"),setTimeout(function(){n.classList.remove("show"),n.style.display="none",e.classList.remove("show","hide"),e.style.display="none",document.body.classList.remove("notifal-activation-popup-active"),t.dismissPopup()},300)},dismissPopup:function(){const o=new FormData;o.append("action","notifal_dismiss_activation_popup"),o.append("nonce",notifalActivationPopup.nonce),fetch(notifalActivationPopup.ajaxUrl,{method:"POST",body:o}).then(t=>t.json()).then(t=>{if(t.success&&window.history.replaceState){const n=new URL(window.location);n.searchParams.delete("notifal_activation"),window.history.replaceState(null,null,n)}}).catch(t=>{t.name!=="TypeError"&&t.message.includes("network")})},trackButtonClick:function(o){}};document.addEventListener("DOMContentLoaded",function(){i.init()})})();
