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