import { color as u } from "../color/index.es.js";
import { colorRegex as N } from "../utils/color-regex.es.js";
import { floatRegex as d } from "../utils/float-regex.es.js";
import { sanitize as b } from "../utils/sanitize.es.js";
function x(t) {
  var o, e;
  return isNaN(t) && typeof t == "string" && (((o = t.match(d)) == null ? void 0 : o.length) || 0) + (((e = t.match(N)) == null ? void 0 : e.length) || 0) > 0;
}
const p = "number", m = "color", T = "var", O = "var(", a = "${}", R = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
function f(t) {
  const o = t.toString(), e = [], c = {
    color: [],
    number: [],
    var: []
  }, n = [];
  let s = 0;
  const l = o.replace(R, (i) => (u.test(i) ? (c.color.push(s), n.push(m), e.push(u.parse(i))) : i.startsWith(O) ? (c.var.push(s), n.push(T), e.push(i)) : (c.number.push(s), n.push(p), e.push(parseFloat(i))), ++s, a)).split(a);
  return { values: e, split: l, indexes: c, types: n };
}
function h(t) {
  return f(t).values;
}
function g(t) {
  const { split: o, types: e } = f(t), c = o.length;
  return (n) => {
    let s = "";
    for (let r = 0; r < c; r++)
      if (s += o[r], n[r] !== void 0) {
        const l = e[r];
        l === p ? s += b(n[r]) : l === m ? s += u.transform(n[r]) : s += n[r];
      }
    return s;
  };
}
const y = (t) => typeof t == "number" ? 0 : u.test(t) ? u.getAnimatableNone(t) : t;
function E(t) {
  const o = h(t);
  return g(t)(o.map(y));
}
const S = {
  test: x,
  parse: h,
  createTransformer: g,
  getAnimatableNone: E
};
export {
  f as analyseComplexValue,
  S as complex
};
//# sourceMappingURL=index.es.js.map
