zudoku 0.66.6 → 0.66.7

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 (114) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +2 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/components/Pagination.js +2 -2
  5. package/dist/lib/components/Pagination.js.map +1 -1
  6. package/dist/lib/components/index.d.ts +3 -0
  7. package/dist/lib/components/index.js +4 -0
  8. package/dist/lib/components/index.js.map +1 -1
  9. package/dist/lib/components/navigation/NavigationItem.js +2 -2
  10. package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
  11. package/dist/lib/core/react-query.d.ts +1 -0
  12. package/dist/lib/core/react-query.js +2 -0
  13. package/dist/lib/core/react-query.js.map +1 -0
  14. package/dist/lib/oas/graphql/circular.d.ts +1 -0
  15. package/dist/lib/oas/graphql/circular.js +15 -8
  16. package/dist/lib/oas/graphql/circular.js.map +1 -1
  17. package/dist/lib/oas/graphql/circular.test.d.ts +1 -0
  18. package/dist/lib/oas/graphql/circular.test.js +152 -0
  19. package/dist/lib/oas/graphql/circular.test.js.map +1 -0
  20. package/dist/vite/config.js +2 -0
  21. package/dist/vite/config.js.map +1 -1
  22. package/lib/{ClaudeLogo-BpqHBMS8.js → ClaudeLogo-DHxJUhN_.js} +20 -20
  23. package/lib/ClaudeLogo-DHxJUhN_.js.map +1 -0
  24. package/lib/HydrationBoundary-CNF2ZV3E.js +601 -0
  25. package/lib/HydrationBoundary-CNF2ZV3E.js.map +1 -0
  26. package/lib/Input-Cx-GeKoF.js +22 -0
  27. package/lib/Input-Cx-GeKoF.js.map +1 -0
  28. package/lib/{MdxPage-CeFSxGb_.js → MdxPage-CD36PJ17.js} +7 -7
  29. package/lib/{MdxPage-CeFSxGb_.js.map → MdxPage-CD36PJ17.js.map} +1 -1
  30. package/lib/{Mermaid-COVtAqcZ.js → Mermaid-Koc3z8mU.js} +3 -3
  31. package/lib/{Mermaid-COVtAqcZ.js.map → Mermaid-Koc3z8mU.js.map} +1 -1
  32. package/lib/{OAuthErrorPage-XTPBOMN8.js → OAuthErrorPage-4mN5DA86.js} +23 -22
  33. package/lib/{OAuthErrorPage-XTPBOMN8.js.map → OAuthErrorPage-4mN5DA86.js.map} +1 -1
  34. package/lib/{OasProvider-BS4rdzZC.js → OasProvider-DSe-hk5Y.js} +3 -3
  35. package/lib/{OasProvider-BS4rdzZC.js.map → OasProvider-DSe-hk5Y.js.map} +1 -1
  36. package/lib/{OperationList-Dg0Nm1tg.js → OperationList-CaknPbvq.js} +32 -31
  37. package/lib/{OperationList-Dg0Nm1tg.js.map → OperationList-CaknPbvq.js.map} +1 -1
  38. package/lib/{RouteGuard-kCicqF3x.js → RouteGuard--A04ESy8.js} +3 -3
  39. package/lib/{RouteGuard-kCicqF3x.js.map → RouteGuard--A04ESy8.js.map} +1 -1
  40. package/lib/{SchemaList-DZKBH2WC.js → SchemaList-Dw3-CJPb.js} +7 -7
  41. package/lib/{SchemaList-DZKBH2WC.js.map → SchemaList-Dw3-CJPb.js.map} +1 -1
  42. package/lib/{SchemaView-DBaqV2yU.js → SchemaView-DyJkiQkD.js} +3 -3
  43. package/lib/{SchemaView-DBaqV2yU.js.map → SchemaView-DyJkiQkD.js.map} +1 -1
  44. package/lib/{SignUp-DNmOFbLD.js → SignUp-DRvN-8cq.js} +3 -3
  45. package/lib/{SignUp-DNmOFbLD.js.map → SignUp-DRvN-8cq.js.map} +1 -1
  46. package/lib/{SyntaxHighlight-C75W8uCn.js → SyntaxHighlight-klTH8c6-.js} +2 -2
  47. package/lib/{SyntaxHighlight-C75W8uCn.js.map → SyntaxHighlight-klTH8c6-.js.map} +1 -1
  48. package/lib/{Toc-ICilS65g.js → Toc-PbuF-u9x.js} +2 -2
  49. package/lib/{Toc-ICilS65g.js.map → Toc-PbuF-u9x.js.map} +1 -1
  50. package/lib/ZudokuContext-BZB1TWdT.js +387 -0
  51. package/lib/ZudokuContext-BZB1TWdT.js.map +1 -0
  52. package/lib/{circular-DleWPaPP.js → circular-DFquXeY2.js} +21 -19
  53. package/lib/{circular-DleWPaPP.js.map → circular-DFquXeY2.js.map} +1 -1
  54. package/lib/{createServer-nqMW9kro.js → createServer-BXZ0CAUn.js} +4 -4
  55. package/lib/{createServer-nqMW9kro.js.map → createServer-BXZ0CAUn.js.map} +1 -1
  56. package/lib/{errors-D2FbERKl.js → errors-rWHkzVTd.js} +2 -2
  57. package/lib/{errors-D2FbERKl.js.map → errors-rWHkzVTd.js.map} +1 -1
  58. package/lib/{firebase-Cn9CmB6h.js → firebase-BmGU1FuD.js} +17 -15
  59. package/lib/{firebase-Cn9CmB6h.js.map → firebase-BmGU1FuD.js.map} +1 -1
  60. package/lib/{hook-B2nmfmYN.js → hook-BGlHBdET.js} +2 -2
  61. package/lib/{hook-B2nmfmYN.js.map → hook-BGlHBdET.js.map} +1 -1
  62. package/lib/{index-D5NeW2z6.js → index-BDsEwofZ.js} +1709 -1707
  63. package/lib/index-BDsEwofZ.js.map +1 -0
  64. package/lib/{index-CSDW7CHl.js → index-BQB9hb6n.js} +151 -149
  65. package/lib/{index-CSDW7CHl.js.map → index-BQB9hb6n.js.map} +1 -1
  66. package/lib/{index-CC4L3gtM.js → index-DBjOT2H1.js} +3 -3
  67. package/lib/{index-CC4L3gtM.js.map → index-DBjOT2H1.js.map} +1 -1
  68. package/lib/{index-DSKBOdpT.js → index-DRBOFufT.js} +2 -2
  69. package/lib/{index-DSKBOdpT.js.map → index-DRBOFufT.js.map} +1 -1
  70. package/lib/{index.esm-B35e7P83.js → index.esm-Cx8B1YJQ.js} +2 -2
  71. package/lib/index.esm-Cx8B1YJQ.js.map +1 -0
  72. package/lib/{mutation-BOYnEDf6.js → mutation-BISOc7OM.js} +2 -2
  73. package/lib/{mutation-BOYnEDf6.js.map → mutation-BISOc7OM.js.map} +1 -1
  74. package/lib/ui/SyntaxHighlight.js +2 -2
  75. package/lib/{Input-B6YcAPv-.js → useMutation-CFMGlAMW.js} +23 -40
  76. package/lib/useMutation-CFMGlAMW.js.map +1 -0
  77. package/lib/useSuspenseQuery-CSB_rVek.js +1226 -0
  78. package/lib/useSuspenseQuery-CSB_rVek.js.map +1 -0
  79. package/lib/zudoku.__internal.js +928 -1457
  80. package/lib/zudoku.__internal.js.map +1 -1
  81. package/lib/zudoku.auth-auth0.js +1 -1
  82. package/lib/zudoku.auth-azureb2c.js +4 -4
  83. package/lib/zudoku.auth-clerk.js +2 -2
  84. package/lib/zudoku.auth-firebase.js +4 -4
  85. package/lib/zudoku.auth-openid.js +4 -4
  86. package/lib/zudoku.auth-supabase.js +4 -4
  87. package/lib/zudoku.components.js +21 -18
  88. package/lib/zudoku.components.js.map +1 -1
  89. package/lib/zudoku.hooks.js +3 -3
  90. package/lib/zudoku.mermaid.js +3 -3
  91. package/lib/zudoku.plugin-api-catalog.js +6 -5
  92. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  93. package/lib/zudoku.plugin-api-keys.js +23 -21
  94. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  95. package/lib/zudoku.plugin-custom-pages.js +1 -1
  96. package/lib/zudoku.plugin-markdown.js +1 -1
  97. package/lib/zudoku.plugin-openapi.js +2 -2
  98. package/lib/zudoku.plugin-search-pagefind.js +29 -28
  99. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  100. package/lib/zudoku.react-query.js +440 -0
  101. package/lib/zudoku.react-query.js.map +1 -0
  102. package/package.json +5 -1
  103. package/src/lib/components/Pagination.tsx +4 -5
  104. package/src/lib/components/index.ts +4 -0
  105. package/src/lib/components/navigation/NavigationItem.tsx +9 -3
  106. package/src/lib/core/react-query.ts +1 -0
  107. package/src/lib/oas/graphql/circular.test.ts +186 -0
  108. package/src/lib/oas/graphql/circular.ts +22 -16
  109. package/lib/ClaudeLogo-BpqHBMS8.js.map +0 -1
  110. package/lib/Input-B6YcAPv-.js.map +0 -1
  111. package/lib/ZudokuContext-Ea7gxmGq.js +0 -1581
  112. package/lib/ZudokuContext-Ea7gxmGq.js.map +0 -1
  113. package/lib/index-D5NeW2z6.js.map +0 -1
  114. package/lib/index.esm-B35e7P83.js.map +0 -1
@@ -0,0 +1,601 @@
1
+ import { t as U, b as g, f as _, g as z, i as B, S as T, n as c, m as C, j, Q as W, l as E, o as $, p as S, r as F, q as x, h as H, v as K, w as L, a as V } from "./useSuspenseQuery-CSB_rVek.js";
2
+ import { M as G } from "./mutation-BISOc7OM.js";
3
+ import * as b from "react";
4
+ function k(e) {
5
+ return e;
6
+ }
7
+ function J(e) {
8
+ return {
9
+ mutationKey: e.options.mutationKey,
10
+ state: e.state,
11
+ ...e.options.scope && { scope: e.options.scope },
12
+ ...e.meta && { meta: e.meta }
13
+ };
14
+ }
15
+ function X(e, t, s) {
16
+ const a = () => {
17
+ const r = e.promise?.then(t).catch((i) => s(i) ? (process.env.NODE_ENV !== "production" && console.error(
18
+ `A query that was dehydrated as pending ended up rejecting. [${e.queryHash}]: ${i}; The error will be redacted in production builds`
19
+ ), Promise.reject(new Error("redacted"))) : Promise.reject(i));
20
+ return r?.catch(g), r;
21
+ };
22
+ return {
23
+ dehydratedAt: Date.now(),
24
+ state: {
25
+ ...e.state,
26
+ ...e.state.data !== void 0 && {
27
+ data: t(e.state.data)
28
+ }
29
+ },
30
+ queryKey: e.queryKey,
31
+ queryHash: e.queryHash,
32
+ ...e.state.status === "pending" && {
33
+ promise: a()
34
+ },
35
+ ...e.meta && { meta: e.meta }
36
+ };
37
+ }
38
+ function Y(e) {
39
+ return e.state.isPaused;
40
+ }
41
+ function Z(e) {
42
+ return e.state.status === "success";
43
+ }
44
+ function ee(e) {
45
+ return !0;
46
+ }
47
+ function ie(e, t = {}) {
48
+ const s = t.shouldDehydrateMutation ?? e.getDefaultOptions().dehydrate?.shouldDehydrateMutation ?? Y, a = e.getMutationCache().getAll().flatMap(
49
+ (n) => s(n) ? [J(n)] : []
50
+ ), r = t.shouldDehydrateQuery ?? e.getDefaultOptions().dehydrate?.shouldDehydrateQuery ?? Z, i = t.shouldRedactErrors ?? e.getDefaultOptions().dehydrate?.shouldRedactErrors ?? ee, h = t.serializeData ?? e.getDefaultOptions().dehydrate?.serializeData ?? k, y = e.getQueryCache().getAll().flatMap(
51
+ (n) => r(n) ? [X(n, h, i)] : []
52
+ );
53
+ return { mutations: a, queries: y };
54
+ }
55
+ function I(e, t, s) {
56
+ if (typeof t != "object" || t === null)
57
+ return;
58
+ const a = e.getMutationCache(), r = e.getQueryCache(), i = s?.defaultOptions?.deserializeData ?? e.getDefaultOptions().hydrate?.deserializeData ?? k, h = t.mutations || [], y = t.queries || [];
59
+ h.forEach(({ state: n, ...u }) => {
60
+ a.build(
61
+ e,
62
+ {
63
+ ...e.getDefaultOptions().hydrate?.mutations,
64
+ ...s?.defaultOptions?.mutations,
65
+ ...u
66
+ },
67
+ n
68
+ );
69
+ }), y.forEach(
70
+ ({ queryKey: n, state: u, queryHash: m, meta: p, promise: d, dehydratedAt: Q }) => {
71
+ const o = d ? U(d) : void 0, l = u.data === void 0 ? o?.data : u.data, v = l === void 0 ? l : i(l);
72
+ let f = r.get(m);
73
+ const D = f?.state.status === "pending", w = f?.state.fetchStatus === "fetching";
74
+ if (f) {
75
+ const P = o && // We only need this undefined check to handle older dehydration
76
+ // payloads that might not have dehydratedAt
77
+ Q !== void 0 && Q > f.state.dataUpdatedAt;
78
+ if (u.dataUpdatedAt > f.state.dataUpdatedAt || P) {
79
+ const { fetchStatus: q, ...O } = u;
80
+ f.setState({
81
+ ...O,
82
+ data: v
83
+ });
84
+ }
85
+ } else
86
+ f = r.build(
87
+ e,
88
+ {
89
+ ...e.getDefaultOptions().hydrate?.queries,
90
+ ...s?.defaultOptions?.queries,
91
+ queryKey: n,
92
+ queryHash: m,
93
+ meta: p
94
+ },
95
+ // Reset fetch status to idle to avoid
96
+ // query being stuck in fetching state upon hydration
97
+ {
98
+ ...u,
99
+ data: v,
100
+ fetchStatus: "idle",
101
+ status: v !== void 0 ? "success" : u.status
102
+ }
103
+ );
104
+ d && !D && !w && // Only hydrate if dehydration is newer than any existing data,
105
+ // this is always true for new queries
106
+ (Q === void 0 || Q > f.state.dataUpdatedAt) && f.fetch(void 0, {
107
+ // RSC transformed promises are not thenable
108
+ initialPromise: Promise.resolve(d).then(i)
109
+ }).catch(g);
110
+ }
111
+ );
112
+ }
113
+ function R(e) {
114
+ return {
115
+ onFetch: (t, s) => {
116
+ const a = t.options, r = t.fetchOptions?.meta?.fetchMore?.direction, i = t.state.data?.pages || [], h = t.state.data?.pageParams || [];
117
+ let y = { pages: [], pageParams: [] }, n = 0;
118
+ const u = async () => {
119
+ let m = !1;
120
+ const p = (o) => {
121
+ Object.defineProperty(o, "signal", {
122
+ enumerable: !0,
123
+ get: () => (t.signal.aborted ? m = !0 : t.signal.addEventListener("abort", () => {
124
+ m = !0;
125
+ }), t.signal)
126
+ });
127
+ }, d = _(t.options, t.fetchOptions), Q = async (o, l, v) => {
128
+ if (m)
129
+ return Promise.reject();
130
+ if (l == null && o.pages.length)
131
+ return Promise.resolve(o);
132
+ const D = (() => {
133
+ const O = {
134
+ client: t.client,
135
+ queryKey: t.queryKey,
136
+ pageParam: l,
137
+ direction: v ? "backward" : "forward",
138
+ meta: t.options.meta
139
+ };
140
+ return p(O), O;
141
+ })(), w = await d(D), { maxPages: P } = t.options, q = v ? z : B;
142
+ return {
143
+ pages: q(o.pages, w, P),
144
+ pageParams: q(o.pageParams, l, P)
145
+ };
146
+ };
147
+ if (r && i.length) {
148
+ const o = r === "backward", l = o ? N : A, v = {
149
+ pages: i,
150
+ pageParams: h
151
+ }, f = l(a, v);
152
+ y = await Q(v, f, o);
153
+ } else {
154
+ const o = e ?? i.length;
155
+ do {
156
+ const l = n === 0 ? h[0] ?? a.initialPageParam : A(a, y);
157
+ if (n > 0 && l == null)
158
+ break;
159
+ y = await Q(y, l), n++;
160
+ } while (n < o);
161
+ }
162
+ return y;
163
+ };
164
+ t.options.persister ? t.fetchFn = () => t.options.persister?.(
165
+ u,
166
+ {
167
+ client: t.client,
168
+ queryKey: t.queryKey,
169
+ meta: t.options.meta,
170
+ signal: t.signal
171
+ },
172
+ s
173
+ ) : t.fetchFn = u;
174
+ }
175
+ };
176
+ }
177
+ function A(e, { pages: t, pageParams: s }) {
178
+ const a = t.length - 1;
179
+ return t.length > 0 ? e.getNextPageParam(
180
+ t[a],
181
+ t,
182
+ s[a],
183
+ s
184
+ ) : void 0;
185
+ }
186
+ function N(e, { pages: t, pageParams: s }) {
187
+ return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
188
+ }
189
+ function ne(e, t) {
190
+ return t ? A(e, t) != null : !1;
191
+ }
192
+ function ue(e, t) {
193
+ return !t || !e.getPreviousPageParam ? !1 : N(e, t) != null;
194
+ }
195
+ var te = class extends T {
196
+ constructor(e = {}) {
197
+ super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
198
+ }
199
+ #e;
200
+ #t;
201
+ #s;
202
+ build(e, t, s) {
203
+ const a = new G({
204
+ client: e,
205
+ mutationCache: this,
206
+ mutationId: ++this.#s,
207
+ options: e.defaultMutationOptions(t),
208
+ state: s
209
+ });
210
+ return this.add(a), a;
211
+ }
212
+ add(e) {
213
+ this.#e.add(e);
214
+ const t = M(e);
215
+ if (typeof t == "string") {
216
+ const s = this.#t.get(t);
217
+ s ? s.push(e) : this.#t.set(t, [e]);
218
+ }
219
+ this.notify({ type: "added", mutation: e });
220
+ }
221
+ remove(e) {
222
+ if (this.#e.delete(e)) {
223
+ const t = M(e);
224
+ if (typeof t == "string") {
225
+ const s = this.#t.get(t);
226
+ if (s)
227
+ if (s.length > 1) {
228
+ const a = s.indexOf(e);
229
+ a !== -1 && s.splice(a, 1);
230
+ } else s[0] === e && this.#t.delete(t);
231
+ }
232
+ }
233
+ this.notify({ type: "removed", mutation: e });
234
+ }
235
+ canRun(e) {
236
+ const t = M(e);
237
+ if (typeof t == "string") {
238
+ const a = this.#t.get(t)?.find(
239
+ (r) => r.state.status === "pending"
240
+ );
241
+ return !a || a === e;
242
+ } else
243
+ return !0;
244
+ }
245
+ runNext(e) {
246
+ const t = M(e);
247
+ return typeof t == "string" ? this.#t.get(t)?.find((a) => a !== e && a.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
248
+ }
249
+ clear() {
250
+ c.batch(() => {
251
+ this.#e.forEach((e) => {
252
+ this.notify({ type: "removed", mutation: e });
253
+ }), this.#e.clear(), this.#t.clear();
254
+ });
255
+ }
256
+ getAll() {
257
+ return Array.from(this.#e);
258
+ }
259
+ find(e) {
260
+ const t = { exact: !0, ...e };
261
+ return this.getAll().find(
262
+ (s) => C(t, s)
263
+ );
264
+ }
265
+ findAll(e = {}) {
266
+ return this.getAll().filter((t) => C(e, t));
267
+ }
268
+ notify(e) {
269
+ c.batch(() => {
270
+ this.listeners.forEach((t) => {
271
+ t(e);
272
+ });
273
+ });
274
+ }
275
+ resumePausedMutations() {
276
+ const e = this.getAll().filter((t) => t.state.isPaused);
277
+ return c.batch(
278
+ () => Promise.all(
279
+ e.map((t) => t.continue().catch(g))
280
+ )
281
+ );
282
+ }
283
+ };
284
+ function M(e) {
285
+ return e.options.scope?.id;
286
+ }
287
+ var se = class extends T {
288
+ constructor(e = {}) {
289
+ super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
290
+ }
291
+ #e;
292
+ build(e, t, s) {
293
+ const a = t.queryKey, r = t.queryHash ?? j(a, t);
294
+ let i = this.get(r);
295
+ return i || (i = new W({
296
+ client: e,
297
+ queryKey: a,
298
+ queryHash: r,
299
+ options: e.defaultQueryOptions(t),
300
+ state: s,
301
+ defaultOptions: e.getQueryDefaults(a)
302
+ }), this.add(i)), i;
303
+ }
304
+ add(e) {
305
+ this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
306
+ type: "added",
307
+ query: e
308
+ }));
309
+ }
310
+ remove(e) {
311
+ const t = this.#e.get(e.queryHash);
312
+ t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({ type: "removed", query: e }));
313
+ }
314
+ clear() {
315
+ c.batch(() => {
316
+ this.getAll().forEach((e) => {
317
+ this.remove(e);
318
+ });
319
+ });
320
+ }
321
+ get(e) {
322
+ return this.#e.get(e);
323
+ }
324
+ getAll() {
325
+ return [...this.#e.values()];
326
+ }
327
+ find(e) {
328
+ const t = { exact: !0, ...e };
329
+ return this.getAll().find(
330
+ (s) => E(t, s)
331
+ );
332
+ }
333
+ findAll(e = {}) {
334
+ const t = this.getAll();
335
+ return Object.keys(e).length > 0 ? t.filter((s) => E(e, s)) : t;
336
+ }
337
+ notify(e) {
338
+ c.batch(() => {
339
+ this.listeners.forEach((t) => {
340
+ t(e);
341
+ });
342
+ });
343
+ }
344
+ onFocus() {
345
+ c.batch(() => {
346
+ this.getAll().forEach((e) => {
347
+ e.onFocus();
348
+ });
349
+ });
350
+ }
351
+ onOnline() {
352
+ c.batch(() => {
353
+ this.getAll().forEach((e) => {
354
+ e.onOnline();
355
+ });
356
+ });
357
+ }
358
+ }, oe = class {
359
+ #e;
360
+ #t;
361
+ #s;
362
+ #r;
363
+ #i;
364
+ #a;
365
+ #n;
366
+ #u;
367
+ constructor(e = {}) {
368
+ this.#e = e.queryCache || new se(), this.#t = e.mutationCache || new te(), this.#s = e.defaultOptions || {}, this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Map(), this.#a = 0;
369
+ }
370
+ mount() {
371
+ this.#a++, this.#a === 1 && (this.#n = $.subscribe(async (e) => {
372
+ e && (await this.resumePausedMutations(), this.#e.onFocus());
373
+ }), this.#u = S.subscribe(async (e) => {
374
+ e && (await this.resumePausedMutations(), this.#e.onOnline());
375
+ }));
376
+ }
377
+ unmount() {
378
+ this.#a--, this.#a === 0 && (this.#n?.(), this.#n = void 0, this.#u?.(), this.#u = void 0);
379
+ }
380
+ isFetching(e) {
381
+ return this.#e.findAll({ ...e, fetchStatus: "fetching" }).length;
382
+ }
383
+ isMutating(e) {
384
+ return this.#t.findAll({ ...e, status: "pending" }).length;
385
+ }
386
+ /**
387
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
388
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
389
+ *
390
+ * Hint: Do not use this function inside a component, because it won't receive updates.
391
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
392
+ */
393
+ getQueryData(e) {
394
+ const t = this.defaultQueryOptions({ queryKey: e });
395
+ return this.#e.get(t.queryHash)?.state.data;
396
+ }
397
+ ensureQueryData(e) {
398
+ const t = this.defaultQueryOptions(e), s = this.#e.build(this, t), a = s.state.data;
399
+ return a === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(F(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(a));
400
+ }
401
+ getQueriesData(e) {
402
+ return this.#e.findAll(e).map(({ queryKey: t, state: s }) => {
403
+ const a = s.data;
404
+ return [t, a];
405
+ });
406
+ }
407
+ setQueryData(e, t, s) {
408
+ const a = this.defaultQueryOptions({ queryKey: e }), i = this.#e.get(
409
+ a.queryHash
410
+ )?.state.data, h = x(t, i);
411
+ if (h !== void 0)
412
+ return this.#e.build(this, a).setData(h, { ...s, manual: !0 });
413
+ }
414
+ setQueriesData(e, t, s) {
415
+ return c.batch(
416
+ () => this.#e.findAll(e).map(({ queryKey: a }) => [
417
+ a,
418
+ this.setQueryData(a, t, s)
419
+ ])
420
+ );
421
+ }
422
+ getQueryState(e) {
423
+ const t = this.defaultQueryOptions({ queryKey: e });
424
+ return this.#e.get(
425
+ t.queryHash
426
+ )?.state;
427
+ }
428
+ removeQueries(e) {
429
+ const t = this.#e;
430
+ c.batch(() => {
431
+ t.findAll(e).forEach((s) => {
432
+ t.remove(s);
433
+ });
434
+ });
435
+ }
436
+ resetQueries(e, t) {
437
+ const s = this.#e;
438
+ return c.batch(() => (s.findAll(e).forEach((a) => {
439
+ a.reset();
440
+ }), this.refetchQueries(
441
+ {
442
+ type: "active",
443
+ ...e
444
+ },
445
+ t
446
+ )));
447
+ }
448
+ cancelQueries(e, t = {}) {
449
+ const s = { revert: !0, ...t }, a = c.batch(
450
+ () => this.#e.findAll(e).map((r) => r.cancel(s))
451
+ );
452
+ return Promise.all(a).then(g).catch(g);
453
+ }
454
+ invalidateQueries(e, t = {}) {
455
+ return c.batch(() => (this.#e.findAll(e).forEach((s) => {
456
+ s.invalidate();
457
+ }), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
458
+ {
459
+ ...e,
460
+ type: e?.refetchType ?? e?.type ?? "active"
461
+ },
462
+ t
463
+ )));
464
+ }
465
+ refetchQueries(e, t = {}) {
466
+ const s = {
467
+ ...t,
468
+ cancelRefetch: t.cancelRefetch ?? !0
469
+ }, a = c.batch(
470
+ () => this.#e.findAll(e).filter((r) => !r.isDisabled() && !r.isStatic()).map((r) => {
471
+ let i = r.fetch(void 0, s);
472
+ return s.throwOnError || (i = i.catch(g)), r.state.fetchStatus === "paused" ? Promise.resolve() : i;
473
+ })
474
+ );
475
+ return Promise.all(a).then(g);
476
+ }
477
+ fetchQuery(e) {
478
+ const t = this.defaultQueryOptions(e);
479
+ t.retry === void 0 && (t.retry = !1);
480
+ const s = this.#e.build(this, t);
481
+ return s.isStaleByTime(
482
+ F(t.staleTime, s)
483
+ ) ? s.fetch(t) : Promise.resolve(s.state.data);
484
+ }
485
+ prefetchQuery(e) {
486
+ return this.fetchQuery(e).then(g).catch(g);
487
+ }
488
+ fetchInfiniteQuery(e) {
489
+ return e.behavior = R(e.pages), this.fetchQuery(e);
490
+ }
491
+ prefetchInfiniteQuery(e) {
492
+ return this.fetchInfiniteQuery(e).then(g).catch(g);
493
+ }
494
+ ensureInfiniteQueryData(e) {
495
+ return e.behavior = R(e.pages), this.ensureQueryData(e);
496
+ }
497
+ resumePausedMutations() {
498
+ return S.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
499
+ }
500
+ getQueryCache() {
501
+ return this.#e;
502
+ }
503
+ getMutationCache() {
504
+ return this.#t;
505
+ }
506
+ getDefaultOptions() {
507
+ return this.#s;
508
+ }
509
+ setDefaultOptions(e) {
510
+ this.#s = e;
511
+ }
512
+ setQueryDefaults(e, t) {
513
+ this.#r.set(H(e), {
514
+ queryKey: e,
515
+ defaultOptions: t
516
+ });
517
+ }
518
+ getQueryDefaults(e) {
519
+ const t = [...this.#r.values()], s = {};
520
+ return t.forEach((a) => {
521
+ K(e, a.queryKey) && Object.assign(s, a.defaultOptions);
522
+ }), s;
523
+ }
524
+ setMutationDefaults(e, t) {
525
+ this.#i.set(H(e), {
526
+ mutationKey: e,
527
+ defaultOptions: t
528
+ });
529
+ }
530
+ getMutationDefaults(e) {
531
+ const t = [...this.#i.values()], s = {};
532
+ return t.forEach((a) => {
533
+ K(e, a.mutationKey) && Object.assign(s, a.defaultOptions);
534
+ }), s;
535
+ }
536
+ defaultQueryOptions(e) {
537
+ if (e._defaulted)
538
+ return e;
539
+ const t = {
540
+ ...this.#s.queries,
541
+ ...this.getQueryDefaults(e.queryKey),
542
+ ...e,
543
+ _defaulted: !0
544
+ };
545
+ return t.queryHash || (t.queryHash = j(
546
+ t.queryKey,
547
+ t
548
+ )), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === L && (t.enabled = !1), t;
549
+ }
550
+ defaultMutationOptions(e) {
551
+ return e?._defaulted ? e : {
552
+ ...this.#s.mutations,
553
+ ...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
554
+ ...e,
555
+ _defaulted: !0
556
+ };
557
+ }
558
+ clear() {
559
+ this.#e.clear(), this.#t.clear();
560
+ }
561
+ }, he = ({
562
+ children: e,
563
+ options: t = {},
564
+ state: s,
565
+ queryClient: a
566
+ }) => {
567
+ const r = V(a), i = b.useRef(t);
568
+ b.useEffect(() => {
569
+ i.current = t;
570
+ });
571
+ const h = b.useMemo(() => {
572
+ if (s) {
573
+ if (typeof s != "object")
574
+ return;
575
+ const y = r.getQueryCache(), n = s.queries || [], u = [], m = [];
576
+ for (const p of n) {
577
+ const d = y.get(p.queryHash);
578
+ d ? (p.state.dataUpdatedAt > d.state.dataUpdatedAt || p.promise && d.state.status !== "pending" && d.state.fetchStatus !== "fetching" && p.dehydratedAt !== void 0 && p.dehydratedAt > d.state.dataUpdatedAt) && m.push(p) : u.push(p);
579
+ }
580
+ if (u.length > 0 && I(r, { queries: u }, i.current), m.length > 0)
581
+ return m;
582
+ }
583
+ }, [r, s]);
584
+ return b.useEffect(() => {
585
+ h && I(r, { queries: h }, i.current);
586
+ }, [r, h]), e;
587
+ };
588
+ export {
589
+ he as H,
590
+ te as M,
591
+ se as Q,
592
+ ne as a,
593
+ oe as b,
594
+ Z as c,
595
+ Y as d,
596
+ ie as e,
597
+ I as f,
598
+ ue as h,
599
+ R as i
600
+ };
601
+ //# sourceMappingURL=HydrationBoundary-CNF2ZV3E.js.map