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GnB,EAAa,GACR,EAAI,EAAG,OAAS,EAAW,OAAI,EAAW,OAAI,EAAW,OAAI,EAA0B,EAAI,EAAY,GAAQ,EAEvH,EAAI,GADJ,EAAa,EAAJ,GACW,GACpB,EAAI,EAAO,EAAS,GACpB,EAAI,EAAO,EAAS,GAChB,EAAO,EAAS,IAGX,MACF,EAAI,KAAO,EAAI,KAAO,EAAI,KAC/B,EAAW,KAAK,CAAC,EAAG,EAAG,KAO1B,IACI,EADO,WAAoB,QAAE,EAAY,GAC1B,UAKnB,OAFA,EAAM,eAEC,CACR,KAGM,CACP,CAzFgB,GA2FjB,QAAiB,QAAI,WACrB,OAAO,QAAU,QAAiB","file":"/npm/@paulavery/color-thief@2.1.1/lib/ColorThief.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@paulavery/color-thief@2.1.1/lib/ColorThief.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar _interopRequireDefault = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };\n\nvar _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, '__esModule', {\n\tvalue: true\n});\n/*\n * @license\n * Creative Commons Attribution 2.5 License:\n * http://creativecommons.org/licenses/by/2.5/\n */\n\n/*\n * Color Thief\n * by Lokesh Dhakar - http://www.lokeshdhakar.com\n *\n * Thanks\n * ------\n * Nick Rabinowitz - For creating quantize.js.\n * John Schulz - For clean up and optimization. @JFSIII\n * Nathan Spady - For adding drag and drop support to the demo page.\n *\n */\n\nvar _CanvasImage = require('./CanvasImage');\n\nvar _CanvasImage2 = _interopRequireDefault(_CanvasImage);\n\nvar _quantize = require('quantize');\n\nvar _quantize2 = _interopRequireDefault(_quantize);\n\nvar ColorThief = (function () {\n\tfunction ColorThief() {\n\t\t_classCallCheck(this, ColorThief);\n\t}\n\n\t_createClass(ColorThief, [{\n\t\tkey: 'getColor',\n\n\t\t/*\n   * getColor(sourceImage[, quality])\n   * returns {r: num, g: num, b: num}\n   *\n   * Use the median cut algorithm provided by quantize.js to cluster similar\n   * colors and return the base color from the largest cluster.\n   *\n   * Quality is an optional argument. It needs to be an integer. 0 is the highest quality settings.\n   * 10 is the default. There is a trade-off between quality and speed. The bigger the number, the\n   * faster a color will be returned but the greater the likelihood that it will not be the visually\n   * most dominant color.\n   *\n   * */\n\n\t\tvalue: function getColor(sourceImage) {\n\t\t\tvar quality = arguments[1] === undefined ? 10 : arguments[1];\n\n\t\t\tvar palette = this.getPalette(sourceImage, 5, quality);\n\t\t\tvar dominantColor = palette[0];\n\t\t\treturn dominantColor;\n\t\t}\n\t}, {\n\t\tkey: 'getPalette',\n\n\t\t/*\n   * getPalette(sourceImage[, colorCount, quality])\n   * returns array[ {r: num, g: num, b: num}, {r: num, g: num, b: num}, ...]\n   *\n   * Use the median cut algorithm provided by quantize.js to cluster similar colors.\n   *\n   * colorCount determines the size of the palette; the number of colors returned. If not set, it\n   * defaults to 10.\n   *\n   * BUGGY: Function does not always return the requested amount of colors. It can be +/- 2.\n   *\n   * quality is an optional argument. It needs to be an integer. 0 is the highest quality settings.\n   * 10 is the default. There is a trade-off between quality and speed. The bigger the number, the\n   * faster the palette generation but the greater the likelihood that colors will be missed.\n   *\n   *\n   */\n\t\tvalue: function getPalette(sourceImage) {\n\t\t\tvar colorCount = arguments[1] === undefined ? 10 : arguments[1];\n\t\t\tvar quality = arguments[2] === undefined ? 10 : arguments[2];\n\n\t\t\t// Create custom CanvasImage object\n\t\t\tvar image = new _CanvasImage2['default'](sourceImage);\n\t\t\tvar imageData = image.getImageData();\n\t\t\tvar pixels = imageData.data;\n\t\t\tvar pixelCount = image.getPixelCount();\n\n\t\t\t// Store the RGB values in an array format suitable for quantize function\n\t\t\tvar pixelArray = [];\n\t\t\tfor (var i = 0, offset = undefined, r = undefined, g = undefined, b = undefined, a = undefined; i < pixelCount; i = i + quality) {\n\t\t\t\toffset = i * 4;\n\t\t\t\tr = pixels[offset + 0];\n\t\t\t\tg = pixels[offset + 1];\n\t\t\t\tb = pixels[offset + 2];\n\t\t\t\ta = pixels[offset + 3];\n\n\t\t\t\t// If pixel is mostly opaque and not white\n\t\t\t\tif (a >= 125) {\n\t\t\t\t\tif (!(r > 250 && g > 250 && b > 250)) {\n\t\t\t\t\t\tpixelArray.push([r, g, b]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Send array to quantize function which clusters values\n\t\t\t// using median cut algorithm\n\t\t\tvar cmap = _quantize2['default'](pixelArray, colorCount);\n\t\t\tvar palette = cmap.palette();\n\n\t\t\t// Clean up\n\t\t\timage.removeCanvas();\n\n\t\t\treturn palette;\n\t\t}\n\t}]);\n\n\treturn ColorThief;\n})();\n\nexports['default'] = ColorThief;\nmodule.exports = exports['default'];\n"]}