(()=>{const e=document.querySelector(".givewp-sale-banners-container"),n=document.querySelectorAll(".givewp-sale-banner__dismiss"),t=document.querySelector(".page-title-action, .wp-heading-inline, #give-in-plugin-upsells h1"),o=document.querySelector("#give-admin-donations-root, #give-admin-donation-forms-root, #give-admin-donors-root"),r=document.querySelector(".give-settings-header"),i=({target:n})=>{const t=new FormData;t.append("id",n.dataset.id),document.getElementById(n.getAttribute("aria-controls")).remove(),fetch(`${window.GiveSaleBanners.apiRoot}/hide`,{method:"POST",headers:{"X-WP-Nonce":window.GiveSaleBanners.apiNonce},body:t}),0===e.querySelectorAll(".givewp-sale-banner").length&&e.remove()};(t||o)&&e&&(e.style.display=null,r?r.insertAdjacentElement("afterend",e):o&&o.querySelector("header").insertAdjacentElement("afterend",e)),n.forEach((e=>{e.addEventListener("click",i)}))})();