import { ConfigProvider } from "antd";
import classNames from "clsx";
import React, { memo, useContext } from "react";
import { useStyle } from "./style";
var TitleComponent = function TitleComponent(param) {
    var title = param.title, subtitle = param.subtitle, style = param.style, className = param.className, customPrefixCls = param.prefixCls;
    var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
    var prefixCls = getPrefixCls('agentic-chatboot-title', customPrefixCls);
    var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
    // 使用提前返回优化
    if (!title && !subtitle) {
        return null;
    }
    var mainCls = classNames("".concat(prefixCls, "-main"), hashId);
    var subtitleCls = classNames("".concat(prefixCls, "-subtitle"), hashId);
    return wrapSSR(/*#__PURE__*/ React.createElement("div", {
        className: classNames(prefixCls, hashId, className),
        style: style
    }, title && /*#__PURE__*/ React.createElement("div", {
        className: mainCls
    }, title), subtitle && /*#__PURE__*/ React.createElement("div", {
        className: subtitleCls
    }, subtitle)));
};
TitleComponent.displayName = 'Title';
// 使用 React.memo 优化性能，避免不必要的重新渲染
var Title = /*#__PURE__*/ memo(TitleComponent);
export default Title;
