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