import { type ImageFormat } from './processor';
/**
 * Probe the request URL and return a Response if it matches the image
 * route, or `null` if the caller should keep trying other handlers.
 *
 * Designed to be a drop-in inside any Bun/fetch-style server:
 *
 *   const imgResponse = await handleImageRequest(request, { publicDir })
 *   if (imgResponse) return imgResponse
 *   // …other routes
 */
export declare function handleImageRequest(request: Request, options: ImageServeOptions): Promise<Response | null>;
/**
 * Wrap {@link handleImageRequest} into a self-contained route handler.
 *
 * Most router slots type their handlers as `(req: Request) => Promise<Response>`
 * — they don't accept `null` inside the Promise the way the chainable
 * `handleImageRequest` returns it. Use this factory when plugging into a
 * router slot of that shape:
 *
 *   const handler = createImageHandler({ publicDir: 'public' })
 *   router.get('/_stx/img', handler)
 *
 * When the request URL doesn't match the configured route path, the
 * returned handler responds with `404 Not Found`. Use the lower-level
 * `handleImageRequest` directly if you want to chain to a fallback.
 */
export declare function createImageHandler(options: ImageServeOptions): (request: Request) => Promise<Response>;
// ============================================================================
// Public types
// ============================================================================
export declare interface ImageServeOptions {
  publicDir: string
  cacheDir?: string
  maxWidth?: number
  maxHeight?: number
  defaultQuality?: number
  defaultFit?: 'cover' | 'contain' | 'fill' | 'inside' | 'outside'
  routePath?: string
}
// ============================================================================
// Parsing & validation
// ============================================================================
declare type ParseResult = | {
    ok: true
    srcFsPath: string
    srcUrl: string
    width: number
    height: number
    format: ImageFormat
    quality: number
    fit: 'cover' | 'contain' | 'fill' | 'inside' | 'outside'
  }
  | { ok: false, error: string, status: number }
