import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { DataProvider } from "./data/index.js";
import { getOrigin } from "../../listen/config.js";
import { UnauthenticatedLayout, Layout } from "./layout.js";
export * from "./data/index.js";
export * from "./paths/index.js";
export * from "./layout.js";
export default function OpenNetworkServer(options) {
    const { pathname } = new URL(options.url, getOrigin());
    const { view: { Component } } = options;
    if (!Component) {
        return _jsxs("div", { children: ["Could not find ", pathname] });
    }
    let children = _jsx(Component, {});
    if (!options.isFragment) {
        const layoutProps = {
            url: options.url,
        };
        if (options.isUnauthenticated) {
            children = _jsx(UnauthenticatedLayout, { ...layoutProps, children: children });
        }
        else {
            children = _jsx(Layout, { ...layoutProps, children: children });
        }
    }
    return _jsx(DataProvider, { value: options, children: children });
}
//# sourceMappingURL=index.js.map