import { DiffType } from 'api-smart-diff'; import { DiffBlockData } from '../diff-builder/common'; /** Pre-computed index entry for a block */ export interface BlockIndexEntry { block: DiffBlockData; parentId: string | null; depth: number; /** Aggregate classification counts (mirrors block.diffs) */ counts: { breaking: number; nonBreaking: number; annotation: number; unclassified: number; }; /** Direct diff type if block has a change */ diffType?: DiffType; /** All ancestor block IDs from root to parent */ ancestorIds: string[]; } /** Pre-computed index for the entire block tree */ export interface BlockTreeIndex { /** blockId → entry (O(1) lookup) */ byId: Map; /** All container block IDs (have children), for filter operations */ containerIds: string[]; /** Container blocks grouped by which diff types they contain */ containersByMatchingType: Map>; /** Container blocks that match NO diff type (no changes at all) */ unchangedContainers: Set; /** All blocks with direct changes, sorted by document order */ changedBlocks: { blockId: string; diffType: DiffType; block: DiffBlockData; }[]; /** Changed blocks grouped by type, sorted by document order */ changedByType: Map; } /** * Build the block tree index. Called once after buildDiffBlock(). * O(N) where N = total nodes in the tree. */ export declare function buildBlockTreeIndex(blocks: DiffBlockData[]): BlockTreeIndex;