@jskit-ai/assistant-voice 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/examples/conversation/package.json +8 -8
  2. package/package.json +1 -1
  3. package/examples/conversation/dist/assets/error-DOwCrGXH.js +0 -1
  4. package/examples/conversation/dist/assets/index-Bq1DwQwF.js +0 -90
  5. package/examples/conversation/dist/assets/index-Bw7_l3Cu.css +0 -1
  6. package/examples/conversation/dist/assets/placement-CUwf_TAl.js +0 -1
  7. package/examples/conversation/dist/assets/placementTopology-CUwf_TAl.js +0 -1
  8. package/examples/conversation/dist/index.html +0 -3
  9. package/examples/conversation/node_modules/.vite/deps/@jskit-ai_kernel_client_moduleBootstrap.js +0 -824
  10. package/examples/conversation/node_modules/.vite/deps/@jskit-ai_kernel_client_moduleBootstrap.js.map +0 -1
  11. package/examples/conversation/node_modules/.vite/deps/@mdi_js.js +0 -7450
  12. package/examples/conversation/node_modules/.vite/deps/@mdi_js.js.map +0 -1
  13. package/examples/conversation/node_modules/.vite/deps/@tanstack_vue-query.js +0 -3965
  14. package/examples/conversation/node_modules/.vite/deps/@tanstack_vue-query.js.map +0 -1
  15. package/examples/conversation/node_modules/.vite/deps/VTooltip-Nwckus73.js +0 -2311
  16. package/examples/conversation/node_modules/.vite/deps/VTooltip-Nwckus73.js.map +0 -1
  17. package/examples/conversation/node_modules/.vite/deps/_metadata.json +0 -110
  18. package/examples/conversation/node_modules/.vite/deps/defineComponent-Bx_4rnHZ.js +0 -710
  19. package/examples/conversation/node_modules/.vite/deps/defineComponent-Bx_4rnHZ.js.map +0 -1
  20. package/examples/conversation/node_modules/.vite/deps/dist-CUIjXXPV.js +0 -3878
  21. package/examples/conversation/node_modules/.vite/deps/dist-CUIjXXPV.js.map +0 -1
  22. package/examples/conversation/node_modules/.vite/deps/hotkey-parsing-B5h5TiMG.js +0 -1214
  23. package/examples/conversation/node_modules/.vite/deps/hotkey-parsing-B5h5TiMG.js.map +0 -1
  24. package/examples/conversation/node_modules/.vite/deps/icons-DPtxVIU0.js +0 -98
  25. package/examples/conversation/node_modules/.vite/deps/icons-DPtxVIU0.js.map +0 -1
  26. package/examples/conversation/node_modules/.vite/deps/json-rest-schema.js +0 -2071
  27. package/examples/conversation/node_modules/.vite/deps/json-rest-schema.js.map +0 -1
  28. package/examples/conversation/node_modules/.vite/deps/package.json +0 -3
  29. package/examples/conversation/node_modules/.vite/deps/pinia.js +0 -1453
  30. package/examples/conversation/node_modules/.vite/deps/pinia.js.map +0 -1
  31. package/examples/conversation/node_modules/.vite/deps/socket__io-client.js +0 -3899
  32. package/examples/conversation/node_modules/.vite/deps/socket__io-client.js.map +0 -1
  33. package/examples/conversation/node_modules/.vite/deps/theme-BSn2V8xv.js +0 -1301
  34. package/examples/conversation/node_modules/.vite/deps/theme-BSn2V8xv.js.map +0 -1
  35. package/examples/conversation/node_modules/.vite/deps/vue-router.js +0 -2989
  36. package/examples/conversation/node_modules/.vite/deps/vue-router.js.map +0 -1
  37. package/examples/conversation/node_modules/.vite/deps/vue.js +0 -2
  38. package/examples/conversation/node_modules/.vite/deps/vue.runtime.esm-bundler-DWdvffrK.js +0 -8890
  39. package/examples/conversation/node_modules/.vite/deps/vue.runtime.esm-bundler-DWdvffrK.js.map +0 -1
  40. package/examples/conversation/node_modules/.vite/deps/vuetify.js +0 -413
  41. package/examples/conversation/node_modules/.vite/deps/vuetify.js.map +0 -1
  42. package/examples/conversation/node_modules/.vite/deps/vuetify_components.js +0 -25370
  43. package/examples/conversation/node_modules/.vite/deps/vuetify_components.js.map +0 -1
  44. package/examples/conversation/node_modules/.vite/deps/vuetify_directives.js +0 -132
  45. package/examples/conversation/node_modules/.vite/deps/vuetify_directives.js.map +0 -1
  46. package/examples/conversation/node_modules/.vite/deps/vuetify_iconsets_mdi-svg.js +0 -70
  47. package/examples/conversation/node_modules/.vite/deps/vuetify_iconsets_mdi-svg.js.map +0 -1
@@ -1,3965 +0,0 @@
1
- import { $n as toRefs, Gn as readonly, Jn as shallowReadonly, Kn as ref, Nn as getCurrentScope, Ot as nextTick, Rn as isRef, U as computed, Vn as onScopeDispose, Wn as reactive, Yn as shallowRef, _n as watchEffect, gn as watch, ht as hasInjectionContext, nr as unref, qn as shallowReactive, xt as inject } from "./vue.runtime.esm-bundler-DWdvffrK.js";
2
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/subscribable.js
3
- var Subscribable = class {
4
- constructor() {
5
- this.listeners = /* @__PURE__ */ new Set();
6
- this.subscribe = this.subscribe.bind(this);
7
- }
8
- subscribe(listener) {
9
- this.listeners.add(listener);
10
- this.onSubscribe();
11
- return () => {
12
- this.listeners.delete(listener);
13
- this.onUnsubscribe();
14
- };
15
- }
16
- hasListeners() {
17
- return this.listeners.size > 0;
18
- }
19
- onSubscribe() {}
20
- onUnsubscribe() {}
21
- };
22
- //#endregion
23
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/focusManager.js
24
- var FocusManager = class extends Subscribable {
25
- #focused;
26
- #cleanup;
27
- #setup;
28
- constructor() {
29
- super();
30
- this.#setup = (onFocus) => {
31
- if (typeof window !== "undefined" && window.addEventListener) {
32
- const listener = () => onFocus();
33
- window.addEventListener("visibilitychange", listener, false);
34
- return () => {
35
- window.removeEventListener("visibilitychange", listener);
36
- };
37
- }
38
- };
39
- }
40
- onSubscribe() {
41
- if (!this.#cleanup) this.setEventListener(this.#setup);
42
- }
43
- onUnsubscribe() {
44
- if (!this.hasListeners()) {
45
- this.#cleanup?.();
46
- this.#cleanup = void 0;
47
- }
48
- }
49
- setEventListener(setup) {
50
- this.#setup = setup;
51
- this.#cleanup?.();
52
- this.#cleanup = setup((focused) => {
53
- if (typeof focused === "boolean") this.setFocused(focused);
54
- else this.onFocus();
55
- });
56
- }
57
- setFocused(focused) {
58
- if (this.#focused !== focused) {
59
- this.#focused = focused;
60
- this.onFocus();
61
- }
62
- }
63
- onFocus() {
64
- const isFocused = this.isFocused();
65
- this.listeners.forEach((listener) => {
66
- listener(isFocused);
67
- });
68
- }
69
- isFocused() {
70
- if (typeof this.#focused === "boolean") return this.#focused;
71
- return globalThis.document?.visibilityState !== "hidden";
72
- }
73
- };
74
- var focusManager = new FocusManager();
75
- //#endregion
76
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/timeoutManager.js
77
- var defaultTimeoutProvider = {
78
- setTimeout: (callback, delay) => setTimeout(callback, delay),
79
- clearTimeout: (timeoutId) => clearTimeout(timeoutId),
80
- setInterval: (callback, delay) => setInterval(callback, delay),
81
- clearInterval: (intervalId) => clearInterval(intervalId)
82
- };
83
- var TimeoutManager = class {
84
- #provider = defaultTimeoutProvider;
85
- #providerCalled = false;
86
- setTimeoutProvider(provider) {
87
- if (this.#providerCalled && provider !== this.#provider) console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, {
88
- previous: this.#provider,
89
- provider
90
- });
91
- this.#provider = provider;
92
- this.#providerCalled = false;
93
- }
94
- setTimeout(callback, delay) {
95
- this.#providerCalled = true;
96
- return this.#provider.setTimeout(callback, delay);
97
- }
98
- clearTimeout(timeoutId) {
99
- this.#provider.clearTimeout(timeoutId);
100
- }
101
- setInterval(callback, delay) {
102
- this.#providerCalled = true;
103
- return this.#provider.setInterval(callback, delay);
104
- }
105
- clearInterval(intervalId) {
106
- this.#provider.clearInterval(intervalId);
107
- }
108
- };
109
- var timeoutManager = new TimeoutManager();
110
- function systemSetTimeoutZero(callback) {
111
- setTimeout(callback, 0);
112
- }
113
- //#endregion
114
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/utils.js
115
- var isServer = typeof window === "undefined" || "Deno" in globalThis;
116
- function noop() {}
117
- function functionalUpdate(updater, input) {
118
- return typeof updater === "function" ? updater(input) : updater;
119
- }
120
- function isValidTimeout(value) {
121
- return typeof value === "number" && value >= 0 && value !== Infinity;
122
- }
123
- function timeUntilStale(updatedAt, staleTime) {
124
- return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
125
- }
126
- function resolveStaleTime(staleTime, query) {
127
- return typeof staleTime === "function" ? staleTime(query) : staleTime;
128
- }
129
- function resolveQueryBoolean(option, query) {
130
- return typeof option === "function" ? option(query) : option;
131
- }
132
- function matchQuery(filters, query) {
133
- const { type = "all", exact, fetchStatus, predicate, queryKey, stale } = filters;
134
- if (queryKey) {
135
- if (exact) {
136
- if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false;
137
- } else if (!partialMatchKey(query.queryKey, queryKey)) return false;
138
- }
139
- if (type !== "all") {
140
- const isActive = query.isActive();
141
- if (type === "active" && !isActive) return false;
142
- if (type === "inactive" && isActive) return false;
143
- }
144
- if (typeof stale === "boolean" && query.isStale() !== stale) return false;
145
- if (fetchStatus && fetchStatus !== query.state.fetchStatus) return false;
146
- if (predicate && !predicate(query)) return false;
147
- return true;
148
- }
149
- function matchMutation(filters, mutation) {
150
- const { exact, status, predicate, mutationKey } = filters;
151
- if (mutationKey) {
152
- if (!mutation.options.mutationKey) return false;
153
- if (exact) {
154
- if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) return false;
155
- } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) return false;
156
- }
157
- if (status && mutation.state.status !== status) return false;
158
- if (predicate && !predicate(mutation)) return false;
159
- return true;
160
- }
161
- function hashQueryKeyByOptions(queryKey, options) {
162
- return (options?.queryKeyHashFn || hashKey)(queryKey);
163
- }
164
- function hashKey(queryKey) {
165
- return JSON.stringify(queryKey, (_, val) => isPlainObject$1(val) ? Object.keys(val).sort().reduce((result, key) => {
166
- result[key] = val[key];
167
- return result;
168
- }, {}) : val);
169
- }
170
- function partialMatchKey(a, b) {
171
- if (a === b) return true;
172
- if (typeof a !== typeof b) return false;
173
- if (a && b && typeof a === "object" && typeof b === "object") return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
174
- return false;
175
- }
176
- var hasOwn = Object.prototype.hasOwnProperty;
177
- function replaceEqualDeep(a, b, depth = 0) {
178
- if (a === b) return a;
179
- if (depth > 500) return b;
180
- const array = isPlainArray(a) && isPlainArray(b);
181
- if (!array && !(isPlainObject$1(a) && isPlainObject$1(b))) return b;
182
- const aSize = (array ? a : Object.keys(a)).length;
183
- const bItems = array ? b : Object.keys(b);
184
- const bSize = bItems.length;
185
- const copy = array ? new Array(bSize) : {};
186
- let equalItems = 0;
187
- for (let i = 0; i < bSize; i++) {
188
- const key = array ? i : bItems[i];
189
- const aItem = a[key];
190
- const bItem = b[key];
191
- if (aItem === bItem) {
192
- copy[key] = aItem;
193
- if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
194
- continue;
195
- }
196
- if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
197
- copy[key] = bItem;
198
- continue;
199
- }
200
- const v = replaceEqualDeep(aItem, bItem, depth + 1);
201
- copy[key] = v;
202
- if (v === aItem) equalItems++;
203
- }
204
- return aSize === bSize && equalItems === aSize ? a : copy;
205
- }
206
- function shallowEqualObjects(a, b) {
207
- if (!b || Object.keys(a).length !== Object.keys(b).length) return false;
208
- for (const key in a) if (a[key] !== b[key]) return false;
209
- return true;
210
- }
211
- function isPlainArray(value) {
212
- return Array.isArray(value) && value.length === Object.keys(value).length;
213
- }
214
- function isPlainObject$1(o) {
215
- if (!hasObjectPrototype(o)) return false;
216
- const ctor = o.constructor;
217
- if (ctor === void 0) return true;
218
- const prot = ctor.prototype;
219
- if (!hasObjectPrototype(prot)) return false;
220
- if (!prot.hasOwnProperty("isPrototypeOf")) return false;
221
- if (Object.getPrototypeOf(o) !== Object.prototype) return false;
222
- return true;
223
- }
224
- function hasObjectPrototype(o) {
225
- return Object.prototype.toString.call(o) === "[object Object]";
226
- }
227
- function sleep(timeout) {
228
- return new Promise((resolve) => {
229
- timeoutManager.setTimeout(resolve, timeout);
230
- });
231
- }
232
- function replaceData(prevData, data, options) {
233
- if (typeof options.structuralSharing === "function") return options.structuralSharing(prevData, data);
234
- else if (options.structuralSharing !== false) try {
235
- return replaceEqualDeep(prevData, data);
236
- } catch (error) {
237
- console.error(`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}`);
238
- throw error;
239
- }
240
- return data;
241
- }
242
- function keepPreviousData(previousData) {
243
- return previousData;
244
- }
245
- function addToEnd(items, item, max = 0) {
246
- const newItems = [...items, item];
247
- return max && newItems.length > max ? newItems.slice(1) : newItems;
248
- }
249
- function addToStart(items, item, max = 0) {
250
- const newItems = [item, ...items];
251
- return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
252
- }
253
- var skipToken = /* @__PURE__ */ Symbol();
254
- function ensureQueryFn(options, fetchOptions) {
255
- if (options.queryFn === skipToken) console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`);
256
- if (!options.queryFn && fetchOptions?.initialPromise) return () => fetchOptions.initialPromise;
257
- if (!options.queryFn || options.queryFn === skipToken) return () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${options.queryHash}'`));
258
- return options.queryFn;
259
- }
260
- function shouldThrowError(throwOnError, params) {
261
- if (typeof throwOnError === "function") return throwOnError(...params);
262
- return !!throwOnError;
263
- }
264
- function addConsumeAwareSignal(object, getSignal, onCancelled) {
265
- let consumed = false;
266
- let signal;
267
- Object.defineProperty(object, "signal", {
268
- enumerable: true,
269
- get: () => {
270
- signal ??= getSignal();
271
- if (consumed) return signal;
272
- consumed = true;
273
- if (signal.aborted) onCancelled();
274
- else signal.addEventListener("abort", onCancelled, { once: true });
275
- return signal;
276
- }
277
- });
278
- return object;
279
- }
280
- //#endregion
281
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/environmentManager.js
282
- var environmentManager = /* @__PURE__ */ (() => {
283
- let isServerFn = () => isServer;
284
- return {
285
- /**
286
- * Returns whether the current runtime should be treated as a server environment.
287
- */
288
- isServer() {
289
- return isServerFn();
290
- },
291
- /**
292
- * Overrides the server check globally.
293
- */
294
- setIsServer(isServerValue) {
295
- isServerFn = isServerValue;
296
- }
297
- };
298
- })();
299
- //#endregion
300
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/thenable.js
301
- function pendingThenable() {
302
- let resolve;
303
- let reject;
304
- const thenable = new Promise((_resolve, _reject) => {
305
- resolve = _resolve;
306
- reject = _reject;
307
- });
308
- thenable.status = "pending";
309
- thenable.catch(() => {});
310
- function finalize(data) {
311
- Object.assign(thenable, data);
312
- delete thenable.resolve;
313
- delete thenable.reject;
314
- }
315
- thenable.resolve = (value) => {
316
- finalize({
317
- status: "fulfilled",
318
- value
319
- });
320
- resolve(value);
321
- };
322
- thenable.reject = (reason) => {
323
- finalize({
324
- status: "rejected",
325
- reason
326
- });
327
- reject(reason);
328
- };
329
- return thenable;
330
- }
331
- function tryResolveSync(promise) {
332
- let data;
333
- promise.then((result) => {
334
- data = result;
335
- return result;
336
- }, noop)?.catch(noop);
337
- if (data !== void 0) return { data };
338
- }
339
- //#endregion
340
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/hydration.js
341
- function defaultTransformerFn(data) {
342
- return data;
343
- }
344
- function dehydrateMutation(mutation) {
345
- return {
346
- mutationKey: mutation.options.mutationKey,
347
- state: mutation.state,
348
- ...mutation.options.scope && { scope: mutation.options.scope },
349
- ...mutation.meta && { meta: mutation.meta }
350
- };
351
- }
352
- function dehydrateQuery(query, serializeData, shouldRedactErrors) {
353
- const dehydratePromise = () => {
354
- const promise = query.promise?.then(serializeData).catch((error) => {
355
- if (!shouldRedactErrors(error)) return Promise.reject(error);
356
- console.error(`A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`);
357
- return Promise.reject(/* @__PURE__ */ new Error("redacted"));
358
- });
359
- promise?.catch(noop);
360
- return promise;
361
- };
362
- return {
363
- dehydratedAt: Date.now(),
364
- state: {
365
- ...query.state,
366
- ...query.state.data !== void 0 && { data: serializeData(query.state.data) }
367
- },
368
- queryKey: query.queryKey,
369
- queryHash: query.queryHash,
370
- ...query.state.status === "pending" && { promise: dehydratePromise() },
371
- ...query.meta && { meta: query.meta },
372
- ...query.queryType && { queryType: query.queryType }
373
- };
374
- }
375
- function defaultShouldDehydrateMutation(mutation) {
376
- return mutation.state.isPaused;
377
- }
378
- function defaultShouldDehydrateQuery(query) {
379
- return query.state.status === "success";
380
- }
381
- function defaultShouldRedactErrors(_) {
382
- return true;
383
- }
384
- function dehydrate(client, options = {}) {
385
- const filterMutation = options.shouldDehydrateMutation ?? client.getDefaultOptions().dehydrate?.shouldDehydrateMutation ?? defaultShouldDehydrateMutation;
386
- const mutations = client.getMutationCache().getAll().flatMap((mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : []);
387
- const filterQuery = options.shouldDehydrateQuery ?? client.getDefaultOptions().dehydrate?.shouldDehydrateQuery ?? defaultShouldDehydrateQuery;
388
- const shouldRedactErrors = options.shouldRedactErrors ?? client.getDefaultOptions().dehydrate?.shouldRedactErrors ?? defaultShouldRedactErrors;
389
- const serializeData = options.serializeData ?? client.getDefaultOptions().dehydrate?.serializeData ?? defaultTransformerFn;
390
- return {
391
- mutations,
392
- queries: client.getQueryCache().getAll().flatMap((query) => filterQuery(query) ? [dehydrateQuery(query, serializeData, shouldRedactErrors)] : [])
393
- };
394
- }
395
- function hydrate(client, dehydratedState, options) {
396
- if (typeof dehydratedState !== "object" || dehydratedState === null) return;
397
- const mutationCache = client.getMutationCache();
398
- const queryCache = client.getQueryCache();
399
- const deserializeData = options?.defaultOptions?.deserializeData ?? client.getDefaultOptions().hydrate?.deserializeData ?? defaultTransformerFn;
400
- const mutations = dehydratedState.mutations || [];
401
- const queries = dehydratedState.queries || [];
402
- mutations.forEach(({ state, ...mutationOptions }) => {
403
- mutationCache.build(client, {
404
- ...client.getDefaultOptions().hydrate?.mutations,
405
- ...options?.defaultOptions?.mutations,
406
- ...mutationOptions
407
- }, state);
408
- });
409
- queries.forEach(({ queryKey, state, queryHash, meta, promise, dehydratedAt, queryType }) => {
410
- const syncData = promise ? tryResolveSync(promise) : void 0;
411
- const rawData = state.data === void 0 ? syncData?.data : state.data;
412
- const data = rawData === void 0 ? rawData : deserializeData(rawData);
413
- let query = queryCache.get(queryHash);
414
- const existingQueryIsPending = query?.state.status === "pending";
415
- const existingQueryIsFetching = query?.state.fetchStatus === "fetching";
416
- if (query) {
417
- const hasNewerSyncData = syncData && dehydratedAt !== void 0 && dehydratedAt > query.state.dataUpdatedAt;
418
- if (state.dataUpdatedAt > query.state.dataUpdatedAt || hasNewerSyncData) {
419
- const { fetchStatus: _ignored, ...serializedState } = state;
420
- query.setState({
421
- ...serializedState,
422
- data,
423
- ...state.status === "pending" && data !== void 0 && {
424
- status: "success",
425
- ...!existingQueryIsFetching && { fetchStatus: "idle" }
426
- }
427
- });
428
- }
429
- } else query = queryCache.build(client, {
430
- ...client.getDefaultOptions().hydrate?.queries,
431
- ...options?.defaultOptions?.queries,
432
- queryKey,
433
- queryHash,
434
- meta,
435
- _type: queryType
436
- }, {
437
- ...state,
438
- data,
439
- fetchStatus: "idle",
440
- status: state.status === "pending" && data !== void 0 ? "success" : state.status
441
- });
442
- if (promise && !syncData && !existingQueryIsPending && !existingQueryIsFetching && (dehydratedAt === void 0 || dehydratedAt > query.state.dataUpdatedAt)) query.fetch(void 0, { initialPromise: Promise.resolve(promise).then(deserializeData) }).catch(noop);
443
- });
444
- }
445
- //#endregion
446
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/notifyManager.js
447
- var defaultScheduler = systemSetTimeoutZero;
448
- function createNotifyManager() {
449
- let queue = [];
450
- let transactions = 0;
451
- let notifyFn = (callback) => {
452
- callback();
453
- };
454
- let batchNotifyFn = (callback) => {
455
- callback();
456
- };
457
- let scheduleFn = defaultScheduler;
458
- const schedule = (callback) => {
459
- if (transactions) queue.push(callback);
460
- else scheduleFn(() => {
461
- notifyFn(callback);
462
- });
463
- };
464
- const flush = () => {
465
- const originalQueue = queue;
466
- queue = [];
467
- if (originalQueue.length) scheduleFn(() => {
468
- batchNotifyFn(() => {
469
- originalQueue.forEach((callback) => {
470
- notifyFn(callback);
471
- });
472
- });
473
- });
474
- };
475
- return {
476
- batch: (callback) => {
477
- let result;
478
- transactions++;
479
- try {
480
- result = callback();
481
- } finally {
482
- transactions--;
483
- if (!transactions) flush();
484
- }
485
- return result;
486
- },
487
- /**
488
- * All calls to the wrapped function will be batched.
489
- */
490
- batchCalls: (callback) => {
491
- return (...args) => {
492
- schedule(() => {
493
- callback(...args);
494
- });
495
- };
496
- },
497
- schedule,
498
- /**
499
- * Use this method to set a custom notify function.
500
- * This can be used to for example wrap notifications with `React.act` while running tests.
501
- */
502
- setNotifyFunction: (fn) => {
503
- notifyFn = fn;
504
- },
505
- /**
506
- * Use this method to set a custom function to batch notifications together into a single tick.
507
- * By default React Query will use the batch function provided by ReactDOM or React Native.
508
- */
509
- setBatchNotifyFunction: (fn) => {
510
- batchNotifyFn = fn;
511
- },
512
- setScheduler: (fn) => {
513
- scheduleFn = fn;
514
- }
515
- };
516
- }
517
- var notifyManager = createNotifyManager();
518
- //#endregion
519
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/onlineManager.js
520
- var OnlineManager = class extends Subscribable {
521
- #online = true;
522
- #cleanup;
523
- #setup;
524
- constructor() {
525
- super();
526
- this.#setup = (onOnline) => {
527
- if (typeof window !== "undefined" && window.addEventListener) {
528
- const onlineListener = () => onOnline(true);
529
- const offlineListener = () => onOnline(false);
530
- window.addEventListener("online", onlineListener, false);
531
- window.addEventListener("offline", offlineListener, false);
532
- return () => {
533
- window.removeEventListener("online", onlineListener);
534
- window.removeEventListener("offline", offlineListener);
535
- };
536
- }
537
- };
538
- }
539
- onSubscribe() {
540
- if (!this.#cleanup) this.setEventListener(this.#setup);
541
- }
542
- onUnsubscribe() {
543
- if (!this.hasListeners()) {
544
- this.#cleanup?.();
545
- this.#cleanup = void 0;
546
- }
547
- }
548
- setEventListener(setup) {
549
- this.#setup = setup;
550
- this.#cleanup?.();
551
- this.#cleanup = setup(this.setOnline.bind(this));
552
- }
553
- setOnline(online) {
554
- if (this.#online !== online) {
555
- this.#online = online;
556
- this.listeners.forEach((listener) => {
557
- listener(online);
558
- });
559
- }
560
- }
561
- isOnline() {
562
- return this.#online;
563
- }
564
- };
565
- var onlineManager = new OnlineManager();
566
- //#endregion
567
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/retryer.js
568
- function defaultRetryDelay(failureCount) {
569
- return Math.min(1e3 * 2 ** failureCount, 3e4);
570
- }
571
- function canFetch(networkMode) {
572
- return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
573
- }
574
- var CancelledError = class extends Error {
575
- constructor(options) {
576
- super("CancelledError");
577
- this.revert = options?.revert;
578
- this.silent = options?.silent;
579
- }
580
- };
581
- function isCancelledError(value) {
582
- return value instanceof CancelledError;
583
- }
584
- function createRetryer(config) {
585
- let isRetryCancelled = false;
586
- let failureCount = 0;
587
- let continueFn;
588
- const thenable = pendingThenable();
589
- const isResolved = () => thenable.status !== "pending";
590
- const cancel = (cancelOptions) => {
591
- if (!isResolved()) {
592
- const error = new CancelledError(cancelOptions);
593
- reject(error);
594
- config.onCancel?.(error);
595
- }
596
- };
597
- const cancelRetry = () => {
598
- isRetryCancelled = true;
599
- };
600
- const continueRetry = () => {
601
- isRetryCancelled = false;
602
- };
603
- const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
604
- const canStart = () => canFetch(config.networkMode) && config.canRun();
605
- const resolve = (value) => {
606
- if (!isResolved()) {
607
- continueFn?.();
608
- thenable.resolve(value);
609
- }
610
- };
611
- const reject = (value) => {
612
- if (!isResolved()) {
613
- continueFn?.();
614
- thenable.reject(value);
615
- }
616
- };
617
- const pause = () => {
618
- return new Promise((continueResolve) => {
619
- continueFn = (value) => {
620
- if (isResolved() || canContinue()) continueResolve(value);
621
- };
622
- config.onPause?.();
623
- }).then(() => {
624
- continueFn = void 0;
625
- if (!isResolved()) config.onContinue?.();
626
- });
627
- };
628
- const run = () => {
629
- if (isResolved()) return;
630
- let promiseOrValue;
631
- const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
632
- try {
633
- promiseOrValue = initialPromise ?? config.fn();
634
- } catch (error) {
635
- promiseOrValue = Promise.reject(error);
636
- }
637
- Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
638
- if (isResolved()) return;
639
- const retry = config.retry ?? (environmentManager.isServer() ? 0 : 3);
640
- const retryDelay = config.retryDelay ?? defaultRetryDelay;
641
- const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
642
- const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
643
- if (isRetryCancelled || !shouldRetry) {
644
- reject(error);
645
- return;
646
- }
647
- failureCount++;
648
- config.onFail?.(failureCount, error);
649
- sleep(delay).then(() => {
650
- return canContinue() ? void 0 : pause();
651
- }).then(() => {
652
- if (isRetryCancelled) reject(error);
653
- else run();
654
- });
655
- });
656
- };
657
- return {
658
- promise: thenable,
659
- status: () => thenable.status,
660
- cancel,
661
- continue: () => {
662
- continueFn?.();
663
- return thenable;
664
- },
665
- cancelRetry,
666
- continueRetry,
667
- canStart,
668
- start: () => {
669
- if (canStart()) run();
670
- else pause().then(run);
671
- return thenable;
672
- }
673
- };
674
- }
675
- //#endregion
676
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/removable.js
677
- var Removable = class {
678
- #gcTimeout;
679
- destroy() {
680
- this.clearGcTimeout();
681
- }
682
- scheduleGc() {
683
- this.clearGcTimeout();
684
- if (isValidTimeout(this.gcTime)) this.#gcTimeout = timeoutManager.setTimeout(() => {
685
- this.optionalRemove();
686
- }, this.gcTime);
687
- }
688
- updateGcTime(newGcTime) {
689
- this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (environmentManager.isServer() ? Infinity : 3e5));
690
- }
691
- clearGcTimeout() {
692
- if (this.#gcTimeout !== void 0) {
693
- timeoutManager.clearTimeout(this.#gcTimeout);
694
- this.#gcTimeout = void 0;
695
- }
696
- }
697
- };
698
- //#endregion
699
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
700
- function infiniteQueryBehavior(pages) {
701
- return { onFetch: (context, query) => {
702
- const options = context.options;
703
- const direction = context.fetchOptions?.meta?.fetchMore?.direction;
704
- const oldPages = context.state.data?.pages || [];
705
- const oldPageParams = context.state.data?.pageParams || [];
706
- let result = {
707
- pages: [],
708
- pageParams: []
709
- };
710
- let currentPage = 0;
711
- const fetchFn = async () => {
712
- let cancelled = false;
713
- const addSignalProperty = (object) => {
714
- addConsumeAwareSignal(object, () => context.signal, () => cancelled = true);
715
- };
716
- const queryFn = ensureQueryFn(context.options, context.fetchOptions);
717
- const fetchPage = async (data, param, previous) => {
718
- if (cancelled) return Promise.reject(context.signal.reason);
719
- if (param == null && data.pages.length) return Promise.resolve(data);
720
- const createQueryFnContext = () => {
721
- const queryFnContext2 = {
722
- client: context.client,
723
- queryKey: context.queryKey,
724
- pageParam: param,
725
- direction: previous ? "backward" : "forward",
726
- meta: context.options.meta
727
- };
728
- addSignalProperty(queryFnContext2);
729
- return queryFnContext2;
730
- };
731
- const queryFnContext = createQueryFnContext();
732
- const page = await queryFn(queryFnContext);
733
- const { maxPages } = context.options;
734
- const addTo = previous ? addToStart : addToEnd;
735
- return {
736
- pages: addTo(data.pages, page, maxPages),
737
- pageParams: addTo(data.pageParams, param, maxPages)
738
- };
739
- };
740
- if (direction && oldPages.length) {
741
- const previous = direction === "backward";
742
- const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
743
- const oldData = {
744
- pages: oldPages,
745
- pageParams: oldPageParams
746
- };
747
- result = await fetchPage(oldData, pageParamFn(options, oldData), previous);
748
- } else {
749
- const remainingPages = pages ?? oldPages.length;
750
- do {
751
- const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
752
- if (currentPage > 0 && param == null) break;
753
- result = await fetchPage(result, param);
754
- currentPage++;
755
- } while (currentPage < remainingPages);
756
- }
757
- return result;
758
- };
759
- if (context.options.persister) context.fetchFn = () => {
760
- return context.options.persister?.(fetchFn, {
761
- client: context.client,
762
- queryKey: context.queryKey,
763
- meta: context.options.meta,
764
- signal: context.signal
765
- }, query);
766
- };
767
- else context.fetchFn = fetchFn;
768
- } };
769
- }
770
- function getNextPageParam(options, { pages, pageParams }) {
771
- const lastIndex = pages.length - 1;
772
- return pages.length > 0 ? options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams) : void 0;
773
- }
774
- function getPreviousPageParam(options, { pages, pageParams }) {
775
- return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
776
- }
777
- function hasNextPage(options, data) {
778
- if (!data) return false;
779
- return getNextPageParam(options, data) != null;
780
- }
781
- function hasPreviousPage(options, data) {
782
- if (!data || !options.getPreviousPageParam) return false;
783
- return getPreviousPageParam(options, data) != null;
784
- }
785
- //#endregion
786
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/query.js
787
- var Query = class extends Removable {
788
- #queryType;
789
- #initialState;
790
- #revertState;
791
- #cache;
792
- #client;
793
- #retryer;
794
- #defaultOptions;
795
- #abortSignalConsumed;
796
- constructor(config) {
797
- super();
798
- this.#abortSignalConsumed = false;
799
- this.#defaultOptions = config.defaultOptions;
800
- this.setOptions(config.options);
801
- this.observers = [];
802
- this.#client = config.client;
803
- this.#cache = this.#client.getQueryCache();
804
- this.queryKey = config.queryKey;
805
- this.queryHash = config.queryHash;
806
- this.#initialState = getDefaultState$1(this.options);
807
- this.state = config.state ?? this.#initialState;
808
- this.scheduleGc();
809
- }
810
- get meta() {
811
- return this.options.meta;
812
- }
813
- get queryType() {
814
- return this.#queryType;
815
- }
816
- get promise() {
817
- return this.#retryer?.promise;
818
- }
819
- setOptions(options) {
820
- this.options = {
821
- ...this.#defaultOptions,
822
- ...options
823
- };
824
- if (options?._type) this.#queryType = options._type;
825
- this.updateGcTime(this.options.gcTime);
826
- if (this.state && this.state.data === void 0) {
827
- const defaultState = getDefaultState$1(this.options);
828
- if (defaultState.data !== void 0) {
829
- this.setState(successState(defaultState.data, defaultState.dataUpdatedAt));
830
- this.#initialState = defaultState;
831
- }
832
- }
833
- }
834
- optionalRemove() {
835
- if (!this.observers.length && this.state.fetchStatus === "idle") this.#cache.remove(this);
836
- }
837
- setData(newData, options) {
838
- const data = replaceData(this.state.data, newData, this.options);
839
- this.#dispatch({
840
- data,
841
- type: "success",
842
- dataUpdatedAt: options?.updatedAt,
843
- manual: options?.manual
844
- });
845
- return data;
846
- }
847
- setState(state) {
848
- this.#dispatch({
849
- type: "setState",
850
- state
851
- });
852
- }
853
- cancel(options) {
854
- const promise = this.#retryer?.promise;
855
- this.#retryer?.cancel(options);
856
- return promise ? promise.then(noop).catch(noop) : Promise.resolve();
857
- }
858
- destroy() {
859
- super.destroy();
860
- this.cancel({ silent: true });
861
- }
862
- get resetState() {
863
- return this.#initialState;
864
- }
865
- reset() {
866
- this.destroy();
867
- this.setState(this.resetState);
868
- }
869
- isActive() {
870
- return this.observers.some((observer) => resolveQueryBoolean(observer.options.enabled, this) !== false);
871
- }
872
- isDisabled() {
873
- if (this.getObserversCount() > 0) return !this.isActive();
874
- return this.options.queryFn === skipToken || !this.isFetched();
875
- }
876
- isFetched() {
877
- return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;
878
- }
879
- isStatic() {
880
- if (this.getObserversCount() > 0) return this.observers.some((observer) => resolveStaleTime(observer.options.staleTime, this) === "static");
881
- return false;
882
- }
883
- isStale() {
884
- if (this.getObserversCount() > 0) return this.observers.some((observer) => observer.getCurrentResult().isStale);
885
- return this.state.data === void 0 || this.state.isInvalidated;
886
- }
887
- isStaleByTime(staleTime = 0) {
888
- if (this.state.data === void 0) return true;
889
- if (staleTime === "static") return false;
890
- if (this.state.isInvalidated) return true;
891
- return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
892
- }
893
- onFocus() {
894
- this.observers.find((x) => x.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: false });
895
- this.#retryer?.continue();
896
- }
897
- onOnline() {
898
- this.observers.find((x) => x.shouldFetchOnReconnect())?.refetch({ cancelRefetch: false });
899
- this.#retryer?.continue();
900
- }
901
- addObserver(observer) {
902
- if (!this.observers.includes(observer)) {
903
- this.observers.push(observer);
904
- this.clearGcTimeout();
905
- this.#cache.notify({
906
- type: "observerAdded",
907
- query: this,
908
- observer
909
- });
910
- }
911
- }
912
- removeObserver(observer) {
913
- if (this.observers.includes(observer)) {
914
- this.observers = this.observers.filter((x) => x !== observer);
915
- if (!this.observers.length) {
916
- if (this.#retryer) {
917
- if (this.#abortSignalConsumed || this.#isInitialPausedFetch()) this.#retryer.cancel({ revert: true });
918
- else this.#retryer.cancelRetry();
919
- }
920
- this.scheduleGc();
921
- }
922
- this.#cache.notify({
923
- type: "observerRemoved",
924
- query: this,
925
- observer
926
- });
927
- }
928
- }
929
- getObserversCount() {
930
- return this.observers.length;
931
- }
932
- #isInitialPausedFetch() {
933
- return this.state.fetchStatus === "paused" && this.state.status === "pending";
934
- }
935
- invalidate() {
936
- if (!this.state.isInvalidated) this.#dispatch({ type: "invalidate" });
937
- }
938
- async fetch(options, fetchOptions) {
939
- if (this.state.fetchStatus !== "idle" && this.#retryer?.status() !== "rejected") {
940
- if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) this.cancel({ silent: true });
941
- else if (this.#retryer) {
942
- this.#retryer.continueRetry();
943
- return this.#retryer.promise;
944
- }
945
- }
946
- if (options) this.setOptions(options);
947
- if (!this.options.queryFn) {
948
- const observer = this.observers.find((x) => x.options.queryFn);
949
- if (observer) this.setOptions(observer.options);
950
- }
951
- if (!Array.isArray(this.options.queryKey)) console.error(`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']`);
952
- const abortController = new AbortController();
953
- const addSignalProperty = (object) => {
954
- Object.defineProperty(object, "signal", {
955
- enumerable: true,
956
- get: () => {
957
- this.#abortSignalConsumed = true;
958
- return abortController.signal;
959
- }
960
- });
961
- };
962
- const fetchFn = () => {
963
- const queryFn = ensureQueryFn(this.options, fetchOptions);
964
- const createQueryFnContext = () => {
965
- const queryFnContext2 = {
966
- client: this.#client,
967
- queryKey: this.queryKey,
968
- meta: this.meta
969
- };
970
- addSignalProperty(queryFnContext2);
971
- return queryFnContext2;
972
- };
973
- const queryFnContext = createQueryFnContext();
974
- this.#abortSignalConsumed = false;
975
- if (this.options.persister) return this.options.persister(queryFn, queryFnContext, this);
976
- return queryFn(queryFnContext);
977
- };
978
- const createFetchContext = () => {
979
- const context2 = {
980
- fetchOptions,
981
- options: this.options,
982
- queryKey: this.queryKey,
983
- client: this.#client,
984
- state: this.state,
985
- fetchFn
986
- };
987
- addSignalProperty(context2);
988
- return context2;
989
- };
990
- const context = createFetchContext();
991
- (this.#queryType === "infinite" ? infiniteQueryBehavior(this.options.pages) : this.options.behavior)?.onFetch(context, this);
992
- this.#revertState = this.state;
993
- if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) this.#dispatch({
994
- type: "fetch",
995
- meta: context.fetchOptions?.meta
996
- });
997
- this.#retryer = createRetryer({
998
- initialPromise: fetchOptions?.initialPromise,
999
- fn: context.fetchFn,
1000
- onCancel: (error) => {
1001
- if (error instanceof CancelledError && error.revert) this.setState({
1002
- ...this.#revertState,
1003
- fetchStatus: "idle"
1004
- });
1005
- abortController.abort();
1006
- },
1007
- onFail: (failureCount, error) => {
1008
- this.#dispatch({
1009
- type: "failed",
1010
- failureCount,
1011
- error
1012
- });
1013
- },
1014
- onPause: () => {
1015
- this.#dispatch({ type: "pause" });
1016
- },
1017
- onContinue: () => {
1018
- this.#dispatch({ type: "continue" });
1019
- },
1020
- retry: context.options.retry,
1021
- retryDelay: context.options.retryDelay,
1022
- networkMode: context.options.networkMode,
1023
- canRun: () => true
1024
- });
1025
- try {
1026
- const data = await this.#retryer.start();
1027
- if (data === void 0) {
1028
- console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`);
1029
- throw new Error(`${this.queryHash} data is undefined`);
1030
- }
1031
- this.setData(data);
1032
- this.#cache.config.onSuccess?.(data, this);
1033
- this.#cache.config.onSettled?.(data, this.state.error, this);
1034
- return data;
1035
- } catch (error) {
1036
- if (error instanceof CancelledError) {
1037
- if (error.silent) return this.#retryer.promise;
1038
- else if (error.revert) {
1039
- if (this.state.data === void 0) throw error;
1040
- return this.state.data;
1041
- }
1042
- }
1043
- this.#dispatch({
1044
- type: "error",
1045
- error
1046
- });
1047
- this.#cache.config.onError?.(error, this);
1048
- this.#cache.config.onSettled?.(this.state.data, error, this);
1049
- throw error;
1050
- } finally {
1051
- this.scheduleGc();
1052
- }
1053
- }
1054
- #dispatch(action) {
1055
- const reducer = (state) => {
1056
- switch (action.type) {
1057
- case "failed": return {
1058
- ...state,
1059
- fetchFailureCount: action.failureCount,
1060
- fetchFailureReason: action.error
1061
- };
1062
- case "pause": return {
1063
- ...state,
1064
- fetchStatus: "paused"
1065
- };
1066
- case "continue": return {
1067
- ...state,
1068
- fetchStatus: "fetching"
1069
- };
1070
- case "fetch": return {
1071
- ...state,
1072
- ...fetchState(state.data, this.options),
1073
- fetchMeta: action.meta ?? null
1074
- };
1075
- case "success":
1076
- const newState = {
1077
- ...state,
1078
- ...successState(action.data, action.dataUpdatedAt),
1079
- dataUpdateCount: state.dataUpdateCount + 1,
1080
- ...!action.manual && {
1081
- fetchStatus: "idle",
1082
- fetchFailureCount: 0,
1083
- fetchFailureReason: null
1084
- }
1085
- };
1086
- this.#revertState = action.manual ? newState : void 0;
1087
- return newState;
1088
- case "error":
1089
- const error = action.error;
1090
- return {
1091
- ...state,
1092
- error,
1093
- errorUpdateCount: state.errorUpdateCount + 1,
1094
- errorUpdatedAt: Date.now(),
1095
- fetchFailureCount: state.fetchFailureCount + 1,
1096
- fetchFailureReason: error,
1097
- fetchStatus: "idle",
1098
- status: "error",
1099
- isInvalidated: true
1100
- };
1101
- case "invalidate": return {
1102
- ...state,
1103
- isInvalidated: true
1104
- };
1105
- case "setState": return {
1106
- ...state,
1107
- ...action.state
1108
- };
1109
- }
1110
- };
1111
- this.state = reducer(this.state);
1112
- notifyManager.batch(() => {
1113
- this.observers.forEach((observer) => {
1114
- observer.onQueryUpdate();
1115
- });
1116
- this.#cache.notify({
1117
- query: this,
1118
- type: "updated",
1119
- action
1120
- });
1121
- });
1122
- }
1123
- };
1124
- function fetchState(data, options) {
1125
- return {
1126
- fetchFailureCount: 0,
1127
- fetchFailureReason: null,
1128
- fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
1129
- ...data === void 0 && {
1130
- error: null,
1131
- status: "pending"
1132
- }
1133
- };
1134
- }
1135
- function successState(data, dataUpdatedAt) {
1136
- return {
1137
- data,
1138
- dataUpdatedAt: dataUpdatedAt ?? Date.now(),
1139
- error: null,
1140
- isInvalidated: false,
1141
- status: "success"
1142
- };
1143
- }
1144
- function getDefaultState$1(options) {
1145
- const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
1146
- const hasData = data !== void 0;
1147
- const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
1148
- return {
1149
- data,
1150
- dataUpdateCount: 0,
1151
- dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
1152
- error: null,
1153
- errorUpdateCount: 0,
1154
- errorUpdatedAt: 0,
1155
- fetchFailureCount: 0,
1156
- fetchFailureReason: null,
1157
- fetchMeta: null,
1158
- isInvalidated: false,
1159
- status: hasData ? "success" : "pending",
1160
- fetchStatus: "idle"
1161
- };
1162
- }
1163
- //#endregion
1164
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/queryObserver.js
1165
- var QueryObserver = class extends Subscribable {
1166
- constructor(client, options) {
1167
- super();
1168
- this.options = options;
1169
- this.#client = client;
1170
- this.#selectError = null;
1171
- this.#currentThenable = pendingThenable();
1172
- this.bindMethods();
1173
- this.setOptions(options);
1174
- }
1175
- #client;
1176
- #currentQuery = void 0;
1177
- #currentQueryInitialState = void 0;
1178
- #currentResult = void 0;
1179
- #currentResultState;
1180
- #currentResultOptions;
1181
- #currentThenable;
1182
- #selectError;
1183
- #selectFn;
1184
- #selectResult;
1185
- #lastQueryWithDefinedData;
1186
- #staleTimeoutId;
1187
- #refetchIntervalId;
1188
- #currentRefetchInterval;
1189
- #trackedProps = /* @__PURE__ */ new Set();
1190
- bindMethods() {
1191
- this.refetch = this.refetch.bind(this);
1192
- }
1193
- onSubscribe() {
1194
- if (this.listeners.size === 1) {
1195
- this.#currentQuery.addObserver(this);
1196
- if (shouldFetchOnMount(this.#currentQuery, this.options)) this.#executeFetch();
1197
- else this.updateResult();
1198
- this.#updateTimers();
1199
- }
1200
- }
1201
- onUnsubscribe() {
1202
- if (!this.hasListeners()) this.destroy();
1203
- }
1204
- shouldFetchOnReconnect() {
1205
- return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect);
1206
- }
1207
- shouldFetchOnWindowFocus() {
1208
- return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus);
1209
- }
1210
- destroy() {
1211
- this.listeners = /* @__PURE__ */ new Set();
1212
- this.#clearStaleTimeout();
1213
- this.#clearRefetchInterval();
1214
- this.#currentQuery.removeObserver(this);
1215
- }
1216
- setOptions(options) {
1217
- const prevOptions = this.options;
1218
- const prevQuery = this.#currentQuery;
1219
- this.options = this.#client.defaultQueryOptions(options);
1220
- if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== "boolean") throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");
1221
- this.#updateQuery();
1222
- this.#currentQuery.setOptions(this.options);
1223
- if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) this.#client.getQueryCache().notify({
1224
- type: "observerOptionsUpdated",
1225
- query: this.#currentQuery,
1226
- observer: this
1227
- });
1228
- const mounted = this.hasListeners();
1229
- if (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) this.#executeFetch();
1230
- this.updateResult();
1231
- if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) this.#updateStaleTimeout();
1232
- const nextRefetchInterval = this.#computeRefetchInterval();
1233
- if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) this.#updateRefetchInterval(nextRefetchInterval);
1234
- }
1235
- getOptimisticResult(options) {
1236
- const query = this.#client.getQueryCache().build(this.#client, options);
1237
- const result = this.createResult(query, options);
1238
- if (shouldAssignObserverCurrentProperties(this, result)) {
1239
- this.#currentResult = result;
1240
- this.#currentResultOptions = this.options;
1241
- this.#currentResultState = this.#currentQuery.state;
1242
- }
1243
- return result;
1244
- }
1245
- getCurrentResult() {
1246
- return this.#currentResult;
1247
- }
1248
- trackResult(result, onPropTracked) {
1249
- return new Proxy(result, { get: (target, key) => {
1250
- this.trackProp(key);
1251
- onPropTracked?.(key);
1252
- if (key === "promise") {
1253
- this.trackProp("data");
1254
- if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") this.#currentThenable.reject(/* @__PURE__ */ new Error("experimental_prefetchInRender feature flag is not enabled"));
1255
- }
1256
- return Reflect.get(target, key);
1257
- } });
1258
- }
1259
- trackProp(key) {
1260
- this.#trackedProps.add(key);
1261
- }
1262
- getCurrentQuery() {
1263
- return this.#currentQuery;
1264
- }
1265
- refetch({ ...options } = {}) {
1266
- return this.fetch({ ...options });
1267
- }
1268
- fetchOptimistic(options) {
1269
- const defaultedOptions = this.#client.defaultQueryOptions(options);
1270
- const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
1271
- return query.fetch().then(() => this.createResult(query, defaultedOptions));
1272
- }
1273
- fetch(fetchOptions) {
1274
- return this.#executeFetch({
1275
- ...fetchOptions,
1276
- cancelRefetch: fetchOptions.cancelRefetch ?? true
1277
- }).then(() => {
1278
- this.updateResult();
1279
- return this.#currentResult;
1280
- });
1281
- }
1282
- #executeFetch(fetchOptions) {
1283
- this.#updateQuery();
1284
- let promise = this.#currentQuery.fetch(this.options, fetchOptions);
1285
- if (!fetchOptions?.throwOnError) promise = promise.catch(noop);
1286
- return promise;
1287
- }
1288
- #updateStaleTimeout() {
1289
- this.#clearStaleTimeout();
1290
- const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery);
1291
- if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) return;
1292
- const timeout = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime) + 1;
1293
- this.#staleTimeoutId = timeoutManager.setTimeout(() => {
1294
- if (!this.#currentResult.isStale) this.updateResult();
1295
- }, timeout);
1296
- }
1297
- #computeRefetchInterval() {
1298
- return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
1299
- }
1300
- #updateRefetchInterval(nextInterval) {
1301
- this.#clearRefetchInterval();
1302
- this.#currentRefetchInterval = nextInterval;
1303
- if (environmentManager.isServer() || resolveQueryBoolean(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) return;
1304
- this.#refetchIntervalId = timeoutManager.setInterval(() => {
1305
- if (this.options.refetchIntervalInBackground || focusManager.isFocused()) this.#executeFetch();
1306
- }, this.#currentRefetchInterval);
1307
- }
1308
- #updateTimers() {
1309
- this.#updateStaleTimeout();
1310
- this.#updateRefetchInterval(this.#computeRefetchInterval());
1311
- }
1312
- #clearStaleTimeout() {
1313
- if (this.#staleTimeoutId !== void 0) {
1314
- timeoutManager.clearTimeout(this.#staleTimeoutId);
1315
- this.#staleTimeoutId = void 0;
1316
- }
1317
- }
1318
- #clearRefetchInterval() {
1319
- if (this.#refetchIntervalId !== void 0) {
1320
- timeoutManager.clearInterval(this.#refetchIntervalId);
1321
- this.#refetchIntervalId = void 0;
1322
- }
1323
- }
1324
- createResult(query, options) {
1325
- const prevQuery = this.#currentQuery;
1326
- const prevOptions = this.options;
1327
- const prevResult = this.#currentResult;
1328
- const prevResultState = this.#currentResultState;
1329
- const prevResultOptions = this.#currentResultOptions;
1330
- const queryInitialState = query !== prevQuery ? query.state : this.#currentQueryInitialState;
1331
- const { state } = query;
1332
- let newState = { ...state };
1333
- let isPlaceholderData = false;
1334
- let data;
1335
- if (options._optimisticResults) {
1336
- const mounted = this.hasListeners();
1337
- const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
1338
- const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
1339
- if (fetchOnMount || fetchOptionally) newState = {
1340
- ...newState,
1341
- ...fetchState(state.data, query.options)
1342
- };
1343
- if (options._optimisticResults === "isRestoring") newState.fetchStatus = "idle";
1344
- }
1345
- let { error, errorUpdatedAt, status } = newState;
1346
- data = newState.data;
1347
- let skipSelect = false;
1348
- if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
1349
- let placeholderData;
1350
- if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
1351
- placeholderData = prevResult.data;
1352
- skipSelect = true;
1353
- } else placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData;
1354
- if (placeholderData !== void 0) {
1355
- status = "success";
1356
- data = replaceData(prevResult?.data, placeholderData, options);
1357
- isPlaceholderData = true;
1358
- }
1359
- }
1360
- if (options.select && data !== void 0 && !skipSelect) {
1361
- if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) data = this.#selectResult;
1362
- else try {
1363
- this.#selectFn = options.select;
1364
- data = options.select(data);
1365
- data = replaceData(prevResult?.data, data, options);
1366
- this.#selectResult = data;
1367
- this.#selectError = null;
1368
- } catch (selectError) {
1369
- this.#selectError = selectError;
1370
- }
1371
- }
1372
- if (this.#selectError) {
1373
- error = this.#selectError;
1374
- data = this.#selectResult;
1375
- errorUpdatedAt = Date.now();
1376
- status = "error";
1377
- }
1378
- const isFetching = newState.fetchStatus === "fetching";
1379
- const isPending = status === "pending";
1380
- const isError = status === "error";
1381
- const isLoading = isPending && isFetching;
1382
- const hasData = data !== void 0;
1383
- const nextResult = {
1384
- status,
1385
- fetchStatus: newState.fetchStatus,
1386
- isPending,
1387
- isSuccess: status === "success",
1388
- isError,
1389
- isInitialLoading: isLoading,
1390
- isLoading,
1391
- data,
1392
- dataUpdatedAt: newState.dataUpdatedAt,
1393
- error,
1394
- errorUpdatedAt,
1395
- failureCount: newState.fetchFailureCount,
1396
- failureReason: newState.fetchFailureReason,
1397
- errorUpdateCount: newState.errorUpdateCount,
1398
- isFetched: query.isFetched(),
1399
- isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
1400
- isFetching,
1401
- isRefetching: isFetching && !isPending,
1402
- isLoadingError: isError && !hasData,
1403
- isPaused: newState.fetchStatus === "paused",
1404
- isPlaceholderData,
1405
- isRefetchError: isError && hasData,
1406
- isStale: isStale(query, options),
1407
- refetch: this.refetch,
1408
- promise: this.#currentThenable,
1409
- isEnabled: resolveQueryBoolean(options.enabled, query) !== false
1410
- };
1411
- if (this.options.experimental_prefetchInRender) {
1412
- const hasResultData = nextResult.data !== void 0;
1413
- const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
1414
- const finalizeThenableIfPossible = (thenable) => {
1415
- if (isErrorWithoutData) thenable.reject(nextResult.error);
1416
- else if (hasResultData) thenable.resolve(nextResult.data);
1417
- };
1418
- const recreateThenable = () => {
1419
- const pending = this.#currentThenable = nextResult.promise = pendingThenable();
1420
- finalizeThenableIfPossible(pending);
1421
- };
1422
- const prevThenable = this.#currentThenable;
1423
- switch (prevThenable.status) {
1424
- case "pending":
1425
- if (query.queryHash === prevQuery.queryHash) finalizeThenableIfPossible(prevThenable);
1426
- break;
1427
- case "fulfilled":
1428
- if (isErrorWithoutData || nextResult.data !== prevThenable.value) recreateThenable();
1429
- break;
1430
- case "rejected": if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) recreateThenable();
1431
- }
1432
- }
1433
- return nextResult;
1434
- }
1435
- updateResult() {
1436
- const prevResult = this.#currentResult;
1437
- const nextResult = this.createResult(this.#currentQuery, this.options);
1438
- this.#currentResultState = this.#currentQuery.state;
1439
- this.#currentResultOptions = this.options;
1440
- if (this.#currentResultState.data !== void 0) this.#lastQueryWithDefinedData = this.#currentQuery;
1441
- if (shallowEqualObjects(nextResult, prevResult)) return;
1442
- this.#currentResult = nextResult;
1443
- const shouldNotifyListeners = () => {
1444
- if (!prevResult) return true;
1445
- const { notifyOnChangeProps } = this.options;
1446
- const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
1447
- if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) return true;
1448
- const includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps);
1449
- if (this.options.throwOnError) includedProps.add("error");
1450
- return Object.keys(this.#currentResult).some((key) => {
1451
- const typedKey = key;
1452
- return this.#currentResult[typedKey] !== prevResult[typedKey] && includedProps.has(typedKey);
1453
- });
1454
- };
1455
- this.#notify({ listeners: shouldNotifyListeners() });
1456
- }
1457
- #updateQuery() {
1458
- const query = this.#client.getQueryCache().build(this.#client, this.options);
1459
- if (query === this.#currentQuery) return;
1460
- const prevQuery = this.#currentQuery;
1461
- this.#currentQuery = query;
1462
- this.#currentQueryInitialState = query.state;
1463
- if (this.hasListeners()) {
1464
- prevQuery?.removeObserver(this);
1465
- query.addObserver(this);
1466
- }
1467
- }
1468
- onQueryUpdate() {
1469
- this.updateResult();
1470
- if (this.hasListeners()) this.#updateTimers();
1471
- }
1472
- #notify(notifyOptions) {
1473
- notifyManager.batch(() => {
1474
- if (notifyOptions.listeners) this.listeners.forEach((listener) => {
1475
- listener(this.#currentResult);
1476
- });
1477
- this.#client.getQueryCache().notify({
1478
- query: this.#currentQuery,
1479
- type: "observerResultsUpdated"
1480
- });
1481
- });
1482
- }
1483
- };
1484
- function shouldLoadOnMount(query, options) {
1485
- return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false);
1486
- }
1487
- function shouldFetchOnMount(query, options) {
1488
- return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
1489
- }
1490
- function shouldFetchOn(query, options, field) {
1491
- if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
1492
- const value = typeof field === "function" ? field(query) : field;
1493
- return value === "always" || value !== false && isStale(query, options);
1494
- }
1495
- return false;
1496
- }
1497
- function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
1498
- return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
1499
- }
1500
- function isStale(query, options) {
1501
- return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
1502
- }
1503
- function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
1504
- if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) return true;
1505
- return false;
1506
- }
1507
- //#endregion
1508
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js
1509
- var InfiniteQueryObserver = class extends QueryObserver {
1510
- constructor(client, options) {
1511
- super(client, options);
1512
- }
1513
- bindMethods() {
1514
- super.bindMethods();
1515
- this.fetchNextPage = this.fetchNextPage.bind(this);
1516
- this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
1517
- }
1518
- setOptions(options) {
1519
- options._type = "infinite";
1520
- super.setOptions(options);
1521
- }
1522
- getOptimisticResult(options) {
1523
- options._type = "infinite";
1524
- return super.getOptimisticResult(options);
1525
- }
1526
- fetchNextPage(options) {
1527
- return this.fetch({
1528
- ...options,
1529
- meta: { fetchMore: { direction: "forward" } }
1530
- });
1531
- }
1532
- fetchPreviousPage(options) {
1533
- return this.fetch({
1534
- ...options,
1535
- meta: { fetchMore: { direction: "backward" } }
1536
- });
1537
- }
1538
- createResult(query, options) {
1539
- const { state } = query;
1540
- const parentResult = super.createResult(query, options);
1541
- const { isFetching, isRefetching, isError, isRefetchError } = parentResult;
1542
- const fetchDirection = state.fetchMeta?.fetchMore?.direction;
1543
- const isFetchNextPageError = isError && fetchDirection === "forward";
1544
- const isFetchingNextPage = isFetching && fetchDirection === "forward";
1545
- const isFetchPreviousPageError = isError && fetchDirection === "backward";
1546
- const isFetchingPreviousPage = isFetching && fetchDirection === "backward";
1547
- return {
1548
- ...parentResult,
1549
- fetchNextPage: this.fetchNextPage,
1550
- fetchPreviousPage: this.fetchPreviousPage,
1551
- hasNextPage: hasNextPage(options, state.data),
1552
- hasPreviousPage: hasPreviousPage(options, state.data),
1553
- isFetchNextPageError,
1554
- isFetchingNextPage,
1555
- isFetchPreviousPageError,
1556
- isFetchingPreviousPage,
1557
- isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,
1558
- isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage
1559
- };
1560
- }
1561
- };
1562
- //#endregion
1563
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/mutation.js
1564
- var Mutation = class extends Removable {
1565
- #client;
1566
- #observers;
1567
- #mutationCache;
1568
- #retryer;
1569
- constructor(config) {
1570
- super();
1571
- this.#client = config.client;
1572
- this.mutationId = config.mutationId;
1573
- this.#mutationCache = config.mutationCache;
1574
- this.#observers = [];
1575
- this.state = config.state || getDefaultState();
1576
- this.setOptions(config.options);
1577
- this.scheduleGc();
1578
- }
1579
- setOptions(options) {
1580
- this.options = options;
1581
- this.updateGcTime(this.options.gcTime);
1582
- }
1583
- get meta() {
1584
- return this.options.meta;
1585
- }
1586
- addObserver(observer) {
1587
- if (!this.#observers.includes(observer)) {
1588
- this.#observers.push(observer);
1589
- this.clearGcTimeout();
1590
- this.#mutationCache.notify({
1591
- type: "observerAdded",
1592
- mutation: this,
1593
- observer
1594
- });
1595
- }
1596
- }
1597
- removeObserver(observer) {
1598
- this.#observers = this.#observers.filter((x) => x !== observer);
1599
- this.scheduleGc();
1600
- this.#mutationCache.notify({
1601
- type: "observerRemoved",
1602
- mutation: this,
1603
- observer
1604
- });
1605
- }
1606
- optionalRemove() {
1607
- if (!this.#observers.length) {
1608
- if (this.state.status === "pending") this.scheduleGc();
1609
- else this.#mutationCache.remove(this);
1610
- }
1611
- }
1612
- continue() {
1613
- return this.#retryer?.continue() ?? this.execute(this.state.variables);
1614
- }
1615
- async execute(variables) {
1616
- const onContinue = () => {
1617
- this.#dispatch({ type: "continue" });
1618
- };
1619
- const mutationFnContext = {
1620
- client: this.#client,
1621
- meta: this.options.meta,
1622
- mutationKey: this.options.mutationKey
1623
- };
1624
- this.#retryer = createRetryer({
1625
- fn: () => {
1626
- if (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error("No mutationFn found"));
1627
- return this.options.mutationFn(variables, mutationFnContext);
1628
- },
1629
- onFail: (failureCount, error) => {
1630
- this.#dispatch({
1631
- type: "failed",
1632
- failureCount,
1633
- error
1634
- });
1635
- },
1636
- onPause: () => {
1637
- this.#dispatch({ type: "pause" });
1638
- },
1639
- onContinue,
1640
- retry: this.options.retry ?? 0,
1641
- retryDelay: this.options.retryDelay,
1642
- networkMode: this.options.networkMode,
1643
- canRun: () => this.#mutationCache.canRun(this)
1644
- });
1645
- const restored = this.state.status === "pending";
1646
- const isPaused = !this.#retryer.canStart();
1647
- try {
1648
- if (restored) onContinue();
1649
- else {
1650
- this.#dispatch({
1651
- type: "pending",
1652
- variables,
1653
- isPaused
1654
- });
1655
- if (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);
1656
- const context = await this.options.onMutate?.(variables, mutationFnContext);
1657
- if (context !== this.state.context) this.#dispatch({
1658
- type: "pending",
1659
- context,
1660
- variables,
1661
- isPaused
1662
- });
1663
- }
1664
- const data = await this.#retryer.start();
1665
- await this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);
1666
- await this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);
1667
- await this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);
1668
- await this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);
1669
- this.#dispatch({
1670
- type: "success",
1671
- data
1672
- });
1673
- return data;
1674
- } catch (error) {
1675
- try {
1676
- await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);
1677
- } catch (e) {
1678
- Promise.reject(e);
1679
- }
1680
- try {
1681
- await this.options.onError?.(error, variables, this.state.context, mutationFnContext);
1682
- } catch (e) {
1683
- Promise.reject(e);
1684
- }
1685
- try {
1686
- await this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);
1687
- } catch (e) {
1688
- Promise.reject(e);
1689
- }
1690
- try {
1691
- await this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);
1692
- } catch (e) {
1693
- Promise.reject(e);
1694
- }
1695
- this.#dispatch({
1696
- type: "error",
1697
- error
1698
- });
1699
- throw error;
1700
- } finally {
1701
- this.#mutationCache.runNext(this);
1702
- }
1703
- }
1704
- #dispatch(action) {
1705
- const reducer = (state) => {
1706
- switch (action.type) {
1707
- case "failed": return {
1708
- ...state,
1709
- failureCount: action.failureCount,
1710
- failureReason: action.error
1711
- };
1712
- case "pause": return {
1713
- ...state,
1714
- isPaused: true
1715
- };
1716
- case "continue": return {
1717
- ...state,
1718
- isPaused: false
1719
- };
1720
- case "pending": return {
1721
- ...state,
1722
- context: action.context,
1723
- data: void 0,
1724
- failureCount: 0,
1725
- failureReason: null,
1726
- error: null,
1727
- isPaused: action.isPaused,
1728
- status: "pending",
1729
- variables: action.variables,
1730
- submittedAt: Date.now()
1731
- };
1732
- case "success": return {
1733
- ...state,
1734
- data: action.data,
1735
- failureCount: 0,
1736
- failureReason: null,
1737
- error: null,
1738
- status: "success",
1739
- isPaused: false
1740
- };
1741
- case "error": return {
1742
- ...state,
1743
- data: void 0,
1744
- error: action.error,
1745
- failureCount: state.failureCount + 1,
1746
- failureReason: action.error,
1747
- isPaused: false,
1748
- status: "error"
1749
- };
1750
- }
1751
- };
1752
- this.state = reducer(this.state);
1753
- notifyManager.batch(() => {
1754
- this.#observers.forEach((observer) => {
1755
- observer.onMutationUpdate(action);
1756
- });
1757
- this.#mutationCache.notify({
1758
- mutation: this,
1759
- type: "updated",
1760
- action
1761
- });
1762
- });
1763
- }
1764
- };
1765
- function getDefaultState() {
1766
- return {
1767
- context: void 0,
1768
- data: void 0,
1769
- error: null,
1770
- failureCount: 0,
1771
- failureReason: null,
1772
- isPaused: false,
1773
- status: "idle",
1774
- variables: void 0,
1775
- submittedAt: 0
1776
- };
1777
- }
1778
- //#endregion
1779
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/mutationCache.js
1780
- var MutationCache$1 = class extends Subscribable {
1781
- constructor(config = {}) {
1782
- super();
1783
- this.config = config;
1784
- this.#mutations = /* @__PURE__ */ new Set();
1785
- this.#scopes = /* @__PURE__ */ new Map();
1786
- this.#mutationId = 0;
1787
- }
1788
- #mutations;
1789
- #scopes;
1790
- #mutationId;
1791
- build(client, options, state) {
1792
- const mutation = new Mutation({
1793
- client,
1794
- mutationCache: this,
1795
- mutationId: ++this.#mutationId,
1796
- options: client.defaultMutationOptions(options),
1797
- state
1798
- });
1799
- this.add(mutation);
1800
- return mutation;
1801
- }
1802
- add(mutation) {
1803
- this.#mutations.add(mutation);
1804
- const scope = scopeFor(mutation);
1805
- if (typeof scope === "string") {
1806
- const scopedMutations = this.#scopes.get(scope);
1807
- if (scopedMutations) scopedMutations.push(mutation);
1808
- else this.#scopes.set(scope, [mutation]);
1809
- }
1810
- this.notify({
1811
- type: "added",
1812
- mutation
1813
- });
1814
- }
1815
- remove(mutation) {
1816
- if (this.#mutations.delete(mutation)) {
1817
- const scope = scopeFor(mutation);
1818
- if (typeof scope === "string") {
1819
- const scopedMutations = this.#scopes.get(scope);
1820
- if (scopedMutations) {
1821
- if (scopedMutations.length > 1) {
1822
- const index = scopedMutations.indexOf(mutation);
1823
- if (index !== -1) scopedMutations.splice(index, 1);
1824
- } else if (scopedMutations[0] === mutation) this.#scopes.delete(scope);
1825
- }
1826
- }
1827
- }
1828
- this.notify({
1829
- type: "removed",
1830
- mutation
1831
- });
1832
- }
1833
- canRun(mutation) {
1834
- const scope = scopeFor(mutation);
1835
- if (typeof scope === "string") {
1836
- const firstPendingMutation = this.#scopes.get(scope)?.find((m) => m.state.status === "pending");
1837
- return !firstPendingMutation || firstPendingMutation === mutation;
1838
- } else return true;
1839
- }
1840
- runNext(mutation) {
1841
- const scope = scopeFor(mutation);
1842
- if (typeof scope === "string") return (this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused))?.continue() ?? Promise.resolve();
1843
- else return Promise.resolve();
1844
- }
1845
- clear() {
1846
- notifyManager.batch(() => {
1847
- this.#mutations.forEach((mutation) => {
1848
- this.notify({
1849
- type: "removed",
1850
- mutation
1851
- });
1852
- });
1853
- this.#mutations.clear();
1854
- this.#scopes.clear();
1855
- });
1856
- }
1857
- getAll() {
1858
- return Array.from(this.#mutations);
1859
- }
1860
- find(filters) {
1861
- const defaultedFilters = {
1862
- exact: true,
1863
- ...filters
1864
- };
1865
- return this.getAll().find((mutation) => matchMutation(defaultedFilters, mutation));
1866
- }
1867
- findAll(filters = {}) {
1868
- return this.getAll().filter((mutation) => matchMutation(filters, mutation));
1869
- }
1870
- notify(event) {
1871
- notifyManager.batch(() => {
1872
- this.listeners.forEach((listener) => {
1873
- listener(event);
1874
- });
1875
- });
1876
- }
1877
- resumePausedMutations() {
1878
- const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
1879
- return notifyManager.batch(() => Promise.all(pausedMutations.map((mutation) => mutation.continue().catch(noop))));
1880
- }
1881
- };
1882
- function scopeFor(mutation) {
1883
- return mutation.options.scope?.id;
1884
- }
1885
- //#endregion
1886
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/mutationObserver.js
1887
- var MutationObserver = class extends Subscribable {
1888
- #client;
1889
- #currentResult = void 0;
1890
- #currentMutation;
1891
- #mutateOptions;
1892
- constructor(client, options) {
1893
- super();
1894
- this.#client = client;
1895
- this.setOptions(options);
1896
- this.bindMethods();
1897
- this.#updateResult();
1898
- }
1899
- bindMethods() {
1900
- this.mutate = this.mutate.bind(this);
1901
- this.reset = this.reset.bind(this);
1902
- }
1903
- setOptions(options) {
1904
- const prevOptions = this.options;
1905
- this.options = this.#client.defaultMutationOptions(options);
1906
- if (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({
1907
- type: "observerOptionsUpdated",
1908
- mutation: this.#currentMutation,
1909
- observer: this
1910
- });
1911
- if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();
1912
- else if (this.#currentMutation?.state.status === "pending") this.#currentMutation.setOptions(this.options);
1913
- }
1914
- onUnsubscribe() {
1915
- if (!this.hasListeners()) this.#currentMutation?.removeObserver(this);
1916
- }
1917
- onMutationUpdate(action) {
1918
- this.#updateResult();
1919
- this.#notify(action);
1920
- }
1921
- getCurrentResult() {
1922
- return this.#currentResult;
1923
- }
1924
- reset() {
1925
- this.#currentMutation?.removeObserver(this);
1926
- this.#currentMutation = void 0;
1927
- this.#updateResult();
1928
- this.#notify();
1929
- }
1930
- mutate(variables, options) {
1931
- this.#mutateOptions = options;
1932
- this.#currentMutation?.removeObserver(this);
1933
- this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);
1934
- this.#currentMutation.addObserver(this);
1935
- return this.#currentMutation.execute(variables);
1936
- }
1937
- #updateResult() {
1938
- const state = this.#currentMutation?.state ?? getDefaultState();
1939
- this.#currentResult = {
1940
- ...state,
1941
- isPending: state.status === "pending",
1942
- isSuccess: state.status === "success",
1943
- isError: state.status === "error",
1944
- isIdle: state.status === "idle",
1945
- mutate: this.mutate,
1946
- reset: this.reset
1947
- };
1948
- }
1949
- #notify(action) {
1950
- notifyManager.batch(() => {
1951
- if (this.#mutateOptions && this.hasListeners()) {
1952
- const variables = this.#currentResult.variables;
1953
- const onMutateResult = this.#currentResult.context;
1954
- const context = {
1955
- client: this.#client,
1956
- meta: this.options.meta,
1957
- mutationKey: this.options.mutationKey
1958
- };
1959
- if (action?.type === "success") {
1960
- try {
1961
- this.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);
1962
- } catch (e) {
1963
- Promise.reject(e);
1964
- }
1965
- try {
1966
- this.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);
1967
- } catch (e) {
1968
- Promise.reject(e);
1969
- }
1970
- } else if (action?.type === "error") {
1971
- try {
1972
- this.#mutateOptions.onError?.(action.error, variables, onMutateResult, context);
1973
- } catch (e) {
1974
- Promise.reject(e);
1975
- }
1976
- try {
1977
- this.#mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);
1978
- } catch (e) {
1979
- Promise.reject(e);
1980
- }
1981
- }
1982
- }
1983
- this.listeners.forEach((listener) => {
1984
- listener(this.#currentResult);
1985
- });
1986
- });
1987
- }
1988
- };
1989
- //#endregion
1990
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/queriesObserver.js
1991
- function difference(array1, array2) {
1992
- const excludeSet = new Set(array2);
1993
- return array1.filter((x) => !excludeSet.has(x));
1994
- }
1995
- function replaceAt(array, index, value) {
1996
- const copy = array.slice(0);
1997
- copy[index] = value;
1998
- return copy;
1999
- }
2000
- var QueriesObserver = class extends Subscribable {
2001
- #client;
2002
- #result;
2003
- #queries;
2004
- #options;
2005
- #observers;
2006
- #combinedResult;
2007
- #lastCombine;
2008
- #lastResult;
2009
- #lastQueryHashes;
2010
- #observerMatches = [];
2011
- constructor(client, queries, options) {
2012
- super();
2013
- this.#client = client;
2014
- this.#options = options;
2015
- this.#queries = [];
2016
- this.#observers = [];
2017
- this.#result = [];
2018
- this.setQueries(queries);
2019
- }
2020
- onSubscribe() {
2021
- if (this.listeners.size === 1) this.#observers.forEach((observer) => {
2022
- observer.subscribe((result) => {
2023
- this.#onUpdate(observer, result);
2024
- });
2025
- });
2026
- }
2027
- onUnsubscribe() {
2028
- if (!this.listeners.size) this.destroy();
2029
- }
2030
- destroy() {
2031
- this.listeners = /* @__PURE__ */ new Set();
2032
- this.#observers.forEach((observer) => {
2033
- observer.destroy();
2034
- });
2035
- }
2036
- setQueries(queries, options) {
2037
- this.#queries = queries;
2038
- this.#options = options;
2039
- {
2040
- const queryHashes = queries.map((query) => this.#client.defaultQueryOptions(query).queryHash);
2041
- if (new Set(queryHashes).size !== queryHashes.length) console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.");
2042
- }
2043
- notifyManager.batch(() => {
2044
- const prevObservers = this.#observers;
2045
- const newObserverMatches = this.#findMatchingObservers(this.#queries);
2046
- newObserverMatches.forEach((match) => match.observer.setOptions(match.defaultedQueryOptions));
2047
- const newObservers = newObserverMatches.map((match) => match.observer);
2048
- const newResult = newObservers.map((observer) => observer.getCurrentResult());
2049
- const hasLengthChange = prevObservers.length !== newObservers.length;
2050
- const hasIndexChange = newObservers.some((observer, index) => observer !== prevObservers[index]);
2051
- const hasStructuralChange = hasLengthChange || hasIndexChange;
2052
- const hasResultChange = hasStructuralChange ? true : newResult.some((result, index) => {
2053
- const prev = this.#result[index];
2054
- return !prev || !shallowEqualObjects(result, prev);
2055
- });
2056
- if (!hasStructuralChange && !hasResultChange) return;
2057
- if (hasStructuralChange) {
2058
- this.#observerMatches = newObserverMatches;
2059
- this.#observers = newObservers;
2060
- }
2061
- this.#result = newResult;
2062
- if (!this.hasListeners()) return;
2063
- if (hasStructuralChange) {
2064
- difference(prevObservers, newObservers).forEach((observer) => {
2065
- observer.destroy();
2066
- });
2067
- difference(newObservers, prevObservers).forEach((observer) => {
2068
- observer.subscribe((result) => {
2069
- this.#onUpdate(observer, result);
2070
- });
2071
- });
2072
- }
2073
- this.#notify();
2074
- });
2075
- }
2076
- getCurrentResult() {
2077
- return this.#result;
2078
- }
2079
- getQueries() {
2080
- return this.#observers.map((observer) => observer.getCurrentQuery());
2081
- }
2082
- getObservers() {
2083
- return this.#observers;
2084
- }
2085
- getOptimisticResult(queries, combine) {
2086
- const matches = this.#findMatchingObservers(queries);
2087
- const result = matches.map((match) => match.observer.getOptimisticResult(match.defaultedQueryOptions));
2088
- const queryHashes = matches.map((match) => match.defaultedQueryOptions.queryHash);
2089
- return [
2090
- result,
2091
- (r) => {
2092
- return this.#combineResult(r ?? result, combine, queryHashes);
2093
- },
2094
- () => {
2095
- return this.#trackResult(result, matches);
2096
- }
2097
- ];
2098
- }
2099
- #trackResult(result, matches) {
2100
- return matches.map((match, index) => {
2101
- const observerResult = result[index];
2102
- return !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult, (accessedProp) => {
2103
- matches.forEach((m) => {
2104
- m.observer.trackProp(accessedProp);
2105
- });
2106
- }) : observerResult;
2107
- });
2108
- }
2109
- #combineResult(input, combine, queryHashes) {
2110
- if (combine) {
2111
- const lastHashes = this.#lastQueryHashes;
2112
- const queryHashesChanged = queryHashes !== void 0 && lastHashes !== void 0 && (lastHashes.length !== queryHashes.length || queryHashes.some((hash, i) => hash !== lastHashes[i]));
2113
- if (!this.#combinedResult || this.#result !== this.#lastResult || queryHashesChanged || combine !== this.#lastCombine) {
2114
- this.#lastCombine = combine;
2115
- this.#lastResult = this.#result;
2116
- if (queryHashes !== void 0) this.#lastQueryHashes = queryHashes;
2117
- this.#combinedResult = replaceEqualDeep(this.#combinedResult, combine(input));
2118
- }
2119
- return this.#combinedResult;
2120
- }
2121
- return input;
2122
- }
2123
- #shouldSkipCombine() {
2124
- return this.#options?.combine !== void 0 && this.#observers.some((observer, index) => {
2125
- return observer.options.suspense && this.#result[index]?.data === void 0;
2126
- });
2127
- }
2128
- #findMatchingObservers(queries) {
2129
- const prevObserversMap = /* @__PURE__ */ new Map();
2130
- this.#observers.forEach((observer) => {
2131
- const key = observer.options.queryHash;
2132
- if (!key) return;
2133
- const previousObservers = prevObserversMap.get(key);
2134
- if (previousObservers) previousObservers.push(observer);
2135
- else prevObserversMap.set(key, [observer]);
2136
- });
2137
- const observers = [];
2138
- queries.forEach((options) => {
2139
- const defaultedOptions = this.#client.defaultQueryOptions(options);
2140
- const observer = prevObserversMap.get(defaultedOptions.queryHash)?.shift() ?? new QueryObserver(this.#client, defaultedOptions);
2141
- observers.push({
2142
- defaultedQueryOptions: defaultedOptions,
2143
- observer
2144
- });
2145
- });
2146
- return observers;
2147
- }
2148
- #onUpdate(observer, result) {
2149
- const index = this.#observers.indexOf(observer);
2150
- if (index !== -1) {
2151
- this.#result = replaceAt(this.#result, index, result);
2152
- this.#notify();
2153
- }
2154
- }
2155
- #notify() {
2156
- if (this.hasListeners()) {
2157
- const newTracked = this.#trackResult(this.#result, this.#observerMatches);
2158
- const shouldSkipCombine = this.#shouldSkipCombine();
2159
- const previousResult = this.#combinedResult;
2160
- const newResult = shouldSkipCombine ? previousResult : this.#combineResult(newTracked, this.#options?.combine);
2161
- if (shouldSkipCombine || previousResult !== newResult) notifyManager.batch(() => {
2162
- this.listeners.forEach((listener) => {
2163
- listener(this.#result);
2164
- });
2165
- });
2166
- }
2167
- }
2168
- };
2169
- //#endregion
2170
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/queryCache.js
2171
- var QueryCache$1 = class extends Subscribable {
2172
- constructor(config = {}) {
2173
- super();
2174
- this.config = config;
2175
- this.#queries = /* @__PURE__ */ new Map();
2176
- }
2177
- #queries;
2178
- build(client, options, state) {
2179
- const queryKey = options.queryKey;
2180
- const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
2181
- let query = this.get(queryHash);
2182
- if (!query) {
2183
- query = new Query({
2184
- client,
2185
- queryKey,
2186
- queryHash,
2187
- options: client.defaultQueryOptions(options),
2188
- state,
2189
- defaultOptions: client.getQueryDefaults(queryKey)
2190
- });
2191
- this.add(query);
2192
- }
2193
- return query;
2194
- }
2195
- add(query) {
2196
- if (!this.#queries.has(query.queryHash)) {
2197
- this.#queries.set(query.queryHash, query);
2198
- this.notify({
2199
- type: "added",
2200
- query
2201
- });
2202
- }
2203
- }
2204
- remove(query) {
2205
- const queryInMap = this.#queries.get(query.queryHash);
2206
- if (queryInMap) {
2207
- query.destroy();
2208
- if (queryInMap === query) this.#queries.delete(query.queryHash);
2209
- this.notify({
2210
- type: "removed",
2211
- query
2212
- });
2213
- }
2214
- }
2215
- clear() {
2216
- notifyManager.batch(() => {
2217
- this.getAll().forEach((query) => {
2218
- this.remove(query);
2219
- });
2220
- });
2221
- }
2222
- get(queryHash) {
2223
- return this.#queries.get(queryHash);
2224
- }
2225
- getAll() {
2226
- return [...this.#queries.values()];
2227
- }
2228
- find(filters) {
2229
- const defaultedFilters = {
2230
- exact: true,
2231
- ...filters
2232
- };
2233
- return this.getAll().find((query) => matchQuery(defaultedFilters, query));
2234
- }
2235
- findAll(filters = {}) {
2236
- const queries = this.getAll();
2237
- return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
2238
- }
2239
- notify(event) {
2240
- notifyManager.batch(() => {
2241
- this.listeners.forEach((listener) => {
2242
- listener(event);
2243
- });
2244
- });
2245
- }
2246
- onFocus() {
2247
- notifyManager.batch(() => {
2248
- this.getAll().forEach((query) => {
2249
- query.onFocus();
2250
- });
2251
- });
2252
- }
2253
- onOnline() {
2254
- notifyManager.batch(() => {
2255
- this.getAll().forEach((query) => {
2256
- query.onOnline();
2257
- });
2258
- });
2259
- }
2260
- };
2261
- //#endregion
2262
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/queryClient.js
2263
- var QueryClient$1 = class {
2264
- #queryCache;
2265
- #mutationCache;
2266
- #defaultOptions;
2267
- #queryDefaults;
2268
- #mutationDefaults;
2269
- #mountCount;
2270
- #unsubscribeFocus;
2271
- #unsubscribeOnline;
2272
- constructor(config = {}) {
2273
- this.#queryCache = config.queryCache || new QueryCache$1();
2274
- this.#mutationCache = config.mutationCache || new MutationCache$1();
2275
- this.#defaultOptions = config.defaultOptions || {};
2276
- this.#queryDefaults = /* @__PURE__ */ new Map();
2277
- this.#mutationDefaults = /* @__PURE__ */ new Map();
2278
- this.#mountCount = 0;
2279
- }
2280
- mount() {
2281
- this.#mountCount++;
2282
- if (this.#mountCount !== 1) return;
2283
- this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
2284
- if (focused) {
2285
- await this.resumePausedMutations();
2286
- this.#queryCache.onFocus();
2287
- }
2288
- });
2289
- this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
2290
- if (online) {
2291
- await this.resumePausedMutations();
2292
- this.#queryCache.onOnline();
2293
- }
2294
- });
2295
- }
2296
- unmount() {
2297
- this.#mountCount--;
2298
- if (this.#mountCount !== 0) return;
2299
- this.#unsubscribeFocus?.();
2300
- this.#unsubscribeFocus = void 0;
2301
- this.#unsubscribeOnline?.();
2302
- this.#unsubscribeOnline = void 0;
2303
- }
2304
- isFetching(filters) {
2305
- return this.#queryCache.findAll({
2306
- ...filters,
2307
- fetchStatus: "fetching"
2308
- }).length;
2309
- }
2310
- isMutating(filters) {
2311
- return this.#mutationCache.findAll({
2312
- ...filters,
2313
- status: "pending"
2314
- }).length;
2315
- }
2316
- /**
2317
- * Imperative (non-reactive) way to retrieve data for a QueryKey.
2318
- * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
2319
- *
2320
- * Hint: Do not use this function inside a component, because it won't receive updates.
2321
- * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
2322
- */
2323
- getQueryData(queryKey) {
2324
- const options = this.defaultQueryOptions({ queryKey });
2325
- return this.#queryCache.get(options.queryHash)?.state.data;
2326
- }
2327
- ensureQueryData(options) {
2328
- const defaultedOptions = this.defaultQueryOptions(options);
2329
- const query = this.#queryCache.build(this, defaultedOptions);
2330
- const cachedData = query.state.data;
2331
- if (cachedData === void 0) return this.fetchQuery(options);
2332
- if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) this.prefetchQuery(defaultedOptions);
2333
- return Promise.resolve(cachedData);
2334
- }
2335
- getQueriesData(filters) {
2336
- return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
2337
- return [queryKey, state.data];
2338
- });
2339
- }
2340
- setQueryData(queryKey, updater, options) {
2341
- const defaultedOptions = this.defaultQueryOptions({ queryKey });
2342
- const prevData = this.#queryCache.get(defaultedOptions.queryHash)?.state.data;
2343
- const data = functionalUpdate(updater, prevData);
2344
- if (data === void 0) return;
2345
- return this.#queryCache.build(this, defaultedOptions).setData(data, {
2346
- ...options,
2347
- manual: true
2348
- });
2349
- }
2350
- setQueriesData(filters, updater, options) {
2351
- return notifyManager.batch(() => this.#queryCache.findAll(filters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)]));
2352
- }
2353
- getQueryState(queryKey) {
2354
- const options = this.defaultQueryOptions({ queryKey });
2355
- return this.#queryCache.get(options.queryHash)?.state;
2356
- }
2357
- removeQueries(filters) {
2358
- const queryCache = this.#queryCache;
2359
- notifyManager.batch(() => {
2360
- queryCache.findAll(filters).forEach((query) => {
2361
- queryCache.remove(query);
2362
- });
2363
- });
2364
- }
2365
- resetQueries(filters, options) {
2366
- const queryCache = this.#queryCache;
2367
- return notifyManager.batch(() => {
2368
- queryCache.findAll(filters).forEach((query) => {
2369
- query.reset();
2370
- });
2371
- return this.refetchQueries({
2372
- type: "active",
2373
- ...filters
2374
- }, options);
2375
- });
2376
- }
2377
- cancelQueries(filters, cancelOptions = {}) {
2378
- const defaultedCancelOptions = {
2379
- revert: true,
2380
- ...cancelOptions
2381
- };
2382
- const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions)));
2383
- return Promise.all(promises).then(noop).catch(noop);
2384
- }
2385
- invalidateQueries(filters, options = {}) {
2386
- return notifyManager.batch(() => {
2387
- this.#queryCache.findAll(filters).forEach((query) => {
2388
- query.invalidate();
2389
- });
2390
- if (filters?.refetchType === "none") return Promise.resolve();
2391
- return this.refetchQueries({
2392
- ...filters,
2393
- type: filters?.refetchType ?? filters?.type ?? "active"
2394
- }, options);
2395
- });
2396
- }
2397
- refetchQueries(filters, options = {}) {
2398
- const fetchOptions = {
2399
- ...options,
2400
- cancelRefetch: options.cancelRefetch ?? true
2401
- };
2402
- const promises = notifyManager.batch(() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
2403
- let promise = query.fetch(void 0, fetchOptions);
2404
- if (!fetchOptions.throwOnError) promise = promise.catch(noop);
2405
- return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
2406
- }));
2407
- return Promise.all(promises).then(noop);
2408
- }
2409
- fetchQuery(options) {
2410
- const defaultedOptions = this.defaultQueryOptions(options);
2411
- if (defaultedOptions.retry === void 0) defaultedOptions.retry = false;
2412
- const query = this.#queryCache.build(this, defaultedOptions);
2413
- return query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
2414
- }
2415
- prefetchQuery(options) {
2416
- return this.fetchQuery(options).then(noop).catch(noop);
2417
- }
2418
- fetchInfiniteQuery(options) {
2419
- options._type = "infinite";
2420
- return this.fetchQuery(options);
2421
- }
2422
- prefetchInfiniteQuery(options) {
2423
- return this.fetchInfiniteQuery(options).then(noop).catch(noop);
2424
- }
2425
- ensureInfiniteQueryData(options) {
2426
- options._type = "infinite";
2427
- return this.ensureQueryData(options);
2428
- }
2429
- resumePausedMutations() {
2430
- if (onlineManager.isOnline()) return this.#mutationCache.resumePausedMutations();
2431
- return Promise.resolve();
2432
- }
2433
- getQueryCache() {
2434
- return this.#queryCache;
2435
- }
2436
- getMutationCache() {
2437
- return this.#mutationCache;
2438
- }
2439
- getDefaultOptions() {
2440
- return this.#defaultOptions;
2441
- }
2442
- setDefaultOptions(options) {
2443
- this.#defaultOptions = options;
2444
- }
2445
- setQueryDefaults(queryKey, options) {
2446
- this.#queryDefaults.set(hashKey(queryKey), {
2447
- queryKey,
2448
- defaultOptions: options
2449
- });
2450
- }
2451
- getQueryDefaults(queryKey) {
2452
- const defaults = [...this.#queryDefaults.values()];
2453
- const result = {};
2454
- defaults.forEach((queryDefault) => {
2455
- if (partialMatchKey(queryKey, queryDefault.queryKey)) Object.assign(result, queryDefault.defaultOptions);
2456
- });
2457
- return result;
2458
- }
2459
- setMutationDefaults(mutationKey, options) {
2460
- this.#mutationDefaults.set(hashKey(mutationKey), {
2461
- mutationKey,
2462
- defaultOptions: options
2463
- });
2464
- }
2465
- getMutationDefaults(mutationKey) {
2466
- const defaults = [...this.#mutationDefaults.values()];
2467
- const result = {};
2468
- defaults.forEach((queryDefault) => {
2469
- if (partialMatchKey(mutationKey, queryDefault.mutationKey)) Object.assign(result, queryDefault.defaultOptions);
2470
- });
2471
- return result;
2472
- }
2473
- defaultQueryOptions(options) {
2474
- if (options._defaulted) return options;
2475
- const defaultedOptions = {
2476
- ...this.#defaultOptions.queries,
2477
- ...this.getQueryDefaults(options.queryKey),
2478
- ...options,
2479
- _defaulted: true
2480
- };
2481
- if (!defaultedOptions.queryHash) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);
2482
- if (defaultedOptions.refetchOnReconnect === void 0) defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
2483
- if (defaultedOptions.throwOnError === void 0) defaultedOptions.throwOnError = !!defaultedOptions.suspense;
2484
- if (!defaultedOptions.networkMode && defaultedOptions.persister) defaultedOptions.networkMode = "offlineFirst";
2485
- if (defaultedOptions.queryFn === skipToken) defaultedOptions.enabled = false;
2486
- return defaultedOptions;
2487
- }
2488
- defaultMutationOptions(options) {
2489
- if (options?._defaulted) return options;
2490
- return {
2491
- ...this.#defaultOptions.mutations,
2492
- ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
2493
- ...options,
2494
- _defaulted: true
2495
- };
2496
- }
2497
- clear() {
2498
- this.#queryCache.clear();
2499
- this.#mutationCache.clear();
2500
- }
2501
- };
2502
- //#endregion
2503
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/streamedQuery.js
2504
- function streamedQuery({ streamFn, refetchMode = "reset", reducer = (items, chunk) => addToEnd(items, chunk), initialValue = [] }) {
2505
- return async (context) => {
2506
- const query = context.client.getQueryCache().find({
2507
- queryKey: context.queryKey,
2508
- exact: true
2509
- });
2510
- const isRefetch = !!query && query.isFetched();
2511
- if (isRefetch && refetchMode === "reset") query.setState({
2512
- ...query.resetState,
2513
- fetchStatus: "fetching"
2514
- });
2515
- let result = initialValue;
2516
- let cancelled = false;
2517
- const stream = await streamFn(addConsumeAwareSignal({
2518
- client: context.client,
2519
- meta: context.meta,
2520
- queryKey: context.queryKey,
2521
- pageParam: context.pageParam,
2522
- direction: context.direction
2523
- }, () => context.signal, () => cancelled = true));
2524
- const isReplaceRefetch = isRefetch && refetchMode === "replace";
2525
- for await (const chunk of stream) {
2526
- if (cancelled) break;
2527
- if (isReplaceRefetch) result = reducer(result, chunk);
2528
- else context.client.setQueryData(context.queryKey, (prev) => reducer(prev === void 0 ? initialValue : prev, chunk));
2529
- }
2530
- if (isReplaceRefetch && !cancelled) context.client.setQueryData(context.queryKey, result);
2531
- return context.client.getQueryData(context.queryKey) ?? initialValue;
2532
- };
2533
- }
2534
- //#endregion
2535
- //#region ../../../../node_modules/@tanstack/query-core/build/modern/types.js
2536
- var dataTagSymbol = /* @__PURE__ */ Symbol("dataTagSymbol");
2537
- var dataTagErrorSymbol = /* @__PURE__ */ Symbol("dataTagErrorSymbol");
2538
- var unsetMarker = /* @__PURE__ */ Symbol("unsetMarker");
2539
- //#endregion
2540
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/utils.js
2541
- var VUE_QUERY_CLIENT = "VUE_QUERY_CLIENT";
2542
- function getClientKey(key) {
2543
- return `${VUE_QUERY_CLIENT}${key ? `:${key}` : ""}`;
2544
- }
2545
- function updateState(state, update) {
2546
- Object.keys(state).forEach((key) => {
2547
- state[key] = update[key];
2548
- });
2549
- }
2550
- function _cloneDeep(value, customize, currentKey = "", currentLevel = 0) {
2551
- if (customize) {
2552
- const result = customize(value, currentKey, currentLevel);
2553
- if (result === void 0 && isRef(value)) return result;
2554
- if (result !== void 0) return result;
2555
- }
2556
- if (Array.isArray(value)) return value.map((val, index) => _cloneDeep(val, customize, String(index), currentLevel + 1));
2557
- if (typeof value === "object" && isPlainObject(value)) {
2558
- const entries = Object.entries(value).map(([key, val]) => [key, _cloneDeep(val, customize, key, currentLevel + 1)]);
2559
- return Object.fromEntries(entries);
2560
- }
2561
- return value;
2562
- }
2563
- function cloneDeep(value, customize) {
2564
- return _cloneDeep(value, customize);
2565
- }
2566
- function cloneDeepUnref(obj, unrefGetters = false) {
2567
- return cloneDeep(obj, (val, key, level) => {
2568
- if (level === 1 && key === "queryKey") return cloneDeepUnref(val, true);
2569
- if (unrefGetters && isFunction(val)) return cloneDeepUnref(val(), unrefGetters);
2570
- if (isRef(val)) return cloneDeepUnref(unref(val), unrefGetters);
2571
- });
2572
- }
2573
- function isPlainObject(value) {
2574
- if (Object.prototype.toString.call(value) !== "[object Object]") return false;
2575
- const prototype = Object.getPrototypeOf(value);
2576
- return prototype === null || prototype === Object.prototype;
2577
- }
2578
- function isFunction(value) {
2579
- return typeof value === "function";
2580
- }
2581
- //#endregion
2582
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useQueryClient.js
2583
- function useQueryClient(id = "") {
2584
- if (!hasInjectionContext()) throw new Error("vue-query hooks can only be used inside setup() function or functions that support injection context.");
2585
- const key = getClientKey(id);
2586
- const queryClient = inject(key);
2587
- if (!queryClient) throw new Error("No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.");
2588
- return queryClient;
2589
- }
2590
- //#endregion
2591
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/queryCache.js
2592
- var QueryCache = class extends QueryCache$1 {
2593
- find(filters) {
2594
- return super.find(cloneDeepUnref(filters));
2595
- }
2596
- findAll(filters = {}) {
2597
- return super.findAll(cloneDeepUnref(filters));
2598
- }
2599
- };
2600
- //#endregion
2601
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/mutationCache.js
2602
- var MutationCache = class extends MutationCache$1 {
2603
- find(filters) {
2604
- return super.find(cloneDeepUnref(filters));
2605
- }
2606
- findAll(filters = {}) {
2607
- return super.findAll(cloneDeepUnref(filters));
2608
- }
2609
- };
2610
- //#endregion
2611
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/queryClient.js
2612
- var QueryClient = class extends QueryClient$1 {
2613
- constructor(config = {}) {
2614
- const vueQueryConfig = {
2615
- defaultOptions: config.defaultOptions,
2616
- queryCache: config.queryCache || new QueryCache(),
2617
- mutationCache: config.mutationCache || new MutationCache()
2618
- };
2619
- super(vueQueryConfig);
2620
- this.isRestoring = ref(false);
2621
- }
2622
- isFetching(filters = {}) {
2623
- return super.isFetching(cloneDeepUnref(filters));
2624
- }
2625
- isMutating(filters = {}) {
2626
- return super.isMutating(cloneDeepUnref(filters));
2627
- }
2628
- getQueryData(queryKey) {
2629
- return super.getQueryData(cloneDeepUnref(queryKey));
2630
- }
2631
- ensureQueryData(options) {
2632
- return super.ensureQueryData(cloneDeepUnref(options));
2633
- }
2634
- getQueriesData(filters) {
2635
- return super.getQueriesData(cloneDeepUnref(filters));
2636
- }
2637
- setQueryData(queryKey, updater, options = {}) {
2638
- return super.setQueryData(cloneDeepUnref(queryKey), updater, cloneDeepUnref(options));
2639
- }
2640
- setQueriesData(filters, updater, options = {}) {
2641
- return super.setQueriesData(cloneDeepUnref(filters), updater, cloneDeepUnref(options));
2642
- }
2643
- getQueryState(queryKey) {
2644
- return super.getQueryState(cloneDeepUnref(queryKey));
2645
- }
2646
- removeQueries(filters = {}) {
2647
- return super.removeQueries(cloneDeepUnref(filters));
2648
- }
2649
- resetQueries(filters = {}, options = {}) {
2650
- return super.resetQueries(cloneDeepUnref(filters), cloneDeepUnref(options));
2651
- }
2652
- cancelQueries(filters = {}, options = {}) {
2653
- return super.cancelQueries(cloneDeepUnref(filters), cloneDeepUnref(options));
2654
- }
2655
- invalidateQueries(filters = {}, options = {}) {
2656
- const filtersCloned = cloneDeepUnref(filters);
2657
- const optionsCloned = cloneDeepUnref(options);
2658
- super.invalidateQueries({
2659
- ...filtersCloned,
2660
- refetchType: "none"
2661
- }, optionsCloned);
2662
- if (filtersCloned.refetchType === "none") return Promise.resolve();
2663
- const refetchFilters = {
2664
- ...filtersCloned,
2665
- type: filtersCloned.refetchType ?? filtersCloned.type ?? "active"
2666
- };
2667
- return nextTick().then(() => {
2668
- return super.refetchQueries(refetchFilters, optionsCloned);
2669
- });
2670
- }
2671
- refetchQueries(filters = {}, options = {}) {
2672
- return super.refetchQueries(cloneDeepUnref(filters), cloneDeepUnref(options));
2673
- }
2674
- fetchQuery(options) {
2675
- return super.fetchQuery(cloneDeepUnref(options));
2676
- }
2677
- prefetchQuery(options) {
2678
- return super.prefetchQuery(cloneDeepUnref(options));
2679
- }
2680
- fetchInfiniteQuery(options) {
2681
- return super.fetchInfiniteQuery(cloneDeepUnref(options));
2682
- }
2683
- prefetchInfiniteQuery(options) {
2684
- return super.prefetchInfiniteQuery(cloneDeepUnref(options));
2685
- }
2686
- setDefaultOptions(options) {
2687
- super.setDefaultOptions(cloneDeepUnref(options));
2688
- }
2689
- setQueryDefaults(queryKey, options) {
2690
- super.setQueryDefaults(cloneDeepUnref(queryKey), cloneDeepUnref(options));
2691
- }
2692
- getQueryDefaults(queryKey) {
2693
- return super.getQueryDefaults(cloneDeepUnref(queryKey));
2694
- }
2695
- setMutationDefaults(mutationKey, options) {
2696
- super.setMutationDefaults(cloneDeepUnref(mutationKey), cloneDeepUnref(options));
2697
- }
2698
- getMutationDefaults(mutationKey) {
2699
- return super.getMutationDefaults(cloneDeepUnref(mutationKey));
2700
- }
2701
- };
2702
- //#endregion
2703
- //#region ../../../../node_modules/@tanstack/vue-query/node_modules/@vue/devtools-api/lib/esm/env.js
2704
- function getDevtoolsGlobalHook() {
2705
- return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
2706
- }
2707
- function getTarget() {
2708
- return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : {};
2709
- }
2710
- var isProxyAvailable = typeof Proxy === "function";
2711
- //#endregion
2712
- //#region ../../../../node_modules/@tanstack/vue-query/node_modules/@vue/devtools-api/lib/esm/const.js
2713
- var HOOK_SETUP = "devtools-plugin:setup";
2714
- var HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
2715
- //#endregion
2716
- //#region ../../../../node_modules/@tanstack/vue-query/node_modules/@vue/devtools-api/lib/esm/time.js
2717
- var supported;
2718
- var perf;
2719
- function isPerformanceSupported() {
2720
- var _a;
2721
- if (supported !== void 0) return supported;
2722
- if (typeof window !== "undefined" && window.performance) {
2723
- supported = true;
2724
- perf = window.performance;
2725
- } else if (typeof globalThis !== "undefined" && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
2726
- supported = true;
2727
- perf = globalThis.perf_hooks.performance;
2728
- } else supported = false;
2729
- return supported;
2730
- }
2731
- function now() {
2732
- return isPerformanceSupported() ? perf.now() : Date.now();
2733
- }
2734
- //#endregion
2735
- //#region ../../../../node_modules/@tanstack/vue-query/node_modules/@vue/devtools-api/lib/esm/proxy.js
2736
- var ApiProxy = class {
2737
- constructor(plugin, hook) {
2738
- this.target = null;
2739
- this.targetQueue = [];
2740
- this.onQueue = [];
2741
- this.plugin = plugin;
2742
- this.hook = hook;
2743
- const defaultSettings = {};
2744
- if (plugin.settings) for (const id in plugin.settings) defaultSettings[id] = plugin.settings[id].defaultValue;
2745
- const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
2746
- let currentSettings = Object.assign({}, defaultSettings);
2747
- try {
2748
- const raw = localStorage.getItem(localSettingsSaveId);
2749
- const data = JSON.parse(raw);
2750
- Object.assign(currentSettings, data);
2751
- } catch (e) {}
2752
- this.fallbacks = {
2753
- getSettings() {
2754
- return currentSettings;
2755
- },
2756
- setSettings(value) {
2757
- try {
2758
- localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
2759
- } catch (e) {}
2760
- currentSettings = value;
2761
- },
2762
- now() {
2763
- return now();
2764
- }
2765
- };
2766
- if (hook) hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
2767
- if (pluginId === this.plugin.id) this.fallbacks.setSettings(value);
2768
- });
2769
- this.proxiedOn = new Proxy({}, { get: (_target, prop) => {
2770
- if (this.target) return this.target.on[prop];
2771
- else return (...args) => {
2772
- this.onQueue.push({
2773
- method: prop,
2774
- args
2775
- });
2776
- };
2777
- } });
2778
- this.proxiedTarget = new Proxy({}, { get: (_target, prop) => {
2779
- if (this.target) return this.target[prop];
2780
- else if (prop === "on") return this.proxiedOn;
2781
- else if (Object.keys(this.fallbacks).includes(prop)) return (...args) => {
2782
- this.targetQueue.push({
2783
- method: prop,
2784
- args,
2785
- resolve: () => {}
2786
- });
2787
- return this.fallbacks[prop](...args);
2788
- };
2789
- else return (...args) => {
2790
- return new Promise((resolve) => {
2791
- this.targetQueue.push({
2792
- method: prop,
2793
- args,
2794
- resolve
2795
- });
2796
- });
2797
- };
2798
- } });
2799
- }
2800
- async setRealTarget(target) {
2801
- this.target = target;
2802
- for (const item of this.onQueue) this.target.on[item.method](...item.args);
2803
- for (const item of this.targetQueue) item.resolve(await this.target[item.method](...item.args));
2804
- }
2805
- };
2806
- //#endregion
2807
- //#region ../../../../node_modules/@tanstack/vue-query/node_modules/@vue/devtools-api/lib/esm/index.js
2808
- function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
2809
- const descriptor = pluginDescriptor;
2810
- const target = getTarget();
2811
- const hook = getDevtoolsGlobalHook();
2812
- const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
2813
- if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
2814
- else {
2815
- const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
2816
- (target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || []).push({
2817
- pluginDescriptor: descriptor,
2818
- setupFn,
2819
- proxy
2820
- });
2821
- if (proxy) setupFn(proxy.proxiedTarget);
2822
- }
2823
- }
2824
- //#endregion
2825
- //#region ../../../../node_modules/@tanstack/match-sorter-utils/build/lib/index.mjs
2826
- /**
2827
- * match-sorter-utils
2828
- *
2829
- * Copyright (c) TanStack
2830
- *
2831
- * This source code is licensed under the MIT license found in the
2832
- * LICENSE.md file in the root directory of this source tree.
2833
- *
2834
- * @license MIT
2835
- */
2836
- var characterMap = {
2837
- À: "A",
2838
- Á: "A",
2839
- Â: "A",
2840
- Ã: "A",
2841
- Ä: "A",
2842
- Å: "A",
2843
- Ấ: "A",
2844
- Ắ: "A",
2845
- Ẳ: "A",
2846
- Ẵ: "A",
2847
- Ặ: "A",
2848
- Æ: "AE",
2849
- Ầ: "A",
2850
- Ằ: "A",
2851
- Ȃ: "A",
2852
- Ç: "C",
2853
- Ḉ: "C",
2854
- È: "E",
2855
- É: "E",
2856
- Ê: "E",
2857
- Ë: "E",
2858
- Ế: "E",
2859
- Ḗ: "E",
2860
- Ề: "E",
2861
- Ḕ: "E",
2862
- Ḝ: "E",
2863
- Ȇ: "E",
2864
- Ì: "I",
2865
- Í: "I",
2866
- Î: "I",
2867
- Ï: "I",
2868
- Ḯ: "I",
2869
- Ȋ: "I",
2870
- Ð: "D",
2871
- Ñ: "N",
2872
- Ò: "O",
2873
- Ó: "O",
2874
- Ô: "O",
2875
- Õ: "O",
2876
- Ö: "O",
2877
- Ø: "O",
2878
- Ố: "O",
2879
- Ṍ: "O",
2880
- Ṓ: "O",
2881
- Ȏ: "O",
2882
- Ù: "U",
2883
- Ú: "U",
2884
- Û: "U",
2885
- Ü: "U",
2886
- Ý: "Y",
2887
- à: "a",
2888
- á: "a",
2889
- â: "a",
2890
- ã: "a",
2891
- ä: "a",
2892
- å: "a",
2893
- ấ: "a",
2894
- ắ: "a",
2895
- ẳ: "a",
2896
- ẵ: "a",
2897
- ặ: "a",
2898
- æ: "ae",
2899
- ầ: "a",
2900
- ằ: "a",
2901
- ȃ: "a",
2902
- ç: "c",
2903
- ḉ: "c",
2904
- è: "e",
2905
- é: "e",
2906
- ê: "e",
2907
- ë: "e",
2908
- ế: "e",
2909
- ḗ: "e",
2910
- ề: "e",
2911
- ḕ: "e",
2912
- ḝ: "e",
2913
- ȇ: "e",
2914
- ì: "i",
2915
- í: "i",
2916
- î: "i",
2917
- ï: "i",
2918
- ḯ: "i",
2919
- ȋ: "i",
2920
- ð: "d",
2921
- ñ: "n",
2922
- ò: "o",
2923
- ó: "o",
2924
- ô: "o",
2925
- õ: "o",
2926
- ö: "o",
2927
- ø: "o",
2928
- ố: "o",
2929
- ṍ: "o",
2930
- ṓ: "o",
2931
- ȏ: "o",
2932
- ù: "u",
2933
- ú: "u",
2934
- û: "u",
2935
- ü: "u",
2936
- ý: "y",
2937
- ÿ: "y",
2938
- Ā: "A",
2939
- ā: "a",
2940
- Ă: "A",
2941
- ă: "a",
2942
- Ą: "A",
2943
- ą: "a",
2944
- Ć: "C",
2945
- ć: "c",
2946
- Ĉ: "C",
2947
- ĉ: "c",
2948
- Ċ: "C",
2949
- ċ: "c",
2950
- Č: "C",
2951
- č: "c",
2952
- C̆: "C",
2953
- c̆: "c",
2954
- Ď: "D",
2955
- ď: "d",
2956
- Đ: "D",
2957
- đ: "d",
2958
- Ē: "E",
2959
- ē: "e",
2960
- Ĕ: "E",
2961
- ĕ: "e",
2962
- Ė: "E",
2963
- ė: "e",
2964
- Ę: "E",
2965
- ę: "e",
2966
- Ě: "E",
2967
- ě: "e",
2968
- Ĝ: "G",
2969
- Ǵ: "G",
2970
- ĝ: "g",
2971
- ǵ: "g",
2972
- Ğ: "G",
2973
- ğ: "g",
2974
- Ġ: "G",
2975
- ġ: "g",
2976
- Ģ: "G",
2977
- ģ: "g",
2978
- Ĥ: "H",
2979
- ĥ: "h",
2980
- Ħ: "H",
2981
- ħ: "h",
2982
- Ḫ: "H",
2983
- ḫ: "h",
2984
- Ĩ: "I",
2985
- ĩ: "i",
2986
- Ī: "I",
2987
- ī: "i",
2988
- Ĭ: "I",
2989
- ĭ: "i",
2990
- Į: "I",
2991
- į: "i",
2992
- İ: "I",
2993
- ı: "i",
2994
- IJ: "IJ",
2995
- ij: "ij",
2996
- Ĵ: "J",
2997
- ĵ: "j",
2998
- Ķ: "K",
2999
- ķ: "k",
3000
- Ḱ: "K",
3001
- ḱ: "k",
3002
- K̆: "K",
3003
- k̆: "k",
3004
- Ĺ: "L",
3005
- ĺ: "l",
3006
- Ļ: "L",
3007
- ļ: "l",
3008
- Ľ: "L",
3009
- ľ: "l",
3010
- Ŀ: "L",
3011
- ŀ: "l",
3012
- Ł: "l",
3013
- ł: "l",
3014
- Ḿ: "M",
3015
- ḿ: "m",
3016
- M̆: "M",
3017
- m̆: "m",
3018
- Ń: "N",
3019
- ń: "n",
3020
- Ņ: "N",
3021
- ņ: "n",
3022
- Ň: "N",
3023
- ň: "n",
3024
- ʼn: "n",
3025
- N̆: "N",
3026
- n̆: "n",
3027
- Ō: "O",
3028
- ō: "o",
3029
- Ŏ: "O",
3030
- ŏ: "o",
3031
- Ő: "O",
3032
- ő: "o",
3033
- Œ: "OE",
3034
- œ: "oe",
3035
- P̆: "P",
3036
- p̆: "p",
3037
- Ŕ: "R",
3038
- ŕ: "r",
3039
- Ŗ: "R",
3040
- ŗ: "r",
3041
- Ř: "R",
3042
- ř: "r",
3043
- R̆: "R",
3044
- r̆: "r",
3045
- Ȓ: "R",
3046
- ȓ: "r",
3047
- Ś: "S",
3048
- ś: "s",
3049
- Ŝ: "S",
3050
- ŝ: "s",
3051
- Ş: "S",
3052
- Ș: "S",
3053
- ș: "s",
3054
- ş: "s",
3055
- Š: "S",
3056
- š: "s",
3057
- Ţ: "T",
3058
- ţ: "t",
3059
- ț: "t",
3060
- Ț: "T",
3061
- Ť: "T",
3062
- ť: "t",
3063
- Ŧ: "T",
3064
- ŧ: "t",
3065
- T̆: "T",
3066
- t̆: "t",
3067
- Ũ: "U",
3068
- ũ: "u",
3069
- Ū: "U",
3070
- ū: "u",
3071
- Ŭ: "U",
3072
- ŭ: "u",
3073
- Ů: "U",
3074
- ů: "u",
3075
- Ű: "U",
3076
- ű: "u",
3077
- Ų: "U",
3078
- ų: "u",
3079
- Ȗ: "U",
3080
- ȗ: "u",
3081
- V̆: "V",
3082
- v̆: "v",
3083
- Ŵ: "W",
3084
- ŵ: "w",
3085
- Ẃ: "W",
3086
- ẃ: "w",
3087
- X̆: "X",
3088
- x̆: "x",
3089
- Ŷ: "Y",
3090
- ŷ: "y",
3091
- Ÿ: "Y",
3092
- Y̆: "Y",
3093
- y̆: "y",
3094
- Ź: "Z",
3095
- ź: "z",
3096
- Ż: "Z",
3097
- ż: "z",
3098
- Ž: "Z",
3099
- ž: "z",
3100
- ſ: "s",
3101
- ƒ: "f",
3102
- Ơ: "O",
3103
- ơ: "o",
3104
- Ư: "U",
3105
- ư: "u",
3106
- Ǎ: "A",
3107
- ǎ: "a",
3108
- Ǐ: "I",
3109
- ǐ: "i",
3110
- Ǒ: "O",
3111
- ǒ: "o",
3112
- Ǔ: "U",
3113
- ǔ: "u",
3114
- Ǖ: "U",
3115
- ǖ: "u",
3116
- Ǘ: "U",
3117
- ǘ: "u",
3118
- Ǚ: "U",
3119
- ǚ: "u",
3120
- Ǜ: "U",
3121
- ǜ: "u",
3122
- Ứ: "U",
3123
- ứ: "u",
3124
- Ṹ: "U",
3125
- ṹ: "u",
3126
- Ǻ: "A",
3127
- ǻ: "a",
3128
- Ǽ: "AE",
3129
- ǽ: "ae",
3130
- Ǿ: "O",
3131
- ǿ: "o",
3132
- Þ: "TH",
3133
- þ: "th",
3134
- Ṕ: "P",
3135
- ṕ: "p",
3136
- Ṥ: "S",
3137
- ṥ: "s",
3138
- X́: "X",
3139
- x́: "x",
3140
- Ѓ: "Г",
3141
- ѓ: "г",
3142
- Ќ: "К",
3143
- ќ: "к",
3144
- A̋: "A",
3145
- a̋: "a",
3146
- E̋: "E",
3147
- e̋: "e",
3148
- I̋: "I",
3149
- i̋: "i",
3150
- Ǹ: "N",
3151
- ǹ: "n",
3152
- Ồ: "O",
3153
- ồ: "o",
3154
- Ṑ: "O",
3155
- ṑ: "o",
3156
- Ừ: "U",
3157
- ừ: "u",
3158
- Ẁ: "W",
3159
- ẁ: "w",
3160
- Ỳ: "Y",
3161
- ỳ: "y",
3162
- Ȁ: "A",
3163
- ȁ: "a",
3164
- Ȅ: "E",
3165
- ȅ: "e",
3166
- Ȉ: "I",
3167
- ȉ: "i",
3168
- Ȍ: "O",
3169
- ȍ: "o",
3170
- Ȑ: "R",
3171
- ȑ: "r",
3172
- Ȕ: "U",
3173
- ȕ: "u",
3174
- B̌: "B",
3175
- b̌: "b",
3176
- Č̣: "C",
3177
- č̣: "c",
3178
- Ê̌: "E",
3179
- ê̌: "e",
3180
- F̌: "F",
3181
- f̌: "f",
3182
- Ǧ: "G",
3183
- ǧ: "g",
3184
- Ȟ: "H",
3185
- ȟ: "h",
3186
- J̌: "J",
3187
- ǰ: "j",
3188
- Ǩ: "K",
3189
- ǩ: "k",
3190
- M̌: "M",
3191
- m̌: "m",
3192
- P̌: "P",
3193
- p̌: "p",
3194
- Q̌: "Q",
3195
- q̌: "q",
3196
- Ř̩: "R",
3197
- ř̩: "r",
3198
- Ṧ: "S",
3199
- ṧ: "s",
3200
- V̌: "V",
3201
- v̌: "v",
3202
- W̌: "W",
3203
- w̌: "w",
3204
- X̌: "X",
3205
- x̌: "x",
3206
- Y̌: "Y",
3207
- y̌: "y",
3208
- A̧: "A",
3209
- a̧: "a",
3210
- B̧: "B",
3211
- b̧: "b",
3212
- Ḑ: "D",
3213
- ḑ: "d",
3214
- Ȩ: "E",
3215
- ȩ: "e",
3216
- Ɛ̧: "E",
3217
- ɛ̧: "e",
3218
- Ḩ: "H",
3219
- ḩ: "h",
3220
- I̧: "I",
3221
- i̧: "i",
3222
- Ɨ̧: "I",
3223
- ɨ̧: "i",
3224
- M̧: "M",
3225
- m̧: "m",
3226
- O̧: "O",
3227
- o̧: "o",
3228
- Q̧: "Q",
3229
- q̧: "q",
3230
- U̧: "U",
3231
- u̧: "u",
3232
- X̧: "X",
3233
- x̧: "x",
3234
- Z̧: "Z",
3235
- z̧: "z"
3236
- };
3237
- var chars = Object.keys(characterMap).join("|");
3238
- var allAccents = new RegExp(chars, "g");
3239
- function removeAccents(str) {
3240
- return str.replace(allAccents, (match) => {
3241
- return characterMap[match];
3242
- });
3243
- }
3244
- /**
3245
- * @name match-sorter
3246
- * @license MIT license.
3247
- * @copyright (c) 2099 Kent C. Dodds
3248
- * @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
3249
- */
3250
- var rankings = {
3251
- CASE_SENSITIVE_EQUAL: 7,
3252
- EQUAL: 6,
3253
- STARTS_WITH: 5,
3254
- WORD_STARTS_WITH: 4,
3255
- CONTAINS: 3,
3256
- ACRONYM: 2,
3257
- MATCHES: 1,
3258
- NO_MATCH: 0
3259
- };
3260
- /**
3261
- * Gets the highest ranking for value for the given item based on its values for the given keys
3262
- * @param {*} item - the item to rank
3263
- * @param {String} value - the value to rank against
3264
- * @param {Object} options - options to control the ranking
3265
- * @return {{rank: Number, accessorIndex: Number, accessorThreshold: Number}} - the highest ranking
3266
- */
3267
- function rankItem(item, value, options) {
3268
- var _options$threshold;
3269
- options = options || {};
3270
- options.threshold = (_options$threshold = options.threshold) != null ? _options$threshold : rankings.MATCHES;
3271
- if (!options.accessors) {
3272
- const rank = getMatchRanking(item, value, options);
3273
- return {
3274
- rankedValue: item,
3275
- rank,
3276
- accessorIndex: -1,
3277
- accessorThreshold: options.threshold,
3278
- passed: rank >= options.threshold
3279
- };
3280
- }
3281
- const valuesToRank = getAllValuesToRank(item, options.accessors);
3282
- const rankingInfo = {
3283
- rankedValue: item,
3284
- rank: rankings.NO_MATCH,
3285
- accessorIndex: -1,
3286
- accessorThreshold: options.threshold,
3287
- passed: false
3288
- };
3289
- for (let i = 0; i < valuesToRank.length; i++) {
3290
- const rankValue = valuesToRank[i];
3291
- let newRank = getMatchRanking(rankValue.itemValue, value, options);
3292
- const { minRanking, maxRanking, threshold = options.threshold } = rankValue.attributes;
3293
- if (newRank < minRanking && newRank >= rankings.MATCHES) newRank = minRanking;
3294
- else if (newRank > maxRanking) newRank = maxRanking;
3295
- newRank = Math.min(newRank, maxRanking);
3296
- if (newRank >= threshold && newRank > rankingInfo.rank) {
3297
- rankingInfo.rank = newRank;
3298
- rankingInfo.passed = true;
3299
- rankingInfo.accessorIndex = i;
3300
- rankingInfo.accessorThreshold = threshold;
3301
- rankingInfo.rankedValue = rankValue.itemValue;
3302
- }
3303
- }
3304
- return rankingInfo;
3305
- }
3306
- /**
3307
- * Gives a rankings score based on how well the two strings match.
3308
- * @param {String} testString - the string to test against
3309
- * @param {String} stringToRank - the string to rank
3310
- * @param {Object} options - options for the match (like keepDiacritics for comparison)
3311
- * @returns {Number} the ranking for how well stringToRank matches testString
3312
- */
3313
- function getMatchRanking(testString, stringToRank, options) {
3314
- testString = prepareValueForComparison(testString, options);
3315
- stringToRank = prepareValueForComparison(stringToRank, options);
3316
- if (stringToRank.length > testString.length) return rankings.NO_MATCH;
3317
- if (testString === stringToRank) return rankings.CASE_SENSITIVE_EQUAL;
3318
- testString = testString.toLowerCase();
3319
- stringToRank = stringToRank.toLowerCase();
3320
- if (testString === stringToRank) return rankings.EQUAL;
3321
- if (testString.startsWith(stringToRank)) return rankings.STARTS_WITH;
3322
- if (testString.includes(` ${stringToRank}`)) return rankings.WORD_STARTS_WITH;
3323
- if (testString.includes(stringToRank)) return rankings.CONTAINS;
3324
- else if (stringToRank.length === 1) return rankings.NO_MATCH;
3325
- if (getAcronym(testString).includes(stringToRank)) return rankings.ACRONYM;
3326
- return getClosenessRanking(testString, stringToRank);
3327
- }
3328
- /**
3329
- * Generates an acronym for a string.
3330
- *
3331
- * @param {String} string the string for which to produce the acronym
3332
- * @returns {String} the acronym
3333
- */
3334
- function getAcronym(string) {
3335
- let acronym = "";
3336
- string.split(" ").forEach((wordInString) => {
3337
- wordInString.split("-").forEach((splitByHyphenWord) => {
3338
- acronym += splitByHyphenWord.substr(0, 1);
3339
- });
3340
- });
3341
- return acronym;
3342
- }
3343
- /**
3344
- * Returns a score based on how spread apart the
3345
- * characters from the stringToRank are within the testString.
3346
- * A number close to rankings.MATCHES represents a loose match. A number close
3347
- * to rankings.MATCHES + 1 represents a tighter match.
3348
- * @param {String} testString - the string to test against
3349
- * @param {String} stringToRank - the string to rank
3350
- * @returns {Number} the number between rankings.MATCHES and
3351
- * rankings.MATCHES + 1 for how well stringToRank matches testString
3352
- */
3353
- function getClosenessRanking(testString, stringToRank) {
3354
- let matchingInOrderCharCount = 0;
3355
- let charNumber = 0;
3356
- function findMatchingCharacter(matchChar, string, index) {
3357
- for (let j = index, J = string.length; j < J; j++) if (string[j] === matchChar) {
3358
- matchingInOrderCharCount += 1;
3359
- return j + 1;
3360
- }
3361
- return -1;
3362
- }
3363
- function getRanking(spread) {
3364
- const spreadPercentage = 1 / spread;
3365
- const inOrderPercentage = matchingInOrderCharCount / stringToRank.length;
3366
- return rankings.MATCHES + inOrderPercentage * spreadPercentage;
3367
- }
3368
- const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0);
3369
- if (firstIndex < 0) return rankings.NO_MATCH;
3370
- charNumber = firstIndex;
3371
- for (let i = 1, I = stringToRank.length; i < I; i++) {
3372
- const matchChar = stringToRank[i];
3373
- charNumber = findMatchingCharacter(matchChar, testString, charNumber);
3374
- if (!(charNumber > -1)) return rankings.NO_MATCH;
3375
- }
3376
- return getRanking(charNumber - firstIndex);
3377
- }
3378
- /**
3379
- * Prepares value for comparison by stringifying it, removing diacritics (if specified)
3380
- * @param {String} value - the value to clean
3381
- * @param {Object} options - {keepDiacritics: whether to remove diacritics}
3382
- * @return {String} the prepared value
3383
- */
3384
- function prepareValueForComparison(value, _ref) {
3385
- let { keepDiacritics } = _ref;
3386
- value = `${value}`;
3387
- if (!keepDiacritics) value = removeAccents(value);
3388
- return value;
3389
- }
3390
- /**
3391
- * Gets value for key in item at arbitrarily nested keypath
3392
- * @param {Object} item - the item
3393
- * @param {Object|Function} key - the potentially nested keypath or property callback
3394
- * @return {Array} - an array containing the value(s) at the nested keypath
3395
- */
3396
- function getItemValues(item, accessor) {
3397
- let accessorFn = accessor;
3398
- if (typeof accessor === "object") accessorFn = accessor.accessor;
3399
- const value = accessorFn(item);
3400
- if (value == null) return [];
3401
- if (Array.isArray(value)) return value;
3402
- return [String(value)];
3403
- }
3404
- /**
3405
- * Gets all the values for the given keys in the given item and returns an array of those values
3406
- * @param item - the item from which the values will be retrieved
3407
- * @param keys - the keys to use to retrieve the values
3408
- * @return objects with {itemValue, attributes}
3409
- */
3410
- function getAllValuesToRank(item, accessors) {
3411
- const allValues = [];
3412
- for (let j = 0, J = accessors.length; j < J; j++) {
3413
- const accessor = accessors[j];
3414
- const attributes = getAccessorAttributes(accessor);
3415
- const itemValues = getItemValues(item, accessor);
3416
- for (let i = 0, I = itemValues.length; i < I; i++) allValues.push({
3417
- itemValue: itemValues[i],
3418
- attributes
3419
- });
3420
- }
3421
- return allValues;
3422
- }
3423
- var defaultKeyAttributes = {
3424
- maxRanking: Infinity,
3425
- minRanking: -Infinity
3426
- };
3427
- /**
3428
- * Gets all the attributes for the given accessor
3429
- * @param accessor - the accessor from which the attributes will be retrieved
3430
- * @return object containing the accessor's attributes
3431
- */
3432
- function getAccessorAttributes(accessor) {
3433
- if (typeof accessor === "function") return defaultKeyAttributes;
3434
- return {
3435
- ...defaultKeyAttributes,
3436
- ...accessor
3437
- };
3438
- }
3439
- //#endregion
3440
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/devtools/utils.js
3441
- function getQueryState(query) {
3442
- if (query.state.fetchStatus === "fetching") return 0;
3443
- if (query.state.fetchStatus === "paused") return 4;
3444
- if (!query.getObserversCount()) return 3;
3445
- if (query.isStale()) return 2;
3446
- return 1;
3447
- }
3448
- function getQueryStateLabel(query) {
3449
- const queryState = getQueryState(query);
3450
- if (queryState === 0) return "fetching";
3451
- if (queryState === 4) return "paused";
3452
- if (queryState === 2) return "stale";
3453
- if (queryState === 3) return "inactive";
3454
- return "fresh";
3455
- }
3456
- function getQueryStatusFg(query) {
3457
- if (getQueryState(query) === 2) return 0;
3458
- return 16777215;
3459
- }
3460
- function getQueryStatusBg(query) {
3461
- const queryState = getQueryState(query);
3462
- if (queryState === 0) return 27647;
3463
- if (queryState === 4) return 9193963;
3464
- if (queryState === 2) return 16757248;
3465
- if (queryState === 3) return 4148832;
3466
- return 33575;
3467
- }
3468
- var queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
3469
- var dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
3470
- var statusAndDateSort = (a, b) => {
3471
- if (getQueryState(a) === getQueryState(b)) return dateSort(a, b);
3472
- return getQueryState(a) > getQueryState(b) ? 1 : -1;
3473
- };
3474
- var sortFns = {
3475
- "Status > Last Updated": statusAndDateSort,
3476
- "Query Hash": queryHashSort,
3477
- "Last Updated": dateSort
3478
- };
3479
- //#endregion
3480
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/devtools/devtools.js
3481
- var pluginId = "vue-query";
3482
- var pluginName = "Vue Query";
3483
- function setupDevtools(app, queryClient) {
3484
- setupDevtoolsPlugin({
3485
- id: pluginId,
3486
- label: pluginName,
3487
- packageName: "vue-query",
3488
- homepage: "https://tanstack.com/query/latest",
3489
- logo: "https://raw.githubusercontent.com/TanStack/query/main/packages/vue-query/media/vue-query.svg",
3490
- app,
3491
- settings: {
3492
- baseSort: {
3493
- type: "choice",
3494
- component: "button-group",
3495
- label: "Sort Cache Entries",
3496
- options: [{
3497
- label: "ASC",
3498
- value: 1
3499
- }, {
3500
- label: "DESC",
3501
- value: -1
3502
- }],
3503
- defaultValue: 1
3504
- },
3505
- sortFn: {
3506
- type: "choice",
3507
- label: "Sort Function",
3508
- options: Object.keys(sortFns).map((key) => ({
3509
- label: key,
3510
- value: key
3511
- })),
3512
- defaultValue: Object.keys(sortFns)[0]
3513
- },
3514
- onlineMode: {
3515
- type: "choice",
3516
- component: "button-group",
3517
- label: "Online mode",
3518
- options: [{
3519
- label: "Online",
3520
- value: 1
3521
- }, {
3522
- label: "Offline",
3523
- value: 0
3524
- }],
3525
- defaultValue: 1
3526
- }
3527
- }
3528
- }, (api) => {
3529
- const initialSettings = api.getSettings();
3530
- onlineManager.setOnline(Boolean(initialSettings.onlineMode.valueOf()));
3531
- const queryCache = queryClient.getQueryCache();
3532
- api.addInspector({
3533
- id: pluginId,
3534
- label: pluginName,
3535
- icon: "api",
3536
- nodeActions: [
3537
- {
3538
- icon: "file_download",
3539
- tooltip: "Refetch",
3540
- action: (queryHash) => {
3541
- queryCache.get(queryHash)?.fetch();
3542
- }
3543
- },
3544
- {
3545
- icon: "alarm",
3546
- tooltip: "Invalidate",
3547
- action: (queryHash) => {
3548
- const query = queryCache.get(queryHash);
3549
- queryClient.invalidateQueries({
3550
- queryKey: query.queryKey,
3551
- exact: true
3552
- });
3553
- }
3554
- },
3555
- {
3556
- icon: "settings_backup_restore",
3557
- tooltip: "Reset",
3558
- action: (queryHash) => {
3559
- queryCache.get(queryHash)?.reset();
3560
- }
3561
- },
3562
- {
3563
- icon: "delete",
3564
- tooltip: "Remove",
3565
- action: (queryHash) => {
3566
- const query = queryCache.get(queryHash);
3567
- queryCache.remove(query);
3568
- }
3569
- },
3570
- {
3571
- icon: "hourglass_empty",
3572
- tooltip: "Force loading",
3573
- action: (queryHash) => {
3574
- queryCache.get(queryHash).setState({
3575
- data: void 0,
3576
- status: "pending"
3577
- });
3578
- }
3579
- },
3580
- {
3581
- icon: "error_outline",
3582
- tooltip: "Force error",
3583
- action: (queryHash) => {
3584
- queryCache.get(queryHash).setState({
3585
- data: void 0,
3586
- status: "error",
3587
- error: /* @__PURE__ */ new Error("Unknown error from devtools")
3588
- });
3589
- }
3590
- }
3591
- ]
3592
- });
3593
- api.addTimelineLayer({
3594
- id: pluginId,
3595
- label: pluginName,
3596
- color: 16767308
3597
- });
3598
- queryCache.subscribe((event) => {
3599
- api.sendInspectorTree(pluginId);
3600
- api.sendInspectorState(pluginId);
3601
- if ([
3602
- "added",
3603
- "removed",
3604
- "updated"
3605
- ].includes(event.type)) api.addTimelineEvent({
3606
- layerId: pluginId,
3607
- event: {
3608
- title: event.type,
3609
- subtitle: event.query.queryHash,
3610
- time: api.now(),
3611
- data: {
3612
- queryHash: event.query.queryHash,
3613
- ...event
3614
- }
3615
- }
3616
- });
3617
- });
3618
- api.on.setPluginSettings((payload) => {
3619
- if (payload.key === "onlineMode") onlineManager.setOnline(Boolean(payload.newValue));
3620
- });
3621
- api.on.getInspectorTree((payload) => {
3622
- if (payload.inspectorId === pluginId) {
3623
- const queries = queryCache.getAll();
3624
- const settings = api.getSettings();
3625
- payload.rootNodes = (payload.filter ? queries.filter((item) => rankItem(item.queryHash, payload.filter).passed) : [...queries]).sort((a, b) => sortFns[settings.sortFn](a, b) * settings.baseSort).map((query) => {
3626
- const stateLabel = getQueryStateLabel(query);
3627
- return {
3628
- id: query.queryHash,
3629
- label: query.queryHash,
3630
- tags: [{
3631
- label: `${stateLabel} [${query.getObserversCount()}]`,
3632
- textColor: getQueryStatusFg(query),
3633
- backgroundColor: getQueryStatusBg(query)
3634
- }]
3635
- };
3636
- });
3637
- }
3638
- });
3639
- api.on.getInspectorState((payload) => {
3640
- if (payload.inspectorId === pluginId) {
3641
- const query = queryCache.get(payload.nodeId);
3642
- if (!query) return;
3643
- payload.state = {
3644
- " Query Details": [
3645
- {
3646
- key: "Query key",
3647
- value: query.queryHash
3648
- },
3649
- {
3650
- key: "Query status",
3651
- value: getQueryStateLabel(query)
3652
- },
3653
- {
3654
- key: "Observers",
3655
- value: query.getObserversCount()
3656
- },
3657
- {
3658
- key: "Last Updated",
3659
- value: new Date(query.state.dataUpdatedAt).toLocaleTimeString()
3660
- }
3661
- ],
3662
- "Data Explorer": [{
3663
- key: "Data",
3664
- value: query.state.data
3665
- }],
3666
- "Query Explorer": [{
3667
- key: "Query",
3668
- value: query
3669
- }]
3670
- };
3671
- }
3672
- });
3673
- });
3674
- }
3675
- //#endregion
3676
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/vueQueryPlugin.js
3677
- var VueQueryPlugin = { install: (app, options = {}) => {
3678
- const clientKey = getClientKey(options.queryClientKey);
3679
- let client;
3680
- if ("queryClient" in options && options.queryClient) client = options.queryClient;
3681
- else client = new QueryClient("queryClientConfig" in options ? options.queryClientConfig : void 0);
3682
- if (!isServer) client.mount();
3683
- let persisterUnmount = () => {};
3684
- if (options.clientPersister) {
3685
- if (client.isRestoring) client.isRestoring.value = true;
3686
- const [unmount, promise] = options.clientPersister(client);
3687
- persisterUnmount = unmount;
3688
- promise.then(() => {
3689
- if (client.isRestoring) client.isRestoring.value = false;
3690
- options.clientPersisterOnSuccess?.(client);
3691
- });
3692
- }
3693
- const cleanup = () => {
3694
- client.unmount();
3695
- persisterUnmount();
3696
- };
3697
- if (app.onUnmount) app.onUnmount(cleanup);
3698
- else {
3699
- const originalUnmount = app.unmount;
3700
- app.unmount = function vueQueryUnmount() {
3701
- cleanup();
3702
- originalUnmount();
3703
- };
3704
- }
3705
- app.provide(clientKey, client);
3706
- if (options.enableDevtoolsV6Plugin) setupDevtools(app, client);
3707
- } };
3708
- //#endregion
3709
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/queryOptions.js
3710
- function queryOptions(options) {
3711
- return options;
3712
- }
3713
- //#endregion
3714
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/infiniteQueryOptions.js
3715
- function infiniteQueryOptions(options) {
3716
- return options;
3717
- }
3718
- //#endregion
3719
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/mutationOptions.js
3720
- function mutationOptions(options) {
3721
- return options;
3722
- }
3723
- //#endregion
3724
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useBaseQuery.js
3725
- function useBaseQuery(Observer, options, queryClient) {
3726
- if (!getCurrentScope()) console.warn("vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.");
3727
- const client = queryClient || useQueryClient();
3728
- const defaultedOptions = computed(() => {
3729
- let resolvedOptions = options;
3730
- if (typeof resolvedOptions === "function") resolvedOptions = resolvedOptions();
3731
- const clonedOptions = cloneDeepUnref(resolvedOptions);
3732
- if (typeof clonedOptions.enabled === "function") clonedOptions.enabled = clonedOptions.enabled();
3733
- const defaulted = client.defaultQueryOptions(clonedOptions);
3734
- defaulted._optimisticResults = client.isRestoring?.value ? "isRestoring" : "optimistic";
3735
- return defaulted;
3736
- });
3737
- const observer = new Observer(client, defaultedOptions.value);
3738
- const state = defaultedOptions.value.shallow ? shallowReactive(observer.getCurrentResult()) : reactive(observer.getCurrentResult());
3739
- let unsubscribe = () => {};
3740
- if (client.isRestoring) watch(client.isRestoring, (isRestoring) => {
3741
- if (!isRestoring) {
3742
- unsubscribe();
3743
- unsubscribe = observer.subscribe((result) => {
3744
- updateState(state, result);
3745
- });
3746
- }
3747
- }, { immediate: true });
3748
- const updater = () => {
3749
- observer.setOptions(defaultedOptions.value);
3750
- updateState(state, observer.getCurrentResult());
3751
- };
3752
- watch(defaultedOptions, updater);
3753
- onScopeDispose(() => {
3754
- unsubscribe();
3755
- });
3756
- const refetch = (...args) => {
3757
- updater();
3758
- return state.refetch(...args);
3759
- };
3760
- const suspense = () => {
3761
- return new Promise((resolve, reject) => {
3762
- let stopWatch = () => {};
3763
- const run = () => {
3764
- if (defaultedOptions.value.enabled !== false) {
3765
- observer.setOptions(defaultedOptions.value);
3766
- const optimisticResult = observer.getOptimisticResult(defaultedOptions.value);
3767
- if (optimisticResult.isStale) {
3768
- stopWatch();
3769
- observer.fetchOptimistic(defaultedOptions.value).then(resolve, (error) => {
3770
- if (shouldThrowError(defaultedOptions.value.throwOnError, [error, observer.getCurrentQuery()])) reject(error);
3771
- else resolve(observer.getCurrentResult());
3772
- });
3773
- } else {
3774
- stopWatch();
3775
- resolve(optimisticResult);
3776
- }
3777
- }
3778
- };
3779
- run();
3780
- stopWatch = watch(defaultedOptions, run);
3781
- });
3782
- };
3783
- watch(() => state.error, (error) => {
3784
- if (state.isError && !state.isFetching && shouldThrowError(defaultedOptions.value.throwOnError, [error, observer.getCurrentQuery()])) throw error;
3785
- });
3786
- const readonlyState = defaultedOptions.value.shallow ? shallowReadonly(state) : readonly(state);
3787
- const object = toRefs(readonlyState);
3788
- for (const key in state) if (typeof state[key] === "function") object[key] = state[key];
3789
- object.suspense = suspense;
3790
- object.refetch = refetch;
3791
- return object;
3792
- }
3793
- //#endregion
3794
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useQuery.js
3795
- function useQuery(options, queryClient) {
3796
- return useBaseQuery(QueryObserver, options, queryClient);
3797
- }
3798
- //#endregion
3799
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useQueries.js
3800
- function useQueries({ queries, ...options }, queryClient) {
3801
- if (!getCurrentScope()) console.warn("vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.");
3802
- const client = queryClient || useQueryClient();
3803
- const defaultedQueries = computed(() => {
3804
- const resolvedQueries = typeof queries === "function" ? queries() : queries;
3805
- return unref(resolvedQueries).map((queryOptions) => {
3806
- const clonedOptions = cloneDeepUnref(queryOptions);
3807
- if (typeof clonedOptions.enabled === "function") clonedOptions.enabled = queryOptions.enabled();
3808
- const defaulted = client.defaultQueryOptions(clonedOptions);
3809
- defaulted._optimisticResults = client.isRestoring?.value ? "isRestoring" : "optimistic";
3810
- return defaulted;
3811
- });
3812
- });
3813
- const observer = new QueriesObserver(client, defaultedQueries.value, options);
3814
- const getOptimisticResult = () => {
3815
- const [results, getCombinedResult] = observer.getOptimisticResult(defaultedQueries.value, options.combine);
3816
- return getCombinedResult(results.map((result, index) => {
3817
- return {
3818
- ...result,
3819
- refetch: async (...args) => {
3820
- const [{ [index]: query }] = observer.getOptimisticResult(defaultedQueries.value, options.combine);
3821
- return query.refetch(...args);
3822
- }
3823
- };
3824
- }));
3825
- };
3826
- const state = shallowRef(getOptimisticResult());
3827
- let unsubscribe = () => {};
3828
- if (client.isRestoring) watch(client.isRestoring, (isRestoring) => {
3829
- if (!isRestoring) {
3830
- unsubscribe();
3831
- unsubscribe = observer.subscribe(() => {
3832
- state.value = getOptimisticResult();
3833
- });
3834
- state.value = getOptimisticResult();
3835
- }
3836
- }, { immediate: true });
3837
- watch(defaultedQueries, (queriesValue) => {
3838
- observer.setQueries(queriesValue, options);
3839
- state.value = getOptimisticResult();
3840
- });
3841
- onScopeDispose(() => {
3842
- unsubscribe();
3843
- });
3844
- return options.shallow ? shallowReadonly(state) : readonly(state);
3845
- }
3846
- //#endregion
3847
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useInfiniteQuery.js
3848
- function useInfiniteQuery(options, queryClient) {
3849
- return useBaseQuery(InfiniteQueryObserver, options, queryClient);
3850
- }
3851
- //#endregion
3852
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/usePrefetchQuery.js
3853
- function isGetter$1(value) {
3854
- return typeof value === "function";
3855
- }
3856
- function usePrefetchQuery(options, queryClient) {
3857
- if (!getCurrentScope()) console.warn("vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.");
3858
- const client = queryClient || useQueryClient();
3859
- watchEffect(() => {
3860
- const clonedOptions = cloneDeepUnref(isGetter$1(options) ? options() : unref(options));
3861
- if (!client.getQueryState(clonedOptions.queryKey)) client.prefetchQuery(clonedOptions);
3862
- });
3863
- }
3864
- //#endregion
3865
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/usePrefetchInfiniteQuery.js
3866
- function isGetter(value) {
3867
- return typeof value === "function";
3868
- }
3869
- function usePrefetchInfiniteQuery(options, queryClient) {
3870
- if (!getCurrentScope()) console.warn("vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.");
3871
- const client = queryClient || useQueryClient();
3872
- watchEffect(() => {
3873
- const clonedOptions = cloneDeepUnref(isGetter(options) ? options() : unref(options));
3874
- if (!client.getQueryState(clonedOptions.queryKey)) client.prefetchInfiniteQuery(clonedOptions);
3875
- });
3876
- }
3877
- //#endregion
3878
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useMutation.js
3879
- function useMutation(mutationOptions, queryClient) {
3880
- if (!getCurrentScope()) console.warn("vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.");
3881
- const client = queryClient || useQueryClient();
3882
- const options = computed(() => {
3883
- const resolvedOptions = typeof mutationOptions === "function" ? mutationOptions() : mutationOptions;
3884
- return client.defaultMutationOptions(cloneDeepUnref(resolvedOptions));
3885
- });
3886
- const observer = new MutationObserver(client, options.value);
3887
- const state = options.value.shallow ? shallowReactive(observer.getCurrentResult()) : reactive(observer.getCurrentResult());
3888
- const unsubscribe = observer.subscribe((result) => {
3889
- updateState(state, result);
3890
- });
3891
- const mutate = (variables, mutateOptions) => {
3892
- observer.mutate(variables, mutateOptions).catch(() => {});
3893
- };
3894
- watch(options, () => {
3895
- observer.setOptions(options.value);
3896
- });
3897
- onScopeDispose(() => {
3898
- unsubscribe();
3899
- });
3900
- const readonlyState = options.value.shallow ? shallowReadonly(state) : readonly(state);
3901
- const resultRefs = toRefs(readonlyState);
3902
- watch(() => state.error, (error) => {
3903
- if (error && shouldThrowError(options.value.throwOnError, [error])) throw error;
3904
- });
3905
- return {
3906
- ...resultRefs,
3907
- mutate,
3908
- mutateAsync: state.mutate,
3909
- reset: state.reset
3910
- };
3911
- }
3912
- //#endregion
3913
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useIsFetching.js
3914
- function useIsFetching(fetchingFilters = {}, queryClient) {
3915
- if (!getCurrentScope()) console.warn("vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.");
3916
- const client = queryClient || useQueryClient();
3917
- const isFetching = ref();
3918
- const listener = () => {
3919
- const resolvedFilters = typeof fetchingFilters === "function" ? fetchingFilters() : fetchingFilters;
3920
- isFetching.value = client.isFetching(cloneDeepUnref(resolvedFilters));
3921
- };
3922
- const unsubscribe = client.getQueryCache().subscribe(listener);
3923
- watchEffect(listener);
3924
- onScopeDispose(() => {
3925
- unsubscribe();
3926
- });
3927
- return isFetching;
3928
- }
3929
- //#endregion
3930
- //#region ../../../../node_modules/@tanstack/vue-query/build/modern/useMutationState.js
3931
- function useIsMutating(filters = {}, queryClient) {
3932
- if (!getCurrentScope()) console.warn("vue-query composable like \"useQuery()\" should only be used inside a \"setup()\" function or a running effect scope. They might otherwise lead to memory leaks.");
3933
- const client = queryClient || useQueryClient();
3934
- const mutationState = useMutationState({ filters: computed(() => ({
3935
- ...cloneDeepUnref(typeof filters === "function" ? filters() : filters),
3936
- status: "pending"
3937
- })) }, client);
3938
- return computed(() => mutationState.value.length);
3939
- }
3940
- function getResult(mutationCache, options) {
3941
- return mutationCache.findAll(options.filters).map((mutation) => options.select ? options.select(mutation) : mutation.state);
3942
- }
3943
- function useMutationState(options = {}, queryClient) {
3944
- const resolvedOptions = computed(() => {
3945
- const newOptions = typeof options === "function" ? options() : options;
3946
- return {
3947
- filters: cloneDeepUnref(newOptions.filters),
3948
- select: newOptions.select
3949
- };
3950
- });
3951
- const mutationCache = (queryClient || useQueryClient()).getMutationCache();
3952
- const state = shallowRef(getResult(mutationCache, resolvedOptions.value));
3953
- const unsubscribe = mutationCache.subscribe(() => {
3954
- state.value = getResult(mutationCache, resolvedOptions.value);
3955
- });
3956
- watch(resolvedOptions, () => {
3957
- state.value = getResult(mutationCache, resolvedOptions.value);
3958
- });
3959
- onScopeDispose(() => {
3960
- unsubscribe();
3961
- });
3962
- return shallowReadonly(state);
3963
- }
3964
- //#endregion
3965
- export { CancelledError, InfiniteQueryObserver, Mutation, MutationCache, MutationObserver, QueriesObserver, Query, QueryCache, QueryClient, QueryObserver, VUE_QUERY_CLIENT, VueQueryPlugin, dataTagErrorSymbol, dataTagSymbol, defaultScheduler, defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, environmentManager, streamedQuery as experimental_streamedQuery, focusManager, hashKey, hydrate, infiniteQueryOptions, isCancelledError, isServer, keepPreviousData, matchMutation, matchQuery, mutationOptions, noop, notifyManager, onlineManager, partialMatchKey, queryOptions, replaceEqualDeep, shouldThrowError, skipToken, timeoutManager, unsetMarker, useInfiniteQuery, useIsFetching, useIsMutating, useMutation, useMutationState, usePrefetchInfiniteQuery, usePrefetchQuery, useQueries, useQuery, useQueryClient };