/**
 * The order in which to return items from an async iterator.
 */
export type IterationOrder = 
/**
 * Items are returned in their original order.
 */
"default"
/**
 * Items are returned as soon as they are available.
 */
 | "eager";
/**
 * An asynchronous producer/consumer queue. Allows one or more producers to
 * populate the queue while one or more consumers are iterating over the queue,
 * completely independently of one another.
 */
export declare class AsyncQueue<T> implements AsyncIterable<T> {
    /**
     * Indicates that no more items are going to be added to the queue.
     */
    get isDone(): boolean;
    private _isDone;
    private _rejectReason;
    private readonly _items;
    /**
     * Fulfills this._ready.
     */
    private _signalReady;
    /**
     * A promise that is fulfilled whenever new items are added or when there is
     * nothing left to add.
     */
    private _ready;
    /**
     * An iterator that returns the items in the queue.
     */
    [Symbol.asyncIterator](): AsyncIterator<T>;
    /**
     * Indicates that no more items will be added to the queue. This will cause
     * any iterators that are iterating over the queue to eventually reach the
     * end of iteration.
     */
    done(): void;
    /**
     * Signals an error to consumers. No more items can be added to the queue
     * after this method is called. Consumers iterating over the queue will
     * still be able to iterate over all items that were added up until the
     * error was signaled, at which point the iteration will abort with the
     * given error.
     *
     * @param reason The reason for rejection (e.g. error, cancellation, etc.).
     */
    reject(reason: unknown): void;
    /**
     * Adds an item to the queue. Once {@link done} is called, no more items can
     * be added.
     *
     * @param item The item (or promise of the item) to add to the queue.
     */
    add(item: T | PromiseLike<T>): void;
    /**
     * Adds items to the queue. Once {@link done} is called, no more items can be
     * added.
     *
     * @param items The items (or item promises) to add to the queue.
     */
    addMany(items: Iterable<T | PromiseLike<T>>): void;
}
/**
 * Creates an async iterable from an existing iterable.
 *
 * @param iterable The iterable containing items (or promises of items) to
 *   return from the async iterable.
 * @param order The order in which to return items. The default is to return
 *   items in the original order, however setting this parameter to EAGER causes
 *   the resulting iterator to return items as soon as they become available.
 */
export declare function from<T>(iterable: PromiseLike<Iterable<T | PromiseLike<T> | AsyncIterable<T>>> | Iterable<T | PromiseLike<T> | AsyncIterable<T>>, order?: IterationOrder): AsyncIterable<T>;
/**
 * Returns an empty async iterable.
 */
export declare function empty<T>(): AsyncIterable<T>;
/**
 * Converts a single item into an async iterable.
 *
 * @param item The item to convert.
 */
export declare function fromSingleItem<T>(item: T | Promise<T>): AsyncIterable<T>;
/**
 * Converts an async iterable to an array.
 *
 * @param iterable The iterable to convert.
 */
export declare function toArray<T>(iterable: AsyncIterable<T>): Promise<T[]>;
/**
 * The equivalent of Array.prototype.map for async iterators.
 *
 * @param iterable The async iterable to map over.
 * @param f The mapping function.
 */
export declare function map<T, U>(iterable: AsyncIterable<T>, f: (x: T, index?: number) => U | PromiseLike<U>): AsyncIterable<U>;
/**
 * The equivalent of Array.prototype.concat for async iterators.
 *
 * @param iterator The initial async iterator.
 * @param values The values to concatenate with the initial iterator.
 */
export declare function concat<T>(iterator: AsyncIterable<T>, ...values: (T | Iterable<T> | AsyncIterable<T>)[]): AsyncIterable<T>;
/**
 * The equivalent of Array.prototype.every for async iterators.
 *
 * @param iterable The async iterator to check.
 * @param p The predicate function.
 */
export declare function every<T>(iterable: AsyncIterable<T>, p: (x: T, index?: number) => boolean | PromiseLike<boolean>): Promise<boolean>;
/**
 * The equivalent of Array.prototype.filter for async iterators.
 *
 * @param iterable The async iterator to filter.
 * @param p The filter predicate.
 */
export declare function filter<T>(iterable: AsyncIterable<T>, p: (x: T, index?: number) => boolean | PromiseLike<boolean>): AsyncIterable<T>;
/**
 * The equivalent of Array.prototype.find for async iterators.
 *
 * @param iterable The async iterator to search.
 * @param p The predicate to use for finding an item.
 */
export declare function find<T>(iterable: AsyncIterable<T>, p: (x: T, index?: number) => boolean | PromiseLike<boolean>): Promise<T | undefined>;
/**
 * Returns the first element in an async iterable, or undefined if there are no
 * elements.
 *
 * @param iterable The async iterator.
 */
export declare function first<T>(iterable: AsyncIterable<T>): Promise<T>;
/**
 * Flattens an async iterable collection of async iterable objects into a single
 * async iterable.
 *
 * @param iterables An async iterable collections of async iterables.
 */
export declare function flatten<T>(iterables: AsyncIterable<AsyncIterable<T>>): AsyncIterable<T>;
/**
 * The equivalent of Array.prototype.forEach for async iterators.
 *
 * @param iterable The async iterator to loop over.
 * @param f The iteration function.
 */
export declare function forEach<T>(iterable: AsyncIterable<T>, f: (x: T, index?: number) => void | PromiseLike<void>): Promise<void>;
/**
 * The equivalent of Array.prototype.some for async iterators.
 *
 * @param iterable The async iterator to check.
 * @param p The predicate function.
 */
export declare function some<T>(iterable: AsyncIterable<T>, p: (x: T, index?: number) => boolean | PromiseLike<boolean>): Promise<boolean>;
/**
 * Returns the first n items of iterable.
 *
 * @param iterable The async iterator.
 * @param n The number of items to return.
 * @returns The first n items, or all items if there are less than n.
 */
export declare function take<T>(iterable: AsyncIterable<T>, n: number): AsyncIterable<T>;
