import { R as RowData, c as Table, f as Row, am as RowModel } from '../types-CwNe64f5.cjs'; interface TreeNode { /** The path segments for this node */ path: string[]; /** The original data (may be synthetic for intermediate nodes) */ data: TData; /** Child nodes */ children: TreeNode[]; /** Depth in the tree (0-based) */ depth: number; /** Whether this node is a leaf (has no children) */ isLeaf: boolean; /** Unique key derived from the full path */ key: string; } interface TreeDataOptions { /** Callback that returns the path array for a data item */ getDataPath: (data: TData) => string[]; /** Whether to auto-expand all nodes initially */ autoExpandAll?: boolean; /** Maximum depth to auto-expand */ autoExpandDepth?: number; } interface TreeRowModelOptions { /** Filter a tree before flattening; ancestors of matching nodes are retained. */ filterNode?: (node: TreeNode) => boolean; /** Sort sibling nodes recursively before flattening. */ compareNodes?: (a: TreeNode, b: TreeNode) => number; /** Expanded state used for flattening. */ expanded?: Record | true; /** Force retained filter paths open so matching descendants are visible. */ expandFilteredPaths?: boolean; } /** * Build a tree structure from flat data using path arrays. * Each data item's path defines its position in the hierarchy. * * @example * ``` * const data = [ * { name: 'USA', value: 100 }, * { name: 'California', value: 50 }, * { name: 'San Francisco', value: 20 }, * ] * // With getDataPath returning: * // ['USA'] for first item * // ['USA', 'California'] for second * // ['USA', 'California', 'San Francisco'] for third * ``` */ declare function buildTreeFromPaths(data: TData[], getDataPath: (item: TData) => string[]): TreeNode[]; /** * Flatten a tree of nodes into a row array, respecting expanded state. * Only includes children of expanded nodes. */ declare function flattenTree(table: Table, treeNodes: TreeNode[], expanded: Record | true): Row[]; /** * Filter tree data, keeping parent chain visible when a child matches. * Returns a new tree with only matching nodes and their ancestors. */ declare function filterTreeData(nodes: TreeNode[], predicate: (node: TreeNode) => boolean): TreeNode[]; /** * Sort tree data recursively. Children are sorted independently at each level. */ declare function sortTreeData(nodes: TreeNode[], compareFn: (a: TreeNode, b: TreeNode) => number): TreeNode[]; /** * Create a RowModel from tree data, applying the full tree processing pipeline. */ declare function getTreeRowModel(table: Table, data: TData[], getDataPath: (item: TData) => string[], options?: TreeRowModelOptions): RowModel; /** * Get the tree depth for a row (shortcut for row._treeDepth). */ declare function getTreeDepth(row: Row): number; /** * Check if a row is a leaf node (no children). */ declare function isLeafRow(row: Row): boolean; /** * Get the parent row by looking up parentId in the row model. */ declare function getParentRow(row: Row, table: Table): Row | undefined; /** * Aggregate values from leaf rows to parent nodes. */ declare function aggregateTreeValues(nodes: TreeNode[], _columnId: string, aggregationFn: (values: unknown[]) => unknown, getValueFromData: (data: TData) => unknown): Map; export { type TreeDataOptions, type TreeNode, type TreeRowModelOptions, aggregateTreeValues, buildTreeFromPaths, filterTreeData, flattenTree, getParentRow, getTreeDepth, getTreeRowModel, isLeafRow, sortTreeData };