import { Anchor } from './rga/constants';
import { Point } from './rga/Point';
import { Range } from './rga/Range';
import { Editor } from './editor/Editor';
import { type ArrNode } from '../../json-crdt/nodes';
import { Slices } from './slice/Slices';
import { Overlay } from './overlay/Overlay';
import { Model, type StrApi } from '../../json-crdt/model';
import { Fragment } from './block/Fragment';
import type { ITimestampStruct } from '../../json-crdt-patch/clock';
import type { Printable } from 'tree-dump/lib/types';
import type { MarkerSlice } from './slice/MarkerSlice';
import type { SliceSchema, SliceType } from './slice/types';
import type { SchemaToJsonNode } from '../../json-crdt/schema/types';
import type { AbstractRga } from '../../json-crdt/nodes/rga';
import type { ChunkSlice } from './util/ChunkSlice';
declare const EXTRA_SLICES_SCHEMA: import("../../json-crdt-patch").nodes.vec<[import("../../json-crdt-patch").nodes.arr<SliceSchema>]>;
type SlicesModel = Model<SchemaToJsonNode<typeof EXTRA_SLICES_SCHEMA>>;
/**
 * Context for a Peritext instance. Contains all the data and methods needed to
 * interact with the text.
 */
export declare class Peritext<T = string> implements Printable {
    readonly model: Model;
    readonly str: AbstractRga<T>;
    /**
     * *Slices* are rich-text annotations that appear in the text. The "saved"
     * slices are the ones that are persisted in the document.
     */
    readonly savedSlices: Slices<T>;
    /**
     * *Extra slices* are slices that are not persisted in the document. However,
     * they are still shared across users, i.e. they are ephemerally persisted
     * during the editing session.
     */
    readonly extraSlices: Slices<T>;
    /**
     * *Local slices* are slices that are not persisted in the document and are
     * not shared with other users. They are used only for local annotations for
     * the current user.
     */
    readonly localSlices: Slices<T>;
    readonly editor: Editor<T>;
    readonly overlay: Overlay<T>;
    readonly blocks: Fragment<T>;
    /**
     * Creates a new Peritext context.
     *
     * @param model JSON CRDT model of the document where the text is stored.
     * @param str The {@link StrNode} where the text is stored.
     * @param slices The {@link ArrNode} where the slices are stored.
     * @param extraSlicesModel The JSON CRDT model for the extra slices, which are
     *        not persisted in the main document, but are shared with other users.
     * @param localSlicesModel The JSON CRDT model for the local slices, which are
     *        not persisted in the main document and are not shared with other
     *        users. The local slices capture current-user-only annotations, such
     *        as the current user's selection.
     */
    constructor(model: Model, str: AbstractRga<T>, slices: ArrNode, extraSlicesModel?: SlicesModel, localSlicesModel?: SlicesModel);
    strApi(): StrApi;
    /** Select a single character before a point. */
    findCharBefore(point: Point<T>): Range<T> | undefined;
    /**
     * Creates a point at a character ID.
     *
     * @param id Character ID to which the point should be attached.
     * @param anchor Whether the point should be before or after the character.
     * @returns The point.
     */
    point(id?: ITimestampStruct, anchor?: Anchor): Point<T>;
    /**
     * Creates a point at a view position in the text. The `pos` argument
     * specifies the position of the character, not the gap between characters.
     *
     * @param pos Position of the character in the text.
     * @param anchor Whether the point should attach before or after a character.
     *               Defaults to "before".
     * @returns The point.
     */
    pointAt(pos: number, anchor?: Anchor): Point<T>;
    /**
     * Creates a point which is attached to the start of the text, before the
     * first character.
     *
     * @returns A point at the start of the text.
     */
    pointAbsStart(): Point<T>;
    /**
     * Creates a point which is attached to the end of the text, after the last
     * character.
     *
     * @returns A point at the end of the text.
     */
    pointAbsEnd(): Point<T>;
    pointStart(): Point<T> | undefined;
    pointEnd(): Point<T> | undefined;
    /**
     * Creates a range from two points. The points can be in any order.
     *
     * @param p1 Point
     * @param p2 Point
     * @returns A range with points in correct order.
     */
    rangeFromPoints(p1: Point<T>, p2: Point<T>): Range<T>;
    rangeFromChunkSlice(slice: ChunkSlice<T>): Range<T>;
    /**
     * Creates a range from two points, the points have to be in the correct
     * order.
     *
     * @param start Start point of the range, must be before or equal to end.
     * @param end End point of the range, must be after or equal to start.
     * @returns A range with the given start and end points.
     */
    range(start: Point<T>, end?: Point<T>): Range<T>;
    /**
     * A convenience method for creating a range from a view position and a
     * length. See {@link Range.at} for more information.
     *
     * @param start Position in the text.
     * @param length Length of the range.
     * @returns A range from the given position with the given length.
     */
    rangeAt(start: number, length?: number): Range<T>;
    /**
     * Creates selection of relative start and end of the whole document.
     *
     * @returns Range, which selects the whole document, if any.
     */
    rangeAll(): Range<T> | undefined;
    fragment(range: Range<T>): Fragment<T>;
    /**
     * Insert plain text at a view position in the text.
     *
     * @param pos View position in the text.
     * @param text Text to insert.
     */
    insAt(pos: number, text: string): void;
    /**
     * Insert plain text after a character referenced by its ID and return the
     * ID of the insertion operation.
     *
     * @param after Character ID after which the text should be inserted.
     * @param text Text to insert.
     * @returns ID of the insertion operation.
     */
    ins(after: ITimestampStruct, text: string): ITimestampStruct;
    delAt(pos: number, len: number): void;
    del(range: Range<T>): void;
    delStr(range: Range<T>): boolean;
    delSlices(range: Range<T>): boolean;
    /** @deprecated Use the method in `Editor` and `Cursor` instead. */
    insMarker(after: ITimestampStruct, type: SliceType, data?: unknown, char?: string): MarkerSlice<T>;
    /** @todo This can probably use .del() */
    delMarker(split: MarkerSlice<T>): void;
    toString(tab?: string): string;
    hash: number;
    refresh(): number;
}
export {};
