Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.156/page_editor/app/contexts/KeyboardMovementContext",["module","exports","require","liferay!frontend-js-react-web$react","../utils/drag_and_drop/constants/targetPositions","../utils/isItemContainerFlex","./StoreContext"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardMovementContextProvider=function KeyboardMovementContextProvider({children:e}){const[t,n]=(0,r.useState)(null),[o,u]=(0,r.useState)({itemId:null,position:null}),[i,s]=(0,r.useState)(null);return r.default.createElement(a.Provider,{value:{setSource:n,setTarget:u,setText:s,source:t,target:o,text:i}},e)},t.useDisableKeyboardMovement=function useDisableKeyboardMovement(){const{setSource:e,setTarget:t}=(0,r.useContext)(a);return(0,r.useCallback)((()=>{e(null),t({itemId:null,position:null})}),[e,t])},t.useMovementSource=function useMovementSource(){return(0,r.useContext)(a).source},t.useMovementTarget=function useMovementTarget(){return(0,r.useContext)(a).target},t.useMovementTargetPosition=function useMovementTargetPosition(){const{target:e}=(0,r.useContext)(a),t=(0,i.useSelectorRef)((e=>e.layoutData)),n=t.current.items[e.itemId],s=t.current.items[null==n?void 0:n.parentId];if(!s||!(0,u.default)(s))return e.position;return e.position===o.TARGET_POSITIONS.BOTTOM?o.TARGET_POSITIONS.RIGHT:o.TARGET_POSITIONS.LEFT},t.useMovementText=function useMovementText(){return(0,r.useContext)(a).text},t.useSetMovementSource=function useSetMovementSource(){return(0,r.useContext)(a).setSource},t.useSetMovementTarget=function useSetMovementTarget(){return(0,r.useContext)(a).setTarget},t.useSetMovementText=function useSetMovementText(){return(0,r.useContext)(a).setText};var r=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=r?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(n,o,u):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),o=n("../utils/drag_and_drop/constants/targetPositions"),u=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n("../utils/isItemContainerFlex")),i=n("./StoreContext");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}const e={setSource:()=>{},setTarget:()=>{},setText:()=>{},source:null,target:{itemId:null,position:null},text:null},a=r.default.createContext(e)}}));
//# sourceMappingURL=KeyboardMovementContext.js.map