import{toConsumableArray as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{useRef as r,useCallback as o}from"react";import n from"../../../../hooks/useEventListener/index.js";import{ARROW_UP_KEYS as t,NavDirections as i,ARROW_RIGHT_KEYS as s,ARROW_DOWN_KEYS as u,ARROW_LEFT_KEYS as a}from"../../../../hooks/useFullKeyboardListeners.js";import c from"../../../../hooks/useKeyEvent/index.js";var l=[].concat(e(t),e(s),e(u),e(a)),m=function(){var e=r(document),m=r(),f=o((function(e){m.current=e}),[]),d=o((function(e){var r=e.key;t.includes(r)?f(i.UP):s.includes(r)?f(i.RIGHT):u.includes(r)?f(i.DOWN):a.includes(r)&&f(i.LEFT)}),[f]),p=o((function(){m.current=void 0}),[m]);return c({ref:e,capture:!0,keys:l,callback:d}),n({eventName:"mousedown",ref:e,capture:!0,callback:p}),{lastNavigationDirectionRef:m}};export{m as useLastNavigationDirection};
