import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_pro_components__ from "@ant-design/pro-components";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE_react_router__ from "react-router";
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "../../index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__user_index_mjs__ from "../../user/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__admin_layout_index_mjs__ from "../admin-layout/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__admin_layout_AdminProvider_mjs__ from "../admin-layout/AdminProvider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__system_settings_index_mjs__ from "../system-settings/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
const SettingLayout = (param)=>{
    let { selectedKeys, onClick, route, children, fullscreen } = param;
    var _result_data_data, _result_data, _result_data_data_logo, _result_data_data1, _result_data1, _data_data, _data_data1, _data_data2;
    const settings = {
        fixSiderbar: true,
        layout: 'mix',
        splitMenus: false,
        navTheme: 'light',
        contentWidth: 'Fluid',
        fixedHeader: true,
        siderMenuType: 'sub'
    };
    const app = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useApp)();
    const location = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useLocation)();
    const navigate = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useNavigate)();
    const { data } = (0, __WEBPACK_EXTERNAL_MODULE__user_index_mjs__.useCurrentUserContext)();
    const result = (0, __WEBPACK_EXTERNAL_MODULE__system_settings_index_mjs__.useSystemSettings)();
    const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
    const redirectToUserHome = ()=>{
        if (app.adminUrl.startsWith('/')) navigate(app.adminUrl);
        else window.location.href = app.adminUrl;
    };
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__admin_layout_AdminProvider_mjs__.AdminProvider, {
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_components__.ProConfigProvider, {
            hashed: false,
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_components__.ProLayout, {
                className: styles.settingLayout,
                title: null == result ? void 0 : null === (_result_data = result.data) || void 0 === _result_data ? void 0 : null === (_result_data_data = _result_data.data) || void 0 === _result_data_data ? void 0 : _result_data_data.title,
                logo: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("img", {
                    src: null == result ? void 0 : null === (_result_data1 = result.data) || void 0 === _result_data1 ? void 0 : null === (_result_data_data1 = _result_data1.data) || void 0 === _result_data_data1 ? void 0 : null === (_result_data_data_logo = _result_data_data1.logo) || void 0 === _result_data_data_logo ? void 0 : _result_data_data_logo.url
                }),
                onMenuHeaderClick: redirectToUserHome,
                bgLayoutImgList: [
                    {
                        src: 'https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png',
                        left: 85,
                        bottom: 100,
                        height: '303px'
                    },
                    {
                        src: 'https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png',
                        bottom: -68,
                        right: -45,
                        height: '303px'
                    },
                    {
                        src: 'https://img.alicdn.com/imgextra/i3/O1CN018NxReL1shX85Yz6Cx_!!6000000005798-2-tps-884-496.png',
                        bottom: 0,
                        left: 0,
                        width: '331px'
                    }
                ],
                route: route,
                token: {
                    header: {
                        colorBgMenuItemSelected: 'rgba(0,0,0,0.04)'
                    }
                },
                location: location,
                siderMenuType: "group",
                menuProps: {
                    onClick,
                    selectedKeys
                },
                menu: {
                    collapsedShowGroupTitle: true
                },
                avatarProps: {
                    src: 'https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg',
                    size: 'small',
                    title: (null == data ? void 0 : null === (_data_data = data.data) || void 0 === _data_data ? void 0 : _data_data.nickname) || (null == data ? void 0 : null === (_data_data1 = data.data) || void 0 === _data_data1 ? void 0 : _data_data1.username) || (null == data ? void 0 : null === (_data_data2 = data.data) || void 0 === _data_data2 ? void 0 : _data_data2.email),
                    render: (props, dom)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Dropdown, {
                            dropdownRender: ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__user_index_mjs__.SettingsMenu, {}),
                            children: dom
                        })
                },
                actionsRender: (props)=>{
                    if (props.isMobile) return [];
                    if ('undefined' == typeof window) return [];
                    return [
                        /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                            type: "text",
                            onClick: ()=>{
                                navigate('/admin');
                            },
                            icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.HomeFilled, {}, "HomeFilled")
                        }),
                        /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                            type: "text",
                            target: "_blank",
                            href: "https://tachybase.org",
                            icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.InfoCircleFilled, {}, "InfoCircleFilled")
                        }),
                        /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                            type: "text",
                            target: "_blank",
                            href: "https://github.com/tachybase/tachybase/issues",
                            icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.QuestionCircleFilled, {}, "QuestionCircleFilled")
                        }),
                        /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                            type: "text",
                            target: "_blank",
                            href: "https://github.com/tachybase/tachybase",
                            icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.GithubFilled, {}, "GithubFilled")
                        })
                    ];
                },
                pageTitleRender: false,
                headerTitleRender: (logo, title, _)=>{
                    const defaultDom = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
                        children: [
                            logo,
                            title
                        ]
                    });
                    if ('undefined' == typeof window) return defaultDom;
                    if (document.body.clientWidth < 1400) return defaultDom;
                    if (_.isMobile) return defaultDom;
                    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
                        children: defaultDom
                    });
                },
                ...settings,
                headerContentRender: ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__admin_layout_index_mjs__.NoticeArea, {}),
                contentStyle: {
                    padding: 0
                },
                children: fullscreen ? children : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_components__.PageContainer, {
                    children: children
                })
            })
        })
    });
};
export { SettingLayout };
