import { EFFramegen } from "../EF_FRAMEGEN.js";
import { EFSourceMixinInterface } from "./EFSourceMixin.js";
import { TemporalMixinInterface } from "./EFTemporal.js";
import { FetchMixinInterface } from "./FetchMixin.js";
import { ControllableInterface } from "../gui/Controllable.js";
import { UrlGenerator } from "../transcoding/utils/UrlGenerator.js";
import { MediaEngine } from "./EFMedia/MediaEngine.js";
import { AudioSpan } from "../transcoding/types/index.js";
import * as lit0 from "lit";
import { LitElement, PropertyValueMap } from "lit";

//#region src/elements/EFMedia.d.ts
declare global {
  var EF_FRAMEGEN: EFFramegen;
}
/**
 * Simple async value wrapper that mimics Lit Task interface.
 * Used for backwards compatibility with code expecting task-like objects.
 */
declare class AsyncValue<T> {
  #private;
  get value(): T | undefined;
  get error(): Error | undefined;
  get status(): number;
  get taskComplete(): Promise<T | undefined>;
  /**
   * Set the value (marks status as complete)
   */
  setValue(value: T): void;
  /**
   * Set an error (marks status as error)
   */
  setError(error: Error): void;
  /**
   * Start a new async operation
   */
  startPending(): void;
  /**
   * Run an async function and update status accordingly
   */
  run(fn: () => Promise<T>): Promise<T | undefined>;
}
declare const EFMedia_base: (new (...args: any[]) => EFSourceMixinInterface) & (new (...args: any[]) => TemporalMixinInterface) & (new (...args: any[]) => FetchMixinInterface) & typeof LitElement;
declare class EFMedia extends EFMedia_base {
  #private;
  get efContext(): ControllableInterface | null;
  shouldAutoReady(): boolean;
  static readonly VIDEO_SAMPLE_BUFFER_SIZE = 30;
  static readonly AUDIO_SAMPLE_BUFFER_SIZE = 120;
  /**
   * Which tracks this media element requires.
   * Subclasses can override to specify their needs:
   * - "audio" - Only needs audio track (e.g., EFAudio)
   * - "video" - Only needs video track
   * - "both" - Needs both tracks (default for backwards compatibility)
   *
   * This is used during media engine creation to skip validation
   * of tracks that won't be used, avoiding unnecessary network requests.
   */
  get requiredTracks(): "audio" | "video" | "both";
  static get observedAttributes(): string[];
  static styles: lit0.CSSResult[];
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
  /**
   * Duration in milliseconds for audio buffering ahead of current time
   * @domAttribute "audio-buffer-duration"
   */
  audioBufferDurationMs: number;
  /**
   * Maximum number of concurrent audio segment fetches for buffering
   * @domAttribute "max-audio-buffer-fetches"
   */
  maxAudioBufferFetches: number;
  /**
   * Enable/disable audio buffering system
   * @domAttribute "enable-audio-buffering"
   */
  enableAudioBuffering: boolean;
  /**
   * Mute/unmute the media element
   * @domAttribute "mute"
   */
  mute: boolean;
  /**
   * FFT size for frequency analysis
   * @domAttribute "fft-size"
   */
  fftSize: number;
  /**
   * FFT decay rate for frequency analysis
   * @domAttribute "fft-decay"
   */
  fftDecay: number;
  /**
   * FFT gain for frequency analysis
   * @domAttribute "fft-gain"
   */
  fftGain: number;
  /**
   * Enable/disable frequency interpolation
   * @domAttribute "interpolate-frequencies"
   */
  interpolateFrequencies: boolean;
  getFreqWeights(): Float32Array<ArrayBufferLike>;
  getShouldInterpolateFrequencies(): boolean;
  getUrlGenerator(): UrlGenerator;
  /**
   * Async wrapper that mimics Task interface for backwards compatibility.
   * Code expecting mediaEngineTask.value, .taskComplete, .error, .status will still work.
   */
  mediaEngineTask: AsyncValue<MediaEngine>;
  /**
   * Get or create the MediaEngine for this element.
   * Uses caching based on src/fileId to avoid redundant fetches.
   */
  getMediaEngine(signal?: AbortSignal): Promise<MediaEngine | undefined>;
  /**
   * Async wrapper for frequency data - mimics Task interface for EFWaveform compatibility
   */
  frequencyDataTask: AsyncValue<Uint8Array<ArrayBufferLike> | null>;
  /**
   * Async wrapper for time domain data - mimics Task interface for EFWaveform compatibility
   */
  byteTimeDomainTask: AsyncValue<Uint8Array<ArrayBufferLike> | null>;
  /**
   * Get frequency data for audio visualization at a given time.
   */
  getFrequencyData(timeMs: number, signal?: AbortSignal): Promise<Uint8Array | null>;
  /**
   * Get time domain data for audio visualization at a given time.
   */
  getTimeDomainData(timeMs: number, signal?: AbortSignal): Promise<Uint8Array | null>;
  audioSegmentIdTask: AsyncValue<number | undefined>;
  audioInitSegmentFetchTask: AsyncValue<ArrayBuffer | undefined>;
  audioSegmentFetchTask: AsyncValue<ArrayBuffer | undefined>;
  audioInputTask: AsyncValue<any>;
  audioSeekTask: AsyncValue<any>;
  audioBufferTask: AsyncValue<any>;
  /**
   * The unique identifier for the media file.
   * This property can be set programmatically or via the "file-id" attribute.
   * The "asset-id" attribute is also supported for backward compatibility.
   * @domAttribute "file-id"
   */
  fileId: string | null;
  /** @deprecated Use fileId instead */
  get assetId(): string | null;
  set assetId(value: string | null);
  get intrinsicDurationMs(): number | undefined;
  protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
  get hasOwnDuration(): boolean;
  private _desiredSeekTimeMs;
  get desiredSeekTimeMs(): number;
  set desiredSeekTimeMs(value: number);
  protected executeSeek(seekToMs: number): Promise<void>;
  /**
   * Main integration method for EFTimegroup audio playback
   * Now powered by clean, testable utility functions
   * Returns undefined if no audio rendition is available
   */
  fetchAudioSpanningTime(fromMs: number, toMs: number, signal?: AbortSignal): Promise<AudioSpan | undefined>;
  /**
   * Wait for media engine to load and determine duration
   * Ensures media is ready for playback
   */
  waitForMediaDurations(signal?: AbortSignal): Promise<void>;
  /**
   * Returns media elements for playback audio rendering
   * For standalone media, returns [this]; for timegroups, returns all descendants
   * Used by PlaybackController for audio-driven playback
   */
  getMediaElements(): EFMedia[];
  /**
   * Render audio buffer for playback
   * Called by PlaybackController during live playback
   * Delegates to shared renderTemporalAudio utility for consistent behavior
   */
  renderAudio(fromMs: number, toMs: number): Promise<AudioBuffer>;
}
//#endregion
export { AsyncValue, EFMedia };
//# sourceMappingURL=EFMedia.d.ts.map