!function(){"use strict";document.addEventListener("DOMContentLoaded",(()=>{(()=>{const e=document.querySelector("#wpmastertoolkit-blacklisted-usernames-notice"),t=document.querySelector("#wpmastertoolkit-blacklisted-usernames-text"),s=document.querySelector("#wpmastertoolkit-blacklisted-usernames-input"),o=document.querySelector("#wpmastertoolkit-blacklisted-usernames-button"),n=document.querySelector("#wpmastertoolkit-blacklisted-usernames-message");s&&s.addEventListener("keyup",(()=>{s.classList.remove("error"),n.textContent=""})),o&&o.addEventListener("click",(()=>{const a=s.value;if(null===a||""===a)return s.classList.add("error"),!1;const r=new FormData;r.append("action",wpmastertoolkitBlacklistedUsernames.action),r.append("nonce",wpmastertoolkitBlacklistedUsernames.nonce),r.append("username",wpmastertoolkitBlacklistedUsernames.username),r.append("newusername",a);const c={method:"POST",body:r,redirect:"follow"};fetch(wpmastertoolkitBlacklistedUsernames.ajaxUrl,c).then((e=>e.json())).then((a=>{a.success?(e.classList.remove("notice-error"),e.classList.add("notice-success"),n.textContent=a.data.message,t.remove(),s.remove(),o.remove(),window.location.reload()):n.textContent=a.data.message})).catch((e=>{console.log("Error...")}))}))})()}))}();