(()=>{let r=":scope > .uicore-menu-panel > .wp-block-uicore-a-menu-wrapper > .wp-block-uicore-a-menu-link > .uicore-menu-link > .uicore-menu-link-wrapper",i="uicore-menu-text-flip-wrap",l="uicore-menu-text-flip-text",t="wp-block-uicore-toggle-icon",o="data-uicore-menu-text-flip-ready",n=e=>e.nodeType===Node.ELEMENT_NODE&&e.classList?.contains(t),c=e=>Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE?Boolean(e.textContent.trim()):e.nodeType===Node.ELEMENT_NODE&&!n(e)&&!e.classList.contains(i)),a=e=>{e.querySelectorAll(":scope > ."+i).forEach(e=>{var t=e.querySelector(`:scope > .${l}.is-primary`);if(t)for(;t.firstChild;)e.parentNode.insertBefore(t.firstChild,e);e.remove()})},u=e=>{if(e&&!e.querySelector(":scope > ."+i)){var r=c(e);if(r.length){var o=e.ownerDocument,n=o.createElement("span");let t=o.createElement("span");o=r[0],e=(n.className=i,t.className=l+" is-primary",e.insertBefore(n,o),r.forEach(e=>t.appendChild(e)),t.cloneNode(!0));e.className=l+" is-secondary",e.setAttribute("aria-hidden","true"),n.append(t,e)}}},s=({menu:e})=>{if(!e||"true"===e.getAttribute(o))return null;let t=Array.from(e.querySelectorAll(r));return t.length?(e.setAttribute(o,"true"),t.forEach(u),()=>{t.forEach(a),e.removeAttribute(o)}):null},e=({contextDocument:e=document}={})=>{e.querySelectorAll(".wp-block-uicore-a-menu.uicore-bl-menu-text-flip").forEach(e=>{s({menu:e})})};window.MenuTextFlip={initTextFlip:e,initTextFlipMenu:s},document.addEventListener("DOMContentLoaded",()=>{document.body.classList.contains("block-editor-page")||e()})})();