import { FootnoteStoryLocator, EndnoteStoryLocator } from '../../../../../../../document-api/src/index.js';
import { Editor } from '../../Editor.js';
import { EventEmitter } from '../../EventEmitter.js';
type NoteLocator = FootnoteStoryLocator | EndnoteStoryLocator;
/**
 * Callback that persists the current PM state of a note editor back to the
 * canonical OOXML part. Obtained from `resolveNoteRuntime` at session
 * activation and cached here so coordinator-driven replays can commit
 * without rebuilding the runtime.
 */
export type NoteCommitHook = (hostEditor: Editor, noteEditor: Editor) => void;
/**
 * Event types emitted by NoteEditorRegistry.
 */
type NoteRegistryEvents = {
    editorCreated: [payload: {
        storyKey: string;
        editor: Editor;
        locator: NoteLocator;
    }];
    editorDisposed: [payload: {
        storyKey: string;
        reason: 'purge' | 'idle' | 'cap' | 'destroy';
    }];
};
export interface NoteEditorRegistryOptions {
    /**
     * Maximum number of unpinned editors kept in memory. Pinned entries are
     * always preserved and do not count against this cap.
     */
    capacity?: number;
    /**
     * Milliseconds after which an unpinned entry becomes eligible for idle
     * disposal. `0` disables idle disposal.
     */
    idleTtlMs?: number;
    /**
     * Called when entries are auto-disposed so the coordinator can purge its
     * global entries in the same tick.
     */
    onBeforeAutoDispose?: (storyKey: string) => void;
    /**
     * Wall-clock provider (injected for tests).
     */
    now?: () => number;
    /**
     * Schedules an idle sweep. Injected for tests. When omitted the registry
     * uses `setInterval` / `clearInterval`.
     */
    scheduleSweep?: (callback: () => void, intervalMs: number) => () => void;
}
export declare class NoteEditorRegistry extends EventEmitter<NoteRegistryEvents> {
    #private;
    constructor(options?: NoteEditorRegistryOptions);
    /**
     * Get the persistent editor for a story key, or `null` if none is tracked.
     * Accessing an entry refreshes its lastAccess timestamp.
     */
    get(storyKey: string): Editor | null;
    /**
     * Register a newly created note editor. `commit` is the runtime hook that
     * persists the editor's state back to the canonical OOXML part.
     */
    register(input: {
        storyKey: string;
        locator: NoteLocator;
        editor: Editor;
        commit?: NoteCommitHook | null;
    }): void;
    /**
     * Attach a disposer that must run when the registry disposes the editor.
     * The session factory uses this to tear down hidden host DOM.
     */
    attachDisposer(storyKey: string, disposer: () => void): void;
    /** Update the commit hook for an already-registered note editor. */
    setCommitHook(storyKey: string, commit: NoteCommitHook | null): void;
    /** Return the commit hook captured at registration time, if any. */
    getCommitHook(storyKey: string): NoteCommitHook | null;
    /** Pin prevents idle/cap disposal for this entry. */
    pin(storyKey: string): void;
    unpin(storyKey: string): void;
    isPinned(storyKey: string): boolean;
    /** Refresh the lastAccess timestamp. Called while a session is live. */
    touch(storyKey: string): void;
    /** Purge a single entry, disposing the editor and notifying observers. */
    purge(storyKey: string, reason?: 'purge' | 'idle' | 'cap' | 'destroy'): void;
    /** The current number of tracked entries (pinned + unpinned). */
    get size(): number;
    /** Iterate over the current set of tracked story keys. */
    keys(): string[];
    /**
     * Manually trigger the idle sweep. Called by the internal timer and by
     * tests.
     */
    runIdleSweep(): void;
    /** Dispose all entries and stop the sweep timer. */
    destroy(): void;
}
export {};
//# sourceMappingURL=NoteEditorRegistry.d.ts.map