/**
 * WorkbookWriter - Browser Streaming Excel Writer
 *
 * This module contains the full cross-platform implementation for the streaming
 * workbook writer and a browser-compatible `WorkbookWriter` class.
 *
 * Node.js uses `workbook-writer.ts`, which extends the same base implementation
 * with filesystem-specific features (filename output + image loading).
 */
import { Zip } from "@archive/zip/stream";
import { StreamBuf } from "@excel/utils/stream-buf";
import { StylesXform } from "@excel/xlsx/xform/style/styles-xform";
import { SharedStrings } from "@excel/utils/shared-strings";
import { DefinedNames } from "@excel/defined-names";
import type { Writable } from "@stream";
import type { Image, WorkbookView, AddWorksheetOptions } from "@excel/types";
import { WorksheetWriter } from "@excel/stream/worksheet-writer";
interface Medium extends Image {
    type: "image";
    name: string;
}
interface CommentRef {
    commentName: string;
    vmlDrawing: string;
}
export interface ZlibOptions {
    flush?: number;
    finishFlush?: number;
    chunkSize?: number;
    windowBits?: number;
    level?: number;
    memLevel?: number;
    strategy?: number;
    dictionary?: Uint8Array | ArrayBuffer;
}
export interface ZipOptions {
    comment?: string;
    forceLocalTime?: boolean;
    forceZip64?: boolean;
    store?: boolean;
    zlib?: Partial<ZlibOptions>;
    compressionOptions?: {
        level?: number;
    };
}
export interface WorkbookWriterOptions {
    created?: Date;
    modified?: Date;
    creator?: string;
    lastModifiedBy?: string;
    lastPrinted?: Date;
    useSharedStrings?: boolean;
    useStyles?: boolean;
    zip?: Partial<ZipOptions>;
    stream?: Writable | WritableStream<Uint8Array>;
    filename?: string;
    trueStreaming?: boolean;
}
interface OutputStreamLike {
    emit(eventName: string | symbol, ...args: any[]): boolean;
    write(chunk: any): boolean | Promise<boolean>;
    end(): void;
    once(eventName: string | symbol, listener: (...args: any[]) => void): this;
    removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
}
export interface WorksheetWriterLike {
    id: number;
    name: string;
    rId?: string;
    committed?: boolean;
    stream: any;
    commit(): void;
}
export interface WorksheetWriterConstructor<T extends WorksheetWriterLike> {
    new (options: {
        id: number;
        name: string;
        workbook: any;
        useSharedStrings: boolean;
        properties?: any;
        state?: any;
        pageSetup?: any;
        views?: any;
        autoFilter?: any;
        headerFooter?: any;
    }): T;
}
export declare abstract class WorkbookWriterBase<TWorksheetWriter extends WorksheetWriterLike> {
    created: Date;
    modified: Date;
    creator: string;
    lastModifiedBy: string;
    lastPrinted?: Date;
    useSharedStrings: boolean;
    sharedStrings: SharedStrings;
    styles: StylesXform;
    _definedNames: DefinedNames;
    _worksheets: TWorksheetWriter[];
    views: WorkbookView[];
    zipOptions?: Partial<ZipOptions>;
    compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    media: Medium[];
    commentRefs: CommentRef[];
    zip: Zip;
    stream: OutputStreamLike;
    promise: Promise<void[]>;
    protected _trueStreaming: boolean;
    protected WorksheetWriterClass: WorksheetWriterConstructor<TWorksheetWriter>;
    constructor(options: WorkbookWriterOptions, WorksheetWriterClass: WorksheetWriterConstructor<TWorksheetWriter>);
    /**
     * Create output stream - can be overridden by Node.js to support filename
     */
    protected _createOutputStream(options: WorkbookWriterOptions): OutputStreamLike;
    get definedNames(): DefinedNames;
    _openStream(path: string): InstanceType<typeof StreamBuf>;
    _addFile(data: string | Uint8Array, name: string, base64?: boolean): void;
    _commitWorksheets(): Promise<void>;
    commit(): Promise<void>;
    get nextId(): number;
    addImage(image: Image): number;
    getImage(id: number): Image | undefined;
    addWorksheet(name?: string, options?: Partial<AddWorksheetOptions>): TWorksheetWriter;
    getWorksheet(id?: string | number): TWorksheetWriter | undefined;
    addStyles(): Promise<void>;
    addThemes(): Promise<void>;
    addOfficeRels(): Promise<void>;
    addContentTypes(): Promise<void>;
    /**
     * Add media files - can be overridden by Node.js for file system support
     */
    addMedia(): Promise<void[]>;
    addApp(): Promise<void>;
    addCore(): Promise<void>;
    addSharedStrings(): Promise<void>;
    addFeaturePropertyBag(): Promise<void>;
    addWorkbookRels(): Promise<void>;
    addWorkbook(): Promise<void>;
    _finalize(): Promise<this>;
}
export declare const WorkbookWriterOptionsSchema: {
    readonly useSharedStrings: readonly ["boolean"];
    readonly useStyles: readonly ["boolean"];
    readonly trueStreaming: readonly ["boolean"];
};
declare class WorkbookWriter extends WorkbookWriterBase<WorksheetWriter> {
    constructor(options?: WorkbookWriterOptions);
}
export { WorkbookWriter };
