import { FileContents, FileDiffMetadata, PJSThemeNames, RenderDiffOptions, RenderDiffResult, RenderFileOptions, RenderFileResult, SupportedLanguages, ThemedDiffResult, ThemedFileResult, ThemesType } from "../types.js";
import { DiffRendererInstance, FileRendererInstance, WorkerHighlighterOptions, WorkerPoolOptions, WorkerStats } from "./types.js";
import { LRUMap } from "lru_map";

//#region src/worker/WorkerPoolManager.d.ts
interface GetCachesResult {
  fileCache: LRUMap<string, RenderFileResult>;
  diffCache: LRUMap<string, RenderDiffResult>;
}
interface ThemeSubscriber {
  rerender(): void;
}
declare class WorkerPoolManager {
  private options;
  private highlighter;
  private renderOptions;
  private initialized;
  private workers;
  private taskQueue;
  private pendingTasks;
  private nextRequestId;
  private themeSubscribers;
  private workersFailed;
  private instanceRequestMap;
  private fileCache;
  private diffCache;
  constructor(options: WorkerPoolOptions, {
    langs,
    theme,
    lineDiffType,
    tokenizeMaxLineLength
  }: WorkerHighlighterOptions);
  isWorkingPool(): boolean;
  getFileResultCache(file: FileContents): RenderFileResult | undefined;
  getDiffResultCache(diff: FileDiffMetadata): RenderDiffResult | undefined;
  inspectCaches(): GetCachesResult;
  evictFileFromCache(cacheKey: string): boolean;
  evictDiffFromCache(cacheKey: string): boolean;
  setTheme(theme: PJSThemeNames | ThemesType): Promise<void>;
  getFileRenderOptions(): RenderFileOptions;
  getDiffRenderOptions(): RenderDiffOptions;
  private registerThemesOnWorkers;
  subscribeToThemeChanges(instance: ThemeSubscriber): () => void;
  unsubscribeToThemeChanges(instance: ThemeSubscriber): void;
  isInitialized(): boolean;
  initialize(languages?: SupportedLanguages[]): Promise<void>;
  private initializeWorkers;
  private drainQueue;
  highlightFileAST(instance: FileRendererInstance, file: FileContents): void;
  getPlainFileAST(file: FileContents): ThemedFileResult | undefined;
  highlightDiffAST(instance: DiffRendererInstance, diff: FileDiffMetadata): void;
  getPlainDiffAST(diff: FileDiffMetadata): ThemedDiffResult | undefined;
  terminate(): void;
  private terminateWorkers;
  getStats(): WorkerStats;
  private submitTask;
  private submitTask;
  private resolveLanguagesAndExecuteTask;
  private handleWorkerMessage;
  private _queuedDrain;
  private queueDrain;
  private executeTask;
  private getAvailableWorker;
  private generateRequestId;
}
//#endregion
export { WorkerPoolManager };
//# sourceMappingURL=WorkerPoolManager.d.ts.map