/**
 * Web Worker for UDoc document rendering.
 *
 * Handles WASM operations off the main thread to keep the UI responsive.
 */
import type { LicenseResult, JsOutlineSection as OutlineSection, JsSplitByOutlineResult as SplitByOutlineResult, JsFontRegistration as FontEntry, JsAnnotation as Annotation, JsAnnotationsByPage as AnnotationsByPage, JsOutlineItem as OutlineItem, JsVisibilityGroup as VisibilityGroup, JsFontUsageEntry as FontUsageEntry, JsLayoutPage as LayoutPage, JsPageInfo as PageInfo, JsPageTransition as PageTransition, JsPageGroup as PageGroup, JsPageGroupLayout as PageGroupLayout } from "../wasm/udoc.js";
export type { LicenseResult, OutlineSection, SplitByOutlineResult, FontEntry, Annotation, AnnotationsByPage, OutlineItem, VisibilityGroup, FontUsageEntry, LayoutPage, PageInfo, PageTransition, PageGroup, PageGroupLayout, };
/**
 * A pick specification for compose operations.
 */
export interface ComposePick {
    /** Document index (0-based, referring to documents in docIds array) */
    doc: number;
    /** Page range string (e.g., "0-2,4") - 0-based page indices */
    pages: string;
    /** Optional rotation in degrees (0, 90, 180, or 270) */
    rotation?: 0 | 90 | 180 | 270;
}
/**
 * A composition specification - array of picks that form one output document.
 */
export type Composition = ComposePick[];
/**
 * Extracted image info.
 * Uses Uint8Array (copied from WASM memory) for safe transfer across worker boundary.
 */
export interface ExtractedImage {
    name: string;
    format: string;
    width: number | undefined;
    height: number | undefined;
    data: Uint8Array;
}
/**
 * Extracted font info.
 * Uses Uint8Array (copied from WASM memory) for safe transfer across worker boundary.
 */
export interface ExtractedFont {
    name: string;
    fontType: string;
    extension: string;
    data: Uint8Array;
}
export type WorkerRequest = {
    type: "init";
    wasmUrl?: string;
    gpu?: boolean;
    domain: string;
    viewerVersion: string;
} | {
    type: "setupTelemetry";
    distinctId: string;
} | {
    type: "disableTelemetry";
} | {
    type: "setLicense";
    license: string;
    domain: string;
} | {
    type: "getLicenseStatus";
} | {
    type: "load";
    id: string;
    bytes: Uint8Array;
} | {
    type: "loadPdf";
    id: string;
    bytes: Uint8Array;
} | {
    type: "loadImage";
    id: string;
    bytes: Uint8Array;
} | {
    type: "loadPptx";
    id: string;
    bytes: Uint8Array;
} | {
    type: "loadDocx";
    id: string;
    bytes: Uint8Array;
} | {
    type: "loadXlsx";
    id: string;
    bytes: Uint8Array;
} | {
    type: "getDocumentFormat";
    documentId: string;
} | {
    type: "unloadPdf";
    documentId: string;
} | {
    type: "needsPassword";
    documentId: string;
} | {
    type: "authenticate";
    documentId: string;
    password: string;
} | {
    type: "getPageCount";
    documentId: string;
} | {
    type: "getPageInfo";
    documentId: string;
    pageIndex: number;
} | {
    type: "getAllPageInfo";
    documentId: string;
} | {
    type: "getPageGroups";
    documentId: string;
} | {
    type: "renderPage";
    documentId: string;
    pageIndex: number;
    width: number;
    height: number;
} | {
    type: "getOutline";
    documentId: string;
} | {
    type: "getPageAnnotations";
    documentId: string;
    pageIndex: number;
} | {
    type: "getAllAnnotations";
    documentId: string;
} | {
    type: "getLayoutPage";
    documentId: string;
    pageIndex: number;
} | {
    type: "pdfCompose";
    compositions: Composition[];
    docIds: string[];
} | {
    type: "getBytes";
    documentId: string;
} | {
    type: "pdfSplitByOutline";
    documentId: string;
    maxLevel: number;
    splitMidPage: boolean;
} | {
    type: "pdfExtractImages";
    documentId: string;
    convertRawToPng: boolean;
} | {
    type: "pdfExtractFonts";
    documentId: string;
} | {
    type: "pdfCompress";
    documentId: string;
} | {
    type: "pdfDecompress";
    documentId: string;
} | {
    type: "registerFonts";
    fonts: FontEntry[];
} | {
    type: "enableGoogleFonts";
} | {
    type: "getVisibilityGroups";
    documentId: string;
} | {
    type: "setVisibilityGroupVisible";
    documentId: string;
    groupId: string;
    visible: boolean;
} | {
    type: "parseFontInfo";
    data: Uint8Array;
} | {
    type: "getFontUsage";
    documentId: string;
} | {
    type: "pdfSaveAnnotations";
    documentId: string;
    annotationsByPage: AnnotationsByPage;
} | {
    type: "getWasmMemoryBytes";
};
/**
 * Message types from worker to main thread.
 */
export type WorkerResponse = {
    type: "init";
    success: true;
} | {
    type: "init";
    success: false;
    error: string;
} | {
    type: "setupTelemetry";
    success: true;
} | {
    type: "setupTelemetry";
    success: false;
    error: string;
} | {
    type: "disableTelemetry";
    success: true;
    disabled: boolean;
} | {
    type: "disableTelemetry";
    success: false;
    error: string;
} | {
    type: "setLicense";
    success: true;
    result: LicenseResult;
} | {
    type: "setLicense";
    success: false;
    error: string;
} | {
    type: "getLicenseStatus";
    success: true;
    result: LicenseResult;
} | {
    type: "getLicenseStatus";
    success: false;
    error: string;
} | {
    type: "load";
    success: true;
    documentId: string;
} | {
    type: "load";
    success: false;
    error: string;
} | {
    type: "getDocumentFormat";
    success: true;
    format: string;
} | {
    type: "getDocumentFormat";
    success: false;
    error: string;
} | {
    type: "loadPdf";
    success: true;
    documentId: string;
} | {
    type: "loadPdf";
    success: false;
    error: string;
} | {
    type: "loadImage";
    success: true;
    documentId: string;
} | {
    type: "loadImage";
    success: false;
    error: string;
} | {
    type: "loadPptx";
    success: true;
    documentId: string;
} | {
    type: "loadPptx";
    success: false;
    error: string;
} | {
    type: "loadDocx";
    success: true;
    documentId: string;
} | {
    type: "loadDocx";
    success: false;
    error: string;
} | {
    type: "loadXlsx";
    success: true;
    documentId: string;
} | {
    type: "loadXlsx";
    success: false;
    error: string;
} | {
    type: "unloadPdf";
    success: true;
    removed: boolean;
} | {
    type: "unloadPdf";
    success: false;
    error: string;
} | {
    type: "needsPassword";
    success: true;
    needsPassword: boolean;
} | {
    type: "needsPassword";
    success: false;
    error: string;
} | {
    type: "authenticate";
    success: true;
    authenticated: boolean;
} | {
    type: "authenticate";
    success: false;
    error: string;
} | {
    type: "getPageCount";
    success: true;
    pageCount: number;
} | {
    type: "getPageCount";
    success: false;
    error: string;
} | {
    type: "getPageInfo";
    success: true;
    width: number;
    height: number;
    rotation: number;
    transition?: PageTransition;
} | {
    type: "getPageInfo";
    success: false;
    error: string;
} | {
    type: "getAllPageInfo";
    success: true;
    pages: PageInfo[];
} | {
    type: "getAllPageInfo";
    success: false;
    error: string;
} | {
    type: "getPageGroups";
    success: true;
    groups: PageGroup[];
} | {
    type: "getPageGroups";
    success: false;
    error: string;
} | {
    type: "renderPage";
    success: true;
    rgba: Uint8Array;
    width: number;
    height: number;
} | {
    type: "renderPage";
    success: false;
    error: string;
} | {
    type: "getOutline";
    success: true;
    outline: OutlineItem[];
} | {
    type: "getOutline";
    success: false;
    error: string;
} | {
    type: "getPageAnnotations";
    success: true;
    annotations: Annotation[];
} | {
    type: "getPageAnnotations";
    success: false;
    error: string;
} | {
    type: "getAllAnnotations";
    success: true;
    annotations: AnnotationsByPage;
} | {
    type: "getAllAnnotations";
    success: false;
    error: string;
} | {
    type: "getLayoutPage";
    success: true;
    layout: LayoutPage;
} | {
    type: "getLayoutPage";
    success: false;
    error: string;
} | {
    type: "pdfCompose";
    success: true;
    documentIds: string[];
} | {
    type: "pdfCompose";
    success: false;
    error: string;
} | {
    type: "getBytes";
    success: true;
    bytes: Uint8Array;
} | {
    type: "getBytes";
    success: false;
    error: string;
} | {
    type: "pdfSplitByOutline";
    success: true;
    result: SplitByOutlineResult;
} | {
    type: "pdfSplitByOutline";
    success: false;
    error: string;
} | {
    type: "pdfExtractImages";
    success: true;
    images: ExtractedImage[];
} | {
    type: "pdfExtractImages";
    success: false;
    error: string;
} | {
    type: "pdfExtractFonts";
    success: true;
    fonts: ExtractedFont[];
} | {
    type: "pdfExtractFonts";
    success: false;
    error: string;
} | {
    type: "pdfCompress";
    success: true;
    bytes: Uint8Array;
} | {
    type: "pdfCompress";
    success: false;
    error: string;
} | {
    type: "pdfDecompress";
    success: true;
    bytes: Uint8Array;
} | {
    type: "pdfDecompress";
    success: false;
    error: string;
} | {
    type: "registerFonts";
    success: true;
} | {
    type: "registerFonts";
    success: false;
    error: string;
} | {
    type: "enableGoogleFonts";
    success: true;
} | {
    type: "enableGoogleFonts";
    success: false;
    error: string;
} | {
    type: "getVisibilityGroups";
    success: true;
    groups: VisibilityGroup[];
} | {
    type: "getVisibilityGroups";
    success: false;
    error: string;
} | {
    type: "setVisibilityGroupVisible";
    success: true;
    updated: boolean;
} | {
    type: "setVisibilityGroupVisible";
    success: false;
    error: string;
} | {
    type: "parseFontInfo";
    success: true;
    info: {
        typeface: string;
        bold: boolean;
        italic: boolean;
    };
} | {
    type: "parseFontInfo";
    success: false;
    error: string;
} | {
    type: "getFontUsage";
    success: true;
    entries: FontUsageEntry[];
} | {
    type: "getFontUsage";
    success: false;
    error: string;
} | {
    type: "pdfSaveAnnotations";
    success: true;
    bytes: Uint8Array;
} | {
    type: "pdfSaveAnnotations";
    success: false;
    error: string;
} | {
    type: "getWasmMemoryBytes";
    success: true;
    bytes: number;
} | {
    type: "getWasmMemoryBytes";
    success: false;
    error: string;
};
//# sourceMappingURL=worker.d.ts.map