import type { TransformValue } from './transform.js'; import type { HierarchyNode } from 'd3-hierarchy'; export interface FlatHierarchyDatum { readonly id: string; readonly parentId: string | null; readonly name: string; readonly datum: TDatum | null; readonly sourceIndex: number | null; } export type FlatHierarchyNode = HierarchyNode> & { readonly id: string; }; export interface FlatHierarchy { readonly data: readonly TDatum[]; readonly root: FlatHierarchyNode; } export interface FlatHierarchyNodeContext { readonly id: string; readonly parentId: string | null; readonly name: string; readonly data: TDatum | null; readonly depth: number; readonly height: number; readonly internal: boolean; readonly external: boolean; readonly source: readonly TDatum[]; readonly sourceIndexes: readonly number[]; } export interface FlatHierarchyPathOptions { readonly path: TransformValue; readonly delimiter?: string; readonly id?: never; readonly parentId?: never; } export interface FlatHierarchyParentOptions { readonly id: TransformValue; readonly parentId: TransformValue; readonly path?: never; readonly delimiter?: never; } export type FlatHierarchyOptions = FlatHierarchyPathOptions | FlatHierarchyParentOptions; /** Builds a private D3 hierarchy while retaining honest raw-row lineage. */ export declare function buildFlatHierarchy(source: Iterable, options: FlatHierarchyOptions, owner: string): FlatHierarchy; /** Materializes the hierarchy metadata shared by public hierarchy layouts. */ export declare function flatHierarchyNodeContext(node: FlatHierarchyNode): FlatHierarchyNodeContext; /** Aggregates nonnegative source values without expanding node lineage. */ export declare function aggregateFlatHierarchyValues(hierarchy: FlatHierarchy, value: TransformValue, owner: string): void; /** Returns root-to-parent ids for a hierarchy node. */ export declare function flatHierarchyAncestorIds(node: FlatHierarchyNode): readonly string[]; /** Returns the depth-one branch containing a node, or null for the root. */ export declare function flatHierarchyBranchId(node: FlatHierarchyNode): string | null; export declare function flatHierarchyNodeValue(node: FlatHierarchyNode): number;