class MenuActions{constructor(){this.init()}init(){this.setupEventListeners()}setupEventListeners(){let e=document.querySelectorAll(".gs-nav-trigger-panel");e&&e.length>0&&e.forEach(e=>{let t=e.getAttribute("data-panel-id"),l=e.getAttribute("data-copy-id"),r=e.getAttribute("data-copy-top-id"),s=e.getAttribute("data-copy-bottom-id"),i=document.querySelector(t);if(i){if(l){let a=document.querySelector(l);if(a){let n=i.querySelector(".gs-menu-copy-area");if(n){let o=a.cloneNode(!0);o.className="";let c=o.tagName.toLowerCase(),g=document.createElement(c);for(Array.from(n.attributes).forEach(e=>{g.setAttribute(e.name,e.value)}),g.innerHTML="";o.firstChild;)g.appendChild(o.firstChild);n.parentNode.replaceChild(g,n)}}}let d=i.querySelector(".gs-nav-back-trigger-copy");if(d){let u=i.querySelectorAll(".gs-dropdown-menu");u&&u.length>0&&u.forEach(e=>{e.classList.add("gs-nav-sub-level"),e.classList.remove("gs-dropdown-menu")});let v=i.querySelectorAll(".gs-nav-sub-level");v&&v.length>0&&v.forEach(e=>{let t=d.cloneNode(!0);e.prepend(t)}),d.remove()}if(r){let y=document.querySelector(r);if(y){let p=y.cloneNode(!0),f=i.querySelector(".gs-nav-top-copy");f&&f.appendChild(p)}}if(s){let h=document.querySelector(s);if(h){let b=h.cloneNode(!0),m=i.querySelector(".gs-nav-bottom-copy");m&&m.appendChild(b)}}e.addEventListener("click",e=>{i&&"function"==typeof openGreendynamicpanel&&(e.preventDefault(),openGreendynamicpanel(i,e.currentTarget,t))});let S=i.querySelectorAll(".gs-nav-trigger");S&&S.length>0&&S.forEach(e=>{e.addEventListener("click",e=>{let t=i.querySelector(".gs-nav-top-level");if(!t)return;let l=e.currentTarget.nextElementSibling;if(l.classList&&!l.classList.contains("gs-nav-sub-level")&&(l=e.currentTarget.nextElementSibling.nextElementSibling),l&&"STYLE"!==l.tagName&&l.classList&&l.classList.contains("gs-nav-sub-level")){let r=l.offsetHeight;t.style.setProperty("min-height",r+"px"),l.style.setProperty("visibility","visible"),l.classList.add("activelevel")}let s=parseInt(t.getAttribute("data-slide"))||0,a=s-100;t.setAttribute("data-slide",a.toString()),this.setTransformAttribute(t,"translateX",a+"%")})});let A=i.querySelectorAll(".gs-nav-back-trigger");A&&A.length>0&&A.forEach(e=>{e.addEventListener("click",e=>{let t=i.querySelector(".gs-nav-top-level");if(!t)return;let l=parseInt(t.getAttribute("data-slide"))||0,r=l+100;t.setAttribute("data-slide",r.toString()),this.setTransformAttribute(t,"translateX",r+"%");let s=e.target.closest(".gs-nav-top-level");if(s){let a=s.offsetHeight;t.style.setProperty("min-height",a+"px")}setTimeout(()=>{let t=e.target.closest(".gs-nav-sub-level");t&&(t.style.setProperty("visibility","hidden"),t.classList.remove("activelevel"))},1300)})})}});let t=document.querySelectorAll(".gs-menu-item-has-children");t&&t.forEach(e=>{let t=e.querySelector("a");t&&t.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),e.classList.toggle("active"))})})}setTransformAttribute(e,t,l){let r=e.style.transform||"",s=RegExp(`${t}\\([^)]*\\)`,"g");r=r.match(s)?r.replace(s,`${t}(${l})`):`${r} ${t}(${l})`.trim(),e.style.transform=r}}document.addEventListener("DOMContentLoaded",()=>{new MenuActions});