import{c as je,r as a,u as L,j as i,P as I,b as S,d as E,aj as Se,v as ke,a as K,f as z,ad as De,ak as Ae,g as Z,h as k,i as Le,ai as Fe}from"./index-BMIwdYku.js";import{c as ne,u as oe}from"./index-uCALUfYL.js";import{u as Oe,a as re}from"./index-CSCvTu1N.js";import{u as Ke}from"./index-DNDsR8xS.js";var D="NavigationMenu",[W,ae,Ve]=ne(D),[$,ze,$e]=ne(D),[Y,vt]=je(D,[Ve,$e]),[Ge,T]=Y(D),[Ue,He]=Y(D),ie=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,value:r,onValueChange:o,defaultValue:s,delayDuration:c=200,skipDelayDuration:d=300,orientation:u="horizontal",dir:N,...l}=e,[g,M]=a.useState(null),R=L(t,w=>M(w)),x=Oe(N),p=a.useRef(0),h=a.useRef(0),y=a.useRef(0),[P,v]=a.useState(!0),[m,f]=oe({prop:r,onChange:w=>{const j=w!=="",V=d>0;j?(window.clearTimeout(y.current),V&&v(!1)):(window.clearTimeout(y.current),y.current=window.setTimeout(()=>v(!0),d)),o==null||o(w)},defaultProp:s??"",caller:D}),C=a.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>f(""),150)},[f]),b=a.useCallback(w=>{window.clearTimeout(h.current),f(w)},[f]),_=a.useCallback(w=>{m===w?window.clearTimeout(h.current):p.current=window.setTimeout(()=>{window.clearTimeout(h.current),f(w)},c)},[m,f,c]);return a.useEffect(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(h.current),window.clearTimeout(y.current)},[]),i.jsx(se,{scope:n,isRootMenu:!0,value:m,dir:x,orientation:u,rootNavigationMenu:g,onTriggerEnter:w=>{window.clearTimeout(p.current),P?_(w):b(w)},onTriggerLeave:()=>{window.clearTimeout(p.current),C()},onContentEnter:()=>window.clearTimeout(h.current),onContentLeave:C,onItemSelect:w=>{f(j=>j===w?"":w)},onItemDismiss:()=>f(""),children:i.jsx(I.nav,{"aria-label":"Main","data-orientation":u,dir:x,...l,ref:R})})});ie.displayName=D;var G="NavigationMenuSub",Be=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,value:r,onValueChange:o,defaultValue:s,orientation:c="horizontal",...d}=e,u=T(G,n),[N,l]=oe({prop:r,onChange:o,defaultProp:s??"",caller:G});return i.jsx(se,{scope:n,isRootMenu:!1,value:N,dir:u.dir,orientation:c,rootNavigationMenu:u.rootNavigationMenu,onTriggerEnter:g=>l(g),onItemSelect:g=>l(g),onItemDismiss:()=>l(""),children:i.jsx(I.div,{"data-orientation":c,...d,ref:t})})});Be.displayName=G;var se=e=>{const{scope:t,isRootMenu:n,rootNavigationMenu:r,dir:o,orientation:s,children:c,value:d,onItemSelect:u,onItemDismiss:N,onTriggerEnter:l,onTriggerLeave:g,onContentEnter:M,onContentLeave:R}=e,[x,p]=a.useState(null),[h,y]=a.useState(new Map),[P,v]=a.useState(null);return i.jsx(Ge,{scope:t,isRootMenu:n,rootNavigationMenu:r,value:d,previousValue:Ke(d),baseId:re(),dir:o,orientation:s,viewport:x,onViewportChange:p,indicatorTrack:P,onIndicatorTrackChange:v,onTriggerEnter:S(l),onTriggerLeave:S(g),onContentEnter:S(M),onContentLeave:S(R),onItemSelect:S(u),onItemDismiss:S(N),onViewportContentChange:a.useCallback((m,f)=>{y(C=>(C.set(m,f),new Map(C)))},[]),onViewportContentRemove:a.useCallback(m=>{y(f=>f.has(m)?(f.delete(m),new Map(f)):f)},[]),children:i.jsx(W.Provider,{scope:t,children:i.jsx(Ue,{scope:t,items:h,children:c})})})},ce="NavigationMenuList",ue=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,...r}=e,o=T(ce,n),s=i.jsx(I.ul,{"data-orientation":o.orientation,...r,ref:t});return i.jsx(I.div,{style:{position:"relative"},ref:o.onIndicatorTrackChange,children:i.jsx(W.Slot,{scope:n,children:o.isRootMenu?i.jsx(Ne,{asChild:!0,children:s}):s})})});ue.displayName=ce;var le="NavigationMenuItem",[We,de]=Y(le),fe=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,value:r,...o}=e,s=re(),c=r||s||"LEGACY_REACT_AUTO_VALUE",d=a.useRef(null),u=a.useRef(null),N=a.useRef(null),l=a.useRef(()=>{}),g=a.useRef(!1),M=a.useCallback((x="start")=>{if(d.current){l.current();const p=H(d.current);p.length&&J(x==="start"?p:p.reverse())}},[]),R=a.useCallback(()=>{if(d.current){const x=H(d.current);x.length&&(l.current=et(x))}},[]);return i.jsx(We,{scope:n,value:c,triggerRef:u,contentRef:d,focusProxyRef:N,wasEscapeCloseRef:g,onEntryKeyDown:M,onFocusProxyEnter:M,onRootContentClose:R,onContentFocusOutside:R,children:i.jsx(I.li,{...o,ref:t})})});fe.displayName=le;var U="NavigationMenuTrigger",ve=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,disabled:r,...o}=e,s=T(U,e.__scopeNavigationMenu),c=de(U,e.__scopeNavigationMenu),d=a.useRef(null),u=L(d,c.triggerRef,t),N=Ce(s.baseId,c.value),l=Me(s.baseId,c.value),g=a.useRef(!1),M=a.useRef(!1),R=c.value===s.value;return i.jsxs(i.Fragment,{children:[i.jsx(W.ItemSlot,{scope:n,value:c.value,children:i.jsx(he,{asChild:!0,children:i.jsx(I.button,{id:N,disabled:r,"data-disabled":r?"":void 0,"data-state":Q(R),"aria-expanded":R,"aria-controls":l,...o,ref:u,onPointerEnter:E(e.onPointerEnter,()=>{M.current=!1,c.wasEscapeCloseRef.current=!1}),onPointerMove:E(e.onPointerMove,O(()=>{r||M.current||c.wasEscapeCloseRef.current||g.current||(s.onTriggerEnter(c.value),g.current=!0)})),onPointerLeave:E(e.onPointerLeave,O(()=>{r||(s.onTriggerLeave(),g.current=!1)})),onClick:E(e.onClick,()=>{s.onItemSelect(c.value),M.current=R}),onKeyDown:E(e.onKeyDown,x=>{const h={horizontal:"ArrowDown",vertical:s.dir==="rtl"?"ArrowLeft":"ArrowRight"}[s.orientation];R&&x.key===h&&(c.onEntryKeyDown(),x.preventDefault())})})})}),R&&i.jsxs(i.Fragment,{children:[i.jsx(Se,{"aria-hidden":!0,tabIndex:0,ref:c.focusProxyRef,onFocus:x=>{const p=c.contentRef.current,h=x.relatedTarget,y=h===d.current,P=p==null?void 0:p.contains(h);(y||!P)&&c.onFocusProxyEnter(y?"start":"end")}}),s.viewport&&i.jsx("span",{"aria-owns":l})]})]})});ve.displayName=U;var Ye="NavigationMenuLink",ee="navigationMenu.linkSelect",me=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,active:r,onSelect:o,...s}=e;return i.jsx(he,{asChild:!0,children:i.jsx(I.a,{"data-active":r?"":void 0,"aria-current":r?"page":void 0,...s,ref:t,onClick:E(e.onClick,c=>{const d=c.target,u=new CustomEvent(ee,{bubbles:!0,cancelable:!0});if(d.addEventListener(ee,N=>o==null?void 0:o(N),{once:!0}),Z(d,u),!u.defaultPrevented&&!c.metaKey){const N=new CustomEvent(F,{bubbles:!0,cancelable:!0});Z(d,N)}},{checkForDefaultPrevented:!1})})})});me.displayName=Ye;var q="NavigationMenuIndicator",ge=a.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=T(q,e.__scopeNavigationMenu),s=!!o.value;return o.indicatorTrack?ke.createPortal(i.jsx(K,{present:n||s,children:i.jsx(qe,{...r,ref:t})}),o.indicatorTrack):null});ge.displayName=q;var qe=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,...r}=e,o=T(q,n),s=ae(n),[c,d]=a.useState(null),[u,N]=a.useState(null),l=o.orientation==="horizontal",g=!!o.value;a.useEffect(()=>{var p;const x=(p=s().find(h=>h.value===o.value))==null?void 0:p.ref.current;x&&d(x)},[s,o.value]);const M=()=>{c&&N({size:l?c.offsetWidth:c.offsetHeight,offset:l?c.offsetLeft:c.offsetTop})};return B(c,M),B(o.indicatorTrack,M),u?i.jsx(I.div,{"aria-hidden":!0,"data-state":g?"visible":"hidden","data-orientation":o.orientation,...r,ref:t,style:{position:"absolute",...l?{left:0,width:u.size+"px",transform:`translateX(${u.offset}px)`}:{top:0,height:u.size+"px",transform:`translateY(${u.offset}px)`},...r.style}}):null}),A="NavigationMenuContent",pe=a.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=T(A,e.__scopeNavigationMenu),s=de(A,e.__scopeNavigationMenu),c=L(s.contentRef,t),d=s.value===o.value,u={value:s.value,triggerRef:s.triggerRef,focusProxyRef:s.focusProxyRef,wasEscapeCloseRef:s.wasEscapeCloseRef,onContentFocusOutside:s.onContentFocusOutside,onRootContentClose:s.onRootContentClose,...r};return o.viewport?i.jsx(Xe,{forceMount:n,...u,ref:c}):i.jsx(K,{present:n||d,children:i.jsx(we,{"data-state":Q(d),...u,ref:c,onPointerEnter:E(e.onPointerEnter,o.onContentEnter),onPointerLeave:E(e.onPointerLeave,O(o.onContentLeave)),style:{pointerEvents:!d&&o.isRootMenu?"none":void 0,...u.style}})})});pe.displayName=A;var Xe=a.forwardRef((e,t)=>{const n=T(A,e.__scopeNavigationMenu),{onViewportContentChange:r,onViewportContentRemove:o}=n;return z(()=>{r(e.value,{ref:t,...e})},[e,t,r]),z(()=>()=>o(e.value),[e.value,o]),null}),F="navigationMenu.rootContentDismiss",we=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,value:r,triggerRef:o,focusProxyRef:s,wasEscapeCloseRef:c,onRootContentClose:d,onContentFocusOutside:u,...N}=e,l=T(A,n),g=a.useRef(null),M=L(g,t),R=Ce(l.baseId,r),x=Me(l.baseId,r),p=ae(n),h=a.useRef(null),{onItemDismiss:y}=l;a.useEffect(()=>{const v=g.current;if(l.isRootMenu&&v){const m=()=>{var f;y(),d(),v.contains(document.activeElement)&&((f=o.current)==null||f.focus())};return v.addEventListener(F,m),()=>v.removeEventListener(F,m)}},[l.isRootMenu,e.value,o,y,d]);const P=a.useMemo(()=>{const m=p().map(j=>j.value);l.dir==="rtl"&&m.reverse();const f=m.indexOf(l.value),C=m.indexOf(l.previousValue),b=r===l.value,_=C===m.indexOf(r);if(!b&&!_)return h.current;const w=(()=>{if(f!==C){if(b&&C!==-1)return f>C?"from-end":"from-start";if(_&&f!==-1)return f>C?"to-start":"to-end"}return null})();return h.current=w,w},[l.previousValue,l.value,l.dir,p,r]);return i.jsx(Ne,{asChild:!0,children:i.jsx(De,{id:x,"aria-labelledby":R,"data-motion":P,"data-orientation":l.orientation,...N,ref:M,disableOutsidePointerEvents:!1,onDismiss:()=>{var m;const v=new Event(F,{bubbles:!0,cancelable:!0});(m=g.current)==null||m.dispatchEvent(v)},onFocusOutside:E(e.onFocusOutside,v=>{var f;u();const m=v.target;(f=l.rootNavigationMenu)!=null&&f.contains(m)&&v.preventDefault()}),onPointerDownOutside:E(e.onPointerDownOutside,v=>{var b;const m=v.target,f=p().some(_=>{var w;return(w=_.ref.current)==null?void 0:w.contains(m)}),C=l.isRootMenu&&((b=l.viewport)==null?void 0:b.contains(m));(f||C||!l.isRootMenu)&&v.preventDefault()}),onKeyDown:E(e.onKeyDown,v=>{var C;const m=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!m){const b=H(v.currentTarget),_=document.activeElement,w=b.findIndex(_e=>_e===_),V=v.shiftKey?b.slice(0,w).reverse():b.slice(w+1,b.length);J(V)?v.preventDefault():(C=s.current)==null||C.focus()}}),onEscapeKeyDown:E(e.onEscapeKeyDown,v=>{c.current=!0})})})}),X="NavigationMenuViewport",xe=a.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=!!T(X,e.__scopeNavigationMenu).value;return i.jsx(K,{present:n||s,children:i.jsx(Je,{...r,ref:t})})});xe.displayName=X;var Je=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,children:r,...o}=e,s=T(X,n),c=L(t,s.onViewportChange),d=He(A,e.__scopeNavigationMenu),[u,N]=a.useState(null),[l,g]=a.useState(null),M=u?(u==null?void 0:u.width)+"px":void 0,R=u?(u==null?void 0:u.height)+"px":void 0,x=!!s.value,p=x?s.value:s.previousValue;return B(l,()=>{l&&N({width:l.offsetWidth,height:l.offsetHeight})}),i.jsx(I.div,{"data-state":Q(x),"data-orientation":s.orientation,...o,ref:c,style:{pointerEvents:!x&&s.isRootMenu?"none":void 0,"--radix-navigation-menu-viewport-width":M,"--radix-navigation-menu-viewport-height":R,...o.style},onPointerEnter:E(e.onPointerEnter,s.onContentEnter),onPointerLeave:E(e.onPointerLeave,O(s.onContentLeave)),children:Array.from(d.items).map(([y,{ref:P,forceMount:v,...m}])=>{const f=p===y;return i.jsx(K,{present:v||f,children:i.jsx(we,{...m,ref:Ae(P,C=>{f&&C&&g(C)})})},y)})})}),Qe="FocusGroup",Ne=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,...r}=e,o=T(Qe,n);return i.jsx($.Provider,{scope:n,children:i.jsx($.Slot,{scope:n,children:i.jsx(I.div,{dir:o.dir,...r,ref:t})})})}),te=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],Ze="FocusGroupItem",he=a.forwardRef((e,t)=>{const{__scopeNavigationMenu:n,...r}=e,o=ze(n),s=T(Ze,n);return i.jsx($.ItemSlot,{scope:n,children:i.jsx(I.button,{...r,ref:t,onKeyDown:E(e.onKeyDown,c=>{if(["Home","End",...te].includes(c.key)){let u=o().map(g=>g.ref.current);if([s.dir==="rtl"?"ArrowRight":"ArrowLeft","ArrowUp","End"].includes(c.key)&&u.reverse(),te.includes(c.key)){const g=u.indexOf(c.currentTarget);u=u.slice(g+1)}setTimeout(()=>J(u)),c.preventDefault()}})})})});function H(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function J(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}function et(e){return e.forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")}),()=>{e.forEach(t=>{const n=t.dataset.tabindex;t.setAttribute("tabindex",n)})}}function B(e,t){const n=S(t);z(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}function Q(e){return e?"open":"closed"}function Ce(e,t){return`${e}-trigger-${t}`}function Me(e,t){return`${e}-content-${t}`}function O(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Re=ie,ye=ue,tt=fe,Ee=ve,nt=me,be=ge,Te=pe,Ie=xe;const ot=a.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Re,{ref:r,className:k("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...n,children:[t,i.jsx(Pe,{})]}));ot.displayName=Re.displayName;const rt=a.forwardRef(({className:e,...t},n)=>i.jsx(ye,{ref:n,className:k("group flex flex-1 list-none items-center justify-center space-x-1",e),...t}));rt.displayName=ye.displayName;const mt=tt,at=Le("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),it=a.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Ee,{ref:r,className:k(at(),"group",e),...n,children:[t," ",i.jsx(Fe,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));it.displayName=Ee.displayName;const st=a.forwardRef(({className:e,...t},n)=>i.jsx(Te,{ref:n,className:k("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto",e),...t}));st.displayName=Te.displayName;const gt=nt,Pe=a.forwardRef(({className:e,...t},n)=>i.jsx("div",{className:k("absolute left-0 top-full flex justify-center"),children:i.jsx(Ie,{className:k("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",e),ref:n,...t})}));Pe.displayName=Ie.displayName;const ct=a.forwardRef(({className:e,...t},n)=>i.jsx(be,{ref:n,className:k("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",e),...t,children:i.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));ct.displayName=be.displayName;export{ot as NavigationMenu,st as NavigationMenuContent,ct as NavigationMenuIndicator,mt as NavigationMenuItem,gt as NavigationMenuLink,rt as NavigationMenuList,it as NavigationMenuTrigger,Pe as NavigationMenuViewport,at as navigationMenuTriggerStyle};