'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@gem-sdk/core"),l=require("react"),r=require("react-transition-group"),s=require("../../../hooks/useBodyOverlay.js"),a=require("../../icons/Dismiss.js"),i=require("../../icons/MenuIcon.js"),o=require("./MenuMobileItem.js");const n={transitionDuration:"300ms",opacity:0},p={entering:{opacity:1,transform:"translateX(0)"},entered:{opacity:1,transform:"translateX(0)"},exiting:{opacity:0,transform:"translateX(-50px)"},exited:{opacity:0,transform:"translateX(-50px)"},unmounted:{opacity:0}},c={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}};exports.default=({menu:g,typography:u,typo:d,arrow:m,menuTextColor:y,menuBg:b,textColor:x,className:f,itemEnableHoverEffect:h})=>{let j=t.useEditorMode(),[v,N]=l.useState(!1),q=l.useRef(null),w=l.useRef(null),C=g?.ROOT;s.useBodyOverlay(v);let k=e=>{"edit"!==j&&N(e)},M=t.composeTypographyClassName(d,u);return e.jsxs("div",{ref:w,className:t.cls("gp-relative gp-z-5 gp-h-full gp-items-center gp-justify-center",f),children:[e.jsx("button",{"aria-label":"Menu",onClick:()=>{k(!0)},style:{...t.getGlobalColorStateStyle("c",x)},children:e.jsx(i.default,{className:"gp-w-8"})}),e.jsx(r.Transition,{in:v,timeout:300,nodeRef:q,unmountOnExit:!1,children:l=>e.jsxs("div",{className:"gp-fixed gp-inset-0 gp-z-[999] gp-overflow-hidden",style:{pointerEvents:v?"auto":"none",visibility:v?"visible":"hidden"},children:[e.jsx("div",{"aria-hidden":!0,"aria-label":"Overlay",onClick:()=>{k(!1)},className:"gp-fixed gp-inset-0 gp-z-[999] gp-bg-slate-600/40",style:{...n,...c[l]}}),e.jsxs("div",{className:"gp-relative gp-inset-0 gp-z-[9999] gp-h-full gp-w-full gp-max-w-[400px] gp-overflow-hidden",style:{...n,...p[l],...t.getGlobalColorResponsiveStyle("bgc",b)},children:[e.jsx("div",{className:"gp-flex gp-h-10 gp-items-center gp-border-b gp-pl-4",children:e.jsx("button",{onClick:()=>k(!1),className:"gp-ml-auto gp-flex gp-aspect-square gp-h-full gp-items-center gp-justify-center",style:{...t.getGlobalColorStateStyle("c",y)},children:e.jsx(a.default,{className:"gp-w-5"})})}),e.jsx("ul",{role:"menu",className:t.cls("gp-w-full scrollbar:!gp-h-1.5 scrollbar:!gp-w-1.5 scrollbar:gp-bg-transparent scrollbar-track:!gp-rounded scrollbar-track:!gp-bg-slate-100 scrollbar-thumb:!gp-rounded scrollbar-thumb:!gp-bg-slate-300",M),ref:q,style:{...t.getGlobalColorResponsiveStyle("bgc",b)},children:C?.childrens?.map(t=>e.jsx(o.default,{id:t,menu:g,arrow:m,depth:0,maxDepth:2,menuBg:b,menuTextColor:y,closeMenu:()=>k(!1),typo:d,typography:u,enableHoverEffect:h},t))})]})]})})]})};
