{"ast":null,"code":"\"use client\";\n\nimport React, { useEffect, useState } from 'react';\nimport Input from '../../input/Input';\nimport { toHexFormat } from '../color';\nimport { generateColor } from '../util';\nconst hexReg = /(^#[\\da-f]{6}$)|(^#[\\da-f]{8}$)/i;\nconst isHexString = hex => hexReg.test(`#${hex}`);\nconst ColorHexInput = _ref => {\n  let {\n    prefixCls,\n    value,\n    onChange\n  } = _ref;\n  const colorHexInputPrefixCls = `${prefixCls}-hex-input`;\n  const [hexValue, setHexValue] = useState(() => value ? toHexFormat(value.toHexString()) : undefined);\n  // Update step value\n  useEffect(() => {\n    if (value) {\n      setHexValue(toHexFormat(value.toHexString()));\n    }\n  }, [value]);\n  const handleHexChange = e => {\n    const originValue = e.target.value;\n    setHexValue(toHexFormat(originValue));\n    if (isHexString(toHexFormat(originValue, true))) {\n      onChange === null || onChange === void 0 ? void 0 : onChange(generateColor(originValue));\n    }\n  };\n  return /*#__PURE__*/React.createElement(Input, {\n    className: colorHexInputPrefixCls,\n    value: hexValue,\n    prefix: \"#\",\n    onChange: handleHexChange,\n    size: \"small\"\n  });\n};\nexport default ColorHexInput;","map":{"version":3,"names":["React","useEffect","useState","Input","toHexFormat","generateColor","hexReg","isHexString","hex","test","ColorHexInput","_ref","prefixCls","value","onChange","colorHexInputPrefixCls","hexValue","setHexValue","toHexString","undefined","handleHexChange","e","originValue","target","createElement","className","prefix","size"],"sources":["/Users/nili/Documents/trae_projects/client/node_modules/antd/es/color-picker/components/ColorHexInput.js"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useState } from 'react';\nimport Input from '../../input/Input';\nimport { toHexFormat } from '../color';\nimport { generateColor } from '../util';\nconst hexReg = /(^#[\\da-f]{6}$)|(^#[\\da-f]{8}$)/i;\nconst isHexString = hex => hexReg.test(`#${hex}`);\nconst ColorHexInput = ({\n  prefixCls,\n  value,\n  onChange\n}) => {\n  const colorHexInputPrefixCls = `${prefixCls}-hex-input`;\n  const [hexValue, setHexValue] = useState(() => value ? toHexFormat(value.toHexString()) : undefined);\n  // Update step value\n  useEffect(() => {\n    if (value) {\n      setHexValue(toHexFormat(value.toHexString()));\n    }\n  }, [value]);\n  const handleHexChange = e => {\n    const originValue = e.target.value;\n    setHexValue(toHexFormat(originValue));\n    if (isHexString(toHexFormat(originValue, true))) {\n      onChange === null || onChange === void 0 ? void 0 : onChange(generateColor(originValue));\n    }\n  };\n  return /*#__PURE__*/React.createElement(Input, {\n    className: colorHexInputPrefixCls,\n    value: hexValue,\n    prefix: \"#\",\n    onChange: handleHexChange,\n    size: \"small\"\n  });\n};\nexport default ColorHexInput;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,OAAOC,KAAK,MAAM,mBAAmB;AACrC,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,aAAa,QAAQ,SAAS;AACvC,MAAMC,MAAM,GAAG,kCAAkC;AACjD,MAAMC,WAAW,GAAGC,GAAG,IAAIF,MAAM,CAACG,IAAI,CAAC,IAAID,GAAG,EAAE,CAAC;AACjD,MAAME,aAAa,GAAGC,IAAA,IAIhB;EAAA,IAJiB;IACrBC,SAAS;IACTC,KAAK;IACLC;EACF,CAAC,GAAAH,IAAA;EACC,MAAMI,sBAAsB,GAAG,GAAGH,SAAS,YAAY;EACvD,MAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGf,QAAQ,CAAC,MAAMW,KAAK,GAAGT,WAAW,CAACS,KAAK,CAACK,WAAW,CAAC,CAAC,CAAC,GAAGC,SAAS,CAAC;EACpG;EACAlB,SAAS,CAAC,MAAM;IACd,IAAIY,KAAK,EAAE;MACTI,WAAW,CAACb,WAAW,CAACS,KAAK,CAACK,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/C;EACF,CAAC,EAAE,CAACL,KAAK,CAAC,CAAC;EACX,MAAMO,eAAe,GAAGC,CAAC,IAAI;IAC3B,MAAMC,WAAW,GAAGD,CAAC,CAACE,MAAM,C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