/** * An simple, efficient queue implementation with amortized O(1) operations, * using a circular buffer. * * Dynamically resizes to manage memory usage. * * @template T The type of elements held in the queue. */ export declare class Queue implements Iterable { #private; /** * Creates a new Queue instance. * */ constructor(); /** * Adds an item to the back of the queue. * * @param {T} item The item to add to the queue. * @returns {number} The new size of the queue. */ enqueue(item: T): number; /** * Removes and returns the item at the front of the queue. * * @returns {T | undefined} The item at the front of the queue, or undefined if the queue is empty. */ dequeue(): T | undefined; /** * Returns the item at the front of the queue without removing it. * * @returns {T | undefined} The item at the front of the queue, or undefined if the queue is empty. */ peek(): T | undefined; /** * Returns the element at the specified index in the queue without removing it. * * @param {number} index - The index of the element to retrieve (0-based). * @returns {T | undefined} The element at the specified index, or undefined if the index is out of bounds. */ get(index: number): T | undefined; /** * Returns the number of items in the queue. * * @returns {number} The number of items in the queue. */ get size(): number; /** * Returns the internal size of the queue. * * @returns {number} The internal size of the queue. */ get internalSize(): number; /** * Removes all items from the queue. */ clear(): void; /** * Creates an iterator for the elements in the queue. * * @generator * @yields {T} The next element in the queue. * @returns {Generator} A generator that yields elements of type T. */ [Symbol.iterator](): Generator; /** * Creates an iterator for the elements in the queue. * * @generator * @yields {[T, number]} A tuple containing the element and its index in the queue. * @returns {Generator<[T, number]>} A generator that yields tuples of elements of type T and their indices. */ entries(): Generator<[T, number]>; /** * Returns a string representation of the queue. * * @returns {string} A string representation of the queue in the format: * "Queue(size) { item1, item2, ... }" */ toString(): string; /** * Executes a provided function once for each queue element. * * @param {function} callbackFn - Function to execute for each element, taking three arguments: * @param {T} callbackFn.value - The current element being processed in the queue. * @param {number} callbackFn.index - The index of the current element being processed in the queue. * @param {Queue} callbackFn.queue - The queue object forEach() was called upon. * * @throws {TypeError} If callbackFn is not a function. */ forEach(callbackFn: (value: T, index: number, queue: Queue) => void): void; }