Liferay.Loader.define("layout-content-page-editor-web@2.0.166/page_editor/app/utils/dragAndDrop/getTargetPosition", ['module', 'exports', 'require', './constants/targetPosition'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = getTargetPosition;

    var _targetPosition = require("./constants/targetPosition");

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */

    /**
     * Returns the cursor vertical position (extracted from provided dnd monitor)
     * @param {number} clientOffsetY
     * @param {DOMRect} hoverBoundingRect
     * @param {number} elevationBorderSize
     * @return {Array} Returns a tuple with targetPositionWithMiddle and
     *  targetPositionWithoutMiddle
     */
    function getTargetPosition(clientOffsetY, hoverBoundingRect, elevationBorderSize) {
      var hoverMiddleY = hoverBoundingRect.top + hoverBoundingRect.height / 2;
      var targetPositionWithoutMiddle = clientOffsetY < hoverMiddleY ? _targetPosition.TARGET_POSITION.TOP : _targetPosition.TARGET_POSITION.BOTTOM;
      var targetPositionWithMiddle = clientOffsetY < hoverBoundingRect.bottom - elevationBorderSize && clientOffsetY > hoverBoundingRect.top + elevationBorderSize ? _targetPosition.TARGET_POSITION.MIDDLE : targetPositionWithoutMiddle;
      return [targetPositionWithMiddle, targetPositionWithoutMiddle];
    }
    //# sourceMappingURL=getTargetPosition.js.map
  }
});
//# sourceMappingURL=getTargetPosition.js.map