/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { subtractChangeAtomIds, } from "../../core/index.js";
import { brand, RangeMap } from "../../util/index.js";
export function newCrossFieldKeyTable() {
    return new RangeMap(offsetCrossFieldKey, subtractCrossFieldKeys);
}
function offsetCrossFieldKey(key, offset) {
    return {
        ...key,
        localId: brand(key.localId + offset),
    };
}
function subtractCrossFieldKeys(a, b) {
    const cmpTarget = a.target - b.target;
    if (cmpTarget !== 0) {
        return cmpTarget * Number.POSITIVE_INFINITY;
    }
    return subtractChangeAtomIds(a, b);
}
//# sourceMappingURL=modularChangeTypes.js.map