import { DataChangeDescription } from './dataChangeDescription';
export { DataChangeDescription } from './dataChangeDescription';
/**
 * Encapsulates a single transaction to be applied to a DataSet.
 * Supports both the AG Grid-compatible API (add/addIndex) and the internal format (prepend/append/insertions).
 */
export interface DataSetTransaction<T> {
    /** Items to add at the specified index (AG Grid-compatible API). */
    add?: T[];
    /** Zero-based index for add operation. If undefined or >= length, items are appended. */
    addIndex?: number;
    /** Items to prepend to the beginning (internal format, converted from add with addIndex=0). */
    prepend?: T[];
    /** Items to append to the end (internal format, converted from add with no addIndex). */
    append?: T[];
    /** Items to remove by referential equality. */
    remove?: T[];
    /** Items to update by referential equality. Items should be mutated in place before calling update. */
    update?: T[];
    /** Arbitrary insertions at specific indices (internal format, converted from add with 0 < addIndex < length). */
    insertions?: Array<{
        index: number;
        items: T[];
    }>;
}
/**
 * Manages transactional updates to an array of data with optimized batch processing.
 * Transactions are queued and can be applied in batch for efficient data transformations.
 */
export declare class DataSet<T = unknown> {
    data: T[];
    private pendingTransactions;
    private cachedChangeDescription;
    private itemToIndexCache;
    constructor(data: T[]);
    /**
     * Creates an empty DataSet.
     */
    static empty<U = unknown>(): DataSet<U>;
    /**
     * Wraps existing data in a DataSet.
     */
    static wrap<U = unknown>(data: U[]): DataSet<U>;
    netSize(): number;
    /**
     * Queues a transaction (applied on commit).
     * Normalizes AG Grid-compatible format (add/addIndex) to internal format (prepend/append).
     */
    addTransaction(transaction: DataSetTransaction<T>): void;
    /**
     * @returns A deep clone of the DataSet.
     */
    deepClone(): DataSet<T>;
    /**
     * Converts AG Grid-compatible transaction format to internal format.
     * Maps `add` + `addIndex` to prepend, append, or arbitrary insertion based on the index.
     */
    private normalizeTransaction;
    hasPendingTransactions(): boolean;
    getPendingTransactionCount(): number;
    /** Applies all pending transactions to the data array. */
    commitPendingTransactions(): boolean;
    /** Updates item→index cache incrementally, or invalidates for complex changes. */
    private updateItemToIndexCache;
    clearPendingTransactions(): number;
    getPendingTransactions(): DataSetTransaction<T>[];
    /** Custom JSON serialization (avoids snapshot bloat). */
    toJSON(): T[];
    /** Builds a DataChangeDescription from pending transactions (does not modify data). */
    getChangeDescription(): DataChangeDescription | undefined;
    /**
     * Helper method to remove items from a list of groups.
     * Mutates the groups in-place and removes found items from toRemove set.
     * @param groups List of groups to search and remove from
     * @param toRemove Set of items to remove (modified in-place)
     */
    private removeFromGroups;
    /**
     * Builds the index transformation map by sequentially applying all pending transactions.
     * Optimized to:
     * - Track operation boundaries instead of individual items
     * - Only scan for values that are actually being removed
     * - Stop scanning early when all removed values are found
     * - Support arbitrary insertions at any index
     * - Track updated items by referential equality
     */
    private buildIndexMap;
    private getSortedRemovedIndices;
    private collectTransactionEffects;
    private applyPrepends;
    private applyInsertions;
    private applyAppends;
    private applyRemovals;
    private applyUpdates;
    private collectUpdatedIndicesFromGroups;
    /** Lazy item→index map for O(1) lookups. */
    private getItemToIndexMap;
    private collectUpdatedOriginalIndices;
    private removeFromTrackedInsertions;
    private adjustLaterInsertionsAfterRemoval;
    private buildSpliceOperations;
    private countRemovalsBeforeIndex;
    private resolveUpdatedIndices;
}
