export function followRedone(store: StructStore, id: ID): {
    item: Item;
    diff: number;
};
export function keepItem(item: Item | null, keep: boolean): void;
export function splitItem(transaction: Transaction | null, leftItem: Item, diff: number): Item;
export function redoItem(transaction: Transaction, item: Item, redoitems: Set<Item>, itemsToDelete: DeleteSet, ignoreRemoteMapChanges: boolean): Item | null;
export function getSourceFromTransaction(transaction: Transaction): "local" | "level" | "decoder";
/**
 * Abstract class that represents any content.
 */
export class Item extends AbstractStruct {
    /**
     * @param {ID} id
     * @param {Item | null} left
     * @param {ID | null} origin
     * @param {Item | null} right
     * @param {ID | null} rightOrigin
     * @param {AbstractType<any>|ID|null} parent Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it.
     * @param {string | null} parentSub
     * @param {AbstractContent} content
     * @param {Array<Signature> | null | undefined} signature
     * @param {string} source
     * @param {IntegrateSignature | null | undefined} integrateSignature
     * @param {Array<DeleteSignature> | null | undefined} deleteSignature
     */
    constructor(id: ID, left: Item | null, origin: ID | null, right: Item | null, rightOrigin: ID | null, parent: AbstractType<any> | ID | null, parentSub: string | null, content: AbstractContent, signature?: Array<Signature> | null | undefined, source?: string, integrateSignature?: IntegrateSignature | null | undefined, deleteSignature?: Array<DeleteSignature> | null | undefined);
    /**
     * The item that was originally to the left of this item.
     * @type {ID | null}
     */
    origin: ID | null;
    /**
     * The item that is currently to the left of this item.
     * @type {Item | null}
     */
    left: Item | null;
    /**
     * The item that is currently to the right of this item.
     * @type {Item | null}
     */
    right: Item | null;
    /**
     * The item that was originally to the right of this item.
     * @type {ID | null}
     */
    rightOrigin: ID | null;
    /**
     * @type {AbstractType<any>|ID|null}
     */
    parent: AbstractType<any> | ID | null;
    /**
     * If the parent refers to this item with some kind of key (e.g. YMap, the
     * key is specified here. The key is then used to refer to the list in which
     * to insert this item. If `parentSub = null` type._start is the list in
     * which to insert to. Otherwise it is `parent._map`.
     * @type {String | null}
     */
    parentSub: string | null;
    /**
     * If this type's effect is redone this type refers to the type that undid
     * this operation.
     * @type {ID | null}
     */
    redone: ID | null;
    /**
     * @type {AbstractContent}
     */
    content: AbstractContent;
    /**
     * bit1: keep
     * bit2: countable
     * bit3: deleted
     * bit4: mark - mark node as fast-search-marker
     * @type {number} byte
     */
    info: number;
    hidden: boolean;
    signature: Signature[] | null;
    integrateSignature: IntegrateSignature | null;
    /**
     * @type {Array<DeleteSignature> | null}
     */
    deleteSignature: Array<DeleteSignature> | null;
    source: string;
    /**
     * @type {Array<MerkleTreeLeafNode> | null}
     */
    merkleTreeLeafNodes: Array<MerkleTreeLeafNode> | null;
    /**
     * 冲突链前item
     * @type {Item | null | undefined}
     */
    nextConflict: Item | null | undefined;
    /**
     * 冲突链后item
     * @type {Item | null | undefined}
     */
    prevConflict: Item | null | undefined;
    /**
     * This is used to mark the item as an indexed fast-search marker
     *
     * @type {boolean}
     */
    set marker(arg: boolean);
    get marker(): boolean;
    set keep(arg: boolean);
    /**
     * If true, do not garbage collect this Item.
     */
    get keep(): boolean;
    get countable(): boolean;
    set deleted(arg: boolean);
    /**
     * Whether this item was deleted or not.
     * @type {Boolean}
     */
    get deleted(): boolean;
    markDeleted(): void;
    /**
     * Return the creator clientID of the missing op or define missing items and return null.
     * 返回缺失的依赖的ID
     * @param {Transaction} transaction
     * @param {StructStore} store
     * @return {null | ID}
     */
    getMissing(transaction: Transaction, store: StructStore): null | ID;
    /**
     *
     * @returns { string | Array<number> | undefined }
     */
    getParentSignal(): string | Array<number> | undefined;
    /**
     * @param {Transaction} transaction
     * @param {number} offset
     * @param {boolean} sideEffect 立即执行副作用
     * @returns {() => void} 如果sideEffect为false，则会返回一个执行副作用的函数，内部进行签名验证和权限验证
     */
    integrate(transaction: Transaction, offset: number, sideEffect?: boolean): () => void;
    /**
     * 当用户创建了一个local的item，在integrate阶段需要按照策略对其创建数字签名
     * @param {Transaction | string} transaction
     * @param {number} offset
     * @param {Array<string>} targets
     * @returns {boolean}
     */
    sign(transaction: Transaction | string, offset: number, targets?: Array<string>): boolean;
    /**
     * @private
     * @param {*} transaction
     * @param {*} offset
     */
    private verify;
    /**
     * @private
     * @param {*} transaction
     * @param {*} offset
     * @param {Function} successNext
     * @param {Function} failNext
     */
    private checkIntegrateSignature;
    /**
     * @public
     * @param {Transaction} transaction
     * @param {number} offset
     * @param {Function} successNext
     * @param {Function} failNext
     *
     */
    public checkAtomicSignature(transaction: Transaction, offset: number, successNext?: Function, failNext?: Function): void;
    /**
     * @private
     * @param {Transaction} transaction
     * @param {number} offset
     * @param {Function} successNext
     */
    private checkSignatureIterate;
    /**
     * 签名校验过程
     * @param {Transaction} transaction
     * @param {number} offset
     * @param {Function} successNext
     */
    checkSignature(transaction: Transaction, offset: number, successNext?: Function): void;
    /**
     * Returns the next non-deleted item
     */
    get next(): Item | null;
    /**
     * Returns the previous non-deleted item
     */
    get prev(): Item | null;
    /**
     * Computes the last content address of this Item.
     */
    get lastId(): ID;
    /**
     * Try to merge two items
     *
     * @param {Item} right
     * @return {boolean}
     */
    mergeWith(right: Item): boolean;
    /**
     * 回滚删除，撤销item的删除
     * @param {Transaction} transaction
     */
    unDelete(transaction: Transaction): void;
    /**
     * Mark this Item as deleted.
     *
     * @param {Transaction} transaction
     * @param {Array<DeleteSignature> | null} signature
     */
    delete(transaction: Transaction, signature?: Array<DeleteSignature> | null): void;
    /**
     * 签名准备阶段，设置签名、创建签名等工作
     * @private
     * @param {Transaction} transaction
     * @param {Array<DeleteSignature> | null} signature
     */
    private prepareDeleteSignaturePhase;
    /**
     * 执行删除阶段
     * @param {Transaction} transaction
     * @param {boolean} signResult
     */
    deletePhase(transaction: Transaction, signResult?: boolean): void;
    /**
     * 检查删除签名的合法性的阶段，会根据检测结果进行item的分离
     * @param {Transaction} transaction
     */
    checkDeleteSignaturePhase(transaction: Transaction): false | undefined;
    /**
     * Mark this Item as hidden or not.
     * hidden操作不会修改长度，只是隐藏item
     *
     * @param {Transaction} transaction
     */
    hide(transaction: Transaction, hidden?: boolean, offset?: number): void;
    /**
     * @private
     * @param {*} transaction
     * @param {*} hidden
     */
    private applyHideProcess;
    /**
     * gc在拜占庭模式下不可用，这是因为会出现历史不同而导致重新同步时，缺失的项目会被弥补回来
     * @param {StructStore} store
     * @param {boolean} parentGCd
     */
    gc(store: StructStore, parentGCd: boolean): void;
    /**
     * signal a unique item, except origin/left and so on not immutable attr
     * item可能是多个item进行压缩的，所以需要找到确切的位置
     * @param {UpdateEncoderV1} encoder
     * @param {number} offset
     * @param {boolean} needContent
     */
    signal(encoder: UpdateEncoderV1, offset: number, needContent?: boolean): void;
    /**
     * Transform the properties of this type to binary and write it to an
     * BinaryEncoder.
     *
     * This is called when this Item is sent to a remote peer.
     *
     * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
     * @param {number} offset offset一定不能比this.length - 1大
     * @param {boolean} hashMode hash模式，计算某一个offset的hash
     */
    write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number, hashMode?: boolean): void;
    /**
     * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
     * @param {number} offset
     */
    writeByzantineInfo(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void;
    /**
     * @private
     * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
     * @param {number} offset
     */
    private writeSignature;
    /**
     * @private
     * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
     */
    private writeIntegrateSignature;
}
export function readItemContent(decoder: UpdateDecoderV1 | UpdateDecoderV2, info: number): AbstractContent;
/**
 * A lookup map for reading Item content.
 *
 * @type {Array<function(UpdateDecoderV1 | UpdateDecoderV2):AbstractContent>}
 */
export const contentRefs: Array<(arg0: UpdateDecoderV1 | UpdateDecoderV2) => AbstractContent>;
/**
 * Do not implement this class!
 */
export class AbstractContent {
    /**
     * @return {number}
     */
    getLength(): number;
    /**
     * @return {Array<any>}
     */
    getContent(): Array<any>;
    /**
     * Should return false if this Item is some kind of meta information
     * (e.g. format information).
     *
     * * Whether this Item should be addressable via `yarray.get(i)`
     * * Whether this Item should be counted when computing yarray.length
     *
     * @return {boolean}
     */
    isCountable(): boolean;
    /**
     * @return {AbstractContent}
     */
    copy(): AbstractContent;
    /**
     * @param {number} offset
     * @return {AbstractContent}
     */
    splice(offset: number): AbstractContent;
    /**
     * @param {AbstractContent} right
     * @return {boolean}
     */
    mergeWith(right: AbstractContent): boolean;
    /**
     * @param {Transaction} transaction
     * @param {Item} item
     */
    integrate(transaction: Transaction, item: Item): void;
    /**
     * @param {Transaction} transaction
     */
    delete(transaction: Transaction): void;
    /**
     * @param {Transaction} transaction
     */
    unDelete(transaction: Transaction): void;
    /**
     * @param {StructStore} store
     */
    gc(store: StructStore): void;
    /**
     * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
     * @param {number} offset
     * @param {boolean} hashMode
     */
    write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number, hashMode?: boolean): void;
    /**
     * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
     * @param {number} offset
     */
    signal(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void;
    /**
     * @return {number}
     */
    getRef(): number;
}
import { StructStore } from "../utils/StructStore.js";
import { ID } from "../utils/ID.js";
import { Transaction } from "../utils/Transaction.js";
import { DeleteSet } from "../utils/DeleteSet.js";
import { AbstractStruct } from "./AbstractStruct.js";
import { AbstractType } from "../types/AbstractType.js";
import { Signature } from "../utils/signature/signature.js";
import { IntegrateSignature } from "../utils/signature/signature.js";
import { DeleteSignature } from "../utils/signature/signature.js";
import { MerkleTreeLeafNode } from "../byzantine/MerkleTree/LeafNode.js";
import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js";
import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js";
import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js";
import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js";
