"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.CheckoutFlexTreeView = void 0;
const feature_libraries_1 = require("../feature-libraries");
const util_1 = require("../util");
/**
 * Implementation of FlexTreeView wrapping a ITreeCheckout.
 */
class CheckoutFlexTreeView {
    constructor(checkout, schema, nodeKeyManager, nodeKeyFieldKey, onDispose) {
        this.checkout = checkout;
        this.schema = schema;
        this.nodeKeyManager = nodeKeyManager;
        this.nodeKeyFieldKey = nodeKeyFieldKey;
        this.onDispose = onDispose;
        this.context = (0, feature_libraries_1.getTreeContext)(schema, this.checkout.forest, this.checkout.editor, nodeKeyManager, nodeKeyFieldKey);
        this.editableTree = this.context.root;
    }
    [util_1.disposeSymbol]() {
        this.context[util_1.disposeSymbol]();
        this.onDispose?.();
    }
    fork() {
        const branch = this.checkout.fork();
        return new CheckoutFlexTreeView(branch, this.schema, this.nodeKeyManager, this.nodeKeyFieldKey);
    }
}
exports.CheckoutFlexTreeView = CheckoutFlexTreeView;
//# sourceMappingURL=treeView.js.map