"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    default: ()=>demo2_rslib_entry_
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const external_react_namespaceObject = require("react");
const client_namespaceObject = require("@tachybase/client");
const external_react_router_dom_namespaceObject = require("react-router-dom");
const Root = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Link, {
                to: '/',
                children: "Home"
            }),
            "|",
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Link, {
                to: '/admin',
                children: "Admin"
            }),
            "|",
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Link, {
                to: '/admin/setting',
                children: "Admin Setting"
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Outlet, {})
        ]
    });
const Home = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
        children: "Home"
    });
const Admin = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                children: "Admin"
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Outlet, {})
        ]
    });
const MobileLayout = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                children: "MobileLayout"
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Link, {
                to: '/mobile/123',
                children: "Mobile 123"
            }),
            "|",
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Link, {
                to: '/mobile/456',
                children: "Mobile 456"
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Outlet, {})
        ]
    });
const MobilePage = ()=>{
    const { id } = (0, external_react_router_dom_namespaceObject.useParams)();
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            "id: ",
            id
        ]
    });
};
const AdminSetting = ()=>{
    const app = (0, client_namespaceObject.useApp)();
    const MobileRouter = (0, external_react_namespaceObject.useMemo)(()=>{
        const router = new client_namespaceObject.RouterManager({
            type: 'memory',
            initialEntries: [
                '/'
            ]
        }, app);
        router.add('mobile', {
            element: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MobileLayout, {})
        });
        router.add('mobile.index', {
            path: '/',
            element: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Navigate, {
                replace: true,
                to: "/mobile/123"
            })
        });
        router.add('mobile.page', {
            path: '/mobile/:id',
            element: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MobilePage, {})
        });
        return router.getRouterComponent();
    }, [
        app
    ]);
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                children: "AdminSetting"
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MobileRouter, {})
        ]
    });
};
class TachybasePresetPlugin extends client_namespaceObject.Plugin {
    async load() {
        this.router.add('root', {
            path: '/',
            element: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Root, {})
        });
        this.router.add('root.home', {
            path: '/',
            element: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Home, {})
        });
        this.router.add('root.admin', {
            path: '/admin',
            element: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Admin, {})
        });
        this.router.add('root.admin.setting', {
            path: '/admin/setting',
            element: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AdminSetting, {})
        });
    }
}
const demo2_rslib_entry_app = new client_namespaceObject.Application({
    router: {
        type: 'hash'
    },
    plugins: [
        TachybasePresetPlugin
    ]
});
const demo2_rslib_entry_ = demo2_rslib_entry_app.getRootComponent();
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
