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_client__ from "@tachybase/client";
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom__ from "react-router-dom";
const Root = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/',
                children: "Home"
            }),
            "|",
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/admin',
                children: "Admin"
            }),
            "|",
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/admin/setting',
                children: "Admin Setting"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Outlet, {})
        ]
    });
const Home = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
        children: "Home"
    });
const Admin = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
                children: "Admin"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Outlet, {})
        ]
    });
const MobileLayout = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
                children: "MobileLayout"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/mobile/123',
                children: "Mobile 123"
            }),
            "|",
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/mobile/456',
                children: "Mobile 456"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Outlet, {})
        ]
    });
const MobilePage = ()=>{
    const { id } = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useParams)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            "id: ",
            id
        ]
    });
};
const AdminSetting = ()=>{
    const app = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useApp)();
    const MobileRouter = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
        const router = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.RouterManager({
            type: 'memory',
            initialEntries: [
                '/'
            ]
        }, app);
        router.add('mobile', {
            element: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(MobileLayout, {})
        });
        router.add('mobile.index', {
            path: '/',
            element: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Navigate, {
                replace: true,
                to: "/mobile/123"
            })
        });
        router.add('mobile.page', {
            path: '/mobile/:id',
            element: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(MobilePage, {})
        });
        return router.getRouterComponent();
    }, [
        app
    ]);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
                children: "AdminSetting"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(MobileRouter, {})
        ]
    });
};
class TachybasePresetPlugin extends __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Plugin {
    async load() {
        this.router.add('root', {
            path: '/',
            element: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Root, {})
        });
        this.router.add('root.home', {
            path: '/',
            element: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Home, {})
        });
        this.router.add('root.admin', {
            path: '/admin',
            element: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Admin, {})
        });
        this.router.add('root.admin.setting', {
            path: '/admin/setting',
            element: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AdminSetting, {})
        });
    }
}
const demo2_rslib_entry_app = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Application({
    router: {
        type: 'hash'
    },
    plugins: [
        TachybasePresetPlugin
    ]
});
const demo2_rslib_entry_ = demo2_rslib_entry_app.getRootComponent();
export { demo2_rslib_entry_ as default };
