## Alpha API Report File for "@fluidframework/merge-tree"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @alpha @legacy
export interface AdjustParams {
    delta: number;
    max?: number | undefined;
    min?: number | undefined;
}

// @alpha @legacy
export function appendToMergeTreeDeltaRevertibles(deltaArgs: IMergeTreeDeltaCallbackArgs, revertibles: MergeTreeDeltaRevertible[]): void;

// @alpha @legacy (undocumented)
export abstract class BaseSegment implements ISegment {
    constructor(properties?: PropertySet);
    // (undocumented)
    protected addSerializedProps(jseg: IJSONSegment): void;
    // (undocumented)
    append(other: ISegment): void;
    // (undocumented)
    attribution?: IAttributionCollection<AttributionKey>;
    // (undocumented)
    cachedLength: number;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    abstract clone(): ISegment;
    // (undocumented)
    protected cloneInto(b: ISegment): void;
    // (undocumented)
    protected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;
    // (undocumented)
    hasProperty(key: string): boolean;
    // (undocumented)
    isLeaf(): this is ISegment;
    // (undocumented)
    properties?: PropertySet;
    // (undocumented)
    splitAt(pos: number): ISegment | undefined;
    // (undocumented)
    abstract toJSONObject(): any;
    // (undocumented)
    readonly trackingCollection: TrackingGroupCollection;
    // (undocumented)
    abstract readonly type: string;
}

// @alpha @legacy
export function discardMergeTreeDeltaRevertible(revertibles: MergeTreeDeltaRevertible[]): void;

// @alpha @legacy
export function endpointPosAndSide(start: SequencePlace | undefined, end: SequencePlace | undefined): {
    startSide: Side | undefined;
    endSide: Side | undefined;
    startPos: number | "start" | "end" | undefined;
    endPos: number | "start" | "end" | undefined;
};

// @alpha @legacy (undocumented)
export interface IAttributionCollection<T> {
    // (undocumented)
    append(other: IAttributionCollection<T>): void;
    // (undocumented)
    readonly channelNames: Iterable<string>;
    // (undocumented)
    clone(): IAttributionCollection<T>;
    getAll(): IAttributionCollectionSpec<T>;
    getAtOffset(offset: number, channel?: string): AttributionKey | undefined;
    getKeysInOffsetRange(startOffset: number, endOffset?: number, channel?: string): {
        offset: number;
        key: AttributionKey;
    }[] | undefined;
    readonly length: number;
    // (undocumented)
    splitAt(pos: number): IAttributionCollection<T>;
    update(name: string | undefined, channel: IAttributionCollection<T>): void;
}

// @alpha @sealed @legacy (undocumented)
export interface IAttributionCollectionSerializer {
    populateAttributionCollections(segments: Iterable<ISegment>, summary: SerializedAttributionCollection): void;
    // (undocumented)
    serializeAttributionCollections(segments: Iterable<{
        attribution?: IAttributionCollection<AttributionKey>;
        cachedLength: number;
    }>): SerializedAttributionCollection;
}

// @alpha @legacy (undocumented)
export interface IAttributionCollectionSpec<T> {
    // (undocumented)
    channels?: {
        [name: string]: Iterable<{
            offset: number;
            key: T | null;
        }>;
    };
    // (undocumented)
    length: number;
    // (undocumented)
    root: Iterable<{
        offset: number;
        key: T | null;
    }>;
}

// @alpha @legacy (undocumented)
export interface IJSONMarkerSegment extends IJSONSegment {
    // (undocumented)
    marker: IMarkerDef;
}

// @alpha @legacy (undocumented)
export interface IJSONSegment {
    // (undocumented)
    props?: Record<string, any>;
}

// @alpha @legacy (undocumented)
export interface IJSONTextSegment extends IJSONSegment {
    // (undocumented)
    text: string;
}

// @alpha @legacy (undocumented)
export interface IMarkerDef {
    // (undocumented)
    refType?: ReferenceType;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeAnnotateAdjustMsg extends IMergeTreeDelta {
    // (undocumented)
    adjust: Record<string, AdjustParams>;
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    props?: never;
    // (undocumented)
    relativePos1?: undefined;
    // (undocumented)
    relativePos2?: undefined;
    // (undocumented)
    type: typeof MergeTreeDeltaType.ANNOTATE;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeAnnotateMsg extends IMergeTreeDelta {
    // (undocumented)
    adjust?: never;
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    props: Record<string, any>;
    // (undocumented)
    relativePos1?: IRelativePosition;
    // (undocumented)
    relativePos2?: IRelativePosition;
    // (undocumented)
    type: typeof MergeTreeDeltaType.ANNOTATE;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeDelta {
    type: MergeTreeDeltaType;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeDeltaCallbackArgs<TOperationType extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType> {
    readonly deltaSegments: IMergeTreeSegmentDelta[];
    readonly operation: TOperationType;
}

// @alpha @legacy (undocumented)
export type IMergeTreeDeltaOp = IMergeTreeInsertMsg | IMergeTreeRemoveMsg | IMergeTreeAnnotateMsg | IMergeTreeAnnotateAdjustMsg | IMergeTreeObliterateMsg | IMergeTreeObliterateSidedMsg;

// @alpha @legacy (undocumented)
export interface IMergeTreeDeltaOpArgs {
    readonly groupOp?: IMergeTreeGroupMsg;
    readonly op: IMergeTreeOp;
    readonly rollback?: true;
    readonly sequencedMessage?: ISequencedDocumentMessage;
}

// @alpha @deprecated @legacy (undocumented)
export interface IMergeTreeGroupMsg extends IMergeTreeDelta {
    // (undocumented)
    ops: IMergeTreeDeltaOp[];
    // (undocumented)
    type: typeof MergeTreeDeltaType.GROUP;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeInsertMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    relativePos1?: IRelativePosition;
    // (undocumented)
    relativePos2?: IRelativePosition;
    // (undocumented)
    seg?: any;
    // (undocumented)
    type: typeof MergeTreeDeltaType.INSERT;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeMaintenanceCallbackArgs extends IMergeTreeDeltaCallbackArgs<MergeTreeMaintenanceType> {
}

// @alpha @deprecated @legacy (undocumented)
export interface IMergeTreeObliterateMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    relativePos1?: never;
    relativePos2?: never;
    // (undocumented)
    type: typeof MergeTreeDeltaType.OBLITERATE;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeObliterateSidedMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1: {
        pos: number;
        before: boolean;
    };
    // (undocumented)
    pos2: {
        pos: number;
        before: boolean;
    };
    relativePos1?: never;
    relativePos2?: never;
    // (undocumented)
    type: typeof MergeTreeDeltaType.OBLITERATE_SIDED;
}

// @alpha @legacy (undocumented)
export type IMergeTreeOp = IMergeTreeDeltaOp | IMergeTreeGroupMsg;

// @alpha @legacy (undocumented)
export interface IMergeTreeOptions {
    // (undocumented)
    catchUpBlobName?: string;
    mergeTreeEnableAnnotateAdjust?: boolean;
    mergeTreeEnableObliterate?: boolean;
    mergeTreeEnableObliterateReconnect?: boolean;
    mergeTreeEnableSidedObliterate?: boolean;
    mergeTreeReferencesCanSlideToEndpoint?: boolean;
    // (undocumented)
    mergeTreeSnapshotChunkSize?: number;
    newMergeTreeSnapshotFormat?: boolean;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeRemoveMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    relativePos1?: IRelativePosition;
    // (undocumented)
    relativePos2?: IRelativePosition;
    // (undocumented)
    type: typeof MergeTreeDeltaType.REMOVE;
}

// @alpha @legacy (undocumented)
export interface IMergeTreeSegmentDelta {
    propertyDeltas?: PropertySet;
    segment: ISegment;
}

// @alpha @legacy
export interface InteriorSequencePlace {
    // (undocumented)
    pos: number;
    // (undocumented)
    side: Side;
}

// @alpha @legacy
export interface IRelativePosition {
    before?: boolean;
    id?: string;
    offset?: number;
}

// @alpha @legacy
export interface ISegment {
    // (undocumented)
    append(segment: ISegment): void;
    attribution?: IAttributionCollection<AttributionKey>;
    cachedLength: number;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    clone(): ISegment;
    // (undocumented)
    isLeaf(): this is ISegment;
    properties?: PropertySet;
    // (undocumented)
    splitAt(pos: number): ISegment | undefined;
    // (undocumented)
    toJSONObject(): any;
    // (undocumented)
    readonly trackingCollection: TrackingGroupCollection;
    // (undocumented)
    readonly type: string;
}

// @alpha @legacy (undocumented)
export interface ISegmentAction<TClientData> {
    // (undocumented)
    (segment: ISegment, pos: number, refSeq: number, clientId: number, start: number, end: number, accum: TClientData): boolean;
}

// @alpha @legacy (undocumented)
export interface ITrackingGroup {
    // (undocumented)
    has(trackable: Trackable): boolean;
    // (undocumented)
    link(trackable: Trackable): void;
    // (undocumented)
    size: number;
    // (undocumented)
    tracked: readonly Trackable[];
    // (undocumented)
    unlink(trackable: Trackable): boolean;
}

// @alpha @sealed @legacy (undocumented)
export interface LocalReferencePosition extends ReferencePosition {
    // (undocumented)
    addProperties(newProps: PropertySet): void;
    // (undocumented)
    callbacks?: Partial<Record<"beforeSlide" | "afterSlide", (ref: LocalReferencePosition) => void>>;
    readonly canSlideToEndpoint?: boolean;
    // (undocumented)
    readonly trackingCollection: TrackingGroupCollection;
}

// @alpha @legacy
export interface MapLike<T> {
    // (undocumented)
    [index: string]: T;
}

// @alpha @legacy
export class Marker extends BaseSegment implements ReferencePosition, ISegment {
    constructor(refType: ReferenceType, props?: PropertySet);
    // (undocumented)
    append(): void;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    clone(): Marker;
    // (undocumented)
    protected createSplitSegmentAt(pos: number): undefined;
    // (undocumented)
    static fromJSONObject(spec: IJSONSegment): Marker | undefined;
    // (undocumented)
    getId(): string | undefined;
    // (undocumented)
    getOffset(): number;
    // (undocumented)
    getProperties(): PropertySet | undefined;
    // (undocumented)
    getSegment(): Marker;
    // (undocumented)
    static is(segment: ISegment): segment is Marker;
    // (undocumented)
    static make(refType: ReferenceType, props?: PropertySet): Marker;
    // (undocumented)
    refType: ReferenceType;
    // (undocumented)
    toJSONObject(): IJSONMarkerSegment;
    // (undocumented)
    toString(): string;
    // (undocumented)
    static readonly type = "Marker";
    // (undocumented)
    readonly type = "Marker";
}

// @alpha @legacy (undocumented)
export type MergeTreeDeltaOperationType = typeof MergeTreeDeltaType.ANNOTATE | typeof MergeTreeDeltaType.INSERT | typeof MergeTreeDeltaType.REMOVE | typeof MergeTreeDeltaType.OBLITERATE;

// @alpha @legacy (undocumented)
export type MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType | MergeTreeMaintenanceType;

// @alpha @legacy (undocumented)
export type MergeTreeDeltaRevertible = {
    operation: typeof MergeTreeDeltaType.INSERT;
    trackingGroup: ITrackingGroup;
} | {
    operation: typeof MergeTreeDeltaType.REMOVE;
    trackingGroup: ITrackingGroup;
} | {
    operation: typeof MergeTreeDeltaType.ANNOTATE;
    trackingGroup: ITrackingGroup;
    propertyDeltas: PropertySet;
};

// @alpha @legacy (undocumented)
export const MergeTreeDeltaType: {
    readonly INSERT: 0;
    readonly REMOVE: 1;
    readonly ANNOTATE: 2;
    readonly GROUP: 3;
    readonly OBLITERATE: 4;
    readonly OBLITERATE_SIDED: 5;
};

// @alpha @legacy (undocumented)
export type MergeTreeDeltaType = (typeof MergeTreeDeltaType)[keyof typeof MergeTreeDeltaType];

// @alpha @legacy
export const MergeTreeMaintenanceType: {
    readonly APPEND: -1;
    readonly SPLIT: -2;
    readonly UNLINK: -3;
    readonly ACKNOWLEDGED: -4;
};

// @alpha @legacy (undocumented)
export type MergeTreeMaintenanceType = (typeof MergeTreeMaintenanceType)[keyof typeof MergeTreeMaintenanceType];

// @alpha @legacy (undocumented)
export interface MergeTreeRevertibleDriver {
    // (undocumented)
    annotateRange(start: number, end: number, props: PropertySet): void;
    // (undocumented)
    insertFromSpec(pos: number, spec: IJSONSegment): void;
    // (undocumented)
    removeRange(start: number, end: number): void;
}

// @alpha @legacy
export type PropertySet = MapLike<any>;

// @alpha @legacy
export interface ReferencePosition {
    getOffset(): number;
    getSegment(): ISegment | undefined;
    // (undocumented)
    isLeaf(): this is ISegment;
    properties?: PropertySet;
    // (undocumented)
    refType: ReferenceType;
    slidingPreference?: SlidingPreference;
}

// @alpha @legacy
export enum ReferenceType {
    RangeBegin = 16,
    RangeEnd = 32,
    // (undocumented)
    Simple = 0,
    SlideOnRemove = 64,
    StayOnRemove = 128,
    Tile = 1,
    Transient = 256
}

// @alpha @legacy
export const refGetTileLabels: (refPos: ReferencePosition) => string[] | undefined;

// @alpha @legacy
export function refHasTileLabel(refPos: ReferencePosition, label: string): boolean;

// @alpha @legacy
export const reservedMarkerIdKey = "markerId";

// @alpha @legacy
export function revertMergeTreeDeltaRevertibles(driver: MergeTreeRevertibleDriver, revertibles: MergeTreeDeltaRevertible[]): void;

// @alpha @legacy
export function segmentIsRemoved(segment: ISegment): boolean;

// @alpha @legacy (undocumented)
export interface SequenceOffsets {
    // (undocumented)
    posBreakpoints: number[];
    seqs: (number | AttributionKey | null)[];
}

// @alpha @legacy
export type SequencePlace = number | "start" | "end" | InteriorSequencePlace;

// @alpha @legacy (undocumented)
export interface SerializedAttributionCollection extends SequenceOffsets {
    // (undocumented)
    channels?: {
        [name: string]: SequenceOffsets;
    };
    // (undocumented)
    length: number;
}

// @alpha @legacy
export enum Side {
    // (undocumented)
    After = 1,
    // (undocumented)
    Before = 0
}

// @alpha @legacy
export const SlidingPreference: {
    readonly BACKWARD: 0;
    readonly FORWARD: 1;
};

// @alpha @legacy
export type SlidingPreference = (typeof SlidingPreference)[keyof typeof SlidingPreference];

// @alpha @legacy (undocumented)
export class TextSegment extends BaseSegment {
    constructor(text: string, props?: PropertySet);
    // (undocumented)
    append(segment: ISegment): void;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    clone(start?: number, end?: number): TextSegment;
    // (undocumented)
    protected createSplitSegmentAt(pos: number): TextSegment | undefined;
    // (undocumented)
    static fromJSONObject(spec: string | IJSONSegment): TextSegment | undefined;
    // (undocumented)
    static is(segment: ISegment): segment is TextSegment;
    // (undocumented)
    static make(text: string, props?: PropertySet): TextSegment;
    // (undocumented)
    text: string;
    // (undocumented)
    toJSONObject(): IJSONTextSegment | string;
    // (undocumented)
    toString(): string;
    // (undocumented)
    static readonly type = "TextSegment";
    // (undocumented)
    readonly type = "TextSegment";
}

// @alpha @legacy (undocumented)
export type Trackable = ISegment | LocalReferencePosition;

// @alpha @legacy (undocumented)
export class TrackingGroup implements ITrackingGroup {
    constructor();
    // (undocumented)
    has(trackable: Trackable): boolean;
    // (undocumented)
    link(trackable: Trackable): void;
    // (undocumented)
    get size(): number;
    // (undocumented)
    get tracked(): readonly Trackable[];
    // (undocumented)
    unlink(trackable: Trackable): boolean;
}

// @alpha @legacy
export class TrackingGroupCollection {
    constructor(trackable: Trackable);
    // (undocumented)
    copyTo(trackable: Trackable): void;
    // (undocumented)
    get empty(): boolean;
    // (undocumented)
    link(trackingGroup: ITrackingGroup): void;
    // (undocumented)
    matches(trackingCollection: TrackingGroupCollection): boolean;
    // (undocumented)
    get trackingGroups(): Set<TrackingGroup>;
    // (undocumented)
    unlink(trackingGroup: ITrackingGroup): boolean;
}

// (No @packageDocumentation comment for this package)

```
