import type { Window } from "../ebml.js";
import { type IndexFetch, type Range, type SizedSource } from "./source.js";
export interface WindowPool {
    /** A lease when the width fits the threshold and a slot. */
    borrow(width: number): Lease | null;
}
interface Lease {
    readonly bytes: Uint8Array;
    release: () => void;
}
export declare class WindowIndex {
    #private;
    /** An index over the windows, which also answers from the index it stacks on. */
    constructor(windows: readonly Window[], head?: Window, under?: WindowIndex);
    find(at: number, length: number): Window | null;
}
export declare function fetchSpans(sized: SizedSource, spans: readonly Range[], concurrency: number, signal?: AbortSignal): Promise<Window[]>;
/** The spans that read every wanted range, letting a stone close the hole between two of them. */
export declare function coalesceAcross(wanted: readonly Range[], stones: readonly Range[], knobs: Pick<IndexFetch, "gapBytes">): Range[];
export declare function windowPool(slotBytes: number, slots: number): WindowPool;
/** The one place a `Source` is read. */
export declare function windowAt({ source, fileSize }: SizedSource, at: number, length: number, signal: AbortSignal | undefined, into?: Uint8Array): Promise<Window>;
export {};
