@viasoftbr/shared-ui 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/main/Header.d.ts +1 -0
- package/dist/components.cjs +53411 -0
- package/dist/components.js +779 -2707
- package/dist/context/AuthContext.d.ts +1 -0
- package/dist/context/SharedUiProvider.d.ts +7 -0
- package/dist/context/index.d.ts +2 -1
- package/dist/context.cjs +3078 -0
- package/dist/context.js +39 -472
- package/dist/hooks.cjs +3182 -0
- package/dist/hooks.js +22 -1322
- package/dist/i18n.cjs +3277 -0
- package/dist/i18n.js +2 -87
- package/dist/index.cjs +53787 -0
- package/dist/index.js +820 -2936
- package/dist/services.cjs +3271 -0
- package/dist/types.cjs +34 -0
- package/package.json +19 -9
package/dist/hooks.js
CHANGED
|
@@ -8,1311 +8,10 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
|
-
var __accessCheck = (obj, member, msg) => {
|
|
12
|
-
if (!member.has(obj))
|
|
13
|
-
throw TypeError("Cannot " + msg);
|
|
14
|
-
};
|
|
15
|
-
var __privateGet = (obj, member, getter) => {
|
|
16
|
-
__accessCheck(obj, member, "read from private field");
|
|
17
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
18
|
-
};
|
|
19
|
-
var __privateAdd = (obj, member, value) => {
|
|
20
|
-
if (member.has(obj))
|
|
21
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
22
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
23
|
-
};
|
|
24
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
25
|
-
__accessCheck(obj, member, "write to private field");
|
|
26
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
27
|
-
return value;
|
|
28
|
-
};
|
|
29
|
-
var __privateMethod = (obj, member, method) => {
|
|
30
|
-
__accessCheck(obj, member, "access private method");
|
|
31
|
-
return method;
|
|
32
|
-
};
|
|
33
11
|
|
|
34
12
|
// src/hooks/useSettings.ts
|
|
35
|
-
import { useState
|
|
36
|
-
|
|
37
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
38
|
-
var Subscribable = class {
|
|
39
|
-
constructor() {
|
|
40
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
41
|
-
this.subscribe = this.subscribe.bind(this);
|
|
42
|
-
}
|
|
43
|
-
subscribe(listener) {
|
|
44
|
-
this.listeners.add(listener);
|
|
45
|
-
this.onSubscribe();
|
|
46
|
-
return () => {
|
|
47
|
-
this.listeners.delete(listener);
|
|
48
|
-
this.onUnsubscribe();
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
hasListeners() {
|
|
52
|
-
return this.listeners.size > 0;
|
|
53
|
-
}
|
|
54
|
-
onSubscribe() {
|
|
55
|
-
}
|
|
56
|
-
onUnsubscribe() {
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
|
|
61
|
-
var defaultTimeoutProvider = {
|
|
62
|
-
// We need the wrapper function syntax below instead of direct references to
|
|
63
|
-
// global setTimeout etc.
|
|
64
|
-
//
|
|
65
|
-
// BAD: `setTimeout: setTimeout`
|
|
66
|
-
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
67
|
-
//
|
|
68
|
-
// If we use direct references here, then anything that wants to spy on or
|
|
69
|
-
// replace the global setTimeout (like tests) won't work since we'll already
|
|
70
|
-
// have a hard reference to the original implementation at the time when this
|
|
71
|
-
// file was imported.
|
|
72
|
-
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
73
|
-
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
74
|
-
setInterval: (callback, delay) => setInterval(callback, delay),
|
|
75
|
-
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
76
|
-
};
|
|
77
|
-
var _provider, _providerCalled, _a;
|
|
78
|
-
var TimeoutManager = (_a = class {
|
|
79
|
-
constructor() {
|
|
80
|
-
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
81
|
-
// type at app boot; and if we leave that type, then any new timer provider
|
|
82
|
-
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
83
|
-
//
|
|
84
|
-
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
85
|
-
// this class is unsafe internally to allow for extension.
|
|
86
|
-
__privateAdd(this, _provider, defaultTimeoutProvider);
|
|
87
|
-
__privateAdd(this, _providerCalled, false);
|
|
88
|
-
}
|
|
89
|
-
setTimeoutProvider(provider) {
|
|
90
|
-
if (false) {
|
|
91
|
-
if (__privateGet(this, _providerCalled) && provider !== __privateGet(this, _provider)) {
|
|
92
|
-
console.error(
|
|
93
|
-
`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
|
|
94
|
-
{ previous: __privateGet(this, _provider), provider }
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
__privateSet(this, _provider, provider);
|
|
99
|
-
if (false) {
|
|
100
|
-
__privateSet(this, _providerCalled, false);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
setTimeout(callback, delay) {
|
|
104
|
-
if (false) {
|
|
105
|
-
__privateSet(this, _providerCalled, true);
|
|
106
|
-
}
|
|
107
|
-
return __privateGet(this, _provider).setTimeout(callback, delay);
|
|
108
|
-
}
|
|
109
|
-
clearTimeout(timeoutId) {
|
|
110
|
-
__privateGet(this, _provider).clearTimeout(timeoutId);
|
|
111
|
-
}
|
|
112
|
-
setInterval(callback, delay) {
|
|
113
|
-
if (false) {
|
|
114
|
-
__privateSet(this, _providerCalled, true);
|
|
115
|
-
}
|
|
116
|
-
return __privateGet(this, _provider).setInterval(callback, delay);
|
|
117
|
-
}
|
|
118
|
-
clearInterval(intervalId) {
|
|
119
|
-
__privateGet(this, _provider).clearInterval(intervalId);
|
|
120
|
-
}
|
|
121
|
-
}, _provider = new WeakMap(), _providerCalled = new WeakMap(), _a);
|
|
122
|
-
var timeoutManager = new TimeoutManager();
|
|
123
|
-
function systemSetTimeoutZero(callback) {
|
|
124
|
-
setTimeout(callback, 0);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/utils.js
|
|
128
|
-
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
129
|
-
function noop() {
|
|
130
|
-
}
|
|
131
|
-
function isValidTimeout(value) {
|
|
132
|
-
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
133
|
-
}
|
|
134
|
-
function timeUntilStale(updatedAt, staleTime) {
|
|
135
|
-
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
136
|
-
}
|
|
137
|
-
function resolveStaleTime(staleTime, query) {
|
|
138
|
-
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
139
|
-
}
|
|
140
|
-
function resolveEnabled(enabled, query) {
|
|
141
|
-
return typeof enabled === "function" ? enabled(query) : enabled;
|
|
142
|
-
}
|
|
143
|
-
function hashKey(queryKey) {
|
|
144
|
-
return JSON.stringify(
|
|
145
|
-
queryKey,
|
|
146
|
-
(_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
147
|
-
result[key] = val[key];
|
|
148
|
-
return result;
|
|
149
|
-
}, {}) : val
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
153
|
-
function replaceEqualDeep(a, b, depth = 0) {
|
|
154
|
-
if (a === b) {
|
|
155
|
-
return a;
|
|
156
|
-
}
|
|
157
|
-
if (depth > 500)
|
|
158
|
-
return b;
|
|
159
|
-
const array = isPlainArray(a) && isPlainArray(b);
|
|
160
|
-
if (!array && !(isPlainObject(a) && isPlainObject(b)))
|
|
161
|
-
return b;
|
|
162
|
-
const aItems = array ? a : Object.keys(a);
|
|
163
|
-
const aSize = aItems.length;
|
|
164
|
-
const bItems = array ? b : Object.keys(b);
|
|
165
|
-
const bSize = bItems.length;
|
|
166
|
-
const copy = array ? new Array(bSize) : {};
|
|
167
|
-
let equalItems = 0;
|
|
168
|
-
for (let i = 0; i < bSize; i++) {
|
|
169
|
-
const key = array ? i : bItems[i];
|
|
170
|
-
const aItem = a[key];
|
|
171
|
-
const bItem = b[key];
|
|
172
|
-
if (aItem === bItem) {
|
|
173
|
-
copy[key] = aItem;
|
|
174
|
-
if (array ? i < aSize : hasOwn.call(a, key))
|
|
175
|
-
equalItems++;
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
179
|
-
copy[key] = bItem;
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
183
|
-
copy[key] = v;
|
|
184
|
-
if (v === aItem)
|
|
185
|
-
equalItems++;
|
|
186
|
-
}
|
|
187
|
-
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
188
|
-
}
|
|
189
|
-
function shallowEqualObjects(a, b) {
|
|
190
|
-
if (!b || Object.keys(a).length !== Object.keys(b).length) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
for (const key in a) {
|
|
194
|
-
if (a[key] !== b[key]) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
function isPlainArray(value) {
|
|
201
|
-
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
202
|
-
}
|
|
203
|
-
function isPlainObject(o) {
|
|
204
|
-
if (!hasObjectPrototype(o)) {
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
const ctor = o.constructor;
|
|
208
|
-
if (ctor === void 0) {
|
|
209
|
-
return true;
|
|
210
|
-
}
|
|
211
|
-
const prot = ctor.prototype;
|
|
212
|
-
if (!hasObjectPrototype(prot)) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
if (Object.getPrototypeOf(o) !== Object.prototype) {
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
return true;
|
|
222
|
-
}
|
|
223
|
-
function hasObjectPrototype(o) {
|
|
224
|
-
return Object.prototype.toString.call(o) === "[object Object]";
|
|
225
|
-
}
|
|
226
|
-
function replaceData(prevData, data, options) {
|
|
227
|
-
if (typeof options.structuralSharing === "function") {
|
|
228
|
-
return options.structuralSharing(prevData, data);
|
|
229
|
-
} else if (options.structuralSharing !== false) {
|
|
230
|
-
if (false) {
|
|
231
|
-
try {
|
|
232
|
-
return replaceEqualDeep(prevData, data);
|
|
233
|
-
} catch (error) {
|
|
234
|
-
console.error(
|
|
235
|
-
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
|
|
236
|
-
);
|
|
237
|
-
throw error;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return replaceEqualDeep(prevData, data);
|
|
241
|
-
}
|
|
242
|
-
return data;
|
|
243
|
-
}
|
|
244
|
-
function shouldThrowError(throwOnError, params) {
|
|
245
|
-
if (typeof throwOnError === "function") {
|
|
246
|
-
return throwOnError(...params);
|
|
247
|
-
}
|
|
248
|
-
return !!throwOnError;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
252
|
-
var _focused, _cleanup, _setup, _a2;
|
|
253
|
-
var FocusManager = (_a2 = class extends Subscribable {
|
|
254
|
-
constructor() {
|
|
255
|
-
super();
|
|
256
|
-
__privateAdd(this, _focused, void 0);
|
|
257
|
-
__privateAdd(this, _cleanup, void 0);
|
|
258
|
-
__privateAdd(this, _setup, void 0);
|
|
259
|
-
__privateSet(this, _setup, (onFocus) => {
|
|
260
|
-
if (!isServer && window.addEventListener) {
|
|
261
|
-
const listener = () => onFocus();
|
|
262
|
-
window.addEventListener("visibilitychange", listener, false);
|
|
263
|
-
return () => {
|
|
264
|
-
window.removeEventListener("visibilitychange", listener);
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
return;
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
onSubscribe() {
|
|
271
|
-
if (!__privateGet(this, _cleanup)) {
|
|
272
|
-
this.setEventListener(__privateGet(this, _setup));
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
onUnsubscribe() {
|
|
276
|
-
var _a6;
|
|
277
|
-
if (!this.hasListeners()) {
|
|
278
|
-
(_a6 = __privateGet(this, _cleanup)) == null ? void 0 : _a6.call(this);
|
|
279
|
-
__privateSet(this, _cleanup, void 0);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
setEventListener(setup) {
|
|
283
|
-
var _a6;
|
|
284
|
-
__privateSet(this, _setup, setup);
|
|
285
|
-
(_a6 = __privateGet(this, _cleanup)) == null ? void 0 : _a6.call(this);
|
|
286
|
-
__privateSet(this, _cleanup, setup((focused) => {
|
|
287
|
-
if (typeof focused === "boolean") {
|
|
288
|
-
this.setFocused(focused);
|
|
289
|
-
} else {
|
|
290
|
-
this.onFocus();
|
|
291
|
-
}
|
|
292
|
-
}));
|
|
293
|
-
}
|
|
294
|
-
setFocused(focused) {
|
|
295
|
-
const changed = __privateGet(this, _focused) !== focused;
|
|
296
|
-
if (changed) {
|
|
297
|
-
__privateSet(this, _focused, focused);
|
|
298
|
-
this.onFocus();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
onFocus() {
|
|
302
|
-
const isFocused = this.isFocused();
|
|
303
|
-
this.listeners.forEach((listener) => {
|
|
304
|
-
listener(isFocused);
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
isFocused() {
|
|
308
|
-
if (typeof __privateGet(this, _focused) === "boolean") {
|
|
309
|
-
return __privateGet(this, _focused);
|
|
310
|
-
}
|
|
311
|
-
return globalThis.document?.visibilityState !== "hidden";
|
|
312
|
-
}
|
|
313
|
-
}, _focused = new WeakMap(), _cleanup = new WeakMap(), _setup = new WeakMap(), _a2);
|
|
314
|
-
var focusManager = new FocusManager();
|
|
315
|
-
|
|
316
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
317
|
-
function pendingThenable() {
|
|
318
|
-
let resolve;
|
|
319
|
-
let reject;
|
|
320
|
-
const thenable = new Promise((_resolve, _reject) => {
|
|
321
|
-
resolve = _resolve;
|
|
322
|
-
reject = _reject;
|
|
323
|
-
});
|
|
324
|
-
thenable.status = "pending";
|
|
325
|
-
thenable.catch(() => {
|
|
326
|
-
});
|
|
327
|
-
function finalize(data) {
|
|
328
|
-
Object.assign(thenable, data);
|
|
329
|
-
delete thenable.resolve;
|
|
330
|
-
delete thenable.reject;
|
|
331
|
-
}
|
|
332
|
-
thenable.resolve = (value) => {
|
|
333
|
-
finalize({
|
|
334
|
-
status: "fulfilled",
|
|
335
|
-
value
|
|
336
|
-
});
|
|
337
|
-
resolve(value);
|
|
338
|
-
};
|
|
339
|
-
thenable.reject = (reason) => {
|
|
340
|
-
finalize({
|
|
341
|
-
status: "rejected",
|
|
342
|
-
reason
|
|
343
|
-
});
|
|
344
|
-
reject(reason);
|
|
345
|
-
};
|
|
346
|
-
return thenable;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
350
|
-
var defaultScheduler = systemSetTimeoutZero;
|
|
351
|
-
function createNotifyManager() {
|
|
352
|
-
let queue = [];
|
|
353
|
-
let transactions = 0;
|
|
354
|
-
let notifyFn = (callback) => {
|
|
355
|
-
callback();
|
|
356
|
-
};
|
|
357
|
-
let batchNotifyFn = (callback) => {
|
|
358
|
-
callback();
|
|
359
|
-
};
|
|
360
|
-
let scheduleFn = defaultScheduler;
|
|
361
|
-
const schedule = (callback) => {
|
|
362
|
-
if (transactions) {
|
|
363
|
-
queue.push(callback);
|
|
364
|
-
} else {
|
|
365
|
-
scheduleFn(() => {
|
|
366
|
-
notifyFn(callback);
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
const flush = () => {
|
|
371
|
-
const originalQueue = queue;
|
|
372
|
-
queue = [];
|
|
373
|
-
if (originalQueue.length) {
|
|
374
|
-
scheduleFn(() => {
|
|
375
|
-
batchNotifyFn(() => {
|
|
376
|
-
originalQueue.forEach((callback) => {
|
|
377
|
-
notifyFn(callback);
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
return {
|
|
384
|
-
batch: (callback) => {
|
|
385
|
-
let result;
|
|
386
|
-
transactions++;
|
|
387
|
-
try {
|
|
388
|
-
result = callback();
|
|
389
|
-
} finally {
|
|
390
|
-
transactions--;
|
|
391
|
-
if (!transactions) {
|
|
392
|
-
flush();
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return result;
|
|
396
|
-
},
|
|
397
|
-
/**
|
|
398
|
-
* All calls to the wrapped function will be batched.
|
|
399
|
-
*/
|
|
400
|
-
batchCalls: (callback) => {
|
|
401
|
-
return (...args) => {
|
|
402
|
-
schedule(() => {
|
|
403
|
-
callback(...args);
|
|
404
|
-
});
|
|
405
|
-
};
|
|
406
|
-
},
|
|
407
|
-
schedule,
|
|
408
|
-
/**
|
|
409
|
-
* Use this method to set a custom notify function.
|
|
410
|
-
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
411
|
-
*/
|
|
412
|
-
setNotifyFunction: (fn) => {
|
|
413
|
-
notifyFn = fn;
|
|
414
|
-
},
|
|
415
|
-
/**
|
|
416
|
-
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
417
|
-
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
418
|
-
*/
|
|
419
|
-
setBatchNotifyFunction: (fn) => {
|
|
420
|
-
batchNotifyFn = fn;
|
|
421
|
-
},
|
|
422
|
-
setScheduler: (fn) => {
|
|
423
|
-
scheduleFn = fn;
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
var notifyManager = createNotifyManager();
|
|
428
|
-
|
|
429
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
430
|
-
var _online, _cleanup2, _setup2, _a3;
|
|
431
|
-
var OnlineManager = (_a3 = class extends Subscribable {
|
|
432
|
-
constructor() {
|
|
433
|
-
super();
|
|
434
|
-
__privateAdd(this, _online, true);
|
|
435
|
-
__privateAdd(this, _cleanup2, void 0);
|
|
436
|
-
__privateAdd(this, _setup2, void 0);
|
|
437
|
-
__privateSet(this, _setup2, (onOnline) => {
|
|
438
|
-
if (!isServer && window.addEventListener) {
|
|
439
|
-
const onlineListener = () => onOnline(true);
|
|
440
|
-
const offlineListener = () => onOnline(false);
|
|
441
|
-
window.addEventListener("online", onlineListener, false);
|
|
442
|
-
window.addEventListener("offline", offlineListener, false);
|
|
443
|
-
return () => {
|
|
444
|
-
window.removeEventListener("online", onlineListener);
|
|
445
|
-
window.removeEventListener("offline", offlineListener);
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
return;
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
onSubscribe() {
|
|
452
|
-
if (!__privateGet(this, _cleanup2)) {
|
|
453
|
-
this.setEventListener(__privateGet(this, _setup2));
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
onUnsubscribe() {
|
|
457
|
-
var _a6;
|
|
458
|
-
if (!this.hasListeners()) {
|
|
459
|
-
(_a6 = __privateGet(this, _cleanup2)) == null ? void 0 : _a6.call(this);
|
|
460
|
-
__privateSet(this, _cleanup2, void 0);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
setEventListener(setup) {
|
|
464
|
-
var _a6;
|
|
465
|
-
__privateSet(this, _setup2, setup);
|
|
466
|
-
(_a6 = __privateGet(this, _cleanup2)) == null ? void 0 : _a6.call(this);
|
|
467
|
-
__privateSet(this, _cleanup2, setup(this.setOnline.bind(this)));
|
|
468
|
-
}
|
|
469
|
-
setOnline(online) {
|
|
470
|
-
const changed = __privateGet(this, _online) !== online;
|
|
471
|
-
if (changed) {
|
|
472
|
-
__privateSet(this, _online, online);
|
|
473
|
-
this.listeners.forEach((listener) => {
|
|
474
|
-
listener(online);
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
isOnline() {
|
|
479
|
-
return __privateGet(this, _online);
|
|
480
|
-
}
|
|
481
|
-
}, _online = new WeakMap(), _cleanup2 = new WeakMap(), _setup2 = new WeakMap(), _a3);
|
|
482
|
-
var onlineManager = new OnlineManager();
|
|
483
|
-
|
|
484
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
485
|
-
function canFetch(networkMode) {
|
|
486
|
-
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/query.js
|
|
490
|
-
function fetchState(data, options) {
|
|
491
|
-
return {
|
|
492
|
-
fetchFailureCount: 0,
|
|
493
|
-
fetchFailureReason: null,
|
|
494
|
-
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
495
|
-
...data === void 0 && {
|
|
496
|
-
error: null,
|
|
497
|
-
status: "pending"
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
503
|
-
var _client, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _currentThenable, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _executeFetch, executeFetch_fn, _updateStaleTimeout, updateStaleTimeout_fn, _computeRefetchInterval, computeRefetchInterval_fn, _updateRefetchInterval, updateRefetchInterval_fn, _updateTimers, updateTimers_fn, _clearStaleTimeout, clearStaleTimeout_fn, _clearRefetchInterval, clearRefetchInterval_fn, _updateQuery, updateQuery_fn, _notify, notify_fn, _a4;
|
|
504
|
-
var QueryObserver = (_a4 = class extends Subscribable {
|
|
505
|
-
constructor(client, options) {
|
|
506
|
-
super();
|
|
507
|
-
__privateAdd(this, _executeFetch);
|
|
508
|
-
__privateAdd(this, _updateStaleTimeout);
|
|
509
|
-
__privateAdd(this, _computeRefetchInterval);
|
|
510
|
-
__privateAdd(this, _updateRefetchInterval);
|
|
511
|
-
__privateAdd(this, _updateTimers);
|
|
512
|
-
__privateAdd(this, _clearStaleTimeout);
|
|
513
|
-
__privateAdd(this, _clearRefetchInterval);
|
|
514
|
-
__privateAdd(this, _updateQuery);
|
|
515
|
-
__privateAdd(this, _notify);
|
|
516
|
-
__privateAdd(this, _client, void 0);
|
|
517
|
-
__privateAdd(this, _currentQuery, void 0);
|
|
518
|
-
__privateAdd(this, _currentQueryInitialState, void 0);
|
|
519
|
-
__privateAdd(this, _currentResult, void 0);
|
|
520
|
-
__privateAdd(this, _currentResultState, void 0);
|
|
521
|
-
__privateAdd(this, _currentResultOptions, void 0);
|
|
522
|
-
__privateAdd(this, _currentThenable, void 0);
|
|
523
|
-
__privateAdd(this, _selectError, void 0);
|
|
524
|
-
__privateAdd(this, _selectFn, void 0);
|
|
525
|
-
__privateAdd(this, _selectResult, void 0);
|
|
526
|
-
// This property keeps track of the last query with defined data.
|
|
527
|
-
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
528
|
-
__privateAdd(this, _lastQueryWithDefinedData, void 0);
|
|
529
|
-
__privateAdd(this, _staleTimeoutId, void 0);
|
|
530
|
-
__privateAdd(this, _refetchIntervalId, void 0);
|
|
531
|
-
__privateAdd(this, _currentRefetchInterval, void 0);
|
|
532
|
-
__privateAdd(this, _trackedProps, /* @__PURE__ */ new Set());
|
|
533
|
-
this.options = options;
|
|
534
|
-
__privateSet(this, _client, client);
|
|
535
|
-
__privateSet(this, _selectError, null);
|
|
536
|
-
__privateSet(this, _currentThenable, pendingThenable());
|
|
537
|
-
this.bindMethods();
|
|
538
|
-
this.setOptions(options);
|
|
539
|
-
}
|
|
540
|
-
bindMethods() {
|
|
541
|
-
this.refetch = this.refetch.bind(this);
|
|
542
|
-
}
|
|
543
|
-
onSubscribe() {
|
|
544
|
-
if (this.listeners.size === 1) {
|
|
545
|
-
__privateGet(this, _currentQuery).addObserver(this);
|
|
546
|
-
if (shouldFetchOnMount(__privateGet(this, _currentQuery), this.options)) {
|
|
547
|
-
__privateMethod(this, _executeFetch, executeFetch_fn).call(this);
|
|
548
|
-
} else {
|
|
549
|
-
this.updateResult();
|
|
550
|
-
}
|
|
551
|
-
__privateMethod(this, _updateTimers, updateTimers_fn).call(this);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
onUnsubscribe() {
|
|
555
|
-
if (!this.hasListeners()) {
|
|
556
|
-
this.destroy();
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
shouldFetchOnReconnect() {
|
|
560
|
-
return shouldFetchOn(
|
|
561
|
-
__privateGet(this, _currentQuery),
|
|
562
|
-
this.options,
|
|
563
|
-
this.options.refetchOnReconnect
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
shouldFetchOnWindowFocus() {
|
|
567
|
-
return shouldFetchOn(
|
|
568
|
-
__privateGet(this, _currentQuery),
|
|
569
|
-
this.options,
|
|
570
|
-
this.options.refetchOnWindowFocus
|
|
571
|
-
);
|
|
572
|
-
}
|
|
573
|
-
destroy() {
|
|
574
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
575
|
-
__privateMethod(this, _clearStaleTimeout, clearStaleTimeout_fn).call(this);
|
|
576
|
-
__privateMethod(this, _clearRefetchInterval, clearRefetchInterval_fn).call(this);
|
|
577
|
-
__privateGet(this, _currentQuery).removeObserver(this);
|
|
578
|
-
}
|
|
579
|
-
setOptions(options) {
|
|
580
|
-
const prevOptions = this.options;
|
|
581
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
582
|
-
this.options = __privateGet(this, _client).defaultQueryOptions(options);
|
|
583
|
-
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, __privateGet(this, _currentQuery)) !== "boolean") {
|
|
584
|
-
throw new Error(
|
|
585
|
-
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
__privateMethod(this, _updateQuery, updateQuery_fn).call(this);
|
|
589
|
-
__privateGet(this, _currentQuery).setOptions(this.options);
|
|
590
|
-
if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
|
|
591
|
-
__privateGet(this, _client).getQueryCache().notify({
|
|
592
|
-
type: "observerOptionsUpdated",
|
|
593
|
-
query: __privateGet(this, _currentQuery),
|
|
594
|
-
observer: this
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
const mounted = this.hasListeners();
|
|
598
|
-
if (mounted && shouldFetchOptionally(
|
|
599
|
-
__privateGet(this, _currentQuery),
|
|
600
|
-
prevQuery,
|
|
601
|
-
this.options,
|
|
602
|
-
prevOptions
|
|
603
|
-
)) {
|
|
604
|
-
__privateMethod(this, _executeFetch, executeFetch_fn).call(this);
|
|
605
|
-
}
|
|
606
|
-
this.updateResult();
|
|
607
|
-
if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || resolveEnabled(this.options.enabled, __privateGet(this, _currentQuery)) !== resolveEnabled(prevOptions.enabled, __privateGet(this, _currentQuery)) || resolveStaleTime(this.options.staleTime, __privateGet(this, _currentQuery)) !== resolveStaleTime(prevOptions.staleTime, __privateGet(this, _currentQuery)))) {
|
|
608
|
-
__privateMethod(this, _updateStaleTimeout, updateStaleTimeout_fn).call(this);
|
|
609
|
-
}
|
|
610
|
-
const nextRefetchInterval = __privateMethod(this, _computeRefetchInterval, computeRefetchInterval_fn).call(this);
|
|
611
|
-
if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || resolveEnabled(this.options.enabled, __privateGet(this, _currentQuery)) !== resolveEnabled(prevOptions.enabled, __privateGet(this, _currentQuery)) || nextRefetchInterval !== __privateGet(this, _currentRefetchInterval))) {
|
|
612
|
-
__privateMethod(this, _updateRefetchInterval, updateRefetchInterval_fn).call(this, nextRefetchInterval);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
getOptimisticResult(options) {
|
|
616
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), options);
|
|
617
|
-
const result = this.createResult(query, options);
|
|
618
|
-
if (shouldAssignObserverCurrentProperties(this, result)) {
|
|
619
|
-
__privateSet(this, _currentResult, result);
|
|
620
|
-
__privateSet(this, _currentResultOptions, this.options);
|
|
621
|
-
__privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
|
|
622
|
-
}
|
|
623
|
-
return result;
|
|
624
|
-
}
|
|
625
|
-
getCurrentResult() {
|
|
626
|
-
return __privateGet(this, _currentResult);
|
|
627
|
-
}
|
|
628
|
-
trackResult(result, onPropTracked) {
|
|
629
|
-
return new Proxy(result, {
|
|
630
|
-
get: (target, key) => {
|
|
631
|
-
this.trackProp(key);
|
|
632
|
-
onPropTracked?.(key);
|
|
633
|
-
if (key === "promise") {
|
|
634
|
-
this.trackProp("data");
|
|
635
|
-
if (!this.options.experimental_prefetchInRender && __privateGet(this, _currentThenable).status === "pending") {
|
|
636
|
-
__privateGet(this, _currentThenable).reject(
|
|
637
|
-
new Error(
|
|
638
|
-
"experimental_prefetchInRender feature flag is not enabled"
|
|
639
|
-
)
|
|
640
|
-
);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
return Reflect.get(target, key);
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
trackProp(key) {
|
|
648
|
-
__privateGet(this, _trackedProps).add(key);
|
|
649
|
-
}
|
|
650
|
-
getCurrentQuery() {
|
|
651
|
-
return __privateGet(this, _currentQuery);
|
|
652
|
-
}
|
|
653
|
-
refetch({ ...options } = {}) {
|
|
654
|
-
return this.fetch({
|
|
655
|
-
...options
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
fetchOptimistic(options) {
|
|
659
|
-
const defaultedOptions = __privateGet(this, _client).defaultQueryOptions(options);
|
|
660
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), defaultedOptions);
|
|
661
|
-
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
662
|
-
}
|
|
663
|
-
fetch(fetchOptions) {
|
|
664
|
-
return __privateMethod(this, _executeFetch, executeFetch_fn).call(this, {
|
|
665
|
-
...fetchOptions,
|
|
666
|
-
cancelRefetch: fetchOptions.cancelRefetch ?? true
|
|
667
|
-
}).then(() => {
|
|
668
|
-
this.updateResult();
|
|
669
|
-
return __privateGet(this, _currentResult);
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
createResult(query, options) {
|
|
673
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
674
|
-
const prevOptions = this.options;
|
|
675
|
-
const prevResult = __privateGet(this, _currentResult);
|
|
676
|
-
const prevResultState = __privateGet(this, _currentResultState);
|
|
677
|
-
const prevResultOptions = __privateGet(this, _currentResultOptions);
|
|
678
|
-
const queryChange = query !== prevQuery;
|
|
679
|
-
const queryInitialState = queryChange ? query.state : __privateGet(this, _currentQueryInitialState);
|
|
680
|
-
const { state } = query;
|
|
681
|
-
let newState = { ...state };
|
|
682
|
-
let isPlaceholderData = false;
|
|
683
|
-
let data;
|
|
684
|
-
if (options._optimisticResults) {
|
|
685
|
-
const mounted = this.hasListeners();
|
|
686
|
-
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
687
|
-
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
688
|
-
if (fetchOnMount || fetchOptionally) {
|
|
689
|
-
newState = {
|
|
690
|
-
...newState,
|
|
691
|
-
...fetchState(state.data, query.options)
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
if (options._optimisticResults === "isRestoring") {
|
|
695
|
-
newState.fetchStatus = "idle";
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
let { error, errorUpdatedAt, status } = newState;
|
|
699
|
-
data = newState.data;
|
|
700
|
-
let skipSelect = false;
|
|
701
|
-
if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
|
|
702
|
-
let placeholderData;
|
|
703
|
-
if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
|
|
704
|
-
placeholderData = prevResult.data;
|
|
705
|
-
skipSelect = true;
|
|
706
|
-
} else {
|
|
707
|
-
placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
|
|
708
|
-
__privateGet(this, _lastQueryWithDefinedData)?.state.data,
|
|
709
|
-
__privateGet(this, _lastQueryWithDefinedData)
|
|
710
|
-
) : options.placeholderData;
|
|
711
|
-
}
|
|
712
|
-
if (placeholderData !== void 0) {
|
|
713
|
-
status = "success";
|
|
714
|
-
data = replaceData(
|
|
715
|
-
prevResult?.data,
|
|
716
|
-
placeholderData,
|
|
717
|
-
options
|
|
718
|
-
);
|
|
719
|
-
isPlaceholderData = true;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
if (options.select && data !== void 0 && !skipSelect) {
|
|
723
|
-
if (prevResult && data === prevResultState?.data && options.select === __privateGet(this, _selectFn)) {
|
|
724
|
-
data = __privateGet(this, _selectResult);
|
|
725
|
-
} else {
|
|
726
|
-
try {
|
|
727
|
-
__privateSet(this, _selectFn, options.select);
|
|
728
|
-
data = options.select(data);
|
|
729
|
-
data = replaceData(prevResult?.data, data, options);
|
|
730
|
-
__privateSet(this, _selectResult, data);
|
|
731
|
-
__privateSet(this, _selectError, null);
|
|
732
|
-
} catch (selectError) {
|
|
733
|
-
__privateSet(this, _selectError, selectError);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
if (__privateGet(this, _selectError)) {
|
|
738
|
-
error = __privateGet(this, _selectError);
|
|
739
|
-
data = __privateGet(this, _selectResult);
|
|
740
|
-
errorUpdatedAt = Date.now();
|
|
741
|
-
status = "error";
|
|
742
|
-
}
|
|
743
|
-
const isFetching = newState.fetchStatus === "fetching";
|
|
744
|
-
const isPending = status === "pending";
|
|
745
|
-
const isError = status === "error";
|
|
746
|
-
const isLoading = isPending && isFetching;
|
|
747
|
-
const hasData = data !== void 0;
|
|
748
|
-
const result = {
|
|
749
|
-
status,
|
|
750
|
-
fetchStatus: newState.fetchStatus,
|
|
751
|
-
isPending,
|
|
752
|
-
isSuccess: status === "success",
|
|
753
|
-
isError,
|
|
754
|
-
isInitialLoading: isLoading,
|
|
755
|
-
isLoading,
|
|
756
|
-
data,
|
|
757
|
-
dataUpdatedAt: newState.dataUpdatedAt,
|
|
758
|
-
error,
|
|
759
|
-
errorUpdatedAt,
|
|
760
|
-
failureCount: newState.fetchFailureCount,
|
|
761
|
-
failureReason: newState.fetchFailureReason,
|
|
762
|
-
errorUpdateCount: newState.errorUpdateCount,
|
|
763
|
-
isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
|
|
764
|
-
isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
765
|
-
isFetching,
|
|
766
|
-
isRefetching: isFetching && !isPending,
|
|
767
|
-
isLoadingError: isError && !hasData,
|
|
768
|
-
isPaused: newState.fetchStatus === "paused",
|
|
769
|
-
isPlaceholderData,
|
|
770
|
-
isRefetchError: isError && hasData,
|
|
771
|
-
isStale: isStale(query, options),
|
|
772
|
-
refetch: this.refetch,
|
|
773
|
-
promise: __privateGet(this, _currentThenable),
|
|
774
|
-
isEnabled: resolveEnabled(options.enabled, query) !== false
|
|
775
|
-
};
|
|
776
|
-
const nextResult = result;
|
|
777
|
-
if (this.options.experimental_prefetchInRender) {
|
|
778
|
-
const hasResultData = nextResult.data !== void 0;
|
|
779
|
-
const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
|
|
780
|
-
const finalizeThenableIfPossible = (thenable) => {
|
|
781
|
-
if (isErrorWithoutData) {
|
|
782
|
-
thenable.reject(nextResult.error);
|
|
783
|
-
} else if (hasResultData) {
|
|
784
|
-
thenable.resolve(nextResult.data);
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
const recreateThenable = () => {
|
|
788
|
-
const pending = __privateSet(this, _currentThenable, nextResult.promise = pendingThenable());
|
|
789
|
-
finalizeThenableIfPossible(pending);
|
|
790
|
-
};
|
|
791
|
-
const prevThenable = __privateGet(this, _currentThenable);
|
|
792
|
-
switch (prevThenable.status) {
|
|
793
|
-
case "pending":
|
|
794
|
-
if (query.queryHash === prevQuery.queryHash) {
|
|
795
|
-
finalizeThenableIfPossible(prevThenable);
|
|
796
|
-
}
|
|
797
|
-
break;
|
|
798
|
-
case "fulfilled":
|
|
799
|
-
if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
|
|
800
|
-
recreateThenable();
|
|
801
|
-
}
|
|
802
|
-
break;
|
|
803
|
-
case "rejected":
|
|
804
|
-
if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
|
|
805
|
-
recreateThenable();
|
|
806
|
-
}
|
|
807
|
-
break;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
return nextResult;
|
|
811
|
-
}
|
|
812
|
-
updateResult() {
|
|
813
|
-
const prevResult = __privateGet(this, _currentResult);
|
|
814
|
-
const nextResult = this.createResult(__privateGet(this, _currentQuery), this.options);
|
|
815
|
-
__privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
|
|
816
|
-
__privateSet(this, _currentResultOptions, this.options);
|
|
817
|
-
if (__privateGet(this, _currentResultState).data !== void 0) {
|
|
818
|
-
__privateSet(this, _lastQueryWithDefinedData, __privateGet(this, _currentQuery));
|
|
819
|
-
}
|
|
820
|
-
if (shallowEqualObjects(nextResult, prevResult)) {
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
__privateSet(this, _currentResult, nextResult);
|
|
824
|
-
const shouldNotifyListeners = () => {
|
|
825
|
-
if (!prevResult) {
|
|
826
|
-
return true;
|
|
827
|
-
}
|
|
828
|
-
const { notifyOnChangeProps } = this.options;
|
|
829
|
-
const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
|
|
830
|
-
if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !__privateGet(this, _trackedProps).size) {
|
|
831
|
-
return true;
|
|
832
|
-
}
|
|
833
|
-
const includedProps = new Set(
|
|
834
|
-
notifyOnChangePropsValue ?? __privateGet(this, _trackedProps)
|
|
835
|
-
);
|
|
836
|
-
if (this.options.throwOnError) {
|
|
837
|
-
includedProps.add("error");
|
|
838
|
-
}
|
|
839
|
-
return Object.keys(__privateGet(this, _currentResult)).some((key) => {
|
|
840
|
-
const typedKey = key;
|
|
841
|
-
const changed = __privateGet(this, _currentResult)[typedKey] !== prevResult[typedKey];
|
|
842
|
-
return changed && includedProps.has(typedKey);
|
|
843
|
-
});
|
|
844
|
-
};
|
|
845
|
-
__privateMethod(this, _notify, notify_fn).call(this, { listeners: shouldNotifyListeners() });
|
|
846
|
-
}
|
|
847
|
-
onQueryUpdate() {
|
|
848
|
-
this.updateResult();
|
|
849
|
-
if (this.hasListeners()) {
|
|
850
|
-
__privateMethod(this, _updateTimers, updateTimers_fn).call(this);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}, _client = new WeakMap(), _currentQuery = new WeakMap(), _currentQueryInitialState = new WeakMap(), _currentResult = new WeakMap(), _currentResultState = new WeakMap(), _currentResultOptions = new WeakMap(), _currentThenable = new WeakMap(), _selectError = new WeakMap(), _selectFn = new WeakMap(), _selectResult = new WeakMap(), _lastQueryWithDefinedData = new WeakMap(), _staleTimeoutId = new WeakMap(), _refetchIntervalId = new WeakMap(), _currentRefetchInterval = new WeakMap(), _trackedProps = new WeakMap(), _executeFetch = new WeakSet(), executeFetch_fn = function(fetchOptions) {
|
|
854
|
-
__privateMethod(this, _updateQuery, updateQuery_fn).call(this);
|
|
855
|
-
let promise = __privateGet(this, _currentQuery).fetch(
|
|
856
|
-
this.options,
|
|
857
|
-
fetchOptions
|
|
858
|
-
);
|
|
859
|
-
if (!fetchOptions?.throwOnError) {
|
|
860
|
-
promise = promise.catch(noop);
|
|
861
|
-
}
|
|
862
|
-
return promise;
|
|
863
|
-
}, _updateStaleTimeout = new WeakSet(), updateStaleTimeout_fn = function() {
|
|
864
|
-
__privateMethod(this, _clearStaleTimeout, clearStaleTimeout_fn).call(this);
|
|
865
|
-
const staleTime = resolveStaleTime(
|
|
866
|
-
this.options.staleTime,
|
|
867
|
-
__privateGet(this, _currentQuery)
|
|
868
|
-
);
|
|
869
|
-
if (isServer || __privateGet(this, _currentResult).isStale || !isValidTimeout(staleTime)) {
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
const time = timeUntilStale(__privateGet(this, _currentResult).dataUpdatedAt, staleTime);
|
|
873
|
-
const timeout = time + 1;
|
|
874
|
-
__privateSet(this, _staleTimeoutId, timeoutManager.setTimeout(() => {
|
|
875
|
-
if (!__privateGet(this, _currentResult).isStale) {
|
|
876
|
-
this.updateResult();
|
|
877
|
-
}
|
|
878
|
-
}, timeout));
|
|
879
|
-
}, _computeRefetchInterval = new WeakSet(), computeRefetchInterval_fn = function() {
|
|
880
|
-
return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(__privateGet(this, _currentQuery)) : this.options.refetchInterval) ?? false;
|
|
881
|
-
}, _updateRefetchInterval = new WeakSet(), updateRefetchInterval_fn = function(nextInterval) {
|
|
882
|
-
__privateMethod(this, _clearRefetchInterval, clearRefetchInterval_fn).call(this);
|
|
883
|
-
__privateSet(this, _currentRefetchInterval, nextInterval);
|
|
884
|
-
if (isServer || resolveEnabled(this.options.enabled, __privateGet(this, _currentQuery)) === false || !isValidTimeout(__privateGet(this, _currentRefetchInterval)) || __privateGet(this, _currentRefetchInterval) === 0) {
|
|
885
|
-
return;
|
|
886
|
-
}
|
|
887
|
-
__privateSet(this, _refetchIntervalId, timeoutManager.setInterval(() => {
|
|
888
|
-
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
889
|
-
__privateMethod(this, _executeFetch, executeFetch_fn).call(this);
|
|
890
|
-
}
|
|
891
|
-
}, __privateGet(this, _currentRefetchInterval)));
|
|
892
|
-
}, _updateTimers = new WeakSet(), updateTimers_fn = function() {
|
|
893
|
-
__privateMethod(this, _updateStaleTimeout, updateStaleTimeout_fn).call(this);
|
|
894
|
-
__privateMethod(this, _updateRefetchInterval, updateRefetchInterval_fn).call(this, __privateMethod(this, _computeRefetchInterval, computeRefetchInterval_fn).call(this));
|
|
895
|
-
}, _clearStaleTimeout = new WeakSet(), clearStaleTimeout_fn = function() {
|
|
896
|
-
if (__privateGet(this, _staleTimeoutId)) {
|
|
897
|
-
timeoutManager.clearTimeout(__privateGet(this, _staleTimeoutId));
|
|
898
|
-
__privateSet(this, _staleTimeoutId, void 0);
|
|
899
|
-
}
|
|
900
|
-
}, _clearRefetchInterval = new WeakSet(), clearRefetchInterval_fn = function() {
|
|
901
|
-
if (__privateGet(this, _refetchIntervalId)) {
|
|
902
|
-
timeoutManager.clearInterval(__privateGet(this, _refetchIntervalId));
|
|
903
|
-
__privateSet(this, _refetchIntervalId, void 0);
|
|
904
|
-
}
|
|
905
|
-
}, _updateQuery = new WeakSet(), updateQuery_fn = function() {
|
|
906
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), this.options);
|
|
907
|
-
if (query === __privateGet(this, _currentQuery)) {
|
|
908
|
-
return;
|
|
909
|
-
}
|
|
910
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
911
|
-
__privateSet(this, _currentQuery, query);
|
|
912
|
-
__privateSet(this, _currentQueryInitialState, query.state);
|
|
913
|
-
if (this.hasListeners()) {
|
|
914
|
-
prevQuery?.removeObserver(this);
|
|
915
|
-
query.addObserver(this);
|
|
916
|
-
}
|
|
917
|
-
}, _notify = new WeakSet(), notify_fn = function(notifyOptions) {
|
|
918
|
-
notifyManager.batch(() => {
|
|
919
|
-
if (notifyOptions.listeners) {
|
|
920
|
-
this.listeners.forEach((listener) => {
|
|
921
|
-
listener(__privateGet(this, _currentResult));
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
__privateGet(this, _client).getQueryCache().notify({
|
|
925
|
-
query: __privateGet(this, _currentQuery),
|
|
926
|
-
type: "observerResultsUpdated"
|
|
927
|
-
});
|
|
928
|
-
});
|
|
929
|
-
}, _a4);
|
|
930
|
-
function shouldLoadOnMount(query, options) {
|
|
931
|
-
return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
|
|
932
|
-
}
|
|
933
|
-
function shouldFetchOnMount(query, options) {
|
|
934
|
-
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
935
|
-
}
|
|
936
|
-
function shouldFetchOn(query, options, field) {
|
|
937
|
-
if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
|
|
938
|
-
const value = typeof field === "function" ? field(query) : field;
|
|
939
|
-
return value === "always" || value !== false && isStale(query, options);
|
|
940
|
-
}
|
|
941
|
-
return false;
|
|
942
|
-
}
|
|
943
|
-
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
944
|
-
return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
945
|
-
}
|
|
946
|
-
function isStale(query, options) {
|
|
947
|
-
return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
|
|
948
|
-
}
|
|
949
|
-
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
950
|
-
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
|
|
951
|
-
return true;
|
|
952
|
-
}
|
|
953
|
-
return false;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
957
|
-
function getDefaultState() {
|
|
958
|
-
return {
|
|
959
|
-
context: void 0,
|
|
960
|
-
data: void 0,
|
|
961
|
-
error: null,
|
|
962
|
-
failureCount: 0,
|
|
963
|
-
failureReason: null,
|
|
964
|
-
isPaused: false,
|
|
965
|
-
status: "idle",
|
|
966
|
-
variables: void 0,
|
|
967
|
-
submittedAt: 0
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
// node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
|
|
972
|
-
var _client2, _currentResult2, _currentMutation, _mutateOptions, _updateResult, updateResult_fn, _notify2, notify_fn2, _a5;
|
|
973
|
-
var MutationObserver = (_a5 = class extends Subscribable {
|
|
974
|
-
constructor(client, options) {
|
|
975
|
-
super();
|
|
976
|
-
__privateAdd(this, _updateResult);
|
|
977
|
-
__privateAdd(this, _notify2);
|
|
978
|
-
__privateAdd(this, _client2, void 0);
|
|
979
|
-
__privateAdd(this, _currentResult2, void 0);
|
|
980
|
-
__privateAdd(this, _currentMutation, void 0);
|
|
981
|
-
__privateAdd(this, _mutateOptions, void 0);
|
|
982
|
-
__privateSet(this, _client2, client);
|
|
983
|
-
this.setOptions(options);
|
|
984
|
-
this.bindMethods();
|
|
985
|
-
__privateMethod(this, _updateResult, updateResult_fn).call(this);
|
|
986
|
-
}
|
|
987
|
-
bindMethods() {
|
|
988
|
-
this.mutate = this.mutate.bind(this);
|
|
989
|
-
this.reset = this.reset.bind(this);
|
|
990
|
-
}
|
|
991
|
-
setOptions(options) {
|
|
992
|
-
const prevOptions = this.options;
|
|
993
|
-
this.options = __privateGet(this, _client2).defaultMutationOptions(options);
|
|
994
|
-
if (!shallowEqualObjects(this.options, prevOptions)) {
|
|
995
|
-
__privateGet(this, _client2).getMutationCache().notify({
|
|
996
|
-
type: "observerOptionsUpdated",
|
|
997
|
-
mutation: __privateGet(this, _currentMutation),
|
|
998
|
-
observer: this
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {
|
|
1002
|
-
this.reset();
|
|
1003
|
-
} else if (__privateGet(this, _currentMutation)?.state.status === "pending") {
|
|
1004
|
-
__privateGet(this, _currentMutation).setOptions(this.options);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
onUnsubscribe() {
|
|
1008
|
-
if (!this.hasListeners()) {
|
|
1009
|
-
__privateGet(this, _currentMutation)?.removeObserver(this);
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
onMutationUpdate(action) {
|
|
1013
|
-
__privateMethod(this, _updateResult, updateResult_fn).call(this);
|
|
1014
|
-
__privateMethod(this, _notify2, notify_fn2).call(this, action);
|
|
1015
|
-
}
|
|
1016
|
-
getCurrentResult() {
|
|
1017
|
-
return __privateGet(this, _currentResult2);
|
|
1018
|
-
}
|
|
1019
|
-
reset() {
|
|
1020
|
-
__privateGet(this, _currentMutation)?.removeObserver(this);
|
|
1021
|
-
__privateSet(this, _currentMutation, void 0);
|
|
1022
|
-
__privateMethod(this, _updateResult, updateResult_fn).call(this);
|
|
1023
|
-
__privateMethod(this, _notify2, notify_fn2).call(this);
|
|
1024
|
-
}
|
|
1025
|
-
mutate(variables, options) {
|
|
1026
|
-
__privateSet(this, _mutateOptions, options);
|
|
1027
|
-
__privateGet(this, _currentMutation)?.removeObserver(this);
|
|
1028
|
-
__privateSet(this, _currentMutation, __privateGet(this, _client2).getMutationCache().build(__privateGet(this, _client2), this.options));
|
|
1029
|
-
__privateGet(this, _currentMutation).addObserver(this);
|
|
1030
|
-
return __privateGet(this, _currentMutation).execute(variables);
|
|
1031
|
-
}
|
|
1032
|
-
}, _client2 = new WeakMap(), _currentResult2 = new WeakMap(), _currentMutation = new WeakMap(), _mutateOptions = new WeakMap(), _updateResult = new WeakSet(), updateResult_fn = function() {
|
|
1033
|
-
const state = __privateGet(this, _currentMutation)?.state ?? getDefaultState();
|
|
1034
|
-
__privateSet(this, _currentResult2, {
|
|
1035
|
-
...state,
|
|
1036
|
-
isPending: state.status === "pending",
|
|
1037
|
-
isSuccess: state.status === "success",
|
|
1038
|
-
isError: state.status === "error",
|
|
1039
|
-
isIdle: state.status === "idle",
|
|
1040
|
-
mutate: this.mutate,
|
|
1041
|
-
reset: this.reset
|
|
1042
|
-
});
|
|
1043
|
-
}, _notify2 = new WeakSet(), notify_fn2 = function(action) {
|
|
1044
|
-
notifyManager.batch(() => {
|
|
1045
|
-
if (__privateGet(this, _mutateOptions) && this.hasListeners()) {
|
|
1046
|
-
const variables = __privateGet(this, _currentResult2).variables;
|
|
1047
|
-
const onMutateResult = __privateGet(this, _currentResult2).context;
|
|
1048
|
-
const context = {
|
|
1049
|
-
client: __privateGet(this, _client2),
|
|
1050
|
-
meta: this.options.meta,
|
|
1051
|
-
mutationKey: this.options.mutationKey
|
|
1052
|
-
};
|
|
1053
|
-
if (action?.type === "success") {
|
|
1054
|
-
try {
|
|
1055
|
-
__privateGet(this, _mutateOptions).onSuccess?.(
|
|
1056
|
-
action.data,
|
|
1057
|
-
variables,
|
|
1058
|
-
onMutateResult,
|
|
1059
|
-
context
|
|
1060
|
-
);
|
|
1061
|
-
} catch (e) {
|
|
1062
|
-
void Promise.reject(e);
|
|
1063
|
-
}
|
|
1064
|
-
try {
|
|
1065
|
-
__privateGet(this, _mutateOptions).onSettled?.(
|
|
1066
|
-
action.data,
|
|
1067
|
-
null,
|
|
1068
|
-
variables,
|
|
1069
|
-
onMutateResult,
|
|
1070
|
-
context
|
|
1071
|
-
);
|
|
1072
|
-
} catch (e) {
|
|
1073
|
-
void Promise.reject(e);
|
|
1074
|
-
}
|
|
1075
|
-
} else if (action?.type === "error") {
|
|
1076
|
-
try {
|
|
1077
|
-
__privateGet(this, _mutateOptions).onError?.(
|
|
1078
|
-
action.error,
|
|
1079
|
-
variables,
|
|
1080
|
-
onMutateResult,
|
|
1081
|
-
context
|
|
1082
|
-
);
|
|
1083
|
-
} catch (e) {
|
|
1084
|
-
void Promise.reject(e);
|
|
1085
|
-
}
|
|
1086
|
-
try {
|
|
1087
|
-
__privateGet(this, _mutateOptions).onSettled?.(
|
|
1088
|
-
void 0,
|
|
1089
|
-
action.error,
|
|
1090
|
-
variables,
|
|
1091
|
-
onMutateResult,
|
|
1092
|
-
context
|
|
1093
|
-
);
|
|
1094
|
-
} catch (e) {
|
|
1095
|
-
void Promise.reject(e);
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
this.listeners.forEach((listener) => {
|
|
1100
|
-
listener(__privateGet(this, _currentResult2));
|
|
1101
|
-
});
|
|
1102
|
-
});
|
|
1103
|
-
}, _a5);
|
|
1104
|
-
|
|
1105
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
1106
|
-
import * as React from "react";
|
|
1107
|
-
import { jsx } from "react/jsx-runtime";
|
|
1108
|
-
var QueryClientContext = React.createContext(
|
|
1109
|
-
void 0
|
|
1110
|
-
);
|
|
1111
|
-
var useQueryClient = (queryClient) => {
|
|
1112
|
-
const client = React.useContext(QueryClientContext);
|
|
1113
|
-
if (queryClient) {
|
|
1114
|
-
return queryClient;
|
|
1115
|
-
}
|
|
1116
|
-
if (!client) {
|
|
1117
|
-
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1118
|
-
}
|
|
1119
|
-
return client;
|
|
1120
|
-
};
|
|
1121
|
-
|
|
1122
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
1123
|
-
import * as React2 from "react";
|
|
1124
|
-
var IsRestoringContext = React2.createContext(false);
|
|
1125
|
-
var useIsRestoring = () => React2.useContext(IsRestoringContext);
|
|
1126
|
-
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
1127
|
-
|
|
1128
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
1129
|
-
import * as React3 from "react";
|
|
1130
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
1131
|
-
function createValue() {
|
|
1132
|
-
let isReset = false;
|
|
1133
|
-
return {
|
|
1134
|
-
clearReset: () => {
|
|
1135
|
-
isReset = false;
|
|
1136
|
-
},
|
|
1137
|
-
reset: () => {
|
|
1138
|
-
isReset = true;
|
|
1139
|
-
},
|
|
1140
|
-
isReset: () => {
|
|
1141
|
-
return isReset;
|
|
1142
|
-
}
|
|
1143
|
-
};
|
|
1144
|
-
}
|
|
1145
|
-
var QueryErrorResetBoundaryContext = React3.createContext(createValue());
|
|
1146
|
-
var useQueryErrorResetBoundary = () => React3.useContext(QueryErrorResetBoundaryContext);
|
|
1147
|
-
|
|
1148
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
1149
|
-
import * as React4 from "react";
|
|
1150
|
-
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
1151
|
-
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
1152
|
-
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
1153
|
-
if (!errorResetBoundary.isReset()) {
|
|
1154
|
-
options.retryOnMount = false;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
};
|
|
1158
|
-
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
|
1159
|
-
React4.useEffect(() => {
|
|
1160
|
-
errorResetBoundary.clearReset();
|
|
1161
|
-
}, [errorResetBoundary]);
|
|
1162
|
-
};
|
|
1163
|
-
var getHasError = ({
|
|
1164
|
-
result,
|
|
1165
|
-
errorResetBoundary,
|
|
1166
|
-
throwOnError,
|
|
1167
|
-
query,
|
|
1168
|
-
suspense
|
|
1169
|
-
}) => {
|
|
1170
|
-
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
|
|
1171
|
-
};
|
|
1172
|
-
|
|
1173
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/suspense.js
|
|
1174
|
-
var ensureSuspenseTimers = (defaultedOptions) => {
|
|
1175
|
-
if (defaultedOptions.suspense) {
|
|
1176
|
-
const MIN_SUSPENSE_TIME_MS = 1e3;
|
|
1177
|
-
const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
|
|
1178
|
-
const originalStaleTime = defaultedOptions.staleTime;
|
|
1179
|
-
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
|
|
1180
|
-
if (typeof defaultedOptions.gcTime === "number") {
|
|
1181
|
-
defaultedOptions.gcTime = Math.max(
|
|
1182
|
-
defaultedOptions.gcTime,
|
|
1183
|
-
MIN_SUSPENSE_TIME_MS
|
|
1184
|
-
);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
};
|
|
1188
|
-
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
|
|
1189
|
-
var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
|
|
1190
|
-
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
|
1191
|
-
errorResetBoundary.clearReset();
|
|
1192
|
-
});
|
|
1193
|
-
|
|
1194
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
1195
|
-
import * as React5 from "react";
|
|
1196
|
-
function useBaseQuery(options, Observer, queryClient) {
|
|
1197
|
-
if (false) {
|
|
1198
|
-
if (typeof options !== "object" || Array.isArray(options)) {
|
|
1199
|
-
throw new Error(
|
|
1200
|
-
'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'
|
|
1201
|
-
);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
const isRestoring = useIsRestoring();
|
|
1205
|
-
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
1206
|
-
const client = useQueryClient(queryClient);
|
|
1207
|
-
const defaultedOptions = client.defaultQueryOptions(options);
|
|
1208
|
-
client.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
1209
|
-
defaultedOptions
|
|
1210
|
-
);
|
|
1211
|
-
const query = client.getQueryCache().get(defaultedOptions.queryHash);
|
|
1212
|
-
if (false) {
|
|
1213
|
-
if (!defaultedOptions.queryFn) {
|
|
1214
|
-
console.error(
|
|
1215
|
-
`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
1216
|
-
);
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
|
1220
|
-
ensureSuspenseTimers(defaultedOptions);
|
|
1221
|
-
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
|
|
1222
|
-
useClearResetErrorBoundary(errorResetBoundary);
|
|
1223
|
-
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
|
1224
|
-
const [observer] = React5.useState(
|
|
1225
|
-
() => new Observer(
|
|
1226
|
-
client,
|
|
1227
|
-
defaultedOptions
|
|
1228
|
-
)
|
|
1229
|
-
);
|
|
1230
|
-
const result = observer.getOptimisticResult(defaultedOptions);
|
|
1231
|
-
const shouldSubscribe = !isRestoring && options.subscribed !== false;
|
|
1232
|
-
React5.useSyncExternalStore(
|
|
1233
|
-
React5.useCallback(
|
|
1234
|
-
(onStoreChange) => {
|
|
1235
|
-
const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
|
|
1236
|
-
observer.updateResult();
|
|
1237
|
-
return unsubscribe;
|
|
1238
|
-
},
|
|
1239
|
-
[observer, shouldSubscribe]
|
|
1240
|
-
),
|
|
1241
|
-
() => observer.getCurrentResult(),
|
|
1242
|
-
() => observer.getCurrentResult()
|
|
1243
|
-
);
|
|
1244
|
-
React5.useEffect(() => {
|
|
1245
|
-
observer.setOptions(defaultedOptions);
|
|
1246
|
-
}, [defaultedOptions, observer]);
|
|
1247
|
-
if (shouldSuspend(defaultedOptions, result)) {
|
|
1248
|
-
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
|
|
1249
|
-
}
|
|
1250
|
-
if (getHasError({
|
|
1251
|
-
result,
|
|
1252
|
-
errorResetBoundary,
|
|
1253
|
-
throwOnError: defaultedOptions.throwOnError,
|
|
1254
|
-
query,
|
|
1255
|
-
suspense: defaultedOptions.suspense
|
|
1256
|
-
})) {
|
|
1257
|
-
throw result.error;
|
|
1258
|
-
}
|
|
1259
|
-
;
|
|
1260
|
-
client.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
1261
|
-
defaultedOptions,
|
|
1262
|
-
result
|
|
1263
|
-
);
|
|
1264
|
-
if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) {
|
|
1265
|
-
const promise = isNewCacheEntry ? (
|
|
1266
|
-
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1267
|
-
fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
|
|
1268
|
-
) : (
|
|
1269
|
-
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
1270
|
-
query?.promise
|
|
1271
|
-
);
|
|
1272
|
-
promise?.catch(noop).finally(() => {
|
|
1273
|
-
observer.updateResult();
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
|
-
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
1280
|
-
function useQuery(options, queryClient) {
|
|
1281
|
-
return useBaseQuery(options, QueryObserver, queryClient);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
// node_modules/.pnpm/@tanstack+react-query@5.90.20_react@19.2.4/node_modules/@tanstack/react-query/build/modern/useMutation.js
|
|
1285
|
-
import * as React6 from "react";
|
|
1286
|
-
function useMutation(options, queryClient) {
|
|
1287
|
-
const client = useQueryClient(queryClient);
|
|
1288
|
-
const [observer] = React6.useState(
|
|
1289
|
-
() => new MutationObserver(
|
|
1290
|
-
client,
|
|
1291
|
-
options
|
|
1292
|
-
)
|
|
1293
|
-
);
|
|
1294
|
-
React6.useEffect(() => {
|
|
1295
|
-
observer.setOptions(options);
|
|
1296
|
-
}, [observer, options]);
|
|
1297
|
-
const result = React6.useSyncExternalStore(
|
|
1298
|
-
React6.useCallback(
|
|
1299
|
-
(onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)),
|
|
1300
|
-
[observer]
|
|
1301
|
-
),
|
|
1302
|
-
() => observer.getCurrentResult(),
|
|
1303
|
-
() => observer.getCurrentResult()
|
|
1304
|
-
);
|
|
1305
|
-
const mutate = React6.useCallback(
|
|
1306
|
-
(variables, mutateOptions) => {
|
|
1307
|
-
observer.mutate(variables, mutateOptions).catch(noop);
|
|
1308
|
-
},
|
|
1309
|
-
[observer]
|
|
1310
|
-
);
|
|
1311
|
-
if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {
|
|
1312
|
-
throw result.error;
|
|
1313
|
-
}
|
|
1314
|
-
return { ...result, mutate, mutateAsync: result.mutate };
|
|
1315
|
-
}
|
|
13
|
+
import { useState, useEffect, useCallback, useMemo } from "react";
|
|
14
|
+
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
1316
15
|
|
|
1317
16
|
// node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/bind.js
|
|
1318
17
|
function bind(fn, thisArg) {
|
|
@@ -1354,7 +53,7 @@ var isFunction = typeOfTest("function");
|
|
|
1354
53
|
var isNumber = typeOfTest("number");
|
|
1355
54
|
var isObject = (thing) => thing !== null && typeof thing === "object";
|
|
1356
55
|
var isBoolean = (thing) => thing === true || thing === false;
|
|
1357
|
-
var
|
|
56
|
+
var isPlainObject = (val) => {
|
|
1358
57
|
if (kindOf(val) !== "object") {
|
|
1359
58
|
return false;
|
|
1360
59
|
}
|
|
@@ -1437,9 +136,9 @@ function merge() {
|
|
|
1437
136
|
const result = {};
|
|
1438
137
|
const assignValue = (val, key) => {
|
|
1439
138
|
const targetKey = caseless && findKey(result, key) || key;
|
|
1440
|
-
if (
|
|
139
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
1441
140
|
result[targetKey] = merge(result[targetKey], val);
|
|
1442
|
-
} else if (
|
|
141
|
+
} else if (isPlainObject(val)) {
|
|
1443
142
|
result[targetKey] = merge({}, val);
|
|
1444
143
|
} else if (isArray(val)) {
|
|
1445
144
|
result[targetKey] = val.slice();
|
|
@@ -1610,7 +309,7 @@ var toObjectSet = (arrayOrString, delimiter) => {
|
|
|
1610
309
|
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
1611
310
|
return obj;
|
|
1612
311
|
};
|
|
1613
|
-
var
|
|
312
|
+
var noop = () => {
|
|
1614
313
|
};
|
|
1615
314
|
var toFiniteNumber = (value, defaultValue) => {
|
|
1616
315
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
@@ -1676,7 +375,7 @@ var utils_default = {
|
|
|
1676
375
|
isNumber,
|
|
1677
376
|
isBoolean,
|
|
1678
377
|
isObject,
|
|
1679
|
-
isPlainObject
|
|
378
|
+
isPlainObject,
|
|
1680
379
|
isEmptyObject,
|
|
1681
380
|
isReadableStream,
|
|
1682
381
|
isRequest,
|
|
@@ -1713,7 +412,7 @@ var utils_default = {
|
|
|
1713
412
|
freezeMethods,
|
|
1714
413
|
toObjectSet,
|
|
1715
414
|
toCamelCase,
|
|
1716
|
-
noop
|
|
415
|
+
noop,
|
|
1717
416
|
toFiniteNumber,
|
|
1718
417
|
findKey,
|
|
1719
418
|
global: _global,
|
|
@@ -4140,7 +2839,7 @@ var fetchApi = {
|
|
|
4140
2839
|
};
|
|
4141
2840
|
|
|
4142
2841
|
// src/services/loadRemoteModule.ts
|
|
4143
|
-
import * as
|
|
2842
|
+
import * as React from "react";
|
|
4144
2843
|
import * as ReactDOM from "react-dom";
|
|
4145
2844
|
|
|
4146
2845
|
// src/services/metadataLoader.ts
|
|
@@ -4314,8 +3013,8 @@ function useSettings(defaultSettings, options) {
|
|
|
4314
3013
|
refetchInterval
|
|
4315
3014
|
} = options;
|
|
4316
3015
|
const queryClient = useQueryClient();
|
|
4317
|
-
const [settings, setSettings] =
|
|
4318
|
-
const [savedSettings, setSavedSettings] =
|
|
3016
|
+
const [settings, setSettings] = useState(defaultSettings);
|
|
3017
|
+
const [savedSettings, setSavedSettings] = useState(defaultSettings);
|
|
4319
3018
|
const {
|
|
4320
3019
|
data,
|
|
4321
3020
|
isLoading,
|
|
@@ -4330,7 +3029,7 @@ function useSettings(defaultSettings, options) {
|
|
|
4330
3029
|
enabled,
|
|
4331
3030
|
refetchInterval
|
|
4332
3031
|
});
|
|
4333
|
-
|
|
3032
|
+
useEffect(() => {
|
|
4334
3033
|
if (data) {
|
|
4335
3034
|
setSettings(data);
|
|
4336
3035
|
setSavedSettings(data);
|
|
@@ -4356,16 +3055,16 @@ function useSettings(defaultSettings, options) {
|
|
|
4356
3055
|
() => JSON.stringify(settings) !== JSON.stringify(savedSettings),
|
|
4357
3056
|
[settings, savedSettings]
|
|
4358
3057
|
);
|
|
4359
|
-
const updateField =
|
|
3058
|
+
const updateField = useCallback((key, value) => {
|
|
4360
3059
|
setSettings((prev) => ({ ...prev, [key]: value }));
|
|
4361
3060
|
}, []);
|
|
4362
|
-
const updateSettings =
|
|
3061
|
+
const updateSettings = useCallback((partial) => {
|
|
4363
3062
|
setSettings((prev) => ({ ...prev, ...partial }));
|
|
4364
3063
|
}, []);
|
|
4365
|
-
const discard =
|
|
3064
|
+
const discard = useCallback(() => {
|
|
4366
3065
|
setSettings(savedSettings);
|
|
4367
3066
|
}, [savedSettings]);
|
|
4368
|
-
const save =
|
|
3067
|
+
const save = useCallback(async () => {
|
|
4369
3068
|
const payload = toPayload(settings);
|
|
4370
3069
|
await saveMutation.mutateAsync(payload);
|
|
4371
3070
|
}, [settings, toPayload, saveMutation]);
|
|
@@ -4385,8 +3084,9 @@ function useSettings(defaultSettings, options) {
|
|
|
4385
3084
|
}
|
|
4386
3085
|
|
|
4387
3086
|
// src/hooks/useApi.ts
|
|
3087
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
4388
3088
|
function useApi(type, key, path, params, enabled = true, refetchInterval) {
|
|
4389
|
-
return
|
|
3089
|
+
return useQuery2({
|
|
4390
3090
|
queryKey: key,
|
|
4391
3091
|
queryFn: () => {
|
|
4392
3092
|
switch (type) {
|
|
@@ -4404,13 +3104,13 @@ function useApi(type, key, path, params, enabled = true, refetchInterval) {
|
|
|
4404
3104
|
}
|
|
4405
3105
|
|
|
4406
3106
|
// src/hooks/useAvailableSubservices.ts
|
|
4407
|
-
import { useEffect as
|
|
3107
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
4408
3108
|
function useAvailableSubservices(serviceKey, fallbackCount = 4) {
|
|
4409
|
-
const [options, setOptions] =
|
|
3109
|
+
const [options, setOptions] = useState2(
|
|
4410
3110
|
Array.from({ length: fallbackCount }).map((_, i) => ({ label: `Channel ${i + 1}`, value: `${i}` }))
|
|
4411
3111
|
);
|
|
4412
|
-
const [loading, setLoading] =
|
|
4413
|
-
|
|
3112
|
+
const [loading, setLoading] = useState2(false);
|
|
3113
|
+
useEffect2(() => {
|
|
4414
3114
|
let mounted = true;
|
|
4415
3115
|
(async () => {
|
|
4416
3116
|
setLoading(true);
|