import { AccessibilityProps } from '../shared/index.js';

type WaveformVariant = 'bars' | 'line' | 'rings';
type WaveformSampleInput = Float32Array | number[];
type WaveformSource = AnalyserNode | MediaStream | WaveformSampleInput;
interface WaveformProps {
    source?: WaveformSource;
    samples?: WaveformSampleInput;
    intensity?: number;
    amplitude?: number;
    variant?: WaveformVariant;
    height?: number | string;
    width?: number | string;
    barCount?: number;
    smoothing?: number;
    color?: string;
    paused?: boolean;
}
interface NormalizedWaveformConfig {
    variant: WaveformVariant;
    intensity: number;
    amplitude: number;
    height: number | string;
    width: number | string;
    barCount: number;
    smoothing: number;
    color: string;
    paused: boolean;
}
interface WaveformAPI {
    config: NormalizedWaveformConfig;
    samples: Float32Array;
    ariaProps: Partial<AccessibilityProps>;
    dataAttributes: Record<'data-variant' | 'data-paused', string>;
    getSamples: (barCount?: number) => Float32Array;
}
declare const DEFAULT_WAVEFORM_BAR_COUNT = 48;
declare const DEFAULT_WAVEFORM_COLOR = "var(--accent-2)";
declare const DEFAULT_WAVEFORM_HEIGHT = 80;
declare const DEFAULT_WAVEFORM_INTENSITY = 1;
declare const DEFAULT_WAVEFORM_SMOOTHING = 0.8;
declare function normalizeBarCount(value: number | undefined): number;
declare function normalizeSmoothing(value: number | undefined): number;
declare function normalizeIntensity(value: number | undefined): number;
declare function normalizeWaveformConfig(props?: WaveformProps): NormalizedWaveformConfig;
declare function isWaveformSampleInput(value: unknown): value is WaveformSampleInput;
declare function createSilentSamples(count?: number): Float32Array;
declare function createIntensitySamples(intensity?: number, count?: number, phase?: number): Float32Array;
declare function normalizeWaveformSamples(input: WaveformSampleInput | undefined, targetCount?: number): Float32Array;
declare function resampleWaveformSamples(samples: WaveformSampleInput, targetCount: number): Float32Array;
declare function smoothWaveformSamples(previous: WaveformSampleInput | undefined, next: WaveformSampleInput, smoothing?: number): Float32Array;
declare function scaleWaveformSamples(samples: WaveformSampleInput, intensity?: number): Float32Array;
declare function getWaveformPeak(samples: WaveformSampleInput): number;
declare function toCssDimension(value: number | string | undefined): string | undefined;
declare function createWaveform(props?: WaveformProps): WaveformAPI;

interface WaveformCanvasSize {
    width: number;
    height: number;
    pixelRatio?: number;
}
interface WaveformRenderOptions {
    variant?: WaveformVariant;
    color?: string;
    intensity?: number;
    amplitude?: number;
    barCount?: number;
}
declare function prepareWaveformCanvas(canvas: HTMLCanvasElement, size: WaveformCanvasSize): CanvasRenderingContext2D | null;
declare function drawWaveform(context: CanvasRenderingContext2D, samples: WaveformSampleInput, size: WaveformCanvasSize, options?: WaveformRenderOptions): void;

declare const waveformVariants: (props?: ({
    variant?: "bars" | "line" | "rings" | undefined;
} & {
    className?: string;
}) | undefined) => string;
declare const waveformCanvasVariants: (props?: ({
    [x: string]: string | undefined;
} & {
    className?: string;
}) | undefined) => string;

export { DEFAULT_WAVEFORM_BAR_COUNT, DEFAULT_WAVEFORM_COLOR, DEFAULT_WAVEFORM_HEIGHT, DEFAULT_WAVEFORM_INTENSITY, DEFAULT_WAVEFORM_SMOOTHING, type NormalizedWaveformConfig, type WaveformAPI, type WaveformCanvasSize, type WaveformProps, type WaveformRenderOptions, type WaveformSampleInput, type WaveformSource, type WaveformVariant, createIntensitySamples, createSilentSamples, createWaveform, drawWaveform, getWaveformPeak, isWaveformSampleInput, normalizeBarCount, normalizeIntensity, normalizeSmoothing, normalizeWaveformConfig, normalizeWaveformSamples, prepareWaveformCanvas, resampleWaveformSamples, scaleWaveformSamples, smoothWaveformSamples, toCssDimension, waveformCanvasVariants, waveformVariants };
