gemi 0.199.1 → 0.201.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/ai/Agent.d.ts +30 -1
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/AgentProvider.d.ts +12 -0
  4. package/dist/ai/AgentProvider.d.ts.map +1 -1
  5. package/dist/ai/index.d.ts +1 -1
  6. package/dist/ai/index.d.ts.map +1 -1
  7. package/dist/ai/index.js +3 -3
  8. package/dist/ai/index.js.map +4 -4
  9. package/dist/ai/providers/request.d.ts +4 -0
  10. package/dist/ai/providers/request.d.ts.map +1 -1
  11. package/dist/{chunk-h49w47dh.js → chunk-1qw9qz03.js} +2 -2
  12. package/dist/{chunk-h49w47dh.js.map → chunk-1qw9qz03.js.map} +1 -1
  13. package/dist/{chunk-2kkv8515.js → chunk-952ek0kg.js} +26 -26
  14. package/dist/{chunk-2kkv8515.js.map → chunk-952ek0kg.js.map} +3 -3
  15. package/dist/{chunk-mxt88hhp.js → chunk-dp2r3vkj.js} +1 -1
  16. package/dist/chunk-ff22412e.js.map +2 -2
  17. package/dist/{chunk-wn9n51t0.js → chunk-q2dypdf5.js} +1 -1
  18. package/dist/{chunk-dcnzh5tt.js → chunk-ty7tv5ab.js} +1 -1
  19. package/dist/chunks/{RealtimeClient-B7zh4okq.js → RealtimeClient-DmBC8zxt.js} +2 -2
  20. package/dist/chunks/{RealtimeClient-B7zh4okq.js.map → RealtimeClient-DmBC8zxt.js.map} +1 -1
  21. package/dist/chunks/{ThemeProvider-D33bPpf8.js → ThemeProvider-BTVQYl5O.js} +119 -14
  22. package/dist/chunks/ThemeProvider-BTVQYl5O.js.map +1 -0
  23. package/dist/chunks/{fetchFileRequest-Cp0QjioM.js → fetchFileRequest-BHCSZqKL.js} +2 -2
  24. package/dist/chunks/{fetchFileRequest-Cp0QjioM.js.map → fetchFileRequest-BHCSZqKL.js.map} +1 -1
  25. package/dist/chunks/{live-D08wnrrZ.js → live-DIj7rF0t.js} +3 -3
  26. package/dist/chunks/{live-D08wnrrZ.js.map → live-DIj7rF0t.js.map} +1 -1
  27. package/dist/chunks/{mutationExtras-BbDboF8F.js → mutationExtras-BRFfb6-L.js} +2 -2
  28. package/dist/chunks/{mutationExtras-BbDboF8F.js.map → mutationExtras-BRFfb6-L.js.map} +1 -1
  29. package/dist/chunks/{subscriptionStream-CRj9aV4K.js → subscriptionStream-CRRgUXJp.js} +2 -2
  30. package/dist/chunks/{subscriptionStream-CRj9aV4K.js.map → subscriptionStream-CRRgUXJp.js.map} +1 -1
  31. package/dist/chunks/useParams-BN3XXfmG.js.map +1 -1
  32. package/dist/client/ClientRouter.d.ts +0 -1
  33. package/dist/client/ClientRouter.d.ts.map +1 -1
  34. package/dist/client/ClientRouterContext.d.ts +0 -5
  35. package/dist/client/ClientRouterContext.d.ts.map +1 -1
  36. package/dist/client/RouteStateContext.d.ts +5 -0
  37. package/dist/client/RouteStateContext.d.ts.map +1 -1
  38. package/dist/client/index.js +22 -29
  39. package/dist/client/index.js.map +1 -1
  40. package/dist/client/scrollRestoration.d.ts +37 -0
  41. package/dist/client/scrollRestoration.d.ts.map +1 -0
  42. package/dist/kernel/index.js +1 -1
  43. package/dist/server/index.js +1 -1
  44. package/dist/services/index.js +1 -1
  45. package/dist/testing/index.js +2 -2
  46. package/package.json +1 -1
  47. package/dist/chunks/ThemeProvider-D33bPpf8.js.map +0 -1
  48. /package/dist/{chunk-mxt88hhp.js.map → chunk-dp2r3vkj.js.map} +0 -0
  49. /package/dist/{chunk-wn9n51t0.js.map → chunk-q2dypdf5.js.map} +0 -0
  50. /package/dist/{chunk-dcnzh5tt.js.map → chunk-ty7tv5ab.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { $ as applyParams, gt as parseRetryAfter, yt as QueryError } from "./ThemeProvider-D33bPpf8.js";
1
+ import { _t as parseRetryAfter, bt as QueryError, et as applyParams } from "./ThemeProvider-BTVQYl5O.js";
2
2
  //#region client/fetchFileRequest.ts
3
3
  /**
4
4
  * `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a
@@ -54,4 +54,4 @@ function filenameOf(response) {
54
54
  //#endregion
55
55
  export { fetchFile, filenameOf };
56
56
 
57
- //# sourceMappingURL=fetchFileRequest-Cp0QjioM.js.map
57
+ //# sourceMappingURL=fetchFileRequest-BHCSZqKL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchFileRequest-Cp0QjioM.js","names":[],"sources":["../../client/fetchFileRequest.ts"],"sourcesContent":["import { applyParams } from \"../utils/applyParams\";\nimport type { FetchedBlob, FetchedText, FetchFileOptions } from \"./fetchFile\";\nimport { QueryError } from \"./QueryError\";\nimport { parseRetryAfter } from \"./retryPolicy\";\n\n// What `fetchBlob` and `fetchText` in `./fetchFile` load on their first call\n// (#915).\n\ntype RequestOptions = Omit<FetchFileOptions<string>, \"params\"> & {\n params?: Record<string, string | number | undefined>;\n};\n\n/**\n * `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a\n * non-2xx, and the body read `as` a blob or text.\n */\nexport async function fetchFile(\n path: string,\n // The caller's `FetchFileOptions<P>`, checked against its path there.\n options: object | undefined,\n as: \"blob\" | \"text\",\n): Promise<FetchedBlob | FetchedText> {\n const response = await request(path, options as RequestOptions);\n const body = as === \"blob\" ? { blob: await response.blob() } : { text: await response.text() };\n return { ...body, filename: filenameOf(response), response } as FetchedBlob | FetchedText;\n}\n\nasync function request(path: string, options: RequestOptions = {}) {\n const { params = {}, search, signal, init } = options;\n const url = applyParams(path, params);\n const query = searchString(search);\n const response = await fetch(`/api${url}${query ? `?${query}` : \"\"}`, {\n ...init,\n method: \"GET\",\n signal,\n });\n if (!response.ok) {\n // An error body that is not JSON (a proxy's HTML 502) is still that status.\n const body = await response.json().catch(() => null);\n throw new QueryError(\n url,\n query,\n response.status,\n body,\n parseRetryAfter(response.headers.get(\"retry-after\")),\n );\n }\n return response;\n}\n\nfunction searchString(search: FetchFileOptions<string>[\"search\"]) {\n if (!search) return \"\";\n if (search instanceof URLSearchParams) return search.toString();\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(search)) {\n if (value !== null && value !== undefined) params.append(key, String(value));\n }\n return params.toString();\n}\n\n/**\n * The file name in a `Content-Disposition` header: the RFC 5987\n * `filename*=UTF-8''...` form when present and decodable, else `filename`.\n *\n * @internal Exported for tests.\n */\nexport function filenameOf(response: Response): string | null {\n const header = response.headers.get(\"content-disposition\");\n if (!header) return null;\n const extended = /filename\\*\\s*=\\s*([^']*)'[^']*'([^;]+)/i.exec(header);\n if (extended) {\n try {\n return decodeURIComponent(extended[2].trim());\n } catch {\n // A malformed escape: fall back to the plain form.\n }\n }\n const plain = /filename\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|([^;]+))/i.exec(header);\n if (!plain) return null;\n const name = plain[1] !== undefined ? plain[1].replace(/\\\\(.)/g, \"$1\") : plain[2].trim();\n return name || null;\n}\n"],"mappings":";;;;;;AAgBA,eAAsB,UACpB,MAEA,SACA,IACoC;CACpC,MAAM,WAAW,MAAM,QAAQ,MAAM,OAAyB;CAE9D,OAAO;EAAE,GADI,OAAO,SAAS,EAAE,MAAM,MAAM,SAAS,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,SAAS,KAAK,EAAE;EAC3E,UAAU,WAAW,QAAQ;EAAG;CAAS;AAC7D;AAEA,eAAe,QAAQ,MAAc,UAA0B,CAAC,GAAG;CACjE,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,QAAQ,SAAS;CAC9C,MAAM,MAAM,YAAY,MAAM,MAAM;CACpC,MAAM,QAAQ,aAAa,MAAM;CACjC,MAAM,WAAW,MAAM,MAAM,OAAO,MAAM,QAAQ,IAAI,UAAU,MAAM;EACpE,GAAG;EACH,QAAQ;EACR;CACF,CAAC;CACD,IAAI,CAAC,SAAS,IAAI;EAEhB,MAAM,OAAO,MAAM,SAAS,KAAK,CAAC,CAAC,YAAY,IAAI;EACnD,MAAM,IAAI,WACR,KACA,OACA,SAAS,QACT,MACA,gBAAgB,SAAS,QAAQ,IAAI,aAAa,CAAC,CACrD;CACF;CACA,OAAO;AACT;AAEA,SAAS,aAAa,QAA4C;CAChE,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,kBAAkB,iBAAiB,OAAO,OAAO,SAAS;CAC9D,MAAM,SAAS,IAAI,gBAAgB;CACnC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO,OAAO,KAAK,OAAO,KAAK,CAAC;CAE7E,OAAO,OAAO,SAAS;AACzB;;;;;;;AAQA,SAAgB,WAAW,UAAmC;CAC5D,MAAM,SAAS,SAAS,QAAQ,IAAI,qBAAqB;CACzD,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,WAAW,0CAA0C,KAAK,MAAM;CACtE,IAAI,UACF,IAAI;EACF,OAAO,mBAAmB,SAAS,EAAE,CAAC,KAAK,CAAC;CAC9C,QAAQ,CAER;CAEF,MAAM,QAAQ,kDAAkD,KAAK,MAAM;CAC3E,IAAI,CAAC,OAAO,OAAO;CAEnB,QADa,MAAM,OAAO,KAAA,IAAY,MAAM,EAAE,CAAC,QAAQ,UAAU,IAAI,IAAI,MAAM,EAAE,CAAC,KAAK,MACxE;AACjB"}
1
+ {"version":3,"file":"fetchFileRequest-BHCSZqKL.js","names":[],"sources":["../../client/fetchFileRequest.ts"],"sourcesContent":["import { applyParams } from \"../utils/applyParams\";\nimport type { FetchedBlob, FetchedText, FetchFileOptions } from \"./fetchFile\";\nimport { QueryError } from \"./QueryError\";\nimport { parseRetryAfter } from \"./retryPolicy\";\n\n// What `fetchBlob` and `fetchText` in `./fetchFile` load on their first call\n// (#915).\n\ntype RequestOptions = Omit<FetchFileOptions<string>, \"params\"> & {\n params?: Record<string, string | number | undefined>;\n};\n\n/**\n * `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a\n * non-2xx, and the body read `as` a blob or text.\n */\nexport async function fetchFile(\n path: string,\n // The caller's `FetchFileOptions<P>`, checked against its path there.\n options: object | undefined,\n as: \"blob\" | \"text\",\n): Promise<FetchedBlob | FetchedText> {\n const response = await request(path, options as RequestOptions);\n const body = as === \"blob\" ? { blob: await response.blob() } : { text: await response.text() };\n return { ...body, filename: filenameOf(response), response } as FetchedBlob | FetchedText;\n}\n\nasync function request(path: string, options: RequestOptions = {}) {\n const { params = {}, search, signal, init } = options;\n const url = applyParams(path, params);\n const query = searchString(search);\n const response = await fetch(`/api${url}${query ? `?${query}` : \"\"}`, {\n ...init,\n method: \"GET\",\n signal,\n });\n if (!response.ok) {\n // An error body that is not JSON (a proxy's HTML 502) is still that status.\n const body = await response.json().catch(() => null);\n throw new QueryError(\n url,\n query,\n response.status,\n body,\n parseRetryAfter(response.headers.get(\"retry-after\")),\n );\n }\n return response;\n}\n\nfunction searchString(search: FetchFileOptions<string>[\"search\"]) {\n if (!search) return \"\";\n if (search instanceof URLSearchParams) return search.toString();\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(search)) {\n if (value !== null && value !== undefined) params.append(key, String(value));\n }\n return params.toString();\n}\n\n/**\n * The file name in a `Content-Disposition` header: the RFC 5987\n * `filename*=UTF-8''...` form when present and decodable, else `filename`.\n *\n * @internal Exported for tests.\n */\nexport function filenameOf(response: Response): string | null {\n const header = response.headers.get(\"content-disposition\");\n if (!header) return null;\n const extended = /filename\\*\\s*=\\s*([^']*)'[^']*'([^;]+)/i.exec(header);\n if (extended) {\n try {\n return decodeURIComponent(extended[2].trim());\n } catch {\n // A malformed escape: fall back to the plain form.\n }\n }\n const plain = /filename\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|([^;]+))/i.exec(header);\n if (!plain) return null;\n const name = plain[1] !== undefined ? plain[1].replace(/\\\\(.)/g, \"$1\") : plain[2].trim();\n return name || null;\n}\n"],"mappings":";;;;;;AAgBA,eAAsB,UACpB,MAEA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QAAQ,CAER;CAEF,MAAM,QAAQ,kDAAkD,KAAK,MAAM;CAC3E,IAAI,CAAC,OAAO,OAAO;CAEnB,QADa,MAAM,OAAO,KAAA,IAAY,MAAM,EAAE,CAAC,QAAQ,UAAU,IAAI,IAAI,MAAM,EAAE,CAAC,KAAK,MACxE;AACjB"}
@@ -1,4 +1,4 @@
1
- import { J as realtime, Z as loadedModule } from "./ThemeProvider-D33bPpf8.js";
1
+ import { Q as loadedModule, Y as realtime } from "./ThemeProvider-BTVQYl5O.js";
2
2
  //#region \0rolldown/runtime.js
3
3
  var __defProp = Object.defineProperty;
4
4
  var __exportAll = (all, no_symbols) => {
@@ -76,7 +76,7 @@ function followLive(provided, live, resource, setOpen) {
76
76
  };
77
77
  const socket = provided ?? realtime.client;
78
78
  if (socket) start(socket);
79
- else import("./RealtimeClient-B7zh4okq.js").then((module) => start(loadedModule(module).tabClient())).catch(() => {});
79
+ else import("./RealtimeClient-DmBC8zxt.js").then((module) => start(loadedModule(module).tabClient())).catch(() => {});
80
80
  return () => {
81
81
  stop?.();
82
82
  stop = null;
@@ -85,4 +85,4 @@ function followLive(provided, live, resource, setOpen) {
85
85
  //#endregion
86
86
  export { live_exports as n, followLive as t };
87
87
 
88
- //# sourceMappingURL=live-D08wnrrZ.js.map
88
+ //# sourceMappingURL=live-DIj7rF0t.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"live-D08wnrrZ.js","names":[],"sources":["../../client/realtime/live.ts"],"sourcesContent":["import type { QueryResource } from \"../QueryResource\";\nimport type { ChannelPattern } from \"../useChannel\";\nimport { EVENT_COALESCE_MS } from \"./useChannelSubscription\";\nimport type { ChannelParamValues, RealtimeSocket } from \"./RealtimeClient\";\nimport { loadedModule } from \"../lazyModule\";\nimport { realtime } from \"./loader\";\n\n/**\n * `useQuery`'s `live` option: the channel whose events and resyncs refetch\n * the query. A pattern without params (`\"user\"`), `[pattern, params]`, or\n * `{ channel, params }`.\n */\nexport type LiveChannel =\n | ChannelPattern\n | readonly [ChannelPattern, ChannelParamValues]\n | { channel: ChannelPattern; params?: ChannelParamValues };\n\nexport function resolveLiveChannel(\n live: LiveChannel | null | undefined | false,\n): { pattern: string; params: ChannelParamValues } | null {\n if (!live) return null;\n if (typeof live === \"string\") return { pattern: live, params: {} };\n if (Array.isArray(live)) return { pattern: live[0], params: live[1] ?? {} };\n const object = live as { channel: string; params?: ChannelParamValues };\n return { pattern: object.channel, params: object.params ?? {} };\n}\n\n/**\n * `useQuery`'s `live` subscription, loaded on first use by `followLive` in\n * `./loader` (#891). The channel's events refetch every cached variant of the\n * query (the rendered ones now), a burst of them once per\n * `EVENT_COALESCE_MS`; a resync refetches at once. `setOpen` follows whether\n * the channel is open, which pauses the query's polling.\n */\nexport function subscribeLive(\n socket: RealtimeSocket,\n live: LiveChannel,\n resource: () => QueryResource,\n setOpen: (open: boolean) => void,\n): () => void {\n const channel = resolveLiveChannel(live);\n if (!channel) return () => {};\n const refresh = () => {\n const target = resource();\n for (const key of target.variantKeys()) target.invalidate(key);\n };\n let timer: ReturnType<typeof setTimeout> | null = null;\n const release = socket.subscribe(channel.pattern, channel.params, {\n onEvent: () => {\n if (timer) return;\n timer = setTimeout(() => {\n timer = null;\n refresh();\n }, EVENT_COALESCE_MS);\n },\n onResync: refresh,\n onStatus: (status) => setOpen(status === \"open\"),\n });\n return () => {\n if (timer) clearTimeout(timer);\n release();\n };\n}\n\n/**\n * What `followLive` in `./loader` hands over to once this module is loaded:\n * subscribes on the provided socket, or the tab's client, loading that first\n * when it is not there yet. Returns the function that stops it.\n */\nexport function followLive(\n provided: RealtimeSocket | null,\n live: LiveChannel,\n resource: () => QueryResource,\n setOpen: (open: boolean) => void,\n): () => void {\n // `undefined` until it subscribes, `null` once stopped.\n let stop: (() => void) | null | undefined;\n const start = (socket: RealtimeSocket) => {\n if (stop === undefined) stop = subscribeLive(socket, live, resource, setOpen);\n };\n const socket = provided ?? realtime.client;\n if (socket) start(socket);\n // Its own `import()` of the client rather than `loadRealtimeClient`, which\n // would keep that in the entry chunk of every app with a `useQuery`. A\n // failed load leaves the channel closed, so the query keeps polling.\n else\n import(\"./RealtimeClient.js\")\n .then((module) => start(loadedModule(module).tabClient()))\n .catch(() => {});\n return () => {\n stop?.();\n stop = null;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,SAAgB,mBACd,MACwD;CACxD,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,OAAO,SAAS,UAAU,OAAO;EAAE,SAAS;EAAM,QAAQ,CAAC;CAAE;CACjE,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO;EAAE,SAAS,KAAK;EAAI,QAAQ,KAAK,MAAM,CAAC;CAAE;CAC1E,MAAM,SAAS;CACf,OAAO;EAAE,SAAS,OAAO;EAAS,QAAQ,OAAO,UAAU,CAAC;CAAE;AAChE;;;;;;;;AASA,SAAgB,cACd,QACA,MACA,UACA,SACY;CACZ,MAAM,UAAU,mBAAmB,IAAI;CACvC,IAAI,CAAC,SAAS,aAAa,CAAC;CAC5B,MAAM,gBAAgB;EACpB,MAAM,SAAS,SAAS;EACxB,KAAK,MAAM,OAAO,OAAO,YAAY,GAAG,OAAO,WAAW,GAAG;CAC/D;CACA,IAAI,QAA8C;CAClD,MAAM,UAAU,OAAO,UAAU,QAAQ,SAAS,QAAQ,QAAQ;EAChE,eAAe;GACb,IAAI,OAAO;GACX,QAAQ,iBAAiB;IACvB,QAAQ;IACR,QAAQ;GACV,GAAA,GAAoB;EACtB;EACA,UAAU;EACV,WAAW,WAAW,QAAQ,WAAW,MAAM;CACjD,CAAC;CACD,aAAa;EACX,IAAI,OAAO,aAAa,KAAK;EAC7B,QAAQ;CACV;AACF;;;;;;AAOA,SAAgB,WACd,UACA,MACA,UACA,SACY;CAEZ,IAAI;CACJ,MAAM,SAAS,WAA2B;EACxC,IAAI,SAAS,KAAA,GAAW,OAAO,cAAc,QAAQ,MAAM,UAAU,OAAO;CAC9E;CACA,MAAM,SAAS,YAAY,SAAS;CACpC,IAAI,QAAQ,MAAM,MAAM;MAKtB,OAAO,+BAAsB,CAC1B,MAAM,WAAW,MAAM,aAAa,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CACzD,YAAY,CAAC,CAAC;CACnB,aAAa;EACX,OAAO;EACP,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"live-DIj7rF0t.js","names":[],"sources":["../../client/realtime/live.ts"],"sourcesContent":["import type { QueryResource } from \"../QueryResource\";\nimport type { ChannelPattern } from \"../useChannel\";\nimport { EVENT_COALESCE_MS } from \"./useChannelSubscription\";\nimport type { ChannelParamValues, RealtimeSocket } from \"./RealtimeClient\";\nimport { loadedModule } from \"../lazyModule\";\nimport { realtime } from \"./loader\";\n\n/**\n * `useQuery`'s `live` option: the channel whose events and resyncs refetch\n * the query. A pattern without params (`\"user\"`), `[pattern, params]`, or\n * `{ channel, params }`.\n */\nexport type LiveChannel =\n | ChannelPattern\n | readonly [ChannelPattern, ChannelParamValues]\n | { channel: ChannelPattern; params?: ChannelParamValues };\n\nexport function resolveLiveChannel(\n live: LiveChannel | null | undefined | false,\n): { pattern: string; params: ChannelParamValues } | null {\n if (!live) return null;\n if (typeof live === \"string\") return { pattern: live, params: {} };\n if (Array.isArray(live)) return { pattern: live[0], params: live[1] ?? {} };\n const object = live as { channel: string; params?: ChannelParamValues };\n return { pattern: object.channel, params: object.params ?? {} };\n}\n\n/**\n * `useQuery`'s `live` subscription, loaded on first use by `followLive` in\n * `./loader` (#891). The channel's events refetch every cached variant of the\n * query (the rendered ones now), a burst of them once per\n * `EVENT_COALESCE_MS`; a resync refetches at once. `setOpen` follows whether\n * the channel is open, which pauses the query's polling.\n */\nexport function subscribeLive(\n socket: RealtimeSocket,\n live: LiveChannel,\n resource: () => QueryResource,\n setOpen: (open: boolean) => void,\n): () => void {\n const channel = resolveLiveChannel(live);\n if (!channel) return () => {};\n const refresh = () => {\n const target = resource();\n for (const key of target.variantKeys()) target.invalidate(key);\n };\n let timer: ReturnType<typeof setTimeout> | null = null;\n const release = socket.subscribe(channel.pattern, channel.params, {\n onEvent: () => {\n if (timer) return;\n timer = setTimeout(() => {\n timer = null;\n refresh();\n }, EVENT_COALESCE_MS);\n },\n onResync: refresh,\n onStatus: (status) => setOpen(status === \"open\"),\n });\n return () => {\n if (timer) clearTimeout(timer);\n release();\n };\n}\n\n/**\n * What `followLive` in `./loader` hands over to once this module is loaded:\n * subscribes on the provided socket, or the tab's client, loading that first\n * when it is not there yet. Returns the function that stops it.\n */\nexport function followLive(\n provided: RealtimeSocket | null,\n live: LiveChannel,\n resource: () => QueryResource,\n setOpen: (open: boolean) => void,\n): () => void {\n // `undefined` until it subscribes, `null` once stopped.\n let stop: (() => void) | null | undefined;\n const start = (socket: RealtimeSocket) => {\n if (stop === undefined) stop = subscribeLive(socket, live, resource, setOpen);\n };\n const socket = provided ?? realtime.client;\n if (socket) start(socket);\n // Its own `import()` of the client rather than `loadRealtimeClient`, which\n // would keep that in the entry chunk of every app with a `useQuery`. A\n // failed load leaves the channel closed, so the query keeps polling.\n else\n import(\"./RealtimeClient.js\")\n .then((module) => start(loadedModule(module).tabClient()))\n .catch(() => {});\n return () => {\n stop?.();\n stop = null;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,SAAgB,mBACd,MACwD;CACxD,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,OAAO,SAAS,UAAU,OAAO;EAAE,SAAS;EAAM,QAAQ,CAAC;CAAE;CACjE,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO;EAAE,SAAS,KAAK;EAAI,QAAQ,KAAK,MAAM,CAAC;CAAE;CAC1E,MAAM,SAAS;CACf,OAAO;EAAE,SAAS,OAAO;EAAS,QAAQ,OAAO,UAAU,CAAC;CAAE;AAChE;;;;;;;;AASA,SAAgB,cACd,QACA,MACA,UACA,SACY;CACZ,MAAM,UAAU,mBAAmB,IAAI;CACvC,IAAI,CAAC,SAAS,aAAa,CAAC;CAC5B,MAAM,gBAAgB;EACpB,MAAM,SAAS,SAAS;EACxB,KAAK,MAAM,OAAO,OAAO,YAAY,GAAG,OAAO,WAAW,GAAG;CAC/D;CACA,IAAI,QAA8C;CAClD,MAAM,UAAU,OAAO,UAAU,QAAQ,SAAS,QAAQ,QAAQ;EAChE,eAAe;GACb,IAAI,OAAO;GACX,QAAQ,iBAAiB;IACvB,QAAQ;IACR,QAAQ;GACV,GAAA,GAAoB;EACtB;EACA,UAAU;EACV,WAAW,WAAW,QAAQ,WAAW,MAAM;CACjD,CAAC;CACD,aAAa;EACX,IAAI,OAAO,aAAa,KAAK;EAC7B,QAAQ;CACV;AACF;;;;;;AAOA,SAAgB,WACd,UACA,MACA,UACA,SACY;CAEZ,IAAI;CACJ,MAAM,SAAS,WAA2B;EACxC,IAAI,SAAS,KAAA,GAAW,OAAO,cAAc,QAAQ,MAAM,UAAU,OAAO;CAC9E;CACA,MAAM,SAAS,YAAY,SAAS;CACpC,IAAI,QAAQ,MAAM,MAAM;MAKtB,OAAO,+BAAsB,CAC1B,MAAM,WAAW,MAAM,aAAa,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CACzD,YAAY,CAAC,CAAC;CACnB,aAAa;EACX,OAAO;EACP,OAAO;CACT;AACF"}
@@ -1,4 +1,4 @@
1
- import { $ as applyParams, Q as toVariantKey } from "./ThemeProvider-D33bPpf8.js";
1
+ import { $ as toVariantKey, et as applyParams } from "./ThemeProvider-BTVQYl5O.js";
2
2
  import { p as mutationErrorFromBody, s as isObject } from "./MutationError-DuKqBW8o.js";
3
3
  //#region client/mutationErrorHelpers.ts
4
4
  var FALLBACK_MESSAGE = "Something went wrong. Try again.";
@@ -112,4 +112,4 @@ function applyQueryUpdates(getResource, routeParams, updates, answer) {
112
112
  //#endregion
113
113
  export { applyQueryUpdates, withMutationErrorHelpers, writeQueryData };
114
114
 
115
- //# sourceMappingURL=mutationExtras-BbDboF8F.js.map
115
+ //# sourceMappingURL=mutationExtras-BRFfb6-L.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mutationExtras-BbDboF8F.js","names":[],"sources":["../../client/mutationErrorHelpers.ts","../../client/queryUpdates.ts"],"sourcesContent":["import {\n isObject,\n mutationErrorFromBody,\n type MutationErrorHelpers,\n type MutationValidationError,\n type WithMutationErrorHelpers,\n} from \"./MutationError\";\n\n// `error.list()` and `error.field(name)` on what the mutation hooks hand over.\n// Loaded with the hooks' other extras when one mounts (see\n// `./mutationModules`), so no route's entry chunk carries it (#915).\n//\n// `list` and `field` repeat `mutationErrorList` and `mutationErrorField` from\n// `./MutationError` on purpose. Those are public and synchronous, so they sit\n// in whatever chunk calls them; importing them here would put them, and so\n// this code, back in every entry chunk. `MutationError.helpers.test` runs the\n// same cases through both.\n\nconst FALLBACK_MESSAGE = \"Something went wrong. Try again.\";\n\n// `isValidationError`, which an import would keep in the entry chunk.\nfunction isValidationError(error: unknown): error is MutationValidationError {\n return isObject(error) && error.kind === \"validation_error\";\n}\n\n// A `QueryError`'s refusal, read as the mutation hooks read a body. Read by\n// shape, not `instanceof`, so a copy of the class from another bundle works.\nfunction unwrapQueryError(error: unknown): unknown {\n if (error instanceof Error && error.name === \"QueryError\" && \"body\" in error) {\n const { body, status } = error as Error & { body: unknown; status: number };\n return body == null ? error : mutationErrorFromBody(body, status);\n }\n return error;\n}\n\n// `error.list(fallback)`: see `mutationErrorList`.\nfunction list(\n error: unknown,\n fallback: string = FALLBACK_MESSAGE,\n): string[] {\n const value = unwrapQueryError(error);\n if (isValidationError(value)) {\n const messages = Object.values(value.messages ?? {})\n .flat()\n .filter((message) => typeof message === \"string\" && message !== \"\");\n return messages.length > 0 ? messages : [fallback];\n }\n if (\n isObject(value) &&\n !(value instanceof Error) &&\n value.kind !== \"server_error\" &&\n typeof value.message === \"string\" &&\n value.message !== \"\"\n ) {\n return [value.message];\n }\n return [fallback];\n}\n\n// `error.field(name)`: see `mutationErrorField`.\nfunction field(error: unknown, name: string): string[] {\n const value = unwrapQueryError(error);\n if (!isValidationError(value)) return [];\n const messages = value.messages?.[name];\n return Array.isArray(messages) ? [...messages] : [];\n}\n\n/**\n * Puts `list` and `field` on an error the hooks hand over, as non-enumerable\n * properties, so `toEqual`, a spread and `JSON.stringify` see the same object\n * as before. A key the error already has is left alone; a primitive or a\n * frozen value is returned as it is.\n *\n * @internal\n */\nexport function withMutationErrorHelpers<T>(error: T): WithMutationErrorHelpers<T> {\n if (!isObject(error) || !Object.isExtensible(error)) {\n return error as WithMutationErrorHelpers<T>;\n }\n const helpers: MutationErrorHelpers = {\n list: (fallback) => list(error, fallback),\n field: (name) => field(error, name),\n };\n for (const key of [\"list\", \"field\"] as const) {\n if (key in error) continue;\n Object.defineProperty(error, key, {\n value: helpers[key],\n configurable: true,\n writable: true,\n enumerable: false,\n });\n }\n return error as WithMutationErrorHelpers<T>;\n}\n","import type { QueryResource } from \"./QueryResource\";\nimport type { QueryTarget, QueryUpdate } from \"./useSetQueryData\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { toVariantKey } from \"../utils/variantKey\";\n\n// The cache writes behind a mutation's `updates` and `useSetQueryData()`\n// (#897). Loaded with the hooks' other extras when one mounts (see\n// `./mutationModules`), so no route's entry chunk carries it (#915).\n\ntype Resolve = (key: string) => QueryResource;\n\n/**\n * Write data the server just produced (a mutation's answer) into a variant,\n * with no refetch: unlike `mutate`, the value is not a guess to reconcile.\n * The variant counts as freshly fetched, so its `staleTime` starts again, and\n * a GET already on the wire for it is dropped when it lands, since it may\n * carry the data from before the write. A reader suspended on the variant\n * wakes up with it (#897). Here rather than on `QueryResource`, which every\n * entry chunk carries (#915).\n */\nfunction setVariant(resource: QueryResource, variantKey: string, data: unknown) {\n resource.dropHttpCache(variantKey);\n resource.markApplied(variantKey);\n const store = resource.store.getValue();\n resource.fill(store, variantKey, data, Date.now());\n resource.store.next(store);\n}\n\n/** The value to write, or a function of the cached one. */\nexport type WriteQueryNext = { value: unknown } | { update: (current: any) => unknown };\n\n/**\n * Write into every variant `target` names. `next` is the value to write, or\n * a function of the cached value; a function skips a variant with nothing\n * cached. A value seeds a single variant that is not cached yet; a predicate\n * only ever reaches variants that are.\n */\nexport function writeQueryData(\n getResource: Resolve,\n routeParams: Record<string, any>,\n target: QueryTarget<any>,\n next: WriteQueryNext,\n) {\n const { path, params = {}, search = {} } = target;\n const resource = getResource(applyParams(String(path), { ...routeParams, ...params }));\n const write = (variantKey: string) => {\n if (\"value\" in next) {\n setVariant(resource, variantKey, next.value);\n return;\n }\n const state = resource.peek(variantKey);\n if (!state?.hasData) return;\n setVariant(resource, variantKey, next.update(state.data));\n };\n\n if (typeof search === \"function\") {\n for (const variantKey of resource.variantKeys()) {\n if (!resource.peek(variantKey)?.hasData) continue;\n if (search(new URLSearchParams(variantKey))) write(variantKey);\n }\n return;\n }\n write(toVariantKey(search));\n}\n\n/**\n * Write a mutation's `updates` with its answer.\n */\nexport function applyQueryUpdates(\n getResource: Resolve,\n routeParams: Record<string, any>,\n updates: ReadonlyArray<QueryUpdate<any>> | undefined,\n answer: unknown,\n) {\n for (const update of updates ?? []) {\n const { data } = update as { data?: (answer: any, current: any) => any };\n writeQueryData(\n getResource,\n routeParams,\n update,\n data ? { update: (current) => data(answer, current) } : { value: answer },\n );\n }\n}\n"],"mappings":";;;AAkBA,IAAM,mBAAmB;AAGzB,SAAS,kBAAkB,OAAkD;CAC3E,OAAO,SAAS,KAAK,KAAK,MAAM,SAAS;AAC3C;AAIA,SAAS,iBAAiB,OAAyB;CACjD,IAAI,iBAAiB,SAAS,MAAM,SAAS,gBAAgB,UAAU,OAAO;EAC5E,MAAM,EAAE,MAAM,WAAW;EACzB,OAAO,QAAQ,OAAO,QAAQ,sBAAsB,MAAM,MAAM;CAClE;CACA,OAAO;AACT;AAGA,SAAS,KACP,OACA,WAAmB,kBACT;CACV,MAAM,QAAQ,iBAAiB,KAAK;CACpC,IAAI,kBAAkB,KAAK,GAAG;EAC5B,MAAM,WAAW,OAAO,OAAO,MAAM,YAAY,CAAC,CAAC,CAAC,CACjD,KAAK,CAAC,C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,WAAW,YAAY,YAAY,OAAO,IAAI,GAAG;EAAE,GAAG;EAAa,GAAG;CAAO,CAAC,CAAC;CACrF,MAAM,SAAS,eAAuB;EACpC,IAAI,WAAW,MAAM;GACnB,WAAW,UAAU,YAAY,KAAK,KAAK;GAC3C;EACF;EACA,MAAM,QAAQ,SAAS,KAAK,UAAU;EACtC,IAAI,CAAC,OAAO,SAAS;EACrB,WAAW,UAAU,YAAY,KAAK,OAAO,MAAM,IAAI,CAAC;CAC1D;CAEA,IAAI,OAAO,WAAW,YAAY;EAChC,KAAK,MAAM,cAAc,SAAS,YAAY,GAAG;GAC/C,IAAI,CAAC,SAAS,KAAK,UAAU,CAAC,EAAE,SAAS;GACzC,IAAI,OAAO,IAAI,gBAAgB,UAAU,CAAC,GAAG,MAAM,UAAU;EAC/D;EACA;CACF;CACA,MAAM,aAAa,MAAM,CAAC;AAC5B;;;;AAKA,SAAgB,kBACd,aACA,aACA,SACA,QACA;CACA,KAAK,MAAM,UAAU,WAAW,CAAC,GAAG;EAClC,MAAM,EAAE,SAAS;EACjB,eACE,aACA,aACA,QACA,OAAO,EAAE,SAAS,YAAY,KAAK,QAAQ,OAAO,EAAE,IAAI,EAAE,OAAO,OAAO,CAC1E;CACF;AACF"}
1
+ {"version":3,"file":"mutationExtras-BRFfb6-L.js","names":[],"sources":["../../client/mutationErrorHelpers.ts","../../client/queryUpdates.ts"],"sourcesContent":["import {\n isObject,\n mutationErrorFromBody,\n type MutationErrorHelpers,\n type MutationValidationError,\n type WithMutationErrorHelpers,\n} from \"./MutationError\";\n\n// `error.list()` and `error.field(name)` on what the mutation hooks hand over.\n// Loaded with the hooks' other extras when one mounts (see\n// `./mutationModules`), so no route's entry chunk carries it (#915).\n//\n// `list` and `field` repeat `mutationErrorList` and `mutationErrorField` from\n// `./MutationError` on purpose. Those are public and synchronous, so they sit\n// in whatever chunk calls them; importing them here would put them, and so\n// this code, back in every entry chunk. `MutationError.helpers.test` runs the\n// same cases through both.\n\nconst FALLBACK_MESSAGE = \"Something went wrong. Try again.\";\n\n// `isValidationError`, which an import would keep in the entry chunk.\nfunction isValidationError(error: unknown): error is MutationValidationError {\n return isObject(error) && error.kind === \"validation_error\";\n}\n\n// A `QueryError`'s refusal, read as the mutation hooks read a body. Read by\n// shape, not `instanceof`, so a copy of the class from another bundle works.\nfunction unwrapQueryError(error: unknown): unknown {\n if (error instanceof Error && error.name === \"QueryError\" && \"body\" in error) {\n const { body, status } = error as Error & { body: unknown; status: number };\n return body == null ? error : mutationErrorFromBody(body, status);\n }\n return error;\n}\n\n// `error.list(fallback)`: see `mutationErrorList`.\nfunction list(\n error: unknown,\n fallback: string = FALLBACK_MESSAGE,\n): string[] {\n const value = unwrapQueryError(error);\n if (isValidationError(value)) {\n const messages = Object.values(value.messages ?? {})\n .flat()\n .filter((message) => typeof message === \"string\" && message !== \"\");\n return messages.length > 0 ? messages : [fallback];\n }\n if (\n isObject(value) &&\n !(value instanceof Error) &&\n value.kind !== \"server_error\" &&\n typeof value.message === \"string\" &&\n value.message !== \"\"\n ) {\n return [value.message];\n }\n return [fallback];\n}\n\n// `error.field(name)`: see `mutationErrorField`.\nfunction field(error: unknown, name: string): string[] {\n const value = unwrapQueryError(error);\n if (!isValidationError(value)) return [];\n const messages = value.messages?.[name];\n return Array.isArray(messages) ? [...messages] : [];\n}\n\n/**\n * Puts `list` and `field` on an error the hooks hand over, as non-enumerable\n * properties, so `toEqual`, a spread and `JSON.stringify` see the same object\n * as before. A key the error already has is left alone; a primitive or a\n * frozen value is returned as it is.\n *\n * @internal\n */\nexport function withMutationErrorHelpers<T>(error: T): WithMutationErrorHelpers<T> {\n if (!isObject(error) || !Object.isExtensible(error)) {\n return error as WithMutationErrorHelpers<T>;\n }\n const helpers: MutationErrorHelpers = {\n list: (fallback) => list(error, fallback),\n field: (name) => field(error, name),\n };\n for (const key of [\"list\", \"field\"] as const) {\n if (key in error) continue;\n Object.defineProperty(error, key, {\n value: helpers[key],\n configurable: true,\n writable: true,\n enumerable: false,\n });\n }\n return error as WithMutationErrorHelpers<T>;\n}\n","import type { QueryResource } from \"./QueryResource\";\nimport type { QueryTarget, QueryUpdate } from \"./useSetQueryData\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { toVariantKey } from \"../utils/variantKey\";\n\n// The cache writes behind a mutation's `updates` and `useSetQueryData()`\n// (#897). Loaded with the hooks' other extras when one mounts (see\n// `./mutationModules`), so no route's entry chunk carries it (#915).\n\ntype Resolve = (key: string) => QueryResource;\n\n/**\n * Write data the server just produced (a mutation's answer) into a variant,\n * with no refetch: unlike `mutate`, the value is not a guess to reconcile.\n * The variant counts as freshly fetched, so its `staleTime` starts again, and\n * a GET already on the wire for it is dropped when it lands, since it may\n * carry the data from before the write. A reader suspended on the variant\n * wakes up with it (#897). Here rather than on `QueryResource`, which every\n * entry chunk carries (#915).\n */\nfunction setVariant(resource: QueryResource, variantKey: string, data: unknown) {\n resource.dropHttpCache(variantKey);\n resource.markApplied(variantKey);\n const store = resource.store.getValue();\n resource.fill(store, variantKey, data, Date.now());\n resource.store.next(store);\n}\n\n/** The value to write, or a function of the cached one. */\nexport type WriteQueryNext = { value: unknown } | { update: (current: any) => unknown };\n\n/**\n * Write into every variant `target` names. `next` is the value to write, or\n * a function of the cached value; a function skips a variant with nothing\n * cached. A value seeds a single variant that is not cached yet; a predicate\n * only ever reaches variants that are.\n */\nexport function writeQueryData(\n getResource: Resolve,\n routeParams: Record<string, any>,\n target: QueryTarget<any>,\n next: WriteQueryNext,\n) {\n const { path, params = {}, search = {} } = target;\n const resource = getResource(applyParams(String(path), { ...routeParams, ...params }));\n const write = (variantKey: string) => {\n if (\"value\" in next) {\n setVariant(resource, variantKey, next.value);\n return;\n }\n const state = resource.peek(variantKey);\n if (!state?.hasData) return;\n setVariant(resource, variantKey, next.update(state.data));\n };\n\n if (typeof search === \"function\") {\n for (const variantKey of resource.variantKeys()) {\n if (!resource.peek(variantKey)?.hasData) continue;\n if (search(new URLSearchParams(variantKey))) write(variantKey);\n }\n return;\n }\n write(toVariantKey(search));\n}\n\n/**\n * Write a mutation's `updates` with its answer.\n */\nexport function applyQueryUpdates(\n getResource: Resolve,\n routeParams: Record<string, any>,\n updates: ReadonlyArray<QueryUpdate<any>> | undefined,\n answer: unknown,\n) {\n for (const update of updates ?? []) {\n const { data } = update as { data?: (answer: any, current: any) => any };\n writeQueryData(\n getResource,\n routeParams,\n update,\n data ? { update: (current) => data(answer, current) } : { value: answer },\n );\n }\n}\n"],"mappings":";;;AAkBA,IAAM,mBAAmB;AAGzB,SAAS,kBAAkB,OAAkD;CAC3E,OAAO,SAAS,KAAK,KAAK,MAAM,SAAS;AAC3C;AAIA,SAAS,iBAAiB,OAAyB;CACjD,IAAI,iBAAiB,SAAS,MAAM,SAAS,gBAAgB,UAAU,OAAO;EAC5E,MAAM,EAAE,MAAM,WAAW;EACzB,OAAO,QAAQ,OAAO,QAAQ,sBAAsB,MAAM,MAAM;CAClE;CACA,OAAO;AACT;AAGA,SAAS,KACP,OACA,WAAmB,kBACT;CACV,MAAM,QAAQ,iBAAiB,KAAK;CACpC,IAAI,kBAAkB,KAAK,GAAG;EAC5B,MAAM,WAAW,OAAO,OAAO,MAAM,YAAY,CAAC,CAAC,CAAC,CACjD,KAAK,CAAC,CACN,QAAQ,YAAY,OAAO,YAAY,YAAY,YAAY,EAAE;EACpE,OAAO,SAAS,SAAS,IAAI,WAAW,CAAC,QAAQ;CACnD;CACA,IACE,SAAS,KAAK,KACd,EAAE,iBAAiB,UACnB,MAAM,SAAS,kBACf,OAAO,MAAM,YAAY,YACzB,MAAM,YAAY,IAElB,OAAO,CAAC,MAAM,OAAO;CAEvB,OAAO,CAAC,QAAQ;AAClB;AAGA,SAAS,MAAM,OAAgB,MAAwB;CACrD,MAAM,QAAQ,iBAAiB,KAAK;CACpC,IAAI,CAAC,kBAAkB,KAAK,GAAG,OAAO,CAAC;CACvC,MAAM,WAAW,MAAM,WAAW;CAClC,OAAO,MAAM,QAAQ,QAAQ,IAAI,CAAC,G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AAgB,UAAU,CAAC,GAAG,MAAM,UAAU;EAC/D;EACA;CACF;CACA,MAAM,aAAa,MAAM,CAAC;AAC5B;;;;AAKA,SAAgB,kBACd,aACA,aACA,SACA,QACA;CACA,KAAK,MAAM,UAAU,WAAW,CAAC,GAAG;EAClC,MAAM,EAAE,SAAS;EACjB,eACE,aACA,aACA,QACA,OAAO,EAAE,SAAS,YAAY,KAAK,QAAQ,OAAO,EAAE,IAAI,EAAE,OAAO,OAAO,CAC1E;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { mt as equalJitter } from "./ThemeProvider-D33bPpf8.js";
1
+ import { ht as equalJitter } from "./ThemeProvider-BTVQYl5O.js";
2
2
  //#region client/subscriptionStream.ts
3
3
  var MIN_RETRY_MS = 1e3;
4
4
  var MAX_RETRY_MS = 3e4;
@@ -175,4 +175,4 @@ async function* readEvents(body) {
175
175
  //#endregion
176
176
  export { follow, readEvents };
177
177
 
178
- //# sourceMappingURL=subscriptionStream-CRj9aV4K.js.map
178
+ //# sourceMappingURL=subscriptionStream-CRRgUXJp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptionStream-CRj9aV4K.js","names":[],"sources":["../../client/subscriptionStream.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from \"react\";\n\nimport type { ChangeFeedMessage } from \"../services/change-feed/wire\";\nimport { equalJitter } from \"./retryPolicy\";\nimport type { SubscriptionConfig, SubscriptionStatus } from \"./useSubscription\";\n\n// `useSubscription`'s connection: the SSE request, its reader and the\n// reconnect loop. Loaded by the hook with a dynamic `import()` when it first\n// connects, so it lands in a chunk of its own rather than in the entry chunk\n// every route loads (#891). Import it as a type only from anywhere else.\n\nconst MIN_RETRY_MS = 1_000;\nconst MAX_RETRY_MS = 30_000;\n\n/** The server answered in a way retrying will not change (401, 403, 404). */\nclass FatalStatus extends Error {\n constructor(readonly status: number) {\n super(`The subscription was refused with ${status}.`);\n }\n}\n\nexport interface SubscriptionState {\n status: SubscriptionStatus;\n cursor: string | null;\n error: Error | null;\n}\n\nexport interface FollowOptions {\n endpoint: string;\n pauseWhenHidden: boolean;\n /** Where to resume; advanced as events arrive. */\n cursor: { current: string | null };\n callbacks: { current: SubscriptionConfig<unknown> };\n setState: Dispatch<SetStateAction<SubscriptionState>>;\n /** The jitter's random source; `Math.random` unless a test passes its own. */\n random?: () => number;\n}\n\n/**\n * Follows `endpoint` until the returned function is called: connects,\n * reconnects with backoff, pauses while the tab is hidden, and reports\n * through `setState` and `callbacks`.\n *\n * The backoff step is 1s, doubling per failed attempt up to 30s, and back to\n * 1s once a stream reaches `ready`. Each wait is jittered (\"equal jitter\", a\n * random point between half the step and all of it): a server restart ends\n * every open tab's stream in the same instant, and an exact schedule would\n * bring them all back in the same instant too. A `Retry-After` the server\n * sent is waited out exactly.\n */\nexport function follow({\n endpoint,\n pauseWhenHidden,\n cursor,\n callbacks,\n setState,\n random = Math.random,\n}: FollowOptions): () => void {\n let stopped = false;\n let request: AbortController | null = null;\n let resume: (() => void) | null = null;\n let retryMs = MIN_RETRY_MS;\n const hidden = () =>\n pauseWhenHidden && typeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n const onVisibilityChange = () => {\n if (hidden()) request?.abort();\n else resume?.();\n };\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n }\n const wait = (ms: number) =>\n new Promise<void>((resolve) => {\n const timer = setTimeout(done, ms);\n function done() {\n clearTimeout(timer);\n resume = null;\n resolve();\n }\n // Shown again, or unmounted: stop waiting.\n resume = done;\n });\n\n void (async () => {\n while (!stopped) {\n if (hidden()) {\n setState((s) => ({ ...s, status: \"paused\" }));\n await new Promise<void>((resolve) => (resume = resolve));\n resume = null;\n continue;\n }\n setState((s) => ({ ...s, status: \"connecting\" }));\n const controller = (request = new AbortController());\n let delay = retryMs;\n let exact = false;\n try {\n const headers: Record<string, string> = { Accept: \"text/event-stream\" };\n if (cursor.current) headers[\"Last-Event-ID\"] = cursor.current;\n const response = await fetch(endpoint, { headers, signal: controller.signal });\n if (!response.ok || !response.body) {\n const status = response.status;\n if (status >= 400 && status < 500 && status !== 408 && status !== 429) {\n throw new FatalStatus(status);\n }\n const retryAfter = Number(response.headers.get(\"Retry-After\"));\n if (Number.isFinite(retryAfter) && retryAfter > 0) {\n delay = retryAfter * 1000;\n exact = true;\n }\n throw new Error(`The subscription answered ${status}.`);\n }\n for await (const { id, message } of readEvents(response.body)) {\n if (stopped) return;\n if (id !== undefined) cursor.current = id;\n if (message.type === \"ready\") {\n retryMs = MIN_RETRY_MS;\n delay = MIN_RETRY_MS;\n setState({ status: \"open\", cursor: cursor.current, error: null });\n } else {\n setState((s) => ({ ...s, cursor: cursor.current }));\n if (message.type === \"change\") callbacks.current.onChange?.(message as never);\n else if (message.type === \"reset\") callbacks.current.onReset?.(message as never);\n }\n }\n } catch (error) {\n if (stopped) return;\n if (error instanceof FatalStatus) {\n setState((s) => ({ ...s, status: \"closed\", error }));\n return;\n }\n // Aborted because the tab was hidden: the loop pauses instead.\n if (controller.signal.aborted) continue;\n setState((s) => ({ ...s, error: error as Error }));\n }\n if (stopped || controller.signal.aborted) continue;\n // The stream ended or failed: try again, a little later each time.\n setState((s) => ({ ...s, status: \"connecting\" }));\n await wait(exact ? delay : equalJitter(delay, random));\n retryMs = Math.min(retryMs * 2, MAX_RETRY_MS);\n }\n })();\n\n return () => {\n stopped = true;\n request?.abort();\n resume?.();\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n }\n };\n}\n\n/**\n * The events of an SSE body: `id` and the JSON `data`. Comments (keepalives)\n * and events without data are skipped; an event whose data is not JSON is\n * dropped rather than ending the stream.\n */\nexport async function* readEvents(\n body: ReadableStream<Uint8Array>,\n): AsyncGenerator<{ id?: string; message: ChangeFeedMessage }> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) return;\n // `ChangeFeed.stream` writes `\\n` only; a proxy's `\\r\\n` is folded here.\n buffer = (buffer + decoder.decode(value, { stream: true })).replace(/\\r\\n?/g, \"\\n\");\n let boundary = buffer.indexOf(\"\\n\\n\");\n while (boundary !== -1) {\n const block = buffer.slice(0, boundary);\n buffer = buffer.slice(boundary + 2);\n boundary = buffer.indexOf(\"\\n\\n\");\n let id: string | undefined;\n const data: string[] = [];\n for (const line of block.split(\"\\n\")) {\n if (line === \"\" || line.startsWith(\":\")) continue;\n const colon = line.indexOf(\":\");\n const field = colon === -1 ? line : line.slice(0, colon);\n let text = colon === -1 ? \"\" : line.slice(colon + 1);\n if (text.startsWith(\" \")) text = text.slice(1);\n if (field === \"id\") id = text;\n else if (field === \"data\") data.push(text);\n }\n if (data.length === 0) continue;\n try {\n yield { id, message: JSON.parse(data.join(\"\\n\")) };\n } catch {\n // Not JSON: not ours to apply.\n }\n }\n }\n } finally {\n await reader.cancel().catch(() => {});\n }\n}\n"],"mappings":";;AAWA,IAAM,eAAe;AACrB,IAAM,eAAe;;AAGrB,IAAM,cAAN,cAA0B,MAAM;CACT;CAArB,YAAY,QAAyB;EACnC,MAAM,qCAAqC,OAAO,EAAE;EADjC,KAAA,SAAA;CAErB;AACF;;;;;;;;;;;;;AA+BA,SAAgB,OAAO,EACrB,UACA,iBACA,QACA,WACA,UACA,SAAS,KAAK,UACc;CAC5B,IAAI,UAAU;CACd,IAAI,UAAkC;CACtC,IAAI,SAA8B;CAClC,IAAI,UAAU;CACd,MAAM,eACJ,mBAAmB,OAAO,aAAa,eAAe,SAAS,oBAAoB;CACrF,MAAM,2BAA2B;EAC/B,IAAI,OAAO,GAAG,SAAS,MAAM;OACxB,SAAS;CAChB;CACA,IAAI,OAAO,aAAa,aACtB,SAAS,iBAAiB,oBAAoB,kBAAkB;CAElE,MAAM,QAAQ,OACZ,IAAI,SAAe,YAAY;EAC7B,MAAM,QAAQ,WAAW,MAAM,EAAE;EACjC,SAAS,OAAO;GACd,aAAa,KAAK;GAClB,SAAS;GACT,QAAQ;EAC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;KACzC,MAAM,QAAQ,KAAK,QAAQ,GAAG;KAC9B,MAAM,QAAQ,UAAU,KAAK,OAAO,KAAK,MAAM,GAAG,KAAK;KACvD,IAAI,OAAO,UAAU,KAAK,KAAK,KAAK,MAAM,QAAQ,CAAC;KACnD,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO,KAAK,MAAM,CAAC;KAC7C,IAAI,UAAU,MAAM,KAAK;UACpB,IAAI,UAAU,QAAQ,KAAK,KAAK,IAAI;IAC3C;IACA,IAAI,KAAK,WAAW,GAAG;IACvB,IAAI;KACF,MAAM;MAAE;MAAI,SAAS,KAAK,MAAM,KAAK,KAAK,IAAI,CAAC;KAAE;IACnD,QAAQ,CAER;GACF;EACF;CACF,UAAU;EACR,MAAM,OAAO,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;CACtC;AACF"}
1
+ {"version":3,"file":"subscriptionStream-CRRgUXJp.js","names":[],"sources":["../../client/subscriptionStream.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from \"react\";\n\nimport type { ChangeFeedMessage } from \"../services/change-feed/wire\";\nimport { equalJitter } from \"./retryPolicy\";\nimport type { SubscriptionConfig, SubscriptionStatus } from \"./useSubscription\";\n\n// `useSubscription`'s connection: the SSE request, its reader and the\n// reconnect loop. Loaded by the hook with a dynamic `import()` when it first\n// connects, so it lands in a chunk of its own rather than in the entry chunk\n// every route loads (#891). Import it as a type only from anywhere else.\n\nconst MIN_RETRY_MS = 1_000;\nconst MAX_RETRY_MS = 30_000;\n\n/** The server answered in a way retrying will not change (401, 403, 404). */\nclass FatalStatus extends Error {\n constructor(readonly status: number) {\n super(`The subscription was refused with ${status}.`);\n }\n}\n\nexport interface SubscriptionState {\n status: SubscriptionStatus;\n cursor: string | null;\n error: Error | null;\n}\n\nexport interface FollowOptions {\n endpoint: string;\n pauseWhenHidden: boolean;\n /** Where to resume; advanced as events arrive. */\n cursor: { current: string | null };\n callbacks: { current: SubscriptionConfig<unknown> };\n setState: Dispatch<SetStateAction<SubscriptionState>>;\n /** The jitter's random source; `Math.random` unless a test passes its own. */\n random?: () => number;\n}\n\n/**\n * Follows `endpoint` until the returned function is called: connects,\n * reconnects with backoff, pauses while the tab is hidden, and reports\n * through `setState` and `callbacks`.\n *\n * The backoff step is 1s, doubling per failed attempt up to 30s, and back to\n * 1s once a stream reaches `ready`. Each wait is jittered (\"equal jitter\", a\n * random point between half the step and all of it): a server restart ends\n * every open tab's stream in the same instant, and an exact schedule would\n * bring them all back in the same instant too. A `Retry-After` the server\n * sent is waited out exactly.\n */\nexport function follow({\n endpoint,\n pauseWhenHidden,\n cursor,\n callbacks,\n setState,\n random = Math.random,\n}: FollowOptions): () => void {\n let stopped = false;\n let request: AbortController | null = null;\n let resume: (() => void) | null = null;\n let retryMs = MIN_RETRY_MS;\n const hidden = () =>\n pauseWhenHidden && typeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n const onVisibilityChange = () => {\n if (hidden()) request?.abort();\n else resume?.();\n };\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n }\n const wait = (ms: number) =>\n new Promise<void>((resolve) => {\n const timer = setTimeout(done, ms);\n function done() {\n clearTimeout(timer);\n resume = null;\n resolve();\n }\n // Shown again, or unmounted: stop waiting.\n resume = done;\n });\n\n void (async () => {\n while (!stopped) {\n if (hidden()) {\n setState((s) => ({ ...s, status: \"paused\" }));\n await new Promise<void>((resolve) => (resume = resolve));\n resume = null;\n continue;\n }\n setState((s) => ({ ...s, status: \"connecting\" }));\n const controller = (request = new AbortController());\n let delay = retryMs;\n let exact = false;\n try {\n const headers: Record<string, string> = { Accept: \"text/event-stream\" };\n if (cursor.current) headers[\"Last-Event-ID\"] = cursor.current;\n const response = await fetch(endpoint, { headers, signal: controller.signal });\n if (!response.ok || !response.body) {\n const status = response.status;\n if (status >= 400 && status < 500 && status !== 408 && status !== 429) {\n throw new FatalStatus(status);\n }\n const retryAfter = Number(response.headers.get(\"Retry-After\"));\n if (Number.isFinite(retryAfter) && retryAfter > 0) {\n delay = retryAfter * 1000;\n exact = true;\n }\n throw new Error(`The subscription answered ${status}.`);\n }\n for await (const { id, message } of readEvents(response.body)) {\n if (stopped) return;\n if (id !== undefined) cursor.current = id;\n if (message.type === \"ready\") {\n retryMs = MIN_RETRY_MS;\n delay = MIN_RETRY_MS;\n setState({ status: \"open\", cursor: cursor.current, error: null });\n } else {\n setState((s) => ({ ...s, cursor: cursor.current }));\n if (message.type === \"change\") callbacks.current.onChange?.(message as never);\n else if (message.type === \"reset\") callbacks.current.onReset?.(message as never);\n }\n }\n } catch (error) {\n if (stopped) return;\n if (error instanceof FatalStatus) {\n setState((s) => ({ ...s, status: \"closed\", error }));\n return;\n }\n // Aborted because the tab was hidden: the loop pauses instead.\n if (controller.signal.aborted) continue;\n setState((s) => ({ ...s, error: error as Error }));\n }\n if (stopped || controller.signal.aborted) continue;\n // The stream ended or failed: try again, a little later each time.\n setState((s) => ({ ...s, status: \"connecting\" }));\n await wait(exact ? delay : equalJitter(delay, random));\n retryMs = Math.min(retryMs * 2, MAX_RETRY_MS);\n }\n })();\n\n return () => {\n stopped = true;\n request?.abort();\n resume?.();\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n }\n };\n}\n\n/**\n * The events of an SSE body: `id` and the JSON `data`. Comments (keepalives)\n * and events without data are skipped; an event whose data is not JSON is\n * dropped rather than ending the stream.\n */\nexport async function* readEvents(\n body: ReadableStream<Uint8Array>,\n): AsyncGenerator<{ id?: string; message: ChangeFeedMessage }> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) return;\n // `ChangeFeed.stream` writes `\\n` only; a proxy's `\\r\\n` is folded here.\n buffer = (buffer + decoder.decode(value, { stream: true })).replace(/\\r\\n?/g, \"\\n\");\n let boundary = buffer.indexOf(\"\\n\\n\");\n while (boundary !== -1) {\n const block = buffer.slice(0, boundary);\n buffer = buffer.slice(boundary + 2);\n boundary = buffer.indexOf(\"\\n\\n\");\n let id: string | undefined;\n const data: string[] = [];\n for (const line of block.split(\"\\n\")) {\n if (line === \"\" || line.startsWith(\":\")) continue;\n const colon = line.indexOf(\":\");\n const field = colon === -1 ? line : line.slice(0, colon);\n let text = colon === -1 ? \"\" : line.slice(colon + 1);\n if (text.startsWith(\" \")) text = text.slice(1);\n if (field === \"id\") id = text;\n else if (field === \"data\") data.push(text);\n }\n if (data.length === 0) continue;\n try {\n yield { id, message: JSON.parse(data.join(\"\\n\")) };\n } catch {\n // Not JSON: not ours to apply.\n }\n }\n }\n } finally {\n await reader.cancel().catch(() => {});\n }\n}\n"],"mappings":";;AAWA,IAAM,eAAe;AACrB,IAAM,eAAe;;AAGrB,IAAM,cAAN,cAA0B,MAAM;CACT;CAArB,YAAY,QAAyB;EACnC,MAAM,qCAAqC,OAAO,EAAE;EADjC,KAAA,SAAA;CAErB;AACF;;;;;;;;;;;;;AA+BA,SAAgB,OAAO,EACrB,UACA,iBACA,QACA,WACA,UACA,SAAS,KAAK,UACc;CAC5B,IAAI,UAAU;CACd,IAAI,UAAkC;CACtC,IAAI,SAA8B;CAClC,IAAI,UAAU;CACd,MAAM,eACJ,mBAAmB,OAAO,aAAa,eAAe,SAAS,oBAAoB;CACrF,MAAM,2BAA2B;EAC/B,IAAI,OAAO,GAAG,SAAS,MAAM;OACxB,SAAS;CAChB;CACA,IAAI,OAAO,aAAa,aACtB,SAAS,iBAAiB,oBAAoB,kBAAkB;CAElE,MAAM,QAAQ,OACZ,IAAI,SAAe,YAAY;EAC7B,MAAM,QAAQ,WAAW,MAAM,EAAE;EACjC,SAAS,OAAO;GACd,aAAa,KAAK;GAClB,SAAS;GACT,QAAQ;EACV;EAEA,SAAS;CACX,CAAC;CAEH,CAAM,YAAY;EAChB,OAAO,CAAC,SAAS;GACf,IAAI,OAAO,GAAG;IACZ,UAAU,OAAO;KAAE,GAAG;KAAG,QAAQ;IAAS,EAAE;IAC5C,MA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,CAAC;KACnD,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO,KAAK,MAAM,CAAC;KAC7C,IAAI,UAAU,MAAM,KAAK;UACpB,IAAI,UAAU,QAAQ,KAAK,KAAK,IAAI;IAC3C;IACA,IAAI,KAAK,WAAW,GAAG;IACvB,IAAI;KACF,MAAM;MAAE;MAAI,SAAS,KAAK,MAAM,KAAK,KAAK,IAAI,CAAC;KAAE;IACnD,QAAQ,CAER;GACF;EACF;CACF,UAAU;EACR,MAAM,OAAO,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;CACtC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"useParams-BN3XXfmG.js","names":[],"sources":["../../client/RouteStateContext.tsx","../../client/useParams.ts"],"sourcesContent":["import type { Action } from \"history\";\nimport { createContext, type PropsWithChildren } from \"react\";\n\nexport interface RouteState {\n views: string[];\n params: Record<string, string>;\n search: string;\n state: Record<string, unknown>;\n /** The resolved URL path, without its locale segment: `/users/7/ai`. */\n pathname: string;\n hash: string;\n action: Action | null;\n /**\n * The matched route's template: `/users/:userId/ai`. Empty when no route\n * matched (a `404`).\n */\n routePath: string;\n locale: string | null;\n}\n\nexport type PageData = {\n data: Record<string, unknown>;\n i18n: {\n currentLocale: string;\n dictionary: Record<string, Record<string, unknown>>;\n supportedLocales: string[];\n defaultLocale?: string;\n /** The IANA zone dates are formatted in, resolved on the server. */\n timeZone?: string;\n };\n prefetchedData: Record<string, unknown>;\n breadcrumbs: any;\n appId: string;\n /**\n * Evaluated features, replaced on every navigation.\n *\n * Lives here rather than only on `ServerDataContext` for the same reason\n * `i18n` does: the server re-evaluates on each navigation payload, so reading\n * from route state is what makes switching a feature on land without a hard\n * reload.\n */\n features: Record<string, boolean>;\n};\n\nexport const RouteStateContext = createContext({} as RouteState & PageData);\n\nexport const RouteStateProvider = (\n props: PropsWithChildren<{\n state: RouteState & PageData;\n }>,\n) => {\n return (\n <RouteStateContext.Provider value={props.state}>\n {props.children}\n </RouteStateContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useParams() {\n const { params = {} } = useContext(RouteStateContext);\n return params;\n}\n"],"mappings":";;;AA4CA,IAAa,oBAAoB,cAAc,CAAC,CAA0B;AAE1E,IAAa,sBACX,UAGG;CACH,OACE,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO,MAAM;YACtC,MAAM;CACmB,CAAA;AAEhC;;;ACrDA,SAAgB,YAAY;CAC1B,MAAM,EAAE,SAAS,CAAC,MAAM,WAAW,iBAAiB;CACpD,OAAO;AACT"}
1
+ {"version":3,"file":"useParams-BN3XXfmG.js","names":[],"sources":["../../client/RouteStateContext.tsx","../../client/useParams.ts"],"sourcesContent":["import type { Action } from \"history\";\nimport { createContext, type PropsWithChildren } from \"react\";\n\nexport interface RouteState {\n views: string[];\n params: Record<string, string>;\n search: string;\n state: Record<string, unknown>;\n /** The resolved URL path, without its locale segment: `/users/7/ai`. */\n pathname: string;\n hash: string;\n action: Action | null;\n /**\n * The history entry the route is on (`scrollRestoration.entryKey`): new on\n * every navigation, including to the same URL. Absent on the server.\n */\n key?: string;\n /**\n * The matched route's template: `/users/:userId/ai`. Empty when no route\n * matched (a `404`).\n */\n routePath: string;\n locale: string | null;\n}\n\nexport type PageData = {\n data: Record<string, unknown>;\n i18n: {\n currentLocale: string;\n dictionary: Record<string, Record<string, unknown>>;\n supportedLocales: string[];\n defaultLocale?: string;\n /** The IANA zone dates are formatted in, resolved on the server. */\n timeZone?: string;\n };\n prefetchedData: Record<string, unknown>;\n breadcrumbs: any;\n appId: string;\n /**\n * Evaluated features, replaced on every navigation.\n *\n * Lives here rather than only on `ServerDataContext` for the same reason\n * `i18n` does: the server re-evaluates on each navigation payload, so reading\n * from route state is what makes switching a feature on land without a hard\n * reload.\n */\n features: Record<string, boolean>;\n};\n\nexport const RouteStateContext = createContext({} as RouteState & PageData);\n\nexport const RouteStateProvider = (\n props: PropsWithChildren<{\n state: RouteState & PageData;\n }>,\n) => {\n return (\n <RouteStateContext.Provider value={props.state}>\n {props.children}\n </RouteStateContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useParams() {\n const { params = {} } = useContext(RouteStateContext);\n return params;\n}\n"],"mappings":";;;AAiDA,IAAa,oBAAoB,cAAc,CAAC,CAA0B;AAE1E,IAAa,sBACX,UAGG;CACH,OACE,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO,MAAM;YACtC,MAAM;CACmB,CAAA;AAEhC;;;AC1DA,SAAgB,YAAY;CAC1B,MAAM,EAAE,SAAS,CAAC,MAAM,WAAW,iBAAiB;CACpD,OAAO;AACT"}
@@ -5,7 +5,6 @@ import { Action } from "history";
5
5
  import { type RootLayoutProps } from "./htmlAttributes";
6
6
  declare global {
7
7
  interface Window {
8
- scrollHistory: Map<string, number>;
9
8
  loaders: Record<string, () => void>;
10
9
  }
11
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ClientRouter.d.ts","sourceRoot":"","sources":["../../client/ClientRouter.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAqB,aAAa,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAKpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAO7C,OAAO,EAA6C,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpG,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAc/E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC;KACrC;CACF;AAkGD,eAAO,MAAM,IAAI,8CACP;IACN,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,a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;AA+SF,eAAO,MAAM,YAAY,GAAI,OAAO;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;IACxD,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAClD,UAAU,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC3C,iEAAiE;IACjE,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,4CAkDA,CAAC"}
@@ -12,11 +12,6 @@ export interface PrefetchTarget {
12
12
  /** `/tr-TR` style prefix, or empty for the default locale. */
13
13
  localeSegment?: string;
14
14
  }
15
- declare global {
16
- interface Window {
17
- scrollHistory: Map<string, number>;
18
- }
19
- }
20
15
  interface ClientRouterContextValue {
21
16
  viewEntriesSubject: Subject<string[]>;
22
17
  history: History | null;
@@ -1 +1 @@
1
- {"version":3,"file":"ClientRouterContext.d.ts","sourceRoot":"","sources":["../../client/ClientRouterContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,OAAO,EAAwB,MAAM,SAAS,CAAC;AAE1E,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAWtD,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,M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,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC1C,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,mBAAmB,mDAE/B,CAAC;AAEF,UAAU,yBAAyB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChD,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACzC;AAKD,eAAO,MAAM,oBAAoB,GAC/B,OAAO,iBAAiB,CAAC,yBAAyB,CAAC,4CA2WpD,CAAC"}
@@ -9,6 +9,11 @@ export interface RouteState {
9
9
  pathname: string;
10
10
  hash: string;
11
11
  action: Action | null;
12
+ /**
13
+ * The history entry the route is on (`scrollRestoration.entryKey`): new on
14
+ * every navigation, including to the same URL. Absent on the server.
15
+ */
16
+ key?: string;
12
17
  /**
13
18
  * The matched route's template: `/users/:userId/ai`. Empty when no route
14
19
  * matched (a `404`).
@@ -1 +1 @@
1
- {"version":3,"file":"RouteStateContext.d.ts","sourceRoot":"","sources":["../../client/RouteStateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE;QACJ,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,gBAAgB,EAAE,MAAM,EAAE,CAAC;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,oEAAoE;QACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,WAAW,EAAE,GAAG,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,e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E,OAAO,CAAC,CAAC;IACxC,WAAW,EAAE,GAAG,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,gDAA6C,CAAC;AAE5E,eAAO,MAAM,kBAAkB,GAC7B,OAAO,iBAAiB,CAAC;IACvB,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC;CAC9B,CAAC,4CAOH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { $ as applyParams$1, A as useNavigate, C as loadDictionaryForRender, D as routeDataUrl, E as readRoutePayload, F as useLocation, G as configureRealtime, H as applyDocumentNonce, I as domainUrl, J as realtime, K as followLive, L as isAbsoluteUrl, M as I18nProvider, N as ServerDataContext, O as useRoute, P as ServerDataProvider, Q as toVariantKey, S as loadDictionary, T as setActiveLocale, U as useCspNonce, V as CspNonceContext, W as RealtimeContext, X as loadLazy, Y as reconnectRealtime, Z as loadedModule, _ as isChunkLoadError, _t as retryDelayFor, a as useRouteTransition, at as DEFAULT_STALE_TIME, b as recoverFromBuildMismatch, bt as Subject, c as ClientRouterContext, ct as resetAuthenticationIncident, d as ComponentsProvider, dt as isExternalRedirect, et as QueryConfigContext, f as initialViewModulesReady, ft as safeRedirectPath, g as configureChunkLoadRecovery, h as CHUNK_RELOAD_MARKER, ht as isRetryableQueryError, i as RouteTransitionProvider, it as pickDefined, j as I18nContext, k as useSearchParams, l as ClientRouterProvider, lt as setAuthenticationNavigator, m as subscribeViewModules, n as useTheme, nt as QueryManagerProvider, o as useChannelSubscription, ot as configureAuthenticationErrors, p as loadViewModule, pt as readResponseBody, r as m, rt as USER_QUERY_CONFIG_KEYS, s as useCoalesced, st as reportAuthenticationRefusal, t as ThemeProvider, tt as QueryManagerContext, u as ComponentsContext, ut as INTENDED_URL_PARAM, v as navigationStarted, vt as shouldRetryQuery, w as registerDictionary, x as recoverFromChunkLoadError, y as otherBuild, yt as QueryError, z as Action } from "../chunks/ThemeProvider-D33bPpf8.js";
1
+ import { $ as toVariantKey, A as useSearchParams, C as loadDictionary, D as readRoutePayload, E as setActiveLocale, F as ServerDataProvider, G as RealtimeContext, H as CspNonceContext, I as useLocation, K as configureRealtime, L as domainUrl, M as I18nContext, N as I18nProvider, O as routeDataUrl, P as ServerDataContext, Q as loadedModule, R as isAbsoluteUrl, S as recoverFromChunkLoadError, T as registerDictionary, U as applyDocumentNonce, W as useCspNonce, X as reconnectRealtime, Y as realtime, Z as loadLazy, _ as configureChunkLoadRecovery, a as useRouteTransition, at as pickDefined, b as otherBuild, bt as QueryError, c as ClientRouterContext, ct as reportAuthenticationRefusal, d as ComponentsContext, dt as INTENDED_URL_PARAM, et as applyParams$1, f as ComponentsProvider, ft as isExternalRedirect, g as CHUNK_RELOAD_MARKER, gt as isRetryableQueryError, h as subscribeViewModules, i as RouteTransitionProvider, it as USER_QUERY_CONFIG_KEYS, j as useNavigate, k as useRoute, l as ClientRouterProvider, lt as resetAuthenticationIncident, m as loadViewModule, mt as readResponseBody, n as useTheme, nt as QueryManagerContext, o as useChannelSubscription, ot as DEFAULT_STALE_TIME, p as initialViewModulesReady, pt as safeRedirectPath, q as followLive, r as m, rt as QueryManagerProvider, s as useCoalesced, st as configureAuthenticationErrors, t as ThemeProvider, tt as QueryConfigContext, u as restoreScroll, ut as setAuthenticationNavigator, v as isChunkLoadError, vt as retryDelayFor, w as loadDictionaryForRender, x as recoverFromBuildMismatch, xt as Subject, y as navigationStarted, yt as shouldRetryQuery } from "../chunks/ThemeProvider-BTVQYl5O.js";
2
2
  import { n as RouteStateContext, r as RouteStateProvider, t as useParams } from "../chunks/useParams-BN3XXfmG.js";
3
3
  import { a as isNetworkError, c as isPermissionError, d as isValidationError, f as mutationErrorField, h as mutationErrorList, i as isHttpError, l as isRateLimitError, m as mutationErrorKind, n as isCsrfError, o as isNotFoundError, p as mutationErrorFromBody, r as isFormError, s as isObject, t as isAuthenticationError, u as isServerError } from "../chunks/MutationError-DuKqBW8o.js";
4
4
  import { Fragment, StrictMode, Suspense, createContext, createElement, isValidElement, lazy, memo, use, useCallback, useContext, useDeferredValue, useEffect, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
@@ -562,7 +562,7 @@ var SOCKET_ID_HEADER = "x-gemi-socket";
562
562
  */
563
563
  var mutationExtras = {
564
564
  current: null,
565
- load: () => import("../chunks/mutationExtras-BbDboF8F.js")
565
+ load: () => import("../chunks/mutationExtras-BRFfb6-L.js")
566
566
  };
567
567
  /** Starts loading `./mutationExtras`: the hooks' mount effect. */
568
568
  function preloadMutationExtras() {
@@ -920,7 +920,7 @@ function useMutate() {
920
920
  //#region client/fetchFile.ts
921
921
  var request = {
922
922
  current: null,
923
- load: () => import("../chunks/fetchFileRequest-Cp0QjioM.js")
923
+ load: () => import("../chunks/fetchFileRequest-BHCSZqKL.js")
924
924
  };
925
925
  /**
926
926
  * Downloads a file route's body as a `Blob`.
@@ -986,7 +986,7 @@ function useSetQueryData() {
986
986
  //#endregion
987
987
  //#region client/useSubscription.ts
988
988
  /** `./subscriptionStream`, loaded on first use. Replaceable in tests. */
989
- var streamModule = { load: () => import("../chunks/subscriptionStream-CRj9aV4K.js") };
989
+ var streamModule = { load: () => import("../chunks/subscriptionStream-CRRgUXJp.js") };
990
990
  /**
991
991
  * Follows a route that answers with `ChangeFeed.stream`, as long as the
992
992
  * component is mounted: each change reaches `onChange`, in order, exactly
@@ -2036,23 +2036,6 @@ async function loadRoutePayload(options) {
2036
2036
  }
2037
2037
  //#endregion
2038
2038
  //#region client/ClientRouter.tsx
2039
- function restoreScroll(action = null, _pathname = "no path") {
2040
- if (action === null) return;
2041
- const { pathname, search, hash } = window.location;
2042
- const key = [
2043
- pathname,
2044
- search,
2045
- hash
2046
- ].join("");
2047
- const sh = window.scrollHistory;
2048
- const scrollPosition = sh?.get(key);
2049
- if (action !== Action.Pop) window.scrollTo(0, 0);
2050
- else {
2051
- if (!scrollPosition) return;
2052
- window.scrollTo(0, scrollPosition ?? 0);
2053
- }
2054
- sh?.delete(key);
2055
- }
2056
2039
  function sameViews(a = [], b = []) {
2057
2040
  return a.length === b.length && a.every((view, i) => view === b[i]);
2058
2041
  }
@@ -2067,7 +2050,7 @@ var DefaultQueryErrorFallback = (props) => {
2067
2050
  });
2068
2051
  };
2069
2052
  var Route = memo((props) => {
2070
- const { componentPath, pathname, action, children } = props;
2053
+ const { componentPath, pathname } = props;
2071
2054
  const { viewImportMap, getViewModule } = useContext(ComponentsContext);
2072
2055
  const { clearErrors } = useContext(QueryManagerContext);
2073
2056
  const { data } = useRouteData();
@@ -2075,13 +2058,6 @@ var Route = memo((props) => {
2075
2058
  const mod = useSyncExternalStore(subscribeViewModules, getModule, getModule);
2076
2059
  const componentData = data?.[pathname]?.[componentPath] ?? {};
2077
2060
  const Component = viewImportMap[componentPath];
2078
- useEffect(() => {
2079
- if (!children) restoreScroll(action, componentPath);
2080
- }, [
2081
- action,
2082
- children,
2083
- componentPath
2084
- ]);
2085
2061
  if (!Component) {
2086
2062
  const NotFound = viewImportMap["404"];
2087
2063
  return /* @__PURE__ */ jsx(NotFound, {});
@@ -2138,6 +2114,7 @@ var Routes = (props) => {
2138
2114
  pathname: routerSubject?.getValue().pathname,
2139
2115
  views: routerSubject?.getValue().views,
2140
2116
  action: null,
2117
+ key: routerSubject?.getValue().key,
2141
2118
  hash: routerSubject?.getValue().hash,
2142
2119
  state: routerSubject?.getValue().state,
2143
2120
  routePath: routerSubject?.getValue().routePath,
@@ -2164,6 +2141,22 @@ var Routes = (props) => {
2164
2141
  } : null;
2165
2142
  }
2166
2143
  }), [routerSubject]);
2144
+ const { key: navigationKey, action, hash = "" } = routeState;
2145
+ const shallow = Boolean(routeState.state?.shallow);
2146
+ useEffect(() => {
2147
+ if (navigationKey === void 0) return;
2148
+ restoreScroll({
2149
+ key: navigationKey,
2150
+ action,
2151
+ hash,
2152
+ shallow
2153
+ });
2154
+ }, [
2155
+ navigationKey,
2156
+ action,
2157
+ hash,
2158
+ shallow
2159
+ ]);
2167
2160
  useEffect(() => {
2168
2161
  resetAuthenticationIncident();
2169
2162
  }, [routeState.pathname, routeState.search]);