import{a as e}from"./chunk-BNv3lrIs.js";import{n as t,t as n}from"./jsx-runtime-pmtNMKr4.js";import{o as r}from"./DataKey-DMUgxTID.js";import{r as i}from"./Button-_yTP2B6J.js";var a=e(t());function o(){return(0,a.useState)(null)}function s(e,t,n,i=!1){let o=r(n);(0,a.useEffect)(()=>{let n=typeof e==`function`?e():e;return n.addEventListener(t,o,i),()=>n.removeEventListener(t,o,i)},[e])}var c=n(),l=[`onKeyDown`];function u(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function d(e){return!e||e.trim()===`#`}var f=a.forwardRef((e,t)=>{let{onKeyDown:n}=e,a=u(e,l),[o]=i(Object.assign({tagName:`a`},a)),s=r(e=>{o.onKeyDown(e),n?.(e)});return d(a.href)||a.role===`button`?(0,c.jsx)(`a`,Object.assign({ref:t},a,o,{onKeyDown:s})):(0,c.jsx)(`a`,Object.assign({ref:t},a,{onKeyDown:n}))});f.displayName=`Anchor`;function p(e,t,n){let r=(0,a.useRef)(e!==void 0),[i,o]=(0,a.useState)(t),s=e!==void 0,c=r.current;return r.current=s,!s&&c&&i!==t&&o(t),[s?e:i,(0,a.useCallback)((...e)=>{let[t,...r]=e,i=n?.(t,...r);return o(t),i},[n])]}function m(){let[,e]=(0,a.useReducer)(e=>e+1,0);return e}var h=a.createContext(null);h.displayName=`NavContext`;export{s as a,f as i,m as n,o,p as r,h as t};