import { Accessor } from 'solid-js';

/**
 * A generic object pool to reduce garbage collection during animations.
 * This helps prevent memory churn by reusing objects instead of creating new ones.
 */
declare class ObjectPool<T> {
    private pool;
    private factory;
    private reset;
    private maxSize;
    /**
     * Creates a new object pool
     * @param factory Function to create new objects when pool is empty
     * @param reset Function to reset object state before returning to pool
     * @param initialSize Initial number of objects to create
     * @param maxSize Maximum size of the pool (prevents memory leaks)
     */
    constructor(factory: () => T, reset: (obj: T) => void, initialSize?: number, maxSize?: number);
    /**
     * Get an object from the pool or create a new one if empty
     */
    get(): T;
    /**
     * Return an object to the pool after use
     */
    release(obj: T): void;
    /**
     * Clear the pool (useful for cleanup)
     */
    clear(): void;
}
declare const recordPool: ObjectPool<Record<string, number>>;
declare const gradientStopPool: ObjectPool<GradientStop>;
declare const gradientPool: ObjectPool<Gradient>;
/**
 * Spring configuration
 */
type SpringConfig = {
    /**
     * Stiffness of the spring (higher = faster)
     * @default 170
     */
    stiffness?: number;
    /**
     * Damping of the spring (higher = less bouncy)
     * @default 26
     */
    damping?: number;
    /**
     * Precision threshold for considering animation complete
     * @default 0.01
     */
    precision?: number;
};
/**
 * Spring animation options
 */
type SpringOptions = {
    /**
     * Spring stiffness (higher = more rigid)
     */
    stiffness?: number;
    /**
     * Spring damping (higher = less bouncy)
     */
    damping?: number;
    /**
     * Precision threshold for considering animation complete
     */
    precision?: number;
    /**
     * Animation duration in milliseconds (overrides physics)
     */
    duration?: number;
    /**
     * Delay before animation starts in milliseconds
     */
    delay?: number;
    /**
     * Easing function or name
     */
    easing?: string | EasingFunction;
    /**
     * Whether animation should repeat infinitely
     */
    infinite?: boolean;
    /**
     * Number of times to repeat the animation
     * - number: Specific number of repetitions
     * - true/false: Whether to repeat infinitely
     * - "infinite": Repeat infinitely
     */
    repeat?: number | boolean | "infinite";
    /**
     * Type of repetition
     * - "loop": Restart from beginning
     * - "reverse": Play in reverse
     * - "mirror": Alternate between forward and reverse
     */
    repeatType?: "loop" | "reverse" | "mirror";
    /**
     * Delay between repetitions in milliseconds
     */
    repeatDelay?: number;
    /**
     * Callback when animation repeats
     */
    onRepeat?: () => void;
    /**
     * Color space for interpolating colors
     */
    colorSpace?: "rgb" | "hsl";
    /**
     * Keyframes for gradient animations
     */
    gradientKeyframes?: Gradient[];
    /**
     * Duration for gradient animations
     */
    gradientDuration?: number;
    /**
     * Callback when animation starts
     */
    onStart?: () => void;
    /**
     * Callback when animation completes
     */
    onComplete?: () => void;
    /**
     * Callback on each animation frame
     */
    onUpdate?: (value: any) => void;
    /**
     * Callback when animation encounters an error
     */
    onError?: (error: any) => void;
    /**
     * GPU acceleration settings
     * - true: Always enable GPU acceleration
     * - false: Always disable GPU acceleration
     * - 'auto': Automatically determine when to use GPU acceleration
     * - object: Detailed GPU acceleration configuration
     */
    gpuAccelerate?: boolean | "auto" | {
        enabled?: boolean | "auto";
        ssr?: boolean;
        hydration?: boolean;
        maxLayers?: number;
        memoryBudget?: "high" | "medium" | "low";
    };
    /**
     * Enable batched updates for better performance with many animations
     */
    batch?: boolean;
    /**
     * Power efficiency mode - reduces animation complexity on battery-powered devices
     */
    powerEfficient?: boolean;
    /**
     * Callback invoked when an ongoing animation is interrupted by a new target before completion.
     */
    onInterrupt?: () => void;
};
type SpringTargetPrimitive = number | Date | string;
type SpringTarget = SpringTargetPrimitive | {
    [key: string]: SpringTargetPrimitive | SpringTarget;
} | SpringTargetPrimitive[] | SpringTarget[];
type WidenSpringTarget<T> = T extends number ? number : T extends Date ? Date : T extends string ? string : T extends Array<infer U> ? Array<WidenSpringTarget<U>> : T extends object ? {
    [K in keyof T]: WidenSpringTarget<T[K]>;
} : T;
type SpringSetter<T> = (newValue: T, opts?: {
    hard?: boolean;
    soft?: boolean | number;
}) => Promise<void>;
type ColorFormat = "rgb" | "rgba" | "hsl" | "hsla" | "hex" | "named";
type GradientType = "linear" | "radial" | "conic";
interface Color {
    value: string;
    format: ColorFormat;
}
interface GradientStop {
    color: Color;
    position: number;
}
interface Gradient {
    type: GradientType;
    stops: GradientStop[];
    angle?: number;
    shape?: "circle" | "ellipse";
    size?: string;
    position?: string;
}
declare function createSpring<T extends SpringTarget>(initialValue: T, options?: SpringOptions): [Accessor<WidenSpringTarget<T>>, SpringSetter<WidenSpringTarget<T>>];
declare function createDerivedSpring<T extends SpringTarget>(target: Accessor<T>, options?: SpringOptions): Accessor<WidenSpringTarget<T>>;
interface KeyframeSpringOptions<T extends SpringTarget> {
    keyframes: WidenSpringTarget<T>[];
    frameDuration: number;
    infinite?: boolean;
    stiffness?: number;
    damping?: number;
    precision?: number;
    easing?: "linear" | "easeIn" | "easeOut" | "easeInOut";
    delay?: number;
    onKeyframeChange?: (newValue: WidenSpringTarget<T>, index: number) => void;
    onComplete?: () => void;
    onPause?: () => void;
    onResume?: () => void;
    onReverse?: () => void;
    onStop?: () => void;
}
/**
 * Creates a spring animation that cycles through an array of keyframes.
 * Throws an error if the keyframes array is empty.
 */
declare function createKeyframeSpring<T extends SpringTarget>(initial: T, options: KeyframeSpringOptions<T>): {
    springValue: Accessor<WidenSpringTarget<T>>;
    setSpringValue: (v: WidenSpringTarget<T>) => void;
    pause: () => void;
    resume: () => void;
    stop: () => void;
    reverse: () => void;
};
/**
 * Comprehensive easing function library for more natural animations
 * Based on popular easing equations but optimized for performance
 */
type EasingFunction = (t: number) => number;
declare const Easings: {
    linear: (t: number) => number;
    easeInSine: (t: number) => number;
    easeOutSine: (t: number) => number;
    easeInOutSine: (t: number) => number;
    easeInQuad: (t: number) => number;
    easeOutQuad: (t: number) => number;
    easeInOutQuad: (t: number) => number;
    easeInCubic: (t: number) => number;
    easeOutCubic: (t: number) => number;
    easeInOutCubic: (t: number) => number;
    easeInQuart: (t: number) => number;
    easeOutQuart: (t: number) => number;
    easeInOutQuart: (t: number) => number;
    easeInQuint: (t: number) => number;
    easeOutQuint: (t: number) => number;
    easeInOutQuint: (t: number) => number;
    easeInExpo: (t: number) => number;
    easeOutExpo: (t: number) => number;
    easeInOutExpo: (t: number) => number;
    easeInCirc: (t: number) => number;
    easeOutCirc: (t: number) => number;
    easeInOutCirc: (t: number) => number;
    easeInBack: (t: number) => number;
    easeOutBack: (t: number) => number;
    easeInOutBack: (t: number) => number;
    easeInElastic: (t: number) => number;
    easeOutElastic: (t: number) => number;
    easeInOutElastic: (t: number) => number;
    easeInBounce: (t: number) => number;
    easeOutBounce: (t: number) => number;
    easeInOutBounce: (t: number) => number;
};
/**
 * Options for a parallel animation group
 */
interface ParallelAnimationOptions {
    /**
     * Whether to loop the entire group
     */
    loop?: boolean;
    /**
     * Delay before starting the group in milliseconds
     */
    startDelay?: number;
    /**
     * Callback when all animations in the group complete
     */
    onComplete?: () => void;
    /**
     * Callback when the group loops
     */
    onLoop?: () => void;
    /**
     * Whether to restart animations that complete while others are still running
     * when loop is true
     */
    synchronizeLoops?: boolean;
}
/**
 * A single animation in a parallel group
 */
interface ParallelAnimationItem<T extends SpringTarget> {
    /**
     * Initial value for this animation
     */
    initialValue: T;
    /**
     * Target value for this animation
     */
    targetValue: WidenSpringTarget<T>;
    /**
     * Optional name for this animation to reference it later
     */
    name?: string;
    /**
     * Options for this specific animation
     */
    options?: SpringOptions & {
        hard?: boolean;
        soft?: boolean | number;
    };
    /**
     * Delay before starting this specific animation in milliseconds
     */
    delay?: number;
    /**
     * Callback when this animation completes
     */
    onComplete?: () => void;
}
/**
 * Creates a group of spring animations that run in parallel
 *
 * @param animations Array of animation configurations
 * @param options Options for the entire group
 * @returns Control functions and values for the animation group
 */
declare function createParallelAnimationGroup<T extends Record<string, SpringTarget>>(animations: Record<keyof T, ParallelAnimationItem<T[keyof T]>>, options?: ParallelAnimationOptions): {
    values: Record<keyof T, Accessor<WidenSpringTarget<T[keyof T]>>>;
    play: () => void;
    pause: () => void;
    stop: () => void;
    restart: () => void;
    isPlaying: Accessor<boolean>;
    progress: Accessor<number>;
    isComplete: Accessor<boolean>;
};
/**
 * Predefined physics configurations for common animation effects
 */
declare const PhysicsPresets: {
    /**
     * Default balanced spring
     */
    default: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Gentle, slow-moving spring
     */
    gentle: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Wobbly spring with less damping
     */
    wobbly: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Stiff spring that settles quickly
     */
    stiff: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Slow spring with high damping
     */
    molasses: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Very bouncy spring
     */
    bouncy: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Quick spring with minimal bounce
     */
    snappy: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Extremely bouncy spring
     */
    elastic: {
        stiffness: number;
        damping: number;
        precision: number;
    };
    /**
     * Instant movement (no animation)
     */
    immediate: {
        stiffness: number;
        damping: number;
        precision: number;
    };
};
/**
 * Apply a physics preset to spring options
 *
 * @param options Base spring options
 * @param preset Name of the preset to apply
 * @returns Updated spring options
 */
declare function applyPhysicsPreset(options: SpringOptions | undefined, preset: keyof typeof PhysicsPresets | SpringOptions): SpringOptions;
/**
 * Enhanced spring creation with physics presets support
 *
 * @param initialValue Initial value for the spring
 * @param options Spring options
 * @param preset Optional physics preset to apply
 * @returns Spring accessor and setter
 */
declare function createPresetSpring<T extends SpringTarget>(initialValue: T, options?: SpringOptions, preset?: keyof typeof PhysicsPresets | SpringOptions): [Accessor<WidenSpringTarget<T>>, SpringSetter<WidenSpringTarget<T>>];
/**
 * Options for staggered animations
 */
interface StaggerOptions {
    /**
     * Delay between each item's animation start (in milliseconds)
     */
    staggerDelay: number;
    /**
     * Direction of the stagger
     * - 'forward': First to last
     * - 'backward': Last to first
     * - 'center': From center outward
     * - 'edges': From edges inward
     */
    direction?: "forward" | "backward" | "center" | "edges";
    /**
     * Spring options for the animations
     */
    springOptions?: SpringOptions;
    /**
     * Easing function for the stagger timing (not the animation itself)
     */
    staggerEasing?: EasingFunction;
    /**
     * Callback when all animations complete
     */
    onComplete?: () => void;
    /**
     * Callback when an individual item's animation completes
     */
    onItemComplete?: (index: number) => void;
}
/**
 * Creates staggered animations across multiple elements
 *
 * @param items Array of elements to animate
 * @param getInitialValue Function to get initial value for each item
 * @param getTargetValue Function to get target value for each item
 * @param options Stagger options
 * @returns Array of spring values and control functions
 */
declare function createStaggeredAnimation<T extends SpringTarget>(items: any[], getInitialValue: (item: any, index: number) => T, getTargetValue: (item: any, index: number) => T, options: StaggerOptions): {
    springs: Accessor<WidenSpringTarget<T>>[];
    play: () => void;
    reset: () => void;
    isComplete: Accessor<boolean>;
};
/**
 * Error types for animation errors
 */
declare enum AnimationErrorType {
    PHYSICS = "physics",
    INTERPOLATION = "interpolation",
    TIMING = "timing",
    RESOURCE = "resource",
    CONFIGURATION = "configuration",
    UNKNOWN = "unknown"
}
/**
 * Structured animation error
 */
interface AnimationError {
    type: AnimationErrorType;
    message: string;
    originalError?: any;
    context?: Record<string, any>;
}
/**
 * Error handler function type
 */
type ErrorHandler = (error: AnimationError) => void;
/**
 * Performance metrics for animation monitoring
 */
interface PerformanceMetrics {
    avgFrameTime: number;
    maxFrameTime: number;
    droppedFrames: number;
    memoryUsage?: number;
    activeAnimations: number;
}
/**
 * Performance monitoring callback
 */
type PerformanceMonitor = (metrics: PerformanceMetrics) => void;
/**
 * Global configuration for the spring animation system
 */
interface SpringSystemConfig {
    /**
     * Custom error handler for animation errors
     */
    errorHandler?: ErrorHandler;
    /**
     * Performance monitoring callback
     */
    performanceMonitor?: PerformanceMonitor;
    /**
     * Whether to enable detailed logging in development
     */
    enableDevLogging?: boolean;
    /**
     * Maximum number of concurrent animations
     */
    maxConcurrentAnimations?: number;
    /**
     * Whether to automatically throttle animations when performance is poor
     */
    autoThrottle?: boolean;
    /**
     * Whether to use requestIdleCallback for non-critical animations
     */
    useIdleCallback?: boolean;
}
/**
 * Configure the spring animation system
 *
 * @param config Configuration options
 */
declare function configureSpringSystem(config: Partial<SpringSystemConfig>): void;
/**
 * Enhanced error reporting function
 *
 * @param error Error object or message
 * @param type Error type
 * @param context Additional context information
 */
declare function reportAnimationError(error: any, type?: AnimationErrorType, context?: Record<string, any>): void;
/**
 * Clean up all active animations
 */
declare function cleanupAllAnimations(): void;
/**
 * Clean up all gradient animation contexts.
 * Call this when unloading components or on unmount.
 */
declare function cleanupGradientAnimations(): void;

export { type AnimationError, AnimationErrorType, type Color, type ColorFormat, type EasingFunction, Easings, type ErrorHandler, type Gradient, type GradientStop, type GradientType, type KeyframeSpringOptions, type ParallelAnimationItem, type ParallelAnimationOptions, type PerformanceMetrics, type PerformanceMonitor, PhysicsPresets, type SpringConfig, type SpringOptions, type SpringSetter, type SpringSystemConfig, type SpringTarget, type SpringTargetPrimitive, type StaggerOptions, type WidenSpringTarget, applyPhysicsPreset, cleanupAllAnimations, cleanupGradientAnimations, configureSpringSystem, createDerivedSpring, createKeyframeSpring, createParallelAnimationGroup, createPresetSpring, createSpring, createStaggeredAnimation, gradientPool, gradientStopPool, recordPool, reportAnimationError };
