'use strict';

var isMotionValue = require('../../../value/utils/is-motion-value.js');
var isForcedMotionValue = require('../../utils/is-forced-motion-value.js');

function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
    const style = props.style;
    const prevStyle = prevProps?.style;
    const newValues = {};
    if (!style)
        return newValues;
    for (const key in style) {
        if (isMotionValue.isMotionValue(style[key]) ||
            (prevStyle && isMotionValue.isMotionValue(prevStyle[key])) ||
            isForcedMotionValue.isForcedMotionValue(key, props) ||
            visualElement?.getValue(key)?.liveStyle !== undefined) {
            newValues[key] = style[key];
        }
    }
    return newValues;
}

exports.scrapeMotionValuesFromProps = scrapeMotionValuesFromProps;
