define(['exports', './TabbableModeContext-a9c97640', './useTabbableMode-dc440317', 'preact/compat', './useUser-797287de'], (function(e,o,a,t,c){"use strict";const s=e=>{e.preventDefault(),e.stopPropagation()},n=(e,o)=>"string"==typeof e?e:e[o];e.useCellNavigation=({navigationMap:e,payload:o,onAction:a,onNavigation:i})=>{const{direction:r}=c.useUser(),l=t.useCallback((()=>{a(o)}),[o,a]),u=t.useCallback((a=>{if(["Enter","Space"].includes(a.code))return void(a.repeat?"Space"===a.code&&a.preventDefault():(s(a),l()));if("KeyT"===a.code&&a.ctrlKey&&a.altKey){const t=e.CtrlAltT;void 0!==t&&(s(a),i({direction:n(t,r),...o}))}const{key:t,shiftKey:c}=a;switch(t){case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"End":case"Home":case"PageUp":case"PageDown":const l=!c||"PageUp"!==t&&"PageDown"!==t?t:`Shift${t}`;if(void 0!==e[l]){s(a);const t=e[l];i({direction:n(t,r),...o})}}}),[r,l,e,i,o]);return{onClick:l,onKeyDown:u}},e.useFocusableCell=({isFocusable:e,isFocused:o})=>{const c=t.useRef(null),{isTabbable:s}=a.useTabbableMode();return t.useLayoutEffect((()=>{e&&o&&c.current?.focus()}),[e,o]),{ref:c,tabIndex:e&&s?0:-1}}}));
//# sourceMappingURL=useCellNavigation-4138513e.js.map
