function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
import { ConfigProvider } from "antd";
import React, { useContext } from "react";
import { LayoutHeader } from "../Components/LayoutHeader";
import { useAgenticLayoutStyle } from "./style";
/**
 * AgenticLayout 组件 - 智能体布局组件
 *
 * 该组件提供一个三栏布局的容器，支持左中右三个区域的灵活配置。
 * 左右侧栏支持折叠功能，中间区域自适应宽度。
 *
 * @component
 * @description 智能体布局组件，提供左中右三栏布局
 * @param {AgenticLayoutProps} props - 组件属性
 * @param {ReactNode} [props.left] - 左侧内容
 * @param {ReactNode} props.center - 中间内容
 * @param {ReactNode} [props.right] - 右侧内容
 * @param {LayoutHeaderConfig} [props.header] - 头部配置
 * @param {React.CSSProperties} [props.style] - 自定义样式
 * @param {string} [props.className] - 自定义CSS类名
 * @param {number} [props.leftWidth=256] - 左侧宽度
 * @param {number} [props.rightWidth=256] - 右侧宽度
 * @param {string | number} [props.minHeight='600px'] - 最小高度
 *
 * @example
 * ```tsx
 * <AgenticLayout
 *   left={<History />}
 *   center={<ChatLayout />}
 *   right={<Workspace />}
 *   header={{
 *     title: "智能体助手",
 *     showShare: true,
 *     showLeftCollapse: true,
 *     showRightCollapse: true,
 *     onLeftCollapse: (collapsed) => console.log('左侧折叠:', collapsed),
 *     onRightCollapse: (collapsed) => console.log('右侧折叠:', collapsed),
 *     onShare: () => console.log('分享')
 *   }}
 * />
 * ```
 *
 * @returns {React.ReactElement} 渲染的布局组件
 *
 * @remarks
 * - 支持左右侧栏的独立折叠控制
 * - 中间区域自适应剩余宽度
 * - 提供响应式布局适配
 * - 支持自定义宽度和高度
 * - 集成 Ant Design 主题系统
 */ export var AgenticLayout = function(param) {
    var left = param.left, center = param.center, right = param.right, header = param.header, style = param.style, className = param.className, _param_leftWidth = param.leftWidth, leftWidth = _param_leftWidth === void 0 ? 256 : _param_leftWidth, _param_rightWidth = param.rightWidth, rightWidth = _param_rightWidth === void 0 ? 540 : _param_rightWidth;
    var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
    var prefixCls = getPrefixCls('agentic-layout');
    var _useAgenticLayoutStyle = useAgenticLayoutStyle(prefixCls), wrapSSR = _useAgenticLayoutStyle.wrapSSR, hashId = _useAgenticLayoutStyle.hashId;
    var _header_leftCollapsed, _ref;
    // 从 header 配置中获取折叠状态
    var leftCollapsed = (_ref = (_header_leftCollapsed = header === null || header === void 0 ? void 0 : header.leftCollapsed) !== null && _header_leftCollapsed !== void 0 ? _header_leftCollapsed : header === null || header === void 0 ? void 0 : header.leftDefaultCollapsed) !== null && _ref !== void 0 ? _ref : false;
    var _header_rightCollapsed, _ref1;
    var rightCollapsed = (_ref1 = (_header_rightCollapsed = header === null || header === void 0 ? void 0 : header.rightCollapsed) !== null && _header_rightCollapsed !== void 0 ? _header_rightCollapsed : header === null || header === void 0 ? void 0 : header.rightDefaultCollapsed) !== null && _ref1 !== void 0 ? _ref1 : false;
    var _header_leftCollapsible, _header_rightCollapsible;
    return wrapSSR(/*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, " ").concat(className || '', " ").concat(hashId),
        style: style
    }, /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-body ").concat(hashId),
        style: {
            display: 'flex',
            flex: 1
        }
    }, left && /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-sidebar ").concat(prefixCls, "-sidebar-left ").concat(leftCollapsed ? "".concat(prefixCls, "-sidebar-left-collapsed") : '', " ").concat(hashId),
        style: {
            width: leftCollapsed ? 0 : leftWidth,
            minWidth: leftCollapsed ? 0 : leftWidth,
            maxWidth: leftCollapsed ? 0 : leftWidth
        }
    }, /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-sidebar-content ").concat(hashId)
    }, left)), /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-main ").concat(hashId),
        style: {
            flex: 1,
            minWidth: 0
        }
    }, header && /*#__PURE__*/ React.createElement(LayoutHeader, _object_spread_props(_object_spread({}, header), {
        leftCollapsible: (_header_leftCollapsible = header.leftCollapsible) !== null && _header_leftCollapsible !== void 0 ? _header_leftCollapsible : !!left,
        rightCollapsible: (_header_rightCollapsible = header.rightCollapsible) !== null && _header_rightCollapsible !== void 0 ? _header_rightCollapsible : !!right
    })), /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-main-content ").concat(hashId)
    }, center))), right && /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-sidebar ").concat(prefixCls, "-sidebar-right ").concat(rightCollapsed ? "".concat(prefixCls, "-sidebar-right-collapsed") : '', " ").concat(hashId),
        style: {
            width: rightCollapsed ? 0 : rightWidth,
            minWidth: rightCollapsed ? 0 : rightWidth,
            maxWidth: rightCollapsed ? 0 : rightWidth
        }
    }, /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-sidebar-content ").concat(hashId)
    }, right))));
};
