/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { assert } from "@fluidframework/core-utils/internal";
import { fail } from "../../util/index.js";
import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
import { SimpleContextSlot } from "./context.js";
/**
 * Gets the {@link TreeNodeSchema} for the {@link InnerNode}.
 */
export function getSimpleNodeSchemaFromInnerNode(innerNode) {
    const context = getSimpleContextFromInnerNode(innerNode);
    return context.schema.get(innerNode.schema) ?? fail("missing schema from context");
}
/**
 * Gets the {@link Context} for the {@link InnerNode}.
 */
export function getSimpleContextFromInnerNode(innerNode) {
    if (innerNode instanceof UnhydratedFlexTreeNode) {
        return innerNode.simpleContext;
    }
    const context = innerNode.anchorNode.anchorSet.slots.get(SimpleContextSlot);
    assert(context !== undefined, 0xa55 /* missing simple tree context */);
    return context;
}
//# sourceMappingURL=schemaCaching.js.map