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AS,GACvF,OAAO,KAAK,eAAe,GAAO,SAAS,EAC7C,CAEA,WAAA,CAAY,EAAY,IACtB,GAAI,MAAM,IAAc,EAAY,KAAK,OAAO,OAC9C,MAAM,IAAI,WACR,gFAMJ,OAFA,KAAK,OAAS,EACd,KAAK,oBAAoB,KAAK,QACvB,IACT,EAGF,OAAO,QAAU","file":"/npm/javascript-color-gradient@2.5.0/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/javascript-color-gradient@2.5.0/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","class GradientColor {\n  constructor() {\n    this.minNum = 0;\n    this.maxNum = 10;\n    this.startHex = \"\";\n    this.endHex = \"\";\n  }\n\n  setColorGradient(colorStart, colorEnd) {\n    if (!colorStart.startsWith(\"#\") || !colorEnd.startsWith(\"#\")) {\n      throw new Error('Colors must be in hexadecimal format starting with \"#\"');\n    }\n\n    this.startHex = this.validateAndExpandHex(colorStart);\n    this.endHex = this.validateAndExpandHex(colorEnd);\n  }\n\n  validateAndExpandHex(hex) {\n    if (hex.length === 4) {\n      return \"#\" + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];\n    } else if (hex.length === 7) {\n      return hex;\n    } else {\n      throw new Error(\n        \"Invalid color format. Please use full hex color values (e.g., #3f2caf) instead of abbreviated formats\",\n      );\n    }\n  }\n\n  setMidpoint(minNumber = 0, maxNumber = 10) {\n    this.minNum = minNumber;\n    this.maxNum = maxNumber;\n  }\n\n  getColor(numberValue) {\n    if (numberValue === undefined) return;\n\n    return (\n      \"#\" +\n      this.generateHex(\n        numberValue,\n        this.startHex.substring(1, 3),\n        this.endHex.substring(1, 3),\n      ) +\n      this.generateHex(\n        numberValue,\n        this.startHex.substring(3, 5),\n        this.endHex.substring(3, 5),\n      ) +\n      this.generateHex(\n        numberValue,\n        this.startHex.substring(5, 7),\n        this.endHex.substring(5, 7),\n      )\n    );\n  }\n\n  generateHex(number, start, end) {\n    if (number < this.minNum) number = this.minNum;\n    else if (number > this.maxNum) number = this.maxNum;\n\n    const midPoint = this.maxNum - this.minNum;\n    const startBase = parseInt(start, 16);\n    const endBase = parseInt(end, 16);\n    const average = (endBase - startBase) / midPoint;\n    const finalBase = Math.round(average * (number - this.minNum) + startBase);\n    return finalBase.toString(16).padStart(2, \"0\");\n  }\n}\n\nclass Gradient {\n  constructor() {\n    this.maxNum = 10;\n    this.colors = [];\n    this.colorGradients = [];\n    this.intervals = [];\n  }\n\n  setColorGradient(...gradientColors) {\n    if (gradientColors.length < 2) {\n      throw new RangeError(`setColorGradient requires at least 2 colors`);\n    }\n\n    const increment = (this.maxNum - 1) / (gradientColors.length - 1);\n    this.colorGradients = [];\n    this.intervals = [];\n\n    for (let i = 0; i < gradientColors.length - 1; i++) {\n      const gradientColor = new GradientColor();\n      const lower = increment * i;\n      const upper = increment * (i + 1);\n      gradientColor.setColorGradient(gradientColors[i], gradientColors[i + 1]);\n      gradientColor.setMidpoint(lower, upper);\n      this.colorGradients.push(gradientColor);\n      this.intervals.push({ lower, upper });\n    }\n    this.colors = gradientColors;\n    return this;\n  }\n\n  getColors() {\n    const gradientColorsArray = [];\n    const numColors = this.maxNum + 1;\n\n    for (let j = 0; j < this.intervals.length; j++) {\n      const { lower, upper } = this.intervals[j];\n      const start = j === 0 ? 0 : Math.ceil(lower);\n      const end = j === this.intervals.length - 1 ? Math.ceil(upper) : Math.floor(upper);\n\n      for (let i = start; i < end; i++) {\n        gradientColorsArray.push(this.colorGradients[j].getColor(i));\n      }\n    }\n\n    gradientColorsArray.push(this.colors[this.colors.length - 1]);\n    return gradientColorsArray.slice(0, numColors);\n  }\n\n  getColor(numberValue) {\n    if (isNaN(numberValue)) {\n      throw new TypeError(`getColor requires a numeric value`);\n    }\n    if (numberValue <= 0) {\n      throw new RangeError(`getColor value should be greater than 0`);\n    }\n\n    const segment = (this.maxNum + 1) / this.colorGradients.length;\n    const index = Math.min(Math.floor(numberValue / segment), this.colorGradients.length - 1);\n    return this.colorGradients[index].getColor(numberValue);\n  }\n\n  setMidpoint(maxNumber = 10) {\n    if (isNaN(maxNumber) || maxNumber < this.colors.length) {\n      throw new RangeError(\n        `setMidpoint should be a number greater than or equal to the number of colors`,\n      );\n    }\n\n    this.maxNum = maxNumber ;\n    this.setColorGradient(...this.colors);\n    return this;\n  }\n}\n\nmodule.exports = Gradient;"]}