{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport React from 'react';\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport classNames from 'classnames';\nimport Button from '../button';\nimport { useLocale } from '../locale';\nimport defaultLocale from '../locale/en_US';\nfunction isValidNode(node) {\n  return node !== undefined && node !== null;\n}\n// Due to the independent design of Panel, it will be too coupled to put in rc-tour,\n// so a set of Panel logic is implemented separately in antd.\nconst TourPanel = props => {\n  var _a, _b;\n  const {\n    stepProps,\n    current,\n    type,\n    indicatorsRender\n  } = props;\n  const {\n    prefixCls,\n    total = 1,\n    title,\n    onClose,\n    onPrev,\n    onNext,\n    onFinish,\n    cover,\n    description,\n    nextButtonProps,\n    prevButtonProps,\n    type: stepType,\n    closable\n  } = stepProps;\n  const mergedType = stepType !== null && stepType !== void 0 ? stepType : type;\n  const mergedCloseIcon = React.useMemo(() => {\n    let defaultCloseIcon = /*#__PURE__*/React.createElement(CloseOutlined, {\n      className: `${prefixCls}-close-icon`\n    });\n    if (closable && closable.closeIcon) {\n      defaultCloseIcon = closable.closeIcon;\n    }\n    return /*#__PURE__*/React.createElement(\"button\", {\n      type: \"button\",\n      onClick: onClose,\n      className: `${prefixCls}-close`\n    }, defaultCloseIcon);\n  }, [closable]);\n  const isLastStep = current === total - 1;\n  const prevBtnClick = () => {\n    var _a;\n    onPrev === null || onPrev === void 0 ? void 0 : onPrev();\n    (_a = prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(prevButtonProps);\n  };\n  const nextBtnClick = () => {\n    var _a;\n    if (isLastStep) {\n      onFinish === null || onFinish === void 0 ? void 0 : onFinish();\n    } else {\n      onNext === null || onNext === void 0 ? void 0 : onNext();\n    }\n    (_a = nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(nextButtonProps);\n  };\n  const headerNode = isValidNode(title) ? ( /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-header`\n  }, /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-title`\n  }, title))) : null;\n  const descriptionNode = isValidNode(description) ? ( /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-description`\n  }, description)) : null;\n  const coverNode = isValidNode(cover) ? /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-cover`\n  }, cover) : null;\n  let mergedIndicatorNode;\n  if (indicatorsRender) {\n    mergedIndicatorNode = indicatorsRender(current, total);\n  } else {\n    mergedIndicatorNode = _toConsumableArray(Array.from({\n      length: total\n    }).keys()).map((stepItem, index) => ( /*#__PURE__*/React.createElement(\"span\", {\n      key: stepItem,\n      className: classNames(index === current && `${prefixCls}-indicator-active`, `${prefixCls}-indicator`)\n    })));\n  }\n  const mainBtnType = mergedType === 'primary' ? 'default' : 'primary';\n  const secondaryBtnProps = {\n    type: 'default',\n    ghost: mergedType === 'primary'\n  };\n  const [contextLocale] = useLocale('Tour', defaultLocale.Tour);\n  return /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-content`\n  }, /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-inner`\n  }, closable && mergedCloseIcon, coverNode, headerNode, descriptionNode, /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-footer`\n  }, total > 1 && /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-indicators`\n  }, mergedIndicatorNode), /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-buttons`\n  }, current !== 0 ? ( /*#__PURE__*/React.createElement(Button, Object.assign({}, secondaryBtnProps, prevButtonProps, {\n    onClick: prevBtnClick,\n    size: \"small\",\n    className: classNames(`${prefixCls}-prev-btn`, prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.className)\n  }), (_a = prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.children) !== null && _a !== void 0 ? _a : contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.Previous)) : null, /*#__PURE__*/React.createElement(Button, Object.assign({\n    type: mainBtnType\n  }, nextButtonProps, {\n    onClick: nextBtnClick,\n    size: \"small\",\n    className: classNames(`${prefixCls}-next-btn`, nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.className)\n  }), (_b = nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.children) !== null && _b !== void 0 ? _b : isLastStep ? contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.Finish : contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.Next)))));\n};\nexport default TourPanel;","map":{"version":3,"names":["_toConsumableArray","React","CloseOutlined","classNames","Button","useLocale","defaultLocale","isValidNode","node","undefined","TourPanel","props","_a","_b","stepProps","current","type","indicatorsRender","prefixCls","total","title","onClose","onPrev","onNext","onFinish","cover","description","nextButtonProps","prevButtonProps","stepType","closable","mergedType","mergedCloseIcon","useMemo","defaultCloseIcon","createElement","className","closeIcon","onClick","isLastStep","prevBtnClick","call","nextBtnClick","headerNode","descriptionNode","coverNode","mergedIndicatorNode","Array","from","length","keys","map","stepItem","index","key","mainBtnType","secondaryBtnProps","ghost","contextLocale","Tour","Object","assign","size","children","Previous","Finish","Next"],"sources":["D:/Project/UC_Trains_Voice/react-demo/node_modules/antd/es/tour/panelRender.js"],"sourcesContent":["\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport React from 'react';\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport classNames from 'classnames';\nimport Button from '../button';\nimport { useLocale } from '../locale';\nimport defaultLocale from '../locale/en_US';\nfunction isValidNode(node) {\n  return node !== undefined && node !== null;\n}\n// Due to the independent design of Panel, it will be too coupled to put in rc-tour,\n// so a set of Panel logic is implemented separately in antd.\nconst TourPanel = props => {\n  var _a, _b;\n  const {\n    stepProps,\n    current,\n    type,\n    indicatorsRender\n  } = props;\n  const {\n    prefixCls,\n    total = 1,\n    title,\n    onClose,\n    onPrev,\n    onNext,\n    onFinish,\n    cover,\n    description,\n    nextButtonProps,\n    prevButtonProps,\n    type: stepType,\n    closable\n  } = stepProps;\n  const mergedType = stepType !== null && stepType !== void 0 ? stepType : type;\n  const mergedCloseIcon = React.useMemo(() => {\n    let defaultCloseIcon = /*#__PURE__*/React.createElement(CloseOutlined, {\n      className: `${prefixCls}-close-icon`\n    });\n    if (closable && closable.closeIcon) {\n      defaultCloseIcon = closable.closeIcon;\n    }\n    return /*#__PURE__*/React.createElement(\"button\", {\n      type: \"button\",\n      onClick: onClose,\n      className: `${prefixCls}-close`\n    }, defaultCloseIcon);\n  }, [closable]);\n  const isLastStep = current === total - 1;\n  const prevBtnClick = () => {\n    var _a;\n    onPrev === null || onPrev === void 0 ? void 0 : onPrev();\n    (_a = prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(prevButtonProps);\n  };\n  const nextBtnClick = () => {\n    var _a;\n    if (isLastStep) {\n      onFinish === null || onFinish === void 0 ? void 0 : onFinish();\n    } else {\n      onNext === null || onNext === void 0 ? void 0 : onNext();\n    }\n    (_a = nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(nextButtonProps);\n  };\n  const headerNode = isValidNode(title) ? ( /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-header`\n  }, /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-title`\n  }, title))) : null;\n  const descriptionNode = isValidNode(description) ? ( /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-description`\n  }, description)) : null;\n  const coverNode = isValidNode(cover) ? /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-cover`\n  }, cover) : null;\n  let mergedIndicatorNode;\n  if (indicatorsRender) {\n    mergedIndicatorNode = indicatorsRender(current, total);\n  } else {\n    mergedIndicatorNode = _toConsumableArray(Array.from({\n      length: total\n    }).keys()).map((stepItem, index) => ( /*#__PURE__*/React.createElement(\"span\", {\n      key: stepItem,\n      className: classNames(index === current && `${prefixCls}-indicator-active`, `${prefixCls}-indicator`)\n    })));\n  }\n  const mainBtnType = mergedType === 'primary' ? 'default' : 'primary';\n  const secondaryBtnProps = {\n    type: 'default',\n    ghost: mergedType === 'primary'\n  };\n  const [contextLocale] = useLocale('Tour', defaultLocale.Tour);\n  return /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-content`\n  }, /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-inner`\n  }, closable && mergedCloseIcon, coverNode, headerNode, descriptionNode, /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-footer`\n  }, total > 1 && /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-indicators`\n  }, mergedIndicatorNode), /*#__PURE__*/React.createElement(\"div\", {\n    className: `${prefixCls}-buttons`\n  }, current !== 0 ? ( /*#__PURE__*/React.createElement(Button, Object.assign({}, secondaryBtnProps, prevButtonProps, {\n    onClick: prevBtnClick,\n    size: \"small\",\n    className: classNames(`${prefixCls}-prev-btn`, prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.className)\n  }), (_a = prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.children) !== null && _a !== void 0 ? _a : contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.Previous)) : null, /*#__PURE__*/React.createElement(Button, Object.assign({\n    type: mainBtnType\n  }, nextButtonProps, {\n    onClick: nextBtnClick,\n    size: \"small\",\n    className: classNames(`${prefixCls}-next-btn`, nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.className)\n  }), (_b = nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.children) !== null && _b !== void 0 ? _b : isLastStep ? contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.Finish : contextLocale ===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