import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "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: '/hello',
                children: "Hello"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/team',
                children: "Team"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/about',
                children: "About"
            }),
            /*#__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: "this is Home"
    });
const Team = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            "Team ",
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Link, {
                to: '/about',
                children: "About"
            })
        ]
    });
const About = ()=>/*#__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: '/team',
                children: "Team"
            }),
            " About"
        ]
    });
class Test1Plugin extends __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Plugin {
    async load() {
        this.router.add('root.team', {
            path: 'team',
            Component: 'Team'
        });
    }
}
class Test2Plugin extends __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Plugin {
    async load() {
        this.router.add('root.about', {
            path: 'about',
            Component: 'About'
        });
    }
}
class TachybasePresetPlugin extends __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Plugin {
    async afterAdd() {
        await this.addRemotePlugin();
    }
    async addRemotePlugin() {
        await this.pm.add(Test1Plugin);
        await this.pm.add(Test2Plugin);
    }
    async load() {
        this.router.add('root', {
            path: '/',
            Component: 'Root'
        });
        this.router.add('root.home', {
            path: '/',
            Component: 'Home'
        });
    }
}
const app = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Application({
    apiClient: {
        baseURL: process.env.API_BASE_URL
    },
    router: {
        type: 'hash'
    },
    plugins: [
        TachybasePresetPlugin
    ],
    components: {
        Root,
        Home,
        Team,
        About
    }
});
const HelloProvider = (props)=>{
    const location = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useLocation)();
    if ('/hello' === location.pathname) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
        children: "Hello"
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
        children: props.children
    });
};
app.use(HelloProvider);
const demo1_rslib_entry_ = app.getRootComponent();
export { demo1_rslib_entry_ as default };
