function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
import { ArrowRight } from "@sofa-design/icons";
import { ConfigProvider } from "antd";
import classNames from "clsx";
import React, { memo, useCallback, useContext, useState } from "react";
import { useStyle } from "./CaseReplyStyle";
var CaseReplyComponent = function CaseReplyComponent(param) {
    var _param_coverBackground = param.coverBackground, coverBackground = _param_coverBackground === void 0 ? 'rgba(132, 220, 24, 0.15)' : _param_coverBackground, _param_quoteIconColor = param.quoteIconColor, quoteIconColor = _param_quoteIconColor === void 0 ? 'rgb(132, 220, 24)' : _param_quoteIconColor, quote = param.quote, title = param.title, description = param.description, _param_buttonText = param.buttonText, buttonText = _param_buttonText === void 0 ? '查看回放' : _param_buttonText, buttonBar = param.buttonBar, onButtonClick = param.onButtonClick, onClick = param.onClick, style = param.style, className = param.className, customPrefixCls = param.prefixCls;
    var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
    var prefixCls = getPrefixCls('agentic-chatboot-case-reply', customPrefixCls);
    var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
    var _useState = _sliced_to_array(useState(false), 2), isHovered = _useState[0], setIsHovered = _useState[1];
    var containerCls = classNames(prefixCls, hashId, className);
    var coverCls = classNames("".concat(prefixCls, "-cover"), hashId);
    var coverContentCls = classNames("".concat(prefixCls, "-cover-content"), hashId, isHovered && "".concat(prefixCls, "-cover-content-hovered"));
    var quoteIconCls = classNames("".concat(prefixCls, "-quote-icon"), hashId);
    var quoteTextCls = classNames("".concat(prefixCls, "-quote-text"), hashId);
    var bottomCls = classNames("".concat(prefixCls, "-bottom"), hashId);
    var titleCls = classNames("".concat(prefixCls, "-title"), hashId);
    var descriptionCls = classNames("".concat(prefixCls, "-description"), hashId);
    var buttonBarCls = classNames("".concat(prefixCls, "-button-bar"), hashId, isHovered && "".concat(prefixCls, "-button-bar-visible"));
    var arrowIconCls = classNames("".concat(prefixCls, "-arrow-icon"), hashId);
    // 使用 useCallback 优化事件处理函数
    var handleMouseEnter = useCallback(function() {
        setIsHovered(true);
    }, []);
    var handleMouseLeave = useCallback(function() {
        setIsHovered(false);
    }, []);
    return wrapSSR(/*#__PURE__*/ React.createElement("div", {
        className: containerCls,
        style: style,
        onClick: onClick,
        onMouseEnter: handleMouseEnter,
        onMouseLeave: handleMouseLeave
    }, /*#__PURE__*/ React.createElement("div", {
        className: coverCls,
        style: {
            background: coverBackground
        }
    }, /*#__PURE__*/ React.createElement("div", {
        className: coverContentCls
    }, /*#__PURE__*/ React.createElement("div", {
        className: quoteIconCls
    }, /*#__PURE__*/ React.createElement("svg", {
        xmlns: "http://www.w3.org/2000/svg",
        width: "24",
        height: "24",
        viewBox: "0 0 25.22317126393318 25.22317126393318",
        fill: "none"
    }, /*#__PURE__*/ React.createElement("defs", null, /*#__PURE__*/ React.createElement("clipPath", {
        id: "master_svg0_1118_33390"
    }, /*#__PURE__*/ React.createElement("rect", {
        x: "23.967108249664307",
        y: "25.22317126393318",
        width: "24",
        height: "24",
        rx: "0"
    }))), /*#__PURE__*/ React.createElement("g", {
        transform: "matrix(-0.9986295104026794,-0.0523359589278698,0.0523359589278698,-0.9986295104026794,46.58129097149476,51.66611602701195)",
        clipPath: "url(#master_svg0_1118_33390)"
    }, /*#__PURE__*/ React.createElement("g", null, /*#__PURE__*/ React.createElement("path", {
        d: "M29.779783327789307,38.963964076433186C28.651713327789306,40.719154076433185,27.054323327789305,42.204154076433184,25.489813327789307,43.26605407643318L27.250773327789307,45.12705407643318C31.293283327789307,43.54175407643318,35.144133327789305,39.44085407643318,35.144133327789305,34.61674407643318L35.11302332778931,34.61674407643318C35.126363327789306,34.47068407643318,35.13353332778931,34.32282407643318,35.13353332778931,34.173284076433184C35.13353332778931,31.51111407643318,32.97547332778931,29.35305407643318,30.313303327789306,29.35305407643318C27.651223327789307,29.35305407643318,25.493075247789307,31.51111407643318,25.493075247789307,34.173284076433184C25.493051107789306,36.65507407643318,27.368793327789305,38.69843407643318,29.779783327789307,38.963964076433186ZM36.8831133277893,43.26605407643318L38.64401332778931,45.12705407643318C42.68651332778931,43.54175407643318,46.53741332778931,39.44085407643318,46.53741332778931,34.61674407643318L46.50631332778931,34.61674407643318C46.51961332778931,34.47068407643318,46.526813327789306,34.32282407643318,46.526813327789306,34.173284076433184C46.526813327789306,31.51111407643318,44.36871332778931,29.35305407643318,41.706613327789306,29.35305407643318C39.04441332778931,29.35305407643318,36.88631332778931,31.51111407643318,36.88631332778931,34.173284076433184C36.88631332778931,36.65509407643318,38.762013327789305,38.69848407643318,41.17311332778931,38.96398407643318C40.045013327789306,40.719154076433185,38.447613327789306,42.204154076433184,36.8831133277893,43.26605407643318Z",
        fill: quoteIconColor,
        fillOpacity: "1"
    }))))), quote && /*#__PURE__*/ React.createElement("div", {
        className: quoteTextCls
    }, quote))), /*#__PURE__*/ React.createElement("div", {
        className: bottomCls
    }, title && /*#__PURE__*/ React.createElement("h3", {
        className: titleCls
    }, title), description && /*#__PURE__*/ React.createElement("p", {
        className: descriptionCls
    }, description), (buttonBar || buttonText) && /*#__PURE__*/ React.createElement("div", {
        className: buttonBarCls
    }, buttonBar || /*#__PURE__*/ React.createElement("button", {
        type: "button",
        onClick: function onClick(e) {
            e.stopPropagation();
            onButtonClick === null || onButtonClick === void 0 ? void 0 : onButtonClick(e);
        }
    }, buttonText, /*#__PURE__*/ React.createElement("span", {
        className: arrowIconCls
    }, /*#__PURE__*/ React.createElement(ArrowRight, null)))))));
};
CaseReplyComponent.displayName = 'CaseReply';
// 使用 React.memo 优化性能，避免不必要的重新渲染
var CaseReply = /*#__PURE__*/ memo(CaseReplyComponent);
export default CaseReply;
