/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { unreachableCase } from "@fluidframework/common-utils";
import { MarkType } from "./delta";
export const emptyDelta = new Map();
/**
 * Returns the number of nodes in the input tree that the mark affects or skips.
 */
export function inputLength(mark) {
    if (isSkipMark(mark)) {
        return mark;
    }
    // Inline into `switch(mark.type)` once we upgrade to TS 4.7
    const type = mark.type;
    switch (type) {
        case MarkType.Delete:
        case MarkType.MoveOut:
            return mark.count;
        case MarkType.Modify:
            return 1;
        case MarkType.Insert:
        case MarkType.MoveIn:
            return 0;
        default:
            unreachableCase(type);
    }
}
export function isSkipMark(mark) {
    return typeof mark === "number";
}
//# sourceMappingURL=deltaUtil.js.map