import type { OfficeArchiveReader } from '../../shared/ooxml/OfficeArchiveReader'; import type { OfficeResourceDescriptor } from '../resource-store/types'; import type { WordOutlineItem } from '../word/types'; import type { WordOutlineProvider } from '../word/WordOutlineProvider'; import type { WordPageSource, WordPageSourceSnapshot } from '../word/WordPageSource'; import type { WordPreviewSource } from '../word/WordPreviewSource'; import { WordSearchProvider } from '../word/WordSearchProvider'; import { type DocxMeasuredBlock, type DocxMeasurementBatch } from './docxPagination'; import type { DocxDocument, DocxPage, DocxPageContent } from './types'; /** DOCX 页面数据源的预览摘要。 */ export type DocxWordPreviewSummary = Omit & { /** 当前已发现的可序列化资源元数据。 */ resourceRefs?: readonly OfficeResourceDescriptor[]; }; /** 创建 DOCX 页面数据源时使用的选项。 */ type DocxWordPageSourceOptions = { /** 当前解析或预览会话的标识。 */ sessionId: string; /** 用于按需读取源数据的读取器。 */ reader: OfficeArchiveReader; /** 用于取消当前异步操作的信号。 */ signal?: AbortSignal; /** 报告不会阻断预览的解析或缓存警告。 */ onWarning?(error: unknown): void; }; /** DOCX Viewer 可同时消费主线程 Source 与 Worker 代理的稳定接口。 */ export interface DocxPagePreviewSource extends WordPageSource, WordPreviewSource { /** 返回当前文档摘要。 */ getSummary(): DocxWordPreviewSummary; /** 返回当前已经发现的扁平大纲条目。 */ getOutlineItems(): WordOutlineItem[]; /** 返回当前等待浏览器布局测量的批次。 */ getMeasurementBatch(): DocxMeasurementBatch | undefined; /** 提交主线程测得的块尺寸并推进分页。 */ commitMeasurement(batch: DocxMeasurementBatch, measurements: readonly DocxMeasuredBlock[], durationMs: number): Promise; /** 标记当前测量批次失败,供界面触发重试。 */ failMeasurement(batch: DocxMeasurementBatch, error: unknown): void; /** 当前 Source 是否已经具备可渲染摘要。 */ hasRenderableContent(): boolean; } /** 流式 DOCX 的页面、测量队列、大纲和懒归档资源的唯一所有者。 */ export declare class DocxWordPageSource implements DocxPagePreviewSource { readonly pages: WordPageSource; readonly outline: WordOutlineProvider; private readonly writableOutline; private readonly reader; private readonly signal?; private readonly pageStore; private readonly stats; private readonly listeners; private readonly outlineItemsById; private readonly blockPageIndex; readonly searchProvider: WordSearchProvider; private readonly batchById; private readonly resourceRefs; private readonly pendingPages; private readonly measurementQueue; private snapshot; private summary?; private nextBatchRevision; private parsingCompleted; private completed; private disposed; private failedBatchId?; private disposePromise?; constructor(options: DocxWordPageSourceOptions); setMetadata(metadata: { page: DocxPage; preserveSectionPagination: boolean; characterSpacingControl?: DocxDocument['characterSpacingControl']; }): void; addSourcePage(page: DocxPageContent): Promise; finishParsing(result: { title: string; images: DocxDocument['images']; bookmarks: NonNullable; review: DocxDocument['review']; notes: DocxDocument['notes']; }): void; getMeasurementBatch(): DocxMeasurementBatch | undefined; commitMeasurement(batch: DocxMeasurementBatch, measurements: readonly DocxMeasuredBlock[], durationMs: number): Promise; failMeasurement(batch: DocxMeasurementBatch, error: unknown): void; hasRenderableContent(): boolean; getSummary(): { resourceRefs: readonly OfficeResourceDescriptor[]; title: string; images: import("./types").DocxImage[]; page: DocxPage; outline?: WordOutlineItem[] | undefined; bookmarks?: Record | undefined; review?: Readonly<{ /** DOCX 页面数据源的预览摘要。 */ annotations: readonly Readonly<{ id: string; author?: string | undefined; createdAt?: string | undefined; text: string; resolved?: boolean | undefined; parentId?: string | undefined; target: import("../../..").OfficeAnnotationTarget; }>[]; revisions: readonly import("../word/review/types").WordRevisionRecord[]; revisionCount: number; noteCount: number; supportsRevisionModes: boolean; warnings: readonly Readonly<{ code: string; message: string; }>[]; }> | undefined; notes?: import("./types").DocxNotes | undefined; preserveSectionPagination?: boolean | undefined; characterSpacingControl?: import("./types").DocxCharacterSpacingControl | undefined; }; getOutlineItems(): WordOutlineItem[]; getPerformanceProfile(): { pageMode: "windowed"; renderWeight: number; outlineMode: "normal" | "virtual"; }; getSnapshot: () => WordPageSourceSnapshot; subscribe: (listener: () => void) => () => boolean; getPage(index: number, signal?: AbortSignal): Promise; ensureRange(start: number, end: number, signal?: AbortSignal): Promise; prioritizeBlock(blockId: string, signal?: AbortSignal): Promise; retainRange(start: number, end: number): () => void; retry(index: number): void; waitForCompletion(signal?: AbortSignal): Promise; dispose(): Promise; private collectPageMetadata; private createBatchMeta; private appendReadyPages; private replaceBatchesWithPages; private createReadyMeta; private rebuildBlockIndex; private tryComplete; private waitForQueueCapacity; private waitUntil; private throwIfAborted; private throwIfUnavailable; private emitChange; } export {};