"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index = require("../color/index.js");
const index$1 = require("../numbers/index.js");
const utils = require("../utils.js");
const colorToken = "${c}";
const numberToken = "${n}";
function test(v) {
  var _a, _b, _c, _d;
  return isNaN(v) && utils.isString(v) && ((_b = (_a = v.match(utils.floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(utils.colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0;
}
function analyse(v) {
  if (typeof v === "number")
    v = `${v}`;
  const values = [];
  let numColors = 0;
  const colors = v.match(utils.colorRegex);
  if (colors) {
    numColors = colors.length;
    v = v.replace(utils.colorRegex, colorToken);
    values.push(...colors.map(index.color.parse));
  }
  const numbers = v.match(utils.floatRegex);
  if (numbers) {
    v = v.replace(utils.floatRegex, numberToken);
    values.push(...numbers.map(index$1.number.parse));
  }
  return { values, numColors, tokenised: v };
}
function parse(v) {
  return analyse(v).values;
}
function createTransformer(v) {
  const { values, numColors, tokenised } = analyse(v);
  const numValues = values.length;
  return (v2) => {
    let output = tokenised;
    for (let i = 0; i < numValues; i++) {
      output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? index.color.transform(v2[i]) : utils.sanitize(v2[i]));
    }
    return output;
  };
}
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v;
function getAnimatableNone(v) {
  const parsed = parse(v);
  const transformer = createTransformer(v);
  return transformer(parsed.map(convertNumbersToZero));
}
const complex = { test, parse, createTransformer, getAnimatableNone };
exports.complex = complex;
//# sourceMappingURL=index.js.map
