@pdf-viewer/react 1.11.0-beta.2 → 1.11.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ToolbarLayout.module-082ff242.js → ToolbarLayout.module-882e61e6.js} +700 -694
- package/dist/assets/ToolbarLayout.css +1 -1
- package/dist/components/RPConfig.js +962 -843
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPPages.js +1 -1
- package/dist/components/layout/LayoutContainer.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +1 -1
- package/dist/components/layout/RPLayout.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/OtherTool.js +2 -2
- package/dist/components/layout/toolbar/Paginate.js +1 -1
- package/dist/components/layout/toolbar/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/RPMoreOptions.js +2 -2
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +1 -1
- package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +1 -1
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/ToolbarCustom.js +1 -1
- package/dist/components/layout/toolbar/ToolbarDefault.js +1 -1
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +1 -1
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +1 -1
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +1 -1
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +1 -1
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextHighlightLayer.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Checkbox.js +237 -125
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +211 -424
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/index-808ea7bf.js +1685 -0
- package/dist/index-a48ec088.js +1672 -0
- package/dist/index-c9a2990a.js +332 -0
- package/dist/main.js +1 -1
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePresentPage.js +1 -1
- package/dist/utils/hooks/usePrint.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useThumbnail.js +1 -1
- package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
- package/package.json +1 -1
- package/dist/floating-ui.react-dom-88a86594.js +0 -1447
- package/dist/index-48ca3f30.js +0 -307
- package/dist/index-4ba3ab9a.js +0 -1877
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
if (!
|
|
1
|
+
var St = (e, t, s) => {
|
|
2
|
+
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + s);
|
|
4
4
|
};
|
|
5
|
-
var i = (
|
|
6
|
-
if (
|
|
5
|
+
var i = (e, t, s) => (St(e, t, "read from private field"), s ? s.call(e) : t.get(e)), c = (e, t, s) => {
|
|
6
|
+
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
-
|
|
9
|
-
}, o = (
|
|
10
|
-
var
|
|
8
|
+
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
9
|
+
}, o = (e, t, s, r) => (St(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s);
|
|
10
|
+
var bt = (e, t, s, r) => ({
|
|
11
11
|
set _(n) {
|
|
12
|
-
o(
|
|
12
|
+
o(e, t, n, s);
|
|
13
13
|
},
|
|
14
14
|
get _() {
|
|
15
|
-
return i(
|
|
16
|
-
}
|
|
17
|
-
}),
|
|
18
|
-
import { jsx as
|
|
19
|
-
import { RPTheme as
|
|
20
|
-
import { ConfigContextProvider as
|
|
21
|
-
import { useLoadWorker as
|
|
22
|
-
import * as
|
|
23
|
-
import { LicenseProvider as
|
|
24
|
-
var
|
|
15
|
+
return i(e, t, r);
|
|
16
|
+
}
|
|
17
|
+
}), F = (e, t, s) => (St(e, t, "access private method"), s);
|
|
18
|
+
import { jsx as dt } from "react/jsx-runtime";
|
|
19
|
+
import { RPTheme as te } from "./RPTheme.js";
|
|
20
|
+
import { ConfigContextProvider as ee } from "../contexts/ConfigContext.js";
|
|
21
|
+
import { useLoadWorker as se } from "../utils/hooks/useLoadWorker.js";
|
|
22
|
+
import * as Bt from "react";
|
|
23
|
+
import { LicenseProvider as re } from "../contexts/LicenseContext.js";
|
|
24
|
+
var Ct = class {
|
|
25
25
|
constructor() {
|
|
26
26
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
27
27
|
}
|
|
28
|
-
subscribe(
|
|
29
|
-
return this.listeners.add(
|
|
30
|
-
this.listeners.delete(
|
|
28
|
+
subscribe(e) {
|
|
29
|
+
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
30
|
+
this.listeners.delete(e), this.onUnsubscribe();
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
hasListeners() {
|
|
@@ -37,146 +37,203 @@ var ge = class {
|
|
|
37
37
|
}
|
|
38
38
|
onUnsubscribe() {
|
|
39
39
|
}
|
|
40
|
-
},
|
|
41
|
-
function
|
|
40
|
+
}, ie = {
|
|
41
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
42
|
+
// global setTimeout etc.
|
|
43
|
+
//
|
|
44
|
+
// BAD: `setTimeout: setTimeout`
|
|
45
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
46
|
+
//
|
|
47
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
48
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
49
|
+
// have a hard reference to the original implementation at the time when this
|
|
50
|
+
// file was imported.
|
|
51
|
+
setTimeout: (e, t) => setTimeout(e, t),
|
|
52
|
+
clearTimeout: (e) => clearTimeout(e),
|
|
53
|
+
setInterval: (e, t) => setInterval(e, t),
|
|
54
|
+
clearInterval: (e) => clearInterval(e)
|
|
55
|
+
}, x, W, Ut, ne = (Ut = class {
|
|
56
|
+
constructor() {
|
|
57
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
58
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
59
|
+
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
60
|
+
//
|
|
61
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
62
|
+
// this class is unsafe internally to allow for extension.
|
|
63
|
+
c(this, x, ie);
|
|
64
|
+
c(this, W, !1);
|
|
65
|
+
}
|
|
66
|
+
setTimeoutProvider(e) {
|
|
67
|
+
process.env.NODE_ENV !== "production" && i(this, W) && e !== i(this, x) && console.error(
|
|
68
|
+
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
69
|
+
{ previous: i(this, x), provider: e }
|
|
70
|
+
), o(this, x, e), process.env.NODE_ENV !== "production" && o(this, W, !1);
|
|
71
|
+
}
|
|
72
|
+
setTimeout(e, t) {
|
|
73
|
+
return process.env.NODE_ENV !== "production" && o(this, W, !0), i(this, x).setTimeout(e, t);
|
|
74
|
+
}
|
|
75
|
+
clearTimeout(e) {
|
|
76
|
+
i(this, x).clearTimeout(e);
|
|
77
|
+
}
|
|
78
|
+
setInterval(e, t) {
|
|
79
|
+
return process.env.NODE_ENV !== "production" && o(this, W, !0), i(this, x).setInterval(e, t);
|
|
80
|
+
}
|
|
81
|
+
clearInterval(e) {
|
|
82
|
+
i(this, x).clearInterval(e);
|
|
83
|
+
}
|
|
84
|
+
}, x = new WeakMap(), W = new WeakMap(), Ut), Et = new ne();
|
|
85
|
+
function ae(e) {
|
|
86
|
+
setTimeout(e, 0);
|
|
87
|
+
}
|
|
88
|
+
var Ft = typeof window > "u" || "Deno" in globalThis;
|
|
89
|
+
function R() {
|
|
42
90
|
}
|
|
43
|
-
function
|
|
44
|
-
return typeof
|
|
91
|
+
function oe(e, t) {
|
|
92
|
+
return typeof e == "function" ? e(t) : e;
|
|
45
93
|
}
|
|
46
|
-
function
|
|
47
|
-
return typeof
|
|
94
|
+
function ue(e) {
|
|
95
|
+
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
48
96
|
}
|
|
49
|
-
function
|
|
50
|
-
return Math.max(
|
|
97
|
+
function he(e, t) {
|
|
98
|
+
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
51
99
|
}
|
|
52
|
-
function
|
|
53
|
-
return typeof
|
|
100
|
+
function Dt(e, t) {
|
|
101
|
+
return typeof e == "function" ? e(t) : e;
|
|
54
102
|
}
|
|
55
|
-
function
|
|
56
|
-
return typeof
|
|
103
|
+
function ce(e, t) {
|
|
104
|
+
return typeof e == "function" ? e(t) : e;
|
|
57
105
|
}
|
|
58
|
-
function
|
|
106
|
+
function Tt(e, t) {
|
|
59
107
|
const {
|
|
60
108
|
type: s = "all",
|
|
61
109
|
exact: r,
|
|
62
110
|
fetchStatus: n,
|
|
63
|
-
predicate:
|
|
64
|
-
queryKey:
|
|
65
|
-
stale:
|
|
66
|
-
} =
|
|
67
|
-
if (
|
|
111
|
+
predicate: a,
|
|
112
|
+
queryKey: l,
|
|
113
|
+
stale: u
|
|
114
|
+
} = e;
|
|
115
|
+
if (l) {
|
|
68
116
|
if (r) {
|
|
69
|
-
if (
|
|
117
|
+
if (t.queryHash !== Mt(l, t.options))
|
|
70
118
|
return !1;
|
|
71
|
-
} else if (!
|
|
119
|
+
} else if (!yt(t.queryKey, l))
|
|
72
120
|
return !1;
|
|
73
121
|
}
|
|
74
122
|
if (s !== "all") {
|
|
75
|
-
const f =
|
|
123
|
+
const f = t.isActive();
|
|
76
124
|
if (s === "active" && !f || s === "inactive" && f)
|
|
77
125
|
return !1;
|
|
78
126
|
}
|
|
79
|
-
return !(typeof
|
|
127
|
+
return !(typeof u == "boolean" && t.isStale() !== u || n && n !== t.state.fetchStatus || a && !a(t));
|
|
80
128
|
}
|
|
81
|
-
function
|
|
82
|
-
const { exact: s, status: r, predicate: n, mutationKey:
|
|
83
|
-
if (
|
|
84
|
-
if (!
|
|
129
|
+
function Rt(e, t) {
|
|
130
|
+
const { exact: s, status: r, predicate: n, mutationKey: a } = e;
|
|
131
|
+
if (a) {
|
|
132
|
+
if (!t.options.mutationKey)
|
|
85
133
|
return !1;
|
|
86
134
|
if (s) {
|
|
87
|
-
if (
|
|
135
|
+
if (ft(t.options.mutationKey) !== ft(a))
|
|
88
136
|
return !1;
|
|
89
|
-
} else if (!
|
|
137
|
+
} else if (!yt(t.options.mutationKey, a))
|
|
90
138
|
return !1;
|
|
91
139
|
}
|
|
92
|
-
return !(r &&
|
|
140
|
+
return !(r && t.state.status !== r || n && !n(t));
|
|
93
141
|
}
|
|
94
|
-
function
|
|
95
|
-
return ((
|
|
142
|
+
function Mt(e, t) {
|
|
143
|
+
return ((t == null ? void 0 : t.queryKeyHashFn) || ft)(e);
|
|
96
144
|
}
|
|
97
|
-
function
|
|
145
|
+
function ft(e) {
|
|
98
146
|
return JSON.stringify(
|
|
99
|
-
|
|
100
|
-
(
|
|
147
|
+
e,
|
|
148
|
+
(t, s) => At(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
|
|
101
149
|
);
|
|
102
150
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
151
|
+
function yt(e, t) {
|
|
152
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => yt(e[s], t[s])) : !1;
|
|
105
153
|
}
|
|
106
|
-
|
|
107
|
-
|
|
154
|
+
var le = Object.prototype.hasOwnProperty;
|
|
155
|
+
function qt(e, t) {
|
|
156
|
+
if (e === t)
|
|
157
|
+
return e;
|
|
158
|
+
const s = It(e) && It(t);
|
|
159
|
+
if (!s && !(At(e) && At(t)))
|
|
108
160
|
return t;
|
|
109
|
-
const s =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
161
|
+
const n = (s ? e : Object.keys(e)).length, a = s ? t : Object.keys(t), l = a.length, u = s ? new Array(l) : {};
|
|
162
|
+
let f = 0;
|
|
163
|
+
for (let O = 0; O < l; O++) {
|
|
164
|
+
const v = s ? O : a[O], C = e[v], g = t[v];
|
|
165
|
+
if (C === g) {
|
|
166
|
+
u[v] = C, (s ? O < n : le.call(e, v)) && f++;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (C === null || g === null || typeof C != "object" || typeof g != "object") {
|
|
170
|
+
u[v] = g;
|
|
171
|
+
continue;
|
|
116
172
|
}
|
|
117
|
-
|
|
173
|
+
const q = qt(C, g);
|
|
174
|
+
u[v] = q, q === C && f++;
|
|
118
175
|
}
|
|
119
|
-
return e;
|
|
176
|
+
return n === l && f === n ? e : u;
|
|
120
177
|
}
|
|
121
|
-
function
|
|
122
|
-
return Array.isArray(
|
|
178
|
+
function It(e) {
|
|
179
|
+
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
123
180
|
}
|
|
124
|
-
function
|
|
125
|
-
if (!
|
|
181
|
+
function At(e) {
|
|
182
|
+
if (!jt(e))
|
|
126
183
|
return !1;
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
184
|
+
const t = e.constructor;
|
|
185
|
+
if (t === void 0)
|
|
129
186
|
return !0;
|
|
130
|
-
const s =
|
|
131
|
-
return !(!
|
|
187
|
+
const s = t.prototype;
|
|
188
|
+
return !(!jt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
132
189
|
}
|
|
133
|
-
function
|
|
134
|
-
return Object.prototype.toString.call(
|
|
190
|
+
function jt(e) {
|
|
191
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
135
192
|
}
|
|
136
|
-
function
|
|
137
|
-
return new Promise((
|
|
138
|
-
setTimeout(
|
|
193
|
+
function de(e) {
|
|
194
|
+
return new Promise((t) => {
|
|
195
|
+
Et.setTimeout(t, e);
|
|
139
196
|
});
|
|
140
197
|
}
|
|
141
|
-
function
|
|
198
|
+
function fe(e, t, s) {
|
|
142
199
|
if (typeof s.structuralSharing == "function")
|
|
143
|
-
return s.structuralSharing(
|
|
200
|
+
return s.structuralSharing(e, t);
|
|
144
201
|
if (s.structuralSharing !== !1) {
|
|
145
202
|
if (process.env.NODE_ENV !== "production")
|
|
146
203
|
try {
|
|
147
|
-
return
|
|
204
|
+
return qt(e, t);
|
|
148
205
|
} catch (r) {
|
|
149
|
-
console.error(
|
|
206
|
+
throw console.error(
|
|
150
207
|
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${r}`
|
|
151
|
-
);
|
|
208
|
+
), r;
|
|
152
209
|
}
|
|
153
|
-
return
|
|
210
|
+
return qt(e, t);
|
|
154
211
|
}
|
|
155
|
-
return
|
|
212
|
+
return t;
|
|
156
213
|
}
|
|
157
|
-
function
|
|
158
|
-
const r = [...
|
|
214
|
+
function ye(e, t, s = 0) {
|
|
215
|
+
const r = [...e, t];
|
|
159
216
|
return s && r.length > s ? r.slice(1) : r;
|
|
160
217
|
}
|
|
161
|
-
function
|
|
162
|
-
const r = [
|
|
218
|
+
function pe(e, t, s = 0) {
|
|
219
|
+
const r = [t, ...e];
|
|
163
220
|
return s && r.length > s ? r.slice(0, -1) : r;
|
|
164
221
|
}
|
|
165
|
-
var
|
|
166
|
-
function
|
|
167
|
-
return process.env.NODE_ENV !== "production" &&
|
|
168
|
-
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${
|
|
169
|
-
), !
|
|
222
|
+
var Pt = Symbol();
|
|
223
|
+
function Jt(e, t) {
|
|
224
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === Pt && console.error(
|
|
225
|
+
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
226
|
+
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn === Pt ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
170
227
|
}
|
|
171
|
-
var
|
|
228
|
+
var Z, G, rt, Nt, me = (Nt = class extends Ct {
|
|
172
229
|
constructor() {
|
|
173
230
|
super();
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
o(this,
|
|
178
|
-
if (!
|
|
179
|
-
const s = () =>
|
|
231
|
+
c(this, Z, void 0);
|
|
232
|
+
c(this, G, void 0);
|
|
233
|
+
c(this, rt, void 0);
|
|
234
|
+
o(this, rt, (t) => {
|
|
235
|
+
if (!Ft && window.addEventListener) {
|
|
236
|
+
const s = () => t();
|
|
180
237
|
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
181
238
|
window.removeEventListener("visibilitychange", s);
|
|
182
239
|
};
|
|
@@ -184,70 +241,36 @@ var B, N, Z, Re, nt = (Re = class extends ge {
|
|
|
184
241
|
});
|
|
185
242
|
}
|
|
186
243
|
onSubscribe() {
|
|
187
|
-
i(this,
|
|
244
|
+
i(this, G) || this.setEventListener(i(this, rt));
|
|
188
245
|
}
|
|
189
246
|
onUnsubscribe() {
|
|
190
|
-
var
|
|
191
|
-
this.hasListeners() || ((
|
|
247
|
+
var t;
|
|
248
|
+
this.hasListeners() || ((t = i(this, G)) == null || t.call(this), o(this, G, void 0));
|
|
192
249
|
}
|
|
193
|
-
setEventListener(
|
|
250
|
+
setEventListener(t) {
|
|
194
251
|
var s;
|
|
195
|
-
o(this,
|
|
252
|
+
o(this, rt, t), (s = i(this, G)) == null || s.call(this), o(this, G, t((r) => {
|
|
196
253
|
typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
|
|
197
254
|
}));
|
|
198
255
|
}
|
|
199
|
-
setFocused(
|
|
200
|
-
i(this,
|
|
256
|
+
setFocused(t) {
|
|
257
|
+
i(this, Z) !== t && (o(this, Z, t), this.onFocus());
|
|
201
258
|
}
|
|
202
259
|
onFocus() {
|
|
203
|
-
const
|
|
260
|
+
const t = this.isFocused();
|
|
204
261
|
this.listeners.forEach((s) => {
|
|
205
|
-
s(
|
|
262
|
+
s(t);
|
|
206
263
|
});
|
|
207
264
|
}
|
|
208
265
|
isFocused() {
|
|
209
|
-
var
|
|
210
|
-
return typeof i(this,
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
l(this, te, void 0);
|
|
218
|
-
o(this, te, (e) => {
|
|
219
|
-
if (!be && window.addEventListener) {
|
|
220
|
-
const s = () => e(!0), r = () => e(!1);
|
|
221
|
-
return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
|
|
222
|
-
window.removeEventListener("online", s), window.removeEventListener("offline", r);
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
onSubscribe() {
|
|
228
|
-
i(this, G) || this.setEventListener(i(this, te));
|
|
229
|
-
}
|
|
230
|
-
onUnsubscribe() {
|
|
231
|
-
var e;
|
|
232
|
-
this.hasListeners() || ((e = i(this, G)) == null || e.call(this), o(this, G, void 0));
|
|
233
|
-
}
|
|
234
|
-
setEventListener(e) {
|
|
235
|
-
var s;
|
|
236
|
-
o(this, te, e), (s = i(this, G)) == null || s.call(this), o(this, G, e(this.setOnline.bind(this)));
|
|
237
|
-
}
|
|
238
|
-
setOnline(e) {
|
|
239
|
-
i(this, ee) !== e && (o(this, ee, e), this.listeners.forEach((r) => {
|
|
240
|
-
r(e);
|
|
241
|
-
}));
|
|
242
|
-
}
|
|
243
|
-
isOnline() {
|
|
244
|
-
return i(this, ee);
|
|
245
|
-
}
|
|
246
|
-
}, ee = new WeakMap(), G = new WeakMap(), te = new WeakMap(), Te), ve = new at();
|
|
247
|
-
function ut() {
|
|
248
|
-
let t, e;
|
|
249
|
-
const s = new Promise((n, u) => {
|
|
250
|
-
t = n, e = u;
|
|
266
|
+
var t;
|
|
267
|
+
return typeof i(this, Z) == "boolean" ? i(this, Z) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
268
|
+
}
|
|
269
|
+
}, Z = new WeakMap(), G = new WeakMap(), rt = new WeakMap(), Nt), Wt = new me();
|
|
270
|
+
function ve() {
|
|
271
|
+
let e, t;
|
|
272
|
+
const s = new Promise((n, a) => {
|
|
273
|
+
e = n, t = a;
|
|
251
274
|
});
|
|
252
275
|
s.status = "pending", s.catch(() => {
|
|
253
276
|
});
|
|
@@ -258,360 +281,416 @@ function ut() {
|
|
|
258
281
|
r({
|
|
259
282
|
status: "fulfilled",
|
|
260
283
|
value: n
|
|
261
|
-
}),
|
|
284
|
+
}), e(n);
|
|
262
285
|
}, s.reject = (n) => {
|
|
263
286
|
r({
|
|
264
287
|
status: "rejected",
|
|
265
288
|
reason: n
|
|
266
|
-
}),
|
|
289
|
+
}), t(n);
|
|
267
290
|
}, s;
|
|
268
291
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
};
|
|
280
|
-
function Pe(t) {
|
|
281
|
-
return t instanceof _e;
|
|
282
|
-
}
|
|
283
|
-
function Ve(t) {
|
|
284
|
-
let e = !1, s = 0, r = !1, n;
|
|
285
|
-
const u = ut(), h = (c) => {
|
|
286
|
-
var p;
|
|
287
|
-
r || (y(new _e(c)), (p = t.abort) == null || p.call(t));
|
|
288
|
-
}, a = () => {
|
|
289
|
-
e = !0;
|
|
290
|
-
}, f = () => {
|
|
291
|
-
e = !1;
|
|
292
|
-
}, w = () => Ne.isFocused() && (t.networkMode === "always" || ve.isOnline()) && t.canRun(), m = () => Ge(t.networkMode) && t.canRun(), d = (c) => {
|
|
293
|
-
var p;
|
|
294
|
-
r || (r = !0, (p = t.onSuccess) == null || p.call(t, c), n == null || n(), u.resolve(c));
|
|
295
|
-
}, y = (c) => {
|
|
296
|
-
var p;
|
|
297
|
-
r || (r = !0, (p = t.onError) == null || p.call(t, c), n == null || n(), u.reject(c));
|
|
298
|
-
}, q = () => new Promise((c) => {
|
|
299
|
-
var p;
|
|
300
|
-
n = (E) => {
|
|
301
|
-
(r || w()) && c(E);
|
|
302
|
-
}, (p = t.onPause) == null || p.call(t);
|
|
303
|
-
}).then(() => {
|
|
304
|
-
var c;
|
|
305
|
-
n = void 0, r || (c = t.onContinue) == null || c.call(t);
|
|
306
|
-
}), S = () => {
|
|
307
|
-
if (r)
|
|
308
|
-
return;
|
|
309
|
-
let c;
|
|
310
|
-
const p = s === 0 ? t.initialPromise : void 0;
|
|
311
|
-
try {
|
|
312
|
-
c = p ?? t.fn();
|
|
313
|
-
} catch (E) {
|
|
314
|
-
c = Promise.reject(E);
|
|
315
|
-
}
|
|
316
|
-
Promise.resolve(c).then(d).catch((E) => {
|
|
317
|
-
var k;
|
|
318
|
-
if (r)
|
|
319
|
-
return;
|
|
320
|
-
const M = t.retry ?? (be ? 0 : 3), g = t.retryDelay ?? ot, D = typeof g == "function" ? g(s, E) : g, j = M === !0 || typeof M == "number" && s < M || typeof M == "function" && M(s, E);
|
|
321
|
-
if (e || !j) {
|
|
322
|
-
y(E);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
s++, (k = t.onFail) == null || k.call(t, s, E), tt(D).then(() => w() ? void 0 : q()).then(() => {
|
|
326
|
-
e ? y(E) : S();
|
|
327
|
-
});
|
|
292
|
+
var ge = ae;
|
|
293
|
+
function be() {
|
|
294
|
+
let e = [], t = 0, s = (u) => {
|
|
295
|
+
u();
|
|
296
|
+
}, r = (u) => {
|
|
297
|
+
u();
|
|
298
|
+
}, n = ge;
|
|
299
|
+
const a = (u) => {
|
|
300
|
+
t ? e.push(u) : n(() => {
|
|
301
|
+
s(u);
|
|
328
302
|
});
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
cancel: h,
|
|
333
|
-
continue: () => (n == null || n(), u),
|
|
334
|
-
cancelRetry: a,
|
|
335
|
-
continueRetry: f,
|
|
336
|
-
canStart: m,
|
|
337
|
-
start: () => (m() ? S() : q().then(S), u)
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function ht() {
|
|
341
|
-
let t = [], e = 0, s = (a) => {
|
|
342
|
-
a();
|
|
343
|
-
}, r = (a) => {
|
|
344
|
-
a();
|
|
345
|
-
}, n = (a) => setTimeout(a, 0);
|
|
346
|
-
const u = (a) => {
|
|
347
|
-
e ? t.push(a) : n(() => {
|
|
348
|
-
s(a);
|
|
349
|
-
});
|
|
350
|
-
}, h = () => {
|
|
351
|
-
const a = t;
|
|
352
|
-
t = [], a.length && n(() => {
|
|
303
|
+
}, l = () => {
|
|
304
|
+
const u = e;
|
|
305
|
+
e = [], u.length && n(() => {
|
|
353
306
|
r(() => {
|
|
354
|
-
|
|
307
|
+
u.forEach((f) => {
|
|
355
308
|
s(f);
|
|
356
309
|
});
|
|
357
310
|
});
|
|
358
311
|
});
|
|
359
312
|
};
|
|
360
313
|
return {
|
|
361
|
-
batch: (
|
|
314
|
+
batch: (u) => {
|
|
362
315
|
let f;
|
|
363
|
-
|
|
316
|
+
t++;
|
|
364
317
|
try {
|
|
365
|
-
f =
|
|
318
|
+
f = u();
|
|
366
319
|
} finally {
|
|
367
|
-
|
|
320
|
+
t--, t || l();
|
|
368
321
|
}
|
|
369
322
|
return f;
|
|
370
323
|
},
|
|
371
324
|
/**
|
|
372
325
|
* All calls to the wrapped function will be batched.
|
|
373
326
|
*/
|
|
374
|
-
batchCalls: (
|
|
375
|
-
|
|
376
|
-
|
|
327
|
+
batchCalls: (u) => (...f) => {
|
|
328
|
+
a(() => {
|
|
329
|
+
u(...f);
|
|
377
330
|
});
|
|
378
331
|
},
|
|
379
|
-
schedule:
|
|
332
|
+
schedule: a,
|
|
380
333
|
/**
|
|
381
334
|
* Use this method to set a custom notify function.
|
|
382
335
|
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
383
336
|
*/
|
|
384
|
-
setNotifyFunction: (
|
|
385
|
-
s =
|
|
337
|
+
setNotifyFunction: (u) => {
|
|
338
|
+
s = u;
|
|
386
339
|
},
|
|
387
340
|
/**
|
|
388
341
|
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
389
342
|
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
390
343
|
*/
|
|
391
|
-
setBatchNotifyFunction: (
|
|
392
|
-
r =
|
|
344
|
+
setBatchNotifyFunction: (u) => {
|
|
345
|
+
r = u;
|
|
393
346
|
},
|
|
394
|
-
setScheduler: (
|
|
395
|
-
n =
|
|
347
|
+
setScheduler: (u) => {
|
|
348
|
+
n = u;
|
|
396
349
|
}
|
|
397
350
|
};
|
|
398
351
|
}
|
|
399
|
-
var
|
|
352
|
+
var D = be(), it, _, nt, Ht, we = (Ht = class extends Ct {
|
|
400
353
|
constructor() {
|
|
401
|
-
|
|
354
|
+
super();
|
|
355
|
+
c(this, it, !0);
|
|
356
|
+
c(this, _, void 0);
|
|
357
|
+
c(this, nt, void 0);
|
|
358
|
+
o(this, nt, (t) => {
|
|
359
|
+
if (!Ft && window.addEventListener) {
|
|
360
|
+
const s = () => t(!0), r = () => t(!1);
|
|
361
|
+
return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
|
|
362
|
+
window.removeEventListener("online", s), window.removeEventListener("offline", r);
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
onSubscribe() {
|
|
368
|
+
i(this, _) || this.setEventListener(i(this, nt));
|
|
369
|
+
}
|
|
370
|
+
onUnsubscribe() {
|
|
371
|
+
var t;
|
|
372
|
+
this.hasListeners() || ((t = i(this, _)) == null || t.call(this), o(this, _, void 0));
|
|
373
|
+
}
|
|
374
|
+
setEventListener(t) {
|
|
375
|
+
var s;
|
|
376
|
+
o(this, nt, t), (s = i(this, _)) == null || s.call(this), o(this, _, t(this.setOnline.bind(this)));
|
|
377
|
+
}
|
|
378
|
+
setOnline(t) {
|
|
379
|
+
i(this, it) !== t && (o(this, it, t), this.listeners.forEach((r) => {
|
|
380
|
+
r(t);
|
|
381
|
+
}));
|
|
382
|
+
}
|
|
383
|
+
isOnline() {
|
|
384
|
+
return i(this, it);
|
|
385
|
+
}
|
|
386
|
+
}, it = new WeakMap(), _ = new WeakMap(), nt = new WeakMap(), Ht), Ot = new we();
|
|
387
|
+
function Pe(e) {
|
|
388
|
+
return Math.min(1e3 * 2 ** e, 3e4);
|
|
389
|
+
}
|
|
390
|
+
function Zt(e) {
|
|
391
|
+
return (e ?? "online") === "online" ? Ot.isOnline() : !0;
|
|
392
|
+
}
|
|
393
|
+
var Qt = class extends Error {
|
|
394
|
+
constructor(e) {
|
|
395
|
+
super("CancelledError"), this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
function Xt(e) {
|
|
399
|
+
let t = !1, s = 0, r;
|
|
400
|
+
const n = ve(), a = () => n.status !== "pending", l = (d) => {
|
|
401
|
+
var b;
|
|
402
|
+
if (!a()) {
|
|
403
|
+
const m = new Qt(d);
|
|
404
|
+
g(m), (b = e.onCancel) == null || b.call(e, m);
|
|
405
|
+
}
|
|
406
|
+
}, u = () => {
|
|
407
|
+
t = !0;
|
|
408
|
+
}, f = () => {
|
|
409
|
+
t = !1;
|
|
410
|
+
}, O = () => Wt.isFocused() && (e.networkMode === "always" || Ot.isOnline()) && e.canRun(), v = () => Zt(e.networkMode) && e.canRun(), C = (d) => {
|
|
411
|
+
a() || (r == null || r(), n.resolve(d));
|
|
412
|
+
}, g = (d) => {
|
|
413
|
+
a() || (r == null || r(), n.reject(d));
|
|
414
|
+
}, q = () => new Promise((d) => {
|
|
415
|
+
var b;
|
|
416
|
+
r = (m) => {
|
|
417
|
+
(a() || O()) && d(m);
|
|
418
|
+
}, (b = e.onPause) == null || b.call(e);
|
|
419
|
+
}).then(() => {
|
|
420
|
+
var d;
|
|
421
|
+
r = void 0, a() || (d = e.onContinue) == null || d.call(e);
|
|
422
|
+
}), Q = () => {
|
|
423
|
+
if (a())
|
|
424
|
+
return;
|
|
425
|
+
let d;
|
|
426
|
+
const b = s === 0 ? e.initialPromise : void 0;
|
|
427
|
+
try {
|
|
428
|
+
d = b ?? e.fn();
|
|
429
|
+
} catch (m) {
|
|
430
|
+
d = Promise.reject(m);
|
|
431
|
+
}
|
|
432
|
+
Promise.resolve(d).then(C).catch((m) => {
|
|
433
|
+
var T;
|
|
434
|
+
if (a())
|
|
435
|
+
return;
|
|
436
|
+
const A = e.retry ?? (Ft ? 0 : 3), p = e.retryDelay ?? Pe, h = typeof p == "function" ? p(s, m) : p, S = A === !0 || typeof A == "number" && s < A || typeof A == "function" && A(s, m);
|
|
437
|
+
if (t || !S) {
|
|
438
|
+
g(m);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
s++, (T = e.onFail) == null || T.call(e, s, m), de(h).then(() => O() ? void 0 : q()).then(() => {
|
|
442
|
+
t ? g(m) : Q();
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
return {
|
|
447
|
+
promise: n,
|
|
448
|
+
status: () => n.status,
|
|
449
|
+
cancel: l,
|
|
450
|
+
continue: () => (r == null || r(), n),
|
|
451
|
+
cancelRetry: u,
|
|
452
|
+
continueRetry: f,
|
|
453
|
+
canStart: v,
|
|
454
|
+
start: () => (v() ? Q() : q().then(Q), n)
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
var X, Lt, Yt = (Lt = class {
|
|
458
|
+
constructor() {
|
|
459
|
+
c(this, X, void 0);
|
|
402
460
|
}
|
|
403
461
|
destroy() {
|
|
404
462
|
this.clearGcTimeout();
|
|
405
463
|
}
|
|
406
464
|
scheduleGc() {
|
|
407
|
-
this.clearGcTimeout(),
|
|
465
|
+
this.clearGcTimeout(), ue(this.gcTime) && o(this, X, Et.setTimeout(() => {
|
|
408
466
|
this.optionalRemove();
|
|
409
467
|
}, this.gcTime));
|
|
410
468
|
}
|
|
411
|
-
updateGcTime(
|
|
469
|
+
updateGcTime(e) {
|
|
412
470
|
this.gcTime = Math.max(
|
|
413
471
|
this.gcTime || 0,
|
|
414
|
-
|
|
472
|
+
e ?? (Ft ? 1 / 0 : 5 * 60 * 1e3)
|
|
415
473
|
);
|
|
416
474
|
}
|
|
417
475
|
clearGcTimeout() {
|
|
418
|
-
i(this,
|
|
476
|
+
i(this, X) && (Et.clearTimeout(i(this, X)), o(this, X, void 0));
|
|
419
477
|
}
|
|
420
|
-
},
|
|
421
|
-
constructor(
|
|
478
|
+
}, X = new WeakMap(), Lt), Y, at, M, tt, P, pt, et, I, N, Gt, Oe = (Gt = class extends Yt {
|
|
479
|
+
constructor(t) {
|
|
422
480
|
super();
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
o(this,
|
|
481
|
+
c(this, I);
|
|
482
|
+
c(this, Y, void 0);
|
|
483
|
+
c(this, at, void 0);
|
|
484
|
+
c(this, M, void 0);
|
|
485
|
+
c(this, tt, void 0);
|
|
486
|
+
c(this, P, void 0);
|
|
487
|
+
c(this, pt, void 0);
|
|
488
|
+
c(this, et, void 0);
|
|
489
|
+
o(this, et, !1), o(this, pt, t.defaultOptions), this.setOptions(t.options), this.observers = [], o(this, tt, t.client), o(this, M, i(this, tt).getQueryCache()), this.queryKey = t.queryKey, this.queryHash = t.queryHash, o(this, Y, xt(this.options)), this.state = t.state ?? i(this, Y), this.scheduleGc();
|
|
432
490
|
}
|
|
433
491
|
get meta() {
|
|
434
492
|
return this.options.meta;
|
|
435
493
|
}
|
|
436
494
|
get promise() {
|
|
437
|
-
var
|
|
438
|
-
return (
|
|
439
|
-
}
|
|
440
|
-
setOptions(
|
|
441
|
-
this.options = { ...i(this,
|
|
495
|
+
var t;
|
|
496
|
+
return (t = i(this, P)) == null ? void 0 : t.promise;
|
|
497
|
+
}
|
|
498
|
+
setOptions(t) {
|
|
499
|
+
if (this.options = { ...i(this, pt), ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
500
|
+
const s = xt(this.options);
|
|
501
|
+
s.data !== void 0 && (this.setData(s.data, {
|
|
502
|
+
updatedAt: s.dataUpdatedAt,
|
|
503
|
+
manual: !0
|
|
504
|
+
}), o(this, Y, s));
|
|
505
|
+
}
|
|
442
506
|
}
|
|
443
507
|
optionalRemove() {
|
|
444
|
-
!this.observers.length && this.state.fetchStatus === "idle" && i(this,
|
|
508
|
+
!this.observers.length && this.state.fetchStatus === "idle" && i(this, M).remove(this);
|
|
445
509
|
}
|
|
446
|
-
setData(
|
|
447
|
-
const r =
|
|
448
|
-
return
|
|
510
|
+
setData(t, s) {
|
|
511
|
+
const r = fe(this.state.data, t, this.options);
|
|
512
|
+
return F(this, I, N).call(this, {
|
|
449
513
|
data: r,
|
|
450
514
|
type: "success",
|
|
451
515
|
dataUpdatedAt: s == null ? void 0 : s.updatedAt,
|
|
452
516
|
manual: s == null ? void 0 : s.manual
|
|
453
517
|
}), r;
|
|
454
518
|
}
|
|
455
|
-
setState(
|
|
456
|
-
|
|
519
|
+
setState(t, s) {
|
|
520
|
+
F(this, I, N).call(this, { type: "setState", state: t, setStateOptions: s });
|
|
457
521
|
}
|
|
458
|
-
cancel(
|
|
522
|
+
cancel(t) {
|
|
459
523
|
var r, n;
|
|
460
|
-
const s = (r = i(this,
|
|
461
|
-
return (n = i(this,
|
|
524
|
+
const s = (r = i(this, P)) == null ? void 0 : r.promise;
|
|
525
|
+
return (n = i(this, P)) == null || n.cancel(t), s ? s.then(R).catch(R) : Promise.resolve();
|
|
462
526
|
}
|
|
463
527
|
destroy() {
|
|
464
528
|
super.destroy(), this.cancel({ silent: !0 });
|
|
465
529
|
}
|
|
466
530
|
reset() {
|
|
467
|
-
this.destroy(), this.setState(i(this,
|
|
531
|
+
this.destroy(), this.setState(i(this, Y));
|
|
468
532
|
}
|
|
469
533
|
isActive() {
|
|
470
534
|
return this.observers.some(
|
|
471
|
-
(
|
|
535
|
+
(t) => ce(t.options.enabled, this) !== !1
|
|
472
536
|
);
|
|
473
537
|
}
|
|
474
538
|
isDisabled() {
|
|
475
|
-
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn ===
|
|
539
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Pt || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
540
|
+
}
|
|
541
|
+
isStatic() {
|
|
542
|
+
return this.getObserversCount() > 0 ? this.observers.some(
|
|
543
|
+
(t) => Dt(t.options.staleTime, this) === "static"
|
|
544
|
+
) : !1;
|
|
476
545
|
}
|
|
477
546
|
isStale() {
|
|
478
|
-
return this.
|
|
479
|
-
(
|
|
480
|
-
) : this.state.data === void 0;
|
|
547
|
+
return this.getObserversCount() > 0 ? this.observers.some(
|
|
548
|
+
(t) => t.getCurrentResult().isStale
|
|
549
|
+
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
481
550
|
}
|
|
482
|
-
isStaleByTime(
|
|
483
|
-
return this.state.
|
|
551
|
+
isStaleByTime(t = 0) {
|
|
552
|
+
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !he(this.state.dataUpdatedAt, t);
|
|
484
553
|
}
|
|
485
554
|
onFocus() {
|
|
486
555
|
var s;
|
|
487
|
-
const
|
|
488
|
-
|
|
556
|
+
const t = this.observers.find((r) => r.shouldFetchOnWindowFocus());
|
|
557
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, P)) == null || s.continue();
|
|
489
558
|
}
|
|
490
559
|
onOnline() {
|
|
491
560
|
var s;
|
|
492
|
-
const
|
|
493
|
-
|
|
561
|
+
const t = this.observers.find((r) => r.shouldFetchOnReconnect());
|
|
562
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, P)) == null || s.continue();
|
|
494
563
|
}
|
|
495
|
-
addObserver(
|
|
496
|
-
this.observers.includes(
|
|
564
|
+
addObserver(t) {
|
|
565
|
+
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), i(this, M).notify({ type: "observerAdded", query: this, observer: t }));
|
|
497
566
|
}
|
|
498
|
-
removeObserver(
|
|
499
|
-
this.observers.includes(
|
|
567
|
+
removeObserver(t) {
|
|
568
|
+
this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (i(this, P) && (i(this, et) ? i(this, P).cancel({ revert: !0 }) : i(this, P).cancelRetry()), this.scheduleGc()), i(this, M).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
500
569
|
}
|
|
501
570
|
getObserversCount() {
|
|
502
571
|
return this.observers.length;
|
|
503
572
|
}
|
|
504
573
|
invalidate() {
|
|
505
|
-
this.state.isInvalidated ||
|
|
506
|
-
}
|
|
507
|
-
fetch(
|
|
508
|
-
var f,
|
|
509
|
-
if (this.state.fetchStatus !== "idle"
|
|
574
|
+
this.state.isInvalidated || F(this, I, N).call(this, { type: "invalidate" });
|
|
575
|
+
}
|
|
576
|
+
async fetch(t, s) {
|
|
577
|
+
var f, O, v, C, g, q, Q, d, b, m, A, p;
|
|
578
|
+
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
579
|
+
// re-start the fetch; there is a chance that the query is still in a
|
|
580
|
+
// pending state when that happens
|
|
581
|
+
((f = i(this, P)) == null ? void 0 : f.status()) !== "rejected") {
|
|
510
582
|
if (this.state.data !== void 0 && (s != null && s.cancelRefetch))
|
|
511
583
|
this.cancel({ silent: !0 });
|
|
512
|
-
else if (i(this,
|
|
513
|
-
return i(this,
|
|
584
|
+
else if (i(this, P))
|
|
585
|
+
return i(this, P).continueRetry(), i(this, P).promise;
|
|
514
586
|
}
|
|
515
|
-
if (
|
|
516
|
-
const
|
|
517
|
-
|
|
587
|
+
if (t && this.setOptions(t), !this.options.queryFn) {
|
|
588
|
+
const h = this.observers.find((S) => S.options.queryFn);
|
|
589
|
+
h && this.setOptions(h.options);
|
|
518
590
|
}
|
|
519
591
|
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
520
592
|
"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']"
|
|
521
593
|
));
|
|
522
|
-
const r = new AbortController(), n = (
|
|
523
|
-
Object.defineProperty(
|
|
594
|
+
const r = new AbortController(), n = (h) => {
|
|
595
|
+
Object.defineProperty(h, "signal", {
|
|
524
596
|
enumerable: !0,
|
|
525
|
-
get: () => (o(this,
|
|
597
|
+
get: () => (o(this, et, !0), r.signal)
|
|
526
598
|
});
|
|
527
|
-
},
|
|
528
|
-
const
|
|
529
|
-
|
|
599
|
+
}, a = () => {
|
|
600
|
+
const h = Jt(this.options, s), T = (() => {
|
|
601
|
+
const B = {
|
|
602
|
+
client: i(this, tt),
|
|
603
|
+
queryKey: this.queryKey,
|
|
604
|
+
meta: this.meta
|
|
605
|
+
};
|
|
606
|
+
return n(B), B;
|
|
607
|
+
})();
|
|
608
|
+
return o(this, et, !1), this.options.persister ? this.options.persister(
|
|
609
|
+
h,
|
|
610
|
+
T,
|
|
611
|
+
this
|
|
612
|
+
) : h(T);
|
|
613
|
+
}, u = (() => {
|
|
614
|
+
const h = {
|
|
615
|
+
fetchOptions: s,
|
|
616
|
+
options: this.options,
|
|
530
617
|
queryKey: this.queryKey,
|
|
531
|
-
|
|
618
|
+
client: i(this, tt),
|
|
619
|
+
state: this.state,
|
|
620
|
+
fetchFn: a
|
|
532
621
|
};
|
|
533
|
-
return n(
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
this
|
|
537
|
-
) : d(y);
|
|
538
|
-
}, h = {
|
|
539
|
-
fetchOptions: s,
|
|
540
|
-
options: this.options,
|
|
541
|
-
queryKey: this.queryKey,
|
|
542
|
-
client: i(this, W),
|
|
543
|
-
state: this.state,
|
|
544
|
-
fetchFn: u
|
|
545
|
-
};
|
|
546
|
-
n(h), (f = this.options.behavior) == null || f.onFetch(
|
|
547
|
-
h,
|
|
548
|
-
this
|
|
549
|
-
), o(this, re, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((w = h.fetchOptions) == null ? void 0 : w.meta)) && P(this, R, x).call(this, { type: "fetch", meta: (m = h.fetchOptions) == null ? void 0 : m.meta });
|
|
550
|
-
const a = (d) => {
|
|
551
|
-
var y, q, S, c;
|
|
552
|
-
Pe(d) && d.silent || P(this, R, x).call(this, {
|
|
553
|
-
type: "error",
|
|
554
|
-
error: d
|
|
555
|
-
}), Pe(d) || ((q = (y = i(this, A).config).onError) == null || q.call(
|
|
556
|
-
y,
|
|
557
|
-
d,
|
|
558
|
-
this
|
|
559
|
-
), (c = (S = i(this, A).config).onSettled) == null || c.call(
|
|
560
|
-
S,
|
|
561
|
-
this.state.data,
|
|
562
|
-
d,
|
|
563
|
-
this
|
|
564
|
-
)), this.scheduleGc();
|
|
565
|
-
};
|
|
566
|
-
return o(this, O, Ve({
|
|
622
|
+
return n(h), h;
|
|
623
|
+
})();
|
|
624
|
+
(O = this.options.behavior) == null || O.onFetch(u, this), o(this, at, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((v = u.fetchOptions) == null ? void 0 : v.meta)) && F(this, I, N).call(this, { type: "fetch", meta: (C = u.fetchOptions) == null ? void 0 : C.meta }), o(this, P, Xt({
|
|
567
625
|
initialPromise: s == null ? void 0 : s.initialPromise,
|
|
568
|
-
fn:
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
575
|
-
), a(new Error(`${this.queryHash} data is undefined`));
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
try {
|
|
579
|
-
this.setData(d);
|
|
580
|
-
} catch (p) {
|
|
581
|
-
a(p);
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
(q = (y = i(this, A).config).onSuccess) == null || q.call(y, d, this), (c = (S = i(this, A).config).onSettled) == null || c.call(
|
|
585
|
-
S,
|
|
586
|
-
d,
|
|
587
|
-
this.state.error,
|
|
588
|
-
this
|
|
589
|
-
), this.scheduleGc();
|
|
626
|
+
fn: u.fetchFn,
|
|
627
|
+
onCancel: (h) => {
|
|
628
|
+
h instanceof Qt && h.revert && this.setState({
|
|
629
|
+
...i(this, at),
|
|
630
|
+
fetchStatus: "idle"
|
|
631
|
+
}), r.abort();
|
|
590
632
|
},
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
P(this, R, x).call(this, { type: "failed", failureCount: d, error: y });
|
|
633
|
+
onFail: (h, S) => {
|
|
634
|
+
F(this, I, N).call(this, { type: "failed", failureCount: h, error: S });
|
|
594
635
|
},
|
|
595
636
|
onPause: () => {
|
|
596
|
-
|
|
637
|
+
F(this, I, N).call(this, { type: "pause" });
|
|
597
638
|
},
|
|
598
639
|
onContinue: () => {
|
|
599
|
-
|
|
640
|
+
F(this, I, N).call(this, { type: "continue" });
|
|
600
641
|
},
|
|
601
|
-
retry:
|
|
602
|
-
retryDelay:
|
|
603
|
-
networkMode:
|
|
642
|
+
retry: u.options.retry,
|
|
643
|
+
retryDelay: u.options.retryDelay,
|
|
644
|
+
networkMode: u.options.networkMode,
|
|
604
645
|
canRun: () => !0
|
|
605
|
-
}))
|
|
646
|
+
}));
|
|
647
|
+
try {
|
|
648
|
+
const h = await i(this, P).start();
|
|
649
|
+
if (h === void 0)
|
|
650
|
+
throw process.env.NODE_ENV !== "production" && console.error(
|
|
651
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
652
|
+
), new Error(`${this.queryHash} data is undefined`);
|
|
653
|
+
return this.setData(h), (q = (g = i(this, M).config).onSuccess) == null || q.call(g, h, this), (d = (Q = i(this, M).config).onSettled) == null || d.call(
|
|
654
|
+
Q,
|
|
655
|
+
h,
|
|
656
|
+
this.state.error,
|
|
657
|
+
this
|
|
658
|
+
), h;
|
|
659
|
+
} catch (h) {
|
|
660
|
+
if (h instanceof Qt) {
|
|
661
|
+
if (h.silent)
|
|
662
|
+
return i(this, P).promise;
|
|
663
|
+
if (h.revert) {
|
|
664
|
+
if (this.state.data === void 0)
|
|
665
|
+
throw h;
|
|
666
|
+
return this.state.data;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
throw F(this, I, N).call(this, {
|
|
670
|
+
type: "error",
|
|
671
|
+
error: h
|
|
672
|
+
}), (m = (b = i(this, M).config).onError) == null || m.call(
|
|
673
|
+
b,
|
|
674
|
+
h,
|
|
675
|
+
this
|
|
676
|
+
), (p = (A = i(this, M).config).onSettled) == null || p.call(
|
|
677
|
+
A,
|
|
678
|
+
this.state.data,
|
|
679
|
+
h,
|
|
680
|
+
this
|
|
681
|
+
), h;
|
|
682
|
+
} finally {
|
|
683
|
+
this.scheduleGc();
|
|
684
|
+
}
|
|
606
685
|
}
|
|
607
|
-
},
|
|
686
|
+
}, Y = new WeakMap(), at = new WeakMap(), M = new WeakMap(), tt = new WeakMap(), P = new WeakMap(), pt = new WeakMap(), et = new WeakMap(), I = new WeakSet(), N = function(t) {
|
|
608
687
|
const s = (r) => {
|
|
609
|
-
switch (
|
|
688
|
+
switch (t.type) {
|
|
610
689
|
case "failed":
|
|
611
690
|
return {
|
|
612
691
|
...r,
|
|
613
|
-
fetchFailureCount:
|
|
614
|
-
fetchFailureReason:
|
|
692
|
+
fetchFailureCount: t.failureCount,
|
|
693
|
+
fetchFailureReason: t.error
|
|
615
694
|
};
|
|
616
695
|
case "pause":
|
|
617
696
|
return {
|
|
@@ -626,33 +705,34 @@ var C = ht(), J, je, $e = (je = class {
|
|
|
626
705
|
case "fetch":
|
|
627
706
|
return {
|
|
628
707
|
...r,
|
|
629
|
-
...
|
|
630
|
-
fetchMeta:
|
|
708
|
+
...Ce(r.data, this.options),
|
|
709
|
+
fetchMeta: t.meta ?? null
|
|
631
710
|
};
|
|
632
711
|
case "success":
|
|
633
|
-
|
|
712
|
+
const n = {
|
|
634
713
|
...r,
|
|
635
|
-
data:
|
|
714
|
+
data: t.data,
|
|
636
715
|
dataUpdateCount: r.dataUpdateCount + 1,
|
|
637
|
-
dataUpdatedAt:
|
|
716
|
+
dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
|
|
638
717
|
error: null,
|
|
639
718
|
isInvalidated: !1,
|
|
640
719
|
status: "success",
|
|
641
|
-
...!
|
|
720
|
+
...!t.manual && {
|
|
642
721
|
fetchStatus: "idle",
|
|
643
722
|
fetchFailureCount: 0,
|
|
644
723
|
fetchFailureReason: null
|
|
645
724
|
}
|
|
646
725
|
};
|
|
726
|
+
return o(this, at, t.manual ? n : void 0), n;
|
|
647
727
|
case "error":
|
|
648
|
-
const
|
|
649
|
-
return
|
|
728
|
+
const a = t.error;
|
|
729
|
+
return {
|
|
650
730
|
...r,
|
|
651
|
-
error:
|
|
731
|
+
error: a,
|
|
652
732
|
errorUpdateCount: r.errorUpdateCount + 1,
|
|
653
733
|
errorUpdatedAt: Date.now(),
|
|
654
734
|
fetchFailureCount: r.fetchFailureCount + 1,
|
|
655
|
-
fetchFailureReason:
|
|
735
|
+
fetchFailureReason: a,
|
|
656
736
|
fetchStatus: "idle",
|
|
657
737
|
status: "error"
|
|
658
738
|
};
|
|
@@ -664,31 +744,31 @@ var C = ht(), J, je, $e = (je = class {
|
|
|
664
744
|
case "setState":
|
|
665
745
|
return {
|
|
666
746
|
...r,
|
|
667
|
-
...
|
|
747
|
+
...t.state
|
|
668
748
|
};
|
|
669
749
|
}
|
|
670
750
|
};
|
|
671
|
-
this.state = s(this.state),
|
|
751
|
+
this.state = s(this.state), D.batch(() => {
|
|
672
752
|
this.observers.forEach((r) => {
|
|
673
753
|
r.onQueryUpdate();
|
|
674
|
-
}), i(this,
|
|
754
|
+
}), i(this, M).notify({ query: this, type: "updated", action: t });
|
|
675
755
|
});
|
|
676
|
-
},
|
|
677
|
-
function
|
|
756
|
+
}, Gt);
|
|
757
|
+
function Ce(e, t) {
|
|
678
758
|
return {
|
|
679
759
|
fetchFailureCount: 0,
|
|
680
760
|
fetchFailureReason: null,
|
|
681
|
-
fetchStatus:
|
|
682
|
-
...
|
|
761
|
+
fetchStatus: Zt(t.networkMode) ? "fetching" : "paused",
|
|
762
|
+
...e === void 0 && {
|
|
683
763
|
error: null,
|
|
684
764
|
status: "pending"
|
|
685
765
|
}
|
|
686
766
|
};
|
|
687
767
|
}
|
|
688
|
-
function
|
|
689
|
-
const
|
|
768
|
+
function xt(e) {
|
|
769
|
+
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
690
770
|
return {
|
|
691
|
-
data:
|
|
771
|
+
data: t,
|
|
692
772
|
dataUpdateCount: 0,
|
|
693
773
|
dataUpdatedAt: s ? r ?? Date.now() : 0,
|
|
694
774
|
error: null,
|
|
@@ -702,206 +782,248 @@ function dt(t) {
|
|
|
702
782
|
fetchStatus: "idle"
|
|
703
783
|
};
|
|
704
784
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
785
|
+
function kt(e) {
|
|
786
|
+
return {
|
|
787
|
+
onFetch: (t, s) => {
|
|
788
|
+
var v, C, g, q, Q;
|
|
789
|
+
const r = t.options, n = (g = (C = (v = t.fetchOptions) == null ? void 0 : v.meta) == null ? void 0 : C.fetchMore) == null ? void 0 : g.direction, a = ((q = t.state.data) == null ? void 0 : q.pages) || [], l = ((Q = t.state.data) == null ? void 0 : Q.pageParams) || [];
|
|
790
|
+
let u = { pages: [], pageParams: [] }, f = 0;
|
|
791
|
+
const O = async () => {
|
|
792
|
+
let d = !1;
|
|
793
|
+
const b = (p) => {
|
|
794
|
+
Object.defineProperty(p, "signal", {
|
|
795
|
+
enumerable: !0,
|
|
796
|
+
get: () => (t.signal.aborted ? d = !0 : t.signal.addEventListener("abort", () => {
|
|
797
|
+
d = !0;
|
|
798
|
+
}), t.signal)
|
|
799
|
+
});
|
|
800
|
+
}, m = Jt(t.options, t.fetchOptions), A = async (p, h, S) => {
|
|
801
|
+
if (d)
|
|
802
|
+
return Promise.reject();
|
|
803
|
+
if (h == null && p.pages.length)
|
|
804
|
+
return Promise.resolve(p);
|
|
805
|
+
const B = (() => {
|
|
806
|
+
const J = {
|
|
807
|
+
client: t.client,
|
|
808
|
+
queryKey: t.queryKey,
|
|
809
|
+
pageParam: h,
|
|
810
|
+
direction: S ? "backward" : "forward",
|
|
811
|
+
meta: t.options.meta
|
|
812
|
+
};
|
|
813
|
+
return b(J), J;
|
|
814
|
+
})(), gt = await m(B), { maxPages: lt } = t.options, w = S ? pe : ye;
|
|
815
|
+
return {
|
|
816
|
+
pages: w(p.pages, gt, lt),
|
|
817
|
+
pageParams: w(p.pageParams, h, lt)
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
if (n && a.length) {
|
|
821
|
+
const p = n === "backward", h = p ? Fe : Kt, S = {
|
|
822
|
+
pages: a,
|
|
823
|
+
pageParams: l
|
|
824
|
+
}, T = h(r, S);
|
|
825
|
+
u = await A(S, T, p);
|
|
826
|
+
} else {
|
|
827
|
+
const p = e ?? a.length;
|
|
828
|
+
do {
|
|
829
|
+
const h = f === 0 ? l[0] ?? r.initialPageParam : Kt(r, u);
|
|
830
|
+
if (f > 0 && h == null)
|
|
831
|
+
break;
|
|
832
|
+
u = await A(u, h), f++;
|
|
833
|
+
} while (f < p);
|
|
834
|
+
}
|
|
835
|
+
return u;
|
|
836
|
+
};
|
|
837
|
+
t.options.persister ? t.fetchFn = () => {
|
|
838
|
+
var d, b;
|
|
839
|
+
return (b = (d = t.options).persister) == null ? void 0 : b.call(
|
|
840
|
+
d,
|
|
841
|
+
O,
|
|
842
|
+
{
|
|
843
|
+
client: t.client,
|
|
844
|
+
queryKey: t.queryKey,
|
|
845
|
+
meta: t.options.meta,
|
|
846
|
+
signal: t.signal
|
|
847
|
+
},
|
|
848
|
+
s
|
|
849
|
+
);
|
|
850
|
+
} : t.fetchFn = O;
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
function Kt(e, { pages: t, pageParams: s }) {
|
|
855
|
+
const r = t.length - 1;
|
|
856
|
+
return t.length > 0 ? e.getNextPageParam(
|
|
857
|
+
t[r],
|
|
858
|
+
t,
|
|
859
|
+
s[r],
|
|
860
|
+
s
|
|
861
|
+
) : void 0;
|
|
862
|
+
}
|
|
863
|
+
function Fe(e, { pages: t, pageParams: s }) {
|
|
864
|
+
var r;
|
|
865
|
+
return t.length > 0 ? (r = e.getPreviousPageParam) == null ? void 0 : r.call(e, t[0], t, s[0], s) : void 0;
|
|
866
|
+
}
|
|
867
|
+
var mt, k, E, st, K, L, _t, Se = (_t = class extends Yt {
|
|
868
|
+
constructor(t) {
|
|
779
869
|
super();
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
870
|
+
c(this, K);
|
|
871
|
+
c(this, mt, void 0);
|
|
872
|
+
c(this, k, void 0);
|
|
873
|
+
c(this, E, void 0);
|
|
874
|
+
c(this, st, void 0);
|
|
875
|
+
o(this, mt, t.client), this.mutationId = t.mutationId, o(this, E, t.mutationCache), o(this, k, []), this.state = t.state || Ee(), this.setOptions(t.options), this.scheduleGc();
|
|
785
876
|
}
|
|
786
|
-
setOptions(
|
|
787
|
-
this.options =
|
|
877
|
+
setOptions(t) {
|
|
878
|
+
this.options = t, this.updateGcTime(this.options.gcTime);
|
|
788
879
|
}
|
|
789
880
|
get meta() {
|
|
790
881
|
return this.options.meta;
|
|
791
882
|
}
|
|
792
|
-
addObserver(
|
|
793
|
-
i(this,
|
|
883
|
+
addObserver(t) {
|
|
884
|
+
i(this, k).includes(t) || (i(this, k).push(t), this.clearGcTimeout(), i(this, E).notify({
|
|
794
885
|
type: "observerAdded",
|
|
795
886
|
mutation: this,
|
|
796
|
-
observer:
|
|
887
|
+
observer: t
|
|
797
888
|
}));
|
|
798
889
|
}
|
|
799
|
-
removeObserver(
|
|
800
|
-
o(this,
|
|
890
|
+
removeObserver(t) {
|
|
891
|
+
o(this, k, i(this, k).filter((s) => s !== t)), this.scheduleGc(), i(this, E).notify({
|
|
801
892
|
type: "observerRemoved",
|
|
802
893
|
mutation: this,
|
|
803
|
-
observer:
|
|
894
|
+
observer: t
|
|
804
895
|
});
|
|
805
896
|
}
|
|
806
897
|
optionalRemove() {
|
|
807
|
-
i(this,
|
|
898
|
+
i(this, k).length || (this.state.status === "pending" ? this.scheduleGc() : i(this, E).remove(this));
|
|
808
899
|
}
|
|
809
900
|
continue() {
|
|
810
|
-
var
|
|
811
|
-
return ((
|
|
901
|
+
var t;
|
|
902
|
+
return ((t = i(this, st)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
812
903
|
this.execute(this.state.variables);
|
|
813
904
|
}
|
|
814
|
-
async execute(
|
|
815
|
-
var
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
905
|
+
async execute(t) {
|
|
906
|
+
var l, u, f, O, v, C, g, q, Q, d, b, m, A, p, h, S, T, B, gt, lt;
|
|
907
|
+
const s = () => {
|
|
908
|
+
F(this, K, L).call(this, { type: "continue" });
|
|
909
|
+
}, r = {
|
|
910
|
+
client: i(this, mt),
|
|
911
|
+
meta: this.options.meta,
|
|
912
|
+
mutationKey: this.options.mutationKey
|
|
913
|
+
};
|
|
914
|
+
o(this, st, Xt({
|
|
915
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(t, r) : Promise.reject(new Error("No mutationFn found")),
|
|
916
|
+
onFail: (w, J) => {
|
|
917
|
+
F(this, K, L).call(this, { type: "failed", failureCount: w, error: J });
|
|
820
918
|
},
|
|
821
919
|
onPause: () => {
|
|
822
|
-
|
|
823
|
-
},
|
|
824
|
-
onContinue: () => {
|
|
825
|
-
P(this, I, L).call(this, { type: "continue" });
|
|
920
|
+
F(this, K, L).call(this, { type: "pause" });
|
|
826
921
|
},
|
|
922
|
+
onContinue: s,
|
|
827
923
|
retry: this.options.retry ?? 0,
|
|
828
924
|
retryDelay: this.options.retryDelay,
|
|
829
925
|
networkMode: this.options.networkMode,
|
|
830
|
-
canRun: () => i(this,
|
|
926
|
+
canRun: () => i(this, E).canRun(this)
|
|
831
927
|
}));
|
|
832
|
-
const
|
|
928
|
+
const n = this.state.status === "pending", a = !i(this, st).canStart();
|
|
833
929
|
try {
|
|
834
|
-
if (
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
930
|
+
if (n)
|
|
931
|
+
s();
|
|
932
|
+
else {
|
|
933
|
+
F(this, K, L).call(this, { type: "pending", variables: t, isPaused: a }), await ((u = (l = i(this, E).config).onMutate) == null ? void 0 : u.call(
|
|
934
|
+
l,
|
|
935
|
+
t,
|
|
936
|
+
this,
|
|
937
|
+
r
|
|
938
|
+
));
|
|
939
|
+
const J = await ((O = (f = this.options).onMutate) == null ? void 0 : O.call(
|
|
940
|
+
f,
|
|
941
|
+
t,
|
|
942
|
+
r
|
|
839
943
|
));
|
|
840
|
-
|
|
841
|
-
z !== this.state.context && P(this, I, L).call(this, {
|
|
944
|
+
J !== this.state.context && F(this, K, L).call(this, {
|
|
842
945
|
type: "pending",
|
|
843
|
-
context:
|
|
844
|
-
variables:
|
|
845
|
-
isPaused:
|
|
946
|
+
context: J,
|
|
947
|
+
variables: t,
|
|
948
|
+
isPaused: a
|
|
846
949
|
});
|
|
847
950
|
}
|
|
848
|
-
const
|
|
849
|
-
return await ((
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
951
|
+
const w = await i(this, st).start();
|
|
952
|
+
return await ((C = (v = i(this, E).config).onSuccess) == null ? void 0 : C.call(
|
|
953
|
+
v,
|
|
954
|
+
w,
|
|
955
|
+
t,
|
|
853
956
|
this.state.context,
|
|
854
|
-
this
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
957
|
+
this,
|
|
958
|
+
r
|
|
959
|
+
)), await ((q = (g = this.options).onSuccess) == null ? void 0 : q.call(
|
|
960
|
+
g,
|
|
961
|
+
w,
|
|
962
|
+
t,
|
|
963
|
+
this.state.context,
|
|
964
|
+
r
|
|
965
|
+
)), await ((d = (Q = i(this, E).config).onSettled) == null ? void 0 : d.call(
|
|
966
|
+
Q,
|
|
967
|
+
w,
|
|
858
968
|
null,
|
|
859
969
|
this.state.variables,
|
|
860
970
|
this.state.context,
|
|
861
|
-
this
|
|
862
|
-
|
|
863
|
-
|
|
971
|
+
this,
|
|
972
|
+
r
|
|
973
|
+
)), await ((m = (b = this.options).onSettled) == null ? void 0 : m.call(
|
|
974
|
+
b,
|
|
975
|
+
w,
|
|
976
|
+
null,
|
|
977
|
+
t,
|
|
978
|
+
this.state.context,
|
|
979
|
+
r
|
|
980
|
+
)), F(this, K, L).call(this, { type: "success", data: w }), w;
|
|
981
|
+
} catch (w) {
|
|
864
982
|
try {
|
|
865
|
-
throw await ((
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
983
|
+
throw await ((p = (A = i(this, E).config).onError) == null ? void 0 : p.call(
|
|
984
|
+
A,
|
|
985
|
+
w,
|
|
986
|
+
t,
|
|
869
987
|
this.state.context,
|
|
870
|
-
this
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
988
|
+
this,
|
|
989
|
+
r
|
|
990
|
+
)), await ((S = (h = this.options).onError) == null ? void 0 : S.call(
|
|
991
|
+
h,
|
|
992
|
+
w,
|
|
993
|
+
t,
|
|
994
|
+
this.state.context,
|
|
995
|
+
r
|
|
996
|
+
)), await ((B = (T = i(this, E).config).onSettled) == null ? void 0 : B.call(
|
|
997
|
+
T,
|
|
878
998
|
void 0,
|
|
879
|
-
|
|
999
|
+
w,
|
|
880
1000
|
this.state.variables,
|
|
881
1001
|
this.state.context,
|
|
882
|
-
this
|
|
883
|
-
|
|
884
|
-
|
|
1002
|
+
this,
|
|
1003
|
+
r
|
|
1004
|
+
)), await ((lt = (gt = this.options).onSettled) == null ? void 0 : lt.call(
|
|
1005
|
+
gt,
|
|
885
1006
|
void 0,
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
this.state.context
|
|
889
|
-
|
|
1007
|
+
w,
|
|
1008
|
+
t,
|
|
1009
|
+
this.state.context,
|
|
1010
|
+
r
|
|
1011
|
+
)), w;
|
|
890
1012
|
} finally {
|
|
891
|
-
|
|
1013
|
+
F(this, K, L).call(this, { type: "error", error: w });
|
|
892
1014
|
}
|
|
893
1015
|
} finally {
|
|
894
|
-
i(this,
|
|
1016
|
+
i(this, E).runNext(this);
|
|
895
1017
|
}
|
|
896
1018
|
}
|
|
897
|
-
},
|
|
1019
|
+
}, mt = new WeakMap(), k = new WeakMap(), E = new WeakMap(), st = new WeakMap(), K = new WeakSet(), L = function(t) {
|
|
898
1020
|
const s = (r) => {
|
|
899
|
-
switch (
|
|
1021
|
+
switch (t.type) {
|
|
900
1022
|
case "failed":
|
|
901
1023
|
return {
|
|
902
1024
|
...r,
|
|
903
|
-
failureCount:
|
|
904
|
-
failureReason:
|
|
1025
|
+
failureCount: t.failureCount,
|
|
1026
|
+
failureReason: t.error
|
|
905
1027
|
};
|
|
906
1028
|
case "pause":
|
|
907
1029
|
return {
|
|
@@ -916,20 +1038,20 @@ var U, Ue, ft = (Ue = class extends ge {
|
|
|
916
1038
|
case "pending":
|
|
917
1039
|
return {
|
|
918
1040
|
...r,
|
|
919
|
-
context:
|
|
1041
|
+
context: t.context,
|
|
920
1042
|
data: void 0,
|
|
921
1043
|
failureCount: 0,
|
|
922
1044
|
failureReason: null,
|
|
923
1045
|
error: null,
|
|
924
|
-
isPaused:
|
|
1046
|
+
isPaused: t.isPaused,
|
|
925
1047
|
status: "pending",
|
|
926
|
-
variables:
|
|
1048
|
+
variables: t.variables,
|
|
927
1049
|
submittedAt: Date.now()
|
|
928
1050
|
};
|
|
929
1051
|
case "success":
|
|
930
1052
|
return {
|
|
931
1053
|
...r,
|
|
932
|
-
data:
|
|
1054
|
+
data: t.data,
|
|
933
1055
|
failureCount: 0,
|
|
934
1056
|
failureReason: null,
|
|
935
1057
|
error: null,
|
|
@@ -940,25 +1062,25 @@ var U, Ue, ft = (Ue = class extends ge {
|
|
|
940
1062
|
return {
|
|
941
1063
|
...r,
|
|
942
1064
|
data: void 0,
|
|
943
|
-
error:
|
|
1065
|
+
error: t.error,
|
|
944
1066
|
failureCount: r.failureCount + 1,
|
|
945
|
-
failureReason:
|
|
1067
|
+
failureReason: t.error,
|
|
946
1068
|
isPaused: !1,
|
|
947
1069
|
status: "error"
|
|
948
1070
|
};
|
|
949
1071
|
}
|
|
950
1072
|
};
|
|
951
|
-
this.state = s(this.state),
|
|
952
|
-
i(this,
|
|
953
|
-
r.onMutationUpdate(
|
|
954
|
-
}), i(this,
|
|
1073
|
+
this.state = s(this.state), D.batch(() => {
|
|
1074
|
+
i(this, k).forEach((r) => {
|
|
1075
|
+
r.onMutationUpdate(t);
|
|
1076
|
+
}), i(this, E).notify({
|
|
955
1077
|
mutation: this,
|
|
956
1078
|
type: "updated",
|
|
957
|
-
action:
|
|
1079
|
+
action: t
|
|
958
1080
|
});
|
|
959
1081
|
});
|
|
960
|
-
},
|
|
961
|
-
function
|
|
1082
|
+
}, _t);
|
|
1083
|
+
function Ee() {
|
|
962
1084
|
return {
|
|
963
1085
|
context: void 0,
|
|
964
1086
|
data: void 0,
|
|
@@ -971,399 +1093,396 @@ function pt() {
|
|
|
971
1093
|
submittedAt: 0
|
|
972
1094
|
};
|
|
973
1095
|
}
|
|
974
|
-
var H,
|
|
975
|
-
constructor(
|
|
1096
|
+
var H, j, vt, Vt, De = (Vt = class extends Ct {
|
|
1097
|
+
constructor(t = {}) {
|
|
976
1098
|
super();
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
this.config =
|
|
981
|
-
}
|
|
982
|
-
build(
|
|
983
|
-
const n = new
|
|
1099
|
+
c(this, H, void 0);
|
|
1100
|
+
c(this, j, void 0);
|
|
1101
|
+
c(this, vt, void 0);
|
|
1102
|
+
this.config = t, o(this, H, /* @__PURE__ */ new Set()), o(this, j, /* @__PURE__ */ new Map()), o(this, vt, 0);
|
|
1103
|
+
}
|
|
1104
|
+
build(t, s, r) {
|
|
1105
|
+
const n = new Se({
|
|
1106
|
+
client: t,
|
|
984
1107
|
mutationCache: this,
|
|
985
|
-
mutationId: ++
|
|
986
|
-
options:
|
|
1108
|
+
mutationId: ++bt(this, vt)._,
|
|
1109
|
+
options: t.defaultMutationOptions(s),
|
|
987
1110
|
state: r
|
|
988
1111
|
});
|
|
989
1112
|
return this.add(n), n;
|
|
990
1113
|
}
|
|
991
|
-
add(
|
|
992
|
-
i(this, H).add(
|
|
993
|
-
const s =
|
|
1114
|
+
add(t) {
|
|
1115
|
+
i(this, H).add(t);
|
|
1116
|
+
const s = wt(t);
|
|
994
1117
|
if (typeof s == "string") {
|
|
995
|
-
const r = i(this,
|
|
996
|
-
r ? r.push(
|
|
1118
|
+
const r = i(this, j).get(s);
|
|
1119
|
+
r ? r.push(t) : i(this, j).set(s, [t]);
|
|
997
1120
|
}
|
|
998
|
-
this.notify({ type: "added", mutation:
|
|
1121
|
+
this.notify({ type: "added", mutation: t });
|
|
999
1122
|
}
|
|
1000
|
-
remove(
|
|
1001
|
-
if (i(this, H).delete(
|
|
1002
|
-
const s =
|
|
1123
|
+
remove(t) {
|
|
1124
|
+
if (i(this, H).delete(t)) {
|
|
1125
|
+
const s = wt(t);
|
|
1003
1126
|
if (typeof s == "string") {
|
|
1004
|
-
const r = i(this,
|
|
1127
|
+
const r = i(this, j).get(s);
|
|
1005
1128
|
if (r)
|
|
1006
1129
|
if (r.length > 1) {
|
|
1007
|
-
const n = r.indexOf(
|
|
1130
|
+
const n = r.indexOf(t);
|
|
1008
1131
|
n !== -1 && r.splice(n, 1);
|
|
1009
1132
|
} else
|
|
1010
|
-
r[0] ===
|
|
1133
|
+
r[0] === t && i(this, j).delete(s);
|
|
1011
1134
|
}
|
|
1012
1135
|
}
|
|
1013
|
-
this.notify({ type: "removed", mutation:
|
|
1136
|
+
this.notify({ type: "removed", mutation: t });
|
|
1014
1137
|
}
|
|
1015
|
-
canRun(
|
|
1016
|
-
const s =
|
|
1138
|
+
canRun(t) {
|
|
1139
|
+
const s = wt(t);
|
|
1017
1140
|
if (typeof s == "string") {
|
|
1018
|
-
const r = i(this,
|
|
1019
|
-
(
|
|
1141
|
+
const r = i(this, j).get(s), n = r == null ? void 0 : r.find(
|
|
1142
|
+
(a) => a.state.status === "pending"
|
|
1020
1143
|
);
|
|
1021
|
-
return !n || n ===
|
|
1144
|
+
return !n || n === t;
|
|
1022
1145
|
} else
|
|
1023
1146
|
return !0;
|
|
1024
1147
|
}
|
|
1025
|
-
runNext(
|
|
1148
|
+
runNext(t) {
|
|
1026
1149
|
var r;
|
|
1027
|
-
const s =
|
|
1150
|
+
const s = wt(t);
|
|
1028
1151
|
if (typeof s == "string") {
|
|
1029
|
-
const n = (r = i(this,
|
|
1152
|
+
const n = (r = i(this, j).get(s)) == null ? void 0 : r.find((a) => a !== t && a.state.isPaused);
|
|
1030
1153
|
return (n == null ? void 0 : n.continue()) ?? Promise.resolve();
|
|
1031
1154
|
} else
|
|
1032
1155
|
return Promise.resolve();
|
|
1033
1156
|
}
|
|
1034
1157
|
clear() {
|
|
1035
|
-
|
|
1036
|
-
i(this, H).forEach((
|
|
1037
|
-
this.notify({ type: "removed", mutation:
|
|
1038
|
-
}), i(this, H).clear(), i(this,
|
|
1158
|
+
D.batch(() => {
|
|
1159
|
+
i(this, H).forEach((t) => {
|
|
1160
|
+
this.notify({ type: "removed", mutation: t });
|
|
1161
|
+
}), i(this, H).clear(), i(this, j).clear();
|
|
1039
1162
|
});
|
|
1040
1163
|
}
|
|
1041
1164
|
getAll() {
|
|
1042
1165
|
return Array.from(i(this, H));
|
|
1043
1166
|
}
|
|
1044
|
-
find(
|
|
1045
|
-
const s = { exact: !0, ...
|
|
1167
|
+
find(t) {
|
|
1168
|
+
const s = { exact: !0, ...t };
|
|
1046
1169
|
return this.getAll().find(
|
|
1047
|
-
(r) =>
|
|
1170
|
+
(r) => Rt(s, r)
|
|
1048
1171
|
);
|
|
1049
1172
|
}
|
|
1050
|
-
findAll(
|
|
1051
|
-
return this.getAll().filter((s) =>
|
|
1173
|
+
findAll(t = {}) {
|
|
1174
|
+
return this.getAll().filter((s) => Rt(t, s));
|
|
1052
1175
|
}
|
|
1053
|
-
notify(
|
|
1054
|
-
|
|
1176
|
+
notify(t) {
|
|
1177
|
+
D.batch(() => {
|
|
1055
1178
|
this.listeners.forEach((s) => {
|
|
1056
|
-
s(
|
|
1179
|
+
s(t);
|
|
1057
1180
|
});
|
|
1058
1181
|
});
|
|
1059
1182
|
}
|
|
1060
1183
|
resumePausedMutations() {
|
|
1061
|
-
const
|
|
1062
|
-
return
|
|
1184
|
+
const t = this.getAll().filter((s) => s.state.isPaused);
|
|
1185
|
+
return D.batch(
|
|
1063
1186
|
() => Promise.all(
|
|
1064
|
-
|
|
1187
|
+
t.map((s) => s.continue().catch(R))
|
|
1065
1188
|
)
|
|
1066
1189
|
);
|
|
1067
1190
|
}
|
|
1068
|
-
}, H = new WeakMap(),
|
|
1069
|
-
function
|
|
1070
|
-
var
|
|
1071
|
-
return (
|
|
1191
|
+
}, H = new WeakMap(), j = new WeakMap(), vt = new WeakMap(), Vt);
|
|
1192
|
+
function wt(e) {
|
|
1193
|
+
var t;
|
|
1194
|
+
return (t = e.options.scope) == null ? void 0 : t.id;
|
|
1072
1195
|
}
|
|
1073
|
-
|
|
1074
|
-
return {
|
|
1075
|
-
onFetch: (e, s) => {
|
|
1076
|
-
var m, d, y, q, S;
|
|
1077
|
-
const r = e.options, n = (y = (d = (m = e.fetchOptions) == null ? void 0 : m.meta) == null ? void 0 : d.fetchMore) == null ? void 0 : y.direction, u = ((q = e.state.data) == null ? void 0 : q.pages) || [], h = ((S = e.state.data) == null ? void 0 : S.pageParams) || [];
|
|
1078
|
-
let a = { pages: [], pageParams: [] }, f = 0;
|
|
1079
|
-
const w = async () => {
|
|
1080
|
-
let c = !1;
|
|
1081
|
-
const p = (g) => {
|
|
1082
|
-
Object.defineProperty(g, "signal", {
|
|
1083
|
-
enumerable: !0,
|
|
1084
|
-
get: () => (e.signal.aborted ? c = !0 : e.signal.addEventListener("abort", () => {
|
|
1085
|
-
c = !0;
|
|
1086
|
-
}), e.signal)
|
|
1087
|
-
});
|
|
1088
|
-
}, E = Le(e.options, e.fetchOptions), M = async (g, D, j) => {
|
|
1089
|
-
if (c)
|
|
1090
|
-
return Promise.reject();
|
|
1091
|
-
if (D == null && g.pages.length)
|
|
1092
|
-
return Promise.resolve(g);
|
|
1093
|
-
const k = {
|
|
1094
|
-
client: e.client,
|
|
1095
|
-
queryKey: e.queryKey,
|
|
1096
|
-
pageParam: D,
|
|
1097
|
-
direction: j ? "backward" : "forward",
|
|
1098
|
-
meta: e.options.meta
|
|
1099
|
-
};
|
|
1100
|
-
p(k);
|
|
1101
|
-
const fe = await E(
|
|
1102
|
-
k
|
|
1103
|
-
), { maxPages: b } = e.options, z = j ? it : rt;
|
|
1104
|
-
return {
|
|
1105
|
-
pages: z(g.pages, fe, b),
|
|
1106
|
-
pageParams: z(g.pageParams, D, b)
|
|
1107
|
-
};
|
|
1108
|
-
};
|
|
1109
|
-
if (n && u.length) {
|
|
1110
|
-
const g = n === "backward", D = g ? vt : Qe, j = {
|
|
1111
|
-
pages: u,
|
|
1112
|
-
pageParams: h
|
|
1113
|
-
}, k = D(r, j);
|
|
1114
|
-
a = await M(j, k, g);
|
|
1115
|
-
} else {
|
|
1116
|
-
const g = t ?? u.length;
|
|
1117
|
-
do {
|
|
1118
|
-
const D = f === 0 ? h[0] ?? r.initialPageParam : Qe(r, a);
|
|
1119
|
-
if (f > 0 && D == null)
|
|
1120
|
-
break;
|
|
1121
|
-
a = await M(a, D), f++;
|
|
1122
|
-
} while (f < g);
|
|
1123
|
-
}
|
|
1124
|
-
return a;
|
|
1125
|
-
};
|
|
1126
|
-
e.options.persister ? e.fetchFn = () => {
|
|
1127
|
-
var c, p;
|
|
1128
|
-
return (p = (c = e.options).persister) == null ? void 0 : p.call(
|
|
1129
|
-
c,
|
|
1130
|
-
w,
|
|
1131
|
-
{
|
|
1132
|
-
client: e.client,
|
|
1133
|
-
queryKey: e.queryKey,
|
|
1134
|
-
meta: e.options.meta,
|
|
1135
|
-
signal: e.signal
|
|
1136
|
-
},
|
|
1137
|
-
s
|
|
1138
|
-
);
|
|
1139
|
-
} : e.fetchFn = w;
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
function Qe(t, { pages: e, pageParams: s }) {
|
|
1144
|
-
const r = e.length - 1;
|
|
1145
|
-
return e.length > 0 ? t.getNextPageParam(
|
|
1146
|
-
e[r],
|
|
1147
|
-
e,
|
|
1148
|
-
s[r],
|
|
1149
|
-
s
|
|
1150
|
-
) : void 0;
|
|
1151
|
-
}
|
|
1152
|
-
function vt(t, { pages: e, pageParams: s }) {
|
|
1153
|
-
var r;
|
|
1154
|
-
return e.length > 0 ? (r = t.getPreviousPageParam) == null ? void 0 : r.call(t, e[0], e, s[0], s) : void 0;
|
|
1155
|
-
}
|
|
1156
|
-
var v, _, V, ie, ne, $, ae, ue, xe, gt = (xe = class {
|
|
1196
|
+
var U, $t, qe = ($t = class extends Ct {
|
|
1157
1197
|
constructor(t = {}) {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
l
|
|
1165
|
-
l(
|
|
1166
|
-
|
|
1198
|
+
super();
|
|
1199
|
+
c(this, U, void 0);
|
|
1200
|
+
this.config = t, o(this, U, /* @__PURE__ */ new Map());
|
|
1201
|
+
}
|
|
1202
|
+
build(t, s, r) {
|
|
1203
|
+
const n = s.queryKey, a = s.queryHash ?? Mt(n, s);
|
|
1204
|
+
let l = this.get(a);
|
|
1205
|
+
return l || (l = new Oe({
|
|
1206
|
+
client: t,
|
|
1207
|
+
queryKey: n,
|
|
1208
|
+
queryHash: a,
|
|
1209
|
+
options: t.defaultQueryOptions(s),
|
|
1210
|
+
state: r,
|
|
1211
|
+
defaultOptions: t.getQueryDefaults(n)
|
|
1212
|
+
}), this.add(l)), l;
|
|
1167
1213
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
})));
|
|
1214
|
+
add(t) {
|
|
1215
|
+
i(this, U).has(t.queryHash) || (i(this, U).set(t.queryHash, t), this.notify({
|
|
1216
|
+
type: "added",
|
|
1217
|
+
query: t
|
|
1218
|
+
}));
|
|
1174
1219
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1220
|
+
remove(t) {
|
|
1221
|
+
const s = i(this, U).get(t.queryHash);
|
|
1222
|
+
s && (t.destroy(), s === t && i(this, U).delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
1178
1223
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1224
|
+
clear() {
|
|
1225
|
+
D.batch(() => {
|
|
1226
|
+
this.getAll().forEach((t) => {
|
|
1227
|
+
this.remove(t);
|
|
1228
|
+
});
|
|
1229
|
+
});
|
|
1181
1230
|
}
|
|
1182
|
-
|
|
1183
|
-
return i(this,
|
|
1231
|
+
get(t) {
|
|
1232
|
+
return i(this, U).get(t);
|
|
1184
1233
|
}
|
|
1185
|
-
|
|
1234
|
+
getAll() {
|
|
1235
|
+
return [...i(this, U).values()];
|
|
1236
|
+
}
|
|
1237
|
+
find(t) {
|
|
1238
|
+
const s = { exact: !0, ...t };
|
|
1239
|
+
return this.getAll().find(
|
|
1240
|
+
(r) => Tt(s, r)
|
|
1241
|
+
);
|
|
1242
|
+
}
|
|
1243
|
+
findAll(t = {}) {
|
|
1244
|
+
const s = this.getAll();
|
|
1245
|
+
return Object.keys(t).length > 0 ? s.filter((r) => Tt(t, r)) : s;
|
|
1246
|
+
}
|
|
1247
|
+
notify(t) {
|
|
1248
|
+
D.batch(() => {
|
|
1249
|
+
this.listeners.forEach((s) => {
|
|
1250
|
+
s(t);
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
onFocus() {
|
|
1255
|
+
D.batch(() => {
|
|
1256
|
+
this.getAll().forEach((t) => {
|
|
1257
|
+
t.onFocus();
|
|
1258
|
+
});
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
onOnline() {
|
|
1262
|
+
D.batch(() => {
|
|
1263
|
+
this.getAll().forEach((t) => {
|
|
1264
|
+
t.onOnline();
|
|
1265
|
+
});
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
}, U = new WeakMap(), $t), y, V, $, ot, ut, z, ht, ct, zt, Ae = (zt = class {
|
|
1269
|
+
constructor(e = {}) {
|
|
1270
|
+
c(this, y, void 0);
|
|
1271
|
+
c(this, V, void 0);
|
|
1272
|
+
c(this, $, void 0);
|
|
1273
|
+
c(this, ot, void 0);
|
|
1274
|
+
c(this, ut, void 0);
|
|
1275
|
+
c(this, z, void 0);
|
|
1276
|
+
c(this, ht, void 0);
|
|
1277
|
+
c(this, ct, void 0);
|
|
1278
|
+
o(this, y, e.queryCache || new qe()), o(this, V, e.mutationCache || new De()), o(this, $, e.defaultOptions || {}), o(this, ot, /* @__PURE__ */ new Map()), o(this, ut, /* @__PURE__ */ new Map()), o(this, z, 0);
|
|
1279
|
+
}
|
|
1280
|
+
mount() {
|
|
1281
|
+
bt(this, z)._++, i(this, z) === 1 && (o(this, ht, Wt.subscribe(async (e) => {
|
|
1282
|
+
e && (await this.resumePausedMutations(), i(this, y).onFocus());
|
|
1283
|
+
})), o(this, ct, Ot.subscribe(async (e) => {
|
|
1284
|
+
e && (await this.resumePausedMutations(), i(this, y).onOnline());
|
|
1285
|
+
})));
|
|
1286
|
+
}
|
|
1287
|
+
unmount() {
|
|
1288
|
+
var e, t;
|
|
1289
|
+
bt(this, z)._--, i(this, z) === 0 && ((e = i(this, ht)) == null || e.call(this), o(this, ht, void 0), (t = i(this, ct)) == null || t.call(this), o(this, ct, void 0));
|
|
1290
|
+
}
|
|
1291
|
+
isFetching(e) {
|
|
1292
|
+
return i(this, y).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
1293
|
+
}
|
|
1294
|
+
isMutating(e) {
|
|
1295
|
+
return i(this, V).findAll({ ...e, status: "pending" }).length;
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
1299
|
+
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
|
|
1300
|
+
*
|
|
1301
|
+
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
1302
|
+
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
1303
|
+
*/
|
|
1304
|
+
getQueryData(e) {
|
|
1186
1305
|
var s;
|
|
1187
|
-
const
|
|
1188
|
-
return (s = i(this,
|
|
1306
|
+
const t = this.defaultQueryOptions({ queryKey: e });
|
|
1307
|
+
return (s = i(this, y).get(t.queryHash)) == null ? void 0 : s.state.data;
|
|
1189
1308
|
}
|
|
1190
|
-
ensureQueryData(
|
|
1191
|
-
const
|
|
1192
|
-
return r === void 0 ? this.fetchQuery(
|
|
1309
|
+
ensureQueryData(e) {
|
|
1310
|
+
const t = this.defaultQueryOptions(e), s = i(this, y).build(this, t), r = s.state.data;
|
|
1311
|
+
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(Dt(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(r));
|
|
1193
1312
|
}
|
|
1194
|
-
getQueriesData(
|
|
1195
|
-
return i(this,
|
|
1313
|
+
getQueriesData(e) {
|
|
1314
|
+
return i(this, y).findAll(e).map(({ queryKey: t, state: s }) => {
|
|
1196
1315
|
const r = s.data;
|
|
1197
|
-
return [
|
|
1316
|
+
return [t, r];
|
|
1198
1317
|
});
|
|
1199
1318
|
}
|
|
1200
|
-
setQueryData(
|
|
1201
|
-
const r = this.defaultQueryOptions({ queryKey:
|
|
1319
|
+
setQueryData(e, t, s) {
|
|
1320
|
+
const r = this.defaultQueryOptions({ queryKey: e }), n = i(this, y).get(
|
|
1202
1321
|
r.queryHash
|
|
1203
|
-
),
|
|
1204
|
-
if (
|
|
1205
|
-
return i(this,
|
|
1322
|
+
), a = n == null ? void 0 : n.state.data, l = oe(t, a);
|
|
1323
|
+
if (l !== void 0)
|
|
1324
|
+
return i(this, y).build(this, r).setData(l, { ...s, manual: !0 });
|
|
1206
1325
|
}
|
|
1207
|
-
setQueriesData(
|
|
1208
|
-
return
|
|
1209
|
-
() => i(this,
|
|
1326
|
+
setQueriesData(e, t, s) {
|
|
1327
|
+
return D.batch(
|
|
1328
|
+
() => i(this, y).findAll(e).map(({ queryKey: r }) => [
|
|
1210
1329
|
r,
|
|
1211
|
-
this.setQueryData(r,
|
|
1330
|
+
this.setQueryData(r, t, s)
|
|
1212
1331
|
])
|
|
1213
1332
|
);
|
|
1214
1333
|
}
|
|
1215
|
-
getQueryState(
|
|
1334
|
+
getQueryState(e) {
|
|
1216
1335
|
var s;
|
|
1217
|
-
const
|
|
1218
|
-
return (s = i(this,
|
|
1219
|
-
|
|
1336
|
+
const t = this.defaultQueryOptions({ queryKey: e });
|
|
1337
|
+
return (s = i(this, y).get(
|
|
1338
|
+
t.queryHash
|
|
1220
1339
|
)) == null ? void 0 : s.state;
|
|
1221
1340
|
}
|
|
1222
|
-
removeQueries(
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1341
|
+
removeQueries(e) {
|
|
1342
|
+
const t = i(this, y);
|
|
1343
|
+
D.batch(() => {
|
|
1344
|
+
t.findAll(e).forEach((s) => {
|
|
1345
|
+
t.remove(s);
|
|
1227
1346
|
});
|
|
1228
1347
|
});
|
|
1229
1348
|
}
|
|
1230
|
-
resetQueries(
|
|
1231
|
-
const s = i(this,
|
|
1232
|
-
return
|
|
1349
|
+
resetQueries(e, t) {
|
|
1350
|
+
const s = i(this, y);
|
|
1351
|
+
return D.batch(() => (s.findAll(e).forEach((r) => {
|
|
1233
1352
|
r.reset();
|
|
1234
1353
|
}), this.refetchQueries(
|
|
1235
1354
|
{
|
|
1236
1355
|
type: "active",
|
|
1237
|
-
...
|
|
1356
|
+
...e
|
|
1238
1357
|
},
|
|
1239
|
-
|
|
1358
|
+
t
|
|
1240
1359
|
)));
|
|
1241
1360
|
}
|
|
1242
|
-
cancelQueries(
|
|
1243
|
-
const s = { revert: !0, ...
|
|
1244
|
-
() => i(this,
|
|
1361
|
+
cancelQueries(e, t = {}) {
|
|
1362
|
+
const s = { revert: !0, ...t }, r = D.batch(
|
|
1363
|
+
() => i(this, y).findAll(e).map((n) => n.cancel(s))
|
|
1245
1364
|
);
|
|
1246
|
-
return Promise.all(r).then(
|
|
1365
|
+
return Promise.all(r).then(R).catch(R);
|
|
1247
1366
|
}
|
|
1248
|
-
invalidateQueries(
|
|
1249
|
-
return
|
|
1367
|
+
invalidateQueries(e, t = {}) {
|
|
1368
|
+
return D.batch(() => (i(this, y).findAll(e).forEach((s) => {
|
|
1250
1369
|
s.invalidate();
|
|
1251
|
-
}), (
|
|
1370
|
+
}), (e == null ? void 0 : e.refetchType) === "none" ? Promise.resolve() : this.refetchQueries(
|
|
1252
1371
|
{
|
|
1253
|
-
...
|
|
1254
|
-
type: (
|
|
1372
|
+
...e,
|
|
1373
|
+
type: (e == null ? void 0 : e.refetchType) ?? (e == null ? void 0 : e.type) ?? "active"
|
|
1255
1374
|
},
|
|
1256
|
-
|
|
1375
|
+
t
|
|
1257
1376
|
)));
|
|
1258
1377
|
}
|
|
1259
|
-
refetchQueries(
|
|
1378
|
+
refetchQueries(e, t = {}) {
|
|
1260
1379
|
const s = {
|
|
1261
|
-
...
|
|
1262
|
-
cancelRefetch:
|
|
1263
|
-
}, r =
|
|
1264
|
-
() => i(this,
|
|
1265
|
-
let
|
|
1266
|
-
return s.throwOnError || (
|
|
1380
|
+
...t,
|
|
1381
|
+
cancelRefetch: t.cancelRefetch ?? !0
|
|
1382
|
+
}, r = D.batch(
|
|
1383
|
+
() => i(this, y).findAll(e).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
|
|
1384
|
+
let a = n.fetch(void 0, s);
|
|
1385
|
+
return s.throwOnError || (a = a.catch(R)), n.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
1267
1386
|
})
|
|
1268
1387
|
);
|
|
1269
|
-
return Promise.all(r).then(
|
|
1388
|
+
return Promise.all(r).then(R);
|
|
1270
1389
|
}
|
|
1271
|
-
fetchQuery(
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
const s = i(this,
|
|
1390
|
+
fetchQuery(e) {
|
|
1391
|
+
const t = this.defaultQueryOptions(e);
|
|
1392
|
+
t.retry === void 0 && (t.retry = !1);
|
|
1393
|
+
const s = i(this, y).build(this, t);
|
|
1275
1394
|
return s.isStaleByTime(
|
|
1276
|
-
|
|
1277
|
-
) ? s.fetch(
|
|
1395
|
+
Dt(t.staleTime, s)
|
|
1396
|
+
) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
1278
1397
|
}
|
|
1279
|
-
prefetchQuery(
|
|
1280
|
-
return this.fetchQuery(
|
|
1398
|
+
prefetchQuery(e) {
|
|
1399
|
+
return this.fetchQuery(e).then(R).catch(R);
|
|
1281
1400
|
}
|
|
1282
|
-
fetchInfiniteQuery(
|
|
1283
|
-
return
|
|
1401
|
+
fetchInfiniteQuery(e) {
|
|
1402
|
+
return e.behavior = kt(e.pages), this.fetchQuery(e);
|
|
1284
1403
|
}
|
|
1285
|
-
prefetchInfiniteQuery(
|
|
1286
|
-
return this.fetchInfiniteQuery(
|
|
1404
|
+
prefetchInfiniteQuery(e) {
|
|
1405
|
+
return this.fetchInfiniteQuery(e).then(R).catch(R);
|
|
1287
1406
|
}
|
|
1288
|
-
ensureInfiniteQueryData(
|
|
1289
|
-
return
|
|
1407
|
+
ensureInfiniteQueryData(e) {
|
|
1408
|
+
return e.behavior = kt(e.pages), this.ensureQueryData(e);
|
|
1290
1409
|
}
|
|
1291
1410
|
resumePausedMutations() {
|
|
1292
|
-
return
|
|
1411
|
+
return Ot.isOnline() ? i(this, V).resumePausedMutations() : Promise.resolve();
|
|
1293
1412
|
}
|
|
1294
1413
|
getQueryCache() {
|
|
1295
|
-
return i(this,
|
|
1414
|
+
return i(this, y);
|
|
1296
1415
|
}
|
|
1297
1416
|
getMutationCache() {
|
|
1298
|
-
return i(this,
|
|
1417
|
+
return i(this, V);
|
|
1299
1418
|
}
|
|
1300
1419
|
getDefaultOptions() {
|
|
1301
|
-
return i(this,
|
|
1420
|
+
return i(this, $);
|
|
1302
1421
|
}
|
|
1303
|
-
setDefaultOptions(
|
|
1304
|
-
o(this,
|
|
1422
|
+
setDefaultOptions(e) {
|
|
1423
|
+
o(this, $, e);
|
|
1305
1424
|
}
|
|
1306
|
-
setQueryDefaults(
|
|
1307
|
-
i(this,
|
|
1308
|
-
queryKey:
|
|
1309
|
-
defaultOptions:
|
|
1425
|
+
setQueryDefaults(e, t) {
|
|
1426
|
+
i(this, ot).set(ft(e), {
|
|
1427
|
+
queryKey: e,
|
|
1428
|
+
defaultOptions: t
|
|
1310
1429
|
});
|
|
1311
1430
|
}
|
|
1312
|
-
getQueryDefaults(
|
|
1313
|
-
const
|
|
1314
|
-
return
|
|
1315
|
-
|
|
1431
|
+
getQueryDefaults(e) {
|
|
1432
|
+
const t = [...i(this, ot).values()], s = {};
|
|
1433
|
+
return t.forEach((r) => {
|
|
1434
|
+
yt(e, r.queryKey) && Object.assign(s, r.defaultOptions);
|
|
1316
1435
|
}), s;
|
|
1317
1436
|
}
|
|
1318
|
-
setMutationDefaults(
|
|
1319
|
-
i(this,
|
|
1320
|
-
mutationKey:
|
|
1321
|
-
defaultOptions:
|
|
1437
|
+
setMutationDefaults(e, t) {
|
|
1438
|
+
i(this, ut).set(ft(e), {
|
|
1439
|
+
mutationKey: e,
|
|
1440
|
+
defaultOptions: t
|
|
1322
1441
|
});
|
|
1323
1442
|
}
|
|
1324
|
-
getMutationDefaults(
|
|
1325
|
-
const
|
|
1326
|
-
return
|
|
1327
|
-
|
|
1443
|
+
getMutationDefaults(e) {
|
|
1444
|
+
const t = [...i(this, ut).values()], s = {};
|
|
1445
|
+
return t.forEach((r) => {
|
|
1446
|
+
yt(e, r.mutationKey) && Object.assign(s, r.defaultOptions);
|
|
1328
1447
|
}), s;
|
|
1329
1448
|
}
|
|
1330
|
-
defaultQueryOptions(
|
|
1331
|
-
if (
|
|
1332
|
-
return
|
|
1333
|
-
const
|
|
1334
|
-
...i(this,
|
|
1335
|
-
...this.getQueryDefaults(
|
|
1336
|
-
...
|
|
1449
|
+
defaultQueryOptions(e) {
|
|
1450
|
+
if (e._defaulted)
|
|
1451
|
+
return e;
|
|
1452
|
+
const t = {
|
|
1453
|
+
...i(this, $).queries,
|
|
1454
|
+
...this.getQueryDefaults(e.queryKey),
|
|
1455
|
+
...e,
|
|
1337
1456
|
_defaulted: !0
|
|
1338
1457
|
};
|
|
1339
|
-
return
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
)),
|
|
1343
|
-
}
|
|
1344
|
-
defaultMutationOptions(
|
|
1345
|
-
return
|
|
1346
|
-
...i(this,
|
|
1347
|
-
...(
|
|
1348
|
-
...
|
|
1458
|
+
return t.queryHash || (t.queryHash = Mt(
|
|
1459
|
+
t.queryKey,
|
|
1460
|
+
t
|
|
1461
|
+
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === Pt && (t.enabled = !1), t;
|
|
1462
|
+
}
|
|
1463
|
+
defaultMutationOptions(e) {
|
|
1464
|
+
return e != null && e._defaulted ? e : {
|
|
1465
|
+
...i(this, $).mutations,
|
|
1466
|
+
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
1467
|
+
...e,
|
|
1349
1468
|
_defaulted: !0
|
|
1350
1469
|
};
|
|
1351
1470
|
}
|
|
1352
1471
|
clear() {
|
|
1353
|
-
i(this,
|
|
1472
|
+
i(this, y).clear(), i(this, V).clear();
|
|
1354
1473
|
}
|
|
1355
|
-
},
|
|
1474
|
+
}, y = new WeakMap(), V = new WeakMap(), $ = new WeakMap(), ot = new WeakMap(), ut = new WeakMap(), z = new WeakMap(), ht = new WeakMap(), ct = new WeakMap(), zt), Qe = Bt.createContext(
|
|
1356
1475
|
void 0
|
|
1357
|
-
),
|
|
1358
|
-
client:
|
|
1359
|
-
children:
|
|
1360
|
-
}) => (
|
|
1361
|
-
|
|
1362
|
-
}), [
|
|
1363
|
-
const
|
|
1364
|
-
const { children:
|
|
1365
|
-
return /* @__PURE__ */
|
|
1476
|
+
), Me = ({
|
|
1477
|
+
client: e,
|
|
1478
|
+
children: t
|
|
1479
|
+
}) => (Bt.useEffect(() => (e.mount(), () => {
|
|
1480
|
+
e.unmount();
|
|
1481
|
+
}), [e]), /* @__PURE__ */ dt(Qe.Provider, { value: e, children: t }));
|
|
1482
|
+
const Te = new Ae(), Ue = (e) => {
|
|
1483
|
+
const { children: t, customVariables: s, customDarkVariables: r, workerUrl: n, licenseKey: a, ...l } = e, { workerUrlAdded: u } = se(n);
|
|
1484
|
+
return /* @__PURE__ */ dt(Me, { client: Te, children: /* @__PURE__ */ dt(re, { licenseKey: a, children: /* @__PURE__ */ dt(ee, { workerUrlAdded: u, ...l, children: /* @__PURE__ */ dt(te, { customDarkVariables: r, customVariables: s, children: t }) }) }) });
|
|
1366
1485
|
};
|
|
1367
1486
|
export {
|
|
1368
|
-
|
|
1487
|
+
Ue as RPConfig
|
|
1369
1488
|
};
|