PromoCursed/node_modules/.cache/babel-loader/659f4ca8d0cb4789f56ea9496803e78bf6ed55034647cddfbf066d3cc5834ad2.json
2024-08-20 23:25:37 +04:00

1 line
5.7 KiB
JSON

{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { Color as RcColor } from '@rc-component/color-picker';\nimport { AggregationColor } from './color';\nexport const generateColor = color => {\n if (color instanceof AggregationColor) {\n return color;\n }\n return new AggregationColor(color);\n};\nexport const getRoundNumber = value => Math.round(Number(value || 0));\nexport const getColorAlpha = color => getRoundNumber(color.toHsb().a * 100);\n/** Return the color whose `alpha` is 1 */\nexport const genAlphaColor = (color, alpha) => {\n const hsba = color.toHsb();\n hsba.a = alpha || 1;\n return generateColor(hsba);\n};\n/**\n * Get percent position color. e.g. [10%-#fff, 20%-#000], 15% => #888\n */\nexport const getGradientPercentColor = (colors, percent) => {\n const filledColors = [{\n percent: 0,\n color: colors[0].color\n }].concat(_toConsumableArray(colors), [{\n percent: 100,\n color: colors[colors.length - 1].color\n }]);\n for (let i = 0; i < filledColors.length - 1; i += 1) {\n const startPtg = filledColors[i].percent;\n const endPtg = filledColors[i + 1].percent;\n const startColor = filledColors[i].color;\n const endColor = filledColors[i + 1].color;\n if (startPtg <= percent && percent <= endPtg) {\n const dist = endPtg - startPtg;\n if (dist === 0) {\n return startColor;\n }\n const ratio = (percent - startPtg) / dist * 100;\n const startRcColor = new RcColor(startColor);\n const endRcColor = new RcColor(endColor);\n return startRcColor.mix(endRcColor, ratio).toRgbString();\n }\n }\n // This will never reach\n /* istanbul ignore next */\n return '';\n};","map":{"version":3,"names":["_toConsumableArray","Color","RcColor","AggregationColor","generateColor","color","getRoundNumber","value","Math","round","Number","getColorAlpha","toHsb","a","genAlphaColor","alpha","hsba","getGradientPercentColor","colors","percent","filledColors","concat","length","i","startPtg","endPtg","startColor","endColor","dist","ratio","startRcColor","endRcColor","mix","toRgbString"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/color-picker/util.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { Color as RcColor } from '@rc-component/color-picker';\nimport { AggregationColor } from './color';\nexport const generateColor = color => {\n if (color instanceof AggregationColor) {\n return color;\n }\n return new AggregationColor(color);\n};\nexport const getRoundNumber = value => Math.round(Number(value || 0));\nexport const getColorAlpha = color => getRoundNumber(color.toHsb().a * 100);\n/** Return the color whose `alpha` is 1 */\nexport const genAlphaColor = (color, alpha) => {\n const hsba = color.toHsb();\n hsba.a = alpha || 1;\n return generateColor(hsba);\n};\n/**\n * Get percent position color. e.g. [10%-#fff, 20%-#000], 15% => #888\n */\nexport const getGradientPercentColor = (colors, percent) => {\n const filledColors = [{\n percent: 0,\n color: colors[0].color\n }].concat(_toConsumableArray(colors), [{\n percent: 100,\n color: colors[colors.length - 1].color\n }]);\n for (let i = 0; i < filledColors.length - 1; i += 1) {\n const startPtg = filledColors[i].percent;\n const endPtg = filledColors[i + 1].percent;\n const startColor = filledColors[i].color;\n const endColor = filledColors[i + 1].color;\n if (startPtg <= percent && percent <= endPtg) {\n const dist = endPtg - startPtg;\n if (dist === 0) {\n return startColor;\n }\n const ratio = (percent - startPtg) / dist * 100;\n const startRcColor = new RcColor(startColor);\n const endRcColor = new RcColor(endColor);\n return startRcColor.mix(endRcColor, ratio).toRgbString();\n }\n }\n // This will never reach\n /* istanbul ignore next */\n return '';\n};"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,SAASC,KAAK,IAAIC,OAAO,QAAQ,4BAA4B;AAC7D,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,OAAO,MAAMC,aAAa,GAAGC,KAAK,IAAI;EACpC,IAAIA,KAAK,YAAYF,gBAAgB,EAAE;IACrC,OAAOE,KAAK;EACd;EACA,OAAO,IAAIF,gBAAgB,CAACE,KAAK,CAAC;AACpC,CAAC;AACD,OAAO,MAAMC,cAAc,GAAGC,KAAK,IAAIC,IAA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