@absolutejs/absolute 0.20.0-beta.170 → 0.20.0-beta.172
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.
- package/CHANGELOG.md +62 -0
- package/README.md +33 -4
- package/changelog.json +128 -0
- package/dist/angular/browser.js +2 -2
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/constants.js +1 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +2 -2
- package/dist/angular/components/core/streamingSlotRegistry.js +3 -3
- package/dist/angular/index.js +184 -29
- package/dist/angular/index.js.map +15 -14
- package/dist/angular/server.js +184 -29
- package/dist/angular/server.js.map +15 -14
- package/dist/build.js +1241 -853
- package/dist/build.js.map +32 -30
- package/dist/cli/{add-6a7pjkn9.js → add-ae6mg79m.js} +10 -10
- package/dist/cli/{analyze-606fshwa.js → analyze-e57zz9x8.js} +3 -3
- package/dist/cli/{androidEmulatorController-68jjdxmx.js → androidEmulatorController-vqc5m2rp.js} +6 -6
- package/dist/cli/{androidNativeWatcher-x032x9yr.js → androidNativeWatcher-s03aczxv.js} +6 -6
- package/dist/cli/{api-mshjr4ah.js → api-8ppxw487.js} +8 -8
- package/dist/cli/{build-g81xqbb9.js → build-fz7qbdn3.js} +3 -3
- package/dist/cli/{buildDepVendor-29d8v9cx.js → buildDepVendor-qvsh6dsj.js} +7 -3
- package/dist/cli/{compile-9y1w9zpj.js → compile-ndc36zna.js} +10 -7
- package/dist/cli/config/server.js +36 -6
- package/dist/cli/{db-5b4s1kvx.js → db-qbzjw3en.js} +2 -2
- package/dist/cli/{dev-hyeb89hp.js → dev-x49583aj.js} +43 -15
- package/dist/cli/{doctor-h55y9hj1.js → doctor-repprx92.js} +42 -12
- package/dist/cli/{emulatorDoctor-p3yt7140.js → emulatorDoctor-s1z5tkp7.js} +5 -5
- package/dist/cli/{emulatorInstaller-4pm2kx9w.js → emulatorInstaller-pgkdswvq.js} +6 -6
- package/dist/cli/{env-snb0597q.js → env-5nz1qm8e.js} +3 -3
- package/dist/cli/{expoDevController-0vj8dvkh.js → expoDevController-018anvbm.js} +6 -6
- package/dist/cli/{generate-20x1pkf7.js → generate-brvjesd6.js} +8 -8
- package/dist/cli/{heapDiff-wqj8vrq8.js → heapDiff-kncvdtn8.js} +3 -3
- package/dist/cli/htmx/htmx.min.js +1 -1
- package/dist/cli/{htmx-6mz2h7k1.js → htmx-5twhjz7p.js} +7 -7
- package/dist/cli/{index-w09fzs9f.js → index-0z5fgb80.js} +1 -1
- package/dist/cli/{index-exfkpjja.js → index-125cfzvn.js} +2 -2
- package/dist/cli/{index-32ge2w1f.js → index-25e7k849.js} +16 -8
- package/dist/cli/{index-ys2rzqhg.js → index-2shf4aya.js} +1 -1
- package/dist/cli/{index-74m7kh8c.js → index-3ewt17wm.js} +1 -1
- package/dist/cli/{index-zd3cna19.js → index-3sfcmb49.js} +1 -1
- package/dist/cli/{index-14fbvz34.js → index-50ag35xg.js} +2 -2
- package/dist/cli/{index-h5qx5jpk.js → index-7854xf0m.js} +1 -1
- package/dist/cli/{index-3y57kd7x.js → index-8khbn8qr.js} +3 -3
- package/dist/cli/{index-xw1byvzp.js → index-9djrap79.js} +1 -1
- package/dist/cli/{index-ppphkyps.js → index-a6xx0p9e.js} +1 -1
- package/dist/cli/{index-g4ehq6ev.js → index-aemhvvwb.js} +1 -1
- package/dist/cli/{index-z6f43b20.js → index-b1wht4q5.js} +1 -1
- package/dist/cli/{index-s3xvccq3.js → index-btp4fyf1.js} +2 -2
- package/dist/cli/{index-066qhc6n.js → index-cgmp9d02.js} +1 -1
- package/dist/cli/{index-3wz3mktm.js → index-gyjxrnnz.js} +1 -1
- package/dist/cli/index-jwfambwe.js +13 -0
- package/dist/cli/{index-3wm8p7rg.js → index-n6faa3m3.js} +1 -1
- package/dist/cli/{index-kye08pjx.js → index-pr1skxen.js} +1 -1
- package/dist/cli/{index-t8cf0zj9.js → index-prza6tkp.js} +3 -3
- package/dist/cli/{index-qbrzvmh9.js → index-q3snnhyd.js} +1 -1
- package/dist/cli/{index-3vmc30gf.js → index-rz56x932.js} +1 -1
- package/dist/cli/{index-9sksd8c8.js → index-vh68jb0e.js} +2 -2
- package/dist/cli/index.js +32 -32
- package/dist/cli/{info-mn125212.js → info-k124sh7g.js} +4 -4
- package/dist/cli/{inspect-c7s117j0.js → inspect-n6pcfvfw.js} +5 -5
- package/dist/cli/{iosNativeWatcher-0nm6qad5.js → iosNativeWatcher-wdq2fvj1.js} +7 -7
- package/dist/cli/{iosSimulatorController-hza2c3rv.js → iosSimulatorController-n97dpa8p.js} +7 -7
- package/dist/cli/{islands-dc54e5y1.js → islands-p4vgx7a2.js} +3 -3
- package/dist/cli/{logs-ej1add2b.js → logs-shg23fbt.js} +3 -3
- package/dist/cli/{ls-b6zz24nt.js → ls-0hfx323m.js} +3 -3
- package/dist/cli/{mem-5q7n3ymb.js → mem-16sy1707.js} +5 -5
- package/dist/cli/{migrate-6nm4kdf6.js → migrate-k91k050s.js} +2 -2
- package/dist/cli/{mobile-ajnnvqtv.js → mobile-nqdkk3gd.js} +13 -13
- package/dist/cli/prerender-010z771p.js +10 -0
- package/dist/cli/{prettier-phdtvqef.js → prettier-dh5fh786.js} +1 -1
- package/dist/cli/{ps-ezmzyscn.js → ps-pk7ncjac.js} +6 -6
- package/dist/cli/{psTui-3x3ykjve.js → psTui-50wf0b72.js} +7 -7
- package/dist/cli/{remoteMacProtocol-g09myqt5.js → remoteMacProtocol-g10s408w.js} +7 -7
- package/dist/cli/{remove-t8x1mrxg.js → remove-abaf0w6k.js} +8 -8
- package/dist/cli/{routes-3xj256gx.js → routes-mc3ymp8t.js} +3 -3
- package/dist/cli/{start-d6p831ny.js → start-t3cq57wn.js} +5 -5
- package/dist/cli/{typecheck-stbt0qt5.js → typecheck-fag7djt5.js} +38 -10
- package/dist/cli/{workspace-61hh6jq1.js → workspace-7sbyyc59.js} +5 -5
- package/dist/client/chunks/islands-s2ta5ajb.js.map +1 -1
- package/dist/client/navigation.js +2 -1
- package/dist/client/navigation.js.map +3 -3
- package/dist/dev/client/domTracker.ts +52 -19
- package/dist/dev/client/frameworkDetect.ts +11 -0
- package/dist/dev/client/handlers/html.ts +6 -1
- package/dist/dev/client/handlers/htmx.ts +6 -1
- package/dist/dev/client/hmrClient.ts +10 -0
- package/dist/dev/serverBootstrap.js +112 -6
- package/dist/index.js +1147 -757
- package/dist/index.js.map +32 -30
- package/dist/islands/index.js +16 -5
- package/dist/islands/index.js.map +6 -6
- package/dist/mobile/index.js +2 -2
- package/dist/mobile/index.js.map +3 -3
- package/dist/react/components/index.js +2 -2
- package/dist/react/components/index.js.map +3 -3
- package/dist/react/index.js +85 -18
- package/dist/react/index.js.map +11 -11
- package/dist/react/server.js +71 -15
- package/dist/react/server.js.map +8 -8
- package/dist/src/angular/baseHref.d.ts +2 -0
- package/dist/src/angular/components/constants.d.ts +1 -0
- package/dist/src/angular/ssrRender.d.ts +1 -1
- package/dist/src/build/compileAngular.d.ts +15 -0
- package/dist/src/build/resolveBuildMode.d.ts +6 -0
- package/dist/src/build/scanAngularHandlerCalls.d.ts +3 -1
- package/dist/src/build/verifyAngularCoreUniqueness.d.ts +3 -1
- package/dist/src/cli/htmx/install.d.ts +1 -1
- package/dist/src/cli/scripts/bunCheck.d.ts +3 -1
- package/dist/src/cli/typeGraphCoherence.d.ts +9 -2
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/core/appErrorHooks.d.ts +8 -0
- package/dist/src/core/islandPageContext.d.ts +5 -1
- package/dist/src/core/requestContext.d.ts +5 -0
- package/dist/src/core/serverOnlyStaticFiles.d.ts +7 -0
- package/dist/src/dev/editorTempFiles.d.ts +3 -0
- package/dist/src/dev/hot/analyze.d.ts +1 -1
- package/dist/src/dev/hot/runtime.d.ts +20 -0
- package/dist/src/dev/importCost/instrument.d.ts +1 -1
- package/dist/src/dev/rebuildTrigger.d.ts +1 -0
- package/dist/src/utils/cleanStaleOutputs.d.ts +4 -1
- package/dist/src/utils/logger.d.ts +3 -2
- package/dist/src/utils/resolveConvention.d.ts +1 -0
- package/dist/src/utils/ssrErrorPage.d.ts +3 -0
- package/dist/svelte/index.js +85 -18
- package/dist/svelte/index.js.map +11 -11
- package/dist/svelte/router/Route.svelte.d.ts +1 -2
- package/dist/svelte/router/Router.svelte +2 -4
- package/dist/svelte/server.js +73 -16
- package/dist/svelte/server.js.map +9 -9
- package/dist/types/globals.d.ts +3 -0
- package/dist/types/svelteRouter.ts +3 -12
- package/dist/vue/components/Image.js +2 -2
- package/dist/vue/components/Image.js.map +3 -3
- package/dist/vue/components/index.js +2 -2
- package/dist/vue/components/index.js.map +3 -3
- package/dist/vue/index.js +158 -91
- package/dist/vue/index.js.map +12 -12
- package/dist/vue/server.js +144 -88
- package/dist/vue/server.js.map +9 -9
- package/package.json +2 -1
- package/dist/cli/prerender-fqpp0m1j.js +0 -10
- /package/dist/cli/{index-vtp20gwf.js → index-2bxfhs32.js} +0 -0
- /package/dist/cli/{index-fgz435qn.js → index-t8jmj8w1.js} +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/client/navigation.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Cross-framework document navigation.\n *\n * Every framework router (React Router via `<UniversalRouter>`, the Svelte\n * router, vue-router, Angular's router) handles the URLs it has routes for\n * and lets every other link fall through to a real page load. This layer\n * catches those fall-through navigations and turns them into a soft swap:\n *\n * fetch the target HTML → load its stylesheets → tear down the current\n * page (`window.__ABSOLUTE_PAGE_DISPOSE__`) → swap <head>/<body> (in a\n * View Transition where supported) → run the target's scripts → the\n * target's hydration index hydrates the new body.\n *\n * So a React page links to a Svelte page (and back) without a reload, and\n * `createIslandStore` state lives on: the store snapshot sits on\n * `globalThis`, which a swap never resets.\n *\n * import { enableNavigation } from '@absolutejs/absolute/client/navigation';\n * enableNavigation();\n *\n * Opt-in per app (call it from every page that should take part; the\n * first call installs, the rest are no-ops) and opt-out per link with\n * `data-absolute-navigation=\"off\"` (on the link or an ancestor). Any\n * error falls back to a full page load.\n *\n * CSP: a fetched page's inline scripts carry THAT response's nonce, which\n * the current document's policy rejects. Scripts and styles are recreated\n * with the current document's nonce, but only those that carried the\n * fetched response's own nonce — what the browser would have run on a\n * full load is what runs here, nothing more. */\nimport { readPageNonce } from '../dev/client/cspNonce';\nimport type {\n\tDocumentNavigationEventDetail,\n\tDocumentNavigationOutcome,\n\tDocumentNavigationType,\n\tEnableNavigationOptions,\n\tNavigateDocumentOptions\n} from '../../types/navigation';\nimport { consumePrefetch } from './prefetch';\n\n/* Shared by every bundle copy of this module (each framework's client pass\n * bundles its own), and read by the Svelte `<Link>` to decide whether a\n * URL no `<Router>` matches should be handed to the browser. */\nconst RUNTIME_KEY = Symbol.for('absolutejs.navigation');\nconst STATE_KEY = '__absoluteNavigation';\nconst OPT_OUT_SELECTOR = '[data-absolute-navigation=\"off\"]';\nconst MODULE_RUN_PARAM = 'absolute-nav';\nconst ANNOUNCER_ID = 'absolute-navigation-announcer';\nconst ISLAND_STATE_GLOBAL = '__ABS_ISLAND_STATE__';\nconst DISPOSE_GLOBAL = '__ABSOLUTE_PAGE_DISPOSE__';\nconst READY_GLOBAL = '__ABSOLUTE_PAGE_READY__';\nconst STYLESHEET_TIMEOUT_MS = 5_000;\nconst PAGE_READY_TIMEOUT_MS = 10_000;\nconst PAGE_READY_POLL_MS = 16;\nconst SCRIPT_PLACEHOLDER = 'absolute-navigation-script';\nconst ID_RADIX = 36;\n\n/* Globals one page's bootstrap writes for its own hydration. Cleared before\n * the next page's scripts run so it never hydrates with the last page's\n * props. `__ABS_ISLAND_STATE__` is deliberately not here: it is the shared\n * island-store snapshot that must survive. */\nconst PAGE_GLOBALS = [\n\t'__INITIAL_PROPS__',\n\t'__SSR_DIRTY__',\n\t'__ABS_SLOT_HYDRATION_PENDING__',\n\t'__ABS_SVELTE_LAZY_ROUTES__',\n\t'__ABS_SVELTE_ISLAND_HTML__',\n\t'__ABS_SERVER_ISLAND_HTML__',\n\t'__ABSOLUTE_SERVER_DATA__',\n\t'__ABS_ANGULAR_REQUEST_CONTEXT__',\n\tDISPOSE_GLOBAL,\n\tREADY_GLOBAL\n];\n\nconst JAVASCRIPT_TYPES = new Set([\n\t'',\n\t'application/ecmascript',\n\t'application/javascript',\n\t'module',\n\t'speculationrules',\n\t'text/ecmascript',\n\t'text/javascript'\n]);\n\ntype NavigationLike = EventTarget & { currentEntry: unknown };\n\ntype ScrollPosition = { left: number; top: number };\n\n/* Which inline scripts / styles of a fetched page may run here. */\ntype ElementTrust =\n\t{ kind: 'all' } | { kind: 'none' } | { kind: 'nonce'; nonce: string };\n\ntype PendingScript = {\n\tplaceholder: Comment;\n\tsource: HTMLScriptElement;\n\ttrusted: boolean;\n};\n\ntype HeadContext = {\n\tavailable: Map<string, Element[]>;\n\tpreloaded: Set<Element>;\n\ttrust: ElementTrust;\n};\n\ntype IslandStateRef = { live: Record<string, unknown> | undefined };\n\ntype LoadedDocument = {\n\tdocument: Document;\n\ttrust: ElementTrust;\n\turl: URL;\n};\n\ntype NavigationRequest = {\n\t/** Document the destination entry belongs to (traversals). */\n\tdocumentId?: string;\n\treplace: boolean;\n\t/** Scroll position saved for the destination entry (traversals). */\n\tscroll?: ScrollPosition;\n\ttype: DocumentNavigationType;\n\turl: URL;\n};\n\ntype Runtime = {\n\tcontroller: AbortController | undefined;\n\tdocumentId: string;\n\tentryOwners: Map<string, string>;\n\tevaluatedModules: Set<string>;\n\tmoduleRun: number;\n\tnavigating: boolean;\n\tnavigationApi: NavigationLike | undefined;\n\tnonce: string | undefined;\n\toptions: EnableNavigationOptions;\n\trestoreHistory: (() => void) | undefined;\n\tscroll: Map<string, ScrollPosition>;\n\tscrollFrame: number;\n\tteardown: Array<() => void>;\n\ttoken: number;\n};\n\ntype PublicRuntime = {\n\tdisable: () => void;\n\tnavigate: (\n\t\thref: string,\n\t\toptions?: NavigateDocumentOptions\n\t) => Promise<DocumentNavigationOutcome>;\n};\n\nlet runtime: Runtime | undefined;\n\n/* ------------------------------------------------------------------ */\n/* Small helpers */\n/* ------------------------------------------------------------------ */\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst createId = () =>\n\ttypeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'\n\t\t? crypto.randomUUID()\n\t\t: `${Date.now().toString(ID_RADIX)}-${Math.random().toString(ID_RADIX).slice(2)}`;\n\nconst delay = (millis: number) =>\n\tnew Promise<void>((resolve) => {\n\t\tsetTimeout(resolve, millis);\n\t});\n\nconst readPublicRuntime = () => {\n\tconst value: unknown = Reflect.get(globalThis, RUNTIME_KEY);\n\tif (!isRecord(value)) return undefined;\n\tconst { disable, navigate } = value;\n\tif (typeof disable !== 'function' || typeof navigate !== 'function') {\n\t\treturn undefined;\n\t}\n\n\treturn value;\n};\n\nconst prefersReducedMotion = () =>\n\ttypeof window.matchMedia === 'function' &&\n\twindow.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n/* ------------------------------------------------------------------ */\n/* History entries: which document owns which entry */\n/* ------------------------------------------------------------------ */\n\nconst isNavigationLike = (value: unknown): value is NavigationLike =>\n\ttypeof value === 'object' &&\n\tvalue !== null &&\n\t'currentEntry' in value &&\n\ttypeof Reflect.get(value, 'addEventListener') === 'function';\n\nconst readNavigationApi = () => {\n\tconst value: unknown = Reflect.get(window, 'navigation');\n\n\treturn isNavigationLike(value) ? value : undefined;\n};\n\nconst readEntryKey = (api: NavigationLike) => {\n\tconst entry = api.currentEntry;\n\tif (typeof entry !== 'object' || entry === null) return undefined;\n\tconst key: unknown = Reflect.get(entry, 'key');\n\n\treturn typeof key === 'string' ? key : undefined;\n};\n\nconst readStamp = (state: unknown) => {\n\tif (!isRecord(state)) return undefined;\n\tconst stamp = state[STATE_KEY];\n\tif (!isRecord(stamp)) return undefined;\n\tconst { doc, key } = stamp;\n\tif (typeof doc !== 'string' || typeof key !== 'string') return undefined;\n\n\treturn { doc, key };\n};\n\nconst isStampable = (state: unknown) => state === null || isRecord(state);\n\nconst stampState = (state: unknown, doc: string, key: string) => {\n\tif (!isStampable(state)) return state;\n\n\treturn { ...(isRecord(state) ? state : {}), [STATE_KEY]: { doc, key } };\n};\n\n/** Key of the history entry the browser is on right now. */\nconst currentEntryKey = (nav: Runtime) =>\n\tnav.navigationApi\n\t\t? readEntryKey(nav.navigationApi)\n\t\t: readStamp(window.history.state)?.key;\n\n/** Document that owns the current entry. `undefined` = unknown. */\nconst currentEntryOwner = (nav: Runtime) => {\n\tif (!nav.navigationApi) return readStamp(window.history.state)?.doc;\n\tconst key = readEntryKey(nav.navigationApi);\n\n\treturn key === undefined ? undefined : nav.entryOwners.get(key);\n};\n\n/** A traversal landed on an entry another document wrote. Navigation API:\n * every entry this session wrote is in the map, so an unknown one is\n * foreign. History fallback: an entry without a stamp (a hash link, an\n * entry from before `enableNavigation`) stays with the current page. */\nconst isForeignEntry = (nav: Runtime) => {\n\tconst owner = currentEntryOwner(nav);\n\tif (owner === nav.documentId) return false;\n\n\treturn owner !== undefined || nav.navigationApi !== undefined;\n};\n\nconst recordCurrentEntry = (nav: Runtime) => {\n\tif (!nav.navigationApi) return;\n\tconst key = readEntryKey(nav.navigationApi);\n\tif (key !== undefined) nav.entryOwners.set(key, nav.documentId);\n};\n\n/* Navigation API: an entry a router (or a hash link) pushes or replaces\n * belongs to the document on screen. Traversals land on known entries. */\nconst trackEntries = (nav: Runtime, api: NavigationLike) => {\n\tconst onEntryChange = (event: Event) => {\n\t\tif (Reflect.get(event, 'navigationType') === 'traverse') return;\n\t\trecordCurrentEntry(nav);\n\t};\n\tapi.addEventListener('currententrychange', onEntryChange);\n\tnav.teardown.push(() =>\n\t\tapi.removeEventListener('currententrychange', onEntryChange)\n\t);\n\trecordCurrentEntry(nav);\n};\n\n/* History fallback: no entry keys without the Navigation API, so every\n * pushState / replaceState gets a `{ doc, key }` stamp merged into its\n * (object or null) state. Routers keep their own keys next to it. */\nconst patchHistory = (nav: Runtime) => {\n\tconst { history } = window;\n\tconst originalPush = history.pushState;\n\tconst originalReplace = history.replaceState;\n\thistory.pushState = (\n\t\tstate: unknown,\n\t\tunused: string,\n\t\turl?: string | URL | null\n\t) =>\n\t\tReflect.apply(originalPush, history, [\n\t\t\tstampState(state, nav.documentId, createId()),\n\t\t\tunused,\n\t\t\turl\n\t\t]);\n\thistory.replaceState = (\n\t\tstate: unknown,\n\t\tunused: string,\n\t\turl?: string | URL | null\n\t) =>\n\t\tReflect.apply(originalReplace, history, [\n\t\t\tstampState(\n\t\t\t\tstate,\n\t\t\t\tnav.documentId,\n\t\t\t\treadStamp(history.state)?.key ?? createId()\n\t\t\t),\n\t\t\tunused,\n\t\t\turl\n\t\t]);\n\thistory.replaceState(history.state, '');\n\tnav.restoreHistory = () => {\n\t\thistory.pushState = originalPush;\n\t\thistory.replaceState = originalReplace;\n\t};\n};\n\n/* ------------------------------------------------------------------ */\n/* Scroll */\n/* ------------------------------------------------------------------ */\n\nconst recordScroll = (nav: Runtime) => {\n\tif (nav.navigating) return;\n\tconst key = currentEntryKey(nav);\n\tif (key === undefined) return;\n\tnav.scroll.set(key, { left: window.scrollX, top: window.scrollY });\n};\n\nconst trackScroll = (nav: Runtime) => {\n\tconst onScroll = () => {\n\t\tif (nav.scrollFrame !== 0) return;\n\t\tnav.scrollFrame = window.requestAnimationFrame(() => {\n\t\t\tnav.scrollFrame = 0;\n\t\t\trecordScroll(nav);\n\t\t});\n\t};\n\twindow.addEventListener('scroll', onScroll, { passive: true });\n\tnav.teardown.push(() => {\n\t\twindow.removeEventListener('scroll', onScroll);\n\t\tif (nav.scrollFrame !== 0) window.cancelAnimationFrame(nav.scrollFrame);\n\t});\n};\n\nconst scrollToHash = (hash: string) => {\n\tif (hash === '' || hash === '#') return false;\n\tconst id = decodeURIComponent(hash.slice(1));\n\tconst target =\n\t\tdocument.getElementById(id) ?? document.getElementsByName(id)[0];\n\tif (!target) return false;\n\ttarget.scrollIntoView();\n\n\treturn true;\n};\n\nconst applyScroll = (request: NavigationRequest, url: URL) => {\n\tif (request.scroll) {\n\t\twindow.scrollTo(request.scroll.left, request.scroll.top);\n\n\t\treturn;\n\t}\n\tif (scrollToHash(url.hash)) return;\n\twindow.scrollTo(0, 0);\n};\n\n/* Hydrating a document root can put the window back at the top (seen with\n * React 19 on `document`). Once the page is up, a position that was reset\n * to 0 is applied again; a position the user scrolled to stays. */\nconst reapplyScroll = (request: NavigationRequest, url: URL) => {\n\tif (window.scrollY !== 0 || window.scrollX !== 0) return;\n\tif (request.scroll && request.scroll.top + request.scroll.left > 0) {\n\t\twindow.scrollTo(request.scroll.left, request.scroll.top);\n\n\t\treturn;\n\t}\n\tif (!request.scroll) scrollToHash(url.hash);\n};\n\n/* ------------------------------------------------------------------ */\n/* Modules: re-run a page's entry when it is visited again */\n/* ------------------------------------------------------------------ */\n\nconst RELATIVE_SPECIFIER = /^(?:\\/|\\.\\.?\\/|https?:)/;\nconst IMPORT_CALL_RE = /\\bimport\\(\\s*([\"'])([^\"'\\n]+)\\1\\s*\\)/g;\nconst IMPORT_FROM_RE = /\\b(from|import)\\s*([\"'])([^\"'\\n]+)\\2/g;\n\nconst resolveSameOrigin = (specifier: string) => {\n\tif (!RELATIVE_SPECIFIER.test(specifier)) return undefined;\n\ttry {\n\t\tconst url = new URL(specifier, window.location.href);\n\n\t\treturn url.origin === window.location.origin ? url : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n};\n\n/* A module URL evaluates once per document, so a page's hydration index\n * that already ran (the user is coming back to it) would be a no-op. Give\n * the revisit a fresh URL; its imports (framework vendor chunks, shared\n * chunks) keep their URLs, so only the entry re-runs. */\nconst moduleUrlFor = (nav: Runtime, specifier: string) => {\n\tconst url = resolveSameOrigin(specifier);\n\tif (!url) return specifier;\n\tif (!nav.evaluatedModules.has(url.href)) {\n\t\tnav.evaluatedModules.add(url.href);\n\n\t\treturn specifier;\n\t}\n\tnav.moduleRun += 1;\n\turl.searchParams.set(MODULE_RUN_PARAM, String(nav.moduleRun));\n\n\treturn url.href;\n};\n\nconst rewriteModuleSpecifiers = (nav: Runtime, source: string) =>\n\tsource\n\t\t.replace(\n\t\t\tIMPORT_CALL_RE,\n\t\t\t(_match, _quote: string, specifier: string) =>\n\t\t\t\t`import(${JSON.stringify(moduleUrlFor(nav, specifier))})`\n\t\t)\n\t\t.replace(\n\t\t\tIMPORT_FROM_RE,\n\t\t\t(match, keyword: string, _quote: string, specifier: string) =>\n\t\t\t\tresolveSameOrigin(specifier)\n\t\t\t\t\t? `${keyword} ${JSON.stringify(moduleUrlFor(nav, specifier))}`\n\t\t\t\t\t: match\n\t\t);\n\nconst rememberSpecifier = (nav: Runtime, specifier: string) => {\n\tconst url = resolveSameOrigin(specifier);\n\tif (url) nav.evaluatedModules.add(url.href);\n};\n\nconst rememberImportCalls = (nav: Runtime, text: string) => {\n\tfor (const match of text.matchAll(IMPORT_CALL_RE)) {\n\t\trememberSpecifier(nav, match[2] ?? '');\n\t}\n};\n\n/** The entries the current document already evaluated. */\nconst rememberDocumentModules = (nav: Runtime) => {\n\tfor (const script of Array.from(document.scripts)) {\n\t\tconst src = script.getAttribute('src');\n\t\tif (src && script.type === 'module') rememberSpecifier(nav, src);\n\t\trememberImportCalls(nav, script.textContent ?? '');\n\t}\n};\n\n/* ------------------------------------------------------------------ */\n/* Fetching and parsing */\n/* ------------------------------------------------------------------ */\n\nconst TRUST_ALL: ElementTrust = { kind: 'all' };\nconst TRUST_NONE: ElementTrust = { kind: 'none' };\n\nconst readTrust = (response: Response) => {\n\tconst policy = response.headers.get('content-security-policy');\n\tif (!policy) return TRUST_ALL;\n\tconst nonce = /'nonce-([^']+)'/.exec(policy)?.[1];\n\tif (!nonce) return TRUST_NONE;\n\tconst trust: ElementTrust = { kind: 'nonce', nonce };\n\n\treturn trust;\n};\n\nconst isTrusted = (element: Element, trust: ElementTrust) => {\n\tif (trust.kind === 'all') return true;\n\tif (trust.kind === 'none') return false;\n\n\treturn element.getAttribute('nonce') === trust.nonce;\n};\n\nconst takePrefetched = async (url: URL) => {\n\tconst pending =\n\t\tconsumePrefetch(url.href) ??\n\t\tconsumePrefetch(`${url.pathname}${url.search}`);\n\tif (!pending) return undefined;\n\tconst response = await pending;\n\n\treturn response.ok ? response : undefined;\n};\n\nconst fetchDocument = async (url: URL, signal: AbortSignal) =>\n\t(await takePrefetched(url)) ??\n\tfetch(url.href, {\n\t\tcredentials: 'same-origin',\n\t\theaders: { Accept: 'text/html' },\n\t\tsignal\n\t});\n\nconst escapeRegExp = (value: string) =>\n\tvalue.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n/* DOMParser documents inherit this document's CSP, so a parsed <style>\n * carrying the fetched response's nonce is reported as a violation the\n * moment it is parsed. Elements carrying that response's nonce (what a full\n * load would have run) get this document's nonce before parsing; nothing\n * else gains one. */\nconst adoptResponseNonce = (\n\tnav: Runtime,\n\thtml: string,\n\ttrust: ElementTrust\n) => {\n\tif (trust.kind !== 'nonce' || !nav.nonce) return { html, trust };\n\tconst pattern = new RegExp(\n\t\t`\\\\bnonce=([\"'])${escapeRegExp(trust.nonce)}\\\\1`,\n\t\t'g'\n\t);\n\tconst adopted: ElementTrust = { kind: 'nonce', nonce: nav.nonce };\n\n\treturn {\n\t\thtml: html.replace(pattern, `nonce=\"${nav.nonce}\"`),\n\t\ttrust: adopted\n\t};\n};\n\nconst loadDocument = async (nav: Runtime, url: URL, signal: AbortSignal) => {\n\tconst response = await fetchDocument(url, signal);\n\tconst contentType = response.headers.get('content-type') ?? '';\n\tconst finalUrl = new URL(response.url || url.href);\n\tfinalUrl.hash = url.hash;\n\tif (\n\t\t!response.ok ||\n\t\t!contentType.includes('text/html') ||\n\t\tfinalUrl.origin !== window.location.origin\n\t) {\n\t\tawait response.body?.cancel().catch(() => undefined);\n\n\t\treturn undefined;\n\t}\n\tconst { html, trust } = adoptResponseNonce(\n\t\tnav,\n\t\tawait response.text(),\n\t\treadTrust(response)\n\t);\n\tconst parsed = new DOMParser().parseFromString(html, 'text/html');\n\tconst loaded: LoadedDocument = {\n\t\tdocument: parsed,\n\t\ttrust,\n\t\turl: finalUrl\n\t};\n\n\treturn loaded;\n};\n\nconst isExecutableScript = (script: HTMLScriptElement) =>\n\tJAVASCRIPT_TYPES.has(\n\t\t(script.getAttribute('type') ?? '').trim().toLowerCase()\n\t);\n\n/* Swap each executable <script> for a comment so the parsed (inert)\n * elements never reach the live document; the comment marks where the\n * recreated script goes. */\nconst extractScripts = (loaded: LoadedDocument) =>\n\tArray.from(loaded.document.querySelectorAll('script'))\n\t\t.filter(isExecutableScript)\n\t\t.map((source) => {\n\t\t\tconst placeholder =\n\t\t\t\tloaded.document.createComment(SCRIPT_PLACEHOLDER);\n\t\t\tconst trusted = isTrusted(source, loaded.trust);\n\t\t\tsource.replaceWith(placeholder);\n\t\t\tconst pending: PendingScript = { placeholder, source, trusted };\n\n\t\t\treturn pending;\n\t\t});\n\n/* ------------------------------------------------------------------ */\n/* Stylesheets, head and body */\n/* ------------------------------------------------------------------ */\n\nconst applyNonce = (nav: Runtime, element: Element, trusted: boolean) => {\n\telement.removeAttribute('nonce');\n\t// The attribute (not just the property) so later readers of the page\n\t// nonce (`script[nonce], style[nonce]`) still find a carrier.\n\tif (trusted && nav.nonce) element.setAttribute('nonce', nav.nonce);\n};\n\nconst waitForStylesheet = (link: HTMLLinkElement) =>\n\tnew Promise<void>((resolve) => {\n\t\tconst timer = setTimeout(resolve, STYLESHEET_TIMEOUT_MS);\n\t\tconst done = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tresolve();\n\t\t};\n\t\tlink.addEventListener('load', done, { once: true });\n\t\tlink.addEventListener('error', done, { once: true });\n\t});\n\n/* Load the target's stylesheets before anything is torn down, inert\n * (`media=\"not all\"`) so they can't restyle the page still on screen. */\nconst preloadStylesheets = async (loaded: LoadedDocument) => {\n\tconst links = Array.from(\n\t\tloaded.document.head.querySelectorAll<HTMLLinkElement>(\n\t\t\t'link[rel~=\"stylesheet\"]'\n\t\t)\n\t);\n\tconst media = new Map<HTMLLinkElement, string | null>();\n\tfor (const link of links) {\n\t\tmedia.set(link, link.getAttribute('media'));\n\t\tlink.setAttribute('media', 'not all');\n\t\tdocument.head.append(document.adoptNode(link));\n\t}\n\tawait Promise.all(links.map(waitForStylesheet));\n\n\treturn media;\n};\n\nconst restoreMedia = (media: Map<HTMLLinkElement, string | null>) => {\n\tfor (const [link, value] of media) {\n\t\tif (value === null) link.removeAttribute('media');\n\t\telse link.setAttribute('media', value);\n\t}\n};\n\nconst elementKey = (element: Element) => {\n\tconst attributes = Array.from(element.attributes)\n\t\t.filter((attribute) => attribute.name !== 'nonce')\n\t\t.map((attribute) => `${attribute.name}=${attribute.value}`)\n\t\t.sort()\n\t\t.join('\\u0000');\n\n\treturn `${element.tagName}\\u0001${attributes}\\u0001${element.textContent ?? ''}`;\n};\n\nconst takeMatch = (available: Map<string, Element[]>, node: Element) =>\n\tavailable.get(elementKey(node))?.shift();\n\nconst syncAttributes = (target: Element, source: Element) => {\n\tfor (const attribute of Array.from(target.attributes)) {\n\t\tif (!source.hasAttribute(attribute.name))\n\t\t\ttarget.removeAttribute(attribute.name);\n\t}\n\tfor (const attribute of Array.from(source.attributes)) {\n\t\ttarget.setAttribute(attribute.name, attribute.value);\n\t}\n};\n\nconst indexHead = (preloaded: Set<Element>) => {\n\tconst available = new Map<string, Element[]>();\n\tfor (const child of Array.from(document.head.children)) {\n\t\tif (preloaded.has(child) || child.tagName === 'SCRIPT') continue;\n\t\tconst key = elementKey(child);\n\t\tavailable.set(key, [...(available.get(key) ?? []), child]);\n\t}\n\n\treturn available;\n};\n\nconst resolveHeadNode = (nav: Runtime, node: Node, context: HeadContext) => {\n\tif (!(node instanceof Element) || context.preloaded.has(node)) return node;\n\tconst existing = takeMatch(context.available, node);\n\tif (existing) return existing;\n\tif (node.tagName === 'STYLE') {\n\t\tapplyNonce(nav, node, isTrusted(node, context.trust));\n\t}\n\n\treturn document.adoptNode(node);\n};\n\n/* Keep head elements the two pages share (same tag, attributes and text):\n * no stylesheet reload, no favicon flash. Everything else is replaced.\n * Every node is kept in order, whitespace text and comments included:\n * Svelte hydrates `<svelte:head>` by walking those nodes, and a missing one\n * makes it throw the server markup away and mount again. */\nconst swapHead = (\n\tnav: Runtime,\n\tloaded: LoadedDocument,\n\theadNodes: Node[],\n\tpreloaded: Set<Element>\n) => {\n\tconst context: HeadContext = {\n\t\tavailable: indexHead(preloaded),\n\t\tpreloaded,\n\t\ttrust: loaded.trust\n\t};\n\tconst nextNodes = headNodes.map((node) =>\n\t\tresolveHeadNode(nav, node, context)\n\t);\n\tsyncAttributes(document.head, loaded.document.head);\n\tdocument.head.replaceChildren(...nextNodes);\n};\n\nconst swapBody = (nav: Runtime, loaded: LoadedDocument) => {\n\tfor (const style of Array.from(\n\t\tloaded.document.body.querySelectorAll('style')\n\t)) {\n\t\tapplyNonce(nav, style, isTrusted(style, loaded.trust));\n\t}\n\tconst nextBody = document.adoptNode(loaded.document.body);\n\tdocument.body.replaceWith(nextBody);\n};\n\nconst disposeCurrentPage = async () => {\n\tconst dispose: unknown = Reflect.get(window, DISPOSE_GLOBAL);\n\tReflect.set(window, DISPOSE_GLOBAL, undefined);\n\tReflect.set(window, READY_GLOBAL, undefined);\n\tif (typeof dispose === 'function') await Reflect.apply(dispose, window, []);\n};\n\nconst canTearDown = () =>\n\ttypeof Reflect.get(window, DISPOSE_GLOBAL) === 'function';\n\n/* ------------------------------------------------------------------ */\n/* Scripts */\n/* ------------------------------------------------------------------ */\n\nconst islandStateOf = (value: unknown) => (isRecord(value) ? value : undefined);\n\n/* A page with islands re-seeds `window.__ABS_ISLAND_STATE__` with the\n * server's store state. The live snapshot wins per store, the same rule\n * `initializeIslandStores` applies. */\nconst keepIslandState = (live: Record<string, unknown> | undefined) => {\n\tconst current = islandStateOf(Reflect.get(globalThis, ISLAND_STATE_GLOBAL));\n\tif (!live || current === live) return live;\n\tconst merged: Record<string, unknown> = { ...(current ?? {}), ...live };\n\tReflect.set(globalThis, ISLAND_STATE_GLOBAL, merged);\n\n\treturn merged;\n};\n\nconst loadEvent = (script: HTMLScriptElement) =>\n\tnew Promise<void>((resolve) => {\n\t\tscript.addEventListener('load', () => resolve(), { once: true });\n\t\tscript.addEventListener('error', () => resolve(), { once: true });\n\t});\n\nconst createScript = (nav: Runtime, pending: PendingScript) => {\n\tconst { source } = pending;\n\tconst script = document.createElement('script');\n\tArray.from(source.attributes)\n\t\t.filter(({ name }) => name !== 'nonce' && name !== 'src')\n\t\t.forEach(({ name, value }) => script.setAttribute(name, value));\n\tapplyNonce(nav, script, pending.trusted);\n\tconst src = source.getAttribute('src');\n\tconst isModule = source.type === 'module';\n\tif (src) script.src = isModule ? moduleUrlFor(nav, src) : src;\n\tif (!src) script.text = rewriteModuleSpecifiers(nav, source.text);\n\tif (src && !source.hasAttribute('async')) script.async = false;\n\n\treturn script;\n};\n\nconst runScript = async (\n\tnav: Runtime,\n\tpending: PendingScript,\n\tislandState: IslandStateRef\n) => {\n\tif (!pending.placeholder.isConnected) return;\n\tconst script = createScript(nav, pending);\n\tconst loaded = script.src ? loadEvent(script) : Promise.resolve();\n\tpending.placeholder.replaceWith(script);\n\tislandState.live = keepIslandState(islandState.live);\n\tawait loaded;\n\tislandState.live = keepIslandState(islandState.live);\n};\n\nconst clearPageGlobals = () => {\n\tfor (const name of PAGE_GLOBALS) Reflect.deleteProperty(window, name);\n};\n\n/* In document order, one at a time: an inline script that sets\n * `__INITIAL_PROPS__` has to run before the module that hydrates with it. */\nconst runScripts = (nav: Runtime, scripts: PendingScript[]) => {\n\tconst islandState: IslandStateRef = {\n\t\tlive: islandStateOf(Reflect.get(globalThis, ISLAND_STATE_GLOBAL))\n\t};\n\n\treturn scripts.reduce<Promise<void>>(\n\t\t(previous, pending) =>\n\t\t\tprevious.then(() => runScript(nav, pending, islandState)),\n\t\tPromise.resolve()\n\t);\n};\n\nconst pollForPage = async (deadline: number): Promise<void> => {\n\tif (canTearDown() || Date.now() >= deadline) return;\n\tawait delay(PAGE_READY_POLL_MS);\n\tawait pollForPage(deadline);\n};\n\n/* The hydration index registers `__ABSOLUTE_PAGE_DISPOSE__` once it has\n * mounted — possibly after an `import()` an inline bootstrap started. */\nconst waitForPageReady = async (hasModules: boolean) => {\n\tif (hasModules) await pollForPage(Date.now() + PAGE_READY_TIMEOUT_MS);\n\tconst ready: unknown = Reflect.get(window, READY_GLOBAL);\n\tif (ready instanceof Promise) await ready.catch(() => undefined);\n};\n\nconst loadsModules = (scripts: PendingScript[]) =>\n\tscripts.some(\n\t\t({ source }) =>\n\t\t\tsource.type === 'module' || /\\bimport\\s*\\(/.test(source.text)\n\t);\n\n/* ------------------------------------------------------------------ */\n/* Focus, announcement, events */\n/* ------------------------------------------------------------------ */\n\nconst ensureAnnouncer = () => {\n\tconst existing = document.getElementById(ANNOUNCER_ID);\n\tif (existing) return existing;\n\tconst region = document.createElement('div');\n\tregion.id = ANNOUNCER_ID;\n\tregion.setAttribute('aria-live', 'assertive');\n\tregion.setAttribute('aria-atomic', 'true');\n\tregion.setAttribute('role', 'status');\n\t// CSSOM, not a style attribute: a strict `style-src-attr` can't block it.\n\tObject.assign(region.style, {\n\t\tborder: '0',\n\t\tclip: 'rect(0 0 0 0)',\n\t\theight: '1px',\n\t\tmargin: '-1px',\n\t\toverflow: 'hidden',\n\t\tpadding: '0',\n\t\tposition: 'absolute',\n\t\twhiteSpace: 'nowrap',\n\t\twidth: '1px'\n\t});\n\tdocument.body.append(region);\n\n\treturn region;\n};\n\nconst announcePage = () => {\n\tconst heading = document.querySelector('h1')?.textContent?.trim();\n\tconst text = document.title || heading || window.location.pathname;\n\tensureAnnouncer().textContent = text;\n};\n\nconst resetFocus = () => {\n\tconst autofocus = document.querySelector<HTMLElement>('[autofocus]');\n\tif (autofocus) {\n\t\tautofocus.focus();\n\n\t\treturn;\n\t}\n\tif (document.activeElement instanceof HTMLElement) {\n\t\tdocument.activeElement.blur();\n\t}\n};\n\nconst dispatch = (\n\tname: string,\n\tdetail: DocumentNavigationEventDetail,\n\tcancelable: boolean\n) => window.dispatchEvent(new CustomEvent(name, { cancelable, detail }));\n\n/* ------------------------------------------------------------------ */\n/* The navigation */\n/* ------------------------------------------------------------------ */\n\nconst outcome = (value: DocumentNavigationOutcome) => value;\n\nconst reload = (request: NavigationRequest, committed: boolean) => {\n\tif (committed || request.type === 'traverse') window.location.reload();\n\telse if (request.replace) window.location.replace(request.url.href);\n\telse window.location.assign(request.url.href);\n\n\treturn outcome('reloaded');\n};\n\nconst commitHistory = (nav: Runtime, request: NavigationRequest, url: URL) => {\n\tnav.documentId = request.documentId ?? createId();\n\tif (request.type === 'traverse') {\n\t\trecordCurrentEntry(nav);\n\n\t\treturn;\n\t}\n\tconst key = currentEntryKey(nav);\n\tif (key !== undefined) {\n\t\tnav.scroll.set(key, { left: window.scrollX, top: window.scrollY });\n\t}\n\tconst state = stampState(null, nav.documentId, createId());\n\tif (request.replace) window.history.replaceState(state, '', url.href);\n\telse window.history.pushState(state, '', url.href);\n\trecordCurrentEntry(nav);\n};\n\nconst shouldAnimate = (nav: Runtime) =>\n\tnav.options.viewTransition !== false &&\n\ttypeof Reflect.get(document, 'startViewTransition') === 'function' &&\n\t!prefersReducedMotion();\n\nconst readPromise = (value: unknown, name: string) => {\n\tif (typeof value !== 'object' || value === null) return undefined;\n\tconst promise: unknown = Reflect.get(value, name);\n\n\treturn promise instanceof Promise ? promise : undefined;\n};\n\nconst runSwap = async (nav: Runtime, swap: () => Promise<void>) => {\n\tconst start: unknown = Reflect.get(document, 'startViewTransition');\n\tif (!shouldAnimate(nav) || typeof start !== 'function') {\n\t\tawait swap();\n\n\t\treturn;\n\t}\n\tconst transition: unknown = Reflect.apply(start, document, [swap]);\n\treadPromise(transition, 'ready')?.catch(() => undefined);\n\treadPromise(transition, 'finished')?.catch(() => undefined);\n\tawait readPromise(transition, 'updateCallbackDone');\n};\n\nconst swapDocument = async (\n\tnav: Runtime,\n\trequest: NavigationRequest,\n\tloaded: LoadedDocument,\n\tisStale: () => boolean\n) => {\n\tconst scripts = extractScripts(loaded);\n\t// Before the preload moves the stylesheet links out of the parsed head.\n\tconst headNodes = Array.from(loaded.document.head.childNodes);\n\tconst media = await preloadStylesheets(loaded);\n\tconst preloaded = new Set<Element>(media.keys());\n\t// A newer navigation started while the stylesheets loaded: it owns the\n\t// page now, so drop what this one added and stop.\n\tif (isStale()) {\n\t\tpreloaded.forEach((link) => link.remove());\n\n\t\treturn false;\n\t}\n\t// Outside the View Transition callback: the browser records the scroll\n\t// position of the entry being left when the new one is pushed, and inside\n\t// the callback it reads 0, which it then restores on a later back.\n\tcommitHistory(nav, request, loaded.url);\n\tconst swap = async () => {\n\t\tawait disposeCurrentPage();\n\t\tclearPageGlobals();\n\t\tsyncAttributes(\n\t\t\tdocument.documentElement,\n\t\t\tloaded.document.documentElement\n\t\t);\n\t\tswapHead(nav, loaded, headNodes, preloaded);\n\t\tswapBody(nav, loaded);\n\t\trestoreMedia(media);\n\t\tapplyScroll(request, loaded.url);\n\t};\n\tawait runSwap(nav, swap);\n\tresetFocus();\n\tawait runScripts(nav, scripts);\n\tawait waitForPageReady(loadsModules(scripts));\n\treapplyScroll(request, loaded.url);\n\tannouncePage();\n\n\treturn true;\n};\n\nconst isCurrent = (nav: Runtime, token: number) => nav.token === token;\n\nconst performNavigation = async (nav: Runtime, request: NavigationRequest) => {\n\tnav.token += 1;\n\tconst { token } = nav;\n\tnav.controller?.abort();\n\tconst controller = new AbortController();\n\tnav.controller = controller;\n\tconst detail: DocumentNavigationEventDetail = {\n\t\ttype: request.type,\n\t\turl: request.url.href\n\t};\n\tconst proceed = dispatch(\n\t\t'absolute:before-navigate',\n\t\tdetail,\n\t\trequest.type !== 'traverse'\n\t);\n\tif (!proceed) return outcome('cancelled');\n\tif (!canTearDown()) return reload(request, false);\n\n\tconst committedBefore = nav.documentId;\n\ttry {\n\t\tconst loaded = await loadDocument(nav, request.url, controller.signal);\n\t\tif (!isCurrent(nav, token)) return outcome('superseded');\n\t\tif (!loaded) return reload(request, false);\n\t\tnav.navigating = true;\n\t\tconst swapped = await swapDocument(\n\t\t\tnav,\n\t\t\trequest,\n\t\t\tloaded,\n\t\t\t() => !isCurrent(nav, token)\n\t\t);\n\t\tif (!swapped) return outcome('superseded');\n\t\tdispatch('absolute:after-navigate', detail, false);\n\n\t\treturn outcome('swapped');\n\t} catch (error) {\n\t\tif (!isCurrent(nav, token)) return outcome('superseded');\n\t\tconsole.error('[absolute] navigation failed, loading the page:', error);\n\n\t\treturn reload(request, nav.documentId !== committedBefore);\n\t} finally {\n\t\tif (isCurrent(nav, token)) nav.navigating = false;\n\t}\n};\n\n/* ------------------------------------------------------------------ */\n/* Interception */\n/* ------------------------------------------------------------------ */\n\nconst isModifiedClick = (event: MouseEvent) =>\n\tevent.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\nconst isSamePageFragment = (url: URL) =>\n\turl.hash !== '' &&\n\turl.pathname === window.location.pathname &&\n\turl.search === window.location.search;\n\nconst findAnchor = (event: MouseEvent) => {\n\tconst { target } = event;\n\tif (!(target instanceof Element)) return null;\n\n\treturn target.closest<HTMLAnchorElement>('a[href]');\n};\n\nconst isPlainClick = (event: MouseEvent) =>\n\t!event.defaultPrevented && event.button === 0 && !isModifiedClick(event);\n\nconst isOptedOut = (anchor: HTMLAnchorElement) =>\n\t(anchor.target !== '' && anchor.target !== '_self') ||\n\tanchor.hasAttribute('download') ||\n\tanchor.relList.contains('external') ||\n\tanchor.closest(OPT_OUT_SELECTOR) !== null;\n\nconst interceptableUrl = (nav: Runtime, anchor: HTMLAnchorElement) => {\n\tif (isOptedOut(anchor)) return undefined;\n\tconst url = new URL(anchor.href, window.location.href);\n\tif (url.origin !== window.location.origin) return undefined;\n\tif (isSamePageFragment(url)) return undefined;\n\tif (nav.options.shouldIntercept?.(url) === false) return undefined;\n\n\treturn url;\n};\n\n/* Bubble phase on window: runs after every framework router's handler, so\n * a click a router handled (`preventDefault`) never reaches this. */\nconst listenForClicks = (nav: Runtime) => {\n\tconst onClick = (event: MouseEvent) => {\n\t\tif (!isPlainClick(event)) return;\n\t\tconst anchor = findAnchor(event);\n\t\tconst url = anchor ? interceptableUrl(nav, anchor) : undefined;\n\t\tif (!url || !canTearDown()) return;\n\t\tevent.preventDefault();\n\t\tvoid performNavigation(nav, { replace: false, type: 'link', url });\n\t};\n\twindow.addEventListener('click', onClick);\n\tnav.teardown.push(() => window.removeEventListener('click', onClick));\n};\n\n/* Capture phase, so it runs before the routers' popstate listeners: a\n * traversal onto another document's entry is stopped here and swapped. */\nconst listenForTraversals = (nav: Runtime) => {\n\tconst onPopState = (event: PopStateEvent) => {\n\t\tif (!isForeignEntry(nav)) return;\n\t\tevent.stopImmediatePropagation();\n\t\tconst owner = currentEntryOwner(nav);\n\t\tconst key = currentEntryKey(nav);\n\t\tvoid performNavigation(nav, {\n\t\t\tdocumentId: owner,\n\t\t\treplace: false,\n\t\t\tscroll: key === undefined ? undefined : nav.scroll.get(key),\n\t\t\ttype: 'traverse',\n\t\t\turl: new URL(window.location.href)\n\t\t});\n\t};\n\twindow.addEventListener('popstate', onPopState, { capture: true });\n\tnav.teardown.push(() =>\n\t\twindow.removeEventListener('popstate', onPopState, { capture: true })\n\t);\n};\n\n/* ------------------------------------------------------------------ */\n/* Public API */\n/* ------------------------------------------------------------------ */\n\n/** Turn the layer off: listeners removed, history methods restored. */\nexport const disableNavigation = () => {\n\tconst installed = readPublicRuntime();\n\tif (installed && typeof installed.disable === 'function') {\n\t\tReflect.apply(installed.disable, undefined, []);\n\t}\n};\n\nconst teardownRuntime = (nav: Runtime) => {\n\tnav.controller?.abort();\n\tfor (const cleanup of nav.teardown.splice(0)) cleanup();\n\tnav.restoreHistory?.();\n\tReflect.deleteProperty(globalThis, RUNTIME_KEY);\n\tif (runtime === nav) runtime = undefined;\n};\n\nconst navigateWith =\n\t(nav: Runtime) =>\n\t(href: string, options: NavigateDocumentOptions = {}) => {\n\t\tconst url = new URL(href, window.location.href);\n\t\tif (url.origin !== window.location.origin) {\n\t\t\twindow.location.assign(url.href);\n\n\t\t\treturn Promise.resolve<DocumentNavigationOutcome>('reloaded');\n\t\t}\n\n\t\treturn performNavigation(nav, {\n\t\t\treplace: options.replace === true,\n\t\t\ttype: 'navigate',\n\t\t\turl\n\t\t});\n\t};\n\n/**\n * Install cross-framework document navigation for this tab. Idempotent:\n * every page can call it (each framework bundle carries its own copy of\n * this module; the first call wins and its options apply).\n */\nexport const enableNavigation = (options: EnableNavigationOptions = {}) => {\n\tif (typeof window === 'undefined' || readPublicRuntime()) return;\n\tconst navigationApi = readNavigationApi();\n\tconst nav: Runtime = {\n\t\tcontroller: undefined,\n\t\tdocumentId: createId(),\n\t\tentryOwners: new Map(),\n\t\tevaluatedModules: new Set(),\n\t\tmoduleRun: 0,\n\t\tnavigating: false,\n\t\tnavigationApi,\n\t\tnonce: readPageNonce(),\n\t\toptions,\n\t\trestoreHistory: undefined,\n\t\tscroll: new Map(),\n\t\tscrollFrame: 0,\n\t\tteardown: [],\n\t\ttoken: 0\n\t};\n\truntime = nav;\n\tif (navigationApi) trackEntries(nav, navigationApi);\n\telse patchHistory(nav);\n\trememberDocumentModules(nav);\n\ttrackScroll(nav);\n\tlistenForClicks(nav);\n\tlistenForTraversals(nav);\n\tconst publicRuntime: PublicRuntime = {\n\t\tnavigate: navigateWith(nav),\n\t\tdisable: () => teardownRuntime(nav)\n\t};\n\tReflect.set(globalThis, RUNTIME_KEY, publicRuntime);\n};\n\nconst OUTCOMES = new Set<unknown>([\n\t'cancelled',\n\t'reloaded',\n\t'superseded',\n\t'swapped'\n]);\n\nconst isOutcome = (value: unknown): value is DocumentNavigationOutcome =>\n\tOUTCOMES.has(value);\n\n/** Whether `enableNavigation()` is active in this tab. */\nexport const isNavigationEnabled = () =>\n\ttypeof window !== 'undefined' && readPublicRuntime() !== undefined;\n\n/**\n * Navigate to `href` through the layer: a soft swap when it is enabled\n * and the page can be torn down, a normal page load otherwise.\n */\nexport const navigateDocument = async (\n\thref: string,\n\toptions: NavigateDocumentOptions = {}\n) => {\n\tconst installed = readPublicRuntime();\n\tconst navigate = installed?.navigate;\n\tif (typeof navigate === 'function') {\n\t\tconst result: unknown = await Reflect.apply(navigate, undefined, [\n\t\t\thref,\n\t\t\toptions\n\t\t]);\n\t\tif (isOutcome(result)) return result;\n\t}\n\tif (options.replace) window.location.replace(href);\n\telse window.location.assign(href);\n\n\treturn outcome('reloaded');\n};\n"
|
|
5
|
+
"/**\n * Cross-framework document navigation.\n *\n * Every framework router (React Router via `<UniversalRouter>`, the Svelte\n * router, vue-router, Angular's router) handles the URLs it has routes for\n * and lets every other link fall through to a real page load. This layer\n * catches those fall-through navigations and turns them into a soft swap:\n *\n * fetch the target HTML → load its stylesheets → tear down the current\n * page (`window.__ABSOLUTE_PAGE_DISPOSE__`) → swap <head>/<body> (in a\n * View Transition where supported) → run the target's scripts → the\n * target's hydration index hydrates the new body.\n *\n * So a React page links to a Svelte page (and back) without a reload, and\n * `createIslandStore` state lives on: the store snapshot sits on\n * `globalThis`, which a swap never resets.\n *\n * import { enableNavigation } from '@absolutejs/absolute/client/navigation';\n * enableNavigation();\n *\n * Opt-in per app (call it from every page that should take part; the\n * first call installs, the rest are no-ops) and opt-out per link with\n * `data-absolute-navigation=\"off\"` (on the link or an ancestor). Any\n * error falls back to a full page load.\n *\n * CSP: a fetched page's inline scripts carry THAT response's nonce, which\n * the current document's policy rejects. Scripts and styles are recreated\n * with the current document's nonce, but only those that carried the\n * fetched response's own nonce — what the browser would have run on a\n * full load is what runs here, nothing more. */\nimport { readPageNonce } from '../dev/client/cspNonce';\nimport type {\n\tDocumentNavigationEventDetail,\n\tDocumentNavigationOutcome,\n\tDocumentNavigationType,\n\tEnableNavigationOptions,\n\tNavigateDocumentOptions\n} from '../../types/navigation';\nimport { consumePrefetch } from './prefetch';\n\n/* Shared by every bundle copy of this module (each framework's client pass\n * bundles its own), and read by the Svelte `<Link>` to decide whether a\n * URL no `<Router>` matches should be handed to the browser. */\nconst RUNTIME_KEY = Symbol.for('absolutejs.navigation');\nconst STATE_KEY = '__absoluteNavigation';\nconst OPT_OUT_SELECTOR = '[data-absolute-navigation=\"off\"]';\nconst MODULE_RUN_PARAM = 'absolute-nav';\nconst ANNOUNCER_ID = 'absolute-navigation-announcer';\nconst ISLAND_STATE_GLOBAL = '__ABS_ISLAND_STATE__';\nconst DISPOSE_GLOBAL = '__ABSOLUTE_PAGE_DISPOSE__';\nconst READY_GLOBAL = '__ABSOLUTE_PAGE_READY__';\nconst STYLESHEET_TIMEOUT_MS = 5_000;\nconst PAGE_READY_TIMEOUT_MS = 10_000;\nconst PAGE_READY_POLL_MS = 16;\nconst SCRIPT_PLACEHOLDER = 'absolute-navigation-script';\nconst ID_RADIX = 36;\n\n/* Globals one page's bootstrap writes for its own hydration. Cleared before\n * the next page's scripts run so it never hydrates with the last page's\n * props. `__ABS_ISLAND_STATE__` is deliberately not here: it is the shared\n * island-store snapshot that must survive. */\nconst PAGE_GLOBALS = [\n\t'__INITIAL_PROPS__',\n\t'__SSR_DIRTY__',\n\t'__ABS_SLOT_HYDRATION_PENDING__',\n\t'__ABS_SVELTE_LAZY_ROUTES__',\n\t'__ABS_SVELTE_ISLAND_HTML__',\n\t'__ABS_SERVER_ISLAND_HTML__',\n\t'__ABSOLUTE_SERVER_DATA__',\n\t'__ABS_ANGULAR_REQUEST_CONTEXT__',\n\t'__ABS_ANGULAR_BASE_HREF__',\n\tDISPOSE_GLOBAL,\n\tREADY_GLOBAL\n];\n\nconst JAVASCRIPT_TYPES = new Set([\n\t'',\n\t'application/ecmascript',\n\t'application/javascript',\n\t'module',\n\t'speculationrules',\n\t'text/ecmascript',\n\t'text/javascript'\n]);\n\ntype NavigationLike = EventTarget & { currentEntry: unknown };\n\ntype ScrollPosition = { left: number; top: number };\n\n/* Which inline scripts / styles of a fetched page may run here. */\ntype ElementTrust =\n\t{ kind: 'all' } | { kind: 'none' } | { kind: 'nonce'; nonce: string };\n\ntype PendingScript = {\n\tplaceholder: Comment;\n\tsource: HTMLScriptElement;\n\ttrusted: boolean;\n};\n\ntype HeadContext = {\n\tavailable: Map<string, Element[]>;\n\tpreloaded: Set<Element>;\n\ttrust: ElementTrust;\n};\n\ntype IslandStateRef = { live: Record<string, unknown> | undefined };\n\ntype LoadedDocument = {\n\tdocument: Document;\n\ttrust: ElementTrust;\n\turl: URL;\n};\n\ntype NavigationRequest = {\n\t/** Document the destination entry belongs to (traversals). */\n\tdocumentId?: string;\n\treplace: boolean;\n\t/** Scroll position saved for the destination entry (traversals). */\n\tscroll?: ScrollPosition;\n\ttype: DocumentNavigationType;\n\turl: URL;\n};\n\ntype Runtime = {\n\tcontroller: AbortController | undefined;\n\tdocumentId: string;\n\tentryOwners: Map<string, string>;\n\tevaluatedModules: Set<string>;\n\tmoduleRun: number;\n\tnavigating: boolean;\n\tnavigationApi: NavigationLike | undefined;\n\tnonce: string | undefined;\n\toptions: EnableNavigationOptions;\n\trestoreHistory: (() => void) | undefined;\n\tscroll: Map<string, ScrollPosition>;\n\tscrollFrame: number;\n\tteardown: Array<() => void>;\n\ttoken: number;\n};\n\ntype PublicRuntime = {\n\tdisable: () => void;\n\tnavigate: (\n\t\thref: string,\n\t\toptions?: NavigateDocumentOptions\n\t) => Promise<DocumentNavigationOutcome>;\n};\n\nlet runtime: Runtime | undefined;\n\n/* ------------------------------------------------------------------ */\n/* Small helpers */\n/* ------------------------------------------------------------------ */\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst createId = () =>\n\ttypeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'\n\t\t? crypto.randomUUID()\n\t\t: `${Date.now().toString(ID_RADIX)}-${Math.random().toString(ID_RADIX).slice(2)}`;\n\nconst delay = (millis: number) =>\n\tnew Promise<void>((resolve) => {\n\t\tsetTimeout(resolve, millis);\n\t});\n\nconst readPublicRuntime = () => {\n\tconst value: unknown = Reflect.get(globalThis, RUNTIME_KEY);\n\tif (!isRecord(value)) return undefined;\n\tconst { disable, navigate } = value;\n\tif (typeof disable !== 'function' || typeof navigate !== 'function') {\n\t\treturn undefined;\n\t}\n\n\treturn value;\n};\n\nconst prefersReducedMotion = () =>\n\ttypeof window.matchMedia === 'function' &&\n\twindow.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n/* ------------------------------------------------------------------ */\n/* History entries: which document owns which entry */\n/* ------------------------------------------------------------------ */\n\nconst isNavigationLike = (value: unknown): value is NavigationLike =>\n\ttypeof value === 'object' &&\n\tvalue !== null &&\n\t'currentEntry' in value &&\n\ttypeof Reflect.get(value, 'addEventListener') === 'function';\n\nconst readNavigationApi = () => {\n\tconst value: unknown = Reflect.get(window, 'navigation');\n\n\treturn isNavigationLike(value) ? value : undefined;\n};\n\nconst readEntryKey = (api: NavigationLike) => {\n\tconst entry = api.currentEntry;\n\tif (typeof entry !== 'object' || entry === null) return undefined;\n\tconst key: unknown = Reflect.get(entry, 'key');\n\n\treturn typeof key === 'string' ? key : undefined;\n};\n\nconst readStamp = (state: unknown) => {\n\tif (!isRecord(state)) return undefined;\n\tconst stamp = state[STATE_KEY];\n\tif (!isRecord(stamp)) return undefined;\n\tconst { doc, key } = stamp;\n\tif (typeof doc !== 'string' || typeof key !== 'string') return undefined;\n\n\treturn { doc, key };\n};\n\nconst isStampable = (state: unknown) => state === null || isRecord(state);\n\nconst stampState = (state: unknown, doc: string, key: string) => {\n\tif (!isStampable(state)) return state;\n\n\treturn { ...(isRecord(state) ? state : {}), [STATE_KEY]: { doc, key } };\n};\n\n/** Key of the history entry the browser is on right now. */\nconst currentEntryKey = (nav: Runtime) =>\n\tnav.navigationApi\n\t\t? readEntryKey(nav.navigationApi)\n\t\t: readStamp(window.history.state)?.key;\n\n/** Document that owns the current entry. `undefined` = unknown. */\nconst currentEntryOwner = (nav: Runtime) => {\n\tif (!nav.navigationApi) return readStamp(window.history.state)?.doc;\n\tconst key = readEntryKey(nav.navigationApi);\n\n\treturn key === undefined ? undefined : nav.entryOwners.get(key);\n};\n\n/** A traversal landed on an entry another document wrote. Navigation API:\n * every entry this session wrote is in the map, so an unknown one is\n * foreign. History fallback: an entry without a stamp (a hash link, an\n * entry from before `enableNavigation`) stays with the current page. */\nconst isForeignEntry = (nav: Runtime) => {\n\tconst owner = currentEntryOwner(nav);\n\tif (owner === nav.documentId) return false;\n\n\treturn owner !== undefined || nav.navigationApi !== undefined;\n};\n\nconst recordCurrentEntry = (nav: Runtime) => {\n\tif (!nav.navigationApi) return;\n\tconst key = readEntryKey(nav.navigationApi);\n\tif (key !== undefined) nav.entryOwners.set(key, nav.documentId);\n};\n\n/* Navigation API: an entry a router (or a hash link) pushes or replaces\n * belongs to the document on screen. Traversals land on known entries. */\nconst trackEntries = (nav: Runtime, api: NavigationLike) => {\n\tconst onEntryChange = (event: Event) => {\n\t\tif (Reflect.get(event, 'navigationType') === 'traverse') return;\n\t\trecordCurrentEntry(nav);\n\t};\n\tapi.addEventListener('currententrychange', onEntryChange);\n\tnav.teardown.push(() =>\n\t\tapi.removeEventListener('currententrychange', onEntryChange)\n\t);\n\trecordCurrentEntry(nav);\n};\n\n/* History fallback: no entry keys without the Navigation API, so every\n * pushState / replaceState gets a `{ doc, key }` stamp merged into its\n * (object or null) state. Routers keep their own keys next to it. */\nconst patchHistory = (nav: Runtime) => {\n\tconst { history } = window;\n\tconst originalPush = history.pushState;\n\tconst originalReplace = history.replaceState;\n\thistory.pushState = (\n\t\tstate: unknown,\n\t\tunused: string,\n\t\turl?: string | URL | null\n\t) =>\n\t\tReflect.apply(originalPush, history, [\n\t\t\tstampState(state, nav.documentId, createId()),\n\t\t\tunused,\n\t\t\turl\n\t\t]);\n\thistory.replaceState = (\n\t\tstate: unknown,\n\t\tunused: string,\n\t\turl?: string | URL | null\n\t) =>\n\t\tReflect.apply(originalReplace, history, [\n\t\t\tstampState(\n\t\t\t\tstate,\n\t\t\t\tnav.documentId,\n\t\t\t\treadStamp(history.state)?.key ?? createId()\n\t\t\t),\n\t\t\tunused,\n\t\t\turl\n\t\t]);\n\thistory.replaceState(history.state, '');\n\tnav.restoreHistory = () => {\n\t\thistory.pushState = originalPush;\n\t\thistory.replaceState = originalReplace;\n\t};\n};\n\n/* ------------------------------------------------------------------ */\n/* Scroll */\n/* ------------------------------------------------------------------ */\n\nconst recordScroll = (nav: Runtime) => {\n\tif (nav.navigating) return;\n\tconst key = currentEntryKey(nav);\n\tif (key === undefined) return;\n\tnav.scroll.set(key, { left: window.scrollX, top: window.scrollY });\n};\n\nconst trackScroll = (nav: Runtime) => {\n\tconst onScroll = () => {\n\t\tif (nav.scrollFrame !== 0) return;\n\t\tnav.scrollFrame = window.requestAnimationFrame(() => {\n\t\t\tnav.scrollFrame = 0;\n\t\t\trecordScroll(nav);\n\t\t});\n\t};\n\twindow.addEventListener('scroll', onScroll, { passive: true });\n\tnav.teardown.push(() => {\n\t\twindow.removeEventListener('scroll', onScroll);\n\t\tif (nav.scrollFrame !== 0) window.cancelAnimationFrame(nav.scrollFrame);\n\t});\n};\n\nconst scrollToHash = (hash: string) => {\n\tif (hash === '' || hash === '#') return false;\n\tconst id = decodeURIComponent(hash.slice(1));\n\tconst target =\n\t\tdocument.getElementById(id) ?? document.getElementsByName(id)[0];\n\tif (!target) return false;\n\ttarget.scrollIntoView();\n\n\treturn true;\n};\n\nconst applyScroll = (request: NavigationRequest, url: URL) => {\n\tif (request.scroll) {\n\t\twindow.scrollTo(request.scroll.left, request.scroll.top);\n\n\t\treturn;\n\t}\n\tif (scrollToHash(url.hash)) return;\n\twindow.scrollTo(0, 0);\n};\n\n/* Hydrating a document root can put the window back at the top (seen with\n * React 19 on `document`). Once the page is up, a position that was reset\n * to 0 is applied again; a position the user scrolled to stays. */\nconst reapplyScroll = (request: NavigationRequest, url: URL) => {\n\tif (window.scrollY !== 0 || window.scrollX !== 0) return;\n\tif (request.scroll && request.scroll.top + request.scroll.left > 0) {\n\t\twindow.scrollTo(request.scroll.left, request.scroll.top);\n\n\t\treturn;\n\t}\n\tif (!request.scroll) scrollToHash(url.hash);\n};\n\n/* ------------------------------------------------------------------ */\n/* Modules: re-run a page's entry when it is visited again */\n/* ------------------------------------------------------------------ */\n\nconst RELATIVE_SPECIFIER = /^(?:\\/|\\.\\.?\\/|https?:)/;\nconst IMPORT_CALL_RE = /\\bimport\\(\\s*([\"'])([^\"'\\n]+)\\1\\s*\\)/g;\nconst IMPORT_FROM_RE = /\\b(from|import)\\s*([\"'])([^\"'\\n]+)\\2/g;\n\nconst resolveSameOrigin = (specifier: string) => {\n\tif (!RELATIVE_SPECIFIER.test(specifier)) return undefined;\n\ttry {\n\t\tconst url = new URL(specifier, window.location.href);\n\n\t\treturn url.origin === window.location.origin ? url : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n};\n\n/* A module URL evaluates once per document, so a page's hydration index\n * that already ran (the user is coming back to it) would be a no-op. Give\n * the revisit a fresh URL; its imports (framework vendor chunks, shared\n * chunks) keep their URLs, so only the entry re-runs. */\nconst moduleUrlFor = (nav: Runtime, specifier: string) => {\n\tconst url = resolveSameOrigin(specifier);\n\tif (!url) return specifier;\n\tif (!nav.evaluatedModules.has(url.href)) {\n\t\tnav.evaluatedModules.add(url.href);\n\n\t\treturn specifier;\n\t}\n\tnav.moduleRun += 1;\n\turl.searchParams.set(MODULE_RUN_PARAM, String(nav.moduleRun));\n\n\treturn url.href;\n};\n\nconst rewriteModuleSpecifiers = (nav: Runtime, source: string) =>\n\tsource\n\t\t.replace(\n\t\t\tIMPORT_CALL_RE,\n\t\t\t(_match, _quote: string, specifier: string) =>\n\t\t\t\t`import(${JSON.stringify(moduleUrlFor(nav, specifier))})`\n\t\t)\n\t\t.replace(\n\t\t\tIMPORT_FROM_RE,\n\t\t\t(match, keyword: string, _quote: string, specifier: string) =>\n\t\t\t\tresolveSameOrigin(specifier)\n\t\t\t\t\t? `${keyword} ${JSON.stringify(moduleUrlFor(nav, specifier))}`\n\t\t\t\t\t: match\n\t\t);\n\nconst rememberSpecifier = (nav: Runtime, specifier: string) => {\n\tconst url = resolveSameOrigin(specifier);\n\tif (url) nav.evaluatedModules.add(url.href);\n};\n\nconst rememberImportCalls = (nav: Runtime, text: string) => {\n\tfor (const match of text.matchAll(IMPORT_CALL_RE)) {\n\t\trememberSpecifier(nav, match[2] ?? '');\n\t}\n};\n\n/** The entries the current document already evaluated. */\nconst rememberDocumentModules = (nav: Runtime) => {\n\tfor (const script of Array.from(document.scripts)) {\n\t\tconst src = script.getAttribute('src');\n\t\tif (src && script.type === 'module') rememberSpecifier(nav, src);\n\t\trememberImportCalls(nav, script.textContent ?? '');\n\t}\n};\n\n/* ------------------------------------------------------------------ */\n/* Fetching and parsing */\n/* ------------------------------------------------------------------ */\n\nconst TRUST_ALL: ElementTrust = { kind: 'all' };\nconst TRUST_NONE: ElementTrust = { kind: 'none' };\n\nconst readTrust = (response: Response) => {\n\tconst policy = response.headers.get('content-security-policy');\n\tif (!policy) return TRUST_ALL;\n\tconst nonce = /'nonce-([^']+)'/.exec(policy)?.[1];\n\tif (!nonce) return TRUST_NONE;\n\tconst trust: ElementTrust = { kind: 'nonce', nonce };\n\n\treturn trust;\n};\n\nconst isTrusted = (element: Element, trust: ElementTrust) => {\n\tif (trust.kind === 'all') return true;\n\tif (trust.kind === 'none') return false;\n\n\treturn element.getAttribute('nonce') === trust.nonce;\n};\n\nconst takePrefetched = async (url: URL) => {\n\tconst pending =\n\t\tconsumePrefetch(url.href) ??\n\t\tconsumePrefetch(`${url.pathname}${url.search}`);\n\tif (!pending) return undefined;\n\tconst response = await pending;\n\n\treturn response.ok ? response : undefined;\n};\n\nconst fetchDocument = async (url: URL, signal: AbortSignal) =>\n\t(await takePrefetched(url)) ??\n\tfetch(url.href, {\n\t\tcredentials: 'same-origin',\n\t\theaders: { Accept: 'text/html' },\n\t\tsignal\n\t});\n\nconst escapeRegExp = (value: string) =>\n\tvalue.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n/* DOMParser documents inherit this document's CSP, so a parsed <style>\n * carrying the fetched response's nonce is reported as a violation the\n * moment it is parsed. Elements carrying that response's nonce (what a full\n * load would have run) get this document's nonce before parsing; nothing\n * else gains one. */\nconst adoptResponseNonce = (\n\tnav: Runtime,\n\thtml: string,\n\ttrust: ElementTrust\n) => {\n\tif (trust.kind !== 'nonce' || !nav.nonce) return { html, trust };\n\tconst pattern = new RegExp(\n\t\t`\\\\bnonce=([\"'])${escapeRegExp(trust.nonce)}\\\\1`,\n\t\t'g'\n\t);\n\tconst adopted: ElementTrust = { kind: 'nonce', nonce: nav.nonce };\n\n\treturn {\n\t\thtml: html.replace(pattern, `nonce=\"${nav.nonce}\"`),\n\t\ttrust: adopted\n\t};\n};\n\nconst loadDocument = async (nav: Runtime, url: URL, signal: AbortSignal) => {\n\tconst response = await fetchDocument(url, signal);\n\tconst contentType = response.headers.get('content-type') ?? '';\n\tconst finalUrl = new URL(response.url || url.href);\n\tfinalUrl.hash = url.hash;\n\tif (\n\t\t!response.ok ||\n\t\t!contentType.includes('text/html') ||\n\t\tfinalUrl.origin !== window.location.origin\n\t) {\n\t\tawait response.body?.cancel().catch(() => undefined);\n\n\t\treturn undefined;\n\t}\n\tconst { html, trust } = adoptResponseNonce(\n\t\tnav,\n\t\tawait response.text(),\n\t\treadTrust(response)\n\t);\n\tconst parsed = new DOMParser().parseFromString(html, 'text/html');\n\tconst loaded: LoadedDocument = {\n\t\tdocument: parsed,\n\t\ttrust,\n\t\turl: finalUrl\n\t};\n\n\treturn loaded;\n};\n\nconst isExecutableScript = (script: HTMLScriptElement) =>\n\tJAVASCRIPT_TYPES.has(\n\t\t(script.getAttribute('type') ?? '').trim().toLowerCase()\n\t);\n\n/* Swap each executable <script> for a comment so the parsed (inert)\n * elements never reach the live document; the comment marks where the\n * recreated script goes. */\nconst extractScripts = (loaded: LoadedDocument) =>\n\tArray.from(loaded.document.querySelectorAll('script'))\n\t\t.filter(isExecutableScript)\n\t\t.map((source) => {\n\t\t\tconst placeholder =\n\t\t\t\tloaded.document.createComment(SCRIPT_PLACEHOLDER);\n\t\t\tconst trusted = isTrusted(source, loaded.trust);\n\t\t\tsource.replaceWith(placeholder);\n\t\t\tconst pending: PendingScript = { placeholder, source, trusted };\n\n\t\t\treturn pending;\n\t\t});\n\n/* ------------------------------------------------------------------ */\n/* Stylesheets, head and body */\n/* ------------------------------------------------------------------ */\n\nconst applyNonce = (nav: Runtime, element: Element, trusted: boolean) => {\n\telement.removeAttribute('nonce');\n\t// The attribute (not just the property) so later readers of the page\n\t// nonce (`script[nonce], style[nonce]`) still find a carrier.\n\tif (trusted && nav.nonce) element.setAttribute('nonce', nav.nonce);\n};\n\nconst waitForStylesheet = (link: HTMLLinkElement) =>\n\tnew Promise<void>((resolve) => {\n\t\tconst timer = setTimeout(resolve, STYLESHEET_TIMEOUT_MS);\n\t\tconst done = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tresolve();\n\t\t};\n\t\tlink.addEventListener('load', done, { once: true });\n\t\tlink.addEventListener('error', done, { once: true });\n\t});\n\n/* Load the target's stylesheets before anything is torn down, inert\n * (`media=\"not all\"`) so they can't restyle the page still on screen. */\nconst preloadStylesheets = async (loaded: LoadedDocument) => {\n\tconst links = Array.from(\n\t\tloaded.document.head.querySelectorAll<HTMLLinkElement>(\n\t\t\t'link[rel~=\"stylesheet\"]'\n\t\t)\n\t);\n\tconst media = new Map<HTMLLinkElement, string | null>();\n\tfor (const link of links) {\n\t\tmedia.set(link, link.getAttribute('media'));\n\t\tlink.setAttribute('media', 'not all');\n\t\tdocument.head.append(document.adoptNode(link));\n\t}\n\tawait Promise.all(links.map(waitForStylesheet));\n\n\treturn media;\n};\n\nconst restoreMedia = (media: Map<HTMLLinkElement, string | null>) => {\n\tfor (const [link, value] of media) {\n\t\tif (value === null) link.removeAttribute('media');\n\t\telse link.setAttribute('media', value);\n\t}\n};\n\nconst elementKey = (element: Element) => {\n\tconst attributes = Array.from(element.attributes)\n\t\t.filter((attribute) => attribute.name !== 'nonce')\n\t\t.map((attribute) => `${attribute.name}=${attribute.value}`)\n\t\t.sort()\n\t\t.join('\\u0000');\n\n\treturn `${element.tagName}\\u0001${attributes}\\u0001${element.textContent ?? ''}`;\n};\n\nconst takeMatch = (available: Map<string, Element[]>, node: Element) =>\n\tavailable.get(elementKey(node))?.shift();\n\nconst syncAttributes = (target: Element, source: Element) => {\n\tfor (const attribute of Array.from(target.attributes)) {\n\t\tif (!source.hasAttribute(attribute.name))\n\t\t\ttarget.removeAttribute(attribute.name);\n\t}\n\tfor (const attribute of Array.from(source.attributes)) {\n\t\ttarget.setAttribute(attribute.name, attribute.value);\n\t}\n};\n\nconst indexHead = (preloaded: Set<Element>) => {\n\tconst available = new Map<string, Element[]>();\n\tfor (const child of Array.from(document.head.children)) {\n\t\tif (preloaded.has(child) || child.tagName === 'SCRIPT') continue;\n\t\tconst key = elementKey(child);\n\t\tavailable.set(key, [...(available.get(key) ?? []), child]);\n\t}\n\n\treturn available;\n};\n\nconst resolveHeadNode = (nav: Runtime, node: Node, context: HeadContext) => {\n\tif (!(node instanceof Element) || context.preloaded.has(node)) return node;\n\tconst existing = takeMatch(context.available, node);\n\tif (existing) return existing;\n\tif (node.tagName === 'STYLE') {\n\t\tapplyNonce(nav, node, isTrusted(node, context.trust));\n\t}\n\n\treturn document.adoptNode(node);\n};\n\n/* Keep head elements the two pages share (same tag, attributes and text):\n * no stylesheet reload, no favicon flash. Everything else is replaced.\n * Every node is kept in order, whitespace text and comments included:\n * Svelte hydrates `<svelte:head>` by walking those nodes, and a missing one\n * makes it throw the server markup away and mount again. */\nconst swapHead = (\n\tnav: Runtime,\n\tloaded: LoadedDocument,\n\theadNodes: Node[],\n\tpreloaded: Set<Element>\n) => {\n\tconst context: HeadContext = {\n\t\tavailable: indexHead(preloaded),\n\t\tpreloaded,\n\t\ttrust: loaded.trust\n\t};\n\tconst nextNodes = headNodes.map((node) =>\n\t\tresolveHeadNode(nav, node, context)\n\t);\n\tsyncAttributes(document.head, loaded.document.head);\n\tdocument.head.replaceChildren(...nextNodes);\n};\n\nconst swapBody = (nav: Runtime, loaded: LoadedDocument) => {\n\tfor (const style of Array.from(\n\t\tloaded.document.body.querySelectorAll('style')\n\t)) {\n\t\tapplyNonce(nav, style, isTrusted(style, loaded.trust));\n\t}\n\tconst nextBody = document.adoptNode(loaded.document.body);\n\tdocument.body.replaceWith(nextBody);\n};\n\nconst disposeCurrentPage = async () => {\n\tconst dispose: unknown = Reflect.get(window, DISPOSE_GLOBAL);\n\tReflect.set(window, DISPOSE_GLOBAL, undefined);\n\tReflect.set(window, READY_GLOBAL, undefined);\n\tif (typeof dispose === 'function') await Reflect.apply(dispose, window, []);\n};\n\nconst canTearDown = () =>\n\ttypeof Reflect.get(window, DISPOSE_GLOBAL) === 'function';\n\n/* ------------------------------------------------------------------ */\n/* Scripts */\n/* ------------------------------------------------------------------ */\n\nconst islandStateOf = (value: unknown) => (isRecord(value) ? value : undefined);\n\n/* A page with islands re-seeds `window.__ABS_ISLAND_STATE__` with the\n * server's store state. The live snapshot wins per store, the same rule\n * `initializeIslandStores` applies. */\nconst keepIslandState = (live: Record<string, unknown> | undefined) => {\n\tconst current = islandStateOf(Reflect.get(globalThis, ISLAND_STATE_GLOBAL));\n\tif (!live || current === live) return live;\n\tconst merged: Record<string, unknown> = { ...(current ?? {}), ...live };\n\tReflect.set(globalThis, ISLAND_STATE_GLOBAL, merged);\n\n\treturn merged;\n};\n\nconst loadEvent = (script: HTMLScriptElement) =>\n\tnew Promise<void>((resolve) => {\n\t\tscript.addEventListener('load', () => resolve(), { once: true });\n\t\tscript.addEventListener('error', () => resolve(), { once: true });\n\t});\n\nconst createScript = (nav: Runtime, pending: PendingScript) => {\n\tconst { source } = pending;\n\tconst script = document.createElement('script');\n\tArray.from(source.attributes)\n\t\t.filter(({ name }) => name !== 'nonce' && name !== 'src')\n\t\t.forEach(({ name, value }) => script.setAttribute(name, value));\n\tapplyNonce(nav, script, pending.trusted);\n\tconst src = source.getAttribute('src');\n\tconst isModule = source.type === 'module';\n\tif (src) script.src = isModule ? moduleUrlFor(nav, src) : src;\n\tif (!src) script.text = rewriteModuleSpecifiers(nav, source.text);\n\tif (src && !source.hasAttribute('async')) script.async = false;\n\n\treturn script;\n};\n\nconst runScript = async (\n\tnav: Runtime,\n\tpending: PendingScript,\n\tislandState: IslandStateRef\n) => {\n\tif (!pending.placeholder.isConnected) return;\n\tconst script = createScript(nav, pending);\n\tconst loaded = script.src ? loadEvent(script) : Promise.resolve();\n\tpending.placeholder.replaceWith(script);\n\tislandState.live = keepIslandState(islandState.live);\n\tawait loaded;\n\tislandState.live = keepIslandState(islandState.live);\n};\n\nconst clearPageGlobals = () => {\n\tfor (const name of PAGE_GLOBALS) Reflect.deleteProperty(window, name);\n};\n\n/* In document order, one at a time: an inline script that sets\n * `__INITIAL_PROPS__` has to run before the module that hydrates with it. */\nconst runScripts = (nav: Runtime, scripts: PendingScript[]) => {\n\tconst islandState: IslandStateRef = {\n\t\tlive: islandStateOf(Reflect.get(globalThis, ISLAND_STATE_GLOBAL))\n\t};\n\n\treturn scripts.reduce<Promise<void>>(\n\t\t(previous, pending) =>\n\t\t\tprevious.then(() => runScript(nav, pending, islandState)),\n\t\tPromise.resolve()\n\t);\n};\n\nconst pollForPage = async (deadline: number): Promise<void> => {\n\tif (canTearDown() || Date.now() >= deadline) return;\n\tawait delay(PAGE_READY_POLL_MS);\n\tawait pollForPage(deadline);\n};\n\n/* The hydration index registers `__ABSOLUTE_PAGE_DISPOSE__` once it has\n * mounted — possibly after an `import()` an inline bootstrap started. */\nconst waitForPageReady = async (hasModules: boolean) => {\n\tif (hasModules) await pollForPage(Date.now() + PAGE_READY_TIMEOUT_MS);\n\tconst ready: unknown = Reflect.get(window, READY_GLOBAL);\n\tif (ready instanceof Promise) await ready.catch(() => undefined);\n};\n\nconst loadsModules = (scripts: PendingScript[]) =>\n\tscripts.some(\n\t\t({ source }) =>\n\t\t\tsource.type === 'module' || /\\bimport\\s*\\(/.test(source.text)\n\t);\n\n/* ------------------------------------------------------------------ */\n/* Focus, announcement, events */\n/* ------------------------------------------------------------------ */\n\nconst ensureAnnouncer = () => {\n\tconst existing = document.getElementById(ANNOUNCER_ID);\n\tif (existing) return existing;\n\tconst region = document.createElement('div');\n\tregion.id = ANNOUNCER_ID;\n\tregion.setAttribute('aria-live', 'assertive');\n\tregion.setAttribute('aria-atomic', 'true');\n\tregion.setAttribute('role', 'status');\n\t// CSSOM, not a style attribute: a strict `style-src-attr` can't block it.\n\tObject.assign(region.style, {\n\t\tborder: '0',\n\t\tclip: 'rect(0 0 0 0)',\n\t\theight: '1px',\n\t\tmargin: '-1px',\n\t\toverflow: 'hidden',\n\t\tpadding: '0',\n\t\tposition: 'absolute',\n\t\twhiteSpace: 'nowrap',\n\t\twidth: '1px'\n\t});\n\tdocument.body.append(region);\n\n\treturn region;\n};\n\nconst announcePage = () => {\n\tconst heading = document.querySelector('h1')?.textContent?.trim();\n\tconst text = document.title || heading || window.location.pathname;\n\tensureAnnouncer().textContent = text;\n};\n\nconst resetFocus = () => {\n\tconst autofocus = document.querySelector<HTMLElement>('[autofocus]');\n\tif (autofocus) {\n\t\tautofocus.focus();\n\n\t\treturn;\n\t}\n\tif (document.activeElement instanceof HTMLElement) {\n\t\tdocument.activeElement.blur();\n\t}\n};\n\nconst dispatch = (\n\tname: string,\n\tdetail: DocumentNavigationEventDetail,\n\tcancelable: boolean\n) => window.dispatchEvent(new CustomEvent(name, { cancelable, detail }));\n\n/* ------------------------------------------------------------------ */\n/* The navigation */\n/* ------------------------------------------------------------------ */\n\nconst outcome = (value: DocumentNavigationOutcome) => value;\n\nconst reload = (request: NavigationRequest, committed: boolean) => {\n\tif (committed || request.type === 'traverse') window.location.reload();\n\telse if (request.replace) window.location.replace(request.url.href);\n\telse window.location.assign(request.url.href);\n\n\treturn outcome('reloaded');\n};\n\nconst commitHistory = (nav: Runtime, request: NavigationRequest, url: URL) => {\n\tnav.documentId = request.documentId ?? createId();\n\tif (request.type === 'traverse') {\n\t\trecordCurrentEntry(nav);\n\n\t\treturn;\n\t}\n\tconst key = currentEntryKey(nav);\n\tif (key !== undefined) {\n\t\tnav.scroll.set(key, { left: window.scrollX, top: window.scrollY });\n\t}\n\tconst state = stampState(null, nav.documentId, createId());\n\tif (request.replace) window.history.replaceState(state, '', url.href);\n\telse window.history.pushState(state, '', url.href);\n\trecordCurrentEntry(nav);\n};\n\nconst shouldAnimate = (nav: Runtime) =>\n\tnav.options.viewTransition !== false &&\n\ttypeof Reflect.get(document, 'startViewTransition') === 'function' &&\n\t!prefersReducedMotion();\n\nconst readPromise = (value: unknown, name: string) => {\n\tif (typeof value !== 'object' || value === null) return undefined;\n\tconst promise: unknown = Reflect.get(value, name);\n\n\treturn promise instanceof Promise ? promise : undefined;\n};\n\nconst runSwap = async (nav: Runtime, swap: () => Promise<void>) => {\n\tconst start: unknown = Reflect.get(document, 'startViewTransition');\n\tif (!shouldAnimate(nav) || typeof start !== 'function') {\n\t\tawait swap();\n\n\t\treturn;\n\t}\n\tconst transition: unknown = Reflect.apply(start, document, [swap]);\n\treadPromise(transition, 'ready')?.catch(() => undefined);\n\treadPromise(transition, 'finished')?.catch(() => undefined);\n\tawait readPromise(transition, 'updateCallbackDone');\n};\n\nconst swapDocument = async (\n\tnav: Runtime,\n\trequest: NavigationRequest,\n\tloaded: LoadedDocument,\n\tisStale: () => boolean\n) => {\n\tconst scripts = extractScripts(loaded);\n\t// Before the preload moves the stylesheet links out of the parsed head.\n\tconst headNodes = Array.from(loaded.document.head.childNodes);\n\tconst media = await preloadStylesheets(loaded);\n\tconst preloaded = new Set<Element>(media.keys());\n\t// A newer navigation started while the stylesheets loaded: it owns the\n\t// page now, so drop what this one added and stop.\n\tif (isStale()) {\n\t\tpreloaded.forEach((link) => link.remove());\n\n\t\treturn false;\n\t}\n\t// Outside the View Transition callback: the browser records the scroll\n\t// position of the entry being left when the new one is pushed, and inside\n\t// the callback it reads 0, which it then restores on a later back.\n\tcommitHistory(nav, request, loaded.url);\n\tconst swap = async () => {\n\t\tawait disposeCurrentPage();\n\t\tclearPageGlobals();\n\t\tsyncAttributes(\n\t\t\tdocument.documentElement,\n\t\t\tloaded.document.documentElement\n\t\t);\n\t\tswapHead(nav, loaded, headNodes, preloaded);\n\t\tswapBody(nav, loaded);\n\t\trestoreMedia(media);\n\t\tapplyScroll(request, loaded.url);\n\t};\n\tawait runSwap(nav, swap);\n\tresetFocus();\n\tawait runScripts(nav, scripts);\n\tawait waitForPageReady(loadsModules(scripts));\n\treapplyScroll(request, loaded.url);\n\tannouncePage();\n\n\treturn true;\n};\n\nconst isCurrent = (nav: Runtime, token: number) => nav.token === token;\n\nconst performNavigation = async (nav: Runtime, request: NavigationRequest) => {\n\tnav.token += 1;\n\tconst { token } = nav;\n\tnav.controller?.abort();\n\tconst controller = new AbortController();\n\tnav.controller = controller;\n\tconst detail: DocumentNavigationEventDetail = {\n\t\ttype: request.type,\n\t\turl: request.url.href\n\t};\n\tconst proceed = dispatch(\n\t\t'absolute:before-navigate',\n\t\tdetail,\n\t\trequest.type !== 'traverse'\n\t);\n\tif (!proceed) return outcome('cancelled');\n\tif (!canTearDown()) return reload(request, false);\n\n\tconst committedBefore = nav.documentId;\n\ttry {\n\t\tconst loaded = await loadDocument(nav, request.url, controller.signal);\n\t\tif (!isCurrent(nav, token)) return outcome('superseded');\n\t\tif (!loaded) return reload(request, false);\n\t\tnav.navigating = true;\n\t\tconst swapped = await swapDocument(\n\t\t\tnav,\n\t\t\trequest,\n\t\t\tloaded,\n\t\t\t() => !isCurrent(nav, token)\n\t\t);\n\t\tif (!swapped) return outcome('superseded');\n\t\tdispatch('absolute:after-navigate', detail, false);\n\n\t\treturn outcome('swapped');\n\t} catch (error) {\n\t\tif (!isCurrent(nav, token)) return outcome('superseded');\n\t\tconsole.error('[absolute] navigation failed, loading the page:', error);\n\n\t\treturn reload(request, nav.documentId !== committedBefore);\n\t} finally {\n\t\tif (isCurrent(nav, token)) nav.navigating = false;\n\t}\n};\n\n/* ------------------------------------------------------------------ */\n/* Interception */\n/* ------------------------------------------------------------------ */\n\nconst isModifiedClick = (event: MouseEvent) =>\n\tevent.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\nconst isSamePageFragment = (url: URL) =>\n\turl.hash !== '' &&\n\turl.pathname === window.location.pathname &&\n\turl.search === window.location.search;\n\nconst findAnchor = (event: MouseEvent) => {\n\tconst { target } = event;\n\tif (!(target instanceof Element)) return null;\n\n\treturn target.closest<HTMLAnchorElement>('a[href]');\n};\n\nconst isPlainClick = (event: MouseEvent) =>\n\t!event.defaultPrevented && event.button === 0 && !isModifiedClick(event);\n\nconst isOptedOut = (anchor: HTMLAnchorElement) =>\n\t(anchor.target !== '' && anchor.target !== '_self') ||\n\tanchor.hasAttribute('download') ||\n\tanchor.relList.contains('external') ||\n\tanchor.closest(OPT_OUT_SELECTOR) !== null;\n\nconst interceptableUrl = (nav: Runtime, anchor: HTMLAnchorElement) => {\n\tif (isOptedOut(anchor)) return undefined;\n\tconst url = new URL(anchor.href, window.location.href);\n\tif (url.origin !== window.location.origin) return undefined;\n\tif (isSamePageFragment(url)) return undefined;\n\tif (nav.options.shouldIntercept?.(url) === false) return undefined;\n\n\treturn url;\n};\n\n/* Bubble phase on window: runs after every framework router's handler, so\n * a click a router handled (`preventDefault`) never reaches this. */\nconst listenForClicks = (nav: Runtime) => {\n\tconst onClick = (event: MouseEvent) => {\n\t\tif (!isPlainClick(event)) return;\n\t\tconst anchor = findAnchor(event);\n\t\tconst url = anchor ? interceptableUrl(nav, anchor) : undefined;\n\t\tif (!url || !canTearDown()) return;\n\t\tevent.preventDefault();\n\t\tvoid performNavigation(nav, { replace: false, type: 'link', url });\n\t};\n\twindow.addEventListener('click', onClick);\n\tnav.teardown.push(() => window.removeEventListener('click', onClick));\n};\n\n/* Capture phase, so it runs before the routers' popstate listeners: a\n * traversal onto another document's entry is stopped here and swapped. */\nconst listenForTraversals = (nav: Runtime) => {\n\tconst onPopState = (event: PopStateEvent) => {\n\t\tif (!isForeignEntry(nav)) return;\n\t\tevent.stopImmediatePropagation();\n\t\tconst owner = currentEntryOwner(nav);\n\t\tconst key = currentEntryKey(nav);\n\t\tvoid performNavigation(nav, {\n\t\t\tdocumentId: owner,\n\t\t\treplace: false,\n\t\t\tscroll: key === undefined ? undefined : nav.scroll.get(key),\n\t\t\ttype: 'traverse',\n\t\t\turl: new URL(window.location.href)\n\t\t});\n\t};\n\twindow.addEventListener('popstate', onPopState, { capture: true });\n\tnav.teardown.push(() =>\n\t\twindow.removeEventListener('popstate', onPopState, { capture: true })\n\t);\n};\n\n/* ------------------------------------------------------------------ */\n/* Public API */\n/* ------------------------------------------------------------------ */\n\n/** Turn the layer off: listeners removed, history methods restored. */\nexport const disableNavigation = () => {\n\tconst installed = readPublicRuntime();\n\tif (installed && typeof installed.disable === 'function') {\n\t\tReflect.apply(installed.disable, undefined, []);\n\t}\n};\n\nconst teardownRuntime = (nav: Runtime) => {\n\tnav.controller?.abort();\n\tfor (const cleanup of nav.teardown.splice(0)) cleanup();\n\tnav.restoreHistory?.();\n\tReflect.deleteProperty(globalThis, RUNTIME_KEY);\n\tif (runtime === nav) runtime = undefined;\n};\n\nconst navigateWith =\n\t(nav: Runtime) =>\n\t(href: string, options: NavigateDocumentOptions = {}) => {\n\t\tconst url = new URL(href, window.location.href);\n\t\tif (url.origin !== window.location.origin) {\n\t\t\twindow.location.assign(url.href);\n\n\t\t\treturn Promise.resolve<DocumentNavigationOutcome>('reloaded');\n\t\t}\n\n\t\treturn performNavigation(nav, {\n\t\t\treplace: options.replace === true,\n\t\t\ttype: 'navigate',\n\t\t\turl\n\t\t});\n\t};\n\n/**\n * Install cross-framework document navigation for this tab. Idempotent:\n * every page can call it (each framework bundle carries its own copy of\n * this module; the first call wins and its options apply).\n */\nexport const enableNavigation = (options: EnableNavigationOptions = {}) => {\n\tif (typeof window === 'undefined' || readPublicRuntime()) return;\n\tconst navigationApi = readNavigationApi();\n\tconst nav: Runtime = {\n\t\tcontroller: undefined,\n\t\tdocumentId: createId(),\n\t\tentryOwners: new Map(),\n\t\tevaluatedModules: new Set(),\n\t\tmoduleRun: 0,\n\t\tnavigating: false,\n\t\tnavigationApi,\n\t\tnonce: readPageNonce(),\n\t\toptions,\n\t\trestoreHistory: undefined,\n\t\tscroll: new Map(),\n\t\tscrollFrame: 0,\n\t\tteardown: [],\n\t\ttoken: 0\n\t};\n\truntime = nav;\n\tif (navigationApi) trackEntries(nav, navigationApi);\n\telse patchHistory(nav);\n\trememberDocumentModules(nav);\n\ttrackScroll(nav);\n\tlistenForClicks(nav);\n\tlistenForTraversals(nav);\n\tconst publicRuntime: PublicRuntime = {\n\t\tnavigate: navigateWith(nav),\n\t\tdisable: () => teardownRuntime(nav)\n\t};\n\tReflect.set(globalThis, RUNTIME_KEY, publicRuntime);\n};\n\nconst OUTCOMES = new Set<unknown>([\n\t'cancelled',\n\t'reloaded',\n\t'superseded',\n\t'swapped'\n]);\n\nconst isOutcome = (value: unknown): value is DocumentNavigationOutcome =>\n\tOUTCOMES.has(value);\n\n/** Whether `enableNavigation()` is active in this tab. */\nexport const isNavigationEnabled = () =>\n\ttypeof window !== 'undefined' && readPublicRuntime() !== undefined;\n\n/**\n * Navigate to `href` through the layer: a soft swap when it is enabled\n * and the page can be torn down, a normal page load otherwise.\n */\nexport const navigateDocument = async (\n\thref: string,\n\toptions: NavigateDocumentOptions = {}\n) => {\n\tconst installed = readPublicRuntime();\n\tconst navigate = installed?.navigate;\n\tif (typeof navigate === 'function') {\n\t\tconst result: unknown = await Reflect.apply(navigate, undefined, [\n\t\t\thref,\n\t\t\toptions\n\t\t]);\n\t\tif (isOutcome(result)) return result;\n\t}\n\tif (options.replace) window.location.replace(href);\n\telse window.location.assign(href);\n\n\treturn outcome('reloaded');\n};\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;;;;;AA2CA,IAAM,cAAc,OAAO,IAAI,uBAAuB;AACtD,IAAM,YAAY;AAClB,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AACzB,IAAM,eAAe;AACrB,IAAM,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AAY,GAAG;AAAA,EACf,gBAAgB,GAAG;AAAA,EACnB,oBAAoB,GAAG;AAAA,EACvB,MAAM,gBAA+B;AAAA,IACpC,UAAU,aAAa,GAAG;AAAA,IAC1B,SAAS,MAAM,gBAAgB,GAAG;AAAA,EACnC;AAAA,EACA,QAAQ,IAAI,YAAY,aAAa,aAAa;AAAA;AAGnD,IAAM,WAAW,IAAI,IAAa;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAED,IAAM,YAAY,CAAC,UAClB,SAAS,IAAI,KAAK;AAGZ,IAAM,sBAAsB,MAClC,OAAO,WAAW,eAAe,kBAAkB,MAAM;AAMnD,IAAM,mBAAmB,OAC/B,MACA,UAAmC,CAAC,MAChC;AAAA,EACJ,MAAM,YAAY,kBAAkB;AAAA,EACpC,MAAM,WAAW,WAAW;AAAA,EAC5B,IAAI,OAAO,aAAa,YAAY;AAAA,IACnC,MAAM,SAAkB,MAAM,QAAQ,MAAM,UAAU,WAAW;AAAA,MAChE;AAAA,MACA;AAAA,IACD,CAAC;AAAA,IACD,IAAI,UAAU,MAAM;AAAA,MAAG,OAAO;AAAA,EAC/B;AAAA,EACA,IAAI,QAAQ;AAAA,IAAS,OAAO,SAAS,QAAQ,IAAI;AAAA,EAC5C;AAAA,WAAO,SAAS,OAAO,IAAI;AAAA,EAEhC,OAAO,QAAQ,UAAU;AAAA;",
|
|
8
|
+
"debugId": "1B604181BCFC6A6964756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,13 +1,58 @@
|
|
|
1
1
|
import type {} from '../../types/globals';
|
|
2
2
|
/* Snapshot/restore for JS-modified DOM state across HMR updates.
|
|
3
3
|
* Before patching, captures text and dynamic children of elements with IDs.
|
|
4
|
-
* After patching, restores values that were changed by user scripts.
|
|
4
|
+
* After patching, restores values that were changed by user scripts.
|
|
5
|
+
*
|
|
6
|
+
* "Changed by user scripts" means the live value differs from what the
|
|
7
|
+
* server last sent for that element (the baseline), not from what it sends
|
|
8
|
+
* now. Comparing against the new markup alone would treat every edited
|
|
9
|
+
* text as a script change and put the old text back. The baseline is the
|
|
10
|
+
* page as parsed when the HMR client starts (captureServerDOM), then each
|
|
11
|
+
* update's markup. */
|
|
5
12
|
|
|
6
13
|
type DOMSnapshot = {
|
|
7
14
|
children: Map<string, string>;
|
|
8
15
|
text: Map<string, string>;
|
|
9
16
|
};
|
|
10
17
|
|
|
18
|
+
let serverBaseline: DOMSnapshot | null = null;
|
|
19
|
+
|
|
20
|
+
const collectIdState = (root: ParentNode): DOMSnapshot => {
|
|
21
|
+
const text = new Map<string, string>();
|
|
22
|
+
const children = new Map<string, string>();
|
|
23
|
+
|
|
24
|
+
root.querySelectorAll('[id]').forEach((elem) => {
|
|
25
|
+
const { childNodes } = elem;
|
|
26
|
+
const isTextLeaf = Array.from(childNodes).every(
|
|
27
|
+
(child) => child.nodeType === Node.TEXT_NODE
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (isTextLeaf && childNodes.length > 0) {
|
|
31
|
+
text.set(elem.id, elem.textContent || '');
|
|
32
|
+
} else if (elem.children.length > 0) {
|
|
33
|
+
children.set(elem.id, elem.innerHTML);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return { children, text };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/* Record the server-rendered DOM as the baseline. Call once, when the HMR
|
|
41
|
+
* client starts: it runs at the end of <body>, before most page scripts
|
|
42
|
+
* have changed anything. */
|
|
43
|
+
export const captureServerDOM = (root: ParentNode | null | undefined) => {
|
|
44
|
+
if (!root || serverBaseline) return;
|
|
45
|
+
serverBaseline = collectIdState(root);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/* True when the live value still matches what the server last sent, i.e.
|
|
49
|
+
* no script touched it: the new server value wins. */
|
|
50
|
+
const isUntouched = (
|
|
51
|
+
baseline: Map<string, string> | undefined,
|
|
52
|
+
elId: string,
|
|
53
|
+
liveValue: string
|
|
54
|
+
) => baseline?.has(elId) === true && baseline.get(elId) === liveValue;
|
|
55
|
+
|
|
11
56
|
export const restoreDOMChanges = (
|
|
12
57
|
root: HTMLElement,
|
|
13
58
|
snapshot: DOMSnapshot,
|
|
@@ -15,12 +60,14 @@ export const restoreDOMChanges = (
|
|
|
15
60
|
) => {
|
|
16
61
|
const tempDiv = document.createElement('div');
|
|
17
62
|
tempDiv.innerHTML = newHTML;
|
|
63
|
+
const baseline = serverBaseline;
|
|
18
64
|
|
|
19
65
|
/* Restore JS-modified text on leaf elements */
|
|
20
66
|
snapshot.text.forEach((liveText, elId) => {
|
|
21
67
|
const newEl = tempDiv.querySelector(`#${CSS.escape(elId)}`);
|
|
22
68
|
const newText = newEl ? newEl.textContent || '' : '';
|
|
23
69
|
if (liveText === newText) return;
|
|
70
|
+
if (isUntouched(baseline?.text, elId, liveText)) return;
|
|
24
71
|
|
|
25
72
|
const liveEl = root.querySelector(`#${CSS.escape(elId)}`);
|
|
26
73
|
if (liveEl) {
|
|
@@ -33,29 +80,15 @@ export const restoreDOMChanges = (
|
|
|
33
80
|
const newEl = tempDiv.querySelector(`#${CSS.escape(elId)}`);
|
|
34
81
|
const newInner = newEl ? newEl.innerHTML : '';
|
|
35
82
|
if (liveHTML === newInner || liveHTML.length <= newInner.length) return;
|
|
83
|
+
if (isUntouched(baseline?.children, elId, liveHTML)) return;
|
|
36
84
|
|
|
37
85
|
const liveEl = root.querySelector(`#${CSS.escape(elId)}`);
|
|
38
86
|
if (liveEl) {
|
|
39
87
|
liveEl.innerHTML = liveHTML;
|
|
40
88
|
}
|
|
41
89
|
});
|
|
42
|
-
};
|
|
43
|
-
export const snapshotDOMChanges = (root: HTMLElement): DOMSnapshot => {
|
|
44
|
-
const text = new Map<string, string>();
|
|
45
|
-
const children = new Map<string, string>();
|
|
46
|
-
|
|
47
|
-
root.querySelectorAll('[id]').forEach((elem) => {
|
|
48
|
-
const { childNodes } = elem;
|
|
49
|
-
const isTextLeaf = Array.from(childNodes).every(
|
|
50
|
-
(child) => child.nodeType === Node.TEXT_NODE
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
if (isTextLeaf && childNodes.length > 0) {
|
|
54
|
-
text.set(elem.id, elem.textContent || '');
|
|
55
|
-
} else if (elem.children.length > 0) {
|
|
56
|
-
children.set(elem.id, elem.innerHTML);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
90
|
|
|
60
|
-
|
|
91
|
+
// The markup just applied is what the server sent last.
|
|
92
|
+
serverBaseline = collectIdState(tempDiv);
|
|
61
93
|
};
|
|
94
|
+
export const snapshotDOMChanges = (root: HTMLElement) => collectIdState(root);
|
|
@@ -61,3 +61,14 @@ export const getComponentNameFromPath = (filePath: string) => {
|
|
|
61
61
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
62
62
|
.join('');
|
|
63
63
|
};
|
|
64
|
+
/* Static (HTML/HTMX) pages are told which built page they are (see
|
|
65
|
+
* injectHMRIntoHTMLFile in build.ts). Every tab receives every page's
|
|
66
|
+
* html-update / htmx-update, so a tab applies only its own page's. A
|
|
67
|
+
* document without a page name (older builds) applies all of them. */
|
|
68
|
+
export const isUpdateForThisPage = (sourceFile: unknown) => {
|
|
69
|
+
const page = window.__HMR_PAGE__;
|
|
70
|
+
if (!page || typeof sourceFile !== 'string') return true;
|
|
71
|
+
const normalized = sourceFile.replace(/\\/g, '/');
|
|
72
|
+
|
|
73
|
+
return normalized.slice(normalized.lastIndexOf('/') + 1) === page;
|
|
74
|
+
};
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
} from '../domState';
|
|
15
15
|
import { processCSSLinks, waitForCSSAndUpdate } from '../cssUtils';
|
|
16
16
|
import { patchHeadInPlace } from '../headPatch';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
detectCurrentFramework,
|
|
19
|
+
isUpdateForThisPage
|
|
20
|
+
} from '../frameworkDetect';
|
|
18
21
|
import type { ScriptInfo } from '../../../types/client';
|
|
19
22
|
import { restoreDOMChanges, snapshotDOMChanges } from '../domTracker';
|
|
20
23
|
import { hmrState } from '../hmrState';
|
|
@@ -86,6 +89,7 @@ export const handleHTMLUpdate = (message: {
|
|
|
86
89
|
data: {
|
|
87
90
|
html?: string | { body?: string; head?: string } | null;
|
|
88
91
|
serverDuration?: number;
|
|
92
|
+
sourceFile?: string;
|
|
89
93
|
};
|
|
90
94
|
timestamp?: number;
|
|
91
95
|
}) => {
|
|
@@ -93,6 +97,7 @@ export const handleHTMLUpdate = (message: {
|
|
|
93
97
|
if (htmlFrameworkCheck !== 'html') {
|
|
94
98
|
return;
|
|
95
99
|
}
|
|
100
|
+
if (!isUpdateForThisPage(message.data.sourceFile)) return;
|
|
96
101
|
|
|
97
102
|
if (window.__REACT_ROOT__) {
|
|
98
103
|
window.__REACT_ROOT__ = undefined;
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
} from '../domState';
|
|
15
15
|
import { processCSSLinks, waitForCSSAndUpdate } from '../cssUtils';
|
|
16
16
|
import { patchHeadInPlace } from '../headPatch';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
detectCurrentFramework,
|
|
19
|
+
isUpdateForThisPage
|
|
20
|
+
} from '../frameworkDetect';
|
|
18
21
|
import { type HTMXSavedState, type ScriptInfo } from '../../../types/client';
|
|
19
22
|
import { hmrState } from '../hmrState';
|
|
20
23
|
import { sendAbsoluteHmrTiming } from '../hmrTiming';
|
|
@@ -72,11 +75,13 @@ export const handleHTMXUpdate = (message: {
|
|
|
72
75
|
data: {
|
|
73
76
|
html?: string | { body?: string; head?: string } | null;
|
|
74
77
|
serverDuration?: number;
|
|
78
|
+
sourceFile?: string;
|
|
75
79
|
};
|
|
76
80
|
timestamp?: number;
|
|
77
81
|
}) => {
|
|
78
82
|
const htmxFrameworkCheck = detectCurrentFramework();
|
|
79
83
|
if (htmxFrameworkCheck !== 'htmx') return;
|
|
84
|
+
if (!isUpdateForThisPage(message.data.sourceFile)) return;
|
|
80
85
|
|
|
81
86
|
if (window.__REACT_ROOT__) {
|
|
82
87
|
window.__REACT_ROOT__ = undefined;
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type ServerSnapshot
|
|
16
16
|
} from './reconnect';
|
|
17
17
|
import { detectCurrentFramework } from './frameworkDetect';
|
|
18
|
+
import { captureServerDOM } from './domTracker';
|
|
18
19
|
import {
|
|
19
20
|
absoluteHmrClientTarget,
|
|
20
21
|
restoreAbsoluteHmrApply,
|
|
@@ -159,6 +160,15 @@ if (typeof window !== 'undefined') {
|
|
|
159
160
|
if (!window.__HMR_SERVER_VERSIONS__) {
|
|
160
161
|
window.__HMR_SERVER_VERSIONS__ = {};
|
|
161
162
|
}
|
|
163
|
+
// Static pages: remember the server-rendered text of elements with an
|
|
164
|
+
// id, so an HMR update can tell script changes from edited markup.
|
|
165
|
+
const framework = window.__HMR_FRAMEWORK__;
|
|
166
|
+
if (
|
|
167
|
+
(framework === 'html' || framework === 'htmx') &&
|
|
168
|
+
typeof document !== 'undefined'
|
|
169
|
+
) {
|
|
170
|
+
captureServerDOM(document.body);
|
|
171
|
+
}
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
// Catch uncaught runtime errors and show the error overlay
|