import { prefix } from './prefix';
import getViewportSize from '../../utils/dom/getViewportSize';
import { SCROLLBAR_WIDTH } from '../../utils/getScrollbarWidth';
export var TopLeftInViewport = function (_a) {
    var relativeRect = _a.relativeRect, anchorRect = _a.anchorRect, contentRect = _a.contentRect, cushion = _a.cushion;
    var left = relativeRect.left, top = relativeRect.top;
    var x = left;
    var y = top - contentRect.height - cushion;
    var viewport = getViewportSize();
    var offsetWidth = contentRect.width - (viewport.width - anchorRect.left);
    return {
        style: {
            position: 'absolute',
            left: x - offsetWidth - SCROLLBAR_WIDTH,
            top: y,
        },
        className: prefix('position-top-left-in-viewport'),
    };
};
