import { HistoryChangeTypes } from '../types';
export var getHistoryLinkCurve = function (x, y, toX, toY) {
    var isUp = y > toY;
    var isLeft = x < toX;
    var curveStartX = isLeft ? toX - 12 : toX + 12;
    var curveCenterY = isUp ? -6 : 6;
    var curveEndY = isUp ? -12 : 12;
    var curve = isLeft ? "c 6 0 12 ".concat(curveCenterY, " 12") : "c -6 0 -12 ".concat(curveCenterY, " -12");
    return "M".concat(x, " ").concat(y, " L").concat(curveStartX, " ").concat(y, " ").concat(curve, " ").concat(curveEndY, " L").concat(toX, " ").concat(toY);
};
export var isFakeHistoryType = function (type) {
    return type === HistoryChangeTypes.FAKE_FILTERED_INCOMING || type === HistoryChangeTypes.FAKE_FILTERED_OUTGOING;
};
export var findEndIndex = function (end) {
    var _a = end || {}, endIndex = _a.index, endType = _a.type;
    if (endIndex === undefined)
        return;
    return endType === HistoryChangeTypes.ENTITIES_MERGED_MANUALLY || endType === HistoryChangeTypes.ENTITIES_MERGED
        ? endIndex + 1
        : endIndex;
};
