import { TraceContext } from "./otel/tracingHelpers.js";
import { VideoRenderOptions } from "@editframe/assets";

//#region src/EF_FRAMEGEN.d.ts
interface Bridge {
  onInitialize: (callback: (renderOptions: VideoRenderOptions, traceContext?: TraceContext, otelEndpoint?: string) => void) => void;
  initialized(): void;
  onBeginFrame(callback: (frameNumber: number, isLast: boolean, traceContext?: TraceContext) => void): void;
  onTriggerCanvas(callback: (traceContext?: TraceContext) => void): void;
  frameReady(frameNumber: number, audioSamples: ArrayBuffer): void;
  error(error: Error): void;
  syncLog(sequence: number, message: string, callback: () => void): void;
  exportSpans?: (endpoint: string, payload: string) => void;
}
declare global {
  interface Window {
    EF_FRAMEGEN?: EFFramegen;
    FRAMEGEN_BRIDGE?: Bridge;
    FRAMEGEN_BINDING?: any;
    FRAMEGEN_BINDING_error?: (error: Error) => void;
    EF_RENDERING?: () => boolean;
  }
}
declare class TriggerCanvas {
  private canvas;
  private ctx;
  private canvasInitialized;
  constructor();
  initialize(): void;
  trigger(): void;
}
declare class EFFramegen {
  time: number;
  frameDurationMs: number;
  audioBufferPromise?: Promise<AudioBuffer>;
  renderOptions?: VideoRenderOptions;
  frameBox: HTMLDivElement;
  BRIDGE: typeof window.FRAMEGEN_BRIDGE;
  triggerCanvas: TriggerCanvas;
  verificationCanvas?: HTMLCanvasElement;
  verificationCtx?: CanvasRenderingContext2D;
  private logSequence;
  frameTasksInProgress: boolean;
  currentFrameNumber: number;
  private timingFrameCount;
  private timingAccum;
  trace(...args: any[]): void;
  syncLog(...args: any[]): Promise<void>;
  private initializeVerificationCanvas;
  private drawVerificationStrip;
  constructor();
  /**
   * Helper method to get the workbench and set its rendering state.
   * This ensures consistent state management across the framegen lifecycle.
   */
  private setWorkbenchRendering;
  connectToBridge(): void;
  get showFrameBox(): boolean;
  initialize(renderOptions: VideoRenderOptions): Promise<void>;
  beginFrame(frameNumber: number, isLast: boolean): Promise<string | ArrayBuffer | null | undefined>;
}
//#endregion
export { EFFramegen };
//# sourceMappingURL=EF_FRAMEGEN.d.ts.map