"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const warnOnce = require("../../utils/warn-once.js");
const index = require("../../value/index.js");
const isMotionValue = require("../../value/utils/is-motion-value.js");
function updateMotionValuesFromProps(element, next, prev) {
  var _a;
  for (var key in next) {
    var nextValue = next[key];
    var prevValue = prev[key];
    if (isMotionValue.isMotionValue(nextValue)) {
      element.addValue(key, nextValue);
      if ({ "ENV": "Browser" }.NODE_ENV === "development") {
        warnOnce.warnOnce(nextValue.version === "6.5.1", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.5.1 may not work as expected."));
      }
    } else if (isMotionValue.isMotionValue(prevValue)) {
      element.addValue(key, index.motionValue(nextValue));
    } else if (prevValue !== nextValue) {
      if (element.hasValue(key)) {
        var existingValue = element.getValue(key);
        !existingValue.hasAnimated && existingValue.set(nextValue);
      } else {
        element.addValue(key, index.motionValue((_a = element.getStaticValue(key)) !== null && _a !== void 0 ? _a : nextValue));
      }
    }
  }
  for (var key in prev) {
    if (next[key] === void 0)
      element.removeValue(key);
  }
  return next;
}
exports.updateMotionValuesFromProps = updateMotionValuesFromProps;
//# sourceMappingURL=motion-values.js.map
