@noxickon/onyx 0.0.4-dev.6 → 0.0.4-dev.8

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.
@@ -0,0 +1,1482 @@
1
+ import { a as C, b as It, _ as y } from "./tslib.es6-ci7D5hcx.js";
2
+ import { i as m, A as Tt, c as Qt, r as Mt, n as vt, a as K, b as xt, e as _, d as N, f as Rt, g as H, R as Ct, h as P, j as jt, u as pt, k as Vt, m as At, v as Lt, D as zt } from "./index-CPwC_oqh.js";
3
+ function Nt(e, r) {
4
+ var t = e.directives;
5
+ return !t || !t.length ? !0 : Ut(t).every(function(n) {
6
+ var i = n.directive, o = n.ifArgument, a = !1;
7
+ return o.value.kind === "Variable" ? (a = r && r[o.value.name.value], m(a !== void 0, 78, i.name.value)) : a = o.value.value, i.name.value === "skip" ? !a : a;
8
+ });
9
+ }
10
+ function Wt(e) {
11
+ var r = e.name.value;
12
+ return r === "skip" || r === "include";
13
+ }
14
+ function Ut(e) {
15
+ var r = [];
16
+ return e && e.length && e.forEach(function(t) {
17
+ if (Wt(t)) {
18
+ var n = t.arguments, i = t.name.value;
19
+ m(n && n.length === 1, 79, i);
20
+ var o = n[0];
21
+ m(o.name && o.name.value === "if", 80, i);
22
+ var a = o.value;
23
+ m(a && (a.kind === "Variable" || a.kind === "BooleanValue"), 81, i), r.push({ directive: t, ifArgument: o });
24
+ }
25
+ }), r;
26
+ }
27
+ function Bt(e) {
28
+ e === void 0 && (e = []);
29
+ var r = {};
30
+ return e.forEach(function(t) {
31
+ r[t.name.value] = t;
32
+ }), r;
33
+ }
34
+ function Gt(e, r) {
35
+ switch (e.kind) {
36
+ case "InlineFragment":
37
+ return e;
38
+ case "FragmentSpread": {
39
+ var t = e.name.value;
40
+ if (typeof r == "function")
41
+ return r(t);
42
+ var n = r && r[t];
43
+ return m(n, 87, t), n || null;
44
+ }
45
+ default:
46
+ return null;
47
+ }
48
+ }
49
+ var dt = Object.assign(function(r) {
50
+ return JSON.stringify(r, Ht);
51
+ }, {
52
+ reset: function() {
53
+ D = new Tt(
54
+ Qt.canonicalStringify || 1e3
55
+ /* defaultCacheSizes.canonicalStringify */
56
+ );
57
+ }
58
+ });
59
+ globalThis.__DEV__ !== !1 && Mt("canonicalStringify", function() {
60
+ return D.size;
61
+ });
62
+ var D;
63
+ dt.reset();
64
+ function Ht(e, r) {
65
+ if (r && typeof r == "object") {
66
+ var t = Object.getPrototypeOf(r);
67
+ if (t === Object.prototype || t === null) {
68
+ var n = Object.keys(r);
69
+ if (n.every(Jt))
70
+ return r;
71
+ var i = JSON.stringify(n), o = D.get(i);
72
+ if (!o) {
73
+ n.sort();
74
+ var a = JSON.stringify(n);
75
+ o = D.get(a) || n, D.set(i, o), D.set(a, o);
76
+ }
77
+ var u = Object.create(t);
78
+ return o.forEach(function(s) {
79
+ u[s] = r[s];
80
+ }), u;
81
+ }
82
+ }
83
+ return r;
84
+ }
85
+ function Jt(e, r, t) {
86
+ return r === 0 || t[r - 1] <= e;
87
+ }
88
+ var $t = [
89
+ "connection",
90
+ "include",
91
+ "skip",
92
+ "client",
93
+ "rest",
94
+ "export",
95
+ "nonreactive"
96
+ ], I = dt;
97
+ Object.assign(function(e, r, t) {
98
+ if (r && t && t.connection && t.connection.key)
99
+ if (t.connection.filter && t.connection.filter.length > 0) {
100
+ var n = t.connection.filter ? t.connection.filter : [];
101
+ n.sort();
102
+ var i = {};
103
+ return n.forEach(function(u) {
104
+ i[u] = r[u];
105
+ }), "".concat(t.connection.key, "(").concat(I(i), ")");
106
+ } else
107
+ return t.connection.key;
108
+ var o = e;
109
+ if (r) {
110
+ var a = I(r);
111
+ o += "(".concat(a, ")");
112
+ }
113
+ return t && Object.keys(t).forEach(function(u) {
114
+ $t.indexOf(u) === -1 && (t[u] && Object.keys(t[u]).length ? o += "@".concat(u, "(").concat(I(t[u]), ")") : o += "@".concat(u));
115
+ }), o;
116
+ }, {
117
+ setStringify: function(e) {
118
+ var r = I;
119
+ return I = e, r;
120
+ }
121
+ });
122
+ function Xt(e) {
123
+ return e.alias ? e.alias.value : e.name.value;
124
+ }
125
+ function Yt(e) {
126
+ return e.kind === "Field";
127
+ }
128
+ function bt(e) {
129
+ m(e && e.kind === "Document", 88);
130
+ var r = e.definitions.filter(function(t) {
131
+ return t.kind !== "FragmentDefinition";
132
+ }).map(function(t) {
133
+ if (t.kind !== "OperationDefinition")
134
+ throw vt(89, t.kind);
135
+ return t;
136
+ });
137
+ return m(r.length <= 1, 90, r.length), e;
138
+ }
139
+ function gt(e) {
140
+ return bt(e), e.definitions.filter(function(r) {
141
+ return r.kind === "OperationDefinition";
142
+ })[0];
143
+ }
144
+ function Zt(e) {
145
+ return e.definitions.filter(function(r) {
146
+ return r.kind === "FragmentDefinition";
147
+ });
148
+ }
149
+ function Kt(e) {
150
+ var r = gt(e);
151
+ return m(r && r.operation === "query", 91), r;
152
+ }
153
+ function te(e) {
154
+ bt(e);
155
+ for (var r, t = 0, n = e.definitions; t < n.length; t++) {
156
+ var i = n[t];
157
+ if (i.kind === "OperationDefinition") {
158
+ var o = i.operation;
159
+ if (o === "query" || o === "mutation" || o === "subscription")
160
+ return i;
161
+ }
162
+ i.kind === "FragmentDefinition" && !r && (r = i);
163
+ }
164
+ if (r)
165
+ return r;
166
+ throw vt(95);
167
+ }
168
+ let g = null;
169
+ const tt = {};
170
+ let ee = 1;
171
+ const re = () => class {
172
+ constructor() {
173
+ this.id = [
174
+ "slot",
175
+ ee++,
176
+ Date.now(),
177
+ Math.random().toString(36).slice(2)
178
+ ].join(":");
179
+ }
180
+ hasValue() {
181
+ for (let r = g; r; r = r.parent)
182
+ if (this.id in r.slots) {
183
+ const t = r.slots[this.id];
184
+ if (t === tt)
185
+ break;
186
+ return r !== g && (g.slots[this.id] = t), !0;
187
+ }
188
+ return g && (g.slots[this.id] = tt), !1;
189
+ }
190
+ getValue() {
191
+ if (this.hasValue())
192
+ return g.slots[this.id];
193
+ }
194
+ withValue(r, t, n, i) {
195
+ const o = {
196
+ __proto__: null,
197
+ [this.id]: r
198
+ }, a = g;
199
+ g = { parent: a, slots: o };
200
+ try {
201
+ return t.apply(i, n);
202
+ } finally {
203
+ g = a;
204
+ }
205
+ }
206
+ // Capture the current context and wrap a callback function so that it
207
+ // reestablishes the captured context when called.
208
+ static bind(r) {
209
+ const t = g;
210
+ return function() {
211
+ const n = g;
212
+ try {
213
+ return g = t, r.apply(this, arguments);
214
+ } finally {
215
+ g = n;
216
+ }
217
+ };
218
+ }
219
+ // Immediately run a callback function without any captured context.
220
+ static noContext(r, t, n) {
221
+ if (g) {
222
+ const i = g;
223
+ try {
224
+ return g = null, r.apply(n, t);
225
+ } finally {
226
+ g = i;
227
+ }
228
+ } else
229
+ return r.apply(n, t);
230
+ }
231
+ };
232
+ function et(e) {
233
+ try {
234
+ return e();
235
+ } catch {
236
+ }
237
+ }
238
+ const V = "@wry/context:Slot", ne = (
239
+ // Prefer globalThis when available.
240
+ // https://github.com/benjamn/wryware/issues/347
241
+ et(() => globalThis) || // Fall back to global, which works in Node.js and may be converted by some
242
+ // bundlers to the appropriate identifier (window, self, ...) depending on the
243
+ // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224
244
+ et(() => global) || // Otherwise, use a dummy host that's local to this module. We used to fall
245
+ // back to using the Array constructor as a namespace, but that was flagged in
246
+ // https://github.com/benjamn/wryware/issues/347, and can be avoided.
247
+ /* @__PURE__ */ Object.create(null)
248
+ ), rt = ne, J = rt[V] || // Earlier versions of this package stored the globalKey property on the Array
249
+ // constructor, so we check there as well, to prevent Slot class duplication.
250
+ Array[V] || function(e) {
251
+ try {
252
+ Object.defineProperty(rt, V, {
253
+ value: e,
254
+ enumerable: !1,
255
+ writable: !1,
256
+ // When it was possible for globalHost to be the Array constructor (a
257
+ // legacy Slot dedup strategy), it was important for the property to be
258
+ // configurable:true so it could be deleted. That does not seem to be as
259
+ // important when globalHost is the global object, but I don't want to
260
+ // cause similar problems again, and configurable:true seems safest.
261
+ // https://github.com/endojs/endo/issues/576#issuecomment-1178274008
262
+ configurable: !0
263
+ });
264
+ } finally {
265
+ return e;
266
+ }
267
+ }(re()), { bind: Ue, noContext: Be } = J;
268
+ new J();
269
+ function mt(e) {
270
+ return Array.isArray(e) && e.length > 0;
271
+ }
272
+ function ie(e, r) {
273
+ var t = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
274
+ if (t) return (t = t.call(e)).next.bind(t);
275
+ if (Array.isArray(e) || (t = oe(e)) || r) {
276
+ t && (e = t);
277
+ var n = 0;
278
+ return function() {
279
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
280
+ };
281
+ }
282
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
283
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
284
+ }
285
+ function oe(e, r) {
286
+ if (e) {
287
+ if (typeof e == "string") return nt(e, r);
288
+ var t = Object.prototype.toString.call(e).slice(8, -1);
289
+ if (t === "Object" && e.constructor && (t = e.constructor.name), t === "Map" || t === "Set") return Array.from(e);
290
+ if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return nt(e, r);
291
+ }
292
+ }
293
+ function nt(e, r) {
294
+ (r == null || r > e.length) && (r = e.length);
295
+ for (var t = 0, n = new Array(r); t < r; t++)
296
+ n[t] = e[t];
297
+ return n;
298
+ }
299
+ function it(e, r) {
300
+ for (var t = 0; t < r.length; t++) {
301
+ var n = r[t];
302
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
303
+ }
304
+ }
305
+ function $(e, r, t) {
306
+ return r && it(e.prototype, r), t && it(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
307
+ }
308
+ var X = function() {
309
+ return typeof Symbol == "function";
310
+ }, Y = function(e) {
311
+ return X() && !!Symbol[e];
312
+ }, Z = function(e) {
313
+ return Y(e) ? Symbol[e] : "@@" + e;
314
+ };
315
+ X() && !Y("observable") && (Symbol.observable = Symbol("observable"));
316
+ var ae = Z("iterator"), W = Z("observable"), wt = Z("species");
317
+ function j(e, r) {
318
+ var t = e[r];
319
+ if (t != null) {
320
+ if (typeof t != "function") throw new TypeError(t + " is not a function");
321
+ return t;
322
+ }
323
+ }
324
+ function T(e) {
325
+ var r = e.constructor;
326
+ return r !== void 0 && (r = r[wt], r === null && (r = void 0)), r !== void 0 ? r : k;
327
+ }
328
+ function ue(e) {
329
+ return e instanceof k;
330
+ }
331
+ function F(e) {
332
+ F.log ? F.log(e) : setTimeout(function() {
333
+ throw e;
334
+ });
335
+ }
336
+ function M(e) {
337
+ Promise.resolve().then(function() {
338
+ try {
339
+ e();
340
+ } catch (r) {
341
+ F(r);
342
+ }
343
+ });
344
+ }
345
+ function _t(e) {
346
+ var r = e._cleanup;
347
+ if (r !== void 0 && (e._cleanup = void 0, !!r))
348
+ try {
349
+ if (typeof r == "function")
350
+ r();
351
+ else {
352
+ var t = j(r, "unsubscribe");
353
+ t && t.call(r);
354
+ }
355
+ } catch (n) {
356
+ F(n);
357
+ }
358
+ }
359
+ function U(e) {
360
+ e._observer = void 0, e._queue = void 0, e._state = "closed";
361
+ }
362
+ function se(e) {
363
+ var r = e._queue;
364
+ if (r) {
365
+ e._queue = void 0, e._state = "ready";
366
+ for (var t = 0; t < r.length && (St(e, r[t].type, r[t].value), e._state !== "closed"); ++t)
367
+ ;
368
+ }
369
+ }
370
+ function St(e, r, t) {
371
+ e._state = "running";
372
+ var n = e._observer;
373
+ try {
374
+ var i = j(n, r);
375
+ switch (r) {
376
+ case "next":
377
+ i && i.call(n, t);
378
+ break;
379
+ case "error":
380
+ if (U(e), i) i.call(n, t);
381
+ else throw t;
382
+ break;
383
+ case "complete":
384
+ U(e), i && i.call(n);
385
+ break;
386
+ }
387
+ } catch (o) {
388
+ F(o);
389
+ }
390
+ e._state === "closed" ? _t(e) : e._state === "running" && (e._state = "ready");
391
+ }
392
+ function A(e, r, t) {
393
+ if (e._state !== "closed") {
394
+ if (e._state === "buffering") {
395
+ e._queue.push({
396
+ type: r,
397
+ value: t
398
+ });
399
+ return;
400
+ }
401
+ if (e._state !== "ready") {
402
+ e._state = "buffering", e._queue = [{
403
+ type: r,
404
+ value: t
405
+ }], M(function() {
406
+ return se(e);
407
+ });
408
+ return;
409
+ }
410
+ St(e, r, t);
411
+ }
412
+ }
413
+ var ce = /* @__PURE__ */ function() {
414
+ function e(t, n) {
415
+ this._cleanup = void 0, this._observer = t, this._queue = void 0, this._state = "initializing";
416
+ var i = new fe(this);
417
+ try {
418
+ this._cleanup = n.call(void 0, i);
419
+ } catch (o) {
420
+ i.error(o);
421
+ }
422
+ this._state === "initializing" && (this._state = "ready");
423
+ }
424
+ var r = e.prototype;
425
+ return r.unsubscribe = function() {
426
+ this._state !== "closed" && (U(this), _t(this));
427
+ }, $(e, [{
428
+ key: "closed",
429
+ get: function() {
430
+ return this._state === "closed";
431
+ }
432
+ }]), e;
433
+ }(), fe = /* @__PURE__ */ function() {
434
+ function e(t) {
435
+ this._subscription = t;
436
+ }
437
+ var r = e.prototype;
438
+ return r.next = function(n) {
439
+ A(this._subscription, "next", n);
440
+ }, r.error = function(n) {
441
+ A(this._subscription, "error", n);
442
+ }, r.complete = function() {
443
+ A(this._subscription, "complete");
444
+ }, $(e, [{
445
+ key: "closed",
446
+ get: function() {
447
+ return this._subscription._state === "closed";
448
+ }
449
+ }]), e;
450
+ }(), k = /* @__PURE__ */ function() {
451
+ function e(t) {
452
+ if (!(this instanceof e)) throw new TypeError("Observable cannot be called as a function");
453
+ if (typeof t != "function") throw new TypeError("Observable initializer must be a function");
454
+ this._subscriber = t;
455
+ }
456
+ var r = e.prototype;
457
+ return r.subscribe = function(n) {
458
+ return (typeof n != "object" || n === null) && (n = {
459
+ next: n,
460
+ error: arguments[1],
461
+ complete: arguments[2]
462
+ }), new ce(n, this._subscriber);
463
+ }, r.forEach = function(n) {
464
+ var i = this;
465
+ return new Promise(function(o, a) {
466
+ if (typeof n != "function") {
467
+ a(new TypeError(n + " is not a function"));
468
+ return;
469
+ }
470
+ function u() {
471
+ s.unsubscribe(), o();
472
+ }
473
+ var s = i.subscribe({
474
+ next: function(c) {
475
+ try {
476
+ n(c, u);
477
+ } catch (f) {
478
+ a(f), s.unsubscribe();
479
+ }
480
+ },
481
+ error: a,
482
+ complete: o
483
+ });
484
+ });
485
+ }, r.map = function(n) {
486
+ var i = this;
487
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
488
+ var o = T(this);
489
+ return new o(function(a) {
490
+ return i.subscribe({
491
+ next: function(u) {
492
+ try {
493
+ u = n(u);
494
+ } catch (s) {
495
+ return a.error(s);
496
+ }
497
+ a.next(u);
498
+ },
499
+ error: function(u) {
500
+ a.error(u);
501
+ },
502
+ complete: function() {
503
+ a.complete();
504
+ }
505
+ });
506
+ });
507
+ }, r.filter = function(n) {
508
+ var i = this;
509
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
510
+ var o = T(this);
511
+ return new o(function(a) {
512
+ return i.subscribe({
513
+ next: function(u) {
514
+ try {
515
+ if (!n(u)) return;
516
+ } catch (s) {
517
+ return a.error(s);
518
+ }
519
+ a.next(u);
520
+ },
521
+ error: function(u) {
522
+ a.error(u);
523
+ },
524
+ complete: function() {
525
+ a.complete();
526
+ }
527
+ });
528
+ });
529
+ }, r.reduce = function(n) {
530
+ var i = this;
531
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
532
+ var o = T(this), a = arguments.length > 1, u = !1, s = arguments[1], c = s;
533
+ return new o(function(f) {
534
+ return i.subscribe({
535
+ next: function(l) {
536
+ var h = !u;
537
+ if (u = !0, !h || a)
538
+ try {
539
+ c = n(c, l);
540
+ } catch (v) {
541
+ return f.error(v);
542
+ }
543
+ else
544
+ c = l;
545
+ },
546
+ error: function(l) {
547
+ f.error(l);
548
+ },
549
+ complete: function() {
550
+ if (!u && !a) return f.error(new TypeError("Cannot reduce an empty sequence"));
551
+ f.next(c), f.complete();
552
+ }
553
+ });
554
+ });
555
+ }, r.concat = function() {
556
+ for (var n = this, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
557
+ o[a] = arguments[a];
558
+ var u = T(this);
559
+ return new u(function(s) {
560
+ var c, f = 0;
561
+ function l(h) {
562
+ c = h.subscribe({
563
+ next: function(v) {
564
+ s.next(v);
565
+ },
566
+ error: function(v) {
567
+ s.error(v);
568
+ },
569
+ complete: function() {
570
+ f === o.length ? (c = void 0, s.complete()) : l(u.from(o[f++]));
571
+ }
572
+ });
573
+ }
574
+ return l(n), function() {
575
+ c && (c.unsubscribe(), c = void 0);
576
+ };
577
+ });
578
+ }, r.flatMap = function(n) {
579
+ var i = this;
580
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
581
+ var o = T(this);
582
+ return new o(function(a) {
583
+ var u = [], s = i.subscribe({
584
+ next: function(f) {
585
+ if (n)
586
+ try {
587
+ f = n(f);
588
+ } catch (h) {
589
+ return a.error(h);
590
+ }
591
+ var l = o.from(f).subscribe({
592
+ next: function(h) {
593
+ a.next(h);
594
+ },
595
+ error: function(h) {
596
+ a.error(h);
597
+ },
598
+ complete: function() {
599
+ var h = u.indexOf(l);
600
+ h >= 0 && u.splice(h, 1), c();
601
+ }
602
+ });
603
+ u.push(l);
604
+ },
605
+ error: function(f) {
606
+ a.error(f);
607
+ },
608
+ complete: function() {
609
+ c();
610
+ }
611
+ });
612
+ function c() {
613
+ s.closed && u.length === 0 && a.complete();
614
+ }
615
+ return function() {
616
+ u.forEach(function(f) {
617
+ return f.unsubscribe();
618
+ }), s.unsubscribe();
619
+ };
620
+ });
621
+ }, r[W] = function() {
622
+ return this;
623
+ }, e.from = function(n) {
624
+ var i = typeof this == "function" ? this : e;
625
+ if (n == null) throw new TypeError(n + " is not an object");
626
+ var o = j(n, W);
627
+ if (o) {
628
+ var a = o.call(n);
629
+ if (Object(a) !== a) throw new TypeError(a + " is not an object");
630
+ return ue(a) && a.constructor === i ? a : new i(function(u) {
631
+ return a.subscribe(u);
632
+ });
633
+ }
634
+ if (Y("iterator") && (o = j(n, ae), o))
635
+ return new i(function(u) {
636
+ M(function() {
637
+ if (!u.closed) {
638
+ for (var s = ie(o.call(n)), c; !(c = s()).done; ) {
639
+ var f = c.value;
640
+ if (u.next(f), u.closed) return;
641
+ }
642
+ u.complete();
643
+ }
644
+ });
645
+ });
646
+ if (Array.isArray(n))
647
+ return new i(function(u) {
648
+ M(function() {
649
+ if (!u.closed) {
650
+ for (var s = 0; s < n.length; ++s)
651
+ if (u.next(n[s]), u.closed) return;
652
+ u.complete();
653
+ }
654
+ });
655
+ });
656
+ throw new TypeError(n + " is not observable");
657
+ }, e.of = function() {
658
+ for (var n = arguments.length, i = new Array(n), o = 0; o < n; o++)
659
+ i[o] = arguments[o];
660
+ var a = typeof this == "function" ? this : e;
661
+ return new a(function(u) {
662
+ M(function() {
663
+ if (!u.closed) {
664
+ for (var s = 0; s < i.length; ++s)
665
+ if (u.next(i[s]), u.closed) return;
666
+ u.complete();
667
+ }
668
+ });
669
+ });
670
+ }, $(e, null, [{
671
+ key: wt,
672
+ get: function() {
673
+ return this;
674
+ }
675
+ }]), e;
676
+ }();
677
+ X() && Object.defineProperty(k, Symbol("extensions"), {
678
+ value: {
679
+ symbol: W,
680
+ hostReportError: F
681
+ },
682
+ configurable: !0
683
+ });
684
+ function le(e) {
685
+ var r, t = e.Symbol;
686
+ if (typeof t == "function")
687
+ if (t.observable)
688
+ r = t.observable;
689
+ else {
690
+ typeof t.for == "function" ? r = t.for("https://github.com/benlesh/symbol-observable") : r = t("https://github.com/benlesh/symbol-observable");
691
+ try {
692
+ t.observable = r;
693
+ } catch {
694
+ }
695
+ }
696
+ else
697
+ r = "@@observable";
698
+ return r;
699
+ }
700
+ var E;
701
+ typeof self < "u" ? E = self : typeof window < "u" ? E = window : typeof global < "u" ? E = global : typeof module < "u" ? E = module : E = Function("return this")();
702
+ le(E);
703
+ var ot = k.prototype, at = "@@observable";
704
+ ot[at] || (ot[at] = function() {
705
+ return this;
706
+ });
707
+ function he(e) {
708
+ return e.catch(function() {
709
+ }), e;
710
+ }
711
+ var ye = Object.prototype.toString;
712
+ function ve(e) {
713
+ return B(e);
714
+ }
715
+ function B(e, r) {
716
+ switch (ye.call(e)) {
717
+ case "[object Array]": {
718
+ if (r = r || /* @__PURE__ */ new Map(), r.has(e))
719
+ return r.get(e);
720
+ var t = e.slice(0);
721
+ return r.set(e, t), t.forEach(function(i, o) {
722
+ t[o] = B(i, r);
723
+ }), t;
724
+ }
725
+ case "[object Object]": {
726
+ if (r = r || /* @__PURE__ */ new Map(), r.has(e))
727
+ return r.get(e);
728
+ var n = Object.create(Object.getPrototypeOf(e));
729
+ return r.set(e, n), Object.keys(e).forEach(function(i) {
730
+ n[i] = B(e[i], r);
731
+ }), n;
732
+ }
733
+ default:
734
+ return e;
735
+ }
736
+ }
737
+ function pe(e) {
738
+ var r = /* @__PURE__ */ new Set([e]);
739
+ return r.forEach(function(t) {
740
+ K(t) && de(t) === t && Object.getOwnPropertyNames(t).forEach(function(n) {
741
+ K(t[n]) && r.add(t[n]);
742
+ });
743
+ }), e;
744
+ }
745
+ function de(e) {
746
+ if (globalThis.__DEV__ !== !1 && !Object.isFrozen(e))
747
+ try {
748
+ Object.freeze(e);
749
+ } catch (r) {
750
+ if (r instanceof TypeError)
751
+ return null;
752
+ throw r;
753
+ }
754
+ return e;
755
+ }
756
+ function Ot(e) {
757
+ return globalThis.__DEV__ !== !1 && pe(e), e;
758
+ }
759
+ function ut(e, r, t) {
760
+ var n = [];
761
+ e.forEach(function(i) {
762
+ return i[r] && n.push(i);
763
+ }), n.forEach(function(i) {
764
+ return i[r](t);
765
+ });
766
+ }
767
+ function be(e) {
768
+ function r(t) {
769
+ Object.defineProperty(e, t, { value: k });
770
+ }
771
+ return xt && Symbol.species && r(Symbol.species), r("@@species"), e;
772
+ }
773
+ function ge(e, r, t, n) {
774
+ var i = r.data, o = C(r, ["data"]), a = t.data, u = C(t, ["data"]);
775
+ return _(o, u) && x(te(e).selectionSet, i, a, {
776
+ fragmentMap: Bt(Zt(e)),
777
+ variables: n
778
+ });
779
+ }
780
+ function x(e, r, t, n) {
781
+ if (r === t)
782
+ return !0;
783
+ var i = /* @__PURE__ */ new Set();
784
+ return e.selections.every(function(o) {
785
+ if (i.has(o) || (i.add(o), !Nt(o, n.variables)) || st(o))
786
+ return !0;
787
+ if (Yt(o)) {
788
+ var a = Xt(o), u = r && r[a], s = t && t[a], c = o.selectionSet;
789
+ if (!c)
790
+ return _(u, s);
791
+ var f = Array.isArray(u), l = Array.isArray(s);
792
+ if (f !== l)
793
+ return !1;
794
+ if (f && l) {
795
+ var h = u.length;
796
+ if (s.length !== h)
797
+ return !1;
798
+ for (var v = 0; v < h; ++v)
799
+ if (!x(c, u[v], s[v], n))
800
+ return !1;
801
+ return !0;
802
+ }
803
+ return x(c, u, s, n);
804
+ } else {
805
+ var p = Gt(o, n.fragmentMap);
806
+ if (p)
807
+ return st(p) ? !0 : x(
808
+ p.selectionSet,
809
+ // Notice that we reuse the same aResult and bResult values here,
810
+ // since the fragment ...spread does not specify a field name, but
811
+ // consists of multiple fields (within the fragment's selection set)
812
+ // that should be applied to the current result value(s).
813
+ r,
814
+ t,
815
+ n
816
+ );
817
+ }
818
+ });
819
+ }
820
+ function st(e) {
821
+ return !!e.directives && e.directives.some(me);
822
+ }
823
+ function me(e) {
824
+ return e.name.value === "nonreactive";
825
+ }
826
+ var b;
827
+ (function(e) {
828
+ 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";
829
+ })(b || (b = {}));
830
+ function Q(e) {
831
+ return e ? e < 7 : !1;
832
+ }
833
+ var ct = Object.assign, we = Object.hasOwnProperty, Pt = (
834
+ /** @class */
835
+ function(e) {
836
+ It(r, e);
837
+ function r(t) {
838
+ var n = t.queryManager, i = t.queryInfo, o = t.options, a = this, u = r.inactiveOnCreation.getValue();
839
+ a = e.call(this, function(d) {
840
+ u && (n.queries.set(a.queryId, i), u = !1);
841
+ try {
842
+ var w = d._subscription._observer;
843
+ w && !w.error && (w.error = _e);
844
+ } catch {
845
+ }
846
+ var kt = !a.observers.size;
847
+ a.observers.add(d);
848
+ var q = a.last;
849
+ return q && q.error ? d.error && d.error(q.error) : q && q.result && d.next && d.next(a.maskResult(q.result)), kt && a.reobserve().catch(function() {
850
+ }), function() {
851
+ a.observers.delete(d) && !a.observers.size && a.tearDownQuery();
852
+ };
853
+ }) || this, a.observers = /* @__PURE__ */ new Set(), a.subscriptions = /* @__PURE__ */ new Set(), a.dirty = !1, a.queryInfo = i, a.queryManager = n, a.waitForOwnResult = L(o.fetchPolicy), a.isTornDown = !1, a.subscribeToMore = a.subscribeToMore.bind(a), a.maskResult = a.maskResult.bind(a);
854
+ var s = n.defaultOptions.watchQuery, c = s === void 0 ? {} : s, f = c.fetchPolicy, l = f === void 0 ? "cache-first" : f, h = o.fetchPolicy, v = h === void 0 ? l : h, p = o.initialFetchPolicy, O = p === void 0 ? v === "standby" ? l : v : p;
855
+ a.options = y(y({}, o), {
856
+ // Remember the initial options.fetchPolicy so we can revert back to this
857
+ // policy when variables change. This information can also be specified
858
+ // (or overridden) by providing options.initialFetchPolicy explicitly.
859
+ initialFetchPolicy: O,
860
+ // This ensures this.options.fetchPolicy always has a string value, in
861
+ // case options.fetchPolicy was not provided.
862
+ fetchPolicy: v
863
+ }), a.queryId = i.queryId || n.generateQueryId();
864
+ var S = gt(a.query);
865
+ return a.queryName = S && S.name && S.name.value, a;
866
+ }
867
+ return Object.defineProperty(r.prototype, "query", {
868
+ // The `query` computed property will always reflect the document transformed
869
+ // by the last run query. `this.options.query` will always reflect the raw
870
+ // untransformed query to ensure document transforms with runtime conditionals
871
+ // are run on the original document.
872
+ get: function() {
873
+ return this.lastQuery || this.options.query;
874
+ },
875
+ enumerable: !1,
876
+ configurable: !0
877
+ }), Object.defineProperty(r.prototype, "variables", {
878
+ // Computed shorthand for this.options.variables, preserved for
879
+ // backwards compatibility.
880
+ /**
881
+ * An object containing the variables that were provided for the query.
882
+ */
883
+ get: function() {
884
+ return this.options.variables;
885
+ },
886
+ enumerable: !1,
887
+ configurable: !0
888
+ }), r.prototype.result = function() {
889
+ var t = this;
890
+ return new Promise(function(n, i) {
891
+ var o = {
892
+ next: function(u) {
893
+ n(u), t.observers.delete(o), t.observers.size || t.queryManager.removeQuery(t.queryId), setTimeout(function() {
894
+ a.unsubscribe();
895
+ }, 0);
896
+ },
897
+ error: i
898
+ }, a = t.subscribe(o);
899
+ });
900
+ }, r.prototype.resetDiff = function() {
901
+ this.queryInfo.resetDiff();
902
+ }, r.prototype.getCurrentFullResult = function(t) {
903
+ t === void 0 && (t = !0);
904
+ var n = this.getLastResult(!0), i = this.queryInfo.networkStatus || n && n.networkStatus || b.ready, o = y(y({}, n), { loading: Q(i), networkStatus: i }), a = this.options.fetchPolicy, u = a === void 0 ? "cache-first" : a;
905
+ if (
906
+ // These fetch policies should never deliver data from the cache, unless
907
+ // redelivering a previously delivered result.
908
+ !(L(u) || // If this.options.query has @client(always: true) fields, we cannot
909
+ // trust diff.result, since it was read from the cache without running
910
+ // local resolvers (and it's too late to run resolvers now, since we must
911
+ // return a result synchronously).
912
+ this.queryManager.getDocumentInfo(this.query).hasForcedResolvers)
913
+ ) if (this.waitForOwnResult)
914
+ this.queryInfo.updateWatch();
915
+ else {
916
+ var s = this.queryInfo.getDiff();
917
+ (s.complete || this.options.returnPartialData) && (o.data = s.result), _(o.data, {}) && (o.data = void 0), s.complete ? (delete o.partial, s.complete && o.networkStatus === b.loading && (u === "cache-first" || u === "cache-only") && (o.networkStatus = b.ready, o.loading = !1)) : o.partial = !0, o.networkStatus === b.ready && (o.error || o.errors) && (o.networkStatus = b.error), globalThis.__DEV__ !== !1 && !s.complete && !this.options.partialRefetch && !o.loading && !o.data && !o.error && Se(s.missing);
918
+ }
919
+ return t && this.updateLastResult(o), o;
920
+ }, r.prototype.getCurrentResult = function(t) {
921
+ return t === void 0 && (t = !0), this.maskResult(this.getCurrentFullResult(t));
922
+ }, r.prototype.isDifferentFromLastResult = function(t, n) {
923
+ if (!this.last)
924
+ return !0;
925
+ var i = this.queryManager.getDocumentInfo(this.query), o = this.queryManager.dataMasking, a = o ? i.nonReactiveQuery : this.query, u = o || i.hasNonreactiveDirective ? !ge(a, this.last.result, t, this.variables) : !_(this.last.result, t);
926
+ return u || n && !_(this.last.variables, n);
927
+ }, r.prototype.getLast = function(t, n) {
928
+ var i = this.last;
929
+ if (i && i[t] && (!n || _(i.variables, this.variables)))
930
+ return i[t];
931
+ }, r.prototype.getLastResult = function(t) {
932
+ return this.getLast("result", t);
933
+ }, r.prototype.getLastError = function(t) {
934
+ return this.getLast("error", t);
935
+ }, r.prototype.resetLastResults = function() {
936
+ delete this.last, this.isTornDown = !1;
937
+ }, r.prototype.resetQueryStoreErrors = function() {
938
+ this.queryManager.resetErrors(this.queryId);
939
+ }, r.prototype.refetch = function(t) {
940
+ var n, i = {
941
+ // Always disable polling for refetches.
942
+ pollInterval: 0
943
+ }, o = this.options.fetchPolicy;
944
+ if (o === "no-cache" ? i.fetchPolicy = "no-cache" : i.fetchPolicy = "network-only", globalThis.__DEV__ !== !1 && t && we.call(t, "variables")) {
945
+ var a = Kt(this.query), u = a.variableDefinitions;
946
+ (!u || !u.some(function(s) {
947
+ return s.variable.name.value === "variables";
948
+ })) && globalThis.__DEV__ !== !1 && m.warn(
949
+ 21,
950
+ t,
951
+ ((n = a.name) === null || n === void 0 ? void 0 : n.value) || a
952
+ );
953
+ }
954
+ return t && !_(this.options.variables, t) && (i.variables = this.options.variables = y(y({}, this.options.variables), t)), this.queryInfo.resetLastWrite(), this.reobserve(i, b.refetch);
955
+ }, r.prototype.fetchMore = function(t) {
956
+ var n = this, i = y(y({}, t.query ? t : y(y(y(y({}, this.options), { query: this.options.query }), t), { variables: y(y({}, this.options.variables), t.variables) })), {
957
+ // The fetchMore request goes immediately to the network and does
958
+ // not automatically write its result to the cache (hence no-cache
959
+ // instead of network-only), because we allow the caller of
960
+ // fetchMore to provide an updateQuery callback that determines how
961
+ // the data gets written to the cache.
962
+ fetchPolicy: "no-cache"
963
+ });
964
+ i.query = this.transformDocument(i.query);
965
+ var o = this.queryManager.generateQueryId();
966
+ this.lastQuery = t.query ? this.transformDocument(this.options.query) : i.query;
967
+ var a = this.queryInfo, u = a.networkStatus;
968
+ a.networkStatus = b.fetchMore, i.notifyOnNetworkStatusChange && this.observe();
969
+ var s = /* @__PURE__ */ new Set(), c = t?.updateQuery, f = this.options.fetchPolicy !== "no-cache";
970
+ return f || m(c, 22), this.queryManager.fetchQuery(o, i, b.fetchMore).then(function(l) {
971
+ if (n.queryManager.removeQuery(o), a.networkStatus === b.fetchMore && (a.networkStatus = u), f)
972
+ n.queryManager.cache.batch({
973
+ update: function(p) {
974
+ var O = t.updateQuery;
975
+ O ? p.updateQuery({
976
+ query: n.query,
977
+ variables: n.variables,
978
+ returnPartialData: !0,
979
+ optimistic: !1
980
+ }, function(S) {
981
+ return O(S, {
982
+ fetchMoreResult: l.data,
983
+ variables: i.variables
984
+ });
985
+ }) : p.writeQuery({
986
+ query: i.query,
987
+ variables: i.variables,
988
+ data: l.data
989
+ });
990
+ },
991
+ onWatchUpdated: function(p) {
992
+ s.add(p.query);
993
+ }
994
+ });
995
+ else {
996
+ var h = n.getLast("result"), v = c(h.data, {
997
+ fetchMoreResult: l.data,
998
+ variables: i.variables
999
+ });
1000
+ n.reportResult(y(y({}, h), { networkStatus: u, loading: Q(u), data: v }), n.variables);
1001
+ }
1002
+ return n.maskResult(l);
1003
+ }).finally(function() {
1004
+ f && !s.has(n.query) && n.reobserveCacheFirst();
1005
+ });
1006
+ }, r.prototype.subscribeToMore = function(t) {
1007
+ var n = this, i = this.queryManager.startGraphQLSubscription({
1008
+ query: t.document,
1009
+ variables: t.variables,
1010
+ context: t.context
1011
+ }).subscribe({
1012
+ next: function(o) {
1013
+ var a = t.updateQuery;
1014
+ a && n.updateQuery(function(u, s) {
1015
+ return a(u, y({ subscriptionData: o }, s));
1016
+ });
1017
+ },
1018
+ error: function(o) {
1019
+ if (t.onError) {
1020
+ t.onError(o);
1021
+ return;
1022
+ }
1023
+ globalThis.__DEV__ !== !1 && m.error(23, o);
1024
+ }
1025
+ });
1026
+ return this.subscriptions.add(i), function() {
1027
+ n.subscriptions.delete(i) && i.unsubscribe();
1028
+ };
1029
+ }, r.prototype.setOptions = function(t) {
1030
+ return this.reobserve(t);
1031
+ }, r.prototype.silentSetOptions = function(t) {
1032
+ var n = N(this.options, t || {});
1033
+ ct(this.options, n);
1034
+ }, r.prototype.setVariables = function(t) {
1035
+ return _(this.variables, t) ? this.observers.size ? this.result() : Promise.resolve() : (this.options.variables = t, this.observers.size ? this.reobserve({
1036
+ // Reset options.fetchPolicy to its original value.
1037
+ fetchPolicy: this.options.initialFetchPolicy,
1038
+ variables: t
1039
+ }, b.setVariables) : Promise.resolve());
1040
+ }, r.prototype.updateQuery = function(t) {
1041
+ var n = this.queryManager, i = n.cache.diff({
1042
+ query: this.options.query,
1043
+ variables: this.variables,
1044
+ returnPartialData: !0,
1045
+ optimistic: !1
1046
+ }), o = i.result, a = i.complete, u = t(o, {
1047
+ variables: this.variables,
1048
+ complete: !!a,
1049
+ previousData: o
1050
+ });
1051
+ u && (n.cache.writeQuery({
1052
+ query: this.options.query,
1053
+ data: u,
1054
+ variables: this.variables
1055
+ }), n.broadcastQueries());
1056
+ }, r.prototype.startPolling = function(t) {
1057
+ this.options.pollInterval = t, this.updatePolling();
1058
+ }, r.prototype.stopPolling = function() {
1059
+ this.options.pollInterval = 0, this.updatePolling();
1060
+ }, r.prototype.applyNextFetchPolicy = function(t, n) {
1061
+ if (n.nextFetchPolicy) {
1062
+ var i = n.fetchPolicy, o = i === void 0 ? "cache-first" : i, a = n.initialFetchPolicy, u = a === void 0 ? o : a;
1063
+ o === "standby" || (typeof n.nextFetchPolicy == "function" ? n.fetchPolicy = n.nextFetchPolicy(o, {
1064
+ reason: t,
1065
+ options: n,
1066
+ observable: this,
1067
+ initialFetchPolicy: u
1068
+ }) : t === "variables-changed" ? n.fetchPolicy = u : n.fetchPolicy = n.nextFetchPolicy);
1069
+ }
1070
+ return n.fetchPolicy;
1071
+ }, r.prototype.fetch = function(t, n, i) {
1072
+ var o = this.queryManager.getOrCreateQuery(this.queryId);
1073
+ return o.setObservableQuery(this), this.queryManager.fetchConcastWithInfo(o, t, n, i);
1074
+ }, r.prototype.updatePolling = function() {
1075
+ var t = this;
1076
+ if (!this.queryManager.ssrMode) {
1077
+ var n = this, i = n.pollingInfo, o = n.options.pollInterval;
1078
+ if (!o || !this.hasObservers()) {
1079
+ i && (clearTimeout(i.timeout), delete this.pollingInfo);
1080
+ return;
1081
+ }
1082
+ if (!(i && i.interval === o)) {
1083
+ m(o, 24);
1084
+ var a = i || (this.pollingInfo = {});
1085
+ a.interval = o;
1086
+ var u = function() {
1087
+ var c, f;
1088
+ t.pollingInfo && (!Q(t.queryInfo.networkStatus) && !(!((f = (c = t.options).skipPollAttempt) === null || f === void 0) && f.call(c)) ? t.reobserve({
1089
+ // Most fetchPolicy options don't make sense to use in a polling context, as
1090
+ // users wouldn't want to be polling the cache directly. However, network-only and
1091
+ // no-cache are both useful for when the user wants to control whether or not the
1092
+ // polled results are written to the cache.
1093
+ fetchPolicy: t.options.initialFetchPolicy === "no-cache" ? "no-cache" : "network-only"
1094
+ }, b.poll).then(s, s) : s());
1095
+ }, s = function() {
1096
+ var c = t.pollingInfo;
1097
+ c && (clearTimeout(c.timeout), c.timeout = setTimeout(u, c.interval));
1098
+ };
1099
+ s();
1100
+ }
1101
+ }
1102
+ }, r.prototype.updateLastResult = function(t, n) {
1103
+ n === void 0 && (n = this.variables);
1104
+ var i = this.getLastError();
1105
+ return i && this.last && !_(n, this.last.variables) && (i = void 0), this.last = y({ result: this.queryManager.assumeImmutableResults ? t : ve(t), variables: n }, i ? { error: i } : null);
1106
+ }, r.prototype.reobserveAsConcast = function(t, n) {
1107
+ var i = this;
1108
+ this.isTornDown = !1;
1109
+ var o = (
1110
+ // Refetching uses a disposable Concast to allow refetches using different
1111
+ // options/variables, without permanently altering the options of the
1112
+ // original ObservableQuery.
1113
+ n === b.refetch || // The fetchMore method does not actually call the reobserve method, but,
1114
+ // if it did, it would definitely use a disposable Concast.
1115
+ n === b.fetchMore || // Polling uses a disposable Concast so the polling options (which force
1116
+ // fetchPolicy to be "network-only" or "no-cache") won't override the original options.
1117
+ n === b.poll
1118
+ ), a = this.options.variables, u = this.options.fetchPolicy, s = N(this.options, t || {}), c = o ? (
1119
+ // Disposable Concast fetches receive a shallow copy of this.options
1120
+ // (merged with newOptions), leaving this.options unmodified.
1121
+ s
1122
+ ) : ct(this.options, s), f = this.transformDocument(c.query);
1123
+ this.lastQuery = f, o || (this.updatePolling(), t && t.variables && !_(t.variables, a) && // Don't mess with the fetchPolicy if it's currently "standby".
1124
+ c.fetchPolicy !== "standby" && // If we're changing the fetchPolicy anyway, don't try to change it here
1125
+ // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.
1126
+ (c.fetchPolicy === u || // A `nextFetchPolicy` function has even higher priority, though,
1127
+ // so in that case `applyNextFetchPolicy` must be called.
1128
+ typeof c.nextFetchPolicy == "function") && (this.applyNextFetchPolicy("variables-changed", c), n === void 0 && (n = b.setVariables))), this.waitForOwnResult && (this.waitForOwnResult = L(c.fetchPolicy));
1129
+ var l = function() {
1130
+ i.concast === p && (i.waitForOwnResult = !1);
1131
+ }, h = c.variables && y({}, c.variables), v = this.fetch(c, n, f), p = v.concast, O = v.fromLink, S = {
1132
+ next: function(d) {
1133
+ _(i.variables, h) && (l(), i.reportResult(d, h));
1134
+ },
1135
+ error: function(d) {
1136
+ _(i.variables, h) && (Rt(d) || (d = new H({ networkError: d })), l(), i.reportError(d, h));
1137
+ }
1138
+ };
1139
+ return !o && (O || !this.concast) && (this.concast && this.observer && this.concast.removeObserver(this.observer), this.concast = p, this.observer = S), p.addObserver(S), p;
1140
+ }, r.prototype.reobserve = function(t, n) {
1141
+ return he(this.reobserveAsConcast(t, n).promise.then(this.maskResult));
1142
+ }, r.prototype.resubscribeAfterError = function() {
1143
+ for (var t = [], n = 0; n < arguments.length; n++)
1144
+ t[n] = arguments[n];
1145
+ var i = this.last;
1146
+ this.resetLastResults();
1147
+ var o = this.subscribe.apply(this, t);
1148
+ return this.last = i, o;
1149
+ }, r.prototype.observe = function() {
1150
+ this.reportResult(
1151
+ // Passing false is important so that this.getCurrentResult doesn't
1152
+ // save the fetchMore result as this.lastResult, causing it to be
1153
+ // ignored due to the this.isDifferentFromLastResult check in
1154
+ // this.reportResult.
1155
+ this.getCurrentFullResult(!1),
1156
+ this.variables
1157
+ );
1158
+ }, r.prototype.reportResult = function(t, n) {
1159
+ var i = this.getLastError(), o = this.isDifferentFromLastResult(t, n);
1160
+ (i || !t.partial || this.options.returnPartialData) && this.updateLastResult(t, n), (i || o) && ut(this.observers, "next", this.maskResult(t));
1161
+ }, r.prototype.reportError = function(t, n) {
1162
+ var i = y(y({}, this.getLastResult()), { error: t, errors: t.graphQLErrors, networkStatus: b.error, loading: !1 });
1163
+ this.updateLastResult(i, n), ut(this.observers, "error", this.last.error = t);
1164
+ }, r.prototype.hasObservers = function() {
1165
+ return this.observers.size > 0;
1166
+ }, r.prototype.tearDownQuery = function() {
1167
+ this.isTornDown || (this.concast && this.observer && (this.concast.removeObserver(this.observer), delete this.concast, delete this.observer), this.stopPolling(), this.subscriptions.forEach(function(t) {
1168
+ return t.unsubscribe();
1169
+ }), this.subscriptions.clear(), this.queryManager.stopQuery(this.queryId), this.observers.clear(), this.isTornDown = !0);
1170
+ }, r.prototype.transformDocument = function(t) {
1171
+ return this.queryManager.transform(t);
1172
+ }, r.prototype.maskResult = function(t) {
1173
+ return t && "data" in t ? y(y({}, t), { data: this.queryManager.maskOperation({
1174
+ document: this.query,
1175
+ data: t.data,
1176
+ fetchPolicy: this.options.fetchPolicy,
1177
+ id: this.queryId
1178
+ }) }) : t;
1179
+ }, r.prototype.resetNotifications = function() {
1180
+ this.cancelNotifyTimeout(), this.dirty = !1;
1181
+ }, r.prototype.cancelNotifyTimeout = function() {
1182
+ this.notifyTimeout && (clearTimeout(this.notifyTimeout), this.notifyTimeout = void 0);
1183
+ }, r.prototype.scheduleNotify = function() {
1184
+ var t = this;
1185
+ this.dirty || (this.dirty = !0, this.notifyTimeout || (this.notifyTimeout = setTimeout(function() {
1186
+ return t.notify();
1187
+ }, 0)));
1188
+ }, r.prototype.notify = function() {
1189
+ if (this.cancelNotifyTimeout(), this.dirty && (this.options.fetchPolicy == "cache-only" || this.options.fetchPolicy == "cache-and-network" || !Q(this.queryInfo.networkStatus))) {
1190
+ var t = this.queryInfo.getDiff();
1191
+ t.fromOptimisticTransaction ? this.observe() : this.reobserveCacheFirst();
1192
+ }
1193
+ this.dirty = !1;
1194
+ }, r.prototype.reobserveCacheFirst = function() {
1195
+ var t = this.options, n = t.fetchPolicy, i = t.nextFetchPolicy;
1196
+ return n === "cache-and-network" || n === "network-only" ? this.reobserve({
1197
+ fetchPolicy: "cache-first",
1198
+ // Use a temporary nextFetchPolicy function that replaces itself with the
1199
+ // previous nextFetchPolicy value and returns the original fetchPolicy.
1200
+ nextFetchPolicy: function(o, a) {
1201
+ return this.nextFetchPolicy = i, typeof this.nextFetchPolicy == "function" ? this.nextFetchPolicy(o, a) : n;
1202
+ }
1203
+ }) : this.reobserve();
1204
+ }, r.inactiveOnCreation = new J(), r;
1205
+ }(k)
1206
+ );
1207
+ be(Pt);
1208
+ function _e(e) {
1209
+ globalThis.__DEV__ !== !1 && m.error(25, e.message, e.stack);
1210
+ }
1211
+ function Se(e) {
1212
+ globalThis.__DEV__ !== !1 && e && globalThis.__DEV__ !== !1 && m.debug(26, e);
1213
+ }
1214
+ function L(e) {
1215
+ return e === "network-only" || e === "no-cache" || e === "standby";
1216
+ }
1217
+ var ft = !1, Oe = "useSyncExternalStore", Pe = Ct[Oe], qe = Pe || function(e, r, t) {
1218
+ var n = r();
1219
+ // DEVIATION: Using __DEV__
1220
+ globalThis.__DEV__ !== !1 && !ft && // DEVIATION: Not using Object.is because we know our snapshots will never
1221
+ // be exotic primitive values like NaN, which is !== itself.
1222
+ n !== r() && (ft = !0, globalThis.__DEV__ !== !1 && m.error(68));
1223
+ var i = P.useState({
1224
+ inst: { value: n, getSnapshot: r }
1225
+ }), o = i[0].inst, a = i[1];
1226
+ return jt ? P.useLayoutEffect(function() {
1227
+ Object.assign(o, { value: n, getSnapshot: r }), z(o) && a({ inst: o });
1228
+ }, [e, n, r]) : Object.assign(o, { value: n, getSnapshot: r }), P.useEffect(function() {
1229
+ return z(o) && a({ inst: o }), e(function() {
1230
+ z(o) && a({ inst: o });
1231
+ });
1232
+ }, [e]), n;
1233
+ };
1234
+ function z(e) {
1235
+ var r = e.value, t = e.getSnapshot;
1236
+ try {
1237
+ return r !== t();
1238
+ } catch {
1239
+ return !0;
1240
+ }
1241
+ }
1242
+ var Ee = Symbol.for("apollo.hook.wrappers");
1243
+ function De(e, r, t) {
1244
+ var n = t.queryManager, i = n && n[Ee], o = i && i[e];
1245
+ return o ? o(r) : r;
1246
+ }
1247
+ var Fe = Object.prototype.hasOwnProperty;
1248
+ function lt() {
1249
+ }
1250
+ var R = Symbol();
1251
+ function Ge(e, r) {
1252
+ return r === void 0 && (r = /* @__PURE__ */ Object.create(null)), De(
1253
+ "useQuery",
1254
+ // eslint-disable-next-line react-compiler/react-compiler
1255
+ ke,
1256
+ pt(r && r.client)
1257
+ )(e, r);
1258
+ }
1259
+ function ke(e, r) {
1260
+ var t = Te(e, r), n = t.result, i = t.obsQueryFields;
1261
+ return P.useMemo(function() {
1262
+ return y(y({}, n), i);
1263
+ }, [n, i]);
1264
+ }
1265
+ function Ie(e, r, t, n, i) {
1266
+ function o(l) {
1267
+ var h;
1268
+ Lt(r, zt.Query);
1269
+ var v = {
1270
+ client: e,
1271
+ query: r,
1272
+ observable: (
1273
+ // See if there is an existing observable that was used to fetch the same
1274
+ // data and if so, use it instead since it will contain the proper queryId
1275
+ // to fetch the result set. This is used during SSR.
1276
+ n && n.getSSRObservable(i()) || Pt.inactiveOnCreation.withValue(!n, function() {
1277
+ return e.watchQuery(qt(void 0, e, t, i()));
1278
+ })
1279
+ ),
1280
+ resultData: {
1281
+ // Reuse previousData from previous InternalState (if any) to provide
1282
+ // continuity of previousData even if/when the query or client changes.
1283
+ previousData: (h = l?.resultData.current) === null || h === void 0 ? void 0 : h.data
1284
+ }
1285
+ };
1286
+ return v;
1287
+ }
1288
+ var a = P.useState(o), u = a[0], s = a[1];
1289
+ function c(l) {
1290
+ var h, v;
1291
+ Object.assign(u.observable, (h = {}, h[R] = l, h));
1292
+ var p = u.resultData;
1293
+ s(y(y({}, u), {
1294
+ // might be a different query
1295
+ query: l.query,
1296
+ resultData: Object.assign(p, {
1297
+ // We need to modify the previous `resultData` object as we rely on the
1298
+ // object reference in other places
1299
+ previousData: ((v = p.current) === null || v === void 0 ? void 0 : v.data) || p.previousData,
1300
+ current: void 0
1301
+ })
1302
+ }));
1303
+ }
1304
+ if (e !== u.client || r !== u.query) {
1305
+ var f = o(u);
1306
+ return s(f), [f, c];
1307
+ }
1308
+ return [u, c];
1309
+ }
1310
+ function Te(e, r) {
1311
+ var t = pt(r.client), n = P.useContext(Vt()).renderPromises, i = !!n, o = t.disableNetworkFetches, a = r.ssr !== !1 && !r.skip, u = r.partialRefetch, s = Re(t, e, r, i), c = Ie(t, e, r, n, s), f = c[0], l = f.observable, h = f.resultData, v = c[1], p = s(l);
1312
+ xe(
1313
+ h,
1314
+ // might get mutated during render
1315
+ l,
1316
+ // might get mutated during render
1317
+ t,
1318
+ r,
1319
+ p
1320
+ );
1321
+ var O = P.useMemo(function() {
1322
+ return Ae(l);
1323
+ }, [l]);
1324
+ Me(l, n, a);
1325
+ var S = Qe(h, l, t, r, p, o, u, i, {
1326
+ onCompleted: r.onCompleted || lt,
1327
+ onError: r.onError || lt
1328
+ });
1329
+ return {
1330
+ result: S,
1331
+ obsQueryFields: O,
1332
+ observable: l,
1333
+ resultData: h,
1334
+ client: t,
1335
+ onQueryExecuted: v
1336
+ };
1337
+ }
1338
+ function Qe(e, r, t, n, i, o, a, u, s) {
1339
+ var c = P.useRef(s);
1340
+ P.useEffect(function() {
1341
+ c.current = s;
1342
+ });
1343
+ var f = (u || o) && n.ssr === !1 && !n.skip ? (
1344
+ // If SSR has been explicitly disabled, and this function has been called
1345
+ // on the server side, return the default loading state.
1346
+ Dt
1347
+ ) : n.skip || i.fetchPolicy === "standby" ? (
1348
+ // When skipping a query (ie. we're not querying for data but still want to
1349
+ // render children), make sure the `data` is cleared out and `loading` is
1350
+ // set to `false` (since we aren't loading anything).
1351
+ //
1352
+ // NOTE: We no longer think this is the correct behavior. Skipping should
1353
+ // not automatically set `data` to `undefined`, but instead leave the
1354
+ // previous data in place. In other words, skipping should not mandate that
1355
+ // previously received data is all of a sudden removed. Unfortunately,
1356
+ // changing this is breaking, so we'll have to wait until Apollo Client 4.0
1357
+ // to address this.
1358
+ Ft
1359
+ ) : void 0, l = e.previousData, h = P.useMemo(function() {
1360
+ return f && Et(f, l, r, t);
1361
+ }, [t, r, f, l]);
1362
+ return qe(P.useCallback(function(v) {
1363
+ if (u)
1364
+ return function() {
1365
+ };
1366
+ var p = function() {
1367
+ var d = e.current, w = r.getCurrentResult();
1368
+ d && d.loading === w.loading && d.networkStatus === w.networkStatus && _(d.data, w.data) || G(w, e, r, t, a, v, c.current);
1369
+ }, O = function(d) {
1370
+ if (S.current.unsubscribe(), S.current = r.resubscribeAfterError(p, O), !Fe.call(d, "graphQLErrors"))
1371
+ throw d;
1372
+ var w = e.current;
1373
+ (!w || w && w.loading || !_(d, w.error)) && G({
1374
+ data: w && w.data,
1375
+ error: d,
1376
+ loading: !1,
1377
+ networkStatus: b.error
1378
+ }, e, r, t, a, v, c.current);
1379
+ }, S = { current: r.subscribe(p, O) };
1380
+ return function() {
1381
+ setTimeout(function() {
1382
+ return S.current.unsubscribe();
1383
+ });
1384
+ };
1385
+ }, [
1386
+ o,
1387
+ u,
1388
+ r,
1389
+ e,
1390
+ a,
1391
+ t
1392
+ ]), function() {
1393
+ return h || ht(e, r, c.current, a, t);
1394
+ }, function() {
1395
+ return h || ht(e, r, c.current, a, t);
1396
+ });
1397
+ }
1398
+ function Me(e, r, t) {
1399
+ r && t && (r.registerSSRObservable(e), e.getCurrentResult().loading && r.addObservableQueryPromise(e));
1400
+ }
1401
+ function xe(e, r, t, n, i) {
1402
+ var o;
1403
+ r[R] && !_(r[R], i) && (r.reobserve(qt(r, t, n, i)), e.previousData = ((o = e.current) === null || o === void 0 ? void 0 : o.data) || e.previousData, e.current = void 0), r[R] = i;
1404
+ }
1405
+ function Re(e, r, t, n) {
1406
+ t === void 0 && (t = {});
1407
+ var i = t.skip;
1408
+ t.ssr, t.onCompleted, t.onError;
1409
+ var o = t.defaultOptions, a = C(t, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
1410
+ return function(u) {
1411
+ var s = Object.assign(a, { query: r });
1412
+ return n && (s.fetchPolicy === "network-only" || s.fetchPolicy === "cache-and-network") && (s.fetchPolicy = "cache-first"), s.variables || (s.variables = {}), i ? (s.initialFetchPolicy = s.initialFetchPolicy || s.fetchPolicy || yt(o, e.defaultOptions), s.fetchPolicy = "standby") : s.fetchPolicy || (s.fetchPolicy = u?.options.initialFetchPolicy || yt(o, e.defaultOptions)), s;
1413
+ };
1414
+ }
1415
+ function qt(e, r, t, n) {
1416
+ var i = [], o = r.defaultOptions.watchQuery;
1417
+ return o && i.push(o), t.defaultOptions && i.push(t.defaultOptions), i.push(N(e && e.options, n)), i.reduce(At);
1418
+ }
1419
+ function G(e, r, t, n, i, o, a) {
1420
+ var u = r.current;
1421
+ u && u.data && (r.previousData = u.data), !e.error && mt(e.errors) && (e.error = new H({ graphQLErrors: e.errors })), r.current = Et(Ve(e, t, i), r.previousData, t, n), o(), Ce(e, u?.networkStatus, a);
1422
+ }
1423
+ function Ce(e, r, t) {
1424
+ if (!e.loading) {
1425
+ var n = je(e);
1426
+ Promise.resolve().then(function() {
1427
+ n ? t.onError(n) : e.data && r !== e.networkStatus && e.networkStatus === b.ready && t.onCompleted(e.data);
1428
+ }).catch(function(i) {
1429
+ globalThis.__DEV__ !== !1 && m.warn(i);
1430
+ });
1431
+ }
1432
+ }
1433
+ function ht(e, r, t, n, i) {
1434
+ return e.current || G(r.getCurrentResult(), e, r, i, n, function() {
1435
+ }, t), e.current;
1436
+ }
1437
+ function yt(e, r) {
1438
+ var t;
1439
+ return e?.fetchPolicy || ((t = r?.watchQuery) === null || t === void 0 ? void 0 : t.fetchPolicy) || "cache-first";
1440
+ }
1441
+ function je(e) {
1442
+ return mt(e.errors) ? new H({ graphQLErrors: e.errors }) : e.error;
1443
+ }
1444
+ function Et(e, r, t, n) {
1445
+ var i = e.data;
1446
+ e.partial;
1447
+ var o = C(e, ["data", "partial"]), a = y(y({ data: i }, o), { client: n, observable: t, variables: t.variables, called: e !== Dt && e !== Ft, previousData: r });
1448
+ return a;
1449
+ }
1450
+ function Ve(e, r, t) {
1451
+ return e.partial && t && !e.loading && (!e.data || Object.keys(e.data).length === 0) && r.options.fetchPolicy !== "cache-only" ? (r.refetch(), y(y({}, e), { loading: !0, networkStatus: b.refetch })) : e;
1452
+ }
1453
+ var Dt = Ot({
1454
+ loading: !0,
1455
+ data: void 0,
1456
+ error: void 0,
1457
+ networkStatus: b.loading
1458
+ }), Ft = Ot({
1459
+ loading: !1,
1460
+ data: void 0,
1461
+ error: void 0,
1462
+ networkStatus: b.ready
1463
+ });
1464
+ function Ae(e) {
1465
+ return {
1466
+ refetch: e.refetch.bind(e),
1467
+ reobserve: e.reobserve.bind(e),
1468
+ fetchMore: e.fetchMore.bind(e),
1469
+ updateQuery: e.updateQuery.bind(e),
1470
+ startPolling: e.startPolling.bind(e),
1471
+ stopPolling: e.stopPolling.bind(e),
1472
+ subscribeToMore: e.subscribeToMore.bind(e)
1473
+ };
1474
+ }
1475
+ export {
1476
+ Te as a,
1477
+ qt as b,
1478
+ Re as c,
1479
+ yt as g,
1480
+ Et as t,
1481
+ Ge as u
1482
+ };