/**
 * Takes an array of nodes that have parent references and turns them into a
 * tree of nodes. The original nodes are not modified, they are wrapped in a
 * new object. Uses a custom accessor for parent.
 *
 * @param {T[]} nodes
 * @param {(node: T) => T} parentAccessor
 * @template T
 * @returns {NodeWrapper<T>[]}
 */
export function nodesToTreesWithAccessor<T>(nodes: T[], parentAccessor: (node: T) => T): {
    ref: T;
    children: /*elided*/ any[];
}[];
/**
 * Takes an array of nodes that have parent references and turns them into a
 * tree of nodes. The original nodes are not modified, they are wrapped in a
 * new object.
 *
 * @param {T[]} nodes
 * @template {{ parent: T}} T
 */
export function nodesToTrees<T extends {
    parent: T;
}>(nodes: T[]): {
    ref: T;
    children: /*elided*/ any[];
}[];
/**
 * Visits a tree using depth-first search. Uses a custom accessor for children.
 *
 * @param {T} rootNode
 * @param {{ preOrder?: (node: T) => VisitResult, postOrder?: (node: T) => VisitResult }} visitor
 * @param {(node: T) => Iterable<T>} childrenAccessor
 * @returns {VisitResult}
 * @template T
 */
export function visitTreeWithAccessor<T>(rootNode: T, visitor: {
    preOrder?: (node: T) => void | "stop" | "skip";
    postOrder?: (node: T) => void | "stop" | "skip";
}, childrenAccessor: (node: T) => Iterable<T>): void | "stop" | "skip";
/**
 * Visits a tree using depth-first search.
 *
 * @param {T} rootNode
 * @param {{ preOrder?: (node: T) => VisitResult, postOrder?: (node: T) => VisitResult }} visitor
 * @returns {VisitResult}
 * @template {{ children: T[] }} T
 */
export function visitTree<T extends {
    children: T[];
}>(rootNode: T, visitor: {
    preOrder?: (node: T) => void | "stop" | "skip";
    postOrder?: (node: T) => void | "stop" | "skip";
}): void | "stop" | "skip";
//# sourceMappingURL=trees.d.ts.map