@data-slot/navigation-menu 0.2.158 → 0.2.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -244,9 +244,6 @@ anchoring, such as inside sticky headers.
|
|
|
244
244
|
|
|
245
245
|
/* Popup owns the main shell animation */
|
|
246
246
|
[data-slot="navigation-menu-popup"] {
|
|
247
|
-
position: absolute;
|
|
248
|
-
top: 0;
|
|
249
|
-
left: 0;
|
|
250
247
|
transform-origin: var(--transform-origin);
|
|
251
248
|
width: var(--popup-width);
|
|
252
249
|
height: var(--popup-height);
|
|
@@ -288,6 +285,8 @@ suppressing exit animations.
|
|
|
288
285
|
Use `data-starting-style` / `data-ending-style` on `navigation-menu-popup` for full popup
|
|
289
286
|
open/close animations, and on `navigation-menu-content` for panel presence.
|
|
290
287
|
Directional panel switching should key off `data-activation-direction="left|right"` on content.
|
|
288
|
+
The active panel stays in normal flow; mounted inactive/exiting panels are absolutely positioned
|
|
289
|
+
by the runtime so they do not affect popup measurement while they animate out.
|
|
291
290
|
|
|
292
291
|
For exit animations, avoid CSS that force-hides content immediately by `data-state`
|
|
293
292
|
(for example `display: none` on non-active panels), because that bypasses the presence lifecycle.
|
|
@@ -322,14 +321,20 @@ For exit animations, avoid CSS that force-hides content immediately by `data-sta
|
|
|
322
321
|
```
|
|
323
322
|
|
|
324
323
|
Legacy `data-motion` and `--motion-direction` are still emitted during panel switches for backward
|
|
325
|
-
compatibility
|
|
324
|
+
compatibility. That includes both root-level and content-level `data-motion` output, but
|
|
325
|
+
`data-activation-direction` is the canonical directional hook.
|
|
326
|
+
|
|
327
|
+
`--popup-width` / `--popup-height` are the popup shell size vars. While the menu is open, they stay
|
|
328
|
+
at fixed pixel values so CSS can animate panel-to-panel size changes directly between `px` targets.
|
|
329
|
+
Initial open writes the measured size synchronously; the shell does not need an `auto` reset while
|
|
330
|
+
open.
|
|
326
331
|
|
|
327
332
|
### CSS Variables
|
|
328
333
|
|
|
329
334
|
| Variable | Element | Description |
|
|
330
335
|
|----------|---------|-------------|
|
|
331
|
-
| `--popup-width` | popup |
|
|
332
|
-
| `--popup-height` | popup |
|
|
336
|
+
| `--popup-width` | popup | Popup width while open; CSS can animate shell width between pixel values |
|
|
337
|
+
| `--popup-height` | popup | Popup height while open; CSS can animate shell height between pixel values |
|
|
333
338
|
| `--positioner-width` | positioner | Measured width of the active panel |
|
|
334
339
|
| `--positioner-height` | positioner | Measured height of the active panel |
|
|
335
340
|
| `--available-width` | positioner | Available width between the active trigger and the viewport edge |
|
|
@@ -346,7 +351,7 @@ compatibility, but `data-activation-direction` is the canonical directional hook
|
|
|
346
351
|
### Deprecated Compatibility
|
|
347
352
|
|
|
348
353
|
- `navigation-menu-viewport-positioner` is a deprecated alias for `navigation-menu-positioner`.
|
|
349
|
-
- `--viewport-width`, `--viewport-height`, `data-motion`, and `--motion-direction` are deprecated and planned for removal in the next major release.
|
|
354
|
+
- `--viewport-width`, `--viewport-height`, root/content `data-motion`, and `--motion-direction` are deprecated and planned for removal in the next major release.
|
|
350
355
|
- Content-wrapped `navigation-menu-portal` / `navigation-menu-positioner` shells are restore-only compatibility and are also planned for removal in the next major release.
|
|
351
356
|
|
|
352
357
|
## Keyboard Navigation
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@data-slot/core`);const t=[`start`,`center`,`end`],n=[`top`,`right`,`bottom`,`left`],r=[`absolute`,`fixed`],i=(e,t)=>t===`start`?{x:e.left,y:e.top}:t===`end`?{x:e.right,y:e.bottom}:{x:e.left+e.width/2,y:e.top+e.height/2},a=(e,t,n)=>{let r=i(n,t);return e===`top`?{x:r.x,y:n.top}:e===`bottom`?{x:r.x,y:n.bottom}:e===`left`?{x:n.left,y:r.y}:{x:n.right,y:r.y}},o=`@data-slot/navigation-menu`;function s(i,s={}){let c=(0,e.reuseRootBinding)(i,o,`[@data-slot/navigation-menu] createNavigationMenu() called more than once for the same root. Returning the existing controller. Destroy it before rebinding with new options.`);if(c)return c;let l=s.delayOpen??(0,e.getDataNumber)(i,`delayOpen`)??0,u=s.delayClose??(0,e.getDataNumber)(i,`delayClose`)??0,d=s.openOnFocus??(0,e.getDataBool)(i,`openOnFocus`)??!1,f=s.side??(0,e.getDataEnum)(i,`side`,n)??`bottom`,p=s.align??(0,e.getDataEnum)(i,`align`,t)??`start`,m=s.sideOffset??(0,e.getDataNumber)(i,`sideOffset`)??0,ee=s.alignOffset??(0,e.getDataNumber)(i,`alignOffset`)??0,te=s.positionMethod??(0,e.getDataEnum)(i,`positionMethod`,r)??`absolute`,h=s.safeTriangle??(0,e.getDataBool)(i,`safeTriangle`)??!1,g=s.debugSafeTriangle??(0,e.getDataBool)(i,`debugSafeTriangle`)??!1,ne=h||g,_=s.onValueChange,re=e=>e.replace(/[^a-z0-9\-_:.]/gi,`-`),ie=(e,t)=>{`inert`in e&&(e.inert=t)},v=(0,e.getPart)(i,`navigation-menu-list`),y=(0,e.getParts)(i,`navigation-menu-item`),b=(0,e.getPart)(i,`navigation-menu-viewport`),x=(0,e.getPart)(i,`navigation-menu-indicator`);if(!v||y.length===0)throw Error(`NavigationMenu requires navigation-menu-list and at least one navigation-menu-item`);let S=null,C=null,w=-1,T=null,ae=null,E=null,D=!1,O=null,k=null,A=!1,j=!1,M=null,N=null,P=null,oe=0,se=0,F=!1,I=!1,L=[],R=new Map,z=new Map,B=(e,t)=>{if(e){if(t){e.setAttribute(`data-open`,``),e.removeAttribute(`data-closed`);return}e.setAttribute(`data-closed`,``),e.removeAttribute(`data-open`)}},V=(e,t)=>{e&&(e.setAttribute(`data-state`,t?`open`:`closed`),B(e,t))},ce=(e,t)=>{e.setAttribute(`data-state`,t?`active`:`inactive`),B(e,t)},H=(e,t)=>{if(t){e.setAttribute(`data-activation-direction`,t);return}e.removeAttribute(`data-activation-direction`)},le=()=>{if(!b)return{popup:null,positioner:null,portal:null};let e=null,t=null,n=null,r=b.parentElement,a=`popup`;for(;r&&r!==i;){let i=r.getAttribute(`data-slot`);if(i===`navigation-menu-portal`){n=r;break}if(a===`popup`&&i===`navigation-menu-popup`){e=r,a=`positioner`,r=r.parentElement;continue}if((a===`popup`||a===`positioner`)&&(i===`navigation-menu-positioner`||i===`navigation-menu-viewport-positioner`)){t=r,a=`portal`,r=r.parentElement;continue}r=r.parentElement}return{popup:e,positioner:t,portal:n}},U=null,ue=e=>{j||U!==e||!e.isClosing||!e.popupExitComplete||!e.viewportExitComplete||ve()},W=()=>U?.popup??le().popup,G=()=>U?.positioner??le().positioner,de=(e,t)=>{let n=(i.ownerDocument??document).createElement(`div`);n.setAttribute(`data-slot`,t),t===`navigation-menu-positioner`&&(n.style.isolation=`isolate`,n.style.zIndex=`50`);let r=e.parentNode;if(!r)throw Error(`NavigationMenu expected popup stack child to have a parent node`);return r.insertBefore(n,e),n.appendChild(e),n},fe=e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}},pe=()=>{let e=G();e&&(e.style.position=``,e.style.top=``,e.style.left=``,e.style.width=``,e.style.height=``,e.style.margin=``,e.style.willChange=``,e.style.pointerEvents=``,e.style.transform=``,e.style.removeProperty(`--transform-origin`),e.style.removeProperty(`--positioner-width`),e.style.removeProperty(`--positioner-height`),e.style.removeProperty(`--available-width`),e.style.removeProperty(`--available-height`));let t=W();t&&(t.style.position=``,t.style.top=``,t.style.left=``,t.style.willChange=``,t.style.pointerEvents=``,t.style.removeProperty(`--transform-origin`),t.style.removeProperty(`--popup-width`),t.style.removeProperty(`--popup-height`))},me=()=>{P!==null&&(cancelAnimationFrame(P),P=null)},he=()=>{let e=F||I;b&&(e?b.setAttribute(`data-instant`,``):b.removeAttribute(`data-instant`));let t=W();t&&(e?t.setAttribute(`data-instant`,``):t.removeAttribute(`data-instant`));let n=G();n&&(e?n.setAttribute(`data-instant`,``):n.removeAttribute(`data-instant`))},ge=()=>{me(),P=requestAnimationFrame(()=>{P=null,I=!1,he()})},_e=()=>{me(),F=!1,I=!1,he()},ve=()=>{let e=U;!e||!b||(_e(),pe(),oe=0,se=0,b.hidden=!0,b.style.pointerEvents=`none`,e.popup.hidden=!0,e.popup.style.pointerEvents=`none`,e.popupPortal.restore(),e.generatedPopup&&fe(e.popup),e.generatedPositioner&&fe(e.positioner),e.generatedPortal&&fe(e.portal),e.popupPresence.cleanup(),e.viewportPresence.cleanup(),U=null)},ye=()=>{if(!b)return null;if(U)return U;let t=le(),n=t.popup,r=t.positioner,a=t.portal,o=!1,s=!1,c=!1;(!n||!n.contains(b))&&(n=de(b,`navigation-menu-popup`),o=!0),(!r||!r.contains(n))&&(r=de(n,`navigation-menu-positioner`),s=!0),(!a||!a.contains(r))&&(a=de(r,`navigation-menu-portal`),c=!0);let l=(0,e.createPortalLifecycle)({content:n,root:i,enabled:!0,container:r,mountTarget:a}),u={popup:n,positioner:r,portal:a,popupPortal:l,popupPresence:null,viewportPresence:null,generatedPopup:o,generatedPositioner:s,generatedPortal:c,isClosing:!1,popupExitComplete:!1,viewportExitComplete:!1},d=(0,e.createPresenceLifecycle)({element:b,onExitComplete:()=>{u.viewportExitComplete=!0,ue(u)}});return u.popupPresence=(0,e.createPresenceLifecycle)({element:n,onExitComplete:()=>{u.popupExitComplete=!0,ue(u)}}),u.viewportPresence=d,U=u,U},be=e=>{if(!b)return;let t=z.get(e)??{originalParent:null,originalNextSibling:null,mountedInViewport:!1};t.mountedInViewport||(t.originalParent=e.parentNode,t.originalNextSibling=e.nextSibling,t.mountedInViewport=!0,z.set(e,t)),e.parentNode!==b&&b.appendChild(e)},xe=e=>{let t=z.get(e);if(!t||!t.mountedInViewport)return;let n=t.originalParent,r=t.originalNextSibling;n&&n.isConnected?r&&r.parentNode===n?n.insertBefore(e,r):n.appendChild(e):e.remove(),t.mountedInViewport=!1,t.originalParent=null,t.originalNextSibling=null},Se=()=>{if(!b)return;let e=G();if(!e)return;let t=i.ownerDocument.defaultView??window,n=i.getBoundingClientRect(),r=te===`fixed`,a=n.top+se+(r?0:t.scrollY),o=n.left+oe+(r?0:t.scrollX);e.style.position=te,e.style.top=`${a}px`,e.style.left=`${o}px`,e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.margin=`0`,e.style.willChange=`top,left`,e.style.pointerEvents=`none`},Ce=null,we=e=>{Ce?.disconnect(),Ce=null,!(!b||!e)&&(Ce=new ResizeObserver(()=>{let t=Te(e.item,e.content);vt(e.content,e.trigger,t)}),Ce.observe(e.content))};L.push(()=>Ce?.disconnect()),L.push(()=>{_e(),R.forEach(e=>e.cleanup()),R.clear(),z.forEach((e,t)=>{xe(t),t.hidden=!0,t.style.pointerEvents=`none`}),z.clear(),ve()});let K=new Map,Te=(r,i)=>({side:s.side??(0,e.getDataEnum)(i,`side`,n)??(0,e.getDataEnum)(r,`side`,n)??f,align:s.align??(0,e.getDataEnum)(i,`align`,t)??(0,e.getDataEnum)(r,`align`,t)??p,sideOffset:s.sideOffset??(0,e.getDataNumber)(i,`sideOffset`)??(0,e.getDataNumber)(r,`sideOffset`)??m,alignOffset:s.alignOffset??(0,e.getDataNumber)(i,`alignOffset`)??(0,e.getDataNumber)(r,`alignOffset`)??ee}),Ee=0;y.forEach(t=>{let n=t.dataset.value;if(!n)return;let r=(0,e.getPart)(t,`navigation-menu-trigger`),i=(0,e.getPart)(t,`navigation-menu-content`);if(r&&i){K.set(n,{value:n,item:t,trigger:r,content:i,index:Ee++}),R.set(i,(0,e.createPresenceLifecycle)({element:i,onExitComplete:()=>{j||(ce(i,!1),H(i,null),i.removeAttribute(`data-motion`),xe(i),i.hidden=!0,i.style.pointerEvents=`none`)}}));let a=re(n),o=(0,e.ensureId)(r,`nav-menu-trigger-${a}`),s=(0,e.ensureId)(i,`nav-menu-content-${a}`);r.setAttribute(`aria-haspopup`,`true`),r.setAttribute(`aria-controls`,s),i.setAttribute(`aria-labelledby`,o)}});let De=Array.from(K.values()).map(e=>e.trigger),Oe=`a[href], button:not([disabled]), [role="link"], [role="button"], [tabindex]:not([tabindex="-1"])`,ke=e=>{let t=e?.closest(`[data-slot="navigation-menu-item"]`);if(!t)return null;let n=t.dataset.value;if(!n)return null;let r=K.get(n);return!r||r.item!==t?null:r},Ae=e=>{if(e.matches(Oe))return e;let t=e.querySelectorAll(Oe);for(let n of t)if(e.contains(n)&&!n.closest(`[data-slot="navigation-menu-content"]`)&&!(n.hidden||n.closest(`[hidden]`)))return n;return null},q=[],je=new Map;y.forEach(e=>{let t=ke(e);if(t){let e={kind:`submenu`,element:t.trigger,item:t.item,value:t.value,trigger:t.trigger};q.push(e),je.set(e.element,e),je.set(e.item,e);return}let n=Ae(e);if(!n)return;let r={kind:`plain`,element:n};q.push(r),je.set(r.element,r)});let Me=e=>{let t=e instanceof HTMLElement?e:null;if(!t)return null;let n=t;for(;n&&n!==v;){let e=je.get(n);if(e)return e;n=n.parentElement}return null},Ne=e=>{let t=Me(e);return t?.kind===`plain`?t:null},Pe=e=>{let t=Me(e);return t?.kind===`submenu`?t:null},Fe=()=>{let e=i.ownerDocument.defaultView;if(!e?.matchMedia)return!0;try{return e.matchMedia(`(any-hover: hover)`).matches}catch{return!0}},Ie=e=>{try{return e.matches(`:hover`)}catch{return!1}},Le=()=>{for(let e of q){if(e.kind===`submenu`){if(Ie(e.item)||Ie(e.trigger))return e;continue}if(Ie(e.element))return e}return null},Re=(e,t={})=>{let n=i.ownerDocument,r=t.preserveOpenOnPlain??!1;return e.kind===`submenu`?(e.trigger.focus(),n.activeElement===e.trigger?(Ct(e.trigger),!0):!1):(S!==null&&!r&&$(),e.element.focus(),n.activeElement===e.element?(S!==null&&r?Ct():Z(e.element),!0):!1)},ze=(e,t,n={})=>{for(let r=e+t;r>=0&&r<q.length;r+=t){let e=q[r];if(e&&Re(e,n))return!0}return!1},Be=(e,t,n={})=>{let r=q.indexOf(e);return r===-1?!1:ze(r,t,n)},Ve=(e,t,n={})=>{let r=q.findIndex(t=>t.kind===`submenu`&&t.trigger===e);return r===-1?!1:ze(r,t,n)},He=e=>{if(!(e instanceof Node)||!v.contains(e))return!1;let t=e instanceof HTMLElement?e:e.parentElement;return!t||t.closest(`[data-slot="navigation-menu-indicator"]`)||ke(t)?!1:t.closest(`[data-slot="navigation-menu-item"]`)?!0:!!t.closest(`a[href], button, [role='link'], [role='button']`)},Ue=`a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])`,We=e=>Array.from(e.querySelectorAll(Ue)).filter(e=>!e.hidden&&!e.closest(`[hidden]`)),Ge=e=>!e.isConnected||e.hidden||e.closest(`[hidden]`)||`disabled`in e&&e.disabled||e.getAttribute(`aria-hidden`)===`true`||e.getAttribute(`tabindex`)===`-1`?!1:e.matches(Ue)?!0:e.tabIndex>=0,Ke=e=>{if(i.contains(e)||b?.contains(e)||W()?.contains(e)||G()?.contains(e))return!0;for(let{content:t}of K.values())if(t.contains(e))return!0;return!1},qe=()=>{let e=i.ownerDocument,t=Array.from(e.querySelectorAll(`*`));for(let n of t)if(Ge(n)&&!Ke(n)&&(i.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0&&(n.focus(),e.activeElement===n))return!0;return!1},Je=e=>{requestAnimationFrame(()=>{if(S!==e)return;let t=K.get(e);if(!t)return;let n=We(t.content)[0];n?n.focus():t.content.focus()})},J=()=>{T&&=(clearTimeout(T),null),ae&&=(clearTimeout(ae),null)},Ye=()=>{J(),C=null},Xe=()=>{O=null,k=null},Ze=()=>{N!==null&&(cancelAnimationFrame(N),N=null)},Y=null,Qe=()=>b?G()||W()||(b.parentElement instanceof HTMLElement?b.parentElement:b):null,$e=()=>{let t=Qe();return Y||(Y=document.createElement(`div`),Y.setAttribute(`data-slot`,`navigation-menu-bridge`),Y.style.cssText=`position: absolute; pointer-events: auto; z-index: 0; display: none;`,L.push((0,e.on)(Y,`pointerenter`,()=>{J()}),(0,e.on)(Y,`pointerleave`,t=>{if(D||S===null)return;let n=t.relatedTarget;ht(n)||n&&(0,e.containsWithPortals)(i,n)||(Q(null),Z(null))}))),t&&Y.parentElement!==t&&t.insertBefore(Y,t.firstChild),Y},et=()=>{Y&&(Y.style.height=`0`,Y.style.width=`0`,Y.style.top=`0px`,Y.style.left=`0px`,Y.style.right=`0px`,Y.style.bottom=`auto`,Y.style.transform=`none`,Y.style.clipPath=`none`,Y.style.display=`none`)},tt=()=>{if(!g)return null;let e=i.ownerDocument.body;return e?(M||(M=i.ownerDocument.createElement(`div`),M.setAttribute(`data-slot`,`navigation-menu-safe-triangle`),M.style.cssText=[`position: fixed`,`pointer-events: none`,`display: none`,`z-index: 2147483647`,`background: rgba(255, 0, 0, 0.18)`,`border: 1px solid rgba(255, 0, 0, 0.45)`].join(`; `)),M.parentElement!==e&&e.appendChild(M),M):null},nt=()=>{M&&(M.style.width=`0`,M.style.height=`0`,M.style.clipPath=`none`,M.style.display=`none`)},X=()=>{g||nt()},rt=e=>{let t=tt();if(!t)return;let n=e.apex.x,r=e.apex.y,i=e.edgeA.x,a=e.edgeA.y,o=e.edgeB.x,s=e.edgeB.y,c=Math.min(n,i,o),l=Math.min(r,a,s),u=Math.max(n,i,o),d=Math.max(r,a,s),f=Math.max(1,u-c),p=Math.max(1,d-l),m=(e,t)=>`${(e-c)/f*100}% ${(t-l)/p*100}%`;t.style.display=`block`,t.style.left=`${c}px`,t.style.top=`${l}px`,t.style.width=`${f}px`,t.style.height=`${p}px`,t.style.clipPath=`polygon(${m(n,r)}, ${m(i,a)}, ${m(o,s)})`},it=(e,t,n)=>(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y),at=(e,t,n,r)=>{let i=it(e,t,n),a=it(e,n,r),o=it(e,r,t);return!((i<0||a<0||o<0)&&(i>0||a>0||o>0))},ot=(e,t,n)=>{let r=.5;if(n.top>=t.bottom-r)return[{x:n.left,y:n.top},{x:n.right,y:n.top}];if(n.bottom<=t.top+r)return[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}];if(n.left>=t.right-r)return[{x:n.left,y:n.top},{x:n.left,y:n.bottom}];if(n.right<=t.left+r)return[{x:n.right,y:n.top},{x:n.right,y:n.bottom}];let i=[[{x:n.left,y:n.top},{x:n.right,y:n.top}],[{x:n.right,y:n.top},{x:n.right,y:n.bottom}],[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}],[{x:n.left,y:n.top},{x:n.left,y:n.bottom}]],a=([t,n])=>t.y===n.y?Math.abs(e.y-t.y):Math.abs(e.x-t.x),o=i[0],s=a(o);for(let e=1;e<i.length;e++){let t=i[e],n=a(t);n<s&&(o=t,s=n)}return o},st=()=>S?K.get(S)??null:null,ct=(e,t,n)=>{if(n.width<=0||n.height<=0)return null;let r={x:e.left+e.width/2,y:e.top+e.height*.62},[i,a]=ot(r,t,n);if(i.x===a.x){let e=Math.min(i.y,a.y),t=Math.max(i.y,a.y),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:i.x,y:e+r},a={x:a.x,y:t-r}}else{let e=Math.min(i.x,a.x),t=Math.max(i.x,a.x),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:e+r,y:i.y},a={x:t-r,y:a.y}}return{apex:r,edgeA:i,edgeB:a}},lt=()=>{if(!ne||!b||S===null)return null;let e=st();if(!e)return null;let t=i.getBoundingClientRect(),n=e.trigger.getBoundingClientRect(),r=b.getBoundingClientRect(),a=e.content.getBoundingClientRect();return ct(n,t,r.width>0&&r.height>0?r:a)},ut=e=>{let t=lt();return t?at({x:e.clientX,y:e.clientY},t.apex,t.edgeA,t.edgeB):!1},dt=(e,t)=>({x:e.x-t.left,y:e.y-t.top}),ft=e=>{if(e.length<=1)return e.slice();let t=e=>`${e.x.toFixed(3)}:${e.y.toFixed(3)}`,n=new Map;for(let r of e)n.set(t(r),r);let r=Array.from(n.values()).sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x);if(r.length<=2)return r;let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=[];for(let e of r){for(;a.length>=2&&i(a[a.length-2],a[a.length-1],e)<=0;)a.pop();a.push(e)}let o=[];for(let e=r.length-1;e>=0;e--){let t=r[e];for(;o.length>=2&&i(o[o.length-2],o[o.length-1],t)<=0;)o.pop();o.push(t)}return a.pop(),o.pop(),a.concat(o)},pt=e=>{if(e.length<3){et();return}let t=$e(),n=t.parentElement,r=ft(n&&n===G()?e.map(e=>({x:e.x-oe,y:e.y-se})):e);if(r.length<3){et();return}let i=Math.min(...r.map(e=>e.x)),a=Math.min(...r.map(e=>e.y)),o=Math.max(...r.map(e=>e.x)),s=Math.max(...r.map(e=>e.y)),c=Math.max(1,o-i),l=Math.max(1,s-a),u=e=>`${(e.x-i)/c*100}% ${(e.y-a)/l*100}%`;t.style.display=`block`,t.style.transform=`none`,t.style.bottom=`auto`,t.style.right=`auto`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.width=`${c}px`,t.style.height=`${l}px`,t.style.clipPath=`polygon(${r.map(u).join(`, `)})`},mt=()=>{if(!g)return;let e=lt();if(!e){nt();return}rt(e)},ht=e=>e?!!(st()?.content.contains(e)||b?.contains(e)||W()?.contains(e)||Y?.contains(e)||G()?.contains(e)):!1;L.push(X),L.push(Ze),L.push(et),L.push(()=>{nt(),M?.parentElement&&M.parentElement.removeChild(M),M=null});let gt=(e,t,n,r,a,o)=>{let s=i.ownerDocument.defaultView??window,c=s.visualViewport,l=c?.offsetLeft??0,u=c?.offsetTop??0,d=c?.width??s.innerWidth,f=c?.height??s.innerHeight,p=n===`left`?Math.max(0,t.left-l-r):n===`right`?Math.max(0,l+d-t.right-r):Math.max(0,d),m=n===`top`?Math.max(0,t.top-u-r):n===`bottom`?Math.max(0,u+f-t.bottom-r):Math.max(0,f);e.style.setProperty(`--positioner-width`,`${a}px`),e.style.setProperty(`--positioner-height`,`${o}px`),e.style.setProperty(`--available-width`,`${p}px`),e.style.setProperty(`--available-height`,`${m}px`)},_t=(t,r,o)=>{let s=ye();if(!b||!s)return;let{popup:c,positioner:l}=s;if(b.getAttribute(`data-state`)!==`open`||t.getAttribute(`data-state`)!==`active`)return;let u=t.firstElementChild,d=t.lastElementChild,f=u?getComputedStyle(u):null,p=d?getComputedStyle(d):null,m=f&&parseFloat(f.marginTop)||0,ee=p&&parseFloat(p.marginBottom)||0,te=(...e)=>{let t=0;for(let n of e)Number.isFinite(n)&&(t=Math.max(t,n));return t},h=t.getBoundingClientRect(),g=te(h.width,t.scrollWidth,t.offsetWidth,t.clientWidth),_=te(h.height,t.scrollHeight,t.offsetHeight,t.clientHeight)+m+ee,re={top:h.top,left:h.left,width:g,height:_,right:h.left+g,bottom:h.top+_},ie=getComputedStyle(b),v=parseFloat(ie.marginTop)||0;b.style.setProperty(`--viewport-width`,`${g}px`),b.style.setProperty(`--viewport-height`,`${_}px`);let y=i.getBoundingClientRect(),x=r.getBoundingClientRect(),S=(0,e.computeFloatingPosition)({anchorRect:x,contentRect:re,side:o.side,align:o.align,sideOffset:o.sideOffset,alignOffset:o.alignOffset,avoidCollisions:!1,collisionPadding:0,allowedSides:n}),C=S.x-y.left,w=S.y-y.top;oe=C,se=w;let T=a(S.side,S.align,x),ae=T.x-(y.left+C),E=T.y-(y.top+w),D=T.x-y.left,O=T.y-y.top,k=`${ae}px ${E}px`,A=`${D}px ${O}px`;c.style.position=`absolute`,c.style.top=`0px`,c.style.left=`0px`,c.style.willChange=`width,height`,c.style.pointerEvents=`auto`,c.style.setProperty(`--popup-width`,`${g}px`),c.style.setProperty(`--popup-height`,`${_}px`),c.style.setProperty(`--transform-origin`,k),b.style.top=`0px`,b.style.left=`0px`,b.style.willChange=`transform,width,height`,b.style.setProperty(`--transform-origin`,k),t.style.top=`0px`,t.style.left=`0px`,t.style.setProperty(`--transform-origin`,k),c.setAttribute(`data-side`,S.side),c.setAttribute(`data-align`,S.align),b.setAttribute(`data-side`,S.side),b.setAttribute(`data-align`,S.align),t.setAttribute(`data-side`,S.side),t.setAttribute(`data-align`,S.align),l.setAttribute(`data-side`,S.side),l.setAttribute(`data-align`,S.align),l.style.setProperty(`--transform-origin`,A),gt(l,x,S.side,o.sideOffset,g,_),Se();let j=b.getBoundingClientRect(),M=[],N=Math.max(0,j.top-y.bottom),P=Math.max(0,y.top-j.bottom),F=Math.max(0,j.left-y.right),I=Math.max(0,y.left-j.right),L=Math.max(0,m+v),R=Math.max(N,P,L),z=Math.max(F,I),B=ne?ct(x,y,j):null,V=(e,t,n,r)=>{n<=0||r<=0||M.push({x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r})};if(R>=z&&R>0){let e=Math.max(N,P,L),t=C,n=P>N&&P>=L?w+_:w-e,r=g;if(B){let e=Math.min(B.edgeA.x,B.edgeB.x)-y.left,n=Math.max(B.edgeA.x,B.edgeB.x)-y.left;t=e-8,r=n-e+16}V(t,n,r,e)}else if(z>0){let e=Math.max(F,I),t=w,n=I>F?C+g:C-e,r=_;if(B){let e=Math.min(B.edgeA.y,B.edgeB.y)-y.top,n=Math.max(B.edgeA.y,B.edgeB.y)-y.top;t=e-8,r=n-e+16}V(n,t,e,r)}if(B){let e=dt(B.apex,y),t=dt(B.edgeA,y),n=dt(B.edgeB,y);M.push(e,t,n)}pt(M),mt()},vt=(e,t,n,r={})=>{if(!b)return;let i=()=>{_t(e,t,n)};if(r.defer===!1){i();return}requestAnimationFrame(()=>{b.getAttribute(`data-state`)!==`open`||e.getAttribute(`data-state`)!==`active`||i()})},yt=(e=st(),t={})=>{if(!e)return;let n=Te(e.item,e.content);vt(e.content,e.trigger,n,t)},bt=(0,e.createPositionSync)({observedElements:[i,...De],isActive:()=>S!==null,ancestorScroll:!0,syncOnScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,onUpdate:()=>{I=!0,he(),yt(void 0,{defer:!1}),ge()}});L.push(()=>bt.stop());let xt=e=>w===-1||e>w?`right`:`left`,Z=e=>{if(!x)return;if(E=e,!e){Ze(),x.removeAttribute(`data-instant`),x.setAttribute(`data-state`,`hidden`);return}x.getAttribute(`data-state`)!==`visible`&&(Ze(),x.setAttribute(`data-instant`,``),N=requestAnimationFrame(()=>{N=requestAnimationFrame(()=>{x.removeAttribute(`data-instant`),N=null})}));let t=v.getBoundingClientRect(),n=e.getBoundingClientRect();x.style.setProperty(`--indicator-left`,`${n.left-t.left}px`),x.style.setProperty(`--indicator-width`,`${n.width}px`),x.style.setProperty(`--indicator-top`,`${n.top-t.top}px`);let r=(b&&parseFloat(getComputedStyle(b).marginTop)||0)<1?1:0;x.style.setProperty(`--indicator-height`,`${n.height-r}px`),x.setAttribute(`data-state`,`visible`)},St=()=>S?K.get(S)?.trigger??null:null,Ct=(e=null)=>{let t=St();if(t){Z(t);return}Z(e)},Q=(t,n=!1)=>{if(X(),t===S){t===null?Ye():J();return}if(!n&&t!==null&&t===C)return;J(),C=t===null?null:t;let r=()=>{let n=S,r=t?K.get(t):null,a=n!==null&&t!==null&&n!==t,o=a&&r?xt(r.index):null,s=document.activeElement;if(t===null&&s&&n){let t=K.get(n);t&&(0,e.containsWithPortals)(t.content,s)&&t.trigger.focus()}if(K.forEach(({trigger:r,content:i,item:a},s)=>{let c=s===t,l=s===n;if((0,e.setAria)(r,`expanded`,c),r.setAttribute(`data-state`,c?`open`:`closed`),a.setAttribute(`data-state`,c?`open`:`closed`),!c){let e=R.get(i);if(ce(i,!1),i.setAttribute(`aria-hidden`,`true`),ie(i,!0),i.style.pointerEvents=`none`,t===null)l&&(H(i,null),i.removeAttribute(`data-motion`));else if(l&&o){H(i,o);let e=o===`right`?`to-left`:`to-right`;i.setAttribute(`data-motion`,e)}else l&&(H(i,null),i.removeAttribute(`data-motion`));l?e?.exit():e?.isExiting||(H(i,null),i.removeAttribute(`data-motion`),xe(i),i.hidden=!0)}}),r){let e=ye();if(e?.popupPortal.mount(),e&&(e.isClosing=!1,e.popupExitComplete=!1,e.viewportExitComplete=!1),e?.popup&&(e.popup.hidden=!1,e.popup.style.pointerEvents=`auto`),b&&(b.hidden=!1),n===null&&(e?.popupPresence.enter(),e?.viewportPresence.enter()),be(r.content),R.get(r.content)?.enter(),bt.start(),o){H(r.content,o);let e=o===`right`?`from-right`:`from-left`;r.content.setAttribute(`data-motion`,e)}else H(r.content,null),r.content.removeAttribute(`data-motion`);ce(r.content,!0),r.content.removeAttribute(`aria-hidden`),ie(r.content,!1),r.content.hidden=!1,r.content.style.pointerEvents=`auto`,w=r.index,yt(r),we(r),Z(r.trigger)}else bt.stop(),et(),X(),U&&(U.isClosing=!0,U.popupExitComplete=!1,U.viewportExitComplete=!1,U.popupPresence.exit(),U.viewportPresence.exit()),we(null);let c=t!==null;if(V(i,c),o?i.setAttribute(`data-motion`,o===`right`?`from-right`:`from-left`):i.removeAttribute(`data-motion`),b){let e=W();V(G(),c),V(e,c),V(b,c),b.style.pointerEvents=c?`auto`:`none`,F=c&&!a,(!c||a)&&(me(),I=!1),he(),o?b.style.setProperty(`--motion-direction`,o===`right`?`1`:`-1`):b.style.removeProperty(`--motion-direction`)}S=t,C=null,t===null&&Z(null),mt(),(0,e.emit)(i,`navigation-menu:change`,{value:t}),_?.(t)};n?r():t!==null&&S===null?T=setTimeout(r,l):t!==null&&S!==null?r():ae=setTimeout(r,u)},wt=le();V(i,!1),b&&(V(wt.positioner,!1),V(wt.popup,!1),V(b,!1),b.hidden=!0,b.style.pointerEvents=`none`,wt.popup&&(wt.popup.hidden=!0,wt.popup.style.pointerEvents=`none`)),x&&x.setAttribute(`data-state`,`hidden`),K.forEach(({trigger:t,content:n,item:r})=>{t.tagName===`BUTTON`&&!t.hasAttribute(`type`)&&(t.type=`button`),(0,e.setAria)(t,`expanded`,!1),t.setAttribute(`data-state`,`closed`),t.tabIndex=0,r.setAttribute(`data-state`,`closed`),ce(n,!1),n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,ie(n,!0),n.hidden=!0,n.style.pointerEvents=`none`}),K.forEach(({item:t,trigger:n},r)=>{L.push((0,e.on)(n,`pointerenter`,e=>{if(!D){if(S!==r&&ut(e))return;Z(n)}})),L.push((0,e.on)(t,`pointerenter`,e=>{if(!D){if(S!==r&&ut(e))return;Q(r)}})),L.push((0,e.on)(t,`pointerleave`,t=>{if(C===r&&S===null&&Ye(),S===r&&!D){let n=t.relatedTarget;if(ht(n))return;(!n||!(0,e.containsWithPortals)(i,n))&&(Q(null),Z(null))}})),L.push((0,e.on)(n,`focus`,()=>{if(O===n){O=null;return}d&&Q(r,!0),Ct(n)})),L.push((0,e.on)(n,`pointerdown`,()=>{O=n,k=n}),(0,e.on)(n,`keydown`,()=>{k=null})),L.push((0,e.on)(n,`click`,()=>{let e=k===n;k=null,O=null,Ye(),S===r&&D?(D=!1,Q(null,!0),Z(null)):S===r&&!D?(D=!0,Z(n),e||Je(r)):(D=!0,Q(r,!0),Z(n),e||Je(r))}))}),L.push((0,e.on)(v,`pointerover`,e=>{let t=e;if(t.pointerType===`touch`)return;let n=Pe(t.target);if(n){if(A=!0,D||S!==n.value&&ut(t))return;Z(n.trigger),Q(n.value);return}let r=Ne(t.target);if(r){if(A=!0,S!==null){if(D)return;$()}Z(r.element);return}S!==null&&(D||He(t.target)&&$())}),(0,e.on)(v,`click`,e=>{S!==null&&He(e.target)&&$()})),L.push((0,e.on)(v,`focusin`,e=>{let t=Ne(e.target);if(t){if(S!==null){Ct();return}Z(t.element)}}),(0,e.on)(i,`pointerenter`,()=>{A=!0}),(0,e.on)(i,`pointerleave`,e=>{let t=e.relatedTarget;if(!ht(t)&&(A=!1,!D)){if(ut(e)){J();return}Q(null),Z(null)}}),(0,e.on)(i,`pointerdown`,()=>{X(),Ye()}));let Tt=()=>{if(!Fe()||S!==null||C!==null||D)return;let e=Le();if(A=e!==null||i instanceof HTMLElement&&Ie(i),e){if(e.kind===`submenu`){Q(e.value,!0);return}Z(e.element)}};b&&L.push((0,e.on)(b,`pointerenter`,()=>{X(),J()}),(0,e.on)(b,`transitionend`,e=>{if(e.target!==b)return;let t=S?K.get(S):null;if(t){let e=Te(t.item,t.content);vt(t.content,t.trigger,e)}})),K.forEach(({content:t})=>{L.push((0,e.on)(t,`pointerenter`,()=>{X(),J()}),(0,e.on)(t,`pointerleave`,t=>{if(D)return;let n=t.relatedTarget;ht(n)||(0,e.containsWithPortals)(i,n)||(Q(null),Z(null))}))}),L.push((0,e.on)(v,`keydown`,e=>{let t=Me(e.target);if(!t)return;let n=q.indexOf(t);if(n===-1)return;let r=n;switch(e.key){case`Tab`:if(e.shiftKey||S===null)return;(Be(t,1,{preserveOpenOnPlain:!0})||qe())&&e.preventDefault();return;case`ArrowLeft`:r=n-1,r<0&&(r=q.length-1);break;case`ArrowRight`:r=n+1,r>=q.length&&(r=0);break;case`ArrowDown`:if(t.kind===`submenu`){e.preventDefault();let n=t.value;D=!0,Q(n,!0),Je(n)}return;case`Home`:r=0;break;case`End`:r=q.length-1;break;case`Escape`:D=!1,Q(null,!0),Z(null);return;default:return}e.preventDefault();let i=q[r];i&&Re(i,{preserveOpenOnPlain:!0})})),K.forEach(({content:t,trigger:n})=>{L.push((0,e.on)(t,`keydown`,e=>{let r=e.target,i=We(t),a=i.indexOf(r);if(a!==-1)switch(e.key){case`Tab`:if(!e.shiftKey&&a===i.length-1){(Ve(n,1,{preserveOpenOnPlain:!0})||qe())&&e.preventDefault();return}if(e.shiftKey&&a===0){e.preventDefault(),n.focus();return}return;case`ArrowDown`:case`ArrowRight`:{e.preventDefault();let t=a+1;t<i.length&&i[t]?.focus();break}case`ArrowUp`:case`ArrowLeft`:e.preventDefault(),a===0?n.focus():i[a-1]?.focus();break;case`Escape`:e.preventDefault(),D=!1,Q(null,!0),Z(null),n.focus();break}}))});let Et=()=>(0,e.containsWithPortals)(i,document.activeElement)||A||D,$=()=>{X(),Ye(),Xe(),D=!1,Q(null,!0),Z(null),mt()};L.push((0,e.on)(document,`focusin`,t=>{let n=t.target;if(!(0,e.containsWithPortals)(i,n)){if(S!==null){$();return}Z(null)}})),L.push((0,e.createDismissLayer)({root:i,isOpen:()=>S!==null&&Et(),onDismiss:$,closeOnClickOutside:!0,closeOnEscape:!0,preventEscapeDefault:!1,isInside:t=>!!t&&(0,e.containsWithPortals)(i,t)})),L.push((0,e.on)(window,`resize`,()=>{(S||E)&&requestAnimationFrame(()=>Ct(E))}),(0,e.on)(v,`scroll`,()=>{(S||E)&&requestAnimationFrame(()=>Ct(E))})),L.push((0,e.on)(i,`navigation-menu:set`,e=>{let t=e.detail;if(t?.value!==void 0){if(t.value===null)$();else if(K.has(t.value)){D=!0,Q(t.value,!0);let e=K.get(t.value);e&&Z(e.trigger)}}}));let Dt={get value(){return S},open:e=>Q(e,!0),close:()=>$(),destroy:()=>{j=!0,Ye(),Xe(),L.forEach(e=>e()),L.length=0,(0,e.clearRootBinding)(i,o,Dt)}};return Tt(),(0,e.setRootBinding)(i,o,Dt),Dt}function c(t=document){let n=[];for(let r of(0,e.getRoots)(t,`navigation-menu`))(0,e.hasRootBinding)(r,o)||n.push(s(r));return n}exports.create=c,exports.createNavigationMenu=s;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@data-slot/core`);const t=[`start`,`center`,`end`],n=[`top`,`right`,`bottom`,`left`],r=[`absolute`,`fixed`],i=(e,t)=>t===`start`?{x:e.left,y:e.top}:t===`end`?{x:e.right,y:e.bottom}:{x:e.left+e.width/2,y:e.top+e.height/2},a=(e,t,n)=>{let r=i(n,t);return e===`top`?{x:r.x,y:n.top}:e===`bottom`?{x:r.x,y:n.bottom}:e===`left`?{x:n.left,y:r.y}:{x:n.right,y:r.y}},o=e=>{let t=getComputedStyle(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;if(e instanceof HTMLElement){let t=e.offsetWidth||n,i=e.offsetHeight||r;(Math.round(n)!==t||Math.round(r)!==i)&&(n=t,r=i)}return{width:n,height:r}},s=`@data-slot/navigation-menu`;function c(i,c={}){let l=(0,e.reuseRootBinding)(i,s,`[@data-slot/navigation-menu] createNavigationMenu() called more than once for the same root. Returning the existing controller. Destroy it before rebinding with new options.`);if(l)return l;let u=c.delayOpen??(0,e.getDataNumber)(i,`delayOpen`)??0,d=c.delayClose??(0,e.getDataNumber)(i,`delayClose`)??0,f=c.openOnFocus??(0,e.getDataBool)(i,`openOnFocus`)??!1,ee=c.side??(0,e.getDataEnum)(i,`side`,n)??`bottom`,p=c.align??(0,e.getDataEnum)(i,`align`,t)??`start`,te=c.sideOffset??(0,e.getDataNumber)(i,`sideOffset`)??0,ne=c.alignOffset??(0,e.getDataNumber)(i,`alignOffset`)??0,re=c.positionMethod??(0,e.getDataEnum)(i,`positionMethod`,r)??`absolute`,ie=c.safeTriangle??(0,e.getDataBool)(i,`safeTriangle`)??!1,ae=c.debugSafeTriangle??(0,e.getDataBool)(i,`debugSafeTriangle`)??!1,oe=ie||ae,m=c.onValueChange,se=e=>e.replace(/[^a-z0-9\-_:.]/gi,`-`),h=(e,t)=>{`inert`in e&&(e.inert=t)},g=(0,e.getPart)(i,`navigation-menu-list`),_=(0,e.getParts)(i,`navigation-menu-item`),v=(0,e.getPart)(i,`navigation-menu-viewport`),y=(0,e.getPart)(i,`navigation-menu-indicator`);if(!g||_.length===0)throw Error(`NavigationMenu requires navigation-menu-list and at least one navigation-menu-item`);let b=null,x=null,ce=-1,le=null,S=null,C=null,w=!1,T=null,E=null,D=!1,ue=!1,O=null,k=null,de=null,fe=0,pe=0,A=!1,j=!1,M=[],N=new Map,P=new Map,F=new WeakMap,I=new Map,me=(e,t)=>{if(e){if(t){e.setAttribute(`data-open`,``),e.removeAttribute(`data-closed`);return}e.setAttribute(`data-closed`,``),e.removeAttribute(`data-open`)}},L=(e,t)=>{e&&(e.setAttribute(`data-state`,t?`open`:`closed`),me(e,t))},he=(e,t)=>{e.setAttribute(`data-state`,t?`active`:`inactive`),me(e,t)},R=(e,t)=>{if(t){e.setAttribute(`data-activation-direction`,t);return}e.removeAttribute(`data-activation-direction`)},z=()=>{if(!v)return{popup:null,positioner:null,portal:null};let e=null,t=null,n=null,r=v.parentElement,a=`popup`;for(;r&&r!==i;){let i=r.getAttribute(`data-slot`);if(i===`navigation-menu-portal`){n=r;break}if(a===`popup`&&i===`navigation-menu-popup`){e=r,a=`positioner`,r=r.parentElement;continue}if((a===`popup`||a===`positioner`)&&(i===`navigation-menu-positioner`||i===`navigation-menu-viewport-positioner`)){t=r,a=`portal`,r=r.parentElement;continue}r=r.parentElement}return{popup:e,positioner:t,portal:n}},B=null,ge=e=>{ue||B!==e||!e.isClosing||!e.popupExitComplete||!e.viewportExitComplete||Ve()},V={committed:{width:0,height:0},live:{width:0,height:0}},H=null,_e=null,ve=null,ye=e=>{e.width>0&&(V.committed.width=e.width),e.height>0&&(V.committed.height=e.height)},be=e=>{e.width>0&&(V.live.width=e.width),e.height>0&&(V.live.height=e.height)},xe=()=>{V={committed:{width:0,height:0},live:{width:0,height:0}}},Se=()=>{ve!==null&&(cancelAnimationFrame(ve),ve=null)},Ce=(e,t)=>{if(t===`auto`){e.style.setProperty(`--popup-width`,`auto`),e.style.setProperty(`--popup-height`,`auto`);return}e.style.setProperty(`--popup-width`,`${t.width}px`),e.style.setProperty(`--popup-height`,`${t.height}px`)},we=(e,t,n)=>{Ce(e,{width:t,height:n})},Te=(e,t)=>{v&&(v.style.setProperty(`--viewport-width`,`${e}px`),v.style.setProperty(`--viewport-height`,`${t}px`))},Ee=(e,t)=>{if(t===`max-content`){e.style.setProperty(`--positioner-width`,`max-content`),e.style.setProperty(`--positioner-height`,`max-content`);return}e.style.setProperty(`--positioner-width`,`${t.width}px`),e.style.setProperty(`--positioner-height`,`${t.height}px`)},De=(e,t)=>{let n=new Map;for(let[r,i]of Object.entries(t))n.set(r,e.style.getPropertyValue(r)),e.style.setProperty(r,i);return()=>{for(let[t,r]of n)r?e.style.setProperty(t,r):e.style.removeProperty(t)}},Oe=(e,t)=>{let n=De(e.popup,{"--popup-width":`auto`,"--popup-height":`auto`,position:`static`,transform:`none`,scale:`1`,top:``,right:``,bottom:``,left:``}),r=De(e.positioner,{"--positioner-width":`max-content`,"--positioner-height":`max-content`,"--available-width":`max-content`,"--available-height":`max-content`}),i=o(e.popup);return r(),n(),i},ke=()=>{let e=W();if(!e)return{...V.committed};let t=o(e),n={width:e.offsetWidth||t.width||V.live.width||V.committed.width,height:e.offsetHeight||t.height||V.live.height||V.committed.height};return be(n),n},Ae=()=>{let e=V.committed;if(e.width<=0||e.height<=0)return!1;let t=ke();return Math.abs(t.width-e.width)>1||Math.abs(t.height-e.height)>1},U=(e,t)=>{if(t){let t=P.get(e)??{applied:!1,left:``,position:``,top:``};t.applied||(t.position=e.style.position,t.top=e.style.top,t.left=e.style.left),t.applied=!0,P.set(e,t),e.style.position=`absolute`,e.style.top=`0px`,e.style.left=`0px`;return}let n=P.get(e);n?.applied&&(n.position?e.style.position=n.position:e.style.removeProperty(`position`),n.top?e.style.top=n.top:e.style.removeProperty(`top`),n.left?e.style.left=n.left:e.style.removeProperty(`left`),n.applied=!1)},je=e=>{let t=F.get(e);t?.applied&&(t.position?e.style.position=t.position:e.style.removeProperty(`position`),t.top?e.style.top=t.top:e.style.removeProperty(`top`),t.right?e.style.right=t.right:e.style.removeProperty(`right`),t.bottom?e.style.bottom=t.bottom:e.style.removeProperty(`bottom`),t.left?e.style.left=t.left:e.style.removeProperty(`left`),t.applied=!1)},Me=(e,t)=>{if(t===null){je(e);return}let n=F.get(e)??{applied:!1,bottom:``,left:``,position:``,right:``,top:``};if(n.applied||(n.position=e.style.position,n.top=e.style.top,n.right=e.style.right,n.bottom=e.style.bottom,n.left=e.style.left),n.applied=!0,F.set(e,n),t===`top`){e.style.position=`absolute`,e.style.top=``,e.style.right=``,e.style.bottom=`0px`,e.style.left=`0px`;return}e.style.position=`absolute`,e.style.top=`0px`,e.style.right=`0px`,e.style.bottom=``,e.style.left=``},W=()=>B?.popup??z().popup,G=()=>B?.positioner??z().positioner,Ne=e=>{H?.disconnect(),H=null,!(!e||typeof ResizeObserver!=`function`)&&(H=new ResizeObserver(t=>{let n=t[0],r=Array.isArray(n?.borderBoxSize)?n?.borderBoxSize[0]?.inlineSize:void 0,i=Array.isArray(n?.borderBoxSize)?n?.borderBoxSize[0]?.blockSize:void 0;be({width:Math.ceil(r??e.offsetWidth),height:Math.ceil(i??e.offsetHeight)})}),H.observe(e))},Pe=(e,t)=>{let n=(i.ownerDocument??document).createElement(`div`);n.setAttribute(`data-slot`,t),t===`navigation-menu-positioner`&&(n.style.isolation=`isolate`,n.style.zIndex=`50`);let r=e.parentNode;if(!r)throw Error(`NavigationMenu expected popup stack child to have a parent node`);return r.insertBefore(n,e),n.appendChild(e),n},Fe=e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}},Ie=()=>{let e=G();e&&(e.style.position=``,e.style.top=``,e.style.left=``,e.style.margin=``,e.style.willChange=``,e.style.pointerEvents=``,e.style.transform=``,e.style.removeProperty(`--transform-origin`),e.style.removeProperty(`--positioner-width`),e.style.removeProperty(`--positioner-height`),e.style.removeProperty(`--available-width`),e.style.removeProperty(`--available-height`));let t=W();t&&(t.style.willChange=``,t.style.pointerEvents=``,je(t),t.style.removeProperty(`scale`),t.style.removeProperty(`--transform-origin`),t.style.removeProperty(`--popup-width`),t.style.removeProperty(`--popup-height`)),v&&(v.style.top=``,v.style.left=``,v.style.willChange=``,v.style.removeProperty(`--transform-origin`),v.style.removeProperty(`--viewport-width`),v.style.removeProperty(`--viewport-height`))},Le=()=>{de!==null&&(cancelAnimationFrame(de),de=null)},Re=()=>{let e=A||j;v&&(e?v.setAttribute(`data-instant`,``):v.removeAttribute(`data-instant`));let t=W();t&&(e?t.setAttribute(`data-instant`,``):t.removeAttribute(`data-instant`));let n=G();n&&(e?n.setAttribute(`data-instant`,``):n.removeAttribute(`data-instant`))},ze=()=>{Le(),de=requestAnimationFrame(()=>{de=null,A=!1,j=!1,Re()})},Be=()=>{Le(),A=!1,j=!1,Re()},Ve=()=>{let e=B;!e||!v||(Se(),H?.disconnect(),H=null,Be(),Ie(),xe(),fe=0,pe=0,v.hidden=!0,v.style.pointerEvents=`none`,e.popup.hidden=!0,e.popup.style.pointerEvents=`none`,e.popupPortal.restore(),e.generatedPopup&&Fe(e.popup),e.generatedPositioner&&Fe(e.positioner),e.generatedPortal&&Fe(e.portal),e.popupPresence.cleanup(),e.viewportPresence.cleanup(),B=null)},He=()=>{if(!v)return null;if(B)return B;let t=z(),n=t.popup,r=t.positioner,a=t.portal,o=!1,s=!1,c=!1;(!n||!n.contains(v))&&(n=Pe(v,`navigation-menu-popup`),o=!0),(!r||!r.contains(n))&&(r=Pe(n,`navigation-menu-positioner`),s=!0),(!a||!a.contains(r))&&(a=Pe(r,`navigation-menu-portal`),c=!0);let l=(0,e.createPortalLifecycle)({content:n,root:i,enabled:!0,container:r,mountTarget:a}),u={popup:n,positioner:r,portal:a,popupPortal:l,popupPresence:null,viewportPresence:null,generatedPopup:o,generatedPositioner:s,generatedPortal:c,isClosing:!1,popupExitComplete:!1,viewportExitComplete:!1},d=(0,e.createPresenceLifecycle)({element:v,onExitComplete:()=>{u.viewportExitComplete=!0,ge(u)}});return u.popupPresence=(0,e.createPresenceLifecycle)({element:n,onExitComplete:()=>{u.popupExitComplete=!0,ge(u)}}),u.viewportPresence=d,B=u,Ne(n),B},Ue=e=>{if(!v)return;let t=I.get(e)??{originalParent:null,originalNextSibling:null,mountedInViewport:!1};t.mountedInViewport||(t.originalParent=e.parentNode,t.originalNextSibling=e.nextSibling,t.mountedInViewport=!0,I.set(e,t)),e.parentNode!==v&&v.appendChild(e)},We=e=>{let t=I.get(e);if(!t||!t.mountedInViewport)return;let n=t.originalParent,r=t.originalNextSibling;n&&n.isConnected?r&&r.parentNode===n?n.insertBefore(e,r):n.appendChild(e):e.remove(),t.mountedInViewport=!1,t.originalParent=null,t.originalNextSibling=null},Ge=()=>{if(!v)return;let e=G();if(!e)return;let t=i.ownerDocument.defaultView??window,n=i.getBoundingClientRect(),r=re===`fixed`,a=n.top+pe+(r?0:t.scrollY),o=n.left+fe+(r?0:t.scrollX);e.style.position=re,e.style.top=`${a}px`,e.style.left=`${o}px`,e.style.margin=`0`,e.style.willChange=`top,left`,e.style.pointerEvents=`none`},Ke=null,qe=e=>{Se(),ve=requestAnimationFrame(()=>{if(ve=null,!v||b===null)return;let t=jt();if(!t||t.content!==e.content)return;let n=He();if(!n||n.isClosing)return;let r=Ye(t.item,t.content);if(n.popup.hasAttribute(`data-starting-style`)||Ae()){Ht(t.content,t.trigger,r,{defer:!1,mode:`sync-current`});return}Ht(t.content,t.trigger,r,{defer:!1,mode:`measure-target`})})},Je=e=>{Ke?.disconnect(),Ke=null,_e?.disconnect(),_e=null,Se(),!(!v||!e)&&(Ke=new ResizeObserver(()=>{qe(e)}),Ke.observe(e.content),typeof MutationObserver==`function`&&(_e=new MutationObserver(()=>{qe(e)}),_e.observe(e.content,{childList:!0,subtree:!0,characterData:!0})))};M.push(()=>Ke?.disconnect()),M.push(()=>_e?.disconnect()),M.push(Se),M.push(()=>{Be(),N.forEach(e=>e.cleanup()),N.clear(),I.forEach((e,t)=>{We(t),U(t,!1),t.hidden=!0,t.style.pointerEvents=`none`}),P.clear(),I.clear(),H?.disconnect(),H=null,Ve()});let K=new Map,Ye=(r,i)=>({side:c.side??(0,e.getDataEnum)(i,`side`,n)??(0,e.getDataEnum)(r,`side`,n)??ee,align:c.align??(0,e.getDataEnum)(i,`align`,t)??(0,e.getDataEnum)(r,`align`,t)??p,sideOffset:c.sideOffset??(0,e.getDataNumber)(i,`sideOffset`)??(0,e.getDataNumber)(r,`sideOffset`)??te,alignOffset:c.alignOffset??(0,e.getDataNumber)(i,`alignOffset`)??(0,e.getDataNumber)(r,`alignOffset`)??ne}),Xe=0;_.forEach(t=>{let n=t.dataset.value;if(!n)return;let r=(0,e.getPart)(t,`navigation-menu-trigger`),i=(0,e.getPart)(t,`navigation-menu-content`);if(r&&i){K.set(n,{value:n,item:t,trigger:r,content:i,index:Xe++}),N.set(i,(0,e.createPresenceLifecycle)({element:i,onExitComplete:()=>{ue||(he(i,!1),R(i,null),i.removeAttribute(`data-motion`),U(i,!1),We(i),i.hidden=!0,i.style.pointerEvents=`none`)}}));let a=se(n),o=(0,e.ensureId)(r,`nav-menu-trigger-${a}`),s=(0,e.ensureId)(i,`nav-menu-content-${a}`);r.setAttribute(`aria-haspopup`,`true`),r.setAttribute(`aria-controls`,s),i.setAttribute(`aria-labelledby`,o)}});let Ze=Array.from(K.values()).map(e=>e.trigger),Qe=`a[href], button:not([disabled]), [role="link"], [role="button"], [tabindex]:not([tabindex="-1"])`,$e=e=>{let t=e?.closest(`[data-slot="navigation-menu-item"]`);if(!t)return null;let n=t.dataset.value;if(!n)return null;let r=K.get(n);return!r||r.item!==t?null:r},et=e=>{if(e.matches(Qe))return e;let t=e.querySelectorAll(Qe);for(let n of t)if(e.contains(n)&&!n.closest(`[data-slot="navigation-menu-content"]`)&&!(n.hidden||n.closest(`[hidden]`)))return n;return null},q=[],tt=new Map;_.forEach(e=>{let t=$e(e);if(t){let e={kind:`submenu`,element:t.trigger,item:t.item,value:t.value,trigger:t.trigger};q.push(e),tt.set(e.element,e),tt.set(e.item,e);return}let n=et(e);if(!n)return;let r={kind:`plain`,element:n};q.push(r),tt.set(r.element,r)});let nt=e=>{let t=e instanceof HTMLElement?e:null;if(!t)return null;let n=t;for(;n&&n!==g;){let e=tt.get(n);if(e)return e;n=n.parentElement}return null},rt=e=>{let t=nt(e);return t?.kind===`plain`?t:null},it=e=>{let t=nt(e);return t?.kind===`submenu`?t:null},at=()=>{let e=i.ownerDocument.defaultView;if(!e?.matchMedia)return!0;try{return e.matchMedia(`(any-hover: hover)`).matches}catch{return!0}},ot=e=>{try{return e.matches(`:hover`)}catch{return!1}},st=()=>{for(let e of q){if(e.kind===`submenu`){if(ot(e.item)||ot(e.trigger))return e;continue}if(ot(e.element))return e}return null},ct=(e,t={})=>{let n=i.ownerDocument,r=t.preserveOpenOnPlain??!1;return e.kind===`submenu`?(e.trigger.focus(),n.activeElement===e.trigger?(qt(e.trigger),!0):!1):(b!==null&&!r&&$(),e.element.focus(),n.activeElement===e.element?(b!==null&&r?qt():Z(e.element),!0):!1)},lt=(e,t,n={})=>{for(let r=e+t;r>=0&&r<q.length;r+=t){let e=q[r];if(e&&ct(e,n))return!0}return!1},ut=(e,t,n={})=>{let r=q.indexOf(e);return r===-1?!1:lt(r,t,n)},dt=(e,t,n={})=>{let r=q.findIndex(t=>t.kind===`submenu`&&t.trigger===e);return r===-1?!1:lt(r,t,n)},ft=e=>{if(!(e instanceof Node)||!g.contains(e))return!1;let t=e instanceof HTMLElement?e:e.parentElement;return!t||t.closest(`[data-slot="navigation-menu-indicator"]`)||$e(t)?!1:t.closest(`[data-slot="navigation-menu-item"]`)?!0:!!t.closest(`a[href], button, [role='link'], [role='button']`)},pt=`a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])`,mt=e=>Array.from(e.querySelectorAll(pt)).filter(e=>!e.hidden&&!e.closest(`[hidden]`)),ht=e=>!e.isConnected||e.hidden||e.closest(`[hidden]`)||`disabled`in e&&e.disabled||e.getAttribute(`aria-hidden`)===`true`||e.getAttribute(`tabindex`)===`-1`?!1:e.matches(pt)?!0:e.tabIndex>=0,gt=e=>{if(i.contains(e)||v?.contains(e)||W()?.contains(e)||G()?.contains(e))return!0;for(let{content:t}of K.values())if(t.contains(e))return!0;return!1},_t=()=>{let e=i.ownerDocument,t=Array.from(e.querySelectorAll(`*`));for(let n of t)if(ht(n)&&!gt(n)&&(i.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0&&(n.focus(),e.activeElement===n))return!0;return!1},vt=e=>{requestAnimationFrame(()=>{if(b!==e)return;let t=K.get(e);if(!t)return;let n=mt(t.content)[0];n?n.focus():t.content.focus()})},J=()=>{le&&=(clearTimeout(le),null),S&&=(clearTimeout(S),null)},yt=()=>{J(),x=null},bt=()=>{T=null,E=null},xt=()=>{k!==null&&(cancelAnimationFrame(k),k=null)},Y=null,St=()=>v?G()||W()||(v.parentElement instanceof HTMLElement?v.parentElement:v):null,Ct=()=>{let t=St();return Y||(Y=document.createElement(`div`),Y.setAttribute(`data-slot`,`navigation-menu-bridge`),Y.style.cssText=`position: absolute; pointer-events: auto; z-index: 0; display: none;`,M.push((0,e.on)(Y,`pointerenter`,()=>{J()}),(0,e.on)(Y,`pointerleave`,t=>{if(w||b===null)return;let n=t.relatedTarget;zt(n)||n&&(0,e.containsWithPortals)(i,n)||(Q(null),Z(null))}))),t&&Y.parentElement!==t&&t.insertBefore(Y,t.firstChild),Y},wt=()=>{Y&&(Y.style.height=`0`,Y.style.width=`0`,Y.style.top=`0px`,Y.style.left=`0px`,Y.style.right=`0px`,Y.style.bottom=`auto`,Y.style.transform=`none`,Y.style.clipPath=`none`,Y.style.display=`none`)},Tt=()=>{if(!ae)return null;let e=i.ownerDocument.body;return e?(O||(O=i.ownerDocument.createElement(`div`),O.setAttribute(`data-slot`,`navigation-menu-safe-triangle`),O.style.cssText=[`position: fixed`,`pointer-events: none`,`display: none`,`z-index: 2147483647`,`background: rgba(255, 0, 0, 0.18)`,`border: 1px solid rgba(255, 0, 0, 0.45)`].join(`; `)),O.parentElement!==e&&e.appendChild(O),O):null},Et=()=>{O&&(O.style.width=`0`,O.style.height=`0`,O.style.clipPath=`none`,O.style.display=`none`)},X=()=>{ae||Et()},Dt=e=>{let t=Tt();if(!t)return;let n=e.apex.x,r=e.apex.y,i=e.edgeA.x,a=e.edgeA.y,o=e.edgeB.x,s=e.edgeB.y,c=Math.min(n,i,o),l=Math.min(r,a,s),u=Math.max(n,i,o),d=Math.max(r,a,s),f=Math.max(1,u-c),ee=Math.max(1,d-l),p=(e,t)=>`${(e-c)/f*100}% ${(t-l)/ee*100}%`;t.style.display=`block`,t.style.left=`${c}px`,t.style.top=`${l}px`,t.style.width=`${f}px`,t.style.height=`${ee}px`,t.style.clipPath=`polygon(${p(n,r)}, ${p(i,a)}, ${p(o,s)})`},Ot=(e,t,n)=>(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y),kt=(e,t,n,r)=>{let i=Ot(e,t,n),a=Ot(e,n,r),o=Ot(e,r,t);return!((i<0||a<0||o<0)&&(i>0||a>0||o>0))},At=(e,t,n)=>{let r=.5;if(n.top>=t.bottom-r)return[{x:n.left,y:n.top},{x:n.right,y:n.top}];if(n.bottom<=t.top+r)return[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}];if(n.left>=t.right-r)return[{x:n.left,y:n.top},{x:n.left,y:n.bottom}];if(n.right<=t.left+r)return[{x:n.right,y:n.top},{x:n.right,y:n.bottom}];let i=[[{x:n.left,y:n.top},{x:n.right,y:n.top}],[{x:n.right,y:n.top},{x:n.right,y:n.bottom}],[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}],[{x:n.left,y:n.top},{x:n.left,y:n.bottom}]],a=([t,n])=>t.y===n.y?Math.abs(e.y-t.y):Math.abs(e.x-t.x),o=i[0],s=a(o);for(let e=1;e<i.length;e++){let t=i[e],n=a(t);n<s&&(o=t,s=n)}return o},jt=()=>b?K.get(b)??null:null,Mt=(e,t,n)=>{if(n.width<=0||n.height<=0)return null;let r={x:e.left+e.width/2,y:e.top+e.height*.62},[i,a]=At(r,t,n);if(i.x===a.x){let e=Math.min(i.y,a.y),t=Math.max(i.y,a.y),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:i.x,y:e+r},a={x:a.x,y:t-r}}else{let e=Math.min(i.x,a.x),t=Math.max(i.x,a.x),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:e+r,y:i.y},a={x:t-r,y:a.y}}return{apex:r,edgeA:i,edgeB:a}},Nt=()=>{if(!oe||!v||b===null)return null;let e=jt();if(!e)return null;let t=i.getBoundingClientRect(),n=e.trigger.getBoundingClientRect(),r=v.getBoundingClientRect(),a=e.content.getBoundingClientRect();return Mt(n,t,r.width>0&&r.height>0?r:a)},Pt=e=>{let t=Nt();return t?kt({x:e.clientX,y:e.clientY},t.apex,t.edgeA,t.edgeB):!1},Ft=(e,t)=>({x:e.x-t.left,y:e.y-t.top}),It=e=>{if(e.length<=1)return e.slice();let t=e=>`${e.x.toFixed(3)}:${e.y.toFixed(3)}`,n=new Map;for(let r of e)n.set(t(r),r);let r=Array.from(n.values()).sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x);if(r.length<=2)return r;let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=[];for(let e of r){for(;a.length>=2&&i(a[a.length-2],a[a.length-1],e)<=0;)a.pop();a.push(e)}let o=[];for(let e=r.length-1;e>=0;e--){let t=r[e];for(;o.length>=2&&i(o[o.length-2],o[o.length-1],t)<=0;)o.pop();o.push(t)}return a.pop(),o.pop(),a.concat(o)},Lt=e=>{if(e.length<3){wt();return}let t=Ct(),n=t.parentElement,r=It(n&&n===G()?e.map(e=>({x:e.x-fe,y:e.y-pe})):e);if(r.length<3){wt();return}let i=Math.min(...r.map(e=>e.x)),a=Math.min(...r.map(e=>e.y)),o=Math.max(...r.map(e=>e.x)),s=Math.max(...r.map(e=>e.y)),c=Math.max(1,o-i),l=Math.max(1,s-a),u=e=>`${(e.x-i)/c*100}% ${(e.y-a)/l*100}%`;t.style.display=`block`,t.style.transform=`none`,t.style.bottom=`auto`,t.style.right=`auto`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.width=`${c}px`,t.style.height=`${l}px`,t.style.clipPath=`polygon(${r.map(u).join(`, `)})`},Rt=()=>{if(!ae)return;let e=Nt();if(!e){Et();return}Dt(e)},zt=e=>e?!!(jt()?.content.contains(e)||v?.contains(e)||W()?.contains(e)||Y?.contains(e)||G()?.contains(e)):!1;M.push(X),M.push(xt),M.push(wt),M.push(()=>{Et(),O?.parentElement&&O.parentElement.removeChild(O),O=null});let Bt=(e,t,n,r,a,o)=>{let s=i.ownerDocument.defaultView??window,c=s.visualViewport,l=c?.offsetLeft??0,u=c?.offsetTop??0,d=c?.width??s.innerWidth,f=c?.height??s.innerHeight,ee=n===`left`?Math.max(0,t.left-l-r):n===`right`?Math.max(0,l+d-t.right-r):Math.max(0,d),p=n===`top`?Math.max(0,t.top-u-r):n===`bottom`?Math.max(0,u+f-t.bottom-r):Math.max(0,f);Ee(e,{width:a,height:o}),e.style.setProperty(`--available-width`,`${ee}px`),e.style.setProperty(`--available-height`,`${p}px`)},Vt=(t,r,o,s={})=>{let c=He();if(!v||!c)return;let{popup:l,positioner:u}=c,d=s.mode??`measure-target`,f=d!==`sync-current`;if(v.getAttribute(`data-state`)!==`open`||t.getAttribute(`data-state`)!==`active`)return;U(t,!1);let ee=t.firstElementChild,p=t.lastElementChild,te=ee?getComputedStyle(ee):null,ne=p?getComputedStyle(p):null,re=te&&parseFloat(te.marginTop)||0,ie=ne&&parseFloat(ne.marginBottom)||0,ae=(...e)=>{let t=0;for(let n of e)Number.isFinite(n)&&(t=Math.max(t,n));return t},m=t.getBoundingClientRect(),se={width:ae(m.width,t.scrollWidth,t.offsetWidth,t.clientWidth),height:ae(m.height,t.scrollHeight,t.offsetHeight,t.clientHeight)+re+ie},h={...V.committed},g=f?Oe(c,o.side):ke(),_={width:d===`sync-current`?h.width||g.width||se.width:g.width||se.width,height:d===`sync-current`?h.height||g.height||se.height:g.height||se.height};be(g.width>0&&g.height>0?g:_),f&&ye(_);let y=_.width,b=_.height;if(y<=0||b<=0)return;let x={top:m.top,left:m.left,width:y,height:b,right:m.left+y,bottom:m.top+b},ce=getComputedStyle(v),le=parseFloat(ce.marginTop)||0;Te(y,b);let S=i.getBoundingClientRect(),C=r.getBoundingClientRect(),w=(0,e.computeFloatingPosition)({anchorRect:C,contentRect:x,side:o.side,align:o.align,sideOffset:o.sideOffset,alignOffset:o.alignOffset,avoidCollisions:!1,collisionPadding:0,allowedSides:n}),T=w.x-S.left,E=w.y-S.top;fe=T,pe=E;let D=a(w.side,w.align,C),ue=D.x-(S.left+T),O=D.y-(S.top+E),k=D.x-S.left,de=D.y-S.top,A=`${ue}px ${O}px`,j=`${k}px ${de}px`;if(l.style.willChange=`width,height`,l.style.pointerEvents=`auto`,w.side===`top`?Me(l,`top`):w.side===`left`?Me(l,`left`):Me(l,null),l.style.setProperty(`--transform-origin`,A),v.style.top=`0px`,v.style.left=`0px`,v.style.willChange=`transform,width,height`,v.style.setProperty(`--transform-origin`,A),t.style.setProperty(`--transform-origin`,A),l.setAttribute(`data-side`,w.side),l.setAttribute(`data-align`,w.align),v.setAttribute(`data-side`,w.side),v.setAttribute(`data-align`,w.align),t.setAttribute(`data-side`,w.side),t.setAttribute(`data-align`,w.align),u.setAttribute(`data-side`,w.side),u.setAttribute(`data-align`,w.align),u.style.setProperty(`--transform-origin`,j),Bt(u,C,w.side,o.sideOffset,y,b),Ge(),d===`measure-target`)we(l,y,b);else if(d===`initial-open`)we(l,y,b);else{let e=l.style.getPropertyValue(`--popup-width`).trim(),t=l.style.getPropertyValue(`--popup-height`).trim();(!e||!t)&&we(l,h.width||y,h.height||b)}let M=v.getBoundingClientRect(),N=[],P=Math.max(0,M.top-S.bottom),F=Math.max(0,S.top-M.bottom),I=Math.max(0,M.left-S.right),me=Math.max(0,S.left-M.right),L=Math.max(0,le),he=Math.max(P,F,L),R=Math.max(I,me),z=oe?Mt(C,S,M):null,B=(e,t,n,r)=>{n<=0||r<=0||N.push({x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r})};if(he>=R&&he>0){let e=Math.max(P,F,L),t=T,n=F>P&&F>=L?E+b:E-e,r=y;if(z){let e=Math.min(z.edgeA.x,z.edgeB.x)-S.left,n=Math.max(z.edgeA.x,z.edgeB.x)-S.left;t=e-8,r=n-e+16}B(t,n,r,e)}else if(R>0){let e=Math.max(I,me),t=E,n=me>I?T+y:T-e,r=b;if(z){let e=Math.min(z.edgeA.y,z.edgeB.y)-S.top,n=Math.max(z.edgeA.y,z.edgeB.y)-S.top;t=e-8,r=n-e+16}B(n,t,e,r)}if(z){let e=Ft(z.apex,S),t=Ft(z.edgeA,S),n=Ft(z.edgeB,S);N.push(e,t,n)}Lt(N),Rt()},Ht=(e,t,n,r={})=>{if(!v)return;let i=()=>{Vt(e,t,n,r)};if(r.defer===!1){i();return}requestAnimationFrame(()=>{v.getAttribute(`data-state`)!==`open`||e.getAttribute(`data-state`)!==`active`||i()})},Ut=(e=jt(),t={})=>{if(!e)return;let n=Ye(e.item,e.content);Ht(e.content,e.trigger,n,t)},Wt=(0,e.createPositionSync)({observedElements:[i,...Ze],isActive:()=>b!==null,ancestorScroll:!0,syncOnScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,onUpdate:()=>{j=!0,Re(),Ut(void 0,{defer:!1,mode:`sync-current`}),ze()}});M.push(()=>Wt.stop());let Gt=e=>ce===-1||e>ce?`right`:`left`,Z=e=>{if(!y)return;if(C=e,!e){xt(),y.removeAttribute(`data-instant`),y.setAttribute(`data-state`,`hidden`);return}y.getAttribute(`data-state`)!==`visible`&&(xt(),y.setAttribute(`data-instant`,``),k=requestAnimationFrame(()=>{k=requestAnimationFrame(()=>{y.removeAttribute(`data-instant`),k=null})}));let t=g.getBoundingClientRect(),n=e.getBoundingClientRect();y.style.setProperty(`--indicator-left`,`${n.left-t.left}px`),y.style.setProperty(`--indicator-width`,`${n.width}px`),y.style.setProperty(`--indicator-top`,`${n.top-t.top}px`);let r=(v&&parseFloat(getComputedStyle(v).marginTop)||0)<1?1:0;y.style.setProperty(`--indicator-height`,`${n.height-r}px`),y.setAttribute(`data-state`,`visible`)},Kt=()=>b?K.get(b)?.trigger??null:null,qt=(e=null)=>{let t=Kt();if(t){Z(t);return}Z(e)},Q=(t,n=!1)=>{if(X(),t===b){t===null?yt():J();return}if(!n&&t!==null&&t===x)return;J(),x=t===null?null:t;let r=()=>{let n=b,r=t?K.get(t):null,a=ke(),o=t!==null,s=n===null&&o,c=n!==null&&t!==null&&n!==t,l=c&&r?Gt(r.index):null,u=document.activeElement;if(t===null&&u&&n){let t=K.get(n);t&&(0,e.containsWithPortals)(t.content,u)&&t.trigger.focus()}if(K.forEach(({trigger:r,content:i,item:a},o)=>{let s=o===t,c=o===n;if((0,e.setAria)(r,`expanded`,s),r.setAttribute(`data-state`,s?`open`:`closed`),a.setAttribute(`data-state`,s?`open`:`closed`),!s){let e=N.get(i);if(he(i,!1),i.setAttribute(`aria-hidden`,`true`),h(i,!0),i.style.pointerEvents=`none`,t===null)c&&(R(i,null),i.removeAttribute(`data-motion`));else if(c&&l){R(i,l);let e=l===`right`?`to-left`:`to-right`;i.setAttribute(`data-motion`,e)}else c&&(R(i,null),i.removeAttribute(`data-motion`));c?(U(i,!0),e?.exit()):e?.isExiting||(R(i,null),i.removeAttribute(`data-motion`),U(i,!1),We(i),i.hidden=!0)}}),r){let e=He();if(e?.popupPortal.mount(),e&&(e.isClosing=!1,e.popupExitComplete=!1,e.viewportExitComplete=!1),v&&s&&(L(i,!0),L(e?.positioner??G(),!0),L(e?.popup??W(),!0),L(v,!0),v.style.pointerEvents=`auto`,A=!0,Le(),j=!1,Re(),ze()),e?.popup&&(e.popup.hidden=!1,e.popup.style.pointerEvents=`auto`),v&&(v.hidden=!1),n===null&&(e?.popupPresence.enter(),e?.viewportPresence.enter()),Ue(r.content),N.get(r.content)?.enter(),Wt.start(),l){R(r.content,l);let e=l===`right`?`from-right`:`from-left`;r.content.setAttribute(`data-motion`,e)}else R(r.content,null),r.content.removeAttribute(`data-motion`);he(r.content,!0),U(r.content,!1),r.content.removeAttribute(`aria-hidden`),h(r.content,!1),r.content.hidden=!1,r.content.style.pointerEvents=`auto`,ce=r.index,c&&(A=!1,Le(),j=!1,Re()),Ut(r,{defer:s||c?!1:void 0,mode:s?`initial-open`:`measure-target`}),Je(r),Z(r.trigger)}else Wt.stop(),wt(),X(),B&&(a.width>0&&a.height>0&&(we(B.popup,a.width,a.height),Ee(B.positioner,{width:a.width,height:a.height}),Te(a.width,a.height)),B.isClosing=!0,B.popupExitComplete=!1,B.viewportExitComplete=!1,B.popupPresence.exit(),B.viewportPresence.exit()),Je(null);if(L(i,o),l?i.setAttribute(`data-motion`,l===`right`?`from-right`:`from-left`):i.removeAttribute(`data-motion`),v){let e=W();L(G(),o),L(e,o),L(v,o),v.style.pointerEvents=o?`auto`:`none`,A=s,(!o||c)&&(Le(),j=!1),Re(),l?v.style.setProperty(`--motion-direction`,l===`right`?`1`:`-1`):v.style.removeProperty(`--motion-direction`)}b=t,x=null,t===null&&Z(null),Rt(),(0,e.emit)(i,`navigation-menu:change`,{value:t}),m?.(t)};n?r():t!==null&&b===null?le=setTimeout(r,u):t!==null&&b!==null?r():S=setTimeout(r,d)},Jt=z();L(i,!1),v&&(L(Jt.positioner,!1),L(Jt.popup,!1),L(v,!1),v.hidden=!0,v.style.pointerEvents=`none`,Jt.popup&&(Jt.popup.hidden=!0,Jt.popup.style.pointerEvents=`none`)),y&&y.setAttribute(`data-state`,`hidden`),K.forEach(({trigger:t,content:n,item:r})=>{t.tagName===`BUTTON`&&!t.hasAttribute(`type`)&&(t.type=`button`),(0,e.setAria)(t,`expanded`,!1),t.setAttribute(`data-state`,`closed`),t.tabIndex=0,r.setAttribute(`data-state`,`closed`),he(n,!1),n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,h(n,!0),n.hidden=!0,U(n,!1),n.style.pointerEvents=`none`}),K.forEach(({item:t,trigger:n},r)=>{M.push((0,e.on)(n,`pointerenter`,e=>{if(!w){if(b!==r&&Pt(e))return;Z(n)}})),M.push((0,e.on)(t,`pointerenter`,e=>{if(!w){if(b!==r&&Pt(e))return;Q(r)}})),M.push((0,e.on)(t,`pointerleave`,t=>{if(x===r&&b===null&&yt(),b===r&&!w){let n=t.relatedTarget;if(zt(n))return;(!n||!(0,e.containsWithPortals)(i,n))&&(Q(null),Z(null))}})),M.push((0,e.on)(n,`focus`,()=>{if(T===n){T=null;return}f&&Q(r,!0),qt(n)})),M.push((0,e.on)(n,`pointerdown`,()=>{T=n,E=n}),(0,e.on)(n,`keydown`,()=>{E=null})),M.push((0,e.on)(n,`click`,()=>{let e=E===n;E=null,T=null,yt(),b===r&&w?(w=!1,Q(null,!0),Z(null)):b===r&&!w?(w=!0,Z(n),e||vt(r)):(w=!0,Q(r,!0),Z(n),e||vt(r))}))}),M.push((0,e.on)(g,`pointerover`,e=>{let t=e;if(t.pointerType===`touch`)return;let n=it(t.target);if(n){if(D=!0,w||b!==n.value&&Pt(t))return;Z(n.trigger),Q(n.value);return}let r=rt(t.target);if(r){if(D=!0,b!==null){if(w)return;$()}Z(r.element);return}b!==null&&(w||ft(t.target)&&$())}),(0,e.on)(g,`click`,e=>{b!==null&&ft(e.target)&&$()})),M.push((0,e.on)(g,`focusin`,e=>{let t=rt(e.target);if(t){if(b!==null){qt();return}Z(t.element)}}),(0,e.on)(i,`pointerenter`,()=>{D=!0}),(0,e.on)(i,`pointerleave`,e=>{let t=e.relatedTarget;if(!zt(t)&&(D=!1,!w)){if(Pt(e)){J();return}Q(null),Z(null)}}),(0,e.on)(i,`pointerdown`,()=>{X(),yt()}));let Yt=()=>{if(!at()||b!==null||x!==null||w)return;let e=st();if(D=e!==null||i instanceof HTMLElement&&ot(i),e){if(e.kind===`submenu`){Q(e.value,!0);return}Z(e.element)}};v&&M.push((0,e.on)(v,`pointerenter`,()=>{X(),J()}),(0,e.on)(v,`transitionend`,e=>{if(e.target!==v)return;let t=b?K.get(b):null;t&&Ut(t,{defer:!1,mode:`sync-current`})})),K.forEach(({content:t})=>{M.push((0,e.on)(t,`pointerenter`,()=>{X(),J()}),(0,e.on)(t,`pointerleave`,t=>{if(w)return;let n=t.relatedTarget;zt(n)||(0,e.containsWithPortals)(i,n)||(Q(null),Z(null))}))}),M.push((0,e.on)(g,`keydown`,e=>{let t=nt(e.target);if(!t)return;let n=q.indexOf(t);if(n===-1)return;let r=n;switch(e.key){case`Tab`:if(e.shiftKey||b===null)return;(ut(t,1,{preserveOpenOnPlain:!0})||_t())&&e.preventDefault();return;case`ArrowLeft`:r=n-1,r<0&&(r=q.length-1);break;case`ArrowRight`:r=n+1,r>=q.length&&(r=0);break;case`ArrowDown`:if(t.kind===`submenu`){e.preventDefault();let n=t.value;w=!0,Q(n,!0),vt(n)}return;case`Home`:r=0;break;case`End`:r=q.length-1;break;case`Escape`:w=!1,Q(null,!0),Z(null);return;default:return}e.preventDefault();let i=q[r];i&&ct(i,{preserveOpenOnPlain:!0})})),K.forEach(({content:t,trigger:n})=>{M.push((0,e.on)(t,`keydown`,e=>{let r=e.target,i=mt(t),a=i.indexOf(r);if(a!==-1)switch(e.key){case`Tab`:if(!e.shiftKey&&a===i.length-1){(dt(n,1,{preserveOpenOnPlain:!0})||_t())&&e.preventDefault();return}if(e.shiftKey&&a===0){e.preventDefault(),n.focus();return}return;case`ArrowDown`:case`ArrowRight`:{e.preventDefault();let t=a+1;t<i.length&&i[t]?.focus();break}case`ArrowUp`:case`ArrowLeft`:e.preventDefault(),a===0?n.focus():i[a-1]?.focus();break;case`Escape`:e.preventDefault(),w=!1,Q(null,!0),Z(null),n.focus();break}}))});let Xt=()=>(0,e.containsWithPortals)(i,document.activeElement)||D||w,$=()=>{X(),yt(),bt(),w=!1,Q(null,!0),Z(null),Rt()};M.push((0,e.on)(document,`focusin`,t=>{let n=t.target;if(!(0,e.containsWithPortals)(i,n)){if(b!==null){$();return}Z(null)}})),M.push((0,e.createDismissLayer)({root:i,isOpen:()=>b!==null&&Xt(),onDismiss:$,closeOnClickOutside:!0,closeOnEscape:!0,preventEscapeDefault:!1,isInside:t=>!!t&&(0,e.containsWithPortals)(i,t)})),M.push((0,e.on)(window,`resize`,()=>{(b||C)&&requestAnimationFrame(()=>qt(C))}),(0,e.on)(g,`scroll`,()=>{(b||C)&&requestAnimationFrame(()=>qt(C))})),M.push((0,e.on)(i,`navigation-menu:set`,e=>{let t=e.detail;if(t?.value!==void 0){if(t.value===null)$();else if(K.has(t.value)){w=!0,Q(t.value,!0);let e=K.get(t.value);e&&Z(e.trigger)}}}));let Zt={get value(){return b},open:e=>Q(e,!0),close:()=>$(),destroy:()=>{ue=!0,yt(),bt(),M.forEach(e=>e()),M.length=0,(0,e.clearRootBinding)(i,s,Zt)}};return Yt(),(0,e.setRootBinding)(i,s,Zt),Zt}function l(t=document){let n=[];for(let r of(0,e.getRoots)(t,`navigation-menu`))(0,e.hasRootBinding)(r,s)||n.push(c(r));return n}exports.create=l,exports.createNavigationMenu=c;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{clearRootBinding as e,computeFloatingPosition as t,containsWithPortals as n,createDismissLayer as r,createPortalLifecycle as i,createPositionSync as a,createPresenceLifecycle as o,emit as s,ensureId as c,getDataBool as l,getDataEnum as u,getDataNumber as d,getPart as f,getParts as p,getRoots as m,hasRootBinding as h,on as g,reuseRootBinding as _,setAria as ee,setRootBinding as te}from"@data-slot/core";const ne=[`start`,`center`,`end`],re=[`top`,`right`,`bottom`,`left`],v=[`absolute`,`fixed`],y=(e,t)=>t===`start`?{x:e.left,y:e.top}:t===`end`?{x:e.right,y:e.bottom}:{x:e.left+e.width/2,y:e.top+e.height/2},ie=(e,t,n)=>{let r=y(n,t);return e===`top`?{x:r.x,y:n.top}:e===`bottom`?{x:r.x,y:n.bottom}:e===`left`?{x:n.left,y:r.y}:{x:n.right,y:r.y}},b=`@data-slot/navigation-menu`;function x(m,h={}){let y=_(m,b,`[@data-slot/navigation-menu] createNavigationMenu() called more than once for the same root. Returning the existing controller. Destroy it before rebinding with new options.`);if(y)return y;let x=h.delayOpen??d(m,`delayOpen`)??0,S=h.delayClose??d(m,`delayClose`)??0,ae=h.openOnFocus??l(m,`openOnFocus`)??!1,oe=h.side??u(m,`side`,re)??`bottom`,se=h.align??u(m,`align`,ne)??`start`,ce=h.sideOffset??d(m,`sideOffset`)??0,le=h.alignOffset??d(m,`alignOffset`)??0,C=h.positionMethod??u(m,`positionMethod`,v)??`absolute`,ue=h.safeTriangle??l(m,`safeTriangle`)??!1,w=h.debugSafeTriangle??l(m,`debugSafeTriangle`)??!1,de=ue||w,fe=h.onValueChange,pe=e=>e.replace(/[^a-z0-9\-_:.]/gi,`-`),T=(e,t)=>{`inert`in e&&(e.inert=t)},E=f(m,`navigation-menu-list`),D=p(m,`navigation-menu-item`),O=f(m,`navigation-menu-viewport`),k=f(m,`navigation-menu-indicator`);if(!E||D.length===0)throw Error(`NavigationMenu requires navigation-menu-list and at least one navigation-menu-item`);let A=null,j=null,M=-1,me=null,he=null,ge=null,N=!1,_e=null,ve=null,P=!1,ye=!1,F=null,I=null,be=null,xe=0,Se=0,Ce=!1,L=!1,R=[],we=new Map,Te=new Map,Ee=(e,t)=>{if(e){if(t){e.setAttribute(`data-open`,``),e.removeAttribute(`data-closed`);return}e.setAttribute(`data-closed`,``),e.removeAttribute(`data-open`)}},z=(e,t)=>{e&&(e.setAttribute(`data-state`,t?`open`:`closed`),Ee(e,t))},De=(e,t)=>{e.setAttribute(`data-state`,t?`active`:`inactive`),Ee(e,t)},B=(e,t)=>{if(t){e.setAttribute(`data-activation-direction`,t);return}e.removeAttribute(`data-activation-direction`)},Oe=()=>{if(!O)return{popup:null,positioner:null,portal:null};let e=null,t=null,n=null,r=O.parentElement,i=`popup`;for(;r&&r!==m;){let a=r.getAttribute(`data-slot`);if(a===`navigation-menu-portal`){n=r;break}if(i===`popup`&&a===`navigation-menu-popup`){e=r,i=`positioner`,r=r.parentElement;continue}if((i===`popup`||i===`positioner`)&&(a===`navigation-menu-positioner`||a===`navigation-menu-viewport-positioner`)){t=r,i=`portal`,r=r.parentElement;continue}r=r.parentElement}return{popup:e,positioner:t,portal:n}},V=null,ke=e=>{ye||V!==e||!e.isClosing||!e.popupExitComplete||!e.viewportExitComplete||Le()},H=()=>V?.popup??Oe().popup,U=()=>V?.positioner??Oe().positioner,Ae=(e,t)=>{let n=(m.ownerDocument??document).createElement(`div`);n.setAttribute(`data-slot`,t),t===`navigation-menu-positioner`&&(n.style.isolation=`isolate`,n.style.zIndex=`50`);let r=e.parentNode;if(!r)throw Error(`NavigationMenu expected popup stack child to have a parent node`);return r.insertBefore(n,e),n.appendChild(e),n},je=e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}},Me=()=>{let e=U();e&&(e.style.position=``,e.style.top=``,e.style.left=``,e.style.width=``,e.style.height=``,e.style.margin=``,e.style.willChange=``,e.style.pointerEvents=``,e.style.transform=``,e.style.removeProperty(`--transform-origin`),e.style.removeProperty(`--positioner-width`),e.style.removeProperty(`--positioner-height`),e.style.removeProperty(`--available-width`),e.style.removeProperty(`--available-height`));let t=H();t&&(t.style.position=``,t.style.top=``,t.style.left=``,t.style.willChange=``,t.style.pointerEvents=``,t.style.removeProperty(`--transform-origin`),t.style.removeProperty(`--popup-width`),t.style.removeProperty(`--popup-height`))},Ne=()=>{be!==null&&(cancelAnimationFrame(be),be=null)},Pe=()=>{let e=Ce||L;O&&(e?O.setAttribute(`data-instant`,``):O.removeAttribute(`data-instant`));let t=H();t&&(e?t.setAttribute(`data-instant`,``):t.removeAttribute(`data-instant`));let n=U();n&&(e?n.setAttribute(`data-instant`,``):n.removeAttribute(`data-instant`))},Fe=()=>{Ne(),be=requestAnimationFrame(()=>{be=null,L=!1,Pe()})},Ie=()=>{Ne(),Ce=!1,L=!1,Pe()},Le=()=>{let e=V;!e||!O||(Ie(),Me(),xe=0,Se=0,O.hidden=!0,O.style.pointerEvents=`none`,e.popup.hidden=!0,e.popup.style.pointerEvents=`none`,e.popupPortal.restore(),e.generatedPopup&&je(e.popup),e.generatedPositioner&&je(e.positioner),e.generatedPortal&&je(e.portal),e.popupPresence.cleanup(),e.viewportPresence.cleanup(),V=null)},Re=()=>{if(!O)return null;if(V)return V;let e=Oe(),t=e.popup,n=e.positioner,r=e.portal,a=!1,s=!1,c=!1;(!t||!t.contains(O))&&(t=Ae(O,`navigation-menu-popup`),a=!0),(!n||!n.contains(t))&&(n=Ae(t,`navigation-menu-positioner`),s=!0),(!r||!r.contains(n))&&(r=Ae(n,`navigation-menu-portal`),c=!0);let l=i({content:t,root:m,enabled:!0,container:n,mountTarget:r}),u={popup:t,positioner:n,portal:r,popupPortal:l,popupPresence:null,viewportPresence:null,generatedPopup:a,generatedPositioner:s,generatedPortal:c,isClosing:!1,popupExitComplete:!1,viewportExitComplete:!1},d=o({element:O,onExitComplete:()=>{u.viewportExitComplete=!0,ke(u)}});return u.popupPresence=o({element:t,onExitComplete:()=>{u.popupExitComplete=!0,ke(u)}}),u.viewportPresence=d,V=u,V},ze=e=>{if(!O)return;let t=Te.get(e)??{originalParent:null,originalNextSibling:null,mountedInViewport:!1};t.mountedInViewport||(t.originalParent=e.parentNode,t.originalNextSibling=e.nextSibling,t.mountedInViewport=!0,Te.set(e,t)),e.parentNode!==O&&O.appendChild(e)},Be=e=>{let t=Te.get(e);if(!t||!t.mountedInViewport)return;let n=t.originalParent,r=t.originalNextSibling;n&&n.isConnected?r&&r.parentNode===n?n.insertBefore(e,r):n.appendChild(e):e.remove(),t.mountedInViewport=!1,t.originalParent=null,t.originalNextSibling=null},Ve=()=>{if(!O)return;let e=U();if(!e)return;let t=m.ownerDocument.defaultView??window,n=m.getBoundingClientRect(),r=C===`fixed`,i=n.top+Se+(r?0:t.scrollY),a=n.left+xe+(r?0:t.scrollX);e.style.position=C,e.style.top=`${i}px`,e.style.left=`${a}px`,e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.margin=`0`,e.style.willChange=`top,left`,e.style.pointerEvents=`none`},He=null,Ue=e=>{He?.disconnect(),He=null,!(!O||!e)&&(He=new ResizeObserver(()=>{let t=We(e.item,e.content);It(e.content,e.trigger,t)}),He.observe(e.content))};R.push(()=>He?.disconnect()),R.push(()=>{Ie(),we.forEach(e=>e.cleanup()),we.clear(),Te.forEach((e,t)=>{Be(t),t.hidden=!0,t.style.pointerEvents=`none`}),Te.clear(),Le()});let W=new Map,We=(e,t)=>({side:h.side??u(t,`side`,re)??u(e,`side`,re)??oe,align:h.align??u(t,`align`,ne)??u(e,`align`,ne)??se,sideOffset:h.sideOffset??d(t,`sideOffset`)??d(e,`sideOffset`)??ce,alignOffset:h.alignOffset??d(t,`alignOffset`)??d(e,`alignOffset`)??le}),Ge=0;D.forEach(e=>{let t=e.dataset.value;if(!t)return;let n=f(e,`navigation-menu-trigger`),r=f(e,`navigation-menu-content`);if(n&&r){W.set(t,{value:t,item:e,trigger:n,content:r,index:Ge++}),we.set(r,o({element:r,onExitComplete:()=>{ye||(De(r,!1),B(r,null),r.removeAttribute(`data-motion`),Be(r),r.hidden=!0,r.style.pointerEvents=`none`)}}));let i=pe(t),a=c(n,`nav-menu-trigger-${i}`),s=c(r,`nav-menu-content-${i}`);n.setAttribute(`aria-haspopup`,`true`),n.setAttribute(`aria-controls`,s),r.setAttribute(`aria-labelledby`,a)}});let Ke=Array.from(W.values()).map(e=>e.trigger),qe=`a[href], button:not([disabled]), [role="link"], [role="button"], [tabindex]:not([tabindex="-1"])`,Je=e=>{let t=e?.closest(`[data-slot="navigation-menu-item"]`);if(!t)return null;let n=t.dataset.value;if(!n)return null;let r=W.get(n);return!r||r.item!==t?null:r},Ye=e=>{if(e.matches(qe))return e;let t=e.querySelectorAll(qe);for(let n of t)if(e.contains(n)&&!n.closest(`[data-slot="navigation-menu-content"]`)&&!(n.hidden||n.closest(`[hidden]`)))return n;return null},G=[],Xe=new Map;D.forEach(e=>{let t=Je(e);if(t){let e={kind:`submenu`,element:t.trigger,item:t.item,value:t.value,trigger:t.trigger};G.push(e),Xe.set(e.element,e),Xe.set(e.item,e);return}let n=Ye(e);if(!n)return;let r={kind:`plain`,element:n};G.push(r),Xe.set(r.element,r)});let Ze=e=>{let t=e instanceof HTMLElement?e:null;if(!t)return null;let n=t;for(;n&&n!==E;){let e=Xe.get(n);if(e)return e;n=n.parentElement}return null},Qe=e=>{let t=Ze(e);return t?.kind===`plain`?t:null},$e=e=>{let t=Ze(e);return t?.kind===`submenu`?t:null},et=()=>{let e=m.ownerDocument.defaultView;if(!e?.matchMedia)return!0;try{return e.matchMedia(`(any-hover: hover)`).matches}catch{return!0}},tt=e=>{try{return e.matches(`:hover`)}catch{return!1}},nt=()=>{for(let e of G){if(e.kind===`submenu`){if(tt(e.item)||tt(e.trigger))return e;continue}if(tt(e.element))return e}return null},rt=(e,t={})=>{let n=m.ownerDocument,r=t.preserveOpenOnPlain??!1;return e.kind===`submenu`?(e.trigger.focus(),n.activeElement===e.trigger?(Z(e.trigger),!0):!1):(A!==null&&!r&&$(),e.element.focus(),n.activeElement===e.element?(A!==null&&r?Z():X(e.element),!0):!1)},it=(e,t,n={})=>{for(let r=e+t;r>=0&&r<G.length;r+=t){let e=G[r];if(e&&rt(e,n))return!0}return!1},at=(e,t,n={})=>{let r=G.indexOf(e);return r===-1?!1:it(r,t,n)},ot=(e,t,n={})=>{let r=G.findIndex(t=>t.kind===`submenu`&&t.trigger===e);return r===-1?!1:it(r,t,n)},st=e=>{if(!(e instanceof Node)||!E.contains(e))return!1;let t=e instanceof HTMLElement?e:e.parentElement;return!t||t.closest(`[data-slot="navigation-menu-indicator"]`)||Je(t)?!1:t.closest(`[data-slot="navigation-menu-item"]`)?!0:!!t.closest(`a[href], button, [role='link'], [role='button']`)},ct=`a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])`,lt=e=>Array.from(e.querySelectorAll(ct)).filter(e=>!e.hidden&&!e.closest(`[hidden]`)),ut=e=>!e.isConnected||e.hidden||e.closest(`[hidden]`)||`disabled`in e&&e.disabled||e.getAttribute(`aria-hidden`)===`true`||e.getAttribute(`tabindex`)===`-1`?!1:e.matches(ct)?!0:e.tabIndex>=0,dt=e=>{if(m.contains(e)||O?.contains(e)||H()?.contains(e)||U()?.contains(e))return!0;for(let{content:t}of W.values())if(t.contains(e))return!0;return!1},ft=()=>{let e=m.ownerDocument,t=Array.from(e.querySelectorAll(`*`));for(let n of t)if(ut(n)&&!dt(n)&&(m.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0&&(n.focus(),e.activeElement===n))return!0;return!1},pt=e=>{requestAnimationFrame(()=>{if(A!==e)return;let t=W.get(e);if(!t)return;let n=lt(t.content)[0];n?n.focus():t.content.focus()})},K=()=>{me&&=(clearTimeout(me),null),he&&=(clearTimeout(he),null)},q=()=>{K(),j=null},mt=()=>{_e=null,ve=null},ht=()=>{I!==null&&(cancelAnimationFrame(I),I=null)},J=null,gt=()=>O?U()||H()||(O.parentElement instanceof HTMLElement?O.parentElement:O):null,_t=()=>{let e=gt();return J||(J=document.createElement(`div`),J.setAttribute(`data-slot`,`navigation-menu-bridge`),J.style.cssText=`position: absolute; pointer-events: auto; z-index: 0; display: none;`,R.push(g(J,`pointerenter`,()=>{K()}),g(J,`pointerleave`,e=>{if(N||A===null)return;let t=e.relatedTarget;Nt(t)||t&&n(m,t)||(Q(null),X(null))}))),e&&J.parentElement!==e&&e.insertBefore(J,e.firstChild),J},vt=()=>{J&&(J.style.height=`0`,J.style.width=`0`,J.style.top=`0px`,J.style.left=`0px`,J.style.right=`0px`,J.style.bottom=`auto`,J.style.transform=`none`,J.style.clipPath=`none`,J.style.display=`none`)},yt=()=>{if(!w)return null;let e=m.ownerDocument.body;return e?(F||(F=m.ownerDocument.createElement(`div`),F.setAttribute(`data-slot`,`navigation-menu-safe-triangle`),F.style.cssText=[`position: fixed`,`pointer-events: none`,`display: none`,`z-index: 2147483647`,`background: rgba(255, 0, 0, 0.18)`,`border: 1px solid rgba(255, 0, 0, 0.45)`].join(`; `)),F.parentElement!==e&&e.appendChild(F),F):null},bt=()=>{F&&(F.style.width=`0`,F.style.height=`0`,F.style.clipPath=`none`,F.style.display=`none`)},Y=()=>{w||bt()},xt=e=>{let t=yt();if(!t)return;let n=e.apex.x,r=e.apex.y,i=e.edgeA.x,a=e.edgeA.y,o=e.edgeB.x,s=e.edgeB.y,c=Math.min(n,i,o),l=Math.min(r,a,s),u=Math.max(n,i,o),d=Math.max(r,a,s),f=Math.max(1,u-c),p=Math.max(1,d-l),m=(e,t)=>`${(e-c)/f*100}% ${(t-l)/p*100}%`;t.style.display=`block`,t.style.left=`${c}px`,t.style.top=`${l}px`,t.style.width=`${f}px`,t.style.height=`${p}px`,t.style.clipPath=`polygon(${m(n,r)}, ${m(i,a)}, ${m(o,s)})`},St=(e,t,n)=>(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y),Ct=(e,t,n,r)=>{let i=St(e,t,n),a=St(e,n,r),o=St(e,r,t);return!((i<0||a<0||o<0)&&(i>0||a>0||o>0))},wt=(e,t,n)=>{let r=.5;if(n.top>=t.bottom-r)return[{x:n.left,y:n.top},{x:n.right,y:n.top}];if(n.bottom<=t.top+r)return[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}];if(n.left>=t.right-r)return[{x:n.left,y:n.top},{x:n.left,y:n.bottom}];if(n.right<=t.left+r)return[{x:n.right,y:n.top},{x:n.right,y:n.bottom}];let i=[[{x:n.left,y:n.top},{x:n.right,y:n.top}],[{x:n.right,y:n.top},{x:n.right,y:n.bottom}],[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}],[{x:n.left,y:n.top},{x:n.left,y:n.bottom}]],a=([t,n])=>t.y===n.y?Math.abs(e.y-t.y):Math.abs(e.x-t.x),o=i[0],s=a(o);for(let e=1;e<i.length;e++){let t=i[e],n=a(t);n<s&&(o=t,s=n)}return o},Tt=()=>A?W.get(A)??null:null,Et=(e,t,n)=>{if(n.width<=0||n.height<=0)return null;let r={x:e.left+e.width/2,y:e.top+e.height*.62},[i,a]=wt(r,t,n);if(i.x===a.x){let e=Math.min(i.y,a.y),t=Math.max(i.y,a.y),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:i.x,y:e+r},a={x:a.x,y:t-r}}else{let e=Math.min(i.x,a.x),t=Math.max(i.x,a.x),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:e+r,y:i.y},a={x:t-r,y:a.y}}return{apex:r,edgeA:i,edgeB:a}},Dt=()=>{if(!de||!O||A===null)return null;let e=Tt();if(!e)return null;let t=m.getBoundingClientRect(),n=e.trigger.getBoundingClientRect(),r=O.getBoundingClientRect(),i=e.content.getBoundingClientRect();return Et(n,t,r.width>0&&r.height>0?r:i)},Ot=e=>{let t=Dt();return t?Ct({x:e.clientX,y:e.clientY},t.apex,t.edgeA,t.edgeB):!1},kt=(e,t)=>({x:e.x-t.left,y:e.y-t.top}),At=e=>{if(e.length<=1)return e.slice();let t=e=>`${e.x.toFixed(3)}:${e.y.toFixed(3)}`,n=new Map;for(let r of e)n.set(t(r),r);let r=Array.from(n.values()).sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x);if(r.length<=2)return r;let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=[];for(let e of r){for(;a.length>=2&&i(a[a.length-2],a[a.length-1],e)<=0;)a.pop();a.push(e)}let o=[];for(let e=r.length-1;e>=0;e--){let t=r[e];for(;o.length>=2&&i(o[o.length-2],o[o.length-1],t)<=0;)o.pop();o.push(t)}return a.pop(),o.pop(),a.concat(o)},jt=e=>{if(e.length<3){vt();return}let t=_t(),n=t.parentElement,r=At(n&&n===U()?e.map(e=>({x:e.x-xe,y:e.y-Se})):e);if(r.length<3){vt();return}let i=Math.min(...r.map(e=>e.x)),a=Math.min(...r.map(e=>e.y)),o=Math.max(...r.map(e=>e.x)),s=Math.max(...r.map(e=>e.y)),c=Math.max(1,o-i),l=Math.max(1,s-a),u=e=>`${(e.x-i)/c*100}% ${(e.y-a)/l*100}%`;t.style.display=`block`,t.style.transform=`none`,t.style.bottom=`auto`,t.style.right=`auto`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.width=`${c}px`,t.style.height=`${l}px`,t.style.clipPath=`polygon(${r.map(u).join(`, `)})`},Mt=()=>{if(!w)return;let e=Dt();if(!e){bt();return}xt(e)},Nt=e=>e?!!(Tt()?.content.contains(e)||O?.contains(e)||H()?.contains(e)||J?.contains(e)||U()?.contains(e)):!1;R.push(Y),R.push(ht),R.push(vt),R.push(()=>{bt(),F?.parentElement&&F.parentElement.removeChild(F),F=null});let Pt=(e,t,n,r,i,a)=>{let o=m.ownerDocument.defaultView??window,s=o.visualViewport,c=s?.offsetLeft??0,l=s?.offsetTop??0,u=s?.width??o.innerWidth,d=s?.height??o.innerHeight,f=n===`left`?Math.max(0,t.left-c-r):n===`right`?Math.max(0,c+u-t.right-r):Math.max(0,u),p=n===`top`?Math.max(0,t.top-l-r):n===`bottom`?Math.max(0,l+d-t.bottom-r):Math.max(0,d);e.style.setProperty(`--positioner-width`,`${i}px`),e.style.setProperty(`--positioner-height`,`${a}px`),e.style.setProperty(`--available-width`,`${f}px`),e.style.setProperty(`--available-height`,`${p}px`)},Ft=(e,n,r)=>{let i=Re();if(!O||!i)return;let{popup:a,positioner:o}=i;if(O.getAttribute(`data-state`)!==`open`||e.getAttribute(`data-state`)!==`active`)return;let s=e.firstElementChild,c=e.lastElementChild,l=s?getComputedStyle(s):null,u=c?getComputedStyle(c):null,d=l&&parseFloat(l.marginTop)||0,f=u&&parseFloat(u.marginBottom)||0,p=(...e)=>{let t=0;for(let n of e)Number.isFinite(n)&&(t=Math.max(t,n));return t},h=e.getBoundingClientRect(),g=p(h.width,e.scrollWidth,e.offsetWidth,e.clientWidth),_=p(h.height,e.scrollHeight,e.offsetHeight,e.clientHeight)+d+f,ee={top:h.top,left:h.left,width:g,height:_,right:h.left+g,bottom:h.top+_},te=getComputedStyle(O),ne=parseFloat(te.marginTop)||0;O.style.setProperty(`--viewport-width`,`${g}px`),O.style.setProperty(`--viewport-height`,`${_}px`);let v=m.getBoundingClientRect(),y=n.getBoundingClientRect(),b=t({anchorRect:y,contentRect:ee,side:r.side,align:r.align,sideOffset:r.sideOffset,alignOffset:r.alignOffset,avoidCollisions:!1,collisionPadding:0,allowedSides:re}),x=b.x-v.left,S=b.y-v.top;xe=x,Se=S;let ae=ie(b.side,b.align,y),oe=ae.x-(v.left+x),se=ae.y-(v.top+S),ce=ae.x-v.left,le=ae.y-v.top,C=`${oe}px ${se}px`,ue=`${ce}px ${le}px`;a.style.position=`absolute`,a.style.top=`0px`,a.style.left=`0px`,a.style.willChange=`width,height`,a.style.pointerEvents=`auto`,a.style.setProperty(`--popup-width`,`${g}px`),a.style.setProperty(`--popup-height`,`${_}px`),a.style.setProperty(`--transform-origin`,C),O.style.top=`0px`,O.style.left=`0px`,O.style.willChange=`transform,width,height`,O.style.setProperty(`--transform-origin`,C),e.style.top=`0px`,e.style.left=`0px`,e.style.setProperty(`--transform-origin`,C),a.setAttribute(`data-side`,b.side),a.setAttribute(`data-align`,b.align),O.setAttribute(`data-side`,b.side),O.setAttribute(`data-align`,b.align),e.setAttribute(`data-side`,b.side),e.setAttribute(`data-align`,b.align),o.setAttribute(`data-side`,b.side),o.setAttribute(`data-align`,b.align),o.style.setProperty(`--transform-origin`,ue),Pt(o,y,b.side,r.sideOffset,g,_),Ve();let w=O.getBoundingClientRect(),fe=[],pe=Math.max(0,w.top-v.bottom),T=Math.max(0,v.top-w.bottom),E=Math.max(0,w.left-v.right),D=Math.max(0,v.left-w.right),k=Math.max(0,d+ne),A=Math.max(pe,T,k),j=Math.max(E,D),M=de?Et(y,v,w):null,me=(e,t,n,r)=>{n<=0||r<=0||fe.push({x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r})};if(A>=j&&A>0){let e=Math.max(pe,T,k),t=x,n=T>pe&&T>=k?S+_:S-e,r=g;if(M){let e=Math.min(M.edgeA.x,M.edgeB.x)-v.left,n=Math.max(M.edgeA.x,M.edgeB.x)-v.left;t=e-8,r=n-e+16}me(t,n,r,e)}else if(j>0){let e=Math.max(E,D),t=S,n=D>E?x+g:x-e,r=_;if(M){let e=Math.min(M.edgeA.y,M.edgeB.y)-v.top,n=Math.max(M.edgeA.y,M.edgeB.y)-v.top;t=e-8,r=n-e+16}me(n,t,e,r)}if(M){let e=kt(M.apex,v),t=kt(M.edgeA,v),n=kt(M.edgeB,v);fe.push(e,t,n)}jt(fe),Mt()},It=(e,t,n,r={})=>{if(!O)return;let i=()=>{Ft(e,t,n)};if(r.defer===!1){i();return}requestAnimationFrame(()=>{O.getAttribute(`data-state`)!==`open`||e.getAttribute(`data-state`)!==`active`||i()})},Lt=(e=Tt(),t={})=>{if(!e)return;let n=We(e.item,e.content);It(e.content,e.trigger,n,t)},Rt=a({observedElements:[m,...Ke],isActive:()=>A!==null,ancestorScroll:!0,syncOnScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,onUpdate:()=>{L=!0,Pe(),Lt(void 0,{defer:!1}),Fe()}});R.push(()=>Rt.stop());let zt=e=>M===-1||e>M?`right`:`left`,X=e=>{if(!k)return;if(ge=e,!e){ht(),k.removeAttribute(`data-instant`),k.setAttribute(`data-state`,`hidden`);return}k.getAttribute(`data-state`)!==`visible`&&(ht(),k.setAttribute(`data-instant`,``),I=requestAnimationFrame(()=>{I=requestAnimationFrame(()=>{k.removeAttribute(`data-instant`),I=null})}));let t=E.getBoundingClientRect(),n=e.getBoundingClientRect();k.style.setProperty(`--indicator-left`,`${n.left-t.left}px`),k.style.setProperty(`--indicator-width`,`${n.width}px`),k.style.setProperty(`--indicator-top`,`${n.top-t.top}px`);let r=(O&&parseFloat(getComputedStyle(O).marginTop)||0)<1?1:0;k.style.setProperty(`--indicator-height`,`${n.height-r}px`),k.setAttribute(`data-state`,`visible`)},Bt=()=>A?W.get(A)?.trigger??null:null,Z=(e=null)=>{let t=Bt();if(t){X(t);return}X(e)},Q=(e,t=!1)=>{if(Y(),e===A){e===null?q():K();return}if(!t&&e!==null&&e===j)return;K(),j=e===null?null:e;let r=()=>{let t=A,r=e?W.get(e):null,i=t!==null&&e!==null&&t!==e,a=i&&r?zt(r.index):null,o=document.activeElement;if(e===null&&o&&t){let e=W.get(t);e&&n(e.content,o)&&e.trigger.focus()}if(W.forEach(({trigger:n,content:r,item:i},o)=>{let s=o===e,c=o===t;if(ee(n,`expanded`,s),n.setAttribute(`data-state`,s?`open`:`closed`),i.setAttribute(`data-state`,s?`open`:`closed`),!s){let t=we.get(r);if(De(r,!1),r.setAttribute(`aria-hidden`,`true`),T(r,!0),r.style.pointerEvents=`none`,e===null)c&&(B(r,null),r.removeAttribute(`data-motion`));else if(c&&a){B(r,a);let e=a===`right`?`to-left`:`to-right`;r.setAttribute(`data-motion`,e)}else c&&(B(r,null),r.removeAttribute(`data-motion`));c?t?.exit():t?.isExiting||(B(r,null),r.removeAttribute(`data-motion`),Be(r),r.hidden=!0)}}),r){let e=Re();if(e?.popupPortal.mount(),e&&(e.isClosing=!1,e.popupExitComplete=!1,e.viewportExitComplete=!1),e?.popup&&(e.popup.hidden=!1,e.popup.style.pointerEvents=`auto`),O&&(O.hidden=!1),t===null&&(e?.popupPresence.enter(),e?.viewportPresence.enter()),ze(r.content),we.get(r.content)?.enter(),Rt.start(),a){B(r.content,a);let e=a===`right`?`from-right`:`from-left`;r.content.setAttribute(`data-motion`,e)}else B(r.content,null),r.content.removeAttribute(`data-motion`);De(r.content,!0),r.content.removeAttribute(`aria-hidden`),T(r.content,!1),r.content.hidden=!1,r.content.style.pointerEvents=`auto`,M=r.index,Lt(r),Ue(r),X(r.trigger)}else Rt.stop(),vt(),Y(),V&&(V.isClosing=!0,V.popupExitComplete=!1,V.viewportExitComplete=!1,V.popupPresence.exit(),V.viewportPresence.exit()),Ue(null);let c=e!==null;if(z(m,c),a?m.setAttribute(`data-motion`,a===`right`?`from-right`:`from-left`):m.removeAttribute(`data-motion`),O){let e=H();z(U(),c),z(e,c),z(O,c),O.style.pointerEvents=c?`auto`:`none`,Ce=c&&!i,(!c||i)&&(Ne(),L=!1),Pe(),a?O.style.setProperty(`--motion-direction`,a===`right`?`1`:`-1`):O.style.removeProperty(`--motion-direction`)}A=e,j=null,e===null&&X(null),Mt(),s(m,`navigation-menu:change`,{value:e}),fe?.(e)};t?r():e!==null&&A===null?me=setTimeout(r,x):e!==null&&A!==null?r():he=setTimeout(r,S)},Vt=Oe();z(m,!1),O&&(z(Vt.positioner,!1),z(Vt.popup,!1),z(O,!1),O.hidden=!0,O.style.pointerEvents=`none`,Vt.popup&&(Vt.popup.hidden=!0,Vt.popup.style.pointerEvents=`none`)),k&&k.setAttribute(`data-state`,`hidden`),W.forEach(({trigger:e,content:t,item:n})=>{e.tagName===`BUTTON`&&!e.hasAttribute(`type`)&&(e.type=`button`),ee(e,`expanded`,!1),e.setAttribute(`data-state`,`closed`),e.tabIndex=0,n.setAttribute(`data-state`,`closed`),De(t,!1),t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,T(t,!0),t.hidden=!0,t.style.pointerEvents=`none`}),W.forEach(({item:e,trigger:t},r)=>{R.push(g(t,`pointerenter`,e=>{if(!N){if(A!==r&&Ot(e))return;X(t)}})),R.push(g(e,`pointerenter`,e=>{if(!N){if(A!==r&&Ot(e))return;Q(r)}})),R.push(g(e,`pointerleave`,e=>{if(j===r&&A===null&&q(),A===r&&!N){let t=e.relatedTarget;if(Nt(t))return;(!t||!n(m,t))&&(Q(null),X(null))}})),R.push(g(t,`focus`,()=>{if(_e===t){_e=null;return}ae&&Q(r,!0),Z(t)})),R.push(g(t,`pointerdown`,()=>{_e=t,ve=t}),g(t,`keydown`,()=>{ve=null})),R.push(g(t,`click`,()=>{let e=ve===t;ve=null,_e=null,q(),A===r&&N?(N=!1,Q(null,!0),X(null)):A===r&&!N?(N=!0,X(t),e||pt(r)):(N=!0,Q(r,!0),X(t),e||pt(r))}))}),R.push(g(E,`pointerover`,e=>{let t=e;if(t.pointerType===`touch`)return;let n=$e(t.target);if(n){if(P=!0,N||A!==n.value&&Ot(t))return;X(n.trigger),Q(n.value);return}let r=Qe(t.target);if(r){if(P=!0,A!==null){if(N)return;$()}X(r.element);return}A!==null&&(N||st(t.target)&&$())}),g(E,`click`,e=>{A!==null&&st(e.target)&&$()})),R.push(g(E,`focusin`,e=>{let t=Qe(e.target);if(t){if(A!==null){Z();return}X(t.element)}}),g(m,`pointerenter`,()=>{P=!0}),g(m,`pointerleave`,e=>{let t=e.relatedTarget;if(!Nt(t)&&(P=!1,!N)){if(Ot(e)){K();return}Q(null),X(null)}}),g(m,`pointerdown`,()=>{Y(),q()}));let Ht=()=>{if(!et()||A!==null||j!==null||N)return;let e=nt();if(P=e!==null||m instanceof HTMLElement&&tt(m),e){if(e.kind===`submenu`){Q(e.value,!0);return}X(e.element)}};O&&R.push(g(O,`pointerenter`,()=>{Y(),K()}),g(O,`transitionend`,e=>{if(e.target!==O)return;let t=A?W.get(A):null;if(t){let e=We(t.item,t.content);It(t.content,t.trigger,e)}})),W.forEach(({content:e})=>{R.push(g(e,`pointerenter`,()=>{Y(),K()}),g(e,`pointerleave`,e=>{if(N)return;let t=e.relatedTarget;Nt(t)||n(m,t)||(Q(null),X(null))}))}),R.push(g(E,`keydown`,e=>{let t=Ze(e.target);if(!t)return;let n=G.indexOf(t);if(n===-1)return;let r=n;switch(e.key){case`Tab`:if(e.shiftKey||A===null)return;(at(t,1,{preserveOpenOnPlain:!0})||ft())&&e.preventDefault();return;case`ArrowLeft`:r=n-1,r<0&&(r=G.length-1);break;case`ArrowRight`:r=n+1,r>=G.length&&(r=0);break;case`ArrowDown`:if(t.kind===`submenu`){e.preventDefault();let n=t.value;N=!0,Q(n,!0),pt(n)}return;case`Home`:r=0;break;case`End`:r=G.length-1;break;case`Escape`:N=!1,Q(null,!0),X(null);return;default:return}e.preventDefault();let i=G[r];i&&rt(i,{preserveOpenOnPlain:!0})})),W.forEach(({content:e,trigger:t})=>{R.push(g(e,`keydown`,n=>{let r=n.target,i=lt(e),a=i.indexOf(r);if(a!==-1)switch(n.key){case`Tab`:if(!n.shiftKey&&a===i.length-1){(ot(t,1,{preserveOpenOnPlain:!0})||ft())&&n.preventDefault();return}if(n.shiftKey&&a===0){n.preventDefault(),t.focus();return}return;case`ArrowDown`:case`ArrowRight`:{n.preventDefault();let e=a+1;e<i.length&&i[e]?.focus();break}case`ArrowUp`:case`ArrowLeft`:n.preventDefault(),a===0?t.focus():i[a-1]?.focus();break;case`Escape`:n.preventDefault(),N=!1,Q(null,!0),X(null),t.focus();break}}))});let Ut=()=>n(m,document.activeElement)||P||N,$=()=>{Y(),q(),mt(),N=!1,Q(null,!0),X(null),Mt()};R.push(g(document,`focusin`,e=>{let t=e.target;if(!n(m,t)){if(A!==null){$();return}X(null)}})),R.push(r({root:m,isOpen:()=>A!==null&&Ut(),onDismiss:$,closeOnClickOutside:!0,closeOnEscape:!0,preventEscapeDefault:!1,isInside:e=>!!e&&n(m,e)})),R.push(g(window,`resize`,()=>{(A||ge)&&requestAnimationFrame(()=>Z(ge))}),g(E,`scroll`,()=>{(A||ge)&&requestAnimationFrame(()=>Z(ge))})),R.push(g(m,`navigation-menu:set`,e=>{let t=e.detail;if(t?.value!==void 0){if(t.value===null)$();else if(W.has(t.value)){N=!0,Q(t.value,!0);let e=W.get(t.value);e&&X(e.trigger)}}}));let Wt={get value(){return A},open:e=>Q(e,!0),close:()=>$(),destroy:()=>{ye=!0,q(),mt(),R.forEach(e=>e()),R.length=0,e(m,b,Wt)}};return Ht(),te(m,b,Wt),Wt}function S(e=document){let t=[];for(let n of m(e,`navigation-menu`))h(n,b)||t.push(x(n));return t}export{S as create,x as createNavigationMenu};
|
|
1
|
+
import{clearRootBinding as e,computeFloatingPosition as t,containsWithPortals as n,createDismissLayer as r,createPortalLifecycle as i,createPositionSync as a,createPresenceLifecycle as o,emit as s,ensureId as c,getDataBool as l,getDataEnum as u,getDataNumber as d,getPart as f,getParts as ee,getRoots as p,hasRootBinding as m,on as h,reuseRootBinding as te,setAria as g,setRootBinding as ne}from"@data-slot/core";const _=[`start`,`center`,`end`],re=[`top`,`right`,`bottom`,`left`],v=[`absolute`,`fixed`],y=(e,t)=>t===`start`?{x:e.left,y:e.top}:t===`end`?{x:e.right,y:e.bottom}:{x:e.left+e.width/2,y:e.top+e.height/2},ie=(e,t,n)=>{let r=y(n,t);return e===`top`?{x:r.x,y:n.top}:e===`bottom`?{x:r.x,y:n.bottom}:e===`left`?{x:n.left,y:r.y}:{x:n.right,y:r.y}},b=e=>{let t=getComputedStyle(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;if(e instanceof HTMLElement){let t=e.offsetWidth||n,i=e.offsetHeight||r;(Math.round(n)!==t||Math.round(r)!==i)&&(n=t,r=i)}return{width:n,height:r}},x=`@data-slot/navigation-menu`;function ae(p,m={}){let y=te(p,x,`[@data-slot/navigation-menu] createNavigationMenu() called more than once for the same root. Returning the existing controller. Destroy it before rebinding with new options.`);if(y)return y;let ae=m.delayOpen??d(p,`delayOpen`)??0,oe=m.delayClose??d(p,`delayClose`)??0,se=m.openOnFocus??l(p,`openOnFocus`)??!1,S=m.side??u(p,`side`,re)??`bottom`,ce=m.align??u(p,`align`,_)??`start`,C=m.sideOffset??d(p,`sideOffset`)??0,le=m.alignOffset??d(p,`alignOffset`)??0,w=m.positionMethod??u(p,`positionMethod`,v)??`absolute`,ue=m.safeTriangle??l(p,`safeTriangle`)??!1,de=m.debugSafeTriangle??l(p,`debugSafeTriangle`)??!1,fe=ue||de,pe=m.onValueChange,me=e=>e.replace(/[^a-z0-9\-_:.]/gi,`-`),he=(e,t)=>{`inert`in e&&(e.inert=t)},T=f(p,`navigation-menu-list`),ge=ee(p,`navigation-menu-item`),E=f(p,`navigation-menu-viewport`),D=f(p,`navigation-menu-indicator`);if(!T||ge.length===0)throw Error(`NavigationMenu requires navigation-menu-list and at least one navigation-menu-item`);let O=null,k=null,A=-1,_e=null,ve=null,j=null,M=!1,ye=null,N=null,P=!1,be=!1,F=null,xe=null,Se=null,Ce=0,we=0,Te=!1,I=!1,L=[],Ee=new Map,De=new Map,Oe=new WeakMap,ke=new Map,Ae=(e,t)=>{if(e){if(t){e.setAttribute(`data-open`,``),e.removeAttribute(`data-closed`);return}e.setAttribute(`data-closed`,``),e.removeAttribute(`data-open`)}},R=(e,t)=>{e&&(e.setAttribute(`data-state`,t?`open`:`closed`),Ae(e,t))},je=(e,t)=>{e.setAttribute(`data-state`,t?`active`:`inactive`),Ae(e,t)},z=(e,t)=>{if(t){e.setAttribute(`data-activation-direction`,t);return}e.removeAttribute(`data-activation-direction`)},Me=()=>{if(!E)return{popup:null,positioner:null,portal:null};let e=null,t=null,n=null,r=E.parentElement,i=`popup`;for(;r&&r!==p;){let a=r.getAttribute(`data-slot`);if(a===`navigation-menu-portal`){n=r;break}if(i===`popup`&&a===`navigation-menu-popup`){e=r,i=`positioner`,r=r.parentElement;continue}if((i===`popup`||i===`positioner`)&&(a===`navigation-menu-positioner`||a===`navigation-menu-viewport-positioner`)){t=r,i=`portal`,r=r.parentElement;continue}r=r.parentElement}return{popup:e,positioner:t,portal:n}},B=null,Ne=e=>{be||B!==e||!e.isClosing||!e.popupExitComplete||!e.viewportExitComplete||it()},V={committed:{width:0,height:0},live:{width:0,height:0}},H=null,Pe=null,Fe=null,Ie=e=>{e.width>0&&(V.committed.width=e.width),e.height>0&&(V.committed.height=e.height)},Le=e=>{e.width>0&&(V.live.width=e.width),e.height>0&&(V.live.height=e.height)},Re=()=>{V={committed:{width:0,height:0},live:{width:0,height:0}}},ze=()=>{Fe!==null&&(cancelAnimationFrame(Fe),Fe=null)},Be=(e,t)=>{if(t===`auto`){e.style.setProperty(`--popup-width`,`auto`),e.style.setProperty(`--popup-height`,`auto`);return}e.style.setProperty(`--popup-width`,`${t.width}px`),e.style.setProperty(`--popup-height`,`${t.height}px`)},Ve=(e,t,n)=>{Be(e,{width:t,height:n})},He=(e,t)=>{E&&(E.style.setProperty(`--viewport-width`,`${e}px`),E.style.setProperty(`--viewport-height`,`${t}px`))},Ue=(e,t)=>{if(t===`max-content`){e.style.setProperty(`--positioner-width`,`max-content`),e.style.setProperty(`--positioner-height`,`max-content`);return}e.style.setProperty(`--positioner-width`,`${t.width}px`),e.style.setProperty(`--positioner-height`,`${t.height}px`)},We=(e,t)=>{let n=new Map;for(let[r,i]of Object.entries(t))n.set(r,e.style.getPropertyValue(r)),e.style.setProperty(r,i);return()=>{for(let[t,r]of n)r?e.style.setProperty(t,r):e.style.removeProperty(t)}},Ge=(e,t)=>{let n=We(e.popup,{"--popup-width":`auto`,"--popup-height":`auto`,position:`static`,transform:`none`,scale:`1`,top:``,right:``,bottom:``,left:``}),r=We(e.positioner,{"--positioner-width":`max-content`,"--positioner-height":`max-content`,"--available-width":`max-content`,"--available-height":`max-content`}),i=b(e.popup);return r(),n(),i},Ke=()=>{let e=W();if(!e)return{...V.committed};let t=b(e),n={width:e.offsetWidth||t.width||V.live.width||V.committed.width,height:e.offsetHeight||t.height||V.live.height||V.committed.height};return Le(n),n},qe=()=>{let e=V.committed;if(e.width<=0||e.height<=0)return!1;let t=Ke();return Math.abs(t.width-e.width)>1||Math.abs(t.height-e.height)>1},U=(e,t)=>{if(t){let t=De.get(e)??{applied:!1,left:``,position:``,top:``};t.applied||(t.position=e.style.position,t.top=e.style.top,t.left=e.style.left),t.applied=!0,De.set(e,t),e.style.position=`absolute`,e.style.top=`0px`,e.style.left=`0px`;return}let n=De.get(e);n?.applied&&(n.position?e.style.position=n.position:e.style.removeProperty(`position`),n.top?e.style.top=n.top:e.style.removeProperty(`top`),n.left?e.style.left=n.left:e.style.removeProperty(`left`),n.applied=!1)},Je=e=>{let t=Oe.get(e);t?.applied&&(t.position?e.style.position=t.position:e.style.removeProperty(`position`),t.top?e.style.top=t.top:e.style.removeProperty(`top`),t.right?e.style.right=t.right:e.style.removeProperty(`right`),t.bottom?e.style.bottom=t.bottom:e.style.removeProperty(`bottom`),t.left?e.style.left=t.left:e.style.removeProperty(`left`),t.applied=!1)},Ye=(e,t)=>{if(t===null){Je(e);return}let n=Oe.get(e)??{applied:!1,bottom:``,left:``,position:``,right:``,top:``};if(n.applied||(n.position=e.style.position,n.top=e.style.top,n.right=e.style.right,n.bottom=e.style.bottom,n.left=e.style.left),n.applied=!0,Oe.set(e,n),t===`top`){e.style.position=`absolute`,e.style.top=``,e.style.right=``,e.style.bottom=`0px`,e.style.left=`0px`;return}e.style.position=`absolute`,e.style.top=`0px`,e.style.right=`0px`,e.style.bottom=``,e.style.left=``},W=()=>B?.popup??Me().popup,G=()=>B?.positioner??Me().positioner,Xe=e=>{H?.disconnect(),H=null,!(!e||typeof ResizeObserver!=`function`)&&(H=new ResizeObserver(t=>{let n=t[0],r=Array.isArray(n?.borderBoxSize)?n?.borderBoxSize[0]?.inlineSize:void 0,i=Array.isArray(n?.borderBoxSize)?n?.borderBoxSize[0]?.blockSize:void 0;Le({width:Math.ceil(r??e.offsetWidth),height:Math.ceil(i??e.offsetHeight)})}),H.observe(e))},Ze=(e,t)=>{let n=(p.ownerDocument??document).createElement(`div`);n.setAttribute(`data-slot`,t),t===`navigation-menu-positioner`&&(n.style.isolation=`isolate`,n.style.zIndex=`50`);let r=e.parentNode;if(!r)throw Error(`NavigationMenu expected popup stack child to have a parent node`);return r.insertBefore(n,e),n.appendChild(e),n},Qe=e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}},$e=()=>{let e=G();e&&(e.style.position=``,e.style.top=``,e.style.left=``,e.style.margin=``,e.style.willChange=``,e.style.pointerEvents=``,e.style.transform=``,e.style.removeProperty(`--transform-origin`),e.style.removeProperty(`--positioner-width`),e.style.removeProperty(`--positioner-height`),e.style.removeProperty(`--available-width`),e.style.removeProperty(`--available-height`));let t=W();t&&(t.style.willChange=``,t.style.pointerEvents=``,Je(t),t.style.removeProperty(`scale`),t.style.removeProperty(`--transform-origin`),t.style.removeProperty(`--popup-width`),t.style.removeProperty(`--popup-height`)),E&&(E.style.top=``,E.style.left=``,E.style.willChange=``,E.style.removeProperty(`--transform-origin`),E.style.removeProperty(`--viewport-width`),E.style.removeProperty(`--viewport-height`))},et=()=>{Se!==null&&(cancelAnimationFrame(Se),Se=null)},tt=()=>{let e=Te||I;E&&(e?E.setAttribute(`data-instant`,``):E.removeAttribute(`data-instant`));let t=W();t&&(e?t.setAttribute(`data-instant`,``):t.removeAttribute(`data-instant`));let n=G();n&&(e?n.setAttribute(`data-instant`,``):n.removeAttribute(`data-instant`))},nt=()=>{et(),Se=requestAnimationFrame(()=>{Se=null,Te=!1,I=!1,tt()})},rt=()=>{et(),Te=!1,I=!1,tt()},it=()=>{let e=B;!e||!E||(ze(),H?.disconnect(),H=null,rt(),$e(),Re(),Ce=0,we=0,E.hidden=!0,E.style.pointerEvents=`none`,e.popup.hidden=!0,e.popup.style.pointerEvents=`none`,e.popupPortal.restore(),e.generatedPopup&&Qe(e.popup),e.generatedPositioner&&Qe(e.positioner),e.generatedPortal&&Qe(e.portal),e.popupPresence.cleanup(),e.viewportPresence.cleanup(),B=null)},at=()=>{if(!E)return null;if(B)return B;let e=Me(),t=e.popup,n=e.positioner,r=e.portal,a=!1,s=!1,c=!1;(!t||!t.contains(E))&&(t=Ze(E,`navigation-menu-popup`),a=!0),(!n||!n.contains(t))&&(n=Ze(t,`navigation-menu-positioner`),s=!0),(!r||!r.contains(n))&&(r=Ze(n,`navigation-menu-portal`),c=!0);let l=i({content:t,root:p,enabled:!0,container:n,mountTarget:r}),u={popup:t,positioner:n,portal:r,popupPortal:l,popupPresence:null,viewportPresence:null,generatedPopup:a,generatedPositioner:s,generatedPortal:c,isClosing:!1,popupExitComplete:!1,viewportExitComplete:!1},d=o({element:E,onExitComplete:()=>{u.viewportExitComplete=!0,Ne(u)}});return u.popupPresence=o({element:t,onExitComplete:()=>{u.popupExitComplete=!0,Ne(u)}}),u.viewportPresence=d,B=u,Xe(t),B},ot=e=>{if(!E)return;let t=ke.get(e)??{originalParent:null,originalNextSibling:null,mountedInViewport:!1};t.mountedInViewport||(t.originalParent=e.parentNode,t.originalNextSibling=e.nextSibling,t.mountedInViewport=!0,ke.set(e,t)),e.parentNode!==E&&E.appendChild(e)},st=e=>{let t=ke.get(e);if(!t||!t.mountedInViewport)return;let n=t.originalParent,r=t.originalNextSibling;n&&n.isConnected?r&&r.parentNode===n?n.insertBefore(e,r):n.appendChild(e):e.remove(),t.mountedInViewport=!1,t.originalParent=null,t.originalNextSibling=null},ct=()=>{if(!E)return;let e=G();if(!e)return;let t=p.ownerDocument.defaultView??window,n=p.getBoundingClientRect(),r=w===`fixed`,i=n.top+we+(r?0:t.scrollY),a=n.left+Ce+(r?0:t.scrollX);e.style.position=w,e.style.top=`${i}px`,e.style.left=`${a}px`,e.style.margin=`0`,e.style.willChange=`top,left`,e.style.pointerEvents=`none`},lt=null,ut=e=>{ze(),Fe=requestAnimationFrame(()=>{if(Fe=null,!E||O===null)return;let t=Jt();if(!t||t.content!==e.content)return;let n=at();if(!n||n.isClosing)return;let r=ft(t.item,t.content);if(n.popup.hasAttribute(`data-starting-style`)||qe()){on(t.content,t.trigger,r,{defer:!1,mode:`sync-current`});return}on(t.content,t.trigger,r,{defer:!1,mode:`measure-target`})})},dt=e=>{lt?.disconnect(),lt=null,Pe?.disconnect(),Pe=null,ze(),!(!E||!e)&&(lt=new ResizeObserver(()=>{ut(e)}),lt.observe(e.content),typeof MutationObserver==`function`&&(Pe=new MutationObserver(()=>{ut(e)}),Pe.observe(e.content,{childList:!0,subtree:!0,characterData:!0})))};L.push(()=>lt?.disconnect()),L.push(()=>Pe?.disconnect()),L.push(ze),L.push(()=>{rt(),Ee.forEach(e=>e.cleanup()),Ee.clear(),ke.forEach((e,t)=>{st(t),U(t,!1),t.hidden=!0,t.style.pointerEvents=`none`}),De.clear(),ke.clear(),H?.disconnect(),H=null,it()});let K=new Map,ft=(e,t)=>({side:m.side??u(t,`side`,re)??u(e,`side`,re)??S,align:m.align??u(t,`align`,_)??u(e,`align`,_)??ce,sideOffset:m.sideOffset??d(t,`sideOffset`)??d(e,`sideOffset`)??C,alignOffset:m.alignOffset??d(t,`alignOffset`)??d(e,`alignOffset`)??le}),pt=0;ge.forEach(e=>{let t=e.dataset.value;if(!t)return;let n=f(e,`navigation-menu-trigger`),r=f(e,`navigation-menu-content`);if(n&&r){K.set(t,{value:t,item:e,trigger:n,content:r,index:pt++}),Ee.set(r,o({element:r,onExitComplete:()=>{be||(je(r,!1),z(r,null),r.removeAttribute(`data-motion`),U(r,!1),st(r),r.hidden=!0,r.style.pointerEvents=`none`)}}));let i=me(t),a=c(n,`nav-menu-trigger-${i}`),s=c(r,`nav-menu-content-${i}`);n.setAttribute(`aria-haspopup`,`true`),n.setAttribute(`aria-controls`,s),r.setAttribute(`aria-labelledby`,a)}});let mt=Array.from(K.values()).map(e=>e.trigger),ht=`a[href], button:not([disabled]), [role="link"], [role="button"], [tabindex]:not([tabindex="-1"])`,gt=e=>{let t=e?.closest(`[data-slot="navigation-menu-item"]`);if(!t)return null;let n=t.dataset.value;if(!n)return null;let r=K.get(n);return!r||r.item!==t?null:r},_t=e=>{if(e.matches(ht))return e;let t=e.querySelectorAll(ht);for(let n of t)if(e.contains(n)&&!n.closest(`[data-slot="navigation-menu-content"]`)&&!(n.hidden||n.closest(`[hidden]`)))return n;return null},q=[],vt=new Map;ge.forEach(e=>{let t=gt(e);if(t){let e={kind:`submenu`,element:t.trigger,item:t.item,value:t.value,trigger:t.trigger};q.push(e),vt.set(e.element,e),vt.set(e.item,e);return}let n=_t(e);if(!n)return;let r={kind:`plain`,element:n};q.push(r),vt.set(r.element,r)});let yt=e=>{let t=e instanceof HTMLElement?e:null;if(!t)return null;let n=t;for(;n&&n!==T;){let e=vt.get(n);if(e)return e;n=n.parentElement}return null},bt=e=>{let t=yt(e);return t?.kind===`plain`?t:null},xt=e=>{let t=yt(e);return t?.kind===`submenu`?t:null},St=()=>{let e=p.ownerDocument.defaultView;if(!e?.matchMedia)return!0;try{return e.matchMedia(`(any-hover: hover)`).matches}catch{return!0}},Ct=e=>{try{return e.matches(`:hover`)}catch{return!1}},wt=()=>{for(let e of q){if(e.kind===`submenu`){if(Ct(e.item)||Ct(e.trigger))return e;continue}if(Ct(e.element))return e}return null},Tt=(e,t={})=>{let n=p.ownerDocument,r=t.preserveOpenOnPlain??!1;return e.kind===`submenu`?(e.trigger.focus(),n.activeElement===e.trigger?(dn(e.trigger),!0):!1):(O!==null&&!r&&$(),e.element.focus(),n.activeElement===e.element?(O!==null&&r?dn():Z(e.element),!0):!1)},Et=(e,t,n={})=>{for(let r=e+t;r>=0&&r<q.length;r+=t){let e=q[r];if(e&&Tt(e,n))return!0}return!1},Dt=(e,t,n={})=>{let r=q.indexOf(e);return r===-1?!1:Et(r,t,n)},Ot=(e,t,n={})=>{let r=q.findIndex(t=>t.kind===`submenu`&&t.trigger===e);return r===-1?!1:Et(r,t,n)},kt=e=>{if(!(e instanceof Node)||!T.contains(e))return!1;let t=e instanceof HTMLElement?e:e.parentElement;return!t||t.closest(`[data-slot="navigation-menu-indicator"]`)||gt(t)?!1:t.closest(`[data-slot="navigation-menu-item"]`)?!0:!!t.closest(`a[href], button, [role='link'], [role='button']`)},At=`a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])`,jt=e=>Array.from(e.querySelectorAll(At)).filter(e=>!e.hidden&&!e.closest(`[hidden]`)),Mt=e=>!e.isConnected||e.hidden||e.closest(`[hidden]`)||`disabled`in e&&e.disabled||e.getAttribute(`aria-hidden`)===`true`||e.getAttribute(`tabindex`)===`-1`?!1:e.matches(At)?!0:e.tabIndex>=0,Nt=e=>{if(p.contains(e)||E?.contains(e)||W()?.contains(e)||G()?.contains(e))return!0;for(let{content:t}of K.values())if(t.contains(e))return!0;return!1},Pt=()=>{let e=p.ownerDocument,t=Array.from(e.querySelectorAll(`*`));for(let n of t)if(Mt(n)&&!Nt(n)&&(p.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0&&(n.focus(),e.activeElement===n))return!0;return!1},Ft=e=>{requestAnimationFrame(()=>{if(O!==e)return;let t=K.get(e);if(!t)return;let n=jt(t.content)[0];n?n.focus():t.content.focus()})},J=()=>{_e&&=(clearTimeout(_e),null),ve&&=(clearTimeout(ve),null)},It=()=>{J(),k=null},Lt=()=>{ye=null,N=null},Rt=()=>{xe!==null&&(cancelAnimationFrame(xe),xe=null)},Y=null,zt=()=>E?G()||W()||(E.parentElement instanceof HTMLElement?E.parentElement:E):null,Bt=()=>{let e=zt();return Y||(Y=document.createElement(`div`),Y.setAttribute(`data-slot`,`navigation-menu-bridge`),Y.style.cssText=`position: absolute; pointer-events: auto; z-index: 0; display: none;`,L.push(h(Y,`pointerenter`,()=>{J()}),h(Y,`pointerleave`,e=>{if(M||O===null)return;let t=e.relatedTarget;nn(t)||t&&n(p,t)||(Q(null),Z(null))}))),e&&Y.parentElement!==e&&e.insertBefore(Y,e.firstChild),Y},Vt=()=>{Y&&(Y.style.height=`0`,Y.style.width=`0`,Y.style.top=`0px`,Y.style.left=`0px`,Y.style.right=`0px`,Y.style.bottom=`auto`,Y.style.transform=`none`,Y.style.clipPath=`none`,Y.style.display=`none`)},Ht=()=>{if(!de)return null;let e=p.ownerDocument.body;return e?(F||(F=p.ownerDocument.createElement(`div`),F.setAttribute(`data-slot`,`navigation-menu-safe-triangle`),F.style.cssText=[`position: fixed`,`pointer-events: none`,`display: none`,`z-index: 2147483647`,`background: rgba(255, 0, 0, 0.18)`,`border: 1px solid rgba(255, 0, 0, 0.45)`].join(`; `)),F.parentElement!==e&&e.appendChild(F),F):null},Ut=()=>{F&&(F.style.width=`0`,F.style.height=`0`,F.style.clipPath=`none`,F.style.display=`none`)},X=()=>{de||Ut()},Wt=e=>{let t=Ht();if(!t)return;let n=e.apex.x,r=e.apex.y,i=e.edgeA.x,a=e.edgeA.y,o=e.edgeB.x,s=e.edgeB.y,c=Math.min(n,i,o),l=Math.min(r,a,s),u=Math.max(n,i,o),d=Math.max(r,a,s),f=Math.max(1,u-c),ee=Math.max(1,d-l),p=(e,t)=>`${(e-c)/f*100}% ${(t-l)/ee*100}%`;t.style.display=`block`,t.style.left=`${c}px`,t.style.top=`${l}px`,t.style.width=`${f}px`,t.style.height=`${ee}px`,t.style.clipPath=`polygon(${p(n,r)}, ${p(i,a)}, ${p(o,s)})`},Gt=(e,t,n)=>(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y),Kt=(e,t,n,r)=>{let i=Gt(e,t,n),a=Gt(e,n,r),o=Gt(e,r,t);return!((i<0||a<0||o<0)&&(i>0||a>0||o>0))},qt=(e,t,n)=>{let r=.5;if(n.top>=t.bottom-r)return[{x:n.left,y:n.top},{x:n.right,y:n.top}];if(n.bottom<=t.top+r)return[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}];if(n.left>=t.right-r)return[{x:n.left,y:n.top},{x:n.left,y:n.bottom}];if(n.right<=t.left+r)return[{x:n.right,y:n.top},{x:n.right,y:n.bottom}];let i=[[{x:n.left,y:n.top},{x:n.right,y:n.top}],[{x:n.right,y:n.top},{x:n.right,y:n.bottom}],[{x:n.left,y:n.bottom},{x:n.right,y:n.bottom}],[{x:n.left,y:n.top},{x:n.left,y:n.bottom}]],a=([t,n])=>t.y===n.y?Math.abs(e.y-t.y):Math.abs(e.x-t.x),o=i[0],s=a(o);for(let e=1;e<i.length;e++){let t=i[e],n=a(t);n<s&&(o=t,s=n)}return o},Jt=()=>O?K.get(O)??null:null,Yt=(e,t,n)=>{if(n.width<=0||n.height<=0)return null;let r={x:e.left+e.width/2,y:e.top+e.height*.62},[i,a]=qt(r,t,n);if(i.x===a.x){let e=Math.min(i.y,a.y),t=Math.max(i.y,a.y),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:i.x,y:e+r},a={x:a.x,y:t-r}}else{let e=Math.min(i.x,a.x),t=Math.max(i.x,a.x),n=t-e,r=n<=28?0:Math.min(10,(n-28)/2);i={x:e+r,y:i.y},a={x:t-r,y:a.y}}return{apex:r,edgeA:i,edgeB:a}},Xt=()=>{if(!fe||!E||O===null)return null;let e=Jt();if(!e)return null;let t=p.getBoundingClientRect(),n=e.trigger.getBoundingClientRect(),r=E.getBoundingClientRect(),i=e.content.getBoundingClientRect();return Yt(n,t,r.width>0&&r.height>0?r:i)},Zt=e=>{let t=Xt();return t?Kt({x:e.clientX,y:e.clientY},t.apex,t.edgeA,t.edgeB):!1},Qt=(e,t)=>({x:e.x-t.left,y:e.y-t.top}),$t=e=>{if(e.length<=1)return e.slice();let t=e=>`${e.x.toFixed(3)}:${e.y.toFixed(3)}`,n=new Map;for(let r of e)n.set(t(r),r);let r=Array.from(n.values()).sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x);if(r.length<=2)return r;let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=[];for(let e of r){for(;a.length>=2&&i(a[a.length-2],a[a.length-1],e)<=0;)a.pop();a.push(e)}let o=[];for(let e=r.length-1;e>=0;e--){let t=r[e];for(;o.length>=2&&i(o[o.length-2],o[o.length-1],t)<=0;)o.pop();o.push(t)}return a.pop(),o.pop(),a.concat(o)},en=e=>{if(e.length<3){Vt();return}let t=Bt(),n=t.parentElement,r=$t(n&&n===G()?e.map(e=>({x:e.x-Ce,y:e.y-we})):e);if(r.length<3){Vt();return}let i=Math.min(...r.map(e=>e.x)),a=Math.min(...r.map(e=>e.y)),o=Math.max(...r.map(e=>e.x)),s=Math.max(...r.map(e=>e.y)),c=Math.max(1,o-i),l=Math.max(1,s-a),u=e=>`${(e.x-i)/c*100}% ${(e.y-a)/l*100}%`;t.style.display=`block`,t.style.transform=`none`,t.style.bottom=`auto`,t.style.right=`auto`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.width=`${c}px`,t.style.height=`${l}px`,t.style.clipPath=`polygon(${r.map(u).join(`, `)})`},tn=()=>{if(!de)return;let e=Xt();if(!e){Ut();return}Wt(e)},nn=e=>e?!!(Jt()?.content.contains(e)||E?.contains(e)||W()?.contains(e)||Y?.contains(e)||G()?.contains(e)):!1;L.push(X),L.push(Rt),L.push(Vt),L.push(()=>{Ut(),F?.parentElement&&F.parentElement.removeChild(F),F=null});let rn=(e,t,n,r,i,a)=>{let o=p.ownerDocument.defaultView??window,s=o.visualViewport,c=s?.offsetLeft??0,l=s?.offsetTop??0,u=s?.width??o.innerWidth,d=s?.height??o.innerHeight,f=n===`left`?Math.max(0,t.left-c-r):n===`right`?Math.max(0,c+u-t.right-r):Math.max(0,u),ee=n===`top`?Math.max(0,t.top-l-r):n===`bottom`?Math.max(0,l+d-t.bottom-r):Math.max(0,d);Ue(e,{width:i,height:a}),e.style.setProperty(`--available-width`,`${f}px`),e.style.setProperty(`--available-height`,`${ee}px`)},an=(e,n,r,i={})=>{let a=at();if(!E||!a)return;let{popup:o,positioner:s}=a,c=i.mode??`measure-target`,l=c!==`sync-current`;if(E.getAttribute(`data-state`)!==`open`||e.getAttribute(`data-state`)!==`active`)return;U(e,!1);let u=e.firstElementChild,d=e.lastElementChild,f=u?getComputedStyle(u):null,ee=d?getComputedStyle(d):null,m=f&&parseFloat(f.marginTop)||0,h=ee&&parseFloat(ee.marginBottom)||0,te=(...e)=>{let t=0;for(let n of e)Number.isFinite(n)&&(t=Math.max(t,n));return t},g=e.getBoundingClientRect(),ne={width:te(g.width,e.scrollWidth,e.offsetWidth,e.clientWidth),height:te(g.height,e.scrollHeight,e.offsetHeight,e.clientHeight)+m+h},_={...V.committed},v=l?Ge(a,r.side):Ke(),y={width:c===`sync-current`?_.width||v.width||ne.width:v.width||ne.width,height:c===`sync-current`?_.height||v.height||ne.height:v.height||ne.height};Le(v.width>0&&v.height>0?v:y),l&&Ie(y);let b=y.width,x=y.height;if(b<=0||x<=0)return;let ae={top:g.top,left:g.left,width:b,height:x,right:g.left+b,bottom:g.top+x},oe=getComputedStyle(E),se=parseFloat(oe.marginTop)||0;He(b,x);let S=p.getBoundingClientRect(),ce=n.getBoundingClientRect(),C=t({anchorRect:ce,contentRect:ae,side:r.side,align:r.align,sideOffset:r.sideOffset,alignOffset:r.alignOffset,avoidCollisions:!1,collisionPadding:0,allowedSides:re}),le=C.x-S.left,w=C.y-S.top;Ce=le,we=w;let ue=ie(C.side,C.align,ce),de=ue.x-(S.left+le),pe=ue.y-(S.top+w),me=ue.x-S.left,he=ue.y-S.top,T=`${de}px ${pe}px`,ge=`${me}px ${he}px`;if(o.style.willChange=`width,height`,o.style.pointerEvents=`auto`,C.side===`top`?Ye(o,`top`):C.side===`left`?Ye(o,`left`):Ye(o,null),o.style.setProperty(`--transform-origin`,T),E.style.top=`0px`,E.style.left=`0px`,E.style.willChange=`transform,width,height`,E.style.setProperty(`--transform-origin`,T),e.style.setProperty(`--transform-origin`,T),o.setAttribute(`data-side`,C.side),o.setAttribute(`data-align`,C.align),E.setAttribute(`data-side`,C.side),E.setAttribute(`data-align`,C.align),e.setAttribute(`data-side`,C.side),e.setAttribute(`data-align`,C.align),s.setAttribute(`data-side`,C.side),s.setAttribute(`data-align`,C.align),s.style.setProperty(`--transform-origin`,ge),rn(s,ce,C.side,r.sideOffset,b,x),ct(),c===`measure-target`)Ve(o,b,x);else if(c===`initial-open`)Ve(o,b,x);else{let e=o.style.getPropertyValue(`--popup-width`).trim(),t=o.style.getPropertyValue(`--popup-height`).trim();(!e||!t)&&Ve(o,_.width||b,_.height||x)}let D=E.getBoundingClientRect(),O=[],k=Math.max(0,D.top-S.bottom),A=Math.max(0,S.top-D.bottom),_e=Math.max(0,D.left-S.right),ve=Math.max(0,S.left-D.right),j=Math.max(0,se),M=Math.max(k,A,j),ye=Math.max(_e,ve),N=fe?Yt(ce,S,D):null,P=(e,t,n,r)=>{n<=0||r<=0||O.push({x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r})};if(M>=ye&&M>0){let e=Math.max(k,A,j),t=le,n=A>k&&A>=j?w+x:w-e,r=b;if(N){let e=Math.min(N.edgeA.x,N.edgeB.x)-S.left,n=Math.max(N.edgeA.x,N.edgeB.x)-S.left;t=e-8,r=n-e+16}P(t,n,r,e)}else if(ye>0){let e=Math.max(_e,ve),t=w,n=ve>_e?le+b:le-e,r=x;if(N){let e=Math.min(N.edgeA.y,N.edgeB.y)-S.top,n=Math.max(N.edgeA.y,N.edgeB.y)-S.top;t=e-8,r=n-e+16}P(n,t,e,r)}if(N){let e=Qt(N.apex,S),t=Qt(N.edgeA,S),n=Qt(N.edgeB,S);O.push(e,t,n)}en(O),tn()},on=(e,t,n,r={})=>{if(!E)return;let i=()=>{an(e,t,n,r)};if(r.defer===!1){i();return}requestAnimationFrame(()=>{E.getAttribute(`data-state`)!==`open`||e.getAttribute(`data-state`)!==`active`||i()})},sn=(e=Jt(),t={})=>{if(!e)return;let n=ft(e.item,e.content);on(e.content,e.trigger,n,t)},cn=a({observedElements:[p,...mt],isActive:()=>O!==null,ancestorScroll:!0,syncOnScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,onUpdate:()=>{I=!0,tt(),sn(void 0,{defer:!1,mode:`sync-current`}),nt()}});L.push(()=>cn.stop());let ln=e=>A===-1||e>A?`right`:`left`,Z=e=>{if(!D)return;if(j=e,!e){Rt(),D.removeAttribute(`data-instant`),D.setAttribute(`data-state`,`hidden`);return}D.getAttribute(`data-state`)!==`visible`&&(Rt(),D.setAttribute(`data-instant`,``),xe=requestAnimationFrame(()=>{xe=requestAnimationFrame(()=>{D.removeAttribute(`data-instant`),xe=null})}));let t=T.getBoundingClientRect(),n=e.getBoundingClientRect();D.style.setProperty(`--indicator-left`,`${n.left-t.left}px`),D.style.setProperty(`--indicator-width`,`${n.width}px`),D.style.setProperty(`--indicator-top`,`${n.top-t.top}px`);let r=(E&&parseFloat(getComputedStyle(E).marginTop)||0)<1?1:0;D.style.setProperty(`--indicator-height`,`${n.height-r}px`),D.setAttribute(`data-state`,`visible`)},un=()=>O?K.get(O)?.trigger??null:null,dn=(e=null)=>{let t=un();if(t){Z(t);return}Z(e)},Q=(e,t=!1)=>{if(X(),e===O){e===null?It():J();return}if(!t&&e!==null&&e===k)return;J(),k=e===null?null:e;let r=()=>{let t=O,r=e?K.get(e):null,i=Ke(),a=e!==null,o=t===null&&a,c=t!==null&&e!==null&&t!==e,l=c&&r?ln(r.index):null,u=document.activeElement;if(e===null&&u&&t){let e=K.get(t);e&&n(e.content,u)&&e.trigger.focus()}if(K.forEach(({trigger:n,content:r,item:i},a)=>{let o=a===e,s=a===t;if(g(n,`expanded`,o),n.setAttribute(`data-state`,o?`open`:`closed`),i.setAttribute(`data-state`,o?`open`:`closed`),!o){let t=Ee.get(r);if(je(r,!1),r.setAttribute(`aria-hidden`,`true`),he(r,!0),r.style.pointerEvents=`none`,e===null)s&&(z(r,null),r.removeAttribute(`data-motion`));else if(s&&l){z(r,l);let e=l===`right`?`to-left`:`to-right`;r.setAttribute(`data-motion`,e)}else s&&(z(r,null),r.removeAttribute(`data-motion`));s?(U(r,!0),t?.exit()):t?.isExiting||(z(r,null),r.removeAttribute(`data-motion`),U(r,!1),st(r),r.hidden=!0)}}),r){let e=at();if(e?.popupPortal.mount(),e&&(e.isClosing=!1,e.popupExitComplete=!1,e.viewportExitComplete=!1),E&&o&&(R(p,!0),R(e?.positioner??G(),!0),R(e?.popup??W(),!0),R(E,!0),E.style.pointerEvents=`auto`,Te=!0,et(),I=!1,tt(),nt()),e?.popup&&(e.popup.hidden=!1,e.popup.style.pointerEvents=`auto`),E&&(E.hidden=!1),t===null&&(e?.popupPresence.enter(),e?.viewportPresence.enter()),ot(r.content),Ee.get(r.content)?.enter(),cn.start(),l){z(r.content,l);let e=l===`right`?`from-right`:`from-left`;r.content.setAttribute(`data-motion`,e)}else z(r.content,null),r.content.removeAttribute(`data-motion`);je(r.content,!0),U(r.content,!1),r.content.removeAttribute(`aria-hidden`),he(r.content,!1),r.content.hidden=!1,r.content.style.pointerEvents=`auto`,A=r.index,c&&(Te=!1,et(),I=!1,tt()),sn(r,{defer:o||c?!1:void 0,mode:o?`initial-open`:`measure-target`}),dt(r),Z(r.trigger)}else cn.stop(),Vt(),X(),B&&(i.width>0&&i.height>0&&(Ve(B.popup,i.width,i.height),Ue(B.positioner,{width:i.width,height:i.height}),He(i.width,i.height)),B.isClosing=!0,B.popupExitComplete=!1,B.viewportExitComplete=!1,B.popupPresence.exit(),B.viewportPresence.exit()),dt(null);if(R(p,a),l?p.setAttribute(`data-motion`,l===`right`?`from-right`:`from-left`):p.removeAttribute(`data-motion`),E){let e=W();R(G(),a),R(e,a),R(E,a),E.style.pointerEvents=a?`auto`:`none`,Te=o,(!a||c)&&(et(),I=!1),tt(),l?E.style.setProperty(`--motion-direction`,l===`right`?`1`:`-1`):E.style.removeProperty(`--motion-direction`)}O=e,k=null,e===null&&Z(null),tn(),s(p,`navigation-menu:change`,{value:e}),pe?.(e)};t?r():e!==null&&O===null?_e=setTimeout(r,ae):e!==null&&O!==null?r():ve=setTimeout(r,oe)},fn=Me();R(p,!1),E&&(R(fn.positioner,!1),R(fn.popup,!1),R(E,!1),E.hidden=!0,E.style.pointerEvents=`none`,fn.popup&&(fn.popup.hidden=!0,fn.popup.style.pointerEvents=`none`)),D&&D.setAttribute(`data-state`,`hidden`),K.forEach(({trigger:e,content:t,item:n})=>{e.tagName===`BUTTON`&&!e.hasAttribute(`type`)&&(e.type=`button`),g(e,`expanded`,!1),e.setAttribute(`data-state`,`closed`),e.tabIndex=0,n.setAttribute(`data-state`,`closed`),je(t,!1),t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,he(t,!0),t.hidden=!0,U(t,!1),t.style.pointerEvents=`none`}),K.forEach(({item:e,trigger:t},r)=>{L.push(h(t,`pointerenter`,e=>{if(!M){if(O!==r&&Zt(e))return;Z(t)}})),L.push(h(e,`pointerenter`,e=>{if(!M){if(O!==r&&Zt(e))return;Q(r)}})),L.push(h(e,`pointerleave`,e=>{if(k===r&&O===null&&It(),O===r&&!M){let t=e.relatedTarget;if(nn(t))return;(!t||!n(p,t))&&(Q(null),Z(null))}})),L.push(h(t,`focus`,()=>{if(ye===t){ye=null;return}se&&Q(r,!0),dn(t)})),L.push(h(t,`pointerdown`,()=>{ye=t,N=t}),h(t,`keydown`,()=>{N=null})),L.push(h(t,`click`,()=>{let e=N===t;N=null,ye=null,It(),O===r&&M?(M=!1,Q(null,!0),Z(null)):O===r&&!M?(M=!0,Z(t),e||Ft(r)):(M=!0,Q(r,!0),Z(t),e||Ft(r))}))}),L.push(h(T,`pointerover`,e=>{let t=e;if(t.pointerType===`touch`)return;let n=xt(t.target);if(n){if(P=!0,M||O!==n.value&&Zt(t))return;Z(n.trigger),Q(n.value);return}let r=bt(t.target);if(r){if(P=!0,O!==null){if(M)return;$()}Z(r.element);return}O!==null&&(M||kt(t.target)&&$())}),h(T,`click`,e=>{O!==null&&kt(e.target)&&$()})),L.push(h(T,`focusin`,e=>{let t=bt(e.target);if(t){if(O!==null){dn();return}Z(t.element)}}),h(p,`pointerenter`,()=>{P=!0}),h(p,`pointerleave`,e=>{let t=e.relatedTarget;if(!nn(t)&&(P=!1,!M)){if(Zt(e)){J();return}Q(null),Z(null)}}),h(p,`pointerdown`,()=>{X(),It()}));let pn=()=>{if(!St()||O!==null||k!==null||M)return;let e=wt();if(P=e!==null||p instanceof HTMLElement&&Ct(p),e){if(e.kind===`submenu`){Q(e.value,!0);return}Z(e.element)}};E&&L.push(h(E,`pointerenter`,()=>{X(),J()}),h(E,`transitionend`,e=>{if(e.target!==E)return;let t=O?K.get(O):null;t&&sn(t,{defer:!1,mode:`sync-current`})})),K.forEach(({content:e})=>{L.push(h(e,`pointerenter`,()=>{X(),J()}),h(e,`pointerleave`,e=>{if(M)return;let t=e.relatedTarget;nn(t)||n(p,t)||(Q(null),Z(null))}))}),L.push(h(T,`keydown`,e=>{let t=yt(e.target);if(!t)return;let n=q.indexOf(t);if(n===-1)return;let r=n;switch(e.key){case`Tab`:if(e.shiftKey||O===null)return;(Dt(t,1,{preserveOpenOnPlain:!0})||Pt())&&e.preventDefault();return;case`ArrowLeft`:r=n-1,r<0&&(r=q.length-1);break;case`ArrowRight`:r=n+1,r>=q.length&&(r=0);break;case`ArrowDown`:if(t.kind===`submenu`){e.preventDefault();let n=t.value;M=!0,Q(n,!0),Ft(n)}return;case`Home`:r=0;break;case`End`:r=q.length-1;break;case`Escape`:M=!1,Q(null,!0),Z(null);return;default:return}e.preventDefault();let i=q[r];i&&Tt(i,{preserveOpenOnPlain:!0})})),K.forEach(({content:e,trigger:t})=>{L.push(h(e,`keydown`,n=>{let r=n.target,i=jt(e),a=i.indexOf(r);if(a!==-1)switch(n.key){case`Tab`:if(!n.shiftKey&&a===i.length-1){(Ot(t,1,{preserveOpenOnPlain:!0})||Pt())&&n.preventDefault();return}if(n.shiftKey&&a===0){n.preventDefault(),t.focus();return}return;case`ArrowDown`:case`ArrowRight`:{n.preventDefault();let e=a+1;e<i.length&&i[e]?.focus();break}case`ArrowUp`:case`ArrowLeft`:n.preventDefault(),a===0?t.focus():i[a-1]?.focus();break;case`Escape`:n.preventDefault(),M=!1,Q(null,!0),Z(null),t.focus();break}}))});let mn=()=>n(p,document.activeElement)||P||M,$=()=>{X(),It(),Lt(),M=!1,Q(null,!0),Z(null),tn()};L.push(h(document,`focusin`,e=>{let t=e.target;if(!n(p,t)){if(O!==null){$();return}Z(null)}})),L.push(r({root:p,isOpen:()=>O!==null&&mn(),onDismiss:$,closeOnClickOutside:!0,closeOnEscape:!0,preventEscapeDefault:!1,isInside:e=>!!e&&n(p,e)})),L.push(h(window,`resize`,()=>{(O||j)&&requestAnimationFrame(()=>dn(j))}),h(T,`scroll`,()=>{(O||j)&&requestAnimationFrame(()=>dn(j))})),L.push(h(p,`navigation-menu:set`,e=>{let t=e.detail;if(t?.value!==void 0){if(t.value===null)$();else if(K.has(t.value)){M=!0,Q(t.value,!0);let e=K.get(t.value);e&&Z(e.trigger)}}}));let hn={get value(){return O},open:e=>Q(e,!0),close:()=>$(),destroy:()=>{be=!0,It(),Lt(),L.forEach(e=>e()),L.length=0,e(p,x,hn)}};return pn(),ne(p,x,hn),hn}function oe(e=document){let t=[];for(let n of p(e,`navigation-menu`))m(n,x)||t.push(ae(n));return t}export{oe as create,ae as createNavigationMenu};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-slot/navigation-menu",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.160",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
],
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@data-slot/core": "0.2.
|
|
38
|
+
"@data-slot/core": "0.2.160"
|
|
39
39
|
}
|
|
40
40
|
}
|