gemi 0.129.0 → 0.130.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 (60) hide show
  1. package/dist/{chunk-wmkrb1qv.js → chunk-13agap7z.js} +1 -1
  2. package/dist/{chunk-zw5z1k84.js → chunk-7ynnce4b.js} +1 -1
  3. package/dist/{chunk-sbdm4enk.js → chunk-xtqhagxz.js} +2 -2
  4. package/dist/{chunk-sbdm4enk.js.map → chunk-xtqhagxz.js.map} +1 -1
  5. package/dist/chunks/MutationError-DuKqBW8o.js +199 -0
  6. package/dist/chunks/MutationError-DuKqBW8o.js.map +1 -0
  7. package/dist/chunks/{RealtimeClient-CqGve6h8.js → RealtimeClient-DsWbFRC7.js} +11 -3
  8. package/dist/chunks/RealtimeClient-DsWbFRC7.js.map +1 -0
  9. package/dist/chunks/{ThemeProvider-DaX0eyqs.js → ThemeProvider-gWqXjGh-.js} +70 -91
  10. package/dist/chunks/ThemeProvider-gWqXjGh-.js.map +1 -0
  11. package/dist/chunks/channelKey-CIhHpX6x.js +10 -0
  12. package/dist/chunks/channelKey-CIhHpX6x.js.map +1 -0
  13. package/dist/chunks/fetchFileRequest-BSrgYnAy.js +57 -0
  14. package/dist/chunks/fetchFileRequest-BSrgYnAy.js.map +1 -0
  15. package/dist/chunks/{live-DIUDdLrA.js → live-CUdMhXHL.js} +22 -3
  16. package/dist/chunks/live-CUdMhXHL.js.map +1 -0
  17. package/dist/chunks/mutationExtras-CtY-X9m7.js +115 -0
  18. package/dist/chunks/mutationExtras-CtY-X9m7.js.map +1 -0
  19. package/dist/client/MutationError.d.ts +7 -9
  20. package/dist/client/MutationError.d.ts.map +1 -1
  21. package/dist/client/QueryResource.d.ts +3 -11
  22. package/dist/client/QueryResource.d.ts.map +1 -1
  23. package/dist/client/fetchFile.d.ts +4 -7
  24. package/dist/client/fetchFile.d.ts.map +1 -1
  25. package/dist/client/fetchFileRequest.d.ts +14 -0
  26. package/dist/client/fetchFileRequest.d.ts.map +1 -0
  27. package/dist/client/index.js +88 -339
  28. package/dist/client/index.js.map +1 -1
  29. package/dist/client/lazyModule.d.ts +32 -0
  30. package/dist/client/lazyModule.d.ts.map +1 -0
  31. package/dist/client/mutationErrorHelpers.d.ts +11 -0
  32. package/dist/client/mutationErrorHelpers.d.ts.map +1 -0
  33. package/dist/client/mutationExtras.d.ts +3 -0
  34. package/dist/client/mutationExtras.d.ts.map +1 -0
  35. package/dist/client/mutationModules.d.ts +17 -0
  36. package/dist/client/mutationModules.d.ts.map +1 -0
  37. package/dist/client/queryUpdates.d.ts +22 -0
  38. package/dist/client/queryUpdates.d.ts.map +1 -0
  39. package/dist/client/realtime/RealtimeClient.d.ts +5 -0
  40. package/dist/client/realtime/RealtimeClient.d.ts.map +1 -1
  41. package/dist/client/realtime/channelKey.d.ts +4 -0
  42. package/dist/client/realtime/channelKey.d.ts.map +1 -0
  43. package/dist/client/realtime/live.d.ts +6 -0
  44. package/dist/client/realtime/live.d.ts.map +1 -1
  45. package/dist/client/realtime/loader.d.ts +20 -23
  46. package/dist/client/realtime/loader.d.ts.map +1 -1
  47. package/dist/client/realtime/useChannelSubscription.d.ts.map +1 -1
  48. package/dist/client/useMutation.d.ts +1 -1
  49. package/dist/client/useMutation.d.ts.map +1 -1
  50. package/dist/client/useSetQueryData.d.ts +4 -17
  51. package/dist/client/useSetQueryData.d.ts.map +1 -1
  52. package/dist/server/index.js +1 -1
  53. package/dist/testing/index.js +4 -3
  54. package/dist/testing/index.js.map +1 -1
  55. package/package.json +1 -1
  56. package/dist/chunks/RealtimeClient-CqGve6h8.js.map +0 -1
  57. package/dist/chunks/ThemeProvider-DaX0eyqs.js.map +0 -1
  58. package/dist/chunks/live-DIUDdLrA.js.map +0 -1
  59. /package/dist/{chunk-wmkrb1qv.js.map → chunk-13agap7z.js.map} +0 -0
  60. /package/dist/{chunk-zw5z1k84.js.map → chunk-7ynnce4b.js.map} +0 -0
@@ -0,0 +1,10 @@
1
+ //#region client/realtime/channelKey.ts
2
+ /** `pattern` and its params, canonical: two hooks on one channel share a `sub`. */
3
+ function channelKey(pattern, params) {
4
+ const sorted = Object.keys(params).sort().map((key) => [key, String(params[key])]);
5
+ return `${pattern}\u0000${JSON.stringify(sorted)}`;
6
+ }
7
+ //#endregion
8
+ export { channelKey as t };
9
+
10
+ //# sourceMappingURL=channelKey-CIhHpX6x.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelKey-CIhHpX6x.js","names":[],"sources":["../../client/realtime/channelKey.ts"],"sourcesContent":["import type { ChannelParamValues } from \"./RealtimeClient\";\n\n// A module of its own so the socket client (`./RealtimeClient`, loaded on\n// first use) and `FakeSocket` share it without reaching `./loader`, which\n// would keep it in every route's entry chunk (#915).\n\n/** `pattern` and its params, canonical: two hooks on one channel share a `sub`. */\nexport function channelKey(pattern: string, params: ChannelParamValues): string {\n const sorted = Object.keys(params)\n .sort()\n .map((key) => [key, String(params[key])]);\n return `${pattern}\\u0000${JSON.stringify(sorted)}`;\n}\n"],"mappings":";;AAOA,SAAgB,WAAW,SAAiB,QAAoC;CAC9E,MAAM,SAAS,OAAO,KAAK,MAAM,CAAC,CAC/B,KAAK,CAAC,CACN,KAAK,QAAQ,CAAC,KAAK,OAAO,OAAO,IAAI,CAAC,CAAC;CAC1C,OAAO,GAAG,QAAQ,QAAQ,KAAK,UAAU,MAAM;AACjD"}
@@ -0,0 +1,57 @@
1
+ import { it as QueryError, q as applyParams, tt as parseRetryAfter } from "./ThemeProvider-gWqXjGh-.js";
2
+ //#region client/fetchFileRequest.ts
3
+ /**
4
+ * `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a
5
+ * non-2xx, and the body read `as` a blob or text.
6
+ */
7
+ async function fetchFile(path, options, as) {
8
+ const response = await request(path, options);
9
+ return {
10
+ ...as === "blob" ? { blob: await response.blob() } : { text: await response.text() },
11
+ filename: filenameOf(response),
12
+ response
13
+ };
14
+ }
15
+ async function request(path, options = {}) {
16
+ const { params = {}, search, signal, init } = options;
17
+ const url = applyParams(path, params);
18
+ const query = searchString(search);
19
+ const response = await fetch(`/api${url}${query ? `?${query}` : ""}`, {
20
+ ...init,
21
+ method: "GET",
22
+ signal
23
+ });
24
+ if (!response.ok) {
25
+ const body = await response.json().catch(() => null);
26
+ throw new QueryError(url, query, response.status, body, parseRetryAfter(response.headers.get("retry-after")));
27
+ }
28
+ return response;
29
+ }
30
+ function searchString(search) {
31
+ if (!search) return "";
32
+ if (search instanceof URLSearchParams) return search.toString();
33
+ const params = new URLSearchParams();
34
+ for (const [key, value] of Object.entries(search)) if (value !== null && value !== void 0) params.append(key, String(value));
35
+ return params.toString();
36
+ }
37
+ /**
38
+ * The file name in a `Content-Disposition` header: the RFC 5987
39
+ * `filename*=UTF-8''...` form when present and decodable, else `filename`.
40
+ *
41
+ * @internal Exported for tests.
42
+ */
43
+ function filenameOf(response) {
44
+ const header = response.headers.get("content-disposition");
45
+ if (!header) return null;
46
+ const extended = /filename\*\s*=\s*([^']*)'[^']*'([^;]+)/i.exec(header);
47
+ if (extended) try {
48
+ return decodeURIComponent(extended[2].trim());
49
+ } catch {}
50
+ const plain = /filename\s*=\s*(?:"((?:[^"\\]|\\.)*)"|([^;]+))/i.exec(header);
51
+ if (!plain) return null;
52
+ return (plain[1] !== void 0 ? plain[1].replace(/\\(.)/g, "$1") : plain[2].trim()) || null;
53
+ }
54
+ //#endregion
55
+ export { fetchFile, filenameOf };
56
+
57
+ //# sourceMappingURL=fetchFileRequest-BSrgYnAy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchFileRequest-BSrgYnAy.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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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,4 +1,4 @@
1
- import "./ThemeProvider-DaX0eyqs.js";
1
+ import { G as loadedModule, H as realtime } from "./ThemeProvider-gWqXjGh-.js";
2
2
  //#region \0rolldown/runtime.js
3
3
  var __defProp = Object.defineProperty;
4
4
  var __exportAll = (all, no_symbols) => {
@@ -13,6 +13,7 @@ var __exportAll = (all, no_symbols) => {
13
13
  //#endregion
14
14
  //#region client/realtime/live.ts
15
15
  var live_exports = /* @__PURE__ */ __exportAll({
16
+ followLive: () => followLive,
16
17
  resolveLiveChannel: () => resolveLiveChannel,
17
18
  subscribeLive: () => subscribeLive
18
19
  });
@@ -63,7 +64,25 @@ function subscribeLive(socket, live, resource, setOpen) {
63
64
  release();
64
65
  };
65
66
  }
67
+ /**
68
+ * What `followLive` in `./loader` hands over to once this module is loaded:
69
+ * subscribes on the provided socket, or the tab's client, loading that first
70
+ * when it is not there yet. Returns the function that stops it.
71
+ */
72
+ function followLive(provided, live, resource, setOpen) {
73
+ let stop;
74
+ const start = (socket) => {
75
+ if (stop === void 0) stop = subscribeLive(socket, live, resource, setOpen);
76
+ };
77
+ const socket = provided ?? realtime.client;
78
+ if (socket) start(socket);
79
+ else import("./RealtimeClient-DsWbFRC7.js").then((module) => start(loadedModule(module).tabClient())).catch(() => {});
80
+ return () => {
81
+ stop?.();
82
+ stop = null;
83
+ };
84
+ }
66
85
  //#endregion
67
- export { live_exports as t };
86
+ export { live_exports as n, followLive as t };
68
87
 
69
- //# sourceMappingURL=live-DIUDdLrA.js.map
88
+ //# sourceMappingURL=live-CUdMhXHL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-CUdMhXHL.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"}
@@ -0,0 +1,115 @@
1
+ import { K as toVariantKey, q as applyParams } from "./ThemeProvider-gWqXjGh-.js";
2
+ import { p as mutationErrorFromBody, s as isObject } from "./MutationError-DuKqBW8o.js";
3
+ //#region client/mutationErrorHelpers.ts
4
+ var FALLBACK_MESSAGE = "Something went wrong. Try again.";
5
+ function isValidationError(error) {
6
+ return isObject(error) && error.kind === "validation_error";
7
+ }
8
+ function unwrapQueryError(error) {
9
+ if (error instanceof Error && error.name === "QueryError" && "body" in error) {
10
+ const { body, status } = error;
11
+ return body == null ? error : mutationErrorFromBody(body, status);
12
+ }
13
+ return error;
14
+ }
15
+ function list(error, fallback = FALLBACK_MESSAGE) {
16
+ const value = unwrapQueryError(error);
17
+ if (isValidationError(value)) {
18
+ const messages = Object.values(value.messages ?? {}).flat().filter((message) => typeof message === "string" && message !== "");
19
+ return messages.length > 0 ? messages : [fallback];
20
+ }
21
+ if (isObject(value) && !(value instanceof Error) && value.kind !== "server_error" && typeof value.message === "string" && value.message !== "") return [value.message];
22
+ return [fallback];
23
+ }
24
+ function field(error, name) {
25
+ const value = unwrapQueryError(error);
26
+ if (!isValidationError(value)) return [];
27
+ const messages = value.messages?.[name];
28
+ return Array.isArray(messages) ? [...messages] : [];
29
+ }
30
+ /**
31
+ * Puts `list` and `field` on an error the hooks hand over, as non-enumerable
32
+ * properties, so `toEqual`, a spread and `JSON.stringify` see the same object
33
+ * as before. A key the error already has is left alone; a primitive or a
34
+ * frozen value is returned as it is.
35
+ *
36
+ * @internal
37
+ */
38
+ function withMutationErrorHelpers(error) {
39
+ if (!isObject(error) || !Object.isExtensible(error)) return error;
40
+ const helpers = {
41
+ list: (fallback) => list(error, fallback),
42
+ field: (name) => field(error, name)
43
+ };
44
+ for (const key of ["list", "field"]) {
45
+ if (key in error) continue;
46
+ Object.defineProperty(error, key, {
47
+ value: helpers[key],
48
+ configurable: true,
49
+ writable: true,
50
+ enumerable: false
51
+ });
52
+ }
53
+ return error;
54
+ }
55
+ //#endregion
56
+ //#region client/queryUpdates.ts
57
+ /**
58
+ * Write data the server just produced (a mutation's answer) into a variant,
59
+ * with no refetch: unlike `mutate`, the value is not a guess to reconcile.
60
+ * The variant counts as freshly fetched, so its `staleTime` starts again, and
61
+ * a GET already on the wire for it is dropped when it lands, since it may
62
+ * carry the data from before the write. A reader suspended on the variant
63
+ * wakes up with it (#897). Here rather than on `QueryResource`, which every
64
+ * entry chunk carries (#915).
65
+ */
66
+ function setVariant(resource, variantKey, data) {
67
+ resource.dropHttpCache(variantKey);
68
+ resource.markApplied(variantKey);
69
+ const store = resource.store.getValue();
70
+ resource.fill(store, variantKey, data, Date.now());
71
+ resource.store.next(store);
72
+ }
73
+ /**
74
+ * Write into every variant `target` names. `next` is the value to write, or
75
+ * a function of the cached value; a function skips a variant with nothing
76
+ * cached. A value seeds a single variant that is not cached yet; a predicate
77
+ * only ever reaches variants that are.
78
+ */
79
+ function writeQueryData(getResource, routeParams, target, next) {
80
+ const { path, params = {}, search = {} } = target;
81
+ const resource = getResource(applyParams(String(path), {
82
+ ...routeParams,
83
+ ...params
84
+ }));
85
+ const write = (variantKey) => {
86
+ if ("value" in next) {
87
+ setVariant(resource, variantKey, next.value);
88
+ return;
89
+ }
90
+ const state = resource.peek(variantKey);
91
+ if (!state?.hasData) return;
92
+ setVariant(resource, variantKey, next.update(state.data));
93
+ };
94
+ if (typeof search === "function") {
95
+ for (const variantKey of resource.variantKeys()) {
96
+ if (!resource.peek(variantKey)?.hasData) continue;
97
+ if (search(new URLSearchParams(variantKey))) write(variantKey);
98
+ }
99
+ return;
100
+ }
101
+ write(toVariantKey(search));
102
+ }
103
+ /**
104
+ * Write a mutation's `updates` with its answer.
105
+ */
106
+ function applyQueryUpdates(getResource, routeParams, updates, answer) {
107
+ for (const update of updates ?? []) {
108
+ const { data } = update;
109
+ writeQueryData(getResource, routeParams, update, data ? { update: (current) => data(answer, current) } : { value: answer });
110
+ }
111
+ }
112
+ //#endregion
113
+ export { applyQueryUpdates, withMutationErrorHelpers, writeQueryData };
114
+
115
+ //# sourceMappingURL=mutationExtras-CtY-X9m7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutationExtras-CtY-X9m7.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,GAAG,QAAQ,IAAI,CAAC;AACpD;;;;;;;;;AAUA,SAAgB,yBAA4B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AM,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"}
@@ -93,6 +93,8 @@ export interface MutationMessageError {
93
93
  export type MutationError = MutationValidationError | MutationFormError | MutationServerError | MutationRefusal | Error;
94
94
  /** What `mutationErrorKind` answers, one per guard below. */
95
95
  export type MutationErrorKind = "validation" | "form" | "authentication" | "permission" | "csrf" | "not_found" | "rate_limit" | "server" | "network" | "unknown";
96
+ /** @internal */
97
+ export declare function isObject(error: unknown): error is Record<string, unknown>;
96
98
  /**
97
99
  * The `MutationError` a non-2xx response's parsed body stands for.
98
100
  *
@@ -197,6 +199,11 @@ export type WithMutationErrorHelpers<T> = T extends object ? T & Omit<MutationEr
197
199
  /**
198
200
  * `error.list(fallback)` for any value: an error kept from a mutation, a
199
201
  * `useQuery` `QueryError` (its body is read), or anything else.
202
+ *
203
+ * Kept in step with `list` in `./mutationErrorHelpers`, which the mutation
204
+ * hooks load on first use (#915) and so cannot share this code: an app's
205
+ * bundler would put it back in the entry chunk. `MutationError.helpers.test`
206
+ * runs the same cases through both.
200
207
  */
201
208
  export declare function mutationErrorList(error: unknown, fallback?: string): string[];
202
209
  /**
@@ -204,13 +211,4 @@ export declare function mutationErrorList(error: unknown, fallback?: string): st
204
211
  * `name` (a `QueryError`'s body is read), `[]` for anything else.
205
212
  */
206
213
  export declare function mutationErrorField(error: unknown, name: string): string[];
207
- /**
208
- * Puts `list` and `field` on an error the hooks hand over, as non-enumerable
209
- * properties, so `toEqual`, a spread and `JSON.stringify` see the same object
210
- * as before. A key the error already has is left alone; a primitive or a
211
- * frozen value is returned as it is.
212
- *
213
- * @internal
214
- */
215
- export declare function withMutationErrorHelpers<T>(error: T): WithMutationErrorHelpers<T>;
216
214
  //# sourceMappingURL=MutationError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutationError.d.ts","sourceRoot":"","sources":["../../client/MutationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sEAAsE;AACtE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,+CAA+C;AAC/C,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,WAAW,EACX,kBAAkB,GAAG,YAAY,GAAG,cAAc,CACnD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB;IAClF,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,aAAa,GACrB,uBAAuB,GACv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AAE,MAAyB,GAClC,MAAM,EAAE,CAkBV;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKzE"}
@@ -172,20 +172,12 @@ export declare class QueryResource {
172
172
  * and revalidates — bypassing the HTTP cache — the next time it is read.
173
173
  */
174
174
  invalidate(variantKey: string, fn?: (data: any) => any): void;
175
- private dropHttpCache;
175
+ dropHttpCache(variantKey: string): void;
176
176
  mutate(variantKey: string, fn?: (data: any) => any): void;
177
- /**
178
- * Write data the server just produced (a mutation's answer) into a
179
- * variant, with no refetch: unlike `mutate`, the value is not a guess to
180
- * reconcile. The variant counts as freshly fetched, so its `staleTime`
181
- * starts again, and a GET already on the wire for it is dropped when it
182
- * lands, since it may carry the data from before the write. A reader
183
- * suspended on the variant wakes up with it (#897).
184
- */
185
- set(variantKey: string, data: any): void;
177
+ fill(store: Map<string, State>, variantKey: string, data: any, now: number): void;
186
178
  refetch(variantKey: string): void;
187
179
  /** Supersede every request for this variant that is already on the wire. */
188
- private markApplied;
180
+ markApplied(variantKey: string): void;
189
181
  private resolveVariant;
190
182
  }
191
183
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"QueryResource.d.ts","sourceRoot":"","sources":["../../client/QueryResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,GAAG,CAAC;IACV;;;;;;OAMG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAGvC,qBAAa,aAAa;IACxB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACnC,aAAa,cAA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AC,UAAU,EAAE,MAAM,GAAG,MAAM,IAAI;IAkBtC;;;;;;;;;OASG;IACH,OAAO,CAAC,aAAa;IAQrB,wDAAwD;IACxD,OAAO,CAAC,KAAK;IASb,iFAAiF;IACjF,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIxC;;;;;OAKG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAqB/C,WAAW,CAAC,UAAU,EAAE,MAAM;IAQ9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM;IAQ3B,2EAA2E;IAC3E,WAAW,IAAI,MAAM,EAAE;IAIvB;;;;;OAKG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG;IAgBtD,aAAa,CAAC,UAAU,EAAE,MAAM;IAiBhC,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,GAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAoB;IAkClE,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;IAe1E,OAAO,CAAC,UAAU,EAAE,MAAM;IAI1B,4EAA4E;IAC5E,WAAW,CAAC,UAAU,EAAE,MAAM;YAIhB,cAAc;CAsK7B"}
@@ -51,16 +51,13 @@ export interface FetchedText extends Fetched {
51
51
  * `retryAfter`), the error `useQuery` throws, so `mutationErrorList(error)`
52
52
  * reads its message. A network failure rejects with the browser's `TypeError`,
53
53
  * an abort with its `AbortError`.
54
+ *
55
+ * The request code loads on the first call (#915), so a route that never
56
+ * downloads a file carries none of it; a failed load rejects as a network
57
+ * failure does.
54
58
  */
55
59
  export declare function fetchBlob<P extends FilePath>(path: P, ...args: FetchFileArgs<P>): Promise<FetchedBlob>;
56
60
  /** `fetchBlob`, with the body read as text. */
57
61
  export declare function fetchText<P extends FilePath>(path: P, ...args: FetchFileArgs<P>): Promise<FetchedText>;
58
- /**
59
- * The file name in a `Content-Disposition` header: the RFC 5987
60
- * `filename*=UTF-8''...` form when present and decodable, else `filename`.
61
- *
62
- * @internal Exported for tests.
63
- */
64
- export declare function filenameOf(response: Response): string | null;
65
62
  export {};
66
63
  //# sourceMappingURL=fetchFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchFile.d.ts","sourceRoot":"","sources":["../../client/fetchFile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;AAE3C,0DAA0D;AAC1D,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AAElF,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IAC/C,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,oEAAoE;IACpE,MAAM,CAAC,EACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,GAC5D,eAAe,CAAC;IACpB,kFAAkF;IAClF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,qFAAqF;IACrF,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;CACxD,CAAC;AAGF,gBAAgB;AAChB,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IACxC,EAAE,SAAS,SAAS,CAA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AG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,+CAA+C;AAC/C,wBAAsB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAChD,IAAI,EAAE,CAAC,EACP,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,WAAW,CAAC,CAEtB"}
@@ -0,0 +1,14 @@
1
+ import type { FetchedBlob, FetchedText } from "./fetchFile";
2
+ /**
3
+ * `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a
4
+ * non-2xx, and the body read `as` a blob or text.
5
+ */
6
+ export declare function fetchFile(path: string, options: object | undefined, as: "blob" | "text"): Promise<FetchedBlob | FetchedText>;
7
+ /**
8
+ * The file name in a `Content-Disposition` header: the RFC 5987
9
+ * `filename*=UTF-8''...` form when present and decodable, else `filename`.
10
+ *
11
+ * @internal Exported for tests.
12
+ */
13
+ export declare function filenameOf(response: Response): string | null;
14
+ //# sourceMappingURL=fetchFileRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchFileRequest.d.ts","sourceRoot":"","sources":["../../client/fetchFileRequest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAoB,MAAM,aAAa,CAAC;AAW9E;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EAEZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,GAClB,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,CAIpC;AAmCD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAe5D"}