import { __rest as V, __assign as p } from "../../../../../tslib/tslib.es6.es.js";
import { isNumericalString as _ } from "../../utils/is-numerical-string.es.js";
import { isZeroValueString as T } from "../../utils/is-zero-value-string.es.js";
import { resolveFinalValueInKeyframes as b } from "../../utils/resolve-value.es.js";
import { motionValue as c } from "../../value/index.es.js";
import { getAnimatableNone as v } from "../dom/value-types/animatable-none.es.js";
import { findValueType as h } from "../dom/value-types/find.es.js";
import { resolveVariant as A } from "./variants.es.js";
import { complex as F } from "../../../../../style-value-types/dist/es/complex/index.es.js";
function N(r, o, n) {
  r.hasValue(o) ? r.getValue(o).set(n) : r.addValue(o, c(n));
}
function q(r, o) {
  var n = A(r, o), t = n ? r.makeTargetAnimatable(n, !1) : {}, f = t.transitionEnd, s = f === void 0 ? {} : f;
  t.transition;
  var a = V(t, ["transitionEnd", "transition"]);
  a = p(p({}, a), s);
  for (var d in a) {
    var m = b(a[d]);
    N(r, d, m);
  }
}
function z(r, o, n) {
  var t, f, s, a, d = Object.keys(o).filter(function(g) {
    return !r.hasValue(g);
  }), m = d.length;
  if (!!m)
    for (var u = 0; u < m; u++) {
      var e = d[u], l = o[e], i = null;
      Array.isArray(l) && (i = l[0]), i === null && (i = (f = (t = n[e]) !== null && t !== void 0 ? t : r.readValue(e)) !== null && f !== void 0 ? f : o[e]), i != null && (typeof i == "string" && (_(i) || T(i)) ? i = parseFloat(i) : !h(i) && F.test(l) && (i = v(e, l)), r.addValue(e, c(i)), (s = (a = n)[e]) !== null && s !== void 0 || (a[e] = i), r.setBaseTarget(e, i));
    }
}
function w(r, o) {
  if (!!o) {
    var n = o[r] || o.default || o;
    return n.from;
  }
}
function C(r, o, n) {
  var t, f, s = {};
  for (var a in r)
    s[a] = (t = w(a, o)) !== null && t !== void 0 ? t : (f = n.getValue(a)) === null || f === void 0 ? void 0 : f.get();
  return s;
}
export {
  z as checkTargetForNewValues,
  C as getOrigin,
  w as getOriginFromTransition,
  q as setTarget
};
//# sourceMappingURL=setters.es.js.map
