/opt/canhelp/node_modules/next/dist/esm/client/components
NameSizeModeActions
builtin/-0755rm
errors/-0755rm
http-access-fallback/-0755rm
metadata/-0755rm
router-reducer/-0755rm
segment-cache-impl/-0755rm
styles/-0755rm
app-router-announcer.js27570644editdlrm
app-router-announcer.js.map46600644editdlrm
app-router-headers.js16750644editdlrm
app-router-headers.js.map30140644editdlrm
app-router-instance.js130370644editdlrm
app-router-instance.js.map211310644editdlrm
app-router.js230670644editdlrm
app-router.js.map350120644editdlrm
bailout-to-client-rendering.js12360644editdlrm
bailout-to-client-rendering.js.map17060644editdlrm
bfcache.js45680644editdlrm
bfcache.js.map63940644editdlrm
client-page.js25190644editdlrm
client-page.js.map39190644editdlrm
client-segment.js21060644editdlrm
client-segment.js.map30990644editdlrm
dev-root-http-access-fallback-boundary.js9010644editdlrm
dev-root-http-access-fallback-boundary.js.map12920644editdlrm
error-boundary.js47300644editdlrm
error-boundary.js.map74540644editdlrm
forbidden.js15430644editdlrm
forbidden.js.map19880644editdlrm
handle-isr-error.js7090644editdlrm
handle-isr-error.js.map13160644editdlrm
hooks-server-context.js5340644editdlrm
hooks-server-context.js.map11330644editdlrm
is-next-router-error.js4810644editdlrm
is-next-router-error.js.map9220644editdlrm
layout-router.js264060644editdlrm
layout-router.js.map378500644editdlrm
links.js125330644editdlrm
links.js.map210600644editdlrm
match-segments.js5240644editdlrm
match-segments.js.map10340644editdlrm
nav-failure-handler.js16140644editdlrm
nav-failure-handler.js.map28270644editdlrm
navigation-untracked.js23970644editdlrm
navigation-untracked.js.map33740644editdlrm
navigation.js91180644editdlrm
navigation.js.map128070644editdlrm
navigation.react-server.js19440644editdlrm
navigation.react-server.js.map27680644editdlrm
noop-head.js940644editdlrm
noop-head.js.map2330644editdlrm
not-found.js13560644editdlrm
not-found.js.map17520644editdlrm
promise-queue.js37120644editdlrm
promise-queue.js.map35910644editdlrm
redirect-boundary.js22220644editdlrm
redirect-boundary.js.map39400644editdlrm
redirect-error.js11230644editdlrm
redirect-error.js.map21030644editdlrm
redirect-status-code.js4250644editdlrm
redirect-status-code.js.map3190644editdlrm
redirect.js38220644editdlrm
redirect.js.map58370644editdlrm
render-from-template-context.js4560644editdlrm
render-from-template-context.js.map6670644editdlrm
segment-cache.js60040644editdlrm
segment-cache.js.map88230644editdlrm
static-generation-bailout.js4660644editdlrm
static-generation-bailout.js.map8770644editdlrm
unauthorized.js15700644editdlrm
unauthorized.js.map20200644editdlrm
unrecognized-action-error.js9230644editdlrm
unrecognized-action-error.js.map14780644editdlrm
unresolved-thenable.js2270644editdlrm
unresolved-thenable.js.map4410644editdlrm
unstable-rethrow.browser.js4330644editdlrm
unstable-rethrow.browser.js.map8410644editdlrm
unstable-rethrow.js7120644editdlrm
unstable-rethrow.js.map11120644editdlrm
unstable-rethrow.server.js8540644editdlrm
unstable-rethrow.server.js.map15660644editdlrm
use-action-queue.js19210644editdlrm
use-action-queue.js.map32730644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/esm/client/components/navigation.js (9118B)
import { useContext, useMemo } from 'react'; import { AppRouterContext, LayoutRouterContext } from '../../shared/lib/app-router-context.shared-runtime'; import { SearchParamsContext, PathnameContext, PathParamsContext } from '../../shared/lib/hooks-client-context.shared-runtime'; import { getSegmentValue } from './router-reducer/reducers/get-segment-value'; import { PAGE_SEGMENT_KEY, DEFAULT_SEGMENT_KEY } from '../../shared/lib/segment'; import { ReadonlyURLSearchParams } from './navigation.react-server'; const useDynamicRouteParams = typeof window === 'undefined' ? require('../../server/app-render/dynamic-rendering').useDynamicRouteParams : undefined; /** * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook * that lets you *read* the current URL's search parameters. * * Learn more about [`URLSearchParams` on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams) * * @example * ```ts * "use client" * import { useSearchParams } from 'next/navigation' * * export default function Page() { * const searchParams = useSearchParams() * searchParams.get('foo') // returns 'bar' when ?foo=bar * // ... * } * ``` * * Read more: [Next.js Docs: `useSearchParams`](https://nextjs.org/docs/app/api-reference/functions/use-search-params) */ // Client components API export function useSearchParams() { const searchParams = useContext(SearchParamsContext); // In the case where this is `null`, the compat types added in // `next-env.d.ts` will add a new overload that changes the return type to // include `null`. const readonlySearchParams = useMemo(()=>{ if (!searchParams) { // When the router is not ready in pages, we won't have the search params // available. return null; } return new ReadonlyURLSearchParams(searchParams); }, [ searchParams ]); if (typeof window === 'undefined') { // AsyncLocalStorage should not be included in the client bundle. const { bailoutToClientRendering } = require('./bailout-to-client-rendering'); // TODO-APP: handle dynamic = 'force-static' here and on the client bailoutToClientRendering('useSearchParams()'); } return readonlySearchParams; } /** * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook * that lets you read the current URL's pathname. * * @example * ```ts * "use client" * import { usePathname } from 'next/navigation' * * export default function Page() { * const pathname = usePathname() // returns "/dashboard" on /dashboard?foo=bar * // ... * } * ``` * * Read more: [Next.js Docs: `usePathname`](https://nextjs.org/docs/app/api-reference/functions/use-pathname) */ // Client components API export function usePathname() { useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('usePathname()'); // In the case where this is `null`, the compat types added in `next-env.d.ts` // will add a new overload that changes the return type to include `null`. return useContext(PathnameContext); } // Client components API export { ServerInsertedHTMLContext, useServerInsertedHTML } from '../../shared/lib/server-inserted-html.shared-runtime'; /** * * This hook allows you to programmatically change routes inside [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components). * * @example * ```ts * "use client" * import { useRouter } from 'next/navigation' * * export default function Page() { * const router = useRouter() * // ... * router.push('/dashboard') // Navigate to /dashboard * } * ``` * * Read more: [Next.js Docs: `useRouter`](https://nextjs.org/docs/app/api-reference/functions/use-router) */ // Client components API export function useRouter() { const router = useContext(AppRouterContext); if (router === null) { throw Object.defineProperty(new Error('invariant expected app router to be mounted'), "__NEXT_ERROR_CODE", { value: "E238", enumerable: false, configurable: true }); } return router; } /** * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook * that lets you read a route's dynamic params filled in by the current URL. * * @example * ```ts * "use client" * import { useParams } from 'next/navigation' * * export default function Page() { * // on /dashboard/[team] where pathname is /dashboard/nextjs * const { team } = useParams() // team === "nextjs" * } * ``` * * Read more: [Next.js Docs: `useParams`](https://nextjs.org/docs/app/api-reference/functions/use-params) */ // Client components API export function useParams() { useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('useParams()'); return useContext(PathParamsContext); } /** Get the canonical parameters from the current level to the leaf node. */ // Client components API function getSelectedLayoutSegmentPath(tree, parallelRouteKey, first, segmentPath) { if (first === void 0) first = true; if (segmentPath === void 0) segmentPath = []; let node; if (first) { // Use the provided parallel route key on the first parallel route node = tree[1][parallelRouteKey]; } else { // After first parallel route prefer children, if there's no children pick the first parallel route. const parallelRoutes = tree[1]; var _parallelRoutes_children; node = (_parallelRoutes_children = parallelRoutes.children) != null ? _parallelRoutes_children : Object.values(parallelRoutes)[0]; } if (!node) return segmentPath; const segment = node[0]; let segmentValue = getSegmentValue(segment); if (!segmentValue || segmentValue.startsWith(PAGE_SEGMENT_KEY)) { return segmentPath; } segmentPath.push(segmentValue); return getSelectedLayoutSegmentPath(node, parallelRouteKey, false, segmentPath); } /** * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook * that lets you read the active route segments **below** the Layout it is called from. * * @example * ```ts * 'use client' * * import { useSelectedLayoutSegments } from 'next/navigation' * * export default function ExampleClientComponent() { * const segments = useSelectedLayoutSegments() * * return ( * * ) * } * ``` * * Read more: [Next.js Docs: `useSelectedLayoutSegments`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segments) */ // Client components API export function useSelectedLayoutSegments(parallelRouteKey) { if (parallelRouteKey === void 0) parallelRouteKey = 'children'; useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('useSelectedLayoutSegments()'); const context = useContext(LayoutRouterContext); // @ts-expect-error This only happens in `pages`. Type is overwritten in navigation.d.ts if (!context) return null; return getSelectedLayoutSegmentPath(context.parentTree, parallelRouteKey); } /** * A [Client Component](https://nextjs.org/docs/app/building-your-application/rendering/client-components) hook * that lets you read the active route segment **one level below** the Layout it is called from. * * @example * ```ts * 'use client' * import { useSelectedLayoutSegment } from 'next/navigation' * * export default function ExampleClientComponent() { * const segment = useSelectedLayoutSegment() * * return

Active segment: {segment}

* } * ``` * * Read more: [Next.js Docs: `useSelectedLayoutSegment`](https://nextjs.org/docs/app/api-reference/functions/use-selected-layout-segment) */ // Client components API export function useSelectedLayoutSegment(parallelRouteKey) { if (parallelRouteKey === void 0) parallelRouteKey = 'children'; useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('useSelectedLayoutSegment()'); const selectedLayoutSegments = useSelectedLayoutSegments(parallelRouteKey); if (!selectedLayoutSegments || selectedLayoutSegments.length === 0) { return null; } const selectedLayoutSegment = parallelRouteKey === 'children' ? selectedLayoutSegments[0] : selectedLayoutSegments[selectedLayoutSegments.length - 1]; // if the default slot is showing, we return null since it's not technically "selected" (it's a fallback) // and returning an internal value like `__DEFAULT__` would be confusing. return selectedLayoutSegment === DEFAULT_SEGMENT_KEY ? null : selectedLayoutSegment; } export { unstable_isUnrecognizedActionError } from './unrecognized-action-error'; // Shared components APIs export { notFound, forbidden, unauthorized, redirect, permanentRedirect, RedirectType, ReadonlyURLSearchParams, unstable_rethrow } from './navigation.react-server'; //# sourceMappingURL=navigation.js.map