/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Abort } from "./Abort.js";
import { Observable } from "./Observable.js";
/**
 * A heap, useful as a priority queue.
 *
 * Features:
 *
 * * Configurable as min-heap or max-heap using comparator
 *
 * * O(1) lookup of first item
 *
 * * O(log(n)) enqueue and dequeue
 *
 * * O(1) deletion of arbitrary position, but will add expense of maintaining index of positions
 *
 * * {@link added}, {@link deleted} and {@link firstChanged} events
 */
export declare class Heap<T> {
    #private;
    /**
     * Create new heap.
     *
     * @param comparator performs ordering of items in the heap
     * @param normalizer optionally converts items to normal form on insert
     */
    constructor(comparator: (a: T, b: T) => number, normalizer?: (entry: T) => T);
    /**
     * Return lowest-ranked item.
     */
    shift(): T | undefined;
    /**
     * The lowest-ranked item.
     */
    get first(): T | undefined;
    /**
     * The queue length.
     */
    get size(): number;
    /**
     * Is the heap empty?
     */
    get isEmpty(): boolean;
    /**
     * Emits when the head of the queue changes.
     */
    get firstChanged(): Observable<[T | undefined], void>;
    /**
     * Emits when an item is added to the heap.
     */
    get added(): Observable<[T], void>;
    /**
     * Emits when an item is deleted.
     */
    get deleted(): Observable<[T], void>;
    /**
     * Add an item.
     */
    add(...items: T[]): void;
    /**
     * Delete an item.
     *
     * The first delete is O(n); subsequent deletes are O(1) but insertions and deletions will have additional cost
     * associated.
     */
    delete(item: T): boolean;
    /**
     * Remove all entries.
     */
    clear(): void;
    /**
     * Stream the first value from the heap until aborted.
     */
    stream(abort?: Abort.Signal): AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
    /**
     * Perform internal validation of queue order.
     */
    validate(): void;
}
//# sourceMappingURL=Heap.d.ts.map