{"version":3,"sources":["webpack:///./node_modules/@microsoft/fast-colors/dist/parse-color.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-rgba-64.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-converters.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-hsv.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-lab.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-interpolation.js","webpack:///./node_modules/@microsoft/fast-colors/dist/math-utilities.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-xyz.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-hsl.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-scale.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-palette.js","webpack:///./node_modules/@microsoft/fast-colors/dist/component-state-color-palette.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-blending.js","webpack:///./node_modules/@microsoft/fast-colors/dist/color-lch.js"],"names":["__webpack_require__","d","__webpack_exports__","parseColorHexRGB","hexRGBRegex","raw","result","exec","digits","length","r","charAt","g","b","concat","rawInt","parseInt","isNaN","color_rgba_64","Object","math_utilities","ColorRGBA64","_math_utilities_js__WEBPACK_IMPORTED_MODULE_0__","[object Object]","red","green","blue","alpha","this","a","data","rhs","map","formatHexValue","join","toStringHexRGB","Math","round","precision","value","rgbToLinearLuminance","rgbToRelativeLuminance","contrastRatio","calculateOverlayColor","rgbToHSL","hslToRGB","rgbToHSV","hsvToRGB","rgbToXYZ","xyzToRGB","rgbToLAB","labToRGB","rgbToLCH","lchToRGB","_color_hsl_js__WEBPACK_IMPORTED_MODULE_0__","_color_hsv_js__WEBPACK_IMPORTED_MODULE_1__","_color_lab_js__WEBPACK_IMPORTED_MODULE_2__","_color_lch_js__WEBPACK_IMPORTED_MODULE_3__","_color_rgba_64_js__WEBPACK_IMPORTED_MODULE_4__","_color_xyz_js__WEBPACK_IMPORTED_MODULE_5__","_math_utilities_js__WEBPACK_IMPORTED_MODULE_6__","rgb","luminanceHelper","i","pow","calculateContrastRatio","luminanceA","luminanceB","calcChannelOverlay","match","background","overlay","calcRgbOverlay","rgbMatch","rgbBackground","rgbOverlay","max","min","delta","hue","lum","sat","abs","hsl","c","l","s","x","h","m","hsv","v","rgbToXYZHelper","y","z","xyz","xyzToRGBHelper","xyzToLABHelper","epsilon","kappa","whitePoint","xyzToLAB","lab","fy","fx","fz","xcubed","ycubed","zcubed","labToXYZ","atan2","sqrt","labToLCH","lch","cos","sin","lchToLAB","ColorHSV","val","ColorLAB","interpolateRGB","ColorInterpolationSpace","interpolateByColorSpace","_color_converters_js__WEBPACK_IMPORTED_MODULE_0__","_color_hsl_js__WEBPACK_IMPORTED_MODULE_1__","_color_hsv_js__WEBPACK_IMPORTED_MODULE_2__","_color_lab_js__WEBPACK_IMPORTED_MODULE_3__","_color_lch_js__WEBPACK_IMPORTED_MODULE_4__","_color_rgba_64_js__WEBPACK_IMPORTED_MODULE_5__","_color_xyz_js__WEBPACK_IMPORTED_MODULE_6__","_math_utilities_js__WEBPACK_IMPORTED_MODULE_7__","position","left","right","space","HSL","interpolateHSL","HSV","interpolateHSV","XYZ","interpolateXYZ","LAB","interpolateLAB","LCH","interpolateLCH","clamp","normalize","denormalize","degreesToRadians","PI","radiansToDegrees","getHexStringForByte","toString","lerp","lerpAnglesInDegrees","roundToPrecisionSmall","factor","ColorXYZ","ColorHSL","color_scale_ColorScale","stops","Error","sortColorScaleStops","colors","Array","color","interpolationMode","color_interpolation","RGB","lowerIndex","upperIndex","scalePosition","lowerBound","upperBound","getColor","containedStops","push","unshift","range","finalStops","contrast","searchDown","contrastErrorMargin","maxSearchIterations","startingColor","finalPosition","finalColor","color_converters","testRangeMin","testRangeMax","mid","iterations","midColor","midContrast","newStops","sort","A","B","color_palette_ColorPalette","config","assign","defaultPaletteConfig","palette","updatePaletteColors","newConfig","changed","key","equalValue","scale","generatePaletteColorScale","steps","baseColorHSL","baseColor","trimmedScale","scaleColorLight","scaleColorDark","trim","clipLight","clipDark","adjustedLight","adjustedDark","saturationAdjustmentCutoff","color_blending","saturationLight","saturationDark","multiplyLight","multiply","multiplyDark","overlayLight","overlayDark","baseScalePosition","parse_color","greyscalePaletteConfig","component_state_color_palette_ComponentStateColorPalette","regenPalettes","darkLumColor","referencePalette","baseColorLum","baseColorPercent","matchRelativeLuminanceIndex","darkPercent","darkBaseColor","color_hsl","fromObject","darkestBaseColor","fullColorScaleStops","input","reference","bestFitValue","Number","MAX_VALUE","bestFitIndex","referenceLength","fitValue","saturateViaLCH","blendMultiply","blendOverlay","computeAlphaBlend","ColorBlendMode","_math_utilities_js__WEBPACK_IMPORTED_MODULE_5__","saturation","saturationConstant","blendMultiplyChannel","bottom","top","blendOverlayChannel","ColorLCH"],"mappings":";8GAAAA,EAAAC,EAAAC,EAAA,sBAAAC,IAIA,MAIAC,EAAA,oCAyDO,SAAAD,EAAAE,GACP,MAAAC,EAAAF,EAAAG,KAAAF,GACA,UAAAC,EACA,YAEA,IAAAE,EAAAF,EAAA,GACA,OAAAE,EAAAC,OAAA,CACA,MAAAC,EAAAF,EAAAG,OAAA,GACAC,EAAAJ,EAAAG,OAAA,GACAE,EAAAL,EAAAG,OAAA,GACAH,EAAAE,EAAAI,OAAAJ,EAAAE,IAAAC,KAEA,MAAAE,EAAAC,SAAAR,EAAA,IACA,OAAAS,MAAAF,GACA,KAGA,IAAeG,EAAA,EAAYC,OAAAC,EAAA,EAAAD,EAAS,SAAAJ,KAAA,UAAsCI,OAAAC,EAAA,EAAAD,EAAS,MAAAJ,KAAA,SAAqCI,OAAAC,EAAA,EAAAD,CAAS,IAAAJ,EAAA,4CClFjIf,EAAAC,EAAAC,EAAA,sBAAAmB,IAAA,IAAAC,EAAAtB,EAAA,GAUO,MAAAqB,EAQPE,YAAAC,EAAAC,EAAAC,EAAAC,GACAC,KAAAlB,EAAAc,EACAI,KAAAhB,EAAAa,EACAG,KAAAf,EAAAa,EACAE,KAAAC,EAAA,iBAAAF,GAAAV,MAAAU,GAAA,EAA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C,GAAqBnB,OAAAG,EAAA,EAAAH,CAAqBS,KAAAwD,EAAA9C,GAAqBnB,OAAAG,EAAA,EAAAH,CAAqBS,KAAA4D,EAAAlD,IAKrIf,WACA,OAAgB8D,EAAAzD,KAAAyD,EAAAD,EAAAxD,KAAAwD,EAAAI,EAAA5D,KAAA4D","file":"41.9450a9c976adac8268dd.js","sourcesContent":["import { ColorRGBA64 } from \"./color-rgba-64.js\";\nimport { normalize } from \"./math-utilities.js\";\nimport { namedColorsConfigs } from \"./named-colors.js\";\n// Matches rgb(R, G, B) where R, G, and B are integers [0 - 255]\nconst webRGBRegex = /^rgb\\(\\s*((?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|\\d{1,2})\\s*,\\s*){2}(?:25[0-5]|2[0-4]\\d|1\\d\\d|\\d{1,2})\\s*)\\)$/i;\n// Matches rgb(R, G, B, A) where R, G, and B are integers [0 - 255] and A is [0-1] floating\nconst webRGBARegex = /^rgba\\(\\s*((?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|\\d{1,2})\\s*,\\s*){3}(?:0|1|0?\\.\\d*)\\s*)\\)$/i;\n// Matches #RGB and #RRGGBB, where R, G, and B are [0-9] or [A-F]\nconst hexRGBRegex = /^#((?:[0-9a-f]{6}|[0-9a-f]{3}))$/i;\n// Matches #RGB and #RRGGBBAA, where R, G, B, and A are [0-9] or [A-F]\nconst hexRGBARegex = /^#((?:[0-9a-f]{8}|[0-9a-f]{4}))$/i;\n/**\n * Test if a color matches #RRGGBB or #RGB\n * @public\n */\nexport function isColorStringHexRGB(raw) {\n    return hexRGBRegex.test(raw);\n}\n/**\n * Test if a color matches #AARRGGBB or #ARGB\n * @public\n */\nexport function isColorStringHexARGB(raw) {\n    return hexRGBARegex.test(raw);\n}\n/**\n * Test if a color matches #RRGGBBAA or #RGBA\n * @public\n */\nexport function isColorStringHexRGBA(raw) {\n    return isColorStringHexARGB(raw); // No way to differentiate these two formats, so just use the same test\n}\n/**\n * Test if a color matches rgb(rr, gg, bb)\n * @public\n */\nexport function isColorStringWebRGB(raw) {\n    return webRGBRegex.test(raw);\n}\n/**\n * Test if a color matches rgba(rr, gg, bb, aa)\n *\n * @public\n */\nexport function isColorStringWebRGBA(raw) {\n    return webRGBARegex.test(raw);\n}\n/**\n * Tests whether a color is in {@link @microsoft/fast-colors#NamedColors}.\n * @param raw - the color name to test\n * @public\n */\nexport function isColorNamed(raw) {\n    return namedColorsConfigs.hasOwnProperty(raw);\n}\n/**\n * Converts a hexadecimal color string to a {@link @microsoft/fast-colors#ColorRGBA64}.\n * @param raw - a color string in the form of \"#RRGGBB\" or \"#RGB\"\n * @example\n * ```ts\n * parseColorHexRGBA(\"#FF0000\");\n * parseColorHexRGBA(\"#F00\");\n * ```\n * @public\n */\nexport function parseColorHexRGB(raw) {\n    const result = hexRGBRegex.exec(raw);\n    if (result === null) {\n        return null;\n    }\n    let digits = result[1];\n    if (digits.length === 3) {\n        const r = digits.charAt(0);\n        const g = digits.charAt(1);\n        const b = digits.charAt(2);\n        digits = r.concat(r, g, g, b, b);\n    }\n    const rawInt = parseInt(digits, 16);\n    if (isNaN(rawInt)) {\n        return null;\n    }\n    // Note the use of >>> rather than >> as we want JS to manipulate these as unsigned numbers\n    return new ColorRGBA64(normalize((rawInt & 0xff0000) >>> 16, 0, 255), normalize((rawInt & 0x00ff00) >>> 8, 0, 255), normalize(rawInt & 0x0000ff, 0, 255), 1);\n}\n/**\n * Converts a hexadecimal color string to a {@link @microsoft/fast-colors#ColorRGBA64}.\n * @param raw - a color string in the form of \"#AARRGGBB\" or \"#ARGB\"\n * @example\n * ```ts\n * parseColorHexRGBA(\"#AAFF0000\");\n * parseColorHexRGBA(\"#AF00\");\n * ```\n * @public\n */\nexport function parseColorHexARGB(raw) {\n    const result = hexRGBARegex.exec(raw);\n    if (result === null) {\n        return null;\n    }\n    let digits = result[1];\n    if (digits.length === 4) {\n        const a = digits.charAt(0);\n        const r = digits.charAt(1);\n        const g = digits.charAt(2);\n        const b = digits.charAt(3);\n        digits = a.concat(a, r, r, g, g, b, b);\n    }\n    const rawInt = parseInt(digits, 16);\n    if (isNaN(rawInt)) {\n        return null;\n    }\n    // Note the use of >>> rather than >> as we want JS to manipulate these as unsigned numbers\n    return new ColorRGBA64(normalize((rawInt & 0x00ff0000) >>> 16, 0, 255), normalize((rawInt & 0x0000ff00) >>> 8, 0, 255), normalize(rawInt & 0x000000ff, 0, 255), normalize((rawInt & 0xff000000) >>> 24, 0, 255));\n}\n/**\n * Converts a hexadecimal color string to a {@link @microsoft/fast-colors#ColorRGBA64}.\n * @param raw - a color string in the form of \"#RRGGBBAA\" or \"#RGBA\"\n * @example\n * ```ts\n * parseColorHexRGBA(\"#FF0000AA\");\n * parseColorHexRGBA(\"#F00A\");\n * ```\n * @public\n */\nexport function parseColorHexRGBA(raw) {\n    const result = hexRGBARegex.exec(raw);\n    if (result === null) {\n        return null;\n    }\n    let digits = result[1];\n    if (digits.length === 4) {\n        const r = digits.charAt(0);\n        const g = digits.charAt(1);\n        const b = digits.charAt(2);\n        const a = digits.charAt(3);\n        digits = r.concat(r, g, g, b, b, a, a);\n    }\n    const rawInt = parseInt(digits, 16);\n    if (isNaN(rawInt)) {\n        return null;\n    }\n    // Note the use of >>> rather than >> as we want JS to manipulate these as unsigned numbers\n    return new ColorRGBA64(normalize((rawInt & 0xff000000) >>> 24, 0, 255), normalize((rawInt & 0x00ff0000) >>> 16, 0, 255), normalize((rawInt & 0x0000ff00) >>> 8, 0, 255), normalize(rawInt & 0x000000ff, 0, 255));\n}\n/**\n * Converts a rgb color string to a {@link @microsoft/fast-colors#ColorRGBA64}.\n * @param raw - a color string format \"rgba(RR,GG,BB)\" where RR,GG,BB are [0,255]\n * @example\n * ```ts\n * parseColorWebRGB(\"rgba(255, 0, 0\");\n * ```\n * @public\n */\nexport function parseColorWebRGB(raw) {\n    const result = webRGBRegex.exec(raw);\n    if (result === null) {\n        return null;\n    }\n    const split = result[1].split(\",\");\n    return new ColorRGBA64(normalize(Number(split[0]), 0, 255), normalize(Number(split[1]), 0, 255), normalize(Number(split[2]), 0, 255), 1);\n}\n/**\n * Converts a rgba color string to a {@link @microsoft/fast-colors#ColorRGBA64}.\n * @param raw - a color string format \"rgba(RR,GG,BB,a)\" where RR,GG,BB are [0,255] and a is [0,1]\n * @example\n * ```ts\n * parseColorWebRGBA(\"rgba(255, 0, 0, 1\");\n * ```\n * @public\n */\nexport function parseColorWebRGBA(raw) {\n    const result = webRGBARegex.exec(raw);\n    if (result === null) {\n        return null;\n    }\n    const split = result[1].split(\",\");\n    if (split.length === 4) {\n        return new ColorRGBA64(normalize(Number(split[0]), 0, 255), normalize(Number(split[1]), 0, 255), normalize(Number(split[2]), 0, 255), Number(split[3]));\n    }\n    return null;\n}\n/**\n * Converts a named color to a {@link @microsoft/fast-colors#ColorRGBA64}.\n * @param raw - a {@link https://www.w3schools.com/colors/colors_names.asp | CSS color name}.\n * @example\n * ```ts\n * parseColorNamed(\"red\");\n * ```\n * @public\n */\nexport function parseColorNamed(raw) {\n    // const rawLower: typeof raw =  raw.toLowerCase() : raw.toString();\n    const config = namedColorsConfigs[raw.toLowerCase()];\n    return config\n        ? new ColorRGBA64(config.r, config.g, config.b, config.hasOwnProperty(\"a\") ? config.a : void 0)\n        : null;\n}\n/**\n *\n  Expects any of the following and attempts to determine which is being used\n * #RRGGBB, #AARRGGBB, rgb(RR,GG,BB) rgba(RR,GG,BB,a),\n * or any of the {@link https://www.w3schools.com/colors/colors_names.asp | CSS color names}.\n * @param raw - the color string to parse\n * @public\n */\nexport function parseColor(raw) {\n    const rawLower = raw.toLowerCase();\n    return isColorStringHexRGB(rawLower)\n        ? parseColorHexRGB(rawLower)\n        : isColorStringHexRGBA(rawLower)\n            ? parseColorHexARGB(rawLower)\n            : isColorStringWebRGB(rawLower)\n                ? parseColorWebRGB(rawLower)\n                : isColorStringWebRGBA(rawLower)\n                    ? parseColorWebRGBA(rawLower)\n                    : isColorNamed(rawLower)\n                        ? parseColorNamed(rawLower)\n                        : null;\n}\n","import { clamp, denormalize, getHexStringForByte, roundToPrecisionSmall, } from \"./math-utilities.js\";\n/**\n * A RGBA color with 64 bit channels.\n *\n * @example\n * ```ts\n * new ColorRGBA64(1, 0, 0, 1) // red\n * ```\n * @public\n */\nexport class ColorRGBA64 {\n    /**\n     *\n     * @param red - the red value\n     * @param green - the green value\n     * @param blue - the blue value\n     * @param alpha - the alpha value\n     */\n    constructor(red, green, blue, alpha) {\n        this.r = red;\n        this.g = green;\n        this.b = blue;\n        this.a = typeof alpha === \"number\" && !isNaN(alpha) ? alpha : 1;\n    }\n    /**\n     * Construct a {@link ColorRGBA64} from a {@link ColorRGBA64Config}\n     * @param data - the config object\n     */\n    static fromObject(data) {\n        return data && !isNaN(data.r) && !isNaN(data.g) && !isNaN(data.b)\n            ? new ColorRGBA64(data.r, data.g, data.b, data.a)\n            : null;\n    }\n    /**\n     * Determines if one color is equal to another.\n     * @param rhs - the color to compare\n     */\n    equalValue(rhs) {\n        return (this.r === rhs.r && this.g === rhs.g && this.b === rhs.b && this.a === rhs.a);\n    }\n    /**\n     * Returns the color formatted as a string; #RRGGBB\n     */\n    toStringHexRGB() {\n        return \"#\" + [this.r, this.g, this.b].map(this.formatHexValue).join(\"\");\n    }\n    /**\n     * Returns the color formatted as a string; #RRGGBBAA\n     */\n    toStringHexRGBA() {\n        return this.toStringHexRGB() + this.formatHexValue(this.a);\n    }\n    /**\n     * Returns the color formatted as a string; #AARRGGBB\n     */\n    toStringHexARGB() {\n        return \"#\" + [this.a, this.r, this.g, this.b].map(this.formatHexValue).join(\"\");\n    }\n    /**\n     * Returns the color formatted as a string; \"rgb(0xRR, 0xGG, 0xBB)\"\n     */\n    toStringWebRGB() {\n        return `rgb(${Math.round(denormalize(this.r, 0.0, 255.0))},${Math.round(denormalize(this.g, 0.0, 255.0))},${Math.round(denormalize(this.b, 0.0, 255.0))})`;\n    }\n    /**\n     * Returns the color formatted as a string; \"rgba(0xRR, 0xGG, 0xBB, a)\"\n     * @remarks\n     * Note that this follows the convention of putting alpha in the range [0.0,1.0] while the other three channels are [0,255]\n     */\n    toStringWebRGBA() {\n        return `rgba(${Math.round(denormalize(this.r, 0.0, 255.0))},${Math.round(denormalize(this.g, 0.0, 255.0))},${Math.round(denormalize(this.b, 0.0, 255.0))},${clamp(this.a, 0, 1)})`;\n    }\n    /**\n     * Returns a new {@link ColorRGBA64} rounded to the provided precision\n     * @param precision - the precision to round to\n     */\n    roundToPrecision(precision) {\n        return new ColorRGBA64(roundToPrecisionSmall(this.r, precision), roundToPrecisionSmall(this.g, precision), roundToPrecisionSmall(this.b, precision), roundToPrecisionSmall(this.a, precision));\n    }\n    /**\n     * Returns a new {@link ColorRGBA64} with channel values clamped between 0 and 1.\n     */\n    clamp() {\n        return new ColorRGBA64(clamp(this.r, 0, 1), clamp(this.g, 0, 1), clamp(this.b, 0, 1), clamp(this.a, 0, 1));\n    }\n    /**\n     * Converts the {@link ColorRGBA64} to a {@link ColorRGBA64Config}.\n     */\n    toObject() {\n        return { r: this.r, g: this.g, b: this.b, a: this.a };\n    }\n    formatHexValue(value) {\n        return getHexStringForByte(denormalize(value, 0.0, 255.0));\n    }\n}\n","import { ColorHSL } from \"./color-hsl.js\";\nimport { ColorHSV } from \"./color-hsv.js\";\nimport { ColorLAB } from \"./color-lab.js\";\nimport { ColorLCH } from \"./color-lch.js\";\nimport { ColorRGBA64 } from \"./color-rgba-64.js\";\nimport { ColorXYZ } from \"./color-xyz.js\";\nimport { degreesToRadians, radiansToDegrees } from \"./math-utilities.js\";\n// All hue values are in degrees rather than radians or normalized\n// All conversions use the D65 2 degree white point for XYZ\n// Info on conversions and constants used can be found in the following:\n// https://en.wikipedia.org/wiki/CIELAB_color_space\n// https://en.wikipedia.org/wiki/Illuminant_D65\n// https://ninedegreesbelow.com/photography/xyz-rgb.html\n// http://user.engineering.uiowa.edu/~aip/Misc/ColorFAQ.html\n// https://web.stanford.edu/~sujason/ColorBalancing/adaptation.html\n// http://brucelindbloom.com/index.html\n/**\n * Get the luminance of a color in the linear RGB space.\n * This is not the same as the relative luminance in the sRGB space for WCAG contrast calculations. Use rgbToRelativeLuminance instead.\n * @param rgb - The input color\n *\n * @public\n */\nexport function rgbToLinearLuminance(rgb) {\n    return rgb.r * 0.2126 + rgb.g * 0.7152 + rgb.b * 0.0722;\n}\n/**\n * Get the relative luminance of a color.\n * Adjusts the color to sRGB space, which is necessary for the WCAG contrast spec.\n * The alpha channel of the input is ignored.\n * @param rgb - The input color\n *\n * @public\n */\nexport function rgbToRelativeLuminance(rgb) {\n    function luminanceHelper(i) {\n        if (i <= 0.03928) {\n            return i / 12.92;\n        }\n        return Math.pow((i + 0.055) / 1.055, 2.4);\n    }\n    return rgbToLinearLuminance(new ColorRGBA64(luminanceHelper(rgb.r), luminanceHelper(rgb.g), luminanceHelper(rgb.b), 1));\n}\nconst calculateContrastRatio = (a, b) => (a + 0.05) / (b + 0.05);\n/**\n * Calculate the contrast ratio between two colors. Uses the formula described by {@link https://www.w3.org/TR/WCAG20-TECHS/G17.html | WCAG 2.0}.\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function contrastRatio(a, b) {\n    const luminanceA = rgbToRelativeLuminance(a);\n    const luminanceB = rgbToRelativeLuminance(b);\n    return luminanceA > luminanceB\n        ? calculateContrastRatio(luminanceA, luminanceB)\n        : calculateContrastRatio(luminanceB, luminanceA);\n}\nfunction calcChannelOverlay(match, background, overlay) {\n    if (overlay - background === 0) {\n        return 0;\n    }\n    else {\n        return (match - background) / (overlay - background);\n    }\n}\nfunction calcRgbOverlay(rgbMatch, rgbBackground, rgbOverlay) {\n    const rChannel = calcChannelOverlay(rgbMatch.r, rgbBackground.r, rgbOverlay.r);\n    const gChannel = calcChannelOverlay(rgbMatch.g, rgbBackground.g, rgbOverlay.g);\n    const bChannel = calcChannelOverlay(rgbMatch.b, rgbBackground.b, rgbOverlay.b);\n    return (rChannel + gChannel + bChannel) / 3;\n}\n/**\n * Calculate an overlay color that uses rgba (rgb + alpha) that matches the appearance of a given solid color when placed on the same background\n * @param rgbMatch - The solid color the overlay should match in appearance when placed over the rgbBackground\n * @param rgbBackground - The background on which the overlay rests\n * @param rgbOverlay - The rgb color of the overlay. Typically this is either pure white or pure black and when not provided will be determined automatically. This color will be used in the returned output\n * @returns The rgba (rgb + alpha) color of the overlay\n *\n * @public\n */\nexport function calculateOverlayColor(rgbMatch, rgbBackground, rgbOverlay = null) {\n    let alpha = 0;\n    let overlay = rgbOverlay;\n    if (overlay !== null) {\n        alpha = calcRgbOverlay(rgbMatch, rgbBackground, overlay);\n    }\n    else {\n        overlay = new ColorRGBA64(0, 0, 0, 1);\n        alpha = calcRgbOverlay(rgbMatch, rgbBackground, overlay);\n        if (alpha <= 0) {\n            overlay = new ColorRGBA64(1, 1, 1, 1);\n            alpha = calcRgbOverlay(rgbMatch, rgbBackground, overlay);\n        }\n    }\n    alpha = Math.round(alpha * 1000) / 1000;\n    return new ColorRGBA64(overlay.r, overlay.g, overlay.b, alpha);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorRGBA64} to a {@link @microsoft/fast-colors#ColorHSL}\n * @param rgb - the rgb color to convert\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function rgbToHSL(rgb) {\n    const max = Math.max(rgb.r, rgb.g, rgb.b);\n    const min = Math.min(rgb.r, rgb.g, rgb.b);\n    const delta = max - min;\n    let hue = 0;\n    if (delta !== 0) {\n        if (max === rgb.r) {\n            hue = 60 * (((rgb.g - rgb.b) / delta) % 6);\n        }\n        else if (max === rgb.g) {\n            hue = 60 * ((rgb.b - rgb.r) / delta + 2);\n        }\n        else {\n            hue = 60 * ((rgb.r - rgb.g) / delta + 4);\n        }\n    }\n    if (hue < 0) {\n        hue += 360;\n    }\n    const lum = (max + min) / 2;\n    let sat = 0;\n    if (delta !== 0) {\n        sat = delta / (1 - Math.abs(2 * lum - 1));\n    }\n    return new ColorHSL(hue, sat, lum);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorHSL} to a {@link @microsoft/fast-colors#ColorRGBA64}\n * @param hsl - the hsl color to convert\n * @param alpha - the alpha value\n *\n * @public\n */\nexport function hslToRGB(hsl, alpha = 1) {\n    const c = (1 - Math.abs(2 * hsl.l - 1)) * hsl.s;\n    const x = c * (1 - Math.abs(((hsl.h / 60) % 2) - 1));\n    const m = hsl.l - c / 2;\n    let r = 0;\n    let g = 0;\n    let b = 0;\n    if (hsl.h < 60) {\n        r = c;\n        g = x;\n        b = 0;\n    }\n    else if (hsl.h < 120) {\n        r = x;\n        g = c;\n        b = 0;\n    }\n    else if (hsl.h < 180) {\n        r = 0;\n        g = c;\n        b = x;\n    }\n    else if (hsl.h < 240) {\n        r = 0;\n        g = x;\n        b = c;\n    }\n    else if (hsl.h < 300) {\n        r = x;\n        g = 0;\n        b = c;\n    }\n    else if (hsl.h < 360) {\n        r = c;\n        g = 0;\n        b = x;\n    }\n    return new ColorRGBA64(r + m, g + m, b + m, alpha);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorRGBA64} to a {@link @microsoft/fast-colors#ColorHSV}\n * @param rgb - the rgb color to convert\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function rgbToHSV(rgb) {\n    const max = Math.max(rgb.r, rgb.g, rgb.b);\n    const min = Math.min(rgb.r, rgb.g, rgb.b);\n    const delta = max - min;\n    let hue = 0;\n    if (delta !== 0) {\n        if (max === rgb.r) {\n            hue = 60 * (((rgb.g - rgb.b) / delta) % 6);\n        }\n        else if (max === rgb.g) {\n            hue = 60 * ((rgb.b - rgb.r) / delta + 2);\n        }\n        else {\n            hue = 60 * ((rgb.r - rgb.g) / delta + 4);\n        }\n    }\n    if (hue < 0) {\n        hue += 360;\n    }\n    let sat = 0;\n    if (max !== 0) {\n        sat = delta / max;\n    }\n    return new ColorHSV(hue, sat, max);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorHSV} to a {@link @microsoft/fast-colors#ColorRGBA64}\n * @param hsv - the hsv color to convert\n * @param alpha - the alpha value\n *\n * @public\n */\nexport function hsvToRGB(hsv, alpha = 1) {\n    const c = hsv.s * hsv.v;\n    const x = c * (1 - Math.abs(((hsv.h / 60) % 2) - 1));\n    const m = hsv.v - c;\n    let r = 0;\n    let g = 0;\n    let b = 0;\n    if (hsv.h < 60) {\n        r = c;\n        g = x;\n        b = 0;\n    }\n    else if (hsv.h < 120) {\n        r = x;\n        g = c;\n        b = 0;\n    }\n    else if (hsv.h < 180) {\n        r = 0;\n        g = c;\n        b = x;\n    }\n    else if (hsv.h < 240) {\n        r = 0;\n        g = x;\n        b = c;\n    }\n    else if (hsv.h < 300) {\n        r = x;\n        g = 0;\n        b = c;\n    }\n    else if (hsv.h < 360) {\n        r = c;\n        g = 0;\n        b = x;\n    }\n    return new ColorRGBA64(r + m, g + m, b + m, alpha);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorLCH} to a {@link @microsoft/fast-colors#ColorLAB}\n * @param lch - the lch color to convert\n *\n * @public\n */\nexport function lchToLAB(lch) {\n    let a = 0;\n    let b = 0;\n    if (lch.h !== 0) {\n        a = Math.cos(degreesToRadians(lch.h)) * lch.c;\n        b = Math.sin(degreesToRadians(lch.h)) * lch.c;\n    }\n    return new ColorLAB(lch.l, a, b);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorLAB} to a {@link @microsoft/fast-colors#ColorLCH}\n * @param lab - the lab color to convert\n *\n * @remarks\n * The discontinuity in the C parameter at 0 means that floating point errors will often result in values near 0 giving unpredictable results.\n * EG: 0.0000001 gives a very different result than -0.0000001\n * In cases where both a and b are very near zero this function will return an LCH color with an H of 0\n * More info about the atan2 function: {@link https://en.wikipedia.org/wiki/Atan2}\n * @public\n */\nexport function labToLCH(lab) {\n    let h = 0;\n    // Because of the discontinuity at 0 if a number is very close to 0 - often due to floating point errors - then\n    // it gives unexpected results. EG: 0.000000000001 gives a different result than 0. So just avoid any number\n    // that has both a and b very close to zero and lump it in with the h = 0 case.\n    if (Math.abs(lab.b) > 0.001 || Math.abs(lab.a) > 0.001) {\n        h = radiansToDegrees(Math.atan2(lab.b, lab.a));\n    }\n    if (h < 0) {\n        h += 360;\n    }\n    const c = Math.sqrt(lab.a * lab.a + lab.b * lab.b);\n    return new ColorLCH(lab.l, c, h);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorLAB} to a {@link @microsoft/fast-colors#ColorXYZ}\n * @param lab - the lab color to convert\n *\n * @public\n */\nexport function labToXYZ(lab) {\n    const fy = (lab.l + 16) / 116;\n    const fx = fy + lab.a / 500;\n    const fz = fy - lab.b / 200;\n    const xcubed = Math.pow(fx, 3);\n    const ycubed = Math.pow(fy, 3);\n    const zcubed = Math.pow(fz, 3);\n    let x = 0;\n    if (xcubed > ColorLAB.epsilon) {\n        x = xcubed;\n    }\n    else {\n        x = (116 * fx - 16) / ColorLAB.kappa;\n    }\n    let y = 0;\n    if (lab.l > ColorLAB.epsilon * ColorLAB.kappa) {\n        y = ycubed;\n    }\n    else {\n        y = lab.l / ColorLAB.kappa;\n    }\n    let z = 0;\n    if (zcubed > ColorLAB.epsilon) {\n        z = zcubed;\n    }\n    else {\n        z = (116 * fz - 16) / ColorLAB.kappa;\n    }\n    x = ColorXYZ.whitePoint.x * x;\n    y = ColorXYZ.whitePoint.y * y;\n    z = ColorXYZ.whitePoint.z * z;\n    return new ColorXYZ(x, y, z);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorXYZ} to a {@link @microsoft/fast-colors#ColorLAB}\n * @param xyz - the xyz color to convert\n *\n * @public\n */\nexport function xyzToLAB(xyz) {\n    function xyzToLABHelper(i) {\n        if (i > ColorLAB.epsilon) {\n            return Math.pow(i, 1 / 3);\n        }\n        return (ColorLAB.kappa * i + 16) / 116;\n    }\n    const x = xyzToLABHelper(xyz.x / ColorXYZ.whitePoint.x);\n    const y = xyzToLABHelper(xyz.y / ColorXYZ.whitePoint.y);\n    const z = xyzToLABHelper(xyz.z / ColorXYZ.whitePoint.z);\n    const l = 116 * y - 16;\n    const a = 500 * (x - y);\n    const b = 200 * (y - z);\n    return new ColorLAB(l, a, b);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorRGBA64} to a {@link @microsoft/fast-colors#ColorXYZ}\n * @param rgb - the rgb color to convert\n *\n * @remarks\n * The alpha channel of the input is ignored\n * @public\n */\nexport function rgbToXYZ(rgb) {\n    function rgbToXYZHelper(i) {\n        if (i <= 0.04045) {\n            return i / 12.92;\n        }\n        return Math.pow((i + 0.055) / 1.055, 2.4);\n    }\n    const r = rgbToXYZHelper(rgb.r);\n    const g = rgbToXYZHelper(rgb.g);\n    const b = rgbToXYZHelper(rgb.b);\n    const x = r * 0.4124564 + g * 0.3575761 + b * 0.1804375;\n    const y = r * 0.2126729 + g * 0.7151522 + b * 0.072175;\n    const z = r * 0.0193339 + g * 0.119192 + b * 0.9503041;\n    return new ColorXYZ(x, y, z);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorXYZ} to a {@link @microsoft/fast-colors#ColorRGBA64}\n * @param xyz - the xyz color to convert\n * @param alpha - the alpha value\n *\n * @remarks\n * Note that the xyz color space is significantly larger than sRGB. As such, this can return colors rgb values greater than 1 or less than 0\n * @public\n */\nexport function xyzToRGB(xyz, alpha = 1) {\n    function xyzToRGBHelper(i) {\n        if (i <= 0.0031308) {\n            return i * 12.92;\n        }\n        return 1.055 * Math.pow(i, 1 / 2.4) - 0.055;\n    }\n    const r = xyzToRGBHelper(xyz.x * 3.2404542 - xyz.y * 1.5371385 - xyz.z * 0.4985314);\n    const g = xyzToRGBHelper(xyz.x * -0.969266 + xyz.y * 1.8760108 + xyz.z * 0.041556);\n    const b = xyzToRGBHelper(xyz.x * 0.0556434 - xyz.y * 0.2040259 + xyz.z * 1.0572252);\n    return new ColorRGBA64(r, g, b, alpha);\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorRGBA64} to a {@link @microsoft/fast-colors#ColorLAB}\n * @param rgb - the rgb color to convert\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function rgbToLAB(rgb) {\n    return xyzToLAB(rgbToXYZ(rgb));\n}\n/**\n * Converts a {@link @microsoft/fast-colors#ColorLAB} to a {@link @microsoft/fast-colors#ColorRGBA64}\n * @param lab - the LAB color to convert\n * @param alpha - the alpha value\n *\n * @remarks\n * Note that the xyz color space (which the conversion from LAB uses) is significantly larger than sRGB. As such, this can return colors rgb values greater than 1 or less than 0\n *\n * @public\n */\nexport function labToRGB(lab, alpha = 1) {\n    return xyzToRGB(labToXYZ(lab), alpha);\n}\n/**\n * Convert a {@link @microsoft/fast-colors#ColorRGBA64} to a {@link @microsoft/fast-colors#ColorLCH}\n *\n * @param rgb - the rgb color to convert\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function rgbToLCH(rgb) {\n    return labToLCH(rgbToLAB(rgb));\n}\n/**\n * Convert a {@link @microsoft/fast-colors#ColorLCH} to a {@link @microsoft/fast-colors#ColorRGBA64}\n * @param lch - the LCH color to convert\n * @param alpha - the alpha value\n *\n * @public\n */\nexport function lchToRGB(lch, alpha = 1) {\n    return labToRGB(lchToLAB(lch), alpha);\n}\n/**\n * Converts a color temperature to a {@link @microsoft/fast-colors#ColorRGBA64}\n * @param tempKelvin - the temperature to convert\n * @param alpha - the alpha value\n *\n * @public\n */\nexport function temperatureToRGB(tempKelvin, alpha = 1) {\n    // The constants I could find assumed a decimal range of [0,255] for each channel. Just going to put a /255.0 at the end\n    let r = 0;\n    let g = 0;\n    let b = 0;\n    if (tempKelvin <= 1000) {\n        tempKelvin = 1000;\n    }\n    else if (tempKelvin >= 40000) {\n        tempKelvin = 40000;\n    }\n    if (tempKelvin < 6600.0) {\n        r = 255.0;\n        g = tempKelvin / 100.0 - 2.0;\n        g =\n            -155.25485562709179 -\n                0.44596950469579133 * g +\n                104.49216199393888 * Math.log(g);\n    }\n    else {\n        r = tempKelvin / 100.0 - 55.0;\n        r = 351.97690566805693 + 0.114206453784165 * r - 40.25366309332127 * Math.log(r);\n        g = tempKelvin / 100.0 - 50.0;\n        g = 325.4494125711974 + 0.07943456536662342 * g - 28.0852963507957 * Math.log(g);\n    }\n    if (tempKelvin >= 6600.0) {\n        b = 255.0;\n    }\n    else if (tempKelvin < 2000.0) {\n        b = 0.0;\n    }\n    else {\n        b = tempKelvin / 100.0 - 10;\n        b =\n            -254.76935184120902 +\n                0.8274096064007395 * b +\n                115.67994401066147 * Math.log(b);\n    }\n    return new ColorRGBA64(r / 255, g / 255, b / 255, alpha);\n}\n/**\n * Convert a rgb color to a color temperature\n * @param rgb - the color to convert\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function rgbToTemperature(rgb) {\n    let t = 0;\n    let min = 1000;\n    let max = 40000;\n    while (max - min > 0.4) {\n        t = (max + min) / 2.0;\n        const testColor = temperatureToRGB(t);\n        if (testColor.b / testColor.r >= rgb.b / rgb.r) {\n            max = t;\n        }\n        else {\n            min = t;\n        }\n    }\n    return Math.round(t);\n}\n","import { roundToPrecisionSmall } from \"./math-utilities.js\";\n/**\n * This uses Hue values in \"degree\" format. So expect a range of [0,360]. Some other implementations instead uses radians or a normalized Hue with range [0,1]. Be aware of this when checking values or using other libraries.\n *\n * @public\n */\nexport class ColorHSV {\n    constructor(hue, sat, val) {\n        this.h = hue;\n        this.s = sat;\n        this.v = val;\n    }\n    /**\n     * Construct a {@link ColorHSV} from a config object.\n     */\n    static fromObject(data) {\n        if (data && !isNaN(data.h) && !isNaN(data.s) && !isNaN(data.v)) {\n            return new ColorHSV(data.h, data.s, data.v);\n        }\n        return null;\n    }\n    /**\n     * Determines if a color is equal to another\n     * @param rhs - the value to compare\n     */\n    equalValue(rhs) {\n        return this.h === rhs.h && this.s === rhs.s && this.v === rhs.v;\n    }\n    /**\n     * Returns a new {@link ColorHSV} rounded to the provided precision\n     * @param precision - the precision to round to\n     */\n    roundToPrecision(precision) {\n        return new ColorHSV(roundToPrecisionSmall(this.h, precision), roundToPrecisionSmall(this.s, precision), roundToPrecisionSmall(this.v, precision));\n    }\n    /**\n     * Returns the {@link ColorHSV} formatted as an object.\n     */\n    toObject() {\n        return { h: this.h, s: this.s, v: this.v };\n    }\n}\n","import { roundToPrecisionSmall } from \"./math-utilities.js\";\n/**\n * {@link https://en.wikipedia.org/wiki/CIELAB_color_space | CIELAB color space}\n * This implementation uses the D65 constants for 2 degrees. That determines the constants used for the pure white point of the XYZ space of 0.95047, 1.0, 1.08883.\n * {@link https://en.wikipedia.org/wiki/Illuminant_D65}\n * These constants determine how the XYZ, LCH and LAB colors convert to/from RGB.\n *\n * @public\n */\nexport class ColorLAB {\n    constructor(l, a, b) {\n        this.l = l;\n        this.a = a;\n        this.b = b;\n    }\n    /**\n     * Construct a {@link ColorLAB} from a config object.\n     */\n    static fromObject(data) {\n        if (data && !isNaN(data.l) && !isNaN(data.a) && !isNaN(data.b)) {\n            return new ColorLAB(data.l, data.a, data.b);\n        }\n        return null;\n    }\n    /**\n     * Determines if a color is equal to another\n     * @param rhs - the value to compare\n     */\n    equalValue(rhs) {\n        return this.l === rhs.l && this.a === rhs.a && this.b === rhs.b;\n    }\n    /**\n     * Returns a new {@link ColorLAB} rounded to the provided precision\n     * @param precision - the precision to round to\n     */\n    roundToPrecision(precision) {\n        return new ColorLAB(roundToPrecisionSmall(this.l, precision), roundToPrecisionSmall(this.a, precision), roundToPrecisionSmall(this.b, precision));\n    }\n    /**\n     * Returns the {@link ColorLAB} formatted as an object.\n     */\n    toObject() {\n        return { l: this.l, a: this.a, b: this.b };\n    }\n}\nColorLAB.epsilon = 216 / 24389;\nColorLAB.kappa = 24389 / 27;\n","import { hslToRGB, hsvToRGB, labToRGB, lchToRGB, rgbToHSL, rgbToHSV, rgbToLAB, rgbToLCH, rgbToXYZ, xyzToRGB, } from \"./color-converters.js\";\nimport { ColorHSL } from \"./color-hsl.js\";\nimport { ColorHSV } from \"./color-hsv.js\";\nimport { ColorLAB } from \"./color-lab.js\";\nimport { ColorLCH } from \"./color-lch.js\";\nimport { ColorRGBA64 } from \"./color-rgba-64.js\";\nimport { ColorXYZ } from \"./color-xyz.js\";\nimport { lerp, lerpAnglesInDegrees } from \"./math-utilities.js\";\n/**\n * Interpolate by RGB color space\n *\n * @public\n */\nexport function interpolateRGB(position, left, right) {\n    if (isNaN(position) || position <= 0) {\n        return left;\n    }\n    else if (position >= 1) {\n        return right;\n    }\n    return new ColorRGBA64(lerp(position, left.r, right.r), lerp(position, left.g, right.g), lerp(position, left.b, right.b), lerp(position, left.a, right.a));\n}\n/**\n * Interpolate by HSL color space\n *\n * @public\n */\nexport function interpolateHSL(position, left, right) {\n    if (isNaN(position) || position <= 0) {\n        return left;\n    }\n    else if (position >= 1) {\n        return right;\n    }\n    return new ColorHSL(lerpAnglesInDegrees(position, left.h, right.h), lerp(position, left.s, right.s), lerp(position, left.l, right.l));\n}\n/**\n * Interpolate by HSV color space\n *\n * @public\n */\nexport function interpolateHSV(position, left, right) {\n    if (isNaN(position) || position <= 0) {\n        return left;\n    }\n    else if (position >= 1) {\n        return right;\n    }\n    return new ColorHSV(lerpAnglesInDegrees(position, left.h, right.h), lerp(position, left.s, right.s), lerp(position, left.v, right.v));\n}\n/**\n * Interpolate by XYZ color space\n *\n * @public\n */\nexport function interpolateXYZ(position, left, right) {\n    if (isNaN(position) || position <= 0) {\n        return left;\n    }\n    else if (position >= 1) {\n        return right;\n    }\n    return new ColorXYZ(lerp(position, left.x, right.x), lerp(position, left.y, right.y), lerp(position, left.z, right.z));\n}\n/**\n * Interpolate by LAB color space\n *\n * @public\n */\nexport function interpolateLAB(position, left, right) {\n    if (isNaN(position) || position <= 0) {\n        return left;\n    }\n    else if (position >= 1) {\n        return right;\n    }\n    return new ColorLAB(lerp(position, left.l, right.l), lerp(position, left.a, right.a), lerp(position, left.b, right.b));\n}\n/**\n * Interpolate by LCH color space\n *\n * @public\n */\nexport function interpolateLCH(position, left, right) {\n    if (isNaN(position) || position <= 0) {\n        return left;\n    }\n    else if (position >= 1) {\n        return right;\n    }\n    return new ColorLCH(lerp(position, left.l, right.l), lerp(position, left.c, right.c), lerpAnglesInDegrees(position, left.h, right.h));\n}\n/**\n * Color interpolation spaces\n *\n * @public\n */\nexport var ColorInterpolationSpace;\n(function (ColorInterpolationSpace) {\n    ColorInterpolationSpace[ColorInterpolationSpace[\"RGB\"] = 0] = \"RGB\";\n    ColorInterpolationSpace[ColorInterpolationSpace[\"HSL\"] = 1] = \"HSL\";\n    ColorInterpolationSpace[ColorInterpolationSpace[\"HSV\"] = 2] = \"HSV\";\n    ColorInterpolationSpace[ColorInterpolationSpace[\"XYZ\"] = 3] = \"XYZ\";\n    ColorInterpolationSpace[ColorInterpolationSpace[\"LAB\"] = 4] = \"LAB\";\n    ColorInterpolationSpace[ColorInterpolationSpace[\"LCH\"] = 5] = \"LCH\";\n})(ColorInterpolationSpace || (ColorInterpolationSpace = {}));\n/**\n * Interpolate by color space\n *\n * @public\n */\nexport function interpolateByColorSpace(position, space, left, right) {\n    if (isNaN(position) || position <= 0) {\n        return left;\n    }\n    else if (position >= 1) {\n        return right;\n    }\n    switch (space) {\n        case ColorInterpolationSpace.HSL:\n            return hslToRGB(interpolateHSL(position, rgbToHSL(left), rgbToHSL(right)));\n        case ColorInterpolationSpace.HSV:\n            return hsvToRGB(interpolateHSV(position, rgbToHSV(left), rgbToHSV(right)));\n        case ColorInterpolationSpace.XYZ:\n            return xyzToRGB(interpolateXYZ(position, rgbToXYZ(left), rgbToXYZ(right)));\n        case ColorInterpolationSpace.LAB:\n            return labToRGB(interpolateLAB(position, rgbToLAB(left), rgbToLAB(right)));\n        case ColorInterpolationSpace.LCH:\n            return lchToRGB(interpolateLCH(position, rgbToLCH(left), rgbToLCH(right)));\n        default:\n            return interpolateRGB(position, left, right);\n    }\n}\n","/**\n * Ensures that an input number does not exceed a max value and is not less than a min value.\n * @param i - the number to clamp\n * @param min - the maximum (inclusive) value\n * @param max - the minimum (inclusive) value\n * @public\n */\nexport function clamp(i, min, max) {\n    if (isNaN(i) || i <= min) {\n        return min;\n    }\n    else if (i >= max) {\n        return max;\n    }\n    return i;\n}\n/**\n * Scales an input to a number between 0 and 1\n * @param i - a number between min and max\n * @param min - the max value\n * @param max - the min value\n * @public\n */\nexport function normalize(i, min, max) {\n    if (isNaN(i) || i <= min) {\n        return 0.0;\n    }\n    else if (i >= max) {\n        return 1.0;\n    }\n    return i / (max - min);\n}\n/**\n * Scales a number between 0 and 1\n * @param i - the number to denormalize\n * @param min - the min value\n * @param max - the max value\n * @public\n */\nexport function denormalize(i, min, max) {\n    if (isNaN(i)) {\n        return min;\n    }\n    return min + i * (max - min);\n}\n/**\n * Converts degrees to radians.\n * @param i - degrees\n * @public\n */\nexport function degreesToRadians(i) {\n    return i * (Math.PI / 180.0);\n}\n/**\n * Converts radians to degrees.\n * @param i - radians\n * @public\n */\nexport function radiansToDegrees(i) {\n    return i * (180.0 / Math.PI);\n}\n/**\n * Converts a number between 0 and 255 to a hex string.\n * @param i - the number to convert to a hex string\n * @public\n */\nexport function getHexStringForByte(i) {\n    const s = Math.round(clamp(i, 0.0, 255.0)).toString(16);\n    if (s.length === 1) {\n        return \"0\" + s;\n    }\n    return s;\n}\n/**\n * Linearly interpolate\n * @public\n */\nexport function lerp(i, min, max) {\n    if (isNaN(i) || i <= 0.0) {\n        return min;\n    }\n    else if (i >= 1.0) {\n        return max;\n    }\n    return min + i * (max - min);\n}\n/**\n * Linearly interpolate angles in degrees\n * @public\n */\nexport function lerpAnglesInDegrees(i, min, max) {\n    if (i <= 0.0) {\n        return min % 360.0;\n    }\n    else if (i >= 1.0) {\n        return max % 360.0;\n    }\n    const a = (min - max + 360.0) % 360.0;\n    const b = (max - min + 360.0) % 360.0;\n    if (a <= b) {\n        return (min - a * i + 360.0) % 360.0;\n    }\n    return (min + a * i + 360.0) % 360.0;\n}\nconst TwoPI = Math.PI * 2;\n/**\n * Linearly interpolate angles in radians\n * @public\n */\nexport function lerpAnglesInRadians(i, min, max) {\n    if (isNaN(i) || i <= 0.0) {\n        return min % TwoPI;\n    }\n    else if (i >= 1.0) {\n        return max % TwoPI;\n    }\n    const a = (min - max + TwoPI) % TwoPI;\n    const b = (max - min + TwoPI) % TwoPI;\n    if (a <= b) {\n        return (min - a * i + TwoPI) % TwoPI;\n    }\n    return (min + a * i + TwoPI) % TwoPI;\n}\n/**\n *\n * Will return infinity if i*10^(precision) overflows number\n * note that floating point rounding rules come into play here\n * so values that end up rounding on a .5 round to the nearest\n * even not always up so 2.5 rounds to 2\n * @param i - the number to round\n * @param precision - the precision to round to\n *\n * @public\n */\nexport function roundToPrecisionSmall(i, precision) {\n    const factor = Math.pow(10, precision);\n    return Math.round(i * factor) / factor;\n}\n","import { roundToPrecisionSmall } from \"./math-utilities.js\";\n/**\n * {@link https://en.wikipedia.org/wiki/CIE_1931_color_space | XYZ color space}\n *\n * This implementation uses the D65 constants for 2 degrees. That determines the constants used for the pure white point of the XYZ space of 0.95047, 1.0, 1.08883.\n * {@link https://en.wikipedia.org/wiki/Illuminant_D65}\n * These constants determine how the XYZ, LCH and LAB colors convert to/from RGB.\n *\n * @public\n */\nexport class ColorXYZ {\n    constructor(x, y, z) {\n        this.x = x;\n        this.y = y;\n        this.z = z;\n    }\n    /**\n     * Construct a {@link ColorXYZ} from a config object.\n     */\n    static fromObject(data) {\n        if (data && !isNaN(data.x) && !isNaN(data.y) && !isNaN(data.z)) {\n            return new ColorXYZ(data.x, data.y, data.z);\n        }\n        return null;\n    }\n    /**\n     * Determines if a color is equal to another\n     * @param rhs - the value to compare\n     */\n    equalValue(rhs) {\n        return this.x === rhs.x && this.y === rhs.y && this.z === rhs.z;\n    }\n    /**\n     * Returns a new {@link ColorXYZ} rounded to the provided precision\n     * @param precision - the precision to round to\n     */\n    roundToPrecision(precision) {\n        return new ColorXYZ(roundToPrecisionSmall(this.x, precision), roundToPrecisionSmall(this.y, precision), roundToPrecisionSmall(this.z, precision));\n    }\n    /**\n     * Returns the {@link ColorXYZ} formatted as an object.\n     */\n    toObject() {\n        return { x: this.x, y: this.y, z: this.z };\n    }\n}\n/**\n * D65 2 degree white point\n */\nColorXYZ.whitePoint = new ColorXYZ(0.95047, 1.0, 1.08883);\n","import { roundToPrecisionSmall } from \"./math-utilities.js\";\n/**\n * This uses Hue values in \"degree\" format. So expect a range of [0,360]. Some other implementations instead uses radians or a normalized Hue with range [0,1]. Be aware of this when checking values or using other libraries.\n *\n * @public\n */\nexport class ColorHSL {\n    constructor(hue, sat, lum) {\n        this.h = hue;\n        this.s = sat;\n        this.l = lum;\n    }\n    /**\n     * Construct a {@link ColorHSL} from a config object.\n     */\n    static fromObject(data) {\n        if (data && !isNaN(data.h) && !isNaN(data.s) && !isNaN(data.l)) {\n            return new ColorHSL(data.h, data.s, data.l);\n        }\n        return null;\n    }\n    /**\n     * Determines if a color is equal to another\n     * @param rhs - the value to compare\n     */\n    equalValue(rhs) {\n        return this.h === rhs.h && this.s === rhs.s && this.l === rhs.l;\n    }\n    /**\n     * Returns a new {@link ColorHSL} rounded to the provided precision\n     * @param precision - the precision to round to\n     */\n    roundToPrecision(precision) {\n        return new ColorHSL(roundToPrecisionSmall(this.h, precision), roundToPrecisionSmall(this.s, precision), roundToPrecisionSmall(this.l, precision));\n    }\n    /**\n     * Returns the {@link ColorHSL} formatted as an object.\n     */\n    toObject() {\n        return { h: this.h, s: this.s, l: this.l };\n    }\n}\n","import { contrastRatio } from \"./color-converters.js\";\nimport { ColorInterpolationSpace, interpolateByColorSpace, } from \"./color-interpolation.js\";\n/**\n * A color scale created from linear stops\n * @public\n */\nexport class ColorScale {\n    constructor(stops) {\n        if (stops == null || stops.length === 0) {\n            throw new Error(\"The stops argument must be non-empty\");\n        }\n        else {\n            this.stops = this.sortColorScaleStops(stops);\n        }\n    }\n    static createBalancedColorScale(colors) {\n        if (colors == null || colors.length === 0) {\n            throw new Error(\"The colors argument must be non-empty\");\n        }\n        const stops = new Array(colors.length);\n        for (let i = 0; i < colors.length; i++) {\n            // Special case first and last in order to avoid floating point jaggies\n            if (i === 0) {\n                stops[i] = { color: colors[i], position: 0 };\n            }\n            else if (i === colors.length - 1) {\n                stops[i] = { color: colors[i], position: 1 };\n            }\n            else {\n                stops[i] = {\n                    color: colors[i],\n                    position: i * (1 / (colors.length - 1)),\n                };\n            }\n        }\n        return new ColorScale(stops);\n    }\n    getColor(position, interpolationMode = ColorInterpolationSpace.RGB) {\n        if (this.stops.length === 1) {\n            return this.stops[0].color;\n        }\n        else if (position <= 0) {\n            return this.stops[0].color;\n        }\n        else if (position >= 1) {\n            return this.stops[this.stops.length - 1].color;\n        }\n        let lowerIndex = 0;\n        for (let i = 0; i < this.stops.length; i++) {\n            if (this.stops[i].position <= position) {\n                lowerIndex = i;\n            }\n        }\n        let upperIndex = lowerIndex + 1;\n        if (upperIndex >= this.stops.length) {\n            upperIndex = this.stops.length - 1;\n        }\n        const scalePosition = (position - this.stops[lowerIndex].position) *\n            (1.0 / (this.stops[upperIndex].position - this.stops[lowerIndex].position));\n        return interpolateByColorSpace(scalePosition, interpolationMode, this.stops[lowerIndex].color, this.stops[upperIndex].color);\n    }\n    trim(lowerBound, upperBound, interpolationMode = ColorInterpolationSpace.RGB) {\n        if (lowerBound < 0 || upperBound > 1 || upperBound < lowerBound) {\n            throw new Error(\"Invalid bounds\");\n        }\n        if (lowerBound === upperBound) {\n            return new ColorScale([\n                { color: this.getColor(lowerBound, interpolationMode), position: 0 },\n            ]);\n        }\n        const containedStops = [];\n        for (let i = 0; i < this.stops.length; i++) {\n            if (this.stops[i].position >= lowerBound &&\n                this.stops[i].position <= upperBound) {\n                containedStops.push(this.stops[i]);\n            }\n        }\n        if (containedStops.length === 0) {\n            return new ColorScale([\n                { color: this.getColor(lowerBound), position: lowerBound },\n                { color: this.getColor(upperBound), position: upperBound },\n            ]);\n        }\n        if (containedStops[0].position !== lowerBound) {\n            containedStops.unshift({\n                color: this.getColor(lowerBound),\n                position: lowerBound,\n            });\n        }\n        if (containedStops[containedStops.length - 1].position !== upperBound) {\n            containedStops.push({\n                color: this.getColor(upperBound),\n                position: upperBound,\n            });\n        }\n        const range = upperBound - lowerBound;\n        const finalStops = new Array(containedStops.length);\n        for (let i = 0; i < containedStops.length; i++) {\n            finalStops[i] = {\n                color: containedStops[i].color,\n                position: (containedStops[i].position - lowerBound) / range,\n            };\n        }\n        return new ColorScale(finalStops);\n    }\n    findNextColor(position, contrast, searchDown = false, interpolationMode = ColorInterpolationSpace.RGB, contrastErrorMargin = 0.005, maxSearchIterations = 32) {\n        if (isNaN(position) || position <= 0) {\n            position = 0;\n        }\n        else if (position >= 1) {\n            position = 1;\n        }\n        const startingColor = this.getColor(position, interpolationMode);\n        const finalPosition = searchDown ? 0 : 1;\n        const finalColor = this.getColor(finalPosition, interpolationMode);\n        const finalContrast = contrastRatio(startingColor, finalColor);\n        if (finalContrast <= contrast) {\n            return finalPosition;\n        }\n        let testRangeMin = searchDown ? 0 : position;\n        let testRangeMax = searchDown ? position : 0;\n        let mid = finalPosition;\n        let iterations = 0;\n        while (iterations <= maxSearchIterations) {\n            mid = Math.abs(testRangeMax - testRangeMin) / 2 + testRangeMin;\n            const midColor = this.getColor(mid, interpolationMode);\n            const midContrast = contrastRatio(startingColor, midColor);\n            if (Math.abs(midContrast - contrast) <= contrastErrorMargin) {\n                return mid;\n            }\n            else if (midContrast > contrast) {\n                if (searchDown) {\n                    testRangeMin = mid;\n                }\n                else {\n                    testRangeMax = mid;\n                }\n            }\n            else {\n                if (searchDown) {\n                    testRangeMax = mid;\n                }\n                else {\n                    testRangeMin = mid;\n                }\n            }\n            iterations++;\n        }\n        return mid;\n    }\n    clone() {\n        const newStops = new Array(this.stops.length);\n        for (let i = 0; i < newStops.length; i++) {\n            newStops[i] = {\n                color: this.stops[i].color,\n                position: this.stops[i].position,\n            };\n        }\n        return new ColorScale(newStops);\n    }\n    sortColorScaleStops(stops) {\n        return stops.sort((a, b) => {\n            const A = a.position;\n            const B = b.position;\n            if (A < B) {\n                return -1;\n            }\n            else if (A > B) {\n                return 1;\n            }\n            else {\n                return 0;\n            }\n        });\n    }\n}\n","import { blendMultiply, blendOverlay, saturateViaLCH } from \"./color-blending.js\";\nimport { rgbToHSL } from \"./color-converters.js\";\nimport { ColorInterpolationSpace, interpolateByColorSpace, } from \"./color-interpolation.js\";\nimport { ColorRGBA64 } from \"./color-rgba-64.js\";\nimport { ColorScale } from \"./color-scale.js\";\nimport { parseColorHexRGB } from \"./parse-color.js\";\n/**\n * Generates a color palette\n * @public\n */\nexport class ColorPalette {\n    constructor(config) {\n        this.config = Object.assign({}, ColorPalette.defaultPaletteConfig, config);\n        this.palette = [];\n        this.updatePaletteColors();\n    }\n    updatePaletteGenerationValues(newConfig) {\n        let changed = false;\n        for (const key in newConfig) {\n            if (this.config[key]) {\n                if (this.config[key].equalValue) {\n                    if (!this.config[key].equalValue(newConfig[key])) {\n                        this.config[key] = newConfig[key];\n                        changed = true;\n                    }\n                }\n                else {\n                    if (newConfig[key] !== this.config[key]) {\n                        this.config[key] = newConfig[key];\n                        changed = true;\n                    }\n                }\n            }\n        }\n        if (changed) {\n            this.updatePaletteColors();\n        }\n        return changed;\n    }\n    updatePaletteColors() {\n        const scale = this.generatePaletteColorScale();\n        for (let i = 0; i < this.config.steps; i++) {\n            this.palette[i] = scale.getColor(i / (this.config.steps - 1), this.config.interpolationMode);\n        }\n    }\n    generatePaletteColorScale() {\n        // Even when config.baseScalePosition is specified, using 0.5 for the baseColor\n        // in the baseScale gives better results. Otherwise very off-center palettes\n        // tend to go completely grey at the end furthest from the specified base color.\n        const baseColorHSL = rgbToHSL(this.config.baseColor);\n        const baseScale = new ColorScale([\n            { position: 0, color: this.config.scaleColorLight },\n            { position: 0.5, color: this.config.baseColor },\n            { position: 1, color: this.config.scaleColorDark },\n        ]);\n        const trimmedScale = baseScale.trim(this.config.clipLight, 1 - this.config.clipDark);\n        const trimmedLight = trimmedScale.getColor(0);\n        const trimmedDark = trimmedScale.getColor(1);\n        let adjustedLight = trimmedLight;\n        let adjustedDark = trimmedDark;\n        if (baseColorHSL.s >= this.config.saturationAdjustmentCutoff) {\n            adjustedLight = saturateViaLCH(adjustedLight, this.config.saturationLight);\n            adjustedDark = saturateViaLCH(adjustedDark, this.config.saturationDark);\n        }\n        if (this.config.multiplyLight !== 0) {\n            const multiply = blendMultiply(this.config.baseColor, adjustedLight);\n            adjustedLight = interpolateByColorSpace(this.config.multiplyLight, this.config.interpolationMode, adjustedLight, multiply);\n        }\n        if (this.config.multiplyDark !== 0) {\n            const multiply = blendMultiply(this.config.baseColor, adjustedDark);\n            adjustedDark = interpolateByColorSpace(this.config.multiplyDark, this.config.interpolationMode, adjustedDark, multiply);\n        }\n        if (this.config.overlayLight !== 0) {\n            const overlay = blendOverlay(this.config.baseColor, adjustedLight);\n            adjustedLight = interpolateByColorSpace(this.config.overlayLight, this.config.interpolationMode, adjustedLight, overlay);\n        }\n        if (this.config.overlayDark !== 0) {\n            const overlay = blendOverlay(this.config.baseColor, adjustedDark);\n            adjustedDark = interpolateByColorSpace(this.config.overlayDark, this.config.interpolationMode, adjustedDark, overlay);\n        }\n        if (this.config.baseScalePosition) {\n            if (this.config.baseScalePosition <= 0) {\n                return new ColorScale([\n                    { position: 0, color: this.config.baseColor },\n                    { position: 1, color: adjustedDark.clamp() },\n                ]);\n            }\n            else if (this.config.baseScalePosition >= 1) {\n                return new ColorScale([\n                    { position: 0, color: adjustedLight.clamp() },\n                    { position: 1, color: this.config.baseColor },\n                ]);\n            }\n            return new ColorScale([\n                { position: 0, color: adjustedLight.clamp() },\n                {\n                    position: this.config.baseScalePosition,\n                    color: this.config.baseColor,\n                },\n                { position: 1, color: adjustedDark.clamp() },\n            ]);\n        }\n        return new ColorScale([\n            { position: 0, color: adjustedLight.clamp() },\n            { position: 0.5, color: this.config.baseColor },\n            { position: 1, color: adjustedDark.clamp() },\n        ]);\n    }\n}\nColorPalette.defaultPaletteConfig = {\n    baseColor: parseColorHexRGB(\"#808080\"),\n    steps: 11,\n    interpolationMode: ColorInterpolationSpace.RGB,\n    scaleColorLight: new ColorRGBA64(1, 1, 1, 1),\n    scaleColorDark: new ColorRGBA64(0, 0, 0, 1),\n    clipLight: 0.185,\n    clipDark: 0.16,\n    saturationAdjustmentCutoff: 0.05,\n    saturationLight: 0.35,\n    saturationDark: 1.25,\n    overlayLight: 0,\n    overlayDark: 0.25,\n    multiplyLight: 0,\n    multiplyDark: 0,\n    baseScalePosition: 0.5,\n};\nColorPalette.greyscalePaletteConfig = {\n    baseColor: parseColorHexRGB(\"#808080\"),\n    steps: 11,\n    interpolationMode: ColorInterpolationSpace.RGB,\n    scaleColorLight: new ColorRGBA64(1, 1, 1, 1),\n    scaleColorDark: new ColorRGBA64(0, 0, 0, 1),\n    clipLight: 0,\n    clipDark: 0,\n    saturationAdjustmentCutoff: 0,\n    saturationLight: 0,\n    saturationDark: 0,\n    overlayLight: 0,\n    overlayDark: 0,\n    multiplyLight: 0,\n    multiplyDark: 0,\n    baseScalePosition: 0.5,\n};\n/**\n * Takes the input color and compares it to each color in the reference array to find the index with the closest Lightness value in HSL color space\n * @public\n */\nexport function matchLightnessIndex(input, reference) {\n    const hsl = rgbToHSL(input);\n    let bestFitValue = Number.MAX_VALUE;\n    let bestFitIndex = 0;\n    for (let i = 0; i < reference.length; i++) {\n        const ihsl = rgbToHSL(reference[i]);\n        const fitValue = Math.abs(ihsl.l - hsl.l);\n        if (fitValue < bestFitValue) {\n            bestFitValue = fitValue;\n            bestFitIndex = i;\n        }\n    }\n    return bestFitIndex;\n}\n/**\n * Generates a greyscale palette using greyscaleConfig. The Lightness (in HSL) of the input color is then compared to the greyscale palette to determine how far off center the input color should be placed. The output palette is then generated with outputSteps number of steps using colorConfig.\n * @public\n */\nexport function generateOffCenterPalette(input, outputSteps, greyscaleConfig = ColorPalette.greyscalePaletteConfig, colorConfig = ColorPalette.defaultPaletteConfig) {\n    const greyscale = new ColorPalette(Object.assign(Object.assign({}, greyscaleConfig), { steps: outputSteps }));\n    const scaleIndex = matchLightnessIndex(input, greyscale.palette);\n    return new ColorPalette(Object.assign(Object.assign({}, colorConfig), { steps: outputSteps, baseColor: input, baseScalePosition: scaleIndex / (outputSteps - 1) }));\n}\n/**\n * Take the input array of colors and extrapolates them to a larger palette of size targetSize. If preserveInputColors is false the input colors are evenly distributed into the output. Otherwise, the positions of the input colors are adjusted from a perfectly even distribution in order to ensure that the exact color values appearing in the input array also appear in the output array. The larger targetSize is compared to input.length the smaller those adjustments will be.\n *\n * @public\n */\nexport function rescale(input, targetSize, preserveInputColors) {\n    if (input.length <= 1 || targetSize <= 1) {\n        throw new Error(\"The input array and targetSize must both be greater than 1\");\n    }\n    if (preserveInputColors && targetSize <= input.length) {\n        throw new Error(\"If preserveInputColors is true then targetSize must be greater than the length of the input array\");\n    }\n    const stops = new Array(input.length);\n    if (preserveInputColors) {\n        for (let i = 0; i < input.length; i++) {\n            const p = i / (input.length - 1);\n            let bestFitValue = 2;\n            let bestFitIndex = 0;\n            for (let j = 0; j < targetSize; j++) {\n                const fitValue = Math.abs(j / (targetSize - 1) - p);\n                if (fitValue < bestFitValue) {\n                    bestFitValue = fitValue;\n                    bestFitIndex = j;\n                }\n                if (fitValue === 0) {\n                    break;\n                }\n            }\n            stops[i] = {\n                color: input[i],\n                position: bestFitIndex / (targetSize - 1),\n            };\n        }\n    }\n    else {\n        for (let i = 0; i < stops.length; i++) {\n            stops[i] = { color: input[i], position: i / (input.length - 1) };\n        }\n    }\n    const scale = new ColorScale(stops);\n    const retVal = new Array(targetSize);\n    for (let i = 0; i < targetSize; i++) {\n        retVal[i] = scale.getColor(i / (targetSize - 1));\n    }\n    return retVal;\n}\n/**\n * @public\n */\nexport const defaultCenteredRescaleConfig = {\n    targetSize: 63,\n    spacing: 4,\n    scaleColorLight: ColorPalette.defaultPaletteConfig.scaleColorLight,\n    scaleColorDark: ColorPalette.defaultPaletteConfig.scaleColorDark,\n};\n/**\n * Takes an input array of colors and extrapolates them to a larger palette. The mapping first takes the input array and extrapolates between each color so that they are separated by spacing-1 slots. Then it adds to either end enough new colors to make up the desired targetSize. All output color slots between the defined stops are interpolated.\n * @example\n * For an input array with length 5, a targetSize of 17 and spacing of 3 the output would be:\n *  0: scaleColorLight\n *  1:\n *  2: input 0\n *  3:\n *  4:\n *  5: input 1\n *  6:\n *  7:\n *  8: input 2\n *  9:\n * 10:\n * 11: input 3\n * 12:\n * 13:\n * 14: input 4\n * 15:\n * 16: scaleColorDark\n *\n * @public\n */\nexport function centeredRescale(input, config = defaultCenteredRescaleConfig) {\n    if (input.length === 0) {\n        return [];\n    }\n    const offset = Math.floor((config.targetSize - ((input.length - 1) * config.spacing + 1)) / 2);\n    if (offset < 0) {\n        throw new Error(\"(targetSize - ((input.length - 1) * spacing + 1)) / 2 must be >= 0\");\n    }\n    const stops = new Array(input.length + 2);\n    stops[0] = { position: 0, color: config.scaleColorLight };\n    stops[stops.length - 1] = {\n        position: 1,\n        color: config.scaleColorDark,\n    };\n    for (let i = 0; i < input.length; i++) {\n        stops[i + 1] = {\n            color: input[i],\n            position: (i * config.spacing + offset) / (config.targetSize - 1),\n        };\n    }\n    const scale = new ColorScale(stops);\n    const retVal = new Array(config.targetSize);\n    for (let i = 0; i < config.targetSize; i++) {\n        retVal[i] = scale.getColor(i / (config.targetSize - 1));\n    }\n    return retVal;\n}\n/**\n * Generates two palettes of length shortPaletteLength and longPaletteLength from a base color. The base color is compared to the default greyscale palette to determine where it should be placed. The short palette is then fed into centeredRescale to create the long palette. The colors in the short palette are always contained within the long.\n * @public\n */\nexport function generateScaledPalettes(input, shortPaletteLength = 11, config = defaultCenteredRescaleConfig) {\n    const shortPalette = generateOffCenterPalette(input, shortPaletteLength);\n    const longPalette = centeredRescale(shortPalette.palette, config);\n    return { short: shortPalette.palette, long: longPalette };\n}\n","import { ColorRGBA64 } from \"./color-rgba-64.js\";\nimport { ColorPalette } from \"./color-palette.js\";\nimport { hslToRGB, rgbToHSL, rgbToLinearLuminance } from \"./color-converters.js\";\nimport { ColorScale } from \"./color-scale.js\";\nimport { ColorHSL } from \"./color-hsl.js\";\nimport { ColorInterpolationSpace } from \"./color-interpolation.js\";\nimport { parseColorHexRGB } from \"./parse-color.js\";\n/**\n * Creates a color palette for UI components\n * @public\n */\nexport class ComponentStateColorPalette {\n    constructor(config) {\n        this.palette = [];\n        this.config = Object.assign({}, ComponentStateColorPalette.defaultPaletteConfig, config);\n        this.regenPalettes();\n    }\n    regenPalettes() {\n        let steps = this.config.steps;\n        if (isNaN(steps) || steps < 3) {\n            steps = 3;\n        }\n        // This palette is tuned to go as dark as differences between the levels can be perceived according to tests\n        // on numerous monitors in different conditions. Stay linear from white until this first cutoff.\n        const darkLum = 0.14;\n        // In the dark compression, this is the last luminance value before full black.\n        const darkestLum = 0.06;\n        // The Color for the luminance value above, placed on the ramp at it's normal position, so darker colors after\n        // it can be compressed.\n        const darkLumColor = new ColorRGBA64(darkLum, darkLum, darkLum, 1);\n        // The number of steps in the ramp that has been tuned for default use. This coincides with the size of the\n        // default ramp, but the palette could be generated with fewer steps to increase final contrast. This number\n        // should however stay the same.\n        const stepsForLuminanceRamp = 94;\n        // Create the reference, dark-compressed, grey palette, like:\n        // F------------------------------------------------------------------------------------[dark]------[darkest]0\n        //                                                                                      |--compressed area--|\n        const r = new ColorPalette(Object.assign(Object.assign({}, ColorPalette.greyscalePaletteConfig), { baseColor: darkLumColor, baseScalePosition: ((1 - darkLum) * 100) / stepsForLuminanceRamp, steps }));\n        const referencePalette = r.palette;\n        // Find the requested base color on the adjusted luminance reference ramp.\n        // There is no _right_ way to desaturate a color, and both methods we've tested have value, so average them out.\n        const baseColorLum1 = rgbToLinearLuminance(this.config.baseColor);\n        const baseColorLum2 = rgbToHSL(this.config.baseColor).l;\n        const baseColorLum = (baseColorLum1 + baseColorLum2) / 2;\n        const baseColorRefIndex = this.matchRelativeLuminanceIndex(baseColorLum, referencePalette);\n        const baseColorPercent = baseColorRefIndex / (steps - 1);\n        // Find the luminance location for the dark cutoff.\n        const darkRefIndex = this.matchRelativeLuminanceIndex(darkLum, referencePalette);\n        const darkPercent = darkRefIndex / (steps - 1);\n        // Issue https://github.com/microsoft/fast/issues/1904\n        // Creating a color from H, S, and a known L value is not the inverse of getting the relative\n        // luminace as above. Need to derive a relative luminance version of the color to better match on the dark end.\n        // Find the dark cutoff and darkest variations of the requested base color.\n        const baseColorHSL = rgbToHSL(this.config.baseColor);\n        const darkBaseColor = hslToRGB(ColorHSL.fromObject({\n            h: baseColorHSL.h,\n            s: baseColorHSL.s,\n            l: darkLum,\n        }));\n        const darkestBaseColor = hslToRGB(ColorHSL.fromObject({\n            h: baseColorHSL.h,\n            s: baseColorHSL.s,\n            l: darkestLum,\n        }));\n        // Create the gradient stops, including the base color and anchor colors for the dark end compression.\n        const fullColorScaleStops = new Array(5);\n        fullColorScaleStops[0] = {\n            position: 0,\n            color: new ColorRGBA64(1, 1, 1, 1),\n        };\n        fullColorScaleStops[1] = {\n            position: baseColorPercent,\n            color: this.config.baseColor,\n        };\n        fullColorScaleStops[2] = {\n            position: darkPercent,\n            color: darkBaseColor,\n        };\n        fullColorScaleStops[3] = {\n            position: 0.99,\n            color: darkestBaseColor,\n        };\n        fullColorScaleStops[4] = {\n            position: 1,\n            color: new ColorRGBA64(0, 0, 0, 1),\n        };\n        const scale = new ColorScale(fullColorScaleStops);\n        // Create the palette.\n        this.palette = new Array(steps);\n        for (let i = 0; i < steps; i++) {\n            const c = scale.getColor(i / (steps - 1), ColorInterpolationSpace.RGB);\n            this.palette[i] = c;\n        }\n    }\n    matchRelativeLuminanceIndex(input, reference) {\n        let bestFitValue = Number.MAX_VALUE;\n        let bestFitIndex = 0;\n        let i = 0;\n        const referenceLength = reference.length;\n        for (; i < referenceLength; i++) {\n            const fitValue = Math.abs(rgbToLinearLuminance(reference[i]) - input);\n            if (fitValue < bestFitValue) {\n                bestFitValue = fitValue;\n                bestFitIndex = i;\n            }\n        }\n        return bestFitIndex;\n    }\n}\nComponentStateColorPalette.defaultPaletteConfig = {\n    baseColor: parseColorHexRGB(\"#808080\"),\n    steps: 94,\n};\n","import { hslToRGB, labToRGB, lchToRGB, rgbToHSL, rgbToLAB, rgbToLCH, } from \"./color-converters.js\";\nimport { ColorHSL } from \"./color-hsl.js\";\nimport { ColorLAB } from \"./color-lab.js\";\nimport { ColorLCH } from \"./color-lch.js\";\nimport { ColorRGBA64 } from \"./color-rgba-64.js\";\nimport { clamp } from \"./math-utilities.js\";\n/**\n * Saturate a color using LCH color space\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function saturateViaLCH(input, saturation, saturationConstant = 18) {\n    const lch = rgbToLCH(input);\n    let sat = lch.c + saturation * saturationConstant;\n    if (sat < 0) {\n        sat = 0;\n    }\n    return lchToRGB(new ColorLCH(lch.l, sat, lch.h));\n}\n/**\n * De-saturate a color using LCH color space\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function desaturateViaLCH(input, saturation, saturationConstant = 18) {\n    return saturateViaLCH(input, -1 * saturation, saturationConstant);\n}\n/**\n * Darken a color using LAB color space\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function darkenViaLAB(input, amount, darkenConstant = 18) {\n    const lab = rgbToLAB(input);\n    const darkened = lab.l - amount * darkenConstant;\n    return labToRGB(new ColorLAB(darkened, lab.a, lab.b));\n}\n/**\n * Lighten a color using LAB color space\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function lightenViaLAB(input, amount, darkenConstant = 18) {\n    return darkenViaLAB(input, -1 * amount, darkenConstant);\n}\n/**\n * @public\n */\nexport function blendBurnChannel(bottom, top) {\n    if (top === 0.0) {\n        // Despite the discontinuity, other sources seem to use 0.0 here instead of 1\n        return 0.0;\n    }\n    return 1.0 - (1.0 - bottom) / top;\n}\n/**\n * Blends two colors with the burn mode\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendBurn(bottom, top) {\n    return new ColorRGBA64(blendBurnChannel(bottom.r, top.r), blendBurnChannel(bottom.g, top.g), blendBurnChannel(bottom.b, top.b), 1);\n}\n/**\n * Blends two colors\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendColor(bottom, top) {\n    const bottomHSL = rgbToHSL(bottom);\n    const topHSL = rgbToHSL(top);\n    if (topHSL.s === 0) {\n        return new ColorRGBA64(bottomHSL.l, bottomHSL.l, bottomHSL.l, 1);\n    }\n    return hslToRGB(new ColorHSL(topHSL.h, topHSL.s, bottomHSL.l));\n}\n/**\n * @public\n */\nexport function blendDarkenChannel(bottom, top) {\n    return Math.min(bottom, top);\n}\n/**\n * Blends two colors with the darken mode\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendDarken(bottom, top) {\n    return new ColorRGBA64(blendDarkenChannel(bottom.r, top.r), blendDarkenChannel(bottom.g, top.g), blendDarkenChannel(bottom.b, top.b), 1);\n}\n/**\n * @public\n */\nexport function blendDodgeChannel(bottom, top) {\n    if (top >= 1.0) {\n        return 1.0;\n    }\n    const retVal = bottom / (1.0 - top);\n    if (retVal >= 1.0) {\n        return 1.0;\n    }\n    return retVal;\n}\n/**\n * Blends two colors with the dodge mode\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendDodge(bottom, top) {\n    return new ColorRGBA64(blendDodgeChannel(bottom.r, top.r), blendDodgeChannel(bottom.g, top.g), blendDodgeChannel(bottom.b, top.b), 1);\n}\n/**\n * @public\n */\nexport function blendLightenChannel(bottom, top) {\n    return Math.max(bottom, top);\n}\n/**\n * Blends two colors with the lighten mode\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendLighten(bottom, top) {\n    return new ColorRGBA64(blendLightenChannel(bottom.r, top.r), blendLightenChannel(bottom.g, top.g), blendLightenChannel(bottom.b, top.b), 1);\n}\n/**\n * @public\n */\nexport function blendMultiplyChannel(bottom, top) {\n    return bottom * top;\n}\n/**\n * Blends two colors with the multiply mode\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendMultiply(bottom, top) {\n    return new ColorRGBA64(blendMultiplyChannel(bottom.r, top.r), blendMultiplyChannel(bottom.g, top.g), blendMultiplyChannel(bottom.b, top.b), 1);\n}\n/**\n * @public\n */\nexport function blendOverlayChannel(bottom, top) {\n    if (bottom < 0.5) {\n        return clamp(2.0 * top * bottom, 0, 1);\n    }\n    return clamp(1.0 - 2.0 * (1.0 - top) * (1.0 - bottom), 0, 1);\n}\n/**\n * Blends two colors with the overlay mode\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendOverlay(bottom, top) {\n    return new ColorRGBA64(blendOverlayChannel(bottom.r, top.r), blendOverlayChannel(bottom.g, top.g), blendOverlayChannel(bottom.b, top.b), 1);\n}\n/**\n * @public\n */\nexport function blendScreenChannel(bottom, top) {\n    return 1.0 - (1.0 - top) * (1.0 - bottom);\n}\n/**\n * Blends two colors with the screen mode\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blendScreen(bottom, top) {\n    return new ColorRGBA64(blendScreenChannel(bottom.r, top.r), blendScreenChannel(bottom.g, top.g), blendScreenChannel(bottom.b, top.b), 1);\n}\n/**\n * Color blend modes.\n * @public\n */\nexport var ColorBlendMode;\n(function (ColorBlendMode) {\n    ColorBlendMode[ColorBlendMode[\"Burn\"] = 0] = \"Burn\";\n    ColorBlendMode[ColorBlendMode[\"Color\"] = 1] = \"Color\";\n    ColorBlendMode[ColorBlendMode[\"Darken\"] = 2] = \"Darken\";\n    ColorBlendMode[ColorBlendMode[\"Dodge\"] = 3] = \"Dodge\";\n    ColorBlendMode[ColorBlendMode[\"Lighten\"] = 4] = \"Lighten\";\n    ColorBlendMode[ColorBlendMode[\"Multiply\"] = 5] = \"Multiply\";\n    ColorBlendMode[ColorBlendMode[\"Overlay\"] = 6] = \"Overlay\";\n    ColorBlendMode[ColorBlendMode[\"Screen\"] = 7] = \"Screen\";\n})(ColorBlendMode || (ColorBlendMode = {}));\n/**\n * Blend two colors.\n *\n * @remarks\n * The alpha channel of the input is ignored\n *\n * @public\n */\nexport function blend(mode, bottom, top) {\n    switch (mode) {\n        case ColorBlendMode.Burn:\n            return blendBurn(bottom, top);\n        case ColorBlendMode.Color:\n            return blendColor(bottom, top);\n        case ColorBlendMode.Darken:\n            return blendDarken(bottom, top);\n        case ColorBlendMode.Dodge:\n            return blendDodge(bottom, top);\n        case ColorBlendMode.Lighten:\n            return blendLighten(bottom, top);\n        case ColorBlendMode.Multiply:\n            return blendMultiply(bottom, top);\n        case ColorBlendMode.Overlay:\n            return blendOverlay(bottom, top);\n        case ColorBlendMode.Screen:\n            return blendScreen(bottom, top);\n        default:\n            throw new Error(\"Unknown blend mode\");\n    }\n}\n/**\n * Alpha channel of bottom is ignored\n * The returned color always has an alpha channel of 1\n * Different programs (eg: paint.net, photoshop) will give different answers than this occasionally but within +/- 1/255 in each channel. Just depends on the details of how they round off decimals\n *\n * @public\n */\nexport function computeAlphaBlend(bottom, top) {\n    if (top.a >= 1) {\n        return top;\n    }\n    else if (top.a <= 0) {\n        return new ColorRGBA64(bottom.r, bottom.g, bottom.b, 1);\n    }\n    const r = top.a * top.r + (1 - top.a) * bottom.r;\n    const g = top.a * top.g + (1 - top.a) * bottom.g;\n    const b = top.a * top.b + (1 - top.a) * bottom.b;\n    return new ColorRGBA64(r, g, b, 1);\n}\n","import { roundToPrecisionSmall } from \"./math-utilities.js\";\n/**\n *\n * {@link https://en.wikipedia.org/wiki/CIELAB_color_space | CIELCH color space}\n *\n * This is a cylindrical representation of the CIELAB space useful for saturation operations\n * This uses Hue values in \"degree\" format. So expect a range of [0,360]. Some other implementations instead uses radians or a normalized Hue with range [0,1]. Be aware of this when checking values or using other libraries.\n * This implementation uses the D65 constants for 2 degrees. That determines the constants used for the pure white point of the XYZ space of 0.95047, 1.0, 1.08883.\n * {@link https://en.wikipedia.org/wiki/Illuminant_D65}\n * These constants determine how the XYZ, LCH and LAB colors convert to/from RGB.\n *\n * @public\n */\nexport class ColorLCH {\n    constructor(l, c, h) {\n        this.l = l;\n        this.c = c;\n        this.h = h;\n    }\n    /**\n     * Construct a {@link ColorLCH} from a config object.\n     * @param data - the config object\n     */\n    static fromObject(data) {\n        if (data && !isNaN(data.l) && !isNaN(data.c) && !isNaN(data.h)) {\n            return new ColorLCH(data.l, data.c, data.h);\n        }\n        return null;\n    }\n    /**\n     * Determines if one color is equal to another.\n     * @param rhs - the color to compare\n     */\n    equalValue(rhs) {\n        return this.l === rhs.l && this.c === rhs.c && this.h === rhs.h;\n    }\n    /**\n     * Returns a new {@link ColorLCH} rounded to the provided precision\n     * @param precision - the precision to round to\n     */\n    roundToPrecision(precision) {\n        return new ColorLCH(roundToPrecisionSmall(this.l, precision), roundToPrecisionSmall(this.c, precision), roundToPrecisionSmall(this.h, precision));\n    }\n    /**\n     * Converts the {@link ColorLCH} to a config object.\n     */\n    toObject() {\n        return { l: this.l, c: this.c, h: this.h };\n    }\n}\n"],"sourceRoot":"","x_microsoft_symbol_client_key":"9b219a5d97cf579fae5ededd30c67230c45790437f494862358d45557a5dfe42"}