import { createContext, useContext, createElement } from 'react';

// src/router/context.ts
var RouterContext = createContext(null);
function useRouterContext() {
  const ctx = useContext(RouterContext);
  if (!ctx) {
    throw new Error(
      "useRouterContext must be used within a RouterProvider. Wrap your app with <TanStackRouterBridge> or a custom RouterProvider."
    );
  }
  return ctx;
}
function RouterProvider({ value, children }) {
  return createElement(RouterContext.Provider, { value }, children);
}

export { RouterProvider, useRouterContext };
