Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/utils/drag-and-drop/defaultComputeHover",["module","exports","require","../../config/constants/contentDisplayOptions","../../config/constants/layoutDataItemTypes","../collectionIsMapped","../formIsMapped","../isItemEmpty","./checkAllowedChild","./constants/dragDropTargetType","./constants/orientations","./constants/targetPositions","./getDropContainerId","./getDropTargetPosition","./getTargetData","./getTargetPositions","./itemIsAncestor"],(function(t,e,n){window;{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t({dispatch:e,layoutDataRef:n,monitor:r,siblingItem:d=null,sourceItem:I,targetItem:f,targetRefs:O}){if(!r.isOver({shallow:!0}))return;const A=function(t,e,n,r){if(!t.parentId||!P(r.current.items[t.parentId]))return u.ORIENTATIONS.vertical;const o=n.get(t.toControlsId(t.itemId)).current.getBoundingClientRect(),i=o.left+o.width/2,a=e.getClientOffset().x,l=a<i?T.TARGET_POSITIONS.LEFT:T.TARGET_POSITIONS.RIGHT;return(l===T.TARGET_POSITIONS.LEFT?a-o.left:o.right-a)<S?u.ORIENTATIONS.horizontal:u.ORIENTATIONS.vertical}(d||f,r,O,n),[m,D,b]=_(d||f,r,O,A),M=(()=>{const t=f.type===o.LAYOUT_DATA_ITEM_TYPES.column,e=f.type===o.LAYOUT_DATA_ITEM_TYPES.collection&&!(0,i.collectionIsMapped)(f),r=P(f),s=f.type===o.LAYOUT_DATA_ITEM_TYPES.fragment,c=f.type===o.LAYOUT_DATA_ITEM_TYPES.form&&!(0,a.formIsMapped)(f),u=(0,l.default)(n.current.items[f.itemId],n.current);return m===T.TARGET_POSITIONS.MIDDLE&&(u||t||r||e||c)&&!s})();if(!d&&M&&!(0,g.default)(I,f,n))return e({dropContainerId:(0,p.default)(n.current,f,m),dropItem:I,dropTargetItem:f,droppable:(0,s.default)(I,f,n),elevate:null,targetPositionWithMiddle:m,targetPositionWithoutMiddle:D,type:c.DRAG_DROP_TARGET_TYPE.INSIDE});if(d&&!y(parent)&&function(t,e,n){const r=n.current.items[t.parentId];return e===u.ORIENTATIONS.horizontal?P(r):!P(r)}(d,A,n)&&!(0,g.default)(I,d,n))return e({dropContainerId:(0,p.default)(n.current,d,m),dropItem:I,dropTargetItem:d,droppable:(0,s.default)(I,f,n),elevate:!0,targetPositionWithMiddle:m,targetPositionWithoutMiddle:D,type:c.DRAG_DROP_TARGET_TYPE.ELEVATE});if(b){const i=(t,e)=>{let a=n.current.items[t.parentId];if(a&&(a=E(E({},a),{},{collectionItemIndex:t.collectionItemIndex,parentToControlsId:t.parentToControlsId,toControlsId:a.type===o.LAYOUT_DATA_ITEM_TYPES.collection?t.parentToControlsId:t.toControlsId})),a){const[n]=_(t,r,O,A),[o]=_(a,r,O,A);if(n!==m&&o!==m||y(a))return i(a,e);if(e>1){const[t,n]=i(a,e-1);if(t)return[t,n]}return[a,t]}return[null,null]},[a,l]=i(f,b);if(a&&a!==f)return t({dispatch:e,layoutDataRef:n,monitor:r,siblingItem:l,sourceItem:I,targetItem:a,targetRefs:O})}};var r=n("../../config/constants/contentDisplayOptions"),o=n("../../config/constants/layoutDataItemTypes"),i=n("../collectionIsMapped"),a=n("../formIsMapped"),l=O(n("../isItemEmpty")),s=O(n("./checkAllowedChild")),c=n("./constants/dragDropTargetType"),u=n("./constants/orientations"),T=n("./constants/targetPositions"),p=O(n("./getDropContainerId")),d=O(n("./getDropTargetPosition")),I=O(n("./getTargetData")),f=O(n("./getTargetPositions")),g=O(n("./itemIsAncestor"));function O(t){return t&&t.__esModule?t:{default:t}}function A(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function E(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?A(Object(n),!0).forEach((function(e){m(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const t=15,D=3,S=80;function _(e,n,r,o){const i=r.get(e.toControlsId(e.itemId));if(!i||!i.current)return[null,null,0];const a=o===u.ORIENTATIONS.horizontal?n.getClientOffset().x:n.getClientOffset().y,l=i.current.getBoundingClientRect(),s=(0,f.default)(o),c=(0,I.default)(l,o),p=Math.min(c.length/(2*(D+1)),t)*D,[g,O]=(0,d.default)(a,p,s,c);let A=0;if(g!==T.TARGET_POSITIONS.MIDDLE){const t=g===s.start?a-c.start:c.end-a;A=D-Math.floor(t/p*D)}return[g,O,A]}function y(t){return t.type===o.LAYOUT_DATA_ITEM_TYPES.collection||t.type===o.LAYOUT_DATA_ITEM_TYPES.row}function P(t){return t.type===o.LAYOUT_DATA_ITEM_TYPES.container&&t.config.contentDisplay===r.CONTENT_DISPLAY_OPTIONS.flexRow}}}));
//# sourceMappingURL=defaultComputeHover.js.map