import { j as jsxRuntimeExports, S as Slot, r as reactExports, C as Children } from "../index.js";
import "../__vite_rsc_assets_manifest.js";
import "node:async_hooks";
const RouterContext = /* @__PURE__ */ reactExports.createContext(null);
const notAvailableInServer = (name) => () => {
  throw new Error(`${name} is not in the server`);
};
function renderError(message) {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("html", {
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("head", {
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("title", {
          children: "Unhandled Error"
        })
      }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("body", {
        style: {
          height: "100vh",
          display: "flex",
          flexDirection: "column",
          placeContent: "center",
          placeItems: "center",
          fontSize: "16px",
          margin: 0
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("h1", {
            children: "Caught an unexpected error"
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("p", {
            children: [
              "Error: ",
              message
            ]
          })
        ]
      })
    ]
  });
}
class ErrorBoundary extends reactExports.Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  static getDerivedStateFromError(error) {
    return {
      error
    };
  }
  render() {
    if ("error" in this.state) {
      if (this.state.error instanceof Error) {
        return renderError(this.state.error.message);
      }
      return renderError(String(this.state.error));
    }
    return this.props.children;
  }
}
const getRouteSlotId = (path) => "route:" + path;
const MOCK_ROUTE_CHANGE_LISTENER = {
  on: () => notAvailableInServer("routeChange:on"),
  off: () => notAvailableInServer("routeChange:off")
};
function INTERNAL_ServerRouter({ route, httpstatus }) {
  const routeElement = /* @__PURE__ */ jsxRuntimeExports.jsx(Slot, {
    id: getRouteSlotId(route.path)
  });
  const rootElement = /* @__PURE__ */ jsxRuntimeExports.jsxs(Slot, {
    id: "root",
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("meta", {
        name: "httpstatus",
        content: `${httpstatus}`
      }),
      routeElement
    ]
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(RouterContext, {
      value: {
        route,
        changeRoute: notAvailableInServer("changeRoute"),
        prefetchRoute: notAvailableInServer("prefetchRoute"),
        routeChangeEvents: MOCK_ROUTE_CHANGE_LISTENER,
        fetchingSlices: /* @__PURE__ */ new Set()
      },
      children: rootElement
    })
  });
}
const export_847a2b1045ef = {
  Children,
  Slot
};
const export_6d786e16fc6b = {
  ErrorBoundary,
  INTERNAL_ServerRouter
};
export {
  export_6d786e16fc6b,
  export_847a2b1045ef
};
