/** * Time-based visibility engine, adapted from * `cloudimage-video-hotspot/src/core/timeline.ts`. * * Determines which timed annotations are visible at a given video time and, * crucially, returns only the items that *changed* state (entered/exited) so * callers can avoid re-rendering on every frame. * * Visibility model (plan §Phase 4 step 7): * - no `startTime` → untimed; not managed here (always visible) * - `startTime` only → visible within [start - back, start + tol] * - `startTime` + `endTime` → visible within [start - back, end] * * A small backward lead (`back`, {@link DEFAULT_BACK_TOLERANCE}) makes markup * appear just BEFORE its frame, so a seek that snaps to a decodable frame a * little before the timestamp (sparse-keyframe / HLS video) still shows it. */ export interface TimedItem { id: string; startTime?: number; endTime?: number; } export interface TimelineUpdate { entered: T[]; exited: T[]; active: T[]; } /** * Default forward tolerance (seconds): a pin/shape anchored at T lingers until * `T + tol` after the playhead passes its frame. */ export declare const DEFAULT_TOLERANCE = 1; /** * Default backward tolerance (seconds): markup becomes visible `back` seconds * BEFORE its timestamp, so a video seek that lands on a decodable frame slightly * before T (sparse-keyframe / HLS) still shows the annotation. So a point item * anchored at T is visible across `[T - back, T + tol]`. */ export declare const DEFAULT_BACK_TOLERANCE = 0.1; /** Effective [start, end] visibility range for a timed item. */ export declare function effectiveRange(item: TimedItem, tolerance?: number, backTolerance?: number): [number, number]; /** Whether a timed item is visible at time `t`. Untimed items are not visible here. */ export declare function isVisibleAt(item: TimedItem, t: number, tolerance?: number, backTolerance?: number): boolean; export declare class TimelineEngine { private items; private sortedByStart; private byId; private activeSet; private tolerance; constructor(items?: T[], tolerance?: number); /** Replace the managed item set (keeps only items that carry a startTime). */ setItems(items: T[]): void; /** * Update for the current time. Returns items that entered or exited * visibility this tick, plus the full active list. */ update(currentTime: number): TimelineUpdate; /** Ids currently active (from the last `update`). */ getActiveIds(): string[]; /** Next item starting strictly after `time` (for "jump to next" controls). */ findNext(time: number): T | null; /** Previous item starting strictly before `time`. */ findPrev(time: number): T | null; /** Clear active tracking (e.g. after a seek that resets state). */ reset(): void; } //# sourceMappingURL=timeline-engine.d.ts.map