import { MyersOperation } from './myers-diff'; /** * Comparator used to determine whether two sequence values are equal. */ type Comparator = (a: T, b: T) => boolean; /** * Hooks and comparators used to translate raw Myers operations into domain-specific diffs. */ export interface SequenceDiffOptions { /** Comparator to determine whether two items are equivalent. */ comparator?: Comparator; /** Builder invoked for insertions in the new sequence. */ buildAdded: (item: T, oldIdx: number, previousOldItem: T | undefined, newIdx: number) => Added | null | undefined; /** Builder invoked for deletions in the old sequence. */ buildDeleted: (item: T, oldIdx: number, newIdx: number) => Deleted | null | undefined; /** Builder invoked for modifications between old and new items. */ buildModified: (oldItem: T, newItem: T, oldIdx: number, newIdx: number) => Modified | null | undefined; /** Predicate to emit modifications even when items compare equal. */ shouldProcessEqualAsModification?: (oldItem: T, newItem: T, oldIdx: number, newIdx: number) => boolean; /** Predicate to treat delete+insert pairs as a modification. */ canTreatAsModification?: (deletedItem: T, insertedItem: T, oldIdx: number, newIdx: number) => boolean; /** Optional reordering hook for Myers operations before mapping. */ reorderOperations?: (operations: MyersOperation[]) => MyersOperation[]; } /** * Generic sequence diff helper built on top of Myers algorithm. * Allows callers to provide custom comparators and payload builders that determine how * additions, deletions, and modifications should be reported. * * @param oldSeq Original sequence to diff from. * @param newSeq Target sequence to diff against. * @param options Hook bundle that controls how additions/deletions/modifications are emitted. * @returns Sequence of mapped diff payloads produced by the caller-provided builders. */ export declare function diffSequences(oldSeq: T[], newSeq: T[], options: SequenceDiffOptions): Array; /** * Normalizes interleaved delete/insert operations so consumers can treat replacements as paired steps. * * @param operations Raw Myers operations. * @returns Normalized operation sequence with deletes and inserts paired. */ export declare function reorderDiffOperations(operations: MyersOperation[]): MyersOperation[]; export {}; //# sourceMappingURL=sequence-diffing.d.ts.map