import { StateCreator } from 'zustand'; import { Adapter, AdapterRegistry, DocumentModel, FileSource, FileSourceReader } from '../types.js'; import { ViewerError } from '../errors.js'; import { NavigationSlice } from './navigationSlice.js'; import { ViewportSlice } from './viewportSlice.js'; import { SearchSlice } from './searchSlice.js'; import { AnnotationSlice } from './annotationSlice.js'; import { PageCache } from '../cache/page-cache.js'; export type LoadState = 'idle' | 'loading' | 'loaded' | 'error'; export interface DocumentSlice { document: DocumentModel | null; loadState: LoadState; loadError: ViewerError | null; adapter: Adapter | null; registry: AdapterRegistry | null; pageCache: PageCache; openDocument: (source: FileSource) => Promise; closeDocument: () => void; setRegistry: (registry: AdapterRegistry) => void; downloadDocument: () => Promise; printDocument: () => Promise; /** Retry the pending encrypted document with a password. */ submitPassword: (password: string) => Promise; /** Abandon a pending encrypted document (user dismissed the prompt). */ cancelPassword: () => void; _setDocument: (model: DocumentModel, adapter: Adapter) => void; _setLoadState: (state: LoadState, error?: ViewerError) => void; _loadController: AbortController | null; _source: FileSource | null; _pendingPassword: { adapter: Adapter; reader: FileSourceReader; source: FileSource; } | null; _runParse: (adapter: Adapter, reader: FileSourceReader, controller: AbortController, source: FileSource, password?: string) => Promise; } export declare const createDocumentSlice: StateCreator;