// Optimized spring configuration for smooth expand/collapse
const SPRING_CONFIG = {
    type: 'spring',
    stiffness: 400,
    damping: 30,
    mass: 0.8,
};
// Core expand/collapse animation for tree nodes
const treeNodeVariants = {
    expanded: {
        opacity: 1,
        scaleY: 1,
        height: 'auto',
        transition: {
            height: {
                ...SPRING_CONFIG,
                duration: 0.3,
            },
            opacity: {
                ...SPRING_CONFIG,
                duration: 0.2,
            },
            scaleY: {
                ...SPRING_CONFIG,
                duration: 0.25,
            },
        },
    },
    collapsed: {
        opacity: 0,
        scaleY: 0.8,
        height: 0,
        transition: {
            height: {
                ...SPRING_CONFIG,
                duration: 0.25,
            },
            opacity: {
                ...SPRING_CONFIG,
                duration: 0.15,
            },
            scaleY: {
                ...SPRING_CONFIG,
                duration: 0.2,
            },
        },
    },
};
// Icon rotation animation for expand/collapse indication
const expandIconVariants = {
    expanded: {
        rotate: 90,
        transition: SPRING_CONFIG,
    },
    collapsed: {
        rotate: 0,
        transition: SPRING_CONFIG,
    },
};
// Stagger animation for children nodes
const childrenStagger = {
    staggerChildren: 0.03,
    delayChildren: 0.05,
};
// Individual child node entry animation
const childNodeVariants = {
    hidden: {
        opacity: 0,
        x: -10,
        transition: SPRING_CONFIG,
    },
    visible: {
        opacity: 1,
        x: 0,
        transition: SPRING_CONFIG,
    },
};
// Reduced motion variants for accessibility
const getReducedMotionVariants = (originalVariants) => {
    const reducedVariants = {};
    Object.keys(originalVariants).forEach((key) => {
        const variant = originalVariants[key];
        if (typeof variant === 'object' && variant !== null) {
            reducedVariants[key] = {
                ...variant,
                transition: {
                    duration: 0.01, // Nearly instant for reduced motion
                    ease: 'linear',
                },
            };
        }
    });
    return reducedVariants;
};

export { childNodeVariants, childrenStagger, expandIconVariants, getReducedMotionVariants, treeNodeVariants };
