import { A as Api } from '../types-BCw6mdsz.mjs';
import '../page-DAsxsEeP.mjs';
import 'next';
import 'fs';
import 'node:stream/web';
import 'next/server';
import '@alessiofrittoli/stream-reader/types';

declare const list: Map<string, number>;
type List = typeof list;
/**
 * A handler function that is called when the rate limit quota is reached for a given IP address.
 *
 * @param requestIp - The IP address of the request that has reached the quota.
 * @param list - A map containing the quota information for each IP address.
 * @returns A promise that resolves to void or void.
 */
type OnQuotaReachedHandler = (requestIp: string, list: List) => void | Promise<void>;
/**
 * Middleware to apply rate limiting to an API route.
 *
 * @template T - The type of the request body.
 *
 * @param	request - The incoming API request.
 * @param	next - The next handler to call if the request is within the rate limit.
 * @param	max - The maximum number of requests allowed within the specified time window.
 * @param	inS - The time window in seconds for rate limiting.
 * @param	cors - CORS policy to apply to the response.
 * @param	onQuotaReached - Optional callback to execute when the rate limit is reached.
 * @returns The response to be sent back to the client.
 */
declare const withRateLimit: <T = unknown>(request: Api.Route.Request<T>, next: Api.Route.Handler<T>, max?: number, inS?: number, cors?: true | Api.CORS.Policy, onQuotaReached?: OnQuotaReachedHandler) => Promise<Response>;

export { type OnQuotaReachedHandler, withRateLimit };
