import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_components__ from "@tachybase/components";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__ from "@ant-design/pro-layout";
import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__ from "@dnd-kit/core";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
import * as __WEBPACK_EXTERNAL_MODULE_classnames__ from "classnames";
import * as __WEBPACK_EXTERNAL_MODULE_react_error_boundary__ from "react-error-boundary";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom__ from "react-router-dom";
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "../index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__ from "../__builtins__/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__built_in_acl_style_mjs__ from "../../../built-in/acl/style.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__ from "../../../built-in/context-menu/useContextMenu.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__built_in_document_title_index_mjs__ from "../../../built-in/document-title/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__filter_provider_FilterProvider_mjs__ from "../../../filter-provider/FilterProvider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__icon_index_mjs__ from "../../../icon/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelOfSchemaInitializer_mjs__ from "../../../schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__ from "../../../style/theme/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__common_index_mjs__ from "../../common/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__ from "../../common/sortable-item/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__common_sortable_item_DragHandlePageTab_mjs__ from "../../common/sortable-item/DragHandlePageTab.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__core_index_mjs__ from "../../core/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__ from "../error-fallback/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__ from "./FixedBlock.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__hooks_useShareActions_mjs__ from "./hooks/useShareActions.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__ from "./Page.style.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__PageDesigner_mjs__ from "./PageDesigner.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__ from "./PageTabDesigner.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
const Page = (props)=>{
    var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
    const { children, ...others } = props;
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const { title, setTitle } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_document_title_index_mjs__.useDocumentTitle)();
    const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const disablePageHeader = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.disablePageHeader;
    const enablePageTabs = null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.enablePageTabs;
    const enableSharePage = null === (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops2 ? void 0 : _fieldSchema_xcomponentprops2.enableSharePage;
    const [searchParams, setSearchParams] = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useSearchParams)();
    const [loading, setLoading] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
    const activeKey = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>searchParams.get('tab') || Object.keys(fieldSchema.properties || {}).shift(), [
        fieldSchema.properties,
        searchParams
    ]);
    const [height, setHeight] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
    const aclStyles = (0, __WEBPACK_EXTERNAL_MODULE__built_in_acl_style_mjs__.useStyles)();
    const { wrapSSR, hashId, componentCls } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.getStyles)();
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        if (!title) setTitle(t(fieldSchema.title));
    }, [
        fieldSchema.title,
        title
    ]);
    return wrapSSR(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__filter_provider_FilterProvider_mjs__.FilterBlockProvider, {
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
            className: "".concat(componentCls, " ").concat(hashId, " ").concat(aclStyles.styles),
            children: [
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageDesigner_mjs__.PageDesigner, {
                    title: fieldSchema.title || title
                }),
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(PageHeader, {
                    disablePageHeader: disablePageHeader,
                    enablePageTabs: enablePageTabs,
                    activeKey: activeKey,
                    title: title,
                    fieldSchema: fieldSchema,
                    parentProps: others,
                    setHeight: setHeight,
                    setLoading: setLoading,
                    enableSharePage: enableSharePage,
                    setSearchParams: setSearchParams
                }),
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(PageContentComponent, {
                    loading: loading,
                    disablePageHeader: disablePageHeader,
                    enablePageTabs: enablePageTabs,
                    fieldSchema: fieldSchema,
                    activeKey: activeKey,
                    height: height,
                    children: children
                })
            ]
        })
    }));
};
const PageHeader = (props)=>{
    var _fieldSchema_xcomponentprops;
    const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps, enableSharePage } = props;
    const { theme } = (0, __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__.useGlobalTheme)();
    const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
    const compile = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCompile)();
    const [open, setOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
    const [imageOpen, setImageOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
    const { showScrollArea } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__.useContextMenu)();
    const hidePageTitle = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
    const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
    const isShare = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useMatch)('/share/:name');
    const items = fieldSchema.mapProperties((schema)=>({
            key: schema.name,
            label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabItem, {
                schema: schema
            })
        }));
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
    const { copyLink, imageAction } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_useShareActions_mjs__.useShareActions)({
        title: pageHeaderTitle,
        uid: ''
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        ref: (ref)=>{
            setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
        },
        className: "tb-page-header-wrapper",
        children: [
            !disablePageHeader && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader, {
                className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('pageHeaderCss', pageHeaderTitle || enableSharePage ? '' : 'height0'),
                ghost: false,
                title: pageHeaderTitle || ' ',
                ...parentProps,
                extra: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(HeaderExtra, {
                    enablePageTabs: enablePageTabs,
                    showScrollArea: showScrollArea,
                    isShare: isShare,
                    setOpen: setOpen,
                    enableSharePage: enableSharePage
                }),
                footer: enablePageTabs && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabComponent, {
                    activeKey: activeKey,
                    setLoading: setLoading,
                    setSearchParams: setSearchParams,
                    showScrollArea: showScrollArea,
                    options: options,
                    theme: theme,
                    items: items
                })
            }),
            disablePageHeader && enableSharePage && !isShare && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
                className: "tb-page-header-button",
                children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                    icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.ShareAltOutlined, {}),
                    onClick: ()=>{
                        setOpen(true);
                    },
                    children: t('Share')
                })
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_antd__.Modal, {
                open: open,
                className: styles.firstmodal,
                title: t('Share'),
                footer: null,
                width: 500,
                onCancel: ()=>{
                    setOpen(false);
                },
                children: [
                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
                        className: styles.secondmodal,
                        children: [
                            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
                                className: "tb-header-modal-list",
                                onClick: copyLink,
                                children: [
                                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
                                        type: "PaperClipOutlined"
                                    }),
                                    t('Copy link')
                                ]
                            }),
                            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
                                className: "tb-header-modal-list",
                                onClick: ()=>{
                                    setImageOpen(true);
                                },
                                children: [
                                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
                                        type: "QrcodeOutlined"
                                    }),
                                    t('Generate QR code')
                                ]
                            })
                        ]
                    }),
                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Modal, {
                        className: styles.imageModal,
                        open: imageOpen,
                        footer: null,
                        onCancel: ()=>{
                            setImageOpen(false);
                        },
                        children: imageAction()
                    })
                ]
            })
        ]
    });
};
const HeaderExtra = (param)=>{
    let { enablePageTabs, showScrollArea, isShare, setOpen, enableSharePage } = param;
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
        children: [
            !isShare && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.ShareAltOutlined, {}),
                onClick: ()=>{
                    setOpen(true);
                },
                style: {
                    visibility: "".concat(enableSharePage ? 'visible' : 'hidden')
                }
            }),
            !enablePageTabs && showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {})
        ]
    });
};
const TabComponent = (props)=>{
    const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
    const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
    const [hasMounted, setHasMounted] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
    const sensors = (0, __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.useSensors)((0, __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.useSensor)(__WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.PointerSensor, {
        activationConstraint: {
            distance: 5
        }
    }));
    const handleTabClick = (activeKey)=>{
        setLoading(true);
        setSearchParams([
            [
                'tab',
                activeKey
            ]
        ]);
        setTimeout(()=>{
            setLoading(false);
        }, 50);
    };
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        setTimeout(()=>{
            setHasMounted(true);
        });
    }, []);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_index_mjs__.DndContext, {
        sensors: sensors,
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tabs, {
            className: styles.tabComponentClass,
            type: "card",
            size: 'small',
            animated: hasMounted,
            activeKey: activeKey,
            items: items,
            onTabClick: handleTabClick,
            tabBarExtraContent: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabBarExtraContent, {
                theme: theme,
                showScrollArea: showScrollArea,
                options: options
            })
        })
    });
};
const TabItem = (props)=>{
    const { schema } = props;
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__.SortableItem, {
        id: schema.name,
        schema: schema,
        className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('tb-action-link', 'designerCss', props.className, styles.tabItemClass),
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_DragHandlePageTab_mjs__.DragHandlePageTab, {
            children: [
                schema['x-icon'] && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
                    style: {
                        marginRight: 8
                    },
                    type: schema['x-icon']
                }),
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
                    children: schema.title || t('Unnamed')
                }),
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
                    className: "tab-designer-wrapper",
                    children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__.PageTabDesigner, {
                        schema: schema
                    })
                })
            ]
        })
    });
};
const TabBarExtraContent = (props)=>{
    const { showScrollArea, options, theme } = props;
    const dn = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const { getAriaLabel } = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelOfSchemaInitializer_mjs__.useGetAriaLabelOfSchemaInitializer)();
    const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
    const handleAddTab = async ()=>{
        const values = await (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.FormDialog)(t('Add tab'), ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AddTabForm, {
                options: options
            }), theme).open({
            initialValues: {}
        });
        const { title, icon } = values;
        dn.insertBeforeEnd({
            type: 'void',
            title,
            'x-icon': icon,
            'x-component': 'Grid',
            'x-initializer': 'page:addBlock',
            properties: {}
        });
    };
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        className: (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.cx)(styles.tabWrapper, {
            designable: dn.designable
        }),
        children: [
            dn.designable && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                className: "add-tab-btn",
                type: "text",
                "aria-label": getAriaLabel('tabs'),
                icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.PlusOutlined, {}),
                onClick: handleAddTab
            }),
            showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {
                className: "scroll-area-extra-content"
            })
        ]
    });
};
const AddTabForm = (props)=>{
    const { options } = props;
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__core_index_mjs__.SchemaComponentOptions, {
        scope: options.scope,
        components: {
            ...options.components
        },
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_components__.FormLayout, {
            layout: 'vertical',
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__core_index_mjs__.SchemaComponent, {
                schema: {
                    properties: {
                        title: {
                            title: t('Tab name'),
                            'x-component': 'Input',
                            'x-decorator': 'FormItem',
                            required: true
                        },
                        icon: {
                            title: t('Icon'),
                            'x-component': 'IconPicker',
                            'x-decorator': 'FormItem'
                        }
                    }
                }
            })
        })
    });
};
const PageContentComponent = (props)=>{
    const handleErrors = (error)=>{
        var _window_Sentry, _window;
        null === (_window = window) || void 0 === _window || null === (_window_Sentry = _window.Sentry) || void 0 === _window_Sentry || _window_Sentry.captureException(error);
        console.error(error);
    };
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
        className: "tb-page-wrapper",
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_error_boundary__.ErrorBoundary, {
            FallbackComponent: __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__.ErrorFallback,
            onError: handleErrors,
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(PageContent, {
                ...props
            })
        })
    });
};
const PageContent = (props)=>{
    const { loading, disablePageHeader, enablePageTabs, fieldSchema, activeKey, height, children } = props;
    const { token } = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.useToken)();
    if (loading) return;
    if (!disablePageHeader && enablePageTabs) return fieldSchema.mapProperties((schema)=>{
        if (schema.name !== activeKey) return null;
        return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__["default"], {
            height: "calc(".concat(height, "px + 46px + ").concat(token.marginLG, "px * 2)"),
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__core_index_mjs__.SchemaComponent, {
                schema: new __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.Schema({
                    properties: {
                        [schema.name]: schema
                    }
                })
            })
        }, schema.name);
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__["default"], {
        height: "calc(".concat(height, "px + 46px + ").concat(token.marginLG, "px * 2)"),
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
            className: "pageWithFixedBlockCss tb-page-content",
            children: children
        })
    });
};
export { Page };
