!function(){"use strict";const e=()=>{const e=document.querySelector(".wpmastertoolkit-maintenance-mode-normal"),t=document.querySelector(".wpmastertoolkit-maintenance-mode-normal-btn.off"),n=document.querySelector(".wpmastertoolkit-maintenance-mode-normal-btn.on"),o=document.querySelector(".wpmastertoolkit-maintenance-mode-compact-btn.off"),a=document.querySelector(".wpmastertoolkit-maintenance-mode-compact-btn.on"),i=document.querySelector(".wpmastertoolkit-maintenance-mode-bypass-link-btn"),c=document.querySelector(".wpmastertoolkit-maintenance-mode-bypass-link-icon"),d=e=>{const t=new FormData;t.append("action","wpmastertoolkit_maintenance_mode_adminbar_toggle"),t.append("nonce",wpmastertoolkit_maintenance_mode_adminbar.nonce),t.append("status",e);const n={method:"POST",body:t,redirect:"follow"};fetch(wpmastertoolkit_maintenance_mode_adminbar.ajaxurl,n).then((e=>e.json())).then((e=>{window.location.reload()})).catch((e=>{console.log("Error...")}))};t&&n&&(t.addEventListener("mouseenter",(()=>{e.classList.contains("active")&&(e.classList.remove("active"),t.addEventListener("mouseleave",(()=>{e.classList.add("active")})))})),n.addEventListener("mouseenter",(()=>{e.classList.contains("active")||(e.classList.add("active"),n.addEventListener("mouseleave",(()=>{e.classList.remove("active")})))})),t.addEventListener("click",(()=>{"1"==e.dataset.enabled&&window.confirm(wpmastertoolkit_maintenance_mode_adminbar.i18n.turnoff)&&d("0")})),n.addEventListener("click",(()=>{"0"==e.dataset.enabled&&window.confirm(wpmastertoolkit_maintenance_mode_adminbar.i18n.turnon)&&d("1")}))),o&&o.addEventListener("click",(()=>{window.confirm(wpmastertoolkit_maintenance_mode_adminbar.i18n.turnon)&&d("1")})),a&&a.addEventListener("click",(()=>{window.confirm(wpmastertoolkit_maintenance_mode_adminbar.i18n.turnoff)&&d("0")})),i&&i.addEventListener("click",(()=>(e=>{const t=e.dataset.content,n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),c.style.display="block",setTimeout((()=>{c.style.display="none"}),1e3)})(i)))};document.addEventListener("DOMContentLoaded",(()=>e()))}();