import { Editor } from '../../core/Editor.js'; import { StoryLocator, TrackChangeOverlapInfo, TrackChangeType, TrackChangeWordRevisionIds, TrackedChangeAddress } from '../../../../../../document-api/src/index.js'; import { TrackedChangeRuntimeRef } from './tracked-change-runtime-ref.js'; export type GroupedTrackedChange = { rawId: string; commandRawId?: string; id: string; from: number; to: number; hasInsert: boolean; hasDelete: boolean; hasFormat: boolean; attrs: Record; excerpt?: string; wordRevisionIds?: TrackChangeWordRevisionIds; overlap?: TrackChangeOverlapInfo; }; export type TrackedChangeProjectedSide = 'inserted' | 'deleted'; type ChangeTypeInput = Pick; export declare function resolveTrackedChangeType(change: ChangeTypeInput): TrackChangeType; export declare function getTrackedChangeMarkAlias(mark: { readonly type: { readonly name: string; }; readonly attrs?: Readonly>; }): string | null; export declare function groupTrackedChanges(editor: Editor): GroupedTrackedChange[]; export declare function resolveTrackedChange(editor: Editor, id: string): GroupedTrackedChange | null; export declare function toCanonicalTrackedChangeId(editor: Editor, rawId: string): string | null; export declare function buildTrackedChangeCanonicalIdMap(editor: Editor): Map; export declare function splitProjectedTrackedChangeId(value: string): { baseId: string; side: TrackedChangeProjectedSide | null; }; /** * Resolves a tracked-change identity across stories. * * Accepts either: * - A bare canonical id string (body back-compat), OR * - A public {@link TrackedChangeAddress} (with optional `story`). * * Returns the grouped change AND the story editor that owns it, so callers * can apply mutations (accept/reject) against the correct runtime without * re-resolving. */ export interface ResolvedStoryTrackedChange { /** The owning story editor (body host editor OR a story runtime editor). */ editor: Editor; /** Public story locator. */ story: StoryLocator; /** Internal runtime ref. */ runtimeRef: TrackedChangeRuntimeRef; /** The grouped change in the owning editor. */ change: GroupedTrackedChange; /** Optional commit callback — present for non-body runtimes. */ commit?: (hostEditor: Editor) => void; } type TrackedChangeLookupInput = string | TrackedChangeAddress; /** * Resolves a tracked-change id/address to the owning story editor and the * grouped change within it. * * For body addresses (no `story` field) this is an O(n) search against the * host editor's grouped marks — same as the legacy body-only resolver. * * For non-body addresses it resolves the correct story runtime, then performs * the lookup within that editor's state. * * Returns `null` if the address resolves to no matching tracked change. */ export declare function resolveTrackedChangeInStory(hostEditor: Editor, input: TrackedChangeLookupInput): ResolvedStoryTrackedChange | null; export {}; //# sourceMappingURL=tracked-change-resolver.d.ts.map