"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIntention = exports.NodeExistenceState = exports.isolatedFieldChangeRebaser = exports.referenceFreeFieldChangeRebaser = void 0;
/**
 * Helper for creating a {@link FieldChangeRebaser} which does not need access to revision tags.
 * This should only be used for fields where the child nodes cannot be edited.
 */
function referenceFreeFieldChangeRebaser(data) {
    return isolatedFieldChangeRebaser({
        compose: (change1, change2, _composeChild, _genId) => data.compose(change1.change, change2.change),
        invert: (change, _invertChild, _genId) => data.invert(change.change),
        rebase: (change, over, _rebaseChild, _genId) => data.rebase(change, over.change),
    });
}
exports.referenceFreeFieldChangeRebaser = referenceFreeFieldChangeRebaser;
function isolatedFieldChangeRebaser(data) {
    return {
        ...data,
        prune: (change) => change,
    };
}
exports.isolatedFieldChangeRebaser = isolatedFieldChangeRebaser;
/**
 * @internal
 */
var NodeExistenceState;
(function (NodeExistenceState) {
    NodeExistenceState[NodeExistenceState["Alive"] = 0] = "Alive";
    NodeExistenceState[NodeExistenceState["Dead"] = 1] = "Dead";
})(NodeExistenceState || (exports.NodeExistenceState = NodeExistenceState = {}));
/**
 * @internal
 */
function getIntention(rev, revisionMetadata) {
    return revisionMetadata.tryGetInfo(rev)?.rollbackOf ?? rev;
}
exports.getIntention = getIntention;
//# sourceMappingURL=fieldChangeHandler.js.map