import { type TimelinePreviewBackend } from '../controllers';
import { type TimelineResourceCacheStats } from '../resources/resourceCache';
import { TimelineConfig, Clip, ClipConfig, TimeMs, PlayState, Action, TimelineEvent, EventListener as TimelineEventListener, TimelineExportData, Track as TrackEntity, ThumbnailProvider, TrackInsertionPlacement, TrackType, ActiveClipPlaybackInfo, PreviewAspectRatio, PreviewMountConfig, PreviewBackendType, SelectedClipAudioAction, ClipConfigVoicePanelOptions } from '../models';
import type { ResolvedPlaybackPlan } from '../controllers/timelinePlaybackResolver';
import { TimelineClipConfigController } from '../controllers/timelineClipConfigController';
import { type DiagnosticExportPackage, type DiagnosticLiveSnapshot, type DiagnosticsListener, type DiagnosticsLiveListener, type DiagnosticSessionSnapshot } from '../../utils/diagnostics';
export declare class TimelineManager {
    private timeline;
    private tracks;
    private trackManager;
    private trackInfoPanelController;
    private playhead;
    private history;
    private config;
    private eventDispatcher;
    private animationFrameId;
    private lastUpdateTime;
    private isInitialized;
    private stage;
    private headerStage;
    private headerLayer;
    private backgroundLayer;
    private trackLayer;
    private dragOverlayLayer;
    private snapGuideLayer;
    private selectionBoxLayer;
    private selectionBoxRect;
    private isBoxSelecting;
    private boxSelectStartX;
    private boxSelectStartY;
    private resizeObserver;
    private rootContainer;
    private layout;
    private bodyBackgroundRect;
    private snapGuideLine;
    private trackInsertionPreviewLine;
    private trackInsertionPreviewY;
    private snapGuideTime;
    private horizontalScrollbar;
    private verticalScrollbar;
    private isExecutingHistoryAction;
    private lastTrackDuration;
    private lastReportedTrackDuration;
    private thumbnailProvider;
    private thumbnailProviderVersion;
    private clipThumbnailLoadStates;
    private sourceMediaRegistry;
    private canPlay;
    private sourceLoadingCount;
    private timelineStore?;
    private timelineCommands?;
    private timelineHistoryExecutor?;
    private timelineHistoryRecorder?;
    private timelinePresentationAdapter?;
    private timelineTrackBridge?;
    private timelinePlaybackResolver?;
    private previewRuntimeController?;
    private previewStateController?;
    private previewPlaybackSuspendedByBuffering;
    private previewPlaybackAutoResume;
    private previewBufferingSuspendTimeoutId;
    private lastSelectedClipId;
    private previewAspectRatio;
    private readonly bodyViewportScrollListener;
    private readonly bodyCanvasHostClickListener;
    private readonly rootWheelListener;
    private keyboardShortcutsController;
    private clipClipboard;
    private mountManager;
    private pendingDraftData;
    private selectionStore;
    private multiDragSession;
    private clipRemovalBatchDepth;
    private splitOperationDepth;
    private readonly diagnostics;
    private diagnosticsPanel;
    private previewRuntimeState;
    private previewActiveClipIds;
    private playbackAttemptId;
    private lastPreviewSyncedPlayState;
    private previewSyncInteractionMode;
    private readonly resourceCacheManager;
    constructor(config?: Partial<TimelineConfig>);
    private createPlaybackAttemptId;
    private refreshPlaybackAttempt;
    private emitDiagnostic;
    private buildDiagnosticsRuntimeState;
    private buildPreviewDiagnosticsContext;
    private mountDiagnosticsPanel;
    private getTimelineStore;
    private getTimelineCommands;
    private getTrackCollection;
    private getTimelinePresentationAdapter;
    private getTimelineTrackBridge;
    private getTimelinePlaybackResolver;
    get previewSession(): TimelinePreviewBackend | undefined;
    set previewSession(value: TimelinePreviewBackend | undefined);
    get previewMountContainer(): HTMLElement | null;
    set previewMountContainer(value: HTMLElement | null);
    get resolvedPreviewBackend(): Exclude<PreviewBackendType, 'auto'>;
    set resolvedPreviewBackend(value: Exclude<PreviewBackendType, 'auto'>);
    get runtimePreviewBackendOverride(): Exclude<PreviewBackendType, 'auto'> | null;
    set runtimePreviewBackendOverride(value: Exclude<PreviewBackendType, 'auto'> | null);
    get activePreviewCallbackToken(): number;
    set activePreviewCallbackToken(value: number);
    private get previewSourceLoadingCount();
    private set previewSourceLoadingCount(value);
    get previewBuffering(): boolean;
    set previewBuffering(value: boolean);
    private get pendingPreviewState();
    private set pendingPreviewState(value);
    get nextPendingPreviewSyncRequestId(): number;
    set nextPendingPreviewSyncRequestId(value: number);
    private getPreviewStateController;
    private getPreviewRuntimeController;
    private resolveConfiguredPreviewBackend;
    private createPreviewBackendCallbacks;
    private isActivePreviewCallbackToken;
    private getEventDispatcher;
    private getDefaultTrackForHistory;
    private getTimelineHistoryRecorder;
    private getTimelineHistoryExecutor;
    private get selectedClipId();
    private set selectedClipId(value);
    private ensureConfigState;
    private getCurrentTimeState;
    private getPlayStateState;
    private setPlayStateState;
    private getSpeedState;
    private getZoomState;
    private getDurationState;
    private setDurationState;
    private getScrollLeftState;
    private setScrollLeftState;
    private getScrollTopState;
    private setScrollTopState;
    private setViewportMetrics;
    private syncCurrentTimeToScene;
    private syncZoomToScene;
    private syncScrollTopPresentation;
    private refreshScrollbarMetrics;
    private getTimeScaleHeight;
    private getTrackContentTopOffset;
    private getViewportWidth;
    private getViewportHeight;
    private getHorizontalContentWidth;
    private getVerticalContentHeight;
    private clampScrollLeft;
    private clampScrollTop;
    private syncScrollLeft;
    private syncScrollTop;
    private getResolvedTracksSnapshot;
    private getTracksSortedByOrder;
    private getPlaybackTracksSnapshot;
    private buildPlaybackPlan;
    private hasTimelineVideoClip;
    private getPreviewAutoAspectRatioClipOrderMap;
    private getNextPreviewAutoAspectRatioOrder;
    private getAutoAspectRatioClip;
    private registerPreviewAutoAspectRatioClip;
    private syncPreviewSession;
    private syncPreviewPlaybackStateIfNeeded;
    private beginPendingPreview;
    updatePendingPreviewState(): void;
    private buildPreviewPendingState;
    private buildPreviewIndicatorState;
    private clearPendingPreviewState;
    private resetPreviewRuntimeState;
    private destroyPreviewSession;
    private retryPendingPreview;
    private handlePreviewBackendRuntimeError;
    init(container: HTMLElement): void;
    createTrack(type: TrackType, name?: string, insertionPlacement?: TrackInsertionPlacement, referenceTrackId?: string, roleOverride?: TrackEntity['role']): string;
    removeTrack(trackId: string): boolean;
    renameTrack(trackId: string, newName: string): boolean;
    getTracks(): any[];
    initTrackInfoPanel(container: HTMLElement): void;
    updateTrackInfoPanel(): void;
    muteTrack(trackId: string, isMuted: boolean): boolean;
    isTrackMuted(trackId: string): boolean;
    private calculateTrackY;
    private calculateTotalHeight;
    private updateAllTrackPositions;
    private cleanupEmptyTracks;
    private clearAllTrackDropPreviews;
    private showClipDropPreview;
    private showClipDropPreviews;
    private ensureTrackInsertionPreviewLine;
    private refreshTrackInsertionPreview;
    private showTrackInsertionPreview;
    private hideTrackInsertionPreview;
    private resolveTrackInsertionPreviewY;
    private updateViewportLayout;
    private renderBodyBackground;
    private handleBodyBackgroundClick;
    private handleBodyCanvasHostClick;
    private getSnapGuideAccentColor;
    private ensureSnapGuideLine;
    private refreshSnapGuideLine;
    private updateSnapGuideLine;
    private handleBodyViewportScroll;
    private handleHorizontalDragAutoScroll;
    private handleUnifiedWheel;
    private normalizeWheelDelta;
    private getPrimaryWheelDelta;
    private isHorizontalWheelGesture;
    private getHorizontalScrollDelta;
    private handleWheelZoom;
    private getWheelAnchorPointerX;
    play(): void;
    pause(): void;
    togglePlay(): void;
    private animate;
    private syncPlaybackClockToPreviewBuffering;
    private clearPreviewBufferingSuspendTimeout;
    setCurrentTime(time: TimeMs): void;
    getCurrentTime(): TimeMs;
    setEnableClipSnap(enabled: boolean): void;
    getEnableClipSnap(): boolean;
    setZoom(zoom: number): void;
    /**
     * 以游标（playhead）为中心设置缩放，用于外置 slider 等非幕布上的缩放操作
     * 调整 scrollLeft 使游标在屏幕上的位置保持不变
     */
    setZoomCenteredOnPlayhead(zoom: number): void;
    /**
     * 外部缩放入口：
     * - 鼠标在时间轴内：以鼠标位置为中心缩放
     * - 鼠标不在时间轴内：回退为以游标（playhead）为中心缩放
     */
    setZoomByInteraction(zoom: number): void;
    /**
     * 以时间轴上的指定像素点为中心缩放，保持该像素对应时间不变
     */
    setZoomCenteredOnTimelinePointer(zoom: number, pointerX: number): void;
    getZoom(): number;
    /**
     * 设置播放倍速
     * @param speed 播放倍速，默认为 1.0
     */
    setSpeed(speed: number): void;
    /**
     * 获取当前播放倍速
     * @returns 当前播放倍速
     */
    getSpeed(): number;
    /**
     * 获取当前是否可以播放
     * @returns 是否可以播放
     */
    getCanPlay(): boolean;
    /**
     * 当前是否存在视频源加载任务（例如 addClip 期间读取视频时长）
     */
    isSourceLoading(): boolean;
    /**
     * 获取视频源加载状态
     */
    getSourceLoadingState(): {
        isLoading: boolean;
        pending: number;
    };
    /**
     * 设置缩略图提供器
     * @param provider 缩略图提供器
     */
    setThumbnailProvider(provider: ThumbnailProvider): void;
    /**
     * 加载片段的封面
     * @param clip 片段对象
     * @returns Promise<boolean> 加载是否成功
     */
    private loadClipThumbnails;
    /**
     * 刷新指定片段的封面
     * @param clipId 片段 ID
     * @returns Promise<boolean> 刷新是否成功
     */
    refreshClipThumbnails(clipId: string): Promise<boolean>;
    /**
     * 刷新所有片段的封面
     * @returns Promise<boolean[]> 每个片段的刷新结果
     */
    refreshAllClipThumbnails(): Promise<boolean[]>;
    addClip(clipConfig: ClipConfig): Promise<string>;
    /**
     * 批量添加片段。批量模式下仅维护一段连续的视频源加载状态。
     */
    addClips(clipConfigs: ClipConfig[]): Promise<string[]>;
    private resolveBatchClipConfig;
    private resolveBatchAppendTrackId;
    private getTrackTimelineExtentById;
    private addClipInternal;
    removeClip(clipId: string): void;
    removeClipsByExternalId(externalId: string): boolean;
    updateClip(clipId: string, updates: Partial<Clip>): void;
    splitClip(clipId: string, time: TimeMs): void;
    splitCurrentClip(): void;
    getClips(): Clip[];
    private getExportComposition;
    private getExportCoverUrl;
    exportTimeline(): TimelineExportData;
    importTimeline(data: TimelineExportData): Promise<void>;
    private resolveImportedTrackRoles;
    private inferImportedPrimaryTrackIndex;
    private stopPlaybackForImport;
    getClipsData(): Clip[];
    /**
   * 获取插件版本号
   */
    getVersion(): string;
    undo(): boolean;
    redo(): boolean;
    getHistoryState(): {
        past: Action[];
        future: Action[];
    };
    /** 调整缩放比例以适应当前所有片段 */
    fitZoom(): void;
    /** 删除轨道内clip 间的空隙 */
    removeClipGaps(): void;
    private handleTimeChange;
    private handleScrollChange;
    private handleClipUpdate;
    private handleClipAdd;
    private handleClipRemove;
    /**
     * 检查并重新加载关键帧（如果需要）
     * @param clip 更新后的片段
     * @param originalClip 原始片段
     */
    private reloadClipThumbnailsIfNeeded;
    /**
     * 更新 canPlay 状态
     */
    private updateCanPlayState;
    private findClipById;
    private buildGeneratedAudioClipName;
    private normalizeGeneratedAudioDuration;
    private getVoiceLinkedAudioClips;
    private applyGeneratedAudioClipResult;
    private syncTextClipDurationToAudio;
    private doesClipOverlapOnTrack;
    private doesClipGroupOverlapOnTrack;
    private findNearestAvailableTrackForClip;
    private resolveOverlapRelocationTargetTrackId;
    private relocateClipToAvoidOverlap;
    private buildClipboardPasteGroups;
    private createTracksForTypeBoundary;
    private buildClipboardPasteGroupPlacementClips;
    private ensureClipboardPasteSourceTracks;
    private resolveClipboardPasteTypeGroupAssignments;
    private resolvePreferredTrackIndexForPasteGroup;
    private resolveClipboardPasteTrackAssignments;
    private relocateClipIfNeeded;
    private regenerateVoiceLinkedAudioClips;
    private getSelectedTextClipsForVoiceGeneration;
    private handleVoiceGenerateAction;
    private primeOrLoadClipThumbnails;
    private markClipThumbnailLoadCompleted;
    private buildClipThumbnailLoadSignature;
    private buildSourceMediaKey;
    private buildClipThumbnailResourceKey;
    private isClipThumbnailLoadCurrent;
    private areThumbnailArraysEqual;
    private handleClipSplit;
    private handleClipSelect;
    private handleActionUndo;
    private handleActionRedo;
    on(event: TimelineEvent, listener: TimelineEventListener): void;
    off(event: TimelineEvent, listener: TimelineEventListener): void;
    private emitEvent;
    private emitSelectedClipChangeIfNeeded;
    private beginSourceLoading;
    private endSourceLoading;
    private handleClipOverlap;
    private handleClipCrossTrackPreview;
    private handleClipCrossTrack;
    getPlayState(): PlayState;
    setDuration(duration: TimeMs): void;
    getDuration(): TimeMs;
    /**
     * 获取当前时间轴内容完整渲染高度。
     *
     * 该高度包含顶部时间刻度、所有轨道内容和底部横向滚动条，可供外部容器
     * 在需要贴合内容时作为高度参考。
     */
    getRenderedHeight(): number;
    /**
     * 调整时间轴大小以适配容器
     * @param width 新的宽度
     * @param height 新的高度
     */
    resize(width: number, height: number): void;
    /**
     * 滚动到指定时间
     * @param time 目标时间（毫秒）
     * @param setCurrentTime 是否同时将当前时间设置为该时间点，默认为 false
     */
    scrollToTime(time: TimeMs, setCurrentTime?: boolean): void;
    /**
     * 选择指定的片段
     * @param clipId 目标片段的 ID
     */
    private notifySelectionChange;
    private syncPrimarySelectionFromSelectionStore;
    private getOrderedSelectionClipIds;
    setSelection(clipIds: string[], options?: {
        preferredPrimaryClipId?: string | null;
        selectedClipEventClip?: Clip | null;
    }): void;
    selectClip(clipId: string, clip?: any): void;
    /**
     * 清空所有轨道的选中状态
     */
    clearSelection(): void;
    getSelectedClipIds(): string[];
    getPrimarySelectedClipId(): string | null;
    addToSelection(clipId: string): void;
    removeFromSelection(clipId: string): void;
    toggleSelection(clipId: string): void;
    isClipSelected(clipId: string): boolean;
    deleteSelectedClips(): void;
    copySelectedClips(): boolean;
    cutSelectedClips(): boolean;
    pasteClipboardClips(): Promise<boolean>;
    private deleteSelectedClipsWithHistoryLabel;
    private captureSelectedClipsToClipboard;
    private cloneClipForClipboard;
    private buildClipboardPasteClipConfig;
    private resolveClipboardPasteTrackId;
    private generateClipId;
    separateSelectedClipsAudio(): void;
    selectAllClips(): void;
    private emitSelectionChangeEvent;
    /**
     * 滚动到指定片段
     * @param clipId 目标片段的 ID
     * @param options 配置选项
     */
    scrollToClip(clipId: string, options?: {
        selectClip?: boolean;
        setCurrentTime?: boolean;
    }): void;
    /**
     * 获取当前时间点所在的clip
     * @returns 当前时间点所在的clip，如果没有则返回null
     */
    /**
     * 获取当前选中的 clip
     * @returns 当前选中的 clip，如果没有则返回 null
     */
    getSelectedClip(): Clip | null;
    getPrimarySelectedClip(): Clip | null;
    getSelectedClips(): Clip[];
    canCopySelectedClips(): boolean;
    canCutSelectedClips(): boolean;
    canPasteClipboardClips(): boolean;
    canDeleteSelectedClips(): boolean;
    canSplitSelectedClip(): boolean;
    getSelectedClipAudioAction(): SelectedClipAudioAction;
    canToggleSelectedClipsAudio(): boolean;
    toggleSelectedClipsAudio(): Promise<boolean>;
    getCurrentActiveClips(): ActiveClipPlaybackInfo[];
    getCurrentPlaybackPlan(): ResolvedPlaybackPlan;
    getPlaybackPlanAtTime(time: TimeMs): ResolvedPlaybackPlan;
    getActiveClipsAtTime(time: TimeMs): ActiveClipPlaybackInfo[];
    attachPreview(containerOrConfig: HTMLElement | PreviewMountConfig): void;
    detachPreview(): void;
    attachClipConfig(container: HTMLElement, options?: ClipConfigVoicePanelOptions): TimelineClipConfigController;
    getPreviewBackendType(): Exclude<PreviewBackendType, 'auto'>;
    hasAttachedPreview(): boolean;
    getPreviewAspectRatio(): PreviewAspectRatio;
    getDiagnosticsSnapshot(): DiagnosticSessionSnapshot;
    subscribeDiagnostics(listener: DiagnosticsListener): () => void;
    getDiagnosticsLiveSnapshot(recentEventLimit?: number): DiagnosticLiveSnapshot;
    subscribeDiagnosticsLive(listener: DiagnosticsLiveListener, recentEventLimit?: number): () => void;
    exportDiagnosticsPackage(): DiagnosticExportPackage;
    clearDiagnostics(sessionOnly?: boolean): void;
    setPreviewAspectRatio(aspectRatio: {
        width: number;
        height: number;
    }): void;
    resetPreviewAspectRatioToAuto(): void;
    /**
     * 删除当前选中的 clip
     * @returns 是否成功删除了选中的 clip
     */
    removeSelectedClip(): boolean;
    removeSelectedClips(): boolean;
    canSeparateClipAudio(clipId: string): boolean;
    canRestoreClipAudio(clipId: string): boolean;
    private pausePlaybackForAudioSeparation;
    private resolvePreferredSeparatedAudioTrackId;
    separateClipAudio(clipId: string): Promise<string | null>;
    restoreClipAudio(clipId: string): boolean;
    private applySelectedClipAudioAction;
    /**
     * 将片段从一个轨道移动到另一个轨道
     * @param clipId 要移动的片段 ID
     * @param targetTrackId 目标轨道 ID
     * @returns 是否成功移动
     */
    moveClipToTrack(clipId: string, targetTrackId: string): boolean;
    private moveClipToTrackWithHistorySnapshot;
    /**
     * 获取时间轴总时长
     * @returns 从 0 到最后一个音视频 clip 终点的时长（毫秒）
     */
    getTrackTotalDuration(): TimeMs;
    getResourceCacheStats(): Promise<TimelineResourceCacheStats>;
    cleanupResourceCache(): Promise<void>;
    clearResourceCache(): Promise<void>;
    destroy(): void;
    private initKeyboardShortcuts;
    /** 清除历史堆栈 */
    clearHistory(): void;
    private handleClipChange;
    private withClipRemovalBatch;
    private withSplitOperation;
    private resolveClipIdsForExternalIdRemoval;
    private shouldClearSelectionForClipIds;
    private resolveSelectedClipAtTime;
    private handleClipToggleSelection;
    private handleSetSingleSelection;
    private getMultiDragClipIds;
    private handleMultiDragMove;
    private normalizeTrackGroupStackOrder;
    private elevateMultiDragTrackGroups;
    private resolveMultiDragSessionTrackIds;
    private resetMultiDragSession;
    private handleMultiDragInteractionEnd;
    private syncMultiDragOverlayState;
    private clearMultiDragOverlayState;
    private ensureMultiDragSession;
    private haveSameClipIds;
    private restoreDraggedClipSnapshot;
    private syncMultiDragPeerClips;
    private previewMultiDragCrossTrack;
    private finalizeMultiDragCrossTrack;
    private resolveTrackIndexDelta;
    private resolveMultiDragTargetTrackId;
    private resolveMultiDragPreviewTargetTrackId;
    private buildMovedClipSnapshot;
    private appendPreviewClip;
    private resolveCrossTrackMoveDestination;
    private resolveCrossTrackPreviewDestination;
    private ensureTrackIdByRelativeIndex;
    private findTrackIdByRelativeIndex;
    private getTrackIdsByType;
    private updateClipPositionWithHistory;
    private updateClipPositionSilently;
    private ensureSelectionBoxRect;
    private showSelectionBoxRect;
    private hideSelectionBoxRect;
    private handleStageMouseDown;
    private handleBoxSelectMove;
    private handleBoxSelectEnd;
    private isPointOnClip;
    private getClipsIntersectingBox;
    private resolveTrackRenderHeight;
    private addClipToTrack;
    private cloneTrackSnapshot;
    private ensureTrackFromHistorySnapshot;
    private getTrackRestoreAnchor;
    private resolveTrackInsertionFromRestoreAnchor;
    private resolveTrackIdByClipId;
    private findTrackByClipId;
    /**
     * 检查轨道总时长是否变化，如果变化则触发事件并更新时间轴时长
     */
    private checkTrackDurationChange;
    private resolveSelectedClipSnapshot;
    private resolveSelectionChangeData;
    private commitPreviewVisualTransform;
    clearAllTracksAndClips(): void;
}
