import type { File } from '../../../../shared/contracts/files';
/**
 * Thrown when an upload is aborted via its `AbortSignal`.
 * Distinct from {@link UploadFileError} so callers can tell cancellation apart
 * from a genuine failure.
 */
export declare class UploadAbortedError extends Error {
    constructor(message?: string);
}
/**
 * Thrown when an upload fails (non-2xx response, network error, or unparseable body).
 */
export declare class UploadFileError extends Error {
    status?: number;
    constructor(message: string, status?: number);
}
export type UploadProgressCallback = (bytes: number, total: number) => void;
/**
 * Uploads a single file via `XMLHttpRequest`, exposing real byte-level upload
 * progress through {@link XMLHttpRequest.upload}'s `progress` event.
 *
 * This is the only place raw XHR lives. `fetch()` is intentionally avoided here
 * because it does not surface upload progress.
 *
 * @param url - The full endpoint URL to POST to.
 * @param token - Admin auth token; the `Authorization` header is only set when present.
 * @param formData - Prebuilt multipart body containing the single file and its `fileInfo`.
 * @param signal - Aborts the in-flight request when triggered.
 * @param onProgress - Called with `(loaded, total)` bytes as the upload progresses.
 * @returns The parsed, signed `File` on a 2xx response.
 * @throws {UploadAbortedError} When the signal aborts.
 * @throws {UploadFileError} On a non-2xx response or network error.
 */
export declare const uploadFileViaXHR: (url: string, token: string | null | undefined, formData: FormData, signal: AbortSignal, onProgress?: UploadProgressCallback) => Promise<File>;
