vorma 0.83.0 → 0.85.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../internal/framework/_typescript/client/src/client.ts", "../../../../../internal/framework/_typescript/client/src/vorma_ctx/vorma_ctx.ts", "../../../../../internal/framework/_typescript/client/src/resolve_public_href.ts", "../../../../../internal/framework/_typescript/client/src/asset_manager.ts", "../../../../../internal/framework/_typescript/client/src/client_loaders.ts", "../../../../../internal/framework/_typescript/client/src/component_loader.ts", "../../../../../internal/framework/_typescript/client/src/utils/logging.ts", "../../../../../internal/framework/_typescript/client/src/utils/errors.ts", "../../../../../internal/framework/_typescript/client/src/events.ts", "../../../../../node_modules/@babel/runtime/helpers/esm/extends.js", "../../../../../node_modules/history/index.js", "../../../../../internal/framework/_typescript/client/src/scroll_state_manager.ts", "../../../../../internal/framework/_typescript/client/src/history/history.ts", "../../../../../internal/framework/_typescript/client/src/redirects/redirects.ts", "../../../../../internal/framework/_typescript/client/src/hard_reload.ts", "../../../../../internal/framework/_typescript/client/src/head_elements/head_elements.ts", "../../../../../internal/framework/_typescript/client/src/rendering.ts", "../../../../../internal/framework/_typescript/client/src/error_boundary.ts", "../../../../../internal/framework/_typescript/client/src/global_loading_indicator/global_loading_indicator.ts", "../../../../../internal/framework/_typescript/client/src/hmr/hmr.ts", "../../../../../internal/framework/_typescript/client/src/init_client.ts", "../../../../../internal/framework/_typescript/client/src/links.ts", "../../../../../internal/framework/_typescript/client/src/static_route_defs/route_def_helpers.ts", "../../../../../internal/framework/_typescript/client/src/vorma_app_helpers/vorma_app_helpers.ts", "../../../../../internal/framework/_typescript/client/src/ui_lib_impl_helpers/link_components.ts", "../../../../../internal/framework/_typescript/client/src/ui_lib_impl_helpers/typed_navigate.ts", "../../../../../internal/framework/_typescript/client/src/window_focus_revalidation/window_focus_revalidation.ts"],
4
- "sourcesContent": ["/// <reference types=\"vite/client\" />\n\nimport { debounce } from \"vorma/kit/debounce\";\nimport { jsonDeepEquals } from \"vorma/kit/json\";\nimport { findNestedMatches, type Match } from \"vorma/kit/matcher/find-nested\";\nimport { getIsGETRequest } from \"vorma/kit/url\";\nimport { AssetManager } from \"./asset_manager.ts\";\nimport {\n\tcompleteClientLoaders,\n\tfindPartialMatchesOnClient,\n\tsetClientLoadersState,\n\ttype ClientLoadersResult,\n} from \"./client_loaders.ts\";\nimport {\n\tdispatchBuildIDEvent,\n\tdispatchStatusEvent,\n\ttype StatusEventDetail,\n} from \"./events.ts\";\nimport { HistoryManager } from \"./history/history.ts\";\nimport type { historyInstance } from \"./history/npm_history_types.ts\";\nimport {\n\teffectuateRedirectDataResult,\n\tgetBuildIDFromResponse,\n\thandleRedirects,\n\ttype RedirectData,\n} from \"./redirects/redirects.ts\";\nimport { __reRenderApp } from \"./rendering.ts\";\nimport {\n\t__applyScrollState,\n\ttype ScrollState,\n} from \"./scroll_state_manager.ts\";\nimport { isAbortError } from \"./utils/errors.ts\";\nimport { logError } from \"./utils/logging.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype ClientLoaderAwaitedServerData,\n\ttype GetRouteDataOutput,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\n/////////////////////////////////////////////////////////////////////\n// TYPES\n/////////////////////////////////////////////////////////////////////\n\nexport type VormaNavigationType =\n\t| \"browserHistory\"\n\t| \"userNavigation\"\n\t| \"revalidation\"\n\t| \"redirect\"\n\t| \"prefetch\"\n\t| \"action\";\n\nexport type NavigateProps = {\n\thref: string;\n\tstate?: unknown;\n\tnavigationType: VormaNavigationType;\n\tscrollStateToRestore?: ScrollState;\n\treplace?: boolean;\n\tredirectCount?: number;\n\tscrollToTop?: boolean;\n};\n\ntype NavigationResult =\n\t| ({\n\t\t\tresponse: Response;\n\t\t\tprops: NavigateProps;\n\t } & (\n\t\t\t| {\n\t\t\t\t\tjson: GetRouteDataOutput;\n\t\t\t\t\tcssBundlePromises: Array<Promise<any>>;\n\t\t\t\t\twaitFnPromise: Promise<ClientLoadersResult> | undefined;\n\t\t\t }\n\t\t\t| { redirectData: RedirectData }\n\t ))\n\t| undefined;\n\nexport type NavigationControl = {\n\tabortController: AbortController | undefined;\n\tpromise: Promise<NavigationResult>;\n};\n\n/////////////////////////////////////////////////////////////////////\n// NAVIGATION STATE MANAGER\n/////////////////////////////////////////////////////////////////////\n\n// Navigation phases represent the lifecycle stages\ntype NavigationPhase =\n\t| \"fetching\" // Fetching route data\n\t| \"waiting\" // Waiting for assets/loaders\n\t| \"rendering\" // Applying changes to DOM\n\t| \"complete\"; // Navigation finished\n\n// Navigation intent represents what should happen when complete\ntype NavigationIntent =\n\t| \"none\" // Prefetch -- don't navigate unless upgraded\n\t| \"navigate\" // Normal navigation -- update URL and render\n\t| \"revalidate\"; // Revalidation -- only update if still on same page\n\ninterface NavigationEntry {\n\tcontrol: NavigationControl;\n\ttype: VormaNavigationType;\n\tintent: NavigationIntent;\n\tphase: NavigationPhase;\n\tstartTime: number;\n\ttargetUrl: string; // URL this navigation is targeting\n\toriginUrl: string; // URL when navigation started (for revalidation)\n\tscrollToTop?: boolean;\n\treplace?: boolean;\n\tstate?: unknown;\n}\n\ninterface SubmissionEntry {\n\tcontrol: NavigationControl;\n\tstartTime: number;\n\tskipGlobalLoadingIndicator?: boolean;\n}\n\nclass NavigationStateManager {\n\tprivate _navigations = new Map<string, NavigationEntry>();\n\tprivate _submissions = new Map<string | symbol, SubmissionEntry>();\n\tprivate lastDispatchedStatus: StatusEventDetail | null = null;\n\tprivate dispatchStatusEventDebounced: () => void;\n\tprivate readonly REVALIDATION_COALESCE_MS = 8;\n\n\tconstructor() {\n\t\tthis.dispatchStatusEventDebounced = debounce(() => {\n\t\t\tthis.dispatchStatusEvent();\n\t\t}, 8);\n\t}\n\n\tasync navigate(props: NavigateProps): Promise<{ didNavigate: boolean }> {\n\t\tconst control = this.beginNavigation(props);\n\n\t\ttry {\n\t\t\tconst result = await control.promise;\n\t\t\tif (!result) {\n\t\t\t\treturn { didNavigate: false };\n\t\t\t}\n\n\t\t\t// Process based on navigation entry state\n\t\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\t\t\tconst entry = this._navigations.get(targetUrl);\n\t\t\tif (!entry) {\n\t\t\t\treturn { didNavigate: false };\n\t\t\t}\n\n\t\t\tif (entry.intent === \"navigate\" || entry.intent === \"revalidate\") {\n\t\t\t\tconst now = Date.now();\n\t\t\t\tlastTriggeredNavOrRevalidateTimestampMS = now;\n\t\t\t}\n\n\t\t\t// Always call processNavigationResult so the module map and other caches are populated.\n\t\t\tawait this.processNavigationResult(result, entry);\n\n\t\t\t// After processing, if it was just a prefetch, then we can return\n\t\t\t// and signal that no UI navigation occurred.\n\t\t\tif (entry.intent === \"none\" && entry.type === \"prefetch\") {\n\t\t\t\treturn { didNavigate: false };\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\t\t\tthis.deleteNavigation(targetUrl);\n\t\t\tif (!isAbortError(error)) {\n\t\t\t\tlogError(\"Navigate error:\", error);\n\t\t\t}\n\t\t\treturn { didNavigate: false };\n\t\t}\n\t\treturn { didNavigate: true };\n\t}\n\n\tbeginNavigation(props: NavigateProps): NavigationControl {\n\t\tconst existing = this._navigations.get(\n\t\t\tnew URL(props.href, window.location.href).href,\n\t\t);\n\n\t\tswitch (props.navigationType) {\n\t\t\tcase \"userNavigation\":\n\t\t\t\treturn this.beginUserNavigation(props, existing);\n\t\t\tcase \"prefetch\":\n\t\t\t\treturn this.beginPrefetch(props, existing);\n\t\t\tcase \"revalidation\":\n\t\t\t\treturn this.beginRevalidation(props);\n\t\t\tcase \"browserHistory\":\n\t\t\tcase \"redirect\":\n\t\t\tdefault:\n\t\t\t\treturn this.createNavigation(props, \"navigate\");\n\t\t}\n\t}\n\n\tprivate beginUserNavigation(\n\t\tprops: NavigateProps,\n\t\texisting: NavigationEntry | undefined,\n\t): NavigationControl {\n\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\n\t\t// Abort all other navigations\n\t\tthis.abortAllNavigationsExcept(targetUrl);\n\n\t\tif (existing) {\n\t\t\tif (existing.type === \"prefetch\") {\n\t\t\t\t// Upgrade prefetch to user navigation\n\t\t\t\tthis.upgradeNavigation(targetUrl, {\n\t\t\t\t\ttype: \"userNavigation\",\n\t\t\t\t\tintent: \"navigate\",\n\t\t\t\t\tscrollToTop: props.scrollToTop,\n\t\t\t\t\treplace: props.replace,\n\t\t\t\t\tstate: props.state,\n\t\t\t\t});\n\t\t\t\treturn existing.control;\n\t\t\t}\n\n\t\t\t// Already navigating to this URL, return existing\n\t\t\treturn existing.control;\n\t\t}\n\n\t\treturn this.createNavigation(props, \"navigate\");\n\t}\n\n\tprivate beginPrefetch(\n\t\tprops: NavigateProps,\n\t\texisting: NavigationEntry | undefined,\n\t): NavigationControl {\n\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\n\t\tif (existing) {\n\t\t\treturn existing.control;\n\t\t}\n\n\t\t// Don't prefetch current page\n\t\tconst currentUrl = new URL(window.location.href);\n\t\tconst targetUrlObj = new URL(targetUrl);\n\t\tcurrentUrl.hash = \"\";\n\t\ttargetUrlObj.hash = \"\";\n\t\tif (currentUrl.href === targetUrlObj.href) {\n\t\t\t// Return a no-op control\n\t\t\treturn {\n\t\t\t\tabortController: new AbortController(),\n\t\t\t\tpromise: Promise.resolve(undefined),\n\t\t\t};\n\t\t}\n\n\t\treturn this.createNavigation(props, \"none\");\n\t}\n\n\tprivate beginRevalidation(props: NavigateProps): NavigationControl {\n\t\t// Store current URL to validate against later\n\t\tconst currentUrl = window.location.href;\n\n\t\t// Check for recent revalidation to same URL\n\t\tconst existing = this._navigations.get(currentUrl);\n\t\tif (\n\t\t\texisting?.type === \"revalidation\" &&\n\t\t\tDate.now() - existing.startTime < this.REVALIDATION_COALESCE_MS\n\t\t) {\n\t\t\treturn existing.control;\n\t\t}\n\n\t\t// Abort other revalidations\n\t\tfor (const [key, nav] of this._navigations.entries()) {\n\t\t\tif (nav.type === \"revalidation\") {\n\t\t\t\tnav.control.abortController?.abort();\n\t\t\t\tthis.deleteNavigation(key);\n\t\t\t}\n\t\t}\n\n\t\t// Create revalidation with current URL\n\t\treturn this.createNavigation(\n\t\t\t{ ...props, href: currentUrl },\n\t\t\t\"revalidate\",\n\t\t);\n\t}\n\n\tprivate createNavigation(\n\t\tprops: NavigateProps,\n\t\tintent: NavigationIntent,\n\t): NavigationControl {\n\t\tconst controller = new AbortController();\n\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\n\t\tconst entry: NavigationEntry = {\n\t\t\tcontrol: {\n\t\t\t\tabortController: controller,\n\t\t\t\tpromise: this.fetchRouteData(controller, props).catch(\n\t\t\t\t\t(error) => {\n\t\t\t\t\t\tthis.deleteNavigation(targetUrl);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t},\n\t\t\ttype: props.navigationType,\n\t\t\tintent,\n\t\t\tphase: \"fetching\",\n\t\t\tstartTime: Date.now(),\n\t\t\ttargetUrl,\n\t\t\toriginUrl: window.location.href,\n\t\t\tscrollToTop: props.scrollToTop,\n\t\t\treplace: props.replace,\n\t\t\tstate: props.state,\n\t\t};\n\n\t\tthis.setNavigation(targetUrl, entry);\n\t\treturn entry.control;\n\t}\n\n\tprivate upgradeNavigation(\n\t\thref: string,\n\t\tupdates: Partial<\n\t\t\tPick<\n\t\t\t\tNavigationEntry,\n\t\t\t\t\"type\" | \"intent\" | \"scrollToTop\" | \"replace\" | \"state\"\n\t\t\t>\n\t\t>,\n\t): void {\n\t\tconst existing = this._navigations.get(href);\n\t\tif (!existing) return;\n\n\t\tthis.setNavigation(href, {\n\t\t\t...existing,\n\t\t\t...updates,\n\t\t});\n\t}\n\n\tprivate transitionPhase(href: string, phase: NavigationPhase): void {\n\t\tconst existing = this._navigations.get(href);\n\t\tif (!existing) return;\n\n\t\tthis.setNavigation(href, {\n\t\t\t...existing,\n\t\t\tphase,\n\t\t});\n\t}\n\n\tprivate canSkipServerFetch(targetUrl: string): {\n\t\tcanSkip: boolean;\n\t\tmatchResult?: any;\n\t\timportURLs?: string[];\n\t\texportKeys?: string[];\n\t\tloadersData?: any[];\n\t} {\n\t\tconst routeManifest = __vormaClientGlobal.get(\"routeManifest\");\n\t\tif (!routeManifest) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\tconst patternRegistry = __vormaClientGlobal.get(\"patternRegistry\");\n\t\tif (!patternRegistry) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\tconst patternToWaitFnMap =\n\t\t\t__vormaClientGlobal.get(\"patternToWaitFnMap\") || {};\n\n\t\tconst url = new URL(targetUrl);\n\t\tconst matchResult = findNestedMatches(patternRegistry, url.pathname);\n\t\tif (!matchResult) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\tconst clientModuleMap =\n\t\t\t__vormaClientGlobal.get(\"clientModuleMap\") || {};\n\t\tconst currentMatchedPatterns =\n\t\t\t__vormaClientGlobal.get(\"matchedPatterns\") || [];\n\t\tconst currentParams = __vormaClientGlobal.get(\"params\") || {};\n\t\tconst currentSplatValues = __vormaClientGlobal.get(\"splatValues\") || [];\n\t\tconst currentLoadersData = __vormaClientGlobal.get(\"loadersData\") || [];\n\n\t\t// Check if any current server loaders are being removed\n\t\tfor (const pattern of currentMatchedPatterns) {\n\t\t\tconst hasServerLoader = routeManifest[pattern] === 1;\n\t\t\tif (hasServerLoader) {\n\t\t\t\tconst stillMatched = matchResult.matches.some(\n\t\t\t\t\t(m: any) => m.registeredPattern.originalPattern === pattern,\n\t\t\t\t);\n\t\t\t\tif (!stillMatched) {\n\t\t\t\t\t// A server loader is being removed - must fetch from server\n\t\t\t\t\treturn { canSkip: false };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Block skip if the target introduces a new client loader\n\t\tfor (const m of matchResult.matches) {\n\t\t\tconst pattern = m.registeredPattern.originalPattern;\n\t\t\tconst hasClientLoader = !!patternToWaitFnMap[pattern];\n\t\t\tconst wasAlreadyMatched = currentMatchedPatterns.includes(pattern);\n\t\t\tif (hasClientLoader && !wasAlreadyMatched) {\n\t\t\t\treturn { canSkip: false };\n\t\t\t}\n\t\t}\n\n\t\tlet outermostLoaderIndex = -1;\n\t\tfor (let i = matchResult.matches.length - 1; i >= 0; i--) {\n\t\t\tconst match: Match | undefined = matchResult.matches[i];\n\t\t\tif (!match) continue;\n\n\t\t\tconst pattern = match.registeredPattern.originalPattern;\n\t\t\tconst hasServerLoader = routeManifest[pattern] === 1;\n\t\t\tconst hasClientLoader = !!patternToWaitFnMap[pattern];\n\n\t\t\tif (hasServerLoader || hasClientLoader) {\n\t\t\t\toutermostLoaderIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tconst currentUrlObj = new URL(window.location.href);\n\t\tconst currentParamsSorted = Array.from(\n\t\t\tcurrentUrlObj.searchParams.entries(),\n\t\t).sort();\n\t\tconst targetParamsSorted = Array.from(\n\t\t\turl.searchParams.entries(),\n\t\t).sort();\n\t\tconst searchChanged = !jsonDeepEquals(\n\t\t\tcurrentParamsSorted,\n\t\t\ttargetParamsSorted,\n\t\t);\n\n\t\tif (searchChanged && outermostLoaderIndex !== -1) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\tif (outermostLoaderIndex !== -1) {\n\t\t\tconst outermostMatch = matchResult.matches[outermostLoaderIndex];\n\t\t\tif (outermostMatch) {\n\t\t\t\tfor (const seg of outermostMatch.registeredPattern\n\t\t\t\t\t.normalizedSegments) {\n\t\t\t\t\tif (seg.segType === \"dynamic\") {\n\t\t\t\t\t\tconst paramName = seg.normalizedVal.substring(1);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tmatchResult.params[paramName] !==\n\t\t\t\t\t\t\tcurrentParams[paramName]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn { canSkip: false };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst hasSplat =\n\t\t\t\t\toutermostMatch.registeredPattern.lastSegType === \"splat\";\n\n\t\t\t\tif (hasSplat) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t!jsonDeepEquals(\n\t\t\t\t\t\t\tmatchResult.splatValues,\n\t\t\t\t\t\t\tcurrentSplatValues,\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn { canSkip: false };\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst importURLs: string[] = [];\n\t\tconst exportKeys: string[] = [];\n\t\tconst loadersData: any[] = [];\n\n\t\tfor (let i = 0; i < matchResult.matches.length; i++) {\n\t\t\tconst match: Match | undefined = matchResult.matches[i];\n\t\t\tif (!match) continue;\n\n\t\t\tconst pattern = match.registeredPattern.originalPattern;\n\n\t\t\tconst moduleInfo = clientModuleMap[pattern];\n\t\t\tif (!moduleInfo) {\n\t\t\t\treturn { canSkip: false };\n\t\t\t}\n\n\t\t\timportURLs.push(moduleInfo.importURL);\n\t\t\texportKeys.push(moduleInfo.exportKey);\n\n\t\t\tconst hasServerLoader = routeManifest[pattern] === 1;\n\n\t\t\tif (!hasServerLoader) {\n\t\t\t\tloadersData.push(undefined);\n\t\t\t} else {\n\t\t\t\tconst currentPatternIndex =\n\t\t\t\t\tcurrentMatchedPatterns.indexOf(pattern);\n\n\t\t\t\tif (currentPatternIndex === -1) {\n\t\t\t\t\t// New server loader that we don't have data for\n\t\t\t\t\treturn { canSkip: false };\n\t\t\t\t}\n\t\t\t\tloadersData.push(currentLoadersData[currentPatternIndex]);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcanSkip: true,\n\t\t\tmatchResult,\n\t\t\timportURLs,\n\t\t\texportKeys,\n\t\t\tloadersData,\n\t\t};\n\t}\n\n\tprivate async fetchRouteData(\n\t\tcontroller: AbortController,\n\t\tprops: NavigateProps,\n\t): Promise<NavigationResult> {\n\t\ttry {\n\t\t\tconst url = new URL(props.href, window.location.href);\n\n\t\t\t// Check if we can skip the server fetch (not for revalidations)\n\t\t\tif (\n\t\t\t\tprops.navigationType !== \"revalidation\" &&\n\t\t\t\tprops.navigationType !== \"action\"\n\t\t\t) {\n\t\t\t\tconst skipCheck = this.canSkipServerFetch(url.href);\n\n\t\t\t\tif (skipCheck.canSkip && skipCheck.matchResult) {\n\t\t\t\t\t// We can use client-only navigation\n\t\t\t\t\tconst { importURLs, exportKeys, loadersData } = skipCheck;\n\n\t\t\t\t\t// Build the response as if it came from the server\n\t\t\t\t\tconst json: GetRouteDataOutput = {\n\t\t\t\t\t\tmatchedPatterns: skipCheck.matchResult.matches.map(\n\t\t\t\t\t\t\t(m: any) => m.registeredPattern.originalPattern,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tloadersData: loadersData!,\n\t\t\t\t\t\timportURLs: importURLs!,\n\t\t\t\t\t\texportKeys: exportKeys!,\n\t\t\t\t\t\thasRootData: __vormaClientGlobal.get(\"hasRootData\"),\n\t\t\t\t\t\tparams: skipCheck.matchResult.params,\n\t\t\t\t\t\tsplatValues: skipCheck.matchResult.splatValues,\n\t\t\t\t\t\tdeps: [],\n\t\t\t\t\t\tcssBundles: [],\n\t\t\t\t\t\toutermostServerError: undefined,\n\t\t\t\t\t\toutermostServerErrorIdx: undefined,\n\t\t\t\t\t\terrorExportKeys: [],\n\t\t\t\t\t\ttitle: undefined,\n\t\t\t\t\t\tmetaHeadEls: undefined,\n\t\t\t\t\t\trestHeadEls: undefined,\n\t\t\t\t\t\tactiveComponents: undefined as unknown as [],\n\t\t\t\t\t};\n\n\t\t\t\t\t// Create a response object\n\t\t\t\t\tconst response = new Response(JSON.stringify(json), {\n\t\t\t\t\t\tstatus: 200,\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t\t\t\"X-Vorma-Build-Id\":\n\t\t\t\t\t\t\t\t__vormaClientGlobal.get(\"buildID\") || \"1\",\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\n\t\t\t\t\tconst currentClientLoadersData =\n\t\t\t\t\t\t__vormaClientGlobal.get(\"clientLoadersData\") || [];\n\t\t\t\t\tconst patternToWaitFnMap =\n\t\t\t\t\t\t__vormaClientGlobal.get(\"patternToWaitFnMap\") || {};\n\t\t\t\t\tconst runningLoaders = new Map<string, Promise<any>>();\n\n\t\t\t\t\tfor (let i = 0; i < json.matchedPatterns.length; i++) {\n\t\t\t\t\t\tconst pattern = json.matchedPatterns[i];\n\t\t\t\t\t\tif (!pattern) continue;\n\n\t\t\t\t\t\tif (patternToWaitFnMap[pattern]) {\n\t\t\t\t\t\t\tconst currentMatchedPatterns =\n\t\t\t\t\t\t\t\t__vormaClientGlobal.get(\"matchedPatterns\") ||\n\t\t\t\t\t\t\t\t[];\n\t\t\t\t\t\t\tconst currentPatternIndex =\n\t\t\t\t\t\t\t\tcurrentMatchedPatterns.indexOf(pattern);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tcurrentPatternIndex !== -1 &&\n\t\t\t\t\t\t\t\tcurrentClientLoadersData[\n\t\t\t\t\t\t\t\t\tcurrentPatternIndex\n\t\t\t\t\t\t\t\t] !== undefined\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\trunningLoaders.set(\n\t\t\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\t\t\tPromise.resolve(\n\t\t\t\t\t\t\t\t\t\tcurrentClientLoadersData[\n\t\t\t\t\t\t\t\t\t\t\tcurrentPatternIndex\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst waitFnPromise = completeClientLoaders(\n\t\t\t\t\t\tjson,\n\t\t\t\t\t\t__vormaClientGlobal.get(\"buildID\") || \"1\",\n\t\t\t\t\t\trunningLoaders,\n\t\t\t\t\t\tcontroller.signal,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tresponse,\n\t\t\t\t\t\tprops,\n\t\t\t\t\t\tjson,\n\t\t\t\t\t\tcssBundlePromises: [],\n\t\t\t\t\t\twaitFnPromise,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\turl.searchParams.set(\n\t\t\t\t\"vorma_json\",\n\t\t\t\t__vormaClientGlobal.get(\"buildID\") || \"1\",\n\t\t\t);\n\n\t\t\tif (props.navigationType === \"revalidation\") {\n\t\t\t\tconst deploymentID = __vormaClientGlobal.get(\"deploymentID\");\n\t\t\t\tif (deploymentID) {\n\t\t\t\t\turl.searchParams.set(\"dpl\", deploymentID);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Start server fetch and immediately process the response to JSON\n\t\t\tconst serverPromise = handleRedirects({\n\t\t\t\tabortController: controller,\n\t\t\t\turl,\n\t\t\t\tisPrefetch: props.navigationType === \"prefetch\",\n\t\t\t\tredirectCount: props.redirectCount,\n\t\t\t}).then(async (result) => {\n\t\t\t\t// Read the response body once and return both the original result and parsed JSON\n\t\t\t\tif (\n\t\t\t\t\tresult.response &&\n\t\t\t\t\tresult.response.ok &&\n\t\t\t\t\t!result.redirectData?.status\n\t\t\t\t) {\n\t\t\t\t\tconst json = await result.response.json();\n\t\t\t\t\treturn { ...result, json };\n\t\t\t\t}\n\t\t\t\treturn { ...result, json: undefined };\n\t\t\t});\n\n\t\t\t// Try to match routes on the client and start parallel loaders\n\t\t\tconst pathname = url.pathname;\n\t\t\tconst matchResult = await findPartialMatchesOnClient(pathname);\n\t\t\tconst patternToWaitFnMap =\n\t\t\t\t__vormaClientGlobal.get(\"patternToWaitFnMap\");\n\t\t\tconst runningLoaders = new Map<string, Promise<any>>();\n\n\t\t\t// Start client loaders for already-registered patterns\n\t\t\tif (matchResult) {\n\t\t\t\tconst { params, splatValues, matches } = matchResult;\n\n\t\t\t\tfor (let i = 0; i < matches.length; i++) {\n\t\t\t\t\tconst match = matches[i];\n\t\t\t\t\tif (!match) continue;\n\n\t\t\t\t\tconst pattern = match.registeredPattern.originalPattern;\n\t\t\t\t\tconst loaderFn = patternToWaitFnMap[pattern];\n\n\t\t\t\t\tif (loaderFn) {\n\t\t\t\t\t\t// Create a promise for this pattern's server data\n\t\t\t\t\t\tconst serverDataPromise = serverPromise\n\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t({\n\t\t\t\t\t\t\t\t\tresponse,\n\t\t\t\t\t\t\t\t\tjson,\n\t\t\t\t\t\t\t\t}): ClientLoaderAwaitedServerData<any, any> => {\n\t\t\t\t\t\t\t\t\tif (!response || !response.ok || !json) {\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\tmatchedPatterns: [],\n\t\t\t\t\t\t\t\t\t\t\tloaderData: undefined,\n\t\t\t\t\t\t\t\t\t\t\trootData: null,\n\t\t\t\t\t\t\t\t\t\t\tbuildID: \"1\",\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst serverIdx =\n\t\t\t\t\t\t\t\t\t\tjson.matchedPatterns?.indexOf(pattern);\n\t\t\t\t\t\t\t\t\tconst loaderData =\n\t\t\t\t\t\t\t\t\t\tserverIdx !== -1 &&\n\t\t\t\t\t\t\t\t\t\tserverIdx !== undefined\n\t\t\t\t\t\t\t\t\t\t\t? json.loadersData[serverIdx]\n\t\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\t\tconst rootData = json.hasRootData\n\t\t\t\t\t\t\t\t\t\t? json.loadersData[0]\n\t\t\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t\t\t\tconst buildID =\n\t\t\t\t\t\t\t\t\t\tgetBuildIDFromResponse(response) || \"1\";\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tmatchedPatterns:\n\t\t\t\t\t\t\t\t\t\t\tjson.matchedPatterns || [],\n\t\t\t\t\t\t\t\t\t\tloaderData,\n\t\t\t\t\t\t\t\t\t\trootData,\n\t\t\t\t\t\t\t\t\t\tbuildID,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.catch(() => ({\n\t\t\t\t\t\t\t\tmatchedPatterns: [],\n\t\t\t\t\t\t\t\tloaderData: undefined,\n\t\t\t\t\t\t\t\trootData: null,\n\t\t\t\t\t\t\t\tbuildID: \"1\",\n\t\t\t\t\t\t\t}));\n\n\t\t\t\t\t\tconst loaderPromise = loaderFn({\n\t\t\t\t\t\t\tparams,\n\t\t\t\t\t\t\tsplatValues,\n\t\t\t\t\t\t\tserverDataPromise,\n\t\t\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\trunningLoaders.set(pattern, loaderPromise);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Wait for server response\n\t\t\tconst { redirectData, response, json } = await serverPromise;\n\n\t\t\tconst redirected = redirectData?.status === \"did\";\n\t\t\tconst responseNotOK = !response?.ok && response?.status !== 304;\n\n\t\t\tif (redirected || !response) {\n\t\t\t\t// This is a valid end to a navigation attempt (e.g., a redirect occurred\n\t\t\t\t// or the request was aborted). It's not an error.\n\t\t\t\tcontroller.abort();\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (responseNotOK) {\n\t\t\t\t// This is a server error. Throwing an exception allows our .catch()\n\t\t\t\t// blocks to handle cleanup and reset the loading state.\n\t\t\t\tcontroller.abort();\n\t\t\t\tthrow new Error(`Fetch failed with status ${response.status}`);\n\t\t\t}\n\n\t\t\tif (redirectData?.status === \"should\") {\n\t\t\t\tcontroller.abort();\n\t\t\t\treturn { response, redirectData, props };\n\t\t\t}\n\n\t\t\tif (!json) {\n\t\t\t\tcontroller.abort();\n\t\t\t\tthrow new Error(\"No JSON response\");\n\t\t\t}\n\n\t\t\t// deps are only present in prod because they stem from the rollup metafile\n\t\t\t// (same for CSS bundles -- vite handles them in dev)\n\t\t\t// so in dev, to get similar behavior, we use the importURLs\n\t\t\t// (which is a subset of what the deps would be in prod)\n\t\t\tconst depsToPreload = import.meta.env.DEV\n\t\t\t\t? [...new Set(json.importURLs)]\n\t\t\t\t: json.deps;\n\t\t\tfor (const dep of depsToPreload ?? []) {\n\t\t\t\tif (dep) AssetManager.preloadModule(dep);\n\t\t\t}\n\n\t\t\tconst buildID = getBuildIDFromResponse(response);\n\n\t\t\t// Complete client loader execution\n\t\t\tconst waitFnPromise = completeClientLoaders(\n\t\t\t\tjson,\n\t\t\t\tbuildID,\n\t\t\t\trunningLoaders,\n\t\t\t\tcontroller.signal,\n\t\t\t);\n\n\t\t\tconst cssBundlePromises: Array<Promise<any>> = [];\n\t\t\tfor (const bundle of json.cssBundles ?? []) {\n\t\t\t\tcssBundlePromises.push(AssetManager.preloadCSS(bundle));\n\t\t\t}\n\n\t\t\treturn { response, json, props, cssBundlePromises, waitFnPromise };\n\t\t} catch (error) {\n\t\t\tif (!isAbortError(error)) {\n\t\t\t\tlogError(\"Navigation failed\", error);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate async processNavigationResult(\n\t\tresult: NavigationResult,\n\t\tentry: NavigationEntry,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tif (!result) return;\n\n\t\t\tif (\"redirectData\" in result) {\n\t\t\t\t// Skip redirect effectuation for pure prefetches\n\t\t\t\tif (entry.type === \"prefetch\" && entry.intent === \"none\") {\n\t\t\t\t\tthis.deleteNavigation(entry.targetUrl);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Clean up before redirect to prevent race conditions\n\t\t\t\tthis.deleteNavigation(entry.targetUrl);\n\n\t\t\t\tawait effectuateRedirectDataResult(\n\t\t\t\t\tresult.redirectData,\n\t\t\t\t\tresult.props.redirectCount || 0,\n\t\t\t\t\tresult.props,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Sanity check -- should not happen\n\t\t\tif (!(\"json\" in result)) {\n\t\t\t\tlogError(\"Invalid navigation result: no JSON or redirect\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only update module map and apply CSS if build IDs match\n\t\t\tconst currentBuildID = __vormaClientGlobal.get(\"buildID\");\n\t\t\tconst responseBuildID = getBuildIDFromResponse(result.response);\n\n\t\t\tif (responseBuildID === currentBuildID) {\n\t\t\t\t// Update module map only when builds match\n\t\t\t\tconst clientModuleMap =\n\t\t\t\t\t__vormaClientGlobal.get(\"clientModuleMap\") || {};\n\t\t\t\tconst matchedPatterns = result.json.matchedPatterns || [];\n\t\t\t\tconst importURLs = result.json.importURLs || [];\n\t\t\t\tconst exportKeys = result.json.exportKeys || [];\n\t\t\t\tconst errorExportKeys = result.json.errorExportKeys || [];\n\n\t\t\t\tfor (let i = 0; i < matchedPatterns.length; i++) {\n\t\t\t\t\tconst pattern = matchedPatterns[i];\n\t\t\t\t\tconst importURL = importURLs[i];\n\t\t\t\t\tconst exportKey = exportKeys[i];\n\t\t\t\t\tconst errorExportKey = errorExportKeys[i];\n\n\t\t\t\t\tif (pattern && importURL) {\n\t\t\t\t\t\tclientModuleMap[pattern] = {\n\t\t\t\t\t\t\timportURL,\n\t\t\t\t\t\t\texportKey: exportKey || \"default\",\n\t\t\t\t\t\t\terrorExportKey: errorExportKey || \"\",\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t__vormaClientGlobal.set(\"clientModuleMap\", clientModuleMap);\n\n\t\t\t\t// Apply CSS bundles immediately, even for prefetches.\n\t\t\t\t// This ensures that if the user doesn't actually click now,\n\t\t\t\t// but they do later (and it happens to be eligible for skip),\n\t\t\t\t// everything still works.\n\t\t\t\tif (\n\t\t\t\t\tresult.json.cssBundles &&\n\t\t\t\t\tresult.json.cssBundles.length > 0\n\t\t\t\t) {\n\t\t\t\t\tAssetManager.applyCSS(result.json.cssBundles);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Validate revalidation is still applicable\n\t\t\tif (entry.type === \"revalidation\") {\n\t\t\t\tconst currentUrl = window.location.href;\n\t\t\t\tif (currentUrl !== entry.originUrl) {\n\t\t\t\t\tthis.deleteNavigation(entry.targetUrl);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Transition to waiting phase\n\t\t\tthis.transitionPhase(entry.targetUrl, \"waiting\");\n\n\t\t\t// Skip if navigation was aborted\n\t\t\tif (!this._navigations.has(entry.targetUrl)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Update build ID if needed\n\t\t\tconst oldID = __vormaClientGlobal.get(\"buildID\");\n\t\t\tconst newID = getBuildIDFromResponse(result.response);\n\t\t\tif (newID && newID !== oldID) {\n\t\t\t\tdispatchBuildIDEvent({ newID, oldID });\n\t\t\t}\n\n\t\t\t// Wait for client loaders and set state\n\t\t\tconst clientLoadersResult = await result.waitFnPromise;\n\t\t\tsetClientLoadersState(clientLoadersResult);\n\n\t\t\t// Wait for CSS\n\t\t\tif (result.cssBundlePromises.length > 0) {\n\t\t\t\ttry {\n\t\t\t\t\tawait Promise.all(result.cssBundlePromises);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogError(\"Error preloading CSS bundles:\", error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Skip rendering for prefetch without intent\n\t\t\tif (entry.intent === \"none\") {\n\t\t\t\tthis.transitionPhase(entry.targetUrl, \"complete\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip rendering for revalidation if not on target page\n\t\t\tif (\n\t\t\t\tentry.type === \"revalidation\" &&\n\t\t\t\twindow.location.href !== entry.originUrl\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Transition to rendering phase\n\t\t\tthis.transitionPhase(entry.targetUrl, \"rendering\");\n\n\t\t\t// Render the app\n\t\t\ttry {\n\t\t\t\tawait __reRenderApp({\n\t\t\t\t\tjson: result.json,\n\t\t\t\t\tnavigationType: entry.type,\n\t\t\t\t\trunHistoryOptions:\n\t\t\t\t\t\tentry.intent === \"navigate\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\thref: entry.targetUrl,\n\t\t\t\t\t\t\t\t\tscrollStateToRestore:\n\t\t\t\t\t\t\t\t\t\tresult.props.scrollStateToRestore,\n\t\t\t\t\t\t\t\t\treplace:\n\t\t\t\t\t\t\t\t\t\tentry.replace || result.props.replace,\n\t\t\t\t\t\t\t\t\tscrollToTop: entry.scrollToTop,\n\t\t\t\t\t\t\t\t\tstate: entry.state,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tonFinish: () => {\n\t\t\t\t\t\tthis.transitionPhase(entry.targetUrl, \"complete\");\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthis.transitionPhase(entry.targetUrl, \"complete\");\n\t\t\t\tif (!isAbortError(error)) {\n\t\t\t\t\tlogError(\"Error completing navigation\", error);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t} finally {\n\t\t\tif (!(entry.type === \"prefetch\" && entry.intent === \"none\")) {\n\t\t\t\tthis.deleteNavigation(entry.targetUrl);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync submit<T = any>(\n\t\turl: string | URL,\n\t\trequestInit?: RequestInit,\n\t\toptions?: SubmitOptions,\n\t): Promise<{ success: true; data: T } | { success: false; error: string }> {\n\t\tconst abortController = new AbortController();\n\t\tconst submissionKey = options?.dedupeKey\n\t\t\t? `submission:${options.dedupeKey}`\n\t\t\t: Symbol(\"submission\");\n\n\t\t// Abort duplicate submission\n\t\tif (typeof submissionKey === \"string\") {\n\t\t\tconst existing = this._submissions.get(submissionKey);\n\t\t\tif (existing) {\n\t\t\t\texisting.control.abortController?.abort(\"deduped\");\n\t\t\t}\n\t\t}\n\n\t\tconst entry: SubmissionEntry = {\n\t\t\tcontrol: {\n\t\t\t\tabortController,\n\t\t\t\tpromise: Promise.resolve() as any,\n\t\t\t},\n\t\t\tstartTime: Date.now(),\n\t\t\tskipGlobalLoadingIndicator: options?.skipGlobalLoadingIndicator,\n\t\t};\n\n\t\tthis._submissions.set(submissionKey, entry);\n\t\tthis.scheduleStatusUpdate();\n\n\t\ttry {\n\t\t\tconst urlToUse = new URL(url, window.location.href);\n\t\t\tconst headers = new Headers(requestInit?.headers);\n\t\t\tconst deploymentID = __vormaClientGlobal.get(\"deploymentID\");\n\t\t\tif (deploymentID) {\n\t\t\t\theaders.set(\"x-deployment-id\", deploymentID);\n\t\t\t}\n\t\t\tconst finalRequestInit: RequestInit = {\n\t\t\t\t...requestInit,\n\t\t\t\theaders,\n\t\t\t\tsignal: abortController.signal,\n\t\t\t};\n\n\t\t\tconst { redirectData, response } = await handleRedirects({\n\t\t\t\tabortController,\n\t\t\t\turl: urlToUse,\n\t\t\t\tisPrefetch: false,\n\t\t\t\tredirectCount: 0,\n\t\t\t\trequestInit: finalRequestInit,\n\t\t\t});\n\n\t\t\tconst oldID = __vormaClientGlobal.get(\"buildID\");\n\t\t\tconst newID = getBuildIDFromResponse(response);\n\t\t\tif (newID && newID !== oldID) {\n\t\t\t\tdispatchBuildIDEvent({ newID, oldID });\n\t\t\t}\n\n\t\t\tif (!response || !response.ok) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: String(response?.status || \"unknown\"),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (redirectData?.status === \"should\") {\n\t\t\t\tawait effectuateRedirectDataResult(redirectData, 0);\n\t\t\t\treturn { success: true, data: undefined as T }; // No data on redirect\n\t\t\t}\n\n\t\t\tconst data = await response.json();\n\n\t\t\t// Auto-revalidate for mutations\n\t\t\tconst isGET = getIsGETRequest(requestInit);\n\t\t\tconst redirected = redirectData?.status === \"did\";\n\t\t\tif (!isGET && !redirected && options?.revalidate !== false) {\n\t\t\t\tawait revalidate();\n\t\t\t}\n\n\t\t\treturn { success: true, data: data as T };\n\t\t} catch (error) {\n\t\t\tif (isAbortError(error)) {\n\t\t\t\treturn { success: false, error: \"Aborted\" };\n\t\t\t}\n\t\t\tlogError(error);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t};\n\t\t} finally {\n\t\t\tthis._submissions.delete(submissionKey);\n\t\t\tthis.scheduleStatusUpdate();\n\t\t}\n\t}\n\n\tprivate setNavigation(key: string, entry: NavigationEntry): void {\n\t\tthis._navigations.set(key, entry);\n\t\tthis.scheduleStatusUpdate();\n\t}\n\n\tprivate deleteNavigation(key: string): boolean {\n\t\tconst result = this._navigations.delete(key);\n\t\tif (result) {\n\t\t\tthis.scheduleStatusUpdate();\n\t\t}\n\t\treturn result;\n\t}\n\n\tremoveNavigation(key: string): void {\n\t\tthis.deleteNavigation(key);\n\t}\n\n\tgetNavigation(key: string): NavigationEntry | undefined {\n\t\treturn this._navigations.get(key);\n\t}\n\n\thasNavigation(key: string): boolean {\n\t\treturn this._navigations.has(key);\n\t}\n\n\tgetNavigationsSize(): number {\n\t\treturn this._navigations.size;\n\t}\n\n\tgetNavigations(): Map<string, NavigationEntry> {\n\t\treturn this._navigations;\n\t}\n\n\tprivate abortAllNavigationsExcept(excludeHref?: string): void {\n\t\tfor (const [href, nav] of this._navigations.entries()) {\n\t\t\tif (href !== excludeHref) {\n\t\t\t\tnav.control.abortController?.abort();\n\t\t\t\tthis.deleteNavigation(href);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetStatus(): StatusEventDetail {\n\t\tconst navigations = Array.from(this._navigations.values());\n\t\tconst submissions = Array.from(this._submissions.values());\n\n\t\tconst isNavigating = navigations.some(\n\t\t\t(nav) => nav.intent === \"navigate\" && nav.phase !== \"complete\",\n\t\t);\n\n\t\tconst isRevalidating = navigations.some(\n\t\t\t(nav) => nav.type === \"revalidation\" && nav.phase !== \"complete\",\n\t\t);\n\n\t\tconst isSubmitting = submissions.some(\n\t\t\t(x) => !x.skipGlobalLoadingIndicator,\n\t\t);\n\n\t\treturn { isNavigating, isSubmitting, isRevalidating };\n\t}\n\n\tclearAll(): void {\n\t\tfor (const nav of this._navigations.values()) {\n\t\t\tnav.control.abortController?.abort();\n\t\t}\n\t\tthis._navigations.clear();\n\t\tfor (const sub of this._submissions.values()) {\n\t\t\tsub.control.abortController?.abort();\n\t\t}\n\t\tthis._submissions.clear();\n\t\tthis.scheduleStatusUpdate();\n\t}\n\n\tprivate scheduleStatusUpdate(): void {\n\t\tthis.dispatchStatusEventDebounced();\n\t}\n\n\tprivate dispatchStatusEvent(): void {\n\t\tconst newStatus = this.getStatus();\n\n\t\tif (jsonDeepEquals(this.lastDispatchedStatus, newStatus)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastDispatchedStatus = newStatus;\n\t\tdispatchStatusEvent(newStatus);\n\t}\n}\n\n// Global instance\nexport const navigationStateManager = new NavigationStateManager();\n\n/////////////////////////////////////////////////////////////////////\n// PUBLIC API\n/////////////////////////////////////////////////////////////////////\n\nexport async function vormaNavigate(\n\thref: string,\n\toptions?: {\n\t\treplace?: boolean;\n\t\tscrollToTop?: boolean;\n\t\tsearch?: string;\n\t\thash?: string;\n\t\tstate?: unknown;\n\t},\n): Promise<void> {\n\tconst url = new URL(href, window.location.href);\n\n\tif (options?.search !== undefined) {\n\t\turl.search = options.search;\n\t}\n\tif (options?.hash !== undefined) {\n\t\turl.hash = options.hash;\n\t}\n\n\tawait navigationStateManager.navigate({\n\t\thref: url.href,\n\t\tnavigationType: \"userNavigation\",\n\t\treplace: options?.replace,\n\t\tscrollToTop: options?.scrollToTop,\n\t\tstate: options?.state,\n\t});\n}\n\nlet lastTriggeredNavOrRevalidateTimestampMS = Date.now();\n\nexport function getLastTriggeredNavOrRevalidateTimestampMS(): number {\n\treturn lastTriggeredNavOrRevalidateTimestampMS;\n}\n\nexport async function revalidate() {\n\tawait navigationStateManager.navigate({\n\t\thref: window.location.href,\n\t\tnavigationType: \"revalidation\",\n\t});\n}\n\nexport type SubmitOptions = {\n\tdedupeKey?: string;\n\trevalidate?: boolean;\n\tskipGlobalLoadingIndicator?: boolean;\n};\n\nexport async function submit<T = any>(\n\turl: string | URL,\n\trequestInit?: RequestInit,\n\toptions?: SubmitOptions,\n): Promise<{ success: true; data: T } | { success: false; error: string }> {\n\treturn navigationStateManager.submit(url, requestInit, options);\n}\n\nexport function beginNavigation(props: NavigateProps): NavigationControl {\n\treturn navigationStateManager.beginNavigation(props);\n}\n\nexport function getStatus(): StatusEventDetail {\n\treturn navigationStateManager.getStatus();\n}\n\nexport function getLocation() {\n\treturn {\n\t\tpathname: window.location.pathname,\n\t\tsearch: window.location.search,\n\t\thash: window.location.hash,\n\t\tstate: HistoryManager.getInstance().location.state,\n\t};\n}\n\nexport function getBuildID(): string {\n\treturn __vormaClientGlobal.get(\"buildID\");\n}\n\nexport function getRootEl(): HTMLDivElement {\n\treturn document.getElementById(\"vorma-root\") as HTMLDivElement;\n}\n\nexport function getHistoryInstance(): historyInstance {\n\treturn HistoryManager.getInstance();\n}\n", "import type { PatternRegistry } from \"vorma/kit/matcher/register\";\nimport type { VormaAppConfig } from \"../vorma_app_helpers/vorma_app_helpers.ts\";\n\nexport type HeadEl = {\n\ttag?: string;\n\tattributesKnownSafe?: Record<string, string>;\n\tbooleanAttributes?: Array<string>;\n\tdangerousInnerHTML?: string;\n};\n\ntype Meta = {\n\ttitle: HeadEl | null | undefined;\n\tmetaHeadEls: Array<HeadEl> | null | undefined;\n\trestHeadEls: Array<HeadEl> | null | undefined;\n};\n\ntype shared = {\n\toutermostServerError?: string;\n\toutermostClientError?: string;\n\toutermostServerErrorIdx?: number;\n\toutermostClientErrorIdx?: number;\n\toutermostError?: string; // derived from above\n\toutermostErrorIdx?: number; // derived from above\n\n\tmatchedPatterns: Array<string>;\n\tloadersData: Array<any>;\n\timportURLs: Array<string>;\n\texportKeys: Array<string>;\n\terrorExportKeys: string[];\n\thasRootData: boolean;\n\n\tparams: Record<string, string>;\n\tsplatValues: Array<string>;\n\n\tbuildID: string;\n\n\tactiveComponents: Array<any> | null;\n\tactiveErrorBoundary?: any;\n};\n\nexport type GetRouteDataOutput = Omit<shared, \"buildID\"> &\n\tMeta & {\n\t\tdeps: Array<string>;\n\t\tcssBundles: Array<string>;\n\t};\n\nexport const VORMA_SYMBOL = Symbol.for(\"__vorma_internal__\");\n\nexport type RouteErrorComponent = (props: { error: string }) => any;\n\nexport type ClientLoaderAwaitedServerData<RD, LD> = {\n\tmatchedPatterns: string[];\n\tloaderData: LD;\n\trootData: RD;\n\tbuildID: string;\n};\n\nexport type VormaClientGlobal = shared & {\n\tisDev: boolean;\n\tviteDevURL: string;\n\tpublicPathPrefix: string;\n\tisTouchDevice: boolean;\n\tpatternToWaitFnMap: Record<\n\t\tstring,\n\t\t(props: {\n\t\t\tparams: Record<string, string>;\n\t\t\tsplatValues: string[];\n\t\t\tserverDataPromise: Promise<ClientLoaderAwaitedServerData<any, any>>;\n\t\t\tsignal: AbortSignal;\n\t\t}) => Promise<any>\n\t>;\n\tclientLoadersData: Array<any>;\n\tdefaultErrorBoundary: RouteErrorComponent;\n\tuseViewTransitions: boolean;\n\tdeploymentID: string;\n\tvormaAppConfig: VormaAppConfig;\n\t// SSR'd\n\trouteManifestURL: string;\n\t// Fetched at startup -- fine because progressive enhancement\n\t// and not needed until any given route's second navigation\n\t// anyway\n\trouteManifest: Record<string, number> | undefined;\n\t// built up as we navigate\n\tclientModuleMap: Record<\n\t\tstring,\n\t\t{\n\t\t\timportURL: string;\n\t\t\texportKey: string;\n\t\t\terrorExportKey: string;\n\t\t}\n\t>;\n\tpatternRegistry: PatternRegistry;\n};\n\nexport function __getVormaClientGlobal() {\n\tconst dangerousGlobalThis = globalThis as any;\n\tfunction get<K extends keyof VormaClientGlobal>(key: K) {\n\t\treturn dangerousGlobalThis[VORMA_SYMBOL][key] as VormaClientGlobal[K];\n\t}\n\tfunction set<\n\t\tK extends keyof VormaClientGlobal,\n\t\tV extends VormaClientGlobal[K],\n\t>(key: K, value: V) {\n\t\tdangerousGlobalThis[VORMA_SYMBOL][key] = value;\n\t}\n\treturn { get, set };\n}\n\nexport const __vormaClientGlobal = __getVormaClientGlobal();\n\n// to debug ctx in browser, paste this:\n// const vorma_ctx = window[Symbol.for(\"__vorma_internal__\")];\n\nexport function getRouterData<\n\tT = any,\n\tP extends Record<string, string> = Record<string, string>,\n>() {\n\tconst rootData: T = __vormaClientGlobal.get(\"hasRootData\")\n\t\t? __vormaClientGlobal.get(\"loadersData\")[0]\n\t\t: null;\n\treturn {\n\t\tbuildID: __vormaClientGlobal.get(\"buildID\") || \"\",\n\t\tmatchedPatterns: __vormaClientGlobal.get(\"matchedPatterns\") || [],\n\t\tsplatValues: __vormaClientGlobal.get(\"splatValues\") || [],\n\t\tparams: (__vormaClientGlobal.get(\"params\") || {}) as P,\n\t\trootData,\n\t};\n}\n", "import { __vormaClientGlobal } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport function resolvePublicHref(relativeHref: string): string {\n\tlet baseURL = __vormaClientGlobal.get(\"viteDevURL\");\n\tif (!baseURL) {\n\t\tbaseURL = __vormaClientGlobal.get(\"publicPathPrefix\");\n\t}\n\tif (baseURL.endsWith(\"/\")) {\n\t\tbaseURL = baseURL.slice(0, -1);\n\t}\n\tlet final = relativeHref.startsWith(\"/\")\n\t\t? baseURL + relativeHref\n\t\t: baseURL + \"/\" + relativeHref;\n\treturn final;\n}\n", "import { resolvePublicHref } from \"./resolve_public_href.ts\";\nimport { __vormaClientGlobal } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport class AssetManager {\n\tstatic preloadModule(url: string): void {\n\t\tconst href = resolvePublicHref(url);\n\t\tif (\n\t\t\tdocument.querySelector(\n\t\t\t\t`link[rel=\"modulepreload\"][href=\"${CSS.escape(href)}\"]`,\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst link = document.createElement(\"link\");\n\t\tlink.rel = \"modulepreload\";\n\t\tlink.href = href;\n\t\tdocument.head.appendChild(link);\n\t}\n\n\tstatic preloadCSS(url: string): Promise<void> {\n\t\tconst href = resolvePublicHref(url);\n\n\t\tif (\n\t\t\tdocument.querySelector(\n\t\t\t\t`link[rel=\"preload\"][href=\"${CSS.escape(href)}\"]`,\n\t\t\t)\n\t\t) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\tconst link = document.createElement(\"link\");\n\t\tlink.rel = \"preload\";\n\t\tlink.setAttribute(\"as\", \"style\");\n\t\tlink.href = href;\n\n\t\tdocument.head.appendChild(link);\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlink.onload = () => resolve();\n\t\t\tlink.onerror = reject;\n\t\t});\n\t}\n\n\tstatic applyCSS(bundles: string[]): void {\n\t\twindow.requestAnimationFrame(() => {\n\t\t\tconst prefix = __vormaClientGlobal.get(\"publicPathPrefix\");\n\n\t\t\tfor (const bundle of bundles) {\n\t\t\t\t// Check using the data attribute without escaping\n\t\t\t\tif (\n\t\t\t\t\tdocument.querySelector(\n\t\t\t\t\t\t`link[data-vorma-css-bundle=\"${bundle}\"]`,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst link = document.createElement(\"link\");\n\t\t\t\tlink.rel = \"stylesheet\";\n\t\t\t\tlink.href = prefix + bundle;\n\t\t\t\tlink.setAttribute(\"data-vorma-css-bundle\", bundle);\n\t\t\t\tdocument.head.appendChild(link);\n\t\t\t}\n\t\t});\n\t}\n}\n", "import { findNestedMatches } from \"vorma/kit/matcher/find-nested\";\nimport { registerPattern } from \"vorma/kit/matcher/register\";\nimport { ComponentLoader, getEffectiveErrorData } from \"./component_loader.ts\";\nimport { isAbortError } from \"./utils/errors.ts\";\nimport { logError } from \"./utils/logging.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype GetRouteDataOutput,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport function setClientLoadersState(\n\tclr: ClientLoadersResult | undefined,\n): void {\n\tif (clr) {\n\t\t__vormaClientGlobal.set(\"clientLoadersData\", clr.data ?? []);\n\t\t__vormaClientGlobal.set(\n\t\t\t\"outermostClientErrorIdx\",\n\t\t\tclr.errorMessage ? clr.data.length - 1 : undefined,\n\t\t);\n\t\t__vormaClientGlobal.set(\"outermostClientError\", clr.errorMessage);\n\t}\n}\n\nexport function deriveAndSetErrorState(): void {\n\tconst effectiveErrData = getEffectiveErrorData();\n\t__vormaClientGlobal.set(\"outermostErrorIdx\", effectiveErrData.index);\n\t__vormaClientGlobal.set(\"outermostError\", effectiveErrData.error);\n}\n\nexport async function setupClientLoaders(): Promise<void> {\n\tconst clientLoadersResult = await runWaitFns(\n\t\t{\n\t\t\thasRootData: __vormaClientGlobal.get(\"hasRootData\"),\n\t\t\timportURLs: __vormaClientGlobal.get(\"importURLs\"),\n\t\t\tloadersData: __vormaClientGlobal.get(\"loadersData\"),\n\t\t\tmatchedPatterns: __vormaClientGlobal.get(\"matchedPatterns\"),\n\t\t\tparams: __vormaClientGlobal.get(\"params\"),\n\t\t\tsplatValues: __vormaClientGlobal.get(\"splatValues\"),\n\t\t},\n\t\t__vormaClientGlobal.get(\"buildID\"),\n\t\tnew AbortController().signal,\n\t);\n\n\tsetClientLoadersState(clientLoadersResult);\n\tderiveAndSetErrorState();\n}\n\nexport async function __registerClientLoaderPattern(\n\tpattern: string,\n): Promise<void> {\n\tregisterPattern(__vormaClientGlobal.get(\"patternRegistry\"), pattern);\n}\n\n// This is needed because the matcher, by definition, will only\n// match when you have a full path match. If the path you are\n// testing is longer than the registered patterns, you will get\n// no match, even if some registered patterns would potentially\n// be in the parent segments. This fixes that.\nexport async function findPartialMatchesOnClient(pathname: string) {\n\tconst patternToWaitFnMap = __vormaClientGlobal.get(\"patternToWaitFnMap\");\n\tif (Object.keys(patternToWaitFnMap).length === 0) {\n\t\treturn null;\n\t}\n\n\tconst patternRegistry = __vormaClientGlobal.get(\"patternRegistry\");\n\n\t// First try the full path\n\tconst fullResult = findNestedMatches(patternRegistry, pathname);\n\tif (fullResult) {\n\t\t// If we get a full match, we have everything we need\n\t\treturn fullResult;\n\t}\n\n\t// If no full match, try progressively shorter paths to find partial matches\n\tconst segments = pathname.split(\"/\").filter(Boolean);\n\n\t// Try from longest to shortest\n\tfor (let i = segments.length; i >= 0; i--) {\n\t\tconst partialPath =\n\t\t\ti === 0 ? \"/\" : \"/\" + segments.slice(0, i).join(\"/\");\n\t\tconst result = findNestedMatches(patternRegistry, partialPath);\n\t\tif (result) {\n\t\t\treturn result; // First match is the longest\n\t\t}\n\t}\n\n\treturn null;\n}\n\ntype PartialWaitFnJSON = Pick<\n\tGetRouteDataOutput,\n\t| \"matchedPatterns\"\n\t| \"splatValues\"\n\t| \"params\"\n\t| \"hasRootData\"\n\t| \"loadersData\"\n\t| \"importURLs\"\n>;\n\nexport type ClientLoadersResult = {\n\tdata: Array<any>;\n\terrorMessage?: string;\n};\n\nasync function executeClientLoaders(\n\tjson: PartialWaitFnJSON,\n\tbuildID: string,\n\tsignal: AbortSignal,\n\trunningLoaders?: Map<string, Promise<any>>,\n): Promise<ClientLoadersResult> {\n\tawait ComponentLoader.loadComponents(json.importURLs);\n\n\tconst matchedPatterns = json.matchedPatterns ?? [];\n\tconst patternToWaitFnMap = __vormaClientGlobal.get(\"patternToWaitFnMap\");\n\tconst outermostServerErrorIdx = __vormaClientGlobal.get(\n\t\t\"outermostServerErrorIdx\",\n\t);\n\n\tconst loaderPromises: Array<Promise<any>> = [];\n\tconst abortControllers: Array<AbortController | null> = [];\n\n\t// Build arrays of all promises and their corresponding abort controllers\n\tlet i = 0;\n\tfor (const pattern of matchedPatterns) {\n\t\tif (\n\t\t\toutermostServerErrorIdx !== undefined &&\n\t\t\ti === outermostServerErrorIdx\n\t\t) {\n\t\t\t// This route has a server error, skip its client loader\n\t\t\tloaderPromises.push(Promise.resolve());\n\t\t\tabortControllers.push(null);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (runningLoaders?.has(pattern)) {\n\t\t\t// This loader is already running (started parallel to fetch)\n\t\t\tloaderPromises.push(runningLoaders.get(pattern)!);\n\t\t\t// We can't create a new controller for it, but we can wrap it\n\t\t\tabortControllers.push(null);\n\t\t} else if (patternToWaitFnMap[pattern]) {\n\t\t\t// This is a new client loader we need to run\n\t\t\tconst controller = new AbortController();\n\t\t\tabortControllers.push(controller);\n\n\t\t\t// Wire up the main navigation signal to this loader's controller\n\t\t\tif (signal.aborted) {\n\t\t\t\tcontroller.abort();\n\t\t\t} else {\n\t\t\t\tsignal.addEventListener(\"abort\", () => controller.abort(), {\n\t\t\t\t\tonce: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst serverDataPromise = Promise.resolve({\n\t\t\t\tmatchedPatterns: json.matchedPatterns,\n\t\t\t\tloaderData: json.loadersData[i],\n\t\t\t\trootData: json.hasRootData ? json.loadersData[0] : null,\n\t\t\t\tbuildID: buildID,\n\t\t\t});\n\n\t\t\tconst loaderPromise = patternToWaitFnMap[pattern]({\n\t\t\t\tparams: json.params || {},\n\t\t\t\tsplatValues: json.splatValues || [],\n\t\t\t\tserverDataPromise,\n\t\t\t\tsignal: controller.signal,\n\t\t\t});\n\t\t\tloaderPromises.push(loaderPromise);\n\t\t} else {\n\t\t\t// No client loader for this route\n\t\t\tloaderPromises.push(Promise.resolve());\n\t\t\tabortControllers.push(null);\n\t\t}\n\t\ti++;\n\t}\n\n\t// Wrap all promises with the child-aborting logic\n\tconst wrappedPromises = loaderPromises.map(async (promise, index) => {\n\t\treturn promise.catch((error) => {\n\t\t\t// If this promise failed with a true error (not just an abort)\n\t\t\tif (!isAbortError(error)) {\n\t\t\t\t// Abort all subsequent (child) loaders immediately\n\t\t\t\tfor (let j = index + 1; j < abortControllers.length; j++) {\n\t\t\t\t\tabortControllers[j]?.abort();\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Re-throw the error so Promise.allSettled sees it as 'rejected'\n\t\t\tthrow error;\n\t\t});\n\t});\n\n\t// Await all wrapped promises. They run in parallel,\n\t// but a rejection in one now triggers aborts in its children.\n\tconst results = await Promise.allSettled(wrappedPromises);\n\n\t// Process the results\n\tconst data: Array<any> = [];\n\tlet errorMessage: string | undefined;\n\n\tfor (let i = 0; i < results.length; i++) {\n\t\tconst result = results[i];\n\t\tif (!result) {\n\t\t\tdata.push(undefined);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (result.status === \"fulfilled\") {\n\t\t\tdata.push(result.value);\n\t\t} else {\n\t\t\t// This is a rejection\n\t\t\tif (!isAbortError(result.reason)) {\n\t\t\t\t// This is the first true error we've hit\n\t\t\t\tconst pattern = matchedPatterns[i];\n\t\t\t\tlogError(\n\t\t\t\t\t`Client loader error for pattern ${pattern}:`,\n\t\t\t\t\tresult.reason,\n\t\t\t\t);\n\t\t\t\terrorMessage =\n\t\t\t\t\tresult.reason instanceof Error\n\t\t\t\t\t\t? result.reason.message\n\t\t\t\t\t\t: String(result.reason);\n\n\t\t\t\t// We found the highest error. Stop processing.\n\t\t\t\t// The .catch() wrapper already aborted any children.\n\t\t\t}\n\t\t\tdata.push(undefined);\n\t\t\tbreak; // Stop at the first error\n\t\t}\n\t}\n\n\treturn { data, errorMessage };\n}\n\nasync function runWaitFns(\n\tjson: PartialWaitFnJSON,\n\tbuildID: string,\n\tsignal: AbortSignal,\n): Promise<ClientLoadersResult> {\n\treturn executeClientLoaders(json, buildID, signal);\n}\n\nexport async function completeClientLoaders(\n\tjson: PartialWaitFnJSON,\n\tbuildID: string,\n\trunningLoaders: Map<string, Promise<any>>,\n\tsignal: AbortSignal,\n): Promise<ClientLoadersResult> {\n\treturn executeClientLoaders(json, buildID, signal, runningLoaders);\n}\n", "import { jsonDeepEquals } from \"vorma/kit/json\";\nimport { resolvePublicHref } from \"./resolve_public_href.ts\";\nimport { __vormaClientGlobal } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport function getEffectiveErrorData(): {\n\tindex: number | undefined;\n\terror: string | undefined;\n} {\n\tconst serverErrorIdx = __vormaClientGlobal.get(\"outermostServerErrorIdx\");\n\tconst clientErrorIdx = __vormaClientGlobal.get(\"outermostClientErrorIdx\");\n\tlet errorIdx: number | undefined;\n\tif (serverErrorIdx != null && clientErrorIdx != null) {\n\t\terrorIdx = Math.min(serverErrorIdx, clientErrorIdx);\n\t} else {\n\t\terrorIdx = serverErrorIdx ?? clientErrorIdx;\n\t}\n\treturn {\n\t\tindex: errorIdx,\n\t\terror:\n\t\t\terrorIdx === serverErrorIdx\n\t\t\t\t? __vormaClientGlobal.get(\"outermostServerError\")\n\t\t\t\t: errorIdx === clientErrorIdx\n\t\t\t\t\t? __vormaClientGlobal.get(\"outermostClientError\")\n\t\t\t\t\t: undefined,\n\t};\n}\n\nexport class ComponentLoader {\n\tstatic async loadComponents(\n\t\timportURLs: string[],\n\t): Promise<Map<string, any>> {\n\t\tconst dedupedURLs = [...new Set(importURLs)];\n\t\tconst modules = await Promise.all(\n\t\t\tdedupedURLs.map(async (url) => {\n\t\t\t\tif (!url) return undefined;\n\t\t\t\treturn import(/* @vite-ignore */ resolvePublicHref(url));\n\t\t\t}),\n\t\t);\n\t\treturn new Map(dedupedURLs.map((url, i) => [url, modules[i]]));\n\t}\n\n\tstatic async handleComponents(importURLs: string[]): Promise<void> {\n\t\tconst modulesMap = await this.loadComponents(importURLs);\n\t\tconst originalImportURLs = __vormaClientGlobal.get(\"importURLs\");\n\t\tconst exportKeys = __vormaClientGlobal.get(\"exportKeys\") ?? [];\n\n\t\t// Build new components array\n\t\tconst newActiveComponents = originalImportURLs.map(\n\t\t\t(url: string, i: number) => {\n\t\t\t\tconst module = modulesMap.get(url);\n\t\t\t\tconst key = exportKeys[i] ?? \"default\";\n\t\t\t\treturn module?.[key] ?? null;\n\t\t\t},\n\t\t);\n\n\t\t// Only update if components actually changed\n\t\tif (\n\t\t\t!jsonDeepEquals(\n\t\t\t\tnewActiveComponents,\n\t\t\t\t__vormaClientGlobal.get(\"activeComponents\"),\n\t\t\t)\n\t\t) {\n\t\t\t__vormaClientGlobal.set(\"activeComponents\", newActiveComponents);\n\t\t}\n\t}\n\n\tstatic async handleErrorBoundaryComponent(\n\t\timportURLs: string[],\n\t): Promise<void> {\n\t\tconst modulesMap = await this.loadComponents(importURLs);\n\t\tconst originalImportURLs = __vormaClientGlobal.get(\"importURLs\");\n\n\t\t// Handle error boundary\n\t\tconst errorIdx = getEffectiveErrorData().index;\n\n\t\tif (errorIdx != null) {\n\t\t\tconst errorModuleURL = originalImportURLs[errorIdx];\n\t\t\tlet errorComponent;\n\n\t\t\tif (errorModuleURL) {\n\t\t\t\tconst errorModule = modulesMap.get(errorModuleURL);\n\t\t\t\tconst errorKeys = __vormaClientGlobal.get(\"errorExportKeys\");\n\t\t\t\tconst errorKey = errorKeys ? errorKeys[errorIdx] : null;\n\t\t\t\tif (errorKey && errorModule) {\n\t\t\t\t\terrorComponent = errorModule[errorKey];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst newErrorBoundary =\n\t\t\t\terrorComponent ??\n\t\t\t\t__vormaClientGlobal.get(\"defaultErrorBoundary\");\n\n\t\t\t// Only update if changed\n\t\t\tconst currentErrorBoundary = __vormaClientGlobal.get(\n\t\t\t\t\"activeErrorBoundary\",\n\t\t\t);\n\t\t\tif (currentErrorBoundary !== newErrorBoundary) {\n\t\t\t\t__vormaClientGlobal.set(\n\t\t\t\t\t\"activeErrorBoundary\",\n\t\t\t\t\tnewErrorBoundary,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n", "export function logInfo(message?: any, ...optionalParams: Array<any>) {\n\tconsole.log(\"Vorma:\", message, ...optionalParams);\n}\n\nexport function logError(message?: any, ...optionalParams: Array<any>) {\n\tconsole.error(\"Vorma:\", message, ...optionalParams);\n}\n", "import { logError } from \"./logging.ts\";\n\nexport function isAbortError(error: unknown) {\n\treturn error instanceof Error && error.name === \"AbortError\";\n}\n\nexport function panic(msg?: string): never {\n\tlogError(\"Panic\");\n\tthrow new Error(msg ?? \"panic\");\n}\n", "import type { ScrollState } from \"./scroll_state_manager.ts\";\n\n// Route Change Event\nexport const VORMA_ROUTE_CHANGE_EVENT_KEY = \"vorma:route-change\";\nexport type RouteChangeEvent = CustomEvent<RouteChangeEventDetail>;\nexport type RouteChangeEventDetail = { __scrollState?: ScrollState };\nexport const addRouteChangeListener = makeListenerAdder<RouteChangeEventDetail>(\n\tVORMA_ROUTE_CHANGE_EVENT_KEY,\n);\nexport function dispatchRouteChangeEvent(detail: RouteChangeEventDetail): void {\n\twindow.dispatchEvent(\n\t\tnew CustomEvent(VORMA_ROUTE_CHANGE_EVENT_KEY, { detail }),\n\t);\n}\n\n// Status Event\nconst STATUS_EVENT_KEY = \"vorma:status\";\nexport type StatusEvent = CustomEvent<StatusEventDetail>;\nexport type StatusEventDetail = {\n\tisNavigating: boolean;\n\tisSubmitting: boolean;\n\tisRevalidating: boolean;\n};\nexport function dispatchStatusEvent(detail: StatusEventDetail): void {\n\twindow.dispatchEvent(new CustomEvent(STATUS_EVENT_KEY, { detail }));\n}\nexport const addStatusListener =\n\tmakeListenerAdder<StatusEventDetail>(STATUS_EVENT_KEY);\n\n// Build ID Event\nconst BUILD_ID_EVENT_KEY = \"vorma:build-id\";\ntype BuildIDEventDetail = { oldID: string; newID: string };\nexport function dispatchBuildIDEvent(detail: BuildIDEventDetail): void {\n\twindow.dispatchEvent(new CustomEvent(BUILD_ID_EVENT_KEY, { detail }));\n}\nexport const addBuildIDListener =\n\tmakeListenerAdder<BuildIDEventDetail>(BUILD_ID_EVENT_KEY);\n\n// Location Event\nconst LOCATION_EVENT_KEY = \"vorma:location\";\nexport function dispatchLocationEvent(): void {\n\twindow.dispatchEvent(new CustomEvent(LOCATION_EVENT_KEY));\n}\nexport const addLocationListener = makeListenerAdder<void>(LOCATION_EVENT_KEY);\n\n// Helper to create listener adders\nfunction makeListenerAdder<T>(key: string) {\n\treturn function addListener(\n\t\tlistener: (event: CustomEvent<T>) => void,\n\t): () => void {\n\t\twindow.addEventListener(key, listener as any);\n\t\treturn () => window.removeEventListener(key, listener as any);\n\t};\n}\n", "function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };", "import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n", "import { HistoryManager } from \"./history/history.ts\";\n\nexport type ScrollState = { x: number; y: number } | { hash: string };\n\nclass ScrollStateManager {\n\tprivate readonly STORAGE_KEY = \"__vorma__scrollStateMap\";\n\tprivate readonly PAGE_REFRESH_KEY = \"__vorma__pageRefreshScrollState\";\n\tprivate readonly MAX_ENTRIES = 50;\n\n\tsaveState(key: string, state: ScrollState): void {\n\t\tconst map = this.getMap();\n\t\tmap.set(key, state);\n\n\t\t// Enforce size limit\n\t\tif (map.size > this.MAX_ENTRIES) {\n\t\t\tconst firstKey = map.keys().next().value;\n\t\t\tif (firstKey) map.delete(firstKey);\n\t\t}\n\n\t\tthis.saveMap(map);\n\t}\n\n\tgetState(key: string): ScrollState | undefined {\n\t\treturn this.getMap().get(key);\n\t}\n\n\tsavePageRefreshState(): void {\n\t\tconst state = {\n\t\t\tx: window.scrollX,\n\t\t\ty: window.scrollY,\n\t\t\tunix: Date.now(),\n\t\t\thref: window.location.href,\n\t\t};\n\t\tsessionStorage.setItem(this.PAGE_REFRESH_KEY, JSON.stringify(state));\n\t}\n\n\trestorePageRefreshState(): void {\n\t\tconst stored = sessionStorage.getItem(this.PAGE_REFRESH_KEY);\n\t\tif (!stored) return;\n\n\t\ttry {\n\t\t\tconst state = JSON.parse(stored);\n\t\t\tif (\n\t\t\t\tstate.href === window.location.href &&\n\t\t\t\tDate.now() - state.unix < 5000\n\t\t\t) {\n\t\t\t\tsessionStorage.removeItem(this.PAGE_REFRESH_KEY);\n\t\t\t\twindow.requestAnimationFrame(() => {\n\t\t\t\t\t__applyScrollState({ x: state.x, y: state.y });\n\t\t\t\t});\n\t\t\t}\n\t\t} catch {}\n\t}\n\n\tprivate getMap(): Map<string, ScrollState> {\n\t\tconst stored = sessionStorage.getItem(this.STORAGE_KEY);\n\t\tif (!stored) return new Map();\n\n\t\ttry {\n\t\t\treturn new Map(JSON.parse(stored));\n\t\t} catch {\n\t\t\treturn new Map();\n\t\t}\n\t}\n\n\tprivate saveMap(map: Map<string, ScrollState>): void {\n\t\tsessionStorage.setItem(\n\t\t\tthis.STORAGE_KEY,\n\t\t\tJSON.stringify(Array.from(map.entries())),\n\t\t);\n\t}\n}\n\nexport const scrollStateManager = new ScrollStateManager();\n\nexport function __applyScrollState(state?: ScrollState): void {\n\tif (!state) {\n\t\tconst id = window.location.hash.slice(1);\n\t\tif (id) {\n\t\t\tdocument.getElementById(id)?.scrollIntoView();\n\t\t}\n\t\treturn;\n\t}\n\n\tif (\"hash\" in state) {\n\t\tif (state.hash) {\n\t\t\tdocument.getElementById(state.hash)?.scrollIntoView();\n\t\t}\n\t} else {\n\t\twindow.scrollTo(state.x, state.y);\n\t}\n}\n\nexport function saveScrollState(): void {\n\tconst lastKnownLocation = HistoryManager.getLastKnownLocation();\n\tscrollStateManager.saveState(lastKnownLocation.key, {\n\t\tx: window.scrollX,\n\t\ty: window.scrollY,\n\t});\n}\n", "import { createBrowserHistory, type Update as NPMHistoryUpdate } from \"history\";\nimport { navigationStateManager } from \"../client.ts\";\nimport { dispatchLocationEvent } from \"../events.ts\";\nimport {\n\t__applyScrollState,\n\tsaveScrollState,\n\tscrollStateManager,\n} from \"../scroll_state_manager.ts\";\nimport { logError } from \"../utils/logging.ts\";\nimport type { historyInstance, historyListener } from \"./npm_history_types.ts\";\n\nexport class HistoryManager {\n\tprivate static instance: historyInstance;\n\tprivate static lastKnownLocation: typeof HistoryManager.instance.location;\n\n\tstatic getInstance(): historyInstance {\n\t\tif (!this.instance) {\n\t\t\tthis.instance =\n\t\t\t\tcreateBrowserHistory() as unknown as historyInstance;\n\t\t\tthis.lastKnownLocation = this.instance.location;\n\t\t}\n\t\treturn this.instance;\n\t}\n\n\tstatic getLastKnownLocation() {\n\t\treturn this.lastKnownLocation;\n\t}\n\n\tstatic updateLastKnownLocation(\n\t\tlocation: typeof HistoryManager.instance.location,\n\t) {\n\t\tthis.lastKnownLocation = location;\n\t}\n\n\tstatic init(): void {\n\t\tconst instance = this.getInstance();\n\t\tinstance.listen(customHistoryListener as unknown as historyListener);\n\t\tthis.setManualScrollRestoration();\n\t}\n\n\tprivate static setManualScrollRestoration(): void {\n\t\tif (\n\t\t\thistory.scrollRestoration &&\n\t\t\thistory.scrollRestoration !== \"manual\"\n\t\t) {\n\t\t\thistory.scrollRestoration = \"manual\";\n\t\t}\n\t}\n}\n\nexport function initCustomHistory(): void {\n\tHistoryManager.init();\n}\n\nexport async function customHistoryListener({\n\taction,\n\tlocation,\n}: NPMHistoryUpdate): Promise<void> {\n\tconst lastKnownLocation = HistoryManager.getLastKnownLocation();\n\n\tif (location.key !== lastKnownLocation.key) {\n\t\tdispatchLocationEvent();\n\t}\n\n\tconst popWithinSameDoc =\n\t\taction === \"POP\" &&\n\t\tlocation.pathname === lastKnownLocation.pathname &&\n\t\tlocation.search === lastKnownLocation.search;\n\n\tconst removingHash =\n\t\tpopWithinSameDoc && lastKnownLocation.hash && !location.hash;\n\tconst addingHash =\n\t\tpopWithinSameDoc && !lastKnownLocation.hash && location.hash;\n\tconst updatingHash = popWithinSameDoc && location.hash;\n\n\tif (!popWithinSameDoc) {\n\t\tsaveScrollState();\n\t}\n\n\tlet navigationSucceeded = true;\n\n\tif (action === \"POP\") {\n\t\tconst newHash = location.hash.slice(1);\n\n\t\tif (addingHash || updatingHash) {\n\t\t\t__applyScrollState({ hash: newHash });\n\t\t}\n\n\t\tif (removingHash) {\n\t\t\tconst stored = scrollStateManager.getState(location.key);\n\t\t\t__applyScrollState(stored ?? { x: 0, y: 0 });\n\t\t}\n\n\t\tif (!popWithinSameDoc) {\n\t\t\tconst result = await navigationStateManager.navigate({\n\t\t\t\thref: window.location.href,\n\t\t\t\tnavigationType: \"browserHistory\",\n\t\t\t\tscrollStateToRestore: scrollStateManager.getState(location.key),\n\t\t\t});\n\n\t\t\tif (!result.didNavigate) {\n\t\t\t\tnavigationSucceeded = false;\n\t\t\t\tlogError(\n\t\t\t\t\t\"Browser POP navigation failed, attempting hard reload of the destination.\",\n\t\t\t\t);\n\n\t\t\t\t// This just reloads the current (failed) URL.\n\t\t\t\t// It preserves the history stack and ensures no UI/URL mismatch,\n\t\t\t\t// which could otherwise happen if a browser forward/back navigation fails\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (navigationSucceeded) {\n\t\tHistoryManager.updateLastKnownLocation(location);\n\t}\n}\n", "import {\n\tgetHrefDetails,\n\tgetIsGETRequest,\n\ttype HrefDetails,\n} from \"vorma/kit/url\";\nimport { navigationStateManager, type NavigateProps } from \"../client.ts\";\nimport { VORMA_HARD_RELOAD_QUERY_PARAM } from \"../hard_reload.ts\";\nimport { logError, logInfo } from \"../utils/logging.ts\";\n\nexport type RedirectData = { href: string; hrefDetails: HrefDetails } & (\n\t| {\n\t\t\tstatus: \"did\";\n\t }\n\t| {\n\t\t\tstatus: \"should\";\n\t\t\tshouldRedirectStrategy: \"hard\" | \"soft\";\n\t\t\tlatestBuildID: string;\n\t }\n);\n\nexport function getBuildIDFromResponse(response: Response | undefined) {\n\treturn response?.headers.get(\"X-Vorma-Build-Id\") || \"\";\n}\n\nexport function parseFetchResponseForRedirectData(\n\treqInit: RequestInit,\n\tres: Response,\n): RedirectData | null {\n\tconst latestBuildID = getBuildIDFromResponse(res);\n\n\tconst vormaReloadTarget = res.headers.get(\"X-Vorma-Reload\");\n\tif (vormaReloadTarget) {\n\t\tconst newURL = new URL(vormaReloadTarget, window.location.href);\n\t\tconst hrefDetails = getHrefDetails(newURL.href);\n\t\tif (!hrefDetails.isHTTP) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn {\n\t\t\threfDetails,\n\t\t\tstatus: \"should\",\n\t\t\thref: vormaReloadTarget,\n\t\t\tshouldRedirectStrategy: \"hard\",\n\t\t\tlatestBuildID,\n\t\t};\n\t}\n\n\tif (res.redirected) {\n\t\tconst newURL = new URL(res.url, window.location.href);\n\t\tconst hrefDetails = getHrefDetails(newURL.href);\n\t\tif (!hrefDetails.isHTTP) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst isCurrent = newURL.href === window.location.href;\n\t\tif (isCurrent) {\n\t\t\treturn { hrefDetails, status: \"did\", href: newURL.href };\n\t\t}\n\n\t\tconst wasGETRequest = getIsGETRequest(reqInit);\n\t\tif (!wasGETRequest) {\n\t\t\tlogInfo(\"Not a GET request. No way to handle.\");\n\t\t\treturn null;\n\t\t}\n\n\t\treturn {\n\t\t\threfDetails,\n\t\t\tstatus: \"should\",\n\t\t\thref: newURL.href,\n\t\t\tshouldRedirectStrategy: hrefDetails.isInternal ? \"soft\" : \"hard\",\n\t\t\tlatestBuildID,\n\t\t};\n\t}\n\n\tconst clientRedirectHeader = res.headers.get(\"X-Client-Redirect\");\n\n\tif (!clientRedirectHeader) {\n\t\treturn null;\n\t}\n\n\tconst newURL = new URL(clientRedirectHeader, window.location.href);\n\tconst hrefDetails = getHrefDetails(newURL.href);\n\tif (!hrefDetails.isHTTP) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\threfDetails,\n\t\tstatus: \"should\",\n\t\thref: hrefDetails.absoluteURL,\n\t\tshouldRedirectStrategy: hrefDetails.isInternal ? \"soft\" : \"hard\",\n\t\tlatestBuildID,\n\t};\n}\n\nexport async function effectuateRedirectDataResult(\n\tredirectData: RedirectData,\n\tredirectCount: number,\n\toriginalProps?: NavigateProps,\n): Promise<RedirectData | null> {\n\tif (redirectData.status !== \"should\") {\n\t\treturn null;\n\t}\n\n\t// Clean up any active redirect or revalidations when redirecting.\n\t// Otherwise loading state will get stuck.\n\tconst navEntries = navigationStateManager.getNavigations().entries();\n\tfor (const [key, nav] of navEntries) {\n\t\tif (nav.type === \"redirect\" || nav.type === \"revalidation\") {\n\t\t\tnav.control.abortController?.abort();\n\t\t\tnavigationStateManager.removeNavigation(key);\n\t\t}\n\t}\n\n\tif (redirectData.shouldRedirectStrategy === \"hard\") {\n\t\tif (!redirectData.hrefDetails.isHTTP) return null;\n\n\t\tif (redirectData.hrefDetails.isExternal) {\n\t\t\twindow.location.href = redirectData.href;\n\t\t} else {\n\t\t\tconst url = new URL(redirectData.href, window.location.href);\n\t\t\turl.searchParams.set(\n\t\t\t\tVORMA_HARD_RELOAD_QUERY_PARAM,\n\t\t\t\tredirectData.latestBuildID,\n\t\t\t);\n\t\t\twindow.location.href = url.href;\n\t\t}\n\n\t\treturn {\n\t\t\threfDetails: redirectData.hrefDetails,\n\t\t\tstatus: \"did\",\n\t\t\thref: redirectData.href,\n\t\t};\n\t}\n\n\tif (redirectData.shouldRedirectStrategy === \"soft\") {\n\t\tawait navigationStateManager.navigate({\n\t\t\thref: redirectData.href,\n\t\t\tnavigationType: \"redirect\",\n\t\t\tredirectCount: redirectCount + 1,\n\t\t\tstate: originalProps?.state,\n\t\t\treplace: originalProps?.replace,\n\t\t\tscrollToTop: originalProps?.scrollToTop,\n\t\t});\n\n\t\treturn {\n\t\t\threfDetails: redirectData.hrefDetails,\n\t\t\tstatus: \"did\",\n\t\t\thref: redirectData.href,\n\t\t};\n\t}\n\n\treturn null;\n}\n\nexport async function handleRedirects(props: {\n\tabortController: AbortController;\n\turl: URL;\n\trequestInit?: RequestInit;\n\tisPrefetch?: boolean;\n\tredirectCount?: number;\n}): Promise<{ redirectData: RedirectData | null; response?: Response }> {\n\tconst MAX_REDIRECTS = 10;\n\tconst redirectCount = props.redirectCount || 0;\n\n\tif (redirectCount >= MAX_REDIRECTS) {\n\t\tlogError(\"Too many redirects\");\n\t\treturn { redirectData: null, response: undefined };\n\t}\n\n\t// Prepare request\n\tconst bodyParentObj: RequestInit = {};\n\tconst isGET = getIsGETRequest(props.requestInit);\n\n\tif (props.requestInit && (props.requestInit.body !== undefined || !isGET)) {\n\t\tif (\n\t\t\tprops.requestInit.body instanceof FormData ||\n\t\t\ttypeof props.requestInit.body === \"string\"\n\t\t) {\n\t\t\tbodyParentObj.body = props.requestInit.body;\n\t\t} else {\n\t\t\tbodyParentObj.body = JSON.stringify(props.requestInit.body);\n\t\t}\n\t}\n\n\tconst headers = new Headers(props.requestInit?.headers);\n\t// To temporarily test traditional server redirect behavior,\n\t// you can set this to \"0\" instead of \"1\"\n\theaders.set(\"X-Accepts-Client-Redirect\", \"1\");\n\tbodyParentObj.headers = headers;\n\n\tconst finalRequestInit = {\n\t\tsignal: props.abortController.signal,\n\t\t...props.requestInit,\n\t\t...bodyParentObj,\n\t};\n\n\t// Execute request\n\tconst res = await fetch(props.url, finalRequestInit);\n\tlet redirectData = parseFetchResponseForRedirectData(finalRequestInit, res);\n\n\treturn { redirectData, response: res };\n}\n", "export const VORMA_HARD_RELOAD_QUERY_PARAM = \"vorma_reload\";\n", "import { panic } from \"../utils/errors.ts\";\nimport type { HeadEl } from \"../vorma_ctx/vorma_ctx.ts\";\n\nexport function getStartAndEndComments(type: \"meta\" | \"rest\"): {\n\tstartComment: Comment | null;\n\tendComment: Comment | null;\n} {\n\tconst startMarker = `data-vorma=\"${type}-start\"`;\n\tconst endMarker = `data-vorma=\"${type}-end\"`;\n\tconst start = findComment(startMarker);\n\tconst end = findComment(endMarker);\n\treturn { startComment: start, endComment: end };\n}\n\nfunction findComment(matchingText: string): Comment | null {\n\tconst walker = document.createTreeWalker(\n\t\tdocument.head,\n\t\tNodeFilter.SHOW_COMMENT,\n\t\t{\n\t\t\tacceptNode(node: Comment) {\n\t\t\t\treturn node.nodeValue?.trim() === matchingText.trim()\n\t\t\t\t\t? NodeFilter.FILTER_ACCEPT\n\t\t\t\t\t: NodeFilter.FILTER_REJECT;\n\t\t\t},\n\t\t},\n\t);\n\treturn walker.nextNode() as Comment | null;\n}\n\nexport function updateHeadEls(type: \"meta\" | \"rest\", blocks: Array<HeadEl>) {\n\tconst { startComment, endComment } = getStartAndEndComments(type);\n\tif (!startComment || !endComment || !endComment.parentNode) {\n\t\treturn;\n\t}\n\tconst parent = endComment.parentNode;\n\n\t// Collect all current nodes between start and end comments\n\tconst currentNodes: Array<Node> = [];\n\tlet nodePtr = startComment.nextSibling;\n\twhile (nodePtr != null && nodePtr !== endComment) {\n\t\tcurrentNodes.push(nodePtr);\n\t\tnodePtr = nodePtr.nextSibling;\n\t}\n\tconst currentElements = currentNodes.filter(\n\t\t(node): node is Element => node.nodeType === Node.ELEMENT_NODE,\n\t);\n\n\t// Create new elements from blocks\n\tconst newElements: Array<Element> = [];\n\tconst newElementFingerprints = new Map<string, Element>();\n\tfor (const block of blocks) {\n\t\tif (!block.tag) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst newEl = document.createElement(block.tag);\n\t\tif (block.attributesKnownSafe) {\n\t\t\tfor (const key of Object.keys(block.attributesKnownSafe)) {\n\t\t\t\tconst value = block.attributesKnownSafe[key];\n\t\t\t\tif (value === null || value === undefined) {\n\t\t\t\t\tpanic(\n\t\t\t\t\t\t`Attribute value for '${key}' in tag '${block.tag}' cannot be null or undefined.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tnewEl.setAttribute(key, value);\n\t\t\t}\n\t\t}\n\t\tif (block.booleanAttributes) {\n\t\t\tfor (const key of block.booleanAttributes) {\n\t\t\t\tnewEl.setAttribute(key, \"\");\n\t\t\t}\n\t\t}\n\t\tif (block.dangerousInnerHTML) {\n\t\t\tnewEl.innerHTML = block.dangerousInnerHTML;\n\t\t}\n\n\t\tconst fingerprint = createElementFingerprint(newEl);\n\t\tif (newElementFingerprints.has(fingerprint)) {\n\t\t\tconst elementToRemove = newElementFingerprints.get(fingerprint);\n\t\t\tif (elementToRemove) {\n\t\t\t\tconst indexToRemove = newElements.indexOf(elementToRemove);\n\t\t\t\tif (indexToRemove > -1) {\n\t\t\t\t\tnewElements.splice(indexToRemove, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tnewElements.push(newEl);\n\t\tnewElementFingerprints.set(fingerprint, newEl);\n\t}\n\n\t// Build a map of current elements by fingerprint\n\tconst currentElementsMap = new Map<string, Array<Element>>();\n\tfor (const el of currentElements) {\n\t\tconst fingerprint = createElementFingerprint(el);\n\t\tif (!currentElementsMap.has(fingerprint)) {\n\t\t\tcurrentElementsMap.set(fingerprint, []);\n\t\t}\n\t\tcurrentElementsMap.get(fingerprint)?.push(el);\n\t}\n\n\t// Match new elements with existing ones when possible\n\tconst finalElements: Array<Element> = [];\n\tconst usedCurrentElements = new Set<Element>();\n\n\tfor (const newEl of newElements) {\n\t\tconst fingerprint = createElementFingerprint(newEl);\n\t\tconst matchingCurrentElementsList =\n\t\t\tcurrentElementsMap.get(fingerprint) || [];\n\n\t\t// Find the first matching element that hasn't been used yet\n\t\tconst matchingElement = matchingCurrentElementsList.find(\n\t\t\t(el) => !usedCurrentElements.has(el),\n\t\t);\n\n\t\tif (matchingElement) {\n\t\t\tusedCurrentElements.add(matchingElement);\n\t\t\tfinalElements.push(matchingElement);\n\t\t} else {\n\t\t\tfinalElements.push(newEl);\n\t\t}\n\t}\n\n\t// Create a map to track which elements are in the correct position\n\t// and which need to be moved or added\n\tconst desiredPositions = new Map<Element, number>();\n\tfinalElements.forEach((el, index) => {\n\t\tdesiredPositions.set(el, index);\n\t});\n\n\t// Track elements still in the DOM\n\tconst remainingCurrentElements = new Set(currentElements);\n\n\t// First pass: remove elements that are no longer needed\n\tfor (const currentElement of currentElements) {\n\t\tif (!usedCurrentElements.has(currentElement)) {\n\t\t\tparent.removeChild(currentElement);\n\t\t\tremainingCurrentElements.delete(currentElement);\n\t\t}\n\t}\n\n\t// Second pass: position elements in the correct order with minimal DOM operations\n\tlet lastProcessedElement: Element | null = null;\n\n\tfor (let i = 0; i < finalElements.length; i++) {\n\t\tconst element = finalElements[i];\n\t\tif (!element) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst isExistingElement = usedCurrentElements.has(element);\n\n\t\tif (isExistingElement) {\n\t\t\t// Check if this element is already in the correct position\n\t\t\tconst nextElementInDOM = (\n\t\t\t\tlastProcessedElement\n\t\t\t\t\t? lastProcessedElement.nextElementSibling\n\t\t\t\t\t: startComment.nextElementSibling\n\t\t\t) as Element | null;\n\n\t\t\tif (nextElementInDOM !== element) {\n\t\t\t\t// Element exists but is in the wrong position, move it\n\t\t\t\tparent.insertBefore(element, nextElementInDOM || endComment);\n\t\t\t}\n\n\t\t\t// Mark as processed\n\t\t\tremainingCurrentElements.delete(element);\n\t\t\tlastProcessedElement = element;\n\t\t} else {\n\t\t\t// This is a new element, insert it\n\t\t\tconst insertBefore = lastProcessedElement\n\t\t\t\t? lastProcessedElement.nextSibling\n\t\t\t\t: startComment.nextSibling;\n\n\t\t\tparent.insertBefore(element, insertBefore || endComment);\n\t\t\tlastProcessedElement = element;\n\t\t}\n\t}\n}\n\nfunction createElementFingerprint(element: Element): string {\n\tconst attributes: Array<string> = [];\n\tfor (let i = 0; i < element.attributes.length; i++) {\n\t\tconst attr = element.attributes[i];\n\t\tif (!attr) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst value =\n\t\t\telement.hasAttribute(attr.name) && attr.value === \"\"\n\t\t\t\t? \"\"\n\t\t\t\t: attr.value;\n\t\tattributes.push(`${attr.name}=\"${value}\"`);\n\t}\n\tattributes.sort();\n\treturn `${element.tagName.toUpperCase()}|${attributes.join(\",\")}|${(element.innerHTML || \"\").trim()}`;\n}\n", "import { AssetManager } from \"./asset_manager.ts\";\nimport type { VormaNavigationType } from \"./client.ts\";\nimport { deriveAndSetErrorState } from \"./client_loaders.ts\";\nimport { ComponentLoader } from \"./component_loader.ts\";\nimport { dispatchRouteChangeEvent } from \"./events.ts\";\nimport { updateHeadEls } from \"./head_elements/head_elements.ts\";\nimport { HistoryManager } from \"./history/history.ts\";\nimport type { ScrollState } from \"./scroll_state_manager.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype GetRouteDataOutput,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\ntype RerenderAppProps = {\n\tjson: GetRouteDataOutput;\n\tnavigationType: VormaNavigationType;\n\trunHistoryOptions?: {\n\t\thref: string;\n\t\tscrollStateToRestore?: ScrollState;\n\t\treplace?: boolean;\n\t\tscrollToTop?: boolean;\n\t\tstate?: unknown;\n\t};\n\tonFinish: () => void;\n};\n\nexport async function __reRenderApp(props: RerenderAppProps): Promise<void> {\n\tconst shouldUseViewTransitions =\n\t\t__vormaClientGlobal.get(\"useViewTransitions\") &&\n\t\t!!document.startViewTransition &&\n\t\tprops.navigationType !== \"prefetch\" &&\n\t\tprops.navigationType !== \"revalidation\";\n\n\tif (shouldUseViewTransitions) {\n\t\tconst transition = document.startViewTransition(async () => {\n\t\t\tawait __reRenderAppInner(props);\n\t\t});\n\t\tawait transition.finished;\n\t} else {\n\t\tawait __reRenderAppInner(props);\n\t}\n}\n\nasync function __reRenderAppInner(props: RerenderAppProps): Promise<void> {\n\tconst { json, navigationType, runHistoryOptions } = props;\n\n\t// Update global state\n\tconst stateKeys = [\n\t\t\"outermostServerError\",\n\t\t\"outermostServerErrorIdx\",\n\t\t\"errorExportKeys\",\n\t\t\"matchedPatterns\",\n\t\t\"loadersData\",\n\t\t\"importURLs\",\n\t\t\"exportKeys\",\n\t\t\"hasRootData\",\n\t\t\"params\",\n\t\t\"splatValues\",\n\t] as const;\n\n\tfor (const key of stateKeys) {\n\t\t__vormaClientGlobal.set(key, json[key]);\n\t}\n\n\tderiveAndSetErrorState();\n\n\t// Load components and error boundary\n\tawait ComponentLoader.handleComponents(json.importURLs);\n\tawait ComponentLoader.handleErrorBoundaryComponent(json.importURLs);\n\n\t// Handle history and scroll\n\tlet scrollStateToDispatch: ScrollState | undefined;\n\n\tif (runHistoryOptions) {\n\t\tconst { href, scrollStateToRestore, replace, scrollToTop } =\n\t\t\trunHistoryOptions;\n\t\tconst hash = href.split(\"#\")[1];\n\t\tconst history = HistoryManager.getInstance();\n\n\t\tif (\n\t\t\tnavigationType === \"userNavigation\" ||\n\t\t\tnavigationType === \"redirect\"\n\t\t) {\n\t\t\tconst target = new URL(href, window.location.href).href;\n\t\t\tconst current = new URL(window.location.href).href;\n\n\t\t\tif (target !== current && !replace) {\n\t\t\t\thistory.push(href, runHistoryOptions.state);\n\t\t\t} else {\n\t\t\t\thistory.replace(href, runHistoryOptions.state);\n\t\t\t}\n\n\t\t\tscrollStateToDispatch = hash\n\t\t\t\t? { hash }\n\t\t\t\t: scrollToTop !== false\n\t\t\t\t\t? { x: 0, y: 0 }\n\t\t\t\t\t: undefined;\n\t\t}\n\n\t\tif (navigationType === \"browserHistory\") {\n\t\t\tscrollStateToDispatch =\n\t\t\t\tscrollStateToRestore ?? (hash ? { hash } : undefined);\n\t\t}\n\t}\n\n\tif (json.title !== undefined) {\n\t\t// Changing the title instantly makes it feel faster\n\t\t// The temp textarea trick is to decode any HTML entities in the title.\n\t\t// This should come after pushing to history though, so that the title is\n\t\t// correct in the history entry.\n\t\tconst tempTxt = document.createElement(\"textarea\");\n\t\ttempTxt.innerHTML = json.title?.dangerousInnerHTML || \"\";\n\t\tif (document.title !== tempTxt.value) {\n\t\t\tdocument.title = tempTxt.value;\n\t\t}\n\t}\n\n\t// Apply CSS\n\tif (json.cssBundles) {\n\t\tAssetManager.applyCSS(json.cssBundles);\n\t}\n\n\t// Dispatch route change event -- this triggers the actual UI update\n\tdispatchRouteChangeEvent({ __scrollState: scrollStateToDispatch });\n\n\t// Only update head elements if provided (not undefined)\n\tif (json.metaHeadEls !== undefined) {\n\t\tupdateHeadEls(\"meta\", json.metaHeadEls ?? []);\n\t}\n\tif (json.restHeadEls !== undefined) {\n\t\tupdateHeadEls(\"rest\", json.restHeadEls ?? []);\n\t}\n\n\tprops.onFinish();\n}\n", "import type { RouteErrorComponent } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport const defaultErrorBoundary: RouteErrorComponent = (props: {\n\terror: string;\n}) => {\n\treturn \"Route Error: \" + props.error;\n};\n", "import { getStatus } from \"../client.ts\";\nimport { addStatusListener, type StatusEvent } from \"../events.ts\";\n\nconst DEFAULT_DELAY = 12;\n\ntype GlobalLoadingIndicatorIncludesOption =\n\t| \"navigations\"\n\t| \"submissions\"\n\t| \"revalidations\";\n\ntype GlobalLoadingIndicatorConfig = {\n\tstart: () => void;\n\tstop: () => void;\n\tisRunning: () => boolean;\n\tinclude?: \"all\" | Array<GlobalLoadingIndicatorIncludesOption>;\n\tstartDelayMS?: number;\n\tstopDelayMS?: number;\n};\n\ntype ParsedGlobalLoadingIndicatorConfig = {\n\tincludesAll: boolean;\n\tincludesNavigations: boolean;\n\tincludesSubmissions: boolean;\n\tincludesRevalidations: boolean;\n\tstartDelayMS: number;\n\tstopDelayMS: number;\n};\n\nfunction resolveIncludes(\n\tconfig: GlobalLoadingIndicatorConfig,\n\tincludesOption: GlobalLoadingIndicatorIncludesOption,\n) {\n\tconst isArray = Array.isArray(config.include);\n\treturn isArray && config.include?.includes(includesOption);\n}\n\nexport function setupGlobalLoadingIndicator(\n\tconfig: GlobalLoadingIndicatorConfig,\n) {\n\tlet gliDebounceStartTimer: number | null = null;\n\tlet gliDebounceStopTimer: number | null = null;\n\tconst includesAll = !config.include || config.include === \"all\";\n\tconst pc: ParsedGlobalLoadingIndicatorConfig = {\n\t\tincludesAll,\n\t\tincludesNavigations:\n\t\t\tresolveIncludes(config, \"navigations\") || includesAll,\n\t\tincludesSubmissions:\n\t\t\tresolveIncludes(config, \"submissions\") || includesAll,\n\t\tincludesRevalidations:\n\t\t\tresolveIncludes(config, \"revalidations\") || includesAll,\n\t\tstartDelayMS: config.startDelayMS ?? DEFAULT_DELAY,\n\t\tstopDelayMS: config.stopDelayMS ?? DEFAULT_DELAY,\n\t};\n\tfunction clearStartTimer() {\n\t\tif (gliDebounceStartTimer) {\n\t\t\twindow.clearTimeout(gliDebounceStartTimer);\n\t\t\tgliDebounceStartTimer = null;\n\t\t}\n\t}\n\tfunction clearStopTimer() {\n\t\tif (gliDebounceStopTimer) {\n\t\t\twindow.clearTimeout(gliDebounceStopTimer);\n\t\t\tgliDebounceStopTimer = null;\n\t\t}\n\t}\n\tfunction clearTimers() {\n\t\tclearStartTimer();\n\t\tclearStopTimer();\n\t}\n\tfunction handleStatusChange(e?: StatusEvent) {\n\t\tconst shouldBeWorking = getIsWorking(pc, e);\n\t\tif (shouldBeWorking) {\n\t\t\tclearStopTimer();\n\t\t\tif (!gliDebounceStartTimer) {\n\t\t\t\tgliDebounceStartTimer = window.setTimeout(() => {\n\t\t\t\t\tgliDebounceStartTimer = null;\n\t\t\t\t\tif (!config.isRunning() && getIsWorking(pc)) {\n\t\t\t\t\t\tconfig.start();\n\t\t\t\t\t}\n\t\t\t\t}, pc.startDelayMS);\n\t\t\t}\n\t\t} else {\n\t\t\tclearStartTimer();\n\t\t\tif (!gliDebounceStopTimer) {\n\t\t\t\tgliDebounceStopTimer = window.setTimeout(() => {\n\t\t\t\t\tgliDebounceStopTimer = null;\n\t\t\t\t\tif (config.isRunning() && !getIsWorking(pc)) {\n\t\t\t\t\t\tconfig.stop();\n\t\t\t\t\t}\n\t\t\t\t}, pc.stopDelayMS);\n\t\t\t}\n\t\t}\n\t}\n\thandleStatusChange();\n\tconst removeStatusListenerCallback = addStatusListener(handleStatusChange);\n\treturn () => {\n\t\tremoveStatusListenerCallback();\n\t\tclearTimers();\n\t\tif (config.isRunning()) {\n\t\t\tconfig.stop();\n\t\t}\n\t};\n}\n\nfunction getIsWorking(\n\tpc: ParsedGlobalLoadingIndicatorConfig,\n\te?: StatusEvent,\n): boolean {\n\tconst status = e?.detail ?? getStatus();\n\tif (pc.includesAll) {\n\t\treturn (\n\t\t\tstatus.isNavigating || status.isSubmitting || status.isRevalidating\n\t\t);\n\t}\n\tif (pc.includesNavigations && status.isNavigating) {\n\t\treturn true;\n\t}\n\tif (pc.includesSubmissions && status.isSubmitting) {\n\t\treturn true;\n\t}\n\tif (pc.includesRevalidations && status.isRevalidating) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n", "import { debounce } from \"vorma/kit/debounce\";\nimport { revalidate } from \"../client.ts\";\nimport { setupClientLoaders } from \"../client_loaders.ts\";\nimport { dispatchRouteChangeEvent } from \"../events.ts\";\nimport { logInfo } from \"../utils/logging.ts\";\nimport { __vormaClientGlobal } from \"../vorma_ctx/vorma_ctx.ts\";\n\nlet devTimeSetupClientLoadersDebounced: () => Promise<void> = () =>\n\tPromise.resolve();\n\nlet hmrRevalidateSet: Set<string>;\n\nexport let __runClientLoadersAfterHMRUpdate: (\n\timportMeta: ImportMeta,\n\tpattern: string,\n) => void = () => {};\n\nexport function initHMR() {\n\tif (import.meta.env.DEV) {\n\t\t(window as any).__waveRevalidate = revalidate;\n\n\t\tdevTimeSetupClientLoadersDebounced = debounce(async () => {\n\t\t\tawait setupClientLoaders();\n\t\t\tdispatchRouteChangeEvent({});\n\t\t}, 10);\n\n\t\t__runClientLoadersAfterHMRUpdate = (importMeta, pattern) => {\n\t\t\tif (hmrRevalidateSet === undefined) {\n\t\t\t\thmrRevalidateSet = new Set();\n\t\t\t}\n\n\t\t\tif (import.meta.env.DEV && import.meta.hot) {\n\t\t\t\tconst thisURL = new URL(importMeta.url, location.href);\n\t\t\t\tthisURL.search = \"\";\n\t\t\t\tconst thisPathname = thisURL.pathname;\n\n\t\t\t\tconst alreadyRegistered = hmrRevalidateSet.has(thisPathname);\n\t\t\t\tif (alreadyRegistered) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\thmrRevalidateSet.add(thisPathname);\n\n\t\t\t\timport.meta.hot.on(\"vite:afterUpdate\", (props) => {\n\t\t\t\t\tfor (const update of props.updates) {\n\t\t\t\t\t\tif (update.type === \"js-update\") {\n\t\t\t\t\t\t\tconst updateURL = new URL(\n\t\t\t\t\t\t\t\tupdate.path,\n\t\t\t\t\t\t\t\tlocation.href,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tupdateURL.search = \"\";\n\t\t\t\t\t\t\tif (updateURL.pathname === thisURL.pathname) {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t__vormaClientGlobal\n\t\t\t\t\t\t\t\t\t\t.get(\"matchedPatterns\")\n\t\t\t\t\t\t\t\t\t\t.includes(pattern)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tlogInfo(\n\t\t\t\t\t\t\t\t\t\t\"Refreshing client loaders due to change in pattern:\",\n\t\t\t\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tdevTimeSetupClientLoadersDebounced();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}\n}\n", "import {\n\tcreatePatternRegistry,\n\tregisterPattern,\n} from \"vorma/kit/matcher/register\";\nimport { setupClientLoaders } from \"./client_loaders.ts\";\nimport { ComponentLoader } from \"./component_loader.ts\";\nimport { defaultErrorBoundary } from \"./error_boundary.ts\";\nimport { VORMA_HARD_RELOAD_QUERY_PARAM } from \"./hard_reload.ts\";\nimport { HistoryManager } from \"./history/history.ts\";\nimport { initHMR } from \"./hmr/hmr.ts\";\nimport { scrollStateManager } from \"./scroll_state_manager.ts\";\nimport type { VormaAppConfig } from \"./vorma_app_helpers/vorma_app_helpers.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype RouteErrorComponent,\n\ttype VormaClientGlobal,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport async function initClient(options: {\n\tvormaAppConfig: VormaAppConfig;\n\trenderFn: () => void;\n\tdefaultErrorBoundary?: RouteErrorComponent;\n\tuseViewTransitions?: boolean;\n}): Promise<void> {\n\tinitHMR();\n\n\t// Setup beforeunload handler for scroll restoration\n\twindow.addEventListener(\"beforeunload\", () => {\n\t\tscrollStateManager.savePageRefreshState();\n\t});\n\n\t__vormaClientGlobal.set(\"vormaAppConfig\", options.vormaAppConfig);\n\tconst clientModuleMap: VormaClientGlobal[\"clientModuleMap\"] = {};\n\n\t// Populate client module map with initial page's modules\n\tconst initialMatchedPatterns =\n\t\t__vormaClientGlobal.get(\"matchedPatterns\") || [];\n\tconst initialImportURLs = __vormaClientGlobal.get(\"importURLs\") || [];\n\tconst initialExportKeys = __vormaClientGlobal.get(\"exportKeys\") || [];\n\tconst initialErrorExportKeys =\n\t\t__vormaClientGlobal.get(\"errorExportKeys\") || [];\n\n\tfor (let i = 0; i < initialMatchedPatterns.length; i++) {\n\t\tconst pattern = initialMatchedPatterns[i];\n\t\tconst importURL = initialImportURLs[i];\n\t\tconst exportKey = initialExportKeys[i];\n\t\tconst errorExportKey = initialErrorExportKeys[i];\n\n\t\tif (pattern && importURL) {\n\t\t\tclientModuleMap[pattern] = {\n\t\t\t\timportURL,\n\t\t\t\texportKey: exportKey || \"default\",\n\t\t\t\terrorExportKey: errorExportKey || \"\",\n\t\t\t};\n\t\t}\n\t}\n\t__vormaClientGlobal.set(\"clientModuleMap\", clientModuleMap);\n\n\tconst patternRegistry = createPatternRegistry({\n\t\tdynamicParamPrefixRune: options.vormaAppConfig.loadersDynamicRune,\n\t\tsplatSegmentRune: options.vormaAppConfig.loadersSplatRune,\n\t\texplicitIndexSegment:\n\t\t\toptions.vormaAppConfig.loadersExplicitIndexSegment,\n\t});\n\t__vormaClientGlobal.set(\"patternRegistry\", patternRegistry);\n\n\tconst manifestURL = __vormaClientGlobal.get(\"routeManifestURL\");\n\tif (manifestURL) {\n\t\tfetch(manifestURL)\n\t\t\t.then((response) => response.json())\n\t\t\t.then((manifest) => {\n\t\t\t\t__vormaClientGlobal.set(\"routeManifest\", manifest);\n\n\t\t\t\t// Register all patterns from manifest into the existing registry\n\t\t\t\tfor (const pattern of Object.keys(manifest)) {\n\t\t\t\t\tregisterPattern(patternRegistry, pattern);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\t// This is no biggie -- it's a progressive enhancement\n\t\t\t\tconsole.warn(\"Failed to load route manifest:\", error);\n\t\t\t});\n\t}\n\n\t// Set options\n\tif (options.defaultErrorBoundary) {\n\t\t__vormaClientGlobal.set(\n\t\t\t\"defaultErrorBoundary\",\n\t\t\toptions.defaultErrorBoundary,\n\t\t);\n\t} else {\n\t\t__vormaClientGlobal.set(\"defaultErrorBoundary\", defaultErrorBoundary);\n\t}\n\n\tif (options.useViewTransitions) {\n\t\t__vormaClientGlobal.set(\"useViewTransitions\", true);\n\t}\n\n\t// Initialize history\n\tHistoryManager.init();\n\n\t// Clean URL\n\tconst url = new URL(window.location.href);\n\tif (url.searchParams.has(VORMA_HARD_RELOAD_QUERY_PARAM)) {\n\t\turl.searchParams.delete(VORMA_HARD_RELOAD_QUERY_PARAM);\n\t\tHistoryManager.getInstance().replace(url.href);\n\t}\n\n\tconst importURLs = __vormaClientGlobal.get(\"importURLs\");\n\n\t// Load initial components\n\tawait ComponentLoader.handleComponents(importURLs);\n\n\t// Setup client loaders\n\tawait setupClientLoaders();\n\n\t// Handle error boundary component (must come after setupClientLoaders)\n\tawait ComponentLoader.handleErrorBoundaryComponent(importURLs);\n\n\t// Render\n\toptions.renderFn();\n\n\t// Restore scroll\n\tscrollStateManager.restorePageRefreshState();\n\n\t// Touch detection\n\twindow.addEventListener(\n\t\t\"touchstart\",\n\t\t() => {\n\t\t\t__vormaClientGlobal.set(\"isTouchDevice\", true);\n\t\t},\n\t\t{ once: true },\n\t);\n}\n", "import { getAnchorDetailsFromEvent, getHrefDetails } from \"vorma/kit/url\";\nimport { navigationStateManager, vormaNavigate } from \"./client.ts\";\nimport { saveScrollState } from \"./scroll_state_manager.ts\";\n\ntype LinkOnClickCallback<E extends Event> = (event: E) => void | Promise<void>;\n\ntype LinkOnClickCallbacks<E extends Event> = {\n\tbeforeBegin?: LinkOnClickCallback<E>;\n\tbeforeRender?: LinkOnClickCallback<E>;\n\tafterRender?: LinkOnClickCallback<E>;\n};\n\ntype GetPrefetchHandlersInput<E extends Event> = LinkOnClickCallbacks<E> & {\n\thref: string;\n\tdelayMs?: number;\n\tscrollToTop?: boolean;\n\treplace?: boolean;\n\tsearch?: string;\n\thash?: string;\n\tstate?: unknown;\n};\n\nexport function __getPrefetchHandlers<E extends Event>(\n\tinput: GetPrefetchHandlersInput<E>,\n) {\n\tconst hrefDetails = getHrefDetails(input.href);\n\tif (!hrefDetails.isHTTP) {\n\t\treturn;\n\t}\n\n\t// TypeScript type guard -- after this check, we know relativeURL exists\n\tconst { relativeURL } = hrefDetails;\n\tif (!relativeURL || hrefDetails.isExternal) {\n\t\treturn;\n\t}\n\n\tlet timer: number | undefined;\n\tlet prefetchStarted = false;\n\tconst delayMs = input.delayMs ?? 100;\n\n\tasync function prefetch(e: E): Promise<void> {\n\t\tif (prefetchStarted) return;\n\t\tprefetchStarted = true;\n\n\t\tif (input.beforeBegin) {\n\t\t\tawait input.beforeBegin(e);\n\t\t}\n\n\t\tconst fullUrl = new URL(relativeURL, window.location.href);\n\t\tif (input.search !== undefined) fullUrl.search = input.search;\n\t\tif (input.hash !== undefined) fullUrl.hash = input.hash;\n\n\t\t// Use the navigation system\n\t\tawait navigationStateManager.navigate({\n\t\t\thref: fullUrl.href,\n\t\t\tnavigationType: \"prefetch\",\n\t\t\tstate: input.state,\n\t\t});\n\t}\n\n\tfunction start(e: E): void {\n\t\tif (prefetchStarted) return;\n\t\ttimer = window.setTimeout(() => prefetch(e), delayMs);\n\t}\n\n\tfunction stop(): void {\n\t\tif (timer) {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = undefined;\n\t\t}\n\n\t\t// Abort prefetch if it exists and hasn't been upgraded\n\t\tconst targetUrl = new URL(relativeURL, window.location.href).href;\n\t\tconst nav = navigationStateManager.getNavigation(targetUrl);\n\t\tif (nav && nav.type === \"prefetch\" && nav.intent === \"none\") {\n\t\t\tnav.control.abortController?.abort();\n\t\t\tnavigationStateManager.removeNavigation(targetUrl);\n\t\t}\n\n\t\tprefetchStarted = false;\n\t}\n\n\tasync function onClick(e: E): Promise<void> {\n\t\tif (e.defaultPrevented) return;\n\n\t\tconst anchorDetails = getAnchorDetailsFromEvent(\n\t\t\te as unknown as MouseEvent,\n\t\t);\n\t\tif (!anchorDetails) return;\n\n\t\tconst { isEligibleForDefaultPrevention, isInternal } = anchorDetails;\n\t\tif (!isEligibleForDefaultPrevention || !isInternal) return;\n\n\t\tif (isJustAHashChange(anchorDetails)) {\n\t\t\tsaveScrollState();\n\t\t\treturn;\n\t\t}\n\n\t\te.preventDefault();\n\n\t\tif (timer) {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = undefined;\n\t\t}\n\n\t\t// Execute callbacks\n\t\tif (input.beforeBegin && !prefetchStarted) {\n\t\t\tawait input.beforeBegin(e);\n\t\t}\n\n\t\tif (input.beforeRender) {\n\t\t\tawait input.beforeRender(e);\n\t\t}\n\n\t\t// Use standard navigation -- it will upgrade the prefetch if it exists\n\t\tawait vormaNavigate(relativeURL, {\n\t\t\tscrollToTop: input.scrollToTop,\n\t\t\treplace: input.replace,\n\t\t\tsearch: input.search,\n\t\t\thash: input.hash,\n\t\t\tstate: input.state,\n\t\t});\n\n\t\tif (input.afterRender) {\n\t\t\tawait input.afterRender(e);\n\t\t}\n\t}\n\n\treturn {\n\t\t...hrefDetails,\n\t\tstart,\n\t\tstop,\n\t\tonClick,\n\t};\n}\n\nexport function __makeLinkOnClickFn<E extends Event>(\n\tcallbacks: LinkOnClickCallbacks<E> & {\n\t\tscrollToTop?: boolean;\n\t\treplace?: boolean;\n\t\tstate?: unknown;\n\t},\n) {\n\treturn async (e: E) => {\n\t\tif (e.defaultPrevented) return;\n\n\t\tconst anchorDetails = getAnchorDetailsFromEvent(\n\t\t\te as unknown as MouseEvent,\n\t\t);\n\t\tif (!anchorDetails) return;\n\n\t\tconst { anchor, isEligibleForDefaultPrevention, isInternal } =\n\t\t\tanchorDetails;\n\t\tif (!anchor) return;\n\n\t\tif (isJustAHashChange(anchorDetails)) {\n\t\t\tsaveScrollState();\n\t\t\treturn;\n\t\t}\n\n\t\tif (isEligibleForDefaultPrevention && isInternal) {\n\t\t\te.preventDefault();\n\n\t\t\tawait callbacks.beforeBegin?.(e);\n\n\t\t\tconst control = navigationStateManager.beginNavigation({\n\t\t\t\thref: anchor.href,\n\t\t\t\tnavigationType: \"userNavigation\",\n\t\t\t\tscrollToTop: callbacks.scrollToTop,\n\t\t\t\treplace: callbacks.replace,\n\t\t\t\tstate: callbacks.state,\n\t\t\t});\n\n\t\t\tif (!control.promise) return;\n\n\t\t\tconst res = await control.promise;\n\n\t\t\tif (!res) {\n\t\t\t\t// If not here, loading indicator can get stuck on\n\t\t\t\t// following redirects\n\t\t\t\tconst targetUrl = new URL(anchor.href, window.location.href)\n\t\t\t\t\t.href;\n\t\t\t\tnavigationStateManager.removeNavigation(targetUrl);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait callbacks.beforeRender?.(e);\n\n\t\t\tconst targetUrl = new URL(anchor.href, window.location.href).href;\n\t\t\tconst entry = navigationStateManager.getNavigation(targetUrl);\n\t\t\tif (entry) {\n\t\t\t\tawait navigationStateManager[\"processNavigationResult\"](\n\t\t\t\t\tres,\n\t\t\t\t\tentry,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait callbacks.afterRender?.(e);\n\t\t}\n\t};\n}\n\nfunction isJustAHashChange(\n\tanchorDetails: ReturnType<typeof getAnchorDetailsFromEvent>,\n): boolean {\n\tif (!anchorDetails) return false;\n\n\tconst { pathname, search, hash } = new URL(\n\t\tanchorDetails.anchor.href,\n\t\twindow.location.href,\n\t);\n\n\treturn !!(\n\t\thash &&\n\t\tpathname === window.location.pathname &&\n\t\tsearch === window.location.search\n\t);\n}\n", "// Used by client route defs file (e.g., vorma.routes.ts)\n\ntype ImportPromise = Promise<Record<string, any>>;\ntype Key<T extends ImportPromise> = keyof Awaited<T>;\n\n/**\n * Registers a route with the given route pattern,\n * module import promise, component export key, and\n * optional error boundary export key. Only for use\n * in your centralized build-time route definitions\n * file.\n */\nexport function route<IP extends ImportPromise>(\n\t// oxlint-disable-next-line no-unused-vars\n\tpattern: string,\n\t// oxlint-disable-next-line no-unused-vars\n\timportPromise: IP,\n\t// oxlint-disable-next-line no-unused-vars\n\tcomponentKey: Key<IP>,\n\t// oxlint-disable-next-line no-unused-vars\n\terrorBoundaryKey?: Key<IP>,\n): void {}\n", "import { serializeToSearchParams } from \"vorma/kit/json\";\nimport type { SubmitOptions } from \"../client.ts\";\n\nexport type VormaAppConfig = {\n\tactionsRouterMountRoot: string;\n\tactionsDynamicRune: string;\n\tactionsSplatRune: string;\n\tloadersDynamicRune: string;\n\tloadersSplatRune: string;\n\tloadersExplicitIndexSegment: string;\n\t__phantom?: any;\n};\n\nexport type VormaAppBase = {\n\troutes: readonly any[];\n\tappConfig: VormaAppConfig;\n\trootData: any;\n};\n\nexport type ExtractApp<C extends VormaAppConfig> = C[\"__phantom\"];\n\ntype RouteByType<App extends VormaAppBase, T extends string> = Extract<\n\tApp[\"routes\"][number],\n\t{ _type: T }\n>;\n\ntype RouteByPattern<Routes, P> = Extract<Routes, { pattern: P }>;\n\ntype VormaLoader<App extends VormaAppBase> = RouteByType<App, \"loader\">;\ntype VormaQuery<App extends VormaAppBase> = RouteByType<App, \"query\">;\ntype VormaMutation<App extends VormaAppBase> = RouteByType<App, \"mutation\">;\n\n// Pattern types\nexport type VormaLoaderPattern<App extends VormaAppBase> =\n\tVormaLoader<App>[\"pattern\"];\nexport type VormaQueryPattern<App extends VormaAppBase> =\n\tVormaQuery<App>[\"pattern\"];\nexport type VormaMutationPattern<App extends VormaAppBase> =\n\tVormaMutation<App>[\"pattern\"];\n\n// IO types\nexport type VormaLoaderOutput<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> =\n\tRouteByPattern<VormaLoader<App>, P> extends { phantomOutputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaQueryInput<\n\tApp extends VormaAppBase,\n\tP extends VormaQueryPattern<App>,\n> =\n\tRouteByPattern<VormaQuery<App>, P> extends { phantomInputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaQueryOutput<\n\tApp extends VormaAppBase,\n\tP extends VormaQueryPattern<App>,\n> =\n\tRouteByPattern<VormaQuery<App>, P> extends { phantomOutputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaMutationInput<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> =\n\tRouteByPattern<VormaMutation<App>, P> extends { phantomInputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaMutationOutput<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> =\n\tRouteByPattern<VormaMutation<App>, P> extends { phantomOutputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaMutationMethod<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> =\n\tRouteByPattern<VormaMutation<App>, P> extends { method: infer M }\n\t\t? M extends string\n\t\t\t? M\n\t\t\t: \"POST\"\n\t\t: \"POST\";\n\n// Route metadata\ntype RouteMetadata<App extends VormaAppBase, P extends string> = Extract<\n\tApp[\"routes\"][number],\n\t{ pattern: P }\n>;\n\nexport type GetParams<App extends VormaAppBase, P extends string> =\n\tRouteMetadata<App, P> extends { params: ReadonlyArray<infer Params> }\n\t\t? Params extends string\n\t\t\t? Params\n\t\t\t: never\n\t\t: never;\n\nexport type VormaRouteParams<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = GetParams<App, P>;\n\nexport type HasParams<App extends VormaAppBase, P extends string> =\n\tGetParams<App, P> extends never ? false : true;\n\nexport type IsSplat<App extends VormaAppBase, P extends string> =\n\tRouteMetadata<App, P> extends { isSplat: true } ? true : false;\n\nexport type IsEmptyInput<T> = [T] extends [null | undefined | never]\n\t? true\n\t: false;\n\n// Pattern-based props composition\ntype ConditionalParams<App extends VormaAppBase, P extends string> =\n\tHasParams<App, P> extends true\n\t\t? { params: { [K in GetParams<App, P>]: string } }\n\t\t: {};\n\ntype ConditionalSplat<App extends VormaAppBase, P extends string> =\n\tIsSplat<App, P> extends true ? { splatValues: Array<string> } : {};\n\nexport type PatternBasedProps<App extends VormaAppBase, P extends string> = {\n\tpattern: P;\n} & ConditionalParams<App, P> &\n\tConditionalSplat<App, P>;\n\nexport type PermissivePatternBasedProps<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = {\n\tpattern: PermissiveLoaderPattern<App, P>;\n} & ConditionalParams<App, P> &\n\tConditionalSplat<App, P>;\n\ntype PermissiveLoaderPattern<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = P extends `${infer Prefix}/${App[\"appConfig\"][\"loadersExplicitIndexSegment\"]}`\n\t? P | (Prefix extends \"\" ? \"/\" : Prefix)\n\t: P;\n\nexport type VormaRoutePropsGeneric<\n\tJSXElement,\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = {\n\tidx: number;\n\tOutlet: (props: Record<string, any>) => JSXElement;\n\t__phantom_pattern: P;\n} & Record<string, any>;\n\n/////////////////////////////////////////////////////////////////////\n/////// API CLIENT HELPERS\n/////////////////////////////////////////////////////////////////////\n\ntype Props = PatternBasedProps<any, string> & {\n\toptions?: SubmitOptions;\n\trequestInit?: RequestInit;\n\tinput?: any;\n};\n\ntype APIClientHelperOpts = {\n\tvormaAppConfig: VormaAppConfig;\n\ttype: \"loader\" | \"query\" | \"mutation\";\n\tprops: Props;\n};\n\nexport type VormaQueryProps<\n\tApp extends VormaAppBase,\n\tP extends VormaQueryPattern<App>,\n> = (PatternBasedProps<App, P> & {\n\toptions?: SubmitOptions;\n\trequestInit?: Omit<RequestInit, \"method\"> & { method?: \"GET\" };\n}) &\n\t(IsEmptyInput<VormaQueryInput<App, P>> extends true\n\t\t? { input?: VormaQueryInput<App, P> }\n\t\t: { input: VormaQueryInput<App, P> });\n\nexport type VormaMutationProps<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> = PatternBasedProps<App, P> & {\n\toptions?: SubmitOptions;\n} & (VormaMutationMethod<App, P> extends \"POST\"\n\t\t? { requestInit?: Omit<RequestInit, \"method\"> & { method?: \"POST\" } }\n\t\t: {\n\t\t\t\trequestInit: RequestInit & {\n\t\t\t\t\tmethod: VormaMutationMethod<App, P>;\n\t\t\t\t};\n\t\t\t}) &\n\t(IsEmptyInput<VormaMutationInput<App, P>> extends true\n\t\t? { input?: VormaMutationInput<App, P> }\n\t\t: { input: VormaMutationInput<App, P> });\n\nexport function buildQueryURL(\n\tvormaAppConfig: VormaAppConfig,\n\tprops: Props,\n): URL {\n\treturn buildURL({ vormaAppConfig, props, type: \"query\" });\n}\n\nexport function buildMutationURL(\n\tvormaAppConfig: VormaAppConfig,\n\tprops: Props,\n): URL {\n\treturn buildURL({ vormaAppConfig, props, type: \"mutation\" });\n}\n\nexport function resolveBody(props: Props): BodyInit | null | undefined {\n\tconst { input } = props;\n\tif (\n\t\tinput == null ||\n\t\ttypeof input === \"string\" ||\n\t\tinput instanceof Blob ||\n\t\tinput instanceof FormData ||\n\t\tinput instanceof URLSearchParams ||\n\t\tinput instanceof ReadableStream ||\n\t\tinput instanceof ArrayBuffer ||\n\t\tArrayBuffer.isView(input)\n\t) {\n\t\treturn input;\n\t}\n\treturn JSON.stringify(input);\n}\n\nfunction buildURL(opts: APIClientHelperOpts): URL {\n\tconst base_path = stripTrailingSlash(\n\t\topts.vormaAppConfig.actionsRouterMountRoot,\n\t);\n\tconst resolved_path = __resolvePath(opts);\n\tconst url = new URL(base_path + resolved_path, getCurrentOrigin());\n\n\tif (opts.type === \"query\" && opts.props.input) {\n\t\turl.search = serializeToSearchParams(opts.props.input).toString();\n\t}\n\n\treturn url;\n}\n\nexport function __resolvePath(opts: APIClientHelperOpts): string {\n\tconst { props, vormaAppConfig } = opts;\n\tlet path = props.pattern;\n\n\tlet dynamicParamPrefixRune = vormaAppConfig.actionsDynamicRune;\n\tlet splatSegmentRune = vormaAppConfig.actionsSplatRune;\n\n\tif (opts.type === \"loader\") {\n\t\tdynamicParamPrefixRune = vormaAppConfig.loadersDynamicRune;\n\t\tsplatSegmentRune = vormaAppConfig.loadersSplatRune;\n\t}\n\n\tif (\"params\" in props && props.params) {\n\t\tfor (const [key, value] of Object.entries(props.params)) {\n\t\t\tpath = path.replace(\n\t\t\t\t`${dynamicParamPrefixRune}${key}`,\n\t\t\t\tString(value),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (\"splatValues\" in props && props.splatValues) {\n\t\tconst splatPath = (props.splatValues as Array<string>).join(\"/\");\n\t\tpath = path.replace(splatSegmentRune, splatPath);\n\t}\n\n\t// Strip explicit index segment\n\tif (opts.type === \"loader\" && vormaAppConfig.loadersExplicitIndexSegment) {\n\t\tconst indexSegment = `/${vormaAppConfig.loadersExplicitIndexSegment}`;\n\t\tif (path.endsWith(indexSegment)) {\n\t\t\tpath = path.slice(0, -indexSegment.length) || \"/\";\n\t\t}\n\t}\n\n\treturn path;\n}\n\nfunction getCurrentOrigin(): string {\n\treturn new URL(window.location.href).origin;\n}\n\nfunction stripTrailingSlash(path: string): string {\n\treturn path.endsWith(\"/\") ? path.slice(0, -1) : path;\n}\n", "import { __getPrefetchHandlers, __makeLinkOnClickFn } from \"../links.ts\";\nimport { __resolvePath } from \"../vorma_app_helpers/vorma_app_helpers.ts\";\nimport { __vormaClientGlobal } from \"../vorma_ctx/vorma_ctx.ts\";\n\nexport type VormaLinkPropsBase<LinkOnClickCallback> = {\n\thref?: string;\n\tprefetch?: \"intent\";\n\tprefetchDelayMs?: number;\n\tbeforeBegin?: LinkOnClickCallback;\n\tbeforeRender?: LinkOnClickCallback;\n\tafterRender?: LinkOnClickCallback;\n\tscrollToTop?: boolean;\n\treplace?: boolean;\n\tstate?: unknown;\n};\n\nfunction linkPropsToPrefetchObj<LinkOnClickCallback>(\n\tprops: VormaLinkPropsBase<LinkOnClickCallback>,\n) {\n\tif (!props.href || props.prefetch !== \"intent\") {\n\t\treturn undefined;\n\t}\n\n\treturn __getPrefetchHandlers({\n\t\thref: props.href,\n\t\tdelayMs: props.prefetchDelayMs,\n\t\tbeforeBegin: props.beforeBegin as any,\n\t\tbeforeRender: props.beforeRender as any,\n\t\tafterRender: props.afterRender as any,\n\t\tscrollToTop: props.scrollToTop,\n\t\treplace: props.replace,\n\t\tstate: props.state,\n\t});\n}\n\nfunction linkPropsToOnClickFn<LinkOnClickCallback>(\n\tprops: VormaLinkPropsBase<LinkOnClickCallback>,\n) {\n\treturn __makeLinkOnClickFn({\n\t\tbeforeBegin: props.beforeBegin as any,\n\t\tbeforeRender: props.beforeRender as any,\n\t\tafterRender: props.afterRender as any,\n\t\tscrollToTop: props.scrollToTop,\n\t\treplace: props.replace,\n\t\tstate: props.state,\n\t});\n}\n\ntype handlerKeys = {\n\tonPointerEnter: string;\n\tonFocus: string;\n\tonPointerLeave: string;\n\tonBlur: string;\n\tonTouchCancel: string;\n\tonClick: string;\n};\n\nconst standardCamelHandlerKeys = {\n\tonPointerEnter: \"onPointerEnter\",\n\tonFocus: \"onFocus\",\n\tonPointerLeave: \"onPointerLeave\",\n\tonBlur: \"onBlur\",\n\tonTouchCancel: \"onTouchCancel\",\n\tonClick: \"onClick\",\n} satisfies handlerKeys;\n\nexport function __makeFinalLinkProps<LinkOnClickCallback>(\n\tprops: VormaLinkPropsBase<LinkOnClickCallback>,\n\tkeys: {\n\t\tonPointerEnter: string;\n\t\tonFocus: string;\n\t\tonPointerLeave: string;\n\t\tonBlur: string;\n\t\tonTouchCancel: string;\n\t\tonClick: string;\n\t} = standardCamelHandlerKeys,\n) {\n\tconst prefetchObj = linkPropsToPrefetchObj(props);\n\n\treturn {\n\t\tdataExternal: prefetchObj?.isExternal || undefined,\n\t\tonPointerEnter: (e: any) => {\n\t\t\tprefetchObj?.start(e);\n\t\t\tif (isFn((props as any)[keys.onPointerEnter])) {\n\t\t\t\t(props as any)[keys.onPointerEnter](e);\n\t\t\t}\n\t\t},\n\t\tonFocus: (e: any) => {\n\t\t\tprefetchObj?.start(e);\n\t\t\tif (isFn((props as any)[keys.onFocus])) {\n\t\t\t\t(props as any)[keys.onFocus](e);\n\t\t\t}\n\t\t},\n\t\tonPointerLeave: (e: any) => {\n\t\t\t// we don't want to stop on a touch device, because this triggers\n\t\t\t// even when the user \"clicks\" on the link for some reason\n\t\t\tif (!__vormaClientGlobal.get(\"isTouchDevice\")) {\n\t\t\t\tprefetchObj?.stop();\n\t\t\t}\n\t\t\tif (isFn((props as any)[keys.onPointerLeave])) {\n\t\t\t\t(props as any)[keys.onPointerLeave](e);\n\t\t\t}\n\t\t},\n\t\tonBlur: (e: any) => {\n\t\t\tprefetchObj?.stop();\n\t\t\tif (isFn((props as any)[keys.onBlur])) {\n\t\t\t\t(props as any)[keys.onBlur](e);\n\t\t\t}\n\t\t},\n\t\tonTouchCancel: (e: any) => {\n\t\t\tprefetchObj?.stop();\n\t\t\tif (isFn((props as any)[keys.onTouchCancel])) {\n\t\t\t\t(props as any)[keys.onTouchCancel](e);\n\t\t\t}\n\t\t},\n\t\tonClick: async (e: any) => {\n\t\t\tif (isFn((props as any)[keys.onClick])) {\n\t\t\t\t(props as any)[keys.onClick](e);\n\t\t\t}\n\t\t\tif (prefetchObj) {\n\t\t\t\tawait prefetchObj.onClick(e);\n\t\t\t} else {\n\t\t\t\tawait linkPropsToOnClickFn(props)(e);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction isFn(fn: any): fn is (...args: Array<any>) => any {\n\treturn typeof fn === \"function\";\n}\n", "import { vormaNavigate } from \"../client.ts\";\nimport {\n\t__resolvePath,\n\ttype ExtractApp,\n\ttype PermissivePatternBasedProps,\n\ttype VormaAppBase,\n\ttype VormaAppConfig,\n\ttype VormaLoaderPattern,\n} from \"../vorma_app_helpers/vorma_app_helpers.ts\";\nimport { __vormaClientGlobal } from \"../vorma_ctx/vorma_ctx.ts\";\n\ntype TypedNavigateOptions<\n\tApp extends VormaAppBase,\n\tPattern extends VormaLoaderPattern<App>,\n> = PermissivePatternBasedProps<App, Pattern> & {\n\treplace?: boolean;\n\tscrollToTop?: boolean;\n\tsearch?: string;\n\thash?: string;\n\tstate?: unknown;\n};\n\nexport function makeTypedNavigate<C extends VormaAppConfig>(vormaAppConfig: C) {\n\ttype App = ExtractApp<C>;\n\n\treturn async function typedNavigate<\n\t\tPattern extends VormaLoaderPattern<App>,\n\t>(options: TypedNavigateOptions<App, Pattern>): Promise<void> {\n\t\tconst {\n\t\t\tpattern,\n\t\t\tparams,\n\t\t\tsplatValues,\n\t\t\treplace,\n\t\t\tscrollToTop,\n\t\t\tsearch,\n\t\t\thash,\n\t\t\tstate,\n\t\t} = options as any;\n\n\t\tconst href = __resolvePath({\n\t\t\tvormaAppConfig,\n\t\t\ttype: \"loader\",\n\t\t\tprops: {\n\t\t\t\tpattern,\n\t\t\t\t...(params && { params }),\n\t\t\t\t...(splatValues && { splatValues }),\n\t\t\t},\n\t\t});\n\n\t\treturn vormaNavigate(href, {\n\t\t\treplace,\n\t\t\tscrollToTop,\n\t\t\tsearch,\n\t\t\thash,\n\t\t\tstate,\n\t\t});\n\t};\n}\n", "import { addOnWindowFocusListener } from \"vorma/kit/listeners\";\nimport {\n\tgetLastTriggeredNavOrRevalidateTimestampMS,\n\tgetStatus,\n\trevalidate,\n} from \"../client.ts\";\n\n/**\n * If called, will setup listeners to revalidate the current route when\n * the window regains focus and at least `staleTimeMS` has passed since\n * the last revalidation. The `staleTimeMS` option defaults to 5,000\n * (5 seconds). Returns a cleanup function.\n */\nexport function revalidateOnWindowFocus(options?: { staleTimeMS?: number }) {\n\tconst staleTimeMS = options?.staleTimeMS ?? 5_000;\n\treturn addOnWindowFocusListener(() => {\n\t\tconst status = getStatus();\n\t\tif (\n\t\t\t!status.isNavigating &&\n\t\t\t!status.isSubmitting &&\n\t\t\t!status.isRevalidating\n\t\t) {\n\t\t\tif (\n\t\t\t\tDate.now() - getLastTriggeredNavOrRevalidateTimestampMS() <\n\t\t\t\tstaleTimeMS\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trevalidate();\n\t\t}\n\t});\n}\n"],
5
- "mappings": ";AAEA,SAAS,gBAAgB;AACzB,SAAS,kBAAAA,uBAAsB;AAC/B,SAAS,qBAAAC,0BAAqC;AAC9C,SAAS,mBAAAC,wBAAuB;;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AAW;AAAA,IACZ;AAAA,EACD,CAAC;AACF;",
6
- "names": ["jsonDeepEquals", "findNestedMatches", "getIsGETRequest", "i", "Action", "window", "location", "index", "action", "history", "location", "location", "newURL", "hrefDetails", "history", "findNestedMatches", "jsonDeepEquals", "json", "response", "patternToWaitFnMap", "runningLoaders", "waitFnPromise", "buildID", "getIsGETRequest", "debounce", "debounce", "registerPattern", "registerPattern", "getHrefDetails", "getHrefDetails", "targetUrl"]
4
+ "sourcesContent": ["/// <reference types=\"vite/client\" />\n\nimport { debounce } from \"vorma/kit/debounce\";\nimport { jsonDeepEquals } from \"vorma/kit/json\";\nimport { findNestedMatches, type Match } from \"vorma/kit/matcher/find-nested\";\nimport { getIsGETRequest } from \"vorma/kit/url\";\nimport { AssetManager } from \"./asset_manager.ts\";\nimport {\n\tcompleteClientLoaders,\n\tfindPartialMatchesOnClient,\n\tsetClientLoadersState,\n\ttype ClientLoadersResult,\n} from \"./client_loaders.ts\";\nimport {\n\tdispatchBuildIDEvent,\n\tdispatchStatusEvent,\n\ttype StatusEventDetail,\n} from \"./events.ts\";\nimport { HistoryManager } from \"./history/history.ts\";\nimport type { historyInstance } from \"./history/npm_history_types.ts\";\nimport {\n\teffectuateRedirectDataResult,\n\tgetBuildIDFromResponse,\n\thandleRedirects,\n\ttype RedirectData,\n} from \"./redirects/redirects.ts\";\nimport { __reRenderApp } from \"./rendering.ts\";\nimport {\n\t__applyScrollState,\n\ttype ScrollState,\n} from \"./scroll_state_manager.ts\";\nimport { isAbortError } from \"./utils/errors.ts\";\nimport { logError } from \"./utils/logging.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype ClientLoaderAwaitedServerData,\n\ttype GetRouteDataOutput,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\n/////////////////////////////////////////////////////////////////////\n// TYPES\n/////////////////////////////////////////////////////////////////////\n\nexport type VormaNavigationType =\n\t| \"browserHistory\"\n\t| \"userNavigation\"\n\t| \"revalidation\"\n\t| \"redirect\"\n\t| \"prefetch\"\n\t| \"action\";\n\nexport type NavigateProps = {\n\thref: string;\n\tstate?: unknown;\n\tnavigationType: VormaNavigationType;\n\tscrollStateToRestore?: ScrollState;\n\treplace?: boolean;\n\tredirectCount?: number;\n\tscrollToTop?: boolean;\n};\n\n// Discriminated union for navigation outcomes -- provides exhaustiveness checking\nexport type NavigationOutcome =\n\t| { type: \"aborted\" }\n\t| { type: \"redirect\"; redirectData: RedirectData; props: NavigateProps }\n\t| {\n\t\t\ttype: \"success\";\n\t\t\tresponse: Response;\n\t\t\tjson: GetRouteDataOutput;\n\t\t\tcssBundlePromises: Array<Promise<any>>;\n\t\t\twaitFnPromise: Promise<ClientLoadersResult> | undefined;\n\t\t\tprops: NavigateProps;\n\t };\n\nexport type NavigationControl = {\n\tabortController: AbortController | undefined;\n\tpromise: Promise<NavigationOutcome>;\n};\n\n/////////////////////////////////////////////////////////////////////\n// NAVIGATION STATE MANAGER\n/////////////////////////////////////////////////////////////////////\n\n// Navigation phases represent the lifecycle stages\ntype NavigationPhase =\n\t| \"fetching\" // Fetching route data\n\t| \"waiting\" // Waiting for assets/loaders\n\t| \"rendering\" // Applying changes to DOM\n\t| \"complete\"; // Navigation finished\n\n// Navigation intent represents what should happen when complete\ntype NavigationIntent =\n\t| \"none\" // Prefetch -- don't navigate unless upgraded\n\t| \"navigate\" // Normal navigation -- update URL and render\n\t| \"revalidate\"; // Revalidation -- only update if still on same page\n\ninterface NavigationEntry {\n\tcontrol: NavigationControl;\n\ttype: VormaNavigationType;\n\tintent: NavigationIntent;\n\tphase: NavigationPhase;\n\tstartTime: number;\n\ttargetUrl: string; // URL this navigation is targeting\n\toriginUrl: string; // URL when navigation started (for revalidation)\n\tscrollToTop?: boolean;\n\treplace?: boolean;\n\tstate?: unknown;\n}\n\ninterface SubmissionEntry {\n\tcontrol: {\n\t\tabortController: AbortController | undefined;\n\t\tpromise: Promise<any>;\n\t};\n\tstartTime: number;\n\tskipGlobalLoadingIndicator?: boolean;\n}\n\n/////////////////////////////////////////////////////////////////////\n// canSkipServerFetch HELPERS - extracted for readability\n/////////////////////////////////////////////////////////////////////\n\ntype SkipCheckContext = {\n\trouteManifest: Record<string, number>;\n\tpatternRegistry: any;\n\tpatternToWaitFnMap: Record<string, any>;\n\tclientModuleMap: Record<\n\t\tstring,\n\t\t{ importURL: string; exportKey: string; errorExportKey: string }\n\t>;\n\tcurrentMatchedPatterns: string[];\n\tcurrentParams: Record<string, string>;\n\tcurrentSplatValues: string[];\n\tcurrentLoadersData: any[];\n\turl: URL;\n\tmatchResult: any;\n};\n\ntype SkipCheckResult =\n\t| { canSkip: false }\n\t| {\n\t\t\tcanSkip: true;\n\t\t\tmatchResult: any;\n\t\t\timportURLs: string[];\n\t\t\texportKeys: string[];\n\t\t\tloadersData: any[];\n\t };\n\nfunction hasServerLoaderRemoval(ctx: SkipCheckContext): boolean {\n\tfor (const pattern of ctx.currentMatchedPatterns) {\n\t\tconst hasServerLoader = ctx.routeManifest[pattern] === 1;\n\t\tif (hasServerLoader) {\n\t\t\tconst stillMatched = ctx.matchResult.matches.some(\n\t\t\t\t(m: Match) => m.registeredPattern.originalPattern === pattern,\n\t\t\t);\n\t\t\tif (!stillMatched) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction hasNewClientLoader(ctx: SkipCheckContext): boolean {\n\tfor (const m of ctx.matchResult.matches) {\n\t\tconst pattern = m.registeredPattern.originalPattern;\n\t\tconst hasClientLoader = !!ctx.patternToWaitFnMap[pattern];\n\t\tconst wasAlreadyMatched = ctx.currentMatchedPatterns.includes(pattern);\n\t\tif (hasClientLoader && !wasAlreadyMatched) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction findOutermostLoaderIndex(ctx: SkipCheckContext): number {\n\tfor (let i = ctx.matchResult.matches.length - 1; i >= 0; i--) {\n\t\tconst match: Match | undefined = ctx.matchResult.matches[i];\n\t\tif (!match) continue;\n\n\t\tconst pattern = match.registeredPattern.originalPattern;\n\t\tconst hasServerLoader = ctx.routeManifest[pattern] === 1;\n\t\tconst hasClientLoader = !!ctx.patternToWaitFnMap[pattern];\n\n\t\tif (hasServerLoader || hasClientLoader) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\nfunction didSearchParamsChange(ctx: SkipCheckContext): boolean {\n\tconst currentUrlObj = new URL(window.location.href);\n\tconst currentParamsSorted = Array.from(\n\t\tcurrentUrlObj.searchParams.entries(),\n\t).sort();\n\tconst targetParamsSorted = Array.from(\n\t\tctx.url.searchParams.entries(),\n\t).sort();\n\treturn !jsonDeepEquals(currentParamsSorted, targetParamsSorted);\n}\n\nfunction didOutermostParamsChange(\n\tctx: SkipCheckContext,\n\toutermostLoaderIndex: number,\n): boolean {\n\tconst outermostMatch = ctx.matchResult.matches[outermostLoaderIndex];\n\tif (!outermostMatch) return false;\n\n\tfor (const seg of outermostMatch.registeredPattern.normalizedSegments) {\n\t\tif (seg.segType === \"dynamic\") {\n\t\t\tconst paramName = seg.normalizedVal.substring(1);\n\t\t\tif (\n\t\t\t\tctx.matchResult.params[paramName] !==\n\t\t\t\tctx.currentParams[paramName]\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst hasSplat = outermostMatch.registeredPattern.lastSegType === \"splat\";\n\tif (hasSplat) {\n\t\tif (\n\t\t\t!jsonDeepEquals(ctx.matchResult.splatValues, ctx.currentSplatValues)\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction buildSkipResult(ctx: SkipCheckContext): SkipCheckResult {\n\tconst importURLs: string[] = [];\n\tconst exportKeys: string[] = [];\n\tconst loadersData: any[] = [];\n\n\tfor (let i = 0; i < ctx.matchResult.matches.length; i++) {\n\t\tconst match: Match | undefined = ctx.matchResult.matches[i];\n\t\tif (!match) continue;\n\n\t\tconst pattern = match.registeredPattern.originalPattern;\n\t\tconst moduleInfo = ctx.clientModuleMap[pattern];\n\t\tif (!moduleInfo) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\timportURLs.push(moduleInfo.importURL);\n\t\texportKeys.push(moduleInfo.exportKey);\n\n\t\tconst hasServerLoader = ctx.routeManifest[pattern] === 1;\n\t\tif (!hasServerLoader) {\n\t\t\tloadersData.push(undefined);\n\t\t} else {\n\t\t\tconst currentPatternIndex =\n\t\t\t\tctx.currentMatchedPatterns.indexOf(pattern);\n\t\t\tif (currentPatternIndex === -1) {\n\t\t\t\treturn { canSkip: false };\n\t\t\t}\n\t\t\tloadersData.push(ctx.currentLoadersData[currentPatternIndex]);\n\t\t}\n\t}\n\n\treturn {\n\t\tcanSkip: true,\n\t\tmatchResult: ctx.matchResult,\n\t\timportURLs,\n\t\texportKeys,\n\t\tloadersData,\n\t};\n}\n\n/////////////////////////////////////////////////////////////////////\n// NAVIGATION STATE MANAGER CLASS\n/////////////////////////////////////////////////////////////////////\n\nclass NavigationStateManager {\n\t// Single slot for active user/browser/redirect navigation\n\tprivate _activeNavigation: NavigationEntry | null = null;\n\t// Separate cache for prefetches (can have multiple to different URLs)\n\tprivate _prefetchCache = new Map<string, NavigationEntry>();\n\t// Single slot for pending revalidation (at most one, coalesced)\n\tprivate _pendingRevalidation: NavigationEntry | null = null;\n\t// Submissions tracked separately\n\tprivate _submissions = new Map<string | symbol, SubmissionEntry>();\n\n\tprivate lastDispatchedStatus: StatusEventDetail | null = null;\n\tprivate dispatchStatusEventDebounced: () => void;\n\tprivate readonly REVALIDATION_COALESCE_MS = 8;\n\n\tconstructor() {\n\t\tthis.dispatchStatusEventDebounced = debounce(() => {\n\t\t\tthis.dispatchStatusEvent();\n\t\t}, 8);\n\t}\n\n\tasync navigate(props: NavigateProps): Promise<{ didNavigate: boolean }> {\n\t\tconst control = this.beginNavigation(props);\n\n\t\ttry {\n\t\t\tconst outcome = await control.promise;\n\n\t\t\t// Handle based on outcome type (discriminated union)\n\t\t\tswitch (outcome.type) {\n\t\t\t\tcase \"aborted\":\n\t\t\t\t\treturn { didNavigate: false };\n\n\t\t\t\tcase \"redirect\": {\n\t\t\t\t\tconst targetUrl = new URL(props.href, window.location.href)\n\t\t\t\t\t\t.href;\n\t\t\t\t\tconst entry = this.findNavigationEntry(targetUrl);\n\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\treturn { didNavigate: false };\n\t\t\t\t\t}\n\n\t\t\t\t\t// Skip redirect effectuation for pure prefetches\n\t\t\t\t\tif (entry.type === \"prefetch\" && entry.intent === \"none\") {\n\t\t\t\t\t\tthis.deleteNavigation(targetUrl);\n\t\t\t\t\t\treturn { didNavigate: false };\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.deleteNavigation(targetUrl);\n\t\t\t\t\tawait effectuateRedirectDataResult(\n\t\t\t\t\t\toutcome.redirectData,\n\t\t\t\t\t\tprops.redirectCount || 0,\n\t\t\t\t\t\tprops,\n\t\t\t\t\t);\n\t\t\t\t\treturn { didNavigate: false };\n\t\t\t\t}\n\n\t\t\t\tcase \"success\": {\n\t\t\t\t\tconst targetUrl = new URL(props.href, window.location.href)\n\t\t\t\t\t\t.href;\n\t\t\t\t\tconst entry = this.findNavigationEntry(targetUrl);\n\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\treturn { didNavigate: false };\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tentry.intent === \"navigate\" ||\n\t\t\t\t\t\tentry.intent === \"revalidate\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastTriggeredNavOrRevalidateTimestampMS = Date.now();\n\t\t\t\t\t}\n\n\t\t\t\t\tawait this.processSuccessfulNavigation(outcome, entry);\n\n\t\t\t\t\tif (entry.intent === \"none\" && entry.type === \"prefetch\") {\n\t\t\t\t\t\treturn { didNavigate: false };\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { didNavigate: true };\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\t// Exhaustiveness check - TypeScript will error if a case is missing\n\t\t\t\t\tconst _exhaustive: never = outcome;\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Unexpected navigation outcome type: ${(_exhaustive as any).type}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\t\t\tthis.deleteNavigation(targetUrl);\n\t\t\tif (!isAbortError(error)) {\n\t\t\t\tlogError(\"Navigate error:\", error);\n\t\t\t}\n\t\t\treturn { didNavigate: false };\n\t\t}\n\t}\n\n\tbeginNavigation(props: NavigateProps): NavigationControl {\n\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\n\t\tswitch (props.navigationType) {\n\t\t\tcase \"userNavigation\":\n\t\t\t\treturn this.beginUserNavigation(props, targetUrl);\n\t\t\tcase \"prefetch\":\n\t\t\t\treturn this.beginPrefetch(props, targetUrl);\n\t\t\tcase \"revalidation\":\n\t\t\t\treturn this.beginRevalidation(props);\n\t\t\tcase \"browserHistory\":\n\t\t\tcase \"redirect\":\n\t\t\tdefault:\n\t\t\t\treturn this.createActiveNavigation(props, \"navigate\");\n\t\t}\n\t}\n\n\tprivate beginUserNavigation(\n\t\tprops: NavigateProps,\n\t\ttargetUrl: string,\n\t): NavigationControl {\n\t\t// Abort active navigation if it's to a different URL\n\t\tif (\n\t\t\tthis._activeNavigation &&\n\t\t\tthis._activeNavigation.targetUrl !== targetUrl\n\t\t) {\n\t\t\tthis._activeNavigation.control.abortController?.abort();\n\t\t\tthis._activeNavigation = null;\n\t\t}\n\n\t\t// Abort all prefetches except the one we might upgrade\n\t\tfor (const [url, prefetch] of this._prefetchCache.entries()) {\n\t\t\tif (url !== targetUrl) {\n\t\t\t\tprefetch.control.abortController?.abort();\n\t\t\t\tthis._prefetchCache.delete(url);\n\t\t\t}\n\t\t}\n\n\t\t// Abort pending revalidation only if it's to a different URL\n\t\tif (\n\t\t\tthis._pendingRevalidation &&\n\t\t\tthis._pendingRevalidation.targetUrl !== targetUrl\n\t\t) {\n\t\t\tthis._pendingRevalidation.control.abortController?.abort();\n\t\t\tthis._pendingRevalidation = null;\n\t\t}\n\n\t\t// Check if there's already an active navigation to this URL\n\t\tif (this._activeNavigation?.targetUrl === targetUrl) {\n\t\t\treturn this._activeNavigation.control;\n\t\t}\n\n\t\t// Check if there's a prefetch to upgrade\n\t\tconst existingPrefetch = this._prefetchCache.get(targetUrl);\n\t\tif (existingPrefetch) {\n\t\t\t// Upgrade prefetch: move from cache to active slot, change intent\n\t\t\tthis._prefetchCache.delete(targetUrl);\n\t\t\texistingPrefetch.type = \"userNavigation\";\n\t\t\texistingPrefetch.intent = \"navigate\";\n\t\t\texistingPrefetch.scrollToTop = props.scrollToTop;\n\t\t\texistingPrefetch.replace = props.replace;\n\t\t\texistingPrefetch.state = props.state;\n\t\t\tthis._activeNavigation = existingPrefetch;\n\t\t\tthis.scheduleStatusUpdate();\n\t\t\treturn existingPrefetch.control;\n\t\t}\n\n\t\t// Check if there's a pending revalidation to the same URL - upgrade it\n\t\tif (this._pendingRevalidation?.targetUrl === targetUrl) {\n\t\t\t// Upgrade revalidation: change intent so user gets proper link semantics\n\t\t\tthis._pendingRevalidation.type = \"userNavigation\";\n\t\t\tthis._pendingRevalidation.intent = \"navigate\";\n\t\t\tthis._pendingRevalidation.scrollToTop = props.scrollToTop;\n\t\t\tthis._pendingRevalidation.replace = props.replace;\n\t\t\tthis._pendingRevalidation.state = props.state;\n\t\t\treturn this._pendingRevalidation.control;\n\t\t}\n\n\t\treturn this.createActiveNavigation(props, \"navigate\");\n\t}\n\n\tprivate beginPrefetch(\n\t\tprops: NavigateProps,\n\t\ttargetUrl: string,\n\t): NavigationControl {\n\t\t// If there's already an active navigation to this URL, return its control\n\t\tif (this._activeNavigation?.targetUrl === targetUrl) {\n\t\t\treturn this._activeNavigation.control;\n\t\t}\n\n\t\t// If there's already a prefetch to this URL, return its control\n\t\tconst existingPrefetch = this._prefetchCache.get(targetUrl);\n\t\tif (existingPrefetch) {\n\t\t\treturn existingPrefetch.control;\n\t\t}\n\n\t\t// If there's a pending revalidation to this URL, return its control\n\t\tif (this._pendingRevalidation?.targetUrl === targetUrl) {\n\t\t\treturn this._pendingRevalidation.control;\n\t\t}\n\n\t\t// Don't prefetch current page\n\t\tconst currentUrl = new URL(window.location.href);\n\t\tconst targetUrlObj = new URL(targetUrl);\n\t\tcurrentUrl.hash = \"\";\n\t\ttargetUrlObj.hash = \"\";\n\t\tif (currentUrl.href === targetUrlObj.href) {\n\t\t\treturn {\n\t\t\t\tabortController: new AbortController(),\n\t\t\t\tpromise: Promise.resolve({ type: \"aborted\" as const }),\n\t\t\t};\n\t\t}\n\n\t\treturn this.createPrefetch(props, targetUrl);\n\t}\n\n\tprivate beginRevalidation(props: NavigateProps): NavigationControl {\n\t\tconst currentUrl = window.location.href;\n\n\t\t// Coalesce recent revalidations\n\t\tif (\n\t\t\tthis._pendingRevalidation &&\n\t\t\tDate.now() - this._pendingRevalidation.startTime <\n\t\t\t\tthis.REVALIDATION_COALESCE_MS\n\t\t) {\n\t\t\treturn this._pendingRevalidation.control;\n\t\t}\n\n\t\t// Abort existing revalidation\n\t\tif (this._pendingRevalidation) {\n\t\t\tthis._pendingRevalidation.control.abortController?.abort();\n\t\t\tthis._pendingRevalidation = null;\n\t\t}\n\n\t\treturn this.createRevalidation({ ...props, href: currentUrl });\n\t}\n\n\tprivate createActiveNavigation(\n\t\tprops: NavigateProps,\n\t\tintent: NavigationIntent,\n\t): NavigationControl {\n\t\tconst controller = new AbortController();\n\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\n\t\tconst entry: NavigationEntry = {\n\t\t\tcontrol: {\n\t\t\t\tabortController: controller,\n\t\t\t\tpromise: this.fetchRouteData(controller, props).catch(\n\t\t\t\t\t(error) => {\n\t\t\t\t\t\tthis.deleteNavigation(targetUrl);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t},\n\t\t\ttype: props.navigationType,\n\t\t\tintent,\n\t\t\tphase: \"fetching\",\n\t\t\tstartTime: Date.now(),\n\t\t\ttargetUrl,\n\t\t\toriginUrl: window.location.href,\n\t\t\tscrollToTop: props.scrollToTop,\n\t\t\treplace: props.replace,\n\t\t\tstate: props.state,\n\t\t};\n\n\t\tthis._activeNavigation = entry;\n\t\tthis.scheduleStatusUpdate();\n\t\treturn entry.control;\n\t}\n\n\tprivate createPrefetch(\n\t\tprops: NavigateProps,\n\t\ttargetUrl: string,\n\t): NavigationControl {\n\t\tconst controller = new AbortController();\n\n\t\tconst entry: NavigationEntry = {\n\t\t\tcontrol: {\n\t\t\t\tabortController: controller,\n\t\t\t\tpromise: this.fetchRouteData(controller, props).catch(\n\t\t\t\t\t(error) => {\n\t\t\t\t\t\tthis._prefetchCache.delete(targetUrl);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t},\n\t\t\ttype: \"prefetch\",\n\t\t\tintent: \"none\",\n\t\t\tphase: \"fetching\",\n\t\t\tstartTime: Date.now(),\n\t\t\ttargetUrl,\n\t\t\toriginUrl: window.location.href,\n\t\t\tscrollToTop: props.scrollToTop,\n\t\t\treplace: props.replace,\n\t\t\tstate: props.state,\n\t\t};\n\n\t\tthis._prefetchCache.set(targetUrl, entry);\n\t\t// No status update needed - prefetches don't affect status\n\t\treturn entry.control;\n\t}\n\n\tprivate createRevalidation(props: NavigateProps): NavigationControl {\n\t\tconst controller = new AbortController();\n\t\tconst targetUrl = new URL(props.href, window.location.href).href;\n\n\t\tconst entry: NavigationEntry = {\n\t\t\tcontrol: {\n\t\t\t\tabortController: controller,\n\t\t\t\tpromise: this.fetchRouteData(controller, props).catch(\n\t\t\t\t\t(error) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis._pendingRevalidation?.targetUrl === targetUrl\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis._pendingRevalidation = null;\n\t\t\t\t\t\t\tthis.scheduleStatusUpdate();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t},\n\t\t\ttype: \"revalidation\",\n\t\t\tintent: \"revalidate\",\n\t\t\tphase: \"fetching\",\n\t\t\tstartTime: Date.now(),\n\t\t\ttargetUrl,\n\t\t\toriginUrl: window.location.href,\n\t\t\tscrollToTop: props.scrollToTop,\n\t\t\treplace: props.replace,\n\t\t\tstate: props.state,\n\t\t};\n\n\t\tthis._pendingRevalidation = entry;\n\t\tthis.scheduleStatusUpdate();\n\t\treturn entry.control;\n\t}\n\n\tprivate transitionPhase(targetUrl: string, phase: NavigationPhase): void {\n\t\tif (this._activeNavigation?.targetUrl === targetUrl) {\n\t\t\tthis._activeNavigation.phase = phase;\n\t\t\tthis.scheduleStatusUpdate();\n\t\t\treturn;\n\t\t}\n\n\t\tconst prefetch = this._prefetchCache.get(targetUrl);\n\t\tif (prefetch) {\n\t\t\tprefetch.phase = phase;\n\t\t\t// No status update for prefetches\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._pendingRevalidation?.targetUrl === targetUrl) {\n\t\t\tthis._pendingRevalidation.phase = phase;\n\t\t\tthis.scheduleStatusUpdate();\n\t\t}\n\t}\n\n\tprivate canSkipServerFetch(targetUrl: string): SkipCheckResult {\n\t\t// Early return: no route manifest\n\t\tconst routeManifest = __vormaClientGlobal.get(\"routeManifest\");\n\t\tif (!routeManifest) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\t// Early return: no pattern registry\n\t\tconst patternRegistry = __vormaClientGlobal.get(\"patternRegistry\");\n\t\tif (!patternRegistry) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\t// Early return: no match\n\t\tconst url = new URL(targetUrl);\n\t\tconst matchResult = findNestedMatches(patternRegistry, url.pathname);\n\t\tif (!matchResult) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\t// Build context for helper functions\n\t\tconst ctx: SkipCheckContext = {\n\t\t\trouteManifest,\n\t\t\tpatternRegistry,\n\t\t\tpatternToWaitFnMap:\n\t\t\t\t__vormaClientGlobal.get(\"patternToWaitFnMap\") || {},\n\t\t\tclientModuleMap: __vormaClientGlobal.get(\"clientModuleMap\") || {},\n\t\t\tcurrentMatchedPatterns:\n\t\t\t\t__vormaClientGlobal.get(\"matchedPatterns\") || [],\n\t\t\tcurrentParams: __vormaClientGlobal.get(\"params\") || {},\n\t\t\tcurrentSplatValues: __vormaClientGlobal.get(\"splatValues\") || [],\n\t\t\tcurrentLoadersData: __vormaClientGlobal.get(\"loadersData\") || [],\n\t\t\turl,\n\t\t\tmatchResult,\n\t\t};\n\n\t\t// Early return: server loader being removed\n\t\tif (hasServerLoaderRemoval(ctx)) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\t// Early return: new client loader introduced\n\t\tif (hasNewClientLoader(ctx)) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\t// Find outermost loader index for param/search change checks\n\t\tconst outermostLoaderIndex = findOutermostLoaderIndex(ctx);\n\n\t\t// Early return: search params changed with loaders present\n\t\tif (outermostLoaderIndex !== -1 && didSearchParamsChange(ctx)) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\t// Early return: outermost loader params changed\n\t\tif (\n\t\t\toutermostLoaderIndex !== -1 &&\n\t\t\tdidOutermostParamsChange(ctx, outermostLoaderIndex)\n\t\t) {\n\t\t\treturn { canSkip: false };\n\t\t}\n\n\t\t// Build and return skip result\n\t\treturn buildSkipResult(ctx);\n\t}\n\n\tprivate async fetchRouteData(\n\t\tcontroller: AbortController,\n\t\tprops: NavigateProps,\n\t): Promise<NavigationOutcome> {\n\t\ttry {\n\t\t\tconst url = new URL(props.href, window.location.href);\n\n\t\t\t// Check if we can skip the server fetch (not for revalidations)\n\t\t\tif (\n\t\t\t\tprops.navigationType !== \"revalidation\" &&\n\t\t\t\tprops.navigationType !== \"action\"\n\t\t\t) {\n\t\t\t\tconst skipCheck = this.canSkipServerFetch(url.href);\n\n\t\t\t\tif (skipCheck.canSkip) {\n\t\t\t\t\treturn this.buildClientOnlyOutcome(\n\t\t\t\t\t\tskipCheck,\n\t\t\t\t\t\tprops,\n\t\t\t\t\t\tcontroller,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\turl.searchParams.set(\n\t\t\t\t\"vorma_json\",\n\t\t\t\t__vormaClientGlobal.get(\"buildID\") || \"1\",\n\t\t\t);\n\n\t\t\tif (props.navigationType === \"revalidation\") {\n\t\t\t\tconst deploymentID = __vormaClientGlobal.get(\"deploymentID\");\n\t\t\t\tif (deploymentID) {\n\t\t\t\t\turl.searchParams.set(\"dpl\", deploymentID);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Start server fetch and immediately process the response to JSON\n\t\t\tconst serverPromise = handleRedirects({\n\t\t\t\tabortController: controller,\n\t\t\t\turl,\n\t\t\t\tisPrefetch: props.navigationType === \"prefetch\",\n\t\t\t\tredirectCount: props.redirectCount,\n\t\t\t}).then(async (result) => {\n\t\t\t\tif (\n\t\t\t\t\tresult.response &&\n\t\t\t\t\tresult.response.ok &&\n\t\t\t\t\t!result.redirectData?.status\n\t\t\t\t) {\n\t\t\t\t\tconst json = await result.response.json();\n\t\t\t\t\treturn { ...result, json };\n\t\t\t\t}\n\t\t\t\treturn { ...result, json: undefined };\n\t\t\t});\n\n\t\t\t// Try to match routes on the client and start parallel loaders\n\t\t\tconst pathname = url.pathname;\n\t\t\tconst matchResult = await findPartialMatchesOnClient(pathname);\n\t\t\tconst patternToWaitFnMap =\n\t\t\t\t__vormaClientGlobal.get(\"patternToWaitFnMap\");\n\t\t\tconst runningLoaders = new Map<string, Promise<any>>();\n\n\t\t\t// Start client loaders for already-registered patterns\n\t\t\tif (matchResult) {\n\t\t\t\tconst { params, splatValues, matches } = matchResult;\n\n\t\t\t\tfor (let i = 0; i < matches.length; i++) {\n\t\t\t\t\tconst match = matches[i];\n\t\t\t\t\tif (!match) continue;\n\n\t\t\t\t\tconst pattern = match.registeredPattern.originalPattern;\n\t\t\t\t\tconst loaderFn = patternToWaitFnMap[pattern];\n\n\t\t\t\t\tif (loaderFn) {\n\t\t\t\t\t\tconst serverDataPromise = serverPromise\n\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t({\n\t\t\t\t\t\t\t\t\tresponse,\n\t\t\t\t\t\t\t\t\tjson,\n\t\t\t\t\t\t\t\t}): ClientLoaderAwaitedServerData<any, any> => {\n\t\t\t\t\t\t\t\t\tif (!response || !response.ok || !json) {\n\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\tmatchedPatterns: [],\n\t\t\t\t\t\t\t\t\t\t\tloaderData: undefined,\n\t\t\t\t\t\t\t\t\t\t\trootData: null,\n\t\t\t\t\t\t\t\t\t\t\tbuildID: \"1\",\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst serverIdx =\n\t\t\t\t\t\t\t\t\t\tjson.matchedPatterns?.indexOf(pattern);\n\t\t\t\t\t\t\t\t\tconst loaderData =\n\t\t\t\t\t\t\t\t\t\tserverIdx !== -1 &&\n\t\t\t\t\t\t\t\t\t\tserverIdx !== undefined\n\t\t\t\t\t\t\t\t\t\t\t? json.loadersData[serverIdx]\n\t\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\t\tconst rootData = json.hasRootData\n\t\t\t\t\t\t\t\t\t\t? json.loadersData[0]\n\t\t\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t\t\t\tconst buildID =\n\t\t\t\t\t\t\t\t\t\tgetBuildIDFromResponse(response) || \"1\";\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tmatchedPatterns:\n\t\t\t\t\t\t\t\t\t\t\tjson.matchedPatterns || [],\n\t\t\t\t\t\t\t\t\t\tloaderData,\n\t\t\t\t\t\t\t\t\t\trootData,\n\t\t\t\t\t\t\t\t\t\tbuildID,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.catch(() => ({\n\t\t\t\t\t\t\t\tmatchedPatterns: [],\n\t\t\t\t\t\t\t\tloaderData: undefined,\n\t\t\t\t\t\t\t\trootData: null,\n\t\t\t\t\t\t\t\tbuildID: \"1\",\n\t\t\t\t\t\t\t}));\n\n\t\t\t\t\t\tconst loaderPromise = loaderFn({\n\t\t\t\t\t\t\tparams,\n\t\t\t\t\t\t\tsplatValues,\n\t\t\t\t\t\t\tserverDataPromise,\n\t\t\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\trunningLoaders.set(pattern, loaderPromise);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Wait for server response\n\t\t\tconst { redirectData, response, json } = await serverPromise;\n\n\t\t\tconst redirected = redirectData?.status === \"did\";\n\t\t\tconst responseNotOK = !response?.ok && response?.status !== 304;\n\n\t\t\tif (redirected || !response) {\n\t\t\t\tcontroller.abort();\n\t\t\t\treturn { type: \"aborted\" };\n\t\t\t}\n\n\t\t\tif (responseNotOK) {\n\t\t\t\tcontroller.abort();\n\t\t\t\tthrow new Error(`Fetch failed with status ${response.status}`);\n\t\t\t}\n\n\t\t\tif (redirectData?.status === \"should\") {\n\t\t\t\tcontroller.abort();\n\t\t\t\treturn { type: \"redirect\", redirectData, props };\n\t\t\t}\n\n\t\t\tif (!json) {\n\t\t\t\tcontroller.abort();\n\t\t\t\tthrow new Error(\"No JSON response\");\n\t\t\t}\n\n\t\t\t// deps are only present in prod because they stem from the rollup metafile\n\t\t\tconst depsToPreload = import.meta.env.DEV\n\t\t\t\t? [...new Set(json.importURLs)]\n\t\t\t\t: json.deps;\n\t\t\tfor (const dep of depsToPreload ?? []) {\n\t\t\t\tif (dep) AssetManager.preloadModule(dep);\n\t\t\t}\n\n\t\t\tconst buildID = getBuildIDFromResponse(response);\n\n\t\t\t// Complete client loader execution\n\t\t\tconst waitFnPromise = completeClientLoaders(\n\t\t\t\tjson,\n\t\t\t\tbuildID,\n\t\t\t\trunningLoaders,\n\t\t\t\tcontroller.signal,\n\t\t\t);\n\n\t\t\tconst cssBundlePromises: Array<Promise<any>> = [];\n\t\t\tfor (const bundle of json.cssBundles ?? []) {\n\t\t\t\tcssBundlePromises.push(AssetManager.preloadCSS(bundle));\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttype: \"success\",\n\t\t\t\tresponse,\n\t\t\t\tjson,\n\t\t\t\tprops,\n\t\t\t\tcssBundlePromises,\n\t\t\t\twaitFnPromise,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (!isAbortError(error)) {\n\t\t\t\tlogError(\"Navigation failed\", error);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate buildClientOnlyOutcome(\n\t\tskipCheck: Extract<SkipCheckResult, { canSkip: true }>,\n\t\tprops: NavigateProps,\n\t\tcontroller: AbortController,\n\t): NavigationOutcome {\n\t\tconst { matchResult, importURLs, exportKeys, loadersData } = skipCheck;\n\n\t\tconst json: GetRouteDataOutput = {\n\t\t\tmatchedPatterns: matchResult.matches.map(\n\t\t\t\t(m: Match) => m.registeredPattern.originalPattern,\n\t\t\t),\n\t\t\tloadersData: loadersData,\n\t\t\timportURLs: importURLs,\n\t\t\texportKeys: exportKeys,\n\t\t\thasRootData: __vormaClientGlobal.get(\"hasRootData\"),\n\t\t\tparams: matchResult.params,\n\t\t\tsplatValues: matchResult.splatValues,\n\t\t\tdeps: [],\n\t\t\tcssBundles: [],\n\t\t\toutermostServerError: undefined,\n\t\t\toutermostServerErrorIdx: undefined,\n\t\t\terrorExportKeys: [],\n\t\t\ttitle: undefined,\n\t\t\tmetaHeadEls: undefined,\n\t\t\trestHeadEls: undefined,\n\t\t\tactiveComponents: undefined as unknown as [],\n\t\t};\n\n\t\tconst response = new Response(JSON.stringify(json), {\n\t\t\tstatus: 200,\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\"X-Vorma-Build-Id\": __vormaClientGlobal.get(\"buildID\") || \"1\",\n\t\t\t},\n\t\t});\n\n\t\tconst currentClientLoadersData =\n\t\t\t__vormaClientGlobal.get(\"clientLoadersData\") || [];\n\t\tconst patternToWaitFnMap =\n\t\t\t__vormaClientGlobal.get(\"patternToWaitFnMap\") || {};\n\t\tconst runningLoaders = new Map<string, Promise<any>>();\n\n\t\tfor (let i = 0; i < json.matchedPatterns.length; i++) {\n\t\t\tconst pattern = json.matchedPatterns[i];\n\t\t\tif (!pattern) continue;\n\n\t\t\tif (patternToWaitFnMap[pattern]) {\n\t\t\t\tconst currentMatchedPatterns =\n\t\t\t\t\t__vormaClientGlobal.get(\"matchedPatterns\") || [];\n\t\t\t\tconst currentPatternIndex =\n\t\t\t\t\tcurrentMatchedPatterns.indexOf(pattern);\n\n\t\t\t\tif (\n\t\t\t\t\tcurrentPatternIndex !== -1 &&\n\t\t\t\t\tcurrentClientLoadersData[currentPatternIndex] !== undefined\n\t\t\t\t) {\n\t\t\t\t\trunningLoaders.set(\n\t\t\t\t\t\tpattern,\n\t\t\t\t\t\tPromise.resolve(\n\t\t\t\t\t\t\tcurrentClientLoadersData[currentPatternIndex],\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst waitFnPromise = completeClientLoaders(\n\t\t\tjson,\n\t\t\t__vormaClientGlobal.get(\"buildID\") || \"1\",\n\t\t\trunningLoaders,\n\t\t\tcontroller.signal,\n\t\t);\n\n\t\treturn {\n\t\t\ttype: \"success\",\n\t\t\tresponse,\n\t\t\tprops,\n\t\t\tjson,\n\t\t\tcssBundlePromises: [],\n\t\t\twaitFnPromise,\n\t\t};\n\t}\n\n\tasync processSuccessfulNavigation(\n\t\toutcome: Extract<NavigationOutcome, { type: \"success\" }>,\n\t\tentry: NavigationEntry,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tconst { response, json, props, cssBundlePromises, waitFnPromise } =\n\t\t\t\toutcome;\n\n\t\t\t// Only update module map and apply CSS if build IDs match\n\t\t\tconst currentBuildID = __vormaClientGlobal.get(\"buildID\");\n\t\t\tconst responseBuildID = getBuildIDFromResponse(response);\n\n\t\t\tif (responseBuildID === currentBuildID) {\n\t\t\t\t// Update module map only when builds match\n\t\t\t\tconst clientModuleMap =\n\t\t\t\t\t__vormaClientGlobal.get(\"clientModuleMap\") || {};\n\t\t\t\tconst matchedPatterns = json.matchedPatterns || [];\n\t\t\t\tconst importURLs = json.importURLs || [];\n\t\t\t\tconst exportKeys = json.exportKeys || [];\n\t\t\t\tconst errorExportKeys = json.errorExportKeys || [];\n\n\t\t\t\tfor (let i = 0; i < matchedPatterns.length; i++) {\n\t\t\t\t\tconst pattern = matchedPatterns[i];\n\t\t\t\t\tconst importURL = importURLs[i];\n\t\t\t\t\tconst exportKey = exportKeys[i];\n\t\t\t\t\tconst errorExportKey = errorExportKeys[i];\n\n\t\t\t\t\tif (pattern && importURL) {\n\t\t\t\t\t\tclientModuleMap[pattern] = {\n\t\t\t\t\t\t\timportURL,\n\t\t\t\t\t\t\texportKey: exportKey || \"default\",\n\t\t\t\t\t\t\terrorExportKey: errorExportKey || \"\",\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t__vormaClientGlobal.set(\"clientModuleMap\", clientModuleMap);\n\n\t\t\t\t// Apply CSS bundles immediately, even for prefetches\n\t\t\t\tif (json.cssBundles && json.cssBundles.length > 0) {\n\t\t\t\t\tAssetManager.applyCSS(json.cssBundles);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Validate revalidation is still applicable\n\t\t\tif (entry.type === \"revalidation\") {\n\t\t\t\tconst currentUrl = window.location.href;\n\t\t\t\tif (currentUrl !== entry.originUrl) {\n\t\t\t\t\tthis.deleteNavigation(entry.targetUrl);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Transition to waiting phase\n\t\t\tthis.transitionPhase(entry.targetUrl, \"waiting\");\n\n\t\t\t// Skip if navigation was aborted\n\t\t\tif (!this.findNavigationEntry(entry.targetUrl)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Update build ID if needed\n\t\t\tconst oldID = __vormaClientGlobal.get(\"buildID\");\n\t\t\tconst newID = getBuildIDFromResponse(response);\n\t\t\tif (newID && newID !== oldID) {\n\t\t\t\tdispatchBuildIDEvent({ newID, oldID });\n\t\t\t}\n\n\t\t\t// Wait for client loaders and set state\n\t\t\tconst clientLoadersResult = await waitFnPromise;\n\t\t\tsetClientLoadersState(clientLoadersResult);\n\n\t\t\t// Wait for CSS\n\t\t\tif (cssBundlePromises.length > 0) {\n\t\t\t\ttry {\n\t\t\t\t\tawait Promise.all(cssBundlePromises);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogError(\"Error preloading CSS bundles:\", error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Skip rendering for prefetch without intent\n\t\t\tif (entry.intent === \"none\") {\n\t\t\t\tthis.transitionPhase(entry.targetUrl, \"complete\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip rendering for revalidation if not on target page\n\t\t\tif (\n\t\t\t\tentry.type === \"revalidation\" &&\n\t\t\t\twindow.location.href !== entry.originUrl\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Transition to rendering phase\n\t\t\tthis.transitionPhase(entry.targetUrl, \"rendering\");\n\n\t\t\t// Render the app\n\t\t\ttry {\n\t\t\t\tawait __reRenderApp({\n\t\t\t\t\tjson,\n\t\t\t\t\tnavigationType: entry.type,\n\t\t\t\t\trunHistoryOptions:\n\t\t\t\t\t\tentry.intent === \"navigate\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\thref: entry.targetUrl,\n\t\t\t\t\t\t\t\t\tscrollStateToRestore:\n\t\t\t\t\t\t\t\t\t\tprops.scrollStateToRestore,\n\t\t\t\t\t\t\t\t\treplace: entry.replace || props.replace,\n\t\t\t\t\t\t\t\t\tscrollToTop: entry.scrollToTop,\n\t\t\t\t\t\t\t\t\tstate: entry.state,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tonFinish: () => {\n\t\t\t\t\t\tthis.transitionPhase(entry.targetUrl, \"complete\");\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthis.transitionPhase(entry.targetUrl, \"complete\");\n\t\t\t\tif (!isAbortError(error)) {\n\t\t\t\t\tlogError(\"Error completing navigation\", error);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t} finally {\n\t\t\tif (!(entry.type === \"prefetch\" && entry.intent === \"none\")) {\n\t\t\t\tthis.deleteNavigation(entry.targetUrl);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync submit<T = any>(\n\t\turl: string | URL,\n\t\trequestInit?: RequestInit,\n\t\toptions?: SubmitOptions,\n\t): Promise<{ success: true; data: T } | { success: false; error: string }> {\n\t\tconst abortController = new AbortController();\n\t\tconst submissionKey = options?.dedupeKey\n\t\t\t? `submission:${options.dedupeKey}`\n\t\t\t: Symbol(\"submission\");\n\n\t\t// Abort duplicate submission\n\t\tif (typeof submissionKey === \"string\") {\n\t\t\tconst existing = this._submissions.get(submissionKey);\n\t\t\tif (existing) {\n\t\t\t\texisting.control.abortController?.abort(\"deduped\");\n\t\t\t}\n\t\t}\n\n\t\tconst entry: SubmissionEntry = {\n\t\t\tcontrol: {\n\t\t\t\tabortController,\n\t\t\t\tpromise: Promise.resolve() as any,\n\t\t\t},\n\t\t\tstartTime: Date.now(),\n\t\t\tskipGlobalLoadingIndicator: options?.skipGlobalLoadingIndicator,\n\t\t};\n\n\t\tthis._submissions.set(submissionKey, entry);\n\t\tthis.scheduleStatusUpdate();\n\n\t\ttry {\n\t\t\tconst urlToUse = new URL(url, window.location.href);\n\t\t\tconst headers = new Headers(requestInit?.headers);\n\t\t\tconst deploymentID = __vormaClientGlobal.get(\"deploymentID\");\n\t\t\tif (deploymentID) {\n\t\t\t\theaders.set(\"x-deployment-id\", deploymentID);\n\t\t\t}\n\t\t\tconst finalRequestInit: RequestInit = {\n\t\t\t\t...requestInit,\n\t\t\t\theaders,\n\t\t\t\tsignal: abortController.signal,\n\t\t\t};\n\n\t\t\tconst { redirectData, response } = await handleRedirects({\n\t\t\t\tabortController,\n\t\t\t\turl: urlToUse,\n\t\t\t\tisPrefetch: false,\n\t\t\t\tredirectCount: 0,\n\t\t\t\trequestInit: finalRequestInit,\n\t\t\t});\n\n\t\t\tconst oldID = __vormaClientGlobal.get(\"buildID\");\n\t\t\tconst newID = getBuildIDFromResponse(response);\n\t\t\tif (newID && newID !== oldID) {\n\t\t\t\tdispatchBuildIDEvent({ newID, oldID });\n\t\t\t}\n\n\t\t\tif (!response || !response.ok) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: String(response?.status || \"unknown\"),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (redirectData?.status === \"should\") {\n\t\t\t\tawait effectuateRedirectDataResult(redirectData, 0);\n\t\t\t\treturn { success: true, data: undefined as T };\n\t\t\t}\n\n\t\t\tconst data = await response.json();\n\n\t\t\t// Auto-revalidate for mutations\n\t\t\tconst isGET = getIsGETRequest(requestInit);\n\t\t\tconst redirected = redirectData?.status === \"did\";\n\t\t\tif (!isGET && !redirected && options?.revalidate !== false) {\n\t\t\t\tawait revalidate();\n\t\t\t}\n\n\t\t\treturn { success: true, data: data as T };\n\t\t} catch (error) {\n\t\t\tif (isAbortError(error)) {\n\t\t\t\treturn { success: false, error: \"Aborted\" };\n\t\t\t}\n\t\t\tlogError(error);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t};\n\t\t} finally {\n\t\t\tthis._submissions.delete(submissionKey);\n\t\t\tthis.scheduleStatusUpdate();\n\t\t}\n\t}\n\n\tprivate findNavigationEntry(\n\t\ttargetUrl: string,\n\t): NavigationEntry | undefined {\n\t\tif (this._activeNavigation?.targetUrl === targetUrl) {\n\t\t\treturn this._activeNavigation;\n\t\t}\n\t\tconst prefetch = this._prefetchCache.get(targetUrl);\n\t\tif (prefetch) {\n\t\t\treturn prefetch;\n\t\t}\n\t\tif (this._pendingRevalidation?.targetUrl === targetUrl) {\n\t\t\treturn this._pendingRevalidation;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate deleteNavigation(key: string): boolean {\n\t\t// Check active navigation\n\t\tif (this._activeNavigation?.targetUrl === key) {\n\t\t\tthis._activeNavigation = null;\n\t\t\tthis.scheduleStatusUpdate();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Check prefetch cache\n\t\tif (this._prefetchCache.has(key)) {\n\t\t\tthis._prefetchCache.delete(key);\n\t\t\t// No status update for prefetches\n\t\t\treturn true;\n\t\t}\n\n\t\t// Check pending revalidation\n\t\tif (this._pendingRevalidation?.targetUrl === key) {\n\t\t\tthis._pendingRevalidation = null;\n\t\t\tthis.scheduleStatusUpdate();\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tremoveNavigation(key: string): void {\n\t\tconst entry = this.findNavigationEntry(key);\n\t\tif (entry) {\n\t\t\tentry.control.abortController?.abort();\n\t\t\tthis.deleteNavigation(key);\n\t\t}\n\t}\n\n\tgetNavigation(key: string): NavigationEntry | undefined {\n\t\treturn this.findNavigationEntry(key);\n\t}\n\n\thasNavigation(key: string): boolean {\n\t\treturn this.findNavigationEntry(key) !== undefined;\n\t}\n\n\tgetNavigationsSize(): number {\n\t\tlet size = 0;\n\t\tif (this._activeNavigation) size++;\n\t\tsize += this._prefetchCache.size;\n\t\tif (this._pendingRevalidation) size++;\n\t\treturn size;\n\t}\n\n\tgetNavigations(): Map<string, NavigationEntry> {\n\t\t// Reconstruct Map for compatibility with existing code\n\t\tconst map = new Map<string, NavigationEntry>();\n\t\tif (this._activeNavigation) {\n\t\t\tmap.set(this._activeNavigation.targetUrl, this._activeNavigation);\n\t\t}\n\t\tfor (const [key, entry] of this._prefetchCache) {\n\t\t\tmap.set(key, entry);\n\t\t}\n\t\tif (this._pendingRevalidation) {\n\t\t\tmap.set(\n\t\t\t\tthis._pendingRevalidation.targetUrl,\n\t\t\t\tthis._pendingRevalidation,\n\t\t\t);\n\t\t}\n\t\treturn map;\n\t}\n\n\tgetStatus(): StatusEventDetail {\n\t\tconst isNavigating =\n\t\t\tthis._activeNavigation !== null &&\n\t\t\tthis._activeNavigation.intent === \"navigate\" &&\n\t\t\tthis._activeNavigation.phase !== \"complete\";\n\n\t\tconst isRevalidating =\n\t\t\tthis._pendingRevalidation !== null &&\n\t\t\tthis._pendingRevalidation.phase !== \"complete\";\n\n\t\tconst isSubmitting = Array.from(this._submissions.values()).some(\n\t\t\t(x) => !x.skipGlobalLoadingIndicator,\n\t\t);\n\n\t\treturn { isNavigating, isSubmitting, isRevalidating };\n\t}\n\n\tclearAll(): void {\n\t\tif (this._activeNavigation) {\n\t\t\tthis._activeNavigation.control.abortController?.abort();\n\t\t\tthis._activeNavigation = null;\n\t\t}\n\n\t\tfor (const prefetch of this._prefetchCache.values()) {\n\t\t\tprefetch.control.abortController?.abort();\n\t\t}\n\t\tthis._prefetchCache.clear();\n\n\t\tif (this._pendingRevalidation) {\n\t\t\tthis._pendingRevalidation.control.abortController?.abort();\n\t\t\tthis._pendingRevalidation = null;\n\t\t}\n\n\t\tfor (const sub of this._submissions.values()) {\n\t\t\tsub.control.abortController?.abort();\n\t\t}\n\t\tthis._submissions.clear();\n\n\t\tthis.scheduleStatusUpdate();\n\t}\n\n\tprivate scheduleStatusUpdate(): void {\n\t\tthis.dispatchStatusEventDebounced();\n\t}\n\n\tprivate dispatchStatusEvent(): void {\n\t\tconst newStatus = this.getStatus();\n\n\t\tif (jsonDeepEquals(this.lastDispatchedStatus, newStatus)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastDispatchedStatus = newStatus;\n\t\tdispatchStatusEvent(newStatus);\n\t}\n}\n\n// Global instance\nexport const navigationStateManager = new NavigationStateManager();\n\n/////////////////////////////////////////////////////////////////////\n// PUBLIC API\n/////////////////////////////////////////////////////////////////////\n\nexport async function vormaNavigate(\n\thref: string,\n\toptions?: {\n\t\treplace?: boolean;\n\t\tscrollToTop?: boolean;\n\t\tsearch?: string;\n\t\thash?: string;\n\t\tstate?: unknown;\n\t},\n): Promise<void> {\n\tconst url = new URL(href, window.location.href);\n\n\tif (options?.search !== undefined) {\n\t\turl.search = options.search;\n\t}\n\tif (options?.hash !== undefined) {\n\t\turl.hash = options.hash;\n\t}\n\n\tawait navigationStateManager.navigate({\n\t\thref: url.href,\n\t\tnavigationType: \"userNavigation\",\n\t\treplace: options?.replace,\n\t\tscrollToTop: options?.scrollToTop,\n\t\tstate: options?.state,\n\t});\n}\n\nlet lastTriggeredNavOrRevalidateTimestampMS = Date.now();\n\nexport function getLastTriggeredNavOrRevalidateTimestampMS(): number {\n\treturn lastTriggeredNavOrRevalidateTimestampMS;\n}\n\nexport async function revalidate() {\n\tawait navigationStateManager.navigate({\n\t\thref: window.location.href,\n\t\tnavigationType: \"revalidation\",\n\t});\n}\n\nexport type SubmitOptions = {\n\tdedupeKey?: string;\n\trevalidate?: boolean;\n\tskipGlobalLoadingIndicator?: boolean;\n};\n\nexport async function submit<T = any>(\n\turl: string | URL,\n\trequestInit?: RequestInit,\n\toptions?: SubmitOptions,\n): Promise<{ success: true; data: T } | { success: false; error: string }> {\n\treturn navigationStateManager.submit(url, requestInit, options);\n}\n\nexport function beginNavigation(props: NavigateProps): NavigationControl {\n\treturn navigationStateManager.beginNavigation(props);\n}\n\nexport function getStatus(): StatusEventDetail {\n\treturn navigationStateManager.getStatus();\n}\n\nexport function getLocation() {\n\treturn {\n\t\tpathname: window.location.pathname,\n\t\tsearch: window.location.search,\n\t\thash: window.location.hash,\n\t\tstate: HistoryManager.getInstance().location.state,\n\t};\n}\n\nexport function getBuildID(): string {\n\treturn __vormaClientGlobal.get(\"buildID\");\n}\n\nexport function getRootEl(): HTMLDivElement {\n\treturn document.getElementById(\"vorma-root\") as HTMLDivElement;\n}\n\nexport function getHistoryInstance(): historyInstance {\n\treturn HistoryManager.getInstance();\n}\n", "import type { PatternRegistry } from \"vorma/kit/matcher/register\";\nimport type { VormaAppConfig } from \"../vorma_app_helpers/vorma_app_helpers.ts\";\n\nexport type HeadEl = {\n\ttag?: string;\n\tattributesKnownSafe?: Record<string, string>;\n\tbooleanAttributes?: Array<string>;\n\tdangerousInnerHTML?: string;\n};\n\ntype Meta = {\n\ttitle: HeadEl | null | undefined;\n\tmetaHeadEls: Array<HeadEl> | null | undefined;\n\trestHeadEls: Array<HeadEl> | null | undefined;\n};\n\ntype shared = {\n\toutermostServerError?: string;\n\toutermostClientError?: string;\n\toutermostServerErrorIdx?: number;\n\toutermostClientErrorIdx?: number;\n\toutermostError?: string; // derived from above\n\toutermostErrorIdx?: number; // derived from above\n\n\tmatchedPatterns: Array<string>;\n\tloadersData: Array<any>;\n\timportURLs: Array<string>;\n\texportKeys: Array<string>;\n\terrorExportKeys: string[];\n\thasRootData: boolean;\n\n\tparams: Record<string, string>;\n\tsplatValues: Array<string>;\n\n\tbuildID: string;\n\n\tactiveComponents: Array<any> | null;\n\tactiveErrorBoundary?: any;\n};\n\nexport type GetRouteDataOutput = Omit<shared, \"buildID\"> &\n\tMeta & {\n\t\tdeps: Array<string>;\n\t\tcssBundles: Array<string>;\n\t};\n\nexport const VORMA_SYMBOL = Symbol.for(\"__vorma_internal__\");\n\nexport type RouteErrorComponent = (props: { error: string }) => any;\n\nexport type ClientLoaderAwaitedServerData<RD, LD> = {\n\tmatchedPatterns: string[];\n\tloaderData: LD;\n\trootData: RD;\n\tbuildID: string;\n};\n\nexport type VormaClientGlobal = shared & {\n\tisDev: boolean;\n\tviteDevURL: string;\n\tpublicPathPrefix: string;\n\tisTouchDevice: boolean;\n\tpatternToWaitFnMap: Record<\n\t\tstring,\n\t\t(props: {\n\t\t\tparams: Record<string, string>;\n\t\t\tsplatValues: string[];\n\t\t\tserverDataPromise: Promise<ClientLoaderAwaitedServerData<any, any>>;\n\t\t\tsignal: AbortSignal;\n\t\t}) => Promise<any>\n\t>;\n\tclientLoadersData: Array<any>;\n\tdefaultErrorBoundary: RouteErrorComponent;\n\tuseViewTransitions: boolean;\n\tdeploymentID: string;\n\tvormaAppConfig: VormaAppConfig;\n\t// SSR'd\n\trouteManifestURL: string;\n\t// Fetched at startup -- fine because progressive enhancement\n\t// and not needed until any given route's second navigation\n\t// anyway\n\trouteManifest: Record<string, number> | undefined;\n\t// built up as we navigate\n\tclientModuleMap: Record<\n\t\tstring,\n\t\t{\n\t\t\timportURL: string;\n\t\t\texportKey: string;\n\t\t\terrorExportKey: string;\n\t\t}\n\t>;\n\tpatternRegistry: PatternRegistry;\n};\n\nexport function __getVormaClientGlobal() {\n\tconst dangerousGlobalThis = globalThis as any;\n\tfunction get<K extends keyof VormaClientGlobal>(key: K) {\n\t\treturn dangerousGlobalThis[VORMA_SYMBOL][key] as VormaClientGlobal[K];\n\t}\n\tfunction set<\n\t\tK extends keyof VormaClientGlobal,\n\t\tV extends VormaClientGlobal[K],\n\t>(key: K, value: V) {\n\t\tdangerousGlobalThis[VORMA_SYMBOL][key] = value;\n\t}\n\treturn { get, set };\n}\n\nexport const __vormaClientGlobal = __getVormaClientGlobal();\n\n// to debug ctx in browser, paste this:\n// const vorma_ctx = window[Symbol.for(\"__vorma_internal__\")];\n\nexport function getRouterData<\n\tT = any,\n\tP extends Record<string, string> = Record<string, string>,\n>() {\n\tconst rootData: T = __vormaClientGlobal.get(\"hasRootData\")\n\t\t? __vormaClientGlobal.get(\"loadersData\")[0]\n\t\t: null;\n\treturn {\n\t\tbuildID: __vormaClientGlobal.get(\"buildID\") || \"\",\n\t\tmatchedPatterns: __vormaClientGlobal.get(\"matchedPatterns\") || [],\n\t\tsplatValues: __vormaClientGlobal.get(\"splatValues\") || [],\n\t\tparams: (__vormaClientGlobal.get(\"params\") || {}) as P,\n\t\trootData,\n\t};\n}\n", "import { __vormaClientGlobal } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport function resolvePublicHref(relativeHref: string): string {\n\tlet baseURL = __vormaClientGlobal.get(\"viteDevURL\");\n\tif (!baseURL) {\n\t\tbaseURL = __vormaClientGlobal.get(\"publicPathPrefix\");\n\t}\n\tif (baseURL.endsWith(\"/\")) {\n\t\tbaseURL = baseURL.slice(0, -1);\n\t}\n\tlet final = relativeHref.startsWith(\"/\")\n\t\t? baseURL + relativeHref\n\t\t: baseURL + \"/\" + relativeHref;\n\treturn final;\n}\n", "import { resolvePublicHref } from \"./resolve_public_href.ts\";\nimport { __vormaClientGlobal } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport class AssetManager {\n\tstatic preloadModule(url: string): void {\n\t\tconst href = resolvePublicHref(url);\n\t\tif (\n\t\t\tdocument.querySelector(\n\t\t\t\t`link[rel=\"modulepreload\"][href=\"${CSS.escape(href)}\"]`,\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst link = document.createElement(\"link\");\n\t\tlink.rel = \"modulepreload\";\n\t\tlink.href = href;\n\t\tdocument.head.appendChild(link);\n\t}\n\n\tstatic preloadCSS(url: string): Promise<void> {\n\t\tconst href = resolvePublicHref(url);\n\n\t\tif (\n\t\t\tdocument.querySelector(\n\t\t\t\t`link[rel=\"preload\"][href=\"${CSS.escape(href)}\"]`,\n\t\t\t)\n\t\t) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\tconst link = document.createElement(\"link\");\n\t\tlink.rel = \"preload\";\n\t\tlink.setAttribute(\"as\", \"style\");\n\t\tlink.href = href;\n\n\t\tdocument.head.appendChild(link);\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlink.onload = () => resolve();\n\t\t\tlink.onerror = reject;\n\t\t});\n\t}\n\n\tstatic applyCSS(bundles: string[]): void {\n\t\twindow.requestAnimationFrame(() => {\n\t\t\tconst prefix = __vormaClientGlobal.get(\"publicPathPrefix\");\n\n\t\t\tfor (const bundle of bundles) {\n\t\t\t\t// Check using the data attribute without escaping\n\t\t\t\tif (\n\t\t\t\t\tdocument.querySelector(\n\t\t\t\t\t\t`link[data-vorma-css-bundle=\"${bundle}\"]`,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst link = document.createElement(\"link\");\n\t\t\t\tlink.rel = \"stylesheet\";\n\t\t\t\tlink.href = prefix + bundle;\n\t\t\t\tlink.setAttribute(\"data-vorma-css-bundle\", bundle);\n\t\t\t\tdocument.head.appendChild(link);\n\t\t\t}\n\t\t});\n\t}\n}\n", "import { findNestedMatches } from \"vorma/kit/matcher/find-nested\";\nimport { registerPattern } from \"vorma/kit/matcher/register\";\nimport { ComponentLoader, getEffectiveErrorData } from \"./component_loader.ts\";\nimport { isAbortError } from \"./utils/errors.ts\";\nimport { logError } from \"./utils/logging.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype GetRouteDataOutput,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport function setClientLoadersState(\n\tclr: ClientLoadersResult | undefined,\n): void {\n\tif (clr) {\n\t\t__vormaClientGlobal.set(\"clientLoadersData\", clr.data ?? []);\n\t\t__vormaClientGlobal.set(\n\t\t\t\"outermostClientErrorIdx\",\n\t\t\tclr.errorMessage ? clr.data.length - 1 : undefined,\n\t\t);\n\t\t__vormaClientGlobal.set(\"outermostClientError\", clr.errorMessage);\n\t}\n}\n\nexport function deriveAndSetErrorState(): void {\n\tconst effectiveErrData = getEffectiveErrorData();\n\t__vormaClientGlobal.set(\"outermostErrorIdx\", effectiveErrData.index);\n\t__vormaClientGlobal.set(\"outermostError\", effectiveErrData.error);\n}\n\nexport async function setupClientLoaders(): Promise<void> {\n\tconst clientLoadersResult = await runWaitFns(\n\t\t{\n\t\t\thasRootData: __vormaClientGlobal.get(\"hasRootData\"),\n\t\t\timportURLs: __vormaClientGlobal.get(\"importURLs\"),\n\t\t\tloadersData: __vormaClientGlobal.get(\"loadersData\"),\n\t\t\tmatchedPatterns: __vormaClientGlobal.get(\"matchedPatterns\"),\n\t\t\tparams: __vormaClientGlobal.get(\"params\"),\n\t\t\tsplatValues: __vormaClientGlobal.get(\"splatValues\"),\n\t\t},\n\t\t__vormaClientGlobal.get(\"buildID\"),\n\t\tnew AbortController().signal,\n\t);\n\n\tsetClientLoadersState(clientLoadersResult);\n\tderiveAndSetErrorState();\n}\n\nexport async function __registerClientLoaderPattern(\n\tpattern: string,\n): Promise<void> {\n\tregisterPattern(__vormaClientGlobal.get(\"patternRegistry\"), pattern);\n}\n\n// This is needed because the matcher, by definition, will only\n// match when you have a full path match. If the path you are\n// testing is longer than the registered patterns, you will get\n// no match, even if some registered patterns would potentially\n// be in the parent segments. This fixes that.\nexport async function findPartialMatchesOnClient(pathname: string) {\n\tconst patternToWaitFnMap = __vormaClientGlobal.get(\"patternToWaitFnMap\");\n\tif (Object.keys(patternToWaitFnMap).length === 0) {\n\t\treturn null;\n\t}\n\n\tconst patternRegistry = __vormaClientGlobal.get(\"patternRegistry\");\n\n\t// First try the full path\n\tconst fullResult = findNestedMatches(patternRegistry, pathname);\n\tif (fullResult) {\n\t\t// If we get a full match, we have everything we need\n\t\treturn fullResult;\n\t}\n\n\t// If no full match, try progressively shorter paths to find partial matches\n\tconst segments = pathname.split(\"/\").filter(Boolean);\n\n\t// Try from longest to shortest\n\tfor (let i = segments.length; i >= 0; i--) {\n\t\tconst partialPath =\n\t\t\ti === 0 ? \"/\" : \"/\" + segments.slice(0, i).join(\"/\");\n\t\tconst result = findNestedMatches(patternRegistry, partialPath);\n\t\tif (result) {\n\t\t\treturn result; // First match is the longest\n\t\t}\n\t}\n\n\treturn null;\n}\n\ntype PartialWaitFnJSON = Pick<\n\tGetRouteDataOutput,\n\t| \"matchedPatterns\"\n\t| \"splatValues\"\n\t| \"params\"\n\t| \"hasRootData\"\n\t| \"loadersData\"\n\t| \"importURLs\"\n>;\n\nexport type ClientLoadersResult = {\n\tdata: Array<any>;\n\terrorMessage?: string;\n};\n\nasync function executeClientLoaders(\n\tjson: PartialWaitFnJSON,\n\tbuildID: string,\n\tsignal: AbortSignal,\n\trunningLoaders?: Map<string, Promise<any>>,\n): Promise<ClientLoadersResult> {\n\tawait ComponentLoader.loadComponents(json.importURLs);\n\n\tconst matchedPatterns = json.matchedPatterns ?? [];\n\tconst patternToWaitFnMap = __vormaClientGlobal.get(\"patternToWaitFnMap\");\n\tconst outermostServerErrorIdx = __vormaClientGlobal.get(\n\t\t\"outermostServerErrorIdx\",\n\t);\n\n\tconst loaderPromises: Array<Promise<any>> = [];\n\tconst abortControllers: Array<AbortController | null> = [];\n\n\t// Build arrays of all promises and their corresponding abort controllers\n\tlet i = 0;\n\tfor (const pattern of matchedPatterns) {\n\t\tif (\n\t\t\toutermostServerErrorIdx !== undefined &&\n\t\t\ti === outermostServerErrorIdx\n\t\t) {\n\t\t\t// This route has a server error, skip its client loader\n\t\t\tloaderPromises.push(Promise.resolve());\n\t\t\tabortControllers.push(null);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (runningLoaders?.has(pattern)) {\n\t\t\t// This loader is already running (started parallel to fetch)\n\t\t\tloaderPromises.push(runningLoaders.get(pattern)!);\n\t\t\t// We can't create a new controller for it, but we can wrap it\n\t\t\tabortControllers.push(null);\n\t\t} else if (patternToWaitFnMap[pattern]) {\n\t\t\t// This is a new client loader we need to run\n\t\t\tconst controller = new AbortController();\n\t\t\tabortControllers.push(controller);\n\n\t\t\t// Wire up the main navigation signal to this loader's controller\n\t\t\tif (signal.aborted) {\n\t\t\t\tcontroller.abort();\n\t\t\t} else {\n\t\t\t\tsignal.addEventListener(\"abort\", () => controller.abort(), {\n\t\t\t\t\tonce: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst serverDataPromise = Promise.resolve({\n\t\t\t\tmatchedPatterns: json.matchedPatterns,\n\t\t\t\tloaderData: json.loadersData[i],\n\t\t\t\trootData: json.hasRootData ? json.loadersData[0] : null,\n\t\t\t\tbuildID: buildID,\n\t\t\t});\n\n\t\t\tconst loaderPromise = patternToWaitFnMap[pattern]({\n\t\t\t\tparams: json.params || {},\n\t\t\t\tsplatValues: json.splatValues || [],\n\t\t\t\tserverDataPromise,\n\t\t\t\tsignal: controller.signal,\n\t\t\t});\n\t\t\tloaderPromises.push(loaderPromise);\n\t\t} else {\n\t\t\t// No client loader for this route\n\t\t\tloaderPromises.push(Promise.resolve());\n\t\t\tabortControllers.push(null);\n\t\t}\n\t\ti++;\n\t}\n\n\t// Wrap all promises with the child-aborting logic\n\tconst wrappedPromises = loaderPromises.map(async (promise, index) => {\n\t\treturn promise.catch((error) => {\n\t\t\t// If this promise failed with a true error (not just an abort)\n\t\t\tif (!isAbortError(error)) {\n\t\t\t\t// Abort all subsequent (child) loaders immediately\n\t\t\t\tfor (let j = index + 1; j < abortControllers.length; j++) {\n\t\t\t\t\tabortControllers[j]?.abort();\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Re-throw the error so Promise.allSettled sees it as 'rejected'\n\t\t\tthrow error;\n\t\t});\n\t});\n\n\t// Await all wrapped promises. They run in parallel,\n\t// but a rejection in one now triggers aborts in its children.\n\tconst results = await Promise.allSettled(wrappedPromises);\n\n\t// Process the results\n\tconst data: Array<any> = [];\n\tlet errorMessage: string | undefined;\n\n\tfor (let i = 0; i < results.length; i++) {\n\t\tconst result = results[i];\n\t\tif (!result) {\n\t\t\tdata.push(undefined);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (result.status === \"fulfilled\") {\n\t\t\tdata.push(result.value);\n\t\t} else {\n\t\t\t// This is a rejection\n\t\t\tif (!isAbortError(result.reason)) {\n\t\t\t\t// This is the first true error we've hit\n\t\t\t\tconst pattern = matchedPatterns[i];\n\t\t\t\tlogError(\n\t\t\t\t\t`Client loader error for pattern ${pattern}:`,\n\t\t\t\t\tresult.reason,\n\t\t\t\t);\n\t\t\t\terrorMessage =\n\t\t\t\t\tresult.reason instanceof Error\n\t\t\t\t\t\t? result.reason.message\n\t\t\t\t\t\t: String(result.reason);\n\n\t\t\t\t// We found the highest error. Stop processing.\n\t\t\t\t// The .catch() wrapper already aborted any children.\n\t\t\t}\n\t\t\tdata.push(undefined);\n\t\t\tbreak; // Stop at the first error\n\t\t}\n\t}\n\n\treturn { data, errorMessage };\n}\n\nasync function runWaitFns(\n\tjson: PartialWaitFnJSON,\n\tbuildID: string,\n\tsignal: AbortSignal,\n): Promise<ClientLoadersResult> {\n\treturn executeClientLoaders(json, buildID, signal);\n}\n\nexport async function completeClientLoaders(\n\tjson: PartialWaitFnJSON,\n\tbuildID: string,\n\trunningLoaders: Map<string, Promise<any>>,\n\tsignal: AbortSignal,\n): Promise<ClientLoadersResult> {\n\treturn executeClientLoaders(json, buildID, signal, runningLoaders);\n}\n", "import { jsonDeepEquals } from \"vorma/kit/json\";\nimport { resolvePublicHref } from \"./resolve_public_href.ts\";\nimport { __vormaClientGlobal } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport function getEffectiveErrorData(): {\n\tindex: number | undefined;\n\terror: string | undefined;\n} {\n\tconst serverErrorIdx = __vormaClientGlobal.get(\"outermostServerErrorIdx\");\n\tconst clientErrorIdx = __vormaClientGlobal.get(\"outermostClientErrorIdx\");\n\tlet errorIdx: number | undefined;\n\tif (serverErrorIdx != null && clientErrorIdx != null) {\n\t\terrorIdx = Math.min(serverErrorIdx, clientErrorIdx);\n\t} else {\n\t\terrorIdx = serverErrorIdx ?? clientErrorIdx;\n\t}\n\treturn {\n\t\tindex: errorIdx,\n\t\terror:\n\t\t\terrorIdx === serverErrorIdx\n\t\t\t\t? __vormaClientGlobal.get(\"outermostServerError\")\n\t\t\t\t: errorIdx === clientErrorIdx\n\t\t\t\t\t? __vormaClientGlobal.get(\"outermostClientError\")\n\t\t\t\t\t: undefined,\n\t};\n}\n\nexport class ComponentLoader {\n\tstatic async loadComponents(\n\t\timportURLs: string[],\n\t): Promise<Map<string, any>> {\n\t\tconst dedupedURLs = [...new Set(importURLs)];\n\t\tconst modules = await Promise.all(\n\t\t\tdedupedURLs.map(async (url) => {\n\t\t\t\tif (!url) return undefined;\n\t\t\t\treturn import(/* @vite-ignore */ resolvePublicHref(url));\n\t\t\t}),\n\t\t);\n\t\treturn new Map(dedupedURLs.map((url, i) => [url, modules[i]]));\n\t}\n\n\tstatic async handleComponents(importURLs: string[]): Promise<void> {\n\t\tconst modulesMap = await this.loadComponents(importURLs);\n\t\tconst originalImportURLs = __vormaClientGlobal.get(\"importURLs\");\n\t\tconst exportKeys = __vormaClientGlobal.get(\"exportKeys\") ?? [];\n\n\t\t// Build new components array\n\t\tconst newActiveComponents = originalImportURLs.map(\n\t\t\t(url: string, i: number) => {\n\t\t\t\tconst module = modulesMap.get(url);\n\t\t\t\tconst key = exportKeys[i] ?? \"default\";\n\t\t\t\treturn module?.[key] ?? null;\n\t\t\t},\n\t\t);\n\n\t\t// Only update if components actually changed\n\t\tif (\n\t\t\t!jsonDeepEquals(\n\t\t\t\tnewActiveComponents,\n\t\t\t\t__vormaClientGlobal.get(\"activeComponents\"),\n\t\t\t)\n\t\t) {\n\t\t\t__vormaClientGlobal.set(\"activeComponents\", newActiveComponents);\n\t\t}\n\t}\n\n\tstatic async handleErrorBoundaryComponent(\n\t\timportURLs: string[],\n\t): Promise<void> {\n\t\tconst modulesMap = await this.loadComponents(importURLs);\n\t\tconst originalImportURLs = __vormaClientGlobal.get(\"importURLs\");\n\n\t\t// Handle error boundary\n\t\tconst errorIdx = getEffectiveErrorData().index;\n\n\t\tif (errorIdx != null) {\n\t\t\tconst errorModuleURL = originalImportURLs[errorIdx];\n\t\t\tlet errorComponent;\n\n\t\t\tif (errorModuleURL) {\n\t\t\t\tconst errorModule = modulesMap.get(errorModuleURL);\n\t\t\t\tconst errorKeys = __vormaClientGlobal.get(\"errorExportKeys\");\n\t\t\t\tconst errorKey = errorKeys ? errorKeys[errorIdx] : null;\n\t\t\t\tif (errorKey && errorModule) {\n\t\t\t\t\terrorComponent = errorModule[errorKey];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst newErrorBoundary =\n\t\t\t\terrorComponent ??\n\t\t\t\t__vormaClientGlobal.get(\"defaultErrorBoundary\");\n\n\t\t\t// Only update if changed\n\t\t\tconst currentErrorBoundary = __vormaClientGlobal.get(\n\t\t\t\t\"activeErrorBoundary\",\n\t\t\t);\n\t\t\tif (currentErrorBoundary !== newErrorBoundary) {\n\t\t\t\t__vormaClientGlobal.set(\n\t\t\t\t\t\"activeErrorBoundary\",\n\t\t\t\t\tnewErrorBoundary,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n", "export function logInfo(message?: any, ...optionalParams: Array<any>) {\n\tconsole.log(\"Vorma:\", message, ...optionalParams);\n}\n\nexport function logError(message?: any, ...optionalParams: Array<any>) {\n\tconsole.error(\"Vorma:\", message, ...optionalParams);\n}\n", "import { logError } from \"./logging.ts\";\n\nexport function isAbortError(error: unknown) {\n\treturn error instanceof Error && error.name === \"AbortError\";\n}\n\nexport function panic(msg?: string): never {\n\tlogError(\"Panic\");\n\tthrow new Error(msg ?? \"panic\");\n}\n", "import type { ScrollState } from \"./scroll_state_manager.ts\";\n\n// Route Change Event\nexport const VORMA_ROUTE_CHANGE_EVENT_KEY = \"vorma:route-change\";\nexport type RouteChangeEvent = CustomEvent<RouteChangeEventDetail>;\nexport type RouteChangeEventDetail = { __scrollState?: ScrollState };\nexport const addRouteChangeListener = makeListenerAdder<RouteChangeEventDetail>(\n\tVORMA_ROUTE_CHANGE_EVENT_KEY,\n);\nexport function dispatchRouteChangeEvent(detail: RouteChangeEventDetail): void {\n\twindow.dispatchEvent(\n\t\tnew CustomEvent(VORMA_ROUTE_CHANGE_EVENT_KEY, { detail }),\n\t);\n}\n\n// Status Event\nconst STATUS_EVENT_KEY = \"vorma:status\";\nexport type StatusEvent = CustomEvent<StatusEventDetail>;\nexport type StatusEventDetail = {\n\tisNavigating: boolean;\n\tisSubmitting: boolean;\n\tisRevalidating: boolean;\n};\nexport function dispatchStatusEvent(detail: StatusEventDetail): void {\n\twindow.dispatchEvent(new CustomEvent(STATUS_EVENT_KEY, { detail }));\n}\nexport const addStatusListener =\n\tmakeListenerAdder<StatusEventDetail>(STATUS_EVENT_KEY);\n\n// Build ID Event\nconst BUILD_ID_EVENT_KEY = \"vorma:build-id\";\ntype BuildIDEventDetail = { oldID: string; newID: string };\nexport function dispatchBuildIDEvent(detail: BuildIDEventDetail): void {\n\twindow.dispatchEvent(new CustomEvent(BUILD_ID_EVENT_KEY, { detail }));\n}\nexport const addBuildIDListener =\n\tmakeListenerAdder<BuildIDEventDetail>(BUILD_ID_EVENT_KEY);\n\n// Location Event\nconst LOCATION_EVENT_KEY = \"vorma:location\";\nexport function dispatchLocationEvent(): void {\n\twindow.dispatchEvent(new CustomEvent(LOCATION_EVENT_KEY));\n}\nexport const addLocationListener = makeListenerAdder<void>(LOCATION_EVENT_KEY);\n\n// Helper to create listener adders\nfunction makeListenerAdder<T>(key: string) {\n\treturn function addListener(\n\t\tlistener: (event: CustomEvent<T>) => void,\n\t): () => void {\n\t\twindow.addEventListener(key, listener as any);\n\t\treturn () => window.removeEventListener(key, listener as any);\n\t};\n}\n", "function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };", "import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n", "import { HistoryManager } from \"./history/history.ts\";\n\nexport type ScrollState = { x: number; y: number } | { hash: string };\n\nclass ScrollStateManager {\n\tprivate readonly STORAGE_KEY = \"__vorma__scrollStateMap\";\n\tprivate readonly PAGE_REFRESH_KEY = \"__vorma__pageRefreshScrollState\";\n\tprivate readonly MAX_ENTRIES = 50;\n\n\tsaveState(key: string, state: ScrollState): void {\n\t\tconst map = this.getMap();\n\t\tmap.set(key, state);\n\n\t\t// Enforce size limit\n\t\tif (map.size > this.MAX_ENTRIES) {\n\t\t\tconst firstKey = map.keys().next().value;\n\t\t\tif (firstKey) map.delete(firstKey);\n\t\t}\n\n\t\tthis.saveMap(map);\n\t}\n\n\tgetState(key: string): ScrollState | undefined {\n\t\treturn this.getMap().get(key);\n\t}\n\n\tsavePageRefreshState(): void {\n\t\tconst state = {\n\t\t\tx: window.scrollX,\n\t\t\ty: window.scrollY,\n\t\t\tunix: Date.now(),\n\t\t\thref: window.location.href,\n\t\t};\n\t\tsessionStorage.setItem(this.PAGE_REFRESH_KEY, JSON.stringify(state));\n\t}\n\n\trestorePageRefreshState(): void {\n\t\tconst stored = sessionStorage.getItem(this.PAGE_REFRESH_KEY);\n\t\tif (!stored) return;\n\n\t\ttry {\n\t\t\tconst state = JSON.parse(stored);\n\t\t\tif (\n\t\t\t\tstate.href === window.location.href &&\n\t\t\t\tDate.now() - state.unix < 5000\n\t\t\t) {\n\t\t\t\tsessionStorage.removeItem(this.PAGE_REFRESH_KEY);\n\t\t\t\twindow.requestAnimationFrame(() => {\n\t\t\t\t\t__applyScrollState({ x: state.x, y: state.y });\n\t\t\t\t});\n\t\t\t}\n\t\t} catch {}\n\t}\n\n\tprivate getMap(): Map<string, ScrollState> {\n\t\tconst stored = sessionStorage.getItem(this.STORAGE_KEY);\n\t\tif (!stored) return new Map();\n\n\t\ttry {\n\t\t\treturn new Map(JSON.parse(stored));\n\t\t} catch {\n\t\t\treturn new Map();\n\t\t}\n\t}\n\n\tprivate saveMap(map: Map<string, ScrollState>): void {\n\t\tsessionStorage.setItem(\n\t\t\tthis.STORAGE_KEY,\n\t\t\tJSON.stringify(Array.from(map.entries())),\n\t\t);\n\t}\n}\n\nexport const scrollStateManager = new ScrollStateManager();\n\nexport function __applyScrollState(state?: ScrollState): void {\n\tif (!state) {\n\t\tconst id = window.location.hash.slice(1);\n\t\tif (id) {\n\t\t\tdocument.getElementById(id)?.scrollIntoView();\n\t\t}\n\t\treturn;\n\t}\n\n\tif (\"hash\" in state) {\n\t\tif (state.hash) {\n\t\t\tdocument.getElementById(state.hash)?.scrollIntoView();\n\t\t}\n\t} else {\n\t\twindow.scrollTo(state.x, state.y);\n\t}\n}\n\nexport function saveScrollState(): void {\n\tconst lastKnownLocation = HistoryManager.getLastKnownLocation();\n\tscrollStateManager.saveState(lastKnownLocation.key, {\n\t\tx: window.scrollX,\n\t\ty: window.scrollY,\n\t});\n}\n", "import { createBrowserHistory, type Update as NPMHistoryUpdate } from \"history\";\nimport { navigationStateManager } from \"../client.ts\";\nimport { dispatchLocationEvent } from \"../events.ts\";\nimport {\n\t__applyScrollState,\n\tsaveScrollState,\n\tscrollStateManager,\n} from \"../scroll_state_manager.ts\";\nimport { logError } from \"../utils/logging.ts\";\nimport type { historyInstance, historyListener } from \"./npm_history_types.ts\";\n\nexport class HistoryManager {\n\tprivate static instance: historyInstance;\n\tprivate static lastKnownLocation: typeof HistoryManager.instance.location;\n\n\tstatic getInstance(): historyInstance {\n\t\tif (!this.instance) {\n\t\t\tthis.instance =\n\t\t\t\tcreateBrowserHistory() as unknown as historyInstance;\n\t\t\tthis.lastKnownLocation = this.instance.location;\n\t\t}\n\t\treturn this.instance;\n\t}\n\n\tstatic getLastKnownLocation() {\n\t\treturn this.lastKnownLocation;\n\t}\n\n\tstatic updateLastKnownLocation(\n\t\tlocation: typeof HistoryManager.instance.location,\n\t) {\n\t\tthis.lastKnownLocation = location;\n\t}\n\n\tstatic init(): void {\n\t\tconst instance = this.getInstance();\n\t\tinstance.listen(customHistoryListener as unknown as historyListener);\n\t\tthis.setManualScrollRestoration();\n\t}\n\n\tprivate static setManualScrollRestoration(): void {\n\t\tif (\n\t\t\thistory.scrollRestoration &&\n\t\t\thistory.scrollRestoration !== \"manual\"\n\t\t) {\n\t\t\thistory.scrollRestoration = \"manual\";\n\t\t}\n\t}\n}\n\nexport function initCustomHistory(): void {\n\tHistoryManager.init();\n}\n\nexport async function customHistoryListener({\n\taction,\n\tlocation,\n}: NPMHistoryUpdate): Promise<void> {\n\tconst lastKnownLocation = HistoryManager.getLastKnownLocation();\n\n\tif (location.key !== lastKnownLocation.key) {\n\t\tdispatchLocationEvent();\n\t}\n\n\tconst popWithinSameDoc =\n\t\taction === \"POP\" &&\n\t\tlocation.pathname === lastKnownLocation.pathname &&\n\t\tlocation.search === lastKnownLocation.search;\n\n\tconst removingHash =\n\t\tpopWithinSameDoc && lastKnownLocation.hash && !location.hash;\n\tconst addingHash =\n\t\tpopWithinSameDoc && !lastKnownLocation.hash && location.hash;\n\tconst updatingHash = popWithinSameDoc && location.hash;\n\n\tif (!popWithinSameDoc) {\n\t\tsaveScrollState();\n\t}\n\n\tlet navigationSucceeded = true;\n\n\tif (action === \"POP\") {\n\t\tconst newHash = location.hash.slice(1);\n\n\t\tif (addingHash || updatingHash) {\n\t\t\t__applyScrollState({ hash: newHash });\n\t\t}\n\n\t\tif (removingHash) {\n\t\t\tconst stored = scrollStateManager.getState(location.key);\n\t\t\t__applyScrollState(stored ?? { x: 0, y: 0 });\n\t\t}\n\n\t\tif (!popWithinSameDoc) {\n\t\t\tconst result = await navigationStateManager.navigate({\n\t\t\t\thref: window.location.href,\n\t\t\t\tnavigationType: \"browserHistory\",\n\t\t\t\tscrollStateToRestore: scrollStateManager.getState(location.key),\n\t\t\t});\n\n\t\t\tif (!result.didNavigate) {\n\t\t\t\tnavigationSucceeded = false;\n\t\t\t\tlogError(\n\t\t\t\t\t\"Browser POP navigation failed, attempting hard reload of the destination.\",\n\t\t\t\t);\n\n\t\t\t\t// This just reloads the current (failed) URL.\n\t\t\t\t// It preserves the history stack and ensures no UI/URL mismatch,\n\t\t\t\t// which could otherwise happen if a browser forward/back navigation fails\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (navigationSucceeded) {\n\t\tHistoryManager.updateLastKnownLocation(location);\n\t}\n}\n", "import {\n\tgetHrefDetails,\n\tgetIsGETRequest,\n\ttype HrefDetails,\n} from \"vorma/kit/url\";\nimport { navigationStateManager, type NavigateProps } from \"../client.ts\";\nimport { VORMA_HARD_RELOAD_QUERY_PARAM } from \"../hard_reload.ts\";\nimport { logError, logInfo } from \"../utils/logging.ts\";\n\nexport type RedirectData = { href: string; hrefDetails: HrefDetails } & (\n\t| {\n\t\t\tstatus: \"did\";\n\t }\n\t| {\n\t\t\tstatus: \"should\";\n\t\t\tshouldRedirectStrategy: \"hard\" | \"soft\";\n\t\t\tlatestBuildID: string;\n\t }\n);\n\nexport function getBuildIDFromResponse(response: Response | undefined) {\n\treturn response?.headers.get(\"X-Vorma-Build-Id\") || \"\";\n}\n\nexport function parseFetchResponseForRedirectData(\n\treqInit: RequestInit,\n\tres: Response,\n): RedirectData | null {\n\tconst latestBuildID = getBuildIDFromResponse(res);\n\n\tconst vormaReloadTarget = res.headers.get(\"X-Vorma-Reload\");\n\tif (vormaReloadTarget) {\n\t\tconst newURL = new URL(vormaReloadTarget, window.location.href);\n\t\tconst hrefDetails = getHrefDetails(newURL.href);\n\t\tif (!hrefDetails.isHTTP) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn {\n\t\t\threfDetails,\n\t\t\tstatus: \"should\",\n\t\t\thref: vormaReloadTarget,\n\t\t\tshouldRedirectStrategy: \"hard\",\n\t\t\tlatestBuildID,\n\t\t};\n\t}\n\n\tif (res.redirected) {\n\t\tconst newURL = new URL(res.url, window.location.href);\n\t\tconst hrefDetails = getHrefDetails(newURL.href);\n\t\tif (!hrefDetails.isHTTP) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst isCurrent = newURL.href === window.location.href;\n\t\tif (isCurrent) {\n\t\t\treturn { hrefDetails, status: \"did\", href: newURL.href };\n\t\t}\n\n\t\tconst wasGETRequest = getIsGETRequest(reqInit);\n\t\tif (!wasGETRequest) {\n\t\t\tlogInfo(\"Not a GET request. No way to handle.\");\n\t\t\treturn null;\n\t\t}\n\n\t\treturn {\n\t\t\threfDetails,\n\t\t\tstatus: \"should\",\n\t\t\thref: newURL.href,\n\t\t\tshouldRedirectStrategy: hrefDetails.isInternal ? \"soft\" : \"hard\",\n\t\t\tlatestBuildID,\n\t\t};\n\t}\n\n\tconst clientRedirectHeader = res.headers.get(\"X-Client-Redirect\");\n\n\tif (!clientRedirectHeader) {\n\t\treturn null;\n\t}\n\n\tconst newURL = new URL(clientRedirectHeader, window.location.href);\n\tconst hrefDetails = getHrefDetails(newURL.href);\n\tif (!hrefDetails.isHTTP) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\threfDetails,\n\t\tstatus: \"should\",\n\t\thref: hrefDetails.absoluteURL,\n\t\tshouldRedirectStrategy: hrefDetails.isInternal ? \"soft\" : \"hard\",\n\t\tlatestBuildID,\n\t};\n}\n\nexport async function effectuateRedirectDataResult(\n\tredirectData: RedirectData,\n\tredirectCount: number,\n\toriginalProps?: NavigateProps,\n): Promise<RedirectData | null> {\n\tif (redirectData.status !== \"should\") {\n\t\treturn null;\n\t}\n\n\t// Clean up any active redirect or revalidations when redirecting.\n\t// Otherwise loading state will get stuck.\n\tconst navEntries = navigationStateManager.getNavigations().entries();\n\tfor (const [key, nav] of navEntries) {\n\t\tif (nav.type === \"redirect\" || nav.type === \"revalidation\") {\n\t\t\tnav.control.abortController?.abort();\n\t\t\tnavigationStateManager.removeNavigation(key);\n\t\t}\n\t}\n\n\tif (redirectData.shouldRedirectStrategy === \"hard\") {\n\t\tif (!redirectData.hrefDetails.isHTTP) return null;\n\n\t\tif (redirectData.hrefDetails.isExternal) {\n\t\t\twindow.location.href = redirectData.href;\n\t\t} else {\n\t\t\tconst url = new URL(redirectData.href, window.location.href);\n\t\t\turl.searchParams.set(\n\t\t\t\tVORMA_HARD_RELOAD_QUERY_PARAM,\n\t\t\t\tredirectData.latestBuildID,\n\t\t\t);\n\t\t\twindow.location.href = url.href;\n\t\t}\n\n\t\treturn {\n\t\t\threfDetails: redirectData.hrefDetails,\n\t\t\tstatus: \"did\",\n\t\t\thref: redirectData.href,\n\t\t};\n\t}\n\n\tif (redirectData.shouldRedirectStrategy === \"soft\") {\n\t\tawait navigationStateManager.navigate({\n\t\t\thref: redirectData.href,\n\t\t\tnavigationType: \"redirect\",\n\t\t\tredirectCount: redirectCount + 1,\n\t\t\tstate: originalProps?.state,\n\t\t\treplace: originalProps?.replace,\n\t\t\tscrollToTop: originalProps?.scrollToTop,\n\t\t});\n\n\t\treturn {\n\t\t\threfDetails: redirectData.hrefDetails,\n\t\t\tstatus: \"did\",\n\t\t\thref: redirectData.href,\n\t\t};\n\t}\n\n\treturn null;\n}\n\nexport async function handleRedirects(props: {\n\tabortController: AbortController;\n\turl: URL;\n\trequestInit?: RequestInit;\n\tisPrefetch?: boolean;\n\tredirectCount?: number;\n}): Promise<{ redirectData: RedirectData | null; response?: Response }> {\n\tconst MAX_REDIRECTS = 10;\n\tconst redirectCount = props.redirectCount || 0;\n\n\tif (redirectCount >= MAX_REDIRECTS) {\n\t\tlogError(\"Too many redirects\");\n\t\treturn { redirectData: null, response: undefined };\n\t}\n\n\t// Prepare request\n\tconst bodyParentObj: RequestInit = {};\n\tconst isGET = getIsGETRequest(props.requestInit);\n\n\tif (props.requestInit && (props.requestInit.body !== undefined || !isGET)) {\n\t\tif (\n\t\t\tprops.requestInit.body instanceof FormData ||\n\t\t\ttypeof props.requestInit.body === \"string\"\n\t\t) {\n\t\t\tbodyParentObj.body = props.requestInit.body;\n\t\t} else {\n\t\t\tbodyParentObj.body = JSON.stringify(props.requestInit.body);\n\t\t}\n\t}\n\n\tconst headers = new Headers(props.requestInit?.headers);\n\t// To temporarily test traditional server redirect behavior,\n\t// you can set this to \"0\" instead of \"1\"\n\theaders.set(\"X-Accepts-Client-Redirect\", \"1\");\n\tbodyParentObj.headers = headers;\n\n\tconst finalRequestInit = {\n\t\tsignal: props.abortController.signal,\n\t\t...props.requestInit,\n\t\t...bodyParentObj,\n\t};\n\n\t// Execute request\n\tconst res = await fetch(props.url, finalRequestInit);\n\tlet redirectData = parseFetchResponseForRedirectData(finalRequestInit, res);\n\n\treturn { redirectData, response: res };\n}\n", "export const VORMA_HARD_RELOAD_QUERY_PARAM = \"vorma_reload\";\n", "import { panic } from \"../utils/errors.ts\";\nimport type { HeadEl } from \"../vorma_ctx/vorma_ctx.ts\";\n\nexport function getStartAndEndComments(type: \"meta\" | \"rest\"): {\n\tstartComment: Comment | null;\n\tendComment: Comment | null;\n} {\n\tconst startMarker = `data-vorma=\"${type}-start\"`;\n\tconst endMarker = `data-vorma=\"${type}-end\"`;\n\tconst start = findComment(startMarker);\n\tconst end = findComment(endMarker);\n\treturn { startComment: start, endComment: end };\n}\n\nfunction findComment(matchingText: string): Comment | null {\n\tconst walker = document.createTreeWalker(\n\t\tdocument.head,\n\t\tNodeFilter.SHOW_COMMENT,\n\t\t{\n\t\t\tacceptNode(node: Comment) {\n\t\t\t\treturn node.nodeValue?.trim() === matchingText.trim()\n\t\t\t\t\t? NodeFilter.FILTER_ACCEPT\n\t\t\t\t\t: NodeFilter.FILTER_REJECT;\n\t\t\t},\n\t\t},\n\t);\n\treturn walker.nextNode() as Comment | null;\n}\n\nexport function updateHeadEls(type: \"meta\" | \"rest\", blocks: Array<HeadEl>) {\n\tconst { startComment, endComment } = getStartAndEndComments(type);\n\tif (!startComment || !endComment || !endComment.parentNode) {\n\t\treturn;\n\t}\n\tconst parent = endComment.parentNode;\n\n\t// Collect all current nodes between start and end comments\n\tconst currentNodes: Array<Node> = [];\n\tlet nodePtr = startComment.nextSibling;\n\twhile (nodePtr != null && nodePtr !== endComment) {\n\t\tcurrentNodes.push(nodePtr);\n\t\tnodePtr = nodePtr.nextSibling;\n\t}\n\tconst currentElements = currentNodes.filter(\n\t\t(node): node is Element => node.nodeType === Node.ELEMENT_NODE,\n\t);\n\n\t// Create new elements from blocks\n\tconst newElements: Array<Element> = [];\n\tconst newElementFingerprints = new Map<string, Element>();\n\tfor (const block of blocks) {\n\t\tif (!block.tag) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst newEl = document.createElement(block.tag);\n\t\tif (block.attributesKnownSafe) {\n\t\t\tfor (const key of Object.keys(block.attributesKnownSafe)) {\n\t\t\t\tconst value = block.attributesKnownSafe[key];\n\t\t\t\tif (value === null || value === undefined) {\n\t\t\t\t\tpanic(\n\t\t\t\t\t\t`Attribute value for '${key}' in tag '${block.tag}' cannot be null or undefined.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tnewEl.setAttribute(key, value);\n\t\t\t}\n\t\t}\n\t\tif (block.booleanAttributes) {\n\t\t\tfor (const key of block.booleanAttributes) {\n\t\t\t\tnewEl.setAttribute(key, \"\");\n\t\t\t}\n\t\t}\n\t\tif (block.dangerousInnerHTML) {\n\t\t\tnewEl.innerHTML = block.dangerousInnerHTML;\n\t\t}\n\n\t\tconst fingerprint = createElementFingerprint(newEl);\n\t\tif (newElementFingerprints.has(fingerprint)) {\n\t\t\tconst elementToRemove = newElementFingerprints.get(fingerprint);\n\t\t\tif (elementToRemove) {\n\t\t\t\tconst indexToRemove = newElements.indexOf(elementToRemove);\n\t\t\t\tif (indexToRemove > -1) {\n\t\t\t\t\tnewElements.splice(indexToRemove, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tnewElements.push(newEl);\n\t\tnewElementFingerprints.set(fingerprint, newEl);\n\t}\n\n\t// Build a map of current elements by fingerprint\n\tconst currentElementsMap = new Map<string, Array<Element>>();\n\tfor (const el of currentElements) {\n\t\tconst fingerprint = createElementFingerprint(el);\n\t\tif (!currentElementsMap.has(fingerprint)) {\n\t\t\tcurrentElementsMap.set(fingerprint, []);\n\t\t}\n\t\tcurrentElementsMap.get(fingerprint)?.push(el);\n\t}\n\n\t// Match new elements with existing ones when possible\n\tconst finalElements: Array<Element> = [];\n\tconst usedCurrentElements = new Set<Element>();\n\n\tfor (const newEl of newElements) {\n\t\tconst fingerprint = createElementFingerprint(newEl);\n\t\tconst matchingCurrentElementsList =\n\t\t\tcurrentElementsMap.get(fingerprint) || [];\n\n\t\t// Find the first matching element that hasn't been used yet\n\t\tconst matchingElement = matchingCurrentElementsList.find(\n\t\t\t(el) => !usedCurrentElements.has(el),\n\t\t);\n\n\t\tif (matchingElement) {\n\t\t\tusedCurrentElements.add(matchingElement);\n\t\t\tfinalElements.push(matchingElement);\n\t\t} else {\n\t\t\tfinalElements.push(newEl);\n\t\t}\n\t}\n\n\t// Create a map to track which elements are in the correct position\n\t// and which need to be moved or added\n\tconst desiredPositions = new Map<Element, number>();\n\tfinalElements.forEach((el, index) => {\n\t\tdesiredPositions.set(el, index);\n\t});\n\n\t// Track elements still in the DOM\n\tconst remainingCurrentElements = new Set(currentElements);\n\n\t// First pass: remove elements that are no longer needed\n\tfor (const currentElement of currentElements) {\n\t\tif (!usedCurrentElements.has(currentElement)) {\n\t\t\tparent.removeChild(currentElement);\n\t\t\tremainingCurrentElements.delete(currentElement);\n\t\t}\n\t}\n\n\t// Second pass: position elements in the correct order with minimal DOM operations\n\tlet lastProcessedElement: Element | null = null;\n\n\tfor (let i = 0; i < finalElements.length; i++) {\n\t\tconst element = finalElements[i];\n\t\tif (!element) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst isExistingElement = usedCurrentElements.has(element);\n\n\t\tif (isExistingElement) {\n\t\t\t// Check if this element is already in the correct position\n\t\t\tconst nextElementInDOM = (\n\t\t\t\tlastProcessedElement\n\t\t\t\t\t? lastProcessedElement.nextElementSibling\n\t\t\t\t\t: startComment.nextElementSibling\n\t\t\t) as Element | null;\n\n\t\t\tif (nextElementInDOM !== element) {\n\t\t\t\t// Element exists but is in the wrong position, move it\n\t\t\t\tparent.insertBefore(element, nextElementInDOM || endComment);\n\t\t\t}\n\n\t\t\t// Mark as processed\n\t\t\tremainingCurrentElements.delete(element);\n\t\t\tlastProcessedElement = element;\n\t\t} else {\n\t\t\t// This is a new element, insert it\n\t\t\tconst insertBefore = lastProcessedElement\n\t\t\t\t? lastProcessedElement.nextSibling\n\t\t\t\t: startComment.nextSibling;\n\n\t\t\tparent.insertBefore(element, insertBefore || endComment);\n\t\t\tlastProcessedElement = element;\n\t\t}\n\t}\n}\n\nfunction createElementFingerprint(element: Element): string {\n\tconst attributes: Array<string> = [];\n\tfor (let i = 0; i < element.attributes.length; i++) {\n\t\tconst attr = element.attributes[i];\n\t\tif (!attr) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst value =\n\t\t\telement.hasAttribute(attr.name) && attr.value === \"\"\n\t\t\t\t? \"\"\n\t\t\t\t: attr.value;\n\t\tattributes.push(`${attr.name}=\"${value}\"`);\n\t}\n\tattributes.sort();\n\treturn `${element.tagName.toUpperCase()}|${attributes.join(\",\")}|${(element.innerHTML || \"\").trim()}`;\n}\n", "import { AssetManager } from \"./asset_manager.ts\";\nimport type { VormaNavigationType } from \"./client.ts\";\nimport { deriveAndSetErrorState } from \"./client_loaders.ts\";\nimport { ComponentLoader } from \"./component_loader.ts\";\nimport { dispatchRouteChangeEvent } from \"./events.ts\";\nimport { updateHeadEls } from \"./head_elements/head_elements.ts\";\nimport { HistoryManager } from \"./history/history.ts\";\nimport type { ScrollState } from \"./scroll_state_manager.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype GetRouteDataOutput,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\ntype RerenderAppProps = {\n\tjson: GetRouteDataOutput;\n\tnavigationType: VormaNavigationType;\n\trunHistoryOptions?: {\n\t\thref: string;\n\t\tscrollStateToRestore?: ScrollState;\n\t\treplace?: boolean;\n\t\tscrollToTop?: boolean;\n\t\tstate?: unknown;\n\t};\n\tonFinish: () => void;\n};\n\nexport async function __reRenderApp(props: RerenderAppProps): Promise<void> {\n\tconst shouldUseViewTransitions =\n\t\t__vormaClientGlobal.get(\"useViewTransitions\") &&\n\t\t!!document.startViewTransition &&\n\t\tprops.navigationType !== \"prefetch\" &&\n\t\tprops.navigationType !== \"revalidation\";\n\n\tif (shouldUseViewTransitions) {\n\t\tconst transition = document.startViewTransition(async () => {\n\t\t\tawait __reRenderAppInner(props);\n\t\t});\n\t\tawait transition.finished;\n\t} else {\n\t\tawait __reRenderAppInner(props);\n\t}\n}\n\nasync function __reRenderAppInner(props: RerenderAppProps): Promise<void> {\n\tconst { json, navigationType, runHistoryOptions } = props;\n\n\t// Update global state\n\tconst stateKeys = [\n\t\t\"outermostServerError\",\n\t\t\"outermostServerErrorIdx\",\n\t\t\"errorExportKeys\",\n\t\t\"matchedPatterns\",\n\t\t\"loadersData\",\n\t\t\"importURLs\",\n\t\t\"exportKeys\",\n\t\t\"hasRootData\",\n\t\t\"params\",\n\t\t\"splatValues\",\n\t] as const;\n\n\tfor (const key of stateKeys) {\n\t\t__vormaClientGlobal.set(key, json[key]);\n\t}\n\n\tderiveAndSetErrorState();\n\n\t// Load components and error boundary\n\tawait ComponentLoader.handleComponents(json.importURLs);\n\tawait ComponentLoader.handleErrorBoundaryComponent(json.importURLs);\n\n\t// Handle history and scroll\n\tlet scrollStateToDispatch: ScrollState | undefined;\n\n\tif (runHistoryOptions) {\n\t\tconst { href, scrollStateToRestore, replace, scrollToTop } =\n\t\t\trunHistoryOptions;\n\t\tconst hash = href.split(\"#\")[1];\n\t\tconst history = HistoryManager.getInstance();\n\n\t\tif (\n\t\t\tnavigationType === \"userNavigation\" ||\n\t\t\tnavigationType === \"redirect\"\n\t\t) {\n\t\t\tconst target = new URL(href, window.location.href).href;\n\t\t\tconst current = new URL(window.location.href).href;\n\n\t\t\tif (target !== current && !replace) {\n\t\t\t\thistory.push(href, runHistoryOptions.state);\n\t\t\t} else {\n\t\t\t\thistory.replace(href, runHistoryOptions.state);\n\t\t\t}\n\n\t\t\tscrollStateToDispatch = hash\n\t\t\t\t? { hash }\n\t\t\t\t: scrollToTop !== false\n\t\t\t\t\t? { x: 0, y: 0 }\n\t\t\t\t\t: undefined;\n\t\t}\n\n\t\tif (navigationType === \"browserHistory\") {\n\t\t\tscrollStateToDispatch =\n\t\t\t\tscrollStateToRestore ?? (hash ? { hash } : undefined);\n\t\t}\n\t}\n\n\tif (json.title !== undefined) {\n\t\t// Changing the title instantly makes it feel faster\n\t\t// The temp textarea trick is to decode any HTML entities in the title.\n\t\t// This should come after pushing to history though, so that the title is\n\t\t// correct in the history entry.\n\t\tconst tempTxt = document.createElement(\"textarea\");\n\t\ttempTxt.innerHTML = json.title?.dangerousInnerHTML || \"\";\n\t\tif (document.title !== tempTxt.value) {\n\t\t\tdocument.title = tempTxt.value;\n\t\t}\n\t}\n\n\t// Apply CSS\n\tif (json.cssBundles) {\n\t\tAssetManager.applyCSS(json.cssBundles);\n\t}\n\n\t// Dispatch route change event -- this triggers the actual UI update\n\tdispatchRouteChangeEvent({ __scrollState: scrollStateToDispatch });\n\n\t// Only update head elements if provided (not undefined)\n\tif (json.metaHeadEls !== undefined) {\n\t\tupdateHeadEls(\"meta\", json.metaHeadEls ?? []);\n\t}\n\tif (json.restHeadEls !== undefined) {\n\t\tupdateHeadEls(\"rest\", json.restHeadEls ?? []);\n\t}\n\n\tprops.onFinish();\n}\n", "import type { RouteErrorComponent } from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport const defaultErrorBoundary: RouteErrorComponent = (props: {\n\terror: string;\n}) => {\n\treturn \"Route Error: \" + props.error;\n};\n", "import { getStatus } from \"../client.ts\";\nimport { addStatusListener, type StatusEvent } from \"../events.ts\";\n\nconst DEFAULT_DELAY = 12;\n\ntype GlobalLoadingIndicatorIncludesOption =\n\t| \"navigations\"\n\t| \"submissions\"\n\t| \"revalidations\";\n\ntype GlobalLoadingIndicatorConfig = {\n\tstart: () => void;\n\tstop: () => void;\n\tisRunning: () => boolean;\n\tinclude?: \"all\" | Array<GlobalLoadingIndicatorIncludesOption>;\n\tstartDelayMS?: number;\n\tstopDelayMS?: number;\n};\n\ntype ParsedGlobalLoadingIndicatorConfig = {\n\tincludesAll: boolean;\n\tincludesNavigations: boolean;\n\tincludesSubmissions: boolean;\n\tincludesRevalidations: boolean;\n\tstartDelayMS: number;\n\tstopDelayMS: number;\n};\n\nfunction resolveIncludes(\n\tconfig: GlobalLoadingIndicatorConfig,\n\tincludesOption: GlobalLoadingIndicatorIncludesOption,\n) {\n\tconst isArray = Array.isArray(config.include);\n\treturn isArray && config.include?.includes(includesOption);\n}\n\nexport function setupGlobalLoadingIndicator(\n\tconfig: GlobalLoadingIndicatorConfig,\n) {\n\tlet gliDebounceStartTimer: number | null = null;\n\tlet gliDebounceStopTimer: number | null = null;\n\tconst includesAll = !config.include || config.include === \"all\";\n\tconst pc: ParsedGlobalLoadingIndicatorConfig = {\n\t\tincludesAll,\n\t\tincludesNavigations:\n\t\t\tresolveIncludes(config, \"navigations\") || includesAll,\n\t\tincludesSubmissions:\n\t\t\tresolveIncludes(config, \"submissions\") || includesAll,\n\t\tincludesRevalidations:\n\t\t\tresolveIncludes(config, \"revalidations\") || includesAll,\n\t\tstartDelayMS: config.startDelayMS ?? DEFAULT_DELAY,\n\t\tstopDelayMS: config.stopDelayMS ?? DEFAULT_DELAY,\n\t};\n\tfunction clearStartTimer() {\n\t\tif (gliDebounceStartTimer) {\n\t\t\twindow.clearTimeout(gliDebounceStartTimer);\n\t\t\tgliDebounceStartTimer = null;\n\t\t}\n\t}\n\tfunction clearStopTimer() {\n\t\tif (gliDebounceStopTimer) {\n\t\t\twindow.clearTimeout(gliDebounceStopTimer);\n\t\t\tgliDebounceStopTimer = null;\n\t\t}\n\t}\n\tfunction clearTimers() {\n\t\tclearStartTimer();\n\t\tclearStopTimer();\n\t}\n\tfunction handleStatusChange(e?: StatusEvent) {\n\t\tconst shouldBeWorking = getIsWorking(pc, e);\n\t\tif (shouldBeWorking) {\n\t\t\tclearStopTimer();\n\t\t\tif (!gliDebounceStartTimer) {\n\t\t\t\tgliDebounceStartTimer = window.setTimeout(() => {\n\t\t\t\t\tgliDebounceStartTimer = null;\n\t\t\t\t\tif (!config.isRunning() && getIsWorking(pc)) {\n\t\t\t\t\t\tconfig.start();\n\t\t\t\t\t}\n\t\t\t\t}, pc.startDelayMS);\n\t\t\t}\n\t\t} else {\n\t\t\tclearStartTimer();\n\t\t\tif (!gliDebounceStopTimer) {\n\t\t\t\tgliDebounceStopTimer = window.setTimeout(() => {\n\t\t\t\t\tgliDebounceStopTimer = null;\n\t\t\t\t\tif (config.isRunning() && !getIsWorking(pc)) {\n\t\t\t\t\t\tconfig.stop();\n\t\t\t\t\t}\n\t\t\t\t}, pc.stopDelayMS);\n\t\t\t}\n\t\t}\n\t}\n\thandleStatusChange();\n\tconst removeStatusListenerCallback = addStatusListener(handleStatusChange);\n\treturn () => {\n\t\tremoveStatusListenerCallback();\n\t\tclearTimers();\n\t\tif (config.isRunning()) {\n\t\t\tconfig.stop();\n\t\t}\n\t};\n}\n\nfunction getIsWorking(\n\tpc: ParsedGlobalLoadingIndicatorConfig,\n\te?: StatusEvent,\n): boolean {\n\tconst status = e?.detail ?? getStatus();\n\tif (pc.includesAll) {\n\t\treturn (\n\t\t\tstatus.isNavigating || status.isSubmitting || status.isRevalidating\n\t\t);\n\t}\n\tif (pc.includesNavigations && status.isNavigating) {\n\t\treturn true;\n\t}\n\tif (pc.includesSubmissions && status.isSubmitting) {\n\t\treturn true;\n\t}\n\tif (pc.includesRevalidations && status.isRevalidating) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n", "import { debounce } from \"vorma/kit/debounce\";\nimport { revalidate } from \"../client.ts\";\nimport { setupClientLoaders } from \"../client_loaders.ts\";\nimport { dispatchRouteChangeEvent } from \"../events.ts\";\nimport { logInfo } from \"../utils/logging.ts\";\nimport { __vormaClientGlobal } from \"../vorma_ctx/vorma_ctx.ts\";\n\nlet devTimeSetupClientLoadersDebounced: () => Promise<void> = () =>\n\tPromise.resolve();\n\nlet hmrRevalidateSet: Set<string>;\n\nexport let __runClientLoadersAfterHMRUpdate: (\n\timportMeta: ImportMeta,\n\tpattern: string,\n) => void = () => {};\n\nexport function initHMR() {\n\tif (import.meta.env.DEV) {\n\t\t(window as any).__waveRevalidate = revalidate;\n\n\t\tdevTimeSetupClientLoadersDebounced = debounce(async () => {\n\t\t\tawait setupClientLoaders();\n\t\t\tdispatchRouteChangeEvent({});\n\t\t}, 10);\n\n\t\t__runClientLoadersAfterHMRUpdate = (importMeta, pattern) => {\n\t\t\tif (hmrRevalidateSet === undefined) {\n\t\t\t\thmrRevalidateSet = new Set();\n\t\t\t}\n\n\t\t\tif (import.meta.env.DEV && import.meta.hot) {\n\t\t\t\tconst thisURL = new URL(importMeta.url, location.href);\n\t\t\t\tthisURL.search = \"\";\n\t\t\t\tconst thisPathname = thisURL.pathname;\n\n\t\t\t\tconst alreadyRegistered = hmrRevalidateSet.has(thisPathname);\n\t\t\t\tif (alreadyRegistered) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\thmrRevalidateSet.add(thisPathname);\n\n\t\t\t\timport.meta.hot.on(\"vite:afterUpdate\", (props) => {\n\t\t\t\t\tfor (const update of props.updates) {\n\t\t\t\t\t\tif (update.type === \"js-update\") {\n\t\t\t\t\t\t\tconst updateURL = new URL(\n\t\t\t\t\t\t\t\tupdate.path,\n\t\t\t\t\t\t\t\tlocation.href,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tupdateURL.search = \"\";\n\t\t\t\t\t\t\tif (updateURL.pathname === thisURL.pathname) {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t__vormaClientGlobal\n\t\t\t\t\t\t\t\t\t\t.get(\"matchedPatterns\")\n\t\t\t\t\t\t\t\t\t\t.includes(pattern)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tlogInfo(\n\t\t\t\t\t\t\t\t\t\t\"Refreshing client loaders due to change in pattern:\",\n\t\t\t\t\t\t\t\t\t\tpattern,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tdevTimeSetupClientLoadersDebounced();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}\n}\n", "import {\n\tcreatePatternRegistry,\n\tregisterPattern,\n} from \"vorma/kit/matcher/register\";\nimport { setupClientLoaders } from \"./client_loaders.ts\";\nimport { ComponentLoader } from \"./component_loader.ts\";\nimport { defaultErrorBoundary } from \"./error_boundary.ts\";\nimport { VORMA_HARD_RELOAD_QUERY_PARAM } from \"./hard_reload.ts\";\nimport { HistoryManager } from \"./history/history.ts\";\nimport { initHMR } from \"./hmr/hmr.ts\";\nimport { scrollStateManager } from \"./scroll_state_manager.ts\";\nimport type { VormaAppConfig } from \"./vorma_app_helpers/vorma_app_helpers.ts\";\nimport {\n\t__vormaClientGlobal,\n\ttype RouteErrorComponent,\n\ttype VormaClientGlobal,\n} from \"./vorma_ctx/vorma_ctx.ts\";\n\nexport async function initClient(options: {\n\tvormaAppConfig: VormaAppConfig;\n\trenderFn: () => void;\n\tdefaultErrorBoundary?: RouteErrorComponent;\n\tuseViewTransitions?: boolean;\n}): Promise<void> {\n\tinitHMR();\n\n\t// Setup beforeunload handler for scroll restoration\n\twindow.addEventListener(\"beforeunload\", () => {\n\t\tscrollStateManager.savePageRefreshState();\n\t});\n\n\t__vormaClientGlobal.set(\"vormaAppConfig\", options.vormaAppConfig);\n\tconst clientModuleMap: VormaClientGlobal[\"clientModuleMap\"] = {};\n\n\t// Populate client module map with initial page's modules\n\tconst initialMatchedPatterns =\n\t\t__vormaClientGlobal.get(\"matchedPatterns\") || [];\n\tconst initialImportURLs = __vormaClientGlobal.get(\"importURLs\") || [];\n\tconst initialExportKeys = __vormaClientGlobal.get(\"exportKeys\") || [];\n\tconst initialErrorExportKeys =\n\t\t__vormaClientGlobal.get(\"errorExportKeys\") || [];\n\n\tfor (let i = 0; i < initialMatchedPatterns.length; i++) {\n\t\tconst pattern = initialMatchedPatterns[i];\n\t\tconst importURL = initialImportURLs[i];\n\t\tconst exportKey = initialExportKeys[i];\n\t\tconst errorExportKey = initialErrorExportKeys[i];\n\n\t\tif (pattern && importURL) {\n\t\t\tclientModuleMap[pattern] = {\n\t\t\t\timportURL,\n\t\t\t\texportKey: exportKey || \"default\",\n\t\t\t\terrorExportKey: errorExportKey || \"\",\n\t\t\t};\n\t\t}\n\t}\n\t__vormaClientGlobal.set(\"clientModuleMap\", clientModuleMap);\n\n\tconst patternRegistry = createPatternRegistry({\n\t\tdynamicParamPrefixRune: options.vormaAppConfig.loadersDynamicRune,\n\t\tsplatSegmentRune: options.vormaAppConfig.loadersSplatRune,\n\t\texplicitIndexSegment:\n\t\t\toptions.vormaAppConfig.loadersExplicitIndexSegment,\n\t});\n\t__vormaClientGlobal.set(\"patternRegistry\", patternRegistry);\n\n\tconst manifestURL = __vormaClientGlobal.get(\"routeManifestURL\");\n\tif (manifestURL) {\n\t\tfetch(manifestURL)\n\t\t\t.then((response) => response.json())\n\t\t\t.then((manifest) => {\n\t\t\t\t__vormaClientGlobal.set(\"routeManifest\", manifest);\n\n\t\t\t\t// Register all patterns from manifest into the existing registry\n\t\t\t\tfor (const pattern of Object.keys(manifest)) {\n\t\t\t\t\tregisterPattern(patternRegistry, pattern);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\t// This is no biggie -- it's a progressive enhancement\n\t\t\t\tconsole.warn(\"Failed to load route manifest:\", error);\n\t\t\t});\n\t}\n\n\t// Set options\n\tif (options.defaultErrorBoundary) {\n\t\t__vormaClientGlobal.set(\n\t\t\t\"defaultErrorBoundary\",\n\t\t\toptions.defaultErrorBoundary,\n\t\t);\n\t} else {\n\t\t__vormaClientGlobal.set(\"defaultErrorBoundary\", defaultErrorBoundary);\n\t}\n\n\tif (options.useViewTransitions) {\n\t\t__vormaClientGlobal.set(\"useViewTransitions\", true);\n\t}\n\n\t// Initialize history\n\tHistoryManager.init();\n\n\t// Clean URL\n\tconst url = new URL(window.location.href);\n\tif (url.searchParams.has(VORMA_HARD_RELOAD_QUERY_PARAM)) {\n\t\turl.searchParams.delete(VORMA_HARD_RELOAD_QUERY_PARAM);\n\t\tHistoryManager.getInstance().replace(url.href);\n\t}\n\n\tconst importURLs = __vormaClientGlobal.get(\"importURLs\");\n\n\t// Load initial components\n\tawait ComponentLoader.handleComponents(importURLs);\n\n\t// Setup client loaders\n\tawait setupClientLoaders();\n\n\t// Handle error boundary component (must come after setupClientLoaders)\n\tawait ComponentLoader.handleErrorBoundaryComponent(importURLs);\n\n\t// Render\n\toptions.renderFn();\n\n\t// Restore scroll\n\tscrollStateManager.restorePageRefreshState();\n\n\t// Touch detection\n\twindow.addEventListener(\n\t\t\"touchstart\",\n\t\t() => {\n\t\t\t__vormaClientGlobal.set(\"isTouchDevice\", true);\n\t\t},\n\t\t{ once: true },\n\t);\n}\n", "import { getAnchorDetailsFromEvent, getHrefDetails } from \"vorma/kit/url\";\nimport { navigationStateManager, vormaNavigate } from \"./client.ts\";\nimport { effectuateRedirectDataResult } from \"./redirects/redirects.ts\";\nimport { saveScrollState } from \"./scroll_state_manager.ts\";\n\ntype LinkOnClickCallback<E extends Event> = (event: E) => void | Promise<void>;\n\ntype LinkOnClickCallbacks<E extends Event> = {\n\tbeforeBegin?: LinkOnClickCallback<E>;\n\tbeforeRender?: LinkOnClickCallback<E>;\n\tafterRender?: LinkOnClickCallback<E>;\n};\n\ntype GetPrefetchHandlersInput<E extends Event> = LinkOnClickCallbacks<E> & {\n\thref: string;\n\tdelayMs?: number;\n\tscrollToTop?: boolean;\n\treplace?: boolean;\n\tsearch?: string;\n\thash?: string;\n\tstate?: unknown;\n};\n\nexport function __getPrefetchHandlers<E extends Event>(\n\tinput: GetPrefetchHandlersInput<E>,\n) {\n\tconst hrefDetails = getHrefDetails(input.href);\n\tif (!hrefDetails.isHTTP) {\n\t\treturn;\n\t}\n\n\t// TypeScript type guard -- after this check, we know relativeURL exists\n\tconst { relativeURL } = hrefDetails;\n\tif (!relativeURL || hrefDetails.isExternal) {\n\t\treturn;\n\t}\n\n\tlet timer: number | undefined;\n\tlet prefetchStarted = false;\n\tconst delayMs = input.delayMs ?? 100;\n\n\tasync function prefetch(e: E): Promise<void> {\n\t\tif (prefetchStarted) return;\n\t\tprefetchStarted = true;\n\n\t\tif (input.beforeBegin) {\n\t\t\tawait input.beforeBegin(e);\n\t\t}\n\n\t\tconst fullUrl = new URL(relativeURL, window.location.href);\n\t\tif (input.search !== undefined) fullUrl.search = input.search;\n\t\tif (input.hash !== undefined) fullUrl.hash = input.hash;\n\n\t\t// Use the navigation system\n\t\tawait navigationStateManager.navigate({\n\t\t\thref: fullUrl.href,\n\t\t\tnavigationType: \"prefetch\",\n\t\t\tstate: input.state,\n\t\t});\n\t}\n\n\tfunction start(e: E): void {\n\t\tif (prefetchStarted) return;\n\t\ttimer = window.setTimeout(() => prefetch(e), delayMs);\n\t}\n\n\tfunction stop(): void {\n\t\tif (timer) {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = undefined;\n\t\t}\n\n\t\t// Abort prefetch if it exists and hasn't been upgraded\n\t\tconst targetUrl = new URL(relativeURL, window.location.href).href;\n\t\tconst nav = navigationStateManager.getNavigation(targetUrl);\n\t\tif (nav && nav.type === \"prefetch\" && nav.intent === \"none\") {\n\t\t\tnav.control.abortController?.abort();\n\t\t\tnavigationStateManager.removeNavigation(targetUrl);\n\t\t}\n\n\t\tprefetchStarted = false;\n\t}\n\n\tasync function onClick(e: E): Promise<void> {\n\t\tif (e.defaultPrevented) return;\n\n\t\tconst anchorDetails = getAnchorDetailsFromEvent(\n\t\t\te as unknown as MouseEvent,\n\t\t);\n\t\tif (!anchorDetails) return;\n\n\t\tconst { isEligibleForDefaultPrevention, isInternal } = anchorDetails;\n\t\tif (!isEligibleForDefaultPrevention || !isInternal) return;\n\n\t\tif (isJustAHashChange(anchorDetails)) {\n\t\t\tsaveScrollState();\n\t\t\treturn;\n\t\t}\n\n\t\te.preventDefault();\n\n\t\tif (timer) {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = undefined;\n\t\t}\n\n\t\t// Execute callbacks\n\t\tif (input.beforeBegin && !prefetchStarted) {\n\t\t\tawait input.beforeBegin(e);\n\t\t}\n\n\t\tif (input.beforeRender) {\n\t\t\tawait input.beforeRender(e);\n\t\t}\n\n\t\t// Use standard navigation -- it will upgrade the prefetch if it exists\n\t\tawait vormaNavigate(relativeURL, {\n\t\t\tscrollToTop: input.scrollToTop,\n\t\t\treplace: input.replace,\n\t\t\tsearch: input.search,\n\t\t\thash: input.hash,\n\t\t\tstate: input.state,\n\t\t});\n\n\t\tif (input.afterRender) {\n\t\t\tawait input.afterRender(e);\n\t\t}\n\t}\n\n\treturn {\n\t\t...hrefDetails,\n\t\tstart,\n\t\tstop,\n\t\tonClick,\n\t};\n}\n\nexport function __makeLinkOnClickFn<E extends Event>(\n\tcallbacks: LinkOnClickCallbacks<E> & {\n\t\tscrollToTop?: boolean;\n\t\treplace?: boolean;\n\t\tstate?: unknown;\n\t},\n) {\n\treturn async (e: E) => {\n\t\tif (e.defaultPrevented) return;\n\n\t\tconst anchorDetails = getAnchorDetailsFromEvent(\n\t\t\te as unknown as MouseEvent,\n\t\t);\n\t\tif (!anchorDetails) return;\n\n\t\tconst { anchor, isEligibleForDefaultPrevention, isInternal } =\n\t\t\tanchorDetails;\n\t\tif (!anchor) return;\n\n\t\tif (isJustAHashChange(anchorDetails)) {\n\t\t\tsaveScrollState();\n\t\t\treturn;\n\t\t}\n\n\t\tif (isEligibleForDefaultPrevention && isInternal) {\n\t\t\te.preventDefault();\n\n\t\t\tawait callbacks.beforeBegin?.(e);\n\n\t\t\tconst control = navigationStateManager.beginNavigation({\n\t\t\t\thref: anchor.href,\n\t\t\t\tnavigationType: \"userNavigation\",\n\t\t\t\tscrollToTop: callbacks.scrollToTop,\n\t\t\t\treplace: callbacks.replace,\n\t\t\t\tstate: callbacks.state,\n\t\t\t});\n\n\t\t\tif (!control.promise) return;\n\n\t\t\tconst outcome = await control.promise;\n\t\t\tconst targetUrl = new URL(anchor.href, window.location.href).href;\n\n\t\t\t// Handle outcome based on type (discriminated union)\n\t\t\tswitch (outcome.type) {\n\t\t\t\tcase \"aborted\":\n\t\t\t\t\t// Navigation was aborted - clean up to prevent stuck loading indicator\n\t\t\t\t\tnavigationStateManager.removeNavigation(targetUrl);\n\t\t\t\t\treturn;\n\n\t\t\t\tcase \"redirect\": {\n\t\t\t\t\t// Call beforeRender while entry still exists (consistent with success case)\n\t\t\t\t\tawait callbacks.beforeRender?.(e);\n\n\t\t\t\t\t// Clean up before redirect to prevent race conditions\n\t\t\t\t\tnavigationStateManager.removeNavigation(targetUrl);\n\n\t\t\t\t\t// Effectuate the redirect\n\t\t\t\t\tawait effectuateRedirectDataResult(\n\t\t\t\t\t\toutcome.redirectData,\n\t\t\t\t\t\toutcome.props.redirectCount || 0,\n\t\t\t\t\t\toutcome.props,\n\t\t\t\t\t);\n\n\t\t\t\t\t// Call afterRender after redirect effectuation\n\t\t\t\t\tawait callbacks.afterRender?.(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcase \"success\": {\n\t\t\t\t\t// Call beforeRender before processing (matches original behavior)\n\t\t\t\t\tawait callbacks.beforeRender?.(e);\n\n\t\t\t\t\t// Process the successful navigation if entry still exists\n\t\t\t\t\tconst entry =\n\t\t\t\t\t\tnavigationStateManager.getNavigation(targetUrl);\n\t\t\t\t\tif (entry) {\n\t\t\t\t\t\tawait navigationStateManager.processSuccessfulNavigation(\n\t\t\t\t\t\t\toutcome,\n\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call afterRender after processing (matches original behavior)\n\t\t\t\t\tawait callbacks.afterRender?.(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\t// Exhaustiveness check\n\t\t\t\t\tconst _exhaustive: never = outcome;\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Unexpected outcome type: ${(_exhaustive as any).type}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\nfunction isJustAHashChange(\n\tanchorDetails: ReturnType<typeof getAnchorDetailsFromEvent>,\n): boolean {\n\tif (!anchorDetails) return false;\n\n\tconst { pathname, search, hash } = new URL(\n\t\tanchorDetails.anchor.href,\n\t\twindow.location.href,\n\t);\n\n\treturn !!(\n\t\thash &&\n\t\tpathname === window.location.pathname &&\n\t\tsearch === window.location.search\n\t);\n}\n", "// Used by client route defs file (e.g., vorma.routes.ts)\n\ntype ImportPromise = Promise<Record<string, any>>;\ntype Key<T extends ImportPromise> = keyof Awaited<T>;\n\n/**\n * Registers a route with the given route pattern,\n * module import promise, component export key, and\n * optional error boundary export key. Only for use\n * in your centralized build-time route definitions\n * file.\n */\nexport function route<IP extends ImportPromise>(\n\t// oxlint-disable-next-line no-unused-vars\n\tpattern: string,\n\t// oxlint-disable-next-line no-unused-vars\n\timportPromise: IP,\n\t// oxlint-disable-next-line no-unused-vars\n\tcomponentKey: Key<IP>,\n\t// oxlint-disable-next-line no-unused-vars\n\terrorBoundaryKey?: Key<IP>,\n): void {}\n", "import { serializeToSearchParams } from \"vorma/kit/json\";\nimport type { SubmitOptions } from \"../client.ts\";\n\nexport type VormaAppConfig = {\n\tactionsRouterMountRoot: string;\n\tactionsDynamicRune: string;\n\tactionsSplatRune: string;\n\tloadersDynamicRune: string;\n\tloadersSplatRune: string;\n\tloadersExplicitIndexSegment: string;\n\t__phantom?: any;\n};\n\nexport type VormaAppBase = {\n\troutes: readonly any[];\n\tappConfig: VormaAppConfig;\n\trootData: any;\n};\n\nexport type ExtractApp<C extends VormaAppConfig> = C[\"__phantom\"];\n\ntype RouteByType<App extends VormaAppBase, T extends string> = Extract<\n\tApp[\"routes\"][number],\n\t{ _type: T }\n>;\n\ntype RouteByPattern<Routes, P> = Extract<Routes, { pattern: P }>;\n\ntype VormaLoader<App extends VormaAppBase> = RouteByType<App, \"loader\">;\ntype VormaQuery<App extends VormaAppBase> = RouteByType<App, \"query\">;\ntype VormaMutation<App extends VormaAppBase> = RouteByType<App, \"mutation\">;\n\n// Pattern types\nexport type VormaLoaderPattern<App extends VormaAppBase> =\n\tVormaLoader<App>[\"pattern\"];\nexport type VormaQueryPattern<App extends VormaAppBase> =\n\tVormaQuery<App>[\"pattern\"];\nexport type VormaMutationPattern<App extends VormaAppBase> =\n\tVormaMutation<App>[\"pattern\"];\n\n// IO types\nexport type VormaLoaderOutput<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> =\n\tRouteByPattern<VormaLoader<App>, P> extends { phantomOutputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaQueryInput<\n\tApp extends VormaAppBase,\n\tP extends VormaQueryPattern<App>,\n> =\n\tRouteByPattern<VormaQuery<App>, P> extends { phantomInputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaQueryOutput<\n\tApp extends VormaAppBase,\n\tP extends VormaQueryPattern<App>,\n> =\n\tRouteByPattern<VormaQuery<App>, P> extends { phantomOutputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaMutationInput<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> =\n\tRouteByPattern<VormaMutation<App>, P> extends { phantomInputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaMutationOutput<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> =\n\tRouteByPattern<VormaMutation<App>, P> extends { phantomOutputType: infer T }\n\t\t? T\n\t\t: null | undefined;\n\nexport type VormaMutationMethod<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> =\n\tRouteByPattern<VormaMutation<App>, P> extends { method: infer M }\n\t\t? M extends string\n\t\t\t? M\n\t\t\t: \"POST\"\n\t\t: \"POST\";\n\n// Route metadata\ntype RouteMetadata<App extends VormaAppBase, P extends string> = Extract<\n\tApp[\"routes\"][number],\n\t{ pattern: P }\n>;\n\nexport type GetParams<App extends VormaAppBase, P extends string> =\n\tRouteMetadata<App, P> extends { params: ReadonlyArray<infer Params> }\n\t\t? Params extends string\n\t\t\t? Params\n\t\t\t: never\n\t\t: never;\n\nexport type VormaRouteParams<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = GetParams<App, P>;\n\nexport type HasParams<App extends VormaAppBase, P extends string> =\n\tGetParams<App, P> extends never ? false : true;\n\nexport type IsSplat<App extends VormaAppBase, P extends string> =\n\tRouteMetadata<App, P> extends { isSplat: true } ? true : false;\n\nexport type IsEmptyInput<T> = [T] extends [null | undefined | never]\n\t? true\n\t: false;\n\n// Pattern-based props composition\ntype ConditionalParams<App extends VormaAppBase, P extends string> =\n\tHasParams<App, P> extends true\n\t\t? { params: { [K in GetParams<App, P>]: string } }\n\t\t: {};\n\ntype ConditionalSplat<App extends VormaAppBase, P extends string> =\n\tIsSplat<App, P> extends true ? { splatValues: Array<string> } : {};\n\nexport type PatternBasedProps<App extends VormaAppBase, P extends string> = {\n\tpattern: P;\n} & ConditionalParams<App, P> &\n\tConditionalSplat<App, P>;\n\nexport type PermissivePatternBasedProps<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = {\n\tpattern: PermissiveLoaderPattern<App, P>;\n} & ConditionalParams<App, P> &\n\tConditionalSplat<App, P>;\n\ntype PermissiveLoaderPattern<\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = P extends `${infer Prefix}/${App[\"appConfig\"][\"loadersExplicitIndexSegment\"]}`\n\t? P | (Prefix extends \"\" ? \"/\" : Prefix)\n\t: P;\n\nexport type VormaRoutePropsGeneric<\n\tJSXElement,\n\tApp extends VormaAppBase,\n\tP extends VormaLoaderPattern<App>,\n> = {\n\tidx: number;\n\tOutlet: (props: Record<string, any>) => JSXElement;\n\t__phantom_pattern: P;\n} & Record<string, any>;\n\n/////////////////////////////////////////////////////////////////////\n/////// API CLIENT HELPERS\n/////////////////////////////////////////////////////////////////////\n\ntype Props = PatternBasedProps<any, string> & {\n\toptions?: SubmitOptions;\n\trequestInit?: RequestInit;\n\tinput?: any;\n};\n\ntype APIClientHelperOpts = {\n\tvormaAppConfig: VormaAppConfig;\n\ttype: \"loader\" | \"query\" | \"mutation\";\n\tprops: Props;\n};\n\nexport type VormaQueryProps<\n\tApp extends VormaAppBase,\n\tP extends VormaQueryPattern<App>,\n> = (PatternBasedProps<App, P> & {\n\toptions?: SubmitOptions;\n\trequestInit?: Omit<RequestInit, \"method\"> & { method?: \"GET\" };\n}) &\n\t(IsEmptyInput<VormaQueryInput<App, P>> extends true\n\t\t? { input?: VormaQueryInput<App, P> }\n\t\t: { input: VormaQueryInput<App, P> });\n\nexport type VormaMutationProps<\n\tApp extends VormaAppBase,\n\tP extends VormaMutationPattern<App>,\n> = PatternBasedProps<App, P> & {\n\toptions?: SubmitOptions;\n} & (VormaMutationMethod<App, P> extends \"POST\"\n\t\t? { requestInit?: Omit<RequestInit, \"method\"> & { method?: \"POST\" } }\n\t\t: {\n\t\t\t\trequestInit: RequestInit & {\n\t\t\t\t\tmethod: VormaMutationMethod<App, P>;\n\t\t\t\t};\n\t\t\t}) &\n\t(IsEmptyInput<VormaMutationInput<App, P>> extends true\n\t\t? { input?: VormaMutationInput<App, P> }\n\t\t: { input: VormaMutationInput<App, P> });\n\nexport function buildQueryURL(\n\tvormaAppConfig: VormaAppConfig,\n\tprops: Props,\n): URL {\n\treturn buildURL({ vormaAppConfig, props, type: \"query\" });\n}\n\nexport function buildMutationURL(\n\tvormaAppConfig: VormaAppConfig,\n\tprops: Props,\n): URL {\n\treturn buildURL({ vormaAppConfig, props, type: \"mutation\" });\n}\n\nexport function resolveBody(props: Props): BodyInit | null | undefined {\n\tconst { input } = props;\n\tif (\n\t\tinput == null ||\n\t\ttypeof input === \"string\" ||\n\t\tinput instanceof Blob ||\n\t\tinput instanceof FormData ||\n\t\tinput instanceof URLSearchParams ||\n\t\tinput instanceof ReadableStream ||\n\t\tinput instanceof ArrayBuffer ||\n\t\tArrayBuffer.isView(input)\n\t) {\n\t\treturn input;\n\t}\n\treturn JSON.stringify(input);\n}\n\nfunction buildURL(opts: APIClientHelperOpts): URL {\n\tconst base_path = stripTrailingSlash(\n\t\topts.vormaAppConfig.actionsRouterMountRoot,\n\t);\n\tconst resolved_path = __resolvePath(opts);\n\tconst url = new URL(base_path + resolved_path, getCurrentOrigin());\n\n\tif (opts.type === \"query\" && opts.props.input) {\n\t\turl.search = serializeToSearchParams(opts.props.input).toString();\n\t}\n\n\treturn url;\n}\n\nexport function __resolvePath(opts: APIClientHelperOpts): string {\n\tconst { props, vormaAppConfig } = opts;\n\tlet path = props.pattern;\n\n\tlet dynamicParamPrefixRune = vormaAppConfig.actionsDynamicRune;\n\tlet splatSegmentRune = vormaAppConfig.actionsSplatRune;\n\n\tif (opts.type === \"loader\") {\n\t\tdynamicParamPrefixRune = vormaAppConfig.loadersDynamicRune;\n\t\tsplatSegmentRune = vormaAppConfig.loadersSplatRune;\n\t}\n\n\tif (\"params\" in props && props.params) {\n\t\tfor (const [key, value] of Object.entries(props.params)) {\n\t\t\tpath = path.replace(\n\t\t\t\t`${dynamicParamPrefixRune}${key}`,\n\t\t\t\tString(value),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (\"splatValues\" in props && props.splatValues) {\n\t\tconst splatPath = (props.splatValues as Array<string>).join(\"/\");\n\t\tpath = path.replace(splatSegmentRune, splatPath);\n\t}\n\n\t// Strip explicit index segment\n\tif (opts.type === \"loader\" && vormaAppConfig.loadersExplicitIndexSegment) {\n\t\tconst indexSegment = `/${vormaAppConfig.loadersExplicitIndexSegment}`;\n\t\tif (path.endsWith(indexSegment)) {\n\t\t\tpath = path.slice(0, -indexSegment.length) || \"/\";\n\t\t}\n\t}\n\n\treturn path;\n}\n\nfunction getCurrentOrigin(): string {\n\treturn new URL(window.location.href).origin;\n}\n\nfunction stripTrailingSlash(path: string): string {\n\treturn path.endsWith(\"/\") ? path.slice(0, -1) : path;\n}\n", "import { __getPrefetchHandlers, __makeLinkOnClickFn } from \"../links.ts\";\nimport { __resolvePath } from \"../vorma_app_helpers/vorma_app_helpers.ts\";\nimport { __vormaClientGlobal } from \"../vorma_ctx/vorma_ctx.ts\";\n\nexport type VormaLinkPropsBase<LinkOnClickCallback> = {\n\thref?: string;\n\tprefetch?: \"intent\";\n\tprefetchDelayMs?: number;\n\tbeforeBegin?: LinkOnClickCallback;\n\tbeforeRender?: LinkOnClickCallback;\n\tafterRender?: LinkOnClickCallback;\n\tscrollToTop?: boolean;\n\treplace?: boolean;\n\tstate?: unknown;\n};\n\nfunction linkPropsToPrefetchObj<LinkOnClickCallback>(\n\tprops: VormaLinkPropsBase<LinkOnClickCallback>,\n) {\n\tif (!props.href || props.prefetch !== \"intent\") {\n\t\treturn undefined;\n\t}\n\n\treturn __getPrefetchHandlers({\n\t\thref: props.href,\n\t\tdelayMs: props.prefetchDelayMs,\n\t\tbeforeBegin: props.beforeBegin as any,\n\t\tbeforeRender: props.beforeRender as any,\n\t\tafterRender: props.afterRender as any,\n\t\tscrollToTop: props.scrollToTop,\n\t\treplace: props.replace,\n\t\tstate: props.state,\n\t});\n}\n\nfunction linkPropsToOnClickFn<LinkOnClickCallback>(\n\tprops: VormaLinkPropsBase<LinkOnClickCallback>,\n) {\n\treturn __makeLinkOnClickFn({\n\t\tbeforeBegin: props.beforeBegin as any,\n\t\tbeforeRender: props.beforeRender as any,\n\t\tafterRender: props.afterRender as any,\n\t\tscrollToTop: props.scrollToTop,\n\t\treplace: props.replace,\n\t\tstate: props.state,\n\t});\n}\n\ntype handlerKeys = {\n\tonPointerEnter: string;\n\tonFocus: string;\n\tonPointerLeave: string;\n\tonBlur: string;\n\tonTouchCancel: string;\n\tonClick: string;\n};\n\nconst standardCamelHandlerKeys = {\n\tonPointerEnter: \"onPointerEnter\",\n\tonFocus: \"onFocus\",\n\tonPointerLeave: \"onPointerLeave\",\n\tonBlur: \"onBlur\",\n\tonTouchCancel: \"onTouchCancel\",\n\tonClick: \"onClick\",\n} satisfies handlerKeys;\n\nexport function __makeFinalLinkProps<LinkOnClickCallback>(\n\tprops: VormaLinkPropsBase<LinkOnClickCallback>,\n\tkeys: {\n\t\tonPointerEnter: string;\n\t\tonFocus: string;\n\t\tonPointerLeave: string;\n\t\tonBlur: string;\n\t\tonTouchCancel: string;\n\t\tonClick: string;\n\t} = standardCamelHandlerKeys,\n) {\n\tconst prefetchObj = linkPropsToPrefetchObj(props);\n\n\treturn {\n\t\tdataExternal: prefetchObj?.isExternal || undefined,\n\t\tonPointerEnter: (e: any) => {\n\t\t\tprefetchObj?.start(e);\n\t\t\tif (isFn((props as any)[keys.onPointerEnter])) {\n\t\t\t\t(props as any)[keys.onPointerEnter](e);\n\t\t\t}\n\t\t},\n\t\tonFocus: (e: any) => {\n\t\t\tprefetchObj?.start(e);\n\t\t\tif (isFn((props as any)[keys.onFocus])) {\n\t\t\t\t(props as any)[keys.onFocus](e);\n\t\t\t}\n\t\t},\n\t\tonPointerLeave: (e: any) => {\n\t\t\t// we don't want to stop on a touch device, because this triggers\n\t\t\t// even when the user \"clicks\" on the link for some reason\n\t\t\tif (!__vormaClientGlobal.get(\"isTouchDevice\")) {\n\t\t\t\tprefetchObj?.stop();\n\t\t\t}\n\t\t\tif (isFn((props as any)[keys.onPointerLeave])) {\n\t\t\t\t(props as any)[keys.onPointerLeave](e);\n\t\t\t}\n\t\t},\n\t\tonBlur: (e: any) => {\n\t\t\tprefetchObj?.stop();\n\t\t\tif (isFn((props as any)[keys.onBlur])) {\n\t\t\t\t(props as any)[keys.onBlur](e);\n\t\t\t}\n\t\t},\n\t\tonTouchCancel: (e: any) => {\n\t\t\tprefetchObj?.stop();\n\t\t\tif (isFn((props as any)[keys.onTouchCancel])) {\n\t\t\t\t(props as any)[keys.onTouchCancel](e);\n\t\t\t}\n\t\t},\n\t\tonClick: async (e: any) => {\n\t\t\tif (isFn((props as any)[keys.onClick])) {\n\t\t\t\t(props as any)[keys.onClick](e);\n\t\t\t}\n\t\t\tif (prefetchObj) {\n\t\t\t\tawait prefetchObj.onClick(e);\n\t\t\t} else {\n\t\t\t\tawait linkPropsToOnClickFn(props)(e);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction isFn(fn: any): fn is (...args: Array<any>) => any {\n\treturn typeof fn === \"function\";\n}\n", "import { vormaNavigate } from \"../client.ts\";\nimport {\n\t__resolvePath,\n\ttype ExtractApp,\n\ttype PermissivePatternBasedProps,\n\ttype VormaAppBase,\n\ttype VormaAppConfig,\n\ttype VormaLoaderPattern,\n} from \"../vorma_app_helpers/vorma_app_helpers.ts\";\nimport { __vormaClientGlobal } from \"../vorma_ctx/vorma_ctx.ts\";\n\ntype TypedNavigateOptions<\n\tApp extends VormaAppBase,\n\tPattern extends VormaLoaderPattern<App>,\n> = PermissivePatternBasedProps<App, Pattern> & {\n\treplace?: boolean;\n\tscrollToTop?: boolean;\n\tsearch?: string;\n\thash?: string;\n\tstate?: unknown;\n};\n\nexport function makeTypedNavigate<C extends VormaAppConfig>(vormaAppConfig: C) {\n\ttype App = ExtractApp<C>;\n\n\treturn async function typedNavigate<\n\t\tPattern extends VormaLoaderPattern<App>,\n\t>(options: TypedNavigateOptions<App, Pattern>): Promise<void> {\n\t\tconst {\n\t\t\tpattern,\n\t\t\tparams,\n\t\t\tsplatValues,\n\t\t\treplace,\n\t\t\tscrollToTop,\n\t\t\tsearch,\n\t\t\thash,\n\t\t\tstate,\n\t\t} = options as any;\n\n\t\tconst href = __resolvePath({\n\t\t\tvormaAppConfig,\n\t\t\ttype: \"loader\",\n\t\t\tprops: {\n\t\t\t\tpattern,\n\t\t\t\t...(params && { params }),\n\t\t\t\t...(splatValues && { splatValues }),\n\t\t\t},\n\t\t});\n\n\t\treturn vormaNavigate(href, {\n\t\t\treplace,\n\t\t\tscrollToTop,\n\t\t\tsearch,\n\t\t\thash,\n\t\t\tstate,\n\t\t});\n\t};\n}\n", "import { addOnWindowFocusListener } from \"vorma/kit/listeners\";\nimport {\n\tgetLastTriggeredNavOrRevalidateTimestampMS,\n\tgetStatus,\n\trevalidate,\n} from \"../client.ts\";\n\n/**\n * If called, will setup listeners to revalidate the current route when\n * the window regains focus and at least `staleTimeMS` has passed since\n * the last revalidation. The `staleTimeMS` option defaults to 5,000\n * (5 seconds). Returns a cleanup function.\n */\nexport function revalidateOnWindowFocus(options?: { staleTimeMS?: number }) {\n\tconst staleTimeMS = options?.staleTimeMS ?? 5_000;\n\treturn addOnWindowFocusListener(() => {\n\t\tconst status = getStatus();\n\t\tif (\n\t\t\t!status.isNavigating &&\n\t\t\t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A,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI;AAEJ,UAAM,OAAO,cAAc;AAAA,MAC1B;AAAA,MACA,MAAM;AAAA,MACN,OAAO;AAAA,QACN;AAAA,QACA,GAAI,UAAU,EAAE,OAAO;AAAA,QACvB,GAAI,eAAe,EAAE,YAAY;AAAA,MAClC;AAAA,IACD,CAAC;AAED,WAAO,cAAc,MAAM;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAAA,EACF;AACD;;;ACzDA,SAAS,gCAAgC;AAalC,SAAS,wBAAwB,SAAoC;AAC3E,QAAM,cAAc,SAAS,eAAe;AAC5C,SAAO,yBAAyB,MAAM;AACrC,UAAM,SAAS,UAAU;AACzB,QACC,CAAC,OAAO,gBACR,CAAC,OAAO,gBACR,CAAC,OAAO,gBACP;AACD,UACC,KAAK,IAAI,IAAI,2CAA2C,IACxD,aACC;AACD;AAAA,MACD;AACA,iBAAW;AAAA,IACZ;AAAA,EACD,CAAC;AACF;",
6
+ "names": ["jsonDeepEquals", "findNestedMatches", "getIsGETRequest", "i", "Action", "window", "location", "index", "action", "history", "location", "location", "newURL", "hrefDetails", "history", "jsonDeepEquals", "findNestedMatches", "json", "response", "buildID", "getIsGETRequest", "debounce", "debounce", "registerPattern", "registerPattern", "getHrefDetails", "getHrefDetails"]
7
7
  }