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