zudoku 0.33.1 → 0.33.2-local.4

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 (169) hide show
  1. package/dist/config/validators/common.d.ts +226 -8
  2. package/dist/config/validators/common.js +26 -8
  3. package/dist/config/validators/common.js.map +1 -1
  4. package/dist/config/validators/validate.d.ts +89 -2
  5. package/dist/lib/authentication/hook.d.ts +1 -0
  6. package/dist/lib/authentication/hook.js +11 -1
  7. package/dist/lib/authentication/hook.js.map +1 -1
  8. package/dist/lib/authentication/providers/clerk.js +6 -6
  9. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  10. package/dist/lib/components/Banner.js +1 -1
  11. package/dist/lib/components/Banner.js.map +1 -1
  12. package/dist/lib/components/Heading.d.ts +1 -1
  13. package/dist/lib/components/Layout.js +1 -1
  14. package/dist/lib/components/Layout.js.map +1 -1
  15. package/dist/lib/components/index.d.ts +1 -0
  16. package/dist/lib/core/RouteGuard.js +2 -1
  17. package/dist/lib/core/RouteGuard.js.map +1 -1
  18. package/dist/lib/plugins/api-catalog/Catalog.d.ts +3 -1
  19. package/dist/lib/plugins/api-catalog/Catalog.js +7 -4
  20. package/dist/lib/plugins/api-catalog/Catalog.js.map +1 -1
  21. package/dist/lib/plugins/api-catalog/index.js +1 -1
  22. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  23. package/dist/lib/plugins/markdown/MdxPage.js +1 -1
  24. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  25. package/dist/lib/plugins/openapi/OperationList.d.ts +1 -1
  26. package/dist/lib/plugins/openapi/OperationList.js +2 -1
  27. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  28. package/dist/lib/plugins/openapi/OperationListItem.js +2 -1
  29. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  30. package/dist/lib/plugins/openapi/ParameterList.d.ts +2 -1
  31. package/dist/lib/plugins/openapi/ParameterList.js +3 -2
  32. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
  33. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +3 -1
  34. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
  35. package/dist/lib/plugins/openapi/Sidecar.js +1 -1
  36. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  37. package/dist/lib/plugins/openapi/playground/PathParams.d.ts +3 -2
  38. package/dist/lib/plugins/openapi/playground/PathParams.js +3 -2
  39. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  40. package/dist/lib/plugins/openapi/playground/Playground.d.ts +4 -1
  41. package/dist/lib/plugins/openapi/playground/Playground.js +10 -7
  42. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  43. package/dist/lib/plugins/search-pagefind/PagefindSearch.d.ts +6 -0
  44. package/dist/lib/plugins/search-pagefind/PagefindSearch.js +66 -0
  45. package/dist/lib/plugins/search-pagefind/PagefindSearch.js.map +1 -0
  46. package/dist/lib/plugins/search-pagefind/ResultList.d.ts +8 -0
  47. package/dist/lib/plugins/search-pagefind/ResultList.js +31 -0
  48. package/dist/lib/plugins/search-pagefind/ResultList.js.map +1 -0
  49. package/dist/lib/plugins/search-pagefind/get-results.d.ts +3 -0
  50. package/dist/lib/plugins/search-pagefind/get-results.js +37 -0
  51. package/dist/lib/plugins/search-pagefind/get-results.js.map +1 -0
  52. package/dist/lib/plugins/search-pagefind/index.d.ts +8 -0
  53. package/dist/lib/plugins/search-pagefind/index.js +9 -0
  54. package/dist/lib/plugins/search-pagefind/index.js.map +1 -0
  55. package/dist/lib/plugins/search-pagefind/types.d.ts +85 -0
  56. package/dist/lib/plugins/search-pagefind/types.js +2 -0
  57. package/dist/lib/plugins/search-pagefind/types.js.map +1 -0
  58. package/dist/lib/ui/Command.d.ts +7 -1
  59. package/dist/lib/ui/Command.js +2 -2
  60. package/dist/lib/ui/Command.js.map +1 -1
  61. package/dist/lib/util/useScrollToAnchor.js +6 -8
  62. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  63. package/dist/vite/build.js +4 -0
  64. package/dist/vite/build.js.map +1 -1
  65. package/dist/vite/config.js +7 -2
  66. package/dist/vite/config.js.map +1 -1
  67. package/dist/vite/dev-server.js +8 -0
  68. package/dist/vite/dev-server.js.map +1 -1
  69. package/dist/vite/pagefind.d.ts +4 -0
  70. package/dist/vite/pagefind.js +15 -0
  71. package/dist/vite/pagefind.js.map +1 -0
  72. package/dist/vite/plugin-component.js +4 -0
  73. package/dist/vite/plugin-component.js.map +1 -1
  74. package/dist/vite/plugin-search.js +4 -0
  75. package/dist/vite/plugin-search.js.map +1 -1
  76. package/dist/vite/prerender/prerender.js +1 -1
  77. package/dist/vite/prerender/prerender.js.map +1 -1
  78. package/dist/vite/sitemap.js +2 -1
  79. package/dist/vite/sitemap.js.map +1 -1
  80. package/lib/{AuthenticationPlugin-CiO1FM6Q.js → AuthenticationPlugin-BCYuduZ9.js} +3 -3
  81. package/lib/{AuthenticationPlugin-CiO1FM6Q.js.map → AuthenticationPlugin-BCYuduZ9.js.map} +1 -1
  82. package/lib/Command-CrTA1FX0.js +140 -0
  83. package/lib/Command-CrTA1FX0.js.map +1 -0
  84. package/lib/{Dialog-DIKGQxQc.js → Dialog-mi6BrnrM.js} +3 -3
  85. package/lib/{Dialog-DIKGQxQc.js.map → Dialog-mi6BrnrM.js.map} +1 -1
  86. package/lib/{Markdown-DePfm7oQ.js → Markdown-DofXBcqg.js} +2 -2
  87. package/lib/{Markdown-DePfm7oQ.js.map → Markdown-DofXBcqg.js.map} +1 -1
  88. package/lib/MdxPage-KJcNWIgt.js +200 -0
  89. package/lib/MdxPage-KJcNWIgt.js.map +1 -0
  90. package/lib/{OasProvider-SzD9mHJc.js → OasProvider-HcqBeC4H.js} +4 -4
  91. package/lib/{OasProvider-SzD9mHJc.js.map → OasProvider-HcqBeC4H.js.map} +1 -1
  92. package/lib/{OperationList-DDs9NblY.js → OperationList-C3wnbFxp.js} +1857 -1816
  93. package/lib/OperationList-C3wnbFxp.js.map +1 -0
  94. package/lib/{Select-Dqtcn53H.js → Select-Co6MuS4j.js} +36 -36
  95. package/lib/{Select-Dqtcn53H.js.map → Select-Co6MuS4j.js.map} +1 -1
  96. package/lib/{SlotletProvider-DdtIOUi6.js → SlotletProvider-CYFNHuok.js} +4 -4
  97. package/lib/{SlotletProvider-DdtIOUi6.js.map → SlotletProvider-CYFNHuok.js.map} +1 -1
  98. package/lib/{chunk-IR6S3I6Y-D_3UmFIn.js → chunk-IR6S3I6Y-CRDBmIgK.js} +3 -3
  99. package/lib/{chunk-IR6S3I6Y-D_3UmFIn.js.map → chunk-IR6S3I6Y-CRDBmIgK.js.map} +1 -1
  100. package/lib/hook-LTe5qHSc.js +347 -0
  101. package/lib/hook-LTe5qHSc.js.map +1 -0
  102. package/lib/{index-CibzSNks.js → index-CtkRMvMw.js} +698 -746
  103. package/lib/index-CtkRMvMw.js.map +1 -0
  104. package/lib/index-vn5bsvmU.js +1399 -0
  105. package/lib/index-vn5bsvmU.js.map +1 -0
  106. package/lib/{mutation-EclmI0is.js → mutation-B81DztCT.js} +2 -2
  107. package/lib/{mutation-EclmI0is.js.map → mutation-B81DztCT.js.map} +1 -1
  108. package/lib/ui/Command.js +96 -70
  109. package/lib/ui/Command.js.map +1 -1
  110. package/lib/{useExposedProps-RIvey2Oy.js → useExposedProps-D76yras4.js} +2 -2
  111. package/lib/{useExposedProps-RIvey2Oy.js.map → useExposedProps-D76yras4.js.map} +1 -1
  112. package/lib/useQuery-CQUwWR9i.js +1137 -0
  113. package/lib/useQuery-CQUwWR9i.js.map +1 -0
  114. package/lib/useScrollToAnchor-DKyrbZoy.js +977 -0
  115. package/lib/useScrollToAnchor-DKyrbZoy.js.map +1 -0
  116. package/lib/zudoku.auth-auth0.js +1 -1
  117. package/lib/zudoku.auth-clerk.js +29 -29
  118. package/lib/zudoku.auth-clerk.js.map +1 -1
  119. package/lib/zudoku.auth-openid.js +3 -3
  120. package/lib/zudoku.components.js +32 -1393
  121. package/lib/zudoku.components.js.map +1 -1
  122. package/lib/zudoku.hooks.js +1 -1
  123. package/lib/zudoku.plugin-api-catalog.js +87 -71
  124. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  125. package/lib/zudoku.plugin-api-keys.js +16 -15
  126. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  127. package/lib/zudoku.plugin-custom-pages.js +2 -2
  128. package/lib/zudoku.plugin-markdown.js +1 -1
  129. package/lib/zudoku.plugin-openapi.js +3 -3
  130. package/lib/zudoku.plugin-redirect.js +1 -1
  131. package/lib/zudoku.plugin-search-pagefind.js +274 -0
  132. package/lib/zudoku.plugin-search-pagefind.js.map +1 -0
  133. package/package.json +8 -3
  134. package/src/lib/authentication/hook.ts +12 -1
  135. package/src/lib/authentication/providers/clerk.tsx +10 -6
  136. package/src/lib/components/Banner.tsx +1 -0
  137. package/src/lib/components/Heading.tsx +1 -1
  138. package/src/lib/components/Layout.tsx +1 -0
  139. package/src/lib/core/RouteGuard.tsx +2 -1
  140. package/src/lib/plugins/api-catalog/Catalog.tsx +23 -7
  141. package/src/lib/plugins/api-catalog/index.tsx +1 -0
  142. package/src/lib/plugins/markdown/MdxPage.tsx +5 -1
  143. package/src/lib/plugins/openapi/OperationList.tsx +15 -3
  144. package/src/lib/plugins/openapi/OperationListItem.tsx +8 -0
  145. package/src/lib/plugins/openapi/ParameterList.tsx +4 -0
  146. package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +7 -0
  147. package/src/lib/plugins/openapi/Sidecar.tsx +1 -0
  148. package/src/lib/plugins/openapi/playground/PathParams.tsx +8 -2
  149. package/src/lib/plugins/openapi/playground/Playground.tsx +61 -5
  150. package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +135 -0
  151. package/src/lib/plugins/search-pagefind/ResultList.tsx +104 -0
  152. package/src/lib/plugins/search-pagefind/get-results.tsx +54 -0
  153. package/src/lib/plugins/search-pagefind/index.tsx +21 -0
  154. package/src/lib/plugins/search-pagefind/types.ts +118 -0
  155. package/src/lib/ui/Command.tsx +25 -3
  156. package/src/lib/util/useScrollToAnchor.ts +8 -8
  157. package/README.md +0 -121
  158. package/lib/MdxPage-DZTt9ld7.js +0 -193
  159. package/lib/MdxPage-DZTt9ld7.js.map +0 -1
  160. package/lib/OperationList-DDs9NblY.js.map +0 -1
  161. package/lib/hook-CN__aZIt.js +0 -1464
  162. package/lib/hook-CN__aZIt.js.map +0 -1
  163. package/lib/index-CibzSNks.js.map +0 -1
  164. package/lib/index.esm-CQHE3GEU.js +0 -691
  165. package/lib/index.esm-CQHE3GEU.js.map +0 -1
  166. package/lib/objectEntries-yMIkr2mI.js +0 -5
  167. package/lib/objectEntries-yMIkr2mI.js.map +0 -1
  168. package/lib/useScrollToAnchor-C7ilRSts.js +0 -290
  169. package/lib/useScrollToAnchor-C7ilRSts.js.map +0 -1
@@ -0,0 +1,1137 @@
1
+ var Le = (t) => {
2
+ throw TypeError(t);
3
+ };
4
+ var pe = (t, e, s) => e.has(t) || Le("Cannot " + s);
5
+ var r = (t, e, s) => (pe(t, e, "read from private field"), s ? s.call(t) : e.get(t)), d = (t, e, s) => e.has(t) ? Le("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), h = (t, e, s, i) => (pe(t, e, "write to private field"), i ? i.call(t, s) : e.set(t, s), s), b = (t, e, s) => (pe(t, e, "access private method"), s);
6
+ import * as P from "react";
7
+ import { j as at } from "./jsx-runtime-CYK1ROHF.js";
8
+ var Qe = class {
9
+ constructor() {
10
+ this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
11
+ }
12
+ subscribe(t) {
13
+ return this.listeners.add(t), this.onSubscribe(), () => {
14
+ this.listeners.delete(t), this.onUnsubscribe();
15
+ };
16
+ }
17
+ hasListeners() {
18
+ return this.listeners.size > 0;
19
+ }
20
+ onSubscribe() {
21
+ }
22
+ onUnsubscribe() {
23
+ }
24
+ }, $ = typeof window > "u" || "Deno" in globalThis;
25
+ function be() {
26
+ }
27
+ function At(t, e) {
28
+ return typeof t == "function" ? t(e) : t;
29
+ }
30
+ function me(t) {
31
+ return typeof t == "number" && t >= 0 && t !== 1 / 0;
32
+ }
33
+ function Xe(t, e) {
34
+ return Math.max(t + (e || 0) - Date.now(), 0);
35
+ }
36
+ function de(t, e) {
37
+ return typeof t == "function" ? t(e) : t;
38
+ }
39
+ function j(t, e) {
40
+ return typeof t == "function" ? t(e) : t;
41
+ }
42
+ function qt(t, e) {
43
+ const {
44
+ type: s = "all",
45
+ exact: i,
46
+ fetchStatus: n,
47
+ predicate: u,
48
+ queryKey: a,
49
+ stale: c
50
+ } = t;
51
+ if (a) {
52
+ if (i) {
53
+ if (e.queryHash !== ot(a, e.options))
54
+ return !1;
55
+ } else if (!Ae(e.queryKey, a))
56
+ return !1;
57
+ }
58
+ if (s !== "all") {
59
+ const l = e.isActive();
60
+ if (s === "active" && !l || s === "inactive" && l)
61
+ return !1;
62
+ }
63
+ return !(typeof c == "boolean" && e.isStale() !== c || n && n !== e.state.fetchStatus || u && !u(e));
64
+ }
65
+ function Mt(t, e) {
66
+ const { exact: s, status: i, predicate: n, mutationKey: u } = t;
67
+ if (u) {
68
+ if (!e.options.mutationKey)
69
+ return !1;
70
+ if (s) {
71
+ if (ge(e.options.mutationKey) !== ge(u))
72
+ return !1;
73
+ } else if (!Ae(e.options.mutationKey, u))
74
+ return !1;
75
+ }
76
+ return !(i && e.state.status !== i || n && !n(e));
77
+ }
78
+ function ot(t, e) {
79
+ return ((e == null ? void 0 : e.queryKeyHashFn) || ge)(t);
80
+ }
81
+ function ge(t) {
82
+ return JSON.stringify(
83
+ t,
84
+ (e, s) => Ce(s) ? Object.keys(s).sort().reduce((i, n) => (i[n] = s[n], i), {}) : s
85
+ );
86
+ }
87
+ function Ae(t, e) {
88
+ return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? !Object.keys(e).some((s) => !Ae(t[s], e[s])) : !1;
89
+ }
90
+ function Re(t, e) {
91
+ if (t === e)
92
+ return t;
93
+ const s = Ne(t) && Ne(e);
94
+ if (s || Ce(t) && Ce(e)) {
95
+ const i = s ? t : Object.keys(t), n = i.length, u = s ? e : Object.keys(e), a = u.length, c = s ? [] : {};
96
+ let l = 0;
97
+ for (let R = 0; R < a; R++) {
98
+ const m = s ? R : u[R];
99
+ (!s && i.includes(m) || s) && t[m] === void 0 && e[m] === void 0 ? (c[m] = void 0, l++) : (c[m] = Re(t[m], e[m]), c[m] === t[m] && t[m] !== void 0 && l++);
100
+ }
101
+ return n === a && l === n ? t : c;
102
+ }
103
+ return e;
104
+ }
105
+ function Se(t, e) {
106
+ if (!e || Object.keys(t).length !== Object.keys(e).length)
107
+ return !1;
108
+ for (const s in t)
109
+ if (t[s] !== e[s])
110
+ return !1;
111
+ return !0;
112
+ }
113
+ function Ne(t) {
114
+ return Array.isArray(t) && t.length === Object.keys(t).length;
115
+ }
116
+ function Ce(t) {
117
+ if (!_e(t))
118
+ return !1;
119
+ const e = t.constructor;
120
+ if (e === void 0)
121
+ return !0;
122
+ const s = e.prototype;
123
+ return !(!_e(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
124
+ }
125
+ function _e(t) {
126
+ return Object.prototype.toString.call(t) === "[object Object]";
127
+ }
128
+ function ut(t) {
129
+ return new Promise((e) => {
130
+ setTimeout(e, t);
131
+ });
132
+ }
133
+ function we(t, e, s) {
134
+ if (typeof s.structuralSharing == "function")
135
+ return s.structuralSharing(t, e);
136
+ if (s.structuralSharing !== !1) {
137
+ if (process.env.NODE_ENV !== "production")
138
+ try {
139
+ return Re(t, e);
140
+ } catch (i) {
141
+ console.error(
142
+ `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${i}`
143
+ );
144
+ }
145
+ return Re(t, e);
146
+ }
147
+ return e;
148
+ }
149
+ function kt(t) {
150
+ return t;
151
+ }
152
+ function Lt(t, e, s = 0) {
153
+ const i = [...t, e];
154
+ return s && i.length > s ? i.slice(1) : i;
155
+ }
156
+ function Nt(t, e, s = 0) {
157
+ const i = [e, ...t];
158
+ return s && i.length > s ? i.slice(0, -1) : i;
159
+ }
160
+ var Ee = Symbol();
161
+ function ht(t, e) {
162
+ return process.env.NODE_ENV !== "production" && t.queryFn === Ee && console.error(
163
+ `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
164
+ ), !t.queryFn && (e != null && e.initialPromise) ? () => e.initialPromise : !t.queryFn || t.queryFn === Ee ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
165
+ }
166
+ var _, q, X, ze, ct = (ze = class extends Qe {
167
+ constructor() {
168
+ super();
169
+ d(this, _);
170
+ d(this, q);
171
+ d(this, X);
172
+ h(this, X, (e) => {
173
+ if (!$ && window.addEventListener) {
174
+ const s = () => e();
175
+ return window.addEventListener("visibilitychange", s, !1), () => {
176
+ window.removeEventListener("visibilitychange", s);
177
+ };
178
+ }
179
+ });
180
+ }
181
+ onSubscribe() {
182
+ r(this, q) || this.setEventListener(r(this, X));
183
+ }
184
+ onUnsubscribe() {
185
+ var e;
186
+ this.hasListeners() || ((e = r(this, q)) == null || e.call(this), h(this, q, void 0));
187
+ }
188
+ setEventListener(e) {
189
+ var s;
190
+ h(this, X, e), (s = r(this, q)) == null || s.call(this), h(this, q, e((i) => {
191
+ typeof i == "boolean" ? this.setFocused(i) : this.onFocus();
192
+ }));
193
+ }
194
+ setFocused(e) {
195
+ r(this, _) !== e && (h(this, _, e), this.onFocus());
196
+ }
197
+ onFocus() {
198
+ const e = this.isFocused();
199
+ this.listeners.forEach((s) => {
200
+ s(e);
201
+ });
202
+ }
203
+ isFocused() {
204
+ var e;
205
+ return typeof r(this, _) == "boolean" ? r(this, _) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
206
+ }
207
+ }, _ = new WeakMap(), q = new WeakMap(), X = new WeakMap(), ze), Ye = new ct(), Y, M, Z, Ve, lt = (Ve = class extends Qe {
208
+ constructor() {
209
+ super();
210
+ d(this, Y, !0);
211
+ d(this, M);
212
+ d(this, Z);
213
+ h(this, Z, (e) => {
214
+ if (!$ && window.addEventListener) {
215
+ const s = () => e(!0), i = () => e(!1);
216
+ return window.addEventListener("online", s, !1), window.addEventListener("offline", i, !1), () => {
217
+ window.removeEventListener("online", s), window.removeEventListener("offline", i);
218
+ };
219
+ }
220
+ });
221
+ }
222
+ onSubscribe() {
223
+ r(this, M) || this.setEventListener(r(this, Z));
224
+ }
225
+ onUnsubscribe() {
226
+ var e;
227
+ this.hasListeners() || ((e = r(this, M)) == null || e.call(this), h(this, M, void 0));
228
+ }
229
+ setEventListener(e) {
230
+ var s;
231
+ h(this, Z, e), (s = r(this, M)) == null || s.call(this), h(this, M, e(this.setOnline.bind(this)));
232
+ }
233
+ setOnline(e) {
234
+ r(this, Y) !== e && (h(this, Y, e), this.listeners.forEach((i) => {
235
+ i(e);
236
+ }));
237
+ }
238
+ isOnline() {
239
+ return r(this, Y);
240
+ }
241
+ }, Y = new WeakMap(), M = new WeakMap(), Z = new WeakMap(), Ve), Ze = new lt();
242
+ function Fe() {
243
+ let t, e;
244
+ const s = new Promise((n, u) => {
245
+ t = n, e = u;
246
+ });
247
+ s.status = "pending", s.catch(() => {
248
+ });
249
+ function i(n) {
250
+ Object.assign(s, n), delete s.resolve, delete s.reject;
251
+ }
252
+ return s.resolve = (n) => {
253
+ i({
254
+ status: "fulfilled",
255
+ value: n
256
+ }), t(n);
257
+ }, s.reject = (n) => {
258
+ i({
259
+ status: "rejected",
260
+ reason: n
261
+ }), e(n);
262
+ }, s;
263
+ }
264
+ function ft(t) {
265
+ return Math.min(1e3 * 2 ** t, 3e4);
266
+ }
267
+ function et(t) {
268
+ return (t ?? "online") === "online" ? Ze.isOnline() : !0;
269
+ }
270
+ var tt = class extends Error {
271
+ constructor(t) {
272
+ super("CancelledError"), this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent;
273
+ }
274
+ };
275
+ function ve(t) {
276
+ return t instanceof tt;
277
+ }
278
+ function dt(t) {
279
+ let e = !1, s = 0, i = !1, n;
280
+ const u = Fe(), a = (v) => {
281
+ var p;
282
+ i || (S(new tt(v)), (p = t.abort) == null || p.call(t));
283
+ }, c = () => {
284
+ e = !0;
285
+ }, l = () => {
286
+ e = !1;
287
+ }, R = () => Ye.isFocused() && (t.networkMode === "always" || Ze.isOnline()) && t.canRun(), m = () => et(t.networkMode) && t.canRun(), o = (v) => {
288
+ var p;
289
+ i || (i = !0, (p = t.onSuccess) == null || p.call(t, v), n == null || n(), u.resolve(v));
290
+ }, S = (v) => {
291
+ var p;
292
+ i || (i = !0, (p = t.onError) == null || p.call(t, v), n == null || n(), u.reject(v));
293
+ }, g = () => new Promise((v) => {
294
+ var p;
295
+ n = (E) => {
296
+ (i || R()) && v(E);
297
+ }, (p = t.onPause) == null || p.call(t);
298
+ }).then(() => {
299
+ var v;
300
+ n = void 0, i || (v = t.onContinue) == null || v.call(t);
301
+ }), w = () => {
302
+ if (i)
303
+ return;
304
+ let v;
305
+ const p = s === 0 ? t.initialPromise : void 0;
306
+ try {
307
+ v = p ?? t.fn();
308
+ } catch (E) {
309
+ v = Promise.reject(E);
310
+ }
311
+ Promise.resolve(v).then(o).catch((E) => {
312
+ var ye;
313
+ if (i)
314
+ return;
315
+ const Q = t.retry ?? ($ ? 0 : 3), N = t.retryDelay ?? ft, ce = typeof N == "function" ? N(s, E) : N, le = Q === !0 || typeof Q == "number" && s < Q || typeof Q == "function" && Q(s, E);
316
+ if (e || !le) {
317
+ S(E);
318
+ return;
319
+ }
320
+ s++, (ye = t.onFail) == null || ye.call(t, s, E), ut(ce).then(() => R() ? void 0 : g()).then(() => {
321
+ e ? S(E) : w();
322
+ });
323
+ });
324
+ };
325
+ return {
326
+ promise: u,
327
+ cancel: a,
328
+ continue: () => (n == null || n(), u),
329
+ cancelRetry: c,
330
+ continueRetry: l,
331
+ canStart: m,
332
+ start: () => (m() ? w() : g().then(w), u)
333
+ };
334
+ }
335
+ function yt() {
336
+ let t = [], e = 0, s = (c) => {
337
+ c();
338
+ }, i = (c) => {
339
+ c();
340
+ }, n = (c) => setTimeout(c, 0);
341
+ const u = (c) => {
342
+ e ? t.push(c) : n(() => {
343
+ s(c);
344
+ });
345
+ }, a = () => {
346
+ const c = t;
347
+ t = [], c.length && n(() => {
348
+ i(() => {
349
+ c.forEach((l) => {
350
+ s(l);
351
+ });
352
+ });
353
+ });
354
+ };
355
+ return {
356
+ batch: (c) => {
357
+ let l;
358
+ e++;
359
+ try {
360
+ l = c();
361
+ } finally {
362
+ e--, e || a();
363
+ }
364
+ return l;
365
+ },
366
+ /**
367
+ * All calls to the wrapped function will be batched.
368
+ */
369
+ batchCalls: (c) => (...l) => {
370
+ u(() => {
371
+ c(...l);
372
+ });
373
+ },
374
+ schedule: u,
375
+ /**
376
+ * Use this method to set a custom notify function.
377
+ * This can be used to for example wrap notifications with `React.act` while running tests.
378
+ */
379
+ setNotifyFunction: (c) => {
380
+ s = c;
381
+ },
382
+ /**
383
+ * Use this method to set a custom function to batch notifications together into a single tick.
384
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
385
+ */
386
+ setBatchNotifyFunction: (c) => {
387
+ i = c;
388
+ },
389
+ setScheduler: (c) => {
390
+ n = c;
391
+ }
392
+ };
393
+ }
394
+ var qe = yt(), K, $e, pt = ($e = class {
395
+ constructor() {
396
+ d(this, K);
397
+ }
398
+ destroy() {
399
+ this.clearGcTimeout();
400
+ }
401
+ scheduleGc() {
402
+ this.clearGcTimeout(), me(this.gcTime) && h(this, K, setTimeout(() => {
403
+ this.optionalRemove();
404
+ }, this.gcTime));
405
+ }
406
+ updateGcTime(t) {
407
+ this.gcTime = Math.max(
408
+ this.gcTime || 0,
409
+ t ?? ($ ? 1 / 0 : 5 * 60 * 1e3)
410
+ );
411
+ }
412
+ clearGcTimeout() {
413
+ r(this, K) && (clearTimeout(r(this, K)), h(this, K, void 0));
414
+ }
415
+ }, K = new WeakMap(), $e), ee, te, D, H, C, oe, B, U, A, We, _t = (We = class extends pt {
416
+ constructor(e) {
417
+ super();
418
+ d(this, U);
419
+ d(this, ee);
420
+ d(this, te);
421
+ d(this, D);
422
+ d(this, H);
423
+ d(this, C);
424
+ d(this, oe);
425
+ d(this, B);
426
+ h(this, B, !1), h(this, oe, e.defaultOptions), this.setOptions(e.options), this.observers = [], h(this, H, e.client), h(this, D, r(this, H).getQueryCache()), this.queryKey = e.queryKey, this.queryHash = e.queryHash, h(this, ee, vt(this.options)), this.state = e.state ?? r(this, ee), this.scheduleGc();
427
+ }
428
+ get meta() {
429
+ return this.options.meta;
430
+ }
431
+ get promise() {
432
+ var e;
433
+ return (e = r(this, C)) == null ? void 0 : e.promise;
434
+ }
435
+ setOptions(e) {
436
+ this.options = { ...r(this, oe), ...e }, this.updateGcTime(this.options.gcTime);
437
+ }
438
+ optionalRemove() {
439
+ !this.observers.length && this.state.fetchStatus === "idle" && r(this, D).remove(this);
440
+ }
441
+ setData(e, s) {
442
+ const i = we(this.state.data, e, this.options);
443
+ return b(this, U, A).call(this, {
444
+ data: i,
445
+ type: "success",
446
+ dataUpdatedAt: s == null ? void 0 : s.updatedAt,
447
+ manual: s == null ? void 0 : s.manual
448
+ }), i;
449
+ }
450
+ setState(e, s) {
451
+ b(this, U, A).call(this, { type: "setState", state: e, setStateOptions: s });
452
+ }
453
+ cancel(e) {
454
+ var i, n;
455
+ const s = (i = r(this, C)) == null ? void 0 : i.promise;
456
+ return (n = r(this, C)) == null || n.cancel(e), s ? s.then(be).catch(be) : Promise.resolve();
457
+ }
458
+ destroy() {
459
+ super.destroy(), this.cancel({ silent: !0 });
460
+ }
461
+ reset() {
462
+ this.destroy(), this.setState(r(this, ee));
463
+ }
464
+ isActive() {
465
+ return this.observers.some(
466
+ (e) => j(e.options.enabled, this) !== !1
467
+ );
468
+ }
469
+ isDisabled() {
470
+ return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Ee || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
471
+ }
472
+ isStale() {
473
+ return this.state.isInvalidated ? !0 : this.getObserversCount() > 0 ? this.observers.some(
474
+ (e) => e.getCurrentResult().isStale
475
+ ) : this.state.data === void 0;
476
+ }
477
+ isStaleByTime(e = 0) {
478
+ return this.state.isInvalidated || this.state.data === void 0 || !Xe(this.state.dataUpdatedAt, e);
479
+ }
480
+ onFocus() {
481
+ var s;
482
+ const e = this.observers.find((i) => i.shouldFetchOnWindowFocus());
483
+ e == null || e.refetch({ cancelRefetch: !1 }), (s = r(this, C)) == null || s.continue();
484
+ }
485
+ onOnline() {
486
+ var s;
487
+ const e = this.observers.find((i) => i.shouldFetchOnReconnect());
488
+ e == null || e.refetch({ cancelRefetch: !1 }), (s = r(this, C)) == null || s.continue();
489
+ }
490
+ addObserver(e) {
491
+ this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), r(this, D).notify({ type: "observerAdded", query: this, observer: e }));
492
+ }
493
+ removeObserver(e) {
494
+ this.observers.includes(e) && (this.observers = this.observers.filter((s) => s !== e), this.observers.length || (r(this, C) && (r(this, B) ? r(this, C).cancel({ revert: !0 }) : r(this, C).cancelRetry()), this.scheduleGc()), r(this, D).notify({ type: "observerRemoved", query: this, observer: e }));
495
+ }
496
+ getObserversCount() {
497
+ return this.observers.length;
498
+ }
499
+ invalidate() {
500
+ this.state.isInvalidated || b(this, U, A).call(this, { type: "invalidate" });
501
+ }
502
+ fetch(e, s) {
503
+ var l, R, m;
504
+ if (this.state.fetchStatus !== "idle") {
505
+ if (this.state.data !== void 0 && (s != null && s.cancelRefetch))
506
+ this.cancel({ silent: !0 });
507
+ else if (r(this, C))
508
+ return r(this, C).continueRetry(), r(this, C).promise;
509
+ }
510
+ if (e && this.setOptions(e), !this.options.queryFn) {
511
+ const o = this.observers.find((S) => S.options.queryFn);
512
+ o && this.setOptions(o.options);
513
+ }
514
+ process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
515
+ "As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
516
+ ));
517
+ const i = new AbortController(), n = (o) => {
518
+ Object.defineProperty(o, "signal", {
519
+ enumerable: !0,
520
+ get: () => (h(this, B, !0), i.signal)
521
+ });
522
+ }, u = () => {
523
+ const o = ht(this.options, s), S = {
524
+ client: r(this, H),
525
+ queryKey: this.queryKey,
526
+ meta: this.meta
527
+ };
528
+ return n(S), h(this, B, !1), this.options.persister ? this.options.persister(
529
+ o,
530
+ S,
531
+ this
532
+ ) : o(S);
533
+ }, a = {
534
+ fetchOptions: s,
535
+ options: this.options,
536
+ queryKey: this.queryKey,
537
+ client: r(this, H),
538
+ state: this.state,
539
+ fetchFn: u
540
+ };
541
+ n(a), (l = this.options.behavior) == null || l.onFetch(
542
+ a,
543
+ this
544
+ ), h(this, te, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((R = a.fetchOptions) == null ? void 0 : R.meta)) && b(this, U, A).call(this, { type: "fetch", meta: (m = a.fetchOptions) == null ? void 0 : m.meta });
545
+ const c = (o) => {
546
+ var S, g, w, v;
547
+ ve(o) && o.silent || b(this, U, A).call(this, {
548
+ type: "error",
549
+ error: o
550
+ }), ve(o) || ((g = (S = r(this, D).config).onError) == null || g.call(
551
+ S,
552
+ o,
553
+ this
554
+ ), (v = (w = r(this, D).config).onSettled) == null || v.call(
555
+ w,
556
+ this.state.data,
557
+ o,
558
+ this
559
+ )), this.scheduleGc();
560
+ };
561
+ return h(this, C, dt({
562
+ initialPromise: s == null ? void 0 : s.initialPromise,
563
+ fn: a.fetchFn,
564
+ abort: i.abort.bind(i),
565
+ onSuccess: (o) => {
566
+ var S, g, w, v;
567
+ if (o === void 0) {
568
+ process.env.NODE_ENV !== "production" && console.error(
569
+ `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
570
+ ), c(new Error(`${this.queryHash} data is undefined`));
571
+ return;
572
+ }
573
+ try {
574
+ this.setData(o);
575
+ } catch (p) {
576
+ c(p);
577
+ return;
578
+ }
579
+ (g = (S = r(this, D).config).onSuccess) == null || g.call(S, o, this), (v = (w = r(this, D).config).onSettled) == null || v.call(
580
+ w,
581
+ o,
582
+ this.state.error,
583
+ this
584
+ ), this.scheduleGc();
585
+ },
586
+ onError: c,
587
+ onFail: (o, S) => {
588
+ b(this, U, A).call(this, { type: "failed", failureCount: o, error: S });
589
+ },
590
+ onPause: () => {
591
+ b(this, U, A).call(this, { type: "pause" });
592
+ },
593
+ onContinue: () => {
594
+ b(this, U, A).call(this, { type: "continue" });
595
+ },
596
+ retry: a.options.retry,
597
+ retryDelay: a.options.retryDelay,
598
+ networkMode: a.options.networkMode,
599
+ canRun: () => !0
600
+ })), r(this, C).start();
601
+ }
602
+ }, ee = new WeakMap(), te = new WeakMap(), D = new WeakMap(), H = new WeakMap(), C = new WeakMap(), oe = new WeakMap(), B = new WeakMap(), U = new WeakSet(), A = function(e) {
603
+ const s = (i) => {
604
+ switch (e.type) {
605
+ case "failed":
606
+ return {
607
+ ...i,
608
+ fetchFailureCount: e.failureCount,
609
+ fetchFailureReason: e.error
610
+ };
611
+ case "pause":
612
+ return {
613
+ ...i,
614
+ fetchStatus: "paused"
615
+ };
616
+ case "continue":
617
+ return {
618
+ ...i,
619
+ fetchStatus: "fetching"
620
+ };
621
+ case "fetch":
622
+ return {
623
+ ...i,
624
+ ...st(i.data, this.options),
625
+ fetchMeta: e.meta ?? null
626
+ };
627
+ case "success":
628
+ return {
629
+ ...i,
630
+ data: e.data,
631
+ dataUpdateCount: i.dataUpdateCount + 1,
632
+ dataUpdatedAt: e.dataUpdatedAt ?? Date.now(),
633
+ error: null,
634
+ isInvalidated: !1,
635
+ status: "success",
636
+ ...!e.manual && {
637
+ fetchStatus: "idle",
638
+ fetchFailureCount: 0,
639
+ fetchFailureReason: null
640
+ }
641
+ };
642
+ case "error":
643
+ const n = e.error;
644
+ return ve(n) && n.revert && r(this, te) ? { ...r(this, te), fetchStatus: "idle" } : {
645
+ ...i,
646
+ error: n,
647
+ errorUpdateCount: i.errorUpdateCount + 1,
648
+ errorUpdatedAt: Date.now(),
649
+ fetchFailureCount: i.fetchFailureCount + 1,
650
+ fetchFailureReason: n,
651
+ fetchStatus: "idle",
652
+ status: "error"
653
+ };
654
+ case "invalidate":
655
+ return {
656
+ ...i,
657
+ isInvalidated: !0
658
+ };
659
+ case "setState":
660
+ return {
661
+ ...i,
662
+ ...e.state
663
+ };
664
+ }
665
+ };
666
+ this.state = s(this.state), qe.batch(() => {
667
+ this.observers.forEach((i) => {
668
+ i.onQueryUpdate();
669
+ }), r(this, D).notify({ query: this, type: "updated", action: e });
670
+ });
671
+ }, We);
672
+ function st(t, e) {
673
+ return {
674
+ fetchFailureCount: 0,
675
+ fetchFailureReason: null,
676
+ fetchStatus: et(e.networkMode) ? "fetching" : "paused",
677
+ ...t === void 0 && {
678
+ error: null,
679
+ status: "pending"
680
+ }
681
+ };
682
+ }
683
+ function vt(t) {
684
+ const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = e !== void 0, i = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
685
+ return {
686
+ data: e,
687
+ dataUpdateCount: 0,
688
+ dataUpdatedAt: s ? i ?? Date.now() : 0,
689
+ error: null,
690
+ errorUpdateCount: 0,
691
+ errorUpdatedAt: 0,
692
+ fetchFailureCount: 0,
693
+ fetchFailureReason: null,
694
+ fetchMeta: null,
695
+ isInvalidated: !1,
696
+ status: s ? "success" : "pending",
697
+ fetchStatus: "idle"
698
+ };
699
+ }
700
+ var T, f, ue, O, G, se, k, I, he, re, ie, z, V, L, ne, y, ae, Oe, Te, De, Pe, Ue, je, xe, rt, Je, bt = (Je = class extends Qe {
701
+ constructor(e, s) {
702
+ super();
703
+ d(this, y);
704
+ d(this, T);
705
+ d(this, f);
706
+ d(this, ue);
707
+ d(this, O);
708
+ d(this, G);
709
+ d(this, se);
710
+ d(this, k);
711
+ d(this, I);
712
+ d(this, he);
713
+ d(this, re);
714
+ // This property keeps track of the last query with defined data.
715
+ // It will be used to pass the previous data and query to the placeholder function between renders.
716
+ d(this, ie);
717
+ d(this, z);
718
+ d(this, V);
719
+ d(this, L);
720
+ d(this, ne, /* @__PURE__ */ new Set());
721
+ this.options = s, h(this, T, e), h(this, I, null), h(this, k, Fe()), this.options.experimental_prefetchInRender || r(this, k).reject(
722
+ new Error("experimental_prefetchInRender feature flag is not enabled")
723
+ ), this.bindMethods(), this.setOptions(s);
724
+ }
725
+ bindMethods() {
726
+ this.refetch = this.refetch.bind(this);
727
+ }
728
+ onSubscribe() {
729
+ this.listeners.size === 1 && (r(this, f).addObserver(this), Ke(r(this, f), this.options) ? b(this, y, ae).call(this) : this.updateResult(), b(this, y, Pe).call(this));
730
+ }
731
+ onUnsubscribe() {
732
+ this.hasListeners() || this.destroy();
733
+ }
734
+ shouldFetchOnReconnect() {
735
+ return Ie(
736
+ r(this, f),
737
+ this.options,
738
+ this.options.refetchOnReconnect
739
+ );
740
+ }
741
+ shouldFetchOnWindowFocus() {
742
+ return Ie(
743
+ r(this, f),
744
+ this.options,
745
+ this.options.refetchOnWindowFocus
746
+ );
747
+ }
748
+ destroy() {
749
+ this.listeners = /* @__PURE__ */ new Set(), b(this, y, Ue).call(this), b(this, y, je).call(this), r(this, f).removeObserver(this);
750
+ }
751
+ setOptions(e, s) {
752
+ const i = this.options, n = r(this, f);
753
+ if (this.options = r(this, T).defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof j(this.options.enabled, r(this, f)) != "boolean")
754
+ throw new Error(
755
+ "Expected enabled to be a boolean or a callback that returns a boolean"
756
+ );
757
+ b(this, y, xe).call(this), r(this, f).setOptions(this.options), i._defaulted && !Se(this.options, i) && r(this, T).getQueryCache().notify({
758
+ type: "observerOptionsUpdated",
759
+ query: r(this, f),
760
+ observer: this
761
+ });
762
+ const u = this.hasListeners();
763
+ u && He(
764
+ r(this, f),
765
+ n,
766
+ this.options,
767
+ i
768
+ ) && b(this, y, ae).call(this), this.updateResult(s), u && (r(this, f) !== n || j(this.options.enabled, r(this, f)) !== j(i.enabled, r(this, f)) || de(this.options.staleTime, r(this, f)) !== de(i.staleTime, r(this, f))) && b(this, y, Oe).call(this);
769
+ const a = b(this, y, Te).call(this);
770
+ u && (r(this, f) !== n || j(this.options.enabled, r(this, f)) !== j(i.enabled, r(this, f)) || a !== r(this, L)) && b(this, y, De).call(this, a);
771
+ }
772
+ getOptimisticResult(e) {
773
+ const s = r(this, T).getQueryCache().build(r(this, T), e), i = this.createResult(s, e);
774
+ return gt(this, i) && (h(this, O, i), h(this, se, this.options), h(this, G, r(this, f).state)), i;
775
+ }
776
+ getCurrentResult() {
777
+ return r(this, O);
778
+ }
779
+ trackResult(e, s) {
780
+ const i = {};
781
+ return Object.keys(e).forEach((n) => {
782
+ Object.defineProperty(i, n, {
783
+ configurable: !1,
784
+ enumerable: !0,
785
+ get: () => (this.trackProp(n), s == null || s(n), e[n])
786
+ });
787
+ }), i;
788
+ }
789
+ trackProp(e) {
790
+ r(this, ne).add(e);
791
+ }
792
+ getCurrentQuery() {
793
+ return r(this, f);
794
+ }
795
+ refetch({ ...e } = {}) {
796
+ return this.fetch({
797
+ ...e
798
+ });
799
+ }
800
+ fetchOptimistic(e) {
801
+ const s = r(this, T).defaultQueryOptions(e), i = r(this, T).getQueryCache().build(r(this, T), s);
802
+ return i.fetch().then(() => this.createResult(i, s));
803
+ }
804
+ fetch(e) {
805
+ return b(this, y, ae).call(this, {
806
+ ...e,
807
+ cancelRefetch: e.cancelRefetch ?? !0
808
+ }).then(() => (this.updateResult(), r(this, O)));
809
+ }
810
+ createResult(e, s) {
811
+ var ke;
812
+ const i = r(this, f), n = this.options, u = r(this, O), a = r(this, G), c = r(this, se), R = e !== i ? e.state : r(this, ue), { state: m } = e;
813
+ let o = { ...m }, S = !1, g;
814
+ if (s._optimisticResults) {
815
+ const F = this.hasListeners(), W = !F && Ke(e, s), J = F && He(e, i, s, n);
816
+ (W || J) && (o = {
817
+ ...o,
818
+ ...st(m.data, e.options)
819
+ }), s._optimisticResults === "isRestoring" && (o.fetchStatus = "idle");
820
+ }
821
+ let { error: w, errorUpdatedAt: v, status: p } = o;
822
+ if (s.select && o.data !== void 0)
823
+ if (u && o.data === (a == null ? void 0 : a.data) && s.select === r(this, he))
824
+ g = r(this, re);
825
+ else
826
+ try {
827
+ h(this, he, s.select), g = s.select(o.data), g = we(u == null ? void 0 : u.data, g, s), h(this, re, g), h(this, I, null);
828
+ } catch (F) {
829
+ h(this, I, F);
830
+ }
831
+ else
832
+ g = o.data;
833
+ if (s.placeholderData !== void 0 && g === void 0 && p === "pending") {
834
+ let F;
835
+ if (u != null && u.isPlaceholderData && s.placeholderData === (c == null ? void 0 : c.placeholderData))
836
+ F = u.data;
837
+ else if (F = typeof s.placeholderData == "function" ? s.placeholderData(
838
+ (ke = r(this, ie)) == null ? void 0 : ke.state.data,
839
+ r(this, ie)
840
+ ) : s.placeholderData, s.select && F !== void 0)
841
+ try {
842
+ F = s.select(F), h(this, I, null);
843
+ } catch (W) {
844
+ h(this, I, W);
845
+ }
846
+ F !== void 0 && (p = "success", g = we(
847
+ u == null ? void 0 : u.data,
848
+ F,
849
+ s
850
+ ), S = !0);
851
+ }
852
+ r(this, I) && (w = r(this, I), g = r(this, re), v = Date.now(), p = "error");
853
+ const E = o.fetchStatus === "fetching", Q = p === "pending", N = p === "error", ce = Q && E, le = g !== void 0, x = {
854
+ status: p,
855
+ fetchStatus: o.fetchStatus,
856
+ isPending: Q,
857
+ isSuccess: p === "success",
858
+ isError: N,
859
+ isInitialLoading: ce,
860
+ isLoading: ce,
861
+ data: g,
862
+ dataUpdatedAt: o.dataUpdatedAt,
863
+ error: w,
864
+ errorUpdatedAt: v,
865
+ failureCount: o.fetchFailureCount,
866
+ failureReason: o.fetchFailureReason,
867
+ errorUpdateCount: o.errorUpdateCount,
868
+ isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
869
+ isFetchedAfterMount: o.dataUpdateCount > R.dataUpdateCount || o.errorUpdateCount > R.errorUpdateCount,
870
+ isFetching: E,
871
+ isRefetching: E && !Q,
872
+ isLoadingError: N && !le,
873
+ isPaused: o.fetchStatus === "paused",
874
+ isPlaceholderData: S,
875
+ isRefetchError: N && le,
876
+ isStale: Me(e, s),
877
+ refetch: this.refetch,
878
+ promise: r(this, k)
879
+ };
880
+ if (this.options.experimental_prefetchInRender) {
881
+ const F = (fe) => {
882
+ x.status === "error" ? fe.reject(x.error) : x.data !== void 0 && fe.resolve(x.data);
883
+ }, W = () => {
884
+ const fe = h(this, k, x.promise = Fe());
885
+ F(fe);
886
+ }, J = r(this, k);
887
+ switch (J.status) {
888
+ case "pending":
889
+ e.queryHash === i.queryHash && F(J);
890
+ break;
891
+ case "fulfilled":
892
+ (x.status === "error" || x.data !== J.value) && W();
893
+ break;
894
+ case "rejected":
895
+ (x.status !== "error" || x.error !== J.reason) && W();
896
+ break;
897
+ }
898
+ }
899
+ return x;
900
+ }
901
+ updateResult(e) {
902
+ const s = r(this, O), i = this.createResult(r(this, f), this.options);
903
+ if (h(this, G, r(this, f).state), h(this, se, this.options), r(this, G).data !== void 0 && h(this, ie, r(this, f)), Se(i, s))
904
+ return;
905
+ h(this, O, i);
906
+ const n = {}, u = () => {
907
+ if (!s)
908
+ return !0;
909
+ const { notifyOnChangeProps: a } = this.options, c = typeof a == "function" ? a() : a;
910
+ if (c === "all" || !c && !r(this, ne).size)
911
+ return !0;
912
+ const l = new Set(
913
+ c ?? r(this, ne)
914
+ );
915
+ return this.options.throwOnError && l.add("error"), Object.keys(r(this, O)).some((R) => {
916
+ const m = R;
917
+ return r(this, O)[m] !== s[m] && l.has(m);
918
+ });
919
+ };
920
+ (e == null ? void 0 : e.listeners) !== !1 && u() && (n.listeners = !0), b(this, y, rt).call(this, { ...n, ...e });
921
+ }
922
+ onQueryUpdate() {
923
+ this.updateResult(), this.hasListeners() && b(this, y, Pe).call(this);
924
+ }
925
+ }, T = new WeakMap(), f = new WeakMap(), ue = new WeakMap(), O = new WeakMap(), G = new WeakMap(), se = new WeakMap(), k = new WeakMap(), I = new WeakMap(), he = new WeakMap(), re = new WeakMap(), ie = new WeakMap(), z = new WeakMap(), V = new WeakMap(), L = new WeakMap(), ne = new WeakMap(), y = new WeakSet(), ae = function(e) {
926
+ b(this, y, xe).call(this);
927
+ let s = r(this, f).fetch(
928
+ this.options,
929
+ e
930
+ );
931
+ return e != null && e.throwOnError || (s = s.catch(be)), s;
932
+ }, Oe = function() {
933
+ b(this, y, Ue).call(this);
934
+ const e = de(
935
+ this.options.staleTime,
936
+ r(this, f)
937
+ );
938
+ if ($ || r(this, O).isStale || !me(e))
939
+ return;
940
+ const i = Xe(r(this, O).dataUpdatedAt, e) + 1;
941
+ h(this, z, setTimeout(() => {
942
+ r(this, O).isStale || this.updateResult();
943
+ }, i));
944
+ }, Te = function() {
945
+ return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(r(this, f)) : this.options.refetchInterval) ?? !1;
946
+ }, De = function(e) {
947
+ b(this, y, je).call(this), h(this, L, e), !($ || j(this.options.enabled, r(this, f)) === !1 || !me(r(this, L)) || r(this, L) === 0) && h(this, V, setInterval(() => {
948
+ (this.options.refetchIntervalInBackground || Ye.isFocused()) && b(this, y, ae).call(this);
949
+ }, r(this, L)));
950
+ }, Pe = function() {
951
+ b(this, y, Oe).call(this), b(this, y, De).call(this, b(this, y, Te).call(this));
952
+ }, Ue = function() {
953
+ r(this, z) && (clearTimeout(r(this, z)), h(this, z, void 0));
954
+ }, je = function() {
955
+ r(this, V) && (clearInterval(r(this, V)), h(this, V, void 0));
956
+ }, xe = function() {
957
+ const e = r(this, T).getQueryCache().build(r(this, T), this.options);
958
+ if (e === r(this, f))
959
+ return;
960
+ const s = r(this, f);
961
+ h(this, f, e), h(this, ue, e.state), this.hasListeners() && (s == null || s.removeObserver(this), e.addObserver(this));
962
+ }, rt = function(e) {
963
+ qe.batch(() => {
964
+ e.listeners && this.listeners.forEach((s) => {
965
+ s(r(this, O));
966
+ }), r(this, T).getQueryCache().notify({
967
+ query: r(this, f),
968
+ type: "observerResultsUpdated"
969
+ });
970
+ });
971
+ }, Je);
972
+ function mt(t, e) {
973
+ return j(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
974
+ }
975
+ function Ke(t, e) {
976
+ return mt(t, e) || t.state.data !== void 0 && Ie(t, e, e.refetchOnMount);
977
+ }
978
+ function Ie(t, e, s) {
979
+ if (j(e.enabled, t) !== !1) {
980
+ const i = typeof s == "function" ? s(t) : s;
981
+ return i === "always" || i !== !1 && Me(t, e);
982
+ }
983
+ return !1;
984
+ }
985
+ function He(t, e, s, i) {
986
+ return (t !== e || j(i.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && Me(t, s);
987
+ }
988
+ function Me(t, e) {
989
+ return j(e.enabled, t) !== !1 && t.isStaleByTime(de(e.staleTime, t));
990
+ }
991
+ function gt(t, e) {
992
+ return !Se(t.getCurrentResult(), e);
993
+ }
994
+ var it = P.createContext(
995
+ void 0
996
+ ), Rt = (t) => {
997
+ const e = P.useContext(it);
998
+ if (t)
999
+ return t;
1000
+ if (!e)
1001
+ throw new Error("No QueryClient set, use QueryClientProvider to set one");
1002
+ return e;
1003
+ }, Kt = ({
1004
+ client: t,
1005
+ children: e
1006
+ }) => (P.useEffect(() => (t.mount(), () => {
1007
+ t.unmount();
1008
+ }), [t]), /* @__PURE__ */ at.jsx(it.Provider, { value: t, children: e })), nt = P.createContext(!1), St = () => P.useContext(nt);
1009
+ nt.Provider;
1010
+ function Ct() {
1011
+ let t = !1;
1012
+ return {
1013
+ clearReset: () => {
1014
+ t = !1;
1015
+ },
1016
+ reset: () => {
1017
+ t = !0;
1018
+ },
1019
+ isReset: () => t
1020
+ };
1021
+ }
1022
+ var wt = P.createContext(Ct()), Et = () => P.useContext(wt);
1023
+ function Ft(t, e) {
1024
+ return typeof t == "function" ? t(...e) : !!t;
1025
+ }
1026
+ function Be() {
1027
+ }
1028
+ var Ot = (t, e) => {
1029
+ (t.suspense || t.throwOnError || t.experimental_prefetchInRender) && (e.isReset() || (t.retryOnMount = !1));
1030
+ }, Tt = (t) => {
1031
+ P.useEffect(() => {
1032
+ t.clearReset();
1033
+ }, [t]);
1034
+ }, Dt = ({
1035
+ result: t,
1036
+ errorResetBoundary: e,
1037
+ throwOnError: s,
1038
+ query: i,
1039
+ suspense: n
1040
+ }) => t.isError && !e.isReset() && !t.isFetching && i && (n && t.data === void 0 || Ft(s, [t.error, i])), Ht = (t, e) => e.state.data === void 0, Pt = (t) => {
1041
+ const e = t.staleTime;
1042
+ t.suspense && (t.staleTime = typeof e == "function" ? (...s) => Math.max(e(...s), 1e3) : Math.max(e ?? 1e3, 1e3), typeof t.gcTime == "number" && (t.gcTime = Math.max(t.gcTime, 1e3)));
1043
+ }, Ut = (t, e) => t.isLoading && t.isFetching && !e, jt = (t, e) => (t == null ? void 0 : t.suspense) && e.isPending, Ge = (t, e, s) => e.fetchOptimistic(t).catch(() => {
1044
+ s.clearReset();
1045
+ });
1046
+ function xt(t, e, s) {
1047
+ var o, S, g, w, v;
1048
+ if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
1049
+ throw new Error(
1050
+ 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
1051
+ );
1052
+ const i = Rt(s), n = St(), u = Et(), a = i.defaultQueryOptions(t);
1053
+ (S = (o = i.getDefaultOptions().queries) == null ? void 0 : o._experimental_beforeQuery) == null || S.call(
1054
+ o,
1055
+ a
1056
+ ), a._optimisticResults = n ? "isRestoring" : "optimistic", Pt(a), Ot(a, u), Tt(u);
1057
+ const c = !i.getQueryCache().get(a.queryHash), [l] = P.useState(
1058
+ () => new e(
1059
+ i,
1060
+ a
1061
+ )
1062
+ ), R = l.getOptimisticResult(a), m = !n && t.subscribed !== !1;
1063
+ if (P.useSyncExternalStore(
1064
+ P.useCallback(
1065
+ (p) => {
1066
+ const E = m ? l.subscribe(qe.batchCalls(p)) : Be;
1067
+ return l.updateResult(), E;
1068
+ },
1069
+ [l, m]
1070
+ ),
1071
+ () => l.getCurrentResult(),
1072
+ () => l.getCurrentResult()
1073
+ ), P.useEffect(() => {
1074
+ l.setOptions(a, { listeners: !1 });
1075
+ }, [a, l]), jt(a, R))
1076
+ throw Ge(a, l, u);
1077
+ if (Dt({
1078
+ result: R,
1079
+ errorResetBoundary: u,
1080
+ throwOnError: a.throwOnError,
1081
+ query: i.getQueryCache().get(a.queryHash),
1082
+ suspense: a.suspense
1083
+ }))
1084
+ throw R.error;
1085
+ if ((w = (g = i.getDefaultOptions().queries) == null ? void 0 : g._experimental_afterQuery) == null || w.call(
1086
+ g,
1087
+ a,
1088
+ R
1089
+ ), a.experimental_prefetchInRender && !$ && Ut(R, n)) {
1090
+ const p = c ? (
1091
+ // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1092
+ Ge(a, l, u)
1093
+ ) : (
1094
+ // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1095
+ (v = i.getQueryCache().get(a.queryHash)) == null ? void 0 : v.promise
1096
+ );
1097
+ p == null || p.catch(Be).finally(() => {
1098
+ l.updateResult();
1099
+ });
1100
+ }
1101
+ return a.notifyOnChangeProps ? R : l.trackResult(R);
1102
+ }
1103
+ function Bt(t, e) {
1104
+ return xt(t, bt, e);
1105
+ }
1106
+ export {
1107
+ bt as Q,
1108
+ pt as R,
1109
+ Qe as S,
1110
+ Be as a,
1111
+ Ft as b,
1112
+ dt as c,
1113
+ Bt as d,
1114
+ Ee as e,
1115
+ xt as f,
1116
+ Ht as g,
1117
+ ge as h,
1118
+ ot as i,
1119
+ _t as j,
1120
+ kt as k,
1121
+ Mt as l,
1122
+ qt as m,
1123
+ qe as n,
1124
+ be as o,
1125
+ ht as p,
1126
+ Nt as q,
1127
+ Lt as r,
1128
+ Se as s,
1129
+ Ye as t,
1130
+ Rt as u,
1131
+ Ze as v,
1132
+ de as w,
1133
+ At as x,
1134
+ Ae as y,
1135
+ Kt as z
1136
+ };
1137
+ //# sourceMappingURL=useQuery-CQUwWR9i.js.map