/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { FieldKey } from "./types";
/**
 * Identical to {@link UpPathDefault}, but a duplicate declaration is needed to make the default type parameter compile.
 * @alpha
 */
export declare type UpPathDefault = UpPath;
/**
 * Path from a location in the tree upward.
 * UpPaths can be used with deduplicated upper parts to allow
 * working with paths localized to part of the tree without incurring
 * costs related to the depth of the local subtree.
 *
 * UpPaths can be thought of as terminating at a special root node (that is `undefined`)
 * who's FieldKeys are all LocalFieldKey's that correspond to detached sequences.
 *
 * UpPaths can be mutated over time and should be considered to be invalidated when any edits occurs:
 * Use of an UpPath that was acquired before the most recent edit is undefined behavior.
 * @alpha
 */
export interface UpPath<TParent = UpPathDefault> {
    /**
     * The parent, or undefined in the case where this path is a member of a detached sequence.
     */
    readonly parent: TParent | undefined;
    /**
     * The Field under which this path points.
     * Note that if `parent` returns `undefined`, this key corresponds to a detached sequence.
     */
    readonly parentField: FieldKey;
    /**
     * The index within `parentField` this path is pointing to.
     */
    readonly parentIndex: number;
}
/**
 * Path from a field in the tree upward.
 *
 * See {@link UpPath}.
 * @alpha
 */
export interface FieldUpPath {
    /**
     * The parent, or undefined in the case where this path is to a detached sequence.
     */
    readonly parent: UpPath | undefined;
    /**
     * The Field to which this path points.
     * Note that if `parent` returns `undefined`, this key  corresponds to a detached sequence.
     */
    readonly field: FieldKey;
}
/**
 * @returns the number of nodes above this one.
 * Zero when the path's parent is undefined, meaning the path represents a node in a detached field.
 * Runs in O(depth) time.
 */
export declare function getDepth(path: UpPath): number;
/**
 * @returns a deep copy of the provided path as simple javascript objects.
 * This is safe to hold onto and use deep object comparisons on.
 */
export declare function clonePath(path: UpPath): UpPath;
/**
 * @returns a deep copy of the provided path as simple javascript objects.
 * This is safe to hold onto and use deep object comparisons on.
 */
export declare function clonePath(path: UpPath | undefined): UpPath | undefined;
/**
 * @returns The elements of the given `path`, ordered from root-most to child-most.
 * These elements are unchanged and therefore still point "up".
 */
export declare function topDownPath(path: UpPath | undefined): UpPath[];
/**
 * @returns true iff `a` and `b` describe the same path.
 *
 * Note that for mutable paths (as used in `AnchorSet`), this equality may change over time: this only checks if the two paths are currently the same.
 */
export declare function compareUpPaths(a: UpPath | undefined, b: UpPath | undefined): boolean;
/**
 * @returns true iff `a` and `b` describe the same field path.
 *
 * Note that for mutable paths (as used in `AnchorSet`), this equality may change over time: this only checks if the two paths are currently the same.
 */
export declare function compareFieldUpPaths(a: FieldUpPath, b: FieldUpPath): boolean;
//# sourceMappingURL=pathTree.d.ts.map