{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { Color } from \"./color\";\nexport var ColorPickerPrefixCls = 'rc-color-picker';\nexport var generateColor = function generateColor(color) {\n if (color instanceof Color) {\n return color;\n }\n return new Color(color);\n};\nexport var defaultColor = generateColor('#1677ff');\nexport var calculateColor = function calculateColor(props) {\n var offset = props.offset,\n targetRef = props.targetRef,\n containerRef = props.containerRef,\n color = props.color,\n type = props.type;\n var _containerRef$current = containerRef.current.getBoundingClientRect(),\n width = _containerRef$current.width,\n height = _containerRef$current.height;\n var _targetRef$current$ge = targetRef.current.getBoundingClientRect(),\n targetWidth = _targetRef$current$ge.width,\n targetHeight = _targetRef$current$ge.height;\n var centerOffsetX = targetWidth / 2;\n var centerOffsetY = targetHeight / 2;\n var saturation = (offset.x + centerOffsetX) / width;\n var bright = 1 - (offset.y + centerOffsetY) / height;\n var hsb = color.toHsb();\n var alphaOffset = saturation;\n var hueOffset = (offset.x + centerOffsetX) / width * 360;\n if (type) {\n switch (type) {\n case 'hue':\n return generateColor(_objectSpread(_objectSpread({}, hsb), {}, {\n h: hueOffset <= 0 ? 0 : hueOffset\n }));\n case 'alpha':\n return generateColor(_objectSpread(_objectSpread({}, hsb), {}, {\n a: alphaOffset <= 0 ? 0 : alphaOffset\n }));\n }\n }\n return generateColor({\n h: hsb.h,\n s: saturation <= 0 ? 0 : saturation,\n b: bright >= 1 ? 1 : bright,\n a: hsb.a\n });\n};\nexport var calcOffset = function calcOffset(color, type) {\n var hsb = color.toHsb();\n switch (type) {\n case 'hue':\n return {\n x: hsb.h / 360 * 100,\n y: 50\n };\n case 'alpha':\n return {\n x: color.a * 100,\n y: 50\n };\n\n // Picker panel\n default:\n return {\n x: hsb.s * 100,\n y: (1 - hsb.b) * 100\n };\n }\n};","map":{"version":3,"names":["_objectSpread","Color","ColorPickerPrefixCls","generateColor","color","defaultColor","calculateColor","props","offset","targetRef","containerRef","type","_containerRef$current","current","getBoundingClientRect","width","height","_targetRef$current$ge","targetWidth","targetHeight","centerOffsetX","centerOffsetY","saturation","x","bright","y","hsb","toHsb","alphaOffset","hueOffset","h","a","s","b","calcOffset"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@rc-component/color-picker/es/util.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { Color } from \"./color\";\nexport var ColorPickerPrefixCls = 'rc-color-picker';\nexport var generateColor = function generateColor(color) {\n if (color instanceof Color) {\n return color;\n }\n return new Color(color);\n};\nexport var defaultColor = generateColor('#1677ff');\nexport var calculateColor = function calculateColor(props) {\n var offset = props.offset,\n targetRef = props.targetRef,\n containerRef = props.containerRef,\n color = props.color,\n type = props.type;\n var _containerRef$current = containerRef.current.getBoundingClientRect(),\n width = _containerRef$current.width,\n height = _containerRef$current.height;\n var _targetRef$current$ge = targetRef.current.getBoundingClientRect(),\n targetWidth = _targetRef$current$ge.width,\n targetHeight = _targetRef$current$ge.height;\n var centerOffsetX = targetWidth / 2;\n var centerOffsetY = targetHeight / 2;\n var saturation = (offset.x + centerOffsetX) / width;\n var bright = 1 - (offset.y + centerOffsetY) / height;\n var hsb = color.toHsb();\n var alphaOffset = saturation;\n var hueOffset = (offset.x + centerOffsetX) / width * 360;\n if (type) {\n switch (type) {\n case 'hue':\n return generateColor(_objectSpread(_objectSpread({}, hsb), {}, {\n h: hueOffset <= 0 ? 0 : hueOffset\n }));\n case 'alpha':\n return generateColor(_objectSpread(_objectSpread({}, hsb), {}, {\n a: alphaOffset <= 0 ? 0 : alphaOffset\n }));\n }\n }\n return generateColor({\n h: hsb.h,\n s: saturation <= 0 ? 0 : saturation,\n b: bright >= 1 ? 1 : bright,\n a: hsb.a\n });\n};\nexport var calcOffset = function calcOffset(color, type) {\n var hsb = color.toHsb();\n switch (type) {\n case 'hue':\n return {\n x: hsb.h / 360 * 100,\n y: 50\n };\n case 'alpha':\n return {\n x: color.a * 100,\n y: 50\n };\n\n // Picker panel\n default:\n return {\n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