@tanstack/react-router
Advanced tools
Comparing version 0.0.1-beta.167 to 0.0.1-beta.168
@@ -15,647 +15,51 @@ /** | ||
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js'); | ||
var React = require('react'); | ||
var reactStore = require('@tanstack/react-store'); | ||
var invariant = require('tiny-invariant'); | ||
var warning = require('tiny-warning'); | ||
var routerCore = require('@tanstack/router-core'); | ||
var react = require('./react.js'); | ||
var scrollRestoration = require('./scroll-restoration.js'); | ||
var deferred = require('./deferred.js'); | ||
var awaited = require('./awaited.js'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant); | ||
var warning__default = /*#__PURE__*/_interopDefaultLegacy(warning); | ||
routerCore.Route.__onInit = route => { | ||
Object.assign(route, { | ||
useMatch: (opts = {}) => { | ||
return useMatch({ | ||
...opts, | ||
from: route.id | ||
}); | ||
}, | ||
useLoader: (opts = {}) => { | ||
return useLoader({ | ||
...opts, | ||
from: route.id | ||
}); | ||
}, | ||
useContext: (opts = {}) => { | ||
return useMatch({ | ||
...opts, | ||
from: route.id, | ||
select: d => opts?.select?.(d.context) ?? d.context | ||
}); | ||
}, | ||
useRouteContext: (opts = {}) => { | ||
return useMatch({ | ||
...opts, | ||
from: route.id, | ||
select: d => opts?.select?.(d.routeContext) ?? d.routeContext | ||
}); | ||
}, | ||
useSearch: (opts = {}) => { | ||
return useSearch({ | ||
...opts, | ||
from: route.id | ||
}); | ||
}, | ||
useParams: (opts = {}) => { | ||
return useParams({ | ||
...opts, | ||
from: route.id | ||
}); | ||
} | ||
}); | ||
}; | ||
// | ||
function lazyRouteComponent(importer, exportName) { | ||
let loadPromise; | ||
const load = () => { | ||
if (!loadPromise) { | ||
loadPromise = importer(); | ||
} | ||
return loadPromise; | ||
}; | ||
const lazyComp = /*#__PURE__*/React__namespace.lazy(async () => { | ||
const moduleExports = await load(); | ||
const comp = moduleExports[exportName ?? 'default']; | ||
return { | ||
default: comp | ||
}; | ||
}); | ||
lazyComp.preload = load; | ||
return lazyComp; | ||
} | ||
// | ||
function useLinkProps(options) { | ||
const router = useRouter(); | ||
const { | ||
// custom props | ||
type, | ||
children, | ||
target, | ||
activeProps = () => ({ | ||
className: 'active' | ||
}), | ||
inactiveProps = () => ({}), | ||
activeOptions, | ||
disabled, | ||
// fromCurrent, | ||
hash, | ||
search, | ||
params, | ||
to = '.', | ||
preload, | ||
preloadDelay, | ||
replace, | ||
// element props | ||
style, | ||
className, | ||
onClick, | ||
onFocus, | ||
onMouseEnter, | ||
onMouseLeave, | ||
onTouchStart, | ||
...rest | ||
} = options; | ||
const linkInfo = router.buildLink(options); | ||
if (linkInfo.type === 'external') { | ||
const { | ||
href | ||
} = linkInfo; | ||
return { | ||
href | ||
}; | ||
} | ||
const { | ||
handleClick, | ||
handleFocus, | ||
handleEnter, | ||
handleLeave, | ||
handleTouchStart, | ||
isActive, | ||
next | ||
} = linkInfo; | ||
const handleReactClick = e => { | ||
if (options.startTransition ?? true) { | ||
(React__namespace.startTransition || (d => d))(() => { | ||
handleClick(e); | ||
}); | ||
} | ||
}; | ||
const composeHandlers = handlers => e => { | ||
if (e.persist) e.persist(); | ||
handlers.filter(Boolean).forEach(handler => { | ||
if (e.defaultPrevented) return; | ||
handler(e); | ||
}); | ||
}; | ||
// Get the active props | ||
const resolvedActiveProps = isActive ? routerCore.functionalUpdate(activeProps, {}) ?? {} : {}; | ||
// Get the inactive props | ||
const resolvedInactiveProps = isActive ? {} : routerCore.functionalUpdate(inactiveProps, {}) ?? {}; | ||
return { | ||
...resolvedActiveProps, | ||
...resolvedInactiveProps, | ||
...rest, | ||
href: disabled ? undefined : next.href, | ||
onClick: composeHandlers([onClick, handleReactClick]), | ||
onFocus: composeHandlers([onFocus, handleFocus]), | ||
onMouseEnter: composeHandlers([onMouseEnter, handleEnter]), | ||
onMouseLeave: composeHandlers([onMouseLeave, handleLeave]), | ||
onTouchStart: composeHandlers([onTouchStart, handleTouchStart]), | ||
target, | ||
style: { | ||
...style, | ||
...resolvedActiveProps.style, | ||
...resolvedInactiveProps.style | ||
}, | ||
className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined, | ||
...(disabled ? { | ||
role: 'link', | ||
'aria-disabled': true | ||
} : undefined), | ||
['data-status']: isActive ? 'active' : undefined | ||
}; | ||
} | ||
const Link = /*#__PURE__*/React__namespace.forwardRef((props, ref) => { | ||
const linkProps = useLinkProps(props); | ||
return /*#__PURE__*/React__namespace.createElement("a", _rollupPluginBabelHelpers["extends"]({ | ||
ref: ref | ||
}, linkProps, { | ||
children: typeof props.children === 'function' ? props.children({ | ||
isActive: linkProps['data-status'] === 'active' | ||
}) : props.children | ||
})); | ||
}); | ||
function Navigate(props) { | ||
const router = useRouter(); | ||
React__namespace.useLayoutEffect(() => { | ||
router.navigate(props); | ||
}, []); | ||
return null; | ||
} | ||
const matchIdsContext = /*#__PURE__*/React__namespace.createContext(null); | ||
const routerContext = /*#__PURE__*/React__namespace.createContext(null); | ||
function useRouterState(opts) { | ||
const router = useRouter(); | ||
return reactStore.useStore(router.__store, opts?.select); | ||
} | ||
function RouterProvider({ | ||
router, | ||
...rest | ||
}) { | ||
router.update(rest); | ||
React__namespace.useEffect(() => { | ||
let unsub; | ||
React__namespace.startTransition(() => { | ||
unsub = router.mount(); | ||
}); | ||
return unsub; | ||
}, [router]); | ||
const Wrap = router.options.Wrap || React__namespace.Fragment; | ||
return /*#__PURE__*/React__namespace.createElement(Wrap, null, /*#__PURE__*/React__namespace.createElement(routerContext.Provider, { | ||
value: router | ||
}, /*#__PURE__*/React__namespace.createElement(Matches, null))); | ||
} | ||
function Matches() { | ||
const router = useRouter(); | ||
const matchIds = useRouterState({ | ||
select: state => { | ||
const hasPendingComponent = state.pendingMatches.some(d => { | ||
const route = router.getRoute(d.routeId); | ||
return !!route?.options.pendingComponent; | ||
}); | ||
if (hasPendingComponent) { | ||
return state.pendingMatchIds; | ||
} | ||
return state.matchIds; | ||
} | ||
}); | ||
return /*#__PURE__*/React__namespace.createElement(matchIdsContext.Provider, { | ||
value: [undefined, ...matchIds] | ||
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, { | ||
errorComponent: ErrorComponent, | ||
route: router.getRoute(routerCore.rootRouteId), | ||
onCatch: () => { | ||
warning__default["default"](false, `Error in router! Consider setting an 'errorComponent' in your RootRoute! 👍`); | ||
} | ||
}, /*#__PURE__*/React__namespace.createElement(Outlet, null))); | ||
} | ||
function useRouter() { | ||
const value = React__namespace.useContext(routerContext); | ||
warning__default["default"](value, 'useRouter must be used inside a <Router> component!'); | ||
return value; | ||
} | ||
function useMatches(opts) { | ||
const matchIds = React__namespace.useContext(matchIdsContext); | ||
return useRouterState({ | ||
select: state => { | ||
const matches = state.matches.slice(state.matches.findIndex(d => d.id === matchIds[0])); | ||
return opts?.select?.(matches) ?? matches; | ||
} | ||
}); | ||
} | ||
function useMatch(opts) { | ||
const router = useRouter(); | ||
const nearestMatchId = React__namespace.useContext(matchIdsContext)[0]; | ||
const nearestMatchRouteId = router.getRouteMatch(nearestMatchId)?.routeId; | ||
const matchRouteId = useRouterState({ | ||
select: state => { | ||
const matches = state.matches; | ||
const match = opts?.from ? matches.find(d => d.routeId === opts?.from) : matches.find(d => d.id === nearestMatchId); | ||
return match.routeId; | ||
} | ||
}); | ||
if (opts?.strict ?? true) { | ||
invariant__default["default"](nearestMatchRouteId == matchRouteId, `useMatch("${matchRouteId}") is being called in a component that is meant to render the '${nearestMatchRouteId}' route. Did you mean to 'useMatch("${matchRouteId}", { strict: false })' or 'useRoute("${matchRouteId}")' instead?`); | ||
} | ||
const match = useRouterState({ | ||
select: state => { | ||
const matches = state.matches; | ||
const match = opts?.from ? matches.find(d => d.routeId === opts?.from) : matches.find(d => d.id === nearestMatchId); | ||
invariant__default["default"](match, `Could not find ${opts?.from ? `an active match from "${opts.from}"` : 'a nearest match!'}`); | ||
return opts?.select?.(match) ?? match; | ||
} | ||
}); | ||
return match; | ||
} | ||
function useLoader(opts) { | ||
return useMatch({ | ||
...opts, | ||
select: match => opts?.select?.(match.loaderData) ?? match.loaderData | ||
}); | ||
} | ||
function useRouterContext(opts) { | ||
return useMatch({ | ||
...opts, | ||
select: match => opts?.select?.(match.context) ?? match.context | ||
}); | ||
} | ||
function useRouteContext(opts) { | ||
return useMatch({ | ||
...opts, | ||
select: match => opts?.select?.(match.routeContext) ?? match.routeContext | ||
}); | ||
} | ||
function useSearch(opts) { | ||
return useMatch({ | ||
...opts, | ||
select: match => { | ||
return opts?.select?.(match.search) ?? match.search; | ||
} | ||
}); | ||
} | ||
function useParams(opts) { | ||
return useRouterState({ | ||
select: state => { | ||
const params = routerCore.last(state.matches)?.params; | ||
return opts?.select?.(params) ?? params; | ||
} | ||
}); | ||
} | ||
function useNavigate(defaultOpts) { | ||
const router = useRouter(); | ||
return React__namespace.useCallback(opts => { | ||
return router.navigate({ | ||
...defaultOpts, | ||
...opts | ||
}); | ||
}, []); | ||
} | ||
function useMatchRoute() { | ||
const router = useRouter(); | ||
return React__namespace.useCallback(opts => { | ||
const { | ||
pending, | ||
caseSensitive, | ||
...rest | ||
} = opts; | ||
return router.matchRoute(rest, { | ||
pending, | ||
caseSensitive | ||
}); | ||
}, []); | ||
} | ||
function MatchRoute(props) { | ||
const matchRoute = useMatchRoute(); | ||
const params = matchRoute(props); | ||
if (typeof props.children === 'function') { | ||
return props.children(params); | ||
} | ||
return !!params ? props.children : null; | ||
} | ||
function Outlet() { | ||
const matchIds = React__namespace.useContext(matchIdsContext).slice(1); | ||
if (!matchIds[0]) { | ||
return null; | ||
} | ||
return /*#__PURE__*/React__namespace.createElement(Match, { | ||
matchIds: matchIds | ||
}); | ||
} | ||
const defaultPending = () => null; | ||
function Match({ | ||
matchIds | ||
}) { | ||
const router = useRouter(); | ||
const matchId = matchIds[0]; | ||
const routeId = router.getRouteMatch(matchId).routeId; | ||
const route = router.getRoute(routeId); | ||
const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent ?? defaultPending; | ||
const errorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent ?? ErrorComponent; | ||
const ResolvedSuspenseBoundary = route.options.wrapInSuspense ?? !route.isRoot ? React__namespace.Suspense : SafeFragment; | ||
const ResolvedCatchBoundary = !!errorComponent ? CatchBoundary : SafeFragment; | ||
return /*#__PURE__*/React__namespace.createElement(matchIdsContext.Provider, { | ||
value: matchIds | ||
}, /*#__PURE__*/React__namespace.createElement(ResolvedSuspenseBoundary, { | ||
fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, { | ||
useMatch: route.useMatch, | ||
useContext: route.useContext, | ||
useRouteContext: route.useRouteContext, | ||
useSearch: route.useSearch, | ||
useParams: route.useParams | ||
}) | ||
}, /*#__PURE__*/React__namespace.createElement(ResolvedCatchBoundary, { | ||
key: route.id, | ||
errorComponent: errorComponent, | ||
route: route, | ||
onCatch: () => { | ||
warning__default["default"](false, `Error in route match: ${matchId}`); | ||
} | ||
}, /*#__PURE__*/React__namespace.createElement(MatchInner, { | ||
matchId: matchId, | ||
PendingComponent: PendingComponent | ||
})))); | ||
} | ||
function MatchInner({ | ||
matchId, | ||
PendingComponent | ||
}) { | ||
const router = useRouter(); | ||
const match = useRouterState({ | ||
select: d => { | ||
const match = d.matchesById[matchId]; | ||
return routerCore.pick(match, ['status', 'loadPromise', 'routeId', 'error']); | ||
} | ||
}); | ||
const route = router.getRoute(match.routeId); | ||
if (match.status === 'error') { | ||
throw match.error; | ||
} | ||
if (match.status === 'pending') { | ||
return /*#__PURE__*/React__namespace.createElement(PendingComponent, { | ||
useLoader: route.useLoader, | ||
useMatch: route.useMatch, | ||
useContext: route.useContext, | ||
useRouteContext: route.useRouteContext, | ||
useSearch: route.useSearch, | ||
useParams: route.useParams | ||
}); | ||
} | ||
if (match.status === 'success') { | ||
let comp = route.options.component ?? router.options.defaultComponent; | ||
if (comp) { | ||
return /*#__PURE__*/React__namespace.createElement(comp, { | ||
useLoader: route.useLoader, | ||
useMatch: route.useMatch, | ||
useContext: route.useContext, | ||
useRouteContext: route.useRouteContext, | ||
useSearch: route.useSearch, | ||
useParams: route.useParams | ||
}); | ||
} | ||
return /*#__PURE__*/React__namespace.createElement(Outlet, null); | ||
} | ||
invariant__default["default"](false, 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!'); | ||
} | ||
function SafeFragment(props) { | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, props.children); | ||
} | ||
function useInjectHtml() { | ||
const router = useRouter(); | ||
return React__namespace.useCallback(html => { | ||
router.injectHtml(html); | ||
}, []); | ||
} | ||
function useDehydrate() { | ||
const router = useRouter(); | ||
return React__namespace.useCallback(function dehydrate(key, data) { | ||
return router.dehydrateData(key, data); | ||
}, []); | ||
} | ||
function useHydrate() { | ||
const router = useRouter(); | ||
return function hydrate(key) { | ||
return router.hydrateData(key); | ||
}; | ||
} | ||
// This is the messiest thing ever... I'm either seriously tired (likely) or | ||
// there has to be a better way to reset error boundaries when the | ||
// router's location key changes. | ||
class CatchBoundary extends React__namespace.Component { | ||
state = { | ||
error: false, | ||
info: undefined | ||
}; | ||
componentDidCatch(error, info) { | ||
this.props.onCatch(error, info); | ||
this.setState({ | ||
error, | ||
info | ||
}); | ||
} | ||
render() { | ||
return /*#__PURE__*/React__namespace.createElement(CatchBoundaryInner, _rollupPluginBabelHelpers["extends"]({}, this.props, { | ||
errorState: this.state, | ||
reset: () => this.setState({}) | ||
})); | ||
} | ||
} | ||
function CatchBoundaryInner(props) { | ||
const locationKey = useRouterState({ | ||
select: d => d.resolvedLocation.key | ||
}); | ||
const [activeErrorState, setActiveErrorState] = React__namespace.useState(props.errorState); | ||
const errorComponent = props.errorComponent ?? ErrorComponent; | ||
const prevKeyRef = React__namespace.useRef(''); | ||
React__namespace.useEffect(() => { | ||
if (activeErrorState) { | ||
if (locationKey !== prevKeyRef.current) { | ||
setActiveErrorState({}); | ||
} | ||
} | ||
prevKeyRef.current = locationKey; | ||
}, [activeErrorState, locationKey]); | ||
React__namespace.useEffect(() => { | ||
if (props.errorState.error) { | ||
setActiveErrorState(props.errorState); | ||
} | ||
// props.reset() | ||
}, [props.errorState.error]); | ||
if (props.errorState.error && activeErrorState.error) { | ||
return /*#__PURE__*/React__namespace.createElement(errorComponent, { | ||
...activeErrorState, | ||
useMatch: props.route.useMatch, | ||
useContext: props.route.useContext, | ||
useRouteContext: props.route.useRouteContext, | ||
useSearch: props.route.useSearch, | ||
useParams: props.route.useParams | ||
}); | ||
} | ||
return props.children; | ||
} | ||
function ErrorComponent({ | ||
error | ||
}) { | ||
const [show, setShow] = React__namespace.useState(process.env.NODE_ENV !== 'production'); | ||
return /*#__PURE__*/React__namespace.createElement("div", { | ||
style: { | ||
padding: '.5rem', | ||
maxWidth: '100%' | ||
} | ||
}, /*#__PURE__*/React__namespace.createElement("div", { | ||
style: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: '.5rem' | ||
} | ||
}, /*#__PURE__*/React__namespace.createElement("strong", { | ||
style: { | ||
fontSize: '1rem' | ||
} | ||
}, "Something went wrong!"), /*#__PURE__*/React__namespace.createElement("button", { | ||
style: { | ||
appearance: 'none', | ||
fontSize: '.6em', | ||
border: '1px solid currentColor', | ||
padding: '.1rem .2rem', | ||
fontWeight: 'bold', | ||
borderRadius: '.25rem' | ||
}, | ||
onClick: () => setShow(d => !d) | ||
}, show ? 'Hide Error' : 'Show Error')), /*#__PURE__*/React__namespace.createElement("div", { | ||
style: { | ||
height: '.25rem' | ||
} | ||
}), show ? /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("pre", { | ||
style: { | ||
fontSize: '.7em', | ||
border: '1px solid red', | ||
borderRadius: '.25rem', | ||
padding: '.3rem', | ||
color: 'red', | ||
overflow: 'auto' | ||
} | ||
}, error.message ? /*#__PURE__*/React__namespace.createElement("code", null, error.message) : null)) : null); | ||
} | ||
function useBlocker(message, condition = true) { | ||
const router = useRouter(); | ||
React__namespace.useEffect(() => { | ||
if (!condition) return; | ||
let unblock = router.history.block((retry, cancel) => { | ||
if (window.confirm(message)) { | ||
unblock(); | ||
retry(); | ||
} | ||
}); | ||
return unblock; | ||
}); | ||
} | ||
function Block({ | ||
message, | ||
condition, | ||
children | ||
}) { | ||
useBlocker(message, condition); | ||
return children ?? null; | ||
} | ||
function shallow(objA, objB) { | ||
if (Object.is(objA, objB)) { | ||
return true; | ||
} | ||
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | ||
return false; | ||
} | ||
const keysA = Object.keys(objA); | ||
if (keysA.length !== Object.keys(objB).length) { | ||
return false; | ||
} | ||
for (let i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
Object.defineProperty(exports, 'useStore', { | ||
enumerable: true, | ||
get: function () { return reactStore.useStore; } | ||
enumerable: true, | ||
get: function () { return reactStore.useStore; } | ||
}); | ||
exports.Block = react.Block; | ||
exports.ErrorComponent = react.ErrorComponent; | ||
exports.Link = react.Link; | ||
exports.MatchRoute = react.MatchRoute; | ||
exports.Navigate = react.Navigate; | ||
exports.Outlet = react.Outlet; | ||
exports.RouterProvider = react.RouterProvider; | ||
exports.lazyRouteComponent = react.lazyRouteComponent; | ||
exports.matchIdsContext = react.matchIdsContext; | ||
exports.routerContext = react.routerContext; | ||
exports.shallow = react.shallow; | ||
exports.useBlocker = react.useBlocker; | ||
exports.useDehydrate = react.useDehydrate; | ||
exports.useHydrate = react.useHydrate; | ||
exports.useInjectHtml = react.useInjectHtml; | ||
exports.useLinkProps = react.useLinkProps; | ||
exports.useLoader = react.useLoader; | ||
exports.useMatch = react.useMatch; | ||
exports.useMatchRoute = react.useMatchRoute; | ||
exports.useMatches = react.useMatches; | ||
exports.useNavigate = react.useNavigate; | ||
exports.useParams = react.useParams; | ||
exports.useRouteContext = react.useRouteContext; | ||
exports.useRouter = react.useRouter; | ||
exports.useRouterContext = react.useRouterContext; | ||
exports.useRouterState = react.useRouterState; | ||
exports.useSearch = react.useSearch; | ||
exports.ScrollRestoration = scrollRestoration.ScrollRestoration; | ||
exports.useScrollRestoration = scrollRestoration.useScrollRestoration; | ||
exports.Deferred = deferred.Deferred; | ||
exports.useDeferred = deferred.useDeferred; | ||
exports.Block = Block; | ||
exports.ErrorComponent = ErrorComponent; | ||
exports.Link = Link; | ||
exports.MatchRoute = MatchRoute; | ||
exports.Navigate = Navigate; | ||
exports.Outlet = Outlet; | ||
exports.RouterProvider = RouterProvider; | ||
exports.lazyRouteComponent = lazyRouteComponent; | ||
exports.matchIdsContext = matchIdsContext; | ||
exports.routerContext = routerContext; | ||
exports.shallow = shallow; | ||
exports.useBlocker = useBlocker; | ||
exports.useDehydrate = useDehydrate; | ||
exports.useHydrate = useHydrate; | ||
exports.useInjectHtml = useInjectHtml; | ||
exports.useLinkProps = useLinkProps; | ||
exports.useLoader = useLoader; | ||
exports.useMatch = useMatch; | ||
exports.useMatchRoute = useMatchRoute; | ||
exports.useMatches = useMatches; | ||
exports.useNavigate = useNavigate; | ||
exports.useParams = useParams; | ||
exports.useRouteContext = useRouteContext; | ||
exports.useRouter = useRouter; | ||
exports.useRouterContext = useRouterContext; | ||
exports.useRouterState = useRouterState; | ||
exports.useSearch = useSearch; | ||
exports.Await = awaited.Await; | ||
exports.useAwaited = awaited.useAwaited; | ||
Object.keys(routerCore).forEach(function (k) { | ||
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
get: function () { return routerCore[k]; } | ||
}); | ||
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
get: function () { return routerCore[k]; } | ||
}); | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -17,3 +17,3 @@ /** | ||
var routerCore = require('@tanstack/router-core'); | ||
var index = require('./index.js'); | ||
var react = require('./react.js'); | ||
@@ -42,3 +42,3 @@ function _interopNamespace(e) { | ||
function useScrollRestoration(options) { | ||
const router = index.useRouter(); | ||
const router = react.useRouter(); | ||
useLayoutEffect(() => { | ||
@@ -45,0 +45,0 @@ return routerCore.watchScrollPositions(router, options); |
@@ -11,9 +11,9 @@ /** | ||
*/ | ||
import * as React from 'react'; | ||
import { useStore } from '@tanstack/react-store'; | ||
export { useStore } from '@tanstack/react-store'; | ||
import { Route, functionalUpdate, rootRouteId, last, pick, watchScrollPositions, restoreScrollPositions, isDehydratedDeferred } from '@tanstack/router-core'; | ||
export * from '@tanstack/router-core'; | ||
import * as React from 'react'; | ||
import invariant from 'tiny-invariant'; | ||
import warning from 'tiny-warning'; | ||
import { watchScrollPositions, restoreScrollPositions, isDehydratedDeferred, Route, functionalUpdate, rootRouteId, last, pick } from '@tanstack/router-core'; | ||
export * from '@tanstack/router-core'; | ||
@@ -35,42 +35,2 @@ function _extends() { | ||
const useLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; | ||
function useScrollRestoration(options) { | ||
const router = useRouter(); | ||
useLayoutEffect(() => { | ||
return watchScrollPositions(router, options); | ||
}, []); | ||
useLayoutEffect(() => { | ||
restoreScrollPositions(router, options); | ||
}); | ||
} | ||
function ScrollRestoration(props) { | ||
useScrollRestoration(props); | ||
return null; | ||
} | ||
function useDeferred({ | ||
promise | ||
}) { | ||
const router = useRouter(); | ||
let state = promise.__deferredState; | ||
const key = `__TSR__DEFERRED__${state.uid}`; | ||
if (isDehydratedDeferred(promise)) { | ||
state = router.hydrateData(key); | ||
promise = Promise.resolve(state.data); | ||
promise.__deferredState = state; | ||
} | ||
if (state.status === 'pending') { | ||
throw promise; | ||
} | ||
if (state.status === 'error') { | ||
throw state.error; | ||
} | ||
router.dehydrateData(key, state); | ||
return [state.data]; | ||
} | ||
function Deferred(props) { | ||
const awaited = useDeferred(props); | ||
return props.children(...awaited); | ||
} | ||
Route.__onInit = route => { | ||
@@ -647,3 +607,43 @@ Object.assign(route, { | ||
export { Block, Deferred, ErrorComponent, Link, MatchRoute, Navigate, Outlet, RouterProvider, ScrollRestoration, lazyRouteComponent, matchIdsContext, routerContext, shallow, useBlocker, useDeferred, useDehydrate, useHydrate, useInjectHtml, useLinkProps, useLoader, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useRouteContext, useRouter, useRouterContext, useRouterState, useScrollRestoration, useSearch }; | ||
const useLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; | ||
function useScrollRestoration(options) { | ||
const router = useRouter(); | ||
useLayoutEffect(() => { | ||
return watchScrollPositions(router, options); | ||
}, []); | ||
useLayoutEffect(() => { | ||
restoreScrollPositions(router, options); | ||
}); | ||
} | ||
function ScrollRestoration(props) { | ||
useScrollRestoration(props); | ||
return null; | ||
} | ||
function useAwaited({ | ||
promise | ||
}) { | ||
const router = useRouter(); | ||
let state = promise.__deferredState; | ||
const key = `__TSR__DEFERRED__${state.uid}`; | ||
if (isDehydratedDeferred(promise)) { | ||
state = router.hydrateData(key); | ||
promise = Promise.resolve(state.data); | ||
promise.__deferredState = state; | ||
} | ||
if (state.status === 'pending') { | ||
throw promise; | ||
} | ||
if (state.status === 'error') { | ||
throw state.error; | ||
} | ||
router.dehydrateData(key, state); | ||
return [state.data]; | ||
} | ||
function Await(props) { | ||
const awaited = useAwaited(props); | ||
return props.children(...awaited); | ||
} | ||
export { Await, Block, ErrorComponent, Link, MatchRoute, Navigate, Outlet, RouterProvider, ScrollRestoration, lazyRouteComponent, matchIdsContext, routerContext, shallow, useAwaited, useBlocker, useDehydrate, useHydrate, useInjectHtml, useLinkProps, useLoader, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useRouteContext, useRouter, useRouterContext, useRouterState, useScrollRestoration, useSearch }; | ||
//# sourceMappingURL=index.js.map |
@@ -10,6 +10,2 @@ { | ||
{ | ||
"uid": "0688-179", | ||
"name": "\u0000rollupPluginBabelHelpers.js" | ||
}, | ||
{ | ||
"name": "packages", | ||
@@ -19,11 +15,11 @@ "children": [ | ||
"name": "store/build/esm/index.js", | ||
"uid": "0688-181" | ||
"uid": "56b6-181" | ||
}, | ||
{ | ||
"name": "react-store/build/esm/index.js", | ||
"uid": "0688-183" | ||
"uid": "56b6-183" | ||
}, | ||
{ | ||
"name": "router-core/build/esm/index.js", | ||
"uid": "0688-189" | ||
"uid": "56b6-189" | ||
}, | ||
@@ -34,11 +30,15 @@ { | ||
{ | ||
"uid": "0688-191", | ||
"uid": "56b6-193", | ||
"name": "react.tsx" | ||
}, | ||
{ | ||
"uid": "56b6-195", | ||
"name": "scroll-restoration.tsx" | ||
}, | ||
{ | ||
"uid": "0688-193", | ||
"name": "deferred.tsx" | ||
"uid": "56b6-197", | ||
"name": "awaited.tsx" | ||
}, | ||
{ | ||
"uid": "0688-195", | ||
"uid": "56b6-199", | ||
"name": "index.tsx" | ||
@@ -55,9 +55,13 @@ } | ||
"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js", | ||
"uid": "0688-185" | ||
"uid": "56b6-185" | ||
}, | ||
{ | ||
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js", | ||
"uid": "0688-187" | ||
"uid": "56b6-187" | ||
} | ||
] | ||
}, | ||
{ | ||
"uid": "56b6-191", | ||
"name": "\u0000rollupPluginBabelHelpers.js" | ||
} | ||
@@ -70,74 +74,68 @@ ] | ||
"nodeParts": { | ||
"0688-179": { | ||
"renderedLength": 429, | ||
"gzipLength": 238, | ||
"brotliLength": 0, | ||
"mainUid": "0688-178" | ||
}, | ||
"0688-181": { | ||
"56b6-181": { | ||
"renderedLength": 1843, | ||
"gzipLength": 644, | ||
"brotliLength": 0, | ||
"mainUid": "0688-180" | ||
"mainUid": "56b6-180" | ||
}, | ||
"0688-183": { | ||
"56b6-183": { | ||
"renderedLength": 1006, | ||
"gzipLength": 479, | ||
"brotliLength": 0, | ||
"mainUid": "0688-182" | ||
"mainUid": "56b6-182" | ||
}, | ||
"0688-185": { | ||
"56b6-185": { | ||
"renderedLength": 181, | ||
"gzipLength": 129, | ||
"brotliLength": 0, | ||
"mainUid": "0688-184" | ||
"mainUid": "56b6-184" | ||
}, | ||
"0688-187": { | ||
"56b6-187": { | ||
"renderedLength": 44, | ||
"gzipLength": 62, | ||
"brotliLength": 0, | ||
"mainUid": "0688-186" | ||
"mainUid": "56b6-186" | ||
}, | ||
"0688-189": { | ||
"renderedLength": 62814, | ||
"gzipLength": 14835, | ||
"56b6-189": { | ||
"renderedLength": 62804, | ||
"gzipLength": 14837, | ||
"brotliLength": 0, | ||
"mainUid": "0688-188" | ||
"mainUid": "56b6-188" | ||
}, | ||
"0688-191": { | ||
"56b6-191": { | ||
"renderedLength": 429, | ||
"gzipLength": 238, | ||
"brotliLength": 0, | ||
"mainUid": "56b6-190" | ||
}, | ||
"56b6-193": { | ||
"renderedLength": 17226, | ||
"gzipLength": 3829, | ||
"brotliLength": 0, | ||
"mainUid": "56b6-192" | ||
}, | ||
"56b6-195": { | ||
"renderedLength": 466, | ||
"gzipLength": 228, | ||
"brotliLength": 0, | ||
"mainUid": "0688-190" | ||
"mainUid": "56b6-194" | ||
}, | ||
"0688-193": { | ||
"renderedLength": 646, | ||
"gzipLength": 299, | ||
"56b6-197": { | ||
"renderedLength": 641, | ||
"gzipLength": 305, | ||
"brotliLength": 0, | ||
"mainUid": "0688-192" | ||
"mainUid": "56b6-196" | ||
}, | ||
"0688-195": { | ||
"renderedLength": 17226, | ||
"gzipLength": 3829, | ||
"56b6-199": { | ||
"renderedLength": 0, | ||
"gzipLength": 0, | ||
"brotliLength": 0, | ||
"mainUid": "0688-194" | ||
"mainUid": "56b6-198" | ||
} | ||
}, | ||
"nodeMetas": { | ||
"0688-178": { | ||
"id": "\u0000rollupPluginBabelHelpers.js", | ||
"moduleParts": { | ||
"index.production.js": "0688-179" | ||
}, | ||
"imported": [], | ||
"importedBy": [ | ||
{ | ||
"uid": "0688-194" | ||
} | ||
] | ||
}, | ||
"0688-180": { | ||
"56b6-180": { | ||
"id": "/packages/store/build/esm/index.js", | ||
"moduleParts": { | ||
"index.production.js": "0688-181" | ||
"index.production.js": "56b6-181" | ||
}, | ||
@@ -147,17 +145,17 @@ "imported": [], | ||
{ | ||
"uid": "0688-182" | ||
"uid": "56b6-182" | ||
} | ||
] | ||
}, | ||
"0688-182": { | ||
"56b6-182": { | ||
"id": "/packages/react-store/build/esm/index.js", | ||
"moduleParts": { | ||
"index.production.js": "0688-183" | ||
"index.production.js": "56b6-183" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "0688-197" | ||
"uid": "56b6-200" | ||
}, | ||
{ | ||
"uid": "0688-180" | ||
"uid": "56b6-180" | ||
} | ||
@@ -167,13 +165,16 @@ ], | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-198" | ||
}, | ||
{ | ||
"uid": "0688-188" | ||
"uid": "56b6-188" | ||
}, | ||
{ | ||
"uid": "56b6-192" | ||
} | ||
] | ||
}, | ||
"0688-184": { | ||
"56b6-184": { | ||
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js", | ||
"moduleParts": { | ||
"index.production.js": "0688-185" | ||
"index.production.js": "56b6-185" | ||
}, | ||
@@ -183,13 +184,13 @@ "imported": [], | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-188" | ||
}, | ||
{ | ||
"uid": "0688-188" | ||
"uid": "56b6-192" | ||
} | ||
] | ||
}, | ||
"0688-186": { | ||
"56b6-186": { | ||
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js", | ||
"moduleParts": { | ||
"index.production.js": "0688-187" | ||
"index.production.js": "56b6-187" | ||
}, | ||
@@ -199,23 +200,23 @@ "imported": [], | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-188" | ||
}, | ||
{ | ||
"uid": "0688-188" | ||
"uid": "56b6-192" | ||
} | ||
] | ||
}, | ||
"0688-188": { | ||
"56b6-188": { | ||
"id": "/packages/router-core/build/esm/index.js", | ||
"moduleParts": { | ||
"index.production.js": "0688-189" | ||
"index.production.js": "56b6-189" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "0688-184" | ||
"uid": "56b6-184" | ||
}, | ||
{ | ||
"uid": "0688-186" | ||
"uid": "56b6-186" | ||
}, | ||
{ | ||
"uid": "0688-182" | ||
"uid": "56b6-182" | ||
} | ||
@@ -225,26 +226,50 @@ ], | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-198" | ||
}, | ||
{ | ||
"uid": "0688-190" | ||
"uid": "56b6-192" | ||
}, | ||
{ | ||
"uid": "0688-192" | ||
"uid": "56b6-194" | ||
}, | ||
{ | ||
"uid": "56b6-196" | ||
} | ||
] | ||
}, | ||
"0688-190": { | ||
"id": "/packages/react-router/src/scroll-restoration.tsx", | ||
"56b6-190": { | ||
"id": "\u0000rollupPluginBabelHelpers.js", | ||
"moduleParts": { | ||
"index.production.js": "0688-191" | ||
"index.production.js": "56b6-191" | ||
}, | ||
"imported": [], | ||
"importedBy": [ | ||
{ | ||
"uid": "56b6-192" | ||
} | ||
] | ||
}, | ||
"56b6-192": { | ||
"id": "/packages/react-router/src/react.tsx", | ||
"moduleParts": { | ||
"index.production.js": "56b6-193" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "0688-196" | ||
"uid": "56b6-190" | ||
}, | ||
{ | ||
"uid": "0688-188" | ||
"uid": "56b6-201" | ||
}, | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-182" | ||
}, | ||
{ | ||
"uid": "56b6-184" | ||
}, | ||
{ | ||
"uid": "56b6-186" | ||
}, | ||
{ | ||
"uid": "56b6-188" | ||
} | ||
@@ -254,17 +279,26 @@ ], | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-198" | ||
}, | ||
{ | ||
"uid": "56b6-194" | ||
}, | ||
{ | ||
"uid": "56b6-196" | ||
} | ||
] | ||
}, | ||
"0688-192": { | ||
"id": "/packages/react-router/src/deferred.tsx", | ||
"56b6-194": { | ||
"id": "/packages/react-router/src/scroll-restoration.tsx", | ||
"moduleParts": { | ||
"index.production.js": "0688-193" | ||
"index.production.js": "56b6-195" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "0688-188" | ||
"uid": "56b6-201" | ||
}, | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-188" | ||
}, | ||
{ | ||
"uid": "56b6-192" | ||
} | ||
@@ -274,49 +308,52 @@ ], | ||
{ | ||
"uid": "0688-194" | ||
"uid": "56b6-198" | ||
} | ||
] | ||
}, | ||
"0688-194": { | ||
"id": "/packages/react-router/src/index.tsx", | ||
"56b6-196": { | ||
"id": "/packages/react-router/src/awaited.tsx", | ||
"moduleParts": { | ||
"index.production.js": "0688-195" | ||
"index.production.js": "56b6-197" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "0688-178" | ||
"uid": "56b6-188" | ||
}, | ||
{ | ||
"uid": "0688-196" | ||
}, | ||
"uid": "56b6-192" | ||
} | ||
], | ||
"importedBy": [ | ||
{ | ||
"uid": "0688-182" | ||
}, | ||
"uid": "56b6-198" | ||
} | ||
] | ||
}, | ||
"56b6-198": { | ||
"id": "/packages/react-router/src/index.tsx", | ||
"moduleParts": { | ||
"index.production.js": "56b6-199" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "0688-184" | ||
"uid": "56b6-182" | ||
}, | ||
{ | ||
"uid": "0688-186" | ||
"uid": "56b6-188" | ||
}, | ||
{ | ||
"uid": "0688-188" | ||
"uid": "56b6-192" | ||
}, | ||
{ | ||
"uid": "0688-190" | ||
"uid": "56b6-194" | ||
}, | ||
{ | ||
"uid": "0688-192" | ||
"uid": "56b6-196" | ||
} | ||
], | ||
"importedBy": [ | ||
{ | ||
"uid": "0688-190" | ||
}, | ||
{ | ||
"uid": "0688-192" | ||
} | ||
], | ||
"importedBy": [], | ||
"isEntry": true | ||
}, | ||
"0688-196": { | ||
"id": "react", | ||
"56b6-200": { | ||
"id": "use-sync-external-store/shim/with-selector", | ||
"moduleParts": {}, | ||
@@ -326,6 +363,3 @@ "imported": [], | ||
{ | ||
"uid": "0688-194" | ||
}, | ||
{ | ||
"uid": "0688-190" | ||
"uid": "56b6-182" | ||
} | ||
@@ -335,4 +369,4 @@ ], | ||
}, | ||
"0688-197": { | ||
"id": "use-sync-external-store/shim/with-selector", | ||
"56b6-201": { | ||
"id": "react", | ||
"moduleParts": {}, | ||
@@ -342,3 +376,6 @@ "imported": [], | ||
{ | ||
"uid": "0688-182" | ||
"uid": "56b6-192" | ||
}, | ||
{ | ||
"uid": "56b6-194" | ||
} | ||
@@ -345,0 +382,0 @@ ], |
@@ -11,27 +11,19 @@ /** | ||
*/ | ||
import { NoInfer } from '@tanstack/react-store'; | ||
export { useStore } from '@tanstack/react-store'; | ||
import * as _tanstack_router_core from '@tanstack/router-core'; | ||
import { ScrollRestorationOptions, DeferredPromise, RouteConstraints, AnyRoute, ResolveFullPath, ResolveId, ResolveFullSearchSchema, ParsePathParams, MergeParamsFromParent, RouteContext, AnyContext, UseLoaderResult, AnySearchSchema, AnyPathParams, AnyRouteProps, RoutePaths, RegisteredRouter, LinkOptions, ToOptions, MatchRouteOptions, RouteByPath, ResolveRelativePath, NavigateOptions, RouterOptions, Router, RouteMatch, RouteIds, RouteById, ParseRoute, RoutesById, AllParams } from '@tanstack/router-core'; | ||
import { AnySearchSchema, AnyPathParams, AnyContext, RouteConstraints, AnyRoute, ResolveFullPath, ResolveId, ResolveFullSearchSchema, ParsePathParams, MergeParamsFromParent, RouteContext, UseLoaderResult, AnyRouteProps, RoutePaths, RegisteredRouter, LinkOptions, ToOptions, MatchRouteOptions, RouteByPath, ResolveRelativePath, NavigateOptions, RouterOptions, Router, RouteMatch, RouteIds, RouteById, ParseRoute, RoutesById, AllParams, ScrollRestorationOptions, DeferredPromise } from '@tanstack/router-core'; | ||
export * from '@tanstack/router-core'; | ||
import * as React from 'react'; | ||
import { NoInfer } from '@tanstack/react-store'; | ||
export { useStore } from '@tanstack/react-store'; | ||
declare function useScrollRestoration(options?: ScrollRestorationOptions): void; | ||
declare function ScrollRestoration(props: ScrollRestorationOptions): null; | ||
type DeferredOptions<T> = { | ||
promise: DeferredPromise<T>; | ||
}; | ||
declare function useDeferred<T>({ promise }: DeferredOptions<T>): [T]; | ||
declare function Deferred<T>(props: DeferredOptions<T> & { | ||
children: (result: T) => JSX.Element; | ||
}): JSX.Element; | ||
declare module '@tanstack/router-core' { | ||
interface RegisterRouteComponent<TProps> { | ||
RouteComponent: RouteComponent<TProps>; | ||
interface RegisterRouteComponent<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> { | ||
RouteComponent: RouteComponent<RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TAllContext>>; | ||
} | ||
interface RegisterRouteErrorComponent<TProps> { | ||
RouteErrorComponent: RouteComponent<TProps>; | ||
interface RegisterErrorRouteComponent<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> { | ||
ErrorRouteComponent: RouteComponent<ErrorRouteProps<TFullSearchSchema, TAllParams, TRouteContext, TAllContext>>; | ||
} | ||
interface RegisterPendingRouteComponent<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> { | ||
PendingRouteComponent: RouteComponent<PendingRouteProps<TFullSearchSchema, TAllParams, TRouteContext, TAllContext>>; | ||
} | ||
interface Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TLoader = unknown, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Record<ParsePathParams<TPath>, string>, TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<TParentRoute['types']['allParams'], TParams>, TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['types']['routeContext'], TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['types']['context'], TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends RouteConstraints['TAllContext'] = MergeParamsFromParent<TParentRoute['types']['context'], TRouteContext>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> { | ||
@@ -67,11 +59,6 @@ useMatch: <TStrict extends boolean = true, TSelected = TAllContext>(opts?: { | ||
interface RegisterPendingRouteProps<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> { | ||
PendingRouteProps: Omit<RouteProps<unknown, TFullSearchSchema, TAllParams, TRouteContext, TAllContext>, 'useLoader'>; | ||
PendingRouteProps: PendingRouteProps<TFullSearchSchema, TAllParams, TRouteContext, TAllContext>; | ||
} | ||
interface RegisterErrorRouteProps<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> { | ||
ErrorRouteProps: { | ||
error: unknown; | ||
info: { | ||
componentStack: string; | ||
}; | ||
} & Omit<RouteProps<unknown, TFullSearchSchema, TAllParams, TRouteContext, TAllContext>, 'useLoader'>; | ||
ErrorRouteProps: ErrorRouteProps; | ||
} | ||
@@ -105,2 +92,9 @@ } | ||
}; | ||
type ErrorRouteProps<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = { | ||
error: unknown; | ||
info: { | ||
componentStack: string; | ||
}; | ||
} & Omit<RouteProps<unknown, TFullSearchSchema, TAllParams, TRouteContext, TAllContext>, 'useLoader'>; | ||
type PendingRouteProps<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = Omit<RouteProps<unknown, TFullSearchSchema, TAllParams, TRouteContext, TAllContext>, 'useLoader'>; | ||
type ReactNode = any; | ||
@@ -111,4 +105,4 @@ type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>; | ||
}; | ||
type RouteErrorComponent = AsyncRouteComponent<RouteErrorComponentProps>; | ||
type RouteErrorComponentProps = { | ||
type ErrorRouteComponent = AsyncRouteComponent<ErrorRouteComponentProps>; | ||
type ErrorRouteComponentProps = { | ||
error: Error; | ||
@@ -208,2 +202,13 @@ info: { | ||
export { AnyRouteComponent, AsyncRouteComponent, Block, Deferred, DeferredOptions, ErrorComponent, Link, LinkComponent, LinkPropsOptions, MakeLinkOptions, MakeLinkPropsOptions, MakeMatchRouteOptions, MakeUseMatchRouteOptions, MatchRoute, Navigate, Outlet, PromptProps, RouteComponent, RouteErrorComponent, RouteErrorComponentProps, RouteFromIdOrRoute, RouteProps, RouterProps, RouterProvider, ScrollRestoration, SyncRouteComponent, lazyRouteComponent, matchIdsContext, routerContext, shallow, useBlocker, useDeferred, useDehydrate, useHydrate, useInjectHtml, useLinkProps, useLoader, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useRouteContext, useRouter, useRouterContext, useRouterState, useScrollRestoration, useSearch }; | ||
declare function useScrollRestoration(options?: ScrollRestorationOptions): void; | ||
declare function ScrollRestoration(props: ScrollRestorationOptions): null; | ||
type AwaitOptions<T> = { | ||
promise: DeferredPromise<T>; | ||
}; | ||
declare function useAwaited<T>({ promise }: AwaitOptions<T>): [T]; | ||
declare function Await<T>(props: AwaitOptions<T> & { | ||
children: (result: T) => JSX.Element; | ||
}): JSX.Element; | ||
export { AnyRouteComponent, AsyncRouteComponent, Await, AwaitOptions, Block, ErrorComponent, ErrorRouteComponent, ErrorRouteComponentProps, ErrorRouteProps, Link, LinkComponent, LinkPropsOptions, MakeLinkOptions, MakeLinkPropsOptions, MakeMatchRouteOptions, MakeUseMatchRouteOptions, MatchRoute, Navigate, Outlet, PendingRouteProps, PromptProps, RouteComponent, RouteFromIdOrRoute, RouteProps, RouterProps, RouterProvider, ScrollRestoration, SyncRouteComponent, lazyRouteComponent, matchIdsContext, routerContext, shallow, useAwaited, useBlocker, useDehydrate, useHydrate, useInjectHtml, useLinkProps, useLoader, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useRouteContext, useRouter, useRouterContext, useRouterState, useScrollRestoration, useSearch }; |
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("use-sync-external-store/shim/with-selector")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim/with-selector"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactRouter={},t.React,t.withSelector)}(this,(function(t,e,r){"use strict";function o(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var s=o(e);function n(){return n=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},n.apply(this,arguments)} | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("use-sync-external-store/shim/with-selector"),require("react")):"function"==typeof define&&define.amd?define(["exports","use-sync-external-store/shim/with-selector","react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactRouter={},t.withSelector,t.React)}(this,(function(t,e,r){"use strict";function o(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var s=o(r); | ||
/** | ||
@@ -22,3 +22,3 @@ * @tanstack/store/src/index.ts | ||
* @license MIT | ||
*/class a{listeners=new Set;_batching=!1;_flushing=0;_nextPriority=null;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=(t,e)=>{const r=this.state;this.state=this.options?.updateFn?this.options.updateFn(r)(t):t(r);const o=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=o:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}} | ||
*/class n{listeners=new Set;_batching=!1;_flushing=0;_nextPriority=null;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=(t,e)=>{const r=this.state;this.state=this.options?.updateFn?this.options.updateFn(r)(t):t(r);const o=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=o:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}} | ||
/** | ||
@@ -33,3 +33,3 @@ * @tanstack/react-store/src/index.tsx | ||
* @license MIT | ||
*/function i(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,c)}function c(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function h(t,e){if(!t)throw new Error("Invariant failed")} | ||
*/function a(t,r=(t=>t)){return e.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),r,i)}function i(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function c(t,e){if(!t)throw new Error("Invariant failed")} | ||
/** | ||
@@ -45,3 +45,3 @@ * @tanstack/router-core/src/index.ts | ||
*/ | ||
const u="pushstate",l="popstate",d="beforeunload",p=t=>(t.preventDefault(),t.returnValue=""),f=()=>{removeEventListener(d,p,{capture:!0})};function m(t){let e=t.getLocation(),r=()=>{},o=new Set,s=[],n=[];const a=()=>{if(s.length)s[0]?.(a,(()=>{s=[],f()}));else{for(;n.length;)n.shift()?.();t.subscriber||c()}},i=t=>{n.push(t),a()},c=()=>{e=t.getLocation(),o.forEach((t=>t()))};return{get location(){return e},subscribe:e=>(0===o.size&&(r="function"==typeof t.subscriber?t.subscriber(c):()=>{}),o.add(e),()=>{o.delete(e),0===o.size&&r()}),push:(e,r)=>{i((()=>{t.pushState(e,r)}))},replace:(e,r)=>{i((()=>{t.replaceState(e,r)}))},go:e=>{i((()=>{t.go(e)}))},back:()=>{i((()=>{t.back()}))},forward:()=>{i((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(s.push(t),1===s.length&&addEventListener(d,p,{capture:!0}),()=>{s=s.filter((e=>e!==t)),s.length||f()})}}function y(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),r=t?.createHref??(t=>t);return m({getLocation:()=>v(e(),history.state),subscriber:t=>{window.addEventListener(u,t),window.addEventListener(l,t);var e=window.history.pushState;window.history.pushState=function(){let r=e.apply(history,arguments);return t(),r};var r=window.history.replaceState;return window.history.replaceState=function(){let e=r.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=r,window.removeEventListener(u,t),window.removeEventListener(l,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:w()},"",r(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:w()},"",r(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>r(t)})}function g(t={initialEntries:["/"]}){const e=t.initialEntries;let r=t.initialIndex??e.length-1,o={};return m({getLocation:()=>v(e[r],o),subscriber:!1,pushState:(t,s)=>{o={...s,key:w()},e.push(t),r++},replaceState:(t,s)=>{o={...s,key:w()},e[r]=t},back:()=>{r--},forward:()=>{r=Math.min(r+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function v(t,e){let r=t.indexOf("#"),o=t.indexOf("?");return{href:t,pathname:t.substring(0,r>0?o>0?Math.min(r,o):r:o>0?o:t.length),hash:r>-1?t.substring(r):"",search:o>-1?t.slice(o,-1===r?void 0:r):"",state:e}}function w(){return(Math.random()+1).toString(36).substring(7)}function b(t){return t[t.length-1]}function S(t,e){return"function"==typeof t?t(e):t}function R(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})}function _(t,e){if(t===e)return t;const r=e,o=Array.isArray(t)&&Array.isArray(r);if(o||x(t)&&x(r)){const e=o?t.length:Object.keys(t).length,s=o?r:Object.keys(r),n=s.length,a=o?[]:{};let i=0;for(let e=0;e<n;e++){const n=o?e:s[e];a[n]=_(t[n],r[n]),a[n]===t[n]&&i++}return e===n&&i===e?t:a}return r}function x(t){if(!E(t))return!1;const e=t.constructor;if(void 0===e)return!0;const r=e.prototype;return!!E(r)&&!!r.hasOwnProperty("isPrototypeOf")}function E(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t,e){return t===e||typeof t==typeof e&&(x(t)&&x(e)?!Object.keys(e).some((r=>!I(t[r],e[r]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,r)=>I(t,e[r])))))}function P(t){return C(t.filter(Boolean).join("/"))}function C(t){return t.replace(/\/{2,}/g,"/")}function M(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function L(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function O(t){return L(M(t))}function A(t,e,r){e=e.replace(new RegExp(`^${t}`),"/"),r=r.replace(new RegExp(`^${t}`),"/");let o=D(e);const s=D(r);s.forEach(((t,e)=>{if("/"===t.value)e?e===s.length-1&&o.push(t):o=[t];else if(".."===t.value)o.length>1&&"/"===b(o)?.value&&o.pop(),o.pop();else{if("."===t.value)return;o.push(t)}}));return C(P([t,...o.map((t=>t.value))]))}function D(t){if(!t)return[];const e=[];if("/"===(t=C(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const r=t.split("/").filter(Boolean);return e.push(...r.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function j(t,e,r=!1){return P(D(t).map((t=>{if("wildcard"===t.type){const o=e[t.value];return r?`${t.value}${o??""}`:o}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function k(t,e,r){const o=B(t,e,r);if(!r.to||o)return o??{}}function B(t,e,r){e="/"!=t?e.substring(t.length):e;const o=`${r.to??"$"}`,s=D(e),n=D(o);e.startsWith("/")||s.unshift({type:"pathname",value:"/"}),o.startsWith("/")||n.unshift({type:"pathname",value:"/"});const a={};return(()=>{for(let t=0;t<Math.max(s.length,n.length);t++){const e=s[t],o=n[t],i=t>=s.length-1,c=t>=n.length-1;if(o){if("wildcard"===o.type)return!!e?.value&&(a["*"]=P(s.slice(t).map((t=>t.value))),!0);if("pathname"===o.type){if("/"===o.value&&!e?.value)return!0;if(e)if(r.caseSensitive){if(o.value!==e.value)return!1}else if(o.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===o.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(a[o.value.substring(1)]=e.value)}}if(!i&&c)return!!r.fuzzy}return!0})()?a:void 0}function $(t,e){var r,o,s,n="";for(r in t)if(void 0!==(s=t[r]))if(Array.isArray(s))for(o=0;o<s.length;o++)n&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(s[o]);else n&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(s);return(e||"")+n}function T(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function H(t){for(var e,r,o={},s=t.split("&");e=s.shift();)void 0!==o[r=(e=e.split("=")).shift()]?o[r]=[].concat(o[r],T(e.shift())):o[r]=T(e.shift());return o}const N="__root__";class F{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,F.__onInit(this)}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=N:h(this.parentRoute);let o=r?N:e.path;o&&"/"!==o&&(o=O(o));const s=e?.id||o;let n=r?N:P([this.parentRoute.id===N?"":this.parentRoute.id,s]);o===N&&(o="/"),n!==N&&(n=P(["/",n]));const a=n===N?"/":P([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=a,this.to=a};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{}}class z extends F{constructor(t){super(t)}}const U=Y(JSON.parse),W=J(JSON.stringify,JSON.parse);function Y(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=H(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function J(t,e){function r(r){if("object"==typeof r&&null!==r)try{return t(r)}catch(t){}else if("string"==typeof r&&"function"==typeof e)try{return e(r),t(r)}catch(t){}return r}return t=>{(t={...t})&&Object.keys(t).forEach((e=>{const o=t[e];void 0===o||void 0===o?delete t[e]:Array.isArray(o)?t[e]=o.map(r):t[e]=r(o)}));const e=$(t).toString();return e?`?${e}`:""}}const q=["component","errorComponent","pendingComponent"];const K="undefined"==typeof window||!window.document.createElement;function X(){return{status:"idle",isFetching:!1,resolvedLocation:null,location:null,matchesById:{},matchIds:[],pendingMatchIds:[],matches:[],pendingMatches:[],lastUpdated:Date.now()}}function V(t){return!!t?.isRedirect}class G extends Error{}class Q extends Error{}const Z="window",tt="___";let et,rt={},ot=!1;const st="undefined"!=typeof window&&window.sessionStorage,nt=t=>t.key;function at(t,e){const r=e?.getKey||nt;st&&(et||(et=(()=>{const t="tsr-scroll-restoration-v1",e=JSON.parse(window.sessionStorage.getItem(t)||"{}");return{current:e,set:(r,o)=>{e[r]=o,window.sessionStorage.setItem(t,JSON.stringify(et))}}})()));const{history:o}=window;o.scrollRestoration&&(o.scrollRestoration="manual");const s=e=>{const o=r(t.state.resolvedLocation);rt[o]||(rt[o]=new WeakSet);const s=rt[o];if(s.has(e.target))return;s.add(e.target);const a=[o,e.target===document||e.target===window?Z:n(e.target)].join(tt);et.current[a]||et.set(a,{scrollX:NaN,scrollY:NaN})},n=t=>{let e,r=[];for(;e=t.parentNode;)r.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${r.join(" > ")}`.toLowerCase()};"undefined"!=typeof document&&document.addEventListener("scroll",s,!0);const a=t.subscribe("onBeforeLoad",(t=>{t.pathChanged&&(t=>{const e=r(t);for(const t in et.current){const r=et.current[t],[o,s]=t.split(tt);if(e===o){if(s===Z)r.scrollX=window.scrollX||0,r.scrollY=window.scrollY||0;else if(s){const t=document.querySelector(s);r.scrollX=t?.scrollLeft||0,r.scrollY=t?.scrollTop||0}et.set(t,r)}}})(t.from)})),i=t.subscribe("onLoad",(t=>{t.pathChanged&&(ot=!0)}));return()=>{document.removeEventListener("scroll",s),a(),i()}}function it(t,e){if(ot){ot=!1;const r=(e?.getKey||nt)(t.state.location);let o=!1;for(const t in et.current){const e=et.current[t],[s,n]=t.split(tt);if(s===r)if(n===Z)o=!0,window.scrollTo(e.scrollX,e.scrollY);else if(n){const t=document.querySelector(n);t&&(t.scrollLeft=e.scrollX,t.scrollTop=e.scrollY)}}o||window.scrollTo(0,0)}}function ct(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}const ht="undefined"!=typeof window?s.useLayoutEffect:s.useEffect;function ut(t){const e=vt();ht((()=>at(e,t)),[]),ht((()=>{it(e,t)}))}function lt({promise:t}){const e=vt();let r=t.__deferredState;const o=`__TSR__DEFERRED__${r.uid}`;if(ct(t)&&(r=e.hydrateData(o),(t=Promise.resolve(r.data)).__deferredState=r),"pending"===r.status)throw t;if("error"===r.status)throw r.error;return e.dehydrateData(o,r),[r.data]}function dt(t){const e=vt(),{type:r,children:o,target:n,activeProps:a=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:u,search:l,params:d,to:p=".",preload:f,preloadDelay:m,replace:y,style:g,className:v,onClick:w,onFocus:b,onMouseEnter:R,onMouseLeave:_,onTouchStart:x,...E}=t,I=e.buildLink(t);if("external"===I.type){const{href:t}=I;return{href:t}}const{handleClick:P,handleFocus:C,handleEnter:M,handleLeave:L,handleTouchStart:O,isActive:A,next:D}=I,j=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},k=A?S(a,{})??{}:{},B=A?{}:S(i,{})??{};return{...k,...B,...E,href:h?void 0:D.href,onClick:j([w,e=>{(t.startTransition??1)&&(s.startTransition||(t=>t))((()=>{P(e)}))}]),onFocus:j([b,C]),onMouseEnter:j([R,M]),onMouseLeave:j([_,L]),onTouchStart:j([x,O]),target:n,style:{...g,...k.style,...B.style},className:[v,k.className,B.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":A?"active":void 0}}F.__onInit=t=>{Object.assign(t,{useMatch:(e={})=>wt({...e,from:t.id}),useLoader:(e={})=>bt({...e,from:t.id}),useContext:(e={})=>wt({...e,from:t.id,select:t=>e?.select?.(t.context)??t.context}),useRouteContext:(e={})=>wt({...e,from:t.id,select:t=>e?.select?.(t.routeContext)??t.routeContext}),useSearch:(e={})=>St({...e,from:t.id}),useParams:(e={})=>Rt({...e,from:t.id})})};const pt=s.forwardRef(((t,e)=>{const r=dt(t);return s.createElement("a",n({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const ft=s.createContext(null),mt=s.createContext(null);function yt(t){return i(vt().__store,t?.select)}function gt(){const t=vt(),e=yt({select:e=>e.pendingMatches.some((e=>!!t.getRoute(e.routeId)?.options.pendingComponent))?e.pendingMatchIds:e.matchIds});return s.createElement(ft.Provider,{value:[void 0,...e]},s.createElement(Mt,{errorComponent:Ot,route:t.getRoute(N),onCatch:()=>{}},s.createElement(xt,null)))}function vt(){return s.useContext(mt)}function wt(t){const e=vt(),r=s.useContext(ft)[0],o=e.getRouteMatch(r)?.routeId,n=yt({select:e=>{const o=e.matches;return(t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r))).routeId}});(t?.strict??1)&&h(o==n);return yt({select:e=>{const o=e.matches,s=t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r));return h(s,t?.from&&t.from),t?.select?.(s)??s}})}function bt(t){return wt({...t,select:e=>t?.select?.(e.loaderData)??e.loaderData})}function St(t){return wt({...t,select:e=>t?.select?.(e.search)??e.search})}function Rt(t){return yt({select:e=>{const r=b(e.matches)?.params;return t?.select?.(r)??r}})}function _t(){const t=vt();return s.useCallback((e=>{const{pending:r,caseSensitive:o,...s}=e;return t.matchRoute(s,{pending:r,caseSensitive:o})}),[])}function xt(){const t=s.useContext(ft).slice(1);return t[0]?s.createElement(It,{matchIds:t}):null}const Et=()=>null;function It({matchIds:t}){const e=vt(),r=t[0],o=e.getRouteMatch(r).routeId,n=e.getRoute(o),a=n.options.pendingComponent??e.options.defaultPendingComponent??Et,i=n.options.errorComponent??e.options.defaultErrorComponent??Ot,c=n.options.wrapInSuspense??!n.isRoot?s.Suspense:Ct,h=i?Mt:Ct;return s.createElement(ft.Provider,{value:t},s.createElement(c,{fallback:s.createElement(a,{useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams})},s.createElement(h,{key:n.id,errorComponent:i,route:n,onCatch:()=>{}},s.createElement(Pt,{matchId:r,PendingComponent:a}))))}function Pt({matchId:t,PendingComponent:e}){const r=vt(),o=yt({select:e=>R(e.matchesById[t],["status","loadPromise","routeId","error"])}),n=r.getRoute(o.routeId);if("error"===o.status)throw o.error;if("pending"===o.status)return s.createElement(e,{useLoader:n.useLoader,useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams});if("success"===o.status){let t=n.options.component??r.options.defaultComponent;return t?s.createElement(t,{useLoader:n.useLoader,useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams}):s.createElement(xt,null)}h(!1)}function Ct(t){return s.createElement(s.Fragment,null,t.children)}class Mt extends s.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),this.setState({error:t,info:e})}render(){return s.createElement(Lt,n({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function Lt(t){const e=yt({select:t=>t.resolvedLocation.key}),[r,o]=s.useState(t.errorState),n=t.errorComponent??Ot,a=s.useRef("");return s.useEffect((()=>{r&&e!==a.current&&o({}),a.current=e}),[r,e]),s.useEffect((()=>{t.errorState.error&&o(t.errorState)}),[t.errorState.error]),t.errorState.error&&r.error?s.createElement(n,{...r,useMatch:t.route.useMatch,useContext:t.route.useContext,useRouteContext:t.route.useRouteContext,useSearch:t.route.useSearch,useParams:t.route.useParams}):t.children}function Ot({error:t}){const[e,r]=s.useState(!1);return s.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},s.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},s.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),s.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r((t=>!t))},e?"Hide Error":"Show Error")),s.createElement("div",{style:{height:".25rem"}}),e?s.createElement("div",null,s.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},t.message?s.createElement("code",null,t.message):null)):null)}function At(t,e=!0){const r=vt();s.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}t.Block=function({message:t,condition:e,children:r}){return At(t,e),r??null},t.Deferred=function(t){const e=lt(t);return t.children(...e)},t.ErrorComponent=Ot,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new F(t);return e.isRoot=!1,e}},t.Link=pt,t.MatchRoute=function(t){const e=_t()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Navigate=function(t){const e=vt();return s.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=xt,t.PathParamError=Q,t.RootRoute=z,t.Route=F,t.Router=class{#t;constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??W,parseSearch:t?.parseSearch??U},this.__store=new a(X(),{onUpdate:()=>{const t=this.state,e=this.__store.state,r=t.matchesById!==e.matchesById;let o,s;r||(o=t.matchIds.length!==e.matchIds.length||t.matchIds.some(((t,r)=>t!==e.matchIds[r])),s=t.pendingMatchIds.length!==e.pendingMatchIds.length||t.pendingMatchIds.some(((t,r)=>t!==e.pendingMatchIds[r]))),(r||o)&&(e.matches=e.matchIds.map((t=>e.matchesById[t]))),(r||s)&&(e.pendingMatches=e.pendingMatchIds.map((t=>e.matchesById[t]))),e.isFetching=[...e.matches,...e.pendingMatches].some((t=>t.isFetching)),this.state=e},defaultPriority:"low"}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.location.href!==e.href&&this.#e({...e,replace:!0})}subscribers=new Set;subscribe=(t,e)=>{const r={eventType:t,fn:e};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}};#r=t=>{this.subscribers.forEach((e=>{e.eventType===t.type&&e.fn(t)}))};reset=()=>{this.__store.setState((t=>Object.assign(t,X())))};mount=()=>{this.safeLoad()};update=t=>{if(this.options={...this.options,...t,context:{...this.options.context,...t?.context}},!this.history||this.options.history&&this.options.history!==this.history){this.#t&&this.#t(),this.history=this.options.history??(K?g():y());const t=this.#o();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#t=this.history.subscribe((()=>{this.safeLoad({next:this.#o(this.state.location)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${O(e??"")??""}`,r&&r!==this.routeTree&&this.#s(r),this};buildNext=t=>{const e=this.#n(t),r=this.matchRoutes(e.pathname,e.search);return this.#n({...t,__matches:r})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=async t=>{try{return this.load(t)}catch(t){}};latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(r,o)=>{const s=this.state.resolvedLocation,n=!(!t?.next||s.href===t.next.href);let a;const i=()=>this.latestLoadPromise!==e?this.latestLoadPromise:void 0;let c;this.#r({type:"onBeforeLoad",from:s,to:t?.next??this.state.location,pathChanged:n}),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),c=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:t?.throwOnError,debug:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatchIds:c.map((t=>t.id)),matchesById:this.#a(t.matchesById,c)})))}));try{try{await this.loadMatches(c)}catch(t){}if(a=i())return a;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matchIds:t.pendingMatchIds,pendingMatchIds:[]}))),this.#r({type:"onLoad",from:s,to:this.state.location,pathChanged:n}),r()}catch(t){if(a=i())return a;o(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#a=(t,e)=>{const r={...t};let o=!1;return e.forEach((t=>{r[t.id]||(o=!0,r[t.id]=t)})),o?r:t};getRoute=t=>{const e=this.routesById[t];return h(e),e};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return this.__store.setState((t=>({...t,matchesById:this.#a(t.matchesById,r)}))),await this.loadMatches(r,{preload:!0,maxAge:t.maxAge}),r};cleanMatches=()=>{const t=Date.now(),e=Object.values(this.state.matchesById).filter((e=>{const r=this.getRoute(e.routeId);return!this.state.matchIds.includes(e.id)&&!this.state.pendingMatchIds.includes(e.id)&&e.preloadInvalidAt<t&&(!r.options.gcMaxAge||e.updatedAt+r.options.gcMaxAge<t)})).map((t=>t.id));e.length&&this.__store.setState((t=>{const r={...t.matchesById};return e.forEach((t=>{delete r[t]})),{...t,matchesById:r}}))};matchRoutes=(t,e,r)=>{let o={},s=this.flatRoutes.find((e=>{const r=k(this.basepath,L(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(o=r,!0)}))||this.routesById.__root__,n=[s];for(;s?.parentRoute;)s=s.parentRoute,s&&n.unshift(s);const a=n.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(o);Object.assign(o,e)}catch(t){if(e=new Q(t.message,{cause:t}),r?.throwOnError)throw e;return e}})),i=n.map(((t,r)=>{const s=j(t.path,o),n=t.options.key?t.options.key({params:o,search:e})??"":"",i=n?JSON.stringify(n):"",c=j(t.id,o,!0)+i,h=this.getRouteMatch(c);if(h)return{...h};const u=!(!t.options.loader&&!q.some((e=>t.options[e]?.preload)));return{id:c,key:i,routeId:t.id,params:o,pathname:P([this.basepath,s]),updatedAt:Date.now(),invalidAt:9999999999999,preloadInvalidAt:9999999999999,routeSearch:{},search:{},status:u?"pending":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:a[r],searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return i.forEach(((t,o)=>{const s=i[o-1],n=this.getRoute(t.routeId),a=(()=>{const o={search:s?.search??e,routeSearch:s?.routeSearch??e};try{const e=("object"==typeof n.options.validateSearch?n.options.validateSearch.parse:n.options.validateSearch)?.(o.search)??{},r={...o.search,...e};return{routeSearch:_(t.routeSearch,e),search:_(t.search,r)}}catch(e){if(t.searchError=new G(e.message,{cause:e}),r?.throwOnError)throw t.searchError;return o}})();Object.assign(t,{...a});const c=(()=>{try{const e=n.options.getContext?.({parentContext:s?.routeContext??{},context:s?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...s?.context??this?.options.context,...e},routeContext:e}}catch(t){throw n.options.onError?.(t),t}})();Object.assign(t,{...c})})),i};loadMatches=async(t,e)=>{let r;this.cleanMatches(),e?.preload||t.forEach((t=>{this.setRouteMatch(t.id,(e=>({...e,routeSearch:t.routeSearch,search:t.search,routeContext:t.routeContext,context:t.context,error:t.error,paramsError:t.paramsError,searchError:t.searchError,params:t.params})))}));try{for(const[o,s]of t.entries()){const t=this.getRoute(s.routeId),n=(e,n)=>{if(e.routerCode=n,r=r??o,V(e))throw e;try{t.options.onError?.(e)}catch(t){if(e=t,V(t))throw t}this.setRouteMatch(s.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};s.paramsError&&n(s.paramsError,"PARSE_PARAMS"),s.searchError&&n(s.searchError,"VALIDATE_SEARCH");let a=!1;try{await(t.options.beforeLoad?.({...s,preload:!!e?.preload}))}catch(t){n(t,"BEFORE_LOAD"),a=!0}if(a)break}}catch(t){throw e?.preload||this.navigate(t),t}const o=t.slice(0,r),s=[];o.forEach(((t,r)=>{s.push((async()=>{const o=s[r-1],n=this.getRoute(t.routeId);if(t.isFetching||"success"===t.status&&!this.getIsInvalid({matchId:t.id,preload:e?.preload}))return this.getRouteMatch(t.id)?.loadPromise;const a=Date.now(),i=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==a?e.loadPromise:void 0},c=t=>!!V(t)&&(e?.preload||this.navigate(t),!0),h=async()=>{let r;try{const s=Promise.all(q.map((async t=>{const e=n.options[t];e?.preload&&await e.preload()}))),a=n.options.loader?.({...t,preload:!!e?.preload,parentMatchPromise:o}),[c,h]=await Promise.all([s,a]);if(r=i())return await r;this.setRouteMatchData(t.id,(()=>h),e)}catch(e){if(r=i())return await r;if(c(e))return;try{n.options.onError?.(e)}catch(t){if(e=t,c(t))return}this.setRouteMatch(t.id,(t=>({...t,error:e,status:"error",isFetching:!1,updatedAt:Date.now()})))}};let u;this.__store.batch((()=>{this.setRouteMatch(t.id,(t=>({...t,isFetching:!0,fetchedAt:a,invalid:!1}))),u=h(),this.setRouteMatch(t.id,(t=>({...t,loadPromise:u})))})),await u})())})),await Promise.all(s)};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>A(this.basepath,t,C(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:s,params:n})=>{const a=String(e),i=void 0===t?t:String(t);let c;try{new URL(`${a}`),c=!0}catch(t){}return h(!c),this.#e({from:i,to:a,search:r,hash:o,replace:s,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t);if(e?.pending&&"pending"!==this.state.status)return!1;const o=e?.pending?this.state.location:this.state.resolvedLocation;if(!o)return!1;const s=k(this.basepath,o.pathname,{...e,to:r.pathname});return!!s&&(e?.includeSearch??1?!!I(o.search,r.search)&&s:s)};buildLink=({from:t,to:e=".",search:r,params:o,hash:s,target:n,replace:a,activeOptions:i,preload:c,preloadDelay:h,disabled:u,state:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const d={from:t,to:e,search:r,params:o,hash:s,replace:a,state:l},p=this.buildNext(d);c=c??this.options.defaultPreload;const f=h??this.options.defaultPreloadDelay??0,m=this.state.location.pathname.split("/"),y=p.pathname.split("/").every(((t,e)=>t===m[e])),g=i?.exact?this.state.location.pathname===p.pathname:y,v=!i?.includeHash||this.state.location.hash===p.hash,w=!(i?.includeSearch??1)||I(this.state.location.search,p.search);return{type:"internal",next:p,handleFocus:t=>{c&&this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{u||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||n&&"_self"!==n||0!==t.button||(t.preventDefault(),this.#e(d))},handleEnter:t=>{const e=t.target||{};if(c){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),f)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&v&&w,disabled:u}};dehydrate=()=>({state:{dehydratedMatches:this.state.matches.map((t=>R(t,["fetchedAt","invalid","invalidAt","id","loaderData","status","updatedAt"])))}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),h(e);const r=e;this.dehydratedData=r.payload,this.options.hydrate?.(r.payload);const{dehydratedMatches:o}=r.router.state;let s=this.matchRoutes(this.state.location.pathname,this.state.location.search).map((t=>{const e=o.find((e=>e.id===t.id));return h(e,t.id),e?{...t,...e}:t}));this.__store.setState((t=>({...t,matches:s,matchesById:this.#a(t.matchesById,s)})))};injectedHtml=[];injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const r="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${r}`,o="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${s=r,s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(o)}\n // ;(() => {\n // var el = document.getElementById('${t}')\n // el.parentElement.removeChild(el)\n // })()\n <\/script>`;var s})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#s=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const e=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(h(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=L(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const o=t.children;o?.length&&e(o)}))};e([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=O(t.fullPath),o=D(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const s=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:o,index:e,score:s}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const o=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let r=0;r<o;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<o;r++)if(t.parsed[r].value!==e.parsed[r].value)return t.parsed[r].value>e.parsed[r].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};#o=t=>{let{pathname:e,search:r,hash:o,state:s}=this.history.location;const n=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:_(t?.search,n),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:s,key:s?.key||"__init__"}};#n=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=A(this.basepath??"/",e,`${t.to??""}`);const o={...b(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let s=!0===(t.params??!0)?o:S(t.params,o);s&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{s={...s,...t(s)}})),r=j(r,s??{});const n=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],a=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],i=n?.length?n?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,c=!0===t.search?i:t.search?S(t.search,i)??{}:n?.length?i:{},h=a?.length?a.reduce(((t,e)=>e(t)),c):c,u=_(this.state.location.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.location.hash:S(t.hash,this.state.location.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.location.state:S(t.state,this.state.location.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.location.href===e.href&&!e.key&&(o="replace");const s=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](s,{id:r,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((r=>(r.matchesById[t]||console.warn(`No match found with id: ${t}`),{...r,matchesById:{...r.matchesById,[t]:e(r.matchesById[t])}})))};setRouteMatchData=(t,e,r)=>{const o=this.getRouteMatch(t);if(!o)return;const s=this.getRoute(o.routeId),n=r?.updatedAt??Date.now(),a=n+(r?.maxAge??s.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),i=n+(r?.maxAge??s.options.maxAge??this.options.defaultMaxAge??9999999999999);this.setRouteMatch(t,(t=>({...t,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:S(e,t.loaderData),preloadInvalidAt:a,invalidAt:i}))),this.state.matches.find((e=>e.id===t))};invalidate=async t=>{if(t?.matchId){this.setRouteMatch(t.matchId,(t=>({...t,invalid:!0})));const e=this.state.matches.findIndex((e=>e.id===t.matchId)),r=this.state.matches[e+1];if(r)return this.invalidate({matchId:r.id,reload:!1})}else this.__store.batch((()=>{Object.values(this.state.matchesById).forEach((t=>{this.setRouteMatch(t.id,(t=>({...t,invalid:!0})))}))}));if(t?.reload??1)return this.reload()};getIsInvalid=t=>{if(!t?.matchId)return!!this.state.matches.find((e=>this.getIsInvalid({matchId:e.id,preload:t?.preload})));const e=this.getRouteMatch(t?.matchId);if(!e)return!1;const r=Date.now();return e.invalid||(t?.preload?e.preloadInvalidAt:e.invalidAt)<r}},t.RouterContext=class{constructor(){}createRootRoute=t=>new z(t)},t.RouterProvider=function({router:t,...e}){t.update(e),s.useEffect((()=>{let e;return s.startTransition((()=>{e=t.mount()})),e}),[t]);const r=t.options.Wrap||s.Fragment;return s.createElement(r,null,s.createElement(mt.Provider,{value:t},s.createElement(gt,null)))},t.ScrollRestoration=function(t){return ut(t),null},t.SearchParamError=G,t.cleanPath=C,t.componentTypes=q,t.createBrowserHistory=y,t.createHashHistory=function(){return y({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=g,t.decode=H,t.defaultParseSearch=U,t.defaultStringifySearch=W,t.defer=function(t){const e=t;if(!e.__deferredState){e.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const t=e.__deferredState;e.then((e=>{t.status="success",t.data=e})).catch((e=>{t.status="error",t.error=e}))}return e},t.encode=$,t.functionalUpdate=S,t.interpolatePath=j,t.invariant=h,t.isDehydratedDeferred=ct,t.isPlainObject=x,t.isRedirect=V,t.joinPaths=P,t.last=b,t.lazyFn=function(t,e){return async(...r)=>(await t())[e||"default"](...r)},t.lazyRouteComponent=function(t,e){let r;const o=()=>(r||(r=t()),r),n=s.lazy((async()=>({default:(await o())[e??"default"]})));return n.preload=o,n},t.matchByPath=B,t.matchIdsContext=ft,t.matchPathname=k,t.parsePathname=D,t.parseSearchWith=Y,t.partialDeepEqual=I,t.pick=R,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=_,t.resolvePath=A,t.restoreScrollPositions=it,t.rootRouteId=N,t.routerContext=mt,t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0},t.stringifySearchWith=J,t.trimPath=O,t.trimPathLeft=M,t.trimPathRight=L,t.useBlocker=At,t.useDeferred=lt,t.useDehydrate=function(){const t=vt();return s.useCallback((function(e,r){return t.dehydrateData(e,r)}),[])},t.useHydrate=function(){const t=vt();return function(e){return t.hydrateData(e)}},t.useInjectHtml=function(){const t=vt();return s.useCallback((e=>{t.injectHtml(e)}),[])},t.useLinkProps=dt,t.useLoader=bt,t.useMatch=wt,t.useMatchRoute=_t,t.useMatches=function(t){const e=s.useContext(ft);return yt({select:r=>{const o=r.matches.slice(r.matches.findIndex((t=>t.id===e[0])));return t?.select?.(o)??o}})},t.useNavigate=function(t){const e=vt();return s.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=Rt,t.useRouteContext=function(t){return wt({...t,select:e=>t?.select?.(e.routeContext)??e.routeContext})},t.useRouter=vt,t.useRouterContext=function(t){return wt({...t,select:e=>t?.select?.(e.context)??e.context})},t.useRouterState=yt,t.useScrollRestoration=ut,t.useSearch=St,t.useStore=i,t.warning=function(t,e){},t.watchScrollPositions=at,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
const h="pushstate",u="popstate",l="beforeunload",d=t=>(t.preventDefault(),t.returnValue=""),p=()=>{removeEventListener(l,d,{capture:!0})};function f(t){let e=t.getLocation(),r=()=>{},o=new Set,s=[],n=[];const a=()=>{if(s.length)s[0]?.(a,(()=>{s=[],p()}));else{for(;n.length;)n.shift()?.();t.subscriber||c()}},i=t=>{n.push(t),a()},c=()=>{e=t.getLocation(),o.forEach((t=>t()))};return{get location(){return e},subscribe:e=>(0===o.size&&(r="function"==typeof t.subscriber?t.subscriber(c):()=>{}),o.add(e),()=>{o.delete(e),0===o.size&&r()}),push:(e,r)=>{i((()=>{t.pushState(e,r)}))},replace:(e,r)=>{i((()=>{t.replaceState(e,r)}))},go:e=>{i((()=>{t.go(e)}))},back:()=>{i((()=>{t.back()}))},forward:()=>{i((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(s.push(t),1===s.length&&addEventListener(l,d,{capture:!0}),()=>{s=s.filter((e=>e!==t)),s.length||p()})}}function m(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),r=t?.createHref??(t=>t);return f({getLocation:()=>g(e(),history.state),subscriber:t=>{window.addEventListener(h,t),window.addEventListener(u,t);var e=window.history.pushState;window.history.pushState=function(){let r=e.apply(history,arguments);return t(),r};var r=window.history.replaceState;return window.history.replaceState=function(){let e=r.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=r,window.removeEventListener(h,t),window.removeEventListener(u,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:v()},"",r(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:v()},"",r(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>r(t)})}function y(t={initialEntries:["/"]}){const e=t.initialEntries;let r=t.initialIndex??e.length-1,o={};return f({getLocation:()=>g(e[r],o),subscriber:!1,pushState:(t,s)=>{o={...s,key:v()},e.push(t),r++},replaceState:(t,s)=>{o={...s,key:v()},e[r]=t},back:()=>{r--},forward:()=>{r=Math.min(r+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function g(t,e){let r=t.indexOf("#"),o=t.indexOf("?");return{href:t,pathname:t.substring(0,r>0?o>0?Math.min(r,o):r:o>0?o:t.length),hash:r>-1?t.substring(r):"",search:o>-1?t.slice(o,-1===r?void 0:r):"",state:e}}function v(){return(Math.random()+1).toString(36).substring(7)}function w(t){return t[t.length-1]}function b(t,e){return"function"==typeof t?t(e):t}function S(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})}function R(t,e){if(t===e)return t;const r=e,o=Array.isArray(t)&&Array.isArray(r);if(o||_(t)&&_(r)){const e=o?t.length:Object.keys(t).length,s=o?r:Object.keys(r),n=s.length,a=o?[]:{};let i=0;for(let e=0;e<n;e++){const n=o?e:s[e];a[n]=R(t[n],r[n]),a[n]===t[n]&&i++}return e===n&&i===e?t:a}return r}function _(t){if(!x(t))return!1;const e=t.constructor;if(void 0===e)return!0;const r=e.prototype;return!!x(r)&&!!r.hasOwnProperty("isPrototypeOf")}function x(t){return"[object Object]"===Object.prototype.toString.call(t)}function E(t,e){return t===e||typeof t==typeof e&&(_(t)&&_(e)?!Object.keys(e).some((r=>!E(t[r],e[r]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,r)=>E(t,e[r])))))}function I(t){return P(t.filter(Boolean).join("/"))}function P(t){return t.replace(/\/{2,}/g,"/")}function C(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function M(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function L(t){return M(C(t))}function O(t,e,r){e=e.replace(new RegExp(`^${t}`),"/"),r=r.replace(new RegExp(`^${t}`),"/");let o=A(e);const s=A(r);s.forEach(((t,e)=>{if("/"===t.value)e?e===s.length-1&&o.push(t):o=[t];else if(".."===t.value)o.length>1&&"/"===w(o)?.value&&o.pop(),o.pop();else{if("."===t.value)return;o.push(t)}}));return P(I([t,...o.map((t=>t.value))]))}function A(t){if(!t)return[];const e=[];if("/"===(t=P(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const r=t.split("/").filter(Boolean);return e.push(...r.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function j(t,e,r=!1){return I(A(t).map((t=>{if("wildcard"===t.type){const o=e[t.value];return r?`${t.value}${o??""}`:o}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function D(t,e,r){const o=k(t,e,r);if(!r.to||o)return o??{}}function k(t,e,r){e="/"!=t?e.substring(t.length):e;const o=`${r.to??"$"}`,s=A(e),n=A(o);e.startsWith("/")||s.unshift({type:"pathname",value:"/"}),o.startsWith("/")||n.unshift({type:"pathname",value:"/"});const a={};return(()=>{for(let t=0;t<Math.max(s.length,n.length);t++){const e=s[t],o=n[t],i=t>=s.length-1,c=t>=n.length-1;if(o){if("wildcard"===o.type)return!!e?.value&&(a["*"]=I(s.slice(t).map((t=>t.value))),!0);if("pathname"===o.type){if("/"===o.value&&!e?.value)return!0;if(e)if(r.caseSensitive){if(o.value!==e.value)return!1}else if(o.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===o.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(a[o.value.substring(1)]=e.value)}}if(!i&&c)return!!r.fuzzy}return!0})()?a:void 0}function B(t,e){var r,o,s,n="";for(r in t)if(void 0!==(s=t[r]))if(Array.isArray(s))for(o=0;o<s.length;o++)n&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(s[o]);else n&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(s);return(e||"")+n}function $(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function T(t){for(var e,r,o={},s=t.split("&");e=s.shift();)void 0!==o[r=(e=e.split("=")).shift()]?o[r]=[].concat(o[r],$(e.shift())):o[r]=$(e.shift());return o}const H="__root__";class N{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,N.__onInit(this)}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=H:c(this.parentRoute);let o=r?H:e.path;o&&"/"!==o&&(o=L(o));const s=e?.id||o;let n=r?H:I([this.parentRoute.id===H?"":this.parentRoute.id,s]);o===H&&(o="/"),n!==H&&(n=I(["/",n]));const a=n===H?"/":I([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=a,this.to=a};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{}}class F extends N{constructor(t){super(t)}}const z=W(JSON.parse),U=Y(JSON.stringify,JSON.parse);function W(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=T(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function Y(t,e){function r(r){if("object"==typeof r&&null!==r)try{return t(r)}catch(t){}else if("string"==typeof r&&"function"==typeof e)try{return e(r),t(r)}catch(t){}return r}return t=>{(t={...t})&&Object.keys(t).forEach((e=>{const o=t[e];void 0===o||void 0===o?delete t[e]:Array.isArray(o)?t[e]=o.map(r):t[e]=r(o)}));const e=B(t).toString();return e?`?${e}`:""}}const J=["component","errorComponent","pendingComponent"];const q="undefined"==typeof window||!window.document.createElement;function K(){return{status:"idle",isFetching:!1,resolvedLocation:null,location:null,matchesById:{},matchIds:[],pendingMatchIds:[],matches:[],pendingMatches:[],lastUpdated:Date.now()}}function X(t){return!!t?.isRedirect}class V extends Error{}class G extends Error{}const Q="window",Z="___";let tt,et={},rt=!1;const ot="undefined"!=typeof window&&window.sessionStorage,st=t=>t.key;function nt(t,e){const r=e?.getKey||st;ot&&(tt||(tt=(()=>{const t="tsr-scroll-restoration-v1",e=JSON.parse(window.sessionStorage.getItem(t)||"{}");return{current:e,set:(r,o)=>{e[r]=o,window.sessionStorage.setItem(t,JSON.stringify(tt))}}})()));const{history:o}=window;o.scrollRestoration&&(o.scrollRestoration="manual");const s=e=>{const o=r(t.state.resolvedLocation);et[o]||(et[o]=new WeakSet);const s=et[o];if(s.has(e.target))return;s.add(e.target);const a=[o,e.target===document||e.target===window?Q:n(e.target)].join(Z);tt.current[a]||tt.set(a,{scrollX:NaN,scrollY:NaN})},n=t=>{let e,r=[];for(;e=t.parentNode;)r.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${r.join(" > ")}`.toLowerCase()};"undefined"!=typeof document&&document.addEventListener("scroll",s,!0);const a=t.subscribe("onBeforeLoad",(t=>{t.pathChanged&&(t=>{const e=r(t);for(const t in tt.current){const r=tt.current[t],[o,s]=t.split(Z);if(e===o){if(s===Q)r.scrollX=window.scrollX||0,r.scrollY=window.scrollY||0;else if(s){const t=document.querySelector(s);r.scrollX=t?.scrollLeft||0,r.scrollY=t?.scrollTop||0}tt.set(t,r)}}})(t.from)})),i=t.subscribe("onLoad",(t=>{t.pathChanged&&(rt=!0)}));return()=>{document.removeEventListener("scroll",s),a(),i()}}function at(t,e){if(rt){rt=!1;const r=(e?.getKey||st)(t.state.location);let o=!1;for(const t in tt.current){const e=tt.current[t],[s,n]=t.split(Z);if(s===r)if(n===Q)o=!0,window.scrollTo(e.scrollX,e.scrollY);else if(n){const t=document.querySelector(n);t&&(t.scrollLeft=e.scrollX,t.scrollTop=e.scrollY)}}o||window.scrollTo(0,0)}}function it(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function ct(){return ct=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},ct.apply(this,arguments)}function ht(t){const e=mt(),{type:r,children:o,target:n,activeProps:a=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:u,search:l,params:d,to:p=".",preload:f,preloadDelay:m,replace:y,style:g,className:v,onClick:w,onFocus:S,onMouseEnter:R,onMouseLeave:_,onTouchStart:x,...E}=t,I=e.buildLink(t);if("external"===I.type){const{href:t}=I;return{href:t}}const{handleClick:P,handleFocus:C,handleEnter:M,handleLeave:L,handleTouchStart:O,isActive:A,next:j}=I,D=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},k=A?b(a,{})??{}:{},B=A?{}:b(i,{})??{};return{...k,...B,...E,href:h?void 0:j.href,onClick:D([w,e=>{(t.startTransition??1)&&(s.startTransition||(t=>t))((()=>{P(e)}))}]),onFocus:D([S,C]),onMouseEnter:D([R,M]),onMouseLeave:D([_,L]),onTouchStart:D([x,O]),target:n,style:{...g,...k.style,...B.style},className:[v,k.className,B.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":A?"active":void 0}}N.__onInit=t=>{Object.assign(t,{useMatch:(e={})=>yt({...e,from:t.id}),useLoader:(e={})=>gt({...e,from:t.id}),useContext:(e={})=>yt({...e,from:t.id,select:t=>e?.select?.(t.context)??t.context}),useRouteContext:(e={})=>yt({...e,from:t.id,select:t=>e?.select?.(t.routeContext)??t.routeContext}),useSearch:(e={})=>vt({...e,from:t.id}),useParams:(e={})=>wt({...e,from:t.id})})};const ut=s.forwardRef(((t,e)=>{const r=ht(t);return s.createElement("a",ct({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const lt=s.createContext(null),dt=s.createContext(null);function pt(t){return a(mt().__store,t?.select)}function ft(){const t=mt(),e=pt({select:e=>e.pendingMatches.some((e=>!!t.getRoute(e.routeId)?.options.pendingComponent))?e.pendingMatchIds:e.matchIds});return s.createElement(lt.Provider,{value:[void 0,...e]},s.createElement(It,{errorComponent:Ct,route:t.getRoute(H),onCatch:()=>{}},s.createElement(St,null)))}function mt(){return s.useContext(dt)}function yt(t){const e=mt(),r=s.useContext(lt)[0],o=e.getRouteMatch(r)?.routeId,n=pt({select:e=>{const o=e.matches;return(t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r))).routeId}});(t?.strict??1)&&c(o==n);return pt({select:e=>{const o=e.matches,s=t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===r));return c(s,t?.from&&t.from),t?.select?.(s)??s}})}function gt(t){return yt({...t,select:e=>t?.select?.(e.loaderData)??e.loaderData})}function vt(t){return yt({...t,select:e=>t?.select?.(e.search)??e.search})}function wt(t){return pt({select:e=>{const r=w(e.matches)?.params;return t?.select?.(r)??r}})}function bt(){const t=mt();return s.useCallback((e=>{const{pending:r,caseSensitive:o,...s}=e;return t.matchRoute(s,{pending:r,caseSensitive:o})}),[])}function St(){const t=s.useContext(lt).slice(1);return t[0]?s.createElement(_t,{matchIds:t}):null}const Rt=()=>null;function _t({matchIds:t}){const e=mt(),r=t[0],o=e.getRouteMatch(r).routeId,n=e.getRoute(o),a=n.options.pendingComponent??e.options.defaultPendingComponent??Rt,i=n.options.errorComponent??e.options.defaultErrorComponent??Ct,c=n.options.wrapInSuspense??!n.isRoot?s.Suspense:Et,h=i?It:Et;return s.createElement(lt.Provider,{value:t},s.createElement(c,{fallback:s.createElement(a,{useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams})},s.createElement(h,{key:n.id,errorComponent:i,route:n,onCatch:()=>{}},s.createElement(xt,{matchId:r,PendingComponent:a}))))}function xt({matchId:t,PendingComponent:e}){const r=mt(),o=pt({select:e=>S(e.matchesById[t],["status","loadPromise","routeId","error"])}),n=r.getRoute(o.routeId);if("error"===o.status)throw o.error;if("pending"===o.status)return s.createElement(e,{useLoader:n.useLoader,useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams});if("success"===o.status){let t=n.options.component??r.options.defaultComponent;return t?s.createElement(t,{useLoader:n.useLoader,useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams}):s.createElement(St,null)}c(!1)}function Et(t){return s.createElement(s.Fragment,null,t.children)}class It extends s.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),this.setState({error:t,info:e})}render(){return s.createElement(Pt,ct({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function Pt(t){const e=pt({select:t=>t.resolvedLocation.key}),[r,o]=s.useState(t.errorState),n=t.errorComponent??Ct,a=s.useRef("");return s.useEffect((()=>{r&&e!==a.current&&o({}),a.current=e}),[r,e]),s.useEffect((()=>{t.errorState.error&&o(t.errorState)}),[t.errorState.error]),t.errorState.error&&r.error?s.createElement(n,{...r,useMatch:t.route.useMatch,useContext:t.route.useContext,useRouteContext:t.route.useRouteContext,useSearch:t.route.useSearch,useParams:t.route.useParams}):t.children}function Ct({error:t}){const[e,r]=s.useState(!1);return s.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},s.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},s.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),s.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r((t=>!t))},e?"Hide Error":"Show Error")),s.createElement("div",{style:{height:".25rem"}}),e?s.createElement("div",null,s.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},t.message?s.createElement("code",null,t.message):null)):null)}function Mt(t,e=!0){const r=mt();s.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const Lt="undefined"!=typeof window?s.useLayoutEffect:s.useEffect;function Ot(t){const e=mt();Lt((()=>nt(e,t)),[]),Lt((()=>{at(e,t)}))}function At({promise:t}){const e=mt();let r=t.__deferredState;const o=`__TSR__DEFERRED__${r.uid}`;if(it(t)&&(r=e.hydrateData(o),(t=Promise.resolve(r.data)).__deferredState=r),"pending"===r.status)throw t;if("error"===r.status)throw r.error;return e.dehydrateData(o,r),[r.data]}t.Await=function(t){const e=At(t);return t.children(...e)},t.Block=function({message:t,condition:e,children:r}){return Mt(t,e),r??null},t.ErrorComponent=Ct,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new N(t);return e.isRoot=!1,e}},t.Link=ut,t.MatchRoute=function(t){const e=bt()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Navigate=function(t){const e=mt();return s.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=St,t.PathParamError=G,t.RootRoute=F,t.Route=N,t.Router=class{#t;constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??U,parseSearch:t?.parseSearch??z},this.__store=new n(K(),{onUpdate:()=>{const t=this.state,e=this.__store.state,r=t.matchesById!==e.matchesById;let o,s;r||(o=t.matchIds.length!==e.matchIds.length||t.matchIds.some(((t,r)=>t!==e.matchIds[r])),s=t.pendingMatchIds.length!==e.pendingMatchIds.length||t.pendingMatchIds.some(((t,r)=>t!==e.pendingMatchIds[r]))),(r||o)&&(e.matches=e.matchIds.map((t=>e.matchesById[t]))),(r||s)&&(e.pendingMatches=e.pendingMatchIds.map((t=>e.matchesById[t]))),e.isFetching=[...e.matches,...e.pendingMatches].some((t=>t.isFetching)),this.state=e},defaultPriority:"low"}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.location.href!==e.href&&this.#e({...e,replace:!0})}subscribers=new Set;subscribe=(t,e)=>{const r={eventType:t,fn:e};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}};#r=t=>{this.subscribers.forEach((e=>{e.eventType===t.type&&e.fn(t)}))};reset=()=>{this.__store.setState((t=>Object.assign(t,K())))};mount=()=>{this.safeLoad()};update=t=>{if(this.options={...this.options,...t,context:{...this.options.context,...t?.context}},!this.history||this.options.history&&this.options.history!==this.history){this.#t&&this.#t(),this.history=this.options.history??(q?y():m());const t=this.#o();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#t=this.history.subscribe((()=>{this.safeLoad({next:this.#o(this.state.location)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${L(e??"")??""}`,r&&r!==this.routeTree&&this.#s(r),this};buildNext=t=>{const e=this.#n(t),r=this.matchRoutes(e.pathname,e.search);return this.#n({...t,__matches:r})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=async t=>{try{return this.load(t)}catch(t){}};latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(r,o)=>{const s=this.state.resolvedLocation,n=!(!t?.next||s.href===t.next.href);let a;const i=()=>this.latestLoadPromise!==e?this.latestLoadPromise:void 0;let c;this.#r({type:"onBeforeLoad",from:s,to:t?.next??this.state.location,pathChanged:n}),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),c=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:t?.throwOnError,debug:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatchIds:c.map((t=>t.id)),matchesById:this.#a(t.matchesById,c)})))}));try{try{await this.loadMatches(c)}catch(t){}if(a=i())return a;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matchIds:t.pendingMatchIds,pendingMatchIds:[]}))),this.#r({type:"onLoad",from:s,to:this.state.location,pathChanged:n}),r()}catch(t){if(a=i())return a;o(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#a=(t,e)=>{const r={...t};let o=!1;return e.forEach((t=>{r[t.id]||(o=!0,r[t.id]=t)})),o?r:t};getRoute=t=>{const e=this.routesById[t];return c(e),e};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return this.__store.setState((t=>({...t,matchesById:this.#a(t.matchesById,r)}))),await this.loadMatches(r,{preload:!0,maxAge:t.maxAge}),r};cleanMatches=()=>{const t=Date.now(),e=Object.values(this.state.matchesById).filter((e=>{const r=this.getRoute(e.routeId);return!this.state.matchIds.includes(e.id)&&!this.state.pendingMatchIds.includes(e.id)&&e.preloadInvalidAt<t&&(!r.options.gcMaxAge||e.updatedAt+r.options.gcMaxAge<t)})).map((t=>t.id));e.length&&this.__store.setState((t=>{const r={...t.matchesById};return e.forEach((t=>{delete r[t]})),{...t,matchesById:r}}))};matchRoutes=(t,e,r)=>{let o={},s=this.flatRoutes.find((e=>{const r=D(this.basepath,M(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(o=r,!0)}))||this.routesById.__root__,n=[s];for(;s?.parentRoute;)s=s.parentRoute,s&&n.unshift(s);const a=n.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(o);Object.assign(o,e)}catch(t){if(e=new G(t.message,{cause:t}),r?.throwOnError)throw e;return e}})),i=n.map(((t,r)=>{const s=j(t.path,o),n=t.options.key?t.options.key({params:o,search:e})??"":"",i=n?JSON.stringify(n):"",c=j(t.id,o,!0)+i,h=this.getRouteMatch(c);if(h)return{...h};const u=!(!t.options.loader&&!J.some((e=>t.options[e]?.preload)));return{id:c,key:i,routeId:t.id,params:o,pathname:I([this.basepath,s]),updatedAt:Date.now(),invalidAt:1/0,preloadInvalidAt:1/0,routeSearch:{},search:{},status:u?"pending":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:a[r],searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return i.forEach(((t,o)=>{const s=i[o-1],n=this.getRoute(t.routeId),a=(()=>{const o={search:s?.search??e,routeSearch:s?.routeSearch??e};try{const e=("object"==typeof n.options.validateSearch?n.options.validateSearch.parse:n.options.validateSearch)?.(o.search)??{},r={...o.search,...e};return{routeSearch:R(t.routeSearch,e),search:R(t.search,r)}}catch(e){if(t.searchError=new V(e.message,{cause:e}),r?.throwOnError)throw t.searchError;return o}})();Object.assign(t,{...a});const c=(()=>{try{const e=n.options.getContext?.({parentContext:s?.routeContext??{},context:s?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...s?.context??this?.options.context,...e},routeContext:e}}catch(t){throw n.options.onError?.(t),t}})();Object.assign(t,{...c})})),i};loadMatches=async(t,e)=>{let r;e?.preload||t.forEach((t=>{this.setRouteMatch(t.id,(e=>({...e,routeSearch:t.routeSearch,search:t.search,routeContext:t.routeContext,context:t.context,error:t.error,paramsError:t.paramsError,searchError:t.searchError,params:t.params,preloadInvalidAt:0})))})),this.cleanMatches();try{for(const[o,s]of t.entries()){const t=this.getRoute(s.routeId),n=(e,n)=>{if(e.routerCode=n,r=r??o,X(e))throw e;try{t.options.onError?.(e)}catch(t){if(e=t,X(t))throw t}this.setRouteMatch(s.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};s.paramsError&&n(s.paramsError,"PARSE_PARAMS"),s.searchError&&n(s.searchError,"VALIDATE_SEARCH");let a=!1;try{await(t.options.beforeLoad?.({...s,preload:!!e?.preload}))}catch(t){n(t,"BEFORE_LOAD"),a=!0}if(a)break}}catch(t){throw e?.preload||this.navigate(t),t}const o=t.slice(0,r),s=[];o.forEach(((t,r)=>{s.push((async()=>{const o=s[r-1],n=this.getRoute(t.routeId);if(t.isFetching||"success"===t.status&&!this.getIsInvalid({matchId:t.id,preload:e?.preload}))return this.getRouteMatch(t.id)?.loadPromise;const a=Date.now(),i=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==a?e.loadPromise:void 0},c=t=>!!X(t)&&(e?.preload||this.navigate(t),!0),h=async()=>{let r;try{const s=Promise.all(J.map((async t=>{const e=n.options[t];e?.preload&&await e.preload()}))),a=n.options.loader?.({...t,preload:!!e?.preload,parentMatchPromise:o}),[c,h]=await Promise.all([s,a]);if(r=i())return await r;this.setRouteMatchData(t.id,(()=>h),e)}catch(e){if(r=i())return await r;if(c(e))return;try{n.options.onError?.(e)}catch(t){if(e=t,c(t))return}this.setRouteMatch(t.id,(t=>({...t,error:e,status:"error",isFetching:!1,updatedAt:Date.now()})))}};let u;this.__store.batch((()=>{this.setRouteMatch(t.id,(t=>({...t,isFetching:!0,fetchedAt:a,invalid:!1}))),u=h(),this.setRouteMatch(t.id,(t=>({...t,loadPromise:u})))})),await u})())})),await Promise.all(s),this.cleanMatches()};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>O(this.basepath,t,P(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:s,params:n})=>{const a=String(e),i=void 0===t?t:String(t);let h;try{new URL(`${a}`),h=!0}catch(t){}return c(!h),this.#e({from:i,to:a,search:r,hash:o,replace:s,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t);if(e?.pending&&"pending"!==this.state.status)return!1;const o=e?.pending?this.state.location:this.state.resolvedLocation;if(!o)return!1;const s=D(this.basepath,o.pathname,{...e,to:r.pathname});return!!s&&(e?.includeSearch??1?!!E(o.search,r.search)&&s:s)};buildLink=({from:t,to:e=".",search:r,params:o,hash:s,target:n,replace:a,activeOptions:i,preload:c,preloadDelay:h,disabled:u,state:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const d={from:t,to:e,search:r,params:o,hash:s,replace:a,state:l},p=this.buildNext(d);c=c??this.options.defaultPreload;const f=h??this.options.defaultPreloadDelay??0,m=this.state.location.pathname.split("/"),y=p.pathname.split("/").every(((t,e)=>t===m[e])),g=i?.exact?this.state.location.pathname===p.pathname:y,v=!i?.includeHash||this.state.location.hash===p.hash,w=!(i?.includeSearch??1)||E(this.state.location.search,p.search);return{type:"internal",next:p,handleFocus:t=>{c&&this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{u||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||n&&"_self"!==n||0!==t.button||(t.preventDefault(),this.#e(d))},handleEnter:t=>{const e=t.target||{};if(c){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),f)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(d).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&v&&w,disabled:u}};dehydrate=()=>({state:{dehydratedMatches:this.state.matches.map((t=>S(t,["fetchedAt","invalid","invalidAt","id","loaderData","status","updatedAt"])))}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),c(e);const r=e;this.dehydratedData=r.payload,this.options.hydrate?.(r.payload);const{dehydratedMatches:o}=r.router.state;let s=this.matchRoutes(this.state.location.pathname,this.state.location.search).map((t=>{const e=o.find((e=>e.id===t.id));return c(e,t.id),e?{...t,...e}:t}));this.__store.setState((t=>({...t,matches:s,matchesById:this.#a(t.matchesById,s)})))};injectedHtml=[];injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const r="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${r}`,o="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${s=r,s.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(o)}\n // ;(() => {\n // var el = document.getElementById('${t}')\n // el.parentElement.removeChild(el)\n // })()\n <\/script>`;var s})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#s=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const e=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(c(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=M(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const o=t.children;o?.length&&e(o)}))};e([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=L(t.fullPath),o=A(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const s=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:o,index:e,score:s}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const o=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let r=0;r<o;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<o;r++)if(t.parsed[r].value!==e.parsed[r].value)return t.parsed[r].value>e.parsed[r].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};#o=t=>{let{pathname:e,search:r,hash:o,state:s}=this.history.location;const n=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:R(t?.search,n),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:s,key:s?.key||"__init__"}};#n=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=O(this.basepath??"/",e,`${t.to??""}`);const o={...w(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let s=!0===(t.params??!0)?o:b(t.params,o);s&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{s={...s,...t(s)}})),r=j(r,s??{});const n=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],a=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],i=n?.length?n?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,c=!0===t.search?i:t.search?b(t.search,i)??{}:n?.length?i:{},h=a?.length?a.reduce(((t,e)=>e(t)),c):c,u=R(this.state.location.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.location.hash:b(t.hash,this.state.location.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.location.state:b(t.state,this.state.location.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.location.href===e.href&&!e.key&&(o="replace");const s=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](s,{id:r,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((r=>(r.matchesById[t]||console.warn(`No match found with id: ${t}`),{...r,matchesById:{...r.matchesById,[t]:e(r.matchesById[t])}})))};setRouteMatchData=(t,e,r)=>{const o=this.getRouteMatch(t);if(!o)return;const s=this.getRoute(o.routeId),n=r?.updatedAt??Date.now(),a=n+(r?.maxAge??s.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),i=n+(r?.maxAge??s.options.maxAge??this.options.defaultMaxAge??1/0);this.setRouteMatch(t,(t=>({...t,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:b(e,t.loaderData),preloadInvalidAt:a,invalidAt:i})))};invalidate=async t=>{if(t?.matchId){this.setRouteMatch(t.matchId,(t=>({...t,invalid:!0})));const e=this.state.matches.findIndex((e=>e.id===t.matchId)),r=this.state.matches[e+1];if(r)return this.invalidate({matchId:r.id,reload:!1})}else this.__store.batch((()=>{Object.values(this.state.matchesById).forEach((t=>{this.setRouteMatch(t.id,(t=>({...t,invalid:!0})))}))}));if(t?.reload??1)return this.reload()};getIsInvalid=t=>{if(!t?.matchId)return!!this.state.matches.find((e=>this.getIsInvalid({matchId:e.id,preload:t?.preload})));const e=this.getRouteMatch(t?.matchId);if(!e)return!1;const r=Date.now();return e.invalid||(t?.preload?e.preloadInvalidAt:e.invalidAt)<r}},t.RouterContext=class{constructor(){}createRootRoute=t=>new F(t)},t.RouterProvider=function({router:t,...e}){t.update(e),s.useEffect((()=>{let e;return s.startTransition((()=>{e=t.mount()})),e}),[t]);const r=t.options.Wrap||s.Fragment;return s.createElement(r,null,s.createElement(dt.Provider,{value:t},s.createElement(ft,null)))},t.ScrollRestoration=function(t){return Ot(t),null},t.SearchParamError=V,t.cleanPath=P,t.componentTypes=J,t.createBrowserHistory=m,t.createHashHistory=function(){return m({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=y,t.decode=T,t.defaultParseSearch=z,t.defaultStringifySearch=U,t.defer=function(t){const e=t;if(!e.__deferredState){e.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const t=e.__deferredState;e.then((e=>{t.status="success",t.data=e})).catch((e=>{t.status="error",t.error=e}))}return e},t.encode=B,t.functionalUpdate=b,t.interpolatePath=j,t.invariant=c,t.isDehydratedDeferred=it,t.isPlainObject=_,t.isRedirect=X,t.joinPaths=I,t.last=w,t.lazyFn=function(t,e){return async(...r)=>(await t())[e||"default"](...r)},t.lazyRouteComponent=function(t,e){let r;const o=()=>(r||(r=t()),r),n=s.lazy((async()=>({default:(await o())[e??"default"]})));return n.preload=o,n},t.matchByPath=k,t.matchIdsContext=lt,t.matchPathname=D,t.parsePathname=A,t.parseSearchWith=W,t.partialDeepEqual=E,t.pick=S,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=R,t.resolvePath=O,t.restoreScrollPositions=at,t.rootRouteId=H,t.routerContext=dt,t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0},t.stringifySearchWith=Y,t.trimPath=L,t.trimPathLeft=C,t.trimPathRight=M,t.useAwaited=At,t.useBlocker=Mt,t.useDehydrate=function(){const t=mt();return s.useCallback((function(e,r){return t.dehydrateData(e,r)}),[])},t.useHydrate=function(){const t=mt();return function(e){return t.hydrateData(e)}},t.useInjectHtml=function(){const t=mt();return s.useCallback((e=>{t.injectHtml(e)}),[])},t.useLinkProps=ht,t.useLoader=gt,t.useMatch=yt,t.useMatchRoute=bt,t.useMatches=function(t){const e=s.useContext(lt);return pt({select:r=>{const o=r.matches.slice(r.matches.findIndex((t=>t.id===e[0])));return t?.select?.(o)??o}})},t.useNavigate=function(t){const e=mt();return s.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=wt,t.useRouteContext=function(t){return yt({...t,select:e=>t?.select?.(e.routeContext)??e.routeContext})},t.useRouter=mt,t.useRouterContext=function(t){return yt({...t,select:e=>t?.select?.(e.context)??e.context})},t.useRouterState=pt,t.useScrollRestoration=Ot,t.useSearch=vt,t.useStore=a,t.warning=function(t,e){},t.watchScrollPositions=nt,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.production.js.map |
{ | ||
"name": "@tanstack/react-router", | ||
"author": "Tanner Linsley", | ||
"version": "0.0.1-beta.167", | ||
"version": "0.0.1-beta.168", | ||
"license": "MIT", | ||
@@ -46,4 +46,4 @@ "repository": "tanstack/router", | ||
"@gisatcz/cross-package-react-context": "^0.2.0", | ||
"@tanstack/router-core": "0.0.1-beta.167", | ||
"@tanstack/react-store": "0.0.1-beta.167" | ||
"@tanstack/router-core": "0.0.1-beta.168", | ||
"@tanstack/react-store": "0.0.1-beta.168" | ||
}, | ||
@@ -50,0 +50,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
852473
25
6131
38
11
+ Added@tanstack/react-store@0.0.1-beta.168(transitive)
+ Added@tanstack/router-core@0.0.1-beta.168(transitive)
+ Added@tanstack/store@0.0.1-beta.168(transitive)
- Removed@tanstack/react-store@0.0.1-beta.167(transitive)
- Removed@tanstack/router-core@0.0.1-beta.167(transitive)
- Removed@tanstack/store@0.0.1-beta.167(transitive)