function installMaxiBlocksNotice(){const{activating:t,installing:e,done:n,activationUrl:s,ajaxUrl:a,pluginSlug:i,nonce:c,pluginStatus:o}=maxiblocks;let l;const u=document.querySelector(".maxiblocks-go-notice .maxiblocks-go-notice__dismiss"),d=document.querySelector(".maxiblocks-go-notice"),r=document.querySelector(".maxiblocks-go-notice #maxiblocks-go-notice-install-maxiblocks");r&&(l=r.querySelector(".maxiblocks-go-button__text"));const g=()=>d?.remove(),m=async()=>{l.textContent=t,await activatePluginUrl(s),r.classList.replace("updating-message","updated-message"),l.textContent=n,setTimeout((()=>{g(),window.location.reload()}),1e3)};r?.addEventListener("click",(async()=>{r.classList.add("updating-message","disabled");r.querySelector(".maxiblocks-go-button__icon").classList.add("hidden"),"installed"!==o?(l.textContent=e,await installPlugin(i),await m()):await m()})),u?.addEventListener("click",(async()=>{200===(await fetch(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:`action=maxiblocks-go-theme-dismiss-plugin-notice&nonce=${c}`})).status&&g()}))}async function installPlugin(t){return new Promise((e=>{wp.updates.ajax("install-plugin",{slug:t,success:()=>e({success:!0}),error:t=>e({success:!1,code:t.errorCode})})}))}async function activatePluginUrl(t){try{if(200===(await fetch(t)).status)return{success:!0}}catch(t){return{success:!1}}}document.addEventListener("DOMContentLoaded",(()=>{installMaxiBlocksNotice()}));