{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport CSSMotion, { CSSMotionList } from 'rc-motion';\nimport initCollapseMotion from '../_util/motion';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { FormItemPrefixContext } from './context';\nimport useDebounce from './hooks/useDebounce';\nimport useStyle from './style';\nconst EMPTY_LIST = [];\nfunction toErrorEntity(error, prefix, errorStatus) {\n  let index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n  return {\n    key: typeof error === 'string' ? error : `${prefix}-${index}`,\n    error,\n    errorStatus\n  };\n}\nconst ErrorList = _ref => {\n  let {\n    help,\n    helpStatus,\n    errors = EMPTY_LIST,\n    warnings = EMPTY_LIST,\n    className: rootClassName,\n    fieldId,\n    onVisibleChanged\n  } = _ref;\n  const {\n    prefixCls\n  } = React.useContext(FormItemPrefixContext);\n  const baseClassName = `${prefixCls}-item-explain`;\n  const rootCls = useCSSVarCls(prefixCls);\n  const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n  const collapseMotion = React.useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);\n  // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n  // ref: https://github.com/ant-design/ant-design/issues/36336\n  const debounceErrors = useDebounce(errors);\n  const debounceWarnings = useDebounce(warnings);\n  const fullKeyList = React.useMemo(() => {\n    if (help !== undefined && help !== null) {\n      return [toErrorEntity(help, 'help', helpStatus)];\n    }\n    return [].concat(_toConsumableArray(debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index))), _toConsumableArray(debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))));\n  }, [help, helpStatus, debounceErrors, debounceWarnings]);\n  const filledKeyFullKeyList = React.useMemo(() => {\n    const keysCount = {};\n    fullKeyList.forEach(_ref2 => {\n      let {\n        key\n      } = _ref2;\n      keysCount[key] = (keysCount[key] || 0) + 1;\n    });\n    return fullKeyList.map((entity, index) => Object.assign(Object.assign({}, entity), {\n      key: keysCount[entity.key] > 1 ? `${entity.key}-fallback-${index}` : entity.key\n    }));\n  }, [fullKeyList]);\n  const helpProps = {};\n  if (fieldId) {\n    helpProps.id = `${fieldId}_help`;\n  }\n  return wrapCSSVar(/*#__PURE__*/React.createElement(CSSMotion, {\n    motionDeadline: collapseMotion.motionDeadline,\n    motionName: `${prefixCls}-show-help`,\n    visible: !!filledKeyFullKeyList.length,\n    onVisibleChanged: onVisibleChanged\n  }, holderProps => {\n    const {\n      className: holderClassName,\n      style: holderStyle\n    } = holderProps;\n    return /*#__PURE__*/React.createElement(\"div\", Object.assign({}, helpProps, {\n      className: classNames(baseClassName, holderClassName, cssVarCls, rootCls, rootClassName, hashId),\n      style: holderStyle\n    }), /*#__PURE__*/React.createElement(CSSMotionList, Object.assign({\n      keys: filledKeyFullKeyList\n    }, initCollapseMotion(prefixCls), {\n      motionName: `${prefixCls}-show-help-item`,\n      component: false\n    }), itemProps => {\n      const {\n        key,\n        error,\n        errorStatus,\n        className: itemClassName,\n        style: itemStyle\n      } = itemProps;\n      return /*#__PURE__*/React.createElement(\"div\", {\n        key: key,\n        className: classNames(itemClassName, {\n          [`${baseClassName}-${errorStatus}`]: errorStatus\n        }),\n        style: itemStyle\n      }, error);\n    }));\n  }));\n};\nexport default ErrorList;","map":{"version":3,"names":["_toConsumableArray","React","classNames","CSSMotion","CSSMotionList","initCollapseMotion","useCSSVarCls","FormItemPrefixContext","useDebounce","useStyle","EMPTY_LIST","toErrorEntity","error","prefix","errorStatus","index","arguments","length","undefined","key","ErrorList","_ref","help","helpStatus","errors","warnings","className","rootClassName","fieldId","onVisibleChanged","prefixCls","useContext","baseClassName","rootCls","wrapCSSVar","hashId","cssVarCls","collapseMotion","useMemo","debounceErrors","debounceWarnings","fullKeyList","concat","map","warning","filledKeyFullKeyList","keysCount","forEach","_ref2","entity","Object","assign","helpProps","id","createElement","motionDeadline","motionName","visible","holderProps","holderClassName","style","holderStyle","keys","component","itemProps","itemClassName","itemStyle"],"sources":["/Users/nili/Documents/trae_projects/client/node_modules/antd/es/form/ErrorList.js"],"sourcesContent":["\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport CSSMotion, { CSSMotionList } from 'rc-motion';\nimport initCollapseMotion from '../_util/motion';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { FormItemPrefixContext } from './context';\nimport useDebounce from './hooks/useDebounce';\nimport useStyle from './style';\nconst EMPTY_LIST = [];\nfunction toErrorEntity(error, prefix, errorStatus, index = 0) {\n  return {\n    key: typeof error === 'string' ? error : `${prefix}-${index}`,\n    error,\n    errorStatus\n  };\n}\nconst ErrorList = ({\n  help,\n  helpStatus,\n  errors = EMPTY_LIST,\n  warnings = EMPTY_LIST,\n  className: rootClassName,\n  fieldId,\n  onVisibleChanged\n}) => {\n  const {\n    prefixCls\n  } = React.useContext(FormItemPrefixContext);\n  const baseClassName = `${prefixCls}-item-explain`;\n  const rootCls = useCSSVarCls(prefixCls);\n  const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n  const collapseMotion = React.useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);\n  // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n  // ref: https://github.com/ant-design/ant-design/issues/36336\n  const debounceErrors = useDebounce(errors);\n  const debounceWarnings = useDebounce(warnings);\n  const fullKeyList = React.useMemo(() => {\n    if (help !== undefined && help !== null) {\n      return [toErrorEntity(help, 'help', helpStatus)];\n    }\n    return [].concat(_toConsumableArray(debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index))), _toConsumableArray(debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))));\n  }, [help, helpStatus, debounceErrors, debounceWarnings]);\n  const filledKeyFullKeyList = React.useMemo(() => {\n    const keysCount = {};\n    fullKeyList.forEach(({\n      key\n    }) => {\n      keysCount[key] = (keysCount[key] || 0) + 1;\n    });\n    return fullKeyList.map((entity, index) => Object.assign(Object.assign({}, entity), {\n      key: keysCount[entity.key] > 1 ? `${entity.key}-fallback-${index}` : entity.key\n    }));\n  }, [fullKeyList]);\n  const helpProps = {};\n  if (fieldId) {\n    helpProps.id = `${fieldId}_help`;\n  }\n  return wrapCSSVar(/*#__PURE__*/React.createElement(CSSMotion, {\n    motionDeadline: collapseMotion.motionDeadline,\n    motionName: `${prefixCls}-show-help`,\n    visible: !!filledKeyFullKeyList.length,\n    onVisibleChanged: onVisibleChanged\n  }, holderProps => {\n    const {\n      className: holderClassName,\n      style: holderStyle\n    } = holderProps;\n    return /*#__PURE__*/React.createElement(\"div\", Object.assign({}, helpProps, {\n      className: classNames(baseClassName, holderClassName, cssVarCls, rootCls, rootClassName, hashId),\n      style: holderStyle\n    }), /*#__PURE__*/React.createElement(CSSMotionList, Object.assign({\n      keys: filledKeyFullKeyList\n    }, initCollapseMotion(prefixCls), {\n      motionName: `${prefixCls}-show-help-item`,\n      component: false\n    }), itemProps => {\n      const {\n        key,\n        error,\n        errorStatus,\n        className: itemClassName,\n        style: itemStyle\n      } = itemProps;\n      return /*#__PURE__*/React.createElement(\"div\", {\n        key: key,\n        className: classNames(itemClassName, {\n          [`${baseClassName}-${errorStatus}`]: errorStatus\n        }),\n        style: itemStyle\n      }, error);\n    }));\n  }));\n};\nexport default ErrorList;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,IAAIC,aAAa,QAAQ,WAAW;AACpD,OAAOC,kBAAkB,MAAM,iBAAiB;AAChD,OAAOC,YAAY,MAAM,uCAAuC;AAChE,SAASC,qBAAqB,QAAQ,WAAW;AACjD,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,OAAOC,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