Rocky_Mountain_Vending/.pnpm-store/v10/files/cb/d55cc0422ff9dd153982a3903f1bfdaad576a28d9582323b33487f7790d13a745ef86f74860d8c77457f37ac5f115586aa2f096f0175fe05e5400fc90d137c
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

1 line
No EOL
7.7 KiB
Text

{"version":3,"sources":["../../src/client/resolve-href.ts"],"sourcesContent":["import type { NextRouter, Url } from '../shared/lib/router/router'\n\nimport { searchParamsToUrlQuery } from '../shared/lib/router/utils/querystring'\nimport { formatWithValidation } from '../shared/lib/router/utils/format-url'\nimport { omit } from '../shared/lib/router/utils/omit'\nimport { normalizeRepeatedSlashes } from '../shared/lib/utils'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\nimport { isLocalURL } from '../shared/lib/router/utils/is-local-url'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { interpolateAs } from '../shared/lib/router/utils/interpolate-as'\nimport { getRouteRegex } from '../shared/lib/router/utils/route-regex'\nimport { getRouteMatcher } from '../shared/lib/router/utils/route-matcher'\n\n/**\n * Resolves a given hyperlink with a certain router state (basePath not included).\n * Preserves absolute urls.\n */\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs: true\n): [string, string] | [string]\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs?: false\n): string\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs?: boolean\n): [string, string] | [string] | string {\n // we use a dummy base url for relative urls\n let base: URL\n let urlAsString = typeof href === 'string' ? href : formatWithValidation(href)\n\n // repeated slashes and backslashes in the URL are considered\n // invalid and will never match a Next.js page/file\n // https://www.rfc-editor.org/rfc/rfc3986.html#section-3.1\n const urlProtoMatch = urlAsString.match(/^[a-z][a-z0-9+.-]*:\\/\\//i)\n const urlAsStringNoProto = urlProtoMatch\n ? urlAsString.slice(urlProtoMatch[0].length)\n : urlAsString\n\n const urlParts = urlAsStringNoProto.split('?', 1)\n\n if ((urlParts[0] || '').match(/(\\/\\/|\\\\)/)) {\n console.error(\n `Invalid href '${urlAsString}' passed to next/router in page: '${router.pathname}'. Repeated forward-slashes (//) or backslashes \\\\ are not valid in the href.`\n )\n const normalizedUrl = normalizeRepeatedSlashes(urlAsStringNoProto)\n urlAsString = (urlProtoMatch ? urlProtoMatch[0] : '') + normalizedUrl\n }\n\n // Return because it cannot be routed by the Next.js router\n if (!isLocalURL(urlAsString)) {\n return (resolveAs ? [urlAsString] : urlAsString) as string\n }\n\n try {\n let baseBase = urlAsString.startsWith('#') ? router.asPath : router.pathname\n\n // If the provided href is only a query string, it is safer to use the asPath\n // considering rewrites.\n if (urlAsString.startsWith('?')) {\n baseBase = router.asPath\n\n // However, if is a dynamic route, we need to use the pathname to preserve the\n // query interpolation and rewrites (router.pathname will look like \"/[slug]\").\n if (isDynamicRoute(router.pathname)) {\n baseBase = router.pathname\n\n const routeRegex = getRouteRegex(router.pathname)\n const match = getRouteMatcher(routeRegex)(router.asPath)\n\n // For dynamic routes, if asPath doesn't match the pathname regex, it is a rewritten path.\n // In this case, should use asPath to preserve the current URL.\n if (!match) {\n baseBase = router.asPath\n }\n\n // Note: There is an edge case where the pathname is dynamic, and also a rewrite path to the same segment.\n // E.g. in \"/[slug]\" path, rewrite \"/foo\" -> \"/bar\"\n\n // In this case, it will be treated as a non-rewritten path and possibly interpolate the query string.\n // E.g., \"/any?slug=foo\" will become the content of \"/foo\", not rewritten as \"/bar\"\n\n // This is currently a trade-off of not resolving rewrite paths on every Router/Link call,\n // but using a lighter route regex pattern check.\n }\n }\n\n base = new URL(baseBase, 'http://n')\n } catch (_) {\n // fallback to / for invalid asPath values e.g. //\n base = new URL('/', 'http://n')\n }\n\n try {\n const finalUrl = new URL(urlAsString, base)\n finalUrl.pathname = normalizePathTrailingSlash(finalUrl.pathname)\n let interpolatedAs = ''\n\n if (\n isDynamicRoute(finalUrl.pathname) &&\n finalUrl.searchParams &&\n resolveAs\n ) {\n const query = searchParamsToUrlQuery(finalUrl.searchParams)\n\n const { result, params } = interpolateAs(\n finalUrl.pathname,\n finalUrl.pathname,\n query\n )\n\n if (result) {\n interpolatedAs = formatWithValidation({\n pathname: result,\n hash: finalUrl.hash,\n query: omit(query, params),\n })\n }\n }\n\n // if the origin didn't change, it means we received a relative href\n const resolvedHref =\n finalUrl.origin === base.origin\n ? finalUrl.href.slice(finalUrl.origin.length)\n : finalUrl.href\n\n return resolveAs\n ? [resolvedHref, interpolatedAs || resolvedHref]\n : resolvedHref\n } catch (_) {\n return resolveAs ? [urlAsString] : urlAsString\n }\n}\n"],"names":["resolveHref","router","href","resolveAs","base","urlAsString","formatWithValidation","urlProtoMatch","match","urlAsStringNoProto","slice","length","urlParts","split","console","error","pathname","normalizedUrl","normalizeRepeatedSlashes","isLocalURL","baseBase","startsWith","asPath","isDynamicRoute","routeRegex","getRouteRegex","getRouteMatcher","URL","_","finalUrl","normalizePathTrailingSlash","interpolatedAs","searchParams","query","searchParamsToUrlQuery","result","params","interpolateAs","hash","omit","resolvedHref","origin"],"mappings":";;;;+BA2BgBA;;;eAAAA;;;6BAzBuB;2BACF;sBAChB;uBACoB;wCACE;4BAChB;wBACI;+BACD;4BACA;8BACE;AAgBzB,SAASA,YACdC,MAAkB,EAClBC,IAAS,EACTC,SAAmB;IAEnB,4CAA4C;IAC5C,IAAIC;IACJ,IAAIC,cAAc,OAAOH,SAAS,WAAWA,OAAOI,IAAAA,+BAAoB,EAACJ;IAEzE,6DAA6D;IAC7D,mDAAmD;IACnD,0DAA0D;IAC1D,MAAMK,gBAAgBF,YAAYG,KAAK,CAAC;IACxC,MAAMC,qBAAqBF,gBACvBF,YAAYK,KAAK,CAACH,aAAa,CAAC,EAAE,CAACI,MAAM,IACzCN;IAEJ,MAAMO,WAAWH,mBAAmBI,K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