!function(){"use strict";const e=()=>{const e=document.querySelector(".wpmtk-popup"),t=document.querySelector("#JS-close-popup"),o=document.querySelector("#JS-popup-overlay"),n=document.querySelectorAll(".wpmtk-view"),c=document.querySelector("#JS-wpmtk-email-preview"),r=document.querySelector("#JS-wpmtk-email-loader"),a=()=>{e&&e.classList.remove("show")};t&&t.addEventListener("click",(()=>{a()})),o&&o.addEventListener("click",(()=>{a()})),n.forEach((t=>{t.addEventListener("click",(()=>{e&&e.classList.add("show"),(e=>{const t=e.value;if(!t)return;c.innerHTML="",r.classList.add("show");const o=new FormData;o.append("action","wpmtk_mail_catcher_preview"),o.append("nonce",WPMastertoolkitSubmenu.nonce),o.append("email_id",t);const n={method:"POST",body:o,redirect:"follow"};fetch(WPMastertoolkitSubmenu.ajaxUrl,n).then((e=>e.json())).then((e=>{c.innerHTML=e.data,r.classList.remove("show")})).catch((e=>{console.log("ERROR: ",e)}))})(t)}))}))};document.addEventListener("DOMContentLoaded",(()=>e()))}();