text: 'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      };
      return __assign.apply(this, arguments);
  };
  
  var clamp = function (min, max) { return function (v) {
      return Math.max(Math.min(v, max), min);
  }; };
  var sanitize = function (v) { return (v % 1 ? Number(v.toFixed(5)) : v); };
  var floatRegex = /(-)?(\d[\d\.]*)/g;
  var colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;
  var singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i;
  
  var number = {
      test: function (v) { return typeof v === 'number'; },
      parse: parseFloat,
      transform: function (v) { return v; }
  };
  var alpha = __assign({}, number, { transform: clamp(0, 1) });
  var scale = __assign({}, number, { default: 1 });
  
  var createUnitType = function (unit) { return ({
      test: function (v) {
          return typeof v === 'string' && v.endsWith(unit) && v.split(' ').length === 1;
      },
      parse: parseFloat,
      transform: function (v) { return "" + v + unit; }
  }); };
  var degrees = createUnitType('deg');
  var percent = createUnitType('%');
  var px = createUnitType('px');
  var vh = createUnitType('vh');
  var vw = createUnitType('vw');
  var progressPercentage = __assign({}, percent, { parse: function (v) { return percent.parse(v) / 100; }, transform: function (v) { return percent.transform(v * 100); } });
  
  var getValueFromFunctionString = function (value) {
      return value.substring(value.indexOf('(') + 1, value.lastIndexOf(')'));
  };
  var clampRgbUnit = clamp(0, 255);
  var isRgba = function (v) { return v.red !== undefined; };
  var isHsla = function (v) { return v.hue !== undefined; };
  var splitColorValues = function (terms) {
      return function (v) {
          if (typeof v !== 'string')
              return v;
          var values = {};
          var valuesArray = getValueFromFunctionString(v).split(/,\s*/);
          for (var i = 0; i < 4; i++) {
              values[terms[i]] =
                  valuesArray[i] !== undefined ? parseFloat(valuesArray[i]) : 1;
          }
          return values;
      };
  };
  var rgbaTemplate = function (_a) {
      var red = _a.red, green = _a.green, blue = _a.blue, _b = _a.alpha, alpha = _b === void 0 ? 1 : _b;
      return "rgba(" + red + ", " + green + ", " + blue + ", " + alpha + ")";
  };
  var hslaTemplate = function (_a) {
      var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, _b = _a.alpha, alpha = _b === void 0 ? 1 : _b;
      return "hsla(" + hue + ", " + saturation + ", " + lightness + ", " + alpha + ")";
  };
  var rgbUnit = __assign({}, number, { transform: function (v) { return Math.round(clampRgbUnit(v)); } });
  function isColorString(color, colorType) {
      return color.startsWith(colorType) && singleColorRegex.test(color);
  }
  var rgba = {
      test: function (v) { return (typeof v === 'string' ? isColorString(v, 'rgb') : isRgba(v)); },
      parse: splitColorValues(['red', 'green', 'blue', 'alpha']),
      transform: function (_a) {
          var red = _a.red, green = _a.green, blue = _a.blue, alpha = _a.alpha;
          return rgbaTemplate({
              red: rgbUnit.transform(red),
              green: rgbUnit.transform(green),
              blue: rgbUnit.transform(blue),
              alpha: sanitize(alpha)
          });
      }
  };
  var hsla = {
      test: function (v) { return (typeof v === 'string' ? isColorString(v, 'hsl') : isHsla(v)); },
      parse: splitColorValues(['hue', 'saturation', 'lightness', 'alpha']),
      transform: function (_a) {
          var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, alpha = _a.alpha;
          return hslaTemplate({
              hue: Math.round(hue),
              saturation: percent.transform(sanitize(saturation)),
              lightness: percent.transform(sanitize(lightness)),
              alpha: sanitize(alpha)
          });
      }
  };
  var hex = __assign({}, rgba, { test: function (v) { return typeof v === 'string' && isColorString(v, '#'); }, parse: function (v) {
          var r = '';
          var g = '';
          var b = '';
          if (v.length > 4) {
              r = v.substr(1, 2);
              g = v.substr(3, 2);
              b = v.substr(5, 2);
          }
          else {
              r = v.substr(1, 1);
              g = v.substr(2, 1);
              b = v.substr(3, 1);
              r += r;
              g += g;
              b += b;
          }
          return {
              red: parseInt(r, 16),
              green: parseInt(g, 16),
              blue: parseInt(b, 16),
              alpha: 1
          };
      } });
  var color = {
      test: function (v) {
          return (typeof v === 'string' && singleColorRegex.test(v)) ||
              isRgba(v) ||
              isHsla(v);
      },
      parse: function (v) {
          if (rgba.test(v)) {
              return rgba.parse(v);
          }
          else if (hsla.test(v)) {
              return hsla.parse(v);
          }
          else if (hex.test(v)) {
              return hex.parse(v);
          }
          return v;
      },
      transform: function (v) {
          if (isRgba(v)) {
              return rgba.transform(v);
          }
          else if (isHsla(v)) {
              return hsla.transform(v);
          }
          return v;
      }
  };
  
  var COLOR_TOKEN = '${c}';
  var NUMBER_TOKEN = '${n}';
  var convertNumbersToZero = function (v) {
      return typeof v === 'number' ? 0 : v;
  };
  var complex = {
      test: function (v) {
          if (typeof v !== 'string' || !isNaN(v))
              return false;
          var numValues = 0;
          var foundNumbers = v.match(floatRegex);
          var foundColors = v.match(colorRegex);
          if (foundNumbers)
              numValues += foundNumbers.length;
          if (foundColors)
              numValues += foundColors.length;
          return numValues > 0;
      },
      parse: function (v) {
          var input = v;
          var parsed = [];
          var foundColors = input.match(colorRegex);
          if (foundColors) {
              input = input.replace(colorRegex, COLOR_TOKEN);
              parsed.push.apply(parsed, foundColors.map(color.parse));
          }
          var foundNumbers = input.match(floatRegex);
          if (foundNumbers) {
              parsed.push.apply(parsed, foundNumbers.map(number.parse));
          }
          return parsed;
      },
      createTransformer: function (prop) {
          var template = prop;
          var token = 0;
          var foundColors = prop.match(colorRegex);
          var numColors = foundColors ? foundColors.length : 0;
          if (foundColors) {
              for (var i = 0; i < numColors; i++) {
                  template = template.replace(foundColors[i], COLOR_TOKEN);
                  token++;
              }
          }
          var foundNumbers = template.match(floatRegex);
          var numNumbers = foundNumbers ? foundNumbers.length : 0;
          if (foundNumbers) {
              for (var i = 0; i < numNumbers; i++) {
                  template = template.replace(foundNumbers[i], NUMBER_TOKEN);
                  token++;
              }
          }
          return function (v) {
              var output = template;
              for (var i = 0; i < token; i++) {
                  output = output.replace(i < numColors ? COLOR_TOKEN : NUMBER_TOKEN, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
              }
              return output;
          };
      },
      getAnimatableNone: function (target) {
          var parsedTarget = complex.parse(target);
          var targetTransformer = complex.createTransformer(target);
          return targetTransformer(parsedTarget.map(convertNumbersToZero));
      }
  };
  
  exports.alpha = alpha;
  exports.color = color;
  exports.complex = complex;
  exports.degrees = degrees;
  exports.hex = hex;
  exports.hsla = hsla;
  exports.number = number;
  exports.percent = percent;
  exports.progressPercentage = progressPercentage;
  exports.px = px;
  exports.rgbUnit = rgbUnit;
  exports.rgba = rgba;
  exports.scale = scale;
  exports.vh = vh;
  exports.vw = vw;
  