@noxickon/onyx 0.0.2 → 0.0.4-dev.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 (42) hide show
  1. package/dist/chunks/Button-D-v4l8ZE.js +20 -0
  2. package/dist/chunks/{Button-CLMaoxRW.js → Button-bARrxYyo.js} +627 -628
  3. package/dist/chunks/Input-CLi1H63d.js +1 -0
  4. package/dist/chunks/{Input-BQQT5eZ0.js → Input-dfvmdIHi.js} +39 -39
  5. package/dist/chunks/errorHelper--G-SWQzN.js +18 -0
  6. package/dist/chunks/errorHelper-DaP_XxEx.js +1 -0
  7. package/dist/chunks/formatTimestamp-CMxOnPo1.js +12 -0
  8. package/dist/chunks/formatTimestamp-TTsNcy7u.js +1 -0
  9. package/dist/chunks/{jsx-runtime-C5mzlN2N.js → jsx-runtime--oOP9f8K.js} +15 -15
  10. package/dist/chunks/{jsx-runtime-DUiatUiq.js → jsx-runtime-CITbqOLs.js} +2 -2
  11. package/dist/chunks/{index-BgUMV1hv.js → useAuth-DDRXztKj.js} +240 -178
  12. package/dist/chunks/{index-XTQUUzZ1.js → useAuth-DPnpY3XC.js} +18 -9
  13. package/dist/chunks/{useForm-BIKRbGHj.js → useForm-D4co95Vn.js} +785 -801
  14. package/dist/chunks/useForm-DUviJ7xS.js +18 -0
  15. package/dist/chunks/useQuery-BvCyJMae.js +2065 -0
  16. package/dist/chunks/useQuery-DTNHO7so.js +3 -0
  17. package/dist/context/context.cjs.js +1 -1
  18. package/dist/context/context.es.js +1 -1
  19. package/dist/context.d.ts +1 -0
  20. package/dist/hooks/hooks.cjs.js +6 -6
  21. package/dist/hooks/hooks.es.js +117 -118
  22. package/dist/index.css +1 -1
  23. package/dist/index.d.ts +24 -10
  24. package/dist/layout/layout.cjs.js +1 -1
  25. package/dist/layout/layout.es.js +2 -2
  26. package/dist/onyx.cjs.js +1 -12
  27. package/dist/onyx.es.js +779 -2035
  28. package/dist/pages/pages.cjs.js +8 -2
  29. package/dist/pages/pages.es.js +35 -25
  30. package/dist/utils/utils.cjs.js +1 -0
  31. package/dist/utils/utils.es.js +8 -0
  32. package/dist/utils.d.ts +29 -0
  33. package/package.json +31 -27
  34. package/dist/chunks/Button-CZYAHivj.js +0 -20
  35. package/dist/chunks/Input-DJZcvJdP.js +0 -1
  36. package/dist/chunks/index-1-zQ3RaM.js +0 -601
  37. package/dist/chunks/index-CjVXr8mh.js +0 -2
  38. package/dist/chunks/useAuth-C-TIgBfr.js +0 -61
  39. package/dist/chunks/useAuth-CfKOZqhG.js +0 -10
  40. package/dist/chunks/useForm-BZEaiRaa.js +0 -26
  41. package/dist/chunks/useQuery-B_ce5e8f.js +0 -2
  42. package/dist/chunks/useQuery-CJdYhuQu.js +0 -1481
@@ -0,0 +1,2065 @@
1
+ import { g as gt } from "./_commonjsHelpers-C6fGbg64.js";
2
+ import bt from "react";
3
+ function mt(e, t) {
4
+ for (var r = 0; r < t.length; r++) {
5
+ const n = t[r];
6
+ if (typeof n != "string" && !Array.isArray(n)) {
7
+ for (const i in n)
8
+ if (i !== "default" && !(i in e)) {
9
+ const o = Object.getOwnPropertyDescriptor(n, i);
10
+ o && Object.defineProperty(e, i, o.get ? o : {
11
+ enumerable: !0,
12
+ get: () => n[i]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var Z = function(e, t) {
20
+ return Z = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
21
+ r.__proto__ = n;
22
+ } || function(r, n) {
23
+ for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (r[i] = n[i]);
24
+ }, Z(e, t);
25
+ };
26
+ function ce(e, t) {
27
+ if (typeof t != "function" && t !== null)
28
+ throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
29
+ Z(e, t);
30
+ function r() {
31
+ this.constructor = e;
32
+ }
33
+ e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
34
+ }
35
+ var p = function() {
36
+ return p = Object.assign || function(t) {
37
+ for (var r, n = 1, i = arguments.length; n < i; n++) {
38
+ r = arguments[n];
39
+ for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (t[o] = r[o]);
40
+ }
41
+ return t;
42
+ }, p.apply(this, arguments);
43
+ };
44
+ function W(e, t) {
45
+ var r = {};
46
+ for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
47
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
48
+ for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
49
+ t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
50
+ return r;
51
+ }
52
+ function T(e, t, r) {
53
+ if (r || arguments.length === 2) for (var n = 0, i = t.length, o; n < i; n++)
54
+ (o || !(n in t)) && (o || (o = Array.prototype.slice.call(t, 0, n)), o[n] = t[n]);
55
+ return e.concat(o || Array.prototype.slice.call(t));
56
+ }
57
+ var B = "Invariant Violation", be = Object.setPrototypeOf, wt = be === void 0 ? function(e, t) {
58
+ return e.__proto__ = t, e;
59
+ } : be, We = (
60
+ /** @class */
61
+ function(e) {
62
+ ce(t, e);
63
+ function t(r) {
64
+ r === void 0 && (r = B);
65
+ var n = e.call(this, typeof r == "number" ? B + ": " + r + " (see https://github.com/apollographql/invariant-packages)" : r) || this;
66
+ return n.framesToPop = 1, n.name = B, wt(n, t.prototype), n;
67
+ }
68
+ return t;
69
+ }(Error)
70
+ );
71
+ function q(e, t) {
72
+ if (!e)
73
+ throw new We(t);
74
+ }
75
+ var $e = ["debug", "log", "warn", "error", "silent"], _t = $e.indexOf("log");
76
+ function A(e) {
77
+ return function() {
78
+ if ($e.indexOf(e) >= _t) {
79
+ var t = console[e] || console.log;
80
+ return t.apply(console, arguments);
81
+ }
82
+ };
83
+ }
84
+ (function(e) {
85
+ e.debug = A("debug"), e.log = A("log"), e.warn = A("warn"), e.error = A("error");
86
+ })(q || (q = {}));
87
+ var Be = "3.13.8";
88
+ function P(e) {
89
+ try {
90
+ return e();
91
+ } catch {
92
+ }
93
+ }
94
+ const ee = P(function() {
95
+ return globalThis;
96
+ }) || P(function() {
97
+ return window;
98
+ }) || P(function() {
99
+ return self;
100
+ }) || P(function() {
101
+ return global;
102
+ }) || // We don't expect the Function constructor ever to be invoked at runtime, as
103
+ // long as at least one of globalThis, window, self, or global is defined, so
104
+ // we are under no obligation to make it easy for static analysis tools to
105
+ // detect syntactic usage of the Function constructor. If you think you can
106
+ // improve your static analysis to detect this obfuscation, think again. This
107
+ // is an arms race you cannot win, at least not in JavaScript.
108
+ P(function() {
109
+ return P.constructor("return this")();
110
+ });
111
+ var me = /* @__PURE__ */ new Map();
112
+ function Ot(e) {
113
+ var t = me.get(e) || 1;
114
+ return me.set(e, t + 1), "".concat(e, ":").concat(t, ":").concat(Math.random().toString(36).slice(2));
115
+ }
116
+ function St(e, t) {
117
+ var r = Ot("stringifyForDisplay");
118
+ return JSON.stringify(e, function(n, i) {
119
+ return i === void 0 ? r : i;
120
+ }, t).split(JSON.stringify(r)).join("<undefined>");
121
+ }
122
+ function N(e) {
123
+ return function(t) {
124
+ for (var r = [], n = 1; n < arguments.length; n++)
125
+ r[n - 1] = arguments[n];
126
+ if (typeof t == "number") {
127
+ var i = t;
128
+ t = fe(i), t || (t = le(i, r), r = []);
129
+ }
130
+ e.apply(void 0, [t].concat(r));
131
+ };
132
+ }
133
+ var b = Object.assign(function(t, r) {
134
+ for (var n = [], i = 2; i < arguments.length; i++)
135
+ n[i - 2] = arguments[i];
136
+ t || q(t, fe(r, n) || le(r, n));
137
+ }, {
138
+ debug: N(q.debug),
139
+ log: N(q.log),
140
+ warn: N(q.warn),
141
+ error: N(q.error)
142
+ });
143
+ function Ge(e) {
144
+ for (var t = [], r = 1; r < arguments.length; r++)
145
+ t[r - 1] = arguments[r];
146
+ return new We(fe(e, t) || le(e, t));
147
+ }
148
+ var we = Symbol.for("ApolloErrorMessageHandler_" + Be);
149
+ function He(e) {
150
+ if (typeof e == "string")
151
+ return e;
152
+ try {
153
+ return St(e, 2).slice(0, 1e3);
154
+ } catch {
155
+ return "<non-serializable>";
156
+ }
157
+ }
158
+ function fe(e, t) {
159
+ if (t === void 0 && (t = []), !!e)
160
+ return ee[we] && ee[we](e, t.map(He));
161
+ }
162
+ function le(e, t) {
163
+ if (t === void 0 && (t = []), !!e)
164
+ return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
165
+ version: Be,
166
+ message: e,
167
+ args: t.map(He)
168
+ })));
169
+ }
170
+ function Et(e, t) {
171
+ var r = e.directives;
172
+ return !r || !r.length ? !0 : kt(r).every(function(n) {
173
+ var i = n.directive, o = n.ifArgument, a = !1;
174
+ return o.value.kind === "Variable" ? (a = t && t[o.value.name.value], b(a !== void 0, 78, i.name.value)) : a = o.value.value, i.name.value === "skip" ? !a : a;
175
+ });
176
+ }
177
+ function Pt(e) {
178
+ var t = e.name.value;
179
+ return t === "skip" || t === "include";
180
+ }
181
+ function kt(e) {
182
+ var t = [];
183
+ return e && e.length && e.forEach(function(r) {
184
+ if (Pt(r)) {
185
+ var n = r.arguments, i = r.name.value;
186
+ b(n && n.length === 1, 79, i);
187
+ var o = n[0];
188
+ b(o.name && o.name.value === "if", 80, i);
189
+ var a = o.value;
190
+ b(a && (a.kind === "Variable" || a.kind === "BooleanValue"), 81, i), t.push({ directive: r, ifArgument: o });
191
+ }
192
+ }), t;
193
+ }
194
+ var qt = P(function() {
195
+ return navigator.product;
196
+ }) == "ReactNative", Je = typeof Symbol == "function" && typeof Symbol.for == "function", Dt = typeof P(function() {
197
+ return window.document.createElement;
198
+ }) == "function", It = (
199
+ // Following advice found in this comment from @domenic (maintainer of jsdom):
200
+ // https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327
201
+ //
202
+ // Since we control the version of Jest and jsdom used when running Apollo
203
+ // Client tests, and that version is recent enought to include " jsdom/x.y.z"
204
+ // at the end of the user agent string, I believe this case is all we need to
205
+ // check. Testing for "Node.js" was recommended for backwards compatibility
206
+ // with older version of jsdom, but we don't have that problem.
207
+ P(function() {
208
+ return navigator.userAgent.indexOf("jsdom") >= 0;
209
+ }) || !1
210
+ ), Ft = (Dt || qt) && !It;
211
+ function te(e) {
212
+ return e !== null && typeof e == "object";
213
+ }
214
+ function jt(e) {
215
+ e === void 0 && (e = []);
216
+ var t = {};
217
+ return e.forEach(function(r) {
218
+ t[r.name.value] = r;
219
+ }), t;
220
+ }
221
+ function Tt(e, t) {
222
+ switch (e.kind) {
223
+ case "InlineFragment":
224
+ return e;
225
+ case "FragmentSpread": {
226
+ var r = e.name.value;
227
+ if (typeof t == "function")
228
+ return t(r);
229
+ var n = t && t[r];
230
+ return b(n, 87, r), n || null;
231
+ }
232
+ default:
233
+ return null;
234
+ }
235
+ }
236
+ function xt() {
237
+ }
238
+ class _e {
239
+ constructor(t = 1 / 0, r = xt) {
240
+ this.max = t, this.dispose = r, this.map = /* @__PURE__ */ new Map(), this.newest = null, this.oldest = null;
241
+ }
242
+ has(t) {
243
+ return this.map.has(t);
244
+ }
245
+ get(t) {
246
+ const r = this.getNode(t);
247
+ return r && r.value;
248
+ }
249
+ get size() {
250
+ return this.map.size;
251
+ }
252
+ getNode(t) {
253
+ const r = this.map.get(t);
254
+ if (r && r !== this.newest) {
255
+ const { older: n, newer: i } = r;
256
+ i && (i.older = n), n && (n.newer = i), r.older = this.newest, r.older.newer = r, r.newer = null, this.newest = r, r === this.oldest && (this.oldest = i);
257
+ }
258
+ return r;
259
+ }
260
+ set(t, r) {
261
+ let n = this.getNode(t);
262
+ return n ? n.value = r : (n = {
263
+ key: t,
264
+ value: r,
265
+ newer: null,
266
+ older: this.newest
267
+ }, this.newest && (this.newest.newer = n), this.newest = n, this.oldest = this.oldest || n, this.map.set(t, n), n.value);
268
+ }
269
+ clean() {
270
+ for (; this.oldest && this.map.size > this.max; )
271
+ this.delete(this.oldest.key);
272
+ }
273
+ delete(t) {
274
+ const r = this.map.get(t);
275
+ return r ? (r === this.newest && (this.newest = r.older), r === this.oldest && (this.oldest = r.newer), r.newer && (r.newer.older = r.older), r.older && (r.older.newer = r.newer), this.map.delete(t), this.dispose(r.value, t), !0) : !1;
276
+ }
277
+ }
278
+ function re() {
279
+ }
280
+ const Mt = re, Rt = typeof WeakRef < "u" ? WeakRef : function(e) {
281
+ return { deref: () => e };
282
+ }, Ct = typeof WeakMap < "u" ? WeakMap : Map, Qt = typeof FinalizationRegistry < "u" ? FinalizationRegistry : function() {
283
+ return {
284
+ register: re,
285
+ unregister: re
286
+ };
287
+ }, At = 10024;
288
+ class Oe {
289
+ constructor(t = 1 / 0, r = Mt) {
290
+ this.max = t, this.dispose = r, this.map = new Ct(), this.newest = null, this.oldest = null, this.unfinalizedNodes = /* @__PURE__ */ new Set(), this.finalizationScheduled = !1, this.size = 0, this.finalize = () => {
291
+ const n = this.unfinalizedNodes.values();
292
+ for (let i = 0; i < At; i++) {
293
+ const o = n.next().value;
294
+ if (!o)
295
+ break;
296
+ this.unfinalizedNodes.delete(o);
297
+ const a = o.key;
298
+ delete o.key, o.keyRef = new Rt(a), this.registry.register(a, o, o);
299
+ }
300
+ this.unfinalizedNodes.size > 0 ? queueMicrotask(this.finalize) : this.finalizationScheduled = !1;
301
+ }, this.registry = new Qt(this.deleteNode.bind(this));
302
+ }
303
+ has(t) {
304
+ return this.map.has(t);
305
+ }
306
+ get(t) {
307
+ const r = this.getNode(t);
308
+ return r && r.value;
309
+ }
310
+ getNode(t) {
311
+ const r = this.map.get(t);
312
+ if (r && r !== this.newest) {
313
+ const { older: n, newer: i } = r;
314
+ i && (i.older = n), n && (n.newer = i), r.older = this.newest, r.older.newer = r, r.newer = null, this.newest = r, r === this.oldest && (this.oldest = i);
315
+ }
316
+ return r;
317
+ }
318
+ set(t, r) {
319
+ let n = this.getNode(t);
320
+ return n ? n.value = r : (n = {
321
+ key: t,
322
+ value: r,
323
+ newer: null,
324
+ older: this.newest
325
+ }, this.newest && (this.newest.newer = n), this.newest = n, this.oldest = this.oldest || n, this.scheduleFinalization(n), this.map.set(t, n), this.size++, n.value);
326
+ }
327
+ clean() {
328
+ for (; this.oldest && this.size > this.max; )
329
+ this.deleteNode(this.oldest);
330
+ }
331
+ deleteNode(t) {
332
+ t === this.newest && (this.newest = t.older), t === this.oldest && (this.oldest = t.newer), t.newer && (t.newer.older = t.older), t.older && (t.older.newer = t.newer), this.size--;
333
+ const r = t.key || t.keyRef && t.keyRef.deref();
334
+ this.dispose(t.value, r), t.keyRef ? this.registry.unregister(t) : this.unfinalizedNodes.delete(t), r && this.map.delete(r);
335
+ }
336
+ delete(t) {
337
+ const r = this.map.get(t);
338
+ return r ? (this.deleteNode(r), !0) : !1;
339
+ }
340
+ scheduleFinalization(t) {
341
+ this.unfinalizedNodes.add(t), this.finalizationScheduled || (this.finalizationScheduled = !0, queueMicrotask(this.finalize));
342
+ }
343
+ }
344
+ var G = /* @__PURE__ */ new WeakSet();
345
+ function Ke(e) {
346
+ e.size <= (e.max || -1) || G.has(e) || (G.add(e), setTimeout(function() {
347
+ e.clean(), G.delete(e);
348
+ }, 100));
349
+ }
350
+ var Nt = function(e, t) {
351
+ var r = new Oe(e, t);
352
+ return r.set = function(n, i) {
353
+ var o = Oe.prototype.set.call(this, n, i);
354
+ return Ke(this), o;
355
+ }, r;
356
+ }, zt = function(e, t) {
357
+ var r = new _e(e, t);
358
+ return r.set = function(n, i) {
359
+ var o = _e.prototype.set.call(this, n, i);
360
+ return Ke(this), o;
361
+ }, r;
362
+ }, Lt = Symbol.for("apollo.cacheSize"), Ye = p({}, ee[Lt]), Vt = {};
363
+ function Xe(e, t) {
364
+ Vt[e] = t;
365
+ }
366
+ var Ze = Object.assign(function(t) {
367
+ return JSON.stringify(t, Ut);
368
+ }, {
369
+ reset: function() {
370
+ j = new zt(
371
+ Ye.canonicalStringify || 1e3
372
+ /* defaultCacheSizes.canonicalStringify */
373
+ );
374
+ }
375
+ });
376
+ globalThis.__DEV__ !== !1 && Xe("canonicalStringify", function() {
377
+ return j.size;
378
+ });
379
+ var j;
380
+ Ze.reset();
381
+ function Ut(e, t) {
382
+ if (t && typeof t == "object") {
383
+ var r = Object.getPrototypeOf(t);
384
+ if (r === Object.prototype || r === null) {
385
+ var n = Object.keys(t);
386
+ if (n.every(Wt))
387
+ return t;
388
+ var i = JSON.stringify(n), o = j.get(i);
389
+ if (!o) {
390
+ n.sort();
391
+ var a = JSON.stringify(n);
392
+ o = j.get(a) || n, j.set(i, o), j.set(a, o);
393
+ }
394
+ var s = Object.create(r);
395
+ return o.forEach(function(u) {
396
+ s[u] = t[u];
397
+ }), s;
398
+ }
399
+ }
400
+ return t;
401
+ }
402
+ function Wt(e, t, r) {
403
+ return t === 0 || r[t - 1] <= e;
404
+ }
405
+ var $t = [
406
+ "connection",
407
+ "include",
408
+ "skip",
409
+ "client",
410
+ "rest",
411
+ "export",
412
+ "nonreactive"
413
+ ], R = Ze;
414
+ Object.assign(function(e, t, r) {
415
+ if (t && r && r.connection && r.connection.key)
416
+ if (r.connection.filter && r.connection.filter.length > 0) {
417
+ var n = r.connection.filter ? r.connection.filter : [];
418
+ n.sort();
419
+ var i = {};
420
+ return n.forEach(function(s) {
421
+ i[s] = t[s];
422
+ }), "".concat(r.connection.key, "(").concat(R(i), ")");
423
+ } else
424
+ return r.connection.key;
425
+ var o = e;
426
+ if (t) {
427
+ var a = R(t);
428
+ o += "(".concat(a, ")");
429
+ }
430
+ return r && Object.keys(r).forEach(function(s) {
431
+ $t.indexOf(s) === -1 && (r[s] && Object.keys(r[s]).length ? o += "@".concat(s, "(").concat(R(r[s]), ")") : o += "@".concat(s));
432
+ }), o;
433
+ }, {
434
+ setStringify: function(e) {
435
+ var t = R;
436
+ return R = e, t;
437
+ }
438
+ });
439
+ function Bt(e) {
440
+ return e.alias ? e.alias.value : e.name.value;
441
+ }
442
+ function Gt(e) {
443
+ return e.kind === "Field";
444
+ }
445
+ function et(e) {
446
+ b(e && e.kind === "Document", 88);
447
+ var t = e.definitions.filter(function(r) {
448
+ return r.kind !== "FragmentDefinition";
449
+ }).map(function(r) {
450
+ if (r.kind !== "OperationDefinition")
451
+ throw Ge(89, r.kind);
452
+ return r;
453
+ });
454
+ return b(t.length <= 1, 90, t.length), e;
455
+ }
456
+ function tt(e) {
457
+ return et(e), e.definitions.filter(function(t) {
458
+ return t.kind === "OperationDefinition";
459
+ })[0];
460
+ }
461
+ function Ht(e) {
462
+ return e.definitions.filter(function(t) {
463
+ return t.kind === "FragmentDefinition";
464
+ });
465
+ }
466
+ function Jt(e) {
467
+ var t = tt(e);
468
+ return b(t && t.operation === "query", 91), t;
469
+ }
470
+ function Kt(e) {
471
+ et(e);
472
+ for (var t, r = 0, n = e.definitions; r < n.length; r++) {
473
+ var i = n[r];
474
+ if (i.kind === "OperationDefinition") {
475
+ var o = i.operation;
476
+ if (o === "query" || o === "mutation" || o === "subscription")
477
+ return i;
478
+ }
479
+ i.kind === "FragmentDefinition" && !t && (t = i);
480
+ }
481
+ if (t)
482
+ return t;
483
+ throw Ge(95);
484
+ }
485
+ let m = null;
486
+ const Se = {};
487
+ let Yt = 1;
488
+ const Xt = () => class {
489
+ constructor() {
490
+ this.id = [
491
+ "slot",
492
+ Yt++,
493
+ Date.now(),
494
+ Math.random().toString(36).slice(2)
495
+ ].join(":");
496
+ }
497
+ hasValue() {
498
+ for (let t = m; t; t = t.parent)
499
+ if (this.id in t.slots) {
500
+ const r = t.slots[this.id];
501
+ if (r === Se)
502
+ break;
503
+ return t !== m && (m.slots[this.id] = r), !0;
504
+ }
505
+ return m && (m.slots[this.id] = Se), !1;
506
+ }
507
+ getValue() {
508
+ if (this.hasValue())
509
+ return m.slots[this.id];
510
+ }
511
+ withValue(t, r, n, i) {
512
+ const o = {
513
+ __proto__: null,
514
+ [this.id]: t
515
+ }, a = m;
516
+ m = { parent: a, slots: o };
517
+ try {
518
+ return r.apply(i, n);
519
+ } finally {
520
+ m = a;
521
+ }
522
+ }
523
+ // Capture the current context and wrap a callback function so that it
524
+ // reestablishes the captured context when called.
525
+ static bind(t) {
526
+ const r = m;
527
+ return function() {
528
+ const n = m;
529
+ try {
530
+ return m = r, t.apply(this, arguments);
531
+ } finally {
532
+ m = n;
533
+ }
534
+ };
535
+ }
536
+ // Immediately run a callback function without any captured context.
537
+ static noContext(t, r, n) {
538
+ if (m) {
539
+ const i = m;
540
+ try {
541
+ return m = null, t.apply(n, r);
542
+ } finally {
543
+ m = i;
544
+ }
545
+ } else
546
+ return t.apply(n, r);
547
+ }
548
+ };
549
+ function Ee(e) {
550
+ try {
551
+ return e();
552
+ } catch {
553
+ }
554
+ }
555
+ const H = "@wry/context:Slot", Zt = (
556
+ // Prefer globalThis when available.
557
+ // https://github.com/benjamn/wryware/issues/347
558
+ Ee(() => globalThis) || // Fall back to global, which works in Node.js and may be converted by some
559
+ // bundlers to the appropriate identifier (window, self, ...) depending on the
560
+ // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224
561
+ Ee(() => global) || // Otherwise, use a dummy host that's local to this module. We used to fall
562
+ // back to using the Array constructor as a namespace, but that was flagged in
563
+ // https://github.com/benjamn/wryware/issues/347, and can be avoided.
564
+ /* @__PURE__ */ Object.create(null)
565
+ ), Pe = Zt, he = Pe[H] || // Earlier versions of this package stored the globalKey property on the Array
566
+ // constructor, so we check there as well, to prevent Slot class duplication.
567
+ Array[H] || function(e) {
568
+ try {
569
+ Object.defineProperty(Pe, H, {
570
+ value: e,
571
+ enumerable: !1,
572
+ writable: !1,
573
+ // When it was possible for globalHost to be the Array constructor (a
574
+ // legacy Slot dedup strategy), it was important for the property to be
575
+ // configurable:true so it could be deleted. That does not seem to be as
576
+ // important when globalHost is the global object, but I don't want to
577
+ // cause similar problems again, and configurable:true seems safest.
578
+ // https://github.com/endojs/endo/issues/576#issuecomment-1178274008
579
+ configurable: !0
580
+ });
581
+ } finally {
582
+ return e;
583
+ }
584
+ }(Xt()), { bind: Kr, noContext: Yr } = he;
585
+ new he();
586
+ function rt(e) {
587
+ return Array.isArray(e) && e.length > 0;
588
+ }
589
+ function er(e, t) {
590
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
591
+ if (r) return (r = r.call(e)).next.bind(r);
592
+ if (Array.isArray(e) || (r = tr(e)) || t) {
593
+ r && (e = r);
594
+ var n = 0;
595
+ return function() {
596
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
597
+ };
598
+ }
599
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
600
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
601
+ }
602
+ function tr(e, t) {
603
+ if (e) {
604
+ if (typeof e == "string") return ke(e, t);
605
+ var r = Object.prototype.toString.call(e).slice(8, -1);
606
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
607
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return ke(e, t);
608
+ }
609
+ }
610
+ function ke(e, t) {
611
+ (t == null || t > e.length) && (t = e.length);
612
+ for (var r = 0, n = new Array(t); r < t; r++)
613
+ n[r] = e[r];
614
+ return n;
615
+ }
616
+ function qe(e, t) {
617
+ for (var r = 0; r < t.length; r++) {
618
+ var n = t[r];
619
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
620
+ }
621
+ }
622
+ function pe(e, t, r) {
623
+ return t && qe(e.prototype, t), r && qe(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e;
624
+ }
625
+ var ye = function() {
626
+ return typeof Symbol == "function";
627
+ }, ve = function(e) {
628
+ return ye() && !!Symbol[e];
629
+ }, de = function(e) {
630
+ return ve(e) ? Symbol[e] : "@@" + e;
631
+ };
632
+ ye() && !ve("observable") && (Symbol.observable = Symbol("observable"));
633
+ var rr = de("iterator"), ne = de("observable"), nt = de("species");
634
+ function $(e, t) {
635
+ var r = e[t];
636
+ if (r != null) {
637
+ if (typeof r != "function") throw new TypeError(r + " is not a function");
638
+ return r;
639
+ }
640
+ }
641
+ function C(e) {
642
+ var t = e.constructor;
643
+ return t !== void 0 && (t = t[nt], t === null && (t = void 0)), t !== void 0 ? t : M;
644
+ }
645
+ function nr(e) {
646
+ return e instanceof M;
647
+ }
648
+ function x(e) {
649
+ x.log ? x.log(e) : setTimeout(function() {
650
+ throw e;
651
+ });
652
+ }
653
+ function L(e) {
654
+ Promise.resolve().then(function() {
655
+ try {
656
+ e();
657
+ } catch (t) {
658
+ x(t);
659
+ }
660
+ });
661
+ }
662
+ function it(e) {
663
+ var t = e._cleanup;
664
+ if (t !== void 0 && (e._cleanup = void 0, !!t))
665
+ try {
666
+ if (typeof t == "function")
667
+ t();
668
+ else {
669
+ var r = $(t, "unsubscribe");
670
+ r && r.call(t);
671
+ }
672
+ } catch (n) {
673
+ x(n);
674
+ }
675
+ }
676
+ function ie(e) {
677
+ e._observer = void 0, e._queue = void 0, e._state = "closed";
678
+ }
679
+ function ir(e) {
680
+ var t = e._queue;
681
+ if (t) {
682
+ e._queue = void 0, e._state = "ready";
683
+ for (var r = 0; r < t.length && (ot(e, t[r].type, t[r].value), e._state !== "closed"); ++r)
684
+ ;
685
+ }
686
+ }
687
+ function ot(e, t, r) {
688
+ e._state = "running";
689
+ var n = e._observer;
690
+ try {
691
+ var i = $(n, t);
692
+ switch (t) {
693
+ case "next":
694
+ i && i.call(n, r);
695
+ break;
696
+ case "error":
697
+ if (ie(e), i) i.call(n, r);
698
+ else throw r;
699
+ break;
700
+ case "complete":
701
+ ie(e), i && i.call(n);
702
+ break;
703
+ }
704
+ } catch (o) {
705
+ x(o);
706
+ }
707
+ e._state === "closed" ? it(e) : e._state === "running" && (e._state = "ready");
708
+ }
709
+ function J(e, t, r) {
710
+ if (e._state !== "closed") {
711
+ if (e._state === "buffering") {
712
+ e._queue.push({
713
+ type: t,
714
+ value: r
715
+ });
716
+ return;
717
+ }
718
+ if (e._state !== "ready") {
719
+ e._state = "buffering", e._queue = [{
720
+ type: t,
721
+ value: r
722
+ }], L(function() {
723
+ return ir(e);
724
+ });
725
+ return;
726
+ }
727
+ ot(e, t, r);
728
+ }
729
+ }
730
+ var or = /* @__PURE__ */ function() {
731
+ function e(r, n) {
732
+ this._cleanup = void 0, this._observer = r, this._queue = void 0, this._state = "initializing";
733
+ var i = new ar(this);
734
+ try {
735
+ this._cleanup = n.call(void 0, i);
736
+ } catch (o) {
737
+ i.error(o);
738
+ }
739
+ this._state === "initializing" && (this._state = "ready");
740
+ }
741
+ var t = e.prototype;
742
+ return t.unsubscribe = function() {
743
+ this._state !== "closed" && (ie(this), it(this));
744
+ }, pe(e, [{
745
+ key: "closed",
746
+ get: function() {
747
+ return this._state === "closed";
748
+ }
749
+ }]), e;
750
+ }(), ar = /* @__PURE__ */ function() {
751
+ function e(r) {
752
+ this._subscription = r;
753
+ }
754
+ var t = e.prototype;
755
+ return t.next = function(n) {
756
+ J(this._subscription, "next", n);
757
+ }, t.error = function(n) {
758
+ J(this._subscription, "error", n);
759
+ }, t.complete = function() {
760
+ J(this._subscription, "complete");
761
+ }, pe(e, [{
762
+ key: "closed",
763
+ get: function() {
764
+ return this._subscription._state === "closed";
765
+ }
766
+ }]), e;
767
+ }(), M = /* @__PURE__ */ function() {
768
+ function e(r) {
769
+ if (!(this instanceof e)) throw new TypeError("Observable cannot be called as a function");
770
+ if (typeof r != "function") throw new TypeError("Observable initializer must be a function");
771
+ this._subscriber = r;
772
+ }
773
+ var t = e.prototype;
774
+ return t.subscribe = function(n) {
775
+ return (typeof n != "object" || n === null) && (n = {
776
+ next: n,
777
+ error: arguments[1],
778
+ complete: arguments[2]
779
+ }), new or(n, this._subscriber);
780
+ }, t.forEach = function(n) {
781
+ var i = this;
782
+ return new Promise(function(o, a) {
783
+ if (typeof n != "function") {
784
+ a(new TypeError(n + " is not a function"));
785
+ return;
786
+ }
787
+ function s() {
788
+ u.unsubscribe(), o();
789
+ }
790
+ var u = i.subscribe({
791
+ next: function(c) {
792
+ try {
793
+ n(c, s);
794
+ } catch (f) {
795
+ a(f), u.unsubscribe();
796
+ }
797
+ },
798
+ error: a,
799
+ complete: o
800
+ });
801
+ });
802
+ }, t.map = function(n) {
803
+ var i = this;
804
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
805
+ var o = C(this);
806
+ return new o(function(a) {
807
+ return i.subscribe({
808
+ next: function(s) {
809
+ try {
810
+ s = n(s);
811
+ } catch (u) {
812
+ return a.error(u);
813
+ }
814
+ a.next(s);
815
+ },
816
+ error: function(s) {
817
+ a.error(s);
818
+ },
819
+ complete: function() {
820
+ a.complete();
821
+ }
822
+ });
823
+ });
824
+ }, t.filter = function(n) {
825
+ var i = this;
826
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
827
+ var o = C(this);
828
+ return new o(function(a) {
829
+ return i.subscribe({
830
+ next: function(s) {
831
+ try {
832
+ if (!n(s)) return;
833
+ } catch (u) {
834
+ return a.error(u);
835
+ }
836
+ a.next(s);
837
+ },
838
+ error: function(s) {
839
+ a.error(s);
840
+ },
841
+ complete: function() {
842
+ a.complete();
843
+ }
844
+ });
845
+ });
846
+ }, t.reduce = function(n) {
847
+ var i = this;
848
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
849
+ var o = C(this), a = arguments.length > 1, s = !1, u = arguments[1], c = u;
850
+ return new o(function(f) {
851
+ return i.subscribe({
852
+ next: function(l) {
853
+ var h = !s;
854
+ if (s = !0, !h || a)
855
+ try {
856
+ c = n(c, l);
857
+ } catch (y) {
858
+ return f.error(y);
859
+ }
860
+ else
861
+ c = l;
862
+ },
863
+ error: function(l) {
864
+ f.error(l);
865
+ },
866
+ complete: function() {
867
+ if (!s && !a) return f.error(new TypeError("Cannot reduce an empty sequence"));
868
+ f.next(c), f.complete();
869
+ }
870
+ });
871
+ });
872
+ }, t.concat = function() {
873
+ for (var n = this, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
874
+ o[a] = arguments[a];
875
+ var s = C(this);
876
+ return new s(function(u) {
877
+ var c, f = 0;
878
+ function l(h) {
879
+ c = h.subscribe({
880
+ next: function(y) {
881
+ u.next(y);
882
+ },
883
+ error: function(y) {
884
+ u.error(y);
885
+ },
886
+ complete: function() {
887
+ f === o.length ? (c = void 0, u.complete()) : l(s.from(o[f++]));
888
+ }
889
+ });
890
+ }
891
+ return l(n), function() {
892
+ c && (c.unsubscribe(), c = void 0);
893
+ };
894
+ });
895
+ }, t.flatMap = function(n) {
896
+ var i = this;
897
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
898
+ var o = C(this);
899
+ return new o(function(a) {
900
+ var s = [], u = i.subscribe({
901
+ next: function(f) {
902
+ if (n)
903
+ try {
904
+ f = n(f);
905
+ } catch (h) {
906
+ return a.error(h);
907
+ }
908
+ var l = o.from(f).subscribe({
909
+ next: function(h) {
910
+ a.next(h);
911
+ },
912
+ error: function(h) {
913
+ a.error(h);
914
+ },
915
+ complete: function() {
916
+ var h = s.indexOf(l);
917
+ h >= 0 && s.splice(h, 1), c();
918
+ }
919
+ });
920
+ s.push(l);
921
+ },
922
+ error: function(f) {
923
+ a.error(f);
924
+ },
925
+ complete: function() {
926
+ c();
927
+ }
928
+ });
929
+ function c() {
930
+ u.closed && s.length === 0 && a.complete();
931
+ }
932
+ return function() {
933
+ s.forEach(function(f) {
934
+ return f.unsubscribe();
935
+ }), u.unsubscribe();
936
+ };
937
+ });
938
+ }, t[ne] = function() {
939
+ return this;
940
+ }, e.from = function(n) {
941
+ var i = typeof this == "function" ? this : e;
942
+ if (n == null) throw new TypeError(n + " is not an object");
943
+ var o = $(n, ne);
944
+ if (o) {
945
+ var a = o.call(n);
946
+ if (Object(a) !== a) throw new TypeError(a + " is not an object");
947
+ return nr(a) && a.constructor === i ? a : new i(function(s) {
948
+ return a.subscribe(s);
949
+ });
950
+ }
951
+ if (ve("iterator") && (o = $(n, rr), o))
952
+ return new i(function(s) {
953
+ L(function() {
954
+ if (!s.closed) {
955
+ for (var u = er(o.call(n)), c; !(c = u()).done; ) {
956
+ var f = c.value;
957
+ if (s.next(f), s.closed) return;
958
+ }
959
+ s.complete();
960
+ }
961
+ });
962
+ });
963
+ if (Array.isArray(n))
964
+ return new i(function(s) {
965
+ L(function() {
966
+ if (!s.closed) {
967
+ for (var u = 0; u < n.length; ++u)
968
+ if (s.next(n[u]), s.closed) return;
969
+ s.complete();
970
+ }
971
+ });
972
+ });
973
+ throw new TypeError(n + " is not observable");
974
+ }, e.of = function() {
975
+ for (var n = arguments.length, i = new Array(n), o = 0; o < n; o++)
976
+ i[o] = arguments[o];
977
+ var a = typeof this == "function" ? this : e;
978
+ return new a(function(s) {
979
+ L(function() {
980
+ if (!s.closed) {
981
+ for (var u = 0; u < i.length; ++u)
982
+ if (s.next(i[u]), s.closed) return;
983
+ s.complete();
984
+ }
985
+ });
986
+ });
987
+ }, pe(e, null, [{
988
+ key: nt,
989
+ get: function() {
990
+ return this;
991
+ }
992
+ }]), e;
993
+ }();
994
+ ye() && Object.defineProperty(M, Symbol("extensions"), {
995
+ value: {
996
+ symbol: ne,
997
+ hostReportError: x
998
+ },
999
+ configurable: !0
1000
+ });
1001
+ function sr(e) {
1002
+ var t, r = e.Symbol;
1003
+ if (typeof r == "function")
1004
+ if (r.observable)
1005
+ t = r.observable;
1006
+ else {
1007
+ typeof r.for == "function" ? t = r.for("https://github.com/benlesh/symbol-observable") : t = r("https://github.com/benlesh/symbol-observable");
1008
+ try {
1009
+ r.observable = t;
1010
+ } catch {
1011
+ }
1012
+ }
1013
+ else
1014
+ t = "@@observable";
1015
+ return t;
1016
+ }
1017
+ var F;
1018
+ typeof self < "u" ? F = self : typeof window < "u" ? F = window : typeof global < "u" ? F = global : typeof module < "u" ? F = module : F = Function("return this")();
1019
+ sr(F);
1020
+ var De = M.prototype, Ie = "@@observable";
1021
+ De[Ie] || (De[Ie] = function() {
1022
+ return this;
1023
+ });
1024
+ function ur(e) {
1025
+ return e.catch(function() {
1026
+ }), e;
1027
+ }
1028
+ var cr = Object.prototype.toString;
1029
+ function fr(e) {
1030
+ return oe(e);
1031
+ }
1032
+ function oe(e, t) {
1033
+ switch (cr.call(e)) {
1034
+ case "[object Array]": {
1035
+ if (t = t || /* @__PURE__ */ new Map(), t.has(e))
1036
+ return t.get(e);
1037
+ var r = e.slice(0);
1038
+ return t.set(e, r), r.forEach(function(i, o) {
1039
+ r[o] = oe(i, t);
1040
+ }), r;
1041
+ }
1042
+ case "[object Object]": {
1043
+ if (t = t || /* @__PURE__ */ new Map(), t.has(e))
1044
+ return t.get(e);
1045
+ var n = Object.create(Object.getPrototypeOf(e));
1046
+ return t.set(e, n), Object.keys(e).forEach(function(i) {
1047
+ n[i] = oe(e[i], t);
1048
+ }), n;
1049
+ }
1050
+ default:
1051
+ return e;
1052
+ }
1053
+ }
1054
+ function lr(e) {
1055
+ var t = /* @__PURE__ */ new Set([e]);
1056
+ return t.forEach(function(r) {
1057
+ te(r) && hr(r) === r && Object.getOwnPropertyNames(r).forEach(function(n) {
1058
+ te(r[n]) && t.add(r[n]);
1059
+ });
1060
+ }), e;
1061
+ }
1062
+ function hr(e) {
1063
+ if (globalThis.__DEV__ !== !1 && !Object.isFrozen(e))
1064
+ try {
1065
+ Object.freeze(e);
1066
+ } catch (t) {
1067
+ if (t instanceof TypeError)
1068
+ return null;
1069
+ throw t;
1070
+ }
1071
+ return e;
1072
+ }
1073
+ function at(e) {
1074
+ return globalThis.__DEV__ !== !1 && lr(e), e;
1075
+ }
1076
+ function Fe(e, t, r) {
1077
+ var n = [];
1078
+ e.forEach(function(i) {
1079
+ return i[t] && n.push(i);
1080
+ }), n.forEach(function(i) {
1081
+ return i[t](r);
1082
+ });
1083
+ }
1084
+ function pr(e) {
1085
+ function t(r) {
1086
+ Object.defineProperty(e, r, { value: M });
1087
+ }
1088
+ return Je && Symbol.species && t(Symbol.species), t("@@species"), e;
1089
+ }
1090
+ function Q() {
1091
+ for (var e = [], t = 0; t < arguments.length; t++)
1092
+ e[t] = arguments[t];
1093
+ var r = /* @__PURE__ */ Object.create(null);
1094
+ return e.forEach(function(n) {
1095
+ n && Object.keys(n).forEach(function(i) {
1096
+ var o = n[i];
1097
+ o !== void 0 && (r[i] = o);
1098
+ });
1099
+ }), r;
1100
+ }
1101
+ function yr(e, t) {
1102
+ return Q(e, t, t.variables && {
1103
+ variables: Q(p(p({}, e && e.variables), t.variables))
1104
+ });
1105
+ }
1106
+ function vr(e) {
1107
+ return e.hasOwnProperty("graphQLErrors");
1108
+ }
1109
+ var dr = function(e) {
1110
+ var t = T(T(T([], e.graphQLErrors, !0), e.clientErrors, !0), e.protocolErrors, !0);
1111
+ return e.networkError && t.push(e.networkError), t.map(function(r) {
1112
+ return te(r) && r.message || "Error message not found.";
1113
+ }).join(`
1114
+ `);
1115
+ }, ge = (
1116
+ /** @class */
1117
+ function(e) {
1118
+ ce(t, e);
1119
+ function t(r) {
1120
+ var n = r.graphQLErrors, i = r.protocolErrors, o = r.clientErrors, a = r.networkError, s = r.errorMessage, u = r.extraInfo, c = e.call(this, s) || this;
1121
+ return c.name = "ApolloError", c.graphQLErrors = n || [], c.protocolErrors = i || [], c.clientErrors = o || [], c.networkError = a || null, c.message = s || dr(c), c.extraInfo = u, c.cause = T(T(T([
1122
+ a
1123
+ ], n || [], !0), i || [], !0), o || [], !0).find(function(f) {
1124
+ return !!f;
1125
+ }) || null, c.__proto__ = t.prototype, c;
1126
+ }
1127
+ return t;
1128
+ }(Error)
1129
+ );
1130
+ const { toString: je, hasOwnProperty: gr } = Object.prototype, Te = Function.prototype.toString, ae = /* @__PURE__ */ new Map();
1131
+ function O(e, t) {
1132
+ try {
1133
+ return se(e, t);
1134
+ } finally {
1135
+ ae.clear();
1136
+ }
1137
+ }
1138
+ function se(e, t) {
1139
+ if (e === t)
1140
+ return !0;
1141
+ const r = je.call(e), n = je.call(t);
1142
+ if (r !== n)
1143
+ return !1;
1144
+ switch (r) {
1145
+ case "[object Array]":
1146
+ if (e.length !== t.length)
1147
+ return !1;
1148
+ // Fall through to object case...
1149
+ case "[object Object]": {
1150
+ if (Me(e, t))
1151
+ return !0;
1152
+ const i = xe(e), o = xe(t), a = i.length;
1153
+ if (a !== o.length)
1154
+ return !1;
1155
+ for (let s = 0; s < a; ++s)
1156
+ if (!gr.call(t, i[s]))
1157
+ return !1;
1158
+ for (let s = 0; s < a; ++s) {
1159
+ const u = i[s];
1160
+ if (!se(e[u], t[u]))
1161
+ return !1;
1162
+ }
1163
+ return !0;
1164
+ }
1165
+ case "[object Error]":
1166
+ return e.name === t.name && e.message === t.message;
1167
+ case "[object Number]":
1168
+ if (e !== e)
1169
+ return t !== t;
1170
+ // Fall through to shared +a === +b case...
1171
+ case "[object Boolean]":
1172
+ case "[object Date]":
1173
+ return +e == +t;
1174
+ case "[object RegExp]":
1175
+ case "[object String]":
1176
+ return e == `${t}`;
1177
+ case "[object Map]":
1178
+ case "[object Set]": {
1179
+ if (e.size !== t.size)
1180
+ return !1;
1181
+ if (Me(e, t))
1182
+ return !0;
1183
+ const i = e.entries(), o = r === "[object Map]";
1184
+ for (; ; ) {
1185
+ const a = i.next();
1186
+ if (a.done)
1187
+ break;
1188
+ const [s, u] = a.value;
1189
+ if (!t.has(s) || o && !se(u, t.get(s)))
1190
+ return !1;
1191
+ }
1192
+ return !0;
1193
+ }
1194
+ case "[object Uint16Array]":
1195
+ case "[object Uint8Array]":
1196
+ // Buffer, in Node.js.
1197
+ case "[object Uint32Array]":
1198
+ case "[object Int32Array]":
1199
+ case "[object Int8Array]":
1200
+ case "[object Int16Array]":
1201
+ case "[object ArrayBuffer]":
1202
+ e = new Uint8Array(e), t = new Uint8Array(t);
1203
+ // Fall through...
1204
+ case "[object DataView]": {
1205
+ let i = e.byteLength;
1206
+ if (i === t.byteLength)
1207
+ for (; i-- && e[i] === t[i]; )
1208
+ ;
1209
+ return i === -1;
1210
+ }
1211
+ case "[object AsyncFunction]":
1212
+ case "[object GeneratorFunction]":
1213
+ case "[object AsyncGeneratorFunction]":
1214
+ case "[object Function]": {
1215
+ const i = Te.call(e);
1216
+ return i !== Te.call(t) ? !1 : !wr(i, mr);
1217
+ }
1218
+ }
1219
+ return !1;
1220
+ }
1221
+ function xe(e) {
1222
+ return Object.keys(e).filter(br, e);
1223
+ }
1224
+ function br(e) {
1225
+ return this[e] !== void 0;
1226
+ }
1227
+ const mr = "{ [native code] }";
1228
+ function wr(e, t) {
1229
+ const r = e.length - t.length;
1230
+ return r >= 0 && e.indexOf(t, r) === r;
1231
+ }
1232
+ function Me(e, t) {
1233
+ let r = ae.get(e);
1234
+ if (r) {
1235
+ if (r.has(t))
1236
+ return !0;
1237
+ } else
1238
+ ae.set(e, r = /* @__PURE__ */ new Set());
1239
+ return r.add(t), !1;
1240
+ }
1241
+ function _r(e, t, r, n) {
1242
+ var i = t.data, o = W(t, ["data"]), a = r.data, s = W(r, ["data"]);
1243
+ return O(o, s) && V(Kt(e).selectionSet, i, a, {
1244
+ fragmentMap: jt(Ht(e)),
1245
+ variables: n
1246
+ });
1247
+ }
1248
+ function V(e, t, r, n) {
1249
+ if (t === r)
1250
+ return !0;
1251
+ var i = /* @__PURE__ */ new Set();
1252
+ return e.selections.every(function(o) {
1253
+ if (i.has(o) || (i.add(o), !Et(o, n.variables)) || Re(o))
1254
+ return !0;
1255
+ if (Gt(o)) {
1256
+ var a = Bt(o), s = t && t[a], u = r && r[a], c = o.selectionSet;
1257
+ if (!c)
1258
+ return O(s, u);
1259
+ var f = Array.isArray(s), l = Array.isArray(u);
1260
+ if (f !== l)
1261
+ return !1;
1262
+ if (f && l) {
1263
+ var h = s.length;
1264
+ if (u.length !== h)
1265
+ return !1;
1266
+ for (var y = 0; y < h; ++y)
1267
+ if (!V(c, s[y], u[y], n))
1268
+ return !1;
1269
+ return !0;
1270
+ }
1271
+ return V(c, s, u, n);
1272
+ } else {
1273
+ var v = Tt(o, n.fragmentMap);
1274
+ if (v)
1275
+ return Re(v) ? !0 : V(
1276
+ v.selectionSet,
1277
+ // Notice that we reuse the same aResult and bResult values here,
1278
+ // since the fragment ...spread does not specify a field name, but
1279
+ // consists of multiple fields (within the fragment's selection set)
1280
+ // that should be applied to the current result value(s).
1281
+ t,
1282
+ r,
1283
+ n
1284
+ );
1285
+ }
1286
+ });
1287
+ }
1288
+ function Re(e) {
1289
+ return !!e.directives && e.directives.some(Or);
1290
+ }
1291
+ function Or(e) {
1292
+ return e.name.value === "nonreactive";
1293
+ }
1294
+ var g;
1295
+ (function(e) {
1296
+ e[e.loading = 1] = "loading", e[e.setVariables = 2] = "setVariables", e[e.fetchMore = 3] = "fetchMore", e[e.refetch = 4] = "refetch", e[e.poll = 6] = "poll", e[e.ready = 7] = "ready", e[e.error = 8] = "error";
1297
+ })(g || (g = {}));
1298
+ function z(e) {
1299
+ return e ? e < 7 : !1;
1300
+ }
1301
+ var Ce = Object.assign, Sr = Object.hasOwnProperty, st = (
1302
+ /** @class */
1303
+ function(e) {
1304
+ ce(t, e);
1305
+ function t(r) {
1306
+ var n = r.queryManager, i = r.queryInfo, o = r.options, a = this, s = t.inactiveOnCreation.getValue();
1307
+ a = e.call(this, function(d) {
1308
+ s && (n.queries.set(a.queryId, i), s = !1);
1309
+ try {
1310
+ var _ = d._subscription._observer;
1311
+ _ && !_.error && (_.error = Er);
1312
+ } catch {
1313
+ }
1314
+ var dt = !a.observers.size;
1315
+ a.observers.add(d);
1316
+ var I = a.last;
1317
+ return I && I.error ? d.error && d.error(I.error) : I && I.result && d.next && d.next(a.maskResult(I.result)), dt && a.reobserve().catch(function() {
1318
+ }), function() {
1319
+ a.observers.delete(d) && !a.observers.size && a.tearDownQuery();
1320
+ };
1321
+ }) || this, a.observers = /* @__PURE__ */ new Set(), a.subscriptions = /* @__PURE__ */ new Set(), a.dirty = !1, a.queryInfo = i, a.queryManager = n, a.waitForOwnResult = K(o.fetchPolicy), a.isTornDown = !1, a.subscribeToMore = a.subscribeToMore.bind(a), a.maskResult = a.maskResult.bind(a);
1322
+ var u = n.defaultOptions.watchQuery, c = u === void 0 ? {} : u, f = c.fetchPolicy, l = f === void 0 ? "cache-first" : f, h = o.fetchPolicy, y = h === void 0 ? l : h, v = o.initialFetchPolicy, E = v === void 0 ? y === "standby" ? l : y : v;
1323
+ a.options = p(p({}, o), {
1324
+ // Remember the initial options.fetchPolicy so we can revert back to this
1325
+ // policy when variables change. This information can also be specified
1326
+ // (or overridden) by providing options.initialFetchPolicy explicitly.
1327
+ initialFetchPolicy: E,
1328
+ // This ensures this.options.fetchPolicy always has a string value, in
1329
+ // case options.fetchPolicy was not provided.
1330
+ fetchPolicy: y
1331
+ }), a.queryId = i.queryId || n.generateQueryId();
1332
+ var S = tt(a.query);
1333
+ return a.queryName = S && S.name && S.name.value, a;
1334
+ }
1335
+ return Object.defineProperty(t.prototype, "query", {
1336
+ // The `query` computed property will always reflect the document transformed
1337
+ // by the last run query. `this.options.query` will always reflect the raw
1338
+ // untransformed query to ensure document transforms with runtime conditionals
1339
+ // are run on the original document.
1340
+ get: function() {
1341
+ return this.lastQuery || this.options.query;
1342
+ },
1343
+ enumerable: !1,
1344
+ configurable: !0
1345
+ }), Object.defineProperty(t.prototype, "variables", {
1346
+ // Computed shorthand for this.options.variables, preserved for
1347
+ // backwards compatibility.
1348
+ /**
1349
+ * An object containing the variables that were provided for the query.
1350
+ */
1351
+ get: function() {
1352
+ return this.options.variables;
1353
+ },
1354
+ enumerable: !1,
1355
+ configurable: !0
1356
+ }), t.prototype.result = function() {
1357
+ var r = this;
1358
+ return new Promise(function(n, i) {
1359
+ var o = {
1360
+ next: function(s) {
1361
+ n(s), r.observers.delete(o), r.observers.size || r.queryManager.removeQuery(r.queryId), setTimeout(function() {
1362
+ a.unsubscribe();
1363
+ }, 0);
1364
+ },
1365
+ error: i
1366
+ }, a = r.subscribe(o);
1367
+ });
1368
+ }, t.prototype.resetDiff = function() {
1369
+ this.queryInfo.resetDiff();
1370
+ }, t.prototype.getCurrentFullResult = function(r) {
1371
+ r === void 0 && (r = !0);
1372
+ var n = this.getLastResult(!0), i = this.queryInfo.networkStatus || n && n.networkStatus || g.ready, o = p(p({}, n), { loading: z(i), networkStatus: i }), a = this.options.fetchPolicy, s = a === void 0 ? "cache-first" : a;
1373
+ if (
1374
+ // These fetch policies should never deliver data from the cache, unless
1375
+ // redelivering a previously delivered result.
1376
+ !(K(s) || // If this.options.query has @client(always: true) fields, we cannot
1377
+ // trust diff.result, since it was read from the cache without running
1378
+ // local resolvers (and it's too late to run resolvers now, since we must
1379
+ // return a result synchronously).
1380
+ this.queryManager.getDocumentInfo(this.query).hasForcedResolvers)
1381
+ ) if (this.waitForOwnResult)
1382
+ this.queryInfo.updateWatch();
1383
+ else {
1384
+ var u = this.queryInfo.getDiff();
1385
+ (u.complete || this.options.returnPartialData) && (o.data = u.result), O(o.data, {}) && (o.data = void 0), u.complete ? (delete o.partial, u.complete && o.networkStatus === g.loading && (s === "cache-first" || s === "cache-only") && (o.networkStatus = g.ready, o.loading = !1)) : o.partial = !0, o.networkStatus === g.ready && (o.error || o.errors) && (o.networkStatus = g.error), globalThis.__DEV__ !== !1 && !u.complete && !this.options.partialRefetch && !o.loading && !o.data && !o.error && Pr(u.missing);
1386
+ }
1387
+ return r && this.updateLastResult(o), o;
1388
+ }, t.prototype.getCurrentResult = function(r) {
1389
+ return r === void 0 && (r = !0), this.maskResult(this.getCurrentFullResult(r));
1390
+ }, t.prototype.isDifferentFromLastResult = function(r, n) {
1391
+ if (!this.last)
1392
+ return !0;
1393
+ var i = this.queryManager.getDocumentInfo(this.query), o = this.queryManager.dataMasking, a = o ? i.nonReactiveQuery : this.query, s = o || i.hasNonreactiveDirective ? !_r(a, this.last.result, r, this.variables) : !O(this.last.result, r);
1394
+ return s || n && !O(this.last.variables, n);
1395
+ }, t.prototype.getLast = function(r, n) {
1396
+ var i = this.last;
1397
+ if (i && i[r] && (!n || O(i.variables, this.variables)))
1398
+ return i[r];
1399
+ }, t.prototype.getLastResult = function(r) {
1400
+ return this.getLast("result", r);
1401
+ }, t.prototype.getLastError = function(r) {
1402
+ return this.getLast("error", r);
1403
+ }, t.prototype.resetLastResults = function() {
1404
+ delete this.last, this.isTornDown = !1;
1405
+ }, t.prototype.resetQueryStoreErrors = function() {
1406
+ this.queryManager.resetErrors(this.queryId);
1407
+ }, t.prototype.refetch = function(r) {
1408
+ var n, i = {
1409
+ // Always disable polling for refetches.
1410
+ pollInterval: 0
1411
+ }, o = this.options.fetchPolicy;
1412
+ if (o === "no-cache" ? i.fetchPolicy = "no-cache" : i.fetchPolicy = "network-only", globalThis.__DEV__ !== !1 && r && Sr.call(r, "variables")) {
1413
+ var a = Jt(this.query), s = a.variableDefinitions;
1414
+ (!s || !s.some(function(u) {
1415
+ return u.variable.name.value === "variables";
1416
+ })) && globalThis.__DEV__ !== !1 && b.warn(
1417
+ 21,
1418
+ r,
1419
+ ((n = a.name) === null || n === void 0 ? void 0 : n.value) || a
1420
+ );
1421
+ }
1422
+ return r && !O(this.options.variables, r) && (i.variables = this.options.variables = p(p({}, this.options.variables), r)), this.queryInfo.resetLastWrite(), this.reobserve(i, g.refetch);
1423
+ }, t.prototype.fetchMore = function(r) {
1424
+ var n = this, i = p(p({}, r.query ? r : p(p(p(p({}, this.options), { query: this.options.query }), r), { variables: p(p({}, this.options.variables), r.variables) })), {
1425
+ // The fetchMore request goes immediately to the network and does
1426
+ // not automatically write its result to the cache (hence no-cache
1427
+ // instead of network-only), because we allow the caller of
1428
+ // fetchMore to provide an updateQuery callback that determines how
1429
+ // the data gets written to the cache.
1430
+ fetchPolicy: "no-cache"
1431
+ });
1432
+ i.query = this.transformDocument(i.query);
1433
+ var o = this.queryManager.generateQueryId();
1434
+ this.lastQuery = r.query ? this.transformDocument(this.options.query) : i.query;
1435
+ var a = this.queryInfo, s = a.networkStatus;
1436
+ a.networkStatus = g.fetchMore, i.notifyOnNetworkStatusChange && this.observe();
1437
+ var u = /* @__PURE__ */ new Set(), c = r?.updateQuery, f = this.options.fetchPolicy !== "no-cache";
1438
+ return f || b(c, 22), this.queryManager.fetchQuery(o, i, g.fetchMore).then(function(l) {
1439
+ if (n.queryManager.removeQuery(o), a.networkStatus === g.fetchMore && (a.networkStatus = s), f)
1440
+ n.queryManager.cache.batch({
1441
+ update: function(v) {
1442
+ var E = r.updateQuery;
1443
+ E ? v.updateQuery({
1444
+ query: n.query,
1445
+ variables: n.variables,
1446
+ returnPartialData: !0,
1447
+ optimistic: !1
1448
+ }, function(S) {
1449
+ return E(S, {
1450
+ fetchMoreResult: l.data,
1451
+ variables: i.variables
1452
+ });
1453
+ }) : v.writeQuery({
1454
+ query: i.query,
1455
+ variables: i.variables,
1456
+ data: l.data
1457
+ });
1458
+ },
1459
+ onWatchUpdated: function(v) {
1460
+ u.add(v.query);
1461
+ }
1462
+ });
1463
+ else {
1464
+ var h = n.getLast("result"), y = c(h.data, {
1465
+ fetchMoreResult: l.data,
1466
+ variables: i.variables
1467
+ });
1468
+ n.reportResult(p(p({}, h), { networkStatus: s, loading: z(s), data: y }), n.variables);
1469
+ }
1470
+ return n.maskResult(l);
1471
+ }).finally(function() {
1472
+ f && !u.has(n.query) && n.reobserveCacheFirst();
1473
+ });
1474
+ }, t.prototype.subscribeToMore = function(r) {
1475
+ var n = this, i = this.queryManager.startGraphQLSubscription({
1476
+ query: r.document,
1477
+ variables: r.variables,
1478
+ context: r.context
1479
+ }).subscribe({
1480
+ next: function(o) {
1481
+ var a = r.updateQuery;
1482
+ a && n.updateQuery(function(s, u) {
1483
+ return a(s, p({ subscriptionData: o }, u));
1484
+ });
1485
+ },
1486
+ error: function(o) {
1487
+ if (r.onError) {
1488
+ r.onError(o);
1489
+ return;
1490
+ }
1491
+ globalThis.__DEV__ !== !1 && b.error(23, o);
1492
+ }
1493
+ });
1494
+ return this.subscriptions.add(i), function() {
1495
+ n.subscriptions.delete(i) && i.unsubscribe();
1496
+ };
1497
+ }, t.prototype.setOptions = function(r) {
1498
+ return this.reobserve(r);
1499
+ }, t.prototype.silentSetOptions = function(r) {
1500
+ var n = Q(this.options, r || {});
1501
+ Ce(this.options, n);
1502
+ }, t.prototype.setVariables = function(r) {
1503
+ return O(this.variables, r) ? this.observers.size ? this.result() : Promise.resolve() : (this.options.variables = r, this.observers.size ? this.reobserve({
1504
+ // Reset options.fetchPolicy to its original value.
1505
+ fetchPolicy: this.options.initialFetchPolicy,
1506
+ variables: r
1507
+ }, g.setVariables) : Promise.resolve());
1508
+ }, t.prototype.updateQuery = function(r) {
1509
+ var n = this.queryManager, i = n.cache.diff({
1510
+ query: this.options.query,
1511
+ variables: this.variables,
1512
+ returnPartialData: !0,
1513
+ optimistic: !1
1514
+ }), o = i.result, a = i.complete, s = r(o, {
1515
+ variables: this.variables,
1516
+ complete: !!a,
1517
+ previousData: o
1518
+ });
1519
+ s && (n.cache.writeQuery({
1520
+ query: this.options.query,
1521
+ data: s,
1522
+ variables: this.variables
1523
+ }), n.broadcastQueries());
1524
+ }, t.prototype.startPolling = function(r) {
1525
+ this.options.pollInterval = r, this.updatePolling();
1526
+ }, t.prototype.stopPolling = function() {
1527
+ this.options.pollInterval = 0, this.updatePolling();
1528
+ }, t.prototype.applyNextFetchPolicy = function(r, n) {
1529
+ if (n.nextFetchPolicy) {
1530
+ var i = n.fetchPolicy, o = i === void 0 ? "cache-first" : i, a = n.initialFetchPolicy, s = a === void 0 ? o : a;
1531
+ o === "standby" || (typeof n.nextFetchPolicy == "function" ? n.fetchPolicy = n.nextFetchPolicy(o, {
1532
+ reason: r,
1533
+ options: n,
1534
+ observable: this,
1535
+ initialFetchPolicy: s
1536
+ }) : r === "variables-changed" ? n.fetchPolicy = s : n.fetchPolicy = n.nextFetchPolicy);
1537
+ }
1538
+ return n.fetchPolicy;
1539
+ }, t.prototype.fetch = function(r, n, i) {
1540
+ var o = this.queryManager.getOrCreateQuery(this.queryId);
1541
+ return o.setObservableQuery(this), this.queryManager.fetchConcastWithInfo(o, r, n, i);
1542
+ }, t.prototype.updatePolling = function() {
1543
+ var r = this;
1544
+ if (!this.queryManager.ssrMode) {
1545
+ var n = this, i = n.pollingInfo, o = n.options.pollInterval;
1546
+ if (!o || !this.hasObservers()) {
1547
+ i && (clearTimeout(i.timeout), delete this.pollingInfo);
1548
+ return;
1549
+ }
1550
+ if (!(i && i.interval === o)) {
1551
+ b(o, 24);
1552
+ var a = i || (this.pollingInfo = {});
1553
+ a.interval = o;
1554
+ var s = function() {
1555
+ var c, f;
1556
+ r.pollingInfo && (!z(r.queryInfo.networkStatus) && !(!((f = (c = r.options).skipPollAttempt) === null || f === void 0) && f.call(c)) ? r.reobserve({
1557
+ // Most fetchPolicy options don't make sense to use in a polling context, as
1558
+ // users wouldn't want to be polling the cache directly. However, network-only and
1559
+ // no-cache are both useful for when the user wants to control whether or not the
1560
+ // polled results are written to the cache.
1561
+ fetchPolicy: r.options.initialFetchPolicy === "no-cache" ? "no-cache" : "network-only"
1562
+ }, g.poll).then(u, u) : u());
1563
+ }, u = function() {
1564
+ var c = r.pollingInfo;
1565
+ c && (clearTimeout(c.timeout), c.timeout = setTimeout(s, c.interval));
1566
+ };
1567
+ u();
1568
+ }
1569
+ }
1570
+ }, t.prototype.updateLastResult = function(r, n) {
1571
+ n === void 0 && (n = this.variables);
1572
+ var i = this.getLastError();
1573
+ return i && this.last && !O(n, this.last.variables) && (i = void 0), this.last = p({ result: this.queryManager.assumeImmutableResults ? r : fr(r), variables: n }, i ? { error: i } : null);
1574
+ }, t.prototype.reobserveAsConcast = function(r, n) {
1575
+ var i = this;
1576
+ this.isTornDown = !1;
1577
+ var o = (
1578
+ // Refetching uses a disposable Concast to allow refetches using different
1579
+ // options/variables, without permanently altering the options of the
1580
+ // original ObservableQuery.
1581
+ n === g.refetch || // The fetchMore method does not actually call the reobserve method, but,
1582
+ // if it did, it would definitely use a disposable Concast.
1583
+ n === g.fetchMore || // Polling uses a disposable Concast so the polling options (which force
1584
+ // fetchPolicy to be "network-only" or "no-cache") won't override the original options.
1585
+ n === g.poll
1586
+ ), a = this.options.variables, s = this.options.fetchPolicy, u = Q(this.options, r || {}), c = o ? (
1587
+ // Disposable Concast fetches receive a shallow copy of this.options
1588
+ // (merged with newOptions), leaving this.options unmodified.
1589
+ u
1590
+ ) : Ce(this.options, u), f = this.transformDocument(c.query);
1591
+ this.lastQuery = f, o || (this.updatePolling(), r && r.variables && !O(r.variables, a) && // Don't mess with the fetchPolicy if it's currently "standby".
1592
+ c.fetchPolicy !== "standby" && // If we're changing the fetchPolicy anyway, don't try to change it here
1593
+ // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.
1594
+ (c.fetchPolicy === s || // A `nextFetchPolicy` function has even higher priority, though,
1595
+ // so in that case `applyNextFetchPolicy` must be called.
1596
+ typeof c.nextFetchPolicy == "function") && (this.applyNextFetchPolicy("variables-changed", c), n === void 0 && (n = g.setVariables))), this.waitForOwnResult && (this.waitForOwnResult = K(c.fetchPolicy));
1597
+ var l = function() {
1598
+ i.concast === v && (i.waitForOwnResult = !1);
1599
+ }, h = c.variables && p({}, c.variables), y = this.fetch(c, n, f), v = y.concast, E = y.fromLink, S = {
1600
+ next: function(d) {
1601
+ O(i.variables, h) && (l(), i.reportResult(d, h));
1602
+ },
1603
+ error: function(d) {
1604
+ O(i.variables, h) && (vr(d) || (d = new ge({ networkError: d })), l(), i.reportError(d, h));
1605
+ }
1606
+ };
1607
+ return !o && (E || !this.concast) && (this.concast && this.observer && this.concast.removeObserver(this.observer), this.concast = v, this.observer = S), v.addObserver(S), v;
1608
+ }, t.prototype.reobserve = function(r, n) {
1609
+ return ur(this.reobserveAsConcast(r, n).promise.then(this.maskResult));
1610
+ }, t.prototype.resubscribeAfterError = function() {
1611
+ for (var r = [], n = 0; n < arguments.length; n++)
1612
+ r[n] = arguments[n];
1613
+ var i = this.last;
1614
+ this.resetLastResults();
1615
+ var o = this.subscribe.apply(this, r);
1616
+ return this.last = i, o;
1617
+ }, t.prototype.observe = function() {
1618
+ this.reportResult(
1619
+ // Passing false is important so that this.getCurrentResult doesn't
1620
+ // save the fetchMore result as this.lastResult, causing it to be
1621
+ // ignored due to the this.isDifferentFromLastResult check in
1622
+ // this.reportResult.
1623
+ this.getCurrentFullResult(!1),
1624
+ this.variables
1625
+ );
1626
+ }, t.prototype.reportResult = function(r, n) {
1627
+ var i = this.getLastError(), o = this.isDifferentFromLastResult(r, n);
1628
+ (i || !r.partial || this.options.returnPartialData) && this.updateLastResult(r, n), (i || o) && Fe(this.observers, "next", this.maskResult(r));
1629
+ }, t.prototype.reportError = function(r, n) {
1630
+ var i = p(p({}, this.getLastResult()), { error: r, errors: r.graphQLErrors, networkStatus: g.error, loading: !1 });
1631
+ this.updateLastResult(i, n), Fe(this.observers, "error", this.last.error = r);
1632
+ }, t.prototype.hasObservers = function() {
1633
+ return this.observers.size > 0;
1634
+ }, t.prototype.tearDownQuery = function() {
1635
+ this.isTornDown || (this.concast && this.observer && (this.concast.removeObserver(this.observer), delete this.concast, delete this.observer), this.stopPolling(), this.subscriptions.forEach(function(r) {
1636
+ return r.unsubscribe();
1637
+ }), this.subscriptions.clear(), this.queryManager.stopQuery(this.queryId), this.observers.clear(), this.isTornDown = !0);
1638
+ }, t.prototype.transformDocument = function(r) {
1639
+ return this.queryManager.transform(r);
1640
+ }, t.prototype.maskResult = function(r) {
1641
+ return r && "data" in r ? p(p({}, r), { data: this.queryManager.maskOperation({
1642
+ document: this.query,
1643
+ data: r.data,
1644
+ fetchPolicy: this.options.fetchPolicy,
1645
+ id: this.queryId
1646
+ }) }) : r;
1647
+ }, t.prototype.resetNotifications = function() {
1648
+ this.cancelNotifyTimeout(), this.dirty = !1;
1649
+ }, t.prototype.cancelNotifyTimeout = function() {
1650
+ this.notifyTimeout && (clearTimeout(this.notifyTimeout), this.notifyTimeout = void 0);
1651
+ }, t.prototype.scheduleNotify = function() {
1652
+ var r = this;
1653
+ this.dirty || (this.dirty = !0, this.notifyTimeout || (this.notifyTimeout = setTimeout(function() {
1654
+ return r.notify();
1655
+ }, 0)));
1656
+ }, t.prototype.notify = function() {
1657
+ if (this.cancelNotifyTimeout(), this.dirty && (this.options.fetchPolicy == "cache-only" || this.options.fetchPolicy == "cache-and-network" || !z(this.queryInfo.networkStatus))) {
1658
+ var r = this.queryInfo.getDiff();
1659
+ r.fromOptimisticTransaction ? this.observe() : this.reobserveCacheFirst();
1660
+ }
1661
+ this.dirty = !1;
1662
+ }, t.prototype.reobserveCacheFirst = function() {
1663
+ var r = this.options, n = r.fetchPolicy, i = r.nextFetchPolicy;
1664
+ return n === "cache-and-network" || n === "network-only" ? this.reobserve({
1665
+ fetchPolicy: "cache-first",
1666
+ // Use a temporary nextFetchPolicy function that replaces itself with the
1667
+ // previous nextFetchPolicy value and returns the original fetchPolicy.
1668
+ nextFetchPolicy: function(o, a) {
1669
+ return this.nextFetchPolicy = i, typeof this.nextFetchPolicy == "function" ? this.nextFetchPolicy(o, a) : n;
1670
+ }
1671
+ }) : this.reobserve();
1672
+ }, t.inactiveOnCreation = new he(), t;
1673
+ }(M)
1674
+ );
1675
+ pr(st);
1676
+ function Er(e) {
1677
+ globalThis.__DEV__ !== !1 && b.error(25, e.message, e.stack);
1678
+ }
1679
+ function Pr(e) {
1680
+ globalThis.__DEV__ !== !1 && e && globalThis.__DEV__ !== !1 && b.debug(26, e);
1681
+ }
1682
+ function K(e) {
1683
+ return e === "network-only" || e === "no-cache" || e === "standby";
1684
+ }
1685
+ var Y = { exports: {} }, Qe;
1686
+ function kr() {
1687
+ return Qe || (Qe = 1, function(e) {
1688
+ e.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = void 0, e.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = void 0, e.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = void 0, Object.assign(e.exports, bt);
1689
+ }(Y)), Y.exports;
1690
+ }
1691
+ var w = kr();
1692
+ const qr = /* @__PURE__ */ gt(w), ut = /* @__PURE__ */ mt({
1693
+ __proto__: null,
1694
+ default: qr
1695
+ }, [w]);
1696
+ var Ae = Je ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
1697
+ function ct() {
1698
+ b("createContext" in ut, 54);
1699
+ var e = w.createContext[Ae];
1700
+ return e || (Object.defineProperty(w.createContext, Ae, {
1701
+ value: e = w.createContext({}),
1702
+ enumerable: !1,
1703
+ writable: !1,
1704
+ configurable: !0
1705
+ }), e.displayName = "ApolloContext"), e;
1706
+ }
1707
+ function ft(e) {
1708
+ var t = w.useContext(ct()), r = e || t.client;
1709
+ return b(!!r, 58), r;
1710
+ }
1711
+ var Ne = !1, Dr = "useSyncExternalStore", Ir = ut[Dr], Fr = Ir || function(e, t, r) {
1712
+ var n = t();
1713
+ // DEVIATION: Using __DEV__
1714
+ globalThis.__DEV__ !== !1 && !Ne && // DEVIATION: Not using Object.is because we know our snapshots will never
1715
+ // be exotic primitive values like NaN, which is !== itself.
1716
+ n !== t() && (Ne = !0, globalThis.__DEV__ !== !1 && b.error(68));
1717
+ var i = w.useState({
1718
+ inst: { value: n, getSnapshot: t }
1719
+ }), o = i[0].inst, a = i[1];
1720
+ return Ft ? w.useLayoutEffect(function() {
1721
+ Object.assign(o, { value: n, getSnapshot: t }), X(o) && a({ inst: o });
1722
+ }, [e, n, t]) : Object.assign(o, { value: n, getSnapshot: t }), w.useEffect(function() {
1723
+ return X(o) && a({ inst: o }), e(function() {
1724
+ X(o) && a({ inst: o });
1725
+ });
1726
+ }, [e]), n;
1727
+ };
1728
+ function X(e) {
1729
+ var t = e.value, r = e.getSnapshot;
1730
+ try {
1731
+ return t !== r();
1732
+ } catch {
1733
+ return !0;
1734
+ }
1735
+ }
1736
+ var k;
1737
+ (function(e) {
1738
+ e[e.Query = 0] = "Query", e[e.Mutation = 1] = "Mutation", e[e.Subscription = 2] = "Subscription";
1739
+ })(k || (k = {}));
1740
+ var D;
1741
+ function ze(e) {
1742
+ var t;
1743
+ switch (e) {
1744
+ case k.Query:
1745
+ t = "Query";
1746
+ break;
1747
+ case k.Mutation:
1748
+ t = "Mutation";
1749
+ break;
1750
+ case k.Subscription:
1751
+ t = "Subscription";
1752
+ break;
1753
+ }
1754
+ return t;
1755
+ }
1756
+ function lt(e) {
1757
+ D || (D = new Nt(
1758
+ Ye.parser || 1e3
1759
+ /* defaultCacheSizes.parser */
1760
+ ));
1761
+ var t = D.get(e);
1762
+ if (t)
1763
+ return t;
1764
+ var r, n, i;
1765
+ b(!!e && !!e.kind, 70, e);
1766
+ for (var o = [], a = [], s = [], u = [], c = 0, f = e.definitions; c < f.length; c++) {
1767
+ var l = f[c];
1768
+ if (l.kind === "FragmentDefinition") {
1769
+ o.push(l);
1770
+ continue;
1771
+ }
1772
+ if (l.kind === "OperationDefinition")
1773
+ switch (l.operation) {
1774
+ case "query":
1775
+ a.push(l);
1776
+ break;
1777
+ case "mutation":
1778
+ s.push(l);
1779
+ break;
1780
+ case "subscription":
1781
+ u.push(l);
1782
+ break;
1783
+ }
1784
+ }
1785
+ b(!o.length || a.length || s.length || u.length, 71), b(
1786
+ a.length + s.length + u.length <= 1,
1787
+ 72,
1788
+ e,
1789
+ a.length,
1790
+ u.length,
1791
+ s.length
1792
+ ), n = a.length ? k.Query : k.Mutation, !a.length && !s.length && (n = k.Subscription);
1793
+ var h = a.length ? a : s.length ? s : u;
1794
+ b(h.length === 1, 73, e, h.length);
1795
+ var y = h[0];
1796
+ r = y.variableDefinitions || [], y.name && y.name.kind === "Name" ? i = y.name.value : i = "data";
1797
+ var v = { name: i, type: n, variables: r };
1798
+ return D.set(e, v), v;
1799
+ }
1800
+ lt.resetCache = function() {
1801
+ D = void 0;
1802
+ };
1803
+ globalThis.__DEV__ !== !1 && Xe("parser", function() {
1804
+ return D ? D.size : 0;
1805
+ });
1806
+ function jr(e, t) {
1807
+ var r = lt(e), n = ze(t), i = ze(r.type);
1808
+ b(
1809
+ r.type === t,
1810
+ 74,
1811
+ n,
1812
+ n,
1813
+ i
1814
+ );
1815
+ }
1816
+ var Tr = Symbol.for("apollo.hook.wrappers");
1817
+ function xr(e, t, r) {
1818
+ var n = r.queryManager, i = n && n[Tr], o = i && i[e];
1819
+ return o ? o(t) : t;
1820
+ }
1821
+ var Mr = Object.prototype.hasOwnProperty;
1822
+ function Le() {
1823
+ }
1824
+ var U = Symbol();
1825
+ function Xr(e, t) {
1826
+ return t === void 0 && (t = /* @__PURE__ */ Object.create(null)), xr(
1827
+ "useQuery",
1828
+ // eslint-disable-next-line react-compiler/react-compiler
1829
+ Rr,
1830
+ ft(t && t.client)
1831
+ )(e, t);
1832
+ }
1833
+ function Rr(e, t) {
1834
+ var r = Qr(e, t), n = r.result, i = r.obsQueryFields;
1835
+ return w.useMemo(function() {
1836
+ return p(p({}, n), i);
1837
+ }, [n, i]);
1838
+ }
1839
+ function Cr(e, t, r, n, i) {
1840
+ function o(l) {
1841
+ var h;
1842
+ jr(t, k.Query);
1843
+ var y = {
1844
+ client: e,
1845
+ query: t,
1846
+ observable: (
1847
+ // See if there is an existing observable that was used to fetch the same
1848
+ // data and if so, use it instead since it will contain the proper queryId
1849
+ // to fetch the result set. This is used during SSR.
1850
+ n && n.getSSRObservable(i()) || st.inactiveOnCreation.withValue(!n, function() {
1851
+ return e.watchQuery(ht(void 0, e, r, i()));
1852
+ })
1853
+ ),
1854
+ resultData: {
1855
+ // Reuse previousData from previous InternalState (if any) to provide
1856
+ // continuity of previousData even if/when the query or client changes.
1857
+ previousData: (h = l?.resultData.current) === null || h === void 0 ? void 0 : h.data
1858
+ }
1859
+ };
1860
+ return y;
1861
+ }
1862
+ var a = w.useState(o), s = a[0], u = a[1];
1863
+ function c(l) {
1864
+ var h, y;
1865
+ Object.assign(s.observable, (h = {}, h[U] = l, h));
1866
+ var v = s.resultData;
1867
+ u(p(p({}, s), {
1868
+ // might be a different query
1869
+ query: l.query,
1870
+ resultData: Object.assign(v, {
1871
+ // We need to modify the previous `resultData` object as we rely on the
1872
+ // object reference in other places
1873
+ previousData: ((y = v.current) === null || y === void 0 ? void 0 : y.data) || v.previousData,
1874
+ current: void 0
1875
+ })
1876
+ }));
1877
+ }
1878
+ if (e !== s.client || t !== s.query) {
1879
+ var f = o(s);
1880
+ return u(f), [f, c];
1881
+ }
1882
+ return [s, c];
1883
+ }
1884
+ function Qr(e, t) {
1885
+ var r = ft(t.client), n = w.useContext(ct()).renderPromises, i = !!n, o = r.disableNetworkFetches, a = t.ssr !== !1 && !t.skip, s = t.partialRefetch, u = Lr(r, e, t, i), c = Cr(r, e, t, n, u), f = c[0], l = f.observable, h = f.resultData, y = c[1], v = u(l);
1886
+ zr(
1887
+ h,
1888
+ // might get mutated during render
1889
+ l,
1890
+ // might get mutated during render
1891
+ r,
1892
+ t,
1893
+ v
1894
+ );
1895
+ var E = w.useMemo(function() {
1896
+ return $r(l);
1897
+ }, [l]);
1898
+ Nr(l, n, a);
1899
+ var S = Ar(h, l, r, t, v, o, s, i, {
1900
+ onCompleted: t.onCompleted || Le,
1901
+ onError: t.onError || Le
1902
+ });
1903
+ return {
1904
+ result: S,
1905
+ obsQueryFields: E,
1906
+ observable: l,
1907
+ resultData: h,
1908
+ client: r,
1909
+ onQueryExecuted: y
1910
+ };
1911
+ }
1912
+ function Ar(e, t, r, n, i, o, a, s, u) {
1913
+ var c = w.useRef(u);
1914
+ w.useEffect(function() {
1915
+ c.current = u;
1916
+ });
1917
+ var f = (s || o) && n.ssr === !1 && !n.skip ? (
1918
+ // If SSR has been explicitly disabled, and this function has been called
1919
+ // on the server side, return the default loading state.
1920
+ yt
1921
+ ) : n.skip || i.fetchPolicy === "standby" ? (
1922
+ // When skipping a query (ie. we're not querying for data but still want to
1923
+ // render children), make sure the `data` is cleared out and `loading` is
1924
+ // set to `false` (since we aren't loading anything).
1925
+ //
1926
+ // NOTE: We no longer think this is the correct behavior. Skipping should
1927
+ // not automatically set `data` to `undefined`, but instead leave the
1928
+ // previous data in place. In other words, skipping should not mandate that
1929
+ // previously received data is all of a sudden removed. Unfortunately,
1930
+ // changing this is breaking, so we'll have to wait until Apollo Client 4.0
1931
+ // to address this.
1932
+ vt
1933
+ ) : void 0, l = e.previousData, h = w.useMemo(function() {
1934
+ return f && pt(f, l, t, r);
1935
+ }, [r, t, f, l]);
1936
+ return Fr(w.useCallback(function(y) {
1937
+ if (s)
1938
+ return function() {
1939
+ };
1940
+ var v = function() {
1941
+ var d = e.current, _ = t.getCurrentResult();
1942
+ d && d.loading === _.loading && d.networkStatus === _.networkStatus && O(d.data, _.data) || ue(_, e, t, r, a, y, c.current);
1943
+ }, E = function(d) {
1944
+ if (S.current.unsubscribe(), S.current = t.resubscribeAfterError(v, E), !Mr.call(d, "graphQLErrors"))
1945
+ throw d;
1946
+ var _ = e.current;
1947
+ (!_ || _ && _.loading || !O(d, _.error)) && ue({
1948
+ data: _ && _.data,
1949
+ error: d,
1950
+ loading: !1,
1951
+ networkStatus: g.error
1952
+ }, e, t, r, a, y, c.current);
1953
+ }, S = { current: t.subscribe(v, E) };
1954
+ return function() {
1955
+ setTimeout(function() {
1956
+ return S.current.unsubscribe();
1957
+ });
1958
+ };
1959
+ }, [
1960
+ o,
1961
+ s,
1962
+ t,
1963
+ e,
1964
+ a,
1965
+ r
1966
+ ]), function() {
1967
+ return h || Ve(e, t, c.current, a, r);
1968
+ }, function() {
1969
+ return h || Ve(e, t, c.current, a, r);
1970
+ });
1971
+ }
1972
+ function Nr(e, t, r) {
1973
+ t && r && (t.registerSSRObservable(e), e.getCurrentResult().loading && t.addObservableQueryPromise(e));
1974
+ }
1975
+ function zr(e, t, r, n, i) {
1976
+ var o;
1977
+ t[U] && !O(t[U], i) && (t.reobserve(ht(t, r, n, i)), e.previousData = ((o = e.current) === null || o === void 0 ? void 0 : o.data) || e.previousData, e.current = void 0), t[U] = i;
1978
+ }
1979
+ function Lr(e, t, r, n) {
1980
+ r === void 0 && (r = {});
1981
+ var i = r.skip;
1982
+ r.ssr, r.onCompleted, r.onError;
1983
+ var o = r.defaultOptions, a = W(r, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
1984
+ return function(s) {
1985
+ var u = Object.assign(a, { query: t });
1986
+ return n && (u.fetchPolicy === "network-only" || u.fetchPolicy === "cache-and-network") && (u.fetchPolicy = "cache-first"), u.variables || (u.variables = {}), i ? (u.initialFetchPolicy = u.initialFetchPolicy || u.fetchPolicy || Ue(o, e.defaultOptions), u.fetchPolicy = "standby") : u.fetchPolicy || (u.fetchPolicy = s?.options.initialFetchPolicy || Ue(o, e.defaultOptions)), u;
1987
+ };
1988
+ }
1989
+ function ht(e, t, r, n) {
1990
+ var i = [], o = t.defaultOptions.watchQuery;
1991
+ return o && i.push(o), r.defaultOptions && i.push(r.defaultOptions), i.push(Q(e && e.options, n)), i.reduce(yr);
1992
+ }
1993
+ function ue(e, t, r, n, i, o, a) {
1994
+ var s = t.current;
1995
+ s && s.data && (t.previousData = s.data), !e.error && rt(e.errors) && (e.error = new ge({ graphQLErrors: e.errors })), t.current = pt(Wr(e, r, i), t.previousData, r, n), o(), Vr(e, s?.networkStatus, a);
1996
+ }
1997
+ function Vr(e, t, r) {
1998
+ if (!e.loading) {
1999
+ var n = Ur(e);
2000
+ Promise.resolve().then(function() {
2001
+ n ? r.onError(n) : e.data && t !== e.networkStatus && e.networkStatus === g.ready && r.onCompleted(e.data);
2002
+ }).catch(function(i) {
2003
+ globalThis.__DEV__ !== !1 && b.warn(i);
2004
+ });
2005
+ }
2006
+ }
2007
+ function Ve(e, t, r, n, i) {
2008
+ return e.current || ue(t.getCurrentResult(), e, t, i, n, function() {
2009
+ }, r), e.current;
2010
+ }
2011
+ function Ue(e, t) {
2012
+ var r;
2013
+ return e?.fetchPolicy || ((r = t?.watchQuery) === null || r === void 0 ? void 0 : r.fetchPolicy) || "cache-first";
2014
+ }
2015
+ function Ur(e) {
2016
+ return rt(e.errors) ? new ge({ graphQLErrors: e.errors }) : e.error;
2017
+ }
2018
+ function pt(e, t, r, n) {
2019
+ var i = e.data;
2020
+ e.partial;
2021
+ var o = W(e, ["data", "partial"]), a = p(p({ data: i }, o), { client: n, observable: r, variables: r.variables, called: e !== yt && e !== vt, previousData: t });
2022
+ return a;
2023
+ }
2024
+ function Wr(e, t, r) {
2025
+ return e.partial && r && !e.loading && (!e.data || Object.keys(e.data).length === 0) && t.options.fetchPolicy !== "cache-only" ? (t.refetch(), p(p({}, e), { loading: !0, networkStatus: g.refetch })) : e;
2026
+ }
2027
+ var yt = at({
2028
+ loading: !0,
2029
+ data: void 0,
2030
+ error: void 0,
2031
+ networkStatus: g.loading
2032
+ }), vt = at({
2033
+ loading: !1,
2034
+ data: void 0,
2035
+ error: void 0,
2036
+ networkStatus: g.ready
2037
+ });
2038
+ function $r(e) {
2039
+ return {
2040
+ refetch: e.refetch.bind(e),
2041
+ reobserve: e.reobserve.bind(e),
2042
+ fetchMore: e.fetchMore.bind(e),
2043
+ updateQuery: e.updateQuery.bind(e),
2044
+ startPolling: e.startPolling.bind(e),
2045
+ stopPolling: e.stopPolling.bind(e),
2046
+ subscribeToMore: e.subscribeToMore.bind(e)
2047
+ };
2048
+ }
2049
+ export {
2050
+ ge as A,
2051
+ k as D,
2052
+ p as _,
2053
+ Qr as a,
2054
+ ht as b,
2055
+ Lr as c,
2056
+ Dt as d,
2057
+ ft as e,
2058
+ O as f,
2059
+ Ue as g,
2060
+ yr as m,
2061
+ w as r,
2062
+ pt as t,
2063
+ Xr as u,
2064
+ jr as v
2065
+ };