export type DocDuckError = { code: string; message: string }; export type DocDuckDocument = { bytes: Uint8Array; fileName: string }; export type DocDuckCreateOptions = { fileName?: string; readOnly?: boolean }; export type DocDuckLoadOptions = DocDuckDocument & { readOnly?: boolean }; export type DocDuckEvent = "ready" | "change" | "saving" | "saved" | "error" | "focusExit"; export type DocDuckEventPayload = DocDuckError | { fileName?: string; updatedAt?: string } | undefined; export type DocDuckEditor = { readonly ready: Promise; readonly frame: HTMLIFrameElement; createBlank(options?: DocDuckCreateOptions): Promise<{ fileName: string }>; load(document: DocDuckLoadOptions): Promise<{ fileName: string }>; export(): Promise; on(event: DocDuckEvent, callback: (payload: DocDuckEventPayload) => void): () => void; destroy(): void; }; export type DocDuckSdk = { readonly version: 1; mount(options: { element: string | HTMLElement; url: string; timeout?: number; }): DocDuckEditor; }; declare global { interface Window { DocDuck: DocDuckSdk; } }