{"version":3,"file":"constants.mjs","names":[],"sources":["../../../src/color/constants.ts"],"sourcesContent":["/**\n * Regex matching color in RGB or RGBA formats (ex: `rgb(0, 0, 0)`, `rgba(255, 100, 10, 0.5)`, `rgba( 255 , 100 , 10 , 0.5 )`, `rgb(1,1,1)`, `rgba(100%, 60%, 10%, 0.5)`)\n * Also matching rgba(r g b / a) as per new specs\n * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb\n *\n * In order to avoid performance issues, you have to clean the input string for this regex from multiple spaces before.\n * ex: colorString.replace(/\\s+/g, ' ');\n *\n * Formal syntax at the time of writing:\n * <rgb()> =\n *  rgb( [ <percentage> | none ]{3} [ / [ <alpha-value> | none ] ]? )  |\n *  rgb( [ <number> | none ]{3} [ / [ <alpha-value> | none ] ]? )\n * <alpha-value> = <number> | <percentage>\n *\n * For learners this is how you can read this regex\n * Regular expression for matching an rgba or rgb CSS color value\n *\n * /^          # Beginning of the string\n * rgba?       # \"rgb\" or \"rgba\"\n * \\(\\s?       # Opening parenthesis and zero or one whitespace character\n * (\\d{0,3}    # 0 to three digits R channel\n *  (?:\\.\\d+)? # Optional decimal with one or more digits\n * )           # End of capturing group for the first color component\n * %?          # Optional percent sign after the first color component\n * \\s?         # Zero or one whitespace character\n * [\\s|,]      # Separator between color components can be a space or comma\n * \\s?         # Zero or one whitespace character\n * (\\d{0,3}    # 0 to three digits G channel\n *  (?:\\.\\d+)? # Optional decimal with one or more digits\n * )           # End of capturing group for the second color component\n * %?          # Optional percent sign after the second color component\n * \\s?         # Zero or one whitespace character\n * [\\s|,]      # Separator between color components can be a space or comma\n * \\s?         # Zero or one whitespace character\n * (\\d{0,3}    # 0 to three digits B channel\n *  (?:\\.\\d+)? # Optional decimal with one or more digits\n * )           # End of capturing group for the third color component\n * %?          # Optional percent sign after the third color component\n * \\s?         # Zero or one whitespace character\n * (?:         # Beginning of non-capturing group for alpha value\n *  \\s?        # Zero or one whitespace character\n *  [,/]       # Comma or slash separator for alpha value\n *  \\s?        # Zero or one whitespace character\n *  (\\d{0,3}   # Zero to three digits\n *    (?:\\.\\d+)? # Optional decimal with one or more digits\n *  )          # End of capturing group for alpha value\n *  %?         # Optional percent sign after alpha value\n *  \\s?        # Zero or one whitespace character\n * )?          # End of non-capturing group for alpha value (optional)\n * \\)          # Closing parenthesis\n * $           # End of the string\n *\n * The alpha channel can be in the format 0.4 .7 or 1 or 73%\n *\n * WARNING this regex doesn't fail on off spec colors. it matches everything that could be a color.\n * So the spec does not allow for `rgba(30 , 45%  35, 49%)` but this will work anyways for us\n */\nexport const reRGBa = () =>\n  /^rgba?\\(\\s?(\\d{0,3}(?:\\.\\d+)?%?)\\s?[\\s|,]\\s?(\\d{0,3}(?:\\.\\d+)?%?)\\s?[\\s|,]\\s?(\\d{0,3}(?:\\.\\d+)?%?)\\s?(?:\\s?[,/]\\s?(\\d{0,3}(?:\\.\\d+)?%?)\\s?)?\\)$/i;\n\n/**\n * Regex matching color in HSL or HSLA formats (ex: hsl(0deg 0%, 0%), hsla(160, 100, 10, 0.5), hsla( 180 , 100 , 10 , 0.5 ), hsl(1,1,1))\n * Also matching hsla(h s l / a) as per new specs\n * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl\n * In order to avoid performance issues, you have to clean the input string for this regex from multiple spaces before.\n * ex: colorString.replace(/\\s+/g, ' ');\n * Formal syntax at the time of writing:\n * <hsl()> =\n *   hsl( [ <hue> | none ] [ <percentage> | none ] [ <percentage> | none ] [ / [ <alpha-value> | none ] ]? )\n *\n * <hue> =\n *   <number>  |\n *   <angle>\n *\n * <alpha-value> =\n *   <number>      |\n *   <percentage>\n *\n * For learners this is how you can read this regex\n * Regular expression for matching an hsla or hsl CSS color value\n *\n * /^hsla?\\(         // Matches the beginning of the string and the opening parenthesis of \"hsl\" or \"hsla\"\n * \\s?               // Matches any whitespace character (space, tab, etc.) zero or one time\n * (\\d{0,3}          // Hue: 0 to three digits - start capture in a group\n * (?:\\.\\d+)?        // Hue: Optional (non capture group) decimal with one or more digits.\n * (?:deg|turn|rad)? // Hue: Optionally include suffix deg or turn or rad\n * )                 // Hue: End capture group\n * \\s?               // Matches any whitespace character zero or one time\n * [\\s|,]            // Matches a space, tab or comma\n * \\s?               // Matches any whitespace character zero or one time\n * (\\d{0,3}          // Saturation: 0 to three digits - start capture in a group\n * (?:\\.\\d+)?        // Saturation: Optional decimal with one or more digits in a non-capturing group\n * %?)               // Saturation: match optional % character and end capture group\n * \\s?               // Matches any whitespace character zero or one time\n * [\\s|,]            // Matches a space, tab or comma\n * \\s?               // Matches any whitespace character zero or one time\n * (\\d{0,3}          // Lightness: 0 to three digits - start capture in a group\n * (?:\\.\\d+)?        // Lightness: Optional decimal with one or more digits in a non-capturing group\n * %?)                // Lightness: match % character and end capture group\n * \\s?               // Matches any whitespace character zero or one time\n * (?:               // Alpha: Begins a non-capturing group for the alpha value\n *   \\s?             // Matches any whitespace character zero or one time\n *   [,/]            // Matches a comma or forward slash\n *   \\s?             // Matches any whitespace character zero or one time\n *   (\\d*(?:\\.\\d+)?%?) // Matches zero or more digits, optionally followed by a decimal point and one or more digits, followed by an optional percentage sign and captures it in a group\n *   \\s?             // Matches any whitespace character zero or one time\n * )?                // Makes the alpha value group optional\n * \\)                // Matches the closing parenthesis\n * $/i               // Matches the end of the string and sets the regular expression to case-insensitive mode\n *\n * WARNING this regex doesn't fail on off spec colors. It matches everything that could be a color.\n * So the spec does not allow `hsl(30 , 45%  35, 49%)` but this will work anyways for us.\n */\nexport const reHSLa = () =>\n  /^hsla?\\(\\s?([+-]?\\d{0,3}(?:\\.\\d+)?(?:deg|turn|rad)?)\\s?[\\s|,]\\s?(\\d{0,3}(?:\\.\\d+)?%?)\\s?[\\s|,]\\s?(\\d{0,3}(?:\\.\\d+)?%?)\\s?(?:\\s?[,/]\\s?(\\d*(?:\\.\\d+)?%?)\\s?)?\\)$/i;\n\n/**\n * Regex matching color in HEX format (ex: #FF5544CC, #FF5555, 010155, aff)\n */\nexport const reHex = () => /^#?(([0-9a-f]){3,4}|([0-9a-f]{2}){3,4})$/i;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,eACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDF,MAAa,eACX;;;;AAKF,MAAa,cAAc"}