import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import {} from 'react-router';
import {} from '../types';
const RouterContext = React.createContext(null);
export function RouterContextProvider({ children, routeDefinitions, routeObjects, routeDefMap, defaultPath, routeMatches, }) {
    const value = React.useMemo(() => ({
        routeDefinitions,
        routeObjects,
        routeDefMap,
        defaultPath,
        routeMatches,
    }), [routeDefinitions, routeObjects, routeDefMap, defaultPath, routeMatches]);
    return _jsx(RouterContext.Provider, { value: value, children: children });
}
export function useRouterContext() {
    const context = React.useContext(RouterContext);
    if (!context) {
        throw new Error('useRouterContext must be used within a RouterContextProvider');
    }
    return context;
}
//# sourceMappingURL=context.js.map