(()=>{"use strict";!function(e){function t(){const t=document.querySelector("#wpadminbar"),o=document.querySelector("#wpwrap"),a=document.querySelector("#adminmenu"),s="dismissible-card__close-icon";if(!t)return;function c(e){const n=t.querySelectorAll("#wp-admin-bar-blog a");for(let t=0;t<n.length;t++)n[t].setAttribute("aria-expanded",e)}!function(){const e=document.querySelector(".wp-submenu .current > a");if(!e)return;e.focus({preventScroll:!0})}(),c("false");const i=t.querySelector("#wp-admin-bar-blog.my-sites > a");function r(n){if(e(window).width()>782)return n.stopImmediatePropagation(),!0;n.preventDefault(),e("#wp-admin-bar-menu-toggle").off("click.wp-responsive");const a=t.querySelectorAll(".hover"),s=a.length;for(let e=0;e<s;e++)a[e].classList.remove("hover");if(o.classList.toggle("wp-responsive-open"),o.classList.contains("wp-responsive-open")){c("true");const e=document.querySelector("#adminmenu a");e&&e.focus()}else c("false")}if(i&&!document.body.classList.contains("wpcom-admin-interface")&&(e("#wp-admin-bar-blog.my-sites > a").off("click.wp-responsive"),i.removeAttribute("aria-haspopup"),i.addEventListener("click",r),document.addEventListener("click",(function(e){const t=!!e.target.closest("#wp-admin-bar-blog > a"),n=document.getElementById("adminmenu").contains(e.target),a=o.classList.contains("wp-responsive-open");!a||t||n||r(e)}))),a){const e=a.querySelector("#collapse-button");e&&e.addEventListener("click",(function(e){setTimeout((function(){var t;t=e.target.parentNode.getAttribute("aria-expanded"),n("POST",ajaxurl,"application/x-www-form-urlencoded; charset=UTF-8","action=sidebar_state&expanded="+t)}),50)})),a.addEventListener("click",(function(e){if(e.target.classList.contains(s)||e.target.closest("."+s)){e.preventDefault();const t=document.getElementById("toplevel_page_site-notices");t&&(t.style.display="none");const o=e.target;n("POST",ajaxurl,"application/x-www-form-urlencoded; charset=UTF-8","id="+encodeURIComponent(o.dataset.feature_id)+"&feature_class="+encodeURIComponent(o.dataset.feature_class)+"&action=jitm_dismiss&_ajax_nonce="+jetpackAdminMenu.jitmDismissNonce)}})),n("GET",ajaxurl+"?action=upsell_nudge_jitm&_ajax_nonce="+jetpackAdminMenu.upsellNudgeJitm,void 0,null,(function(e){try{e.readyState===XMLHttpRequest.DONE&&200===e.status&&e.responseText&&a.querySelector("#toplevel_page_site_card").insertAdjacentHTML("afterend",e.responseText)}catch(e){}}))}}function n(e,t,n,o=null,a=null){const s=new XMLHttpRequest;s.open(e,t,!0),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),n&&s.setRequestHeader("Content-Type",n),s.withCredentials=!0,a&&(s.onreadystatechange=function(){a(s)}),s.send(o)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}(jQuery)})();