{"dependencies":[{"name":"warning","loc":{"line":16,"column":23}}],"generated":{"js":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.convertColorToString = convertColorToString;\nexports.convertHexToRGB = convertHexToRGB;\nexports.decomposeColor = decomposeColor;\nexports.getContrastRatio = getContrastRatio;\nexports.getLuminance = getLuminance;\nexports.emphasize = emphasize;\nexports.fade = fade;\nexports.darken = darken;\nexports.lighten = lighten;\n\nvar _warning = require('warning');\n\nvar _warning2 = _interopRequireDefault(_warning);\n\nfunction _interopRequireDefault(obj) {\n  return obj && obj.__esModule ? obj : { default: obj };\n}\n\n/**\n * Returns a number whose value is limited to the given range.\n *\n * @param {number} value The value to be clamped\n * @param {number} min The lower boundary of the output range\n * @param {number} max The upper boundary of the output range\n * @returns {number} A number in the range [min, max]\n */\nfunction clamp(value, min, max) {\n  if (value < min) {\n    return min;\n  }\n  if (value > max) {\n    return max;\n  }\n  return value;\n}\n\n/**\n * Converts a color object with type and values to a string.\n *\n * @param {object} color - Decomposed color\n * @param {string} color.type - One of, 'rgb', 'rgba', 'hsl', 'hsla'\n * @param {array} color.values - [n,n,n] or [n,n,n,n]\n * @returns {string} A CSS color string\n */\nfunction convertColorToString(color) {\n  var type = color.type,\n      values = color.values;\n\n  if (type.indexOf('rgb') > -1) {\n    // Only convert the first 3 values to int (i.e. not alpha)\n    for (var i = 0; i < 3; i++) {\n      values[i] = parseInt(values[i]);\n    }\n  }\n\n  var colorString = void 0;\n\n  if (type.indexOf('hsl') > -1) {\n    colorString = color.type + '(' + values[0] + ', ' + values[1] + '%, ' + values[2] + '%';\n  } else {\n    colorString = color.type + '(' + values[0] + ', ' + values[1] + ', ' + values[2];\n  }\n\n  if (values.length === 4) {\n    colorString += ', ' + color.values[3] + ')';\n  } else {\n    colorString += ')';\n  }\n\n  return colorString;\n}\n\n/**\n * Converts a color from CSS hex format to CSS rgb format.\n *\n *  @param {string} color - Hex color, i.e. #nnn or #nnnnnn\n *  @returns {string} A CSS rgb color string\n */\nfunction convertHexToRGB(color) {\n  if (color.length === 4) {\n    var extendedColor = '#';\n    for (var i = 1; i < color.length; i++) {\n      extendedColor += color.charAt(i) + color.charAt(i);\n    }\n    color = extendedColor;\n  }\n\n  var values = {\n    r: parseInt(color.substr(1, 2), 16),\n    g: parseInt(color.substr(3, 2), 16),\n    b: parseInt(color.substr(5, 2), 16)\n  };\n\n  return 'rgb(' + values.r + ', ' + values.g + ', ' + values.b + ')';\n}\n\n/**\n * Returns an object with the type and values of a color.\n *\n * Note: Does not support rgb % values and color names.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {{type: string, values: number[]}} A MUI color object\n */\nfunction decomposeColor(color) {\n  if (color.charAt(0) === '#') {\n    return decomposeColor(convertHexToRGB(color));\n  }\n\n  var marker = color.indexOf('(');\n\n  \"development\" !== \"production\" ? (0, _warning2.default)(marker !== -1, 'Material-UI: The ' + color + ' color was not parsed correctly,\\n  because it has an unsupported format (color name or RGB %). This may cause issues in component rendering.') : void 0;\n\n  var type = color.substring(0, marker);\n  var values = color.substring(marker + 1, color.length - 1).split(',');\n  values = values.map(function (value) {\n    return parseFloat(value);\n  });\n\n  return { type: type, values: values };\n}\n\n/**\n * Calculates the contrast ratio between two colors.\n *\n * Formula: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef\n *\n * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} A contrast ratio value in the range 0 - 21 with 2 digit precision.\n */\nfunction getContrastRatio(foreground, background) {\n  var lumA = getLuminance(foreground);\n  var lumB = getLuminance(background);\n  var contrastRatio = (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);\n\n  return Number(contrastRatio.toFixed(2)); // Truncate at two digits\n}\n\n/**\n * The relative brightness of any point in a color space,\n * normalized to 0 for darkest black and 1 for lightest white.\n *\n * Formula: https://www.w3.org/WAI/GL/wiki/Relative_luminance\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} The relative brightness of the color in the range 0 - 1\n */\nfunction getLuminance(color) {\n  color = decomposeColor(color);\n\n  if (color.type.indexOf('rgb') > -1) {\n    var rgb = color.values.map(function (val) {\n      val /= 255; // normalized\n      return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);\n    });\n    return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3)); // Truncate at 3 digits\n  } else if (color.type.indexOf('hsl') > -1) {\n    return color.values[2] / 100;\n  }\n}\n\n/**\n * Darken or lighten a colour, depending on its luminance.\n * Light colors are darkened, dark colors are lightened.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} coefficient=0.15 - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction emphasize(color) {\n  var coefficient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15;\n\n  return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);\n}\n\n/**\n * Set the absolute transparency of a color.\n * Any existing alpha values are overwritten.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} value - value to set the alpha channel to in the range 0 -1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction fade(color, value) {\n  color = decomposeColor(color);\n  value = clamp(value, 0, 1);\n\n  if (color.type === 'rgb' || color.type === 'hsl') {\n    color.type += 'a';\n  }\n  color.values[3] = value;\n\n  return convertColorToString(color);\n}\n\n/**\n * Darkens a color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction darken(color, coefficient) {\n  color = decomposeColor(color);\n  coefficient = clamp(coefficient, 0, 1);\n\n  if (color.type.indexOf('hsl') > -1) {\n    color.values[2] *= 1 - coefficient;\n  } else if (color.type.indexOf('rgb') > -1) {\n    for (var i = 0; i < 3; i++) {\n      color.values[i] *= 1 - coefficient;\n    }\n  }\n  return convertColorToString(color);\n}\n\n/**\n * Lightens a color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction lighten(color, coefficient) {\n  color = decomposeColor(color);\n  coefficient = clamp(coefficient, 0, 1);\n\n  if (color.type.indexOf('hsl') > -1) {\n    color.values[2] += (100 - color.values[2]) * coefficient;\n  } else if (color.type.indexOf('rgb') > -1) {\n    for (var i = 0; i < 3; i++) {\n      color.values[i] += (255 - color.values[i]) * coefficient;\n    }\n  }\n\n  return convertColorToString(color);\n}"},"hash":"4fc9380b391425aebb5f07d3717b2415"}