import { jsx as _jsx } from "react/jsx-runtime";
import React, { memo } from "react";
import { ConfigProvider } from "antd";
import { useAppContext } from "./AppContext";
const BasicLayout = /*#__PURE__*/ memo(({ children, configProps: externalConfigProps })=>{
    const { antdConfig, theme } = useAppContext();
    // 优先使用上下文中的配置，如果没有则使用外部传入的配置
    const finalConfigProps = antdConfig || externalConfigProps;
    // 合并主题配置到 Ant Design 配置
    const mergedConfigProps = React.useMemo(()=>{
        if (!finalConfigProps && !theme.primaryColor) {
            return undefined;
        }
        return {
            ...finalConfigProps,
            theme: {
                ...finalConfigProps?.theme,
                token: {
                    ...finalConfigProps?.theme?.token,
                    ...theme.primaryColor ? {
                        colorPrimary: theme.primaryColor
                    } : {}
                },
                algorithm: finalConfigProps?.theme?.algorithm
            }
        };
    }, [
        finalConfigProps,
        theme.primaryColor
    ]);
    return /*#__PURE__*/ _jsx(ConfigProvider, {
        ...mergedConfigProps,
        children: children
    });
});
BasicLayout.displayName = 'BasicLayout';
export { BasicLayout };

//# sourceMappingURL=BasicLayout.js.map